summaryrefslogtreecommitdiffstats
path: root/DynamicTablesPkg
diff options
context:
space:
mode:
authorPierre Gondois <Pierre.Gondois@arm.com>2021-12-09 10:25:02 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-13 12:48:42 +0000
commit69ddfee1c378650645fce5970ccb6577d43c4076 (patch)
treed5abe32ed8626bdd3555fcdca36c093edb2b915e /DynamicTablesPkg
parentb2b8def4e38a9b35ea0e466d7541f920c8d06678 (diff)
downloadedk2-69ddfee1c378650645fce5970ccb6577d43c4076.tar.gz
edk2-69ddfee1c378650645fce5970ccb6577d43c4076.tar.bz2
edk2-69ddfee1c378650645fce5970ccb6577d43c4076.zip
DynamicTablesPkg: Add AmlAttachNode()
This function allows to add a node as the last node of a parent node in an AML tree. For instance, ASL code corresponding to NewNode: Name (_UID, 0) ASL code corresponding to ParentNode: Device (PCI0) { Name(_HID, EISAID("PNP0A08")) } "AmlAttachNode (ParentNode, NewNode)" will result in: ASL code: Device (PCI0) { Name(_HID, EISAID("PNP0A08")) Name (_UID, 0) } To: Sami Mujawar <sami.mujawar@arm.com> To: Alexei Fedorov <Alexei.Fedorov@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Diffstat (limited to 'DynamicTablesPkg')
-rw-r--r--DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h33
-rw-r--r--DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c36
2 files changed, 69 insertions, 0 deletions
diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
index 9ca34f61ba..af18bf8e48 100644
--- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
+++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
@@ -166,6 +166,39 @@ AmlDetachNode (
IN AML_NODE_HANDLE Node
);
+/** Attach a node in an AML tree.
+
+ The node will be added as the last statement of the ParentNode.
+ E.g.:
+ ASL code corresponding to NewNode:
+ Name (_UID, 0)
+
+ ASL code corresponding to ParentNode:
+ Device (PCI0) {
+ Name(_HID, EISAID("PNP0A08"))
+ }
+
+ "AmlAttachNode (ParentNode, NewNode)" will result in:
+ ASL code:
+ Device (PCI0) {
+ Name(_HID, EISAID("PNP0A08"))
+ Name (_UID, 0)
+ }
+
+ @param [in] ParentNode Pointer to the parent node.
+ Must be a root or an object node.
+ @param [in] NewNode Pointer to the node to add.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+AmlAttachNode (
+ IN AML_NODE_HANDLE ParentNode,
+ IN AML_NODE_HANDLE NewNode
+ );
+
/** Find a node in the AML namespace, given an ASL path and a reference Node.
- The AslPath can be an absolute path, or a relative path from the
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c b/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c
index e6802d211e..519afdc1ea 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c
@@ -394,6 +394,42 @@ AmlNameOpGetNextRdNode (
return EFI_SUCCESS;
}
+/** Attach a node in an AML tree.
+
+ The node will be added as the last statement of the ParentNode.
+ E.g.:
+ ASL code corresponding to NewNode:
+ Name (_UID, 0)
+
+ ASL code corresponding to ParentNode:
+ Device (PCI0) {
+ Name(_HID, EISAID("PNP0A08"))
+ }
+
+ "AmlAttachNode (ParentNode, NewNode)" will result in:
+ ASL code:
+ Device (PCI0) {
+ Name(_HID, EISAID("PNP0A08"))
+ Name (_UID, 0)
+ }
+
+ @param [in] ParentNode Pointer to the parent node.
+ Must be a root or an object node.
+ @param [in] NewNode Pointer to the node to add.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+AmlAttachNode (
+ IN AML_NODE_HANDLE ParentNode,
+ IN AML_NODE_HANDLE NewNode
+ )
+{
+ return AmlVarListAddTail (ParentNode, NewNode);
+}
+
// DEPRECATED APIS
#ifndef DISABLE_NEW_DEPRECATED_INTERFACES