TianoCore EDK2 master
Loading...
Searching...
No Matches
AmlParser.c
Go to the documentation of this file.
1
9#include <Parser/AmlParser.h>
10
11#include <AmlCoreInterface.h>
16#include <String/AmlString.h>
17#include <Tree/AmlNode.h>
18#include <Tree/AmlTree.h>
19
20/*
21 AML Tree
22 --------
23
24 Each ASL Statement is represented in AML as and ObjectNode.
25 Each ObjectNode has an Opcode and has up to six FixedArguments
26 followed by a list of VariableArguments.
27 (ObjectNode)
28 \
29 |- [0][1][2][3][4][5] # Fixed Arguments
30 |- {(VarArg1)->(VarArg2)->(VarArg3)->...N} # Variable Arguments
31
32 A RootNode is a special type of Object Node that does not have an
33 Opcode or Fixed Arguments. It only has a list of VariableArguments
34 (RootNode)
35 \
36 |- {(VarArg1)->(VarArg2)->(VarArg3)->...N} # Variable Arguments
37
38 A DataNode consists of a data buffer.
39
40 A FixedArgument or VariableArgument can be either an ObjectNode or
41 a DataNode.
42
43 Example:
44 ASL code sample:
45 Device (DEV0) {
46 Name (VAR0, 0x6)
47 }
48
49 Tree generated from the ASL code:
50 (RootNode)
51 \
52 |- {(Device statement (ObjectNode))} # Variable Arg of the
53 \ # RootNode
54 |
55 |- [0] - Device Name (DataNode)(="DEV0") # Fixed Arg0 of the
56 | # Device() statement
57 |
58 |- {(Name statement (ObjectNode))} # Variable Arg of the
59 \ # Device() statement
60 |
61 |- [0] - Name statement(DataNode)(="VAR0") # Fixed Arg0 of the
62 | # Name() statement
63 |- [1] - Value(DataNode)(=0x6) # Fixed Arg1 of the
64 # Name() statement
65*/
66
67// Forward declaration.
70EFIAPI
71AmlParseStream (
72 IN AML_NODE_HEADER *Node,
73 IN OUT AML_STREAM *FStream,
74 IN OUT LIST_ENTRY *NameSpaceRefList
75 );
76
101typedef
103(EFIAPI *AML_PARSE_FUNCTION)(
105 IN AML_PARSE_FORMAT ExpectedFormat,
106 IN OUT AML_STREAM *FStream,
107 OUT AML_NODE_HEADER **OutNode
108 );
109
128STATIC
130EFIAPI
132 IN CONST AML_NODE_HEADER *ParentNode,
133 IN AML_PARSE_FORMAT ExpectedFormat,
134 IN OUT AML_STREAM *FStream,
135 OUT AML_NODE_HEADER **OutNode
136 )
137{
138 EFI_STATUS Status;
139 UINT32 UIntXSize;
140
141 if ((!IS_AML_ROOT_NODE (ParentNode) &&
142 !IS_AML_OBJECT_NODE (ParentNode)) ||
143 ((ExpectedFormat != EAmlUInt8) &&
144 (ExpectedFormat != EAmlUInt16) &&
145 (ExpectedFormat != EAmlUInt32) &&
146 (ExpectedFormat != EAmlUInt64)) ||
147 !IS_STREAM (FStream) ||
148 IS_END_OF_STREAM (FStream) ||
149 !IS_STREAM_FORWARD (FStream) ||
150 (OutNode == NULL))
151 {
152 ASSERT (0);
153 return EFI_INVALID_PARAMETER;
154 }
155
156 switch (ExpectedFormat) {
157 case EAmlUInt8:
158 UIntXSize = 1;
159 break;
160 case EAmlUInt16:
161 UIntXSize = 2;
162 break;
163 case EAmlUInt32:
164 UIntXSize = 4;
165 break;
166 case EAmlUInt64:
167 UIntXSize = 8;
168 break;
169 default:
170 ASSERT (0);
171 return EFI_INVALID_PARAMETER;
172 }
173
174 Status = AmlCreateDataNode (
175 AmlTypeToNodeDataType (ExpectedFormat),
176 AmlStreamGetCurrPos (FStream),
177 UIntXSize,
178 (AML_DATA_NODE **)OutNode
179 );
180 if (EFI_ERROR (Status)) {
181 ASSERT (0);
182 return Status;
183 }
184
185 AMLDBG_DUMP_RAW (AmlStreamGetCurrPos (FStream), UIntXSize);
186
187 // Move stream forward by the size of UIntX.
188 Status = AmlStreamProgress (FStream, UIntXSize);
189 if (EFI_ERROR (Status)) {
190 AmlDeleteTree (*OutNode);
191 ASSERT (0);
192 }
193
194 return Status;
195}
196
215STATIC
217EFIAPI
219 IN CONST AML_NODE_HEADER *ParentNode,
220 IN AML_PARSE_FORMAT ExpectedFormat,
221 IN OUT AML_STREAM *FStream,
222 OUT AML_NODE_HEADER **OutNode
223 )
224{
225 EFI_STATUS Status;
226
227 CONST UINT8 *Buffer;
228 CONST AML_BYTE_ENCODING *ByteEncoding;
229 UINT32 StrSize;
230
231 if ((!IS_AML_ROOT_NODE (ParentNode) &&
232 !IS_AML_OBJECT_NODE (ParentNode)) ||
233 (ExpectedFormat != EAmlName) ||
234 !IS_STREAM (FStream) ||
235 IS_END_OF_STREAM (FStream) ||
236 !IS_STREAM_FORWARD (FStream) ||
237 (OutNode == NULL))
238 {
239 ASSERT (0);
240 return EFI_INVALID_PARAMETER;
241 }
242
243 Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
244 ByteEncoding = AmlGetByteEncoding (Buffer);
245 if ((ByteEncoding == NULL) ||
246 ((ByteEncoding->Attribute & AML_IS_NAME_CHAR) == 0))
247 {
248 ASSERT (0);
249 return EFI_INVALID_PARAMETER;
250 }
251
252 // Parse the NameString.
253 Status = AmlGetNameStringSize ((CONST CHAR8 *)Buffer, &StrSize);
254 if ((EFI_ERROR (Status)) ||
255 (StrSize > AmlStreamGetFreeSpace (FStream)))
256 {
257 ASSERT (0);
258 return EFI_INVALID_PARAMETER;
259 }
260
261 Status = AmlCreateDataNode (
263 Buffer,
264 StrSize,
265 (AML_DATA_NODE **)OutNode
266 );
267 if (EFI_ERROR (Status)) {
268 ASSERT (0);
269 return Status;
270 }
271
272 AMLDBG_DUMP_RAW (AmlStreamGetCurrPos (FStream), StrSize);
273
274 // Move the stream forward by StrSize.
275 Status = AmlStreamProgress (FStream, StrSize);
276 if (EFI_ERROR (Status)) {
277 AmlDeleteTree (*OutNode);
278 ASSERT (0);
279 }
280
281 return Status;
282}
283
302STATIC
304EFIAPI
306 IN CONST AML_NODE_HEADER *ParentNode,
307 IN AML_PARSE_FORMAT ExpectedFormat,
308 IN OUT AML_STREAM *FStream,
309 OUT AML_NODE_HEADER **OutNode
310 )
311{
312 EFI_STATUS Status;
313 UINT32 StrSize;
314 UINT8 Byte;
315 CONST UINT8 *Buffer;
316
317 if ((!IS_AML_ROOT_NODE (ParentNode) &&
318 !IS_AML_OBJECT_NODE (ParentNode)) ||
319 (ExpectedFormat != EAmlString) ||
320 !IS_STREAM (FStream) ||
321 IS_END_OF_STREAM (FStream) ||
322 !IS_STREAM_FORWARD (FStream) ||
323 (OutNode == NULL))
324 {
325 ASSERT (0);
326 return EFI_INVALID_PARAMETER;
327 }
328
329 Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
330 StrSize = 0;
331 // AML String is NULL terminated.
332 do {
333 // Reading the stream moves the stream forward as well.
334 Status = AmlStreamReadByte (FStream, &Byte);
335 if (EFI_ERROR (Status)) {
336 ASSERT (0);
337 return Status;
338 }
339
340 StrSize++;
341 } while (Byte != '\0');
342
343 AMLDBG_DUMP_RAW (Buffer, StrSize);
344
345 Status = AmlCreateDataNode (
346 AmlTypeToNodeDataType (ExpectedFormat),
347 Buffer,
348 StrSize,
349 (AML_DATA_NODE **)OutNode
350 );
351 ASSERT_EFI_ERROR (Status);
352
353 return Status;
354}
355
376STATIC
378EFIAPI
380 IN CONST AML_NODE_HEADER *ParentNode,
381 IN AML_PARSE_FORMAT ExpectedFormat,
382 IN OUT AML_STREAM *FStream,
383 OUT AML_NODE_HEADER **OutNode
384 )
385{
386 EFI_STATUS Status;
387
388 UINT8 OpCodeSize;
389 UINT32 PkgLength;
390 UINT32 PkgOffset;
391 UINT32 FreeSpace;
392
393 CONST AML_BYTE_ENCODING *AmlByteEncoding;
394 CONST UINT8 *Buffer;
395
396 if ((!IS_AML_ROOT_NODE (ParentNode) &&
397 !IS_AML_OBJECT_NODE (ParentNode)) ||
398 (ExpectedFormat != EAmlObject) ||
399 !IS_STREAM (FStream) ||
400 IS_END_OF_STREAM (FStream) ||
401 !IS_STREAM_FORWARD (FStream) ||
402 (OutNode == NULL))
403 {
404 ASSERT (0);
405 return EFI_INVALID_PARAMETER;
406 }
407
408 PkgLength = 0;
409
410 // 0. Get the AML Byte encoding.
411 AmlByteEncoding = AmlGetByteEncoding (AmlStreamGetCurrPos (FStream));
412 if (AmlByteEncoding == NULL) {
413 ASSERT (0);
414 return EFI_INVALID_PARAMETER;
415 }
416
417 // 1. Check for NameString.
418 // Indeed a NameString can be found when an AML object is expected.
419 // e.g. VAR0 = 3 // VAR0 is assigned an object which is a UINT.
420 // VAR1 = VAR2 // VAR2 is a NameString.
421 // If this is a NameString, return. A NameString can be a variable, a
422 // method invocation, etc.
423 if ((AmlByteEncoding->Attribute & AML_IS_NAME_CHAR) != 0) {
424 Status = AmlParseNameString (
425 ParentNode,
426 EAmlName,
427 FStream,
428 OutNode
429 );
430 if (EFI_ERROR (Status)) {
431 ASSERT (0);
432 }
433
434 return Status;
435 }
436
437 // 2. Determine the OpCode size to move the stream forward.
438 Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
439 if (*Buffer == AML_EXT_OP) {
440 OpCodeSize = 2;
441 } else {
442 OpCodeSize = 1;
443 }
444
445 Status = AmlStreamProgress (FStream, OpCodeSize);
446 if (EFI_ERROR (Status)) {
447 ASSERT (0);
448 return Status;
449 }
450
451 // Print the opcode.
452 AMLDBG_DUMP_RAW (Buffer, OpCodeSize);
453
454 if (!IS_END_OF_STREAM (FStream)) {
455 // 3. Parse the PkgLength field, if present.
456 if ((AmlByteEncoding->Attribute & AML_HAS_PKG_LENGTH) != 0) {
457 Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
458 PkgOffset = AmlGetPkgLength (Buffer, &PkgLength);
459 if (PkgOffset == 0) {
460 ASSERT (0);
461 return EFI_INVALID_PARAMETER;
462 }
463
464 // Print the package length.
465 AMLDBG_DUMP_RAW (Buffer, PkgOffset);
466
467 // Adjust the size of the stream if it is valid package length.
468 FreeSpace = AmlStreamGetFreeSpace (FStream);
469 if (FreeSpace > PkgLength) {
470 // Reduce the stream size by (FreeSpace - PkgLength) bytes.
471 AmlStreamReduceMaxBufferSize (FStream, FreeSpace - PkgLength);
472 } else if (FreeSpace != PkgLength) {
473 ASSERT (0);
474 return EFI_INVALID_PARAMETER;
475 }
476
477 Status = AmlStreamProgress (FStream, PkgOffset);
478 if (EFI_ERROR (Status)) {
479 ASSERT (0);
480 return Status;
481 }
482 }
483 } else if ((AmlByteEncoding->Attribute & AML_HAS_PKG_LENGTH) != 0) {
484 // The stream terminated unexpectedly. A PkgLen had to be parsed.
485 ASSERT (0);
486 return EFI_INVALID_PARAMETER;
487 }
488
489 // 4. Create an Object Node.
490 Status = AmlCreateObjectNode (
491 AmlByteEncoding,
492 PkgLength,
493 (AML_OBJECT_NODE **)OutNode
494 );
495 ASSERT_EFI_ERROR (Status);
496
497 return Status;
498}
499
520STATIC
522EFIAPI
524 IN CONST AML_NODE_HEADER *ParentNode,
525 IN AML_PARSE_FORMAT ExpectedFormat,
526 IN OUT AML_STREAM *FStream,
527 OUT AML_NODE_HEADER **OutNode
528 )
529{
530 EFI_STATUS Status;
531 EFI_STATUS Status1;
532 CONST UINT8 *Buffer;
533 UINT32 PkgOffset;
534 UINT32 PkgLength;
535
537 (CONST AML_OBJECT_NODE *)ParentNode,
539 ) ||
540 (ExpectedFormat != EAmlFieldPkgLen) ||
541 !IS_STREAM (FStream) ||
542 IS_END_OF_STREAM (FStream) ||
543 !IS_STREAM_FORWARD (FStream) ||
544 (OutNode == NULL))
545 {
546 ASSERT (0);
547 return EFI_INVALID_PARAMETER;
548 }
549
550 Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
551
552 PkgOffset = AmlGetPkgLength (Buffer, &PkgLength);
553 if (PkgOffset == 0) {
554 ASSERT (0);
555 return EFI_INVALID_PARAMETER;
556 }
557
558 // Warning: Since, updating of field elements is not supported, store the
559 // FieldPkgLength in a Data Node as a raw buffer.
560 Status = AmlCreateDataNode (
561 AmlTypeToNodeDataType (ExpectedFormat),
562 Buffer,
563 PkgOffset,
564 (AML_DATA_NODE **)OutNode
565 );
566 if (EFI_ERROR (Status)) {
567 ASSERT (0);
568 return Status;
569 }
570
571 AMLDBG_DUMP_RAW (Buffer, PkgOffset);
572
573 Status = AmlStreamProgress (FStream, PkgOffset);
574 if (EFI_ERROR (Status)) {
575 Status1 = AmlDeleteNode (*OutNode);
576 ASSERT_EFI_ERROR (Status1);
577 ASSERT (0);
578 }
579
580 return Status;
581}
582
590 NULL, // EAmlNone
591 AmlParseUIntX, // EAmlUInt8
592 AmlParseUIntX, // EAmlUInt16
593 AmlParseUIntX, // EAmlUInt32
594 AmlParseUIntX, // EAmlUInt64
595 AmlParseObject, // EAmlObject
596 AmlParseNameString, // EAmlName
597 AmlParseString, // EAmlString
598 AmlParseFieldPkgLen // EAmlFieldPkgLen
599};
600
619STATIC
621EFIAPI
623 IN CONST AML_NODE_HEADER *ParentNode,
624 IN AML_DATA_NODE *DataNode,
625 IN OUT LIST_ENTRY *NameSpaceRefList,
626 OUT AML_OBJECT_NODE **OutNode
627 )
628{
629 EFI_STATUS Status;
630 AML_NAMESPACE_REF_NODE *NameSpaceRefNode;
631 AML_OBJECT_NODE *MethodInvocationNode;
632 AML_STREAM FStream;
633
634 if ((!IS_AML_ROOT_NODE (ParentNode) &&
635 !IS_AML_OBJECT_NODE (ParentNode)) ||
636 !IS_AML_DATA_NODE (DataNode) ||
637 (DataNode->DataType != EAmlNodeDataTypeNameString) ||
638 (NameSpaceRefList == NULL) ||
639 (OutNode == NULL))
640 {
641 ASSERT (0);
642 return EFI_INVALID_PARAMETER;
643 }
644
645 // Initialize a stream containing the NameString which is checked.
646 Status = AmlStreamInit (
647 &FStream,
648 DataNode->Buffer,
649 DataNode->Size,
651 );
652 if (EFI_ERROR (Status)) {
653 ASSERT (0);
654 return Status;
655 }
656
657 // Check whether the NameString is a method invocation.
658 NameSpaceRefNode = NULL;
659 Status = AmlIsMethodInvocation (
660 ParentNode,
661 &FStream,
662 NameSpaceRefList,
663 &NameSpaceRefNode
664 );
665 if (EFI_ERROR (Status)) {
666 ASSERT (0);
667 return Status;
668 }
669
670 MethodInvocationNode = NULL;
671 if (NameSpaceRefNode != NULL) {
672 // A matching method definition has been found.
673 // Create a method invocation node.
675 NameSpaceRefNode,
676 (AML_DATA_NODE *)DataNode,
677 &MethodInvocationNode
678 );
679 if (EFI_ERROR (Status)) {
680 ASSERT (0);
681 return Status;
682 }
683 }
684
685 *OutNode = MethodInvocationNode;
686
687 return EFI_SUCCESS;
688}
689
710STATIC
712EFIAPI
714 IN CONST AML_NODE_HEADER *ParentNode,
715 IN AML_PARSE_FORMAT ExpectedFormat,
716 IN OUT AML_STREAM *FStream,
717 IN OUT LIST_ENTRY *NameSpaceRefList,
718 OUT AML_NODE_HEADER **OutNode
719 )
720{
721 EFI_STATUS Status;
722 AML_PARSE_FUNCTION ParsingFunction;
723 AML_DATA_NODE *DataNode;
724 AML_OBJECT_NODE *MethodInvocationNode;
725
726 if ((!IS_AML_ROOT_NODE (ParentNode) &&
727 !IS_AML_OBJECT_NODE (ParentNode)) ||
728 (ExpectedFormat >= EAmlParseFormatMax) ||
729 !IS_STREAM (FStream) ||
730 IS_END_OF_STREAM (FStream) ||
731 !IS_STREAM_FORWARD (FStream) ||
732 (NameSpaceRefList == NULL) ||
733 (OutNode == NULL))
734 {
735 ASSERT (0);
736 return EFI_INVALID_PARAMETER;
737 }
738
739 ParsingFunction = mParseType[ExpectedFormat];
740 if (ParsingFunction == NULL) {
741 ASSERT (0);
742 return EFI_INVALID_PARAMETER;
743 }
744
745 // Note: The ParsingFunction moves the stream forward as it
746 // consumes the AML bytecode
747 Status = ParsingFunction (
748 ParentNode,
749 ExpectedFormat,
750 FStream,
751 OutNode
752 );
753 if (EFI_ERROR (Status)) {
754 ASSERT (0);
755 return Status;
756 }
757
758 // Check whether the parsed argument is a NameString when an object
759 // is expected. In such case, it could be a method invocation.
760 DataNode = (AML_DATA_NODE *)*OutNode;
761 if (IS_AML_DATA_NODE (DataNode) &&
762 (DataNode->DataType == EAmlNodeDataTypeNameString) &&
763 (ExpectedFormat == EAmlObject))
764 {
766 ParentNode,
767 (AML_DATA_NODE *)*OutNode,
768 NameSpaceRefList,
769 &MethodInvocationNode
770 );
771 if (EFI_ERROR (Status)) {
772 ASSERT (0);
773 return Status;
774 }
775
776 // A method invocation node has been created and the DataNode containing
777 // the NameString has been attached to the MethodInvocationNode.
778 // Replace the OutNode with the MethodInvocationNode.
779 if (MethodInvocationNode != NULL) {
780 *OutNode = (AML_NODE_HEADER *)MethodInvocationNode;
781 }
782 }
783
784 return Status;
785}
786
801STATIC
803EFIAPI
805 IN AML_OBJECT_NODE *BufferNode,
806 IN OUT AML_STREAM *FStream
807 )
808{
809 EFI_STATUS Status;
810 AML_NODE_HEADER *NewNode;
811 CONST UINT8 *Buffer;
812 UINT32 BufferSize;
813
814 // Check whether the node is an Object Node and has byte list.
815 if (!AmlNodeHasAttribute (BufferNode, AML_HAS_BYTE_LIST) ||
816 !IS_STREAM (FStream) ||
817 IS_END_OF_STREAM (FStream) ||
818 !IS_STREAM_FORWARD (FStream))
819 {
820 ASSERT (0);
821 return EFI_INVALID_PARAMETER;
822 }
823
824 // The buffer contains a list of resource data elements.
825 if (AmlRdIsResourceDataBuffer (FStream)) {
826 // Parse the resource data elements and add them as data nodes.
827 // AmlParseResourceData() moves the stream forward.
828 Status = AmlParseResourceData (BufferNode, FStream);
829 if (EFI_ERROR (Status)) {
830 ASSERT (0);
831 }
832 } else {
833 // The buffer doesn't contain a list of resource data elements.
834 // Create a single node holding the whole buffer data.
835
836 // CreateDataNode checks the Buffer and BufferSize values.
837 Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
838 BufferSize = AmlStreamGetFreeSpace (FStream);
839
840 Status = AmlCreateDataNode (
842 Buffer,
843 BufferSize,
844 (AML_DATA_NODE **)&NewNode
845 );
846 if (EFI_ERROR (Status)) {
847 ASSERT (0);
848 return Status;
849 }
850
852 (AML_NODE_HEADER *)BufferNode,
853 NewNode
854 );
855 if (EFI_ERROR (Status)) {
856 ASSERT (0);
857 AmlDeleteTree (NewNode);
858 return Status;
859 }
860
861 AMLDBG_DUMP_RAW (Buffer, BufferSize);
862
863 // Move the stream forward as we have consumed the Buffer.
864 Status = AmlStreamProgress (FStream, BufferSize);
865 if (EFI_ERROR (Status)) {
866 ASSERT (0);
867 }
868 }
869
870 return Status;
871}
872
892EFIAPI
894 IN AML_OBJECT_NODE *ObjectNode,
895 IN AML_STREAM *FStream,
896 IN LIST_ENTRY *NameSpaceRefList
897 )
898{
899 EFI_STATUS Status;
900
901 AML_NODE_HEADER *FixedArgNode;
902 AML_STREAM FixedArgFStream;
903
904 EAML_PARSE_INDEX TermIndex;
905 EAML_PARSE_INDEX MaxIndex;
906 CONST AML_PARSE_FORMAT *Format;
907
908 // Fixed arguments of method invocations node are handled differently.
909 if (!IS_AML_OBJECT_NODE (ObjectNode) ||
910 AmlNodeCompareOpCode (ObjectNode, AML_METHOD_INVOC_OP, 0) ||
911 !IS_STREAM (FStream) ||
912 IS_END_OF_STREAM (FStream) ||
913 !IS_STREAM_FORWARD (FStream) ||
914 (NameSpaceRefList == NULL))
915 {
916 ASSERT (0);
917 return EFI_INVALID_PARAMETER;
918 }
919
920 TermIndex = EAmlParseIndexTerm0;
922 (AML_OBJECT_NODE *)ObjectNode
923 );
924 if ((ObjectNode->AmlByteEncoding != NULL) &&
925 (ObjectNode->AmlByteEncoding->Format != NULL))
926 {
927 Format = ObjectNode->AmlByteEncoding->Format;
928 } else {
929 ASSERT (0);
930 return EFI_INVALID_PARAMETER;
931 }
932
933 // Parse all the FixedArgs.
934 while ((TermIndex < MaxIndex) &&
935 !IS_END_OF_STREAM (FStream) &&
936 (Format[TermIndex] != EAmlNone))
937 {
938 // Initialize a FixedArgStream to parse the current fixed argument.
939 Status = AmlStreamInitSubStream (FStream, &FixedArgFStream);
940 if (EFI_ERROR (Status)) {
941 ASSERT (0);
942 return Status;
943 }
944
945 // Parse the current fixed argument.
946 Status = AmlParseArgument (
947 (CONST AML_NODE_HEADER *)ObjectNode,
948 Format[TermIndex],
949 &FixedArgFStream,
950 NameSpaceRefList,
951 &FixedArgNode
952 );
953 if (EFI_ERROR (Status)) {
954 ASSERT (0);
955 return Status;
956 }
957
958 // Add the fixed argument to the parent node's fixed argument list.
959 // FixedArgNode can be an object or data node.
960 Status = AmlSetFixedArgument (
961 (AML_OBJECT_NODE *)ObjectNode,
962 TermIndex,
963 FixedArgNode
964 );
965 if (EFI_ERROR (Status)) {
966 ASSERT (0);
967 // Delete the sub-tree if the insertion failed.
968 // Otherwise its reference will be lost.
969 // Use DeleteTree because if the argument was a method invocation,
970 // multiple nodes have been created.
971 AmlDeleteTree (FixedArgNode);
972 return Status;
973 }
974
975 // Parse the AML bytecode of the FixedArgNode if this is an object node.
976 if (IS_AML_OBJECT_NODE (FixedArgNode) &&
977 !IS_END_OF_STREAM (&FixedArgFStream))
978 {
979 Status = AmlParseStream (
980 FixedArgNode,
981 &FixedArgFStream,
982 NameSpaceRefList
983 );
984 if (EFI_ERROR (Status)) {
985 ASSERT (0);
986 return Status;
987 }
988 }
989
990 // Move the stream forward as we have consumed the sub-stream.
991 Status = AmlStreamProgress (
992 FStream,
993 AmlStreamGetIndex (&FixedArgFStream)
994 );
995 if (EFI_ERROR (Status)) {
996 ASSERT (0);
997 return Status;
998 }
999
1000 TermIndex++;
1001 } // while
1002
1003 return EFI_SUCCESS;
1004}
1005
1030EFIAPI
1032 IN AML_NODE_HEADER *Node,
1033 IN AML_STREAM *FStream,
1034 IN LIST_ENTRY *NameSpaceRefList
1035 )
1036{
1037 EFI_STATUS Status;
1038
1039 BOOLEAN IsMethodInvocation;
1040 UINT8 MethodInvocationArgCount;
1041
1042 AML_NODE_HEADER *VarArgNode;
1043 AML_STREAM VarArgFStream;
1044
1045 if ((!AmlNodeHasAttribute (
1046 (CONST AML_OBJECT_NODE *)Node,
1048 ) &&
1049 !IS_AML_ROOT_NODE (Node)) ||
1050 !IS_STREAM (FStream) ||
1051 IS_END_OF_STREAM (FStream) ||
1052 !IS_STREAM_FORWARD (FStream) ||
1053 (NameSpaceRefList == NULL))
1054 {
1055 ASSERT (0);
1056 return EFI_INVALID_PARAMETER;
1057 }
1058
1060 (CONST AML_OBJECT_NODE *)Node,
1061 &IsMethodInvocation,
1062 &MethodInvocationArgCount
1063 );
1064 if (EFI_ERROR (Status)) {
1065 ASSERT (0);
1066 return Status;
1067 }
1068
1069 // Parse variable arguments while the Stream is not empty.
1070 while (!IS_END_OF_STREAM (FStream)) {
1071 // If the number of variable arguments are counted, decrement the counter.
1072 if ((IsMethodInvocation) && (MethodInvocationArgCount-- == 0)) {
1073 return EFI_SUCCESS;
1074 }
1075
1076 // Initialize a VarArgStream to parse the current variable argument.
1077 Status = AmlStreamInitSubStream (FStream, &VarArgFStream);
1078 if (EFI_ERROR (Status)) {
1079 ASSERT (0);
1080 return Status;
1081 }
1082
1083 // Parse the current variable argument.
1084 Status = AmlParseArgument (
1085 Node,
1086 EAmlObject,
1087 &VarArgFStream,
1088 NameSpaceRefList,
1089 &VarArgNode
1090 );
1091 if (EFI_ERROR (Status)) {
1092 ASSERT (0);
1093 return Status;
1094 }
1095
1096 // Add the variable argument to its parent variable list of arguments.
1097 // VarArgNode can be an object or data node.
1098 Status = AmlVarListAddTailInternal (
1099 (AML_NODE_HEADER *)Node,
1100 VarArgNode
1101 );
1102 if (EFI_ERROR (Status)) {
1103 ASSERT (0);
1104 // Delete the sub-tree if the insertion failed.
1105 // Otherwise its reference will be lost.
1106 // Use DeleteTree because if the argument was a method invocation,
1107 // multiple nodes have been created.
1108 AmlDeleteTree (VarArgNode);
1109 return Status;
1110 }
1111
1112 // Parse the AML bytecode of the VarArgNode if this is an object node.
1113 if (IS_AML_OBJECT_NODE (VarArgNode) &&
1114 (!IS_END_OF_STREAM (&VarArgFStream)))
1115 {
1116 Status = AmlParseStream (VarArgNode, &VarArgFStream, NameSpaceRefList);
1117 if (EFI_ERROR (Status)) {
1118 ASSERT (0);
1119 return Status;
1120 }
1121 }
1122
1123 // Move the stream forward as we have consumed the sub-stream.
1124 Status = AmlStreamProgress (
1125 FStream,
1126 AmlStreamGetIndex (&VarArgFStream)
1127 );
1128 if (EFI_ERROR (Status)) {
1129 ASSERT (0);
1130 return Status;
1131 }
1132 } // while
1133
1134 // If the number of variable arguments are counted, check all the
1135 // MethodInvocationArgCount have been parsed.
1136 if (IsMethodInvocation && (MethodInvocationArgCount != 0)) {
1137 ASSERT (0);
1138 return EFI_INVALID_PARAMETER;
1139 }
1140
1141 return Status;
1142}
1143
1158STATIC
1160EFIAPI
1162 IN AML_ROOT_NODE *RootNode,
1163 IN OUT AML_STREAM *FStream,
1164 IN OUT LIST_ENTRY *NameSpaceRefList
1165 )
1166{
1167 EFI_STATUS Status;
1168
1169 if (!IS_AML_ROOT_NODE (RootNode) ||
1170 !IS_STREAM (FStream) ||
1171 IS_END_OF_STREAM (FStream) ||
1172 !IS_STREAM_FORWARD (FStream) ||
1173 (NameSpaceRefList == NULL))
1174 {
1175 ASSERT (0);
1176 return EFI_INVALID_PARAMETER;
1177 }
1178
1179 // A Root Node only has variable arguments.
1180 Status = AmlParseVariableArguments (
1181 (AML_NODE_HEADER *)RootNode,
1182 FStream,
1183 NameSpaceRefList
1184 );
1185 ASSERT_EFI_ERROR (Status);
1186
1187 return Status;
1188}
1189
1204STATIC
1206EFIAPI
1208 IN AML_OBJECT_NODE *ObjectNode,
1209 IN OUT AML_STREAM *FStream,
1210 IN OUT LIST_ENTRY *NameSpaceRefList
1211 )
1212{
1213 EFI_STATUS Status;
1214
1215 if (!IS_AML_OBJECT_NODE (ObjectNode) ||
1216 !IS_STREAM (FStream) ||
1217 IS_END_OF_STREAM (FStream) ||
1218 !IS_STREAM_FORWARD (FStream) ||
1219 (NameSpaceRefList == NULL))
1220 {
1221 ASSERT (0);
1222 return EFI_INVALID_PARAMETER;
1223 }
1224
1225 Status = EFI_SUCCESS;
1226
1227 // Don't parse the fixed arguments of method invocation nodes.
1228 // The AML encoding for method invocations in the ACPI specification 6.3 is:
1229 // MethodInvocation := NameString TermArgList
1230 // Since the AML specification does not define an OpCode for method
1231 // invocation, this AML parser defines a pseudo opcode and redefines the
1232 // grammar for simplicity as:
1233 // MethodInvocation := MethodInvocationOp NameString ArgumentCount TermArgList
1234 // ArgumentCount := ByteData
1235 // Due to this difference, the MethodInvocationOp and the fixed argument
1236 // i.e. ArgumentCount is not available in the AML stream and need to be
1237 // handled differently.
1238 if (!AmlNodeCompareOpCode (ObjectNode, AML_METHOD_INVOC_OP, 0)) {
1239 // Parse the fixed list of arguments.
1240 Status = AmlParseFixedArguments (
1241 ObjectNode,
1242 FStream,
1243 NameSpaceRefList
1244 );
1245 if (EFI_ERROR (Status)) {
1246 ASSERT (0);
1247 return Status;
1248 }
1249 }
1250
1251 // Save the association [node reference/pathname] in the NameSpaceRefList.
1252 // This allows to identify method invocations from other namespace
1253 // paths. Method invocation need to be parsed differently.
1255 (CONST AML_OBJECT_NODE *)ObjectNode,
1257 ))
1258 {
1259 Status = AmlAddNameSpaceReference (
1260 (CONST AML_OBJECT_NODE *)ObjectNode,
1261 NameSpaceRefList
1262 );
1263 if (EFI_ERROR (Status)) {
1264 ASSERT (0);
1265 return Status;
1266 }
1267 }
1268
1269 if (!IS_END_OF_STREAM (FStream)) {
1270 // Parse the variable list of arguments if present.
1271 if (AmlNodeHasAttribute (ObjectNode, AML_HAS_CHILD_OBJ)) {
1272 Status = AmlParseVariableArguments (
1273 (AML_NODE_HEADER *)ObjectNode,
1274 FStream,
1275 NameSpaceRefList
1276 );
1277 } else if (AmlNodeHasAttribute (ObjectNode, AML_HAS_BYTE_LIST)) {
1278 // Parse the byte list if present.
1279 Status = AmlParseByteList (
1280 ObjectNode,
1281 FStream
1282 );
1283 } else if (AmlNodeHasAttribute (ObjectNode, AML_HAS_FIELD_LIST)) {
1284 // Parse the field list if present.
1285 Status = AmlParseFieldList (
1286 ObjectNode,
1287 FStream,
1288 NameSpaceRefList
1289 );
1290 }
1291
1292 // Check status and assert
1293 if (EFI_ERROR (Status)) {
1294 ASSERT (0);
1295 }
1296 }
1297
1298 return Status;
1299}
1300
1315STATIC
1317EFIAPI
1318AmlParseStream (
1319 IN AML_NODE_HEADER *Node,
1320 IN AML_STREAM *FStream,
1321 IN LIST_ENTRY *NameSpaceRefList
1322 )
1323{
1324 EFI_STATUS Status;
1325
1326 if (IS_AML_ROOT_NODE (Node)) {
1327 Status = AmlPopulateRootNode (
1328 (AML_ROOT_NODE *)Node,
1329 FStream,
1330 NameSpaceRefList
1331 );
1332 if (EFI_ERROR (Status)) {
1333 ASSERT (0);
1334 }
1335 } else if (IS_AML_OBJECT_NODE (Node)) {
1336 Status = AmlPopulateObjectNode (
1337 (AML_OBJECT_NODE *)Node,
1338 FStream,
1339 NameSpaceRefList
1340 );
1341 if (EFI_ERROR (Status)) {
1342 ASSERT (0);
1343 }
1344 } else {
1345 // Data node or other.
1346 ASSERT (0);
1347 Status = EFI_INVALID_PARAMETER;
1348 }
1349
1350 return Status;
1351}
1352
1369EFIAPI
1371 IN CONST EFI_ACPI_DESCRIPTION_HEADER *DefinitionBlock,
1372 OUT AML_ROOT_NODE **RootPtr
1373 )
1374{
1375 EFI_STATUS Status;
1376 EFI_STATUS Status1;
1377 AML_STREAM Stream;
1378 AML_ROOT_NODE *Root;
1379
1380 LIST_ENTRY NameSpaceRefList;
1381
1382 UINT8 *Buffer;
1383 UINT32 MaxBufferSize;
1384
1385 if ((DefinitionBlock == NULL) ||
1386 (RootPtr == NULL))
1387 {
1388 ASSERT (0);
1389 return EFI_INVALID_PARAMETER;
1390 }
1391
1392 Buffer = (UINT8 *)DefinitionBlock + sizeof (EFI_ACPI_DESCRIPTION_HEADER);
1393 if (DefinitionBlock->Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER)) {
1394 ASSERT (0);
1395 return EFI_INVALID_PARAMETER;
1396 }
1397
1398 MaxBufferSize = DefinitionBlock->Length -
1399 (UINT32)sizeof (EFI_ACPI_DESCRIPTION_HEADER);
1400
1401 // Create a root node.
1402 Status = AmlCreateRootNode (
1403 (EFI_ACPI_DESCRIPTION_HEADER *)DefinitionBlock,
1404 &Root
1405 );
1406 if (EFI_ERROR (Status)) {
1407 ASSERT (0);
1408 return Status;
1409 }
1410
1411 *RootPtr = Root;
1412
1413 if (MaxBufferSize == 0) {
1414 return EFI_SUCCESS;
1415 }
1416
1417 // Initialize a stream to parse the AML bytecode.
1418 Status = AmlStreamInit (
1419 &Stream,
1420 Buffer,
1421 MaxBufferSize,
1423 );
1424 if (EFI_ERROR (Status)) {
1425 ASSERT (0);
1426 goto error_handler;
1427 }
1428
1429 // Initialize the NameSpaceRefList, holding references to nodes declaring
1430 // a name in the AML namespace.
1431 InitializeListHead (&NameSpaceRefList);
1432
1433 // Parse the whole AML blob.
1434 Status = AmlParseStream (
1435 (AML_NODE_HEADER *)Root,
1436 &Stream,
1437 &NameSpaceRefList
1438 );
1439 if (EFI_ERROR (Status)) {
1440 ASSERT (0);
1441 goto error_handler;
1442 }
1443
1444 // Check the whole AML blob has been parsed.
1445 if (!IS_END_OF_STREAM (&Stream)) {
1446 ASSERT (0);
1447 Status = EFI_INVALID_PARAMETER;
1448 goto error_handler;
1449 }
1450
1451 // Print the list of NameSpace reference nodes.
1452 // AmlDbgPrintNameSpaceRefList (&NameSpaceRefList);
1453
1454 // Delete the NameSpaceRefList
1455 goto exit_handler;
1456
1457error_handler:
1458 if (Root != NULL) {
1460 }
1461
1462exit_handler:
1463 Status1 = AmlDeleteNameSpaceRefList (&NameSpaceRefList);
1464 if (EFI_ERROR (Status1)) {
1465 ASSERT (0);
1466 if (!EFI_ERROR (Status)) {
1467 return Status1;
1468 }
1469 }
1470
1471 return Status;
1472}
#define AML_IS_NAME_CHAR
Definition: Aml.h:70
#define AML_IS_FIELD_ELEMENT
Definition: Aml.h:93
enum EAmlParseFormat AML_PARSE_FORMAT
#define AML_HAS_CHILD_OBJ
Definition: Aml.h:75
#define AML_HAS_PKG_LENGTH
Definition: Aml.h:64
#define AML_IN_NAMESPACE
Definition: Aml.h:98
#define AML_HAS_BYTE_LIST
Definition: Aml.h:82
#define AML_HAS_FIELD_LIST
Definition: Aml.h:88
@ EAmlParseFormatMax
Max enum.
Definition: Aml.h:51
@ EAmlUInt64
Eight byte value evaluated as a UINT64.
Definition: Aml.h:38
@ EAmlName
Definition: Aml.h:44
@ EAmlObject
Definition: Aml.h:39
@ EAmlUInt8
One byte value evaluated as a UINT8.
Definition: Aml.h:35
@ EAmlFieldPkgLen
Definition: Aml.h:47
@ EAmlString
NULL terminated string.
Definition: Aml.h:46
@ EAmlNone
No data expected.
Definition: Aml.h:34
@ EAmlUInt16
Two byte value evaluated as a UINT16.
Definition: Aml.h:36
@ EAmlUInt32
Four byte value evaluated as a UINT32.
Definition: Aml.h:37
EFI_STATUS EFIAPI AmlParseFieldList(IN AML_OBJECT_NODE *FieldNode, IN AML_STREAM *FStream, IN LIST_ENTRY *NameSpaceRefList)
EFI_STATUS EFIAPI AmlCreateMethodInvocationNode(IN CONST AML_NAMESPACE_REF_NODE *NameSpaceRefNode, IN AML_DATA_NODE *MethodInvocationName, OUT AML_OBJECT_NODE **MethodInvocationNodePtr)
EFI_STATUS EFIAPI AmlGetMethodInvocationArgCount(IN CONST AML_OBJECT_NODE *MethodInvocationNode, OUT BOOLEAN *IsMethodInvocation, OUT UINT8 *ArgCount)
EFI_STATUS EFIAPI AmlAddNameSpaceReference(IN CONST AML_OBJECT_NODE *Node, IN OUT LIST_ENTRY *NameSpaceRefList)
EFI_STATUS EFIAPI AmlIsMethodInvocation(IN CONST AML_NODE_HEADER *ParentNode, IN CONST AML_STREAM *FStream, IN CONST LIST_ENTRY *NameSpaceRefList, OUT AML_NAMESPACE_REF_NODE **OutNameSpaceRefNode)
EFI_STATUS EFIAPI AmlDeleteNameSpaceRefList(IN LIST_ENTRY *NameSpaceRefList)
BOOLEAN EFIAPI AmlNodeCompareOpCode(IN CONST AML_OBJECT_NODE *ObjectNode, IN UINT8 OpCode, IN UINT8 SubOpCode)
Definition: AmlNode.c:457
EFI_STATUS EFIAPI AmlCreateObjectNode(IN CONST AML_BYTE_ENCODING *AmlByteEncoding, IN UINT32 PkgLength, OUT AML_OBJECT_NODE **NewObjectNodePtr)
Definition: AmlNode.c:181
EFI_STATUS EFIAPI AmlDeleteNode(IN AML_NODE_HEADER *Node)
Definition: AmlNode.c:339
BOOLEAN EFIAPI AmlNodeHasAttribute(IN CONST AML_OBJECT_NODE *ObjectNode, IN AML_OP_ATTRIBUTE Attribute)
Definition: AmlNode.c:430
EFI_STATUS EFIAPI AmlCreateRootNode(IN CONST EFI_ACPI_DESCRIPTION_HEADER *SdtHeader, OUT AML_ROOT_NODE **NewRootNodePtr)
Definition: AmlNode.c:92
EFI_STATUS EFIAPI AmlCreateDataNode(IN EAML_NODE_DATA_TYPE DataType, IN CONST UINT8 *Data, IN UINT32 DataSize, OUT AML_DATA_NODE **NewDataNodePtr)
Definition: AmlNode.c:275
#define IS_AML_ROOT_NODE(Node)
#define IS_AML_OBJECT_NODE(Node)
#define IS_AML_DATA_NODE(Node)
STATIC EFI_STATUS EFIAPI AmlPopulateObjectNode(IN AML_OBJECT_NODE *ObjectNode, IN OUT AML_STREAM *FStream, IN OUT LIST_ENTRY *NameSpaceRefList)
Definition: AmlParser.c:1207
STATIC EFI_STATUS EFIAPI AmlParseString(IN CONST AML_NODE_HEADER *ParentNode, IN AML_PARSE_FORMAT ExpectedFormat, IN OUT AML_STREAM *FStream, OUT AML_NODE_HEADER **OutNode)
Definition: AmlParser.c:305
STATIC EFI_STATUS EFIAPI AmlParseNameString(IN CONST AML_NODE_HEADER *ParentNode, IN AML_PARSE_FORMAT ExpectedFormat, IN OUT AML_STREAM *FStream, OUT AML_NODE_HEADER **OutNode)
Definition: AmlParser.c:218
STATIC EFI_STATUS EFIAPI AmlParseByteList(IN AML_OBJECT_NODE *BufferNode, IN OUT AML_STREAM *FStream)
Definition: AmlParser.c:804
EFI_STATUS EFIAPI AmlParseFixedArguments(IN AML_OBJECT_NODE *ObjectNode, IN AML_STREAM *FStream, IN LIST_ENTRY *NameSpaceRefList)
Definition: AmlParser.c:893
EFI_STATUS EFIAPI AmlParseVariableArguments(IN AML_NODE_HEADER *Node, IN AML_STREAM *FStream, IN LIST_ENTRY *NameSpaceRefList)
Definition: AmlParser.c:1031
STATIC EFI_STATUS EFIAPI AmlPopulateRootNode(IN AML_ROOT_NODE *RootNode, IN OUT AML_STREAM *FStream, IN OUT LIST_ENTRY *NameSpaceRefList)
Definition: AmlParser.c:1161
AML_PARSE_FUNCTION mParseType[EAmlParseFormatMax]
Definition: AmlParser.c:589
STATIC EFI_STATUS EFIAPI AmlParseUIntX(IN CONST AML_NODE_HEADER *ParentNode, IN AML_PARSE_FORMAT ExpectedFormat, IN OUT AML_STREAM *FStream, OUT AML_NODE_HEADER **OutNode)
Definition: AmlParser.c:131
STATIC EFI_STATUS EFIAPI AmlParseObject(IN CONST AML_NODE_HEADER *ParentNode, IN AML_PARSE_FORMAT ExpectedFormat, IN OUT AML_STREAM *FStream, OUT AML_NODE_HEADER **OutNode)
Definition: AmlParser.c:379
EFI_STATUS(EFIAPI * AML_PARSE_FUNCTION)(IN CONST AML_NODE_HEADER *Node, IN AML_PARSE_FORMAT ExpectedFormat, IN OUT AML_STREAM *FStream, OUT AML_NODE_HEADER **OutNode)
Definition: AmlParser.c:103
STATIC EFI_STATUS EFIAPI AmlParseArgument(IN CONST AML_NODE_HEADER *ParentNode, IN AML_PARSE_FORMAT ExpectedFormat, IN OUT AML_STREAM *FStream, IN OUT LIST_ENTRY *NameSpaceRefList, OUT AML_NODE_HEADER **OutNode)
Definition: AmlParser.c:713
EFI_STATUS EFIAPI AmlParseDefinitionBlock(IN CONST EFI_ACPI_DESCRIPTION_HEADER *DefinitionBlock, OUT AML_ROOT_NODE **RootPtr)
Definition: AmlParser.c:1370
STATIC EFI_STATUS EFIAPI AmlParseFieldPkgLen(IN CONST AML_NODE_HEADER *ParentNode, IN AML_PARSE_FORMAT ExpectedFormat, IN OUT AML_STREAM *FStream, OUT AML_NODE_HEADER **OutNode)
Definition: AmlParser.c:523
STATIC EFI_STATUS EFIAPI AmlCheckAndParseMethodInvoc(IN CONST AML_NODE_HEADER *ParentNode, IN AML_DATA_NODE *DataNode, IN OUT LIST_ENTRY *NameSpaceRefList, OUT AML_OBJECT_NODE **OutNode)
Definition: AmlParser.c:622
EFI_STATUS EFIAPI AmlParseResourceData(IN AML_OBJECT_NODE *BufferNode, IN AML_STREAM *FStream)
BOOLEAN EFIAPI AmlRdIsResourceDataBuffer(IN CONST AML_STREAM *FStream)
UINT32 EFIAPI AmlStreamGetIndex(IN CONST AML_STREAM *Stream)
Definition: AmlStream.c:222
EFI_STATUS EFIAPI AmlStreamReadByte(IN AML_STREAM *Stream, OUT UINT8 *OutByte)
Definition: AmlStream.c:461
UINT32 EFIAPI AmlStreamGetFreeSpace(IN CONST AML_STREAM *Stream)
Definition: AmlStream.c:292
EFI_STATUS EFIAPI AmlStreamProgress(IN AML_STREAM *Stream, IN UINT32 Offset)
Definition: AmlStream.c:324
UINT8 *EFIAPI AmlStreamGetCurrPos(IN CONST AML_STREAM *Stream)
Definition: AmlStream.c:264
EFI_STATUS EFIAPI AmlStreamReduceMaxBufferSize(IN AML_STREAM *Stream, IN UINT32 Diff)
Definition: AmlStream.c:190
EFI_STATUS EFIAPI AmlStreamInitSubStream(IN CONST AML_STREAM *Stream, OUT AML_STREAM *SubStream)
Definition: AmlStream.c:109
EFI_STATUS EFIAPI AmlStreamInit(IN OUT AML_STREAM *Stream, IN UINT8 *Buffer, IN UINT32 MaxBufferSize, IN EAML_STREAM_DIRECTION Direction)
Definition: AmlStream.c:25
#define IS_STREAM_FORWARD(Stream)
Definition: AmlStream.h:91
@ EAmlStreamDirectionForward
Definition: AmlStream.h:20
#define IS_STREAM(Stream)
Definition: AmlStream.h:69
#define IS_END_OF_STREAM(Stream)
Definition: AmlStream.h:80
EFI_STATUS EFIAPI AmlSetFixedArgument(IN AML_OBJECT_NODE *ObjectNode, IN EAML_PARSE_INDEX Index, IN AML_NODE_HEADER *NewNode)
Definition: AmlTree.c:168
EFI_STATUS EFIAPI AmlVarListAddTailInternal(IN AML_NODE_HEADER *ParentNode, IN AML_NODE_HEADER *NewNode)
Definition: AmlTree.c:379
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
Definition: String.c:72
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
Definition: LinkedList.c:182
EAML_NODE_DATA_TYPE EFIAPI AmlTypeToNodeDataType(IN AML_PARSE_FORMAT AmlType)
Definition: Aml.c:596
UINT32 EFIAPI AmlGetPkgLength(IN CONST UINT8 *Buffer, OUT UINT32 *PkgLength)
Definition: Aml.c:621
CONST AML_BYTE_ENCODING *EFIAPI AmlGetByteEncoding(IN CONST UINT8 *Buffer)
Definition: Aml.c:290
EFI_STATUS EFIAPI AmlGetNameStringSize(IN CONST CHAR8 *AmlPath, OUT UINT32 *AmlPathSizePtr)
Definition: AmlString.c:547
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define STATIC
Definition: Base.h:264
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
UINT8 AmlGetFixedArgumentCount(IN AML_OBJECT_NODE_HANDLE Node)
#define AML_METHOD_INVOC_OP
Definition: AmlDefines.h:120
enum EAmlParseIndex EAML_PARSE_INDEX
@ EAmlParseIndexTerm0
First fixed argument index.
Definition: AmlDefines.h:65
@ EAmlNodeDataTypeRaw
Raw bytes contained in a buffer.
Definition: AmlDefines.h:43
@ EAmlNodeDataTypeNameString
Definition: AmlDefines.h:37
EFI_STATUS EFIAPI AmlDeleteTree(IN AML_NODE_HANDLE Node)
EAML_NODE_DATA_TYPE DataType
UINT8 * Buffer
Pointer to a buffer.
Definition: AmlStream.h:34