TianoCore EDK2 master
Loading...
Searching...
No Matches
AmlNode.c File Reference
#include <Tree/AmlNode.h>
#include <AmlCoreInterface.h>
#include <Tree/AmlTree.h>

Go to the source code of this file.

Functions

STATIC EFI_STATUS EFIAPI AmlInitializeNodeHeader (IN AML_NODE_HEADER *Node, IN EAML_NODE_TYPE NodeType)
 
STATIC EFI_STATUS EFIAPI AmlDeleteRootNode (IN AML_ROOT_NODE *RootNode)
 
EFI_STATUS EFIAPI AmlCreateRootNode (IN CONST EFI_ACPI_DESCRIPTION_HEADER *SdtHeader, OUT AML_ROOT_NODE **NewRootNodePtr)
 
STATIC EFI_STATUS EFIAPI AmlDeleteObjectNode (IN AML_OBJECT_NODE *ObjectNode)
 
EFI_STATUS EFIAPI AmlCreateObjectNode (IN CONST AML_BYTE_ENCODING *AmlByteEncoding, IN UINT32 PkgLength, OUT AML_OBJECT_NODE **NewObjectNodePtr)
 
STATIC EFI_STATUS EFIAPI AmlDeleteDataNode (IN AML_DATA_NODE *DataNode)
 
EFI_STATUS EFIAPI AmlCreateDataNode (IN EAML_NODE_DATA_TYPE DataType, IN CONST UINT8 *Data, IN UINT32 DataSize, OUT AML_DATA_NODE **NewDataNodePtr)
 
EFI_STATUS EFIAPI AmlDeleteNode (IN AML_NODE_HEADER *Node)
 
BOOLEAN EFIAPI AmlNodeHasAttribute (IN CONST AML_OBJECT_NODE *ObjectNode, IN AML_OP_ATTRIBUTE Attribute)
 
BOOLEAN EFIAPI AmlNodeCompareOpCode (IN CONST AML_OBJECT_NODE *ObjectNode, IN UINT8 OpCode, IN UINT8 SubOpCode)
 
BOOLEAN EFIAPI IsIntegerNode (IN AML_OBJECT_NODE *Node)
 
BOOLEAN EFIAPI IsSpecialIntegerNode (IN AML_OBJECT_NODE *Node)
 
BOOLEAN EFIAPI AmlIsMethodDefinitionNode (IN CONST AML_OBJECT_NODE *Node)
 
EFI_STATUS AmlNodeGetNameIndex (IN CONST AML_OBJECT_NODE *ObjectNode, OUT EAML_PARSE_INDEX *Index)
 
CHAR8 *EFIAPI AmlNodeGetName (IN CONST AML_OBJECT_NODE *ObjectNode)
 

Detailed Description

AML Node.

Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file AmlNode.c.

Function Documentation

◆ AmlCreateDataNode()

EFI_STATUS EFIAPI AmlCreateDataNode ( IN EAML_NODE_DATA_TYPE  DataType,
IN CONST UINT8 *  Data,
IN UINT32  DataSize,
OUT AML_DATA_NODE **  NewDataNodePtr 
)

Create an AML_DATA_NODE.

Parameters
[in]DataTypeDataType of the node.
[in]DataPointer to the AML bytecode corresponding to this node. Data is copied from there.
[in]DataSizeNumber of bytes to consider at the address pointed by Data.
[out]NewDataNodePtrIf success, contains the created AML_DATA_NODE. Otherwise reset to NULL.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 275 of file AmlNode.c.

◆ AmlCreateObjectNode()

EFI_STATUS EFIAPI AmlCreateObjectNode ( IN CONST AML_BYTE_ENCODING AmlByteEncoding,
IN UINT32  PkgLength,
OUT AML_OBJECT_NODE **  NewObjectNodePtr 
)

Create an AML_OBJECT_NODE.

Parameters
[in]AmlByteEncodingByte encoding entry.
[in]PkgLengthPkgLength of the node if the AmlByteEncoding has the PkgLen attribute. 0 otherwise.
[out]NewObjectNodePtrIf success, contains the created AML_OBJECT_NODE. Otherwise reset to NULL.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 181 of file AmlNode.c.

◆ AmlCreateRootNode()

EFI_STATUS EFIAPI AmlCreateRootNode ( IN CONST EFI_ACPI_DESCRIPTION_HEADER SdtHeader,
OUT AML_ROOT_NODE **  NewRootNodePtr 
)

Create an AML_ROOT_NODE. This node will be the root of the tree.

Parameters
[in]SdtHeaderPointer to an ACPI DSDT/SSDT header to copy the data from.
[out]NewRootNodePtrIf success, contains the created AML_ROOT_NODE. Otherwise reset to NULL.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 92 of file AmlNode.c.

◆ AmlDeleteDataNode()

