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