]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h
Solve a wrong pointer reference in QueryVariableInfo().
[mirror_edk2.git] / MdeModulePkg / Universal / Acpi / AcpiTableDxe / AcpiSdt.h
CommitLineData
3dc8585e
JY
1/** @file\r
2 ACPI Sdt Protocol Driver\r
3\r
4 Copyright (c) 2010, Intel Corporation. All rights reserved. <BR>\r
5 This program and the accompanying materials\r
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_SDT_H_\r
16#define _ACPI_SDT_H_\r
17\r
18//\r
19// ACPI AML definition\r
20//\r
21\r
22//\r
23// Primary OpCode\r
24//\r
25#define AML_ZERO_OP 0x00\r
26#define AML_ONE_OP 0x01\r
27#define AML_ALIAS_OP 0x06\r
28#define AML_NAME_OP 0x08\r
29#define AML_BYTE_PREFIX 0x0a\r
30#define AML_WORD_PREFIX 0x0b\r
31#define AML_DWORD_PREFIX 0x0c\r
32#define AML_STRING_PREFIX 0x0d\r
33#define AML_QWORD_PREFIX 0x0e\r
34#define AML_SCOPE_OP 0x10\r
35#define AML_BUFFER_OP 0x11\r
36#define AML_PACKAGE_OP 0x12\r
37#define AML_VAR_PACKAGE_OP 0x13\r
38#define AML_METHOD_OP 0x14\r
39#define AML_DUAL_NAME_PREFIX 0x2e\r
40#define AML_MULTI_NAME_PREFIX 0x2f\r
41#define AML_NAME_CHAR_A 0x41\r
42#define AML_NAME_CHAR_B 0x42\r
43#define AML_NAME_CHAR_C 0x43\r
44#define AML_NAME_CHAR_D 0x44\r
45#define AML_NAME_CHAR_E 0x45\r
46#define AML_NAME_CHAR_F 0x46\r
47#define AML_NAME_CHAR_G 0x47\r
48#define AML_NAME_CHAR_H 0x48\r
49#define AML_NAME_CHAR_I 0x49\r
50#define AML_NAME_CHAR_J 0x4a\r
51#define AML_NAME_CHAR_K 0x4b\r
52#define AML_NAME_CHAR_L 0x4c\r
53#define AML_NAME_CHAR_M 0x4d\r
54#define AML_NAME_CHAR_N 0x4e\r
55#define AML_NAME_CHAR_O 0x4f\r
56#define AML_NAME_CHAR_P 0x50\r
57#define AML_NAME_CHAR_Q 0x51\r
58#define AML_NAME_CHAR_R 0x52\r
59#define AML_NAME_CHAR_S 0x53\r
60#define AML_NAME_CHAR_T 0x54\r
61#define AML_NAME_CHAR_U 0x55\r
62#define AML_NAME_CHAR_V 0x56\r
63#define AML_NAME_CHAR_W 0x57\r
64#define AML_NAME_CHAR_X 0x58\r
65#define AML_NAME_CHAR_Y 0x59\r
66#define AML_NAME_CHAR_Z 0x5a\r
67#define AML_ROOT_CHAR 0x5c\r
68#define AML_PARENT_PREFIX_CHAR 0x5e\r
69#define AML_NAME_CHAR__ 0x5f\r
70#define AML_LOCAL0 0x60\r
71#define AML_LOCAL1 0x61\r
72#define AML_LOCAL2 0x62\r
73#define AML_LOCAL3 0x63\r
74#define AML_LOCAL4 0x64\r
75#define AML_LOCAL5 0x65\r
76#define AML_LOCAL6 0x66\r
77#define AML_LOCAL7 0x67\r
78#define AML_ARG0 0x68\r
79#define AML_ARG1 0x69\r
80#define AML_ARG2 0x6a\r
81#define AML_ARG3 0x6b\r
82#define AML_ARG4 0x6c\r
83#define AML_ARG5 0x6d\r
84#define AML_ARG6 0x6e\r
85#define AML_STORE_OP 0x70\r
86#define AML_REF_OF_OP 0x71\r
87#define AML_ADD_OP 0x72\r
88#define AML_CONCAT_OP 0x73\r
89#define AML_SUBTRACT_OP 0x74\r
90#define AML_INCREMENT_OP 0x75\r
91#define AML_DECREMENT_OP 0x76\r
92#define AML_MULTIPLY_OP 0x77\r
93#define AML_DIVIDE_OP 0x78\r
94#define AML_SHIFT_LEFT_OP 0x79\r
95#define AML_SHIFT_RIGHT_OP 0x7a\r
96#define AML_AND_OP 0x7b\r
97#define AML_NAND_OP 0x7c\r
98#define AML_OR_OP 0x7d\r
99#define AML_NOR_OP 0x7e\r
100#define AML_XOR_OP 0x7f\r
101#define AML_NOT_OP 0x80\r
102#define AML_FIND_SET_LEFT_BIT_OP 0x81\r
103#define AML_FIND_SET_RIGHT_BIT_OP 0x82\r
104#define AML_DEREF_OF_OP 0x83\r
105#define AML_CONCAT_RES_OP 0x84\r
106#define AML_MOD_OP 0x85\r
107#define AML_NOTIFY_OP 0x86\r
108#define AML_SIZE_OF_OP 0x87\r
109#define AML_INDEX_OP 0x88\r
110#define AML_MATCH_OP 0x89\r
111#define AML_CREATE_DWORD_FIELD_OP 0x8a\r
112#define AML_CREATE_WORD_FIELD_OP 0x8b\r
113#define AML_CREATE_BYTE_FIELD_OP 0x8c\r
114#define AML_CREATE_BIT_FIELD_OP 0x8d\r
115#define AML_OBJECT_TYPE_OP 0x8e\r
116#define AML_CREATE_QWORD_FIELD_OP 0x8f\r
117#define AML_LAND_OP 0x90\r
118#define AML_LOR_OP 0x91\r
119#define AML_LNOT_OP 0x92\r
120#define AML_LEQUAL_OP 0x93\r
121#define AML_LGREATER_OP 0x94\r
122#define AML_LLESS_OP 0x95\r
123#define AML_TO_BUFFER_OP 0x96\r
124#define AML_TO_DEC_STRING_OP 0x97\r
125#define AML_TO_HEX_STRING_OP 0x98\r
126#define AML_TO_INTEGER_OP 0x99\r
127#define AML_TO_STRING_OP 0x9c\r
128#define AML_COPY_OBJECT_OP 0x9d\r
129#define AML_MID_OP 0x9e\r
130#define AML_CONTINUE_OP 0x9f\r
131#define AML_IF_OP 0xa0\r
132#define AML_ELSE_OP 0xa1\r
133#define AML_WHILE_OP 0xa2\r
134#define AML_NOOP_OP 0xa3\r
135#define AML_RETURN_OP 0xa4\r
136#define AML_BREAK_OP 0xa5\r
137#define AML_BREAK_POINT_OP 0xcc\r
138#define AML_ONES_OP 0xff\r
139\r
140//\r
141// Extended OpCode\r
142//\r
143#define AML_EXT_OP 0x5b\r
144\r
145#define AML_EXT_MUTEX_OP 0x01\r
146#define AML_EXT_EVENT_OP 0x02\r
147#define AML_EXT_COND_REF_OF_OP 0x12\r
148#define AML_EXT_CREATE_FIELD_OP 0x13\r
149#define AML_EXT_LOAD_TABLE_OP 0x1f\r
150#define AML_EXT_LOAD_OP 0x20\r
151#define AML_EXT_STALL_OP 0x21\r
152#define AML_EXT_SLEEP_OP 0x22\r
153#define AML_EXT_ACQUIRE_OP 0x23\r
154#define AML_EXT_SIGNAL_OP 0x24\r
155#define AML_EXT_WAIT_OP 0x25\r
156#define AML_EXT_RESET_OP 0x26\r
157#define AML_EXT_RELEASE_OP 0x27\r
158#define AML_EXT_FROM_BCD_OP 0x28\r
159#define AML_EXT_TO_BCD_OP 0x29\r
160#define AML_EXT_UNLOAD_OP 0x2a\r
161#define AML_EXT_REVISION_OP 0x30\r
162#define AML_EXT_DEBUG_OP 0x31\r
163#define AML_EXT_FATAL_OP 0x32\r
164#define AML_EXT_TIMER_OP 0x33\r
165#define AML_EXT_REGION_OP 0x80\r
166#define AML_EXT_FIELD_OP 0x81\r
167#define AML_EXT_DEVICE_OP 0x82\r
168#define AML_EXT_PROCESSOR_OP 0x83\r
169#define AML_EXT_POWER_RES_OP 0x84\r
170#define AML_EXT_THERMAL_ZONE_OP 0x85\r
171#define AML_EXT_INDEX_FIELD_OP 0x86\r
172#define AML_EXT_BANK_FIELD_OP 0x87\r
173#define AML_EXT_DATA_REGION_OP 0x88\r
174\r
175//\r
176// Privacy data structure\r
177//\r
178\r
179//\r
180// ACPI Notify Linked List Signature.\r
181//\r
182#define EFI_ACPI_NOTIFY_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'N', 'L')\r
183\r
184//\r
185// ACPI Notify List Entry definition.\r
186//\r
187// Signature must be set to EFI_ACPI_NOTIFY_LIST_SIGNATURE\r
188// Link is the linked list data.\r
189// Notification is the callback function.\r
190//\r
191typedef struct {\r
192 UINT32 Signature;\r
193 LIST_ENTRY Link;\r
194 EFI_ACPI_NOTIFICATION_FN Notification;\r
195} EFI_ACPI_NOTIFY_LIST;\r
196\r
197//\r
198// Containment record for ACPI Notify linked list.\r
199//\r
200#define EFI_ACPI_NOTIFY_LIST_FROM_LINK(_link) CR (_link, EFI_ACPI_NOTIFY_LIST, Link, EFI_ACPI_NOTIFY_LIST_SIGNATURE)\r
201\r
202typedef struct _AML_BYTE_ENCODING AML_BYTE_ENCODING;\r
203typedef struct _EFI_AML_NODE_LIST EFI_AML_NODE_LIST;\r
204\r
205//\r
206// AML Node Linked List Signature.\r
207//\r
208#define EFI_AML_NODE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'M', 'L')\r
209\r
210//\r
211// AML Node Linked List Entry definition.\r
212//\r
213// Signature must be set to EFI_AML_NODE_LIST_SIGNATURE\r
214// Link is the linked list data.\r
215// Name is the ACPI node name.\r
216// This is listed for PATH finding.\r
217// Buffer is the ACPI node buffer pointer, the first/second bytes are opcode.\r
218// This buffer should not be freed.\r
219// Size is the total size of this ACPI node buffer.\r
220// Children is the children linked list of this node.\r
221//\r
222#define AML_NAME_SEG_SIZE 4\r
223\r
224struct _EFI_AML_NODE_LIST {\r
225 UINT32 Signature;\r
226 UINT8 Name[AML_NAME_SEG_SIZE];\r
227 UINT8 *Buffer;\r
228 UINTN Size;\r
229 LIST_ENTRY Link;\r
230 LIST_ENTRY Children;\r
231 EFI_AML_NODE_LIST *Parent;\r
232 AML_BYTE_ENCODING *AmlByteEncoding;\r
233};\r
234\r
235//\r
236// Containment record for AML Node linked list.\r
237//\r
238#define EFI_AML_NODE_LIST_FROM_LINK(_link) CR (_link, EFI_AML_NODE_LIST, Link, EFI_AML_NODE_LIST_SIGNATURE)\r
239\r
240//\r
241// AML Handle Signature.\r
242//\r
243#define EFI_AML_HANDLE_SIGNATURE SIGNATURE_32 ('E', 'A', 'H', 'S')\r
244#define EFI_AML_ROOT_HANDLE_SIGNATURE SIGNATURE_32 ('E', 'A', 'R', 'H')\r
245\r
246//\r
247// AML Handle Entry definition.\r
248//\r
249// Signature must be set to EFI_AML_HANDLE_SIGNATURE or EFI_AML_ROOT_HANDLE_SIGNATURE\r
250// Buffer is the ACPI node buffer pointer, the first/second bytes are opcode.\r
251// This buffer should not be freed.\r
252// Size is the total size of this ACPI node buffer.\r
253//\r
254typedef struct {\r
255 UINT32 Signature;\r
256 UINT8 *Buffer;\r
257 UINTN Size;\r
258 AML_BYTE_ENCODING *AmlByteEncoding;\r
259 BOOLEAN Modified;\r
260} EFI_AML_HANDLE;\r
261\r
262typedef UINT32 AML_OP_PARSE_INDEX;\r
263\r
264#define AML_OP_PARSE_INDEX_GET_OPCODE 0\r
265#define AML_OP_PARSE_INDEX_GET_TERM1 1\r
266#define AML_OP_PARSE_INDEX_GET_TERM2 2\r
267#define AML_OP_PARSE_INDEX_GET_TERM3 3\r
268#define AML_OP_PARSE_INDEX_GET_TERM4 4\r
269#define AML_OP_PARSE_INDEX_GET_TERM5 5\r
270#define AML_OP_PARSE_INDEX_GET_TERM6 6\r
271#define AML_OP_PARSE_INDEX_GET_SIZE (AML_OP_PARSE_INDEX)-1\r
272\r
273typedef UINT32 AML_OP_PARSE_FORMAT;\r
274#define AML_NONE 0\r
275#define AML_OPCODE 1\r
276#define AML_UINT8 2\r
277#define AML_UINT16 3\r
278#define AML_UINT32 4\r
279#define AML_UINT64 5\r
280#define AML_NAME 6\r
281#define AML_STRING 7\r
282#define AML_OBJECT 8\r
283\r
284typedef UINT32 AML_OP_ATTRIBUTE;\r
285#define AML_HAS_PKG_LENGTH 0x1 // It is ACPI attribute - if OpCode has PkgLength\r
286#define AML_IS_NAME_CHAR 0x2 // It is ACPI attribute - if this is NameChar\r
287#define AML_HAS_CHILD_OBJ 0x4 // it is ACPI attribute - if OpCode has Child Object.\r
288#define AML_IN_NAMESPACE 0x10000 // It is UEFI SDT attribute - if OpCode will be in NameSpace\r
289 // NOTE; Not all OBJECT will be in NameSpace\r
290 // For example, BankField | CreateBitField | CreateByteField | CreateDWordField | \r
291 // CreateField | CreateQWordField | CreateWordField | Field | IndexField.\r
292\r
293struct _AML_BYTE_ENCODING {\r
294 UINT8 OpCode;\r
295 UINT8 SubOpCode;\r
296 AML_OP_PARSE_INDEX MaxIndex;\r
297 AML_OP_PARSE_FORMAT Format[6];\r
298 AML_OP_ATTRIBUTE Attribute;\r
299};\r
300\r
301//\r
302// AcpiSdt protocol declaration\r
303//\r
304\r
305/**\r
306 Returns a requested ACPI table.\r
307 \r
308 The GetAcpiTable() function returns a pointer to a buffer containing the ACPI table associated\r
309 with the Index that was input. The following structures are not considered elements in the list of\r
310 ACPI tables:\r
311 - Root System Description Pointer (RSD_PTR)\r
312 - Root System Description Table (RSDT)\r
313 - Extended System Description Table (XSDT)\r
314 Version is updated with a bit map containing all the versions of ACPI of which the table is a\r
315 member.\r
316 \r
317 @param[in] Index The zero-based index of the table to retrieve.\r
318 @param[out] Table Pointer for returning the table buffer.\r
319 @param[out] Version On return, updated with the ACPI versions to which this table belongs. Type\r
320 EFI_ACPI_TABLE_VERSION is defined in "Related Definitions" in the\r
321 EFI_ACPI_SDT_PROTOCOL. \r
322 @param[out] TableKey On return, points to the table key for the specified ACPI system definition table. This\r
323 is identical to the table key used in the EFI_ACPI_TABLE_PROTOCOL. \r
324 \r
325 @retval EFI_SUCCESS The function completed successfully.\r
326 @retval EFI_NOT_FOUND The requested index is too large and a table was not found. \r
327**/ \r
328EFI_STATUS\r
329EFIAPI\r
330GetAcpiTable2 (\r
331 IN UINTN Index,\r
332 OUT EFI_ACPI_SDT_HEADER **Table,\r
333 OUT EFI_ACPI_TABLE_VERSION *Version,\r
334 OUT UINTN *TableKey\r
335 );\r
336\r
337/**\r
338 Register or unregister a callback when an ACPI table is installed.\r
339 \r
340 This function registers or unregisters a function which will be called whenever a new ACPI table is\r
341 installed.\r
342 \r
343 @param[in] Register If TRUE, then the specified function will be registered. If FALSE, then the specified\r
344 function will be unregistered.\r
345 @param[in] Notification Points to the callback function to be registered or unregistered.\r
346 \r
347 @retval EFI_SUCCESS Callback successfully registered or unregistered.\r
348 @retval EFI_INVALID_PARAMETER Notification is NULL\r
349 @retval EFI_INVALID_PARAMETER Register is FALSE and Notification does not match a known registration function. \r
350**/\r
351EFI_STATUS\r
352EFIAPI\r
353RegisterNotify (\r
354 IN BOOLEAN Register,\r
355 IN EFI_ACPI_NOTIFICATION_FN Notification\r
356 );\r
357\r
358/**\r
359 Create a handle for the first ACPI opcode in an ACPI system description table.\r
360 \r
361 @param[in] TableKey The table key for the ACPI table, as returned by GetTable().\r
362 @param[out] Handle On return, points to the newly created ACPI handle.\r
363\r
364 @retval EFI_SUCCESS Handle created successfully.\r
365 @retval EFI_NOT_FOUND TableKey does not refer to a valid ACPI table. \r
366**/\r
367EFI_STATUS\r
368EFIAPI\r
369OpenSdt (\r
370 IN UINTN TableKey,\r
371 OUT EFI_ACPI_HANDLE *Handle\r
372 );\r
373\r
374/**\r
375 Create a handle from an ACPI opcode\r
376 \r
377 @param[in] Buffer Points to the ACPI opcode.\r
378 @param[out] Handle Upon return, holds the handle.\r
379 \r
380 @retval EFI_SUCCESS Success\r
381 @retval EFI_INVALID_PARAMETER Buffer is NULL or Handle is NULL or Buffer points to an\r
382 invalid opcode.\r
383 \r
384**/\r
385EFI_STATUS\r
386EFIAPI\r
387Open (\r
388 IN VOID *Buffer,\r
389 OUT EFI_ACPI_HANDLE *Handle \r
390 );\r
391\r
392/**\r
393 Close an ACPI handle.\r
394 \r
395 @param[in] Handle Returns the handle.\r
396 \r
397 @retval EFI_SUCCESS Success\r
398 @retval EFI_INVALID_PARAMETER Handle is NULL or does not refer to a valid ACPI object. \r
399**/\r
400EFI_STATUS\r
401EFIAPI\r
402Close (\r
403 IN EFI_ACPI_HANDLE Handle\r
404 );\r
405\r
406/**\r
407 Retrieve information about an ACPI object.\r
408 \r
409 @param[in] Handle ACPI object handle.\r
410 @param[in] Index Index of the data to retrieve from the object. In general, indexes read from left-to-right\r
411 in the ACPI encoding, with index 0 always being the ACPI opcode.\r
412 @param[out] DataType Points to the returned data type or EFI_ACPI_DATA_TYPE_NONE if no data exists\r
413 for the specified index.\r
414 @param[out] Data Upon return, points to the pointer to the data.\r
415 @param[out] DataSize Upon return, points to the size of Data.\r
416 \r
417 @retval EFI_SUCCESS Success.\r
418 @retval EFI_INVALID_PARAMETER Handle is NULL or does not refer to a valid ACPI object.\r
419**/\r
420EFI_STATUS\r
421EFIAPI\r
422GetOption (\r
423 IN EFI_ACPI_HANDLE Handle,\r
424 IN UINTN Index,\r
425 OUT EFI_ACPI_DATA_TYPE *DataType,\r
426 OUT CONST VOID **Data,\r
427 OUT UINTN *DataSize\r
428 );\r
429\r
430/**\r
431 Change information about an ACPI object.\r
432 \r
433 @param[in] Handle ACPI object handle.\r
434 @param[in] Index Index of the data to retrieve from the object. In general, indexes read from left-to-right\r
435 in the ACPI encoding, with index 0 always being the ACPI opcode.\r
436 @param[in] Data Points to the data.\r
437 @param[in] DataSize The size of the Data.\r
438\r
439 @retval EFI_SUCCESS Success\r
440 @retval EFI_INVALID_PARAMETER Handle is NULL or does not refer to a valid ACPI object.\r
441 @retval EFI_BAD_BUFFER_SIZE Data cannot be accommodated in the space occupied by\r
442 the option.\r
443\r
444**/\r
445EFI_STATUS\r
446EFIAPI\r
447SetOption (\r
448 IN EFI_ACPI_HANDLE Handle,\r
449 IN UINTN Index,\r
450 IN CONST VOID *Data,\r
451 IN UINTN DataSize\r
452 );\r
453\r
454/**\r
455 Return the child ACPI objects.\r
456 \r
457 @param[in] ParentHandle Parent handle.\r
458 @param[in, out] Handle On entry, points to the previously returned handle or NULL to start with the first\r
459 handle. On return, points to the next returned ACPI handle or NULL if there are no\r
460 child objects.\r
461\r
462 @retval EFI_SUCCESS Success\r
463 @retval EFI_INVALID_PARAMETER ParentHandle is NULL or does not refer to a valid ACPI object. \r
464**/\r
465EFI_STATUS\r
466EFIAPI\r
467GetChild (\r
468 IN EFI_ACPI_HANDLE ParentHandle,\r
469 IN OUT EFI_ACPI_HANDLE *Handle\r
470 );\r
471\r
472/**\r
473 Returns the handle of the ACPI object representing the specified ACPI path\r
474 \r
475 @param[in] HandleIn Points to the handle of the object representing the starting point for the path search.\r
476 @param[in] AcpiPath Points to the ACPI path, which conforms to the ACPI encoded path format.\r
477 @param[out] HandleOut On return, points to the ACPI object which represents AcpiPath, relative to\r
478 HandleIn.\r
479 \r
480 @retval EFI_SUCCESS Success\r
481 @retval EFI_INVALID_PARAMETER HandleIn is NULL or does not refer to a valid ACPI object. \r
482**/\r
483EFI_STATUS\r
484EFIAPI\r
485FindPath (\r
486 IN EFI_ACPI_HANDLE HandleIn,\r
487 IN VOID *AcpiPath,\r
488 OUT EFI_ACPI_HANDLE *HandleOut\r
489 );\r
490\r
491//\r
492// ACPI SDT function\r
493//\r
494\r
495/**\r
496 Create a handle from an ACPI opcode\r
497 \r
498 @param[in] Buffer Points to the ACPI opcode.\r
499 @param[in] BufferSize Max buffer size.\r
500 @param[out] Handle Upon return, holds the handle.\r
501 \r
502 @retval EFI_SUCCESS Success\r
503 @retval EFI_INVALID_PARAMETER Buffer is NULL or Handle is NULL or Buffer points to an\r
504 invalid opcode.\r
505 \r
506**/\r
507EFI_STATUS\r
508SdtOpenEx (\r
509 IN VOID *Buffer,\r
510 IN UINTN BufferSize,\r
511 OUT EFI_ACPI_HANDLE *Handle \r
512 );\r
513\r
514//\r
515// AML support function\r
516//\r
517\r
518/**\r
519 Get AML NameString size.\r
520\r
521 @param[in] Buffer AML NameString.\r
522 @param[out] BufferSize AML NameString size \r
523 \r
524 @retval EFI_SUCCESS Success.\r
525 @retval EFI_INVALID_PARAMETER Buffer does not refer to a valid AML NameString.\r
526**/\r
527EFI_STATUS\r
528AmlGetNameStringSize (\r
529 IN UINT8 *Buffer,\r
530 OUT UINTN *BufferSize\r
531 );\r
532\r
533/**\r
534 This function retuns package length from the buffer.\r
535\r
536 @param[in] Buffer AML buffer\r
537 @param[out] PkgLength The total length of package.\r
538\r
539 @return The byte data count to present the package length.\r
540**/\r
541UINTN\r
542AmlGetPkgLength (\r
543 IN UINT8 *Buffer,\r
544 OUT UINTN *PkgLength\r
545 );\r
546\r
547/**\r
548 This function returns AcpiDataType according to AmlType.\r
549\r
550 @param[in] AmlType AML Type.\r
551\r
552 @return AcpiDataType\r
553**/\r
554EFI_ACPI_DATA_TYPE\r
555AmlTypeToAcpiType (\r
556 IN AML_OP_PARSE_FORMAT AmlType\r
557 );\r
558\r
559/**\r
560 This function returns AmlByteEncoding according to OpCode Byte.\r
561\r
562 @param[in] OpByteBuffer OpCode byte buffer.\r
563\r
564 @return AmlByteEncoding\r
565**/\r
566AML_BYTE_ENCODING *\r
567AmlSearchByOpByte (\r
568 IN UINT8 *OpByteBuffer\r
569 );\r
570\r
571/**\r
572 Return object size.\r
573 \r
574 @param[in] AmlByteEncoding AML Byte Encoding.\r
575 @param[in] Buffer AML object buffer.\r
576 @param[in] MaxBufferSize AML object buffer MAX size. The parser can not parse any data exceed this region.\r
577 \r
578 @return Size of the object.\r
579**/\r
580UINTN\r
581AmlGetObjectSize (\r
582 IN AML_BYTE_ENCODING *AmlByteEncoding,\r
583 IN UINT8 *Buffer,\r
584 IN UINTN MaxBufferSize\r
585 );\r
586\r
587/**\r
588 Return object name.\r
589 \r
590 @param[in] AmlHandle AML handle.\r
591 \r
592 @return Name of the object.\r
593**/\r
594CHAR8 *\r
595AmlGetObjectName (\r
596 IN EFI_AML_HANDLE *AmlHandle\r
597 );\r
598\r
599/**\r
600 Retrieve information according to AmlHandle\r
601 \r
602 @param[in] AmlHandle AML handle.\r
603 @param[in] Index Index of the data to retrieve from the object. In general, indexes read from left-to-right\r
604 in the ACPI encoding, with index 0 always being the ACPI opcode.\r
605 @param[out] DataType Points to the returned data type or EFI_ACPI_DATA_TYPE_NONE if no data exists\r
606 for the specified index.\r
607 @param[out] Data Upon return, points to the pointer to the data.\r
608 @param[out] DataSize Upon return, points to the size of Data.\r
609 \r
610 @retval EFI_SUCCESS Success.\r
611 @retval EFI_INVALID_PARAMETER AmlHandle does not refer to a valid ACPI object.\r
612**/\r
613EFI_STATUS\r
614AmlParseOptionHandleCommon (\r
615 IN EFI_AML_HANDLE *AmlHandle,\r
616 IN AML_OP_PARSE_INDEX Index,\r
617 OUT EFI_ACPI_DATA_TYPE *DataType,\r
618 OUT VOID **Data,\r
619 OUT UINTN *DataSize\r
620 );\r
621\r
622/**\r
623 Return offset of last option.\r
624 \r
625 @param[in] AmlHandle AML Handle.\r
626 @param[out] Buffer Upon return, points to the offset after last option.\r
627 \r
628 @retval EFI_SUCCESS Success.\r
629 @retval EFI_INVALID_PARAMETER AmlHandle does not refer to a valid ACPI object.\r
630**/\r
631EFI_STATUS\r
632AmlGetOffsetAfterLastOption (\r
633 IN EFI_AML_HANDLE *AmlHandle,\r
634 OUT UINT8 **Buffer\r
635 );\r
636\r
637/**\r
638 Return the child ACPI objects from Root Handle.\r
639 \r
640 @param[in] AmlParentHandle Parent handle. It is Root Handle.\r
641 @param[in] AmlHandle The previously returned handle or NULL to start with the first handle.\r
642 @param[out] Buffer On return, points to the next returned ACPI handle or NULL if there are no\r
643 child objects.\r
644\r
645 @retval EFI_SUCCESS Success\r
646 @retval EFI_INVALID_PARAMETER ParentHandle is NULL or does not refer to a valid ACPI object. \r
647**/\r
648EFI_STATUS\r
649AmlGetChildFromRoot (\r
650 IN EFI_AML_HANDLE *AmlParentHandle,\r
651 IN EFI_AML_HANDLE *AmlHandle,\r
652 OUT VOID **Buffer\r
653 );\r
654\r
655/**\r
656 Return the child ACPI objects from Non-Root Handle.\r
657 \r
658 @param[in] AmlParentHandle Parent handle. It is Non-Root Handle.\r
659 @param[in] AmlHandle The previously returned handle or NULL to start with the first handle.\r
660 @param[out] Buffer On return, points to the next returned ACPI handle or NULL if there are no\r
661 child objects.\r
662\r
663 @retval EFI_SUCCESS Success\r
664 @retval EFI_INVALID_PARAMETER ParentHandle is NULL or does not refer to a valid ACPI object. \r
665**/\r
666EFI_STATUS\r
667AmlGetChildFromNonRoot (\r
668 IN EFI_AML_HANDLE *AmlParentHandle,\r
669 IN EFI_AML_HANDLE *AmlHandle,\r
670 OUT VOID **Buffer\r
671 );\r
672\r
673/**\r
674 Return AML name according to ASL name.\r
675 The caller need free the AmlName returned.\r
676\r
677 @param[in] AslPath ASL name.\r
678\r
679 @return AmlName\r
680**/\r
681UINT8 *\r
682AmlNameFromAslName (\r
683 IN UINT8 *AslPath\r
684 );\r
685\r
686/**\r
687 Returns the handle of the ACPI object representing the specified ACPI AML path\r
688 \r
689 @param[in] AmlHandle Points to the handle of the object representing the starting point for the path search.\r
690 @param[in] AmlPath Points to the ACPI AML path.\r
691 @param[out] Buffer On return, points to the ACPI object which represents AcpiPath, relative to\r
692 HandleIn.\r
693 @param[in] FromRoot TRUE means to find AML path from \ (Root) Node.\r
694 FALSE means to find AML path from this Node (The HandleIn).\r
695 \r
696 @retval EFI_SUCCESS Success\r
697 @retval EFI_INVALID_PARAMETER HandleIn does not refer to a valid ACPI object. \r
698**/\r
699EFI_STATUS\r
700AmlFindPath (\r
701 IN EFI_AML_HANDLE *AmlHandle,\r
702 IN UINT8 *AmlPath,\r
703 OUT VOID **Buffer,\r
704 IN BOOLEAN FromRoot\r
705 );\r
706\r
707/**\r
708 Print AML NameString.\r
709\r
710 @param[in] Buffer AML NameString.\r
711**/\r
712VOID\r
713AmlPrintNameString (\r
714 IN UINT8 *Buffer\r
715 );\r
716\r
717/**\r
718 Print AML NameSeg.\r
719\r
720 @param[in] Buffer AML NameSeg.\r
721**/\r
722VOID\r
723AmlPrintNameSeg (\r
724 IN UINT8 *Buffer\r
725 );\r
726\r
727/**\r
728 Check if it is AML Root name\r
729\r
730 @param[in] Buffer AML path.\r
731 \r
732 @retval TRUE AML path is root.\r
733 @retval FALSE AML path is not root.\r
734**/\r
735BOOLEAN\r
736AmlIsRootPath (\r
737 IN UINT8 *Buffer\r
738 );\r
739\r
740#endif\r