]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c
ShellPkg: Clean up source files
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / SmbiosView / SmbiosView.c
index a06339452a37b19853a2aaac9047decdc32bdd3c..e20b20793df61f1e80d6036976cad240a3370b0f 100644 (file)
@@ -2,7 +2,7 @@
   Tools of clarify the content of the smbios table.\r
 \r
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
-  Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -13,7 +13,7 @@
 \r
 **/\r
 \r
-#include "../UefiShellDebug1CommandsLib.h"\r
+#include "UefiShellDebug1CommandsLib.h"\r
 #include "LibSmbiosView.h"\r
 #include "SmbiosView.h"\r
 #include "PrintInfo.h"\r
@@ -69,7 +69,7 @@ ShellCommandRunSmbiosView (
   Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);\r
   if (EFI_ERROR(Status)) {\r
     if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"smbiosview", ProblemParam);  \r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"smbiosview", ProblemParam);\r
       FreePool(ProblemParam);\r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
     } else {\r
@@ -77,13 +77,13 @@ ShellCommandRunSmbiosView (
     }\r
   } else {\r
     if (ShellCommandLineGetCount(Package) > 1) {\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"smbiosview");  \r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"smbiosview");\r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
     } else if (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetValue(Package, L"-t") == NULL) {\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"smbiosview", L"-t");  \r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"smbiosview", L"-t");\r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
     } else if (ShellCommandLineGetFlag(Package, L"-h") && ShellCommandLineGetValue(Package, L"-h") == NULL) {\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle,  L"smbiosview", L"-h");  \r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle,  L"smbiosview", L"-h");\r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
     } else if (\r
         (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetFlag(Package, L"-h")) ||\r
@@ -93,7 +93,7 @@ ShellCommandRunSmbiosView (
         (ShellCommandLineGetFlag(Package, L"-h") && ShellCommandLineGetFlag(Package, L"-a")) ||\r
         (ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetFlag(Package, L"-a"))\r
       ) {\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"smbiosview");  \r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"smbiosview");\r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
     } else {\r
 \r
@@ -103,30 +103,30 @@ ShellCommandRunSmbiosView (
       Status1 = LibSmbiosInit ();\r
       Status2 = LibSmbios64BitInit ();\r
       if (EFI_ERROR (Status1) && EFI_ERROR (Status2)) {\r
-       ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_CANNOT_GET_TABLE), gShellDebug1HiiHandle);\r
+        ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_CANNOT_GET_TABLE), gShellDebug1HiiHandle);\r
         ShellStatus = SHELL_NOT_FOUND;\r
         goto Done;\r
       }\r
-      \r
+\r
       StructType    = STRUCTURE_TYPE_RANDOM;\r
       RandomView    = TRUE;\r
-      \r
+\r
       Temp          = ShellCommandLineGetValue(Package, L"-t");\r
       if (Temp != NULL) {\r
         StructType = (UINT8) ShellStrToUintn (Temp);\r
       }\r
-      \r
+\r
       if (ShellCommandLineGetFlag(Package, L"-a")) {\r
         gShowType = SHOW_ALL;\r
       }\r
-      \r
+\r
       if (!EFI_ERROR (Status1)) {\r
         //\r
         // Initialize the StructHandle to be the first handle\r
         //\r
         StructHandle  = INVALID_HANDLE;\r
         LibGetSmbiosStructure (&StructHandle, NULL, NULL);\r
-        \r
+\r
         Temp = ShellCommandLineGetValue(Package, L"-h");\r
         if (Temp != NULL) {\r
           RandomView   = FALSE;\r
@@ -140,7 +140,7 @@ ShellCommandRunSmbiosView (
           ShellStatus = SHELL_NOT_FOUND;\r
           goto Done;\r
         }\r
-        \r
+\r
         if (ShellCommandLineGetFlag(Package, L"-s")) {\r
           Status = DisplayStatisticsTable (SHOW_DETAIL);\r
           if (EFI_ERROR(Status)) {\r
@@ -148,7 +148,7 @@ ShellCommandRunSmbiosView (
           }\r
           goto Show64Bit;\r
         }\r
-        \r
+\r
         //\r
         // Show SMBIOS structure information\r
         //\r
@@ -174,13 +174,13 @@ Show64Bit:
         //\r
         StructHandle  = INVALID_HANDLE;\r
         LibGetSmbios64BitStructure (&StructHandle, NULL, NULL);\r
-        \r
+\r
         Temp = ShellCommandLineGetValue(Package, L"-h");\r
         if (Temp != NULL) {\r
           RandomView   = FALSE;\r
           StructHandle = (UINT16) ShellStrToUintn(Temp);\r
         }\r
-        \r
+\r
         if (ShellCommandLineGetFlag(Package, L"-s")) {\r
           Status = DisplaySmbios64BitStatisticsTable (SHOW_DETAIL);\r
           if (EFI_ERROR(Status)) {\r
@@ -188,7 +188,7 @@ Show64Bit:
           }\r
           goto Done;\r
         }\r
-        \r
+\r
         //\r
         // Show SMBIOS structure information\r
         //\r
@@ -242,7 +242,6 @@ Done:
   @retval EFI_BAD_BUFFER_SIZE   structure is out of the range of SMBIOS table.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 SMBiosView (\r
   IN  UINT8   QueryType,\r
   IN  UINT16  QueryHandle,\r
@@ -416,7 +415,6 @@ SMBiosView (
   @retval EFI_BAD_BUFFER_SIZE   structure is out of the range of SMBIOS table.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 SMBios64View (\r
   IN  UINT8   QueryType,\r
   IN  UINT16  QueryHandle,\r
@@ -582,7 +580,6 @@ SMBios64View (
   @retval EFI_SUCCESS           print is successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 InitSmbiosTableStatistics (\r
   VOID\r
   )\r
@@ -669,10 +666,9 @@ InitSmbiosTableStatistics (
   @param[out] NumberOfSmbios64Structures  The number of structures in 64-bit SMBIOS table.\r
   @param[out] Smbios64TableLength         The total length of 64-bit SMBIOS table.\r
 \r
-  @retval EFI_SUCCESS                                                  Calculation was successful.\r
+  @retval EFI_SUCCESS                     Calculation was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 CalculateSmbios64BitStructureCountAndLength (\r
   SMBIOS_TABLE_3_0_ENTRY_POINT    *Smbios64EntryPoint,\r
   UINTN                           *NumberOfSmbios64Structures,\r
@@ -681,10 +677,10 @@ CalculateSmbios64BitStructureCountAndLength (
 {\r
   SMBIOS_STRUCTURE_POINTER        Smbios;\r
   UINT8                           *Raw;\r
-  \r
+\r
   *Smbios64TableLength = 0;\r
   *NumberOfSmbios64Structures = 0;\r
-  \r
+\r
   Smbios.Raw = (UINT8 *)(UINTN)(Smbios64EntryPoint->TableAddress);\r
   while (TRUE) {\r
     if (Smbios.Hdr->Type == 127) {\r
@@ -704,13 +700,13 @@ CalculateSmbios64BitStructureCountAndLength (
     //\r
     // Length = Next structure head - this structure head\r
     //\r
-    (*Smbios64TableLength) += (UINTN) (Smbios.Raw - Raw);\r
+    (*Smbios64TableLength) += ((UINTN) Smbios.Raw - (UINTN) Raw);\r
     if ((*Smbios64TableLength) > Smbios64EntryPoint->TableMaximumSize) {\r
-       //\r
-       // The actual table length exceeds maximum table size,\r
-       // There should be something wrong with SMBIOS table.\r
-       //\r
-       return EFI_INVALID_PARAMETER;\r
+      //\r
+      // The actual table length exceeds maximum table size,\r
+      // There should be something wrong with SMBIOS table.\r
+      //\r
+      return EFI_INVALID_PARAMETER;\r
     }\r
     (*NumberOfSmbios64Structures)++;\r
   }\r
@@ -722,7 +718,6 @@ CalculateSmbios64BitStructureCountAndLength (
   @retval EFI_SUCCESS           print is successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 InitSmbios64BitTableStatistics (\r
   VOID\r
   )\r
@@ -732,7 +727,7 @@ InitSmbios64BitTableStatistics (
   UINT16                    Length;\r
   UINT16                    Offset;\r
   UINT16                    Index;\r
-       EFI_STATUS                                                              Status;\r
+  EFI_STATUS                Status;\r
   SMBIOS_STRUCTURE_POINTER      SmbiosStruct;\r
   SMBIOS_TABLE_3_0_ENTRY_POINT  *SMBiosTable;\r
   STRUCTURE_STATISTICS          *StatisticsPointer;\r
@@ -760,9 +755,9 @@ InitSmbios64BitTableStatistics (
   //\r
   Status = CalculateSmbios64BitStructureCountAndLength (SMBiosTable, &mNumberOfSmbios64BitStructures, &mSmbios64BitTableLength);\r
   if ((EFI_ERROR (Status)) || (mSmbios64BitTableLength > SMBiosTable->TableMaximumSize)) {\r
-       return EFI_INVALID_PARAMETER;\r
+    return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   mSmbios64BitStatisticsTable = (STRUCTURE_STATISTICS *) AllocateZeroPool (mNumberOfSmbios64BitStructures * sizeof (STRUCTURE_STATISTICS));\r
 \r
   if (mSmbios64BitStatisticsTable == NULL) {\r
@@ -819,7 +814,6 @@ InitSmbios64BitTableStatistics (
   @retval EFI_SUCCESS           print is successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 DisplayStatisticsTable (\r
   IN   UINT8   Option\r
   )\r
@@ -900,7 +894,6 @@ DisplayStatisticsTable (
   @retval EFI_SUCCESS           print is successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 DisplaySmbios64BitStatisticsTable (\r
   IN   UINT8   Option\r
   )\r
@@ -981,7 +974,6 @@ DisplaySmbios64BitStatisticsTable (
   @return   A pointer to a string representing the ShowType (or 'undefined type' if not known).\r
 **/\r
 CHAR16 *\r
-EFIAPI\r
 GetShowTypeString (\r
   UINT8 ShowType\r
   )\r