]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/AcpiSystemDescriptionTable.h
fe209877b9bfc8bf57bc6f20d528de25282d0c7b
[mirror_edk2.git] / MdePkg / Include / Protocol / AcpiSystemDescriptionTable.h
1 /** @file
2 This protocol provides services for creating ACPI system description tables.
3
4 Copyright (c) 2006 - 2010, Intel Corporation
5 All rights reserved. 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_SYSTEM_DESCRIPTION_TABLE_H___
16 #define __ACPI_SYSTEM_DESCRIPTION_TABLE_H___
17
18 #define EFI_ACPI_SDT_PROTOCOL_GUID \
19 { 0xeb97088e, 0xcfdf, 0x49c6, { 0xbe, 0x4b, 0xd9, 0x6, 0xa5, 0xb2, 0xe, 0x86 }}
20
21 typedef UINT32 EFI_ACPI_TABLE_VERSION;
22 typedef VOID *EFI_ACPI_HANDLE;
23
24 #define EFI_ACPI_TABLE_VERSION_NONE (1 << 0)
25 #define EFI_ACPI_TABLE_VERSION_1_0B (1 << 1)
26 #define EFI_ACPI_TABLE_VERSION_2_0 (1 << 2)
27 #define EFI_ACPI_TABLE_VERSION_3_0 (1 << 3)
28 #define EFI_ACPI_TABLE_VERSION_4_0 (1 << 4)
29
30 typedef UINT32 EFI_ACPI_DATA_TYPE;
31 #define EFI_ACPI_DATA_TYPE_NONE 0
32 #define EFI_ACPI_DATA_TYPE_OPCODE 1
33 #define EFI_ACPI_DATA_TYPE_NAME_STRING 2
34 #define EFI_ACPI_DATA_TYPE_OP 3
35 #define EFI_ACPI_DATA_TYPE_UINT 4
36 #define EFI_ACPI_DATA_TYPE_STRING 5
37 #define EFI_ACPI_DATA_TYPE_CHILD 6
38
39 typedef struct {
40 UINT32 Signature;
41 UINT32 Length;
42 UINT8 Revision;
43 UINT8 Checksum;
44 CHAR8 OemId[6];
45 CHAR8 OemTableId[8];
46 UINT32 OemRevision;
47 UINT32 CreatorId;
48 UINT32 CreatorRevision;
49 } EFI_ACPI_SDT_HEADER;
50
51 typedef
52 EFI_STATUS
53 (EFIAPI *EFI_ACPI_NOTIFICATION_FN)(
54 IN EFI_ACPI_SDT_HEADER *Table, ///< A pointer to the ACPI table header.
55 IN EFI_ACPI_TABLE_VERSION Version, ///< The ACPI table's version.
56 IN UINTN TableKey ///< The table key for this ACPI table.
57 );
58
59 /**
60 Returns a requested ACPI table.
61
62 The GetAcpiTable() function returns a pointer to a buffer containing the ACPI table associated
63 with the Index that was input. The following structures are not considered elements in the list of
64 ACPI tables:
65 - Root System Description Pointer (RSD_PTR)
66 - Root System Description Table (RSDT)
67 - Extended System Description Table (XSDT)
68 Version is updated with a bit map containing all the versions of ACPI of which the table is a
69 member.
70
71 @param[in] Index The zero-based index of the table to retrieve.
72 @param[out] Table Pointer for returning the table buffer.
73 @param[out] Version On return, updated with the ACPI versions to which this table belongs. Type
74 EFI_ACPI_TABLE_VERSION is defined in "Related Definitions" in the
75 EFI_ACPI_SDT_PROTOCOL.
76 @param[out] TableKey On return, points to the table key for the specified ACPI system definition table. This
77 is identical to the table key used in the EFI_ACPI_TABLE_PROTOCOL.
78
79 @retval EFI_SUCCESS The function completed successfully.
80 @retval EFI_NOT_FOUND The requested index is too large and a table was not found.
81 **/
82 typedef
83 EFI_STATUS
84 (EFIAPI *EFI_ACPI_GET_ACPI_TABLE2)(
85 IN UINTN Index,
86 OUT EFI_ACPI_SDT_HEADER **Table,
87 OUT EFI_ACPI_TABLE_VERSION *Version,
88 OUT UINTN *TableKey
89 );
90
91 /**
92 Register or unregister a callback when an ACPI table is installed.
93
94 This function registers or unregisters a function which will be called whenever a new ACPI table is
95 installed.
96
97 @param[in] Register If TRUE, then the specified function will be registered. If FALSE, then the specified
98 function will be unregistered.
99 @param[in] Notification Points to the callback function to be registered or unregistered.
100
101 @retval EFI_SUCCESS Callback successfully registered or unregistered.
102 @retval EFI_INVALID_PARAMETER Notification is NULL
103 @retval EFI_INVALID_PARAMETER Register is FALSE and Notification does not match a known registration function.
104 **/
105 typedef
106 EFI_STATUS
107 (EFIAPI *EFI_ACPI_REGISTER_NOTIFY)(
108 IN BOOLEAN Register,
109 IN EFI_ACPI_NOTIFICATION_FN Notification
110 );
111
112 /**
113 Create a handle from an ACPI opcode
114
115 @param[in] Buffer Points to the ACPI opcode.
116 @param[out] Handle Upon return, holds the handle.
117
118 @retval EFI_SUCCESS Success
119 @retval EFI_INVALID_PARAMETER Buffer is NULL or Handle is NULL or Buffer points to an
120 invalid opcode.
121
122 **/
123 typedef
124 EFI_STATUS
125 (EFIAPI *EFI_ACPI_OPEN)(
126 IN VOID *Buffer,
127 OUT EFI_ACPI_HANDLE *Handle
128 );
129
130 /**
131 Create a handle for the first ACPI opcode in an ACPI system description table.
132
133 @param[in] TableKey The table key for the ACPI table, as returned by GetTable().
134 @param[out] Handle On return, points to the newly created ACPI handle.
135
136 @retval EFI_SUCCESS Handle created successfully.
137 @retval EFI_NOT_FOUND TableKey does not refer to a valid ACPI table.
138 **/
139 typedef
140 EFI_STATUS
141 (EFIAPI *EFI_ACPI_OPEN_SDT)(
142 IN UINTN TableKey,
143 OUT EFI_ACPI_HANDLE *Handle
144 );
145
146 /**
147 Close an ACPI handle.
148
149 @param[in] Handle Returns the handle.
150
151 @retval EFI_SUCCESS Success
152 @retval EFI_INVALID_PARAMETER Handle is NULL or does not refer to a valid ACPI object.
153 **/
154 typedef
155 EFI_STATUS
156 (EFIAPI *EFI_ACPI_CLOSE)(
157 IN EFI_ACPI_HANDLE Handle
158 );
159
160 /**
161 Return the child ACPI objects.
162
163 @param[in] ParentHandle Parent handle.
164 @param[in, out] Handle On entry, points to the previously returned handle or NULL to start with the first
165 handle. On return, points to the next returned ACPI handle or NULL if there are no
166 child objects.
167
168 @retval EFI_SUCCESS Success
169 @retval EFI_INVALID_PARAMETER ParentHandle is NULL or does not refer to a valid ACPI object.
170 **/
171 typedef
172 EFI_STATUS
173 (EFIAPI *EFI_ACPI_GET_CHILD)(
174 IN EFI_ACPI_HANDLE ParentHandle,
175 IN OUT EFI_ACPI_HANDLE *Handle
176 );
177
178 /**
179 Retrieve information about an ACPI object.
180
181 @param[in] Handle ACPI object handle.
182 @param[in] Index Index of the data to retrieve from the object. In general, indexes read from left-to-right
183 in the ACPI encoding, with index 0 always being the ACPI opcode.
184 @param[out] DataType Points to the returned data type or EFI_ACPI_DATA_TYPE_NONE if no data exists
185 for the specified index.
186 @param[out] Data Upon return, points to the pointer to the data.
187 @param[out] DataSize Upon return, points to the size of Data.
188
189 @retval
190 **/
191 typedef
192 EFI_STATUS
193 (EFIAPI *EFI_ACPI_GET_OPTION)(
194 IN EFI_ACPI_HANDLE Handle,
195 IN UINTN Index,
196 OUT EFI_ACPI_DATA_TYPE *DataType,
197 OUT CONST VOID **Data,
198 OUT UINTN *DataSize
199 );
200
201 /**
202 Change information about an ACPI object.
203
204 @param[in] Handle ACPI object handle.
205 @param[in] Index Index of the data to retrieve from the object. In general, indexes read from left-to-right
206 in the ACPI encoding, with index 0 always being the ACPI opcode.
207 @param[in] Data Points to the data.
208 @param[in] DataSize The size of the Data.
209
210 @retval EFI_SUCCESS Success
211 @retval EFI_INVALID_PARAMETER Handle is NULL or does not refer to a valid ACPI object.
212 @retval EFI_BAD_BUFFER_SIZE Data cannot be accommodated in the space occupied by
213 the option.
214
215 **/
216 typedef
217 EFI_STATUS
218 (EFIAPI *EFI_ACPI_SET_OPTION)(
219 IN EFI_ACPI_HANDLE Handle,
220 IN UINTN Index,
221 IN CONST VOID *Data,
222 IN UINTN DataSize
223 );
224
225 /**
226 Returns the handle of the ACPI object representing the specified ACPI path
227
228 @param[in] HandleIn Points to the handle of the object representing the starting point for the path search.
229 @param[in] AcpiPath Points to the ACPI path, which conforms to the ACPI encoded path format.
230 @param[out] HandleOut On return, points to the ACPI object which represents AcpiPath, relative to
231 HandleIn.
232
233 @retval EFI_SUCCESS Success
234 @retval EFI_INVALID_PARAMETER HandleIn is NULL or does not refer to a valid ACPI object.
235 **/
236 typedef
237 EFI_STATUS
238 (EFIAPI *EFI_ACPI_FIND_PATH)(
239 IN EFI_ACPI_HANDLE HandleIn,
240 IN VOID *AcpiPath,
241 OUT EFI_ACPI_HANDLE HandleOut
242 );
243
244 typedef struct _EFI_ACPI_SDT_PROTOCOL {
245 ///
246 /// Specifies the ACPI version supported by this protocol.
247 ///
248 EFI_ACPI_TABLE_VERSION AcpiVersion;
249 EFI_ACPI_GET_ACPI_TABLE2 GetAcpiTable;
250 EFI_ACPI_REGISTER_NOTIFY RegisterNotify;
251 EFI_ACPI_OPEN Open;
252 EFI_ACPI_OPEN_SDT OpenSdt;
253 EFI_ACPI_CLOSE Close;
254 EFI_ACPI_GET_CHILD GetChild;
255 EFI_ACPI_GET_OPTION GetOption;
256 EFI_ACPI_SET_OPTION SetOption;
257 EFI_ACPI_FIND_PATH FindPath;
258 } EFI_ACPI_SDT_PROTOCOL;
259
260 extern EFI_GUID gEfiAcpiSdtProtocolGuid;
261
262 #endif // __ACPI_SYSTEM_DESCRIPTION_TABLE_H___