]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c
ShellPkg: Update Debug1 profile commands response output
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / SmbiosView / SmbiosView.c
index b280306695fcb18474bbad176bca4c7a33d892cd..8ef3050b053c905e3eafb2d46a325a43267d83ef 100644 (file)
@@ -1,7 +1,8 @@
 /** @file\r
   Tools of clarify the content of the smbios table.\r
 \r
-  Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2015, Hewlett-Packard Development Company, L.P.<BR>\r
+  Copyright (c) 2005 - 2012, 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
@@ -61,7 +62,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, 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
@@ -69,13 +70,13 @@ ShellCommandRunSmbiosView (
     }\r
   } else {\r
     if (ShellCommandLineGetCount(Package) > 1) {\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\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"-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"-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
@@ -85,7 +86,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);\r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"smbiosview");  \r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
     } else {\r
 \r
@@ -111,7 +112,7 @@ ShellCommandRunSmbiosView (
       //\r
       // Initialize the StructHandle to be the first handle\r
       //\r
-      StructHandle  = STRUCTURE_HANDLE_INVALID;\r
+      StructHandle  = INVALID_HANDLE;\r
       LibGetSmbiosStructure (&StructHandle, NULL, NULL);\r
 \r
       Temp          = ShellCommandLineGetValue(Package, L"-t");\r
@@ -188,23 +189,12 @@ SMBiosView (
   )\r
 {\r
   UINT16                    Handle;\r
-  UINT8                     Buffer[1024];\r
-  //\r
-  // bigger than SMBIOS_STRUCTURE_TABLE.MaxStructureSize\r
-  //\r
+  UINT8                     *Buffer;\r
   UINT16                    Length;\r
   UINTN                     Index;\r
-  UINT16                    Offset;\r
-  //\r
-  // address offset from structure table head.\r
-  //\r
-  UINT32                    TableHead;\r
-  //\r
-  // structure table head.\r
-  //\r
 \r
   SMBIOS_STRUCTURE_POINTER  SmbiosStruct;\r
-  SMBIOS_STRUCTURE_TABLE    *SMBiosTable;\r
+  SMBIOS_TABLE_ENTRY_POINT  *SMBiosTable;\r
 \r
   SMBiosTable = NULL;\r
   LibSmbiosGetEPS (&SMBiosTable);\r
@@ -215,7 +205,7 @@ SMBiosView (
 \r
   if (CompareMem (SMBiosTable->AnchorString, "_SM_", 4) == 0) {\r
     //\r
-    // Have get SMBIOS table\r
+    // Have got SMBIOS table\r
     //\r
     SmbiosPrintEPSInfo (SMBiosTable, Option);\r
 \r
@@ -259,22 +249,20 @@ SMBiosView (
     // Searching and display structure info\r
     //\r
     Handle    = QueryHandle;\r
-    TableHead = SMBiosTable->TableAddress;\r
-    Offset    = 0;\r
     for (Index = 0; Index < SMBiosTable->NumberOfSmbiosStructures; Index++) {\r
       //\r
       // if reach the end of table, break..\r
       //\r
-      if (Handle == STRUCTURE_HANDLE_INVALID) {\r
+      if (Handle == INVALID_HANDLE) {\r
         break;\r
       }\r
       //\r
       // handle then point to the next!\r
       //\r
-      if (LibGetSmbiosStructure (&Handle, Buffer, &Length) != DMI_SUCCESS) {\r
+      if (LibGetSmbiosStructure (&Handle, &Buffer, &Length) != DMI_SUCCESS) {\r
         break;\r
       }\r
-      Offset      = (UINT16) (Offset + Length);\r
+\r
       SmbiosStruct.Raw = Buffer;\r
 \r
       //\r
@@ -297,7 +285,7 @@ SMBiosView (
       //\r
       // Addr of structure in structure in table\r
       //\r
-      ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ADDR), gShellDebug1HiiHandle, TableHead + Offset);\r
+      ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ADDR), gShellDebug1HiiHandle, (UINTN) Buffer);\r
       DumpHex (0, 0, Length, Buffer);\r
 \r
 /*\r
@@ -315,11 +303,6 @@ SMBiosView (
 */\r
 \r
       if (gShowType != SHOW_NONE) {\r
-        //\r
-        // check structure legality\r
-        //\r
-        SmbiosCheckStructure (&SmbiosStruct);\r
-\r
         //\r
         // Print structure information\r
         //\r
@@ -343,6 +326,12 @@ SMBiosView (
       if (!RandomView) {\r
         break;\r
       }\r
+      //\r
+      // Support Execution Interrupt.\r
+      //\r
+      if (ShellGetExecutionBreakFlag ()) {\r
+        return EFI_ABORTED;\r
+      }\r
     }\r
 \r
     ShellPrintEx(-1,-1,L"\n=========================================================\n");\r
@@ -364,13 +353,13 @@ InitSmbiosTableStatistics (
   )\r
 {\r
   UINT16                    Handle;\r
-  UINT8                     Buffer[1024];\r
+  UINT8                     *Buffer;\r
   UINT16                    Length;\r
   UINT16                    Offset;\r
   UINT16                    Index;\r
 \r
   SMBIOS_STRUCTURE_POINTER  SmbiosStruct;\r
-  SMBIOS_STRUCTURE_TABLE    *SMBiosTable;\r
+  SMBIOS_TABLE_ENTRY_POINT  *SMBiosTable;\r
   STRUCTURE_STATISTICS      *StatisticsPointer;\r
 \r
   SMBiosTable = NULL;\r
@@ -405,24 +394,23 @@ InitSmbiosTableStatistics (
   //\r
   // search from the first one\r
   //\r
-  Handle = STRUCTURE_HANDLE_INVALID;\r
+  Handle = INVALID_HANDLE;\r
   LibGetSmbiosStructure (&Handle, NULL, NULL);\r
   for (Index = 1; Index <= SMBiosTable->NumberOfSmbiosStructures; Index++) {\r
     //\r
     // If reach the end of table, break..\r
     //\r
-    if (Handle == STRUCTURE_HANDLE_INVALID) {\r
+    if (Handle == INVALID_HANDLE) {\r
       break;\r
     }\r
     //\r
     // After LibGetSmbiosStructure(), handle then point to the next!\r
     //\r
-    if (LibGetSmbiosStructure (&Handle, Buffer, &Length) != DMI_SUCCESS) {\r
+    if (LibGetSmbiosStructure (&Handle, &Buffer, &Length) != DMI_SUCCESS) {\r
       break;\r
     }\r
 \r
     SmbiosStruct.Raw = Buffer;\r
-    Offset      = (UINT16) (Offset + Length);\r
 \r
     //\r
     // general statistics\r
@@ -433,6 +421,8 @@ InitSmbiosTableStatistics (
     StatisticsPointer->Length = Length;\r
     StatisticsPointer->Addr   = Offset;\r
 \r
+    Offset = (UINT16) (Offset + Length);\r
+\r
     StatisticsPointer         = &mStatisticsTable[Index];\r
   }\r
 \r
@@ -452,10 +442,10 @@ DisplayStatisticsTable (
   IN   UINT8   Option\r
   )\r
 {\r
-  UINTN                   Index;\r
-  UINTN                   Num;\r
-  STRUCTURE_STATISTICS    *StatisticsPointer;\r
-  SMBIOS_STRUCTURE_TABLE  *SMBiosTable;\r
+  UINTN                    Index;\r
+  UINTN                    Num;\r
+  STRUCTURE_STATISTICS     *StatisticsPointer;\r
+  SMBIOS_TABLE_ENTRY_POINT *SMBiosTable;\r
 \r
   SMBiosTable = NULL;\r
   if (Option < SHOW_OUTLINE) {\r
@@ -558,12 +548,3 @@ GetShowTypeString (
   }\r
 }\r
 \r
-/*\r
-EFI_STATUS\r
-InitializeSmbiosViewApplicationGetLineHelp (\r
-  OUT CHAR16              **Str\r
-  )\r
-{\r
-  return LibCmdGetStringByToken (STRING_ARRAY_NAME, &EfiSmbiosViewGuid, STRING_TOKEN (STR_SMBIOSVIEW_LINE_HELP), Str);\r
-}\r
-*/\r