36 if (NameSpaceRefNode ==
NULL) {
38 return EFI_INVALID_PARAMETER;
41 if (NameSpaceRefNode->RawAbsolutePath !=
NULL) {
42 FreePool ((CHAR8 *)NameSpaceRefNode->RawAbsolutePath);
45 return EFI_INVALID_PARAMETER;
68 if (NameSpaceRefList ==
NULL) {
70 return EFI_INVALID_PARAMETER;
74 CurrentLink = NameSpaceRefList->ForwardLink;
79 if (EFI_ERROR (Status)) {
110 IN CONST CHAR8 *RawAbsolutePath,
111 IN UINT32 RawAbsolutePathSize,
118 (RawAbsolutePath ==
NULL) ||
119 (RawAbsolutePathSize == 0) ||
120 (NameSpaceRefNodePtr ==
NULL))
123 return EFI_INVALID_PARAMETER;
127 if (NameSpaceRefNode ==
NULL) {
129 return EFI_OUT_OF_RESOURCES;
140 return EFI_OUT_OF_RESOURCES;
145 NameSpaceRefNode->
NodeRef = ObjectNode;
146 *NameSpaceRefNodePtr = NameSpaceRefNode;
151#if !defined (MDEPKG_NDEBUG)
166 if (NameSpaceRefList ==
NULL) {
171 DEBUG ((DEBUG_INFO,
"AmlMethodParser: List of available raw AML paths:\n"));
173 CurrLink = NameSpaceRefList->ForwardLink;
174 while (CurrLink != NameSpaceRefList) {
182 DEBUG ((DEBUG_INFO,
"\n"));
184 CurrLink = CurrLink->ForwardLink;
187 DEBUG ((DEBUG_INFO,
"\n"));
225 UINT8 *RawPathBuffer;
235 (RawPathNameBStream ==
NULL))
238 return EFI_INVALID_PARAMETER;
242 if (Buffer ==
NULL) {
244 return EFI_INVALID_PARAMETER;
254 if (EFI_ERROR (Status)) {
265 if (RawPathBuffer ==
NULL) {
267 return EFI_INVALID_PARAMETER;
274 (SegCount * AML_NAME_SEG_SIZE),
327 (OutNamedNode ==
NULL))
330 return EFI_INVALID_PARAMETER;
346 if (EFI_ERROR (Status)) {
353 Node = NameSpaceNode;
397 UINT8 *RawPathBuffer;
398 CONST CHAR8 *CurrPos;
414 return EFI_INVALID_PARAMETER;
418 if (CurrPos ==
NULL) {
420 return EFI_INVALID_PARAMETER;
430 if (EFI_ERROR (Status)) {
447 SegCount * AML_NAME_SEG_SIZE
449 if (EFI_ERROR (Status)) {
462 if (EFI_ERROR (Status)) {
499 OUT UINT32 *CompareCount
517 (CompareCount ==
NULL))
520 return EFI_INVALID_PARAMETER;
524 if ((Stream1Size & (AML_NAME_SEG_SIZE - 1)) != 0) {
526 return EFI_INVALID_PARAMETER;
530 if ((Stream2Size & (AML_NAME_SEG_SIZE - 1)) != 0) {
532 return EFI_INVALID_PARAMETER;
536 if (EFI_ERROR (Status)) {
542 if (EFI_ERROR (Status)) {
547 CompareLen =
MIN (Stream1Size, Stream2Size);
550 while (Index < CompareLen) {
563 if (EFI_ERROR (Status)) {
569 if (EFI_ERROR (Status)) {
574 Index += AML_NAME_SEG_SIZE;
577 *CompareCount = Index;
623 (NameSpaceRefList ==
NULL) ||
624 (OutNameSpaceRefNode ==
NULL))
627 return EFI_INVALID_PARAMETER;
636 if (DataNode ==
NULL) {
638 return EFI_INVALID_PARAMETER;
648 if (EFI_ERROR (Status)) {
661 if (EFI_ERROR (Status)) {
736 UINT32 NameSegScopeCount;
737 UINT32 PathNameSegScopeCount;
738 UINT32 ProbedScopeCount;
739 UINT32 BestScopeCount;
747 if (!
IS_STREAM (RawAbsolutePathFStream) ||
751 (AML_NAME_SEG_SIZE - 1)) != 0) ||
756 (AML_NAME_SEG_SIZE - 1)) != 0) ||
757 (NameSpaceRefList ==
NULL) ||
758 (OutNameSpaceRefNode ==
NULL))
761 return EFI_INVALID_PARAMETER;
764 DEBUG ((DEBUG_VERBOSE,
"AmlMethodParser: Checking absolute name: "));
770 DEBUG ((DEBUG_VERBOSE,
".\n"));
772 BestNameSpaceRefNode =
NULL;
778 DEBUG ((DEBUG_VERBOSE,
"AmlMethodParser: Comparing with: "));
779 NextLink = NameSpaceRefList->ForwardLink;
780 while (NextLink != NameSpaceRefList) {
789 DEBUG ((DEBUG_VERBOSE,
"; "));
796 NextLink = NextLink->ForwardLink;
805 &ProbedRawAbsoluteBStream,
810 if (EFI_ERROR (Status)) {
818 &ProbedRawAbsoluteBStream,
822 NextLink = NextLink->ForwardLink;
837 &ProbedRawAbsoluteFStream,
842 if (EFI_ERROR (Status)) {
849 RawAbsolutePathFStream,
850 &ProbedRawAbsoluteFStream,
853 if (EFI_ERROR (Status)) {
855 return EFI_INVALID_PARAMETER;
858 if (ProbedScopeCount == NameSegScopeCount) {
860 BestNameSpaceRefNode = ProbedNameSpaceRefNode;
862 }
else if (ProbedScopeCount > BestScopeCount) {
865 BestScopeCount = ProbedScopeCount;
866 BestNameSpaceRefNode = ProbedNameSpaceRefNode;
867 }
else if (ProbedScopeCount == BestScopeCount) {
870 if (ProbedScopeCount == 0) {
872 BestNameSpaceRefNode = ProbedNameSpaceRefNode;
891 BestScopeCount = ProbedScopeCount;
892 BestNameSpaceRefNode = ProbedNameSpaceRefNode;
897 return EFI_INVALID_PARAMETER;
902 NextLink = NextLink->ForwardLink;
905 DEBUG ((DEBUG_VERBOSE,
"\n"));
908 if (BestNameSpaceRefNode !=
NULL) {
910 *OutNameSpaceRefNode = BestNameSpaceRefNode;
924 if (EFI_ERROR (Status)) {
931 *OutNameSpaceRefNode =
NULL;
978 UINT8 *RawAbsolutePathBuffer;
979 UINT32 RawAbsolutePathBufferSize;
988 (NameSpaceRefList ==
NULL) ||
989 (OutNameSpaceRefNode ==
NULL))
992 return EFI_INVALID_PARAMETER;
1001 *OutNameSpaceRefNode =
NULL;
1008 if (RawAbsolutePathBuffer ==
NULL) {
1010 return EFI_OUT_OF_RESOURCES;
1015 &RawAbsolutePathBStream,
1016 RawAbsolutePathBuffer,
1017 RawAbsolutePathBufferSize,
1020 if (EFI_ERROR (Status)) {
1029 &RawAbsolutePathBStream
1031 if (EFI_ERROR (Status)) {
1041 "Root node cannot be a method invocation\n"
1043 *OutNameSpaceRefNode =
NULL;
1052 &RawAbsolutePathFStream,
1057 if (EFI_ERROR (Status)) {
1067 if (EFI_ERROR (Status)) {
1074 NameSpaceRefNode =
NULL;
1076 &RawAbsolutePathFStream,
1077 &RawPathNameBStream,
1081 if (EFI_ERROR (Status)) {
1086 #if !defined (MDEPKG_NDEBUG)
1088 if (NameSpaceRefNode !=
NULL) {
1091 "AmlMethodParser: Corresponding method definition: "
1093 AMLDBG_PRINT_CHARS (
1098 DEBUG ((DEBUG_VERBOSE,
".\n"));
1100 DEBUG ((DEBUG_VERBOSE,
"AmlMethodParser: No method definition found.\n"));
1105 *OutNameSpaceRefNode = NameSpaceRefNode;
1143 UINT32 RawAbsolutePathBStreamSize;
1145 CHAR8 *AbsolutePathBuffer;
1146 UINT32 AbsolutePathBufferSize;
1151 (NameSpaceRefList ==
NULL))
1154 return EFI_INVALID_PARAMETER;
1161 if (AbsolutePathBuffer ==
NULL) {
1163 return EFI_OUT_OF_RESOURCES;
1167 &RawAbsolutePathBStream,
1168 (UINT8 *)AbsolutePathBuffer,
1169 AbsolutePathBufferSize,
1172 if (EFI_ERROR (Status)) {
1174 Status = EFI_INVALID_PARAMETER;
1181 if (EFI_ERROR (Status)) {
1183 Status = EFI_INVALID_PARAMETER;
1196 Status = EFI_INVALID_PARAMETER;
1208 if (EFI_ERROR (Status)) {
1210 Status = EFI_INVALID_PARAMETER;
1215 if (ParentNode ==
NULL) {
1217 Status = EFI_INVALID_PARAMETER;
1225 &RawAbsolutePathBStream
1227 if (EFI_ERROR (Status)) {
1234 if (RawAbsolutePathBStreamSize == 0) {
1243 RawAbsolutePathBStreamSize,
1246 if (EFI_ERROR (Status)) {
1256 "AmlMethodParser: Adding namespace reference with name:\n"
1258 AMLDBG_PRINT_CHARS (
1263 DEBUG ((DEBUG_VERBOSE,
"\n"));
1316 if ((NameSpaceRefNode ==
NULL) ||
1320 (MethodInvocationNodePtr ==
NULL))
1323 return EFI_INVALID_PARAMETER;
1328 FixedArgs = MethodDefinitionNode->
FixedArgs;
1342 ArgCount = *((UINT8 *)ArgCountNode->
Buffer) & 0x7;
1353 ArgCount = *((UINT8 *)ArgCountNode->
Buffer);
1356 return EFI_INVALID_PARAMETER;
1367 &MethodInvocationNode
1369 if (EFI_ERROR (Status)) {
1376 MethodInvocationNode,
1380 if (EFI_ERROR (Status)) {
1387 ArgCountNode =
NULL;
1394 if (EFI_ERROR (Status)) {
1401 MethodInvocationNode,
1405 if (EFI_ERROR (Status)) {
1410 *MethodInvocationNodePtr = MethodInvocationNode;
1416 if (ArgCountNode !=
NULL) {
1445 OUT BOOLEAN *IsMethodInvocation,
1452 (IsMethodInvocation ==
NULL) ||
1456 return EFI_INVALID_PARAMETER;
1461 *IsMethodInvocation =
FALSE;
1477 (NumArgsNode->
Size != 1))
1480 return EFI_INVALID_PARAMETER;
1483 *ArgCount = *NumArgsNode->
Buffer;
1485 *IsMethodInvocation =
TRUE;
#define AML_HAS_FIELD_LIST
STATIC EFI_STATUS EFIAPI AmlInitRawPathBStream(IN CONST AML_STREAM *FStream, OUT AML_STREAM *RawPathNameBStream)
EFI_STATUS EFIAPI AmlCreateMethodInvocationNode(IN CONST AML_NAMESPACE_REF_NODE *NameSpaceRefNode, IN AML_DATA_NODE *MethodInvocationName, OUT AML_OBJECT_NODE **MethodInvocationNodePtr)
STATIC EFI_STATUS EFIAPI AmlDeleteNameSpaceRefNode(IN AML_NAMESPACE_REF_NODE *NameSpaceRefNode)
STATIC EFI_STATUS EFIAPI AmlFindMethodDefinition(IN CONST AML_STREAM *RawAbsolutePathFStream, IN CONST AML_STREAM *RawPathNameBStream, IN CONST LIST_ENTRY *NameSpaceRefList, OUT AML_NAMESPACE_REF_NODE **OutNameSpaceRefNode)
STATIC EFI_STATUS EFIAPI AmlCompareRawNameString(IN CONST AML_STREAM *RawFStream1, IN CONST AML_STREAM *RawFStream2, OUT UINT32 *CompareCount)
STATIC EFI_STATUS EFIAPI AmlResolveAliasMethod(IN CONST AML_OBJECT_NODE *AliasNode, IN CONST LIST_ENTRY *NameSpaceRefList, OUT AML_NAMESPACE_REF_NODE **OutNameSpaceRefNode)
STATIC EFI_STATUS EFIAPI AmlBuildRawMethodAbsolutePath(IN CONST AML_NODE_HEADER *ParentNode, IN CONST AML_STREAM *PathnameFStream, IN OUT AML_STREAM *AbsolutePathBStream)
EFI_STATUS EFIAPI AmlGetMethodInvocationArgCount(IN CONST AML_OBJECT_NODE *MethodInvocationNode, OUT BOOLEAN *IsMethodInvocation, OUT UINT8 *ArgCount)
STATIC EFI_STATUS EFIAPI AmlGetFirstNamedAncestorNode(IN CONST AML_NODE_HEADER *Node, OUT AML_NODE_HEADER **OutNamedNode)
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)
VOID EFIAPI AmlDbgPrintNameSpaceRefList(IN CONST LIST_ENTRY *NameSpaceRefList)
STATIC EFI_STATUS EFIAPI AmlCreateMethodRefNode(IN CONST AML_OBJECT_NODE *ObjectNode, IN CONST CHAR8 *RawAbsolutePath, IN UINT32 RawAbsolutePathSize, OUT AML_NAMESPACE_REF_NODE **NameSpaceRefNodePtr)
EFI_STATUS EFIAPI AmlDeleteNameSpaceRefList(IN LIST_ENTRY *NameSpaceRefList)
BOOLEAN EFIAPI AmlIsMethodDefinitionNode(IN CONST AML_OBJECT_NODE *Node)
BOOLEAN EFIAPI AmlNodeCompareOpCode(IN CONST AML_OBJECT_NODE *ObjectNode, IN UINT8 OpCode, IN UINT8 SubOpCode)
EFI_STATUS EFIAPI AmlCreateObjectNode(IN CONST AML_BYTE_ENCODING *AmlByteEncoding, IN UINT32 PkgLength, OUT AML_OBJECT_NODE **NewObjectNodePtr)
EFI_STATUS EFIAPI AmlDeleteNode(IN AML_NODE_HEADER *Node)
BOOLEAN EFIAPI AmlNodeHasAttribute(IN CONST AML_OBJECT_NODE *ObjectNode, IN AML_OP_ATTRIBUTE Attribute)
CHAR8 *EFIAPI AmlNodeGetName(IN CONST AML_OBJECT_NODE *ObjectNode)
EFI_STATUS EFIAPI AmlCreateDataNode(IN EAML_NODE_DATA_TYPE DataType, IN CONST UINT8 *Data, IN UINT32 DataSize, OUT AML_DATA_NODE **NewDataNodePtr)
EFI_STATUS AmlNodeGetNameIndex(IN CONST AML_OBJECT_NODE *ObjectNode, OUT EAML_PARSE_INDEX *Index)
#define IS_AML_ROOT_NODE(Node)
#define IS_AML_OBJECT_NODE(Node)
#define IS_AML_DATA_NODE(Node)
#define IS_AML_NODE_VALID(Node)
UINT32 EFIAPI AmlStreamGetMaxBufferSize(IN CONST AML_STREAM *Stream)
UINT32 EFIAPI AmlStreamGetIndex(IN CONST AML_STREAM *Stream)
UINT32 EFIAPI AmlStreamGetFreeSpace(IN CONST AML_STREAM *Stream)
EFI_STATUS EFIAPI AmlStreamProgress(IN AML_STREAM *Stream, IN UINT32 Offset)
EFI_STATUS EFIAPI AmlStreamClone(IN CONST AML_STREAM *Stream, OUT AML_STREAM *ClonedStream)
EFI_STATUS EFIAPI AmlStreamWrite(IN AML_STREAM *Stream, IN CONST UINT8 *Buffer, IN UINT32 Size)
UINT8 *EFIAPI AmlStreamGetCurrPos(IN CONST AML_STREAM *Stream)
BOOLEAN EFIAPI AmlStreamCmp(IN CONST AML_STREAM *Stream1, IN CONST AML_STREAM *Stream2, IN UINT32 Size)
EFI_STATUS EFIAPI AmlStreamInit(IN OUT AML_STREAM *Stream, IN UINT8 *Buffer, IN UINT32 MaxBufferSize, IN EAML_STREAM_DIRECTION Direction)
#define IS_STREAM_FORWARD(Stream)
@ EAmlStreamDirectionForward
@ EAmlStreamDirectionBackward
#define IS_STREAM(Stream)
#define IS_STREAM_BACKWARD(Stream)
#define IS_END_OF_STREAM(Stream)
EFI_STATUS EFIAPI AmlSetFixedArgument(IN AML_OBJECT_NODE *ObjectNode, IN EAML_PARSE_INDEX Index, IN AML_NODE_HEADER *NewNode)
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
CONST AML_BYTE_ENCODING *EFIAPI AmlGetByteEncodingByOpCode(IN UINT8 OpCode, IN UINT8 SubOpCode)
EFI_STATUS EFIAPI AmlGetRawNameSpacePath(IN CONST AML_NODE_HEADER *Node, IN UINT32 InputParent, OUT AML_STREAM *RawAbsPathBStream)
EFI_STATUS EFIAPI AmlGetFirstAncestorNameSpaceNode(IN CONST AML_NODE_HEADER *Node, OUT AML_NODE_HEADER **OutNode)
EFI_STATUS EFIAPI AmlParseNameStringInfo(IN CONST CHAR8 *Buffer, OUT UINT32 *Root, OUT UINT32 *ParentPrefix, OUT UINT32 *SegCount)
CONST CHAR8 *EFIAPI AmlGetFirstNameSeg(IN CONST CHAR8 *AmlPath, IN UINT32 Root, IN UINT32 ParentPrefix)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
AML_NODE_HANDLE EFIAPI AmlGetParent(IN AML_NODE_HANDLE Node)
AML_NODE_HANDLE EFIAPI AmlGetFixedArgument(IN AML_OBJECT_NODE_HANDLE ObjectNode, IN EAML_PARSE_INDEX Index)
#define AML_METHOD_INVOC_OP
enum EAmlParseIndex EAML_PARSE_INDEX
#define MAX_AML_NAMESTRING_SIZE
@ EAmlParseIndexTerm1
Second fixed argument index.
@ EAmlParseIndexTerm0
First fixed argument index.
@ EAmlParseIndexTerm2
Third fixed argument index.
@ EAmlNodeDataTypeNameString
EFI_STATUS EFIAPI AmlDeleteTree(IN AML_NODE_HANDLE Node)
EAML_NODE_DATA_TYPE DataType
UINT8 * Buffer
Buffer containing the data stored by this node.
UINT32 Size
Size of the Buffer.
CONST AML_OBJECT_NODE * NodeRef
CONST CHAR8 * RawAbsolutePath
UINT32 RawAbsolutePathSize
Size of the raw AML absolute pathname buffer.
AML_NODE_HEADER * FixedArgs[EAmlParseIndexMax]
UINT8 * Buffer
Pointer to a buffer.