[{"id":1760968,"web_url":"http://patchwork.ozlabs.org/comment/1760968/","msgid":"<CAPnjgZ1Vmuqre=tOoFeQCF=rv95_z4_sf_aKn7vOBEO6b9h-XA@mail.gmail.com>","list_archive_url":null,"date":"2017-08-31T12:51:33","subject":"Re: [U-Boot] [PATCH 08/23] efi_loader: allow creating new handles","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:51, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n> In efi_install_protocol_interface support creating\n> a new handle.\n>\n> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>\n> ---\n>  lib/efi_loader/efi_boottime.c | 22 ++++++++++++++++++++--\n>  1 file changed, 20 insertions(+), 2 deletions(-)\n>\nReviewed-by: Simon Glass <sjg@chromium.org>\n\nThe use of void ** seems odd. Is that mandated by EFI? Is there no way\nto use a proper type?\n\n> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c\n> index 96cb1fa410..9f8d64659f 100644\n> --- a/lib/efi_loader/efi_boottime.c\n> +++ b/lib/efi_loader/efi_boottime.c\n> @@ -238,6 +238,23 @@ static efi_status_t EFIAPI efi_free_pool_ext(void *buffer)\n>         return EFI_EXIT(r);\n>  }\n>\n> +static efi_status_t efi_create_handle(void **handle)\n> +{\n> +       struct efi_object *obj;\n> +       efi_status_t r;\n> +\n> +       r = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES,\n> +                             sizeof(struct efi_object),\n> +                             (void **)&obj);\n> +       if (r != EFI_SUCCESS)\n> +               return r;\n> +       memset(obj, 0, sizeof(struct efi_object));\n> +       obj->handle = obj;\n> +       list_add_tail(&obj->link, &efi_obj_list);\n> +       *handle = obj;\n> +       return r;\n> +}\n> +\n>  /*\n>   * Our event capabilities are very limited. Only a small limited\n>   * number of events is allowed to coexist.\n> @@ -497,8 +514,9 @@ static efi_status_t EFIAPI efi_install_protocol_interface(void **handle,\n>\n>         /* Create new handle if requested. */\n>         if (!*handle) {\n> -               r = EFI_OUT_OF_RESOURCES;\n> -               goto out;\n> +               r = efi_create_handle(handle);\n> +               if (r != EFI_SUCCESS)\n> +                       goto out;\n>         }\n>\n>         /* Find object. */\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=\"FW5OrXDM\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"OAJ/N/ZW\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xjjPh6G3Hz9s72\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 23:09:12 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 90CA3C21E96; Thu, 31 Aug 2017 12:55:04 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 29E6FC21E29;\n\tThu, 31 Aug 2017 12:54:02 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid E9E77C21E0E; Thu, 31 Aug 2017 12:51:59 +0000 (UTC)","from mail-qk0-f178.google.com (mail-qk0-f178.google.com\n\t[209.85.220.178])\n\tby lists.denx.de (Postfix) with ESMTPS id 8F7B7C21DB1\n\tfor <u-boot@lists.denx.de>; Thu, 31 Aug 2017 12:51:55 +0000 (UTC)","by mail-qk0-f178.google.com with SMTP id a77so2307596qkb.1\n\tfor <u-boot@lists.denx.de>; Thu, 31 Aug 2017 05:51:55 -0700 (PDT)","by 10.200.28.106 with HTTP; Thu, 31 Aug 2017 05:51:33 -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_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=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=e204+RzH7wD4Wv71ST/uO1tLj4WIu/MFRlI6H7qk+PI=;\n\tb=FW5OrXDMsu6lyh+tN/3WMhBajidbGjww7WckCin08QC6QmO4rnWA3pscIPi0nKjfAj\n\tPVpkmtVzwcVxb4B8ecXv1OmzNpwDvmSo6Pu6SbairrmnAoTRqgzMHBn3GcP7CfFgJc2Z\n\t3KuGI68uGNYVa2/C9ojNFUdttRGN4DUqLxOatZFev3DLP+Noe7FbumNHBFNXTi0ODpNF\n\tGVeaJ5sPeKCYB+nAuv3p8w6fL/nyYyYutQOp2QtC16+mhfwVn2QPPr3Yymta0eGqITDf\n\tqY4DHXhJjMXuq1i+knsby8Cjn9j3pP4JrQOhOdLC8U0rKEPzLOz1nbAscxA4aiPD9xvP\n\tuUcA==","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=e204+RzH7wD4Wv71ST/uO1tLj4WIu/MFRlI6H7qk+PI=;\n\tb=OAJ/N/ZWr2Uux6kFK98f8LQbavmyxBNg7gqOnB3ZTDt30EF6+KR0rKvTYSnrW6/UcO\n\tju0UtnZn+e+PKViR2rAPONxn9fiQnR6PBIk0nkw6/s0399+rH/LnwygIsKJP/N4EQBB5\n\t2XDJqbMwGNJMcZxabQGfQX8VCcAC/ten9yLWg="],"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=e204+RzH7wD4Wv71ST/uO1tLj4WIu/MFRlI6H7qk+PI=;\n\tb=onvOE+MQR/LpUfO8uvR0NVfSCGf0/xISSn1VEIRl1WMGm2n0LBgeJqw+sC/Z4p2StE\n\tj8D3QA3bM+JV3kNPzvA5ruIbcWbcevjVUcAbBMvCIUGYv3XOEBHhe8h03iKBRYPeIQqz\n\twtggvHX81GVj0Ln0SPGVWqGbqu/+iOWpiJhozdPJcTcPAm5kVJIiCNPAP0aH60+791Q8\n\tKPVm5/zKFaD7QhsjuKgAXPLquzVmq/118h6njpUTGiyK8LNqyrqam8P8xNRGKFrvtXsr\n\tyd0x5WowgnUiN4TwrKnkuGuNLMGU/uovtSYkmZq40q2ZkYg3fwJGW1+tagHpQIysYdOW\n\tVBSw==","X-Gm-Message-State":"AHYfb5jPjj3O1/NsbLat7kUuJ0xlmCC0BinQqYphBXydG2h/VrL1mlHs\n\tgNz/62CkKs8SVifw5LonLdeq89gBwsZN","X-Google-Smtp-Source":"ADKCNb5HlmCr4UjyKYks9fdfwkj/T/nzHxQ6lhztk1cIp98pGYiZi77Go0XtkeiFKxp44GwOzOlE03lwVol90jQl+Cg=","X-Received":"by 10.55.102.200 with SMTP id a191mr3520274qkc.326.1504183914246;\n\tThu, 31 Aug 2017 05:51:54 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<20170826225110.7381-9-xypron.glpk@gmx.de>","References":"<20170826225110.7381-1-xypron.glpk@gmx.de>\n\t<20170826225110.7381-9-xypron.glpk@gmx.de>","From":"Simon Glass <sjg@chromium.org>","Date":"Thu, 31 Aug 2017 20:51:33 +0800","X-Google-Sender-Auth":"j0Njg60h6m45mRay1rvb9puqYxs","Message-ID":"<CAPnjgZ1Vmuqre=tOoFeQCF=rv95_z4_sf_aKn7vOBEO6b9h-XA@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 08/23] efi_loader: allow creating new handles","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>"}},{"id":1764904,"web_url":"http://patchwork.ozlabs.org/comment/1764904/","msgid":"<CAF6AEGvk1fM9ByF=gs+4C-WMpxx96Keef=SWaegF2UqvvSupWQ@mail.gmail.com>","list_archive_url":null,"date":"2017-09-07T19:20:07","subject":"Re: [U-Boot] [PATCH 08/23] efi_loader: allow creating new handles","submitter":{"id":18760,"url":"http://patchwork.ozlabs.org/api/people/18760/","name":"Rob Clark","email":"robdclark@gmail.com"},"content":"On Thu, Aug 31, 2017 at 8:51 AM, Simon Glass <sjg@chromium.org> wrote:\n> On 27 August 2017 at 06:51, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n>> In efi_install_protocol_interface support creating\n>> a new handle.\n>>\n>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>\n>> ---\n>>  lib/efi_loader/efi_boottime.c | 22 ++++++++++++++++++++--\n>>  1 file changed, 20 insertions(+), 2 deletions(-)\n>>\n> Reviewed-by: Simon Glass <sjg@chromium.org>\n>\n> The use of void ** seems odd. Is that mandated by EFI? Is there no way\n> to use a proper type?\n\nThere is in fact an efi_handle_t, which we should probably start using..\n\nAnyways, turns out SCT needed this patch, so Heinrich, you can add my:\n\nTested-by: Rob Clark <robdclark@gmail.com>\n\n\n>> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c\n>> index 96cb1fa410..9f8d64659f 100644\n>> --- a/lib/efi_loader/efi_boottime.c\n>> +++ b/lib/efi_loader/efi_boottime.c\n>> @@ -238,6 +238,23 @@ static efi_status_t EFIAPI efi_free_pool_ext(void *buffer)\n>>         return EFI_EXIT(r);\n>>  }\n>>\n>> +static efi_status_t efi_create_handle(void **handle)\n>> +{\n>> +       struct efi_object *obj;\n>> +       efi_status_t r;\n>> +\n>> +       r = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES,\n>> +                             sizeof(struct efi_object),\n>> +                             (void **)&obj);\n>> +       if (r != EFI_SUCCESS)\n>> +               return r;\n>> +       memset(obj, 0, sizeof(struct efi_object));\n>> +       obj->handle = obj;\n>> +       list_add_tail(&obj->link, &efi_obj_list);\n>> +       *handle = obj;\n>> +       return r;\n>> +}\n>> +\n>>  /*\n>>   * Our event capabilities are very limited. Only a small limited\n>>   * number of events is allowed to coexist.\n>> @@ -497,8 +514,9 @@ static efi_status_t EFIAPI efi_install_protocol_interface(void **handle,\n>>\n>>         /* Create new handle if requested. */\n>>         if (!*handle) {\n>> -               r = EFI_OUT_OF_RESOURCES;\n>> -               goto out;\n>> +               r = efi_create_handle(handle);\n>> +               if (r != EFI_SUCCESS)\n>> +                       goto out;\n>>         }\n>>\n>>         /* Find object. */\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=gmail.com header.i=@gmail.com\n\theader.b=\"tx7A1SCo\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xp9Jm6ykTz9ryv\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Sep 2017 05:20:23 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid E5EE6C21EA5; Thu,  7 Sep 2017 19:20:15 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 84526C21D70;\n\tThu,  7 Sep 2017 19:20:13 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 50C8BC21D70; Thu,  7 Sep 2017 19:20:12 +0000 (UTC)","from mail-lf0-f68.google.com (mail-lf0-f68.google.com\n\t[209.85.215.68])\n\tby lists.denx.de (Postfix) with ESMTPS id 924CBC21C73\n\tfor <u-boot@lists.denx.de>; Thu,  7 Sep 2017 19:20:08 +0000 (UTC)","by mail-lf0-f68.google.com with SMTP id y15so241977lfd.0\n\tfor <u-boot@lists.denx.de>; Thu, 07 Sep 2017 12:20:08 -0700 (PDT)","by 10.46.0.94 with HTTP; Thu, 7 Sep 2017 12:20:07 -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=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID\n\tautolearn=unavailable autolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=SO+HInpYeRQly1E7mt2xFe4FDPNnGAQ3CtF6n45SE6s=;\n\tb=tx7A1SCoQ09VnH1boZ4rpksJRzWHfrV9yb2tPYC8B/REiFL9AWdPVmB+YTg/g8L7z3\n\tYoGidHcfBGNYKhRwLgPce5cjrlaTM0npw647EXfwk3f29VWy0DcIhyz8s5MhQxFfi4Mc\n\tkunlxMaDN39Jdt8hrV3KMm1qpL/ZpJiSkRGjdrdEA90XkKEUBFIxjxOs9KvbXYbHjpIW\n\tv3SzsBYmWqADoOeqpmur6izNSuL6SKlLivq95NaIprBWcbHnK1Zq97apsX55kdXlQo3G\n\t5F6aM6bc/die1IwzQeLkyN6s1brdrhGnJrwA6oLFcu6eZQa3bEETY54JuSlDbmHaK432\n\tWEMw==","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:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=SO+HInpYeRQly1E7mt2xFe4FDPNnGAQ3CtF6n45SE6s=;\n\tb=t2tzyw5xDBlOLA8H+74i9IobUp1XgXVJUJsuhYmcsHj8Yo18dHt/vsiXt0D7iNfpkb\n\tspqhEROETVDtYum4RDfdydg2oL5I+nxW4z6zZO185GC8O0NUKRC6kP9160FNdHC+Ow0Q\n\t0xduylSsgiJGlR7dYIXkLv8NSIApL40Jn0swLlXaPgm5K5viLQt3NRI2rrMReAsyQiFD\n\t+z3/gmZISxjOfHIS4RIfD3ZDjMVF3FAZr5DtCP5sly3vwyGazrIyBwys8tY/y+M6kNOO\n\t6oZ5EEGe31xkMJtqvXgTQ92/MrKwfMT9qtcGKIuN65gmmPFi8xLqE9fqS2mXfWmdTIq3\n\tk0Uw==","X-Gm-Message-State":"AHPjjUihD44J3gaTdlbB3A335bi+O0kRgrsgghGd+s3/fmd1uepLPnvx\n\t4Xfv5jGz4B60yoes9VS2PJ0QhWb0mg==","X-Google-Smtp-Source":"AOwi7QDd+tYLPWqfZsyT45sTNA/8VWJgIpN2qbhzj/NlKexcCpLUleY1F1MftG/eIRxalFnKra/omx25WO3/jRtd0Yw=","X-Received":"by 10.25.166.69 with SMTP id p66mr123534lfe.190.1504812008003;\n\tThu, 07 Sep 2017 12:20:08 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CAPnjgZ1Vmuqre=tOoFeQCF=rv95_z4_sf_aKn7vOBEO6b9h-XA@mail.gmail.com>","References":"<20170826225110.7381-1-xypron.glpk@gmx.de>\n\t<20170826225110.7381-9-xypron.glpk@gmx.de>\n\t<CAPnjgZ1Vmuqre=tOoFeQCF=rv95_z4_sf_aKn7vOBEO6b9h-XA@mail.gmail.com>","From":"Rob Clark <robdclark@gmail.com>","Date":"Thu, 7 Sep 2017 15:20:07 -0400","Message-ID":"<CAF6AEGvk1fM9ByF=gs+4C-WMpxx96Keef=SWaegF2UqvvSupWQ@mail.gmail.com>","To":"Simon Glass <sjg@chromium.org>","Cc":"U-Boot Mailing List <u-boot@lists.denx.de>,\n\tHeinrich Schuchardt <xypron.glpk@gmx.de>","Subject":"Re: [U-Boot] [PATCH 08/23] efi_loader: allow creating new handles","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>"}}]