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 2CE38C7EE29 for ; Thu, 25 May 2023 13:55:36 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 463C0860BD; Thu, 25 May 2023 15:55:33 +0200 (CEST) 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="FVgyo8xn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BDF70860BB; Thu, 25 May 2023 15:55:31 +0200 (CEST) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (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 6BE35860A8 for ; Thu, 25 May 2023 15:55:29 +0200 (CEST) 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-wr1-x435.google.com with SMTP id ffacd0b85a97d-3094871953bso1514103f8f.0 for ; Thu, 25 May 2023 06:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685022929; x=1687614929; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=pQVctkKf7Xr6THF4CA5xli50CdS5YEHKnnx5dOF3TYQ=; b=FVgyo8xnChBQLMuL2FYWrPhV1H6iGzM5XLLReV50qk9yU951Zhh5IDBJ2Bq9DhnX2M z7O60arrBF7keKH3BzAtVHxkoiO40bO3dxdxxDIPgqqxgYN9iUdQcffF+lrIQzcmzfho 7LXFjyh4EraJikBtUdY5qfeJdFhBgRpYHeO3prppFMEvZvWwV4zu1Yh0sJm4AICTl23/ QSioOOIGnoMgEEV5FTQcMJP1OOnhWfdUvWqNatkn3TtZ4kXelPYUNHeqSeCZp/mTdRI1 K60XYT+Xu1ZcVFmUdgbyGcsfFJ38so1qphN8Hce0+HOS5KKVN51+KXrPLlCrz5z3pfiY y4aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685022929; x=1687614929; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pQVctkKf7Xr6THF4CA5xli50CdS5YEHKnnx5dOF3TYQ=; b=AhyS8Z3dzenWlmz/jWZdMBL0E3mAvAQh9WySATaCQfGtdm1bedFvINkdxEJhTtO+8q Gjp1pDMG9hGFToOrSvZitxhHHGItRPy0W5viuK3Jd1Y5cMc0qjQfMNMOfLItOiiWTqo7 adrmt+9yRrbWTJumiVowlQ+RmAP/DbbDft4zZnvDU7GEc/sdb7QgmovOyWtPhkrPua70 FRAJxv1M/y54vr5kYZLYHOE8B9io06w/vSMWIb+Kflw7+V7h5RqDKQrdzdi216MQD1PC 1TxR0UF91bDty49988zbceguoIH3HFfm01tdKk8HkJVHYh1unkdOlGwYG2i1CHMFKQh9 E42A== X-Gm-Message-State: AC+VfDwc6j3WOvFKk3TYFN2mH0rP77Z4XcDEgmCwYB+64TeKICc5LjJc saD6DKXGw9qqEwjEHHsYBZUA6A== X-Google-Smtp-Source: ACHHUZ4AQO8Z2JgdlicI21fUoiCX1tJzazeSU1BgensEjPogoOh4VuP952SJkoxPJNh2/0Hutm7VFQ== X-Received: by 2002:adf:fd06:0:b0:309:491b:39cc with SMTP id e6-20020adffd06000000b00309491b39ccmr2527961wrr.3.1685022928862; Thu, 25 May 2023 06:55:28 -0700 (PDT) Received: from hera (ppp089210114029.access.hol.gr. [89.210.114.29]) by smtp.gmail.com with ESMTPSA id i2-20020a05600c290200b003eddc6aa5fasm5750198wmd.39.2023.05.25.06.55.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 06:55:28 -0700 (PDT) Date: Thu, 25 May 2023 16:55:26 +0300 From: Ilias Apalodimas To: Raymond Mao Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Simon Glass , Masahisa Kojima Subject: Re: [PATCH v4 2/3] Boot var automatic management for removable medias Message-ID: References: <20230523191819.80258-1-raymond.mao@linaro.org> <20230523191819.80258-2-raymond.mao@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230523191819.80258-2-raymond.mao@linaro.org> 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.8 at phobos.denx.de X-Virus-Status: Clean On Tue, May 23, 2023 at 12:18:20PM -0700, Raymond Mao wrote: > Changes for complying to EFI spec §3.5.1.1 > 'Removable Media Boot Behavior'. > Boot variables can be automatically generated during a removable > media is probed. At the same time, unused boot variables will be > detected and removed. > > Signed-off-by: Raymond Mao > --- > Changes in v2 > - Ignore EFI_NOT_FOUND returned from > efi_bootmgr_update_media_device_boot_option which means no boot > options scanned. > Changes in v3 > - Split the patch into moving and renaming functions and > individual patches for each changed functionality > Changes in v4 > - Revert the change of introducing a bool parameter when updating > the boot option. Use short-form of device path by default > > lib/efi_loader/efi_disk.c | 7 +++++++ > lib/efi_loader/efi_variable.c | 10 +++++++++- > lib/efi_loader/efi_variable_tee.c | 5 +++++ > 3 files changed, 21 insertions(+), 1 deletion(-) > > diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c > index d2256713a8..ca5f07f2ec 100644 > --- a/lib/efi_loader/efi_disk.c > +++ b/lib/efi_loader/efi_disk.c > @@ -687,6 +687,13 @@ int efi_disk_probe(void *ctx, struct event *event) > return -1; > } > > + /* only do the boot option management when UEFI sub-system is initialized */ > + if (efi_obj_list_initialized == EFI_SUCCESS) { > + ret = efi_bootmgr_update_media_device_boot_option(); > + if (ret != EFI_SUCCESS && ret != EFI_NOT_FOUND) > + return -1; > + } > + > return 0; > } > > diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c > index be95ed44e6..fe71144358 100644 > --- a/lib/efi_loader/efi_variable.c > +++ b/lib/efi_loader/efi_variable.c > @@ -476,6 +476,14 @@ efi_status_t efi_init_variables(void) > log_err("Invalid EFI variable seed\n"); > } > > + ret = efi_init_secure_state(); > + if (ret != EFI_SUCCESS) > + return ret; > > - return efi_init_secure_state(); > + /* update boot option management after variable service initialized */ > + ret = efi_bootmgr_update_media_device_boot_option(); > + if (ret != EFI_SUCCESS && ret != EFI_NOT_FOUND) > + return ret; > + > + return EFI_SUCCESS; > } > diff --git a/lib/efi_loader/efi_variable_tee.c b/lib/efi_loader/efi_variable_tee.c > index dfef18435d..2995d4a583 100644 > --- a/lib/efi_loader/efi_variable_tee.c > +++ b/lib/efi_loader/efi_variable_tee.c > @@ -748,5 +748,10 @@ efi_status_t efi_init_variables(void) > if (ret != EFI_SUCCESS) > return ret; > > + /* update boot option management after variable service initialized */ > + ret = efi_bootmgr_update_media_device_boot_option(); > + if (ret != EFI_SUCCESS && ret != EFI_NOT_FOUND) > + return ret; > + > return EFI_SUCCESS; Instead of having to add identical code in the variable init code why dont we add this in efi_setup.c, right under the efi_init_variables() call? Thanks /Ilias > } > -- > 2.25.1 >