STATIC EFI_STATUS EFIAPI AmlDeleteDataNode ( IN AML_DATA_NODE DataNode)

Delete a data node and its buffer.

It is the caller's responsibility to check the DataNode has been removed from the tree and is not referencing any other node in the tree.

Parameters
[in]DataNodePointer to a data node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 238 of file AmlNode.c.

◆ AmlDeleteNode()

EFI_STATUS EFIAPI AmlDeleteNode ( IN AML_NODE_HEADER Node)

Delete a Node.

Parameters
[in]NodePointer to a Node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 339 of file AmlNode.c.

◆ AmlDeleteObjectNode()

STATIC EFI_STATUS EFIAPI AmlDeleteObjectNode ( IN AML_OBJECT_NODE ObjectNode)

Delete an object node.

It is the caller's responsibility to check the ObjectNode has been removed from the tree and is not referencing any other node in the tree.

Parameters
[in]ObjectNodePointer to an object node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 152 of file AmlNode.c.

◆ AmlDeleteRootNode()

STATIC EFI_STATUS EFIAPI AmlDeleteRootNode ( IN AML_ROOT_NODE RootNode)

Delete a root node and its ACPI DSDT/SSDT header.

It is the caller's responsibility to check the RootNode has been removed from the tree and is not referencing any other node in the tree.

Parameters
[in]RootNodePointer to a root node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 57 of file AmlNode.c.

◆ AmlInitializeNodeHeader()

STATIC EFI_STATUS EFIAPI AmlInitializeNodeHeader ( IN AML_NODE_HEADER Node,
IN EAML_NODE_TYPE  NodeType 
)

Initialize an AML_NODE_HEADER structure.

Parameters
[in]NodePointer to a node header.
[in]NodeTypeNodeType to initialize the Node with. Must be an EAML_NODE_TYPE.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 26 of file AmlNode.c.

◆ AmlIsMethodDefinitionNode()

BOOLEAN EFIAPI AmlIsMethodDefinitionNode ( IN CONST 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.

Parameters
[in]NodeNode to check whether it is a method definition.
Return values
TRUEThe Node is a method definition.
FALSEOtherwise.

Definition at line 570 of file AmlNode.c.

◆ AmlNodeCompareOpCode()

BOOLEAN EFIAPI AmlNodeCompareOpCode ( IN CONST AML_OBJECT_NODE ObjectNode,
IN UINT8  OpCode,
IN UINT8  SubOpCode 
)

Check whether ObjectNode has the input OpCode/SubOpcode couple.

Parameters
[in]ObjectNodePointer to an object node.
[in]OpCodeOpCode to check
[in]SubOpCodeSubOpCode to check
Return values
TRUEThe node is an AML object and the Opcode and the SubOpCode match.
FALSEOtherwise.

Definition at line 457 of file AmlNode.c.

◆ AmlNodeGetName()

CHAR8 *EFIAPI AmlNodeGetName ( IN CONST AML_OBJECT_NODE ObjectNode)

Get the name of the Node.

Node must be part of the namespace.

Parameters
[in]ObjectNodePointer to an object node, which is part of the namespace.
Returns
A pointer to the name. NULL otherwise. Return NULL for the root node.

Definition at line 663 of file AmlNode.c.

◆ AmlNodeGetNameIndex()

EFI_STATUS AmlNodeGetNameIndex ( IN CONST AML_OBJECT_NODE ObjectNode,
OUT EAML_PARSE_INDEX Index 
)

Get the index at which the name of the node is stored.

Parameters
[in]ObjectNodePointer to an object node. Must have the AML_IN_NAMESPACE attribute.
[out]IndexIndex of the name in the fixed list of arguments.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 621 of file AmlNode.c.

◆ AmlNodeHasAttribute()

BOOLEAN EFIAPI AmlNodeHasAttribute ( IN CONST AML_OBJECT_NODE ObjectNode,
IN AML_OP_ATTRIBUTE  Attribute 
)

Check whether ObjectNode has the input attribute. This function can be used to check ObjectNode is an object node at the same time.

Parameters
[in]ObjectNodePointer to an object node.
[in]AttributeAttribute to check for.
Return values
TRUEThe node is an AML object and the attribute is present.
FALSEOtherwise.

Definition at line 430 of file AmlNode.c.

◆ IsIntegerNode()

BOOLEAN EFIAPI IsIntegerNode ( IN AML_OBJECT_NODE Node)

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.
Parameters
[in]NodeThe node to check.
Return values
TRUEThe Node is an integer node.
FALSEOtherwise.

Definition at line 491 of file AmlNode.c.

◆ IsSpecialIntegerNode()

BOOLEAN EFIAPI IsSpecialIntegerNode ( 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.

Parameters
[in]NodeThe node to check.
Return values
TRUEThe Node is a ZeroOp or OneOp.
FALSEOtherwise.

Definition at line 528 of file AmlNode.c.