All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Raymond Mao <raymond.mao@linaro.org>
Cc: u-boot@lists.denx.de, Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Simon Glass <sjg@chromium.org>,
	Masahisa Kojima <masahisa.kojima@linaro.org>
Subject: Re: [PATCH v7 3/4] Boot var automatic management for removable medias
Date: Tue, 6 Jun 2023 15:06:35 +0300	[thread overview]
Message-ID: <ZH8hS4+kpD5KNdHT@hera> (raw)
In-Reply-To: <20230531174515.41758-4-raymond.mao@linaro.org>

On Wed, May 31, 2023 at 10:45:17AM -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.
>

The code seems fine, but I think there's some things that need to be
clarified on the commit message for future reference.
Can you add a short text describing *why* you only do that in
efi_disk_probe() and not when the disk is signalled to be removed as well?
IOW mention the fact that the _remove() callback is always called when we
are exiting U-Boot trying to boot and OS, so running the same function in
remove doesn't currently make sense.

With that addition
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

> Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
> ---
> 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()
>
>  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
>

  parent reply	other threads:[~2023-06-06 12:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230531174515.41758-1-raymond.mao@linaro.org>
     [not found] ` <20230531174515.41758-5-raymond.mao@linaro.org>
2023-06-01  7:20   ` [PATCH v7 4/4] Load option with short device path for boot vars Ilias Apalodimas
     [not found] ` <20230531174515.41758-4-raymond.mao@linaro.org>
2023-06-06 12:06   ` Ilias Apalodimas [this message]
2023-06-06 14:42     ` [PATCH v7 3/4] Boot var automatic management for removable medias Raymond Mao
     [not found] ` <20230531174515.41758-3-raymond.mao@linaro.org>
2023-06-06 13:36   ` [PATCH v7 2/4] Fix incorrect return code of boot option update Ilias Apalodimas
     [not found] ` <20230531174515.41758-2-raymond.mao@linaro.org>
2023-06-06  8:13   ` [PATCH v7 1/4] Move bootorder and bootoption apis to lib Heinrich Schuchardt
2023-06-06 14:39     ` Raymond Mao
2023-06-06 15:12       ` Heinrich Schuchardt
2023-06-06 13:37   ` Ilias Apalodimas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZH8hS4+kpD5KNdHT@hera \
    --to=ilias.apalodimas@linaro.org \
    --cc=masahisa.kojima@linaro.org \
    --cc=raymond.mao@linaro.org \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.