]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/SerialStatusCodeWorker.c
Update the copyright notice format
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / StatusCode / RuntimeDxe / SerialStatusCodeWorker.c
index 710a808ada14acf3eb833e8d14a4d39292564786..3f503687550450fa9e34456e65fd367bec639640 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Serial I/O status code reporting worker.\r
 \r
-  Copyright (c) 2006 - 2009, Intel Corporation                                                         \r
-  All rights reserved. This program and the accompanying materials                          \r
+  Copyright (c) 2006 - 2009, 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
   http://opensource.org/licenses/bsd-license.php                                            \r
 \r
 #include "StatusCodeRuntimeDxe.h"\r
 \r
-EFI_SERIAL_IO_PROTOCOL *mSerialIoProtocol;\r
-\r
-/**\r
-  Locates Serial I/O Protocol as initialization for serial status code worker.\r
\r
-  @retval EFI_SUCCESS  Serial I/O Protocol is successfully located.\r
-\r
-**/\r
-EFI_STATUS\r
-EfiSerialStatusCodeInitializeWorker (\r
-  VOID\r
-  )\r
-{\r
-  EFI_STATUS Status;\r
-\r
-  Status = gBS->LocateProtocol (\r
-             &gEfiSerialIoProtocolGuid,\r
-             NULL,\r
-             (VOID **) &mSerialIoProtocol\r
-             );\r
-\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-\r
 /**\r
   Convert status code value and extended data to readable ASCII string, send string to serial I/O device.\r
  \r
@@ -76,16 +49,7 @@ SerialStatusCodeReportWorker (
   UINT32          ErrorLevel;\r
   UINT32          LineNumber;\r
   UINTN           CharCount;\r
-  VA_LIST         Marker;\r
-\r
-  if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {\r
-    if (EfiAtRuntime ()) {\r
-      return EFI_DEVICE_ERROR;\r
-    }\r
-    if (EfiGetCurrentTpl () > TPL_CALLBACK ) {\r
-      return EFI_DEVICE_ERROR;\r
-    }\r
-  }\r
+  BASE_LIST       Marker;\r
 \r
   Buffer[0] = '\0';\r
 \r
@@ -96,7 +60,7 @@ SerialStatusCodeReportWorker (
     //\r
     CharCount = AsciiSPrint (\r
                   Buffer,\r
-                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  sizeof (Buffer),\r
                   "\n\rDXE_ASSERT!: %a (%d): %a\n\r",\r
                   Filename,\r
                   LineNumber,\r
@@ -107,9 +71,9 @@ 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
@@ -119,7 +83,7 @@ SerialStatusCodeReportWorker (
     //\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
@@ -128,8 +92,8 @@ SerialStatusCodeReportWorker (
    \r
     if (CallerId != NULL) {\r
       CharCount += AsciiSPrint (\r
-                     &Buffer[CharCount - 1],\r
-                     (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                     &Buffer[CharCount],\r
+                     (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),\r
                      " %g",\r
                      CallerId\r
                      );\r
@@ -137,16 +101,16 @@ SerialStatusCodeReportWorker (
 \r
     if (Data != NULL) {\r
       CharCount += AsciiSPrint (\r
-                     &Buffer[CharCount - 1],\r
-                     (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                     &Buffer[CharCount],\r
+                     (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),\r
                      " %x",\r
                      Data\r
                      );\r
     }\r
 \r
     CharCount += AsciiSPrint (\r
-                   &Buffer[CharCount - 1],\r
-                   (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                   &Buffer[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
@@ -155,7 +119,7 @@ SerialStatusCodeReportWorker (
     //\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
@@ -166,7 +130,7 @@ SerialStatusCodeReportWorker (
     //\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
@@ -174,20 +138,10 @@ SerialStatusCodeReportWorker (
                   );\r
   }\r
 \r
-\r
-  if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {\r
-    //\r
-    // Call SerialPort Lib function to do print.\r
-    //\r
-    SerialPortWrite ((UINT8 *) Buffer, CharCount);\r
-  }\r
-  if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {\r
-    mSerialIoProtocol->Write (\r
-      mSerialIoProtocol,\r
-      &CharCount,\r
-      Buffer\r
-      );\r
-  }\r
+  //\r
+  // Call SerialPort Lib function to do print.\r
+  //\r
+  SerialPortWrite ((UINT8 *) Buffer, CharCount);\r
 \r
   return EFI_SUCCESS;\r
 }\r