{"id":798305,"url":"http://patchwork.ozlabs.org/api/patches/798305/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170805203230.19796-4-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":"<20170805203230.19796-4-xypron.glpk@gmx.de>","list_archive_url":null,"date":"2017-08-05T20:32:30","name":"[U-Boot,v3,3/3] efi_loader: implement OpenProtocolInformation","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"2263335843bc3caf55c563eba4d9a1a921660b26","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/20170805203230.19796-4-xypron.glpk@gmx.de/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/798305/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/798305/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 3xPwZ366ttz9sNc\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun,  6 Aug 2017 06:36:43 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 8B559C21C72; Sat,  5 Aug 2017 20:35:06 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id DD5D1C21F29;\n\tSat,  5 Aug 2017 20:34:34 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid E7591C21D82; Sat,  5 Aug 2017 20:34:31 +0000 (UTC)","from mout.gmx.net (mout.gmx.net [212.227.17.22])\n\tby lists.denx.de (Postfix) with ESMTPS id 9BBA6C21C72\n\tfor <u-boot@lists.denx.de>; Sat,  5 Aug 2017 20:34:31 +0000 (UTC)","from workstation4.fritz.box ([84.118.154.110]) by mail.gmx.com\n\t(mrgmx103 [212.227.17.174]) with ESMTPSA (Nemesis) id\n\t0MUpI8-1eA2N03PsS-00Y6s3; Sat, 05 Aug 2017 22:34:30 +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 autolearn=unavailable autolearn_force=no\n\tversion=3.4.0","From":"Heinrich Schuchardt <xypron.glpk@gmx.de>","To":"Alexander Graf <agraf@suse.de>","Date":"Sat,  5 Aug 2017 22:32:30 +0200","Message-Id":"<20170805203230.19796-4-xypron.glpk@gmx.de>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20170805203230.19796-1-xypron.glpk@gmx.de>","References":"<20170805203230.19796-1-xypron.glpk@gmx.de>","X-Provags-ID":"V03:K0:ONzP6ii34iSxvmHfQWYaiLFN2c5EBVKvozxvS8ao9GZhbPSievM\n\trGft90mXkglfwop74r7CzVNiNg40iPIVfg9ocpCBqtlEnxgp40WyX8ZfTc0+JbcUw9rIA2I\n\ts8Uk3H7CGdsYJiZ0LAIv6D9+miRBGRO1uIQDjXQjhJmzjVAgN8GAHtVO+GT2wpc8LbWTnKk\n\tJ+8OnqRXvZCeEFnPNT8Tw==","X-UI-Out-Filterresults":"notjunk:1; V01:K0:eSc9437vnvM=:8ffFJCHWSs5zjrTAmg/rkE\n\tHEAkhcNOkPM3EnIfvXKTc+sa+/QUYBgORPlOPp/hjhWcWfPX5ibvh1WNJwiiR4Liym4RypYFL\n\toCCHezvFquM/pkF8VWRk4GjAkaOmiAZzVASjc5ExF9GpQdBDsovqO47x0rCAPbg/xL6W0cGAv\n\tvIt0ei0NbTOj3xUjwZcpHhkOtJ9sRYO+ewy570o5Nq8hlJZp9x2nm+B5XnwSPTFtLCVKaEwUA\n\tJn8PDfh5VbBUHzlsQHRvSzVMrNH+RDI3YQkSeiQzepM9cBBOUb0t/ziY6q1XIbc9r0OpBn2vE\n\t5oDjmmXJbJH/xnrsYBhm4uDuDgVrjXAcsfz78UniGVYqXePt6C5nnJ8jo6dXKcNniCos2Bla3\n\tCB33d3jOYVsgD6HRvtvJRfIAnXrYPD6yhtxPNbfc1uPKAZcr8QEYn/wLYzERYtMt9UoEhRspk\n\trWRXdPSge9IF5eyBPtFwKJ5d03kh8xFCjQ1YCbAHC8OBIxkHcs0HLuDN7uJkEnIQt4MP1J67k\n\tW4vQRFT2OFB6sAO2I1WdnOjAv2nFqs5ceOXjRmEw5iyvIwzCQQ/uul3X0PKaJ6mKDskUSWyyE\n\tuhC5fOc6VH9FwBuEcdw5j4B3hartvyDoeX744ItZ7TyZ5txoqq7od3hoaWR8jHlel/uAUw6od\n\t0o5YA59ZO5iNGvsD8WykpdhDSK/WxC01NxWMdfFijqJmqwQkjQCrXxu9abJag+ECIO4MyQ3OM\n\tQv3iRaEE5a6Zj8BJKXVMSVFyyzUjmTbFLb29Ivbt1fxwrbAFdEmmRo0dRMtIrnG/ItHJVVX2G\n\tFvQJvj5A4r4R7hTwRBLE+cCNPVxcA==","Cc":"u-boot@lists.denx.de, Heinrich Schuchardt <xypron.glpk@gmx.de>","Subject":"[U-Boot] [PATCH v3 3/3] efi_loader: implement\n\tOpenProtocolInformation","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---\nv3:\n\tuse list_for_each_entry\n\tcorrect indention\nv2:\n\tnew patch\n---\n lib/efi_loader/efi_boottime.c | 74 ++++++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 73 insertions(+), 1 deletion(-)","diff":"diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c\nindex 65a7a79dc1..fa9b74d465 100644\n--- a/lib/efi_loader/efi_boottime.c\n+++ b/lib/efi_loader/efi_boottime.c\n@@ -984,14 +984,86 @@ out:\n \treturn EFI_EXIT(r);\n }\n \n+static efi_status_t efi_copy_open_protocol_information(\n+\t\t\tstruct efi_handler *protocol,\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 = 0;\n+\tsize_t i;\n+\tefi_status_t r;\n+\n+\t*entry_buffer = NULL;\n+\n+\t/* Count entries */\n+\tfor (i = 0; i < ARRAY_SIZE(protocol->open_info); ++i) {\n+\t\tstruct efi_open_protocol_info_entry *open_info =\n+\t\t\t&protocol->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\treturn EFI_SUCCESS;\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\treturn r;\n+\tcount = 0;\n+\tfor (i = 0; i < ARRAY_SIZE(protocol->open_info); ++i) {\n+\t\tstruct efi_open_protocol_info_entry *open_info =\n+\t\t\t&protocol->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+\treturn EFI_SUCCESS;\n+}\n+\n static efi_status_t EFIAPI efi_open_protocol_information(efi_handle_t handle,\n \t\t\tefi_guid_t *protocol,\n \t\t\tstruct efi_open_protocol_info_entry **entry_buffer,\n \t\t\tunsigned long *entry_count)\n {\n+\tstruct efi_object *efiobj;\n+\tsize_t i;\n+\tefi_status_t r = EFI_NOT_FOUND;\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+\tif (!handle || !protocol || !entry_buffer)\n+\t\tEFI_EXIT(EFI_INVALID_PARAMETER);\n+\n+\tEFI_PRINT_GUID(\"protocol:\", protocol);\n+\n+\tlist_for_each_entry(efiobj, &efi_obj_list, link) {\n+\t\tif (efiobj->handle != handle)\n+\t\t\tcontinue;\n+\n+\t\tfor (i = 0; i < ARRAY_SIZE(efiobj->protocols); i++) {\n+\t\t\tstruct efi_handler *handler = &efiobj->protocols[i];\n+\t\t\tconst efi_guid_t *hprotocol = handler->guid;\n+\t\t\tif (!hprotocol)\n+\t\t\t\tcontinue;\n+\t\t\tif (!guidcmp(hprotocol, protocol)) {\n+\t\t\t\tr = efi_copy_open_protocol_information(\n+\t\t\t\t\thandler, entry_buffer, entry_count);\n+\t\t\t\tgoto out;\n+\t\t\t}\n+\t\t}\n+\t\tgoto out;\n+\t}\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","v3","3/3"]}