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 79E1DC77B7A for ; Tue, 23 May 2023 06:22:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4364685021; Tue, 23 May 2023 08:22:31 +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="jH0+9+3A"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7AD1B85021; Tue, 23 May 2023 08:22:29 +0200 (CEST) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 001C7847D0 for ; Tue, 23 May 2023 08:22:26 +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-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3f60dfc5f93so30445e9.2 for ; Mon, 22 May 2023 23:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684822946; x=1687414946; 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=/fnQjJpKid5U0+oiEPygsBM4HmQL+VUWJj2goV9spxc=; b=jH0+9+3A3fA8Jr68H9eNQDEBUkS9zfJYutwLqYgroeEDNGtxyu1V/EVRjgNGMKBmXW 7Q9U9WoCth7ooDavlw3adV+++sV1yVENB3AUABFPj8UkyGSVwVEkPuufxif45wdN/3rl esJoFiULdq9AnMuwqJBRW++cA40anSxFjurXLFCEIMGmdQUnUVWQ2k0NA86Bq1r7NCs+ KIF21A5xiSKw8wZ8N/0+Ns3jFby13NKV3NLYZFl4GevfyHDG/xhc1ObMb7bchO84trdP 3Mtli5axzdxh+CHCdF2vVyM8QL99TONJjuNLcPFXivcmDfmhHrcpC0XiClTxNd9iDt+Q 3KRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684822946; x=1687414946; 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=/fnQjJpKid5U0+oiEPygsBM4HmQL+VUWJj2goV9spxc=; b=a7mTKLHkyvdqyY426EyTOmfsV2Y12QoYDIm2L01ZPtyAgrfjlxBCGd0ni0qcUykw1b pvbJcy0eTvpP5KzXPmNvdJCE7etXaBeHPChU8UAoAxNB3+rlzGrHNPQV5HcP/wKb7R+4 cpg1Dp3KgDBRUrS3o5Ir4npb+lJrPzzPjfTrXPbF4QZ+mdasNZV59IF+Qro8RIm9tGMM Pzi/TrdI4vvYAyyQxakiIleScSDZpaitgCVVhALa20AK0MaiKbzkyEfpp4pf+ISQYQDt KoZrOgVgDpHX86MEluD2IXQtvJdRx+rtR0CUT+B318t2YZhm7MsIkaaennmEzZKx3ktt IwHw== X-Gm-Message-State: AC+VfDypiiRdA07pPyiKMnARwwzkK0yJYIKyqoCqVAq093lVSgN3rXGW V+WdrQNEqk3RShpbDh/P/ht26Q== X-Google-Smtp-Source: ACHHUZ7nCpebQWzoJhN6dbYqd/9VN6e1aDH0df1rIaY+6H9IuX70lQRIr+xXHrb+cS9dmQk7n3BagA== X-Received: by 2002:a05:600c:2312:b0:3f6:832:aae7 with SMTP id 18-20020a05600c231200b003f60832aae7mr2316032wmo.25.1684822946460; Mon, 22 May 2023 23:22:26 -0700 (PDT) Received: from hera (ppp176092130041.access.hol.gr. [176.92.130.41]) by smtp.gmail.com with ESMTPSA id c11-20020a05600c0acb00b003f4285629casm10342712wmr.42.2023.05.22.23.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 23:22:26 -0700 (PDT) Date: Tue, 23 May 2023 09:22:23 +0300 From: Ilias Apalodimas To: Raymond Mao Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Masahisa Kojima , Simon Glass Subject: Re: [PATCH v3 2/3] Boot var automatic management for removable medias Message-ID: References: <20230502191218.47109-1-raymond.mao@linaro.org> <20230502191218.47109-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: 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 16, 2023 at 10:17:14AM -0400, Raymond Mao wrote: > Hi Ilias, > > On Tue, 16 May 2023 at 01:59, Ilias Apalodimas > wrote: > > > On Tue, May 02, 2023 at 12:12:19PM -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 > > > > > > 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; > > > > You don't need this if, just return ret > > > We have to differentiate EFI_NOT_FOUND here for no removable medias are > detected, otherwise efi_init_obj_list() will return failure if the return > code of efi_init_variables() is not EFI_SUCCESS. > Ah fair enough. This seems fine then, please resend the series with the changes in patch #3 Thanks /Ilias > > > > > + > > > return EFI_SUCCESS; > > > } > > > -- > > > 2.25.1 > > > > > > > Regards > > /Ilias > >