public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Tomas Pilar (tpilar)" <Tomas.Pilar@arm.com>
To: <devel@edk2.groups.io>
Cc: <nd@arm.com>, Ray Ni <ray.ni@intel.com>,
	Zhichao Gao <zhichao.gao@intel.com>
Subject: [PATCH v3 2/7] ShellPkg/AcpiView: Refactor configuration
Date: Mon, 15 Jun 2020 15:03:46 +0100	[thread overview]
Message-ID: <20200615140351.1725-3-Tomas.Pilar@arm.com> (raw)
In-Reply-To: <20200615140351.1725-1-Tomas.Pilar@arm.com>

A new file and header (AcpiViewConfig.[ch]) is created
that houses the user configuration. This declutters the
core code and improves modularity of the design.

The module level symbols for verbosity, table selection, and
highlighting are refactored into the new file.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Tomas Pilar <tomas.pilar@arm.com>
---
 .../UefiShellAcpiViewCommandLib/AcpiParser.c  |   1 +
 .../AcpiTableParser.c                         |   1 +
 .../UefiShellAcpiViewCommandLib/AcpiView.c    | 237 +++--------------
 .../UefiShellAcpiViewCommandLib/AcpiView.h    |  95 -------
 .../AcpiViewConfig.c                          | 246 ++++++++++++++++++
 .../AcpiViewConfig.h                          | 177 +++++++++++++
 .../Parsers/Gtdt/GtdtParser.c                 |   1 +
 .../Parsers/Iort/IortParser.c                 |   1 +
 .../Parsers/Madt/MadtParser.c                 |   1 +
 .../Parsers/Pptt/PpttParser.c                 |   1 +
 .../Parsers/Srat/SratParser.c                 |   1 +
 .../UefiShellAcpiViewCommandLib.inf           |  32 +--
 12 files changed, 479 insertions(+), 315 deletions(-)
 create mode 100644 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c
 create mode 100644 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
index 3f12a33050a4..02f6d771c7e1 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
@@ -10,6 +10,7 @@
 #include <Library/UefiBootServicesTableLib.h>
 #include "AcpiParser.h"
 #include "AcpiView.h"
+#include "AcpiViewConfig.h"
 
 STATIC UINT32   gIndent;
 STATIC UINT32   mTableErrorCount;
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
index d5b9eee52323..4b618f131eac 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
@@ -17,6 +17,7 @@
 #include "AcpiParser.h"
 #include "AcpiTableParser.h"
 #include "AcpiView.h"
+#include "AcpiViewConfig.h"
 
 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
 #include "Arm/SbbrValidator.h"
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
index f1a95b7b8f03..390e378e9a6c 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
@@ -20,6 +20,7 @@
 #include "AcpiParser.h"
 #include "AcpiTableParser.h"
 #include "AcpiView.h"
+#include "AcpiViewConfig.h"
 #include "UefiShellAcpiViewCommandLib.h"
 
 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
@@ -28,17 +29,8 @@
 
 EFI_HII_HANDLE gShellAcpiViewHiiHandle = NULL;
 
-// Report variables
-STATIC UINT32             mSelectedAcpiTable;
-STATIC CONST CHAR16*      mSelectedAcpiTableName;
-STATIC BOOLEAN            mSelectedAcpiTableFound;
-STATIC EREPORT_OPTION     mReportType;
 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.
@@ -53,142 +45,6 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
   {NULL, TypeMax}
 };
 
