[U-Boot] [PATCH 5/7] smbios: Expose in efi_loader as table
Bin Meng
bmeng.cn at gmail.com
Tue Aug 9 11:24:30 CEST 2016
Hi Alexander,
On Mon, Aug 8, 2016 at 10:06 PM, Alexander Graf <agraf at suse.de> wrote:
> We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
> patch adds enablement for that case.
>
> While at it, we also enable SMBIOS generation for ARM systems, since they support
> EFI_LOADER.
>
> Signed-off-by: Alexander Graf <agraf at suse.de>
> ---
> cmd/bootefi.c | 3 +++
> include/efi_api.h | 4 ++++
> include/efi_loader.h | 2 ++
> include/smbios.h | 1 +
> lib/Kconfig | 4 ++--
> lib/smbios.c | 36 ++++++++++++++++++++++++++++++++++++
> 6 files changed, 48 insertions(+), 2 deletions(-)
>
Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
One nits below:
> diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> index 53a6ee3..e241b7d 100644
> --- a/cmd/bootefi.c
> +++ b/cmd/bootefi.c
> @@ -205,6 +205,9 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
> if (!memcmp(bootefi_device_path[0].str, "N\0e\0t", 6))
> loaded_image_info.device_handle = nethandle;
> #endif
> +#ifdef CONFIG_GENERATE_SMBIOS_TABLE
> + efi_smbios_register();
> +#endif
>
[snip]
>
> static int smbios_write_type32(uintptr_t *current, int handle)
> {
> @@ -216,7 +227,9 @@ static smbios_write_type smbios_write_funcs[] = {
> smbios_write_type1,
> smbios_write_type2,
> smbios_write_type3,
> +#ifdef CONFIG_X86
> smbios_write_type4,
> +#endif
> smbios_write_type32,
> smbios_write_type127
> };
> @@ -267,3 +280,26 @@ uintptr_t write_smbios_table(uintptr_t addr)
>
> return addr;
> }
> +
> +#ifdef CONFIG_EFI_LOADER
> +
> +void efi_smbios_register(void)
> +{
> + static efi_guid_t smbios_guid = SMBIOS_TABLE_GUID;
> + /* Map within the low 32 bits, to allow for 32bit SMBIOS tables */
> + uint64_t dmi = 0xffffffff;
nits: one space before uint64_t
> + /* Reserve 4kb for SMBIOS */
> + uint64_t pages = 1;
> + int memtype = EFI_RUNTIME_SERVICES_DATA;
> +
> + if (efi_allocate_pages(1, memtype, pages, &dmi) != EFI_SUCCESS)
> + return;
> +
> + /* Generate SMBIOS tables */
> + write_smbios_table(dmi);
> +
> + /* And expose them to our EFI payload */
> + efi_install_configuration_table(&smbios_guid, (void*)dmi);
> +}
> +
> +#endif
> --
Regards,
Bin
More information about the U-Boot
mailing list