TianoCore EDK2 master
Loading...
Searching...
No Matches
AmlMethodParser.h File Reference
#include <AmlNodeDefines.h>
#include <Stream/AmlStream.h>

Go to the source code of this file.

Data Structures

struct  AmlNameSpaceRefNode
 

Typedefs

typedef struct AmlNameSpaceRefNode AML_NAMESPACE_REF_NODE
 

Functions

EFI_STATUS EFIAPI AmlDeleteNameSpaceRefList (IN LIST_ENTRY *NameSpaceRefList)
 
VOID EFIAPI AmlDbgPrintNameSpaceRefList (IN CONST LIST_ENTRY *NameSpaceRefList)
 
EFI_STATUS EFIAPI AmlIsMethodInvocation (IN CONST AML_NODE_HEADER *ParentNode, IN CONST AML_STREAM *FStream, IN CONST LIST_ENTRY *NameSpaceRefList, OUT AML_NAMESPACE_REF_NODE **OutNameSpaceRefNode)
 
EFI_STATUS EFIAPI AmlAddNameSpaceReference (IN CONST AML_OBJECT_NODE *Node, IN OUT LIST_ENTRY *NameSpaceRefList)
 
EFI_STATUS EFIAPI AmlCreateMethodInvocationNode (IN CONST AML_NAMESPACE_REF_NODE *NameSpaceRefNode, IN AML_DATA_NODE *MethodInvocationName, OUT AML_OBJECT_NODE **MethodInvocationNodePtr)
 
EFI_STATUS EFIAPI AmlGetMethodInvocationArgCount (IN CONST AML_OBJECT_NODE *MethodInvocationNode, OUT BOOLEAN *IsMethodInvocation, OUT UINT8 *ArgCount)
 

Detailed Description

AML Method Parser.

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

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

Definition in file AmlMethodParser.h.

Typedef Documentation

◆ AML_NAMESPACE_REF_NODE

AML namespace reference node.

Namespace reference nodes allow to associate an AML absolute pathname to the tree node defining this object in the namespace.

Namespace reference nodes are stored in a separate list. They are not part of the tree.

Function Documentation

◆ AmlAddNameSpaceReference()

EFI_STATUS EFIAPI AmlAddNameSpaceReference ( IN CONST AML_OBJECT_NODE Node,
IN OUT LIST_ENTRY NameSpaceRefList 
)

Create a namespace reference node and add it to the NameSpaceRefList.

When a namespace node is encountered, the namespace it defines must be associated to the node. This allow to keep track of the nature of each name present in the AML namespace.

In the end, this allows to recognize method invocations and parse the right number of arguments after the method name.

Parameters
[in]NodeNamespace node.
[in,out]NameSpaceRefListList of namespace reference nodes.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 1130 of file AmlMethodParser.c.

◆ AmlCreateMethodInvocationNode()

EFI_STATUS EFIAPI AmlCreateMethodInvocationNode ( IN CONST AML_NAMESPACE_REF_NODE NameSpaceRefNode,
IN AML_DATA_NODE MethodInvocationName,
OUT AML_OBJECT_NODE **  MethodInvocationNodePtr 
)

Create a method invocation node.

The AML grammar does not attribute an OpCode/SubOpCode couple for method invocations. This library is representing method invocations as if they had one.

The AML encoding for method invocations in the ACPI specification 6.3 is: MethodInvocation := NameString TermArgList In this library, it is: MethodInvocation := MethodInvocationOp NameString ArgumentCount TermArgList ArgumentCount := ByteData

When computing the size of a tree or serializing it, the additional data is not taken into account (i.e. the MethodInvocationOp and the ArgumentCount).

Method invocation nodes have the AML_METHOD_INVOVATION attribute.

Parameters
[in]NameSpaceRefNodeNameSpaceRef node pointing to the the definition of the invoked method.
[in]MethodInvocationNameData node containing the method invocation name.
[out]MethodInvocationNodePtrCreated method invocation node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 1302 of file AmlMethodParser.c.

◆ AmlDbgPrintNameSpaceRefList()

VOID EFIAPI AmlDbgPrintNameSpaceRefList ( IN CONST LIST_ENTRY NameSpaceRefList)

Print the list of raw absolute paths of the NameSpace reference list.

Parameters
[in]NameSpaceRefListList of NameSpace reference nodes.

Definition at line 159 of file AmlMethodParser.c.

◆ AmlDeleteNameSpaceRefList()

EFI_STATUS EFIAPI AmlDeleteNameSpaceRefList ( IN LIST_ENTRY NameSpaceRefList)

Delete a list of namespace reference nodes.

Parameters
[in]NameSpaceRefListList of namespace reference nodes.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 61 of file AmlMethodParser.c.

◆ AmlGetMethodInvocationArgCount()

EFI_STATUS EFIAPI AmlGetMethodInvocationArgCount ( IN CONST AML_OBJECT_NODE MethodInvocationNode,
OUT BOOLEAN *  IsMethodInvocation,
OUT UINT8 *  ArgCount 
)

Get the number of arguments of a method invocation node.

This function also allow to identify whether a node is a method invocation node. If the input node is not a method invocation node, just return.

Parameters
[in]MethodInvocationNodeMethod invocation node.
[out]IsMethodInvocationBoolean stating whether the input node is a method invocation.
[out]ArgCountNumber of arguments of the method invocation. Set to 0 if MethodInvocationNode is not a method invocation.
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.

Definition at line 1443 of file AmlMethodParser.c.

◆ AmlIsMethodInvocation()

EFI_STATUS EFIAPI AmlIsMethodInvocation ( IN CONST AML_NODE_HEADER ParentNode,
IN CONST AML_STREAM FStream,
IN CONST LIST_ENTRY NameSpaceRefList,
OUT AML_NAMESPACE_REF_NODE **  OutNameSpaceRefNode 
)

Check whether a pathname is a method invocation.

If there is a matching method definition, returns the corresponding NameSpaceRef node.

To do so, the NameSpaceRefList is keeping track of every namespace node and its raw AML absolute path. To check whether a pathname is a method invocation, a corresponding raw absolute pathname is built. This raw absolute pathname is then compared to the list of available pathnames. If a pathname defining a method matches the scope of the input pathname, return.

Parameters
[in]ParentNodeParent node. Node to which the node to be created will be attached.
[in]FStreamForward stream pointing to the NameString to find.
[in]NameSpaceRefListList of NameSpaceRef nodes.
[out]OutNameSpaceRefNodeIf the NameString pointed by FStream is a method invocation, OutNameSpaceRefNode contains the NameSpaceRef corresponding to the method definition. NULL otherwise.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 965 of file AmlMethodParser.c.