4 Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #include <AmlNodeDefines.h>
13 #include <IndustryStandard/Acpi.h>
15 /** Create an AML_ROOT_NODE.
16 This node will be the root of the tree.
18 @param [in] SdtHeader Pointer to an ACPI DSDT/SSDT header to copy
20 @param [out] NewRootNodePtr If success, contains the created
22 Otherwise reset to NULL.
24 @retval EFI_SUCCESS The function completed successfully.
25 @retval EFI_INVALID_PARAMETER Invalid parameter.
26 @retval EFI_OUT_OF_RESOURCES Could not allocate memory.
31 IN CONST EFI_ACPI_DESCRIPTION_HEADER
* SdtHeader
,
32 OUT AML_ROOT_NODE
** NewRootNodePtr
35 /** Create an AML_OBJECT_NODE.
37 @param [in] AmlByteEncoding Byte encoding entry.
38 @param [in] PkgLength PkgLength of the node if the AmlByteEncoding
39 has the PkgLen attribute.
41 @param [out] NewObjectNodePtr If success, contains the created
43 Otherwise reset to NULL.
45 @retval EFI_SUCCESS The function completed successfully.
46 @retval EFI_INVALID_PARAMETER Invalid parameter.
47 @retval EFI_OUT_OF_RESOURCES Could not allocate memory.
52 IN CONST AML_BYTE_ENCODING
* AmlByteEncoding
,
54 OUT AML_OBJECT_NODE
** NewObjectNodePtr
57 /** Create an AML_DATA_NODE.
59 @param [in] DataType DataType of the node.
60 @param [in] Data Pointer to the AML bytecode corresponding to
61 this node. Data is copied from there.
62 @param [in] DataSize Number of bytes to consider at the address
64 @param [out] NewDataNodePtr If success, contains the created
66 Otherwise reset to NULL.
68 @retval EFI_SUCCESS The function completed successfully.
69 @retval EFI_INVALID_PARAMETER Invalid parameter.
70 @retval EFI_OUT_OF_RESOURCES Could not allocate memory.
75 IN EAML_NODE_DATA_TYPE DataType
,
76 IN CONST UINT8
* Data
,
78 OUT AML_DATA_NODE
** NewDataNodePtr
83 @param [in] Node Pointer to a Node.
85 @retval EFI_SUCCESS The function completed successfully.
86 @retval EFI_INVALID_PARAMETER Invalid parameter.
91 IN AML_NODE_HEADER
* Node
94 /** Check whether ObjectNode has the input attribute.
95 This function can be used to check ObjectNode is an object node
98 @param [in] ObjectNode Pointer to an object node.
99 @param [in] Attribute Attribute to check for.
101 @retval TRUE The node is an AML object and the attribute is present.
102 @retval FALSE Otherwise.
106 AmlNodeHasAttribute (
107 IN CONST AML_OBJECT_NODE
* ObjectNode
,
108 IN AML_OP_ATTRIBUTE Attribute
111 /** Check whether ObjectNode has the input OpCode/SubOpcode couple.
113 @param [in] ObjectNode Pointer to an object node.
114 @param [in] OpCode OpCode to check
115 @param [in] SubOpCode SubOpCode to check
117 @retval TRUE The node is an AML object and
118 the Opcode and the SubOpCode match.
119 @retval FALSE Otherwise.
123 AmlNodeCompareOpCode (
124 IN CONST AML_OBJECT_NODE
* ObjectNode
,
129 /** Check whether a Node is an integer node.
131 By integer node we mean an object node having one of the following opcode:
137 @param [in] Node The node to check.
139 @retval TRUE The Node is an integer node.
140 @retval FALSE Otherwise.
145 IN AML_OBJECT_NODE
* Node
148 /** Check whether a Node is a ZeroOp, a OneOp or a OnesOp.
150 These two objects don't have a data node holding
151 a value. This require special handling.
153 @param [in] Node The node to check.
155 @retval TRUE The Node is a ZeroOp or OneOp.
156 @retval FALSE Otherwise.
160 IsSpecialIntegerNode (
161 IN AML_OBJECT_NODE
* Node
164 /** Check whether Node corresponds to a method definition.
166 A method definition can be introduced:
167 - By a method object, having an AML_METHOD_OP OpCode;
168 - By an external definition of a method, having an AML_EXTERNAL_OP OpCode
169 and an ObjectType byte set to the MethodObj.
172 An alias node, having an AML_ALIAS_OP, can be resolved to a method
173 definition. This function doesn't handle this case.
175 @param [in] Node Node to check whether it is a method definition.
177 @retval TRUE The Node is a method definition.
178 @retval FALSE Otherwise.
182 AmlIsMethodDefinitionNode (
183 IN CONST AML_OBJECT_NODE
* Node
186 /** Get the index at which the name of the node is stored.
188 @param [in] ObjectNode Pointer to an object node.
189 Must have the AML_IN_NAMESPACE attribute.
190 @param [out] Index Index of the name in the fixed list of arguments.
192 @retval EFI_SUCCESS The function completed successfully.
193 @retval EFI_INVALID_PARAMETER Invalid parameter.
196 AmlNodeGetNameIndex (
197 IN CONST AML_OBJECT_NODE
* ObjectNode
,
198 OUT EAML_PARSE_INDEX
* Index
201 /** Get the name of the Node.
203 Node must be part of the namespace.
205 @param [in] ObjectNode Pointer to an object node,
206 which is part of the namespace.
208 @return A pointer to the name.
210 Return NULL for the root node.
215 IN CONST AML_OBJECT_NODE
* ObjectNode
218 #endif // AML_NODE_H_