From: "Krzysztof Koch" <krzysztof.koch@arm.com>
To: <devel@edk2.groups.io>
Cc: <jaben.carsey@intel.com>, <ray.ni@intel.com>,
<zhichao.gao@intel.com>, <Sami.Mujawar@arm.com>,
<Matteo.Carlini@arm.com>, <nd@arm.com>
Subject: [PATCH v1 3/5] ShellPkg: acpiview: Allow disabling consistency checks (-q flag)
Date: Fri, 28 Jun 2019 09:56:58 +0100 [thread overview]
Message-ID: <20190628085700.17472-4-krzysztof.koch@arm.com> (raw)
In-Reply-To: <20190628085700.17472-1-krzysztof.koch@arm.com>
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>
---
Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/fa016236b0955d19db70bf83fe4e5048e3b858f4
Notes:
v1:
- make table consistency checks optional where applicable [Krzysztof]
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | 6 ++--
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c | 6 ++--
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c | 35 ++++++++++++++++++--
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h | 23 ++++++++++++-
ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni | 4 +--
5 files changed, 65 insertions(+), 9 deletions(-)
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
index f9dbbd35449e74fdf81f09e627920b10583a9816..8b3153516d2b7d9b920ab2de0344c17798ac572c 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
@@ -506,7 +506,8 @@ ParseAcpi (
break;
}
- if (Offset != Parser[Index].Offset) {
+ if (GetConsistencyChecking () &&
+ (Offset != Parser[Index].Offset)) {
IncrementErrorCount ();
Print (
L"\nERROR: %a: Offset Mismatch for %s\n"
@@ -549,7 +550,8 @@ ParseAcpi (
// Validating only makes sense if we are tracing
// 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);
}
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
index 504c81e3f1405095afd0d77fee64a02fd06a64d2..d5500bcb2b4a55c7a69f45444aa49d36d2c1694f 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
@@ -1,7 +1,7 @@
/** @file
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
**/
@@ -193,7 +193,9 @@ ProcessAcpiTable (
if (Trace) {
DumpRaw (Ptr, *AcpiTableLength);
- VerifyChecksum (TRUE, Ptr, *AcpiTableLength);
+ if (GetConsistencyChecking ()) {
+ VerifyChecksum (TRUE, Ptr, *AcpiTableLength);
+ }
}
Status = GetParser (*AcpiTableSignature, &ParserProc);
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
index 9bbb00cacafa34760c9d45cb6a9fe15bcd4c100e..e99537acf36616783103e1e9d154278f8dedb78e 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
@@ -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 {
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
index 1b26d8fb1771eb4adb3f381e04234932480b6110..b5cb274ecbf77f7ccb81d78f852caa0f50854312 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
@@ -1,7 +1,7 @@
/** @file
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
**/
@@ -91,6 +91,27 @@ SetColourHighlighting (
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.
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni
index 4c63143cbef85262793c287dfeb8ebb394394416..f0610870505d5c5d89e6516122fc9e782479df0c 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni
@@ -30,7 +30,7 @@
"Display ACPI Table information.\r\n"
".SH SYNOPSIS\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"
".SH OPTIONS\r\n"
" \r\n"
@@ -39,7 +39,7 @@
" invocation option.\r\n"
" AcpiTable : The required ACPI Table type.\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"
" -h - Enable/Disable Colour Highlighting.\r\n"
" Highlight : TRUE/ON enables highlighting;\r\n"
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
next prev parent reply other threads:[~2019-06-28 8:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-28 8:56 [PATCH v1 0/5] Clean up acpiview input parameters Krzysztof Koch
2019-06-28 8:56 ` [PATCH v1 1/5] ShellPkg: acpiview: Remove '/?' from valid command line flags Krzysztof Koch
2019-06-28 11:06 ` [edk2-devel] " Alexei Fedorov
2019-06-28 8:56 ` [PATCH v1 2/5] ShellPkg: acpiview: Fix '\n\n' printing in Table Checksum reporting Krzysztof Koch
2019-06-28 11:06 ` [edk2-devel] " Alexei Fedorov
2019-06-28 8:56 ` Krzysztof Koch [this message]
2019-06-28 11:06 ` [edk2-devel] [PATCH v1 3/5] ShellPkg: acpiview: Allow disabling consistency checks (-q flag) Alexei Fedorov
2019-06-28 8:56 ` [PATCH v1 4/5] ShellPkg: acpiview: Remove '-v' flag from allowed command line args Krzysztof Koch
2019-06-28 11:06 ` [edk2-devel] " Alexei Fedorov
2019-06-28 8:57 ` [PATCH v1 5/5] ShellPkg: acpiview: Make '-h' option not require a parameter Krzysztof Koch
2019-06-28 11:05 ` [edk2-devel] " Alexei Fedorov
2019-06-28 11:07 ` [edk2-devel] [PATCH v1 0/5] Clean up acpiview input parameters Alexei Fedorov
2019-07-01 3:51 ` Gao, Zhichao
2019-07-02 8:44 ` Sami Mujawar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190628085700.17472-4-krzysztof.koch@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox