{"id":806179,"url":"http://patchwork.ozlabs.org/api/patches/806179/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170826225328.7550-3-xypron.glpk@gmx.de/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170826225328.7550-3-xypron.glpk@gmx.de>","list_archive_url":null,"date":"2017-08-26T22:53:21","name":"[U-Boot,12/23] efi_loader: implement OpenProtocolInformation","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"5d6b3b8dae248c172e19357bdd2c67326a067a50","submitter":{"id":61270,"url":"http://patchwork.ozlabs.org/api/people/61270/?format=json","name":"Heinrich Schuchardt","email":"xypron.glpk@gmx.de"},"delegate":{"id":3400,"url":"http://patchwork.ozlabs.org/api/users/3400/?format=json","username":"agraf","first_name":"Alexander","last_name":"Graf","email":"agraf@suse.de"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170826225328.7550-3-xypron.glpk@gmx.de/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/806179/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/806179/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xfts72KM9z9s7g\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 27 Aug 2017 09:04:43 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 047DAC2220B; Sat, 26 Aug 2017 22:57:16 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id AB565C2218C;\n\tSat, 26 Aug 2017 22:57:14 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 1C84CC21DB5; Sat, 26 Aug 2017 22:54:27 +0000 (UTC)","from mout.gmx.net (mout.gmx.net [212.227.17.20])\n\tby lists.denx.de (Postfix) with ESMTPS id 308B9C221C9\n\tfor <u-boot@lists.denx.de>; Sat, 26 Aug 2017 22:54:23 +0000 (UTC)","from localhost.localdomain ([84.118.154.110]) by mail.gmx.com\n\t(mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id\n\t0MVedf-1e2NzT2uZr-00YwEv; Sun, 27 Aug 2017 00:53:36 +0200"],"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,\n\tRCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,\n\tRCVD_IN_MSPIKE_WL autolearn=unavailable\n\tautolearn_force=no version=3.4.0","From":"Heinrich Schuchardt <xypron.glpk@gmx.de>","To":"Alexander Graf <agraf@suse.de>","Date":"Sun, 27 Aug 2017 00:53:21 +0200","Message-Id":"<20170826225328.7550-3-xypron.glpk@gmx.de>","X-Mailer":"git-send-email 2.14.1","In-Reply-To":"<20170826225328.7550-1-xypron.glpk@gmx.de>","References":"<20170826225110.7381-1-xypron.glpk@gmx.de>\n\t<20170826225328.7550-1-xypron.glpk@gmx.de>","X-Provags-ID":"V03:K0:DtaoDVqNoNwiqqArWZf+CzuxpNwCiTznfAWJYmTq14CSWmxtURZ\n\trzmzowP1nknmh9OsocljXVCT9rZLOEnmCYHnHWHj5F9RHDeIg0xtKnzcWhsUkop1YibZNyE\n\tqaHvO3kAAs7UNOnp5EJySYmohbS7fyaV8p+hpTVNiNXcCIh+5b8kJt+W2n3a5at26469ZBX\n\tyCA4jjKKi7gXGUkJPtDlg==","X-UI-Out-Filterresults":"notjunk:1; V01:K0:OdpaC7BjFPk=:l2MeDEwzLwO0IzAqVB4XRN\n\t3ZnzgD+f8sDweveG5MP7yZ8+Fxff2kRIRdQPQpqlTXXtb0iIUC9Oqquf3dATiPw2mJfsKyFTW\n\tRz5aYiqT9G9Vk5bFpX+9N/YJtYEO7kwRCK0394ftpBIR4lNEQ0pDhVplSs/7cxTT5GAr5s3ZU\n\t12tEuwGry0WKNRIymVwGF+Rm43wf6OnD9ffQp6Dq/l+qpPRM114w82pT+ODrYAQPr2jG9SMJS\n\tLZN/KwFcRzyCghyjJUULbkElI+PwxrSRJAeQT8411lIkloECGQF1KcsK3eyXpuGC/OIA4OV2m\n\tyXXuXede3otuJvIH4s67LufE4wxZn6m/yEW3DzxEB8/0cd2wzHMfNuuksvKauWJcRaJC0qxSL\n\twtPVvL79CZBy/EcDPTikr2z9lulwaBkH+4HMcXMChS2Q83+rFk99HEpdV4oA8yCpKKEg7ueJg\n\tAQqSHvXIkMojP9MnneR3Bzu3FlwidKQLnmrHUKB6AKJx3qbcSFRzSCaYOd9yPWOQSZAljZmBW\n\t49xxjxR3G8eEmxA74XwrzSbxS5Qda7jsynAodaQ35Lbr6+uu8MrPaJghF9z/UCXKWcpNXhzDV\n\tJHa9aJf5VFkoJRFziqO120+aY0oQObWzsDm1fWODcGnB3+z7e8RQK+gnl4DM4jTusJlGsDSuD\n\t+lc2b886/uFZeZDemPbUPOLWJaJdNirg+R5H37yVXKAMvxr/Y1aXgyjBUo3bCr41phlyJ/UUL\n\tyfqgaI77yzqKdf6FLIyWTDdaMCQcnL8eNnmUn+nLAKYa7sJhzEXg/LHm/dYzoFgZivJeg+F5P\n\t7vJyUp9T/BowJU6vgUrSPpwPAOlBg==","Cc":"Heinrich Schuchardt <xypron.glpk@gmx.de>, u-boot@lists.denx.de","Subject":"[U-Boot] [PATCH 12/23] efi_loader: implement OpenProtocolInformation","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"efi_open_protocol_information provides the agent and controller\nhandles as well as the attributes and open count of an protocol\non a handle.\n\nCc: Rob Clark <robdclark@gmail.com>\nSigned-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>\n---\n lib/efi_loader/efi_boottime.c | 55 ++++++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 54 insertions(+), 1 deletion(-)","diff":"diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c\nindex c9aec597a2..23b8894e73 100644\n--- a/lib/efi_loader/efi_boottime.c\n+++ b/lib/efi_loader/efi_boottime.c\n@@ -985,9 +985,62 @@ static efi_status_t EFIAPI efi_open_protocol_information(efi_handle_t handle,\n \t\t\tstruct efi_open_protocol_info_entry **entry_buffer,\n \t\t\tunsigned long *entry_count)\n {\n+\tunsigned long buffer_size;\n+\tunsigned long count;\n+\tstruct efi_handler *handler;\n+\tsize_t i;\n+\tefi_status_t r;\n+\n \tEFI_ENTRY(\"%p, %p, %p, %p\", handle, protocol, entry_buffer,\n \t\t  entry_count);\n-\treturn EFI_EXIT(EFI_NOT_FOUND);\n+\n+\t/* Check parameters */\n+\tif (!handle || !protocol || !entry_buffer) {\n+\t\tr = EFI_INVALID_PARAMETER;\n+\t\tgoto out;\n+\t}\n+\n+\t/* Find the protocol */\n+\tr = efi_search_protocol(handle, protocol, &handler);\n+\tif (r != EFI_SUCCESS)\n+\t\tgoto out;\n+\n+\t*entry_buffer = NULL;\n+\n+\t/* Count entries */\n+\tcount = 0;\n+\tfor (i = 0; i < ARRAY_SIZE(handler->open_info); ++i) {\n+\t\tstruct efi_open_protocol_info_entry *open_info =\n+\t\t\t&handler->open_info[i];\n+\n+\t\tif (open_info->open_count)\n+\t\t\t++count;\n+\t}\n+\t*entry_count = count;\n+\tif (!count) {\n+\t\tr = EFI_SUCCESS;\n+\t\tgoto out;\n+\t}\n+\n+\t/* Copy entries */\n+\tbuffer_size = count * sizeof(struct efi_open_protocol_info_entry);\n+\tr = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, buffer_size,\n+\t\t\t      (void **)entry_buffer);\n+\tif (r != EFI_SUCCESS)\n+\t\tgoto out;\n+\tcount = 0;\n+\tfor (i = 0; i < ARRAY_SIZE(handler->open_info); ++i) {\n+\t\tstruct efi_open_protocol_info_entry *open_info =\n+\t\t\t&handler->open_info[i];\n+\n+\t\tif (!open_info->open_count)\n+\t\t\tcontinue;\n+\t\t(*entry_buffer)[count] = *open_info;\n+\t\t++count;\n+\t}\n+\n+out:\n+\treturn EFI_EXIT(r);\n }\n \n static efi_status_t EFIAPI efi_protocols_per_handle(void *handle,\n","prefixes":["U-Boot","12/23"]}