]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
ShellPkg: Add acpiview tool to dump ACPI tables
[mirror_edk2.git] / ShellPkg / Library / UefiShellAcpiViewCommandLib / AcpiTableParser.h
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
new file mode 100644 (file)
index 0000000..a69d56d
--- /dev/null
@@ -0,0 +1,126 @@
+/**\r
+  Header file for ACPI table parser\r
+\r
+  Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+\r
+#ifndef ACPITABLEPARSER_H_\r
+#define ACPITABLEPARSER_H_\r
+\r
+/** The maximum number of ACPI table parsers.\r
+*/\r
+#define MAX_ACPI_TABLE_PARSERS          16\r
+\r
+/** An invalid/NULL signature value.\r
+*/\r
+#define ACPI_PARSER_SIGNATURE_NULL      0\r
+\r
+/** A function that parses the ACPI table.\r
+\r
+  @param [in] Trace              If TRUE, trace the ACPI fields.\r
+  @param [in] Ptr                Pointer to the start of the buffer.\r
+  @param [in] AcpiTableLength    Length of the ACPI table.\r
+  @param [in] AcpiTableRevision  Revision of the ACPI table.\r
+*/\r
+typedef\r
+VOID\r
+(EFIAPI * PARSE_ACPI_TABLE_PROC) (\r
+  IN BOOLEAN Trace,\r
+  IN UINT8*  Ptr,\r
+  IN UINT32  AcpiTableLength,\r
+  IN UINT8   AcpiTableRevision\r
+  );\r
+\r
+/** The ACPI table parser information\r
+*/\r
+typedef struct AcpiTableParser {\r
+  /// ACPI table signature\r
+  UINT32                  Signature;\r
+\r
+  /// The ACPI table parser function.\r
+  PARSE_ACPI_TABLE_PROC   Parser;\r
+} ACPI_TABLE_PARSER;\r
+\r
+/** Register the ACPI table Parser\r
+\r
+  This function registers the ACPI table parser.\r
+\r
+  @param [in] Signature   The ACPI table signature.\r
+  @param [in] ParserProc  The ACPI table parser.\r
+\r
+  @retval EFI_SUCCESS           The parser is registered.\r
+  @retval EFI_INVALID_PARAMETER A parameter is invalid.\r
+  @retval EFI_ALREADY_STARTED   The parser for the Table\r
+                                was already registered.\r
+  @retval EFI_OUT_OF_RESOURCES  No space to register the\r
+                                parser.\r
+*/\r
+EFI_STATUS\r
+EFIAPI\r
+RegisterParser (\r
+  IN  UINT32                  Signature,\r
+  IN  PARSE_ACPI_TABLE_PROC   ParserProc\r
+);\r
+\r
+/** Deregister the ACPI table Parser\r
+\r
+  This function deregisters the ACPI table parser.\r
+\r
+  @param [in] Signature   The ACPI table signature.\r
+\r
+  @retval EFI_SUCCESS           The parser was deregistered.\r
+  @retval EFI_INVALID_PARAMETER A parameter is invalid.\r
+  @retval EFI_NOT_FOUND         A registered parser was not found.\r
+*/\r
+EFI_STATUS\r
+EFIAPI\r
+DeregisterParser (\r
+  IN  UINT32                  Signature\r
+);\r
+\r
+/** This function processes the ACPI tables.\r
+  This function calls ProcessTableReportOptions() to list the ACPI\r
+  tables, perform binary dump of the tables and determine if the\r
+  ACPI fields should be traced.\r
+\r
+  This function also invokes the parser for the ACPI tables.\r
+\r
+  This function also performs a RAW dump of the ACPI table including\r
+  the unknown/unparsed ACPI tables and validates the checksum.\r
+\r
+  @param [in] Ptr                Pointer to the start of the ACPI\r
+                                 table data buffer.\r
+*/\r
+VOID\r
+EFIAPI\r
+ProcessAcpiTable (\r
+  IN UINT8* Ptr\r
+  );\r
+\r
+/** Get the ACPI table Parser\r
+\r
+  This function returns the ACPI table parser proc from the list of\r
+  registered parsers.\r
+\r
+  @param [in]  Signature   The ACPI table signature.\r
+  @param [out] ParserProc  Pointer to a ACPI table parser proc.\r
+\r
+  @retval EFI_SUCCESS           The parser was returned successfully.\r
+  @retval EFI_INVALID_PARAMETER A parameter is invalid.\r
+  @retval EFI_NOT_FOUND         A registered parser was not found.\r
+*/\r
+EFI_STATUS\r
+EFIAPI\r
+GetParser (\r
+  IN  UINT32                   Signature,\r
+  OUT PARSE_ACPI_TABLE_PROC *  ParserProc\r
+  );\r
+\r
+#endif // ACPITABLEPARSER_H_\r