/* The input SdtHeader information is copied to the tree RootNode. The table Length field is automatically updated. The checksum field is only updated when serializing the tree. */
EFI_STATUS EFIAPI AmlUpdateRootNode(IN AML_ROOT_NODE *RootNode, IN CONST EFI_ACPI_DESCRIPTION_HEADER *SdtHeader)
/* The input SdtHeader information is copied to the tree RootNode. The table Length field is automatically updated. The checksum field is only updated when serializing the tree. */
EFI_STATUS EFIAPI AmlUpdateRootNode(IN AML_ROOT_NODE *RootNode, IN CONST EFI_ACPI_DESCRIPTION_HEADER *SdtHeader)
{
  EFI_STATUS  Status;
  UINT32      Length;
  if (!IS_AML_ROOT_NODE (RootNode)  ||
      (SdtHeader == NULL)           ||
      ((SdtHeader->Signature !=
        EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) &&
       (SdtHeader->Signature !=
        EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)))
  {
    ASSERT (0);
    return EFI_INVALID_PARAMETER;
  }
  CopyMem (
    RootNode->SdtHeader,
    SdtHeader,
    sizeof (EFI_ACPI_DESCRIPTION_HEADER)
    );
  Status = AmlComputeSize ((AML_NODE_HEADER *)RootNode, &Length);
  if (EFI_ERROR (Status)) {
    ASSERT (0);
    return Status;
  }
  RootNode->SdtHeader->Length = Length +
                                (UINT32)sizeof (EFI_ACPI_DESCRIPTION_HEADER);
  return Status;
}