/* This function finds the table specified by the buffer. */
EFI_ACPI_TABLE_LIST* FindTableByBuffer(IN VOID *Buffer)
/* This function finds the table specified by the buffer. */
EFI_ACPI_TABLE_LIST* FindTableByBuffer(IN VOID *Buffer)
{
  EFI_ACPI_TABLE_INSTANCE  *AcpiTableInstance;
  LIST_ENTRY               *CurrentLink;
  EFI_ACPI_TABLE_LIST      *CurrentTableList;
  LIST_ENTRY               *StartLink;
  AcpiTableInstance = SdtGetAcpiTableInstance ();
  StartLink   = &AcpiTableInstance->TableList;
  CurrentLink = StartLink->ForwardLink;
  while (CurrentLink != StartLink) {
    CurrentTableList = EFI_ACPI_TABLE_LIST_FROM_LINK (CurrentLink);
    if (((UINTN)CurrentTableList->Table <= (UINTN)Buffer) &&
        ((UINTN)CurrentTableList->Table + CurrentTableList->TableSize > (UINTN)Buffer))
    {
      return CurrentTableList;
    }
    CurrentLink = CurrentLink->ForwardLink;
  }
  return NULL;
}