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:
@ -506,7 +506,8 @@ ParseAcpi (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Offset != Parser[Index].Offset) {
|
if (GetConsistencyChecking () &&
|
||||||
|
(Offset != Parser[Index].Offset)) {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"\nERROR: %a: Offset Mismatch for %s\n"
|
L"\nERROR: %a: Offset Mismatch for %s\n"
|
||||||
@ -549,7 +550,8 @@ ParseAcpi (
|
|||||||
|
|
||||||
// Validating only makes sense if we are tracing
|
// Validating only makes sense if we are tracing
|
||||||
// the parsed table entries, to report by table name.
|
// the parsed table entries, to report by table name.
|
||||||
if (Parser[Index].FieldValidator != NULL) {
|
if (GetConsistencyChecking () &&
|
||||||
|
(Parser[Index].FieldValidator != NULL)) {
|
||||||
Parser[Index].FieldValidator (Ptr, Parser[Index].Context);
|
Parser[Index].FieldValidator (Ptr, Parser[Index].Context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
ACPI table parser
|
ACPI table parser
|
||||||
|
|
||||||
Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
|
Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@ -193,8 +193,10 @@ ProcessAcpiTable (
|
|||||||
|
|
||||||
if (Trace) {
|
if (Trace) {
|
||||||
DumpRaw (Ptr, *AcpiTableLength);
|
DumpRaw (Ptr, *AcpiTableLength);
|
||||||
|
if (GetConsistencyChecking ()) {
|
||||||
VerifyChecksum (TRUE, Ptr, *AcpiTableLength);
|
VerifyChecksum (TRUE, Ptr, *AcpiTableLength);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Status = GetParser (*AcpiTableSignature, &ParserProc);
|
Status = GetParser (*AcpiTableSignature, &ParserProc);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
@ -33,7 +33,7 @@ STATIC BOOLEAN mColourHighlighting;
|
|||||||
An array of acpiview command line parameters.
|
An array of acpiview command line parameters.
|
||||||
**/
|
**/
|
||||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||||
{L"-c", TypeFlag},
|
{L"-q", TypeFlag},
|
||||||
{L"-d", TypeFlag},
|
{L"-d", TypeFlag},
|
||||||
{L"-h", TypeValue},
|
{L"-h", TypeValue},
|
||||||
{L"-l", TypeFlag},
|
{L"-l", TypeFlag},
|
||||||
@ -69,6 +69,33 @@ SetColourHighlighting (
|
|||||||
mColourHighlighting = Highlight;
|
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.
|
This function returns the report options.
|
||||||
|
|
||||||
@ -380,7 +407,8 @@ AcpiView (
|
|||||||
(ReportDumpBinFile == ReportOption)) &&
|
(ReportDumpBinFile == ReportOption)) &&
|
||||||
(!mSelectedAcpiTableFound)) {
|
(!mSelectedAcpiTableFound)) {
|
||||||
Print (L"\nRequested ACPI Table not found.\n");
|
Print (L"\nRequested ACPI Table not found.\n");
|
||||||
} else if (ReportDumpBinFile != ReportOption) {
|
} else if (GetConsistencyChecking () &&
|
||||||
|
(ReportDumpBinFile != ReportOption)) {
|
||||||
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
||||||
|
|
||||||
Print (L"\nTable Statistics:\n");
|
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")) {
|
if (ShellCommandLineGetFlag (Package, L"-l")) {
|
||||||
mReportType = ReportTableList;
|
mReportType = ReportTableList;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file for AcpiView
|
Header file for AcpiView
|
||||||
|
|
||||||
Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
|
Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@ -91,6 +91,27 @@ SetColourHighlighting (
|
|||||||
BOOLEAN Highlight
|
BOOLEAN Highlight
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function returns the consistency checking status.
|
||||||
|
|
||||||
|
@retval TRUE if consistency checking is enabled.
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
GetConsistencyChecking (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function sets the consistency checking status.
|
||||||
|
|
||||||
|
@param ConsistencyChecking The consistency checking status.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
SetConsistencyChecking (
|
||||||
|
BOOLEAN ConsistencyChecking
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function processes the table reporting options for the ACPI table.
|
This function processes the table reporting options for the ACPI table.
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
"Display ACPI Table information.\r\n"
|
"Display ACPI Table information.\r\n"
|
||||||
".SH SYNOPSIS\r\n"
|
".SH SYNOPSIS\r\n"
|
||||||
" \r\n"
|
" \r\n"
|
||||||
"ACPIVIEW [[-?] | [[-l] | [-s AcpiTable [-d]]] [-c] [-v] [-h Highlight]]\r\n"
|
"ACPIVIEW [[-?] | [[-l] | [-s AcpiTable [-d]]] [-q] [-v] [-h Highlight]]\r\n"
|
||||||
" \r\n"
|
" \r\n"
|
||||||
".SH OPTIONS\r\n"
|
".SH OPTIONS\r\n"
|
||||||
" \r\n"
|
" \r\n"
|
||||||
@ -39,7 +39,7 @@
|
|||||||
" invocation option.\r\n"
|
" invocation option.\r\n"
|
||||||
" AcpiTable : The required ACPI Table type.\r\n"
|
" AcpiTable : The required ACPI Table type.\r\n"
|
||||||
" -d - Generate a binary file dump of the specified AcpiTable.\r\n"
|
" -d - Generate a binary file dump of the specified AcpiTable.\r\n"
|
||||||
" -c - Consistency checking (enabled by default).\r\n"
|
" -q - Quiet. Suppress errors and warnings. Disables consistency checks.\r\n"
|
||||||
" -v - Display verbose data (enabled by default).\r\n"
|
" -v - Display verbose data (enabled by default).\r\n"
|
||||||
" -h - Enable/Disable Colour Highlighting.\r\n"
|
" -h - Enable/Disable Colour Highlighting.\r\n"
|
||||||
" Highlight : TRUE/ON enables highlighting;\r\n"
|
" Highlight : TRUE/ON enables highlighting;\r\n"
|
||||||
|
Reference in New Issue
Block a user