From patchwork Sun Nov 26 13:05:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841378 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9Hd4QNmz9s3w for ; Mon, 27 Nov 2017 00:09:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 50AE5C21E41; Sun, 26 Nov 2017 13:07:59 +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_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL 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 6E804C21D8C; Sun, 26 Nov 2017 13:07:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DA42CC21DBB; Sun, 26 Nov 2017 13:06:56 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lists.denx.de (Postfix) with ESMTPS id 4DF51C21DA1 for ; Sun, 26 Nov 2017 13:06:53 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0Lp3sy-1eogUv1gvc-00eswo; Sun, 26 Nov 2017 14:06:41 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:06 +0100 Message-Id: <20171126130523.4993-2-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:5+YmDvknflcgw1SlF6S0OCs5+UpO45SL7YaB6G55Ox8SEG0JKq1 HPWOiyY3R9ZrvzQdUFUe/DM2RIcm2l7jG4JtohOR50UhkW/ocanZnjntWC5FMpCYg7W51YD IUgZSpLFRXWWBcyXcbxV1Xgqw7n/2BUBE8Cvxe0A5b+eQSQz6rm7C/R1Om1gc0Me/MIty2v SIeoI6xaje694rzAvZnTg== X-UI-Out-Filterresults: notjunk:1; V01:K0:h+46vuPV91Q=:+d7Kqs7lm0ae2DmJNvKwaO 5nlk4A177IlDKdZvmqVUnCKsyio3BT6++m53tvagzeviFV1aWIbE5k9btJX1K9eLVTrrpPrGm OQ/OBy8FMA90GoZAhrnz4qjx0iKT5GAVQOOtWMC6H2OJYY91aS8ylIQlJmGthwOy2QHRTEZe1 i6dGGfNFUfyxAA0qFaWurLLFXwzasQGeRd5RliE5I8sCT4AqRoGX4lyair4+Goy+hgmUVY49x BJsHIhwlR6H0dlqNbBFRx+++bGVCrYkQcuXN1z4JtRR9P5/aTuAfKKZpvs9nStKCWXjRoRx46 aba/3IWYq4b9FiVFLeVgPqFCNJ5MoNoUBBnjADtbPOrgHkbCNih8/O1sTzRPS2baK/8WT2Xkn gP5XF89ZGwXpXicTMax3HIzrE482GA73V7eEe0x88PYEsfFBHS7FYIRKyf4+7uBb+VMiM4MSL jETuoRaUxFGF4oGnDXo9dbVsN+RbBU+zjcjauYB+y7Jnb/h7tWFNUCjHmsbO/VpdTkaYpH1RX Q6YDGcjPc1r5M72MBFGT4cHJSJwuvN8NfB0e8Zj/HnTjfKdCjd/DrK2JKPmDRW3o+PBf+7iav pFZd1BKYaf96P6/SMyV159Fm5DHWdSM3jcKjPd9oRCnc+LrCBPG0Qk02FAWXgdhQgNDoyJcGQ NiYCfbU9M02FAFgPBW1i4UGVw8O1tHexpk98TlB38zY3mxtuNwcEMxFXA4SbPLv1peI88uLs7 fXuJUmYUJf/3BmeBu+38LZl4r/6A9Z0y82Krx5E7nvzkq2I0ORXGA9atawbeapdPPOh/8JGve owG50stl8gP8EYop5xf50OgYCB8qQ== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 01/18] efi_loader: helloworld.c: remove superfluous include 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" Remove a superfluous include from helloworld.c Signed-off-by: Heinrich Schuchardt --- v3 resubmitted patch added --- lib/efi_loader/helloworld.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/efi_loader/helloworld.c b/lib/efi_loader/helloworld.c index 03e65ab133..77130a36dd 100644 --- a/lib/efi_loader/helloworld.c +++ b/lib/efi_loader/helloworld.c @@ -8,7 +8,6 @@ */ #include -#include #include efi_status_t EFIAPI efi_main(efi_handle_t handle, From patchwork Sun Nov 26 13:05:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841389 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9Rh4NFXz9s3w for ; Mon, 27 Nov 2017 00:16:16 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 3E3C3C21DB1; Sun, 26 Nov 2017 13:09: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.7 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 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 03610C21E01; Sun, 26 Nov 2017 13:07:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0A3D7C21DC1; Sun, 26 Nov 2017 13:07:00 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id 3BFEDC21DC1 for ; Sun, 26 Nov 2017 13:06:54 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0Lx8OH-1fC5Yu3A3l-016g95; Sun, 26 Nov 2017 14:06:41 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:07 +0100 Message-Id: <20171126130523.4993-3-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:uNxTzJVuyFaE6YwrZl0wKfn//mkLMZUy+8+pdnM0yjk370Uejfj +BO/C7n+wBuFPsXiSZBpZXULXZwbYqzXq8etnmlxWyMXHaF20dIotEnFYH45oLAEeK26ut6 vwqVlAeh08DiJ9zLmoVwA9qEWZ92jwfwaLtpifNxT/cbrF9kGcp1Loif3W4w5BBRQXwUgBQ kRrIsVSaP19L5YACgiwbw== X-UI-Out-Filterresults: notjunk:1; V01:K0:JSU8vDX24TI=:Eo84p3tMcRavJ3jK22cHnq zpWNSjlwXnVLUec+V3KCwkkNNwiN/UrpgP4KBS1TTBv4xE3+JHXydQqNQ/KzPY6/gtX7fAYN4 bL0hKswxPli5mZV4CW/H8gbgV2KGC/VaNOAXvK1/I6moiAGVYu+jIEDTjfQgjGOHQvVJXe+28 guG6gX6QJ2aWtpYH8k6sIu8Du8/CopPz1Pogzj3zRKI4DyXTpe4wkeO0i21NltHF5TmHqfes2 kVsNotMaEbmr4BKShnM0+c2p++Y62fGf/ivOOUU8r7e47EPF6OCLLsrsVxUnxCP9hS3Y9KZc5 Gjs5vkuJhk7RY/xCkmhGj0RqDZlrNNxsKLgTLvjni2yhWyJuHTudsMIWijvrNYrhS/KERKmLK 1tpKMPg7rij9GQ50auTVhsStYOwbWFKwg7CFRJG8YsJjsLGa8/uM1D9F8SjyV/ls5jO1/wdRo OGBrSlOQWCxRFYAptSJnWRsqOSqtG9GZNr/whlw3092GPlNovHKKxXkJKv8qsS2u5zL32hc19 rI7jRScCiIKRKGWOisWlg2TAsAx7AVmZnfbHPYlzv/ceMxYXH2sc6Xb4ci/Ip40/vVDe8uLzg H8rpAkyX9Krieyhw5tDPjmZBixVkBb7zMeywyMKMHQuu4bwT9T4935p83OH6mCEgUw4QsyP0t GeOR+IZRCN/OdJuImajhP+jE7Em2uT7i0ERX9MeieCneeTmsaktQ4S6B7E9Y8ygL7bN+Ducm8 J01ZUHYK9UmFMibE6GTDKi1RykQUo1mKtF6uvAHIghCio3QKTLghxrPz2CVWofHH3h5owEgJD yvf7Dz16MYy27UcNVGjvGoLsnfLmg== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 02/18] efi_loader: size of media device path node represenation 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" In the format specifier we want to specify the maximum width in case an ending \0 is missing. So slen must be used as precision and not as field width. Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- v3 no change v2 no change --- lib/efi_loader/efi_device_path_to_text.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c index 62771338f0..98617cf163 100644 --- a/lib/efi_loader/efi_device_path_to_text.c +++ b/lib/efi_loader/efi_device_path_to_text.c @@ -153,7 +153,7 @@ static char *dp_media(char *s, struct efi_device_path *dp) struct efi_device_path_file_path *fp = (struct efi_device_path_file_path *)dp; int slen = (dp->length - sizeof(*dp)) / 2; - s += sprintf(s, "/%-*ls", slen, fp->str); + s += sprintf(s, "/%-.*ls", slen, fp->str); break; } default: From patchwork Sun Nov 26 13:05:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841379 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9Lb4SqGz9s3w for ; Mon, 27 Nov 2017 00:11:51 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 431C6C21D8C; Sun, 26 Nov 2017 13:08:43 +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, RCVD_IN_MSPIKE_H2 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 7B789C21DB2; Sun, 26 Nov 2017 13:07:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 40ACEC21DC1; Sun, 26 Nov 2017 13:06:57 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id 30D74C21DA2 for ; Sun, 26 Nov 2017 13:06:54 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0M08eS-1f8YnO0JMi-00uMSk; Sun, 26 Nov 2017 14:06:42 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:08 +0100 Message-Id: <20171126130523.4993-4-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:UvQa1lWqpUncFaX6cyHTtSzSqeOQG6Kb8TbKm7sZSw0V+gk/xht ipEOkMZ0Q1HCWqFLYlXmMiyHT5bvrarA70QbVS57JstEYXQxo2/JYpUPRJ12/aQmdanlcgn 6US0PU9E39uNiXyqXQzCiXllc3Ivo+UfUzerIkvE0Os1Jx4/HHUsp+KyL5nv5HAxK/ueex5 NaakgxRE+TPqfti1p5XWw== X-UI-Out-Filterresults: notjunk:1; V01:K0:alo8phKtfCw=:42RmL691VlWo/cP7oJpPhs s1MC63KTTFcNqzLSy/6NRQnpNXW+nQnxsM/ov+yNPXps6bepm/wTsRbw7LcKQJyBwcYahUm3Q 5dIIv8QaD45zlgr6MQMikqwhQ1ErIQUj6BjhMQ+Uz83uDScd3y+ziID6h010vGE6VLXj3sPVt iKzJJFvbpc26DkCSrz6rcPkgeOBYWNH5KZGMje7AiqkBZCB4n6HYo2zpj8+MRkBVgeJNHmltp BO0R4VjHLwmSbtqLfmEpy/yZAPzk2lJqBYd/pAwc+t/rdqjzCjPwMkeYgLXrMWlKhbZU395vr mbohIdbDu9Xb/bUlROnkCG+K5tRMYmjqHp66Na+oeynzMmPaywgVSqMEremmk7dOVDqzujQsv KqtFmpIVahqjq6GwVYmBldddLYhOEofPCOQR3vvFj+VxDJe7rqawAI1Vyg+aWZCFRSlGrOwAQ 7d9xrOQnh7bsov1GIOtvBhw80Mqu6vNe4YUtKw6RosbzL2hi3gvhrCU4niZuXCIWkNX3aQC6w HkMRod+A5C863Z0BU3fInPTjFongOyriIqOLAqNueUkOB4JBpjoBL6QJnQjXSjB6qlVRrCD9v ZtunkEawPnS6Mgp9gV1tXyS6OaYW4x7JizfkByNmrRaYa8aPiu0FXcm6nUqRPBJmjXWrawgLk JLCH9xnDR4e1twZy5YUdwQMLzRARhad1gi3XUppgdUU8H/IJz/LSPHSxc8/siOiofZWHO0Qia vmqJ/D4fxQxQANyKPLBAkTeWyyeAkASt0XDXgl4LMAwDMzQoE/Bezi3L6yxVC4goDcX6TKyOu H7CbRi2mmONNkiv19Uq95K29WbjMQ== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 03/18] efi_loader: efi_dp_str should print path not node 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" efi_dp_str is meant to print a device path and not a device node. The old coding only worked because efi_convert_device_node_to_text was screwed up to expect paths instead of nodes. Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- v3 no change v2 no change --- lib/efi_loader/efi_device_path_to_text.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c index 98617cf163..ad248cb492 100644 --- a/lib/efi_loader/efi_device_path_to_text.c +++ b/lib/efi_loader/efi_device_path_to_text.c @@ -208,13 +208,6 @@ static uint16_t *efi_convert_device_node_to_text( return out; } -/* helper for debug prints.. efi_free_pool() the result. */ -uint16_t *efi_dp_str(struct efi_device_path *dp) -{ - return efi_convert_device_node_to_text(dp, true, true); -} - - static uint16_t EFIAPI *efi_convert_device_node_to_text_ext( struct efi_device_path *device_node, bool display_only, @@ -251,6 +244,12 @@ static uint16_t EFIAPI *efi_convert_device_path_to_text( return buffer; } +/* helper for debug prints.. efi_free_pool() the result. */ +uint16_t *efi_dp_str(struct efi_device_path *dp) +{ + return EFI_CALL(efi_convert_device_path_to_text(dp, true, true)); +} + const struct efi_device_path_to_text_protocol efi_device_path_to_text = { .convert_device_node_to_text = efi_convert_device_node_to_text_ext, .convert_device_path_to_text = efi_convert_device_path_to_text, From patchwork Sun Nov 26 13:05:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841377 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9GT5hp2z9s3w for ; Mon, 27 Nov 2017 00:08:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 6C0D1C21E43; Sun, 26 Nov 2017 13:07:34 +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_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL 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 A3946C21DBB; Sun, 26 Nov 2017 13:07:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 51DB4C21DE9; Sun, 26 Nov 2017 13:06:57 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lists.denx.de (Postfix) with ESMTPS id BA70EC21DB0 for ; Sun, 26 Nov 2017 13:06:53 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LeMWL-1evW7L1fCv-00q7EV; Sun, 26 Nov 2017 14:06:42 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:09 +0100 Message-Id: <20171126130523.4993-5-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:KhSEP2dwKrorJas5tLbsZdA5NVOAgQcZlN5UzJfIFuW6YsrIrRI 7Ka8yrVIwst92KvEPLhqAADWuHyFsbymahMCUlmLXQVflXt9MHKEWD+c5S1uy+GBpIyMW3F CSeZG2+lxO7YCOHb+qtxkxsc2TwFuiEzudcs2HUe+UuaIb8CL+Y0FkJg+hLKKdd9WRV954R sgHl81zGqaYlfSwbETNKw== X-UI-Out-Filterresults: notjunk:1; V01:K0:rMG3isBVEWU=:VDnvPXHuucoSRyq3xcV1/7 S9htBwfTUFsvQwWj7OA6h4P1XGZKzvhWPBsFl25hF09SrXl3BPqXMgAIPp5GbW7uZfbO+mBXg K3xT66IVau3Kh29ZeCQeUSdsfnajBQXdyE4Cctil6zwJTvSPsQctX4ADiPwwVwKt+wW3jWzxa 1Ig+20/11ZGJo//uxHrw1zAVuO0FBkrJBemI/lnMK60KcTazaJuJUVkc90uCVq+NUXyCzOGFX MHGg6Ek5tYCgjYDPL3N2AX2I1U/5O14DyvTm/Pyo7OCu3aJ1BUcyq0cTYnM+aVW9bKDM6DWlA hEZGjlusfaZjMRyfmRdhdkjRcNwb67cgKwp2hGmMOGEgh9mnU11rt0yi6SO8FfF3fQGfwxiR8 GEXnkMPYztp12qHKRdDU6seuS6Fn9RwaN3E/9+lKfMRgqWO6g3um04X3ZE2ZBNox6Tmrhw7SU 5FWiTEEJ+MM8raiJNJGSxj7xQ7Q51b3bEa9qm1dIhqwEO4Hjq0N6dy5pZU4MaKLaEGQ79wlHx xcFNjQ2Edu3na626U7DbN8s2+HtKFp4gLiOjlmLLETzz5Y9V1EnmtXJ++iAycw1qe385PASr4 77DahPk0PmTrCx9gYdtbMU6tEBzCItB16hwpMsVNY/DE5YE/Duuv4oTe1fOWozD96lWBMhoJm ie+EM3HzVB4uQK+I4/I4DDibcvW8z4dC74Pi/877+qnCnLB2gF2UieNlc5AWOrJxBsBYJzsUx y1wjZ2jMsk15rqj9gtwfP7jLg31OAEd3Je/x48s2QNJYatG6ZFiFgxcOBBHkbk5PZue5XPIwI AME9V+xrc7WjHSGovdZrYUXl6x8Jw== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 04/18] efi_loader: fix efi_convert_device_node_to_text 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" We need to implement to different functions for the EFI_DEVICE_PATH_TO_TEXT_PROTOCOL: ConvertDeviceNodeToText ConvertDevicePathToText A recent patch screwed up efi_convert_device_node_to_text to expect a device path and not a node. The patch makes both service functions work again. efi_convert_device_node_to_text is renamed to efi_convert_single_device_node_to_text and efi_convert_device_node_to_text_ext is renamed to efi_convert_device_node_to_text to avoid future confusion. A test of ConvertDeviceNodeToText will be provided in a follow-up patch. Fixes: adae4313cdd efi_loader: flesh out device-path to text Signed-off-by: Heinrich Schuchardt --- v3 Correctly handle NULL values. v2 no change --- lib/efi_loader/efi_device_path_to_text.c | 154 ++++++++++++++++++------------- 1 file changed, 88 insertions(+), 66 deletions(-) diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c index ad248cb492..43af5dfd8d 100644 --- a/lib/efi_loader/efi_device_path_to_text.c +++ b/lib/efi_loader/efi_device_path_to_text.c @@ -12,12 +12,31 @@ #define MAC_OUTPUT_LEN 22 #define UNKNOWN_OUTPUT_LEN 23 +#define MAX_NODE_LEN 512 +#define MAX_PATH_LEN 1024 + const efi_guid_t efi_guid_device_path_to_text_protocol = EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID; +static u16 *efi_str_to_u16(char *str) +{ + efi_uintn_t len; + u16 *out; + efi_status_t ret; + + len = strlen(str) + 1; + ret = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, len * sizeof(u16), + (void **)&out); + if (ret != EFI_SUCCESS) + return NULL; + ascii2unicode(out, str); + out[len - 1] = 0; + return out; +} + static char *dp_unknown(char *s, struct efi_device_path *dp) { - s += sprintf(s, "/UNKNOWN(%04x,%04x)", dp->type, dp->sub_type); + s += sprintf(s, "UNKNOWN(%04x,%04x)", dp->type, dp->sub_type); return s; } @@ -27,7 +46,7 @@ static char *dp_hardware(char *s, struct efi_device_path *dp) case DEVICE_PATH_SUB_TYPE_MEMORY: { struct efi_device_path_memory *mdp = (struct efi_device_path_memory *)dp; - s += sprintf(s, "/MemoryMapped(0x%x,0x%llx,0x%llx)", + s += sprintf(s, "MemoryMapped(0x%x,0x%llx,0x%llx)", mdp->memory_type, mdp->start_address, mdp->end_address); @@ -36,7 +55,7 @@ static char *dp_hardware(char *s, struct efi_device_path *dp) case DEVICE_PATH_SUB_TYPE_VENDOR: { struct efi_device_path_vendor *vdp = (struct efi_device_path_vendor *)dp; - s += sprintf(s, "/VenHw(%pUl)", &vdp->guid); + s += sprintf(s, "VenHw(%pUl)", &vdp->guid); break; } default: @@ -52,7 +71,7 @@ static char *dp_acpi(char *s, struct efi_device_path *dp) case DEVICE_PATH_SUB_TYPE_ACPI_DEVICE: { struct efi_device_path_acpi_path *adp = (struct efi_device_path_acpi_path *)dp; - s += sprintf(s, "/Acpi(PNP%04x", EISA_PNP_NUM(adp->hid)); + s += sprintf(s, "Acpi(PNP%04x", EISA_PNP_NUM(adp->hid)); if (adp->uid) s += sprintf(s, ",%d", adp->uid); s += sprintf(s, ")"); @@ -71,7 +90,7 @@ static char *dp_msging(char *s, struct efi_device_path *dp) case DEVICE_PATH_SUB_TYPE_MSG_USB: { struct efi_device_path_usb *udp = (struct efi_device_path_usb *)dp; - s += sprintf(s, "/Usb(0x%x,0x%x)", udp->parent_port_number, + s += sprintf(s, "Usb(0x%x,0x%x)", udp->parent_port_number, udp->usb_interface); break; } @@ -82,7 +101,7 @@ static char *dp_msging(char *s, struct efi_device_path *dp) if (mdp->if_type != 0 && mdp->if_type != 1) break; - s += sprintf(s, "/MAC(%02x%02x%02x%02x%02x%02x,0x%1x)", + s += sprintf(s, "MAC(%02x%02x%02x%02x%02x%02x,0x%1x)", mdp->mac.addr[0], mdp->mac.addr[1], mdp->mac.addr[2], mdp->mac.addr[3], mdp->mac.addr[4], mdp->mac.addr[5], @@ -94,7 +113,7 @@ static char *dp_msging(char *s, struct efi_device_path *dp) struct efi_device_path_usb_class *ucdp = (struct efi_device_path_usb_class *)dp; - s += sprintf(s, "/USBClass(%x,%x,%x,%x,%x)", + s += sprintf(s, "USBClass(%x,%x,%x,%x,%x)", ucdp->vendor_id, ucdp->product_id, ucdp->device_class, ucdp->device_subclass, ucdp->device_protocol); @@ -108,7 +127,7 @@ static char *dp_msging(char *s, struct efi_device_path *dp) "SDCard" : "MMC"; struct efi_device_path_sd_mmc_path *sddp = (struct efi_device_path_sd_mmc_path *)dp; - s += sprintf(s, "/%s(Slot%u)", typename, sddp->slot_number); + s += sprintf(s, "%s(Slot%u)", typename, sddp->slot_number); break; } default: @@ -128,15 +147,15 @@ static char *dp_media(char *s, struct efi_device_path *dp) switch (hddp->signature_type) { case SIG_TYPE_MBR: - s += sprintf(s, "/HD(Part%d,Sig%08x)", + s += sprintf(s, "HD(Part%d,Sig%08x)", hddp->partition_number, *(uint32_t *)sig); break; case SIG_TYPE_GUID: - s += sprintf(s, "/HD(Part%d,Sig%pUl)", + s += sprintf(s, "HD(Part%d,Sig%pUl)", hddp->partition_number, sig); default: - s += sprintf(s, "/HD(Part%d,MBRType=%02x,SigType=%02x)", + s += sprintf(s, "HD(Part%d,MBRType=%02x,SigType=%02x)", hddp->partition_number, hddp->partmap_type, hddp->signature_type); } @@ -146,14 +165,16 @@ static char *dp_media(char *s, struct efi_device_path *dp) case DEVICE_PATH_SUB_TYPE_CDROM_PATH: { struct efi_device_path_cdrom_path *cddp = (struct efi_device_path_cdrom_path *)dp; - s += sprintf(s, "/CDROM(0x%x)", cddp->boot_entry); + s += sprintf(s, "CDROM(0x%x)", cddp->boot_entry); break; } case DEVICE_PATH_SUB_TYPE_FILE_PATH: { struct efi_device_path_file_path *fp = (struct efi_device_path_file_path *)dp; int slen = (dp->length - sizeof(*dp)) / 2; - s += sprintf(s, "/%-.*ls", slen, fp->str); + if (slen > MAX_NODE_LEN - 2) + slen = MAX_NODE_LEN - 2; + s += sprintf(s, "%-.*ls", slen, fp->str); break; } default: @@ -163,65 +184,59 @@ static char *dp_media(char *s, struct efi_device_path *dp) return s; } -static uint16_t *efi_convert_device_node_to_text( - struct efi_device_path *dp, - bool display_only, - bool allow_shortcuts) +/* + * Converts a single node to a char string. + * + * @buffer output buffer + * @dp device path or node + * @return end of string + */ +static char *efi_convert_single_device_node_to_text( + char *buffer, + struct efi_device_path *dp) { - unsigned long len; - efi_status_t r; - char buf[512]; /* this ought be be big enough for worst case */ - char *str = buf; - uint16_t *out; - - while (dp) { - switch (dp->type) { - case DEVICE_PATH_TYPE_HARDWARE_DEVICE: - str = dp_hardware(str, dp); - break; - case DEVICE_PATH_TYPE_ACPI_DEVICE: - str = dp_acpi(str, dp); - break; - case DEVICE_PATH_TYPE_MESSAGING_DEVICE: - str = dp_msging(str, dp); - break; - case DEVICE_PATH_TYPE_MEDIA_DEVICE: - str = dp_media(str, dp); - break; - default: - str = dp_unknown(str, dp); - } + char *str = buffer; - dp = efi_dp_next(dp); + switch (dp->type) { + case DEVICE_PATH_TYPE_HARDWARE_DEVICE: + str = dp_hardware(str, dp); + break; + case DEVICE_PATH_TYPE_ACPI_DEVICE: + str = dp_acpi(str, dp); + break; + case DEVICE_PATH_TYPE_MESSAGING_DEVICE: + str = dp_msging(str, dp); + break; + case DEVICE_PATH_TYPE_MEDIA_DEVICE: + str = dp_media(str, dp); + break; + default: + str = dp_unknown(str, dp); } - *str++ = '\0'; - - len = str - buf; - r = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, 2 * len, (void **)&out); - if (r != EFI_SUCCESS) - return NULL; - - ascii2unicode(out, buf); - out[len - 1] = 0; - - return out; + *str = '\0'; + return str; } -static uint16_t EFIAPI *efi_convert_device_node_to_text_ext( +static uint16_t EFIAPI *efi_convert_device_node_to_text( struct efi_device_path *device_node, bool display_only, bool allow_shortcuts) { - uint16_t *buffer; + char str[MAX_NODE_LEN]; + uint16_t *text = NULL; EFI_ENTRY("%p, %d, %d", device_node, display_only, allow_shortcuts); - buffer = efi_convert_device_node_to_text(device_node, display_only, - allow_shortcuts); + if (!device_node) + goto out; + efi_convert_single_device_node_to_text(str, device_node); + + text = efi_str_to_u16(str); +out: EFI_EXIT(EFI_SUCCESS); - return buffer; + return text; } static uint16_t EFIAPI *efi_convert_device_path_to_text( @@ -229,19 +244,26 @@ static uint16_t EFIAPI *efi_convert_device_path_to_text( bool display_only, bool allow_shortcuts) { - uint16_t *buffer; + uint16_t *text = NULL; + char buffer[MAX_PATH_LEN]; + char *str = buffer; EFI_ENTRY("%p, %d, %d", device_path, display_only, allow_shortcuts); - /* - * Our device paths are all of depth one. So its is sufficient to - * to convert the first node. - */ - buffer = efi_convert_device_node_to_text(device_path, display_only, - allow_shortcuts); + if (!device_path) + goto out; + while (device_path && + str + MAX_NODE_LEN < buffer + MAX_PATH_LEN) { + *str++ = '/'; + str = efi_convert_single_device_node_to_text(str, device_path); + device_path = efi_dp_next(device_path); + } + + text = efi_str_to_u16(buffer); +out: EFI_EXIT(EFI_SUCCESS); - return buffer; + return text; } /* helper for debug prints.. efi_free_pool() the result. */ @@ -251,6 +273,6 @@ uint16_t *efi_dp_str(struct efi_device_path *dp) } const struct efi_device_path_to_text_protocol efi_device_path_to_text = { - .convert_device_node_to_text = efi_convert_device_node_to_text_ext, + .convert_device_node_to_text = efi_convert_device_node_to_text, .convert_device_path_to_text = efi_convert_device_path_to_text, }; From patchwork Sun Nov 26 13:05:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841376 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9GJ5wNhz9s3w for ; Mon, 27 Nov 2017 00:08:08 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 6CDE7C21E39; Sun, 26 Nov 2017 13:07:13 +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, RCVD_IN_MSPIKE_H2 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 D080FC21DA9; Sun, 26 Nov 2017 13:06:58 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 20392C21DDB; Sun, 26 Nov 2017 13:06:57 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id 1C109C21DBA for ; Sun, 26 Nov 2017 13:06:54 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0Lm3bl-1esHWl2wuP-00ZfkJ; Sun, 26 Nov 2017 14:06:42 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:10 +0100 Message-Id: <20171126130523.4993-6-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:7ZCq9AsfwHgNMUfus0qiuXMHumwKJQui7JbWfQcwl/dzQ7JzU6h C8FAf5h1ClyQVvrEKMKeby6Rls/Z7Hj9FfME13oUhwh6sDMZerSZeDrHn58yAVefuPqCcjf px2FDX66/W2vQV+dXIIi/biUIkxl4rZ/13QtdgR2paZ56eZ8XD+IajS+iUlE1w4Y7yWchRS niDDYrxgDJcFF9bCrSvwA== X-UI-Out-Filterresults: notjunk:1; V01:K0:zVuBAUQMqxY=:OB15Qn1mNrw/sbb74NBlIC v0f62IF6iv621Yhog5sZGmJwjM3Ah2pSxKPvH2Kd86QU8niykow0WLJWjDqJerjk2NOhG55kV MVRu5xcAR9fTJDhnRalwhBrAzgR7YmFzMMzZMs5pyxIXtfL9SxNJBACwQOkD2xtMvd6rIhXn1 Nt9Xpvt2inQ8P5AGxAxSmr/NRkIzC9PrL3BfEv8JiKmuLOPlLWwp2M+QGYPssiH2iQVEmCEw+ j91JlF2YpAXnN3WWRFyGBPUz87+TLVBLtP16zAcTfx6kvWoS0XyyAf7uOfSWn5t/y/B04mdsJ w109SX8/nLE4Kp5Ef/CeRqw//dLcdOWfsfHAvkDXWg6WnCaMRtmfmqhJMzCHS0mC0dmHAscJ+ bDiajcafHyuhjYZoJdaM6d0iQX4C4Vy5H001h1Pbe+sCg4YWJr/WTZGfr+CRg50Djo84Boiu8 P/OSdgkRExDGaRXz9P6tZp2zk5Row2Tsrgh9414j2z9ri0zZJsDsGm9rI/d55gv4Jn63WAa69 UT+cVFG+YLw44DgM5PpG8IPDRMyS7ShT63DEuSr8givIRSQSKh3GG1cMfv32PjeQhT6JLLsQU FPfYxSJtDHrmvsdVAskiUmBcbCCajF/t1kxMBORoe9JxRHkuqN3Mgcyk1fZp6JlEGbRKKw1+M HAXbsWpQovPYePskff4i5BqS0nSNGqCPrDJZ1r6wKyp04q2b8SBI3Av18Pyi+DUj6ZBWyJlr/ gtECFUjTlkP5ZgyMH0jobvcdzSCxPG1NRhiG7WGQvtN9LF5/XTHBpwVMoZ9Z5k6ouq+hyXWaH RNlG/ALKNBDFJrw4TmF3tMAk12XXQ== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 05/18] efi_loader: reimplement LocateDevicePath 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" The current implementation of efi_locate_device_path does not match the UEFI specification. It completely ignores the protocol parameters. Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- v3 remove trailing dot in comment v2 no change --- lib/efi_loader/efi_boottime.c | 106 ++++++++++++++++++++++++++++++------------ 1 file changed, 76 insertions(+), 30 deletions(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 9b5512f086..565addfc3f 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1080,36 +1080,6 @@ static efi_status_t EFIAPI efi_locate_handle_ext( buffer_size, buffer)); } -/* - * Get the device path and handle of an device implementing a protocol. - * - * This function implements the LocateDevicePath service. - * See the Unified Extensible Firmware Interface (UEFI) specification - * for details. - * - * @protocol GUID of the protocol - * @device_path device path - * @device handle of the device - * @return status code - */ -static efi_status_t EFIAPI efi_locate_device_path( - const efi_guid_t *protocol, - struct efi_device_path **device_path, - efi_handle_t *device) -{ - struct efi_object *efiobj; - - EFI_ENTRY("%pUl, %p, %p", protocol, device_path, device); - - efiobj = efi_dp_find_obj(*device_path, device_path); - if (!efiobj) - return EFI_EXIT(EFI_NOT_FOUND); - - *device = efiobj->handle; - - return EFI_EXIT(EFI_SUCCESS); -} - /* Collapses configuration table entries, removing index i */ static void efi_remove_configuration_table(int i) { @@ -1813,6 +1783,82 @@ static efi_status_t EFIAPI efi_locate_protocol(const efi_guid_t *protocol, return EFI_EXIT(EFI_NOT_FOUND); } +/* + * Get the device path and handle of an device implementing a protocol. + * + * This function implements the LocateDevicePath service. + * See the Unified Extensible Firmware Interface (UEFI) specification + * for details. + * + * @protocol GUID of the protocol + * @device_path device path + * @device handle of the device + * @return status code + */ +static efi_status_t EFIAPI efi_locate_device_path( + const efi_guid_t *protocol, + struct efi_device_path **device_path, + efi_handle_t *device) +{ + struct efi_device_path *dp; + size_t i; + struct efi_handler *handler; + efi_handle_t *handles; + size_t len, len_dp; + size_t len_best = 0; + efi_uintn_t no_handles; + u8 *remainder; + efi_status_t ret; + + EFI_ENTRY("%pUl, %p, %p", protocol, device_path, device); + + if (!protocol || !device_path || !*device_path || !device) { + ret = EFI_INVALID_PARAMETER; + goto out; + } + + /* Find end of device path */ + len = efi_dp_size(*device_path); + + /* Get all handles implementing the protocol */ + ret = EFI_CALL(efi_locate_handle_buffer(BY_PROTOCOL, protocol, NULL, + &no_handles, &handles)); + if (ret != EFI_SUCCESS) + goto out; + + for (i = 0; i < no_handles; ++i) { + /* Find the device path protocol */ + ret = efi_search_protocol(handles[i], &efi_guid_device_path, + &handler); + if (ret != EFI_SUCCESS) + continue; + dp = (struct efi_device_path *)handler->protocol_interface; + len_dp = efi_dp_size(dp); + /* + * This handle can only be a better fit + * if its device path length is longer than the best fit and + * if its device path length is shorter of equal the searched + * device path. + */ + if (len_dp <= len_best || len_dp > len) + continue; + /* Check if dp is a subpath of device_path */ + if (memcmp(*device_path, dp, len_dp)) + continue; + *device = handles[i]; + len_best = len_dp; + } + if (len_best) { + remainder = (u8 *)*device_path + len_best; + *device_path = (struct efi_device_path *)remainder; + ret = EFI_SUCCESS; + } else { + ret = EFI_NOT_FOUND; + } +out: + return EFI_EXIT(ret); +} + /* * Install multiple protocol interfaces. * From patchwork Sun Nov 26 13:05:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841390 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9SS2r3Yz9s3w for ; Mon, 27 Nov 2017 00:16:56 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 1BCA9C21DC8; Sun, 26 Nov 2017 13:09:02 +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_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL 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 650C6C21DE8; Sun, 26 Nov 2017 13:07:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6904DC21E1E; Sun, 26 Nov 2017 13:07:00 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lists.denx.de (Postfix) with ESMTPS id DFE1EC21DDD for ; Sun, 26 Nov 2017 13:06:54 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0MfVYB-1eTiP20711-00P7qj; Sun, 26 Nov 2017 14:06:43 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:11 +0100 Message-Id: <20171126130523.4993-7-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:nSV9QOfwRb8AZw5F4zTEvQQ+bXCV6+A69AWcZgjEqBj7qAQi8Me MoNmPe0k+rW2Dn9sjD0N1TWDviDYVDgZG/6RPQas5p8Iu3wHwEngYsVAmrU3gn6GsDqJQSU 6PiGCHrPEp/C8WFe+4r1dUvvExbVjtKsecDQ37DY0pSru34q6nT5p8hrBT0Fcu12oKStOZF 5xLDAJ+L60GdU3Mdv6MYg== X-UI-Out-Filterresults: notjunk:1; V01:K0:ZmM/p0IW8vw=:Hm85tquFmrb+0H9wVSH18L B8oEv143/Bc4VFENHDlsD2od7E8FerAUAuvHn+8Pr/IMd9cPK+qqI/dful9BitunFIKMO4QqA fZZtE8qlxMYe2erN7G8JOWFvf22CJQUERGxmLtROphD/OdP/K1S7U+eXB6lh4g0A5l+dTefUU zOUXXNCVha6mASEfsyvmRGpY/ILUcVFEIwA5COVDogGgLjAsDaU0jkfdZ2jUDHLyYm5zWt1+v Pj7s+3UMSZ0UyCL1pettTTjv5O4QJAcSAJ1Wi2Oca3AwGI2jfmlUG+F/AqIpaYKBs+TJPUvs3 Fsgq/7P03Vrh0Hl3MrrXVu8KUvQFbA8nPbN+2HqCX1JKtskOrmtEAh+pi7MXYyS/pizvPF6hN r/BRXllvSgODv91OiR8xb/nIv8reOFcESO0Jr25176oHpo0ajSyLVpvSKXdVpt77p6UOrcfsU 78KDHDN22wHvp9yLRguxYsjrU3G+ilvjEMNoPVOeKp/F5i4Uu5aiqnDnuenKJ51RKrt/i300x Bv18Prb1rqgX/LPv5Y8NGK3l9nsweurZxikuER6R0mD883qqEnL2OY1O3989Vd1YGM/O6rAuY 8NmzOUW+xng6UNxpU2lw+KH5L026Crlkp6aV5qIW39QSl1aDxN0RgBGkzUrfPfMQzwW/LBdvi 5zghLRxfInRcJ2hST0rfeKKJILTFaQ/vkqqnvwgfgxkEi6CDlUNlF2et+GhLTDyn5eiXZP7Sy 7qoggkevq21K+IdL0Fx1UDAIyEBu/ZrC4yTTqRLcMaY8uudKmZcHV/QnBp92mwKEQQSkzWJ7h qc86dYi7fBE0tp5GHGnHQtvtnBCBQ== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 06/18] efi_selftest: test EFI_DEVICE_PATH_TO_TEXT_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" Provide a test for the EFI_DEVICE_PATH_TO_TEXT_PROTOCOL protocol. Signed-off-by: Heinrich Schuchardt --- v3 Print all installed device paths. v2 No change --- lib/efi_selftest/Makefile | 3 + lib/efi_selftest/efi_selftest_devicepath.c | 391 +++++++++++++++++++++++++++++ 2 files changed, 394 insertions(+) create mode 100644 lib/efi_selftest/efi_selftest_devicepath.c diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index 1851c17db6..d280eca5c3 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -11,6 +11,8 @@ CFLAGS_efi_selftest.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest.o := $(CFLAGS_NON_EFI) CFLAGS_efi_selftest_console.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_console.o := $(CFLAGS_NON_EFI) +CFLAGS_efi_selftest_devicepathe.o := $(CFLAGS_EFI) +CFLAGS_REMOVE_efi_selftest_devicepath.o := $(CFLAGS_NON_EFI) CFLAGS_efi_selftest_events.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_events.o := $(CFLAGS_NON_EFI) CFLAGS_efi_selftest_exitbootservices.o := $(CFLAGS_EFI) @@ -33,6 +35,7 @@ CFLAGS_REMOVE_efi_selftest_watchdog.o := $(CFLAGS_NON_EFI) obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += \ efi_selftest.o \ efi_selftest_console.o \ +efi_selftest_devicepath.o \ efi_selftest_events.o \ efi_selftest_exitbootservices.o \ efi_selftest_gop.o \ diff --git a/lib/efi_selftest/efi_selftest_devicepath.c b/lib/efi_selftest/efi_selftest_devicepath.c new file mode 100644 index 0000000000..55f4632b14 --- /dev/null +++ b/lib/efi_selftest/efi_selftest_devicepath.c @@ -0,0 +1,390 @@ +/* + * efi_selftest_devicepath + * + * Copyright (c) 2017 Heinrich Schuchardt + * + * SPDX-License-Identifier: GPL-2.0+ + * + * This unit test checks the following protocol services: + * DevicePathToText + */ + +#include + +static struct efi_boot_services *boottime; + +static efi_handle_t handle1; +static efi_handle_t handle2; +static efi_handle_t handle3; + +struct interface { + void (EFIAPI * inc)(void); +} interface; + +static efi_guid_t guid_device_path = DEVICE_PATH_GUID; + +static efi_guid_t guid_device_path_to_text_protocol = + EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID; + +static efi_guid_t guid_protocol = + EFI_GUID(0xdbca4c98, 0x6cb0, 0x694d, + 0x08, 0x72, 0x81, 0x9c, 0x65, 0x0c, 0xbb, 0x7d); + +static efi_guid_t guid_vendor1 = + EFI_GUID(0xdbca4c98, 0x6cb0, 0x694d, + 0x08, 0x72, 0x81, 0x9c, 0x65, 0x0c, 0xbb, 0xb1); + +static efi_guid_t guid_vendor2 = + EFI_GUID(0xdbca4c98, 0x6cb0, 0x694d, + 0x08, 0x72, 0x81, 0x9c, 0x65, 0x0c, 0xbb, 0xa2); + +static efi_guid_t guid_vendor3 = + EFI_GUID(0xdbca4c98, 0x6cb0, 0x694d, + 0x08, 0x72, 0x81, 0x9c, 0x65, 0x0c, 0xbb, 0xc3); + +static u8 *dp1; +static u8 *dp2; +static u8 *dp3; + +struct efi_device_path_to_text_protocol *device_path_to_text; + +/* + * Setup unit test. + * + * Create three handles. Install a new protocol on two of them and + * provice device paths. + * + * handle1 + * guid interface + * handle2 + * guid interface + * handle3 + * + * @handle: handle of the loaded image + * @systable: system table + */ +static int setup(const efi_handle_t img_handle, + const struct efi_system_table *systable) +{ + struct efi_device_path_vendor vendor_node; + struct efi_device_path end_node; + efi_status_t ret; + + boottime = systable->boottime; + + ret = boottime->locate_protocol(&guid_device_path_to_text_protocol, + NULL, (void **)&device_path_to_text); + if (ret != EFI_SUCCESS) { + device_path_to_text = NULL; + efi_st_error( + "Device path to text protocol is not available.\n"); + return EFI_ST_FAILURE; + } + + ret = boottime->allocate_pool(EFI_LOADER_DATA, + sizeof(struct efi_device_path_vendor) + + sizeof(struct efi_device_path), + (void **)&dp1); + if (ret != EFI_SUCCESS) + goto out_of_memory; + + ret = boottime->allocate_pool(EFI_LOADER_DATA, 2 * + sizeof(struct efi_device_path_vendor) + + sizeof(struct efi_device_path), + (void **)&dp2); + if (ret != EFI_SUCCESS) + goto out_of_memory; + + ret = boottime->allocate_pool(EFI_LOADER_DATA, 3 * + sizeof(struct efi_device_path_vendor) + + sizeof(struct efi_device_path), + (void **)&dp3); + if (ret != EFI_SUCCESS) + goto out_of_memory; + + vendor_node.dp.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE; + vendor_node.dp.sub_type = DEVICE_PATH_SUB_TYPE_VENDOR; + vendor_node.dp.length = sizeof(struct efi_device_path_vendor); + + boottime->copy_mem(&vendor_node.guid, &guid_vendor1, + sizeof(efi_guid_t)); + boottime->copy_mem(dp1, &vendor_node, + sizeof(struct efi_device_path_vendor)); + boottime->copy_mem(dp2, &vendor_node, + sizeof(struct efi_device_path_vendor)); + boottime->copy_mem(dp3, &vendor_node, + sizeof(struct efi_device_path_vendor)); + + boottime->copy_mem(&vendor_node.guid, &guid_vendor2, + sizeof(efi_guid_t)); + boottime->copy_mem(dp2 + sizeof(struct efi_device_path_vendor), + &vendor_node, sizeof(struct efi_device_path_vendor)); + boottime->copy_mem(dp3 + sizeof(struct efi_device_path_vendor), + &vendor_node, sizeof(struct efi_device_path_vendor)); + + boottime->copy_mem(&vendor_node.guid, &guid_vendor3, + sizeof(efi_guid_t)); + boottime->copy_mem(dp3 + 2 * sizeof(struct efi_device_path_vendor), + &vendor_node, sizeof(struct efi_device_path_vendor)); + + end_node.type = DEVICE_PATH_TYPE_END; + end_node.sub_type = DEVICE_PATH_SUB_TYPE_END; + end_node.length = sizeof(struct efi_device_path); + boottime->copy_mem(dp1 + sizeof(struct efi_device_path_vendor), + &end_node, sizeof(struct efi_device_path)); + boottime->copy_mem(dp2 + 2 * sizeof(struct efi_device_path_vendor), + &end_node, sizeof(struct efi_device_path)); + boottime->copy_mem(dp3 + 3 * sizeof(struct efi_device_path_vendor), + &end_node, sizeof(struct efi_device_path)); + + ret = boottime->install_protocol_interface(&handle1, + &guid_device_path, + EFI_NATIVE_INTERFACE, + dp1); + if (ret != EFI_SUCCESS) { + efi_st_error("InstallProtocolInterface failed\n"); + return EFI_ST_FAILURE; + } + ret = boottime->install_protocol_interface(&handle1, + &guid_protocol, + EFI_NATIVE_INTERFACE, + &interface); + if (ret != EFI_SUCCESS) { + efi_st_error("InstallProtocolInterface failed\n"); + return EFI_ST_FAILURE; + } + ret = boottime->install_protocol_interface(&handle2, + &guid_device_path, + EFI_NATIVE_INTERFACE, + dp2); + if (ret != EFI_SUCCESS) { + efi_st_error("InstallProtocolInterface failed\n"); + return EFI_ST_FAILURE; + } + ret = boottime->install_protocol_interface(&handle2, + &guid_protocol, + EFI_NATIVE_INTERFACE, + &interface); + if (ret != EFI_SUCCESS) { + efi_st_error("InstallProtocolInterface failed\n"); + return EFI_ST_FAILURE; + } + ret = boottime->install_protocol_interface(&handle3, + &guid_device_path, + EFI_NATIVE_INTERFACE, + dp3); + if (ret != EFI_SUCCESS) { + efi_st_error("InstallProtocolInterface failed\n"); + return EFI_ST_FAILURE; + } + return EFI_ST_SUCCESS; + +out_of_memory: + efi_st_error("Out of memory\n"); + return EFI_ST_FAILURE; +} + +/* + * Tear down unit test. + * + */ +static int teardown(void) +{ + efi_status_t ret; + + ret = boottime->uninstall_protocol_interface(&handle1, + &guid_device_path, + dp1); + if (ret != EFI_SUCCESS) + efi_st_todo("UninstallProtocolInterface failed\n"); + ret = boottime->uninstall_protocol_interface(&handle1, + &guid_protocol, + &interface); + if (ret != EFI_SUCCESS) + efi_st_todo("UninstallProtocolInterface failed\n"); + ret = boottime->uninstall_protocol_interface(&handle2, + &guid_device_path, + dp2); + if (ret != EFI_SUCCESS) + efi_st_todo("UninstallProtocolInterface failed\n"); + ret = boottime->uninstall_protocol_interface(&handle2, + &guid_protocol, + &interface); + if (ret != EFI_SUCCESS) + efi_st_todo("UninstallProtocolInterface failed\n"); + ret = boottime->uninstall_protocol_interface(&handle3, + &guid_device_path, + dp3); + if (ret != EFI_SUCCESS) + efi_st_todo("UninstallProtocolInterface failed\n"); + if (dp1) { + ret = boottime->free_pool(dp1); + if (ret != EFI_SUCCESS) { + efi_st_error("FreePool failed\n"); + return EFI_ST_FAILURE; + } + } + if (dp2) { + ret = boottime->free_pool(dp2); + if (ret != EFI_SUCCESS) { + efi_st_error("FreePool failed\n"); + return EFI_ST_FAILURE; + } + } + if (dp3) { + ret = boottime->free_pool(dp3); + if (ret != EFI_SUCCESS) { + efi_st_error("FreePool failed\n"); + return EFI_ST_FAILURE; + } + } + return EFI_ST_SUCCESS; +} + +/* + * Execute unit test. + * + */ +static int execute(void) +{ + struct efi_device_path *remaining_dp; + void *handle; + /* + * This device path node ends with the letter 't' of 'u-boot'. + * The following '.bin' does not belong to the node but is + * helps to test the correct truncation. + */ + struct { + struct efi_device_path dp; + u16 text[12]; + } __packed dp_node = { + { DEVICE_PATH_TYPE_MEDIA_DEVICE, + DEVICE_PATH_SUB_TYPE_FILE_PATH, + sizeof(struct efi_device_path) + 12}, + L"u-boot.bin", + }; + u16 *string; + efi_status_t ret; + efi_uintn_t i, no_handles; + efi_handle_t *handles; + struct efi_device_path *dp; + + /* Display all available device paths */ + ret = boottime->locate_handle_buffer(BY_PROTOCOL, + &guid_device_path, + NULL, &no_handles, &handles); + if (ret != EFI_SUCCESS) { + efi_st_error("Cannot retrieve device path protocols.\n"); + return EFI_ST_FAILURE; + } + + efi_st_printf("Installed device path protocols:\n"); + for (i = 0; i < no_handles; ++i) { + ret = boottime->open_protocol(handles[i], &guid_device_path, + (void **)&dp, NULL, NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL); + if (ret != EFI_SUCCESS) { + efi_st_error("Cannot open device path protocol.\n"); + return EFI_ST_FAILURE; + } + string = device_path_to_text->convert_device_path_to_text( + dp, true, false); + if (!string) { + efi_st_error("ConvertDevicePathToText failed\n"); + return EFI_ST_FAILURE; + } + efi_st_printf("%ps\n", string); + ret = boottime->free_pool(string); + if (ret != EFI_SUCCESS) { + efi_st_error("FreePool failed\n"); + return EFI_ST_FAILURE; + } + ret = boottime->close_protocol(handles[i], &guid_device_path, + NULL, NULL); + if (ret != EFI_SUCCESS) + efi_st_todo("Cannot close device path protocol.\n"); + } + ret = boottime->free_pool(handles); + if (ret != EFI_SUCCESS) { + efi_st_error("FreePool failed\n"); + return EFI_ST_FAILURE; + } + efi_st_printf("\n"); + + /* Test ConvertDevicePathToText */ + string = device_path_to_text->convert_device_path_to_text( + (struct efi_device_path *)dp2, true, false); + if (!string) { + efi_st_error("ConvertDevicePathToText failed\n"); + return EFI_ST_FAILURE; + } + efi_st_printf("dp2: %ps\n", string); + if (efi_st_strcmp_16_8( + string, + "/VenHw(dbca4c98-6cb0-694d-0872-819c650cbbb1)/VenHw(dbca4c98-6cb0-694d-0872-819c650cbba2)") + ) { + efi_st_error("Incorrect text from ConvertDevicePathToText\n"); + return EFI_ST_FAILURE; + } + + ret = boottime->free_pool(string); + if (ret != EFI_SUCCESS) { + efi_st_error("FreePool failed\n"); + return EFI_ST_FAILURE; + } + + /* Test ConvertDeviceNodeToText */ + string = device_path_to_text->convert_device_node_to_text( + (struct efi_device_path *)&dp_node, true, false); + if (!string) { + efi_st_error("ConvertDeviceNodeToText failed\n"); + return EFI_ST_FAILURE; + } + efi_st_printf("dp_node: %ps\n", string); + ret = boottime->free_pool(string); + if (ret != EFI_SUCCESS) { + efi_st_error("FreePool failed\n"); + return EFI_ST_FAILURE; + } + if (efi_st_strcmp_16_8(string, "u-boot")) { + efi_st_error( + "Incorrect conversion by ConvertDeviceNodeToText\n"); + return EFI_ST_FAILURE; + } + + /* Test LocateDevicePath */ + remaining_dp = (struct efi_device_path *)dp3; + ret = boottime->locate_device_path(&guid_protocol, &remaining_dp, + &handle); + if (ret != EFI_SUCCESS) { + efi_st_error("LocateDevicePath failed\n"); + return EFI_ST_FAILURE; + } + if (handle != handle2) { + efi_st_error("LocateDevicePath returned wrong handle\n"); + return EFI_ST_FAILURE; + } + string = device_path_to_text->convert_device_path_to_text(remaining_dp, + true, false); + if (!string) { + efi_st_error("ConvertDevicePathToText failed\n"); + return EFI_ST_FAILURE; + } + efi_st_printf("remaining device path: %ps\n", string); + if (efi_st_strcmp_16_8(string, + "/VenHw(dbca4c98-6cb0-694d-0872-819c650cbbc3)") + ) { + efi_st_error("LocateDevicePath: wrong remaining device path\n"); + return EFI_ST_FAILURE; + } + + return EFI_ST_SUCCESS; +} + +EFI_UNIT_TEST(devicepath) = { + .name = "device path", + .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, + .setup = setup, + .execute = execute, + .teardown = teardown, +}; From patchwork Sun Nov 26 13:05:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841380 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9Lg12Lyz9s3w for ; Mon, 27 Nov 2017 00:11:55 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id BFB19C21DA2; Sun, 26 Nov 2017 13:08:19 +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_BLOCKED,RCVD_IN_MSPIKE_H2 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 93009C21E09; Sun, 26 Nov 2017 13:07:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id ECA2CC21DDB; Sun, 26 Nov 2017 13:06:56 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lists.denx.de (Postfix) with ESMTPS id 8304AC21DA9 for ; Sun, 26 Nov 2017 13:06:53 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0MPV69-1eEnuk1PNZ-004ieJ; Sun, 26 Nov 2017 14:06:43 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:12 +0100 Message-Id: <20171126130523.4993-8-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:vAI4ykvEsFm8O7I57JPL3ewzvNkDQbO8oCIM1rveI8/YXFNi/MI PRtVFCfqvIisSR5FCuQBHwROaFj8IlRdo7lsvTVC0t3qbybZjP1sHLeOrueRj/0XynQUkir 25BEVvjBmhJGGSc59munrfxRuj0sSaiDHkvaunRwqIKhg/JCgUi6pmp3ubJ07O/WVaPBHqS 9MQb49AzkPn7FsbRvqrNw== X-UI-Out-Filterresults: notjunk:1; V01:K0:0uD5/V7Am0M=:zTgCx/YnblSeOMVejxbMoM 7Kzgc8ndecdcDH8VbBoL5ZUpehGiEYaXQCtX5dK607g8VGy4ycHvbYPnuTnEM3PXkVV9AusvY E2XHT4onL7Y9j/Y5UdZPmPBtOCX4XAwue8cG7v/DOuEPaZUL6xBwFabK1D9IdKymwlB0igBUy T8BHilsEP2KxbhdOZVjVFKJof0CDLlbaoCYS1FaFQBnkrK0zCZq7mJLSJB4r7TurWy/TFoleJ 23uetB0xw0wRsExOVZe7bxfhTGYao5lDDc6YvBlY5yA1gx8bSVOgCPhxhyZnvywrE6MO3GmYa 50ze2uqrLlsaW+qrZG1ApU9XNp+t1L4GCERE4LaFdAFt6z4QFFmog9qt21CHt6o9WYj1te6R5 X8MDQDWnnRQHVo4OvcXIDCbmHGkF6ECac+MwD1oM64n6hvFTF0nvSBist/67JsiM1/PP2qaC+ prWckICp3f/OJPRLdX85EkVxPu6+I2UmekDBjNcxNTD7kLikCy1J/LaPgDImRc7V0+402xLWL Ech4V0MzfhLdribuQYw71CBoPMWYUtASUci/auLmkxc2jhr6HgDzSHWm/7lgEMm+fbArvNti8 2mUAx/0L2uJfQ9vzE0Ic8HsZI8anVaFXhU8mmPfsPedpzKdjOfY+9ghaie2OHL7oYzNCLHOjO AzqvCKgf1jbrnocjbnQex/VFa8i+YSX4lwcvBMt7lZaOaYjXxVCX7nFi8E+bOS+ji25dUIAl8 6d09TWEbmN/xWpH0EOqCJonBxSBgFQF2RdyHQgO2dTmQGYZCYJRnOcxu38Rxw+iuEHTVPo1q2 nhSlsOaUB2DPni2Q33YNANFyCZj/g== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 07/18] efi_loader: efi_disk: use efi_add_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" Use efi_add_protocol to install protocols. Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- v3 no change v2 no change --- lib/efi_loader/efi_disk.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index c6f0d732c1..1d6cf3122f 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -213,33 +213,40 @@ static void efi_disk_add_dev(const char *name, unsigned int part) { struct efi_disk_obj *diskobj; + efi_status_t ret; /* Don't add empty devices */ if (!desc->lba) return; diskobj = calloc(1, sizeof(*diskobj)); - if (!diskobj) { - printf("ERROR: Out of memory\n"); - return; - } + if (!diskobj) + goto out_of_memory; + + /* Hook up to the device list */ + list_add_tail(&diskobj->parent.link, &efi_obj_list); /* Fill in object data */ diskobj->dp = efi_dp_from_part(desc, part); diskobj->part = part; - diskobj->parent.protocols[0].guid = &efi_block_io_guid; - diskobj->parent.protocols[0].protocol_interface = &diskobj->ops; - diskobj->parent.protocols[1].guid = &efi_guid_device_path; - diskobj->parent.protocols[1].protocol_interface = diskobj->dp; + diskobj->parent.handle = diskobj; + ret = efi_add_protocol(diskobj->parent.handle, &efi_block_io_guid, + &diskobj->ops); + if (ret != EFI_SUCCESS) + goto out_of_memory; + ret = efi_add_protocol(diskobj->parent.handle, &efi_guid_device_path, + diskobj->dp); + if (ret != EFI_SUCCESS) + goto out_of_memory; if (part >= 1) { diskobj->volume = efi_simple_file_system(desc, part, diskobj->dp); - diskobj->parent.protocols[2].guid = - &efi_simple_file_system_protocol_guid; - diskobj->parent.protocols[2].protocol_interface = - diskobj->volume; + ret = efi_add_protocol(diskobj->parent.handle, + &efi_simple_file_system_protocol_guid, + &diskobj->volume); + if (ret != EFI_SUCCESS) + goto out_of_memory; } - diskobj->parent.handle = diskobj; diskobj->ops = block_io_disk_template; diskobj->ifname = if_typename; diskobj->dev_index = dev_index; @@ -253,9 +260,9 @@ static void efi_disk_add_dev(const char *name, diskobj->media.io_align = desc->blksz; diskobj->media.last_block = desc->lba - offset; diskobj->ops.media = &diskobj->media; - - /* Hook up to the device list */ - list_add_tail(&diskobj->parent.link, &efi_obj_list); + return; +out_of_memory: + printf("ERROR: Out of memory\n"); } static int efi_disk_create_eltorito(struct blk_desc *desc, From patchwork Sun Nov 26 13:05:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841387 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9RJ2wFpz9s3w for ; Mon, 27 Nov 2017 00:15:56 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 3131AC21DCA; Sun, 26 Nov 2017 13:10:02 +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, RCVD_IN_MSPIKE_H2 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 1BC28C21E1E; Sun, 26 Nov 2017 13:07:24 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BB901C21DA9; Sun, 26 Nov 2017 13:07:00 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id C0D8EC21DDA for ; Sun, 26 Nov 2017 13:06:54 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0MTSrf-1ekCWa2iRz-00SQAn; Sun, 26 Nov 2017 14:06:43 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:13 +0100 Message-Id: <20171126130523.4993-9-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:oz8TYhtCfc7/53pH18FHSdwgKCQz9zZ9+kP7cgWz6Mr//nbWxwF vIECHZbJgh9J3hhPoPvDwT8VUAaiLpHuCq/j8vPVQEbUAvkOMCYJD6ShuDUDkoDnEYO7mrC 1KL35qYqow4EcUjmhbT/3k95NvSZ49VCYQrgYqrQEh21bTKLZGqXcYNZanR6J/i0o57j+8D MEo/ru1SgVQL6zscYoTTA== X-UI-Out-Filterresults: notjunk:1; V01:K0:YKKG4Nv45Ag=:95LQFsDjIZl+5a+u3d7CIn kZIKjH2omdqgQoECUcwbzV+WT/A0sZ+pJHDP9l/zktPBvFaSkGbmH70sYTqwMzByw/38uHHEM qdH4rxVi0C/vdmvCJIY5EIiTW/HJGn9OR0T+/QPe4GXtd3QSZ3Njce/9RuZiMaoOzQiCz0uzG DnZ9Fk10rRDNGxi9SCd0SIN814akGnVmip7t91fH7fnhPf8b2HD3bknoJKW6Vyz17KIIlR1RN HnepYokowxIfTVuSHpG7QGHeWylx5f7pgPz2S8oUKQy+kgEXCqcUxfKJYXtTzwtJYAPboVPY/ YUl0b2d7Uqksc2Oh9dxtXcwu/LcIrch8faZqoF4Ewy4rcOOIsf+PE2VqjaRpPXA+nElG4wzAr 1XsQLSgLLwZWbwDesfWje3h8us0z0rjQ3gB+XwIFDgfq32K1LBcj9rihrNTvY42LYwIMTxZQK ah4DNMb5IZZPh95SjojIIYoWICLEFwY7Gi0352zHDkh6PKRjugcUiGlVknZLIFeOqsJpg1QcE a8OBDivp5G5ZcNkJF/mgjoRtBXfYkETtlwo5bX3zE71sI9AwKaSnBLSDX/P3uLWvNN7hmUtM6 qNuiq6gFVPDn0VxYZxl3iW0+Eqb6L+GK1u7Bq2drChl+PxC9UPv/ty/0L3c/lxUc/0bcDxZyo lcD1UxTX/V/lnY9R295R9jFiyGjNxCJDIojYcWIBX04O6doQGOGe1dzK2VQnhSC0i9tKdmZuB hQHolpz2PIpYKdNt4bUIupnvEYdPH2Km/sCXG8mUCiRdegzEUqPFRMXtzahZ3rq9VhWQo3HIC iohGw9Cl83REz6VtuK9RgX75/PbUA== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 08/18] efi_loader: efi_net: use efi_add_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" Use efi_add_protocol to add protocols. Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- v3 no change v2 no change --- lib/efi_loader/efi_net.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index a7b101e830..8b2f682351 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -292,20 +292,26 @@ int efi_net_register(void) /* We only expose the "active" eth device, so one is enough */ netobj = calloc(1, sizeof(*netobj)); - if (!netobj) { - printf("ERROR: Out of memory\n"); - return 1; - } + if (!netobj) + goto out_of_memory; + + /* Hook net up to the device list */ + list_add_tail(&netobj->parent.link, &efi_obj_list); /* Fill in object data */ - netobj->parent.protocols[0].guid = &efi_net_guid; - netobj->parent.protocols[0].protocol_interface = &netobj->net; - netobj->parent.protocols[1].guid = &efi_guid_device_path; - netobj->parent.protocols[1].protocol_interface = - efi_dp_from_eth(); - netobj->parent.protocols[2].guid = &efi_pxe_guid; - netobj->parent.protocols[2].protocol_interface = &netobj->pxe; netobj->parent.handle = &netobj->net; + r = efi_add_protocol(netobj->parent.handle, &efi_net_guid, + &netobj->net); + if (r != EFI_SUCCESS) + goto out_of_memory; + r = efi_add_protocol(netobj->parent.handle, &efi_guid_device_path, + efi_dp_from_eth()); + if (r != EFI_SUCCESS) + goto out_of_memory; + r = efi_add_protocol(netobj->parent.handle, &efi_pxe_guid, + &netobj->pxe); + if (r != EFI_SUCCESS) + goto out_of_memory; netobj->net.revision = EFI_SIMPLE_NETWORK_PROTOCOL_REVISION; netobj->net.start = efi_net_start; netobj->net.stop = efi_net_stop; @@ -330,9 +336,6 @@ int efi_net_register(void) if (dhcp_ack) netobj->pxe_mode.dhcp_ack = *dhcp_ack; - /* Hook net up to the device list */ - list_add_tail(&netobj->parent.link, &efi_obj_list); - /* * Create WaitForPacket event. */ @@ -365,4 +368,7 @@ int efi_net_register(void) } return 0; +out_of_memory: + printf("ERROR: Out of memory\n"); + return 1; } From patchwork Sun Nov 26 13:05:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841384 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9Ph0rnvz9s4q for ; Mon, 27 Nov 2017 00:14:31 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id B675DC21DAB; Sun, 26 Nov 2017 13:09:29 +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_BLOCKED,RCVD_IN_MSPIKE_H2 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 C005FC21C4C; Sun, 26 Nov 2017 13:07:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C1CCBC21DFA; Sun, 26 Nov 2017 13:07:00 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lists.denx.de (Postfix) with ESMTPS id F0E87C21DDE for ; Sun, 26 Nov 2017 13:06:54 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0MBFUT-1eT57842DN-00ACpj; Sun, 26 Nov 2017 14:06:44 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:14 +0100 Message-Id: <20171126130523.4993-10-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:hwdFU6eX+mP91sH1oUSSjSS+gpz5UMoGOPJBFrDjBxGlRhUl9+E gaLpHvniiwjeQ/5Z+HrS/isCYXXzuBW+jmToKrpJSTP1lLlS2awDCQg8DI/S2dOvg0DZhq2 6qVS81ntYxYGrkP2neQfJtcd+3C4CpLS96Wwi6Gf8rtZR5G8fIRBwgp31Qof+Ne717TFtkQ u08Xm1n6WUtKPUZj3w+Qw== X-UI-Out-Filterresults: notjunk:1; V01:K0:Pn7LAxGVdXs=:K8Z20ZrBRKMqbEdjhO8jsJ L+i75TN6ZZuh+bk9rW9eMH5QM5PZ4E196Kekkb/9JtXL8pPI64LNzhGHLapS6hgVHCkfVdJ+l Al+bkE3M1gxdUJPCB3RwqTnSdBkYIH8NXlad5L3TjI10Vyt1oRpvKC5/lCoGeoUapZS67Ioz3 B+DJJlhXdMXok1Y5jrwGhna8wau8U1i5kGOmHe0s203d2Pst2rXr+ph17LM0FUq5zAKbh4K3z CTNgPcjf6NBWPFSf3/evh9qO14JZuw8npfw3wtVC4ZMlbkmbyUZz1Alkzjc6ZEPenCiVEqgqm oDsghmbXp1lRVf4grM3eTmcqxp2TB8EGBlcsqkMqlRTpJrAJrjo/FrAds+XVCKOrh+0mvUbrn F0MOhyX81JXqyOKFzSCmCNUjTFVvzGvqp/s7+ZxRYzhGBhJeZ0v3SbQi7YHuyNQGmCF5LKBHH +3r62y29MqfRCELIbVGAyi4f2/ywkXAiC+hZRDAFIiOEX5rP/elG91fDbdRYzCKhIZlgEsuZX b30nKezxfHDcnKSIeSP2a0CFSGik4WhjGa9xRZCC4zbIbtXbx8wFz2wHWnEXYrVYaQgJX9ncT wFmt6/R4GLNLyr5LK6Cc+0NqTEIkO4sJVdD/MCmc3OnYaUSYSuNxSL2kd325R/hQqjsg4qgGq wo045FgiE32Vpqe31WaI1b5xg2aceoU8MWwVChjtIkikUVbMeFp2Ft3Gdu2XjPKrSotedT/pm cdluQL0BmxurmBUzsgubLHD8hVOm8DOvY14aYag73n/1vbaqe+tmwzg2HDXN3EcDSmjNuJNA+ SCouV763HvBXkp3unmDlTranDuo/g== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 09/18] efi_loader: efi_gop: use efi_add_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" Use efi_add_protocol to add protocol. Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- v3 no change v2 no change --- lib/efi_loader/efi_gop.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c index 7370eeee37..7b74d6ef33 100644 --- a/lib/efi_loader/efi_gop.c +++ b/lib/efi_loader/efi_gop.c @@ -132,6 +132,7 @@ int efi_gop_register(void) u32 bpix, col, row; u64 fb_base, fb_size; void *fb; + efi_status_t ret; #ifdef CONFIG_DM_VIDEO struct udevice *vdev; @@ -178,10 +179,17 @@ int efi_gop_register(void) return 1; } + /* Hook up to the device list */ + list_add_tail(&gopobj->parent.link, &efi_obj_list); + /* Fill in object data */ - gopobj->parent.protocols[0].guid = &efi_gop_guid; - gopobj->parent.protocols[0].protocol_interface = &gopobj->ops; gopobj->parent.handle = &gopobj->ops; + ret = efi_add_protocol(gopobj->parent.handle, &efi_gop_guid, + &gopobj->ops); + if (ret != EFI_SUCCESS) { + printf("ERROR: Out of memory\n"); + return 1; + } gopobj->ops.query_mode = gop_query_mode; gopobj->ops.set_mode = gop_set_mode; gopobj->ops.blt = gop_blt; @@ -210,8 +218,5 @@ int efi_gop_register(void) gopobj->bpix = bpix; gopobj->fb = fb; - /* Hook up to the device list */ - list_add_tail(&gopobj->parent.link, &efi_obj_list); - return 0; } From patchwork Sun Nov 26 13:05:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841392 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9Tx6cz6z9s3w for ; Mon, 27 Nov 2017 00:18:13 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id A56E3C21DB5; Sun, 26 Nov 2017 13:10:35 +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_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL 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 68124C21DF4; Sun, 26 Nov 2017 13:07:30 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D1762C21E2C; Sun, 26 Nov 2017 13:07:00 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lists.denx.de (Postfix) with ESMTPS id 92E2FC21DD0 for ; Sun, 26 Nov 2017 13:06:54 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LaWlT-1ezNzn13RX-00mHTZ; Sun, 26 Nov 2017 14:06:44 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:15 +0100 Message-Id: <20171126130523.4993-11-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:AcINgVKVr9AcIDB14jSwxfmpMmK227mGxwrKHYDHSlhL+47WNGD /HiPqi1c5GwHr0bYa+Mm345f+6jXscvMO6tPEtkJK5DqmV/gg+pAgkNVkZnJmokLTCWuZA6 QNPxdZUQPbZpYyOE0Hw11SnvZmrsVwfc0Utknvv1dtUymKDzalguio7peVW53oODNxDw++O 5FJx0BYHVjBWHeGjuwy7A== X-UI-Out-Filterresults: notjunk:1; V01:K0:cHrMZ0II3Jc=:C/g3D1GTpYSIDFXDNnqtwv Gj96qd8XgBHeCiOKgDYElIL0Rb2iZs//h0T0GnnaEpCDWrSRMyY+dQDy9rA2Jj7uQ+q7O/mYH 9tmfVoXy9CdnkvrsC7gZEFgyUxrq6mgs3nEJgUTo/f9SKdIzPP0DSLWg+eqGeWKHm8cbKC7Ap cIiBHuFodeJlISATKknEcpX1o+kltSW3xet9KOYRqLXV79qhtOwkMB6B0m0/VIyaNn0SRrvKQ RPv08OdgskFHqUsAXlDFr9pkncERgn7mtAy/qekQB54a3LRJhIVRF0YsMP/wnPLvDpEkRhDIE 5TF2uStc2NGND6ILHibd2pNwDYAgpjAxcZ2vL8dzILS5uObE2vB6kqJBxdEw+4ypBt1Z4lZLz bY7Y5IEwHqWTNHDIVyVUFSE7eERAsCpl1cUCPAGzKFazMPrOJrO0fZ8T/UHSDnVD4IafHV1EV rFxqkUAlVOvR7mYqKKcNIt4aiSuuhSrGKquZuiV1khl0aDOIC+WUPMeLJTOgmkBnTBw3XU88Z yP5U8WTqadXQMtYesDHHMNMprnbpcGredSEISq54AmF3l2MI2wsOEnc0L/YtMycJyPJ3c1v4X 9xWt7vZ3aMnU2Bw8Wzkbja/4PXrJzmvCj26a2nuktoVq9wYPX6VDNyLiUGHMCjhLjH/UqR58q Tz2O4qpDjlYVxurowOsf27XG7T7cqu/c4jgWCB4U17B1X8bwT7Ek8GLe6fvgY/d9T04qCO2i0 bPBdQagNqQkANrF8e9cIsCgRjKfaRRHi9ccTf10obD9lGd7AKXre1CyvzCLpATTmg6ZV+Bw2s rU9rYZBhUXfD2KJXxxpWANpQ5DbPw== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 10/18] efi_loader: simplify efi_open_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" Use function efi_search_protocol. Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- v3 no change v2 no change --- lib/efi_loader/efi_boottime.c | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 565addfc3f..4cc5b1e620 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -2051,8 +2051,7 @@ static efi_status_t EFIAPI efi_open_protocol( void **protocol_interface, void *agent_handle, void *controller_handle, uint32_t attributes) { - struct list_head *lhandle; - int i; + struct efi_handler *handler; efi_status_t r = EFI_INVALID_PARAMETER; EFI_ENTRY("%p, %pUl, %p, %p, %p, 0x%x", handle, protocol, @@ -2065,8 +2064,6 @@ static efi_status_t EFIAPI efi_open_protocol( goto out; } - EFI_PRINT_GUID("protocol", protocol); - switch (attributes) { case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL: case EFI_OPEN_PROTOCOL_GET_PROTOCOL: @@ -2087,33 +2084,12 @@ static efi_status_t EFIAPI efi_open_protocol( goto out; } - list_for_each(lhandle, &efi_obj_list) { - struct efi_object *efiobj; - efiobj = list_entry(lhandle, struct efi_object, link); - - if (efiobj->handle != handle) - continue; - - for (i = 0; i < ARRAY_SIZE(efiobj->protocols); i++) { - struct efi_handler *handler = &efiobj->protocols[i]; - const efi_guid_t *hprotocol = handler->guid; - if (!hprotocol) - continue; - if (!guidcmp(hprotocol, protocol)) { - if (attributes != - EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { - *protocol_interface = - handler->protocol_interface; - } - r = EFI_SUCCESS; - goto out; - } - } - goto unsupported; - } + r = efi_search_protocol(handle, protocol, &handler); + if (r != EFI_SUCCESS) + goto out; -unsupported: - r = EFI_UNSUPPORTED; + if (attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) + *protocol_interface = handler->protocol_interface; out: return EFI_EXIT(r); } From patchwork Sun Nov 26 13:05:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841382 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9P52ZQkz9s3w for ; Mon, 27 Nov 2017 00:14:01 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 0639DC21DED; Sun, 26 Nov 2017 13:10:19 +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_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL 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 30FD5C21DF7; Sun, 26 Nov 2017 13:07:25 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E6B20C21DAB; Sun, 26 Nov 2017 13:07:00 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lists.denx.de (Postfix) with ESMTPS id 4776AC21DBB for ; Sun, 26 Nov 2017 13:06:55 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0M54L0-1f3azC2Oha-00zI9E; Sun, 26 Nov 2017 14:06:44 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:16 +0100 Message-Id: <20171126130523.4993-12-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:x9R9aveztJM0PDoxM60LXurKKgLOuxBnrAA9+XnVJVWUaAhMDoX eAdQbkDLDqrUn51leRf0jgoBWZrkbbvnXrHJtTtWOf0FfpCILZGSZPlHd7jcEXUi/7t2S+3 PLFVx8nRDXclYEgX0/ep4K2S0NvG/hDwaAWMt7BYyZGkqxpP7fqHvMT+aI/D14vvUGatWUB YzbXAiTlx/dpx5q3icBXw== X-UI-Out-Filterresults: notjunk:1; V01:K0:+5vjjxJwqUc=:vtKF+CAcSnCJ7ZmSI0JR9j AHoWMpOuUmknBQqtKZIrvM4RB2HwBjQnpcjUa/HKtVQ6EqWtCBR22C2pfJgqbJ1SZKA3aaV90 rkToD7nWfEW1XdG91EvnOTcpn4vNQez447h6yUekQzjPlAGRyCYXcDm+7Bp4yJZRXU0egDfG3 mwinsTG4MaygS03l7Oqgf0gZjeFU4K+qpZHDXmismIrJI3jXzs1Y/XA85a4YALdrIqV8DHWL+ SRCtaquEjqdTqJeQjPL0cgVrPkQ/YsNRFXmZvURVLcO30xdvm0OKtVGNz+draxY9XZok2GMjg h7zaUWNXLpNRtWsm/QYoHItAhVjE1dlBBwBq0FQPOY50tESVE61pOSDL8N9k1UQwxPax9c/X0 5Y4ZKYZedqFcQUBFWhZ/9TAPK4RcZnw0YRtvIEpOFD8i2nVRohA7S/YBXPprTFFbrQzMcKCLq stiJskjdr/i/67Ad3jHxeefYaXXOY4IIXAESrw2BSPOZf4O2Vuolco5umSxND2r+EKi2LN2Tw WkODhIL/w9K7OjahI5V0aFEoZ90BFknBY4xrauZfNEnyKN15012FAp6VucPChlC/afuzjRGz4 Rx8UBKZCmB5g731P61RGsjrE38k3S//s4mzhbVw0+kokpXe1k9qvZWh9XCzrSY9K1NkmgZmqT qzWmuD/awJwSdOYGXS5E9cdLmdA9O5Tf9fIcCGwHmBuTroiIhZB1hPLGzr+fncfZwN+Wl8Rrp NvCRGRPz0BWNmG90JIkXybz2BLpErWCdVxpnfgGfvyaP2zKNN3iWnfe+PdjL2GQkr8RiCA5sh ObnY26/b2Jkv2az9OSU3KTPTIi1oA== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 11/18] efi_loader: simplify find_obj 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" Use function efi_search_protocol(). Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- v3 fix typo in commit message v2 no change --- lib/efi_loader/efi_device_path.c | 43 ++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 9027ae8efb..b4e2f933cb 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -128,32 +128,27 @@ static struct efi_object *find_obj(struct efi_device_path *dp, bool short_path, struct efi_object *efiobj; list_for_each_entry(efiobj, &efi_obj_list, link) { - int i; - - for (i = 0; i < ARRAY_SIZE(efiobj->protocols); i++) { - struct efi_handler *handler = &efiobj->protocols[i]; - struct efi_device_path *obj_dp; - - if (!handler->guid) - break; - - if (guidcmp(handler->guid, &efi_guid_device_path)) - continue; - - obj_dp = handler->protocol_interface; - - do { - if (efi_dp_match(dp, obj_dp) == 0) { - if (rem) { - *rem = ((void *)dp) + - efi_dp_size(obj_dp); - } - return efiobj; + struct efi_handler *handler; + struct efi_device_path *obj_dp; + efi_status_t ret; + + ret = efi_search_protocol(efiobj->handle, + &efi_guid_device_path, &handler); + if (ret != EFI_SUCCESS) + continue; + obj_dp = handler->protocol_interface; + + do { + if (efi_dp_match(dp, obj_dp) == 0) { + if (rem) { + *rem = ((void *)dp) + + efi_dp_size(obj_dp); } + return efiobj; + } - obj_dp = shorten_path(efi_dp_next(obj_dp)); - } while (short_path && obj_dp); - } + obj_dp = shorten_path(efi_dp_next(obj_dp)); + } while (short_path && obj_dp); } return NULL; From patchwork Sun Nov 26 13:05:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841385 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9Q94w9Qz9s3w for ; Mon, 27 Nov 2017 00:14:57 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 6B9F1C21DC1; Sun, 26 Nov 2017 13:12: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.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL 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 37233C21DE6; Sun, 26 Nov 2017 13:08:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E99E4C21DAA; Sun, 26 Nov 2017 13:07:08 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lists.denx.de (Postfix) with ESMTPS id A4E58C21DBA for ; Sun, 26 Nov 2017 13:07:04 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LvEZe-1fHtFc39aU-010NXs; Sun, 26 Nov 2017 14:06:54 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:17 +0100 Message-Id: <20171126130523.4993-13-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:YuQgnMKuNKjtlostPyD0s69CAKN7OcFO+gMYJVM3UfJAf6cvff2 NlbFyd9bskBZD+Tr2Gcyt9FKKHmU6M8JMbqX606xfTwcfvVrCDQBEUetijwt4xe4HxHZGag fCfEWqDyyI6lPeoY2NHrbeHv4CCSoDW9fWi42IFMjKaj+eGqrihqTLl3fM8N+qZePf96dll 9iVUp+VNdsk8iltXIbIPg== X-UI-Out-Filterresults: notjunk:1; V01:K0:yiuMNvMLvyE=:gqMfAWhr6xUscG+gWGFwRb vDztrCN4DoNxL+gcBETdG4g1axVfcGWr2KRvKYE/iFaayKoBQBasXZCOf3NmyL4xTfN0O4sU5 L8/Ig7BAkvkIEPsSYvNVyPeU2p5UwwI/KM3yCmQTsssUpXEuZvXuxucJ1BSJ1yCfYd2bGI5pT f3ELLNR6isY/QBr4u+1jlOsG+m/3pdxsNEozmZWKSE4fzsuRqyRItTDr+X5ceVki25Akxm+Oj 6c4ynbnjno1TZQQ87MPfHzEO/WX6d+n9eSJDm7G2t4OkkZSqy5sc0EI8XaAlmV7togTZM3aG3 K3k5PmJnP0+WapZcE59j6d/Zb/NpML1ZUISt700n08DQ49Vy3p2xgZRRKfr0r03qHhBlbJkne 5VV1f+aJm0HHFBvgXvej/g/yZL59JpuD6Jbucq55g9EeC0TR/dT1gLzqzHkXvxDNt6F5RAvIe O4J/tpy2JMPf//rfX9TCz9UigbFpLdFJt2InBIBkXxEEnTmHgs4FHwRcvH0WyvUc6V1oRmV4B ru4f9oDX9fFSXi5BixgXbx09HoeMiAqmw91kH87f1Bi+AVsuhaVEgNUNadWATuPJSUS4v1P7f 0vnfTUQRxYO3YL85dhZNy9vgTNh14qAeaBqce7hHUOcJIuT9wF8xOTW+56djYQYgyyAnaZUrs mz7b+r6HBVLxsoP/YHeFaDE+aiIySukPZBtXKbKoryQ89pQdCqoys7dBERJw8t1TgwAZWvFJa DHQzcMG2tpIchR5xkNkheRm1P4G1xPLswC3NNhIAspCvRqocTbLv5nlYoQTfHEGqSIkpjgc7q SKO9bH70gNUWqm0Z6HzPHKuR8TnFA== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 12/18] efi_loader: manage protocols in a linked list 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" Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- v3 no change v2 no change --- include/efi_loader.h | 6 ++- lib/efi_loader/efi_boottime.c | 107 ++++++++++++++++++++---------------------- lib/efi_loader/efi_disk.c | 1 + lib/efi_loader/efi_gop.c | 1 + lib/efi_loader/efi_net.c | 1 + 5 files changed, 58 insertions(+), 58 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index e1f0af3496..a73bbc1269 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -101,6 +101,8 @@ extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop; * interface (usually a struct with callback functions), this struct maps the * protocol GUID to the respective protocol interface */ struct efi_handler { + /* Link to the list of protocols of a handle */ + struct list_head link; const efi_guid_t *guid; void *protocol_interface; }; @@ -115,8 +117,8 @@ struct efi_handler { struct efi_object { /* Every UEFI object is part of a global object list */ struct list_head link; - /* We support up to 16 "protocols" an object can be accessed through */ - struct efi_handler protocols[16]; + /* The list of protocols */ + struct list_head protocols; /* The object spawner can either use this for data or as identifier */ void *handle; }; diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 4cc5b1e620..54e9c27db1 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -339,6 +339,7 @@ efi_status_t efi_create_handle(void **handle) return r; memset(obj, 0, sizeof(struct efi_object)); obj->handle = obj; + INIT_LIST_HEAD(&obj->protocols); list_add_tail(&obj->link, &efi_obj_list); *handle = obj; return r; @@ -715,18 +716,17 @@ efi_status_t efi_search_protocol(const void *handle, struct efi_handler **handler) { struct efi_object *efiobj; - size_t i; - struct efi_handler *protocol; + struct list_head *lhandle; if (!handle || !protocol_guid) return EFI_INVALID_PARAMETER; efiobj = efi_search_obj(handle); if (!efiobj) return EFI_INVALID_PARAMETER; - for (i = 0; i < ARRAY_SIZE(efiobj->protocols); i++) { - protocol = &efiobj->protocols[i]; - if (!protocol->guid) - continue; + list_for_each(lhandle, &efiobj->protocols) { + struct efi_handler *protocol; + + protocol = list_entry(lhandle, struct efi_handler, link); if (!guidcmp(protocol->guid, protocol_guid)) { if (handler) *handler = protocol; @@ -750,7 +750,6 @@ efi_status_t efi_add_protocol(const void *handle, const efi_guid_t *protocol, struct efi_object *efiobj; struct efi_handler *handler; efi_status_t ret; - size_t i; efiobj = efi_search_obj(handle); if (!efiobj) @@ -761,16 +760,10 @@ efi_status_t efi_add_protocol(const void *handle, const efi_guid_t *protocol, handler = calloc(1, sizeof(struct efi_handler)); if (!handler) return EFI_OUT_OF_RESOURCES; - /* Install protocol in first empty slot. */ - for (i = 0; i < ARRAY_SIZE(efiobj->protocols); i++) { - handler = &efiobj->protocols[i]; - if (handler->guid) - continue; - handler->guid = protocol; - handler->protocol_interface = protocol_interface; - return EFI_SUCCESS; - } - return EFI_OUT_OF_RESOURCES; + handler->guid = protocol; + handler->protocol_interface = protocol_interface; + list_add_tail(&handler->link, &efiobj->protocols); + return EFI_SUCCESS; } /* @@ -790,10 +783,10 @@ efi_status_t efi_remove_protocol(const void *handle, const efi_guid_t *protocol, ret = efi_search_protocol(handle, protocol, &handler); if (ret != EFI_SUCCESS) return ret; - if (handler->protocol_interface != protocol_interface) - return EFI_NOT_FOUND; - handler->guid = NULL; - handler->protocol_interface = NULL; + if (guidcmp(handler->guid, protocol)) + return EFI_INVALID_PARAMETER; + list_del(&handler->link); + free(handler); return EFI_SUCCESS; } @@ -806,17 +799,22 @@ efi_status_t efi_remove_protocol(const void *handle, const efi_guid_t *protocol, efi_status_t efi_remove_all_protocols(const void *handle) { struct efi_object *efiobj; - struct efi_handler *handler; - size_t i; + struct list_head *lhandle; + struct list_head *pos; efiobj = efi_search_obj(handle); if (!efiobj) return EFI_INVALID_PARAMETER; + list_for_each_safe(lhandle, pos, &efiobj->protocols) { + struct efi_handler *protocol; + efi_status_t ret; - for (i = 0; i < ARRAY_SIZE(efiobj->protocols); i++) { - handler = &efiobj->protocols[i]; - handler->guid = NULL; - handler->protocol_interface = NULL; + protocol = list_entry(lhandle, struct efi_handler, link); + + ret = efi_remove_protocol(handle, protocol->guid, + protocol->protocol_interface); + if (ret != EFI_SUCCESS) + return ret; } return EFI_SUCCESS; } @@ -1171,6 +1169,7 @@ void efi_setup_loaded_image(struct efi_loaded_image *info, struct efi_object *ob if (device_path) info->device_handle = efi_dp_find_obj(device_path, NULL); + INIT_LIST_HEAD(&obj->protocols); list_add_tail(&obj->link, &efi_obj_list); /* * When asking for the device path interface, return @@ -1648,8 +1647,7 @@ static efi_status_t EFIAPI efi_protocols_per_handle(void *handle, { unsigned long buffer_size; struct efi_object *efiobj; - unsigned long i, j; - struct list_head *lhandle; + struct list_head *protocol_handle; efi_status_t r; EFI_ENTRY("%p, %p, %p", handle, protocol_buffer, @@ -1660,36 +1658,33 @@ static efi_status_t EFIAPI efi_protocols_per_handle(void *handle, *protocol_buffer = NULL; *protocol_buffer_count = 0; - list_for_each(lhandle, &efi_obj_list) { - efiobj = list_entry(lhandle, struct efi_object, link); - if (efiobj->handle != handle) - continue; + efiobj = efi_search_obj(handle); + if (!efiobj) + return EFI_EXIT(EFI_INVALID_PARAMETER); - /* Count protocols */ - for (i = 0; i < ARRAY_SIZE(efiobj->protocols); i++) { - if (efiobj->protocols[i].guid) - ++*protocol_buffer_count; - } - /* Copy guids */ - if (*protocol_buffer_count) { - buffer_size = sizeof(efi_guid_t *) * - *protocol_buffer_count; - r = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, - buffer_size, - (void **)protocol_buffer); - if (r != EFI_SUCCESS) - return EFI_EXIT(r); - j = 0; - for (i = 0; i < ARRAY_SIZE(efiobj->protocols); ++i) { - if (efiobj->protocols[i].guid) { - (*protocol_buffer)[j] = (void *) - efiobj->protocols[i].guid; - ++j; - } - } + /* Count protocols */ + list_for_each(protocol_handle, &efiobj->protocols) { + ++*protocol_buffer_count; + } + + /* Copy guids */ + if (*protocol_buffer_count) { + size_t j = 0; + + buffer_size = sizeof(efi_guid_t *) * *protocol_buffer_count; + r = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, buffer_size, + (void **)protocol_buffer); + if (r != EFI_SUCCESS) + return EFI_EXIT(r); + list_for_each(protocol_handle, &efiobj->protocols) { + struct efi_handler *protocol; + + protocol = list_entry(protocol_handle, + struct efi_handler, link); + (*protocol_buffer)[j] = (void *)protocol->guid; + ++j; } - break; } return EFI_EXIT(EFI_SUCCESS); diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index 1d6cf3122f..af8db40e19 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -224,6 +224,7 @@ static void efi_disk_add_dev(const char *name, goto out_of_memory; /* Hook up to the device list */ + INIT_LIST_HEAD(&diskobj->parent.protocols); list_add_tail(&diskobj->parent.link, &efi_obj_list); /* Fill in object data */ diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c index 7b74d6ef33..498184d754 100644 --- a/lib/efi_loader/efi_gop.c +++ b/lib/efi_loader/efi_gop.c @@ -180,6 +180,7 @@ int efi_gop_register(void) } /* Hook up to the device list */ + INIT_LIST_HEAD(&gopobj->parent.protocols); list_add_tail(&gopobj->parent.link, &efi_obj_list); /* Fill in object data */ diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index 8b2f682351..74a67c5365 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -296,6 +296,7 @@ int efi_net_register(void) goto out_of_memory; /* Hook net up to the device list */ + INIT_LIST_HEAD(&netobj->parent.protocols); list_add_tail(&netobj->parent.link, &efi_obj_list); /* Fill in object data */ From patchwork Sun Nov 26 13:05:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841393 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9Vl0jfsz9s3w for ; Mon, 27 Nov 2017 00:18:55 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id A9FC0C21DDB; Sun, 26 Nov 2017 13:12:03 +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_BLOCKED,RCVD_IN_MSPIKE_H2 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 CF15EC21DDA; Sun, 26 Nov 2017 13:08:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8E2AFC21DE9; Sun, 26 Nov 2017 13:07:08 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lists.denx.de (Postfix) with ESMTPS id 7B660C21DED for ; Sun, 26 Nov 2017 13:07:04 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0MA91t-1ePmGE0JK5-00BIEN; Sun, 26 Nov 2017 14:06:55 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:18 +0100 Message-Id: <20171126130523.4993-14-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:NS3Rxof78pFsqn2jHVLmJIU//dvLinO+RQHFsGZCvmxXzZzX/Vc ao7xa0sKdhk4noZOVpxbgIsAYRwiO1QDnrDuKKQP9GvgV5EydLl7dCXs213wL+lVJTIDnBK JUCgjWmlQkCGwx9Qq2i2MuMgfJD04ia5yhj94Qu/XJQqJ+/L6XOWAa1JARD7lGrpsuaLEKm RUVI0+V1MgdlPQGL9oHAA== X-UI-Out-Filterresults: notjunk:1; V01:K0:ooCSkpHWQGw=:b+36pmIsCwwb6pgeR3U2hR igjOq3tW/4dKjAvtCmBOB7Hvo1wlcevlcT2+hG3a/gJdO0iLknltXIjwosd6fkBP9CiEU/j21 exKDp9FHl9THn36BRdlxT+qfvXK5v/oyQzCgaQ5i/SZ0dyuB4fzsrFkCyBbvfG5AVBVPpOrIF mggZJatg57H8bCfaC235gNUHCMoVmupub7aXgheYFgrCrgSGf+lgXanAGSkkXj9F0KaQpSsvl LANpfQsF74jLLeO2hMgymMhI6+7Y1btfWMkmTF+U3nZyTY/YFF+6hnM9JNNDeqzUx4SYWKhXG K/up1+1uvoONORPV/Xo1mUx/E9ToXrNiqDJwYBIWzF3DkaN2tAdUpqLSdp61SrzfC9q37fEGp 7MmQ3UMv28FtcojZZorxoWAtzVHNh7sI53iNs3OeBGNDl8mlEtw56qGLzgX0lff+ziUpv8n4j TjgIzcDWiQSGcatL1IphUefsw7wUg1cf3pjOkAwbPJgqDOIn26dlJmw7Qqd6XXmDQAacOA6pU UrtlYiU2Ilux8L3j8z0ywCbxvLl7pcX5hNUsMXl8ona6VvgwEmaRWvLwCNugg5/L7Y+adHZZg eYZoq/KguwzKsp8aZDPPrJyI4Q6SyET0OZhX66eHkfOt6D0k0ipyNe4HsMTNiq8kg1+EA81bj JdbD2U8x8eZtLX96XTkpNimekk2MDzN3cdOyzr00NPdEgXXF53uoQnO2Np1cba5eHj8BKm/5j SPP+R4TNjI5x67YVeoGYF6p3UHgslhJUdvNr0Imf8M5Oxbo1QlUpNeBwSrltCxcQGGuYIGDtZ iegWCSYSHSHdSTQW2BpVocn0yOV9w== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 13/18] efi_selftest: compile without special compiler flags 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" As the selftest is not compiled as an EFI binary we do not need special compiler flags. This avoids the checkarmreloc error on vexpress_ca15_tc2. Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- v3 no change v2 no change --- lib/efi_selftest/Makefile | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index d280eca5c3..837e86228e 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -7,31 +7,6 @@ # This file only gets included with CONFIG_EFI_LOADER set, so all # object inclusion implicitly depends on it -CFLAGS_efi_selftest.o := $(CFLAGS_EFI) -CFLAGS_REMOVE_efi_selftest.o := $(CFLAGS_NON_EFI) -CFLAGS_efi_selftest_console.o := $(CFLAGS_EFI) -CFLAGS_REMOVE_efi_selftest_console.o := $(CFLAGS_NON_EFI) -CFLAGS_efi_selftest_devicepathe.o := $(CFLAGS_EFI) -CFLAGS_REMOVE_efi_selftest_devicepath.o := $(CFLAGS_NON_EFI) -CFLAGS_efi_selftest_events.o := $(CFLAGS_EFI) -CFLAGS_REMOVE_efi_selftest_events.o := $(CFLAGS_NON_EFI) -CFLAGS_efi_selftest_exitbootservices.o := $(CFLAGS_EFI) -CFLAGS_REMOVE_efi_selftest_exitbootservices.o := $(CFLAGS_NON_EFI) -CFLAGS_efi_selftest_gop.o := $(CFLAGS_EFI) -CFLAGS_REMOVE_efi_selftest_gop.o := $(CFLAGS_NON_EFI) -CFLAGS_efi_selftest_manageprotocols.o := $(CFLAGS_EFI) -CFLAGS_REMOVE_efi_selftest_manageprotocols.o := $(CFLAGS_NON_EFI) -CFLAGS_efi_selftest_snp.o := $(CFLAGS_EFI) -CFLAGS_REMOVE_efi_selftest_snp.o := $(CFLAGS_NON_EFI) -CFLAGS_efi_selftest_textoutput.o := $(CFLAGS_EFI) -CFLAGS_REVMOE_efi_selftest_textoutput.o := $(CFLAGS_NON_EFI) -CFLAGS_efi_selftest_tpl.o := $(CFLAGS_EFI) -CFLAGS_REMOVE_efi_selftest_tpl.o := $(CFLAGS_NON_EFI) -CFLAGS_efi_selftest_util.o := $(CFLAGS_EFI) -CFLAGS_REMOVE_efi_selftest_util.o := $(CFLAGS_NON_EFI) -CFLAGS_efi_selftest_watchdog.o := $(CFLAGS_EFI) -CFLAGS_REMOVE_efi_selftest_watchdog.o := $(CFLAGS_NON_EFI) - obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += \ efi_selftest.o \ efi_selftest_console.o \ From patchwork Sun Nov 26 13:05:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841396 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9Wc1qhnz9s3w for ; Mon, 27 Nov 2017 00:19:40 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 00989C21DB9; Sun, 26 Nov 2017 13:12:21 +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, RCVD_IN_MSPIKE_H2 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 5857AC21DB5; Sun, 26 Nov 2017 13:08:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1402CC21DAA; Sun, 26 Nov 2017 13:07:08 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id 89421C21E06 for ; Sun, 26 Nov 2017 13:07:04 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0M5LJv-1f3s6C1X9r-00zZ89; Sun, 26 Nov 2017 14:06:55 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:19 +0100 Message-Id: <20171126130523.4993-15-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:oMRl2LMpgK25Eh1Bul1XzLhWYlvGP06WKdbT7MSkJ+T/WDV0CX7 sZQ4753uJYXsSy3m7cmLhJUl06+4X1p/G7RM37vcEmMWNqwFVsbkMGcbbU1w1lDj9l+hW+I +ucHFx4Mxp/IQSu+DDtL6/t+CThTOnbqXQ+ze/4uObPyGNXK7/0vb9Ez+ZjAlnESPMtH6/s 2HxmMR1tKewf3XR92M/sw== X-UI-Out-Filterresults: notjunk:1; V01:K0:gqJHRz5LYtI=:QyYK6ZAb/tNMryD01HAR94 oAEqmh4B6ghXxVSY8JDeaiKWXHX4V6VrPeHyWVwTXT1lDTgCK7HgDI6pBxjoQ6WtlvSd5sK/X 15f89vzJ+uD1gQqFJyZHUqoHNE45piQEB9/Tw+akJ/MMtcCU1KSqfSO4kLceArz3GOrJw+Tn2 Dd2zcUs+tEDHPGI54qm2JA5Ozqr7s3LYd1H0W1qZ1uZfU1u+FBHJf0P0E78cfFMQJXyCMHPJk sDKFSuzHJRPvihciB4wHEK35XXZpjXvb8+0C2aoiQQmuabEE7mtrfBp/UfvQ846BgZATB07pd k2w1fX/ygZtgXsWtKZj4epq4mXRxxXKL1zp3WeOybyH5vdb4DBoC683bUsaCRR0ReSn1Ca0XB HT38QT4ZjXr9CZx8AwKMusn1ibCiTj8ObnoxTpZ8e4KpSlCpMm8WUSwo13lOY0Uldm5U6hfom m/Y+gX9AS+rz+kAL3B0VuulwAdNPoTRqSt6W+0fOXyRYuEAfxmfQGYnjy+8ebCczU+zepTzDW acsK6xLoZ6d/97JcZDlneQTtF9nAjykdu3tE2fDCzV+IPvd80PrVVl7Pg8uHUgcF5GkmbiGUs Ub7l5yxz995U2EUxX3O4dhHmmm20KTPyl52uUyVXBKrQcx0wWIe+47zZD7Btewie3pwSf5NyV RDMIaIxeDK0488FO0cmBfILU8kZ7bVfA9CPO/yEtkbz5sMLAPUI6yX+/jG2VytL/ecgjWloL3 bsVuYbsFrgZ5PjZ124yMEIxTBkUvVaAraYBqgV8lOTW/gEqHHXX7d91MZdUaD7UYuxj1FAAUe sQdmmLBlrCMXbg6YUQlxuSZ+rBDHA== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 14/18] efi_selftest: add missing line feed 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" Add a missing line feed for an error message. Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- v3 no change v2 new patch --- lib/efi_selftest/efi_selftest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c index 263b53f672..4e5a12c47c 100644 --- a/lib/efi_selftest/efi_selftest.c +++ b/lib/efi_selftest/efi_selftest.c @@ -239,7 +239,7 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle, ret = boottime->handle_protocol(image_handle, &efi_guid_loaded_image, (void **)&loaded_image); if (ret != EFI_SUCCESS) { - efi_st_error("Cannot open loaded image protocol"); + efi_st_error("Cannot open loaded image protocol\n"); return ret; } From patchwork Sun Nov 26 13:05:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841394 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9W86B0Tz9s3w for ; Mon, 27 Nov 2017 00:19:16 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 88BF3C21DFA; Sun, 26 Nov 2017 13:10:53 +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, RCVD_IN_MSPIKE_H2 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 6CC77C21E48; Sun, 26 Nov 2017 13:07:57 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 71D1CC21DDF; Sun, 26 Nov 2017 13:07:09 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id C1B1EC21DE5 for ; Sun, 26 Nov 2017 13:07:04 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LgqQQ-1ewtxZ2mCU-00oCM0; Sun, 26 Nov 2017 14:06:55 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:20 +0100 Message-Id: <20171126130523.4993-16-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:tKyj5j1sI6m7rM7RtPoslWhMpaBXHbdQqJZ3L5Sv+nDjPScYFxi G7393DrNtAbXLPjtLR+SVeJ8mqLdugG4cSRYWfXfDbKSxtuSZbIQGpKtSaVknQJiZ5mPrrN yYbt2lgUQs1IdA4LQeh0hOwckYjKlKjonS/hCK98a/t0ck5qiN7El95Oh+ojR3oHxGx2ceC MOB6A+VsujzuGCig102Kw== X-UI-Out-Filterresults: notjunk:1; V01:K0:tiFBUdAiuMk=:S34PQFPIBMCSjs7pAeTJ8G qzF6j3h5euN+9kwc7pv7/N3i8Dztuzjl2oookuP3FHO3VbgE3gMGcKPgN98nhJ1RD3yDrkv1Q t0F/9fZXsCAuacvKoJXPhb8mWtb/niocNLV8vrzwJiigQbrW1jxUXuCyzfm0SgKn1dXOlvQnB bHu/QuB88IN2Fv6K5PU3F9PO5KiViUA+fnbzKdmVtYGPwo1Lp/1pDKaH8JdlgXugnB7q59a6/ 2QlHZNS6BFkdFeyiCFhQptFFSwuQ5oPtSzxG3Y4FEJe0ow84rMiSwsdKSBj53V0bEYpZbUp4v wt9BYkrD0FjLunq37xBo8iXP0Rp7ix+PVflzn/bXTedtghmVHcySkgDbYtFxAf9SVPCTvWR+j QKbdH423iIB7o2UeWxSd9TsqhHiy65nR8rUQDlKrPFPWp2dgKaEA9N5lgmDevyCbnB9+SXIJ8 pyljfJfNCmJNtn4Z5HDpsw+HsA5fsMM6TUzEutJkeOg66iv4F5qwV9WoWQyylyZN27CUQU07h eSOtYCSjacfelFMB1ua4fSzsZuw50P2gRo1gD9dHGzv3JVijyej3OgZWIF3Go0UIr8Nbhukhr jtis8PioJVNVkhJ/LYNey1RjByl1/knxsdnYcyrxG+waQrbV/mbjFm+Okrb1FXxODJrOg35Gl h9yxDCLzbJZBaVFLsK6Kviz6n65esPtEKxQniNbbASgwxbGkokQCkhtO3RzhEQGxKwJ9ei/i+ 4x8PqzXSl5h0yMx5mQdnIKccbcE6OezpWakquRgC8LO9BzP0hYOMa/YCo0JfA1u4mEFlxWVgJ oDI9gkKMyP8HLHiRzxtELgWXy5k+w== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 15/18] efi_loader: output load options in helloworld 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" We need to test if we pass a valid image handle when loading and EFI application. This cannot be done in efi_selftest as it is not loaded as an image. So let's enhance helloworld a bit. Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- v3 no change v2 new patch --- lib/efi_loader/helloworld.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/helloworld.c b/lib/efi_loader/helloworld.c index 77130a36dd..e59c24c788 100644 --- a/lib/efi_loader/helloworld.c +++ b/lib/efi_loader/helloworld.c @@ -5,19 +5,52 @@ * Written by Simon Glass * * SPDX-License-Identifier: GPL-2.0+ + * + * This program demonstrates calling a boottime service. + * It writes a greeting and the load options to the console. */ #include #include +/* + * Entry point of the EFI application. + * + * @handle handle of the loaded image + * @systable system table + * @return status code + */ efi_status_t EFIAPI efi_main(efi_handle_t handle, struct efi_system_table *systable) { struct efi_simple_text_output_protocol *con_out = systable->con_out; struct efi_boot_services *boottime = systable->boottime; + struct efi_loaded_image *loaded_image; + const efi_guid_t loaded_image_guid = LOADED_IMAGE_GUID; + efi_status_t ret; con_out->output_string(con_out, L"Hello, world!\n"); - boottime->exit(handle, 0, 0, NULL); - return EFI_SUCCESS; + /* Get the loaded image protocol */ + ret = boottime->handle_protocol(handle, &loaded_image_guid, + (void **)&loaded_image); + if (ret != EFI_SUCCESS) { + con_out->output_string(con_out, + L"Cannot open loaded image protocol\n"); + goto out; + } + /* Output the load options */ + con_out->output_string(con_out, L"Load options: "); + if (loaded_image->load_options_size && loaded_image->load_options) + con_out->output_string(con_out, + (u16 *)loaded_image->load_options); + else + con_out->output_string(con_out, L""); + con_out->output_string(con_out, L"\n"); + +out: + boottime->exit(handle, ret, 0, NULL); + + /* We should never arrive here */ + return ret; } From patchwork Sun Nov 26 13:05:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841386 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9QL0zLxz9s3w for ; Mon, 27 Nov 2017 00:15:06 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id D27E7C21DC4; Sun, 26 Nov 2017 13:11:47 +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_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL 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 B7187C21DE7; Sun, 26 Nov 2017 13:08:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8E511C21E3A; Sun, 26 Nov 2017 13:07:09 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lists.denx.de (Postfix) with ESMTPS id 82DA3C21DF3 for ; Sun, 26 Nov 2017 13:07:05 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LdIBN-1f12xK466r-00iRBj; Sun, 26 Nov 2017 14:06:56 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:21 +0100 Message-Id: <20171126130523.4993-17-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:Y/SaapFZMjHeqf17Q4T06uFooSdHp0L0Xvwc7d+1UM36YDrnEa3 WMcGyDjpDck7bG7w7L07JUHisi4eFI4qH/jfwHAsaPw6Y6wmmqDSJm7TG1BaFka8NB9blcv k/5q2yPsCWApv1BsaaZKywwhWiHBkUy9NgbcamaolKY3dq/KvqP0UgfEoFKX9FXJ0zXOy8b stszx2L3rBf55KwaCapcA== X-UI-Out-Filterresults: notjunk:1; V01:K0:xb9sCXNir00=:653xQf4ppEMB7H58GbGfqM RNgQOVt7oCB5wP7ZaopB/NLsZnV+VKxcPB/yQTIu3ypHL/6RMyvLv6EcSMcbcEAtqacWeUPJS yY/2txxNqmeyeVr9Z82oxq17xZVGQoa2Wcs/fPEJhycbqPvbbOTcrLFlFASLj4RcRMA4WqHCO Rk+/czwTLWCzUrYwF1CM8LBeou7DZhpiOAN3eAT6miZVnIYiNKPQU/0XN38NR3gfu5bqNDlpI maNmjy8g3P5ncwdQvcqHXgNevW7sG2kytz9pTY3b8sGNBEE13HnEWmnykHCF4HKDvjjiT7Lhf cLUVm8F1Of9a5llveWKzk4YqSNawXwWtymFszA/BF6yIWHd48vljgsHZ1evDrtyfFPUYPP3OZ wimmQpcqJDhXmPaUoV4OnLXkR+i+6Ecq5tfo/BHFsGG14OzTxAGAjwGr3gVF55cSpKrSz5l2C lrbRtIBzRaqNlNRtcTXzaHwsPELhnDGnb7eqAV6Rpiow/rIwL9larP9tuSHmy7iAHYKfeMEZj /3wcKP1VP1fYq30ba2oBdlYFxXdXISg8qz4VL6xEPylci+r7wfVIK4xQbohaZVHNmrqHmhMgx lM0JEDNHuRkmzHMYIRJzDp0wi0RMAfpuuiNXoMd0FME1GZHW609J1oc6e1R8ZBxV1SVWNc3rW O686kvsxDivZ2HS9Cz7zqHebOChc1gl1WduotWgN37/PWg5pB68X3vEPIAa5vs6HpnuMhw5vV 7WjOUGfnAFksKwEaG1VS19KQE3AjYxjhied9P5Cx2ZV61c7Mxj/zIRvxX3d8RX2Pf8kX0tfAd sIh+wBT5MWh4g28DQLbQu3BEwGA/g== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 16/18] test/py: check return code of helloworld 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" Check that helloworld.efi returns EFI_SUCCESS. Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- v3 no change v2 new patch --- test/py/tests/test_efi_loader.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py index 4d391e13ef..906ef2feaa 100644 --- a/test/py/tests/test_efi_loader.py +++ b/test/py/tests/test_efi_loader.py @@ -154,6 +154,8 @@ def test_efi_helloworld_net(u_boot_console): output = u_boot_console.run_command('bootefi %x' % addr) expected_text = 'Hello, world' assert expected_text in output + expected_text = '## Application terminated, r = 0' + assert expected_text in output @pytest.mark.buildconfigspec('cmd_bootefi_hello') def test_efi_helloworld_builtin(u_boot_console): From patchwork Sun Nov 26 13:05:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841391 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9T00qrBz9s3w for ; Mon, 27 Nov 2017 00:17:24 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id C0047C21DB2; Sun, 26 Nov 2017 13:11:30 +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, RCVD_IN_MSPIKE_H2 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 72B32C21E3C; Sun, 26 Nov 2017 13:08:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 59EDAC21DEF; Sun, 26 Nov 2017 13:07:12 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id C8AB8C21E11 for ; Sun, 26 Nov 2017 13:07:06 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0M3j17-1f9wuH1FAX-00rL7b; Sun, 26 Nov 2017 14:06:56 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:22 +0100 Message-Id: <20171126130523.4993-18-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:q0iy0AtR2NTye5thCZ8esclqXFs45unlOJm/mH8CpuWrigMBtlJ nEiEi8qcIIR3wBMB/PLMJULzEHVVciiXzKdlBagh8j8ltvGgvbWk6Xp/FJPoRgp5YhTivpG yFn0HhgLX6v0Fmvib5OJ5MLFx0/2lHVYOzSuQDqF6hu3IDcAA3Wf01Xs8wSoETrz6IVDe2r Fj3+9j7L2HNGycDeckINw== X-UI-Out-Filterresults: notjunk:1; V01:K0:c6dM3Uf4w9s=:EUI4wVszdldl8IdmaKVGq1 gdlxysU/NqjPU5723s/ZjqEg8wV13NNHutreKiRWsoCPzgQvD5wiLWYhiNC8f15J7G5HQ0hwX hveab+T1gcKGgt7hBJelx8faAK4bkTWXe26fpW+6cJZIH3DAcPMxZb8dKucAVDL7y1VnQ//Ar wbJ3bcpMhsHCyGhe4usPw/WfHo+noEymX/oQLKYjSHmoX3V8fSrlzYgxAFDschuU9u3gCuAao f7i0PGwaDLjTyb7FxYJEGDHjYCIm2Y/vz25TbkENZWhAM5bs7TOSwNYsBFq/BZRtNtkVyu3zj u6Q8dXYwWY36dlSuFJW0Va83zmMxfHUcr/CFyTTG5wmee2B+tj7O0Z+rUtVxkU/n3iVX3tF0i AUQ8IYHLo+tmyBIIXW9NnPb3yV4QmczP4qu+9FsOg79L5h1KRjIaMQTnaBTqAZpuMhLM9A30/ 3/WPCoD5MVjq+IyFantyIuS0Rvdo0E4m04zwKDMVQUi/Rv94ngF3zzqWcPygF9sshdPtEmxj1 g9vt31s/dMqZs08y4SMJnELZ97RCkxhXzEF4UVTl0Jsao74rDtqCTemW6OoAC14RT2cIKamEz ecirkCVAPornTO7q6iN69ICvNBBTgCKoy2C3rU7Ve9dbZ5kD+TSwJHk1NKrdzIO1W0GOSK6Vz ZGxMiijzrVCWxNkV4sgp/M9gimAaYfN7el55lp9cUHKwpS3ONMjWPL6IShFnlJOgQVHp+UY5c tNNjKJymzEKHbZSF2MCPn8KhT0vwrkoHR5/Uu6+HWh4oOtEmHaLswE04d/yN+gJ0QikPLjSfU MaKFWE1nTQyV758UFu/BFQn9+zRNg== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 17/18] efi_loader: pass handle of loaded image 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" The handle of a loaded image is the value of the handle member of the loaded image info object and not the address of the loaded image info. Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- v3 no change v2 new patch --- cmd/bootefi.c | 7 ++++--- lib/efi_loader/efi_boottime.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 67855ba685..e6b8ec11d5 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -254,7 +254,8 @@ static efi_status_t do_bootefi_exec(void *efi, void *fdt, dcache_disable(); /* flush cache before switch to EL2 */ /* Move into EL2 and keep running there */ - armv8_switch_to_el2((ulong)entry, (ulong)&loaded_image_info, + armv8_switch_to_el2((ulong)entry, + (ulong)&loaded_image_info_obj.handle, (ulong)&systab, 0, (ulong)efi_run_in_el2, ES_TO_AARCH64); @@ -263,7 +264,7 @@ static efi_status_t do_bootefi_exec(void *efi, void *fdt, } #endif - ret = efi_do_enter(&loaded_image_info, &systab, entry); + ret = efi_do_enter(loaded_image_info_obj.handle, &systab, entry); exit: /* image has returned, loaded-image obj goes *poof*: */ @@ -350,7 +351,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Transfer environment variable efi_selftest as load options */ set_load_options(&loaded_image_info, "efi_selftest"); /* Execute the test */ - r = efi_selftest(&loaded_image_info, &systab); + r = efi_selftest(loaded_image_info_obj.handle, &systab); efi_restore_gd(); free(loaded_image_info.load_options); list_del(&loaded_image_info_obj.link); diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 54e9c27db1..0fb2848ecf 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1317,7 +1317,7 @@ static efi_status_t EFIAPI efi_load_image(bool boot_policy, info->system_table = &systab; info->parent_handle = parent_image; - *image_handle = info; + *image_handle = obj->handle; return EFI_EXIT(EFI_SUCCESS); } From patchwork Sun Nov 26 13:05:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 841388 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yl9RS6N5Mz9s3w for ; Mon, 27 Nov 2017 00:16:04 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 89717C21DA9; Sun, 26 Nov 2017 13:11:11 +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_BLOCKED,RCVD_IN_MSPIKE_H2 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 70C5AC21E26; Sun, 26 Nov 2017 13:08:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 874B7C21E39; Sun, 26 Nov 2017 13:07:10 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lists.denx.de (Postfix) with ESMTPS id EF8FBC21D56 for ; Sun, 26 Nov 2017 13:07:05 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0MWk7n-1ecTpD2YbD-00XtI9; Sun, 26 Nov 2017 14:06:56 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 26 Nov 2017 14:05:23 +0100 Message-Id: <20171126130523.4993-19-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171126130523.4993-1-xypron.glpk@gmx.de> References: <20171126130523.4993-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:BMY4vesmf/4JkEytO+UCCftmvOzwkAyQn0RatwK/UZLB0twXXth VjZy1PoWobrNcFrmbARKVVwcTmPlWETzitUoKiXLhY95cH8qs11Z7LK6gsmUS2XsshS3XLg r6v7Iy/e9yU/EtywYy/AgpjlRh3opqwCWUiDCwqNrPQA0qiNmzrhlIE8z81iS74h0upuUn9 l1UahMMn+8lkepCYaH93w== X-UI-Out-Filterresults: notjunk:1; V01:K0:haUbXBXIW2M=:v+jgmXI54cFlr4IeGMGeIM 0+e9VmwqfXxBS+HzcRGELpY6cBI39viB2TKmMj+pnk3Fn56DybpqxZTBBP/1IoLQKp3kLOYbv h5uQhQIRmni4z4Ljs7pdc3C4myt64rsEAEGugrht+BXztDZoS/3jIZpl087zlTjd+od4TCt5s V2OG3QXWUx2cdO+qKZRF2a8dpZwDB4bpoog4yfRVLUdHwLLIn6yUM4zg9ixQlBS6V2VLbW/bb bKSCkfHQE2RTsTy9c4brzVMchoYQTkaXYmGDV5E71o254FBIGTU6E/pwYdG7HmZTxncA0Gvf3 vhqbVGZRqc0P/OIJ7wNs22uf7Cz7y0BhXwyzRv7UbbWY3J7kXAVSG1Wwib+gQB7gdqQZrL9PD G9zLK3bmtTU3LGIdLP5QYxEisr0WlKyA3bb4EMt1ix+Tw+u/V3uTJkN3QOQuIz1szP262vKE8 9fPqU5RkPV32AjoHiFVninRZacCgKkjCZiF8ww7jE0G5kLouTIvzlTuhlizDfGhDG8/Km5/gv 2LD3qyqfGxQxpOB54AfcZdfGM3JdmooK2gHvwjNx1WDPx+S7gMdHHwNHUfWR0r8Sw3obyimoo Nf56ULaZAHlw4FRAvUt8ROzPHBChrZYbNuJLm6czGL5DHEBeicH9gOZvA1DcHgCre1bAd767Y my7E3fPd5UXlRE113A0MBpYHaVmFL6ZogtwygGVLKn2PZ/cs2tSOaWVWhPbdxxfS5aq1/OACJ /+/il9iQE06CVtc3esy66PDsIjgjQG8ZrTDcYcdRQmYmorI17dOnInLfLV2EaHr0hv+nqkXGb tIUFaND357/TrnolAYIl16AnnFtCw== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 18/18] efi_loader: helper function to add EFI object to list 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" To avoid duplicate coding provide a helper function that initializes an EFI object and adds it to the EFI object list. efi_exit() is the only place where we dereference a handle to obtain a protocol interface. Add a comment to the function. Suggested-by: Alexander Graf Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- v3 no change v2 new patch --- include/efi_loader.h | 2 ++ lib/efi_loader/efi_boottime.c | 40 +++++++++++++++++++++++++++++++++------- lib/efi_loader/efi_disk.c | 4 +--- lib/efi_loader/efi_gop.c | 4 +--- lib/efi_loader/efi_net.c | 4 +--- 5 files changed, 38 insertions(+), 16 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index a73bbc1269..c0caabddb1 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -186,6 +186,8 @@ void efi_restore_gd(void); void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map); /* Call this to set the current device name */ void efi_set_bootdev(const char *dev, const char *devnr, const char *path); +/* Add a new object to the object list. */ +void efi_add_handle(struct efi_object *obj); /* Create handle */ efi_status_t efi_create_handle(void **handle); /* Call this to validate a handle and find the EFI object for it */ diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 0fb2848ecf..a37fb25638 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -321,6 +321,23 @@ static efi_status_t EFIAPI efi_free_pool_ext(void *buffer) return EFI_EXIT(r); } +/* + * Add a new object to the object list. + * + * The protocols list is initialized. + * The object handle is set. + * + * @obj object to be added + */ +void efi_add_handle(struct efi_object *obj) +{ + if (!obj) + return; + INIT_LIST_HEAD(&obj->protocols); + obj->handle = obj; + list_add_tail(&obj->link, &efi_obj_list); +} + /* * Create handle. * @@ -337,11 +354,8 @@ efi_status_t efi_create_handle(void **handle) (void **)&obj); if (r != EFI_SUCCESS) return r; - memset(obj, 0, sizeof(struct efi_object)); - obj->handle = obj; - INIT_LIST_HEAD(&obj->protocols); - list_add_tail(&obj->link, &efi_obj_list); - *handle = obj; + efi_add_handle(obj); + *handle = obj->handle; return r; } @@ -1163,14 +1177,15 @@ void efi_setup_loaded_image(struct efi_loaded_image *info, struct efi_object *ob { efi_status_t ret; + /* Add internal object to object list */ + efi_add_handle(obj); + /* efi_exit() assumes that the handle points to the info */ obj->handle = info; info->file_path = file_path; if (device_path) info->device_handle = efi_dp_find_obj(device_path, NULL); - INIT_LIST_HEAD(&obj->protocols); - list_add_tail(&obj->link, &efi_obj_list); /* * When asking for the device path interface, return * bootefi_device_path @@ -1379,6 +1394,17 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t image_handle, efi_status_t exit_status, unsigned long exit_data_size, int16_t *exit_data) { + /* + * We require that the handle points to the original loaded + * image protocol interface. + * + * For getting the longjmp address this is safer than locating + * the protocol because the protocol may have been reinstalled + * pointing to another memory location. + * + * TODO: We should call the unload procedure of the loaded + * image protocol. + */ struct efi_loaded_image *loaded_image_info = (void*)image_handle; EFI_ENTRY("%p, %ld, %ld, %p", image_handle, exit_status, diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index af8db40e19..68ba2cf7b2 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -224,13 +224,11 @@ static void efi_disk_add_dev(const char *name, goto out_of_memory; /* Hook up to the device list */ - INIT_LIST_HEAD(&diskobj->parent.protocols); - list_add_tail(&diskobj->parent.link, &efi_obj_list); + efi_add_handle(&diskobj->parent); /* Fill in object data */ diskobj->dp = efi_dp_from_part(desc, part); diskobj->part = part; - diskobj->parent.handle = diskobj; ret = efi_add_protocol(diskobj->parent.handle, &efi_block_io_guid, &diskobj->ops); if (ret != EFI_SUCCESS) diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c index 498184d754..3caddd5f84 100644 --- a/lib/efi_loader/efi_gop.c +++ b/lib/efi_loader/efi_gop.c @@ -180,11 +180,9 @@ int efi_gop_register(void) } /* Hook up to the device list */ - INIT_LIST_HEAD(&gopobj->parent.protocols); - list_add_tail(&gopobj->parent.link, &efi_obj_list); + efi_add_handle(&gopobj->parent); /* Fill in object data */ - gopobj->parent.handle = &gopobj->ops; ret = efi_add_protocol(gopobj->parent.handle, &efi_gop_guid, &gopobj->ops); if (ret != EFI_SUCCESS) { diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index 74a67c5365..8c5d5b492c 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -296,11 +296,9 @@ int efi_net_register(void) goto out_of_memory; /* Hook net up to the device list */ - INIT_LIST_HEAD(&netobj->parent.protocols); - list_add_tail(&netobj->parent.link, &efi_obj_list); + efi_add_handle(&netobj->parent); /* Fill in object data */ - netobj->parent.handle = &netobj->net; r = efi_add_protocol(netobj->parent.handle, &efi_net_guid, &netobj->net); if (r != EFI_SUCCESS)