From patchwork Mon Apr 16 05:59:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 898471 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40Pd7t1hkpz9s0t for ; Mon, 16 Apr 2018 16:02:18 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id BDE8CC21DD7; Mon, 16 Apr 2018 06:00:38 +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.7 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_LOW 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 7D049C21DF9; Mon, 16 Apr 2018 05:59:24 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AB2E0C21C2C; Mon, 16 Apr 2018 05:59:19 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by lists.denx.de (Postfix) with ESMTPS id 24312C21D56 for ; Mon, 16 Apr 2018 05:59:19 +0000 (UTC) Received: from LPT2.fritz.box ([62.143.246.157]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0M3eDF-1eHdX53GEr-00rKSu; Mon, 16 Apr 2018 07:59:18 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Mon, 16 Apr 2018 07:59:05 +0200 Message-Id: <20180416055910.12611-4-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180416055910.12611-1-xypron.glpk@gmx.de> References: <20180416055910.12611-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K1:CTu+75nfKBZTONpSoLKNQj4w1elbfiPRFmy6cYIV9HwpHpSRa24 dBlW5QaQoO0fFyKj9eC34MTImTgNrcmR572JemPeRWMz3BrqHw/l5owVhF43Cc7w58cS1Bo uHQ32itjeCG4nHFQuD6BQWcCoPNp475OIVZU2ovVmimGSl08aPZvFWfR/e1uHxkdoyvBxJo y1NymjZHlGOmYnJKBeCOw== X-UI-Out-Filterresults: notjunk:1; V01:K0:l720/ZO0d6U=:gMZMljoe/8MnL5fFR/ZMUz rJpHyCbsZvM1Q7vhZkwWCvO5FNynGhtZM7ZyAKljwcR33XbaQccgQE9etqte+dxdvauM18bPt 6/vwHoA8UQiBGBJNjICbOsao3UxAs+e8/GEdVm9d+mw4W7IPO2JmGXHnaZ/zlR3ZyPFKKBUcU Cl1Z2ncB0Qxy0OZU8Pej8fhuHH5kwT+bXRjUizEdYekxQAo1gFNzYqxHI2nOwVxxpEzqywxyP N6PgAZkm4qz/3nlSoTyi4PYULqsHRX1g4c5kcQGEN0ApIDLzEM/i64xTpp54U31KI0p+TChev zeeN2KlRm2CzZX99Amv0PZQsxjrf8O5ZL5l6GKxDUj1+QtJWdzrybm8Jw5hkZ3lnXthVInoHW FXcfDu+ziygdp+kWYtBoO6fAPBK4zTdTPElPwX93VEsWPyEghKi3IBWihiJV4FbNsIHHuRC/M ZC3AFvK+tFoYQHgOjyaSjaCIZtXQPtIUwKNMrvnf22beKXMR5V7jumOqrmaaTsYtQU64Gqs/K Tp0faavOahfXRqmnW+UhFFEWLX9dCZYqjk5uHy4Y9v3e6DnPZm1dwjt3GAh2qAmL1eXaOpYX0 6MHO3qeuFK3UkZE+B0ytTkGbHzkI3qF9jTwa9R+5tft01L4hXWPZmxTTQWkGAn+LtDb5UG0CZ vXcS4dcwoJ0E01OsUPbNrcqkKYOAgpYUI84m7KM0vC/JTfMfQ4DNRgnPFetPSCoCP6BMaPYwI 2zXeOTRB1T2yKiZzGi5rr7zsCUqr4MM+zHr8B9hZk+2x6pxPzo/9AxtrCnBnLxpQ7TiIjIWxR VQfHL4Sz2QdGntOqcqZBusBmuQV5w== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v2 3/8] efi_loader: implement CreateDeviceNode 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" Implement the CreateDeviceNode service of the device path utility protocol. Signed-off-by: Heinrich Schuchardt --- v2 no change --- include/efi_loader.h | 5 ++++- lib/efi_loader/efi_device_path.c | 15 +++++++++++++++ lib/efi_loader/efi_device_path_utilities.c | 17 ++++++++++++++++- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index 17f9d3d1ef..0358bcb1d7 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -330,7 +330,10 @@ struct efi_device_path *efi_dp_append(const struct efi_device_path *dp1, const struct efi_device_path *dp2); struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp, const struct efi_device_path *node); - +/* Create a device path node of given type, sub-type, length */ +struct efi_device_path *efi_dp_create_device_node(const u8 type, + const u8 sub_type, + const u16 length); struct efi_device_path *efi_dp_from_dev(struct udevice *dev); struct efi_device_path *efi_dp_from_part(struct blk_desc *desc, int part); diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index ab28b2fd25..801c1558e5 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -315,6 +315,21 @@ struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp, return ret; } +struct efi_device_path *efi_dp_create_device_node(const u8 type, + const u8 sub_type, + const u16 length) +{ + struct efi_device_path *ret; + + ret = dp_alloc(length); + if (!ret) + return ret; + ret->type = type; + ret->sub_type = sub_type; + ret->length = length; + return ret; +} + #ifdef CONFIG_DM /* size of device-path not including END node for device and all parents * up to the root device. diff --git a/lib/efi_loader/efi_device_path_utilities.c b/lib/efi_loader/efi_device_path_utilities.c index bc97eeee31..e73188b242 100644 --- a/lib/efi_loader/efi_device_path_utilities.c +++ b/lib/efi_loader/efi_device_path_utilities.c @@ -70,11 +70,26 @@ static bool EFIAPI is_device_path_multi_instance( return EFI_EXIT(false); } +/* + * Create device node. + * + * This function implements the CreateDeviceNode service of the device path + * utilities protocol. + * + * See the Unified Extensible Firmware Interface (UEFI) specification + * for details. + * + * @node_type node type + * @node_sub_type node sub type + * @node_length node length + * @return device path node + */ static struct efi_device_path * EFIAPI 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); + return EFI_EXIT(efi_dp_create_device_node(node_type, node_sub_type, + node_length)); } const struct efi_device_path_utilities_protocol efi_device_path_utilities = {