]> git.proxmox.com Git - mirror_edk2.git/commitdiff
DynamicTablesPkg: Add AmlAttachNode()
authorPierre Gondois <Pierre.Gondois@arm.com>
Thu, 9 Dec 2021 09:25:02 +0000 (10:25 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 13 Dec 2021 12:48:42 +0000 (12:48 +0000)
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>
DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c

index 9ca34f61ba88c44b27a81fb952794d4f6c0a9408..af18bf8e487182739b2a4ec16cea53a2956c12cc 100644 (file)
@@ -166,6 +166,39 @@ AmlDetachNode (
   IN  AML_NODE_HANDLE  Node\r
   );\r
 \r
+/** Attach a node in an AML tree.\r
+\r
+  The node will be added as the last statement of the ParentNode.\r
+  E.g.:\r
+  ASL code corresponding to NewNode:\r
+  Name (_UID, 0)\r
+\r
+  ASL code corresponding to ParentNode:\r
+  Device (PCI0) {\r
+    Name(_HID, EISAID("PNP0A08"))\r
+  }\r
+\r
+  "AmlAttachNode (ParentNode, NewNode)" will result in:\r
+  ASL code:\r
+  Device (PCI0) {\r
+    Name(_HID, EISAID("PNP0A08"))\r
+    Name (_UID, 0)\r
+  }\r
+\r
+  @param  [in]  ParentNode  Pointer to the parent node.\r
+                            Must be a root or an object node.\r
+  @param  [in]  NewNode     Pointer to the node to add.\r
+\r
+  @retval EFI_SUCCESS             The function completed successfully.\r
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+AmlAttachNode (\r
+  IN  AML_NODE_HANDLE  ParentNode,\r
+  IN  AML_NODE_HANDLE  NewNode\r
+  );\r
+\r
 /** Find a node in the AML namespace, given an ASL path and a reference Node.\r
 \r
    - The AslPath can be an absolute path, or a relative path from the\r
index e6802d211eb7bc1972579baa0a562b0277d4d46d..519afdc1eafa4de89ea97f4468941bddec09801f 100644 (file)
@@ -394,6 +394,42 @@ AmlNameOpGetNextRdNode (
   return EFI_SUCCESS;\r
 }\r
 \r
+/** Attach a node in an AML tree.\r
+\r
+  The node will be added as the last statement of the ParentNode.\r
+  E.g.:\r
+  ASL code corresponding to NewNode:\r
+  Name (_UID, 0)\r
+\r
+  ASL code corresponding to ParentNode:\r
+  Device (PCI0) {\r
+    Name(_HID, EISAID("PNP0A08"))\r
+  }\r
+\r
+  "AmlAttachNode (ParentNode, NewNode)" will result in:\r
+  ASL code:\r
+  Device (PCI0) {\r
+    Name(_HID, EISAID("PNP0A08"))\r
+    Name (_UID, 0)\r
+  }\r
+\r
+  @param  [in]  ParentNode  Pointer to the parent node.\r
+                            Must be a root or an object node.\r
+  @param  [in]  NewNode     Pointer to the node to add.\r
+\r
+  @retval EFI_SUCCESS             The function completed successfully.\r
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+AmlAttachNode (\r
+  IN  AML_NODE_HANDLE  ParentNode,\r
+  IN  AML_NODE_HANDLE  NewNode\r
+  )\r
+{\r
+  return AmlVarListAddTail (ParentNode, NewNode);\r
+}\r
+\r
 // DEPRECATED APIS\r
 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r
 \r