]> git.proxmox.com Git - mirror_edk2.git/blame - EmbeddedPkg/Include/Library/AcpiLib.h
DynamicTablesPkg: Replace BSD License with BSD+Patent License
[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
OM
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef __ACPI_LIB_H__\r
17#define __ACPI_LIB_H__\r
18\r
19#include <Uefi.h>\r
20\r
da7dd714
OM
21#include <IndustryStandard/Acpi10.h>\r
22\r
3356211b
OM
23//\r
24// Macros for the Generic Address Space\r
25//\r
26#define NULL_GAS { EFI_ACPI_5_0_SYSTEM_MEMORY, 0, 0, EFI_ACPI_5_0_UNDEFINED, 0L }\r
27#define ARM_GAS8(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 8, 0, EFI_ACPI_5_0_BYTE, Address }\r
28#define ARM_GAS16(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 16, 0, EFI_ACPI_5_0_WORD, Address }\r
29#define ARM_GAS32(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 32, 0, EFI_ACPI_5_0_DWORD, Address }\r
30#define ARM_GASN(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 0, 0, EFI_ACPI_5_0_DWORD, Address }\r
31\r
32//\r
33// Macros for the Multiple APIC Description Table (MADT)\r
34//\r
35#define EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(GicDistHwId, GicDistBase, GicDistVector) \\r
36 { \\r
37 EFI_ACPI_5_0_GICD, sizeof (EFI_ACPI_5_0_GIC_DISTRIBUTOR_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
38 GicDistHwId, GicDistBase, GicDistVector, EFI_ACPI_RESERVED_DWORD \\r
39 }\r
40\r
d354963f
HG
41#define EFI_ACPI_6_0_GIC_DISTRIBUTOR_INIT(GicDistHwId, GicDistBase, GicDistVector, GicVersion) \\r
42 { \\r
43 EFI_ACPI_6_0_GICD, sizeof (EFI_ACPI_6_0_GIC_DISTRIBUTOR_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
44 GicDistHwId, GicDistBase, GicDistVector, GicVersion, \\r
45 {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE} \\r
46 }\r
47\r
3356211b
OM
48// Note the parking protocol is configured by UEFI if required\r
49#define EFI_ACPI_5_0_GIC_STRUCTURE_INIT(GicId, AcpiCpuId, Flags, PmuIrq, GicBase) \\r
50 { \\r
51 EFI_ACPI_5_0_GIC, sizeof (EFI_ACPI_5_0_GIC_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
52 GicId, AcpiCpuId, Flags, 0, PmuIrq, 0, GicBase \\r
53 }\r
54\r
7c1712f0
OM
55// Note the parking protocol is configured by UEFI if required\r
56#define EFI_ACPI_5_1_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, Flags, PmuIrq, \\r
57 GicBase, GicVBase, GicHBase, GsivId, GicRBase) \\r
58 { \\r
59 EFI_ACPI_5_1_GIC, sizeof (EFI_ACPI_5_1_GIC_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
60 GicId, AcpiCpuUid, Flags, 0, PmuIrq, 0, GicBase, GicVBase, GicHBase, \\r
61 GsivId, GicRBase, Mpidr \\r
62 }\r
63\r
6ff71a13
GG
64#define EFI_ACPI_6_0_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, Flags, PmuIrq, \\r
65 GicBase, GicVBase, GicHBase, GsivId, GicRBase, Efficiency) \\r
66 { \\r
67 EFI_ACPI_6_0_GIC, sizeof (EFI_ACPI_6_0_GIC_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
68 GicId, AcpiCpuUid, Flags, 0, PmuIrq, 0, GicBase, GicVBase, GicHBase, \\r
69 GsivId, GicRBase, Mpidr, Efficiency, \\r
70 {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE} \\r
71 }\r
72\r
b71bd28a
OM
73#define EFI_ACPI_6_0_GIC_MSI_FRAME_INIT(GicMsiFrameId, PhysicalBaseAddress, Flags, SPICount, SPIBase) \\r
74 { \\r
75 EFI_ACPI_6_0_GIC_MSI_FRAME, sizeof (EFI_ACPI_6_0_GIC_MSI_FRAME_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
76 GicMsiFrameId, PhysicalBaseAddress, Flags, SPICount, SPIBase \\r
77 }\r
78\r
7c1712f0
OM
79//\r
80// SBSA Generic Watchdog\r
81//\r
82#define EFI_ACPI_5_1_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(RefreshFramePhysicalAddress, \\r
83 ControlFramePhysicalAddress, WatchdogTimerGSIV, WatchdogTimerFlags) \\r
84 { \\r
85 EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG, sizeof(EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE), \\r
d5194980 86 EFI_ACPI_RESERVED_BYTE, RefreshFramePhysicalAddress, ControlFramePhysicalAddress, \\r
7c1712f0
OM
87 WatchdogTimerGSIV, WatchdogTimerFlags \\r
88 }\r
3356211b 89\r
da7dd714
OM
90typedef\r
91BOOLEAN\r
92(EFIAPI *EFI_LOCATE_ACPI_CHECK) (\r
93 IN EFI_ACPI_DESCRIPTION_HEADER *AcpiHeader\r
94 );\r
95\r
96/**\r
97 Locate and Install the ACPI tables from the Firmware Volume if it verifies\r
98 the function condition.\r
99\r
100 @param AcpiFile Guid of the ACPI file into the Firmware Volume\r
101 @param CheckAcpiTableFunction Function that checks if the ACPI table should be installed\r
102\r
103 @return EFI_SUCCESS The function completed successfully.\r
104 @return EFI_NOT_FOUND The protocol could not be located.\r
105 @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.\r
106\r
107**/\r
108EFI_STATUS\r
109LocateAndInstallAcpiFromFvConditional (\r
110 IN CONST EFI_GUID* AcpiFile,\r
111 IN EFI_LOCATE_ACPI_CHECK CheckAcpiTableFunction\r
112 );\r
113\r
3356211b
OM
114/**\r
115 Locate and Install the ACPI tables from the Firmware Volume\r
116\r
117 @param AcpiFile Guid of the ACPI file into the Firmware Volume\r
118\r
119 @return EFI_SUCCESS The function completed successfully.\r
120 @return EFI_NOT_FOUND The protocol could not be located.\r
121 @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.\r
122\r
123**/\r
124EFI_STATUS\r
125LocateAndInstallAcpiFromFv (\r
126 IN CONST EFI_GUID* AcpiFile\r
127 );\r
128\r
129#endif // __ACPI_LIB_H__\r