audk/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h

127 lines
3.7 KiB
C
Raw Normal View History

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>
2018-04-20 10:08:22 +02:00
/**
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_