Ruiyu Ni ee4dc24f57 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-23 17:52:44 +08:00

104 lines
2.5 KiB
C

/**
Header file for AcpiView
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 ACPIVIEW_H_
#define ACPIVIEW_H_
/** A macro to define the max file name length
*/
#define MAX_FILE_NAME_LEN 128
/** Offset to the RSDP revision from the start of the RSDP
*/
#define RSDP_REVISION_OFFSET 15
/** Offset to the RSDP length from the start of the RSDP
*/
#define RSDP_LENGTH_OFFSET 20
/** The EREPORT_OPTION enum describes ACPI table Reporting options.
*/
typedef enum ReportOption {
EREPORT_ALL, ///< Report All tables.
EREPORT_SELECTED, ///< Report Selected table.
EREPORT_TABLE_LIST, ///< Report List of tables.
EREPORT_DUMP_BIN_FILE, ///< Dump selected table to a file.
EREPORT_MAX
} EREPORT_OPTION;
/** This function resets the ACPI table error counter to Zero.
*/
VOID
ResetErrorCount (
VOID
);
/** This function returns the ACPI table error count.
@retval Returns the count of errors detected in the ACPI tables.
*/
UINT32
GetErrorCount (
VOID
);
/** This function resets the ACPI table warning counter to Zero.
*/
VOID
ResetWarningCount (
VOID
);
/** This function returns the ACPI table warning count.
@retval Returns the count of warning detected in the ACPI tables.
*/
UINT32
GetWarningCount (
VOID
);
/** This function returns the colour highlighting status.
@retval TRUE if colour highlighting is enabled.
*/
BOOLEAN
GetColourHighlighting (
VOID
);
/** This function sets the colour highlighting status.
*/
VOID
SetColourHighlighting (
BOOLEAN Highlight
);
/** This function processes the table reporting options for the ACPI table.
@param [in] Signature The ACPI table Signature.
@param [in] TablePtr Pointer to the ACPI table data.
@param [in] Length The length fo the ACPI table.
@retval Returns TRUE if the ACPI table should be traced.
*/
BOOLEAN
ProcessTableReportOptions (
IN CONST UINT32 Signature,
IN CONST UINT8* TablePtr,
IN CONST UINT32 Length
);
#endif // ACPIVIEW_H_