From patchwork Sun Sep 10 13:22:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 112152 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp2583558qgf; Sun, 10 Sep 2017 06:24:58 -0700 (PDT) X-Received: by 10.80.206.11 with SMTP id y11mr7264617edi.94.1505049898166; Sun, 10 Sep 2017 06:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505049898; cv=none; d=google.com; s=arc-20160816; b=OLs7yl4FkMVwPU68X3cx+wQDUUO9syuckOlVzTwezB7wlJuA9ft0b9shy/wqw6UKyQ LAU1zCqxFUq6WdVGRn70q6DSyUx7tEHGncUNXYxY9Q3CLFM5PEgBtJdVmGYKOh1TvE1u J6CC5bt726xmyzNbJTUl4nD52dMxXRKhEC870jW4gaOMBcPCsOcBUPPwKaJWT2McuBJF 7vNP5vAORjw3nCEFSbnTCUOiWOf/kejJG0a/0JynuB9ru936Cy8wHIxMFCCPEaiSkb03 Q11ijU7CJETGGloChFo4IBd46J2uOCCahggv4d5k4ohV1wKzqlO+PtWa6jRvMoVmCKgP ivug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:arc-authentication-results; bh=Rp+eM7vmWNV6+A2EHNMSjmoRFqhXldnA2YPDNWdZJ+Y=; b=E7SeVR+4wH+6G0ZwIZHA6T/KtlCe09H1QcG8geVt9r7JJJDdjsoDsSLd5QqPrZLO8d cnAkD2HtfheqoLn5a6XU7RV9moEAmxsmXBzoeArpi2IGXkMjvR7c69BaUpZuCc4e8JvH kuG7w3KB3ckc+X7JEPL0gRTbUNKUVh3HdD0WSHQb/pmxepVm3ukLE5PFqf6KXrMAtHOi pM5k5E//L5Lwx3WwsiQkVSkoaCkuT5F808YKeTerKJkGY2RktjvrnKl2LyuRTFXEgnHV c/E+OPX75/pXu1AfMPASG/77v551DjjP2IWcSYPKzVKwnvfYt4tWDbx4NjHLUNX6y8nZ A38A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=cnTj3IX4; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id w36si8005161edc.97.2017.09.10.06.24.57; Sun, 10 Sep 2017 06:24:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=cnTj3IX4; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: by lists.denx.de (Postfix, from userid 105) id B04A2C21F21; Sun, 10 Sep 2017 13:23:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id A5D56C21E40; Sun, 10 Sep 2017 13:23:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id F01B3C21DEB; Sun, 10 Sep 2017 13:22:50 +0000 (UTC) Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) by lists.denx.de (Postfix) with ESMTPS id ECC63C21EA9 for ; Sun, 10 Sep 2017 13:22:45 +0000 (UTC) Received: by mail-qt0-f196.google.com with SMTP id 7so4190460qtz.3 for ; Sun, 10 Sep 2017 06:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LemN/4krNFCT7o7M65iutcrbnjNiKuB/STSObMRxCqM=; b=cnTj3IX4hrwrtvNfIAGaggGHWgL57KskJNjNFw6tD2rMUYAvkYmYQJ/MHydIuswxjo 805l3L3TWDovdwtNEadVuYAfmQa2D7ARHaM99kGyK4T0prGZXhHG9anHSU966XjA/nrr BX9t33iCz6isTFT1iZp5i/qh0UFi9L9QIM6KAdaVFR0WjJOomHbIdaZ7b28DnbwH9mzd dxRNFF7qiUNDZKwP6vKGq4efgrXcLRft+XBpt8HKZL8wmoB2yljY61EjR3QCmtC5lwws deukzAZ5vl7JW/qXi0578xwpPkYVk7bEpaII2ODzEnaIzW8l8oaSW8oqsTmOT9xhLGXt nwTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LemN/4krNFCT7o7M65iutcrbnjNiKuB/STSObMRxCqM=; b=qic6I8l79oHzX9w0iORMWKgqrQtZ0dVEr9fzqr6QzgK26R+BbV2gaAqHcDPIRGYK+Y SFrku7TxyDoI41+MajSc8bH/GN1Hig7NZIzHtnI7u+SRRX0mrS7ia2JNw8/c1A4UlneV //mzR0vcKkn9IgAHAzy/ti449+jWik8RRu0Ylve1nPpuOdAX8DPXUpW9S5p28/Qbp4ze wPm75eYsAMzDOO1ZBZJlnVNXPyHOwqBvNi47gzoxtt+0b1LppPmR6WP886zNVQWQplAF suIBi2yAz9LqXVpxoIZOP7xTp+qN13AW/8MBig8qdaUxGXEC1tqDFw5z9JaDB0vLZI/U Lnhg== X-Gm-Message-State: AHPjjUikqU4EMJsP3ON4dqghDsDuJrk8BRnbynhN9TQ4WtUrhcoAlCml /gC3UmUk48V4ZNugUG8= X-Google-Smtp-Source: AOwi7QDMnsT27AC7mRHS7S8ysEDWpXaou6B9ratYeOw2y9Lpr/PhaUDZcM8qibQhMX+7VZhXJPGVUg== X-Received: by 10.200.26.123 with SMTP id q56mr5514604qtk.130.1505049764657; Sun, 10 Sep 2017 06:22:44 -0700 (PDT) Received: from localhost ([2601:184:4780:aac0:25f8:dd96:a084:785a]) by smtp.gmail.com with ESMTPSA id h58sm4438932qta.82.2017.09.10.06.22.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 10 Sep 2017 06:22:43 -0700 (PDT) From: Rob Clark To: U-Boot Mailing List Date: Sun, 10 Sep 2017 09:22:22 -0400 Message-Id: <20170910132236.14318-2-robdclark@gmail.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170910132236.14318-1-robdclark@gmail.com> References: <20170910132236.14318-1-robdclark@gmail.com> Cc: Heinrich Schuchardt , Peter Jones , Leif Lindholm Subject: [U-Boot] [PATCH v1 01/12] efi_loader: add stub EFI_DEVICE_PATH_UTILITIES_PROTOCOL X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Leif Lindholm Signed-off-by: Leif Lindholm --- include/efi_api.h | 30 +++++++++++ include/efi_loader.h | 2 + lib/efi_loader/Makefile | 1 + lib/efi_loader/efi_boottime.c | 4 ++ lib/efi_loader/efi_device_path_utilities.c | 83 ++++++++++++++++++++++++++++++ 5 files changed, 120 insertions(+) create mode 100644 lib/efi_loader/efi_device_path_utilities.c diff --git a/include/efi_api.h b/include/efi_api.h index c3b9032a48..57468dd972 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -506,6 +506,36 @@ struct efi_device_path_to_text_protocol bool allow_shortcuts); }; +#define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \ + EFI_GUID(0x0379be4e, 0xd706, 0x437d, \ + 0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4) + +struct efi_device_path_utilities_protocol +{ + UINTN(EFIAPI *get_device_path_size)( + const struct efi_device_path *device_path); + struct efi_device_path *(EFIAPI *duplicate_device_path)( + const struct efi_device_path *device_path); + struct efi_device_path *(EFIAPI *append_device_path)( + const struct efi_device_path *src1, + const struct efi_device_path *src2); + struct efi_device_path *(EFIAPI *append_device_node)( + const struct efi_device_path *device_path, + const struct efi_device_path *device_node); + struct efi_device_path *(EFIAPI *append_device_path_instance)( + const struct efi_device_path *device_path, + const struct efi_device_path *device_path_instance); + struct efi_device_path *(EFIAPI *get_next_device_path_instance)( + struct efi_device_path **device_path_instance, + UINTN *device_path_instance_size); + struct efi_device_path *(EFIAPI *create_device_node)( + uint8_t node_type, + uint8_t node_sub_type, + uint16_t node_length); + bool(EFIAPI *is_device_path_multi_instance)( + const struct efi_device_path *device_path); +}; + #define EFI_GOP_GUID \ EFI_GUID(0x9042a9de, 0x23dc, 0x4a38, \ 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a) diff --git a/include/efi_loader.h b/include/efi_loader.h index 43b12b94fa..c009828db9 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -58,6 +58,7 @@ extern const struct efi_simple_text_output_protocol efi_con_out; extern struct efi_simple_input_interface efi_con_in; extern const struct efi_console_control_protocol efi_console_control; extern const struct efi_device_path_to_text_protocol efi_device_path_to_text; +extern const struct efi_device_path_utilities_protocol efi_device_path_utilities; uint16_t *efi_dp_str(struct efi_device_path *dp); @@ -68,6 +69,7 @@ extern const efi_guid_t efi_guid_loaded_image; extern const efi_guid_t efi_guid_device_path_to_text_protocol; extern const efi_guid_t efi_simple_file_system_protocol_guid; extern const efi_guid_t efi_file_info_guid; +extern const efi_guid_t efi_guid_device_path_utilities_protocol; extern unsigned int __efi_runtime_start, __efi_runtime_stop; extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop; diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 930c0e218e..f5e69dd078 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -16,6 +16,7 @@ always := $(efiprogs-y) obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o obj-y += efi_memory.o efi_device_path_to_text.o efi_device_path.o +obj-y += efi_device_path_utilities.o obj-y += efi_file.o efi_variable.o efi_bootmgr.o obj-$(CONFIG_LCD) += efi_gop.o obj-$(CONFIG_DM_VIDEO) += efi_gop.o diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 3860feb79b..8bb243d673 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -775,6 +775,10 @@ void efi_setup_loaded_image(struct efi_loaded_image *info, struct efi_object *ob obj->protocols[3].protocol_interface = (void *)&efi_device_path_to_text; + obj->protocols[4].guid = &efi_guid_device_path_utilities_protocol; + obj->protocols[4].protocol_interface = + (void *)&efi_device_path_utilities; + info->file_path = file_path; info->device_handle = efi_dp_find_obj(device_path, NULL); diff --git a/lib/efi_loader/efi_device_path_utilities.c b/lib/efi_loader/efi_device_path_utilities.c new file mode 100644 index 0000000000..4b97080f35 --- /dev/null +++ b/lib/efi_loader/efi_device_path_utilities.c @@ -0,0 +1,83 @@ +/* + * EFI device path interface + * + * Copyright (c) 2017 Leif Lindholm + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include + +const efi_guid_t efi_guid_device_path_utilities_protocol = + EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID; + +static UINTN get_device_path_size(const struct efi_device_path *device_path) +{ + EFI_ENTRY("%p", device_path); + return EFI_EXIT(0); +} + +static struct efi_device_path *duplicate_device_path( + const struct efi_device_path *device_path) +{ + EFI_ENTRY("%p", device_path); + return EFI_EXIT(NULL); +} + +static struct efi_device_path *append_device_path( + const struct efi_device_path *src1, + const struct efi_device_path *src2) +{ + EFI_ENTRY("%p, %p", src1, src2); + return EFI_EXIT(NULL); +} + +static struct efi_device_path *append_device_node( + const struct efi_device_path *device_path, + const struct efi_device_path *device_node) +{ + EFI_ENTRY("%p, %p", device_path, device_node); + return EFI_EXIT(NULL); +} + +static struct efi_device_path *append_device_path_instance( + const struct efi_device_path *device_path, + const struct efi_device_path *device_path_instance) +{ + EFI_ENTRY("%p, %p", device_path, device_path_instance); + return EFI_EXIT(NULL); +} + +static struct efi_device_path *get_next_device_path_instance( + struct efi_device_path **device_path_instance, + UINTN *device_path_instance_size) +{ + EFI_ENTRY("%p, %p", device_path_instance, device_path_instance_size); + return EFI_EXIT(NULL); +} + +static struct efi_device_path *create_device_node( + uint8_t node_type, uint8_t node_sub_type, uint16_t node_length) +{ + EFI_ENTRY("%u, %u, %u", node_type, node_sub_type, node_length); + return EFI_EXIT(NULL); +} + +static bool is_device_path_multi_instance( + const struct efi_device_path *device_path) +{ + EFI_ENTRY("%p", device_path); + return EFI_EXIT(false); +} + +const struct efi_device_path_utilities_protocol efi_device_path_utilities = { + .get_device_path_size = get_device_path_size, + .duplicate_device_path = duplicate_device_path, + .append_device_path = append_device_path, + .append_device_node = append_device_node, + .append_device_path_instance = append_device_path_instance, + .get_next_device_path_instance = get_next_device_path_instance, + .create_device_node = create_device_node, + .is_device_path_multi_instance = is_device_path_multi_instance, +};