summaryrefslogtreecommitdiffstats
path: root/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2018-04-20 16:08:22 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2018-04-23 17:52:44 +0800
commitee4dc24f57c32a445e7c747396c9bfbd8b221568 (patch)
treea332a4c461762cf555bc62b4eb9930f1bb4888fa /ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
parent8b5c80e0296c7050348a6a89f2cef66190c6141d (diff)
downloadedk2-ee4dc24f57c32a445e7c747396c9bfbd8b221568.tar.gz
edk2-ee4dc24f57c32a445e7c747396c9bfbd8b221568.tar.bz2
edk2-ee4dc24f57c32a445e7c747396c9bfbd8b221568.zip
ShellPkg: Add acpiview tool to dump ACPI tables
This program is provided to allow examination of ACPI table contents from the UEFI Shell. This can help with investigations, especially at that stage where the tables are not enabling an OS to boot. The program is not exhaustive, and only encapsulates detailed knowledge of a limited number of table types. Default behaviour is to display the content of all tables installed. 'Known' table types will be parsed and displayed with descriptions and field values. Where appropriate a degree of consistency checking is done and errors may be reported in the output. Other table types will be displayed as an array of Hexadecimal bytes. To facilitate debugging, the -s and -d options can be used to generate a binary file image of a table that can be copied elsewhere for investigation using tools such as those provided by acpica.org. This is especially relevant for AML type tables like DSDT and SSDT. The inspiration for this is the existing smbiosview Debug1 Shell command. Many tables are not explicitly handled, in part because no examples are available for our testing. The program is designed to be extended to new tables with minimal effort, and contributions are invited. Change-Id: Ifa23dc80ab8ab042c56e88424847e796a8122a7c Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Evan Lloyd <evan.lloyd@arm.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Evan Lloyd <evan.lloyd@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Diffstat (limited to 'ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h')
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h126
1 files changed, 126 insertions, 0 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
new file mode 100644
index 0000000000..a69d56da6c
--- /dev/null
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
@@ -0,0 +1,126 @@
+/**
+ Header file for ACPI table parser
+
+ Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
+
+#ifndef ACPITABLEPARSER_H_
+#define ACPITABLEPARSER_H_
+
+/** The maximum number of ACPI table parsers.
+*/
+#define MAX_ACPI_TABLE_PARSERS 16
+
+/** An invalid/NULL signature value.
+*/
+#define ACPI_PARSER_SIGNATURE_NULL 0
+
+/** A function that parses the ACPI table.
+
+ @param [in] Trace If TRUE, trace the ACPI fields.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] AcpiTableLength Length of the ACPI table.
+ @param [in] AcpiTableRevision Revision of the ACPI table.
+*/
+typedef
+VOID
+(EFIAPI * PARSE_ACPI_TABLE_PROC) (
+ IN BOOLEAN Trace,
+ IN UINT8* Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
+ );
+
+/** The ACPI table parser information
+*/
+typedef struct AcpiTableParser {
+ /// ACPI table signature
+ UINT32 Signature;
+
+ /// The ACPI table parser function.
+ PARSE_ACPI_TABLE_PROC Parser;
+} ACPI_TABLE_PARSER;
+
+/** Register the ACPI table Parser
+
+ This function registers the ACPI table parser.
+
+ @param [in] Signature The ACPI table signature.
+ @param [in] ParserProc The ACPI table parser.
+
+ @retval EFI_SUCCESS The parser is registered.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_ALREADY_STARTED The parser for the Table
+ was already registered.
+ @retval EFI_OUT_OF_RESOURCES No space to register the
+ parser.
+*/
+EFI_STATUS
+EFIAPI
+RegisterParser (
+ IN UINT32 Signature,
+ IN PARSE_ACPI_TABLE_PROC ParserProc
+);
+
+/** Deregister the ACPI table Parser
+
+ This function deregisters the ACPI table parser.
+
+ @param [in] Signature The ACPI table signature.
+
+ @retval EFI_SUCCESS The parser was deregistered.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND A registered parser was not found.
+*/
+EFI_STATUS
+EFIAPI
+DeregisterParser (
+ IN UINT32 Signature
+);
+
+/** This function processes the ACPI tables.
+ This function calls ProcessTableReportOptions() to list the ACPI
+ tables, perform binary dump of the tables and determine if the
+ ACPI fields should be traced.
+
+ This function also invokes the parser for the ACPI tables.
+
+ This function also performs a RAW dump of the ACPI table including
+ the unknown/unparsed ACPI tables and validates the checksum.
+
+ @param [in] Ptr Pointer to the start of the ACPI
+ table data buffer.
+*/
+VOID
+EFIAPI
+ProcessAcpiTable (
+ IN UINT8* Ptr
+ );
+
+/** Get the ACPI table Parser
+
+ This function returns the ACPI table parser proc from the list of
+ registered parsers.
+
+ @param [in] Signature The ACPI table signature.
+ @param [out] ParserProc Pointer to a ACPI table parser proc.
+
+ @retval EFI_SUCCESS The parser was returned successfully.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND A registered parser was not found.
+*/
+EFI_STATUS
+EFIAPI
+GetParser (
+ IN UINT32 Signature,
+ OUT PARSE_ACPI_TABLE_PROC * ParserProc
+ );
+
+#endif // ACPITABLEPARSER_H_