]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: acpiview: Add -r parameter for table requirements validation
authorKrzysztof Koch <krzysztof.koch@arm.com>
Wed, 25 Mar 2020 09:39:22 +0000 (17:39 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 6 May 2020 17:00:57 +0000 (17:00 +0000)
Define a new command line parameter '-r' to enable checking if all
mandatory ACPI tables listed in a specification are present.

The -r parameter takes an integer value to specify which specification
the validation should be performed against.

The parameter is used to set two Acpiview variables. An interface to
access these variables is implemented in this patch.

The new functionality is aimed at Arm-based platforms, however,
there are no restriction on extending it to other architectures.
For the 32-bit and 64-bit Arm architectures, the possible values for
the -r parameter are:
  0: Arm Server Base Boot Requirements 1.0, March 2016
  1: Arm Server Base Boot Requirements 1.1, May 2018
  2: Arm Server Base Boot Requirements 1.2, September 2019

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Sami Mujawar <Sami.Mujawar@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni

index de0851dd5fbae51308def95bd4964f792fb9e680..49c2e87c430d7fb57793f6405ebee91cb8f6cbaa 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.\r
+  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 **/\r
 \r
@@ -27,6 +27,8 @@ STATIC UINT32             mTableCount;
 STATIC UINT32             mBinTableCount;\r
 STATIC BOOLEAN            mConsistencyCheck;\r
 STATIC BOOLEAN            mColourHighlighting;\r
+STATIC BOOLEAN            mMandatoryTableValidate;\r
+STATIC UINTN              mMandatoryTableSpec;\r
 \r
 /**\r
   An array of acpiview command line parameters.\r
@@ -37,6 +39,7 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
   {L"-h", TypeFlag},\r
   {L"-l", TypeFlag},\r
   {L"-s", TypeValue},\r
+  {L"-r", TypeValue},\r
   {NULL, TypeMax}\r
 };\r
 \r
@@ -94,6 +97,60 @@ SetConsistencyChecking (
   mConsistencyCheck = ConsistencyChecking;\r
 }\r
 \r
+/**\r
+  This function returns the ACPI table requirements validation flag.\r
+\r
+  @retval TRUE if check for mandatory table presence should be performed.\r
+**/\r
+BOOLEAN\r
+GetMandatoryTableValidate (\r
+  VOID\r
+  )\r
+{\r
+  return mMandatoryTableValidate;\r
+}\r
+\r
+/**\r
+  This function sets the ACPI table requirements validation flag.\r
+\r
+  @param  Validate    Enable/Disable ACPI table requirements validation.\r
+**/\r
+VOID\r
+SetMandatoryTableValidate (\r
+  BOOLEAN Validate\r
+  )\r
+{\r
+  mMandatoryTableValidate = Validate;\r
+}\r
+\r
+/**\r
+  This function returns the identifier of specification to validate ACPI table\r
+  requirements against.\r
+\r
+  @return   ID of specification listing mandatory tables.\r
+**/\r
+UINTN\r
+GetMandatoryTableSpec (\r
+  VOID\r
+  )\r
+{\r
+  return mMandatoryTableSpec;\r
+}\r
+\r
+/**\r
+  This function sets the identifier of specification to validate ACPI table\r
+  requirements against.\r
+\r
+  @param  Spec      ID of specification listing mandatory tables.\r
+**/\r
+VOID\r
+SetMandatoryTableSpec (\r
+  UINTN Spec\r
+  )\r
+{\r
+  mMandatoryTableSpec = Spec;\r
+}\r
+\r
 /**\r
   This function returns the report options.\r
 \r
@@ -470,6 +527,7 @@ ShellCommandRunAcpiView (
   LIST_ENTRY*        Package;\r
   CHAR16*            ProblemParam;\r
   SHELL_FILE_HANDLE  TmpDumpFileHandle;\r
+  CONST CHAR16*      MandatoryTableSpecStr;\r
 \r
   // Set Defaults\r
   mReportType = ReportAll;\r
@@ -479,6 +537,8 @@ ShellCommandRunAcpiView (
   mSelectedAcpiTableName = NULL;\r
   mSelectedAcpiTableFound = FALSE;\r
   mConsistencyCheck = TRUE;\r
+  mMandatoryTableValidate = FALSE;\r
+  mMandatoryTableSpec = 0;\r
 \r
   ShellStatus = SHELL_SUCCESS;\r
   Package = NULL;\r
@@ -537,6 +597,18 @@ ShellCommandRunAcpiView (
         L"-s"\r
         );\r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
+    } else if (ShellCommandLineGetFlag (Package, L"-r") &&\r
+               ShellCommandLineGetValue (Package, L"-r") == NULL) {\r
+      ShellPrintHiiEx (\r
+        -1,\r
+        -1,\r
+        NULL,\r
+        STRING_TOKEN (STR_GEN_NO_VALUE),\r
+        gShellAcpiViewHiiHandle,\r
+        L"acpiview",\r
+        L"-r"\r
+        );\r
+      ShellStatus = SHELL_INVALID_PARAMETER;\r
     } else if ((ShellCommandLineGetFlag (Package, L"-s") &&\r
                 ShellCommandLineGetFlag (Package, L"-l"))) {\r
       ShellPrintHiiEx (\r
@@ -568,6 +640,14 @@ ShellCommandRunAcpiView (
       // Surpress consistency checking if requested\r
       SetConsistencyChecking (!ShellCommandLineGetFlag (Package, L"-q"));\r
 \r
+      // Evaluate the parameters for mandatory ACPI table presence checks\r
+      SetMandatoryTableValidate (ShellCommandLineGetFlag (Package, L"-r"));\r
+      MandatoryTableSpecStr = ShellCommandLineGetValue (Package, L"-r");\r
+\r
+      if (MandatoryTableSpecStr != NULL) {\r
+        SetMandatoryTableSpec (ShellHexStrToUintn (MandatoryTableSpecStr));\r
+      }\r
+\r
       if (ShellCommandLineGetFlag (Package, L"-l")) {\r
         mReportType = ReportTableList;\r
       } else {\r
index b5cb274ecbf77f7ccb81d78f852caa0f50854312..be65564c86a67a03e71b11f3b2ecde7a21016736 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Header file for AcpiView\r
 \r
-  Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.\r
+  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 **/\r
 \r
@@ -112,6 +112,48 @@ SetConsistencyChecking (
   BOOLEAN ConsistencyChecking\r
   );\r
 \r
+/**\r
+  This function returns the ACPI table requirements validation flag.\r
+\r
+  @retval TRUE if check for mandatory table presence should be performed.\r
+**/\r
+BOOLEAN\r
+GetMandatoryTableValidate (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  This function sets the ACPI table requirements validation flag.\r
+\r
+  @param  Validate    Enable/Disable ACPI table requirements validation.\r
+**/\r
+VOID\r
+SetMandatoryTableValidate (\r
+  BOOLEAN Validate\r
+  );\r
+\r
+/**\r
+  This function returns the identifier of specification to validate ACPI table\r
+  requirements against.\r
+\r
+  @return   ID of specification listing mandatory tables.\r
+**/\r
+UINTN\r
+GetMandatoryTableSpec (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  This function sets the identifier of specification to validate ACPI table\r
+  requirements against.\r
+\r
+  @param  Spec      ID of specification listing mandatory tables.\r
+**/\r
+VOID\r
+SetMandatoryTableSpec (\r
+  UINTN Spec\r
+  );\r
+\r
 /**\r
   This function processes the table reporting options for the ACPI table.\r
 \r
index 1f07b7ae20d474be67a433ff3774a508a5289318..7cd43d0518fd0a23dc547a5cab0d08b62602a113 100644 (file)
@@ -1,6 +1,6 @@
 // /**\r
 //\r
-// Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.<BR>\r
+// Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.<BR>\r
 // SPDX-License-Identifier: BSD-2-Clause-Patent\r
 //\r
 // Module Name:\r
@@ -30,7 +30,7 @@
 "Display ACPI Table information.\r\n"\r
 ".SH SYNOPSIS\r\n"\r
 " \r\n"\r
-"ACPIVIEW [[-?] | [[-l] | [-s AcpiTable [-d]]] [-q] [-h]]\r\n"\r
+"ACPIVIEW [[-?] | [[[[-l] | [-s AcpiTable [-d]]] [-q] [-h]] [-r Spec]]]\r\n"\r
 " \r\n"\r
 ".SH OPTIONS\r\n"\r
 " \r\n"\r
 "  -d - Generate a binary file dump of the specified AcpiTable.\r\n"\r
 "  -q - Quiet. Suppress errors and warnings. Disables consistency checks.\r\n"\r
 "  -h - Enable colour highlighting.\r\n"\r
+"  -r - Validate that all required ACPI tables are installed\r\n"\r
+"         Spec  : Specification to validate against.\r\n"\r
+"                 For Arm, the possible values are:\r\n"\r
+"                   0 - Server Base Boot Requirements v1.0\r\n"\r
+"                   1 - Server Base Boot Requirements v1.1\r\n"\r
+"                   2 - Server Base Boot Requirements v1.2\r\n"\r
 "  -? - Show help.\r\n"\r
 " \r\n"\r
 ".SH DESCRIPTION\r\n"\r
 "  * To display contents of all ACPI tables:\r\n"\r
 "    fs0:\> acpiview\r\n"\r
 " \r\n"\r
+"  * To check if all Server Base Boot Requirements (SBBR) v1.2 mandatory\r\n"\r
+"    ACPI tables are installed (Arm only):\r\n"\r
+"    fs0:\> acpiview -r 2\r\n"\r
+" \r\n"\r
 ".SH RETURNVALUES\r\n"\r
 " \r\n"\r
 "RETURN VALUES:\r\n"\r