]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/DxeIpl/Debug.c
MdeModulePkg-MemoryProfile(1): Add SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET...
[mirror_edk2.git] / DuetPkg / DxeIpl / Debug.c
index 31b89fc49ef7bdb7103282fccdfd5db9dc25c370..1cb7e39c80361e4b922e0ab200987d64d1aeb485 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
+Copyright (c) 2006 - 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
 http://opensource.org/licenses/bsd-license.php                                            \r
@@ -19,7 +19,9 @@ Revision History:
 **/\r
 \r
 #include "DxeIpl.h"\r
+#include <Library/SerialPortLib.h>\r
 #include "SerialStatusCode.h"\r
+#include "Debug.h"\r
 \r
 UINT8 *mCursor;\r
 UINT8 mHeaderIndex = 10;\r
@@ -49,54 +51,32 @@ ClearScreen (
   mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);\r
 }\r
 \r
-VOID\r
-PrintValue (\r
-  UINT32 Value\r
-  )\r
-{\r
-  UINT32 Index;\r
-  UINT8  Char;\r
-\r
-  for (Index = 0; Index < 8; Index++) {\r
-    Char = (UINT8)(((Value >> ((7 - Index) * 4)) & 0x0f) + '0');\r
-    if (Char > '9') {\r
-      Char = (UINT8) (Char - '0' - 10 + 'A');\r
-    }\r
-    *mCursor = Char;\r
-    mCursor += 2;\r
-  }\r
-}\r
-\r
-VOID\r
-PrintValue64 (\r
-  UINT64 Value\r
-  )\r
-{\r
-  PrintValue ((UINT32) RShiftU64 (Value, 32));\r
-  PrintValue ((UINT32) Value);\r
-}\r
-\r
-\r
-\r
 VOID\r
 PrintString (\r
-  UINT8 *String\r
+  IN CONST CHAR8  *FormatString,\r
+  ...\r
   )\r
 {\r
-  UINT32 Index;\r
+  UINTN           Index;\r
+  CHAR8           PrintBuffer[1000];\r
+  VA_LIST         Marker;\r
 \r
-  for (Index = 0; String[Index] != 0; Index++) {\r
-    if (String[Index] == '\n') {\r
-      mCursor = (UINT8 *)(UINTN)(0xb8000 + (((((UINTN)mCursor - 0xb8000) + 160) / 160) * 160));\r
+  VA_START (Marker, FormatString);\r
+  AsciiVSPrint (PrintBuffer, sizeof (PrintBuffer), FormatString, Marker);\r
+  VA_END (Marker);\r
+\r
+  for (Index = 0; PrintBuffer[Index] != 0; Index++) {\r
+    if (PrintBuffer[Index] == '\n') {\r
+      mCursor = (UINT8 *) (UINTN) (0xb8000 + (((((UINTN)mCursor - 0xb8000) + 160) / 160) * 160));\r
     } else {\r
-      *mCursor = String[Index];\r
+      *mCursor = (UINT8) PrintBuffer[Index];\r
       mCursor += 2;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // All information also output to serial port.\r
   //\r
-  DebugSerialPrint (String);\r
+  SerialPortWrite ((UINT8 *) PrintBuffer, Index);\r
 }\r
 \r