[edk2-devel] [PATCH v1 2/9] ShellPkg: Replace SBBR validation option with generic one

Chris Jones christopher.jones at arm.com
Wed Dec 15 17:19:28 UTC 2021


Bugzilla: 3773 (https://bugzilla.tianocore.org/show_bug.cgi?id=3773)

To facilitate the change to using generic validators, replace old SBBR
mandatory table validation config options with a more generic validator
config option.

As generic validators have not been implemented yet, simply assert
if trying to run a validator.

Signed-off-by: Chris Jones <christopher.jones at arm.com>
---
 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c             |  7 ---
 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c                    | 27 +++-------
 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c              | 52 ++++++++++----------
 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h              | 36 +++++++-------
 ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c | 12 ++---
 5 files changed, 58 insertions(+), 76 deletions(-)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
index 75b949429ec9d22026147900be591cfdc94ead44..381651ca3af75ab777ccff596ea17fb39be629bc 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
@@ -227,13 +227,6 @@ ProcessAcpiTable (
     }
   }
 
- #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
-  if (GetMandatoryTableValidate ()) {
-    ArmSbbrIncrementTableCount (*AcpiTableSignature);
-  }
-
- #endif
-
   Status = GetParser (*AcpiTableSignature, &ParserProc);
   if (EFI_ERROR (Status)) {
     // No registered parser found, do default handling.
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
index 9cdfcb3fae2aa85d3ed3835ae90f5230f685e0fa..8798410c05c03b98814b0c211d66287cbb6ef0e8 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
+  Copyright (c) 2016 - 2021, ARM Limited. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
   @par Glossary:
@@ -23,10 +23,6 @@
 #include "AcpiView.h"
 #include "AcpiViewConfig.h"
 
-#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
-  #include "Arm/SbbrValidator.h"
-#endif
-
 STATIC UINT32  mTableCount;
 STATIC UINT32  mBinTableCount;
 
@@ -205,6 +201,7 @@ AcpiView (
   PARSE_ACPI_TABLE_PROC    RsdpParserProc;
   BOOLEAN                  Trace;
   SELECTED_ACPI_TABLE      *SelectedTable;
+  UINTN                    ValidatorId;
 
   //
   // set local variables to suppress incorrect compiler/analyzer warnings
@@ -250,13 +247,6 @@ AcpiView (
       return EFI_UNSUPPORTED;
     }
 
- #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
-    if (GetMandatoryTableValidate ()) {
-      ArmSbbrResetTableCounts ();
-    }
-
- #endif
-
     // The RSDP length is 4 bytes starting at offset 20
     RsdpLength = *(UINT32 *)(RsdpPtr + RSDP_LENGTH_OFFSET);
 
@@ -284,13 +274,6 @@ AcpiView (
     return EFI_NOT_FOUND;
   }
 
- #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
-  if (GetMandatoryTableValidate ()) {
-    ArmSbbrReqsValidate ((ARM_SBBR_VERSION)GetMandatoryTableSpec ());
-  }
-
- #endif
-
   ReportOption = GetReportOption ();
   if (ReportTableList != ReportOption) {
     if (((ReportSelected == ReportOption)  ||
@@ -301,6 +284,12 @@ AcpiView (
     } else if (GetConsistencyChecking () &&
                (ReportDumpBinFile != ReportOption))
     {
+      // Run additional validators from command line args
+      ValidatorId = GetValidatorId ();
+      if (GetValidatorStatus () && (ValidatorId != 0)) {
+        ASSERT (0);   // Validators not implemented yet
+      }
+
       OriginalAttribute = gST->ConOut->Mode->Attribute;
 
       Print (L"\nTable Statistics:\n");
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c
index 8f6823f64b08f88a3cbe6ac01b2fc14e64423c75..e9a838812dbc5fc20fdf9ae7371e90f559f4ee2b 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c
@@ -1,7 +1,7 @@
 /** @file
   State and accessors for 'acpiview' configuration.
 
-  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.<BR>
+  Copyright (c) 2016 - 2021, ARM Limited. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -14,8 +14,8 @@
 STATIC BOOLEAN         mConsistencyCheck;
 STATIC BOOLEAN         mColourHighlighting;
 STATIC EREPORT_OPTION  mReportType;
-STATIC BOOLEAN         mMandatoryTableValidate;
-STATIC UINTN           mMandatoryTableSpec;
+STATIC BOOLEAN         mValidatorStatus;
+STATIC UINTN           mValidatorId;
 
 // User selection of which ACPI table should be checked
 SELECTED_ACPI_TABLE  mSelectedAcpiTable;
@@ -34,8 +34,8 @@ AcpiConfigSetDefaults (
   mSelectedAcpiTable.Name  = NULL;
   mSelectedAcpiTable.Found = FALSE;
   mConsistencyCheck        = TRUE;
-  mMandatoryTableValidate  = FALSE;
-  mMandatoryTableSpec      = 0;
+  mValidatorStatus         = FALSE;
+  mValidatorId             = 0;
 }
 
 /**
@@ -190,59 +190,59 @@ SetReportOption (
 }
 
 /**
-  This function returns the ACPI table requirements validation flag.
+  Return the ValidatorStatus flag.
 
-  @retval TRUE Check for mandatory table presence should be performed.
-**/
+  @retval TRUE   Validator should be run.
+  @retval FALSE  Validator should not be run.
+ **/
 BOOLEAN
 EFIAPI
-GetMandatoryTableValidate (
+GetValidatorStatus (
   VOID
   )
 {
-  return mMandatoryTableValidate;
+  return mValidatorStatus;
 }
 
 /**
-  This function sets the ACPI table requirements validation flag.
+  Set the ValidatorStatus flag.
 
-  @param [in] Validate Enable/Disable ACPI table requirements validation.
+  @param [in] Status  Enable (True)/Disable (False) running the optional
+                      Validator.
 **/
 VOID
 EFIAPI
-SetMandatoryTableValidate (
-  BOOLEAN  Validate
+SetValidatorStatus (
+  BOOLEAN  Status
   )
 {
-  mMandatoryTableValidate = Validate;
+  mValidatorStatus = Status;
 }
 
 /**
-  This function returns the identifier of specification to validate ACPI table
-  requirements against.
+  Return the ID of validator to run against the parsed ACPI tables.
 
-  @return ID of specification listing mandatory tables.
+  @return ID of validator to run.
 **/
 UINTN
 EFIAPI
-GetMandatoryTableSpec (
+GetValidatorId (
   VOID
   )
 {
-  return mMandatoryTableSpec;
+  return mValidatorId;
 }
 
 /**
-  This function sets the identifier of specification to validate ACPI table
-  requirements against.
+  Set the ID of the validator to run against the parsed ACPI tables.
 
-  @param [in] Spec ID of specification listing mandatory tables.
+  @param [in] ValidatorId  ID of validator.
 **/
 VOID
 EFIAPI
-SetMandatoryTableSpec (
-  UINTN  Spec
+SetValidatorId (
+  UINTN  ValidatorId
   )
 {
-  mMandatoryTableSpec = Spec;
+  mValidatorId = ValidatorId;
 }
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h
index c58755bf1def3fe778994ba30f598d831e0f1aa6..c6b1cf38cdd8f653b2ea04479aa625be1393762b 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h
@@ -1,7 +1,7 @@
 /** @file
   Header file for 'acpiview' configuration.
 
-  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.<BR>
+  Copyright (c) 2016 - 2021, ARM Limited. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -53,49 +53,49 @@ SetConsistencyChecking (
   );
 
 /**
-  This function returns the ACPI table requirements validation flag.
+  Return the ValidatorStatus flag.
 
-  @retval TRUE Check for mandatory table presence should be performed.
-**/
+  @retval TRUE   Validator should be run.
+  @retval FALSE  Validator should not be run.
+ **/
 BOOLEAN
 EFIAPI
-GetMandatoryTableValidate (
+GetValidatorStatus (
   VOID
   );
 
 /**
-  This function sets the ACPI table requirements validation flag.
+  Set the ValidatorStatus flag.
 
-  @param [in] Validate Enable/Disable ACPI table requirements validation.
+  @param [in] Status  Enable (True)/Disable (False) running the optional
+                      Validator.
 **/
 VOID
 EFIAPI
-SetMandatoryTableValidate (
-  BOOLEAN  Validate
+SetValidatorStatus (
+  BOOLEAN  Status
   );
 
 /**
-  This function returns the identifier of specification to validate ACPI table
-  requirements against.
+  Return the ID of validator to run against the parsed ACPI tables.
 
-  @return ID of specification listing mandatory tables.
+  @return ID of validator to run.
 **/
 UINTN
 EFIAPI
-GetMandatoryTableSpec (
+GetValidatorId (
   VOID
   );
 
 /**
-  This function sets the identifier of specification to validate ACPI table
-  requirements against.
+  Set the ID of the validator to run against the parsed ACPI tables.
 
-  @param [in] Spec ID of specification listing mandatory tables.
+  @param [in] ValidatorId  ID of validator.
 **/
 VOID
 EFIAPI
-SetMandatoryTableSpec (
-  UINTN  Spec
+SetValidatorId (
+  UINTN  ValidatorId
   );
 
 /**
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
index 09bdddb56e5bd70dec44bdbdcba88373f93daa66..15d2727ed13b66785b6c1078f214611b29aefd40 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
@@ -199,7 +199,7 @@ ShellCommandRunAcpiView (
   LIST_ENTRY         *Package;
   CHAR16             *ProblemParam;
   SHELL_FILE_HANDLE  TmpDumpFileHandle;
-  CONST CHAR16       *MandatoryTableSpecStr;
+  CONST CHAR16       *ValidatorIdStr;
   CONST CHAR16       *SelectedTableName;
 
   // Set configuration defaults
@@ -306,12 +306,12 @@ 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");
+      // Evaluate the parameters for running validators
+      SetValidatorStatus (ShellCommandLineGetFlag (Package, L"-r"));
+      ValidatorIdStr = ShellCommandLineGetValue (Package, L"-r");
 
-      if (MandatoryTableSpecStr != NULL) {
-        SetMandatoryTableSpec (ShellHexStrToUintn (MandatoryTableSpecStr));
+      if (ValidatorIdStr != NULL) {
+        SetValidatorId (ShellStrToUintn (ValidatorIdStr));
       }
 
       if (ShellCommandLineGetFlag (Package, L"-l")) {
-- 
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#84914): https://edk2.groups.io/g/devel/message/84914
Mute This Topic: https://groups.io/mt/87748583/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list