[PATCH 1/1] efi_loader: generated SMBIOS table below 4 GiB

Ilias Apalodimas ilias.apalodimas at linaro.org
Tue Nov 21 22:06:30 CET 2023


Hi Heinrich,

On Tue, 21 Nov 2023 at 00:33, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> We currently use an outdated format 32-bit format for SMBIOS tables.
> So we must allocate SMBIOS tables below 4 GiB.

Can we please adjust the commit message to something that would
represent the situation better 6 months from now?
Mention that this fixes 53fab13a7 ("efi: Use the installed SMBIOS
tables") and keeps the x86 changes while reverting back to allocate
memory < 4GB

Other than that
Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
Tested-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>

Thanks
/Ilias
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> ---
>  lib/efi_loader/efi_smbios.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/lib/efi_loader/efi_smbios.c b/lib/efi_loader/efi_smbios.c
> index 48446f654d..0fbf51b98d 100644
> --- a/lib/efi_loader/efi_smbios.c
> +++ b/lib/efi_loader/efi_smbios.c
> @@ -49,25 +49,27 @@ efi_status_t efi_smbios_register(void)
>
>  static int install_smbios_table(void)
>  {
> -       ulong addr;
> -       void *buf;
> +       u64 addr;
> +       efi_status_t ret;
>
>         if (!IS_ENABLED(CONFIG_GENERATE_SMBIOS_TABLE) || IS_ENABLED(CONFIG_X86))
>                 return 0;
>
> -       /* Align the table to a 4KB boundary to keep EFI happy */
> -       buf = memalign(SZ_4K, TABLE_SIZE);
> -       if (!buf)
> +       addr = SZ_4G;
> +       ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
> +                                EFI_RUNTIME_SERVICES_DATA,
> +                                efi_size_in_pages(TABLE_SIZE), &addr);
> +       if (ret != EFI_SUCCESS)
>                 return log_msg_ret("mem", -ENOMEM);
>
> -       addr = map_to_sysmem(buf);
> +       addr = map_to_sysmem((void *)(uintptr_t)addr);
>         if (!write_smbios_table(addr)) {
>                 log_err("Failed to write SMBIOS table\n");
>                 return log_msg_ret("smbios", -EINVAL);
>         }
>
>         /* Make a note of where we put it */
> -       log_debug("SMBIOS tables written to %lx\n", addr);
> +       log_debug("SMBIOS tables written to %llx\n", addr);
>         gd->arch.smbios_start = addr;
>
>         return 0;
> --
> 2.40.1
>


More information about the U-Boot mailing list