]> git.proxmox.com Git - mirror_edk2.git/blame - EmbeddedPkg/Include/Library/AcpiLib.h
ArmPkg/AArch64Mmu: Fix XN attribute for device memory
[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
41// Note the parking protocol is configured by UEFI if required\r
42#define EFI_ACPI_5_0_GIC_STRUCTURE_INIT(GicId, AcpiCpuId, Flags, PmuIrq, GicBase) \\r
43 { \\r
44 EFI_ACPI_5_0_GIC, sizeof (EFI_ACPI_5_0_GIC_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
45 GicId, AcpiCpuId, Flags, 0, PmuIrq, 0, GicBase \\r
46 }\r
47\r
7c1712f0
OM
48// Note the parking protocol is configured by UEFI if required\r
49#define EFI_ACPI_5_1_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, Flags, PmuIrq, \\r
50 GicBase, GicVBase, GicHBase, GsivId, GicRBase) \\r
51 { \\r
52 EFI_ACPI_5_1_GIC, sizeof (EFI_ACPI_5_1_GIC_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
53 GicId, AcpiCpuUid, Flags, 0, PmuIrq, 0, GicBase, GicVBase, GicHBase, \\r
54 GsivId, GicRBase, Mpidr \\r
55 }\r
56\r
b71bd28a
OM
57#define EFI_ACPI_6_0_GIC_MSI_FRAME_INIT(GicMsiFrameId, PhysicalBaseAddress, Flags, SPICount, SPIBase) \\r
58 { \\r
59 EFI_ACPI_6_0_GIC_MSI_FRAME, sizeof (EFI_ACPI_6_0_GIC_MSI_FRAME_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
60 GicMsiFrameId, PhysicalBaseAddress, Flags, SPICount, SPIBase \\r
61 }\r
62\r
7c1712f0
OM
63//\r
64// SBSA Generic Watchdog\r
65//\r
66#define EFI_ACPI_5_1_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(RefreshFramePhysicalAddress, \\r
67 ControlFramePhysicalAddress, WatchdogTimerGSIV, WatchdogTimerFlags) \\r
68 { \\r
69 EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG, sizeof(EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE), \\r
d5194980 70 EFI_ACPI_RESERVED_BYTE, RefreshFramePhysicalAddress, ControlFramePhysicalAddress, \\r
7c1712f0
OM
71 WatchdogTimerGSIV, WatchdogTimerFlags \\r
72 }\r
3356211b 73\r
da7dd714
OM
74typedef\r
75BOOLEAN\r
76(EFIAPI *EFI_LOCATE_ACPI_CHECK) (\r
77 IN EFI_ACPI_DESCRIPTION_HEADER *AcpiHeader\r
78 );\r
79\r
80/**\r
81 Locate and Install the ACPI tables from the Firmware Volume if it verifies\r
82 the function condition.\r
83\r
84 @param AcpiFile Guid of the ACPI file into the Firmware Volume\r
85 @param CheckAcpiTableFunction Function that checks if the ACPI table should be installed\r
86\r
87 @return EFI_SUCCESS The function completed successfully.\r
88 @return EFI_NOT_FOUND The protocol could not be located.\r
89 @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.\r
90\r
91**/\r
92EFI_STATUS\r
93LocateAndInstallAcpiFromFvConditional (\r
94 IN CONST EFI_GUID* AcpiFile,\r
95 IN EFI_LOCATE_ACPI_CHECK CheckAcpiTableFunction\r
96 );\r
97\r
3356211b
OM
98/**\r
99 Locate and Install the ACPI tables from the Firmware Volume\r
100\r
101 @param AcpiFile Guid of the ACPI file into the Firmware Volume\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
109LocateAndInstallAcpiFromFv (\r
110 IN CONST EFI_GUID* AcpiFile\r
111 );\r
112\r
113#endif // __ACPI_LIB_H__\r