DynamicTablesPkg[all]  1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
User APIs

Functions

EFI_STATUS EFIAPI AmlParseDefinitionBlock (IN CONST EFI_ACPI_DESCRIPTION_HEADER *DefinitionBlock, OUT AML_ROOT_NODE_HANDLE *RootPtr)
 
EFI_STATUS EFIAPI AmlSerializeDefinitionBlock (IN AML_ROOT_NODE_HANDLE RootNode, OUT EFI_ACPI_DESCRIPTION_HEADER **Table)
 
EFI_STATUS EFIAPI AmlCloneTree (IN AML_NODE_HANDLE Node, OUT AML_NODE_HANDLE *ClonedNode)
 
EFI_STATUS EFIAPI AmlDeleteTree (IN AML_NODE_HANDLE Node)
 
EFI_STATUS EFIAPI AmlDetachNode (IN AML_NODE_HANDLE Node)
 
EFI_STATUS EFIAPI AmlDeviceOpUpdateName (IN AML_OBJECT_NODE_HANDLE DeviceOpNode, IN CHAR8 *NewNameString)
 
EFI_STATUS EFIAPI AmlNameOpUpdateInteger (IN AML_OBJECT_NODE_HANDLE NameOpNode, IN UINT64 NewInt)
 
EFI_STATUS EFIAPI AmlNameOpUpdateString (IN AML_OBJECT_NODE_HANDLE NameOpNode, IN CONST CHAR8 *NewName)
 
EFI_STATUS EFIAPI AmlNameOpGetFirstRdNode (IN AML_OBJECT_NODE_HANDLE NameOpNode, OUT AML_DATA_NODE_HANDLE *OutRdNode)
 
EFI_STATUS EFIAPI AmlNameOpGetNextRdNode (IN AML_DATA_NODE_HANDLE CurrRdNode, OUT AML_DATA_NODE_HANDLE *OutRdNode)
 
EFI_STATUS EFIAPI AmlUpdateRdInterrupt (IN AML_DATA_NODE_HANDLE InterruptRdNode, IN UINT32 Irq)
 
EFI_STATUS EFIAPI AmlUpdateRdQWord (IN AML_DATA_NODE_HANDLE QWordRdNode, IN UINT64 BaseAddress, IN UINT64 BaseAddressLength)
 
EFI_STATUS EFIAPI AmlNameOpCrsGetFirstRdNode (IN AML_OBJECT_NODE_HANDLE NameOpCrsNode, OUT AML_DATA_NODE_HANDLE *OutRdNode)
 
EFI_STATUS EFIAPI AmlNameOpCrsGetNextRdNode (IN AML_DATA_NODE_HANDLE CurrRdNode, OUT AML_DATA_NODE_HANDLE *OutRdNode)
 

Detailed Description

User APIs are implemented to ease most common actions that might be done using the AmlLib. They allow to find specific objects like "_UID" or "_CRS" and to update their value. It also shows what can be done using AmlLib functions.

Function Documentation

EFI_STATUS EFIAPI AmlCloneTree ( IN AML_NODE_HANDLE  Node,
OUT AML_NODE_HANDLE ClonedNode 
)

Clone a node and its children (clone a tree branch).

The cloned branch returned is not attached to any tree.

