AcpiTableParser.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /** @file
  2. Header file for ACPI table parser
  3. Copyright (c) 2016 - 2020, Arm Limited. All rights reserved.
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef ACPITABLEPARSER_H_
  7. #define ACPITABLEPARSER_H_
  8. /**
  9. The maximum number of ACPI table parsers.
  10. */
  11. #define MAX_ACPI_TABLE_PARSERS 32
  12. /** An invalid/NULL signature value.
  13. */
  14. #define ACPI_PARSER_SIGNATURE_NULL 0
  15. /**
  16. A function that parses the ACPI table.
  17. @param [in] Trace If TRUE, trace the ACPI fields.
  18. @param [in] Ptr Pointer to the start of the buffer.
  19. @param [in] AcpiTableLength Length of the ACPI table.
  20. @param [in] AcpiTableRevision Revision of the ACPI table.
  21. **/
  22. typedef
  23. VOID
  24. (EFIAPI *PARSE_ACPI_TABLE_PROC)(
  25. IN BOOLEAN Trace,
  26. IN UINT8 *Ptr,
  27. IN UINT32 AcpiTableLength,
  28. IN UINT8 AcpiTableRevision
  29. );
  30. /**
  31. The ACPI table parser information
  32. **/
  33. typedef struct AcpiTableParser {
  34. /// ACPI table signature
  35. UINT32 Signature;
  36. /// The ACPI table parser function.
  37. PARSE_ACPI_TABLE_PROC Parser;
  38. } ACPI_TABLE_PARSER;
  39. /**
  40. Register the ACPI table Parser
  41. This function registers the ACPI table parser.
  42. @param [in] Signature The ACPI table signature.
  43. @param [in] ParserProc The ACPI table parser.
  44. @retval EFI_SUCCESS The parser is registered.
  45. @retval EFI_INVALID_PARAMETER A parameter is invalid.
  46. @retval EFI_ALREADY_STARTED The parser for the Table
  47. was already registered.
  48. @retval EFI_OUT_OF_RESOURCES No space to register the
  49. parser.
  50. **/
  51. EFI_STATUS
  52. EFIAPI
  53. RegisterParser (
  54. IN UINT32 Signature,
  55. IN PARSE_ACPI_TABLE_PROC ParserProc
  56. );
  57. /**
  58. Deregister the ACPI table Parser
  59. This function deregisters the ACPI table parser.
  60. @param [in] Signature The ACPI table signature.
  61. @retval EFI_SUCCESS The parser was deregistered.
  62. @retval EFI_INVALID_PARAMETER A parameter is invalid.
  63. @retval EFI_NOT_FOUND A registered parser was not found.
  64. **/
  65. EFI_STATUS
  66. EFIAPI
  67. DeregisterParser (
  68. IN UINT32 Signature
  69. );
  70. /**
  71. This function processes the ACPI tables.
  72. This function calls ProcessTableReportOptions() to list the ACPI
  73. tables, perform binary dump of the tables and determine if the
  74. ACPI fields should be traced.
  75. This function also invokes the parser for the ACPI tables.
  76. This function also performs a RAW dump of the ACPI table including
  77. the unknown/unparsed ACPI tables and validates the checksum.
  78. @param [in] Ptr Pointer to the start of the ACPI
  79. table data buffer.
  80. **/
  81. VOID
  82. EFIAPI
  83. ProcessAcpiTable (
  84. IN UINT8 *Ptr
  85. );
  86. /**
  87. Get the ACPI table Parser
  88. This function returns the ACPI table parser proc from the list of
  89. registered parsers.
  90. @param [in] Signature The ACPI table signature.
  91. @param [out] ParserProc Pointer to a ACPI table parser proc.
  92. @retval EFI_SUCCESS The parser was returned successfully.
  93. @retval EFI_INVALID_PARAMETER A parameter is invalid.
  94. @retval EFI_NOT_FOUND A registered parser was not found.
  95. **/
  96. EFI_STATUS
  97. EFIAPI
  98. GetParser (
  99. IN UINT32 Signature,
  100. OUT PARSE_ACPI_TABLE_PROC *ParserProc
  101. );
  102. #endif // ACPITABLEPARSER_H_