1 // SPDX-License-Identifier: GPL-2.0+
3 * EFI application tables support
5 * Copyright (c) 2016 Alexander Graf
9 #include <efi_loader.h>
12 static const efi_guid_t smbios_guid = SMBIOS_TABLE_GUID;
15 * Install the SMBIOS table as a configuration table.
19 efi_status_t efi_smbios_register(void)
21 /* Map within the low 32 bits, to allow for 32bit SMBIOS tables */
25 /* Reserve 4kiB page for SMBIOS */
26 ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
27 EFI_RUNTIME_SERVICES_DATA, 1, &dmi);
29 if (ret != EFI_SUCCESS) {
30 /* Could not find space in lowmem, use highmem instead */
31 ret = efi_allocate_pages(EFI_ALLOCATE_ANY_PAGES,
32 EFI_RUNTIME_SERVICES_DATA, 1, &dmi);
34 if (ret != EFI_SUCCESS)
39 * Generate SMBIOS tables - we know that efi_allocate_pages() returns
40 * a 4k-aligned address, so it is safe to assume that
41 * write_smbios_table() will write the table at that address.
44 write_smbios_table(dmi);
46 /* And expose them to our EFI payload */
47 return efi_install_configuration_table(&smbios_guid,
48 (void *)(uintptr_t)dmi);