Parameters
[in]NodePointer to a node. Node is the head of the branch to clone.
[out]ClonedNodePointer holding the head of the created cloned branch.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.
EFI_STATUS EFIAPI AmlDeleteTree ( IN AML_NODE_HANDLE  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.
EFI_STATUS EFIAPI AmlDetachNode ( IN AML_NODE_HANDLE  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.
EFI_STATUS EFIAPI AmlDeviceOpUpdateName ( IN AML_OBJECT_NODE_HANDLE  DeviceOpNode,
IN CHAR8 *  NewNameString 
)

Update the name of a DeviceOp object node.

Parameters
[in]DeviceOpNodeObject node representing a Device. Must have an OpCode=AML_NAME_OP, SubOpCode=0. OpCode/SubOpCode. DeviceOp object nodes are defined in ASL using the "Device ()" function.
[in]NewNameStringThe new Device's name. Must be a NULL-terminated ASL NameString e.g.: "DEV0", "DV15.DEV0", etc. The input string is copied.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_STATUS EFIAPI AmlNameOpCrsGetFirstRdNode ( IN AML_OBJECT_NODE_HANDLE  NameOpCrsNode,
OUT AML_DATA_NODE_HANDLE OutRdNode 
)

DEPRECATED API

Get the first Resource Data element contained in a "_CRS" object.

In the following ASL code, the function will return the Resource Data node corresponding to the "QWordMemory ()" ASL macro. Name (_CRS, ResourceTemplate() { QWordMemory (...) {...}, Interrupt (...) {...} } )

Note:

  • The "_CRS" object must be declared using ASL "Name (Declare Named Object)".
  • "_CRS" declared using ASL "Method (Declare Control Method)" is not supported.
Parameters
[in]NameOpCrsNodeNameOp object node defining a "_CRS" object. Must have an OpCode=AML_NAME_OP, SubOpCode=0. NameOp object nodes are defined in ASL using the "Name ()" function.
[out]OutRdNodePointer to the first Resource Data element of the "_CRS" object. A Resource Data element is stored in a data node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_STATUS EFIAPI AmlNameOpCrsGetNextRdNode ( IN AML_DATA_NODE_HANDLE  CurrRdNode,
OUT AML_DATA_NODE_HANDLE OutRdNode 
)

DEPRECATED API

Get the Resource Data element following the CurrRdNode Resource Data.

In the following ASL code, if CurrRdNode corresponds to the first "QWordMemory ()" ASL macro, the function will return the Resource Data node corresponding to the "Interrupt ()" ASL macro. Name (_CRS, ResourceTemplate() { QwordMemory (...) {...}, Interrupt (...) {...} } )

The CurrRdNode Resource Data node must be defined in an object named "_CRS" and defined by a "Name ()" ASL function.

Parameters
[in]CurrRdNodePointer to the current Resource Data element of the "_CRS" variable.
[out]OutRdNodePointer to the Resource Data element following the CurrRdNode. Contain a NULL pointer if CurrRdNode is the last Resource Data element in the list. The "End Tag" is not considered as a resource data element and is not returned.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_STATUS EFIAPI AmlNameOpGetFirstRdNode ( IN AML_OBJECT_NODE_HANDLE  NameOpNode,
OUT AML_DATA_NODE_HANDLE OutRdNode 
)

Get the first Resource Data element contained in a named object.

In the following ASL code, the function will return the Resource Data node corresponding to the "QWordMemory ()" ASL macro. Name (_CRS, ResourceTemplate() { QWordMemory (...) {...}, Interrupt (...) {...} } )

Note: "_CRS" names defined as methods are not handled by this function. They must be defined as names, using the "Name ()" statement.

Parameters
[in]NameOpNodeNameOp object node defining a named object. Must have an OpCode=AML_NAME_OP, SubOpCode=0. NameOp object nodes are defined in ASL using the "Name ()" function.
[out]OutRdNodePointer to the first Resource Data element of the named object. A Resource Data element is stored in a data node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_STATUS EFIAPI AmlNameOpGetNextRdNode ( IN AML_DATA_NODE_HANDLE  CurrRdNode,
OUT AML_DATA_NODE_HANDLE OutRdNode 
)

Get the Resource Data element following the CurrRdNode Resource Data.

In the following ASL code, if CurrRdNode corresponds to the first "QWordMemory ()" ASL macro, the function will return the Resource Data node corresponding to the "Interrupt ()" ASL macro. Name (_CRS, ResourceTemplate() { QwordMemory (...) {...}, Interrupt (...) {...} } )

Note: "_CRS" names defined as methods are not handled by this function. They must be defined as names, using the "Name ()" statement.

Parameters
[in]CurrRdNodePointer to the current Resource Data element of the named object.
[out]OutRdNodePointer to the Resource Data element following the CurrRdNode. Contain a NULL pointer if CurrRdNode is the last Resource Data element in the list. The "End Tag" is not considered as a resource data element and is not returned.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_STATUS EFIAPI AmlNameOpUpdateInteger ( IN AML_OBJECT_NODE_HANDLE  NameOpNode,
IN UINT64  NewInt 
)

Update an integer value defined by a NameOp object node.

For compatibility reasons, the NameOpNode must initially contain an integer.

Parameters
[in]NameOpNodeNameOp object node. Must have an OpCode=AML_NAME_OP, SubOpCode=0. NameOp object nodes are defined in ASL using the "Name ()" function.
[in]NewIntNew Integer value to assign. Must be a UINT64.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_STATUS EFIAPI AmlNameOpUpdateString ( IN AML_OBJECT_NODE_HANDLE  NameOpNode,
IN CONST CHAR8 *  NewName 
)

Update a string value defined by a NameOp object node.

The NameOpNode must initially contain a string. The EISAID ASL macro converts a string to an integer. This, it is not accepted.

Parameters
[in]NameOpNodeNameOp object node. Must have an OpCode=AML_NAME_OP, SubOpCode=0. NameOp object nodes are defined in ASL using the "Name ()" function.
[in]NewNameNew NULL terminated string to assign to the NameOpNode. The input string is copied.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_STATUS EFIAPI AmlParseDefinitionBlock ( IN CONST EFI_ACPI_DESCRIPTION_HEADER *  DefinitionBlock,
OUT AML_ROOT_NODE_HANDLE RootPtr 
)

Parse the definition block.

The function parses the whole AML blob. It starts with the ACPI DSDT/SSDT header and then parses the AML bytestream. A tree structure is returned via the RootPtr. The tree must be deleted with the AmlDeleteTree function.

Parameters
[in]DefinitionBlockPointer to the definition block.
[out]RootPtrPointer to the root node of the AML tree.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_BUFFER_TOO_SMALLNo space left in the buffer.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.
EFI_STATUS EFIAPI AmlSerializeDefinitionBlock ( IN AML_ROOT_NODE_HANDLE  RootNode,
OUT EFI_ACPI_DESCRIPTION_HEADER **  Table 
)

Serialize an AML definition block.

This functions allocates memory with the "AllocateZeroPool ()" function. This memory is used to serialize the AML tree and is returned in the Table.

Parameters
[in]RootNodeRoot node of the tree.
[out]TableOn return, hold the serialized definition block.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.
EFI_STATUS EFIAPI AmlUpdateRdInterrupt ( IN AML_DATA_NODE_HANDLE  InterruptRdNode,
IN UINT32  Irq 
)

Update the first interrupt of an Interrupt resource data node.

The flags of the Interrupt resource data are left unchanged.

The InterruptRdNode corresponds to the Resource Data created by the "Interrupt ()" ASL macro. It is an Extended Interrupt Resource Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor" for more information about Extended Interrupt Resource Data.

Parameters
[in]InterruptRdNodePointer to the an extended interrupt resource data node.
[in]IrqInterrupt value to update.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESOut of resources.
EFI_STATUS EFIAPI AmlUpdateRdQWord ( IN AML_DATA_NODE_HANDLE  QWordRdNode,
IN UINT64  BaseAddress,
IN UINT64  BaseAddressLength 
)

Update the base address and length of a QWord resource data node.

Parameters
[in]QWordRdNodePointer a QWord resource data node.
[in]BaseAddressBase address.
[in]BaseAddressLengthBase address length.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESOut of resources.