public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Chris Jones" <christopher.jones@arm.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "ray.ni@intel.com" <ray.ni@intel.com>,
	"zhichao.gao@intel.com" <zhichao.gao@intel.com>,
	Sami Mujawar <Sami.Mujawar@arm.com>, nd <nd@arm.com>
Subject: [PATCH v1 2/9] ShellPkg: Replace SBBR validation option with generic one
Date: Wed, 15 Dec 2021 17:19:28 +0000	[thread overview]
Message-ID: <c81a67391dbc49acb01241c0a15f244120211215154722.4860-3-christopher.jones@arm.com> (raw)
In-Reply-To: <20211215154722.4860-1-christopher.jones@arm.com>

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@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")


  parent reply	other threads:[~2021-12-15 17:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211215154722.4860-1-christopher.jones@arm.com>
2021-12-15 17:19 ` [PATCH v1 1/9] ShellPkg: Add AcpiView validators readme Chris Jones
2021-12-15 17:19 ` Chris Jones [this message]
2021-12-15 17:19 ` [PATCH v1 3/9] ShellPkg: Add post parsing validation framework Chris Jones
2021-12-15 17:19 ` [PATCH v1 4/9] ShellPkg: Add ACPI data store Chris Jones
2021-12-15 17:19 ` [PATCH v1 5/9] ShellPkg: Store MADT and PPTT processor data Chris Jones
2021-12-15 17:19 ` [PATCH v1 6/9] ShellPkg: Add processor ID cross table validation Chris Jones
2021-12-15 17:19 ` [PATCH v1 7/9] ShellPkg: Add installed tables to parser collection Chris Jones
2021-12-15 17:20 ` [PATCH v1 8/9] ShellPkg: Rewrite SBBR validation Chris Jones
2021-12-15 17:20 ` [PATCH v1 9/9] ShellPkg: Add validator help string Chris Jones

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=c81a67391dbc49acb01241c0a15f244120211215154722.4860-3-christopher.jones@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