]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c
ShellPkg: ShellCommands/SetVar: Make '-rt' imply '-bs'
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / SmbiosView / EventLogInfo.c
index f0a9d54b7397a2675199d00d2183dd27688673d3..f07a4c492116997d01726cf4f7d76345f1871d2c 100644 (file)
@@ -1,7 +1,7 @@
-/**\r
+/** @file\r
   Module for clarifying the content of the smbios structure element info.\r
 \r
-  Copyright (c) 2005-2010, Intel Corporation. All rights reserved. <BR>\r
+  Copyright (c) 2005 - 2011, 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
@@ -141,6 +141,12 @@ DisplaySysEventLogHeaderFormat (
   }\r
 }\r
 \r
+/**\r
+  Display the header information for SEL log items.\r
+\r
+  @param[in] Key      The information key.\r
+  @param[in] Option   The option index.\r
+**/\r
 VOID\r
 DisplaySELLogHeaderLen (\r
   UINT8 Key,\r
@@ -163,9 +169,14 @@ DisplaySELLogHeaderLen (
   }\r
 }\r
 \r
+/**\r
+  Display the header information for type 1 items.\r
+\r
+  @param[in] LogHeader      The buffer with the information.\r
+**/\r
 VOID\r
 DisplaySysEventLogHeaderType1 (\r
-  UINT8 *LogHeader\r
+  IN UINT8 *LogHeader\r
   )\r
 {\r
   LOG_HEADER_TYPE1_FORMAT *Header;\r
@@ -186,8 +197,8 @@ DisplaySysEventLogHeaderType1 (
     Header->OEMReserved[3],\r
     Header->OEMReserved[4]\r
    );\r
-  ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_TIME), gShellDebug1HiiHandle, Header->METW);\r
-  ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_COUNT), gShellDebug1HiiHandle, Header->MECI);\r
+  ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_TIME), gShellDebug1HiiHandle, Header->Metw);\r
+  ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_COUNT), gShellDebug1HiiHandle, Header->Meci);\r
   ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_ADDRESS), gShellDebug1HiiHandle, Header->CMOSAddress);\r
   ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_INDEX), gShellDebug1HiiHandle, Header->CMOSBitIndex);\r
   ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUM_STARTING_OFF), gShellDebug1HiiHandle, Header->StartingOffset);\r
@@ -235,6 +246,12 @@ DisplaySysEventLogHeader (
   }\r
 }\r
 \r
+/**\r
+  Display the El Vdf information.\r
+\r
+  @param[in] ElVdfType    The information type.\r
+  @param[in] VarData      The information buffer.\r
+**/\r
 VOID\r
 DisplayElVdfInfo (\r
   UINT8 ElVdfType,\r
@@ -340,55 +357,56 @@ DisplaySysEventLogData (
   //\r
   Offset  = 0;\r
   Log     = (LOG_RECORD_FORMAT *) LogData;\r
-  while (Log->Type != END_OF_LOG && Offset < LogAreaLength) {\r
+  while (Log != NULL && Log->Type != END_OF_LOG && Offset < LogAreaLength) {\r
     //\r
     // Get a Event Log Record\r
     //\r
     Log = (LOG_RECORD_FORMAT *) (LogData + Offset);\r
 \r
-    //\r
-    // Display Event Log Record Information\r
-    //\r
-    DisplaySELVarDataFormatType (Log->Type, SHOW_DETAIL);\r
-    DisplaySELLogHeaderLen (Log->Length, SHOW_DETAIL);\r
-\r
-    Offset += Log->Length;\r
-\r
-    //\r
-    // Display Log Header Date/Time Fields\r
-    // These fields contain the BCD representation of the date and time\r
-    // (as read from CMOS) of the occurrence of the event\r
-    // So Print as hex and represent decimal\r
-    //\r
-    ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_DATE), gShellDebug1HiiHandle);\r
-    if (Log != NULL && Log->Year >= 80 && Log->Year <= 99) {\r
-      Print (L"19");\r
-    } else if (Log != NULL && Log->Year <= 79) {\r
-      Print (L"20");\r
-    } else {\r
-      ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ERROR), gShellDebug1HiiHandle);\r
-      continue;\r
-    }\r
-\r
-    ShellPrintHiiEx(-1,-1,NULL,\r
-      STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TIME_SIX_VARS),\r
-      gShellDebug1HiiHandle,\r
-      Log->Year,\r
-      Log->Month,\r
-      Log->Day,\r
-      Log->Hour,\r
-      Log->Minute,\r
-      Log->Second\r
-     );\r
-\r
-    //\r
-    // Display Variable Data Format\r
-    //\r
-    if (Log->Length <= (sizeof (LOG_RECORD_FORMAT) - 1)) {\r
-      continue;\r
+    if (Log != NULL) {\r
+      //\r
+      // Display Event Log Record Information\r
+      //\r
+      DisplaySELVarDataFormatType (Log->Type, SHOW_DETAIL);\r
+      DisplaySELLogHeaderLen (Log->Length, SHOW_DETAIL);\r
+\r
+      Offset += Log->Length;\r
+      //\r
+      // Display Log Header Date/Time Fields\r
+      // These fields contain the BCD representation of the date and time\r
+      // (as read from CMOS) of the occurrence of the event\r
+      // So Print as hex and represent decimal\r
+      //\r
+      ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_DATE), gShellDebug1HiiHandle);\r
+      if (Log != NULL && Log->Year >= 80 && Log->Year <= 99) {\r
+        Print (L"19");\r
+      } else if (Log != NULL && Log->Year <= 79) {\r
+        Print (L"20");\r
+      } else {\r
+        ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ERROR), gShellDebug1HiiHandle);\r
+        continue;\r
+      }\r
+\r
+      ShellPrintHiiEx(-1,-1,NULL,\r
+        STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TIME_SIX_VARS),\r
+        gShellDebug1HiiHandle,\r
+        Log->Year,\r
+        Log->Month,\r
+        Log->Day,\r
+        Log->Hour,\r
+        Log->Minute,\r
+        Log->Second\r
+       );\r
+\r
+      //\r
+      // Display Variable Data Format\r
+      //\r
+      if (Log->Length <= (sizeof (LOG_RECORD_FORMAT) - 1)) {\r
+        continue;\r
+      }\r
+\r
+      ElVdfType = Log->LogVariableData[0];\r
+      DisplayElVdfInfo (ElVdfType, Log->LogVariableData);\r
     }\r
-\r
-    ElVdfType = Log->LogVariableData[0];\r
-    DisplayElVdfInfo (ElVdfType, Log->LogVariableData);\r
   }\r
 }\r