[PATCH v2 1/7] efi_loader: Refactor device and image paths into a function

Ilias Apalodimas ilias.apalodimas at linaro.org
Thu Dec 12 08:40:48 CET 2024


Hi Simon,

On Thu, 12 Dec 2024 at 00:38, Simon Glass <sjg at chromium.org> wrote:
>
> Move this code into a function so it can be called from elsewhere.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> (no changes since v1)
>
>  lib/efi_loader/efi_bootbin.c | 53 +++++++++++++++++++++++++-----------
>  1 file changed, 37 insertions(+), 16 deletions(-)
>
> diff --git a/lib/efi_loader/efi_bootbin.c b/lib/efi_loader/efi_bootbin.c
> index 7e7a6bf31aa..afb13a008c2 100644
> --- a/lib/efi_loader/efi_bootbin.c
> +++ b/lib/efi_loader/efi_bootbin.c
> @@ -44,12 +44,46 @@ void efi_clear_bootdev(void)
>         image_size = 0;
>  }
>
> +efi_status_t calculate_paths(const char *dev, const char *devnr, const char *path,
> +                            struct efi_device_path **device_pathp,
> +                            struct efi_device_path **image_pathp)
> +
> +{
> +       struct efi_device_path *image, *device;
> +       efi_status_t ret;
> +
> +       ret = efi_dp_from_name(dev, devnr, path, &device, &image);
> +       if (ret != EFI_SUCCESS)
> +               return ret;
> +
> +       *device_pathp = device;
> +       if (image) {
> +               /* FIXME: image should not contain device */
> +               struct efi_device_path *image_tmp = image;
> +
> +               efi_dp_split_file_path(image, &device, &image);
> +               efi_free_pool(image_tmp);
> +       }
> +       *image_pathp = image;
> +       log_debug("- boot device %pD\n", device);
> +       if (image)
> +               log_debug("- image %pD\n", image);
> +
> +       return EFI_SUCCESS;
> +}


This needs an entry in a header file and a description. Also, we
usually keep DP related functions to lib/efi_loader/efi_device_path.c

[...]

Thanks
/Ilias


More information about the U-Boot mailing list