summaryrefslogtreecommitdiffstats
path: root/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c')
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c82
1 files changed, 81 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
index de0851dd5f..49c2e87c43 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
@@ -1,6 +1,6 @@
/** @file
- Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -27,6 +27,8 @@ STATIC UINT32 mTableCount;
STATIC UINT32 mBinTableCount;
STATIC BOOLEAN mConsistencyCheck;
STATIC BOOLEAN mColourHighlighting;
+STATIC BOOLEAN mMandatoryTableValidate;
+STATIC UINTN mMandatoryTableSpec;
/**
An array of acpiview command line parameters.
@@ -37,6 +39,7 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
{L"-h", TypeFlag},
{L"-l", TypeFlag},
{L"-s", TypeValue},
+ {L"-r", TypeValue},
{NULL, TypeMax}
};
@@ -95,6 +98,60 @@ SetConsistencyChecking (
}
/**
+ This function returns the ACPI table requirements validation flag.
+
+ @retval TRUE if check for mandatory table presence should be performed.
+**/
+BOOLEAN
+GetMandatoryTableValidate (
+ VOID
+ )
+{
+ return mMandatoryTableValidate;
+}
+
+/**
+ This function sets the ACPI table requirements validation flag.
+
+ @param Validate Enable/Disable ACPI table requirements validation.
+**/
+VOID
+SetMandatoryTableValidate (
+ BOOLEAN Validate
+ )
+{
+ mMandatoryTableValidate = Validate;
+}
+
+/**
+ This function returns the identifier of specification to validate ACPI table
+ requirements against.
+
+ @return ID of specification listing mandatory tables.
+**/
+UINTN
+GetMandatoryTableSpec (
+ VOID
+ )
+{
+ return mMandatoryTableSpec;
+}
+
+/**
+ This function sets the identifier of specification to validate ACPI table
+ requirements against.
+
+ @param Spec ID of specification listing mandatory tables.
+**/
+VOID
+SetMandatoryTableSpec (
+ UINTN Spec
+ )
+{
+ mMandatoryTableSpec = Spec;
+}
+
+/**
This function returns the report options.
@retval Returns the report option.
@@ -470,6 +527,7 @@ ShellCommandRunAcpiView (
LIST_ENTRY* Package;
CHAR16* ProblemParam;
SHELL_FILE_HANDLE TmpDumpFileHandle;
+ CONST CHAR16* MandatoryTableSpecStr;
// Set Defaults
mReportType = ReportAll;
@@ -479,6 +537,8 @@ ShellCommandRunAcpiView (
mSelectedAcpiTableName = NULL;
mSelectedAcpiTableFound = FALSE;
mConsistencyCheck = TRUE;
+ mMandatoryTableValidate = FALSE;
+ mMandatoryTableSpec = 0;
ShellStatus = SHELL_SUCCESS;
Package = NULL;
@@ -537,6 +597,18 @@ ShellCommandRunAcpiView (
L"-s"
);
ShellStatus = SHELL_INVALID_PARAMETER;
+ } else if (ShellCommandLineGetFlag (Package, L"-r") &&
+ ShellCommandLineGetValue (Package, L"-r") == NULL) {
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_GEN_NO_VALUE),
+ gShellAcpiViewHiiHandle,
+ L"acpiview",
+ L"-r"
+ );
+ ShellStatus = SHELL_INVALID_PARAMETER;
} else if ((ShellCommandLineGetFlag (Package, L"-s") &&
ShellCommandLineGetFlag (Package, L"-l"))) {
ShellPrintHiiEx (
@@ -568,6 +640,14 @@ ShellCommandRunAcpiView (
// Surpress consistency checking if requested
SetConsistencyChecking (!ShellCommandLineGetFlag (Package, L"-q"));
+ // Evaluate the parameters for mandatory ACPI table presence checks
+ SetMandatoryTableValidate (ShellCommandLineGetFlag (Package, L"-r"));
+ MandatoryTableSpecStr = ShellCommandLineGetValue (Package, L"-r");
+
+ if (MandatoryTableSpecStr != NULL) {
+ SetMandatoryTableSpec (ShellHexStrToUintn (MandatoryTableSpecStr));
+ }
+
if (ShellCommandLineGetFlag (Package, L"-l")) {
mReportType = ReportTableList;
} else {