/* Add the NewNode before the Node in the list of variable arguments of the Node's parent. */
EFI_STATUS EFIAPI AmlVarListAddBefore(IN AML_NODE_HEADER *Node, IN AML_NODE_HEADER *NewNode)
/* Add the NewNode before the Node in the list of variable arguments of the Node's parent. */
EFI_STATUS EFIAPI AmlVarListAddBefore(IN AML_NODE_HEADER *Node, IN AML_NODE_HEADER *NewNode)
{
  EFI_STATUS       Status;
  AML_NODE_HEADER  *ParentNode;
  UINT32           NewSize;
  if ((!IS_AML_DATA_NODE (NewNode)        &&
       !IS_AML_OBJECT_NODE (NewNode))     ||
      !AML_NODE_IS_DETACHED (NewNode))
  {
    ASSERT (0);
    return EFI_INVALID_PARAMETER;
  }
  ParentNode = AmlGetParent (Node);
  if (!IS_AML_ROOT_NODE (ParentNode)    &&
      !IS_AML_OBJECT_NODE (ParentNode))
  {
    ASSERT (0);
    return EFI_INVALID_PARAMETER;
  }
  InsertTailList (&Node->Link, &NewNode->Link);
  NewNode->Parent = ParentNode;
  Status = AmlComputeSize (NewNode, &NewSize);
  if (EFI_ERROR (Status)) {
    ASSERT (0);
    return Status;
  }
  Status = AmlPropagateInformation (ParentNode, TRUE, NewSize, 1);
  ASSERT_EFI_ERROR (Status);
  return Status;
}