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