]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Universal / Acpi / AcpiTableDxe / AcpiTable.h
CommitLineData
5f55c700 1/** @file\r
2 ACPI Table Protocol Driver\r
3\r
d1102dba 4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
e5eed7d3 5 This program and the accompanying materials\r
5f55c700 6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _ACPI_TABLE_H_\r
16#define _ACPI_TABLE_H_\r
17\r
18\r
19#include <PiDxe.h>\r
20\r
21#include <Protocol/AcpiTable.h>\r
22#include <Guid/Acpi.h>\r
3dc8585e 23#include <Protocol/AcpiSystemDescriptionTable.h>\r
5f55c700 24\r
25#include <Library/BaseLib.h>\r
26#include <Library/DebugLib.h>\r
27#include <Library/UefiLib.h>\r
28#include <Library/BaseMemoryLib.h>\r
29#include <Library/UefiDriverEntryPoint.h>\r
30#include <Library/MemoryAllocationLib.h>\r
31#include <Library/UefiBootServicesTableLib.h>\r
32#include <Library/PcdLib.h>\r
33\r
34//\r
35// Statements that include other files\r
36//\r
37#include <IndustryStandard/Acpi.h>\r
38\r
3dc8585e
JY
39#include "AcpiSdt.h"\r
40\r
5f55c700 41//\r
f0071740 42// Great than or equal to 2.0.\r
5f55c700 43//\r
f0071740
SZ
44#define ACPI_TABLE_VERSION_GTE_2_0 (EFI_ACPI_TABLE_VERSION_2_0 | \\r
45 EFI_ACPI_TABLE_VERSION_3_0 | \\r
46 EFI_ACPI_TABLE_VERSION_4_0 | \\r
47 EFI_ACPI_TABLE_VERSION_5_0)\r
5f55c700 48\r
49//\r
50// Private Driver Data\r
51//\r
52//\r
53// ACPI Table Linked List Signature.\r
54//\r
55#define EFI_ACPI_TABLE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'T', 'L')\r
56\r
57//\r
58// ACPI Table Linked List Entry definition.\r
59//\r
60// Signature must be set to EFI_ACPI_TABLE_LIST_SIGNATURE\r
61// Link is the linked list data.\r
62// Version is the versions of the ACPI tables that this table belongs in.\r
63// Table is a pointer to the table.\r
64// PageAddress is the address of the pages allocated for the table.\r
65// NumberOfPages is the number of pages allocated at PageAddress.\r
66// Handle is used to identify a particular table.\r
67//\r
68typedef struct {\r
69 UINT32 Signature;\r
70 LIST_ENTRY Link;\r
71 EFI_ACPI_TABLE_VERSION Version;\r
72 EFI_ACPI_COMMON_HEADER *Table;\r
73 EFI_PHYSICAL_ADDRESS PageAddress;\r
74 UINTN NumberOfPages;\r
75 UINTN Handle;\r
76} EFI_ACPI_TABLE_LIST;\r
77\r
78//\r
3dc8585e 79// Containment record for ACPI Table linked list.\r
5f55c700 80//\r
81#define EFI_ACPI_TABLE_LIST_FROM_LINK(_link) CR (_link, EFI_ACPI_TABLE_LIST, Link, EFI_ACPI_TABLE_LIST_SIGNATURE)\r
82\r
83//\r
84// The maximum number of tables this driver supports\r
85//\r
86#define EFI_ACPI_MAX_NUM_TABLES 20\r
87\r
5f55c700 88//\r
89// Protocol private structure definition\r
90//\r
91//\r
92// ACPI support protocol instance signature definition.\r
93//\r
94#define EFI_ACPI_TABLE_SIGNATURE SIGNATURE_32 ('S', 'T', 'A', 'E')\r
95\r
96//\r
97// ACPI support protocol instance data structure\r
98//\r
99typedef struct {\r
100 UINTN Signature;\r
101 EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp1; // Pointer to RSD_PTR structure\r
102 EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp3; // Pointer to RSD_PTR structure\r
103 EFI_ACPI_DESCRIPTION_HEADER *Rsdt1; // Pointer to RSDT table header\r
104 EFI_ACPI_DESCRIPTION_HEADER *Rsdt3; // Pointer to RSDT table header\r
105 EFI_ACPI_DESCRIPTION_HEADER *Xsdt; // Pointer to XSDT table header\r
106 EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt1; // Pointer to FADT table header\r
107 EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt3; // Pointer to FADT table header\r
108 EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs1; // Pointer to FACS table header\r
109 EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs3; // Pointer to FACS table header\r
110 EFI_ACPI_DESCRIPTION_HEADER *Dsdt1; // Pointer to DSDT table header\r
111 EFI_ACPI_DESCRIPTION_HEADER *Dsdt3; // Pointer to DSDT table header\r
3dc8585e 112 LIST_ENTRY TableList;\r
5f55c700 113 UINTN NumberOfTableEntries1; // Number of ACPI 1.0 tables\r
114 UINTN NumberOfTableEntries3; // Number of ACPI 3.0 tables\r
115 UINTN CurrentHandle;\r
5f55c700 116 EFI_ACPI_TABLE_PROTOCOL AcpiTableProtocol;\r
3dc8585e
JY
117 EFI_ACPI_SDT_PROTOCOL AcpiSdtProtocol;\r
118 LIST_ENTRY NotifyList;\r
5f55c700 119} EFI_ACPI_TABLE_INSTANCE;\r
120\r
121//\r
122// ACPI table protocol instance containing record macro\r
123//\r
124#define EFI_ACPI_TABLE_INSTANCE_FROM_THIS(a) \\r
125 CR (a, \\r
126 EFI_ACPI_TABLE_INSTANCE, \\r
127 AcpiTableProtocol, \\r
128 EFI_ACPI_TABLE_SIGNATURE \\r
129 )\r
130\r
131//\r
132// Protocol Constructor functions\r
133//\r
134\r
135/**\r
136 Constructor for the ACPI support protocol. Initializes instance\r
137 data.\r
138\r
139 @param AcpiTableInstance Instance to construct\r
140\r
141 @return EFI_SUCCESS Instance initialized.\r
142 @return EFI_OUT_OF_RESOURCES Unable to allocate required resources.\r
143\r
144**/\r
145EFI_STATUS\r
146AcpiTableAcpiTableConstructor (\r
147 EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance\r
148 );\r
149\r
150\r
151/**\r
152 Entry point of the ACPI table driver.\r
d1102dba 153 Creates and initializes an instance of the ACPI Table\r
5f55c700 154 Protocol and installs it on a new handle.\r
155\r
156 @param ImageHandle A handle for the image that is initializing this driver\r
157 @param SystemTable A pointer to the EFI system table\r
158\r
159 @return EFI_SUCCESS Driver initialized successfully\r
d1102dba 160 @return EFI_LOAD_ERROR Failed to Initialize or has been loaded\r
5f55c700 161 @return EFI_OUT_OF_RESOURCES Could not allocate needed resources\r
162\r
163**/\r
164EFI_STATUS\r
165EFIAPI\r
166InitializeAcpiTableDxe (\r
167 IN EFI_HANDLE ImageHandle,\r
168 IN EFI_SYSTEM_TABLE *SystemTable\r
169 );\r
170\r
3dc8585e
JY
171/**\r
172\r
173 This function finds the table specified by the handle and returns a pointer to it.\r
174 If the handle is not found, EFI_NOT_FOUND is returned and the contents of Table are\r
175 undefined.\r
176\r
177 @param[in] Handle Table to find.\r
178 @param[in] TableList Table list to search\r
d1102dba 179 @param[out] Table Pointer to table found.\r
3dc8585e
JY
180\r
181 @retval EFI_SUCCESS The function completed successfully.\r
182 @retval EFI_NOT_FOUND No table found matching the handle specified.\r
183\r
184**/\r
185EFI_STATUS\r
186FindTableByHandle (\r
187 IN UINTN Handle,\r
188 IN LIST_ENTRY *TableList,\r
189 OUT EFI_ACPI_TABLE_LIST **Table\r
190 );\r
191\r
192/**\r
193\r
194 This function calculates and updates an UINT8 checksum.\r
195\r
196 @param[in] Buffer Pointer to buffer to checksum\r
197 @param[in] Size Number of bytes to checksum\r
198 @param[in] ChecksumOffset Offset to place the checksum result in\r
199\r
200 @retval EFI_SUCCESS The function completed successfully.\r
201\r
202**/\r
203EFI_STATUS\r
204AcpiPlatformChecksum (\r
205 IN VOID *Buffer,\r
206 IN UINTN Size,\r
207 IN UINTN ChecksumOffset\r
208 );\r
209\r
210/**\r
211 This function invokes ACPI notification.\r
212\r
213 @param[in] AcpiTableInstance Instance to AcpiTable\r
214 @param[in] Version Version(s) to set.\r
215 @param[in] Handle Handle of the table.\r
216**/\r
217VOID\r
218SdtNotifyAcpiList (\r
219 IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,\r
220 IN EFI_ACPI_TABLE_VERSION Version,\r
221 IN UINTN Handle\r
222 );\r
223\r
224/**\r
225 This function initializes AcpiSdt protocol in ACPI table instance.\r
226\r
227 @param[in] AcpiTableInstance Instance to construct\r
228**/\r
229VOID\r
230SdtAcpiTableAcpiSdtConstructor (\r
231 IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance\r
232 );\r
233\r
234//\r
235// export PrivateData symbol, because we need that in AcpiSdtProtol implementation\r
236//\r
237extern EFI_HANDLE mHandle;\r
238extern EFI_ACPI_TABLE_INSTANCE *mPrivateData;\r
239\r
5f55c700 240#endif\r