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