]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/StatusCode/Dxe/SerialStatusCodeWorker.c
Code Scrub for Status Code Runtime Dxe driver.
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / StatusCode / Dxe / SerialStatusCodeWorker.c
index 52817283d943aea2f33ddb1a754dd6618d6d078b..d9ec8c5ca3a08dcf224f47d0c73040c4ec06d056 100644 (file)
@@ -1,7 +1,7 @@
 /** @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
@@ -17,9 +17,9 @@
 EFI_SERIAL_IO_PROTOCOL *mSerialIoProtocol;\r
 \r
 /**\r
-  Initialize serial status code worker.\r
+  Locates Serial I/O Protocol as initialization for serial status code worker.\r
  \r
-  @return  The function always return EFI_SUCCESS\r
+  @retval EFI_SUCCESS  Serial I/O Protocol is successfully located.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -44,30 +44,20 @@ EfiSerialStatusCodeInitializeWorker (
 /**\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
-  @retval EFI_SUCCESS         Success to report status code to serial I/O.\r
-  @retval EFI_DEVICE_ERROR    EFI serial device can not work after ExitBootService() is called .\r
+  @param  CodeType         Indicates the type of status code being reported.\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\r
+                           classify the entity as well as an operation.\r
+  @param  Instance         The enumeration of a hardware or software entity within\r
+                           the system. 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
+  @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.\r
+  @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -87,17 +77,12 @@ SerialStatusCodeReportWorker (
   UINT32          LineNumber;\r
   UINTN           CharCount;\r
   VA_LIST         Marker;\r
-  EFI_TPL         CurrentTpl;\r
-\r
 \r
   if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {\r
     if (EfiAtRuntime ()) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
-    CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
-    gBS->RestoreTPL (CurrentTpl);\r
-\r
-    if (CurrentTpl > TPL_CALLBACK ) {\r
+    if (EfiGetCurrentTpl () > TPL_CALLBACK ) {\r
       return EFI_DEVICE_ERROR;\r
     }\r
   }\r
@@ -140,12 +125,7 @@ SerialStatusCodeReportWorker (
                   Value, \r
                   Instance\r
                   );\r
-\r
-    //\r
-    // Make sure we don't try to print values that weren't \r
-    // intended to be printed, especially NULL GUID pointers.\r
-    //\r
-    \r
+   \r
     if (CallerId != NULL) {\r
       CharCount += AsciiSPrint (\r
                      &Buffer[CharCount - 1],\r
@@ -170,6 +150,9 @@ SerialStatusCodeReportWorker (
                    "\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
@@ -178,6 +161,9 @@ SerialStatusCodeReportWorker (
                   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
@@ -191,7 +177,7 @@ SerialStatusCodeReportWorker (
 \r
   if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {\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