]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg/AcpiView: Refactor configuration
authorTomas Pilar <Tomas.Pilar@arm.com>
Fri, 19 Jun 2020 11:59:54 +0000 (12:59 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 30 Jun 2020 01:39:50 +0000 (01:39 +0000)
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>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Tomas Pilar <tomas.pilar@arm.com>
12 files changed:
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c [new file with mode: 0644]
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h [new file with mode: 0644]
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf

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