/* The following structures are not considered elements in the list of ACPI tables: */
EFI_STATUS SdtGetAcpiTable(IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance, IN UINTN Index, OUT EFI_ACPI_SDT_HEADER **Table, OUT EFI_ACPI_TABLE_VERSION *Version, OUT UINTN *TableKey)
/* The following structures are not considered elements in the list of ACPI tables: */
EFI_STATUS SdtGetAcpiTable(IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance, IN UINTN Index, OUT EFI_ACPI_SDT_HEADER **Table, OUT EFI_ACPI_TABLE_VERSION *Version, OUT UINTN *TableKey)
{
  UINTN                TableIndex;
  LIST_ENTRY           *CurrentLink;
  LIST_ENTRY           *StartLink;
  EFI_ACPI_TABLE_LIST  *CurrentTable;
  StartLink   = &AcpiTableInstance->TableList;
  CurrentLink = StartLink->ForwardLink;
  TableIndex  = 0;
  while (CurrentLink != StartLink) {
    if (TableIndex == Index) {
      break;
    }
    CurrentLink = CurrentLink->ForwardLink;
    TableIndex++;
  }
  if ((TableIndex != Index) || (CurrentLink == StartLink)) {
    return EFI_NOT_FOUND;
  }
  CurrentTable = EFI_ACPI_TABLE_LIST_FROM_LINK (CurrentLink);
  *TableKey    = CurrentTable->Handle;
  *Version     = CurrentTable->Version;
  *Table       = (EFI_ACPI_SDT_HEADER *)CurrentTable->Table;
  return EFI_SUCCESS;
}