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

Go to the source code of this file.

Functions

AML_NODE_HEADER *EFIAPI AmlGetParent (IN AML_NODE_HEADER *Node)
 
AML_ROOT_NODE *EFIAPI AmlGetRootNode (IN CONST AML_NODE_HEADER *Node)
 
AML_NODE_HEADER *EFIAPI AmlGetFixedArgument (IN AML_OBJECT_NODE *ObjectNode, IN EAML_PARSE_INDEX Index)
 
BOOLEAN EFIAPI AmlIsNodeFixedArgument (IN CONST AML_NODE_HEADER *Node, OUT EAML_PARSE_INDEX *IndexPtr)
 
EFI_STATUS EFIAPI AmlSetFixedArgument (IN AML_OBJECT_NODE *ObjectNode, IN EAML_PARSE_INDEX Index, IN AML_NODE_HEADER *NewNode)
 
LIST_ENTRY *EFIAPI AmlNodeGetVariableArgList (IN CONST AML_NODE_HEADER *Node)
 
EFI_STATUS EFIAPI AmlRemoveNodeFromVarArgList (IN AML_NODE_HEADER *Node)
 
EFI_STATUS EFIAPI AmlDetachNode (IN AML_NODE_HEADER *Node)
 
EFI_STATUS EFIAPI AmlVarListAddHead (IN AML_NODE_HEADER *ParentNode, IN AML_NODE_HEADER *NewNode)
 
EFI_STATUS EFIAPI AmlVarListAddTailInternal (IN AML_NODE_HEADER *ParentNode, IN AML_NODE_HEADER *NewNode)
 
EFI_STATUS EFIAPI AmlVarListAddTail (IN AML_NODE_HEADER *ParentNode, IN AML_NODE_HEADER *NewNode)
 
EFI_STATUS EFIAPI AmlVarListAddBefore (IN AML_NODE_HEADER *Node, IN AML_NODE_HEADER *NewNode)
 
EFI_STATUS EFIAPI AmlVarListAddAfter (IN AML_NODE_HEADER *Node, IN AML_NODE_HEADER *NewNode)
 
EFI_STATUS EFIAPI AmlAppendRdNode (IN AML_OBJECT_NODE *BufferOpNode, IN AML_DATA_NODE *NewRdNode)
 
STATIC EFI_STATUS EFIAPI AmlReplaceFixedArgument (IN AML_OBJECT_NODE *ParentNode, IN EAML_PARSE_INDEX Index, IN AML_NODE_HEADER *NewNode)
 
EFI_STATUS EFIAPI AmlReplaceVariableArgument (IN AML_NODE_HEADER *OldNode, IN AML_NODE_HEADER *NewNode)
 
EFI_STATUS EFIAPI AmlReplaceArgument (IN AML_NODE_HEADER *OldNode, IN AML_NODE_HEADER *NewNode)
 
EFI_STATUS EFIAPI AmlDeleteTree (IN AML_NODE_HEADER *Node)
 

Detailed Description

AML Tree.

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

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

Definition in file AmlTree.c.

Function Documentation

◆ AmlAppendRdNode()

EFI_STATUS EFIAPI AmlAppendRdNode ( IN AML_OBJECT_NODE BufferOpNode,
IN AML_DATA_NODE NewRdNode 
)

Append a Resource Data node to the BufferOpNode.

The Resource Data node is added at the end of the variable list of arguments of the BufferOpNode, but before the End Tag. If no End Tag is found, the function returns an error.

Parameters
[in]BufferOpNodeBuffer node containing resource data elements.
[in]NewRdNodeThe new Resource Data node to add.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 578 of file AmlTree.c.

◆ AmlDeleteTree()

EFI_STATUS EFIAPI AmlDeleteTree ( IN AML_NODE_HEADER Node)

Delete a Node and its children.

The Node must be removed from the tree first, or must be the root node.

Parameters
[in]NodePointer to the node to delete.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 977 of file AmlTree.c.

◆ AmlDetachNode()