-/**
-  This function returns the colour highlighting status.
-
-  @retval TRUE if colour highlighting is enabled.
-**/
-BOOLEAN
-GetColourHighlighting (
-  VOID
-  )
-{
-  return mColourHighlighting;
-}
-
-/**
-  This function sets the colour highlighting status.
-
-  @param  Highlight       The Highlight status.
-
-**/
-VOID
-SetColourHighlighting (
-  BOOLEAN Highlight
-  )
-{
-  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 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.
-**/
-STATIC
-EREPORT_OPTION
-GetReportOption (
-  VOID
-  )
-{
-  return mReportType;
-}
-
-/**
-  This function returns the selected ACPI table.
-
-  @retval Returns signature of the selected ACPI table.
-**/
-STATIC
-UINT32
-GetSelectedAcpiTable (
-  VOID
-  )
-{
-  return mSelectedAcpiTable;
-}
-
 /**
   This function dumps the ACPI table to a file.
 
@@ -205,19 +61,21 @@ DumpAcpiTableToFile (
   IN CONST UINTN   Length
   )
 {
-  EFI_STATUS         Status;
-  CHAR16             FileNameBuffer[MAX_FILE_NAME_LEN];
-  SHELL_FILE_HANDLE  DumpFileHandle;
-  UINTN              TransferBytes;
+  EFI_STATUS          Status;
+  CHAR16              FileNameBuffer[MAX_FILE_NAME_LEN];
+  SHELL_FILE_HANDLE   DumpFileHandle;
+  UINTN               TransferBytes;
+  SELECTED_ACPI_TABLE *SelectedTable;
 
   DumpFileHandle = NULL;
   TransferBytes = Length;
+  GetSelectedAcpiTable (&SelectedTable);
 
   UnicodeSPrint (
     FileNameBuffer,
     sizeof (FileNameBuffer),
     L".\\%s%04d.bin",
-    mSelectedAcpiTableName,
+    SelectedTable->Name,
     mBinTableCount++
     );
 
@@ -273,10 +131,11 @@ ProcessTableReportOptions (
   IN CONST UINT32  Length
   )
 {
-  UINTN   OriginalAttribute;
-  UINT8*  SignaturePtr;
-  BOOLEAN Log;
-  BOOLEAN HighLight;
+  UINTN                OriginalAttribute;
+  UINT8               *SignaturePtr;
+  BOOLEAN              Log;
+  BOOLEAN              HighLight;
+  SELECTED_ACPI_TABLE *SelectedTable;
 
   //
   // set local variables to suppress incorrect compiler/analyzer warnings
@@ -285,15 +144,16 @@ ProcessTableReportOptions (
   SignaturePtr = (UINT8*)(UINTN)&Signature;
   Log = FALSE;
   HighLight = GetColourHighlighting ();
+  GetSelectedAcpiTable (&SelectedTable);
 
   switch (GetReportOption ()) {
     case ReportAll:
       Log = TRUE;
       break;
     case ReportSelected:
-      if (Signature == GetSelectedAcpiTable ()) {
+      if (Signature == SelectedTable->Type) {
         Log = TRUE;
-        mSelectedAcpiTableFound = TRUE;
+        SelectedTable->Found = TRUE;
       }
       break;
     case ReportTableList:
@@ -321,8 +181,8 @@ ProcessTableReportOptions (
         );
       break;
     case ReportDumpBinFile:
-      if (Signature == GetSelectedAcpiTable ()) {
-        mSelectedAcpiTableFound = TRUE;
+      if (Signature == SelectedTable->Type) {
+        SelectedTable->Found = TRUE;
         DumpAcpiTableToFile (TablePtr, Length);
       }
       break;
@@ -356,37 +216,7 @@ ProcessTableReportOptions (
   return Log;
 }
 
-/**
-  This function converts a string to ACPI table signature.
-
-  @param [in] Str   Pointer to the string to be converted to the
-                    ACPI table signature.
 
-  @retval The ACPI table signature.
-**/
-STATIC
-UINT32
-ConvertStrToAcpiSignature (
-  IN  CONST CHAR16* Str
-  )
-{
-  UINT8 Index;
-  CHAR8 Ptr[4];
-
-  ZeroMem (Ptr, sizeof (Ptr));
-  Index = 0;
-
-  // Convert to Upper case and convert to ASCII
-  while ((Index < 4) && (Str[Index] != 0)) {
-    if (Str[Index] >= L'a' && Str[Index] <= L'z') {
-      Ptr[Index] = (CHAR8)(Str[Index] - (L'a' - L'A'));
-    } else {
-      Ptr[Index] = (CHAR8)Str[Index];
-    }
-    Index++;
-  }
-  return *(UINT32*)Ptr;
-}
 
 /**
   This function iterates the configuration table entries in the
@@ -417,6 +247,7 @@ AcpiView (
   UINT8                    RsdpRevision;
   PARSE_ACPI_TABLE_PROC    RsdpParserProc;
   BOOLEAN                  Trace;
+  SELECTED_ACPI_TABLE     *SelectedTable;
 
   //
   // set local variables to suppress incorrect compiler/analyzer warnings
@@ -428,6 +259,9 @@ AcpiView (
   ResetErrorCount ();
   ResetWarningCount ();
 
+  // Retrieve the user selection of ACPI table to process
+  GetSelectedAcpiTable (&SelectedTable);
+
   // Search the table for an entry that matches the ACPI Table Guid
   FoundAcpiTable = FALSE;
   for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) {
@@ -496,7 +330,7 @@ AcpiView (
   if (ReportTableList != ReportOption) {
     if (((ReportSelected == ReportOption)  ||
          (ReportDumpBinFile == ReportOption)) &&
-        (!mSelectedAcpiTableFound)) {
+        (!SelectedTable->Found)) {
       Print (L"\nRequested ACPI Table not found.\n");
     } else if (GetConsistencyChecking () &&
                (ReportDumpBinFile != ReportOption)) {
@@ -554,17 +388,12 @@ ShellCommandRunAcpiView (
   CHAR16*            ProblemParam;
   SHELL_FILE_HANDLE  TmpDumpFileHandle;
   CONST CHAR16*      MandatoryTableSpecStr;
+  CONST CHAR16       *SelectedTableName;
 
   // Set Defaults
-  mReportType = ReportAll;
   mTableCount = 0;
   mBinTableCount = 0;
-  mSelectedAcpiTable = 0;
-  mSelectedAcpiTableName = NULL;
-  mSelectedAcpiTableFound = FALSE;
-  mConsistencyCheck = TRUE;
-  mMandatoryTableValidate = FALSE;
-  mMandatoryTableSpec = 0;
+  AcpiConfigSetDefaults ();
 
   ShellStatus = SHELL_SUCCESS;
   Package = NULL;
@@ -671,25 +500,23 @@ ShellCommandRunAcpiView (
       }
 
       if (ShellCommandLineGetFlag (Package, L"-l")) {
-        mReportType = ReportTableList;
+        SetReportOption (ReportTableList);
       } else {
-        mSelectedAcpiTableName = ShellCommandLineGetValue (Package, L"-s");
-        if (mSelectedAcpiTableName != NULL) {
-          mSelectedAcpiTable = (UINT32)ConvertStrToAcpiSignature (
-                                         mSelectedAcpiTableName
-                                         );
-          mReportType = ReportSelected;
+        SelectedTableName = ShellCommandLineGetValue (Package, L"-s");
+        if (SelectedTableName != NULL) {
+          SelectAcpiTable (SelectedTableName);
+          SetReportOption (ReportSelected);
 
           if (ShellCommandLineGetFlag (Package, L"-d"))  {
             // Create a temporary file to check if the media is writable.
             CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
-            mReportType = ReportDumpBinFile;
+            SetReportOption (ReportDumpBinFile);
 
             UnicodeSPrint (
               FileNameBuffer,
               sizeof (FileNameBuffer),
               L".\\%s%04d.tmp",
-              mSelectedAcpiTableName,
+              SelectedTableName,
               mBinTableCount
               );
 
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
index be65564c86a6..92d64a88814d 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
@@ -23,17 +23,6 @@
 **/
 #define RSDP_LENGTH_OFFSET   20
 
-/**
-  The EREPORT_OPTION enum describes ACPI table Reporting options.
-**/
-typedef enum ReportOption {
-  ReportAll,            ///< Report All tables.
-  ReportSelected,       ///< Report Selected table.
-  ReportTableList,      ///< Report List of tables.
-  ReportDumpBinFile,    ///< Dump selected table to a file.
-  ReportMax,
-} EREPORT_OPTION;
-
 /**
   This function resets the ACPI table error counter to Zero.
 **/
@@ -70,90 +59,6 @@ GetWarningCount (
   VOID
   );
 
-/**
-  This function returns the colour highlighting status.
-
-  @retval TRUE if colour highlighting is enabled.
-**/
-BOOLEAN
-GetColourHighlighting (
-  VOID
-  );
-
-/**
-  This function sets the colour highlighting status.
-
-  @param  Highlight       The Highlight status.
-
-**/
-VOID
-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 returns the ACPI table requirements validation flag.
-
-  @retval TRUE if check for mandatory table presence should be performed.
-**/
-BOOLEAN
-GetMandatoryTableValidate (
-  VOID
-  );
-
-/**
-  This function sets the ACPI table requirements validation flag.
-
-  @param  Validate    Enable/Disable ACPI table requirements validation.
-**/
-VOID
-SetMandatoryTableValidate (
-  BOOLEAN Validate
-  );
-
-/**
-  This function returns the identifier of specification to validate ACPI table
-  requirements against.
-
-  @return   ID of specification listing mandatory tables.
-**/
-UINTN
-GetMandatoryTableSpec (
-  VOID
-  );
-
-/**
-  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
-  );
-
 /**
   This function processes the table reporting options for the ACPI table.
 
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c
new file mode 100644
index 000000000000..759a915928c7
--- /dev/null
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c
@@ -0,0 +1,246 @@
+/** @file
+  State and accessors for 'acpiview' configuration.
+
+  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+
+#include "AcpiViewConfig.h"
+
+// Report variables
+STATIC BOOLEAN        mConsistencyCheck;
+STATIC BOOLEAN        mColourHighlighting;
+STATIC EREPORT_OPTION mReportType;
+STATIC BOOLEAN        mMandatoryTableValidate;
+STATIC UINTN          mMandatoryTableSpec;
+
+// User selection of which ACPI table should be checked
+SELECTED_ACPI_TABLE mSelectedAcpiTable;
+
+/**
+ Reset the AcpiView user configuration to defaults
+**/
+VOID
+EFIAPI
+AcpiConfigSetDefaults (
+  VOID
+  )
+{
+  mReportType = ReportAll;
+  mSelectedAcpiTable.Type = 0;
+  mSelectedAcpiTable.Name = NULL;
+  mSelectedAcpiTable.Found = FALSE;
+  mConsistencyCheck = TRUE;
+  mMandatoryTableValidate = FALSE;
+  mMandatoryTableSpec = 0;
+}
+
+/**
+  This function converts a string to ACPI table signature.
+
+  @param [in] Str   Pointer to the string to be converted to the
+                    ACPI table signature.
+
+  @retval The ACPI table signature.
+**/
+STATIC
+UINT32
+ConvertStrToAcpiSignature (
+  IN CONST CHAR16 *Str
+  )
+{
+  UINT8 Index;
+  CHAR8 Ptr[4];
+
+  ZeroMem (Ptr, sizeof (Ptr));
+  Index = 0;
+
+  // Convert to Upper case and convert to ASCII
+  while ((Index < 4) && (Str[Index] != 0)) {
+    if (Str[Index] >= L'a' && Str[Index] <= L'z') {
+      Ptr[Index] = (CHAR8)(Str[Index] - (L'a' - L'A'));
+    } else {
+      Ptr[Index] = (CHAR8)Str[Index];
+    }
+    Index++;
+  }
+  return *(UINT32 *) Ptr;
+}
+
+/**
+  This function selects an ACPI table in current context.
+  The string name of the table is converted into UINT32
+  table signature.
+
+  @param [in] TableName The name of the ACPI table to select.
+**/
+VOID
+EFIAPI
+SelectAcpiTable (
+  IN CONST CHAR16 *TableName
+  )
+{
+  ASSERT (TableName != NULL);
+
+  mSelectedAcpiTable.Name = TableName;
+  mSelectedAcpiTable.Type = ConvertStrToAcpiSignature (mSelectedAcpiTable.Name);
+}
+
+/**
+  This function returns the selected ACPI table.
+
+  @param [out] SelectedAcpiTable Pointer that will contain the returned struct.
+**/
+VOID
+EFIAPI
+GetSelectedAcpiTable (
+  OUT SELECTED_ACPI_TABLE **SelectedAcpiTable
+  )
+{
+  *SelectedAcpiTable = &mSelectedAcpiTable;
+}
+
+/**
+  This function returns the colour highlighting status.
+
+  @retval TRUE Colour highlighting is enabled.
+**/
+BOOLEAN
+EFIAPI
+GetColourHighlighting (
+  VOID
+  )
+{
+  return mColourHighlighting;
+}
+
+/**
+  This function sets the colour highlighting status.
+
+  @param [in] Highlight The highlight status.
+**/
+VOID
+EFIAPI
+SetColourHighlighting (
+  BOOLEAN Highlight
+  )
+{
+  mColourHighlighting = Highlight;
+}
+
+/**
+  This function returns the consistency checking status.
+
+  @retval TRUE Consistency checking is enabled.
+**/
+BOOLEAN
+EFIAPI
+GetConsistencyChecking (
+  VOID
+  )
+{
+  return mConsistencyCheck;
+}
+
+/**
+  This function sets the consistency checking status.
+
+  @param [in] ConsistencyChecking   The consistency checking status.
+**/
+VOID
+EFIAPI
+SetConsistencyChecking (
+  BOOLEAN ConsistencyChecking
+  )
+{
+  mConsistencyCheck = ConsistencyChecking;
+}
+
+/**
+  This function returns the report options.
+
+  @return The current report option.
+**/
+EREPORT_OPTION
+EFIAPI
+GetReportOption (
+  VOID
+  )
+{
+  return mReportType;
+}
+
+/**
+  This function sets the report options.
+
+  @param [in] ReportType The report option to set.
+**/
+VOID
+EFIAPI
+SetReportOption (
+  EREPORT_OPTION ReportType
+  )
+{
+  mReportType = ReportType;
+}
+
+/**
+  This function returns the ACPI table requirements validation flag.
+
+  @retval TRUE Check for mandatory table presence should be performed.
+**/
+BOOLEAN
+EFIAPI
+GetMandatoryTableValidate (
+  VOID
+  )
+{
+  return mMandatoryTableValidate;
+}
+
+/**
+  This function sets the ACPI table requirements validation flag.
+
+  @param [in] Validate Enable/Disable ACPI table requirements validation.
+**/
+VOID
+EFIAPI
+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
+EFIAPI
+GetMandatoryTableSpec (
+  VOID
+  )
+{
+  return mMandatoryTableSpec;
+}
+
+/**
+  This function sets the identifier of specification to validate ACPI table
+  requirements against.
+
+  @param [in] Spec ID of specification listing mandatory tables.
+**/
+VOID
+EFIAPI
+SetMandatoryTableSpec (
+  UINTN Spec
+  )
+{
+  mMandatoryTableSpec = Spec;
+}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h
new file mode 100644
index 000000000000..2db4a65415d8
--- /dev/null
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h
@@ -0,0 +1,177 @@
+/** @file
+  Header file for 'acpiview' configuration.
+
+  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef ACPI_VIEW_CONFIG_H_
+#define ACPI_VIEW_CONFIG_H_
+
+/**
+  This function returns the colour highlighting status.
+
+  @retval TRUE Colour highlighting is enabled.
+**/
+BOOLEAN
+EFIAPI
+GetColourHighlighting (
+  VOID
+  );
+
+/**
+  This function sets the colour highlighting status.
+
+  @param [in] Highlight The highlight status.
+**/
+VOID
+EFIAPI
+SetColourHighlighting (
+  BOOLEAN Highlight
+  );
+
+/**
+  This function returns the consistency checking status.
+
+  @retval TRUE Consistency checking is enabled.
+**/
+BOOLEAN
+EFIAPI
+GetConsistencyChecking (
+  VOID
+  );
+
+/**
+  This function sets the consistency checking status.
+
+  @param [in] ConsistencyChecking   The consistency checking status.
+**/
+VOID
+EFIAPI
+SetConsistencyChecking (
+  BOOLEAN ConsistencyChecking
+  );
+
+/**
+  This function returns the ACPI table requirements validation flag.
+
+  @retval TRUE Check for mandatory table presence should be performed.
+**/
+BOOLEAN
+EFIAPI
+GetMandatoryTableValidate (
+  VOID
+  );
+
+/**
+  This function sets the ACPI table requirements validation flag.
+
+  @param [in] Validate Enable/Disable ACPI table requirements validation.
+**/
+VOID
+EFIAPI
+SetMandatoryTableValidate (
+  BOOLEAN Validate
+  );
+
+/**
+  This function returns the identifier of specification to validate ACPI table
+  requirements against.
+
+  @return ID of specification listing mandatory tables.
+**/
+UINTN
+EFIAPI
+GetMandatoryTableSpec (
+  VOID
+  );
+
+/**
+  This function sets the identifier of specification to validate ACPI table
+  requirements against.
+
+  @param [in] Spec ID of specification listing mandatory tables.
+**/
+VOID
+EFIAPI
+SetMandatoryTableSpec (
+  UINTN Spec
+  );
+
+/**
+  The EREPORT_OPTION enum describes ACPI table Reporting options.
+**/
+typedef enum {
+  ReportAll,          ///< Report All tables.
+  ReportSelected,     ///< Report Selected table.
+  ReportTableList,    ///< Report List of tables.
+  ReportDumpBinFile,  ///< Dump selected table to a file.
+  ReportMax,
+} EREPORT_OPTION;
+
+/**
+  This function returns the report options.
+
+  @return The current report option.
+**/
+EREPORT_OPTION
+EFIAPI
+GetReportOption (
+  VOID
+  );
+
+/**
+  This function sets the report options.
+
+  @param [in] ReportType The report option to set.
+**/
+VOID
+EFIAPI
+SetReportOption (
+  EREPORT_OPTION ReportType
+  );
+
+/**
+  A structure holding the user selection detailing which
+  ACPI table is to be examined by the AcpiView code.
+**/
+typedef struct {
+  UINT32              Type;    ///< 32bit signature of the selected ACPI table.
+  CONST CHAR16*       Name;    ///< User friendly name of the selected ACPI table.
+  BOOLEAN             Found;   ///< The selected table has been found in the system.
+} SELECTED_ACPI_TABLE;
+
+/**
+  This function returns the selected ACPI table.
+
+  @param [out] SelectedAcpiTable Pointer that will contain the returned struct.
+**/
+VOID
+EFIAPI
+GetSelectedAcpiTable (
+  OUT SELECTED_ACPI_TABLE** SelectedAcpiTable
+  );
+
+/**
+  This function selects an ACPI table in current context.
+  The string name of the table is converted into UINT32
+  table signature.
+
+  @param [in] TableName The name of the ACPI table to select.
+**/
+VOID
+EFIAPI
+SelectAcpiTable (
+  CONST CHAR16* TableName
+  );
+
+/**
+  Reset the AcpiView user configuration to defaults.
+**/
+VOID
+EFIAPI
+AcpiConfigSetDefaults (
+  VOID
+  );
+
+#endif // ACPI_VIEW_CONFIG_H_
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
index bdd30ff45c61..d02fc4929d6f 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
@@ -12,6 +12,7 @@
 #include <Library/UefiLib.h>
 #include "AcpiParser.h"
 #include "AcpiTableParser.h"
+#include "AcpiViewConfig.h"
 
 // "The number of GT Block Timers must be less than or equal to 8"
 #define GT_BLOCK_TIMER_COUNT_MAX 8
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
index 9a006a01448b..f7447947b230 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
@@ -13,6 +13,7 @@
 #include <Library/UefiLib.h>
 #include "AcpiParser.h"
 #include "AcpiTableParser.h"
+#include "AcpiViewConfig.h"
 
 // Local variables
 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
index f85d2b36532c..15aa2392b60c 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
@@ -15,6 +15,7 @@
 #include <Library/UefiLib.h>
 #include "AcpiParser.h"
 #include "AcpiTableParser.h"
+#include "AcpiViewConfig.h"
 #include "MadtParser.h"
 
 // Local Variables
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c
index 0db272c16af0..acd2b81bb325 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c
@@ -13,6 +13,7 @@
 #include <Library/UefiLib.h>
 #include "AcpiParser.h"
 #include "AcpiView.h"
+#include "AcpiViewConfig.h"
 #include "PpttParser.h"
 
 // Local variables
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
index 6f66be68cc0b..b9b67820b89f 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
@@ -13,6 +13,7 @@
 #include <Library/UefiLib.h>
 #include "AcpiParser.h"
 #include "AcpiTableParser.h"
+#include "AcpiViewConfig.h"
 
 // Local Variables
 STATIC CONST UINT8* SratRAType;
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
index d21ecd40a8cf..92de2391b09f 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
@@ -19,15 +19,14 @@ [Defines]
   DESTRUCTOR                     = UefiShellAcpiViewCommandLibDestructor
 
 [Sources.common]
-  UefiShellAcpiViewCommandLib.uni
-  UefiShellAcpiViewCommandLib.c
-  UefiShellAcpiViewCommandLib.h
-  AcpiParser.h
-  AcpiTableParser.h
-  AcpiView.h
   AcpiParser.c
+  AcpiParser.h
   AcpiTableParser.c
+  AcpiTableParser.h
   AcpiView.c
+  AcpiView.h
+  AcpiViewConfig.c
+  AcpiViewConfig.h
   Parsers/Bgrt/BgrtParser.c
   Parsers/Dbg2/Dbg2Parser.c
   Parsers/Dsdt/DsdtParser.c
@@ -36,40 +35,43 @@ [Sources.common]
   Parsers/Gtdt/GtdtParser.c
   Parsers/Iort/IortParser.c
   Parsers/Madt/MadtParser.c
+  Parsers/Madt/MadtParser.h
   Parsers/Mcfg/McfgParser.c
   Parsers/Pptt/PpttParser.c
+  Parsers/Pptt/PpttParser.h
   Parsers/Rsdp/RsdpParser.c
   Parsers/Slit/SlitParser.c
   Parsers/Spcr/SpcrParser.c
   Parsers/Srat/SratParser.c
   Parsers/Ssdt/SsdtParser.c
   Parsers/Xsdt/XsdtParser.c
-  Parsers/Madt/MadtParser.h
-  Parsers/Pptt/PpttParser.h
+  UefiShellAcpiViewCommandLib.c
+  UefiShellAcpiViewCommandLib.h
+  UefiShellAcpiViewCommandLib.uni
 
 [Sources.ARM, Sources.AARCH64]
   Arm/SbbrValidator.h
   Arm/SbbrValidator.c
 
 [Packages]
+  MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   ShellPkg/ShellPkg.dec
-  MdeModulePkg/MdeModulePkg.dec
 
 [LibraryClasses]
-  MemoryAllocationLib
   BaseLib
   BaseMemoryLib
   DebugLib
+  FileHandleLib
+  HiiLib
+  MemoryAllocationLib
+  PcdLib
+  PrintLib
   ShellCommandLib
   ShellLib
+  UefiBootServicesTableLib
   UefiLib
   UefiRuntimeServicesTableLib
-  UefiBootServicesTableLib
-  PcdLib
-  HiiLib
-  PrintLib
-  FileHandleLib
 
 
 [FixedPcd]
-- 
2.24.1.windows.2



  parent reply	other threads:[~2020-06-15 14:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15 14:03 [PATCH v3 0/7] Standalone AcpiView Application Tomas Pilar (tpilar)
2020-06-15 14:03 ` [PATCH v3 1/7] ShellPkg/AcpiView: Move log reset to main method Tomas Pilar (tpilar)
2020-06-15 14:03 ` Tomas Pilar (tpilar) [this message]
2020-06-23  1:23   ` [PATCH v3 2/7] ShellPkg/AcpiView: Refactor configuration Gao, Zhichao
2020-06-15 14:03 ` [PATCH v3 3/7] ShellPkg/AcpiView: Move table count reset Tomas Pilar (tpilar)
2020-06-15 14:03 ` [PATCH v3 4/7] ShellPkg/AcpiView: Move parameter parsing Tomas Pilar (tpilar)
2020-06-15 14:03 ` [PATCH v3 5/7] ShellPkg/AcpiView: Refactor DumpAcpiTableToFile Tomas Pilar (tpilar)
2020-06-23  1:25   ` Gao, Zhichao
2020-06-15 14:03 ` [PATCH v3 6/7] ShellPkg: Add AcpiViewCommandLib Tomas Pilar (tpilar)
2020-06-23  1:26   ` [edk2-devel] " Gao, Zhichao
2020-06-15 14:03 ` [PATCH v3 7/7] ShellPkg/AcpiView: Add application wrapper Tomas Pilar (tpilar)
2020-06-23  1:28   ` Gao, Zhichao
2020-06-22 12:23 ` [edk2-devel] [PATCH v3 0/7] Standalone AcpiView Application Tomas Pilar (tpilar)
2020-06-23  1:32   ` Gao, Zhichao

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=20200615140351.1725-3-Tomas.Pilar@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