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_3_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, Flags, PmuIrq, \
68 GicBase, GicVBase, GicHBase, GsivId, GicRBase, Efficiency, SpeOvflIrq) \
70 EFI_ACPI_6_0_GIC, sizeof (EFI_ACPI_6_3_GIC_STRUCTURE), EFI_ACPI_RESERVED_WORD, \
71 GicId, AcpiCpuUid, Flags, 0, PmuIrq, 0, GicBase, GicVBase, GicHBase, \
72 GsivId, GicRBase, Mpidr, Efficiency, EFI_ACPI_RESERVED_BYTE, SpeOvflIrq \
75 #define EFI_ACPI_6_0_GIC_MSI_FRAME_INIT(GicMsiFrameId, PhysicalBaseAddress, Flags, SPICount, SPIBase) \
77 EFI_ACPI_6_0_GIC_MSI_FRAME, sizeof (EFI_ACPI_6_0_GIC_MSI_FRAME_STRUCTURE), EFI_ACPI_RESERVED_WORD, \
78 GicMsiFrameId, PhysicalBaseAddress, Flags, SPICount, SPIBase \
82 // SBSA Generic Watchdog
84 #define EFI_ACPI_5_1_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(RefreshFramePhysicalAddress, \
85 ControlFramePhysicalAddress, WatchdogTimerGSIV, WatchdogTimerFlags) \
87 EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG, sizeof(EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE), \
88 EFI_ACPI_RESERVED_BYTE, RefreshFramePhysicalAddress, ControlFramePhysicalAddress, \
89 WatchdogTimerGSIV, WatchdogTimerFlags \
94 (EFIAPI
*EFI_LOCATE_ACPI_CHECK
)(
95 IN EFI_ACPI_DESCRIPTION_HEADER
*AcpiHeader
99 Locate and Install the ACPI tables from the Firmware Volume if it verifies
100 the function condition.
102 @param AcpiFile Guid of the ACPI file into the Firmware Volume
103 @param CheckAcpiTableFunction Function that checks if the ACPI table should be installed
105 @return EFI_SUCCESS The function completed successfully.
106 @return EFI_NOT_FOUND The protocol could not be located.
107 @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.
111 LocateAndInstallAcpiFromFvConditional (
112 IN CONST EFI_GUID
*AcpiFile
,
113 IN EFI_LOCATE_ACPI_CHECK CheckAcpiTableFunction
117 Locate and Install the ACPI tables from the Firmware Volume
119 @param AcpiFile Guid of the ACPI file into the Firmware Volume
121 @return EFI_SUCCESS The function completed successfully.
122 @return EFI_NOT_FOUND The protocol could not be located.
123 @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.
127 LocateAndInstallAcpiFromFv (
128 IN CONST EFI_GUID
*AcpiFile
131 #endif // __ACPI_LIB_H__