[{"id":1760958,"web_url":"http://patchwork.ozlabs.org/comment/1760958/","msgid":"<CAPnjgZ2Csx6qP8VoZhMLex-FBj=1GhJDY5q6TRs6vEHzjPUxzw@mail.gmail.com>","list_archive_url":null,"date":"2017-08-31T12:51:48","subject":"Re: [U-Boot] [PATCH 11/23] efi_loader: open_info in CloseProtocol","submitter":{"id":6170,"url":"http://patchwork.ozlabs.org/api/people/6170/","name":"Simon Glass","email":"sjg@chromium.org"},"content":"On 27 August 2017 at 06:53, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n> efi_open_protocol and efi_close_protocol have to keep track of\n> opened protocols.\n>\n> efi_close_protocol has to mark the appropriate entry as\n> empty.\n>\n> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>\n> ---\n>  lib/efi_loader/efi_boottime.c | 33 ++++++++++++++++++++++++++++++++-\n>  1 file changed, 32 insertions(+), 1 deletion(-)\n\nReviewed-by: Simon Glass <sjg@chromium.org>\n\nAgain I wonder if you can use a utility function to find the slot.\n\n>\n> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c\n> index 294bc1f138..c9aec597a2 100644\n> --- a/lib/efi_loader/efi_boottime.c\n> +++ b/lib/efi_loader/efi_boottime.c\n> @@ -944,9 +944,40 @@ static efi_status_t EFIAPI efi_close_protocol(void *handle,\n>                                               void *agent_handle,\n>                                               void *controller_handle)\n>  {\n> +       struct efi_handler *handler;\n> +       size_t i;\n> +       struct efi_open_protocol_info_entry *open_info;\n> +       efi_status_t r;\n> +\n>         EFI_ENTRY(\"%p, %p, %p, %p\", handle, protocol, agent_handle,\n>                   controller_handle);\n> -       return EFI_EXIT(EFI_NOT_FOUND);\n> +\n> +       if (!agent_handle) {\n> +               r = EFI_INVALID_PARAMETER;\n> +               goto out;\n> +       }\n> +\n> +       r = efi_search_protocol(handle, protocol, &handler);\n> +       if (r != EFI_SUCCESS)\n> +               goto out;\n> +\n> +       for (i = 0; i < ARRAY_SIZE(handler->open_info); ++i) {\n> +               open_info = &handler->open_info[i];\n> +\n> +               if (!open_info->open_count)\n> +                       continue;\n> +\n> +               if (open_info->agent_handle == agent_handle &&\n> +                   open_info->controller_handle ==\n> +                   controller_handle) {\n> +                       open_info->open_count--;\n> +                       r = EFI_SUCCESS;\n> +                       goto out;\n> +               }\n> +       }\n> +       r = EFI_NOT_FOUND;\n> +out:\n> +       return EFI_EXIT(r);\n>  }\n>\n>  static efi_status_t EFIAPI efi_open_protocol_information(efi_handle_t handle,\n> --\n> 2.14.1\n>","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>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=google.com header.i=@google.com\n\theader.b=\"ia0TkiuE\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"cekihXr9\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xjjFl6c63z9sMN\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 23:02:19 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 9C14DC21E27; Thu, 31 Aug 2017 12:53:46 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 68EAAC21E27;\n\tThu, 31 Aug 2017 12:52:50 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid DAB8FC21E0C; Thu, 31 Aug 2017 12:52:13 +0000 (UTC)","from mail-qk0-f172.google.com (mail-qk0-f172.google.com\n\t[209.85.220.172])\n\tby lists.denx.de (Postfix) with ESMTPS id 817EAC21DF9\n\tfor <u-boot@lists.denx.de>; Thu, 31 Aug 2017 12:52:10 +0000 (UTC)","by mail-qk0-f172.google.com with SMTP id a77so2310255qkb.1\n\tfor <u-boot@lists.denx.de>; Thu, 31 Aug 2017 05:52:10 -0700 (PDT)","by 10.200.28.106 with HTTP; Thu, 31 Aug 2017 05:51:48 -0700 (PDT)"],"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=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H2,\n\tT_DKIM_INVALID autolearn=unavailable autolearn_force=no\n\tversion=3.4.0","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=20161025; \n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=sPf8dqfGBw+ovLHKp3GcNgJFAO4T8gr80NnRPKmt9jo=;\n\tb=ia0TkiuE540wtgUXJ72Sl7r3p1W2aGIFtifhC702YFltRaEu/FwTCKahmTH/x1m4cd\n\tEOKih3X2ycK8OYysc4tlZfiEP+o+tOiC7jwD1NmZM4fsccodYqfb3m9K9OZ411kmwD1g\n\tS/NtNbJ7ostcyLWOiDbr6Wdx9PegrcxTA7egdLmvZL5HJOPhzwfxBzTnHu5syj6tz+Zw\n\t/zZhUJ8l1JvJ7n6xp8XfjB6L+LRy2njbr86T3S+/5hi2v0xL/51sx6+bUDv6R1o1f+Yp\n\twwUHriD22cpXQGoUpa1/wEzynapJamc3lsWc24Tt/Tdpz9dzFRylvKQbAP7PZqkTffAP\n\tAXYQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=sPf8dqfGBw+ovLHKp3GcNgJFAO4T8gr80NnRPKmt9jo=;\n\tb=cekihXr9aWvsY2C9+UQC5quYutztidApWTXl5PszTAZcpFZnEjheH0Pm35/yTYedh3\n\t7DXhKVIbNKYgX8xsz5cVBMV52jlgw3nS70MBahuPzfXbvNwiDN2ZkamFtLm152tAXfdL\n\t1al1dgw3iMlPoZKuxntoGn9kAhbQCOro5FgDA="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc;\n\tbh=sPf8dqfGBw+ovLHKp3GcNgJFAO4T8gr80NnRPKmt9jo=;\n\tb=CwLREwjhhjcRTF/++sZNND6n0iJ0eVF7+qYv68saxW/2xlwGWRlvElWOcDXWEHhiKK\n\tqfVdxzhFWQRHlkVaFlogOS338HpSycyaqK3u3Xt+tVmk1f83iRbAFX6IGwtZYcpeyxWN\n\t+S84PN0Jh5rsd0DcutHa/NeQtaFm3yfPWh/31q2sY5O+I5Fat7SxcKLDlKCyva7hfY5V\n\tHrdwWh6AQLxv0ckJgE4IJWsGysbbOModDEhg2e+f2XKQeZ+4Ef10qCrvnZRHGQDSTfX+\n\tveiwaXZJb5ozVN3rj+9bN8imdU5a1Hb8qQIzeWoB1YzcZimdTOsnUv1bFWcMll4MzQi+\n\tXcuQ==","X-Gm-Message-State":"AHYfb5ggfo04S8SprFt8V014ZOLTs37wc2dH+wedjqlJE8f6XAp3eSqk\n\tKzeUeRA0EcPKgFie0vwO7zmjuHlieN1I","X-Google-Smtp-Source":"ADKCNb6JOTdz8XDiD0RiliHQf6p2cyTrK7pzCqyui78I2/OVSqQnexl72GfXIF4ceow5eP8TCXADVAGX7KuFJAO+3dE=","X-Received":"by 10.55.74.88 with SMTP id x85mr3486887qka.294.1504183929186;\n\tThu, 31 Aug 2017 05:52:09 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<20170826225328.7550-2-xypron.glpk@gmx.de>","References":"<20170826225110.7381-1-xypron.glpk@gmx.de>\n\t<20170826225328.7550-1-xypron.glpk@gmx.de>\n\t<20170826225328.7550-2-xypron.glpk@gmx.de>","From":"Simon Glass <sjg@chromium.org>","Date":"Thu, 31 Aug 2017 20:51:48 +0800","X-Google-Sender-Auth":"8vydHoKv7E6IPK_SGLIeFhGGYZ8","Message-ID":"<CAPnjgZ2Csx6qP8VoZhMLex-FBj=1GhJDY5q6TRs6vEHzjPUxzw@mail.gmail.com>","To":"Heinrich Schuchardt <xypron.glpk@gmx.de>","Cc":"U-Boot Mailing List <u-boot@lists.denx.de>","Subject":"Re: [U-Boot] [PATCH 11/23] efi_loader: open_info in CloseProtocol","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>","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>"}}]