summaryrefslogtreecommitdiffstats
path: root/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c
diff options
context:
space:
mode:
Diffstat (limited to 'DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c')
-rw-r--r--DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c147
1 files changed, 115 insertions, 32 deletions
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c b/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c
index fdf04acc62..6f9e3f6f28 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c
@@ -1,7 +1,7 @@
/** @file
AML Api.
- Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -222,7 +222,7 @@ AmlNameOpUpdateString (
return Status;
}
-/** Get the first Resource Data element contained in a "_CRS" object.
+/** 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.
@@ -233,35 +233,33 @@ AmlNameOpUpdateString (
)
Note:
- - The "_CRS" object must be declared using ASL "Name (Declare Named Object)".
- - "_CRS" declared using ASL "Method (Declare Control Method)" is not
- supported.
+ "_CRS" names defined as methods are not handled by this function.
+ They must be defined as names, using the "Name ()" statement.
- @param [in] NameOpCrsNode NameOp 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.
- @param [out] OutRdNode Pointer to the first Resource Data element of
- the "_CRS" object. A Resource Data element
- is stored in a data node.
+ @param [in] NameOpNode NameOp 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.
+ @param [out] OutRdNode Pointer to the first Resource Data element of
+ the named object. A Resource Data element
+ is stored in a data node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EFIAPI
-AmlNameOpCrsGetFirstRdNode (
- IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
+AmlNameOpGetFirstRdNode (
+ IN AML_OBJECT_NODE_HANDLE NameOpNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode
)
{
AML_OBJECT_NODE_HANDLE BufferOpNode;
AML_DATA_NODE_HANDLE FirstRdNode;
- if ((NameOpCrsNode == NULL) ||
- (AmlGetNodeType ((AML_NODE_HANDLE)NameOpCrsNode) != EAmlNodeObject) ||
- (!AmlNodeHasOpCode (NameOpCrsNode, AML_NAME_OP, 0)) ||
- (!AmlNameOpCompareName (NameOpCrsNode, "_CRS")) ||
+ if ((NameOpNode == NULL) ||
+ (AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
+ (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)) ||
(OutRdNode == NULL)) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -269,10 +267,10 @@ AmlNameOpCrsGetFirstRdNode (
*OutRdNode = NULL;
- // Get the _CRS value which is represented as a BufferOp object node
- // which is the 2nd fixed argument (i.e. index 1).
+ // Get the value of the variable which is represented as a BufferOp object
+ // node which is the 2nd fixed argument (i.e. index 1).
BufferOpNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument (
- NameOpCrsNode,
+ NameOpNode,
EAmlParseIndexTerm1
);
if ((BufferOpNode == NULL) ||
@@ -310,11 +308,12 @@ AmlNameOpCrsGetFirstRdNode (
}
)
- The CurrRdNode Resource Data node must be defined in an object named "_CRS"
- and defined by a "Name ()" ASL function.
+ Note:
+ "_CRS" names defined as methods are not handled by this function.
+ They must be defined as names, using the "Name ()" statement.
@param [in] CurrRdNode Pointer to the current Resource Data element of
- the "_CRS" object.
+ the named object.
@param [out] OutRdNode Pointer to the Resource Data element following
the CurrRdNode.
Contain a NULL pointer if CurrRdNode is the
@@ -327,12 +326,12 @@ AmlNameOpCrsGetFirstRdNode (
**/
EFI_STATUS
EFIAPI
-AmlNameOpCrsGetNextRdNode (
+AmlNameOpGetNextRdNode (
IN AML_DATA_NODE_HANDLE CurrRdNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode
)
{
- AML_OBJECT_NODE_HANDLE NameOpCrsNode;
+ AML_OBJECT_NODE_HANDLE NameOpNode;
AML_OBJECT_NODE_HANDLE BufferOpNode;
if ((CurrRdNode == NULL) ||
@@ -356,12 +355,11 @@ AmlNameOpCrsGetNextRdNode (
}
// The parent of the BufferOpNode must be a NameOp node.
- NameOpCrsNode = (AML_OBJECT_NODE_HANDLE)AmlGetParent (
- (AML_NODE_HANDLE)BufferOpNode
- );
- if ((NameOpCrsNode == NULL) ||
- (!AmlNodeHasOpCode (NameOpCrsNode, AML_NAME_OP, 0)) ||
- (!AmlNameOpCompareName (NameOpCrsNode, "_CRS"))) {
+ NameOpNode = (AML_OBJECT_NODE_HANDLE)AmlGetParent (
+ (AML_NODE_HANDLE)BufferOpNode
+ );
+ if ((NameOpNode == NULL) ||
+ (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -380,3 +378,88 @@ AmlNameOpCrsGetNextRdNode (
return EFI_SUCCESS;
}
+
+// DEPRECATED APIS
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
+
+/** 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.
+
+ @ingroup UserApis
+
+ @param [in] NameOpCrsNode NameOp 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.
+ @param [out] OutRdNode Pointer to the first Resource Data element of
+ the "_CRS" object. A Resource Data element
+ is stored in a data node.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+AmlNameOpCrsGetFirstRdNode (
+ IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
+ OUT AML_DATA_NODE_HANDLE * OutRdNode
+ )
+{
+ return AmlNameOpGetFirstRdNode (NameOpCrsNode, 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.
+
+ @ingroup UserApis
+
+ @param [in] CurrRdNode Pointer to the current Resource Data element of
+ the "_CRS" variable.
+ @param [out] OutRdNode Pointer 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.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+AmlNameOpCrsGetNextRdNode (
+ IN AML_DATA_NODE_HANDLE CurrRdNode,
+ OUT AML_DATA_NODE_HANDLE * OutRdNode
+ )
+{
+ return AmlNameOpGetNextRdNode (CurrRdNode, OutRdNode);
+}
+
+#endif // DISABLE_NEW_DEPRECATED_INTERFACES