]> git.proxmox.com Git - mirror_edk2.git/commitdiff
DuetPkg: Send EfiLdr messages to serial port
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 16 Oct 2010 18:51:09 +0000 (18:51 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 16 Oct 2010 18:51:09 +0000 (18:51 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10949 6f19259b-4bc3-4df7-8a09-765794883524

DuetPkg/DuetPkgIa32.dsc
DuetPkg/DuetPkgX64.dsc
DuetPkg/EfiLdr/Debug.c
DuetPkg/EfiLdr/EfiLdr.inf

index b0677e3deb7350db42d30c60846ea869874400a9..fa411b5b9d4750eea5566be38dfebfecea8c1be1 100644 (file)
@@ -98,6 +98,7 @@
   MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf\r
   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf\r
   ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf\r
+  SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf\r
   \r
   #\r
   # To save size, use NULL library for DebugLib and ReportStatusCodeLib.\r
     <LibraryClasses>\r
       DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
       ReportStatusCodeLib|DuetPkg/Library/DxeCoreReportStatusCodeLibFromHob/DxeCoreReportStatusCodeLibFromHob.inf\r
-      SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf\r
   }\r
 \r
   MdeModulePkg/Universal/PCD/Dxe/Pcd.inf\r
index a83d705b6024f114a04cb046c5ed982e4083d5f2..0079782532d65a14c3409942da7634620c5720fc 100644 (file)
@@ -98,6 +98,7 @@
   MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf\r
   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf\r
   ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf\r
+  SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf\r
   \r
   #\r
   # To save size, use NULL library for DebugLib and ReportStatusCodeLib.\r
     <LibraryClasses>\r
       DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
       ReportStatusCodeLib|DuetPkg/Library/DxeCoreReportStatusCodeLibFromHob/DxeCoreReportStatusCodeLibFromHob.inf\r
-      SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf\r
   }\r
 \r
   MdeModulePkg/Universal/PCD/Dxe/Pcd.inf\r
index 0f554b01ed2c97d05e9517433335ee5ea80da758..d0049218dc80964ab470658fbc180c0e5f3c335b 100644 (file)
@@ -19,6 +19,7 @@ Revision History:
 --*/\r
 #include "EfiLdr.h"\r
 #include "Debug.h"\r
+#include <Library/SerialPortLib.h>\r
 \r
 UINT8 *mCursor;\r
 UINT8 mHeaderIndex = 10;\r
@@ -47,31 +48,68 @@ ClearScreen (
   mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);\r
 }\r
 \r
-VOID\r
-PrintValue64 (\r
-  UINT64 Value\r
+\r
+VOID \r
+PrintU32Base10 (\r
+  UINT32 Value\r
   )\r
 {\r
-  PrintValue ((UINT32) RShiftU64 (Value, 32));\r
-  PrintValue ((UINT32) Value);\r
+  UINT32 Index;\r
+  CHAR8  Char;\r
+  CHAR8  String[11];\r
+  UINTN  StringPos;\r
+  UINT32 B10Div;\r
+\r
+  B10Div = 1000000000;\r
+  for (Index = 0, StringPos = 0; Index < 10; Index++) {\r
+    Char = ((Value / B10Div) % 10) + '0';\r
+    if ((StringPos > 0) || (Char != '0')) {\r
+      String[StringPos] = Char;\r
+      StringPos++;\r
+    }\r
+    B10Div = B10Div / 10;\r
+  }\r
+\r
+  if (StringPos == 0) {\r
+      String[0] = '0';\r
+      StringPos++;\r
+  }\r
+\r
+  String[StringPos] = '\0';\r
+\r
+  PrintString (String);\r
 }\r
 \r
+\r
 VOID\r
 PrintValue (\r
   UINT32 Value\r
   )\r
 {\r
   UINT32 Index;\r
-  UINT8  Char;\r
+  CHAR8  Char;\r
+  CHAR8  String[9];\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
+    String[Index] = Char;\r
   }\r
+\r
+  String[sizeof (String) - 1] = '\0';\r
+\r
+  PrintString (String);\r
+}\r
+\r
+VOID\r
+PrintValue64 (\r
+  UINT64 Value\r
+  )\r
+{\r
+  PrintValue ((UINT32) RShiftU64 (Value, 32));\r
+  PrintValue ((UINT32) Value);\r
 }\r
 \r
 VOID\r
@@ -89,5 +127,10 @@ PrintString (
       mCursor += 2;\r
     }\r
   }\r
+\r
+  //\r
+  // All information also output to serial port.\r
+  //\r
+  SerialPortWrite ((UINT8*) String, Index);\r
 }\r
 \r
index 829320528a2e7a37f97423be07b201afbd59fd76..ea3977d8882bd38dabf139151b5e16b2362300a3 100644 (file)
@@ -33,6 +33,7 @@
   BaseLib\r
   BaseMemoryLib\r
   PrintLib\r
+  SerialPortLib\r
 \r
 [Sources]\r
   Debug.h\r