1 // SPDX-License-Identifier: GPL-2.0+
3 * EFI application ACPI tables support
5 * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
9 #include <efi_loader.h>
11 #include <acpi/acpi_table.h>
13 static const efi_guid_t acpi_guid = EFI_ACPI_TABLE_GUID;
16 * Install the ACPI table as a configuration table.
20 efi_status_t efi_acpi_register(void)
22 /* Map within the low 32 bits, to allow for 32bit ACPI tables */
26 /* Reserve 64kiB page for ACPI */
27 ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
28 EFI_RUNTIME_SERVICES_DATA, 16, &acpi);
29 if (ret != EFI_SUCCESS)
33 * Generate ACPI tables - we know that efi_allocate_pages() returns
34 * a 4k-aligned address, so it is safe to assume that
35 * write_acpi_tables() will write the table at that address.
37 assert(!(acpi & 0xf));
38 write_acpi_tables(acpi);
40 /* And expose them to our EFI payload */
41 return efi_install_configuration_table(&acpi_guid,
42 (void *)(uintptr_t)acpi);