[RFC 13/14] efi_loader: export efi_load_image_from_path

Ilias Apalodimas ilias.apalodimas at linaro.org
Sun Apr 28 15:32:16 CEST 2024


On Fri, 26 Apr 2024 at 17:14, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> We can reuse this function to load the device-tree.

This patch is correct, but needs splitting.
It exports the function, but also adds IS_ENABLED etc, that belong to
an earlier patch

Thanks
/Ilias
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> ---
>  include/efi_loader.h          |  4 ++++
>  lib/efi_loader/efi_bootmgr.c  | 17 +++++++++++++----
>  lib/efi_loader/efi_boottime.c |  1 -
>  3 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index ed2b517b130..0bf325fdc4b 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -664,6 +664,10 @@ efi_status_t EFIAPI efi_load_image(bool boot_policy,
>                                    void *source_buffer,
>                                    efi_uintn_t source_size,
>                                    efi_handle_t *image_handle);
> +/* Load image from path */
> +efi_status_t efi_load_image_from_path(bool boot_policy,
> +                                     struct efi_device_path *file_path,
> +                                     void **buffer, efi_uintn_t *size);
>  /* Start image */
>  efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
>                                     efi_uintn_t *exit_data_size,
> diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
> index 3d58a928b10..9ae948bcf08 100644
> --- a/lib/efi_loader/efi_bootmgr.c
> +++ b/lib/efi_loader/efi_bootmgr.c
> @@ -1265,12 +1265,21 @@ efi_status_t efi_bootmgr_run(void *fdt)
>                 return ret;
>         }
>
> -       fdt_lo = load_fdt_from_load_option();
> -       if (fdt_lo)
> -               fdt = fdt_lo;
> +       if (!IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE)) {
> +               fdt_lo = load_fdt_from_load_option();
> +               if (fdt_lo)
> +                       fdt = fdt_lo;
> +       }
>
> +       /*
> +        * Needed in ACPI case to create reservations based on
> +        * control device-tree.
> +        */
>         ret = efi_install_fdt(fdt);
> -       free(fdt_lo);
> +
> +       if (!IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE))
> +               free(fdt_lo);
> +
>         if (ret != EFI_SUCCESS) {
>                 if (EFI_CALL(efi_unload_image(handle)) == EFI_SUCCESS)
>                         free(load_options);
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index 33f03c0cb0f..50ce8386051 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -1996,7 +1996,6 @@ error:
>   * @size:              size of the loaded image
>   * Return:             status code
>   */
> -static
>  efi_status_t efi_load_image_from_path(bool boot_policy,
>                                       struct efi_device_path *file_path,
>                                       void **buffer, efi_uintn_t *size)
> --
> 2.43.0
>


More information about the U-Boot mailing list