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

Go to the source code of this file.

Functions

STATIC BOOLEAN EFIAPI AmlSerializeNodeCallback (IN AML_NODE_HEADER *Node, IN OUT VOID *Context OPTIONAL, IN OUT EFI_STATUS *Status OPTIONAL)
 
EFI_STATUS EFIAPI AmlSerializeTree (IN AML_ROOT_NODE *RootNode, IN UINT8 *Buffer OPTIONAL, IN OUT UINT32 *BufferSize)
 
EFI_STATUS EFIAPI AmlSerializeDefinitionBlock (IN AML_ROOT_NODE *RootNode, OUT EFI_ACPI_DESCRIPTION_HEADER **Table)
 

Detailed Description

AML Serialize.

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

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

Definition in file AmlSerialize.c.

Function Documentation

◆ AmlSerializeDefinitionBlock()

EFI_STATUS EFIAPI AmlSerializeDefinitionBlock ( IN AML_ROOT_NODE 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.

Definition at line 275 of file AmlSerialize.c.

◆ AmlSerializeNodeCallback()

STATIC BOOLEAN EFIAPI AmlSerializeNodeCallback ( IN AML_NODE_HEADER Node,
IN OUT VOID *Context  OPTIONAL,
IN OUT EFI_STATUS *Status  OPTIONAL 
)

Callback function to copy the AML bytecodes contained in a node to the Stream stored in the Context. The SDT header data contained in the root node is not serialized by this function.

Parameters
[in]NodePointer to the node to copy the AML bytecodes from.
[in,out]ContextContains a forward Stream to write to. (AML_STREAM*)Context.
[in,out]StatusAt entry, contains the status returned by the last call to this exact function during the enumeration. As exit, contains the returned status of the call to this function. Optional, can be NULL.
Return values
TRUEif the enumeration can continue or has finished without interruption.
FALSEif the enumeration needs to stopped or has stopped.

Definition at line 40 of file AmlSerialize.c.

◆ AmlSerializeTree()

EFI_STATUS EFIAPI AmlSerializeTree ( IN AML_ROOT_NODE RootNode,
IN UINT8 *Buffer  OPTIONAL,
IN OUT UINT32 *  BufferSize 
)

Serialize a tree to create an ACPI DSDT/SSDT table.

If:

  • the content of BufferSize is >= to the size needed to serialize the definition block;
  • Buffer is not NULL; first serialize the ACPI DSDT/SSDT header from the root node, then serialize the AML blob from the rest of the tree.

The content of BufferSize is always updated to the size needed to serialize the definition block.

Parameters
[in]RootNodePointer to a root node.
[in]BufferBuffer to write the DSDT/SSDT table to. If Buffer is NULL, the size needed to serialize the DSDT/SSDT table is returned in BufferSize.
[in,out]BufferSizePointer holding the size of the Buffer. Its content is always updated to the size needed to serialize the DSDT/SSDT table.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_BUFFER_TOO_SMALLNo space left in the buffer.

Definition at line 176 of file AmlSerialize.c.