public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: u-boot@lists.denx.de, Ilias Apalodimas <ilias.apalodimas@linaro.org>
Subject: Re: [PATCH v2 4/9] efi_loader: support booting via short-form device-path
Date: Wed, 23 Mar 2022 16:50:26 +0900	[thread overview]
Message-ID: <20220323075026.GF49108@laputa> (raw)
In-Reply-To: <20220319091148.142036-5-heinrich.schuchardt@canonical.com>

On Sat, Mar 19, 2022 at 10:11:43AM +0100, Heinrich Schuchardt wrote:
> The boot manager must support loading from boot options using a short-form
> device-path, e.g. one where the first element is a hard drive media path.
> 
> See '3.1.2 Load Options Processing' in UEFI specification version 2.9.

Thank you for adding this feature.
Just reminder; a hard drive media path is not the only case for allowing
short-form paths. In particular,  booting from a short-form path starting
with a *file path* device path is also, in my opinion, valuable.

So we should have some description, in the commit message or the comment,
about this sort of limitation or TODO in handling short-form paths even
after this commit.

> Fixes: 0e074d12393b ("efi_loader: carve out efi_load_image_from_file()")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
> v2:
> 	path correct remaining paths to LOAD_FILE(2) protocol
> ---
>  lib/efi_loader/efi_boottime.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index a7bc371f54..5bcb8253ed 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -1940,7 +1940,7 @@ efi_status_t efi_load_image_from_path(bool boot_policy,
>  {
>  	efi_handle_t device;
>  	efi_status_t ret;
> -	struct efi_device_path *dp;
> +	struct efi_device_path *dp, *rem;
>  	struct efi_load_file_protocol *load_file_protocol = NULL;
>  	efi_uintn_t buffer_size;
>  	uint64_t addr, pages;
> @@ -1951,18 +1951,18 @@ efi_status_t efi_load_image_from_path(bool boot_policy,
>  	*size = 0;
>  
>  	dp = file_path;
> -	ret = EFI_CALL(efi_locate_device_path(
> -		       &efi_simple_file_system_protocol_guid, &dp, &device));
> +	device = efi_dp_find_obj(dp, NULL, &rem);
> +	ret = efi_search_protocol(device, &efi_simple_file_system_protocol_guid,
> +				  NULL);

I think that you intended to use your *new* efi_dp_find_obj() in patch#3 here.

-Takahiro Akashi


>  	if (ret == EFI_SUCCESS)
>  		return efi_load_image_from_file(file_path, buffer, size);
>  
> -	ret = EFI_CALL(efi_locate_device_path(
> -		       &efi_guid_load_file_protocol, &dp, &device));
> +	ret = efi_search_protocol(device, &efi_guid_load_file_protocol, NULL);
>  	if (ret == EFI_SUCCESS) {
>  		guid = &efi_guid_load_file_protocol;
>  	} else if (!boot_policy) {
>  		guid = &efi_guid_load_file2_protocol;
> -		ret = EFI_CALL(efi_locate_device_path(guid, &dp, &device));
> +		ret = efi_search_protocol(device, guid, NULL);
>  	}
>  	if (ret != EFI_SUCCESS)
>  		return EFI_NOT_FOUND;
> @@ -1971,9 +1971,9 @@ efi_status_t efi_load_image_from_path(bool boot_policy,
>  	if (ret != EFI_SUCCESS)
>  		return EFI_NOT_FOUND;
>  	buffer_size = 0;
> -	ret = load_file_protocol->load_file(load_file_protocol, dp,
> -					    boot_policy, &buffer_size,
> -					    NULL);
> +	ret = EFI_CALL(load_file_protocol->load_file(
> +					load_file_protocol, rem, boot_policy,
> +					&buffer_size, NULL));
>  	if (ret != EFI_BUFFER_TOO_SMALL)
>  		goto out;
>  	pages = efi_size_in_pages(buffer_size);
> @@ -1984,7 +1984,7 @@ efi_status_t efi_load_image_from_path(bool boot_policy,
>  		goto out;
>  	}
>  	ret = EFI_CALL(load_file_protocol->load_file(
> -					load_file_protocol, dp, boot_policy,
> +					load_file_protocol, rem, boot_policy,
>  					&buffer_size, (void *)(uintptr_t)addr));
>  	if (ret != EFI_SUCCESS)
>  		efi_free_pages(addr, pages);
> -- 
> 2.34.1
> 

  reply	other threads:[~2022-03-23  7:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-19  9:11 [PATCH v2 0/9] efi_loader: booting via short-form device-path Heinrich Schuchardt
2022-03-19  9:11 ` [PATCH v2 1/9] efi_loader: export efi_dp_shorten() Heinrich Schuchardt
2022-03-21  7:41   ` Ilias Apalodimas
2022-03-23  6:55   ` AKASHI Takahiro
2022-03-19  9:11 ` [PATCH v2 2/9] efi_loader: fix efi_dp_find_obj() Heinrich Schuchardt
2022-03-23  7:18   ` AKASHI Takahiro
2022-03-19  9:11 ` [PATCH v2 3/9] efi_loader: efi_dp_find_obj() add protocol check Heinrich Schuchardt
2022-03-23  7:26   ` AKASHI Takahiro
2022-03-19  9:11 ` [PATCH v2 4/9] efi_loader: support booting via short-form device-path Heinrich Schuchardt
2022-03-23  7:50   ` AKASHI Takahiro [this message]
2022-03-19  9:11 ` [PATCH v2 5/9] efi_loader: use short-form DP for load options Heinrich Schuchardt
2022-03-23  8:18   ` AKASHI Takahiro
2022-03-19  9:11 ` [PATCH v2 6/9] efi_loader: export efi_system_partition_guid Heinrich Schuchardt
2022-03-19  9:11 ` [PATCH v2 7/9] efi_loader: remove efi_disk_is_system_part() Heinrich Schuchardt
2022-03-19  9:11 ` [PATCH v2 8/9] efi_loader: move dtbdump.c, initrddump.c to lib/efi_loader Heinrich Schuchardt
2022-03-23  7:01   ` AKASHI Takahiro
2022-03-19  9:11 ` [PATCH v2 9/9] test: test UEFI boot manager Heinrich Schuchardt
2022-03-25  7:01 ` [PATCH v2 0/9] efi_loader: booting via short-form device-path AKASHI Takahiro
2022-03-25  9:12   ` AKASHI Takahiro

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=20220323075026.GF49108@laputa \
    --to=takahiro.akashi@linaro.org \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=u-boot@lists.denx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox