]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
ShellPkg/UefiShellAcpiViewCommandLib: Fix VS2017 compilation errors
[mirror_edk2.git] / ShellPkg / Library / UefiShellAcpiViewCommandLib / AcpiView.c
index 3bb142538c0099dcdd2dfa3d208d3350c425accb..47ce93f104b024540b3140e3acd92b8a1dccccb1 100644 (file)
@@ -1,4 +1,4 @@
-/**\r
+/** @file\r
 \r
   Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.\r
   This program and the accompanying materials\r
@@ -35,8 +35,9 @@ STATIC BOOLEAN            mVerbose;
 STATIC BOOLEAN            mConsistencyCheck;\r
 STATIC BOOLEAN            mColourHighlighting;\r
 \r
-/** An array of acpiview command line parameters.\r
-*/\r
+/**\r
+  An array of acpiview command line parameters.\r
+**/\r
 STATIC CONST SHELL_PARAM_ITEM ParamList[] = {\r
   {L"/?", TypeFlag},\r
   {L"-c", TypeFlag},\r
@@ -48,10 +49,11 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
   {NULL, TypeMax}\r
 };\r
 \r
-/** This function returns the colour highlighting status.\r
+/**\r
+  This function returns the colour highlighting status.\r
 \r
   @retval TRUE if colour highlighting is enabled.\r
-*/\r
+**/\r
 BOOLEAN\r
 GetColourHighlighting (\r
   VOID\r
@@ -60,9 +62,12 @@ GetColourHighlighting (
   return mColourHighlighting;\r
 }\r
 \r
-/** This function sets the colour highlighting status.\r
+/**\r
+  This function sets the colour highlighting status.\r
+\r
+  @param  Highlight       The Highlight status.\r
 \r
-*/\r
+**/\r
 VOID\r
 SetColourHighlighting (\r
   BOOLEAN Highlight\r
@@ -71,10 +76,11 @@ SetColourHighlighting (
   mColourHighlighting = Highlight;\r
 }\r
 \r
-/** This function returns the report options.\r
+/**\r
+  This function returns the report options.\r
 \r
   @retval Returns the report option.\r
-*/\r
+**/\r
 STATIC\r
 EREPORT_OPTION\r
 GetReportOption (\r
@@ -84,10 +90,11 @@ GetReportOption (
   return mReportType;\r
 }\r
 \r
-/** This function returns the selected ACPI table.\r
+/**\r
+  This function returns the selected ACPI table.\r
 \r
   @retval Returns signature of the selected ACPI table.\r
-*/\r
+**/\r
 STATIC\r
 UINT32\r
 GetSelectedAcpiTable (\r
@@ -97,13 +104,15 @@ GetSelectedAcpiTable (
   return mSelectedAcpiTable;\r
 }\r
 \r
-/** This function dumps the ACPI table to a file.\r
+/**\r
+  This function dumps the ACPI table to a file.\r
+\r
   @param [in] Ptr       Pointer to the ACPI table data.\r
   @param [in] Length    The length of the ACPI table.\r
 \r
   @retval TRUE          Success.\r
   @retval FALSE         Failure.\r
-*/\r
+**/\r
 STATIC\r
 BOOLEAN\r
 DumpAcpiTableToFile (\r
@@ -113,8 +122,11 @@ DumpAcpiTableToFile (
 {\r
   EFI_STATUS         Status;\r
   CHAR16             FileNameBuffer[MAX_FILE_NAME_LEN];\r
-  SHELL_FILE_HANDLE  DumpFileHandle = NULL;\r
-  UINTN              TransferBytes = Length;\r
+  SHELL_FILE_HANDLE  DumpFileHandle;\r
+  UINTN              TransferBytes;\r
+\r
+  DumpFileHandle = NULL;\r
+  TransferBytes = Length;\r
 \r
   UnicodeSPrint (\r
     FileNameBuffer,\r
@@ -160,14 +172,15 @@ DumpAcpiTableToFile (
   return (Length == TransferBytes);\r
 }\r
 \r
-/** This function processes the table reporting options for the ACPI table.\r
+/**\r
+  This function processes the table reporting options for the ACPI table.\r
 \r
   @param [in] Signature The ACPI table Signature.\r
   @param [in] TablePtr  Pointer to the ACPI table data.\r
   @param [in] Length    The length fo the ACPI table.\r
 \r
   @retval Returns TRUE if the ACPI table should be traced.\r
-*/\r
+**/\r
 BOOLEAN\r
 ProcessTableReportOptions (\r
   IN CONST UINT32  Signature,\r
@@ -176,20 +189,25 @@ ProcessTableReportOptions (
   )\r
 {\r
   UINTN   OriginalAttribute;\r
-  UINT8*  SignaturePtr = (UINT8*)(UINTN)&Signature;\r
-  BOOLEAN Log = FALSE;\r
-  BOOLEAN HighLight = GetColourHighlighting ();\r
+  UINT8*  SignaturePtr;\r
+  BOOLEAN Log;\r
+  BOOLEAN HighLight;\r
+\r
+  SignaturePtr = (UINT8*)(UINTN)&Signature;\r
+  Log = FALSE;\r
+  HighLight = GetColourHighlighting ();\r
+\r
   switch (GetReportOption ()) {\r
-    case EREPORT_ALL:\r
+    case ReportAll:\r
       Log = TRUE;\r
       break;\r
-    case EREPORT_SELECTED:\r
+    case ReportSelected:\r
       if (Signature == GetSelectedAcpiTable ()) {\r
         Log = TRUE;\r
         mSelectedAcpiTableFound = TRUE;\r
       }\r
       break;\r
-    case EREPORT_TABLE_LIST:\r
+    case ReportTableList:\r
       if (mTableCount == 0) {\r
         if (HighLight) {\r
           OriginalAttribute = gST->ConOut->Mode->Attribute;\r
@@ -213,13 +231,13 @@ ProcessTableReportOptions (
         SignaturePtr[3]\r
         );\r
       break;\r
-    case EREPORT_DUMP_BIN_FILE:\r
+    case ReportDumpBinFile:\r
       if (Signature == GetSelectedAcpiTable ()) {\r
         mSelectedAcpiTableFound = TRUE;\r
         DumpAcpiTableToFile (TablePtr, Length);\r
       }\r
       break;\r
-    case EREPORT_MAX:\r
+    case ReportMax:\r
       // We should never be here.\r
       // This case is only present to prevent compiler warning.\r
       break;\r
@@ -249,22 +267,25 @@ ProcessTableReportOptions (
   return Log;\r
 }\r
 \r
-/** This function converts a string to ACPI table signature.\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
+**/\r
 STATIC\r
 UINT32\r
 ConvertStrToAcpiSignature (\r
   IN  CONST CHAR16* Str\r
   )\r
 {\r
-  UINT8 Index = 0;\r
+  UINT8 Index;\r
   CHAR8 Ptr[4];\r
 \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
@@ -277,16 +298,16 @@ ConvertStrToAcpiSignature (
   return *(UINT32*)Ptr;\r
 }\r
 \r
-/** This function iterates the configuration table entries in the\r
-    system table, retrieves the RSDP pointer and starts parsing\r
-    the ACPI tables.\r
+/**\r
+  This function iterates the configuration table entries in the\r
+  system table, retrieves the RSDP pointer and starts parsing the ACPI tables.\r
 \r
   @param [in] SystemTable Pointer to the EFI system table.\r
 \r
   @retval Returns EFI_NOT_FOUND   if the RSDP pointer is not found.\r
           Returns EFI_UNSUPPORTED if the RSDP version is less than 2.\r
           Returns EFI_SUCCESS     if successful.\r
-*/\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
@@ -360,12 +381,12 @@ AcpiView (
   }\r
 \r
   ReportOption = GetReportOption ();\r
-  if (EREPORT_TABLE_LIST != ReportOption) {\r
-    if (((EREPORT_SELECTED == ReportOption)  ||\r
-         (EREPORT_DUMP_BIN_FILE == ReportOption)) &&\r
+  if (ReportTableList != ReportOption) {\r
+    if (((ReportSelected == ReportOption)  ||\r
+         (ReportDumpBinFile == ReportOption)) &&\r
         (!mSelectedAcpiTableFound)) {\r
       Print (L"\nRequested ACPI Table not found.\n");\r
-    } else if (EREPORT_DUMP_BIN_FILE != ReportOption) {\r
+    } else if (ReportDumpBinFile != ReportOption) {\r
       OriginalAttribute = gST->ConOut->Mode->Attribute;\r
 \r
       Print (L"\nTable Statistics:\n");\r
@@ -406,7 +427,7 @@ AcpiView (
 \r
   @param[in] ImageHandle  Handle to the Image (NULL if Internal).\r
   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).\r
-*/\r
+**/\r
 SHELL_STATUS\r
 EFIAPI\r
 ShellCommandRunAcpiView (\r
@@ -415,15 +436,15 @@ ShellCommandRunAcpiView (
   )\r
 {\r
   EFI_STATUS         Status;\r
-  SHELL_STATUS       ShellStatus = SHELL_SUCCESS;\r
-  LIST_ENTRY*        Package = NULL;\r
+  SHELL_STATUS       ShellStatus;\r
+  LIST_ENTRY*        Package;\r
   CHAR16*            ProblemParam;\r
   CONST CHAR16*      Temp;\r
   CHAR8              ColourOption[8];\r
-  SHELL_FILE_HANDLE  TmpDumpFileHandle = NULL;\r
+  SHELL_FILE_HANDLE  TmpDumpFileHandle;\r
 \r
   // Set Defaults\r
-  mReportType = EREPORT_ALL;\r
+  mReportType = ReportAll;\r
   mTableCount = 0;\r
   mBinTableCount = 0;\r
   mSelectedAcpiTable = 0;\r
@@ -432,6 +453,10 @@ ShellCommandRunAcpiView (
   mVerbose = TRUE;\r
   mConsistencyCheck = TRUE;\r
 \r
+  ShellStatus = SHELL_SUCCESS;\r
+  Package = NULL;\r
+  TmpDumpFileHandle = NULL;\r
+\r
   // Reset The error/warning counters\r
   ResetErrorCount ();\r
   ResetWarningCount ();\r
@@ -536,19 +561,19 @@ ShellCommandRunAcpiView (
       }\r
 \r
       if (ShellCommandLineGetFlag (Package, L"-l")) {\r
-        mReportType = EREPORT_TABLE_LIST;\r
+        mReportType = ReportTableList;\r
       } else {\r
         mSelectedAcpiTableName = ShellCommandLineGetValue (Package, L"-s");\r
         if (mSelectedAcpiTableName != NULL) {\r
           mSelectedAcpiTable = (UINT32)ConvertStrToAcpiSignature (\r
                                          mSelectedAcpiTableName\r
                                          );\r
-          mReportType = EREPORT_SELECTED;\r
+          mReportType = 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 = EREPORT_DUMP_BIN_FILE;\r
+            mReportType = ReportDumpBinFile;\r
 \r
             UnicodeSPrint (\r
               FileNameBuffer,\r