EFI_STATUS EFIAPI AmlDetachNode ( IN AML_NODE_HEADER Node)

Detach the Node from the tree.

The function will fail if the Node is in its parent's fixed argument list. The Node is not deleted. The deletion is done separately from the removal.

Parameters
[in]NodePointer to a Node. Must be a data node or an object node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 300 of file AmlTree.c.

◆ AmlGetFixedArgument()

AML_NODE_HEADER *EFIAPI AmlGetFixedArgument ( IN AML_OBJECT_NODE ObjectNode,
IN EAML_PARSE_INDEX  Index 
)

Get the node at the input Index in the fixed argument list of the input ObjectNode.

Parameters
[in]ObjectNodePointer to an object node.
[in]IndexThe Index of the fixed argument to get.
Returns
The node at the input Index in the fixed argument list of the input ObjectNode. NULL otherwise, e.g. if the node is not an object node, or no node is available at this Index.

Definition at line 81 of file AmlTree.c.

◆ AmlGetParent()

AML_NODE_HEADER *EFIAPI AmlGetParent ( IN AML_NODE_HEADER Node)

Get the parent node of the input Node.

Parameters
[in]NodePointer to a node.
Returns
The parent node of the input Node. NULL otherwise.

Definition at line 25 of file AmlTree.c.

◆ AmlGetRootNode()

AML_ROOT_NODE *EFIAPI AmlGetRootNode ( IN CONST AML_NODE_HEADER Node)

Get the root node from any node of the tree. This is done by climbing up the tree until the root node is reached.

Parameters
[in]NodePointer to a node.
Returns
The root node of the tree. NULL if error.

Definition at line 48 of file AmlTree.c.

◆ AmlIsNodeFixedArgument()

BOOLEAN EFIAPI AmlIsNodeFixedArgument ( IN CONST AML_NODE_HEADER Node,
OUT EAML_PARSE_INDEX IndexPtr 
)

Check whether the input Node is in the fixed argument list of its parent node.

If so, IndexPtr contains this Index.

Parameters
[in]NodePointer to a Node.
[out]IndexPtrPointer holding the Index of the Node in its parent's fixed argument list.
Return values
TRUEThe node is a fixed argument and the index in IndexPtr is valid.
FALSEThe node is not a fixed argument.

Definition at line 110 of file AmlTree.c.

◆ AmlNodeGetVariableArgList()

LIST_ENTRY *EFIAPI AmlNodeGetVariableArgList ( IN CONST AML_NODE_HEADER Node)

If the given AML_NODE_HEADER has a variable list of arguments, return a pointer to this list. Return NULL otherwise.

Parameters
[in]NodePointer to the AML_NODE_HEADER to check.
Returns
The list of variable arguments if there is one. NULL otherwise.

Definition at line 205 of file AmlTree.c.

◆ AmlRemoveNodeFromVarArgList()

EFI_STATUS EFIAPI AmlRemoveNodeFromVarArgList ( IN AML_NODE_HEADER Node)

Remove the Node from its parent's variable list of arguments.

The function will fail if the Node is in its parent's fixed argument list. The Node is not deleted. The deletion is done separately from the removal.

Parameters
[in]NodePointer to a Node. Must be a data node or an object node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 233 of file AmlTree.c.

◆ AmlReplaceArgument()

EFI_STATUS EFIAPI AmlReplaceArgument ( IN AML_NODE_HEADER OldNode,
IN AML_NODE_HEADER NewNode 
)

Replace the OldNode by the NewNode.

Note: This function unlinks the OldNode from the tree. It is the callers responsibility to delete the OldNode if needed.

Parameters
[in]OldNodePointer to the node to replace. Must be a data node or an object node.
[in]NewNodeThe new node to insert. Must be a data node or an object node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 915 of file AmlTree.c.

◆ AmlReplaceFixedArgument()

STATIC EFI_STATUS EFIAPI AmlReplaceFixedArgument ( IN AML_OBJECT_NODE ParentNode,
IN EAML_PARSE_INDEX  Index,
IN AML_NODE_HEADER NewNode 
)

