[PATCH 1/4] efi_loader: implement a HOB list

Ilias Apalodimas ilias.apalodimas at linaro.org
Tue Jan 7 14:28:14 CET 2025


Hi Heinrich,

[...]

> +
> +/**
> + * efi_hob_list_register() - install HOB list
> + *
> + * The EFI shell on X86 requires a HOB list
> + *
> + * Return:     status code
> + */
> +efi_status_t efi_hob_list_register(void)
> +{
> +       struct efi_hob_header *hob;
> +
> +       hob = efi_alloc(sizeof(struct efi_hob_header));
> +       if (!hob)
> +               return EFI_OUT_OF_RESOURCES;
> +
> +       hob->hob_type = EFI_HOB_TYPE_END_OF_HOB_LIST;
> +       hob->hob_length = sizeof(struct efi_hob_header);
> +       hob->reserved = 0;
> +
> +       return efi_install_configuration_table(&efi_guid_hob_list, hob);\

If this fails no one frees the  'hob' allocated memory

> +}
> diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
> index aa59bc7779d..393b690c3ee 100644
> --- a/lib/efi_loader/efi_setup.c
> +++ b/lib/efi_loader/efi_setup.c
> @@ -7,6 +7,7 @@
>
>  #define LOG_CATEGORY LOGC_EFI
>
> +#include <efi_hob.h>
>  #include <efi_loader.h>
>  #include <efi_variable.h>
>  #include <log.h>
> @@ -271,6 +272,12 @@ efi_status_t efi_init_obj_list(void)
>                         goto out;
>         }
>
> +       if (IS_ENABLED(CONFIG_EFI_HOB)) {
> +               ret = efi_hob_list_register();
> +               if (ret != EFI_SUCCESS)
> +                       goto out;
> +       }
> +
>         if (IS_ENABLED(CONFIG_EFI_TCG2_PROTOCOL)) {
>                 ret = efi_tcg2_register();
>                 if (ret != EFI_SUCCESS)
> --
> 2.47.1
>

Cheers
/Ilias


More information about the U-Boot mailing list