[{"id":1766966,"web_url":"http://patchwork.ozlabs.org/comment/1766966/","msgid":"<CAPnjgZ1Le5+5qQkZa3jUYgBynR16XuxcbU+O2EPt7J8VLFqatw@mail.gmail.com>","list_archive_url":null,"date":"2017-09-12T12:30:26","subject":"Re: [U-Boot] [PATCH v2 14/21] efi_loader: efi variable support","submitter":{"id":6170,"url":"http://patchwork.ozlabs.org/api/people/6170/","name":"Simon Glass","email":"sjg@chromium.org"},"content":"Hi Rob,\n\nOn 10 September 2017 at 05:21, Rob Clark <robdclark@gmail.com> wrote:\n> Add EFI variable support, mapping to u-boot environment variables.\n> Variables are pretty important for setting up boot order, among other\n> things.  If the board supports saveenv, then it will be called in\n> ExitBootServices() to persist variables set by the efi payload.  (For\n> example, fallback.efi configuring BootOrder and BootXXXX load-option\n> variables.)\n>\n> Variables are *not* currently exposed at runtime, post ExitBootServices.\n> On boards without a dedicated device for storage, which the loaded OS\n> is not trying to also use, this is rather tricky.  One idea, at least\n> for boards that can persist RAM across reboot, is to keep a \"journal\"\n> of modified variables in RAM, and then turn halt into a reboot into\n> u-boot, plus store variables, plus halt.  Whatever the solution, it\n> likely involves some per-board support.\n>\n> Mapping between EFI variables and u-boot variables:\n>\n>   efi_$guid_$varname = {attributes}(type)value\n>\n> For example:\n>\n>   efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported=\n>      \"{ro,boot,run}(blob)0000000000000000\"\n>   efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_BootOrder=\n>      \"(blob)00010000\"\n>\n> The attributes are a comma separated list of these possible\n> attributes:\n>\n>   + ro   - read-only\n>   + boot - boot-services access\n>   + run  - runtime access\n>\n> NOTE: with current implementation, no variables are available after\n> ExitBootServices, and all are persisted (if possible).\n>\n> If not specified, the attributes default to \"{boot}\".\n>\n> The required type is one of:\n>\n>   + utf8 - raw utf8 string\n>   + blob - arbitrary length hex string\n>\n> Signed-off-by: Rob Clark <robdclark@gmail.com>\n> ---\n>  cmd/bootefi.c                 |   4 +\n>  include/efi.h                 |  19 +++\n>  include/efi_loader.h          |  10 ++\n>  lib/efi_loader/Makefile       |   2 +-\n>  lib/efi_loader/efi_boottime.c |   6 +\n>  lib/efi_loader/efi_runtime.c  |  17 ++-\n>  lib/efi_loader/efi_variable.c | 335 ++++++++++++++++++++++++++++++++++++++++++\n>  7 files changed, 388 insertions(+), 5 deletions(-)\n>  create mode 100644 lib/efi_loader/efi_variable.c\n\nWhat does hex2mem() do? Please add a comment\n\nThis code looks fine but we need a simple way to test it. I think\nHerinrich is working on a single hello world test. That could be\nenhanced to set and read variables.","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=\"Lrl9sYUe\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"VnmHIJzb\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xs4Xg3s3nz9t6M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 22:54:38 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 1026CC2202D; Tue, 12 Sep 2017 12:39:04 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 69014C22038;\n\tTue, 12 Sep 2017 12:39:03 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid D9907C220BB; Tue, 12 Sep 2017 12:30:52 +0000 (UTC)","from mail-qk0-f173.google.com (mail-qk0-f173.google.com\n\t[209.85.220.173])\n\tby lists.denx.de (Postfix) with ESMTPS id CD4DCC21FCD\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 12:30:48 +0000 (UTC)","by mail-qk0-f173.google.com with SMTP id a128so24577808qkc.5\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 05:30:48 -0700 (PDT)","by 10.200.37.200 with HTTP; Tue, 12 Sep 2017 05:30:26 -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=LO2Xgvj10+DiYZ5JexbPtFs+JlxcOcNM0GbMMQNlbAM=;\n\tb=Lrl9sYUewIbbWxdTF3EpUOfF6e+AwKzw3S67rnlg7amCqMBJh8v5nRDoxy7yBJ+yn5\n\tm1k4fuHby+D7H+LBmdJHa19uRqcuSBO9cNv0uF9KiwVWEO/MOhPcl/WpyRUpo6vmnctI\n\tTKJtfTE6kgFPkQr4cTX7NPTKlwmFFnCAhiowAAIKBNJmgoxbVjydS/mSfs/w3XUtebTv\n\tRRWZnJeUSanVbEn8jUz1kIs6XYd8xVcZ/B8WwFuUpuAu+y3MwwjEX4Z1Xz6/SSOosS4g\n\tyfpjJ8sgGe5K3aVz7KwEOV7gk0VoWnCFFrgNqVxNHB8PQpNJp9H98pz8BgqTXQ6sa2QK\n\tlw3g==","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=LO2Xgvj10+DiYZ5JexbPtFs+JlxcOcNM0GbMMQNlbAM=;\n\tb=VnmHIJzbl5dFsgdtgq+mSjMPNdKvqgDiVQJBdE4qsVXBygSZwfFwhie9KcIvui7/qa\n\t/2xUwyocc/ZsKAizYJHLmLjWL/rEijYi8ODu9iX3KWN31mhnqmQZ9S+ymMjX5WF2hq+F\n\tkHYsZQe1OZYng2OuIpJ/cyZIYoDYW/6PbSnAE="],"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=LO2Xgvj10+DiYZ5JexbPtFs+JlxcOcNM0GbMMQNlbAM=;\n\tb=glpL2hZaReZ35i1l4JLDkupuQtgBtIOXAOdv7SZUb/p56hwYmAiiNtzeZko2cow5vJ\n\tla/0Uk4IV9zkkZVH3cqveQFMWiX3s9LXDez+6YL93OkPbb4VbRQSB2FJ67aJquR0THQs\n\tPIIAXLUWMR3hTx2QVlXy5NP7VAIED1jGM2VByOs10t5ip8J13BMsn276lbG43hayOE41\n\tBiFg5FYGqEmyj34Gcye1fs+tHr8czuE35cimvwI+k02ToPL1DmC3VrDiYcq0/XXyzED8\n\tzvifUKt3RTI5+1fp4i2zRsfHrz+VB3NRnUu2GpcMioY2z8Vnm8IbIIVJpjsjh65k3oiQ\n\tAPyA==","X-Gm-Message-State":"AHPjjUhuGBsoCHWoOo49VZ34jrKNSLwsBhcXw4+Uq8H83Ox3/rSjakyq\n\tuJiwgBx6P6CQsUJTACZPYLBYZdTaw5oUsJoUbYuaKA==","X-Google-Smtp-Source":"AOwi7QA99tB1XqWqwWnnq3kMqoIL6CJiHAqK30afIpCPVd7/85Nx2CXGTxD4NaLyBnHUTgQJ29wp2pqD5TR1sRUQfrs=","X-Received":"by 10.55.122.130 with SMTP id v124mr936021qkc.209.1505219447379; \n\tTue, 12 Sep 2017 05:30:47 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<20170910112149.21358-24-robdclark@gmail.com>","References":"<20170910112149.21358-1-robdclark@gmail.com>\n\t<20170910112149.21358-24-robdclark@gmail.com>","From":"Simon Glass <sjg@chromium.org>","Date":"Tue, 12 Sep 2017 06:30:26 -0600","X-Google-Sender-Auth":"3sZkioSTGF6Ub6zKEP5HoP0ELzg","Message-ID":"<CAPnjgZ1Le5+5qQkZa3jUYgBynR16XuxcbU+O2EPt7J8VLFqatw@mail.gmail.com>","To":"Rob Clark <robdclark@gmail.com>","Cc":"U-Boot Mailing List <u-boot@lists.denx.de>,\n\tHeinrich Schuchardt <xypron.glpk@gmx.de>","Subject":"Re: [U-Boot] [PATCH v2 14/21] efi_loader: efi variable support","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":1767022,"web_url":"http://patchwork.ozlabs.org/comment/1767022/","msgid":"<CAF6AEGunrOP280Kze1S_=kU8ysytN0vrODLh0ygZQu4WE=duLw@mail.gmail.com>","list_archive_url":null,"date":"2017-09-12T13:10:52","subject":"Re: [U-Boot] [PATCH v2 14/21] efi_loader: efi variable support","submitter":{"id":18760,"url":"http://patchwork.ozlabs.org/api/people/18760/","name":"Rob Clark","email":"robdclark@gmail.com"},"content":"On Tue, Sep 12, 2017 at 8:30 AM, Simon Glass <sjg@chromium.org> wrote:\n> Hi Rob,\n>\n> On 10 September 2017 at 05:21, Rob Clark <robdclark@gmail.com> wrote:\n>> Add EFI variable support, mapping to u-boot environment variables.\n>> Variables are pretty important for setting up boot order, among other\n>> things.  If the board supports saveenv, then it will be called in\n>> ExitBootServices() to persist variables set by the efi payload.  (For\n>> example, fallback.efi configuring BootOrder and BootXXXX load-option\n>> variables.)\n>>\n>> Variables are *not* currently exposed at runtime, post ExitBootServices.\n>> On boards without a dedicated device for storage, which the loaded OS\n>> is not trying to also use, this is rather tricky.  One idea, at least\n>> for boards that can persist RAM across reboot, is to keep a \"journal\"\n>> of modified variables in RAM, and then turn halt into a reboot into\n>> u-boot, plus store variables, plus halt.  Whatever the solution, it\n>> likely involves some per-board support.\n>>\n>> Mapping between EFI variables and u-boot variables:\n>>\n>>   efi_$guid_$varname = {attributes}(type)value\n>>\n>> For example:\n>>\n>>   efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported=\n>>      \"{ro,boot,run}(blob)0000000000000000\"\n>>   efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_BootOrder=\n>>      \"(blob)00010000\"\n>>\n>> The attributes are a comma separated list of these possible\n>> attributes:\n>>\n>>   + ro   - read-only\n>>   + boot - boot-services access\n>>   + run  - runtime access\n>>\n>> NOTE: with current implementation, no variables are available after\n>> ExitBootServices, and all are persisted (if possible).\n>>\n>> If not specified, the attributes default to \"{boot}\".\n>>\n>> The required type is one of:\n>>\n>>   + utf8 - raw utf8 string\n>>   + blob - arbitrary length hex string\n>>\n>> Signed-off-by: Rob Clark <robdclark@gmail.com>\n>> ---\n>>  cmd/bootefi.c                 |   4 +\n>>  include/efi.h                 |  19 +++\n>>  include/efi_loader.h          |  10 ++\n>>  lib/efi_loader/Makefile       |   2 +-\n>>  lib/efi_loader/efi_boottime.c |   6 +\n>>  lib/efi_loader/efi_runtime.c  |  17 ++-\n>>  lib/efi_loader/efi_variable.c | 335 ++++++++++++++++++++++++++++++++++++++++++\n>>  7 files changed, 388 insertions(+), 5 deletions(-)\n>>  create mode 100644 lib/efi_loader/efi_variable.c\n>\n> What does hex2mem() do? Please add a comment\n>\n> This code looks fine but we need a simple way to test it. I think\n> Herinrich is working on a single hello world test. That could be\n> enhanced to set and read variables.\n\ntbh, just starting Shell.efi, let alone launching SCT.efi, requires\nall of this stuff (filesys, variables, installing/removing protocols,\netc) to be working\n\nGetting shell.efi into travis and running a couple \"simple\" commands\nseems like a better option.\n\nBR,\n-R","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=\"GBnrdVmO\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xs4tW75DMz9s3T\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 23:11:15 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid A109DC220A9; Tue, 12 Sep 2017 13:10:58 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id A5DFFC21DE1;\n\tTue, 12 Sep 2017 13:10:55 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 73AB9C21DE1; Tue, 12 Sep 2017 13:10:54 +0000 (UTC)","from mail-lf0-f65.google.com (mail-lf0-f65.google.com\n\t[209.85.215.65])\n\tby lists.denx.de (Postfix) with ESMTPS id 17DD8C21D78\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 13:10:54 +0000 (UTC)","by mail-lf0-f65.google.com with SMTP id y15so5345311lfd.0\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 06:10:54 -0700 (PDT)","by 10.46.29.20 with HTTP; Tue, 12 Sep 2017 06:10:52 -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=p5O5XOsgh5goviP/CgX2YR1NLQUE0L6PZJthzw+1TVM=;\n\tb=GBnrdVmOHr4UZh9OJHaLRwDQ7zv4O1qFVyn//8I7aVAsd7WfIZkGZB4Nk4C0D/Pzw4\n\tSHAmiONBt830kO3IigwQwTeWksLMa7McffLSYVWIQspJZh7LWUOWjvhoDA51XtySPcgL\n\tEsDB6U0+FHyEt2xMWK7BNuMLf3FYeaxsoLZ0SKok2ieL7PscikNxVjVRx0ED0Sg/RD3a\n\tdwXPrNfF/GPKO00ZywJ6MLqy+rEm4n/CttEWEzBoAgu7OP4LeuMx8ZUSpC39yBuVDw/G\n\tW80rZZz0ccSDO/LW15cYWk/NNiUHAyKflqsI1H5ATYp51SZ1KIpCu5d1+PnftFgMFP4Q\n\tIrjg==","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=p5O5XOsgh5goviP/CgX2YR1NLQUE0L6PZJthzw+1TVM=;\n\tb=UCN0SZBxmcqVW/Juh1TBQSzcdsopnhDGwpq+kkJmCBQj0GY8KcimMUrpeiUWYCD6eG\n\t8O05VHlgJF5E2mYjbwzQpBzIt/zFLaKba32Kv8FLX18uZY4WkGwLrafYZGLFcupHAzaP\n\teSOoBbVfjtiuRgXGUx53pNlbC4O0aJoRMwljF4cMddHPyqO4sQUf9Tepzog0DyaPz7Lq\n\tf1IHTNpU+2nZvfaozJnu7DqN8J7LxROSYWD544q9I9oZyjg/ksc8rXLF3bs9sxpaCAXH\n\teCIMvrLP0G48g1KO1r816OEWtVqvmVrr0ryS0e88Hq5AHlE0Knz9SJL2tpnw6HX99Avz\n\tZMRQ==","X-Gm-Message-State":"AHPjjUgJhZkXJwYeTYDOq35PvOlfUa+CbHz5gSpg6q8ecljrJhDCxIbA\n\t+1IVx0mWEJkXau+WbG2ucV5vtgbwlQ==","X-Google-Smtp-Source":"AOwi7QB8GoyMELKz29V6/SWzpeSlCt788/vYPAuylGsK6n8OmFpqBT35MdeYZl8asSiuCwzM14WXB/RFRyPg/VWVB0Q=","X-Received":"by 10.46.33.202 with SMTP id h71mr5331884lji.56.1505221853478;\n\tTue, 12 Sep 2017 06:10:53 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CAPnjgZ1Le5+5qQkZa3jUYgBynR16XuxcbU+O2EPt7J8VLFqatw@mail.gmail.com>","References":"<20170910112149.21358-1-robdclark@gmail.com>\n\t<20170910112149.21358-24-robdclark@gmail.com>\n\t<CAPnjgZ1Le5+5qQkZa3jUYgBynR16XuxcbU+O2EPt7J8VLFqatw@mail.gmail.com>","From":"Rob Clark <robdclark@gmail.com>","Date":"Tue, 12 Sep 2017 09:10:52 -0400","Message-ID":"<CAF6AEGunrOP280Kze1S_=kU8ysytN0vrODLh0ygZQu4WE=duLw@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 v2 14/21] efi_loader: efi variable support","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>"}}]