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
This commit is contained in:
jljusten 2010-10-16 18:51:09 +00:00
parent 65e9e35245
commit 6fc74eaa63
4 changed files with 54 additions and 10 deletions

View File

@ -98,6 +98,7 @@
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
# #
# To save size, use NULL library for DebugLib and ReportStatusCodeLib. # To save size, use NULL library for DebugLib and ReportStatusCodeLib.
@ -166,7 +167,6 @@
<LibraryClasses> <LibraryClasses>
DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
ReportStatusCodeLib|DuetPkg/Library/DxeCoreReportStatusCodeLibFromHob/DxeCoreReportStatusCodeLibFromHob.inf ReportStatusCodeLib|DuetPkg/Library/DxeCoreReportStatusCodeLibFromHob/DxeCoreReportStatusCodeLibFromHob.inf
SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
} }
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf MdeModulePkg/Universal/PCD/Dxe/Pcd.inf

View File

@ -98,6 +98,7 @@
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
# #
# To save size, use NULL library for DebugLib and ReportStatusCodeLib. # To save size, use NULL library for DebugLib and ReportStatusCodeLib.
@ -166,7 +167,6 @@
<LibraryClasses> <LibraryClasses>
DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
ReportStatusCodeLib|DuetPkg/Library/DxeCoreReportStatusCodeLibFromHob/DxeCoreReportStatusCodeLibFromHob.inf ReportStatusCodeLib|DuetPkg/Library/DxeCoreReportStatusCodeLibFromHob/DxeCoreReportStatusCodeLibFromHob.inf
SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
} }
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf MdeModulePkg/Universal/PCD/Dxe/Pcd.inf

View File

@ -19,6 +19,7 @@ Revision History:
--*/ --*/
#include "EfiLdr.h" #include "EfiLdr.h"
#include "Debug.h" #include "Debug.h"
#include <Library/SerialPortLib.h>
UINT8 *mCursor; UINT8 *mCursor;
UINT8 mHeaderIndex = 10; UINT8 mHeaderIndex = 10;
@ -47,31 +48,68 @@ ClearScreen (
mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160); mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);
} }
VOID VOID
PrintValue64 ( PrintU32Base10 (
UINT64 Value UINT32 Value
) )
{ {
PrintValue ((UINT32) RShiftU64 (Value, 32)); UINT32 Index;
PrintValue ((UINT32) Value); 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 VOID
PrintValue ( PrintValue (
UINT32 Value UINT32 Value
) )
{ {
UINT32 Index; UINT32 Index;
UINT8 Char; CHAR8 Char;
CHAR8 String[9];
for (Index = 0; Index < 8; Index++) { for (Index = 0; Index < 8; Index++) {
Char = (UINT8)(((Value >> ((7 - Index) * 4)) & 0x0f) + '0'); Char = (UINT8)(((Value >> ((7 - Index) * 4)) & 0x0f) + '0');
if (Char > '9') { if (Char > '9') {
Char = (UINT8) (Char - '0' - 10 + 'A'); Char = (UINT8) (Char - '0' - 10 + 'A');
} }
*mCursor = Char; String[Index] = Char;
mCursor += 2;
} }
String[sizeof (String) - 1] = '\0';
PrintString (String);
}
VOID
PrintValue64 (
UINT64 Value
)
{
PrintValue ((UINT32) RShiftU64 (Value, 32));
PrintValue ((UINT32) Value);
} }
VOID VOID
@ -89,5 +127,10 @@ PrintString (
mCursor += 2; mCursor += 2;
} }
} }
//
// All information also output to serial port.
//
SerialPortWrite ((UINT8*) String, Index);
} }

View File

@ -33,6 +33,7 @@
BaseLib BaseLib
BaseMemoryLib BaseMemoryLib
PrintLib PrintLib
SerialPortLib
[Sources] [Sources]
Debug.h Debug.h