public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: u-boot@lists.denx.de
Subject: [PATCH 1/4] efi_loader: description EFI_LOAD_FILE2_PROTOCOL
Date: Sun, 4 Oct 2020 08:14:04 +0300	[thread overview]
Message-ID: <20201004051404.GA27264@Iliass-MBP> (raw)
In-Reply-To: <20201003115716.38058-2-xypron.glpk@gmx.de>

On Sat, Oct 03, 2020 at 01:57:13PM +0200, Heinrich Schuchardt wrote:
> U-Boot offers a EFI_LOAD_FILE2_PROTOCOL which the Linux EFI stub can use to
> load an initial RAM disk. Update the function comments of the
> implementation.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  lib/efi_loader/efi_load_initrd.c | 42 +++++++++++++++++---------------
>  1 file changed, 23 insertions(+), 19 deletions(-)
> 
> diff --git a/lib/efi_loader/efi_load_initrd.c b/lib/efi_loader/efi_load_initrd.c
> index 574a83d7e3..ff69e6eb79 100644
> --- a/lib/efi_loader/efi_load_initrd.c
> +++ b/lib/efi_loader/efi_load_initrd.c
> @@ -47,9 +47,9 @@ static const struct efi_initrd_dp dp = {
>  /**
>   * get_file_size() - retrieve the size of initramfs, set efi status on error
>   *
> - * @dev:			device to read from. i.e "mmc"
> - * @part:			device partition. i.e "0:1"
> - * @file:			name fo file
> + * @dev:			device to read from, e.g. "mmc"
> + * @part:			device partition, e.g. "0:1"
> + * @file:			name of file
>   * @status:			EFI exit code in case of failure
>   *
>   * Return:			size of file
> @@ -78,15 +78,16 @@ out:
>  }
> 
>  /**
> - * load_file2() - get information about random number generation
> + * efi_load_file2initrd() - load initial RAM disk
> + *
> + * This function implements the LoadFile service of the EFI_LOAD_FILE2_PROTOCOL
> + * in order to load an initial RAM disk requested by the Linux kernel stub.
>   *
> - * This function implement the LoadFile2() service in order to load an initram
> - * disk requested by the Linux kernel stub.
>   * See the UEFI spec for details.
>   *
> - * @this:			loadfile2 protocol instance
> - * @file_path:			relative path of the file. "" in this case
> - * @boot_policy:		must be false for Loadfile2
> + * @this:			EFI_LOAD_FILE2_PROTOCOL instance
> + * @file_path:			media device path of the file, "" in this case
> + * @boot_policy:		must be false
>   * @buffer_size:		size of allocated buffer
>   * @buffer:			buffer to load the file
>   *
> @@ -128,7 +129,13 @@ efi_load_file2_initrd(struct efi_load_file_protocol *this,
>  		goto out;
>  	}
> 
> -	/* expect something like 'mmc 0:1 initrd.cpio.gz' */
> +	/*
> +	 * expect a string with three space separated parts:
> +	 *
> +	 * * a block device type, e.g. "mmc"
> +	 * * a device and partition identifier, e.g. "0:1"
> +	 * * a file path on the block device, e.g. "/boot/initrd.cpio.gz"
> +	 */
>  	dev = strsep(&s, " ");
>  	if (!dev)
>  		goto out;
> @@ -168,23 +175,20 @@ out:
>  }
> 
>  /**
> - * efi_initrd_register() - Register a handle and loadfile2 protocol
> + * efi_initrd_register() - create handle for loading initial RAM disk
>   *
> - * This function creates a new handle and installs a linux specific GUID
> - * to handle initram disk loading during boot.
> - * See the UEFI spec for details.
> + * This function creates a new handle and installs a Linux specific vendor
> + * device path and an EFI_LOAD_FILE_2_PROTOCOL. Linux uses the device path
> + * to identify the handle and then calls the LoadFile service of the
> + * EFI_LOAD_FILE_2_PROTOCOL to read the initial RAM disk.
>   *
> - * Return:			status code
> + * Return:	status code
>   */
>  efi_status_t efi_initrd_register(void)
>  {
>  	efi_handle_t efi_initrd_handle = NULL;
>  	efi_status_t ret;
> 
> -	/*
> -	 * Set up the handle with the EFI_LOAD_FILE2_PROTOCOL which Linux may
> -	 * use to load the initial ramdisk.
> -	 */
>  	ret = EFI_CALL(efi_install_multiple_protocol_interfaces
>  		       (&efi_initrd_handle,
>  			/* initramfs */
> --
> 2.28.0
> 

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

  reply	other threads:[~2020-10-04  5:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-03 11:57 [PATCH 0/4] efi_loader: fix EFI_LOAD_FILE2_PROTOCOL Heinrich Schuchardt
2020-10-03 11:57 ` [PATCH 1/4] efi_loader: description EFI_LOAD_FILE2_PROTOCOL Heinrich Schuchardt
2020-10-04  5:14   ` Ilias Apalodimas [this message]
2020-10-03 11:57 ` [PATCH 2/4] efi_loader: illegal free in EFI_LOAD_FILE2_PROTOCOL Heinrich Schuchardt
2020-10-04  5:16   ` Ilias Apalodimas
2020-10-03 11:57 ` [PATCH 3/4] efi_selftest: enable printing hexadecimal numbers Heinrich Schuchardt
2020-10-03 11:57 ` [PATCH 4/4] efi_selftest: print CRC32 of initrd as hexadecimal Heinrich Schuchardt
2020-10-04  5:16   ` 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=20201004051404.GA27264@Iliass-MBP \
    --to=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