/* Create a handle for the first ACPI opcode in an ACPI system description table. */
EFI_STATUS SdtOpenSdtTable(IN UINTN TableKey, OUT EFI_ACPI_HANDLE *Handle)
/* Create a handle for the first ACPI opcode in an ACPI system description table. */
EFI_STATUS SdtOpenSdtTable(IN UINTN TableKey, OUT EFI_ACPI_HANDLE *Handle)
{
  EFI_ACPI_TABLE_INSTANCE  *AcpiTableInstance;
  EFI_STATUS               Status;
  EFI_ACPI_TABLE_LIST      *Table;
  EFI_AML_HANDLE           *AmlHandle;
  AcpiTableInstance = SdtGetAcpiTableInstance ();
  Status = FindTableByHandle (
             TableKey,
             &AcpiTableInstance->TableList,
             &Table
             );
  if (EFI_ERROR (Status)) {
    return EFI_NOT_FOUND;
  }
  AmlHandle = AllocatePool (sizeof (*AmlHandle));
  ASSERT (AmlHandle != NULL);
  AmlHandle->Signature       = EFI_AML_ROOT_HANDLE_SIGNATURE;
  AmlHandle->Buffer          = (VOID *)((UINTN)Table->Table + sizeof (EFI_ACPI_SDT_HEADER));
  AmlHandle->Size            = Table->Table->Length - sizeof (EFI_ACPI_SDT_HEADER);
  AmlHandle->AmlByteEncoding = NULL;
  AmlHandle->Modified        = FALSE;
  *Handle = (EFI_ACPI_HANDLE)AmlHandle;
  return EFI_SUCCESS;
}