ArmPkg: only attempt buildin MmCommunicationDxe for AArch64
[mirror_edk2.git] / EmbeddedPkg / Include / Library / AcpiLib.h
CommitLineData
3356211b
OM
1/** @file\r
2 Helper Library for ACPI\r
3\r
d5194980 4 Copyright (c) 2014-2016, ARM Ltd. All rights reserved.\r
3356211b 5\r
878b807a 6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
3356211b
OM
7\r
8**/\r
9\r
10#ifndef __ACPI_LIB_H__\r
11#define __ACPI_LIB_H__\r
12\r
13#include <Uefi.h>\r
14\r
da7dd714
OM
15#include <IndustryStandard/Acpi10.h>\r
16\r
3356211b
OM
17//\r
18// Macros for the Generic Address Space\r
19//\r
20#define NULL_GAS { EFI_ACPI_5_0_SYSTEM_MEMORY, 0, 0, EFI_ACPI_5_0_UNDEFINED, 0L }\r
21#define ARM_GAS8(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 8, 0, EFI_ACPI_5_0_BYTE, Address }\r
22#define ARM_GAS16(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 16, 0, EFI_ACPI_5_0_WORD, Address }\r
23#define ARM_GAS32(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 32, 0, EFI_ACPI_5_0_DWORD, Address }\r
24#define ARM_GASN(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 0, 0, EFI_ACPI_5_0_DWORD, Address }\r
25\r
26//\r
27// Macros for the Multiple APIC Description Table (MADT)\r
28//\r
29#define EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(GicDistHwId, GicDistBase, GicDistVector) \\r
30 { \\r
31 EFI_ACPI_5_0_GICD, sizeof (EFI_ACPI_5_0_GIC_DISTRIBUTOR_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
32 GicDistHwId, GicDistBase, GicDistVector, EFI_ACPI_RESERVED_DWORD \\r
33 }\r
34\r
d354963f
HG
35#define EFI_ACPI_6_0_GIC_DISTRIBUTOR_INIT(GicDistHwId, GicDistBase, GicDistVector, GicVersion) \\r
36 { \\r
37 EFI_ACPI_6_0_GICD, sizeof (EFI_ACPI_6_0_GIC_DISTRIBUTOR_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
38 GicDistHwId, GicDistBase, GicDistVector, GicVersion, \\r
39 {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE} \\r
40 }\r
41\r
3356211b
OM
42// Note the parking protocol is configured by UEFI if required\r
43#define EFI_ACPI_5_0_GIC_STRUCTURE_INIT(GicId, AcpiCpuId, Flags, PmuIrq, GicBase) \\r
44 { \\r
45 EFI_ACPI_5_0_GIC, sizeof (EFI_ACPI_5_0_GIC_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
46 GicId, AcpiCpuId, Flags, 0, PmuIrq, 0, GicBase \\r
47 }\r
48\r
7c1712f0
OM
49// Note the parking protocol is configured by UEFI if required\r
50#define EFI_ACPI_5_1_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, Flags, PmuIrq, \\r
51 GicBase, GicVBase, GicHBase, GsivId, GicRBase) \\r
52 { \\r
53 EFI_ACPI_5_1_GIC, sizeof (EFI_ACPI_5_1_GIC_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
54 GicId, AcpiCpuUid, Flags, 0, PmuIrq, 0, GicBase, GicVBase, GicHBase, \\r
55 GsivId, GicRBase, Mpidr \\r
56 }\r
57\r
6ff71a13
GG
58#define EFI_ACPI_6_0_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, Flags, PmuIrq, \\r
59 GicBase, GicVBase, GicHBase, GsivId, GicRBase, Efficiency) \\r
60 { \\r
61 EFI_ACPI_6_0_GIC, sizeof (EFI_ACPI_6_0_GIC_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
62 GicId, AcpiCpuUid, Flags, 0, PmuIrq, 0, GicBase, GicVBase, GicHBase, \\r
63 GsivId, GicRBase, Mpidr, Efficiency, \\r
64 {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE} \\r
65 }\r
66\r
6c1fb568
PB
67#define EFI_ACPI_6_3_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, Flags, PmuIrq, \\r
68 GicBase, GicVBase, GicHBase, GsivId, GicRBase, Efficiency, SpeOvflIrq) \\r
69 { \\r
70 EFI_ACPI_6_0_GIC, sizeof (EFI_ACPI_6_3_GIC_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
71 GicId, AcpiCpuUid, Flags, 0, PmuIrq, 0, GicBase, GicVBase, GicHBase, \\r
72 GsivId, GicRBase, Mpidr, Efficiency, EFI_ACPI_RESERVED_BYTE, SpeOvflIrq \\r
73 }\r
74\r
b71bd28a
OM
75#define EFI_ACPI_6_0_GIC_MSI_FRAME_INIT(GicMsiFrameId, PhysicalBaseAddress, Flags, SPICount, SPIBase) \\r
76 { \\r
77 EFI_ACPI_6_0_GIC_MSI_FRAME, sizeof (EFI_ACPI_6_0_GIC_MSI_FRAME_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
78 GicMsiFrameId, PhysicalBaseAddress, Flags, SPICount, SPIBase \\r
79 }\r
80\r
7c1712f0
OM
81//\r
82// SBSA Generic Watchdog\r
83//\r
84#define EFI_ACPI_5_1_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(RefreshFramePhysicalAddress, \\r
85 ControlFramePhysicalAddress, WatchdogTimerGSIV, WatchdogTimerFlags) \\r
86 { \\r
87 EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG, sizeof(EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE), \\r
d5194980 88 EFI_ACPI_RESERVED_BYTE, RefreshFramePhysicalAddress, ControlFramePhysicalAddress, \\r
7c1712f0
OM
89 WatchdogTimerGSIV, WatchdogTimerFlags \\r
90 }\r
3356211b 91\r
da7dd714
OM
92typedef\r
93BOOLEAN\r
94(EFIAPI *EFI_LOCATE_ACPI_CHECK) (\r
95 IN EFI_ACPI_DESCRIPTION_HEADER *AcpiHeader\r
96 );\r
97\r
98/**\r
99 Locate and Install the ACPI tables from the Firmware Volume if it verifies\r
100 the function condition.\r
101\r
102 @param AcpiFile Guid of the ACPI file into the Firmware Volume\r
103 @param CheckAcpiTableFunction Function that checks if the ACPI table should be installed\r
104\r
105 @return EFI_SUCCESS The function completed successfully.\r
106 @return EFI_NOT_FOUND The protocol could not be located.\r
107 @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.\r
108\r
109**/\r
110EFI_STATUS\r
111LocateAndInstallAcpiFromFvConditional (\r
112 IN CONST EFI_GUID* AcpiFile,\r
113 IN EFI_LOCATE_ACPI_CHECK CheckAcpiTableFunction\r
114 );\r
115\r
3356211b
OM
116/**\r
117 Locate and Install the ACPI tables from the Firmware Volume\r
118\r
119 @param AcpiFile Guid of the ACPI file into the Firmware Volume\r
120\r
121 @return EFI_SUCCESS The function completed successfully.\r
122 @return EFI_NOT_FOUND The protocol could not be located.\r
123 @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.\r
124\r
125**/\r
126EFI_STATUS\r
127LocateAndInstallAcpiFromFv (\r
128 IN CONST EFI_GUID* AcpiFile\r
129 );\r
130\r
131#endif // __ACPI_LIB_H__\r