ShellPkg: acpiview: Allow disabling consistency checks (-q flag)

The current documentation for the acpiview UEFI shell tool states
that the '-c' flag enables consistency checks on ACPI table data.
However, these checks are enabled anyway by default.

This patch keeps ACPI table validation as a default option, but it
makes it possible to turn ACPI table validation off by setting the
newly-introduced '-q' flag. Consequently, the '-c' flag is removed.

The remaining code changes in this patch make a number of consistency
checks optional (but enabled by default):
1. ACPI table field offset mismatch.
2. ACPI table field validation functions provided in the ACPI_PARSER
   arrays.
3. Table checksum computation.

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
This commit is contained in:
Krzysztof Koch
2019-06-28 16:56:58 +08:00
committed by Ray Ni
parent 3d31443502
commit f73843d56d
5 changed files with 65 additions and 9 deletions

View File

@ -33,7 +33,7 @@ STATIC BOOLEAN mColourHighlighting;
An array of acpiview command line parameters.
**/
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
{L"-c", TypeFlag},
{L"-q", TypeFlag},
{L"-d", TypeFlag},
{L"-h", TypeValue},
{L"-l", TypeFlag},
@ -69,6 +69,33 @@ SetColourHighlighting (
mColourHighlighting = Highlight;
}
/**
This function returns the consistency checking status.
@retval TRUE if consistency checking is enabled.
**/
BOOLEAN
GetConsistencyChecking (
VOID
)
{
return mConsistencyCheck;
}
/**
This function sets the consistency checking status.
@param ConsistencyChecking The consistency checking status.
**/
VOID
SetConsistencyChecking (
BOOLEAN ConsistencyChecking
)
{
mConsistencyCheck = ConsistencyChecking;
}
/**
This function returns the report options.
@ -380,7 +407,8 @@ AcpiView (
(ReportDumpBinFile == ReportOption)) &&
(!mSelectedAcpiTableFound)) {
Print (L"\nRequested ACPI Table not found.\n");
} else if (ReportDumpBinFile != ReportOption) {
} else if (GetConsistencyChecking () &&
(ReportDumpBinFile != ReportOption)) {
OriginalAttribute = gST->ConOut->Mode->Attribute;
Print (L"\nTable Statistics:\n");
@ -554,6 +582,9 @@ ShellCommandRunAcpiView (
}
}
// Surpress consistency checking if requested
SetConsistencyChecking (!ShellCommandLineGetFlag (Package, L"-q"));
if (ShellCommandLineGetFlag (Package, L"-l")) {
mReportType = ReportTableList;
} else {