]> git.proxmox.com Git - mirror_edk2.git/blame - EmbeddedPkg/Include/Library/AcpiLib.h
MdeModulePkg/BootMaintUi: Add error handling codes when AllocatePool fail
[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
b71bd28a
OM
64#define EFI_ACPI_6_0_GIC_MSI_FRAME_INIT(GicMsiFrameId, PhysicalBaseAddress, Flags, SPICount, SPIBase) \\r
65 { \\r
66 EFI_ACPI_6_0_GIC_MSI_FRAME, sizeof (EFI_ACPI_6_0_GIC_MSI_FRAME_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
67 GicMsiFrameId, PhysicalBaseAddress, Flags, SPICount, SPIBase \\r
68 }\r
69\r
7c1712f0
OM
70//\r
71// SBSA Generic Watchdog\r
72//\r
73#define EFI_ACPI_5_1_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(RefreshFramePhysicalAddress, \\r
74 ControlFramePhysicalAddress, WatchdogTimerGSIV, WatchdogTimerFlags) \\r
75 { \\r
76 EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG, sizeof(EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE), \\r
d5194980 77 EFI_ACPI_RESERVED_BYTE, RefreshFramePhysicalAddress, ControlFramePhysicalAddress, \\r
7c1712f0
OM
78 WatchdogTimerGSIV, WatchdogTimerFlags \\r
79 }\r
3356211b 80\r
da7dd714
OM
81typedef\r
82BOOLEAN\r
83(EFIAPI *EFI_LOCATE_ACPI_CHECK) (\r
84 IN EFI_ACPI_DESCRIPTION_HEADER *AcpiHeader\r
85 );\r
86\r
87/**\r
88 Locate and Install the ACPI tables from the Firmware Volume if it verifies\r
89 the function condition.\r
90\r
91 @param AcpiFile Guid of the ACPI file into the Firmware Volume\r
92 @param CheckAcpiTableFunction Function that checks if the ACPI table should be installed\r
93\r
94 @return EFI_SUCCESS The function completed successfully.\r
95 @return EFI_NOT_FOUND The protocol could not be located.\r
96 @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.\r
97\r
98**/\r
99EFI_STATUS\r
100LocateAndInstallAcpiFromFvConditional (\r
101 IN CONST EFI_GUID* AcpiFile,\r
102 IN EFI_LOCATE_ACPI_CHECK CheckAcpiTableFunction\r
103 );\r
104\r
3356211b
OM
105/**\r
106 Locate and Install the ACPI tables from the Firmware Volume\r
107\r
108 @param AcpiFile Guid of the ACPI file into the Firmware Volume\r
109\r
110 @return EFI_SUCCESS The function completed successfully.\r
111 @return EFI_NOT_FOUND The protocol could not be located.\r
112 @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.\r
113\r
114**/\r
115EFI_STATUS\r
116LocateAndInstallAcpiFromFv (\r
117 IN CONST EFI_GUID* AcpiFile\r
118 );\r
119\r
120#endif // __ACPI_LIB_H__\r