1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
|
/** @file
AML Node.
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef AML_NODE_H_
#define AML_NODE_H_
#include <AmlNodeDefines.h>
#include <IndustryStandard/Acpi.h>
/** Create an AML_ROOT_NODE.
This node will be the root of the tree.
@param [in] SdtHeader Pointer to an ACPI DSDT/SSDT header to copy
the data from.
@param [out] NewRootNodePtr If success, contains the created
AML_ROOT_NODE.
Otherwise reset to NULL.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
**/
EFI_STATUS
EFIAPI
AmlCreateRootNode (
IN CONST EFI_ACPI_DESCRIPTION_HEADER *SdtHeader,
OUT AML_ROOT_NODE **NewRootNodePtr
);
/** Create an AML_OBJECT_NODE.
@param [in] AmlByteEncoding Byte encoding entry.
@param [in] PkgLength PkgLength of the node if the AmlByteEncoding
has the PkgLen attribute.
0 otherwise.
@param [out] NewObjectNodePtr If success, contains the created
AML_OBJECT_NODE.
Otherwise reset to NULL.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
**/
EFI_STATUS
EFIAPI
AmlCreateObjectNode (
IN CONST AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT32 PkgLength,
OUT AML_OBJECT_NODE **NewObjectNodePtr
);
/** Create an AML_DATA_NODE.
@param [in] DataType DataType of the node.
@param [in] Data Pointer to the AML bytecode corresponding to
this node. Data is copied from there.
@param [in] DataSize Number of bytes to consider at the address
pointed by Data.
@param [out] NewDataNodePtr If success, contains the created
AML_DATA_NODE.
Otherwise reset to NULL.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
**/
EFI_STATUS
EFIAPI
AmlCreateDataNode (
IN EAML_NODE_DATA_TYPE DataType,
IN CONST UINT8 *Data,
IN UINT32 DataSize,
OUT AML_DATA_NODE **NewDataNodePtr
);
/** Delete a Node.
@param [in] Node Pointer to a Node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EFIAPI
AmlDeleteNode (
IN AML_NODE_HEADER *Node
);
/** Check whether ObjectNode has the input attribute.
This function can be used to check ObjectNode is an object node
at the same time.
@param [in] ObjectNode Pointer to an object node.
@param [in] Attribute Attribute to check for.
@retval TRUE The node is an AML object and the attribute is present.
@retval FALSE Otherwise.
**/
BOOLEAN
EFIAPI
AmlNodeHasAttribute (
IN CONST AML_OBJECT_NODE *ObjectNode,
IN AML_OP_ATTRIBUTE Attribute
);
/** Check whether ObjectNode has the input OpCode/SubOpcode couple.
@param [in] ObjectNode Pointer to an object node.
@param [in] OpCode OpCode to check
@param [in] SubOpCode SubOpCode to check
@retval TRUE The node is an AML object and
the Opcode and the SubOpCode match.
@retval FALSE Otherwise.
**/
BOOLEAN
EFIAPI
AmlNodeCompareOpCode (
IN CONST AML_OBJECT_NODE *ObjectNode,
IN UINT8 OpCode,
IN UINT8 SubOpCode
);
/** Check whether a Node is an integer node.
By integer node we mean an object node having one of the following opcode:
- AML_BYTE_PREFIX;
- AML_WORD_PREFIX;
- AML_DWORD_PREFIX;
- AML_QWORD_PREFIX.
@param [in] Node The node to check.
@retval TRUE The Node is an integer node.
@retval FALSE Otherwise.
*/
BOOLEAN
EFIAPI
IsIntegerNode (
IN AML_OBJECT_NODE *Node
);
/** Check whether a Node is a ZeroOp, a OneOp or a OnesOp.
These two objects don't have a data node holding
a value. This require special handling.
@param [in] Node The node to check.
@retval TRUE The Node is a ZeroOp or OneOp.
@retval FALSE Otherwise.
*/
BOOLEAN
EFIAPI
IsSpecialIntegerNode (
IN AML_OBJECT_NODE *Node
);
/** Check whether Node corresponds to a method definition.
A method definition can be introduced:
- By a method object, having an AML_METHOD_OP OpCode;
- By an external definition of a method, having an AML_EXTERNAL_OP OpCode
and an ObjectType byte set to the MethodObj.
Note:
An alias node, having an AML_ALIAS_OP, can be resolved to a method
definition. This function doesn't handle this case.
@param [in] Node Node to check whether it is a method definition.
@retval TRUE The Node is a method definition.
@retval FALSE Otherwise.
**/
BOOLEAN
EFIAPI
AmlIsMethodDefinitionNode (
IN CONST AML_OBJECT_NODE *Node
);
/** Get the index at which the name of the node is stored.
@param [in] ObjectNode Pointer to an object node.
Must have the AML_IN_NAMESPACE attribute.
@param [out] Index Index of the name in the fixed list of arguments.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
AmlNodeGetNameIndex (
IN CONST AML_OBJECT_NODE *ObjectNode,
OUT EAML_PARSE_INDEX *Index
);
/** Get the name of the Node.
Node must be part of the namespace.
@param [in] ObjectNode Pointer to an object node,
which is part of the namespace.
@return A pointer to the name.
NULL otherwise.
Return NULL for the root node.
**/
CHAR8 *
EFIAPI
AmlNodeGetName (
IN CONST AML_OBJECT_NODE *ObjectNode
);
#endif // AML_NODE_H_
|