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 9D051C77B7A for ; Tue, 16 May 2023 05:59:43 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F32F88662B; Tue, 16 May 2023 07:59:41 +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="bzLj8xOs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 182B78662C; Tue, 16 May 2023 07:59:41 +0200 (CEST) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (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 E66B585E51 for ; Tue, 16 May 2023 07:59:38 +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-x32d.google.com with SMTP id 5b1f17b1804b1-3f420618d5bso68148945e9.1 for ; Mon, 15 May 2023 22:59:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684216778; x=1686808778; 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=sxBZBiqZnGd8PJob4Bm1ziGHnQ1hGn9s6X23pnAdZkg=; b=bzLj8xOsZyA6+jNFIC1SKRgKZGIB4iudRGtXwgTTucMjEROxYaIgsXDHdKYh/8Fnf8 i9FXULC6cpikKcKfrPUXSr0WoIDrC9tib0x9gZkD49uXqN1MjwzJJuCWEkajgC3LLU9w PAEO6czzuPAhALq+2uk3AXb1Pl+YeEd6PWnHSL2OSHjhoJ3N6Bo7AKzd28yGYXA7k6/K R0gfX+z0F7HuaQgKVObGZWGNA3DWLN2/gz3V2HsfEZW5qASmRUa5dkgajfP6+PB5cBzT S2lUf3LcBvYW2sFPol9pYG4gpxL7IlJEpgaVQTeEE58+3yqSmHntYIrjcbu8h8yzMg7m H/jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684216778; x=1686808778; 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=sxBZBiqZnGd8PJob4Bm1ziGHnQ1hGn9s6X23pnAdZkg=; b=LdRTiMnjJZOz+VQJaH6KyM4OcyyPANHLh6ysQuHtmi17nf9qReuWqS3O+n8yqdq1Eb egjDWgD9FJOrMUExL1fc+wsjdNp54IaraVDmx8SUDPwmZfi6DW7PAczZMKGRimM5mpS9 /xp3kvGICdak980a6UMnZhwhiCkYWJ27TYnvrxjQZXtLm34kCY/A5clzjtyPsUh4CzR3 pxNzB1Sd6EJX3LLSg/+PXdWa5R/VJxzdoeC2nIytrckg/Q/KSDXPy/mkmtyaF7PSlJPv GwiyTcxb5/v7roYA2IzsNJsQuKAT+nlr3EEYLlcAyYC8gjmRNbISiyNxNvR5XRSSVRo9 jaiA== X-Gm-Message-State: AC+VfDy7DOrRMHhftswJCyyCxxY4eInzvtbAChbt+jmx/pKRW5SnUWap R8hnnd6ACCmeG3FsbNfaa9Ceuw== X-Google-Smtp-Source: ACHHUZ6QZ2NiQzNjqBRcrXc2tleEWgcKi4mXODUsCXwYPfaOCdYV4hkOs9pAXsq4tD3TK9j3JpmXLg== X-Received: by 2002:a7b:c419:0:b0:3f4:a09f:1877 with SMTP id k25-20020a7bc419000000b003f4a09f1877mr13742690wmi.23.1684216778411; Mon, 15 May 2023 22:59:38 -0700 (PDT) Received: from hera (ppp176092130041.access.hol.gr. [176.92.130.41]) by smtp.gmail.com with ESMTPSA id v14-20020a1cf70e000000b003eddc6aa5fasm1024660wmh.39.2023.05.15.22.59.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 22:59:38 -0700 (PDT) Date: Tue, 16 May 2023 08:59:35 +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: <20230502191218.47109-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 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 > + > return EFI_SUCCESS; > } > -- > 2.25.1 > Regards /Ilias