TianoCore EDK2 master
Loading...
Searching...
No Matches
AmlTreeEnumerator.c
Go to the documentation of this file.
1
9#include <AmlNodeDefines.h>
10
11#include <AmlCoreInterface.h>
12#include <Tree/AmlTree.h>
13
33BOOLEAN
34EFIAPI
36 IN AML_NODE_HEADER *Node,
38 IN OUT VOID *Context OPTIONAL,
39 OUT EFI_STATUS *Status OPTIONAL
40 )
41{
42 BOOLEAN ContinueEnum;
43
44 EAML_PARSE_INDEX Index;
45 EAML_PARSE_INDEX MaxIndex;
46
47 LIST_ENTRY *StartLink;
48 LIST_ENTRY *CurrentLink;
49
50 if (!IS_AML_NODE_VALID (Node) || (CallBack == NULL)) {
51 ASSERT (0);
52 if (Status != NULL) {
53 *Status = EFI_INVALID_PARAMETER;
54 }
55
56 return FALSE;
57 }
58
59 ContinueEnum = (*CallBack)(Node, Context, Status);
60 if (ContinueEnum == FALSE) {
61 return ContinueEnum;
62 }
63
64 // Iterate through the fixed list of arguments.
66 (AML_OBJECT_NODE *)Node
67 );
68 for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) {
69 ContinueEnum = AmlEnumTree (
70 AmlGetFixedArgument ((AML_OBJECT_NODE *)Node, Index),
71 CallBack,
72 Context,
73 Status
74 );
75 if (ContinueEnum == FALSE) {
76 return ContinueEnum;
77 }
78 }
79
80 // Iterate through the variable list of arguments.
81 StartLink = AmlNodeGetVariableArgList (Node);
82 if (StartLink != NULL) {
83 CurrentLink = StartLink->ForwardLink;
84 while (CurrentLink != StartLink) {
85 ContinueEnum = AmlEnumTree (
86 (AML_NODE_HEADER *)CurrentLink,
87 CallBack,
88 Context,
89 Status
90 );
91 if (ContinueEnum == FALSE) {
92 return ContinueEnum;
93 }
94
95 CurrentLink = CurrentLink->ForwardLink;
96 } // while
97 }
98
99 return ContinueEnum;
100}
#define IS_AML_NODE_VALID(Node)
LIST_ENTRY *EFIAPI AmlNodeGetVariableArgList(IN CONST AML_NODE_HEADER *Node)
Definition: AmlTree.c:205
BOOLEAN EFIAPI AmlEnumTree(IN AML_NODE_HEADER *Node, IN EDKII_AML_TREE_ENUM_CALLBACK CallBack, IN OUT VOID *Context OPTIONAL, OUT EFI_STATUS *Status OPTIONAL)
#define NULL
Definition: Base.h:319
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
AML_NODE_HANDLE EFIAPI AmlGetFixedArgument(IN AML_OBJECT_NODE_HANDLE ObjectNode, IN EAML_PARSE_INDEX Index)
BOOLEAN(EFIAPI * EDKII_AML_TREE_ENUM_CALLBACK)(IN AML_NODE_HANDLE Node, IN OUT VOID *Context OPTIONAL, IN OUT EFI_STATUS *Status OPTIONAL)
UINT8 AmlGetFixedArgumentCount(IN AML_OBJECT_NODE_HANDLE Node)
enum EAmlParseIndex EAML_PARSE_INDEX
@ EAmlParseIndexTerm0
First fixed argument index.
Definition: AmlDefines.h:65