]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h
MdeModulePkg:
[mirror_edk2.git] / MdeModulePkg / Universal / Acpi / AcpiTableDxe / AcpiTable.h
CommitLineData
5f55c700 1/** @file\r
2 ACPI Table Protocol Driver\r
3\r
3dc8585e 4 Copyright (c) 2006 - 2010, 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
JY
23#include <Protocol/AcpiSystemDescriptionTable.h>\r
24#include <Protocol/DxeSmmReadyToLock.h>\r
5f55c700 25\r
26#include <Library/BaseLib.h>\r
27#include <Library/DebugLib.h>\r
28#include <Library/UefiLib.h>\r
29#include <Library/BaseMemoryLib.h>\r
30#include <Library/UefiDriverEntryPoint.h>\r
31#include <Library/MemoryAllocationLib.h>\r
32#include <Library/UefiBootServicesTableLib.h>\r
33#include <Library/PcdLib.h>\r
34\r
35//\r
36// Statements that include other files\r
37//\r
38#include <IndustryStandard/Acpi.h>\r
39\r
3dc8585e
JY
40#include "AcpiSdt.h"\r
41\r
5f55c700 42//\r
43// From Protocol/AcpiSupport.h\r
44//\r
45\r
46//\r
47// ACPI Version bitmap definition:\r
48//\r
49// EFI_ACPI_TABLE_VERSION_1_0B - ACPI Version 1.0b\r
50// EFI_ACPI_TABLE_VERSION_2_0 - ACPI Version 2.0\r
51// EFI_ACPI_TABLE_VERSION_3_0 - ACPI Version 3.0\r
52// EFI_ACPI_TABLE_VERSION_NONE - No ACPI Versions. This might be used\r
53// to create memory-based operation regions or other information\r
54// that is not part of the ACPI "tree" but must still be found\r
55// in ACPI memory space and/or managed by the core ACPI driver.\r
56//\r
57// Note that EFI provides discrete GUIDs for each version of ACPI\r
58// that is supported. It is expected that each EFI GUIDed\r
59// version of ACPI will also have a corresponding bitmap\r
60// definition. This allows maintenance of separate ACPI trees\r
61// for each distinctly different version of ACPI.\r
62//\r
63#define EFI_ACPI_TABLE_VERSION UINT32\r
64\r
65#define EFI_ACPI_TABLE_VERSION_NONE (1 << 0)\r
66#define EFI_ACPI_TABLE_VERSION_1_0B (1 << 1)\r
67#define EFI_ACPI_TABLE_VERSION_2_0 (1 << 2)\r
68#define EFI_ACPI_TABLE_VERSION_3_0 (1 << 3)\r
69\r
70//\r
71// Private Driver Data\r
72//\r
73//\r
74// ACPI Table Linked List Signature.\r
75//\r
76#define EFI_ACPI_TABLE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'T', 'L')\r
77\r
78//\r
79// ACPI Table Linked List Entry definition.\r
80//\r
81// Signature must be set to EFI_ACPI_TABLE_LIST_SIGNATURE\r
82// Link is the linked list data.\r
83// Version is the versions of the ACPI tables that this table belongs in.\r
84// Table is a pointer to the table.\r
85// PageAddress is the address of the pages allocated for the table.\r
86// NumberOfPages is the number of pages allocated at PageAddress.\r
87// Handle is used to identify a particular table.\r
88//\r
89typedef struct {\r
90 UINT32 Signature;\r
91 LIST_ENTRY Link;\r
92 EFI_ACPI_TABLE_VERSION Version;\r
93 EFI_ACPI_COMMON_HEADER *Table;\r
94 EFI_PHYSICAL_ADDRESS PageAddress;\r
95 UINTN NumberOfPages;\r
96 UINTN Handle;\r
97} EFI_ACPI_TABLE_LIST;\r
98\r
99//\r
3dc8585e 100// Containment record for ACPI Table linked list.\r
5f55c700 101//\r
102#define EFI_ACPI_TABLE_LIST_FROM_LINK(_link) CR (_link, EFI_ACPI_TABLE_LIST, Link, EFI_ACPI_TABLE_LIST_SIGNATURE)\r
103\r
104//\r
105// The maximum number of tables this driver supports\r
106//\r
107#define EFI_ACPI_MAX_NUM_TABLES 20\r
108\r
109//\r
110// ACPI table information used to initialize tables.\r
111//\r
112#define EFI_ACPI_OEM_ID "INTEL "\r
113#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64('E', 'D', 'K', '2', ' ', ' ', ' ', ' ')\r
114#define EFI_ACPI_OEM_REVISION 0x00000002\r
115#define EFI_ACPI_CREATOR_ID 0x20202020\r
116#define EFI_ACPI_CREATOR_REVISION 0x01000013\r
117\r
118//\r
119// Protocol private structure definition\r
120//\r
121//\r
122// ACPI support protocol instance signature definition.\r
123//\r
124#define EFI_ACPI_TABLE_SIGNATURE SIGNATURE_32 ('S', 'T', 'A', 'E')\r
125\r
126//\r
127// ACPI support protocol instance data structure\r
128//\r
129typedef struct {\r
130 UINTN Signature;\r
131 EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp1; // Pointer to RSD_PTR structure\r
132 EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp3; // Pointer to RSD_PTR structure\r
133 EFI_ACPI_DESCRIPTION_HEADER *Rsdt1; // Pointer to RSDT table header\r
134 EFI_ACPI_DESCRIPTION_HEADER *Rsdt3; // Pointer to RSDT table header\r
135 EFI_ACPI_DESCRIPTION_HEADER *Xsdt; // Pointer to XSDT table header\r
136 EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt1; // Pointer to FADT table header\r
137 EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt3; // Pointer to FADT table header\r
138 EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs1; // Pointer to FACS table header\r
139 EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs3; // Pointer to FACS table header\r
140 EFI_ACPI_DESCRIPTION_HEADER *Dsdt1; // Pointer to DSDT table header\r
141 EFI_ACPI_DESCRIPTION_HEADER *Dsdt3; // Pointer to DSDT table header\r
3dc8585e 142 LIST_ENTRY TableList;\r
5f55c700 143 UINTN NumberOfTableEntries1; // Number of ACPI 1.0 tables\r
144 UINTN NumberOfTableEntries3; // Number of ACPI 3.0 tables\r
145 UINTN CurrentHandle;\r
146 BOOLEAN TablesInstalled1; // ACPI 1.0 tables published\r
147 BOOLEAN TablesInstalled3; // ACPI 3.0 tables published\r
148 EFI_ACPI_TABLE_PROTOCOL AcpiTableProtocol;\r
3dc8585e
JY
149 EFI_ACPI_SDT_PROTOCOL AcpiSdtProtocol;\r
150 LIST_ENTRY NotifyList;\r
5f55c700 151} EFI_ACPI_TABLE_INSTANCE;\r
152\r
153//\r
154// ACPI table protocol instance containing record macro\r
155//\r
156#define EFI_ACPI_TABLE_INSTANCE_FROM_THIS(a) \\r
157 CR (a, \\r
158 EFI_ACPI_TABLE_INSTANCE, \\r
159 AcpiTableProtocol, \\r
160 EFI_ACPI_TABLE_SIGNATURE \\r
161 )\r
162\r
163//\r
164// Protocol Constructor functions\r
165//\r
166\r
167/**\r
168 Constructor for the ACPI support protocol. Initializes instance\r
169 data.\r
170\r
171 @param AcpiTableInstance Instance to construct\r
172\r
173 @return EFI_SUCCESS Instance initialized.\r
174 @return EFI_OUT_OF_RESOURCES Unable to allocate required resources.\r
175\r
176**/\r
177EFI_STATUS\r
178AcpiTableAcpiTableConstructor (\r
179 EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance\r
180 );\r
181\r
182\r
183/**\r
184 Entry point of the ACPI table driver.\r
185 Creates and initializes an instance of the ACPI Table \r
186 Protocol and installs it on a new handle.\r
187\r
188 @param ImageHandle A handle for the image that is initializing this driver\r
189 @param SystemTable A pointer to the EFI system table\r
190\r
191 @return EFI_SUCCESS Driver initialized successfully\r
192 @return EFI_LOAD_ERROR Failed to Initialize or has been loaded \r
193 @return EFI_OUT_OF_RESOURCES Could not allocate needed resources\r
194\r
195**/\r
196EFI_STATUS\r
197EFIAPI\r
198InitializeAcpiTableDxe (\r
199 IN EFI_HANDLE ImageHandle,\r
200 IN EFI_SYSTEM_TABLE *SystemTable\r
201 );\r
202\r
3dc8585e
JY
203/**\r
204\r
205 This function finds the table specified by the handle and returns a pointer to it.\r
206 If the handle is not found, EFI_NOT_FOUND is returned and the contents of Table are\r
207 undefined.\r
208\r
209 @param[in] Handle Table to find.\r
210 @param[in] TableList Table list to search\r
211 @param[out] Table Pointer to table found. \r
212\r
213 @retval EFI_SUCCESS The function completed successfully.\r
214 @retval EFI_NOT_FOUND No table found matching the handle specified.\r
215\r
216**/\r
217EFI_STATUS\r
218FindTableByHandle (\r
219 IN UINTN Handle,\r
220 IN LIST_ENTRY *TableList,\r
221 OUT EFI_ACPI_TABLE_LIST **Table\r
222 );\r
223\r
224/**\r
225\r
226 This function calculates and updates an UINT8 checksum.\r
227\r
228 @param[in] Buffer Pointer to buffer to checksum\r
229 @param[in] Size Number of bytes to checksum\r
230 @param[in] ChecksumOffset Offset to place the checksum result in\r
231\r
232 @retval EFI_SUCCESS The function completed successfully.\r
233\r
234**/\r
235EFI_STATUS\r
236AcpiPlatformChecksum (\r
237 IN VOID *Buffer,\r
238 IN UINTN Size,\r
239 IN UINTN ChecksumOffset\r
240 );\r
241\r
242/**\r
243 This function invokes ACPI notification.\r
244\r
245 @param[in] AcpiTableInstance Instance to AcpiTable\r
246 @param[in] Version Version(s) to set.\r
247 @param[in] Handle Handle of the table.\r
248**/\r
249VOID\r
250SdtNotifyAcpiList (\r
251 IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,\r
252 IN EFI_ACPI_TABLE_VERSION Version,\r
253 IN UINTN Handle\r
254 );\r
255\r
256/**\r
257 This function initializes AcpiSdt protocol in ACPI table instance.\r
258\r
259 @param[in] AcpiTableInstance Instance to construct\r
260**/\r
261VOID\r
262SdtAcpiTableAcpiSdtConstructor (\r
263 IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance\r
264 );\r
265\r
266//\r
267// export PrivateData symbol, because we need that in AcpiSdtProtol implementation\r
268//\r
269extern EFI_HANDLE mHandle;\r
270extern EFI_ACPI_TABLE_INSTANCE *mPrivateData;\r
271\r
5f55c700 272#endif\r