From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED9E8C433EF for ; Wed, 9 Mar 2022 13:50:42 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F0BCF80FA6; Wed, 9 Mar 2022 14:50:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="nPqSTnFo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8E0F880312; Wed, 9 Mar 2022 14:50:38 +0100 (CET) Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8269180FA6 for ; Wed, 9 Mar 2022 14:50:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ej1-x636.google.com with SMTP id gb39so5201168ejc.1 for ; Wed, 09 Mar 2022 05:50:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=LKav+aui4CDxdceMUiygYP1jG/61AyDm9ywOp4kt2Uc=; b=nPqSTnFog33E3ixYxZsrIQmZH8i/SsX8cc+qcGnCTqWfXKuTb3Va1v4fZmIzut/QWU bmCpEHEPCFgflD5do33XivYK+Al2dekwDLY9Zp8fErzEue3m33Ks1fm6H29cYJEkeUWP lfWNi63h9zley2yXtzQRMt7VWrObbn7IgENIN9s+2Km4LjfwFpcgxSBQVmoGqldgWI0o pRP16v0yv5+0kXyCELqDD9cp7bvzsVAw+GZf4tmX6Z6Ai6Q21OturXTBDhJT/HiBxzMW LsBsWNPDb7FhnocvLifYyHX+ghwvmHiTTATxzpqr5LdtjoCY/5KBlZt0eV7VetScNuVL wJuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=LKav+aui4CDxdceMUiygYP1jG/61AyDm9ywOp4kt2Uc=; b=JkktGASH5j4wjFt4y6dvIYQ+2T01ZqMn2XUtmeMaRh2tFsryW20/E5+oXl0vJ63ZKQ X5MWKgjNR/d8LkNScGQSKClu4Om7EKnIjKtR7hXb/KLN+2gotgWWQPNG+UU8NVNsZWCp WTgpoayweGBpyPm9vgkgKqpszl6khT9MuYHx1GrlClOMOC7iPVpcRBdpFjOj2cgYH4+z kAJO6/XiGtleajX/Y+qVjxnpBwaqA3VOxyyVg9mIb8VJLZW9z4U41jCHAW3hzXWA7K6u 5Q90ivVoFIJEuHpUqy8YAoZ+lswXgIbXPCVWzUEk8KNdWPino+7GrFzRDGXpTKrHw9/O N07Q== X-Gm-Message-State: AOAM532r5rVbN2q3az+GlhB+a2yzXEdlzExFp0pOesRk+l6bVSqcZt2I 1002tmnqzAXgtf4dLzpTyVqzZg== X-Google-Smtp-Source: ABdhPJzEtd5aEaWAdfBfJzS98BswsJTIiEJtCfHXfC4zgmbW0DYYbtmG1YmXqQ/et0XMemynhhcolg== X-Received: by 2002:a17:907:96a6:b0:6db:1d4a:a8ed with SMTP id hd38-20020a17090796a600b006db1d4aa8edmr13547489ejc.317.1646833832334; Wed, 09 Mar 2022 05:50:32 -0800 (PST) Received: from hades (athedsl-4461682.home.otenet.gr. [94.71.4.98]) by smtp.gmail.com with ESMTPSA id bq23-20020a170906d0d700b006db0372d3a2sm771474ejb.20.2022.03.09.05.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Mar 2022 05:50:31 -0800 (PST) Date: Wed, 9 Mar 2022 15:50:29 +0200 From: Ilias Apalodimas To: Takahiro Akashi , Masahisa Kojima , u-boot@lists.denx.de, Heinrich Schuchardt , Simon Glass , Francois Ozog , Mark Kettenis Subject: Re: [RFC PATCH v3 1/2] efi_loader: introduce "bootefi bootindex" command Message-ID: References: <20220308140745.26180-1-masahisa.kojima@linaro.org> <20220308140745.26180-2-masahisa.kojima@linaro.org> <20220308141728.GC228584@laputa> <20220309023557.GB136899@laputa> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220309023557.GB136899@laputa> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Hi Kojima-san On Wed, Mar 09, 2022 at 11:35:57AM +0900, Takahiro Akashi wrote: > On Wed, Mar 09, 2022 at 09:47:25AM +0900, Masahisa Kojima wrote: > > On Tue, 8 Mar 2022 at 23:17, Takahiro Akashi wrote: > > > > > > On Tue, Mar 08, 2022 at 11:07:44PM +0900, Masahisa Kojima wrote: > > > > This commit introduces the new command "bootefi bootindex". > > > > With this command, user can select which "Boot####" option > > > > to load and execute. > > > > > > You can do the same thing with: > > > $ efidebug boot next 1 (for BOOT0001) > > > $ bootefi bootmgr > > > > Thank you for the information, it is good to know. > > My only concern is that user needs to enable "efidebug" command > > for this case, since efidebug implies that it is for debug purpose. > > Yeah, that is the point where I and ex-maintainer have never agreed. > So we have no standard UI for UEFI subsystem on U-Boot until now. > > Just FYI, we can do the same thing in yet another way :) > => env set -e -nv -bs -rt BootNext =0x0001 > > Similarly, BootOrder as well. > > -Takahiro Akashi I also think it's safe to drop this patch. It's indeed an easier way to load a specific boot index, however the use of bootnext is clearly defined in the spec. I don't think we need to increase the EFI code more as long as it's clear to anyone that setting bootnext (note here it has to be set on each reboot) would have the same result. Cheers /Ilias > > > Thanks, > > Masahisa Kojima > > > > > > > > -Takahiro Akashi > > > > > > > > > > Signed-off-by: Masahisa Kojima > > > > --- > > > > Changes in v3: > > > > - newly created > > > > > > > > cmd/bootefi.c | 42 ++++++++++++++++++++++++++++++++++++ > > > > include/efi_loader.h | 1 + > > > > lib/efi_loader/efi_bootmgr.c | 7 +++--- > > > > 3 files changed, 46 insertions(+), 4 deletions(-) > > > > > > > > diff --git a/cmd/bootefi.c b/cmd/bootefi.c > > > > index 46eebd5ee2..df86438fec 100644 > > > > --- a/cmd/bootefi.c > > > > +++ b/cmd/bootefi.c > > > > @@ -416,6 +416,30 @@ static int do_efibootmgr(void) > > > > return CMD_RET_SUCCESS; > > > > } > > > > > > > > +/** > > > > + * do_efibootindex() - load and execute the specified Boot#### option > > > > + * > > > > + * Return: status code > > > > + */ > > > > +static int do_efibootindex(u16 boot_index) > > > > +{ > > > > + efi_handle_t handle; > > > > + efi_status_t ret; > > > > + void *load_options; > > > > + > > > > + ret = efi_try_load_entry(boot_index, &handle, &load_options); > > > > + if (ret != EFI_SUCCESS) { > > > > + log_notice("EFI boot manager: failed to load Boot%04X\n", boot_index); > > > > + return CMD_RET_FAILURE; > > > > + } > > > > + > > > > + ret = do_bootefi_exec(handle, load_options); > > > > + > > > > + if (ret != EFI_SUCCESS) > > > > + return CMD_RET_FAILURE; > > > > + > > > > + return CMD_RET_SUCCESS; > > > > +} > > > > /** > > > > * do_bootefi_image() - execute EFI binary > > > > * > > > > @@ -654,6 +678,22 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc, > > > > return CMD_RET_FAILURE; > > > > } > > > > > > > > + if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) { > > > > + if (!strcmp(argv[1], "bootindex")) { > > > > + char *endp; > > > > + int boot_index; > > > > + > > > > + if (argc < 3) > > > > + return CMD_RET_USAGE; > > > > + > > > > + boot_index = (int)hextoul(argv[2], &endp); > > > > + if (*endp != '\0' || boot_index > 0xffff) > > > > + return CMD_RET_USAGE; > > > > + > > > > + return do_efibootindex((u16)boot_index); > > > > + } > > > > + } > > > > + > > > > if (argc > 2) { > > > > uintptr_t fdt_addr; > > > > > > > > @@ -702,6 +742,8 @@ static char bootefi_help_text[] = > > > > "\n" > > > > " If specified, the device tree located at gets\n" > > > > " exposed as EFI configuration table.\n" > > > > + "bootefi bootindex \n" > > > > + " - load and boot EFI payload based on the specified BootXXXX variable.\n" > > > > #endif > > > > ; > > > > #endif > > > > diff --git a/include/efi_loader.h b/include/efi_loader.h > > > > index 80a5f1ec01..e5972f5fee 100644 > > > > --- a/include/efi_loader.h > > > > +++ b/include/efi_loader.h > > > > @@ -861,6 +861,7 @@ efi_status_t efi_set_load_options(efi_handle_t handle, > > > > efi_uintn_t load_options_size, > > > > void *load_options); > > > > efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options); > > > > +efi_status_t efi_try_load_entry(u16 n, efi_handle_t *handle, void **load_options); > > > > > > > > /** > > > > * struct efi_image_regions - A list of memory regions > > > > diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c > > > > index 8c04ecbdc8..a3060b5c62 100644 > > > > --- a/lib/efi_loader/efi_bootmgr.c > > > > +++ b/lib/efi_loader/efi_bootmgr.c > > > > @@ -42,8 +42,7 @@ static const struct efi_runtime_services *rs; > > > > * @load_options: load options set on the loaded image protocol > > > > * Return: status code > > > > */ > > > > -static efi_status_t try_load_entry(u16 n, efi_handle_t *handle, > > > > - void **load_options) > > > > +efi_status_t efi_try_load_entry(u16 n, efi_handle_t *handle, void **load_options) > > > > { > > > > struct efi_load_option lo; > > > > u16 varname[] = u"Boot0000"; > > > > @@ -165,7 +164,7 @@ efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options) > > > > /* load BootNext */ > > > > if (ret == EFI_SUCCESS) { > > > > if (size == sizeof(u16)) { > > > > - ret = try_load_entry(bootnext, handle, > > > > + ret = efi_try_load_entry(bootnext, handle, > > > > load_options); > > > > if (ret == EFI_SUCCESS) > > > > return ret; > > > > @@ -189,7 +188,7 @@ efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options) > > > > for (i = 0; i < num; i++) { > > > > log_debug("%s trying to load Boot%04X\n", __func__, > > > > bootorder[i]); > > > > - ret = try_load_entry(bootorder[i], handle, load_options); > > > > + ret = efi_try_load_entry(bootorder[i], handle, load_options); > > > > if (ret == EFI_SUCCESS) > > > > break; > > > > } > > > > -- > > > > 2.17.1 > > > >