Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/806178/?format=api
{ "id": 806178, "url": "http://patchwork.ozlabs.org/api/patches/806178/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20170826225328.7550-1-xypron.glpk@gmx.de/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "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-1-xypron.glpk@gmx.de>", "list_archive_url": null, "date": "2017-08-26T22:53:19", "name": "[U-Boot,10/23] efi_loader: open_info in OpenProtocol", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "576716d93da31b60799eb9be54d02a2ab4e9d053", "submitter": { "id": 61270, "url": "http://patchwork.ozlabs.org/api/people/61270/?format=api", "name": "Heinrich Schuchardt", "email": "xypron.glpk@gmx.de" }, "delegate": { "id": 3400, "url": "http://patchwork.ozlabs.org/api/users/3400/?format=api", "username": "agraf", "first_name": "Alexander", "last_name": "Graf", "email": "agraf@suse.de" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20170826225328.7550-1-xypron.glpk@gmx.de/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/806178/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/806178/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 3xftph6m75z9s7g\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 27 Aug 2017 09:02:36 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid AAC7BC22161; Sat, 26 Aug 2017 23:01:44 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id B03B2C221FE;\n\tSat, 26 Aug 2017 23:01:41 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid B7A1DC220D3; Sat, 26 Aug 2017 22:54:21 +0000 (UTC)", "from mout.gmx.net (mout.gmx.net [212.227.17.22])\n\tby lists.denx.de (Postfix) with ESMTPS id 35A4AC221D5\n\tfor <u-boot@lists.denx.de>; Sat, 26 Aug 2017 22:54:18 +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\t0Lk81O-1dF8xu0DM2-00cDQm; 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:19 +0200", "Message-Id": "<20170826225328.7550-1-xypron.glpk@gmx.de>", "X-Mailer": "git-send-email 2.14.1", "In-Reply-To": "<20170826225110.7381-1-xypron.glpk@gmx.de>", "References": "<20170826225110.7381-1-xypron.glpk@gmx.de>", "X-Provags-ID": "V03:K0:K5xOQa1sWGAIt5HftvwudADDQQW9lBoGWYJ9Od/xdIJsv19I3dr\n\tjF1c0n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n\tYsq9Dps0ayoRfxF0nloSDmX1wbqYg==", "Cc": "Heinrich Schuchardt <xypron.glpk@gmx.de>, u-boot@lists.denx.de", "Subject": "[U-Boot] [PATCH 10/23] efi_loader: open_info in OpenProtocol", "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 and close_protocol have to keep track of\nopened protocols.\n\nSo we add an array open_info to each protocol of each handle.\n\nOpenProtocol has enter the agent and controller handle\ninformation into this array.\n\nSigned-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>\n---\n include/efi_loader.h | 1 +\n lib/efi_loader/efi_boottime.c | 130 +++++++++++++++++++++++++++++++-----------\n 2 files changed, 99 insertions(+), 32 deletions(-)", "diff": "diff --git a/include/efi_loader.h b/include/efi_loader.h\nindex 193fca24ce..2c3360534b 100644\n--- a/include/efi_loader.h\n+++ b/include/efi_loader.h\n@@ -87,6 +87,7 @@ extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop;\n struct efi_handler {\n \tconst efi_guid_t *guid;\n \tvoid *protocol_interface;\n+\tstruct efi_open_protocol_info_entry open_info[4];\n };\n \n /*\ndiff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c\nindex a483b827cd..294bc1f138 100644\n--- a/lib/efi_loader/efi_boottime.c\n+++ b/lib/efi_loader/efi_boottime.c\n@@ -1152,24 +1152,111 @@ static void EFIAPI efi_set_mem(void *buffer, unsigned long size, uint8_t value)\n \tmemset(buffer, value, size);\n }\n \n+static efi_status_t efi_protocol_open(\n+\t\t\tstruct efi_handler *protocol,\n+\t\t\tvoid **protocol_interface, void *agent_handle,\n+\t\t\tvoid *controller_handle, uint32_t attributes)\n+{\n+\tbool opened_exclusive = false;\n+\tbool opened_by_driver = false;\n+\tint i;\n+\tstruct efi_open_protocol_info_entry *open_info;\n+\tstruct efi_open_protocol_info_entry *match = NULL;\n+\n+\tif (attributes !=\n+\t EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {\n+\t\t*protocol_interface = NULL;\n+\t}\n+\n+\tfor (i = 0; i < ARRAY_SIZE(protocol->open_info); ++i) {\n+\t\topen_info = &protocol->open_info[i];\n+\n+\t\tif (!open_info->open_count)\n+\t\t\tcontinue;\n+\t\tif (open_info->agent_handle == agent_handle) {\n+\t\t\tif ((attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) &&\n+\t\t\t (open_info->attributes == attributes))\n+\t\t\t\treturn EFI_ALREADY_STARTED;\n+\t\t\tif (open_info->controller_handle == controller_handle)\n+\t\t\t\tmatch = open_info;\n+\t\t}\n+\t\tif (open_info->attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE)\n+\t\t\topened_exclusive = true;\n+\t}\n+\n+\tif (attributes &\n+\t (EFI_OPEN_PROTOCOL_EXCLUSIVE | EFI_OPEN_PROTOCOL_BY_DRIVER) &&\n+\t opened_exclusive)\n+\t\treturn EFI_ACCESS_DENIED;\n+\n+\tif (attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE) {\n+\t\tfor (i = 0; i < ARRAY_SIZE(protocol->open_info); ++i) {\n+\t\t\topen_info = &protocol->open_info[i];\n+\n+\t\t\tif (!open_info->open_count)\n+\t\t\t\tcontinue;\n+\t\t\tif (open_info->attributes ==\n+\t\t\t\t\tEFI_OPEN_PROTOCOL_BY_DRIVER)\n+\t\t\t\tEFI_CALL(efi_disconnect_controller(\n+\t\t\t\t\t\topen_info->controller_handle,\n+\t\t\t\t\t\topen_info->agent_handle,\n+\t\t\t\t\t\tNULL));\n+\t\t}\n+\t\topened_by_driver = false;\n+\t\tfor (i = 0; i < ARRAY_SIZE(protocol->open_info); ++i) {\n+\t\t\topen_info = &protocol->open_info[i];\n+\n+\t\t\tif (!open_info->open_count)\n+\t\t\t\tcontinue;\n+\t\t\tif (open_info->attributes & EFI_OPEN_PROTOCOL_BY_DRIVER)\n+\t\t\t\topened_by_driver = true;\n+\t\t}\n+\t\tif (opened_by_driver)\n+\t\t\treturn EFI_ACCESS_DENIED;\n+\t\tif (match && !match->open_count)\n+\t\t\tmatch = NULL;\n+\t}\n+\n+\t/*\n+\t * Find an empty slot.\n+\t */\n+\tif (!match) {\n+\t\tfor (i = 0; i < ARRAY_SIZE(protocol->open_info); ++i) {\n+\t\t\topen_info = &protocol->open_info[i];\n+\n+\t\t\tif (!open_info->open_count) {\n+\t\t\t\tmatch = open_info;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t}\n+\tif (!match)\n+\t\treturn EFI_OUT_OF_RESOURCES;\n+\n+\tmatch->agent_handle = agent_handle;\n+\tmatch->controller_handle = controller_handle;\n+\tmatch->attributes = attributes;\n+\tmatch->open_count++;\n+\t*protocol_interface = protocol->protocol_interface;\n+\n+\treturn EFI_SUCCESS;\n+}\n+\n static efi_status_t EFIAPI efi_open_protocol(\n \t\t\tvoid *handle, efi_guid_t *protocol,\n \t\t\tvoid **protocol_interface, void *agent_handle,\n \t\t\tvoid *controller_handle, uint32_t attributes)\n {\n-\tstruct list_head *lhandle;\n-\tint i;\n+\tstruct efi_handler *handler;\n \tefi_status_t r = EFI_INVALID_PARAMETER;\n \n \tEFI_ENTRY(\"%p, %p, %p, %p, %p, 0x%x\", handle, protocol,\n \t\t protocol_interface, agent_handle, controller_handle,\n \t\t attributes);\n \n-\tif (!handle || !protocol ||\n-\t (!protocol_interface && attributes !=\n-\t EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) {\n+\tif (!protocol_interface && attributes !=\n+\t EFI_OPEN_PROTOCOL_TEST_PROTOCOL)\n \t\tgoto out;\n-\t}\n \n \tswitch (attributes) {\n \tcase EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL:\n@@ -1191,33 +1278,12 @@ static efi_status_t EFIAPI efi_open_protocol(\n \t\tgoto out;\n \t}\n \n-\tlist_for_each(lhandle, &efi_obj_list) {\n-\t\tstruct efi_object *efiobj;\n-\t\tefiobj = list_entry(lhandle, struct efi_object, link);\n-\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\tif (attributes !=\n-\t\t\t\t EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {\n-\t\t\t\t\t*protocol_interface =\n-\t\t\t\t\t\thandler->protocol_interface;\n-\t\t\t\t}\n-\t\t\t\tr = EFI_SUCCESS;\n-\t\t\t\tgoto out;\n-\t\t\t}\n-\t\t}\n-\t\tgoto unsupported;\n-\t}\n+\tr = efi_search_protocol(handle, protocol, &handler);\n+\tif (r != EFI_SUCCESS)\n+\t\tgoto out;\n \n-unsupported:\n-\tr = EFI_UNSUPPORTED;\n+\tr = efi_protocol_open(handler, protocol_interface, agent_handle,\n+\t\t\t controller_handle, attributes);\n out:\n \treturn EFI_EXIT(r);\n }\n", "prefixes": [ "U-Boot", "10/23" ] }