2 Helper Library for ACPI
4 Copyright (c) 2014-2016, ARM Ltd. All rights reserved.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef __ACPI_LIB_H__
11 #define __ACPI_LIB_H__
15 #include <IndustryStandard/Acpi10.h>
18 // Macros for the Generic Address Space
20 #define NULL_GAS { EFI_ACPI_5_0_SYSTEM_MEMORY, 0, 0, EFI_ACPI_5_0_UNDEFINED, 0L }
21 #define ARM_GAS8(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 8, 0, EFI_ACPI_5_0_BYTE, Address }
22 #define ARM_GAS16(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 16, 0, EFI_ACPI_5_0_WORD, Address }
23 #define ARM_GAS32(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 32, 0, EFI_ACPI_5_0_DWORD, Address }
24 #define ARM_GASN(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 0, 0, EFI_ACPI_5_0_DWORD, Address }
27 // Macros for the Multiple APIC Description Table (MADT)
29 #define EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(GicDistHwId, GicDistBase, GicDistVector) \
31 EFI_ACPI_5_0_GICD, sizeof (EFI_ACPI_5_0_GIC_DISTRIBUTOR_STRUCTURE), EFI_ACPI_RESERVED_WORD, \
32 GicDistHwId, GicDistBase, GicDistVector, EFI_ACPI_RESERVED_DWORD \
35 #define EFI_ACPI_6_0_GIC_DISTRIBUTOR_INIT(GicDistHwId, GicDistBase, GicDistVector, GicVersion) \
37 EFI_ACPI_6_0_GICD, sizeof (EFI_ACPI_6_0_GIC_DISTRIBUTOR_STRUCTURE), EFI_ACPI_RESERVED_WORD, \
38 GicDistHwId, GicDistBase, GicDistVector, GicVersion, \
39 {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE} \
42 // Note the parking protocol is configured by UEFI if required
43 #define EFI_ACPI_5_0_GIC_STRUCTURE_INIT(GicId, AcpiCpuId, Flags, PmuIrq, GicBase) \
45 EFI_ACPI_5_0_GIC, sizeof (EFI_ACPI_5_0_GIC_STRUCTURE), EFI_ACPI_RESERVED_WORD, \
46 GicId, AcpiCpuId, Flags, 0, PmuIrq, 0, GicBase \
49 // Note the parking protocol is configured by UEFI if required
50 #define EFI_ACPI_5_1_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, Flags, PmuIrq, \
51 GicBase, GicVBase, GicHBase, GsivId, GicRBase) \
53 EFI_ACPI_5_1_GIC, sizeof (EFI_ACPI_5_1_GIC_STRUCTURE), EFI_ACPI_RESERVED_WORD, \
54 GicId, AcpiCpuUid, Flags, 0, PmuIrq, 0, GicBase, GicVBase, GicHBase, \
55 GsivId, GicRBase, Mpidr \
58 #define EFI_ACPI_6_0_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, Flags, PmuIrq, \
59 GicBase, GicVBase, GicHBase, GsivId, GicRBase, Efficiency) \
61 EFI_ACPI_6_0_GIC, sizeof (EFI_ACPI_6_0_GIC_STRUCTURE), EFI_ACPI_RESERVED_WORD, \
62 GicId, AcpiCpuUid, Flags, 0, PmuIrq, 0, GicBase, GicVBase, GicHBase, \
63 GsivId, GicRBase, Mpidr, Efficiency, \
64 {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE} \
67 #define EFI_ACPI_6_0_GIC_MSI_FRAME_INIT(GicMsiFrameId, PhysicalBaseAddress, Flags, SPICount, SPIBase) \
69 EFI_ACPI_6_0_GIC_MSI_FRAME, sizeof (EFI_ACPI_6_0_GIC_MSI_FRAME_STRUCTURE), EFI_ACPI_RESERVED_WORD, \
70 GicMsiFrameId, PhysicalBaseAddress, Flags, SPICount, SPIBase \
74 // SBSA Generic Watchdog
76 #define EFI_ACPI_5_1_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(RefreshFramePhysicalAddress, \
77 ControlFramePhysicalAddress, WatchdogTimerGSIV, WatchdogTimerFlags) \
79 EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG, sizeof(EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE), \
80 EFI_ACPI_RESERVED_BYTE, RefreshFramePhysicalAddress, ControlFramePhysicalAddress, \
81 WatchdogTimerGSIV, WatchdogTimerFlags \
86 (EFIAPI
*EFI_LOCATE_ACPI_CHECK
) (
87 IN EFI_ACPI_DESCRIPTION_HEADER
*AcpiHeader
91 Locate and Install the ACPI tables from the Firmware Volume if it verifies
92 the function condition.
94 @param AcpiFile Guid of the ACPI file into the Firmware Volume
95 @param CheckAcpiTableFunction Function that checks if the ACPI table should be installed
97 @return EFI_SUCCESS The function completed successfully.
98 @return EFI_NOT_FOUND The protocol could not be located.
99 @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.
103 LocateAndInstallAcpiFromFvConditional (
104 IN CONST EFI_GUID
* AcpiFile
,
105 IN EFI_LOCATE_ACPI_CHECK CheckAcpiTableFunction
109 Locate and Install the ACPI tables from the Firmware Volume
111 @param AcpiFile Guid of the ACPI file into the Firmware Volume
113 @return EFI_SUCCESS The function completed successfully.
114 @return EFI_NOT_FOUND The protocol could not be located.
115 @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.
119 LocateAndInstallAcpiFromFv (
120 IN CONST EFI_GUID
* AcpiFile
123 #endif // __ACPI_LIB_H__