Replace the fixed argument at the Index of the ParentNode with the NewNode.

Note: This function unlinks the OldNode from the tree. It is the callers responsibility to delete the OldNode if needed.

Parameters
[in]ParentNodePointer to the parent node. Must be an object node.
[in]IndexIndex of the fixed argument to replace.
[in]NewNodeThe new node to insert. Must be an object node or a data node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 648 of file AmlTree.c.

◆ AmlReplaceVariableArgument()

EFI_STATUS EFIAPI AmlReplaceVariableArgument ( IN AML_NODE_HEADER OldNode,
IN AML_NODE_HEADER NewNode 
)

Replace the OldNode, which is in a variable list of arguments, with the NewNode.

Note: This function unlinks the OldNode from the tree. It is the callers responsibility to delete the OldNode if needed.

Parameters
[in]OldNodePointer to the node to replace. Must be a data node or an object node.
[in]NewNodeThe new node to insert. Must be a data node or an object node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 786 of file AmlTree.c.

◆ AmlSetFixedArgument()

EFI_STATUS EFIAPI AmlSetFixedArgument ( IN AML_OBJECT_NODE ObjectNode,
IN EAML_PARSE_INDEX  Index,
IN AML_NODE_HEADER NewNode 
)

Set the fixed argument of the ObjectNode at the Index to the NewNode.

It is the caller's responsibility to save the old node, if desired, otherwise the reference to the old node will be lost. If NewNode is not NULL, set its parent to ObjectNode.

Parameters
[in]ObjectNodePointer to an object node.
[in]IndexIndex in the fixed argument list of the ObjectNode to set.
[in]NewNodePointer to the NewNode. Can be NULL, a data node or an object node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 168 of file AmlTree.c.

◆ AmlVarListAddAfter()

EFI_STATUS EFIAPI AmlVarListAddAfter ( IN AML_NODE_HEADER Node,
IN AML_NODE_HEADER NewNode 
)

Add the NewNode after the Node in the variable list of arguments of the Node's parent.

Parameters
[in]NodePointer to a node. Must be a root or an object node.
[in]NewNodePointer to the node to add.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 520 of file AmlTree.c.

◆ AmlVarListAddBefore()

EFI_STATUS EFIAPI AmlVarListAddBefore ( IN AML_NODE_HEADER Node,
IN AML_NODE_HEADER NewNode 
)

Add the NewNode before the Node in the list of variable arguments of the Node's parent.

Parameters
[in]NodePointer to a node. Must be a root or an object node.
[in]NewNodePointer to the node to add.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 464 of file AmlTree.c.

◆ AmlVarListAddHead()

EFI_STATUS EFIAPI AmlVarListAddHead ( IN AML_NODE_HEADER ParentNode,
IN AML_NODE_HEADER NewNode 
)

Add the NewNode to the head of the variable list of arguments of the ParentNode.

Parameters
[in]ParentNodePointer to the parent node. Must be a root or an object node.
[in]NewNodePointer to the node to add.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 319 of file AmlTree.c.

◆ AmlVarListAddTail()

EFI_STATUS EFIAPI AmlVarListAddTail ( IN AML_NODE_HEADER ParentNode,
IN AML_NODE_HEADER NewNode 
)

Add the NewNode to the tail of the variable list of arguments of the ParentNode.

Parameters
[in]ParentNodePointer to the parent node. Must be a root or an object node.
[in]NewNodePointer to the node to add.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 423 of file AmlTree.c.

◆ AmlVarListAddTailInternal()

EFI_STATUS EFIAPI AmlVarListAddTailInternal ( IN AML_NODE_HEADER ParentNode,
IN AML_NODE_HEADER NewNode 
)

Add the NewNode to the tail of the variable list of arguments of the ParentNode.

NOTE: This is an internal function which does not propagate the size when a new node is added.

Parameters
[in]ParentNodePointer to the parent node. Must be a root or an object node.
[in]NewNodePointer to the node to add.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 379 of file AmlTree.c.