]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/StatusCode/Pei/SerialStatusCodeWorker.c
Reviewed the code comments in the Include/Protocol directory for typos, grammar issue...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / StatusCode / Pei / SerialStatusCodeWorker.c
index 4000f372a1a905cf08327f9cf61f17768751828c..1b409310cf230efbcf9874cefcbd92368440c573 100644 (file)
@@ -1,8 +1,7 @@
-\r
 /** @file\r
   Serial I/O status code reporting worker.\r
 \r
-  Copyright (c) 2006, Intel Corporation\r
+  Copyright (c) 2006 - 2009, Intel Corporation\r
   All rights reserved. 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
 \r
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-  Module Name:  SerialStatusCodeWorker.c\r
-\r
 **/\r
 \r
-#include "PeiStatusCode.h"\r
-#include "DebugInfo.h"\r
+#include "StatusCodePei.h"\r
 \r
 /**\r
   Convert status code value and extended data to readable ASCII string, send string to serial I/O device.\r
 \r
-  @param  CodeType      Indicates the type of status code being reported.  Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r
-\r
-  @param  Value         Describes the current status of a hardware or software entity.\r
-                        This included information about the class and subclass that is used to classify the entity\r
-                        as well as an operation.  For progress codes, the operation is the current activity.\r
-                        For error codes, it is the exception.  For debug codes, it is not defined at this time.\r
-                        Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.\r
-                        Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r
-\r
-  @param  Instance      The enumeration of a hardware or software entity within the system.\r
-                        A system may contain multiple entities that match a class/subclass pairing.\r
-                        The instance differentiates between them.  An instance of 0 indicates that instance information is unavailable,\r
-                        not meaningful, or not relevant.  Valid instance numbers start with 1.\r
-\r
-\r
-  @param  CallerId      This optional parameter may be used to identify the caller.\r
-                        This parameter allows the status code driver to apply different rules to different callers.\r
-                        Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0 Specification.\r
-\r
-\r
-  @param  Data          This optional parameter may be used to pass additional data\r
-\r
-  @return               The function always return EFI_SUCCESS.\r
+  @param  CodeType         Indicates the type of status code being reported.\r
+  @param  Value            Describes the current status of a hardware or\r
+                           software entity. This includes information about the class and\r
+                           subclass that is used to classify the entity as well as an operation.\r
+                           For progress codes, the operation is the current activity.\r
+                           For error codes, it is the exception.For debug codes,it is not defined at this time.\r
+  @param  Instance         The enumeration of a hardware or software entity within\r
+                           the system. A system may contain multiple entities that match a class/subclass\r
+                           pairing. The instance differentiates between them. An instance of 0 indicates\r
+                           that instance information is unavailable, not meaningful, or not relevant.\r
+                           Valid instance numbers start with 1.\r
+  @param  CallerId         This optional parameter may be used to identify the caller.\r
+                           This parameter allows the status code driver to apply different rules to\r
+                           different callers.\r
+  @param  Data             This optional parameter may be used to pass additional data.\r
+\r
+  @retval EFI_SUCCESS      Status code reported to serial I/O successfully.\r
 \r
 **/\r
 EFI_STATUS\r
 SerialStatusCodeReportWorker (\r
-  IN EFI_STATUS_CODE_TYPE     CodeType,\r
-  IN EFI_STATUS_CODE_VALUE    Value,\r
-  IN UINT32                   Instance,\r
+  IN EFI_STATUS_CODE_TYPE           CodeType,\r
+  IN EFI_STATUS_CODE_VALUE          Value,\r
+  IN UINT32                         Instance,\r
   IN CONST EFI_GUID                 *CallerId,\r
   IN CONST EFI_STATUS_CODE_DATA     *Data OPTIONAL\r
   )\r
@@ -62,8 +51,7 @@ SerialStatusCodeReportWorker (
   UINT32          ErrorLevel;\r
   UINT32          LineNumber;\r
   UINTN           CharCount;\r
-  VA_LIST         Marker;\r
-  EFI_DEBUG_INFO  *DebugInfo;\r
+  BASE_LIST       Marker;\r
 \r
   Buffer[0] = '\0';\r
 \r
@@ -74,7 +62,7 @@ SerialStatusCodeReportWorker (
     //\r
     CharCount = AsciiSPrint (\r
                   Buffer,\r
-                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  sizeof (Buffer),\r
                   "\n\rPEI_ASSERT!: %a (%d): %a\n\r",\r
                   Filename,\r
                   LineNumber,\r
@@ -85,44 +73,29 @@ SerialStatusCodeReportWorker (
     //\r
     // Print DEBUG() information into output buffer.\r
     //\r
-    CharCount = AsciiVSPrint (\r
+    CharCount = AsciiBSPrint (\r
                   Buffer,\r
-                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  sizeof (Buffer),\r
                   Format,\r
                   Marker\r
                   );\r
-  } else if (Data != NULL &&\r
-             CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid) &&\r
-             (CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {\r
-    //\r
-    // Print specific data into output buffer.\r
-    //\r
-    DebugInfo = (EFI_DEBUG_INFO *) (Data + 1);\r
-    Marker    = (VA_LIST) (DebugInfo + 1);\r
-    Format    = (CHAR8 *) (((UINT64 *) Marker) + 12);\r
-\r
-    CharCount = AsciiVSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, Format, Marker);\r
   } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {\r
     //\r
     // Print ERROR information into output buffer.\r
     //\r
     CharCount = AsciiSPrint (\r
                   Buffer,\r
-                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  sizeof (Buffer),\r
                   "ERROR: C%x:V%x I%x",\r
                   CodeType,\r
                   Value,\r
                   Instance\r
                   );\r
 \r
-    //\r
-    // Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.\r
-    //\r
-\r
     if (CallerId != NULL) {\r
       CharCount += AsciiSPrint (\r
                      &Buffer[CharCount - 1],\r
-                     (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                     (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),\r
                      " %g",\r
                      CallerId\r
                      );\r
@@ -131,7 +104,7 @@ SerialStatusCodeReportWorker (
     if (Data != NULL) {\r
       CharCount += AsciiSPrint (\r
                      &Buffer[CharCount - 1],\r
-                     (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                     (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),\r
                      " %x",\r
                      Data\r
                      );\r
@@ -139,21 +112,27 @@ SerialStatusCodeReportWorker (
 \r
     CharCount += AsciiSPrint (\r
                    &Buffer[CharCount - 1],\r
-                   (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                   (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),\r
                    "\n\r"\r
                    );\r
   } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {\r
+    //\r
+    // Print PROGRESS information into output buffer.\r
+    //\r
     CharCount = AsciiSPrint (\r
                   Buffer,\r
-                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  sizeof (Buffer),\r
                   "PROGRESS CODE: V%x I%x\n\r",\r
                   Value,\r
                   Instance\r
                   );\r
   } else {\r
+    //\r
+    // Code type is not defined.\r
+    //\r
     CharCount = AsciiSPrint (\r
                   Buffer,\r
-                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  sizeof (Buffer),\r
                   "Undefined: C%x:V%x I%x\n\r",\r
                   CodeType,\r
                   Value,\r
@@ -162,9 +141,10 @@ SerialStatusCodeReportWorker (
   }\r
 \r
   //\r
-  // Callout to SerialPort Lib function to do print.\r
+  // Call SerialPort Lib function to do print.\r
   //\r
   SerialPortWrite ((UINT8 *) Buffer, CharCount);\r
 \r
   return EFI_SUCCESS;\r
 }\r
+\r