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 6098CC7EE29 for ; Wed, 7 Jun 2023 00:42:10 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ECCD585F18; Wed, 7 Jun 2023 02:42:06 +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="oshRpxxk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EE7EE85F29; Wed, 7 Jun 2023 02:42:03 +0200 (CEST) Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) (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 8C0EE8471C for ; Wed, 7 Jun 2023 02:42:00 +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=takahiro.akashi@linaro.org Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6584553892cso758377b3a.0 for ; Tue, 06 Jun 2023 17:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686098519; x=1688690519; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:from:to:cc:subject:date:message-id:reply-to; bh=u253FsYIHNCNbW7oMxQBv7oXhf4q+j8g5QumLOEwPpw=; b=oshRpxxk1czXPLMUp6qIJnjLk9E760VICvKYOhYyT6zQ4vxp0irnVjooCObOTJjb99 GvNZk2H3vrySs+JoJCA2PKqiA4Bc0rr+X87uzteJdTqzS2FWlPD070gPFbmmZJjq6wux 4t4eSDKP5oHqnFHYawk0cqPTf5UT+OLjHYN1wCN80uNmwh4OVOQXQKaCrawak+gJVwd+ THd6AAGG7w4Ow1J1QpRsfPNW2nr0dBoH1IDu6tT+oagFdgpwkz7Jxuos0hd23Wtze9oM Qzhzfma2v592SJ9+erGOUFYPEPqvFFjJZtuIexCX0bV/5bj/6y/U+3Ty1yfwK/kUNqnz ld8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686098519; x=1688690519; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=u253FsYIHNCNbW7oMxQBv7oXhf4q+j8g5QumLOEwPpw=; b=EKC3mLA9OGkAiiIzcDUl6Qg+AUCSHCJYTQV89lViWY948rv2WL5AEL5FbIvtTrOB3Y NXVhYUVRTHFskUAdOF6QEAE/HqIMjjAO1Ua3l8egrb2790tsERb+3sqfXWHHRRFLDpY0 wU57mUxf7Hy48xT/4nwl81W2bMHkpAe0tACiw840VPYznUi4b54JVTzLHeb8yH9TTz2h Zjtsmrwm7JUvyiHCID6RF1d6GelL97tv8ktQUJ/d9C5o4NXYJCu6HjJr8bsY80NAA4LO VVipwjfW+tp3tN3inOHmGoAXVhVAkPUvP6T7YdgOvoszJdmEA8kPwJRc3TwimvVqjpKI JkXg== X-Gm-Message-State: AC+VfDx1CPzC3Jx9gqfNCh4MP8YotuzLckqP0L6SPwxmqEeTTtX3NUdy 46TxuWzPVN2YhRhn90uSAZu7LQ== X-Google-Smtp-Source: ACHHUZ5l9/3CXQaaL2Iwq47G3Fwk0cCDKmKPlbLgELQMQy/2w2P5e1Nc5BMYDCPlguYbQiGcP9j8yA== X-Received: by 2002:a05:6a00:813:b0:658:85e9:bd7e with SMTP id m19-20020a056a00081300b0065885e9bd7emr3851544pfk.2.1686098518756; Tue, 06 Jun 2023 17:41:58 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:fc03:17ce:85e7:750]) by smtp.gmail.com with ESMTPSA id y17-20020aa78551000000b0063b8ddf77f7sm7297060pfn.211.2023.06.06.17.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 17:41:58 -0700 (PDT) Date: Wed, 7 Jun 2023 09:41:54 +0900 From: AKASHI Takahiro To: Raymond Mao Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Masahisa Kojima Subject: Re: [PATCH v8 3/4] Boot var automatic management for removable medias Message-ID: Mail-Followup-To: AKASHI Takahiro , Raymond Mao , u-boot@lists.denx.de, Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Masahisa Kojima References: <20230606163722.198820-1-raymond.mao@linaro.org> <20230606163722.198820-4-raymond.mao@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230606163722.198820-4-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, Jun 06, 2023 at 09:37:20AM -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. > Please note that currently the function 'efi_disk_remove' is being > invoked during exiting U-Boot and booting an OS - that is why we > don't add the boot variables management inside 'efi_disk_remove'. It's not accurate. For instance, a user may run "scsi scan" or "usb reset" to re-enumerate devices added (or removed). They will invoke "remove" against pre-existing devices before invoking a "probe" routine. So the text above doesn't justify not implementing "remove" hook. -Takahiro Akashi > Signed-off-by: Raymond Mao > Reviewed-by: Heinrich Schuchardt > Reviewed-by: Ilias Apalodimas > --- > Changes in v3 > - Split the patch into moving and renaming functions and > individual patches for each changed functionality > Changes in v5 > - Move function call of efi_bootmgr_update_media_device_boot_option() > from efi_init_variables() to efi_init_obj_list() > Changes in v6 > - Revert unrelated changes > Changes in v7 > - adapt the return code of function > efi_bootmgr_update_media_device_boot_option() > Changes in v8 > - add a note in the commit message for future reference > > lib/efi_loader/efi_disk.c | 7 +++++++ > lib/efi_loader/efi_setup.c | 5 +++++ > 2 files changed, 12 insertions(+) > > diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c > index d2256713a8..d9b48ecf64 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) > + return -1; > + } > + > return 0; > } > > diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c > index 58d4e13402..877f3878d6 100644 > --- a/lib/efi_loader/efi_setup.c > +++ b/lib/efi_loader/efi_setup.c > @@ -245,6 +245,11 @@ efi_status_t efi_init_obj_list(void) > if (ret != EFI_SUCCESS) > goto out; > > + /* update boot option after variable service initialized */ > + ret = efi_bootmgr_update_media_device_boot_option(); > + if (ret != EFI_SUCCESS) > + goto out; > + > /* Define supported languages */ > ret = efi_init_platform_lang(); > if (ret != EFI_SUCCESS) > -- > 2.25.1 >