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>
12 #include <acpi/acpi_table.h>
13 #include <asm/global_data.h>
15 DECLARE_GLOBAL_DATA_PTR;
17 static const efi_guid_t acpi_guid = EFI_ACPI_TABLE_GUID;
20 * Install the ACPI table as a configuration table.
24 efi_status_t efi_acpi_register(void)
26 ulong addr, start, end;
29 /* Mark space used for tables */
30 start = ALIGN_DOWN(gd->arch.table_start, EFI_PAGE_MASK);
31 end = ALIGN(gd->arch.table_end, EFI_PAGE_MASK);
32 ret = efi_add_memory_map(start, end - start, EFI_ACPI_RECLAIM_MEMORY);
33 if (ret != EFI_SUCCESS)
35 if (gd->arch.table_start_high) {
36 start = ALIGN_DOWN(gd->arch.table_start_high, EFI_PAGE_MASK);
37 end = ALIGN(gd->arch.table_end_high, EFI_PAGE_MASK);
38 ret = efi_add_memory_map(start, end - start,
39 EFI_ACPI_RECLAIM_MEMORY);
40 if (ret != EFI_SUCCESS)
44 addr = gd_acpi_start();
45 printf("EFI using ACPI tables at %lx\n", addr);
47 /* And expose them to our EFI payload */
48 return efi_install_configuration_table(&acpi_guid,