1 /* 2 * EFI application tables support 3 * 4 * Copyright (c) 2016 Alexander Graf 5 * 6 * SPDX-License-Identifier: GPL-2.0+ 7 */ 8 9 #include <common.h> 10 #include <efi_loader.h> 11 #include <inttypes.h> 12 #include <smbios.h> 13 14 static const efi_guid_t smbios_guid = SMBIOS_TABLE_GUID; 15 16 void efi_smbios_register(void) 17 { 18 /* Map within the low 32 bits, to allow for 32bit SMBIOS tables */ 19 uint64_t dmi = 0xffffffff; 20 /* Reserve 4kb for SMBIOS */ 21 uint64_t pages = 1; 22 int memtype = EFI_RUNTIME_SERVICES_DATA; 23 24 if (efi_allocate_pages(1, memtype, pages, &dmi) != EFI_SUCCESS) 25 return; 26 27 /* Generate SMBIOS tables */ 28 write_smbios_table(dmi); 29 30 /* And expose them to our EFI payload */ 31 efi_install_configuration_table(&smbios_guid, (void*)(uintptr_t)dmi); 32 } 33