Acpi.c 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /** @file
  2. This module provides help function for finding ACPI table.
  3. Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #include "UefiLibInternal.h"
  7. #include <IndustryStandard/Acpi.h>
  8. /**
  9. This function locates next ACPI table in XSDT/RSDT based on Signature and
  10. previous returned Table.
  11. If PreviousTable is NULL:
  12. This function will locate the first ACPI table in XSDT/RSDT based on
  13. Signature in gEfiAcpi20TableGuid system configuration table first, and then
  14. gEfiAcpi10TableGuid system configuration table.
  15. This function will locate in XSDT first, and then RSDT.
  16. For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in
  17. FADT.
  18. For FACS, this function will locate XFirmwareCtrl in FADT first, and then
  19. FirmwareCtrl in FADT.
  20. If PreviousTable is not NULL:
  21. 1. If it could be located in XSDT in gEfiAcpi20TableGuid system configuration
  22. table, then this function will just locate next table in XSDT in
  23. gEfiAcpi20TableGuid system configuration table.
  24. 2. If it could be located in RSDT in gEfiAcpi20TableGuid system configuration
  25. table, then this function will just locate next table in RSDT in
  26. gEfiAcpi20TableGuid system configuration table.
  27. 3. If it could be located in RSDT in gEfiAcpi10TableGuid system configuration
  28. table, then this function will just locate next table in RSDT in
  29. gEfiAcpi10TableGuid system configuration table.
  30. It's not supported that PreviousTable is not NULL but PreviousTable->Signature
  31. is not same with Signature, NULL will be returned.
  32. @param Signature ACPI table signature.
  33. @param PreviousTable Pointer to previous returned table to locate next
  34. table, or NULL to locate first table.
  35. @return Next ACPI table or NULL if not found.
  36. **/
  37. EFI_ACPI_COMMON_HEADER *
  38. EFIAPI
  39. EfiLocateNextAcpiTable (
  40. IN UINT32 Signature,
  41. IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL
  42. )
  43. {
  44. ASSERT (FALSE);
  45. return NULL;
  46. }
  47. /**
  48. This function locates first ACPI table in XSDT/RSDT based on Signature.
  49. This function will locate the first ACPI table in XSDT/RSDT based on
  50. Signature in gEfiAcpi20TableGuid system configuration table first, and then
  51. gEfiAcpi10TableGuid system configuration table.
  52. This function will locate in XSDT first, and then RSDT.
  53. For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in
  54. FADT.
  55. For FACS, this function will locate XFirmwareCtrl in FADT first, and then
  56. FirmwareCtrl in FADT.
  57. @param Signature ACPI table signature.
  58. @return First ACPI table or NULL if not found.
  59. **/
  60. EFI_ACPI_COMMON_HEADER *
  61. EFIAPI
  62. EfiLocateFirstAcpiTable (
  63. IN UINT32 Signature
  64. )
  65. {
  66. return EfiLocateNextAcpiTable (Signature, NULL);
  67. }