diff --git a/DuetPkg/DuetPkgIa32.dsc b/DuetPkg/DuetPkgIa32.dsc index b0677e3deb..fa411b5b9d 100644 --- a/DuetPkg/DuetPkgIa32.dsc +++ b/DuetPkg/DuetPkgIa32.dsc @@ -98,6 +98,7 @@ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf + SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf # # To save size, use NULL library for DebugLib and ReportStatusCodeLib. @@ -166,7 +167,6 @@ DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf ReportStatusCodeLib|DuetPkg/Library/DxeCoreReportStatusCodeLibFromHob/DxeCoreReportStatusCodeLibFromHob.inf - SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf } MdeModulePkg/Universal/PCD/Dxe/Pcd.inf diff --git a/DuetPkg/DuetPkgX64.dsc b/DuetPkg/DuetPkgX64.dsc index a83d705b60..0079782532 100644 --- a/DuetPkg/DuetPkgX64.dsc +++ b/DuetPkg/DuetPkgX64.dsc @@ -98,6 +98,7 @@ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf + SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf # # To save size, use NULL library for DebugLib and ReportStatusCodeLib. @@ -166,7 +167,6 @@ DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf ReportStatusCodeLib|DuetPkg/Library/DxeCoreReportStatusCodeLibFromHob/DxeCoreReportStatusCodeLibFromHob.inf - SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf } MdeModulePkg/Universal/PCD/Dxe/Pcd.inf diff --git a/DuetPkg/EfiLdr/Debug.c b/DuetPkg/EfiLdr/Debug.c index 0f554b01ed..d0049218dc 100644 --- a/DuetPkg/EfiLdr/Debug.c +++ b/DuetPkg/EfiLdr/Debug.c @@ -19,6 +19,7 @@ Revision History: --*/ #include "EfiLdr.h" #include "Debug.h" +#include UINT8 *mCursor; UINT8 mHeaderIndex = 10; @@ -47,31 +48,68 @@ ClearScreen ( mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160); } -VOID -PrintValue64 ( - UINT64 Value + +VOID +PrintU32Base10 ( + UINT32 Value ) { - PrintValue ((UINT32) RShiftU64 (Value, 32)); - PrintValue ((UINT32) Value); + UINT32 Index; + CHAR8 Char; + CHAR8 String[11]; + UINTN StringPos; + UINT32 B10Div; + + B10Div = 1000000000; + for (Index = 0, StringPos = 0; Index < 10; Index++) { + Char = ((Value / B10Div) % 10) + '0'; + if ((StringPos > 0) || (Char != '0')) { + String[StringPos] = Char; + StringPos++; + } + B10Div = B10Div / 10; + } + + if (StringPos == 0) { + String[0] = '0'; + StringPos++; + } + + String[StringPos] = '\0'; + + PrintString (String); } + VOID PrintValue ( UINT32 Value ) { UINT32 Index; - UINT8 Char; + CHAR8 Char; + CHAR8 String[9]; for (Index = 0; Index < 8; Index++) { Char = (UINT8)(((Value >> ((7 - Index) * 4)) & 0x0f) + '0'); if (Char > '9') { Char = (UINT8) (Char - '0' - 10 + 'A'); } - *mCursor = Char; - mCursor += 2; + String[Index] = Char; } + + String[sizeof (String) - 1] = '\0'; + + PrintString (String); +} + +VOID +PrintValue64 ( + UINT64 Value + ) +{ + PrintValue ((UINT32) RShiftU64 (Value, 32)); + PrintValue ((UINT32) Value); } VOID @@ -89,5 +127,10 @@ PrintString ( mCursor += 2; } } + + // + // All information also output to serial port. + // + SerialPortWrite ((UINT8*) String, Index); } diff --git a/DuetPkg/EfiLdr/EfiLdr.inf b/DuetPkg/EfiLdr/EfiLdr.inf index 829320528a..ea3977d888 100644 --- a/DuetPkg/EfiLdr/EfiLdr.inf +++ b/DuetPkg/EfiLdr/EfiLdr.inf @@ -33,6 +33,7 @@ BaseLib BaseMemoryLib PrintLib + SerialPortLib [Sources] Debug.h