]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/DxeIpl/SerialStatusCode.c
Patch from open source community for CryptoPkg to allow it to build for ARM using...
[mirror_edk2.git] / DuetPkg / DxeIpl / SerialStatusCode.c
index 20a11d2c54a61fd1fc7cf522e29e1ffcf85c652e..e936db5b59016a8a0ebf0f04af4b60f170b70fe1 100644 (file)
@@ -1,7 +1,7 @@
-/*++\r
+/** @file\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
+Copyright (c) 2006, 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
@@ -16,7 +16,7 @@ Abstract:
 \r
 Revision History:\r
 \r
---*/\r
+**/\r
 \r
 #include "SerialStatusCode.h"\r
 \r
@@ -542,21 +542,6 @@ STATUS_CODE_LOOKUP_TABLE mOperationToken[] = {
   };\r
 \r
 \r
-//\r
-// Private function declarations\r
-//\r
-UINT8\r
-CpuIoRead8 (\r
-  UINT16  Port \r
-  );\r
-\r
-VOID\r
-CpuIoWrite8 (\r
-  UINT16  Port,    \r
-  UINT32  Data   \r
-  );\r
-\r
-\r
 EFI_STATUS\r
 MatchString (\r
   IN  STATUS_CODE_LOOKUP_TABLE  *Table,\r
@@ -648,15 +633,15 @@ Returns:
   // Wait for the serail port to be ready.\r
   //\r
   do {\r
-    Data = CpuIoRead8 (gComBase + LSR_OFFSET);\r
+    Data = IoRead8 (gComBase + LSR_OFFSET);\r
   } while ((Data & LSR_TXRDY) == 0);\r
     \r
-  CpuIoWrite8 (gComBase, Character);\r
+  IoWrite8 (gComBase, Character);\r
 }\r
 \r
 VOID\r
 DebugSerialPrint (\r
-  IN UINT8    *OutputString\r
+  IN CHAR8    *OutputString\r
   )\r
 /*++\r
 \r
@@ -674,10 +659,6 @@ Returns:
 \r
 --*/\r
 {\r
-  EFI_STATUS  Status;\r
-\r
-  Status = EFI_SUCCESS;\r
-\r
   for ( ; *OutputString != 0; OutputString++) {\r
     DebugSerialWrite (*OutputString);\r
   }\r
@@ -714,46 +695,48 @@ Returns:
   CHAR8                   *Filename;\r
   CHAR8                   *Description;\r
   CHAR8                   *Format;\r
-  VA_LIST                 Marker;\r
+  BASE_LIST               Marker;\r
   UINT32                  ErrorLevel;\r
   UINTN                   CharCount;\r
 \r
   Buffer[0] = '\0';\r
 \r
-  if (ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {\r
+  if (Data != NULL && \r
+      ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {\r
     //\r
     // Processes PEI_ASSERT ()\r
     //\r
     AsciiSPrint (\r
       Buffer,\r
-      EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+      sizeof (Buffer),\r
       "\nPEI_ASSERT!: %a (%d): %a\n",\r
       Filename,\r
       LineNumber,\r
       Description\r
       );\r
 \r
-  } else if (ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {\r
+  } else if (Data != NULL &&\r
+             ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {\r
     //\r
     // Process PEI_DEBUG () macro to Serial\r
     //\r
-    AsciiVSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, Format, Marker);\r
+    AsciiBSPrint (Buffer, sizeof (Buffer), Format, Marker);\r
 \r
   } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) { \r
     //\r
     // Process Errors\r
     //\r
-    CharCount = AsciiSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "ERROR: C%x:V%x I%x", CodeType, Value, Instance);\r
+    CharCount = AsciiSPrint (Buffer, sizeof (Buffer), "ERROR: C%x:V%x I%x", CodeType, Value, Instance);\r
     //\r
     // Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.\r
     //\r
     if (CallerId) {\r
-      CharCount += AsciiSPrint (&Buffer[CharCount - 1], (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof(Buffer[0]) * CharCount)), " %g", CallerId);\r
+      CharCount += AsciiSPrint (&Buffer[CharCount - 1], (sizeof (Buffer) - (sizeof(Buffer[0]) * CharCount)), " %g", CallerId);\r
     }\r
     if (Data) {\r
-      CharCount += AsciiSPrint (&Buffer[CharCount - 1], (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof(Buffer[0]) * CharCount)), " %x", Data);\r
+      CharCount += AsciiSPrint (&Buffer[CharCount - 1], (sizeof (Buffer) - (sizeof(Buffer[0]) * CharCount)), " %x", Data);\r
     }\r
-    CharCount += AsciiSPrint (&Buffer[CharCount - 1], (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof(Buffer[0]) * CharCount)), "\n");\r
+    CharCount += AsciiSPrint (&Buffer[CharCount - 1], (sizeof (Buffer) - (sizeof(Buffer[0]) * CharCount)), "\n");\r
 \r
   }\r
 \r
@@ -805,7 +788,7 @@ Returns:
         //\r
         AsciiSPrint (\r
           Buffer,\r
-          EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+          sizeof (Buffer),\r
           "%a:%a:%a:%d\n",\r
           SeverityToken,\r
           SubClassToken,\r
@@ -867,19 +850,19 @@ Returns:
   // Set communications format\r
   //\r
   OutputData = (UINT8)((DLAB << 7) | ((gBreakSet << 6) | ((gParity << 3) | ((gStop << 2) | Data))));\r
-  CpuIoWrite8 (gComBase + LCR_OFFSET, OutputData);\r
+  IoWrite8 (gComBase + LCR_OFFSET, OutputData);\r
 \r
   //\r
   // Configure baud rate\r
   //\r
-  CpuIoWrite8 (gComBase + BAUD_HIGH_OFFSET, (UINT8)(Divisor >> 8));\r
-  CpuIoWrite8 (gComBase + BAUD_LOW_OFFSET, (UINT8)(Divisor & 0xff));\r
+  IoWrite8 (gComBase + BAUD_HIGH_OFFSET, (UINT8)(Divisor >> 8));\r
+  IoWrite8 (gComBase + BAUD_LOW_OFFSET, (UINT8)(Divisor & 0xff));\r
 \r
   //\r
   // Switch back to bank 0\r
   //\r
   OutputData = (UINT8)((~DLAB<<7)|((gBreakSet<<6)|((gParity<<3)|((gStop<<2)| Data))));\r
-  CpuIoWrite8 (gComBase + LCR_OFFSET, OutputData);\r
+  IoWrite8 (gComBase + LCR_OFFSET, OutputData);\r
 \r
   *ReportStatusCode = SerialReportStatusCode;\r
 }\r