From 6fc74eaa6393ef107619ee19e2939cde6a8ee205 Mon Sep 17 00:00:00 2001 From: jljusten Date: Sat, 16 Oct 2010 18:51:09 +0000 Subject: DuetPkg: Send EfiLdr messages to serial port git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10949 6f19259b-4bc3-4df7-8a09-765794883524 --- DuetPkg/DuetPkgIa32.dsc | 2 +- DuetPkg/DuetPkgX64.dsc | 2 +- DuetPkg/EfiLdr/Debug.c | 59 ++++++++++++++++++++++++++++++++++++++++------- DuetPkg/EfiLdr/EfiLdr.inf | 1 + 4 files changed, 54 insertions(+), 10 deletions(-) (limited to 'DuetPkg') diff --git a/DuetPkg/DuetPkgIa32.dsc b/DuetPkg/DuetPkgIa32.dsc index b0677e3de..fa411b5b9 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 a83d705b6..007978253 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 0f554b01e..d0049218d 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 829320528..ea3977d88 100644 --- a/DuetPkg/EfiLdr/EfiLdr.inf +++ b/DuetPkg/EfiLdr/EfiLdr.inf @@ -33,6 +33,7 @@ BaseLib BaseMemoryLib PrintLib + SerialPortLib [Sources] Debug.h -- cgit v1.2.3