summaryrefslogtreecommitdiff
path: root/DuetPkg/DxeIpl
diff options
context:
space:
mode:
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-23 08:31:18 +0000
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-23 08:31:18 +0000
commitb68b78e66cc7acdce3fdd571a6db71a9731117b1 (patch)
tree3503126e864baece1017dfef12b1e823818b78aa /DuetPkg/DxeIpl
parentf6bd06633df2811cbc8ae8f3c96e047164c41849 (diff)
downloadedk2-platforms-b68b78e66cc7acdce3fdd571a6db71a9731117b1.tar.xz
Change DUET DxeIpl to use SerialPort instead of manipulating serial port directly.
Signed-off-by: niruiyu Reviewed-by: jyao1 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11876 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'DuetPkg/DxeIpl')
-rw-r--r--DuetPkg/DxeIpl/Debug.c59
-rw-r--r--DuetPkg/DxeIpl/Debug.h15
-rw-r--r--DuetPkg/DxeIpl/DxeInit.c209
-rw-r--r--DuetPkg/DxeIpl/DxeIpl.inf11
-rw-r--r--DuetPkg/DxeIpl/PpisNeededByDxeCore.c21
-rw-r--r--DuetPkg/DxeIpl/SerialStatusCode.c130
-rw-r--r--DuetPkg/DxeIpl/SerialStatusCode.h46
7 files changed, 97 insertions, 394 deletions
diff --git a/DuetPkg/DxeIpl/Debug.c b/DuetPkg/DxeIpl/Debug.c
index 3462815640..950c06b118 100644
--- a/DuetPkg/DxeIpl/Debug.c
+++ b/DuetPkg/DxeIpl/Debug.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -19,6 +19,7 @@ Revision History:
**/
#include "DxeIpl.h"
+#include <Library/SerialPortLib.h>
#include "SerialStatusCode.h"
#include "Debug.h"
@@ -51,57 +52,31 @@ ClearScreen (
}
VOID
-PrintValue (
- UINT32 Value
- )
-{
- UINT32 Index;
- 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');
- }
- String[Index] = Char;
- }
-
- String[sizeof (String) - 1] = '\0';
-
- PrintString (String);
-}
-
-VOID
-PrintValue64 (
- UINT64 Value
- )
-{
- PrintValue ((UINT32) RShiftU64 (Value, 32));
- PrintValue ((UINT32) Value);
-}
-
-
-
-VOID
PrintString (
- CHAR8 *String
+ IN CONST CHAR8 *FormatString,
+ ...
)
{
- UINT32 Index;
+ UINTN Index;
+ CHAR8 PrintBuffer[1000];
+ VA_LIST Marker;
- for (Index = 0; String[Index] != 0; Index++) {
- if (String[Index] == '\n') {
- mCursor = (UINT8 *)(UINTN)(0xb8000 + (((((UINTN)mCursor - 0xb8000) + 160) / 160) * 160));
+ VA_START (Marker, FormatString);
+ AsciiVSPrint (PrintBuffer, sizeof (PrintBuffer), FormatString, Marker);
+ VA_END (Marker);
+
+ for (Index = 0; PrintBuffer[Index] != 0; Index++) {
+ if (PrintBuffer[Index] == '\n') {
+ mCursor = (UINT8 *) (UINTN) (0xb8000 + (((((UINTN)mCursor - 0xb8000) + 160) / 160) * 160));
} else {
- *mCursor = String[Index];
+ *mCursor = (UINT8) PrintBuffer[Index];
mCursor += 2;
}
}
-
+
//
// All information also output to serial port.
//
- DebugSerialPrint ((CHAR8*)String);
+ SerialPortWrite (PrintBuffer, Index);
}
diff --git a/DuetPkg/DxeIpl/Debug.h b/DuetPkg/DxeIpl/Debug.h
index ec3997b9fd..7fcad268ee 100644
--- a/DuetPkg/DxeIpl/Debug.h
+++ b/DuetPkg/DxeIpl/Debug.h
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -26,19 +26,10 @@ PrintHeader (
CHAR8 Char
);
-VOID
-PrintValue (
- UINT32 Value
- );
-
VOID
-PrintValue64 (
- UINT64 Value
- );
-
-VOID
PrintString (
- CHAR8 *String
+ IN CONST CHAR8 *FormatString,
+ ...
);
VOID
diff --git a/DuetPkg/DxeIpl/DxeInit.c b/DuetPkg/DxeIpl/DxeInit.c
index b10e273f0c..223cbcd49e 100644
--- a/DuetPkg/DxeIpl/DxeInit.c
+++ b/DuetPkg/DxeIpl/DxeInit.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -137,55 +137,42 @@ Returns:
VOID *MemoryTopOnDescriptor;
VOID *MemoryDescriptor;
VOID *NvStorageBase;
- CHAR8 PrintBuffer[256];
EFILDRHANDOFF HandoffCopy;
CopyMem ((VOID*) &HandoffCopy, (VOID*) Handoff, sizeof (EFILDRHANDOFF));
Handoff = &HandoffCopy;
ClearScreen();
- PrintString("Enter DxeIpl ...\n");
-
-/*
- ClearScreen();
- PrintString("handoff:\n");
- PrintString("Handoff.BfvBase = ");
- PrintValue64((UINT64)(UINTN)Handoff->BfvBase);
- PrintString(", ");
- PrintString("BfvLength = ");
- PrintValue64(Handoff->BfvSize);
- PrintString("\n");
- PrintString("Handoff.DxeIplImageBase = ");
- PrintValue64((UINT64)(UINTN)Handoff->DxeIplImageBase);
- PrintString(", ");
- PrintString("DxeIplImageSize = ");
- PrintValue64(Handoff->DxeIplImageSize);
- PrintString("\n");
- PrintString("Handoff.DxeCoreImageBase = ");
- PrintValue64((UINT64)(UINTN)Handoff->DxeCoreImageBase);
- PrintString(", ");
- PrintString("DxeCoreImageSize = ");
- PrintValue64(Handoff->DxeCoreImageSize);
- PrintString("\n");
-*/
+
+ PrintString (
+ "Enter DxeIpl ...\n"
+ "Handoff:\n"
+ "Handoff.BfvBase = %p, BfvLength = %x\n"
+ "Handoff.DxeIplImageBase = %p, DxeIplImageSize = %x\n"
+ "Handoff.DxeCoreImageBase = %p, DxeCoreImageSize = %x\n",
+ Handoff->BfvBase, Handoff->BfvSize,
+ Handoff->DxeIplImageBase, Handoff->DxeIplImageSize,
+ Handoff->DxeCoreImageBase, Handoff->DxeCoreImageSize
+ );
+
//
// Hob Generation Guild line:
// * Don't report FV as physical memory
// * MemoryAllocation Hob should only cover physical memory
// * Use ResourceDescriptor Hob to report physical memory or Firmware Device and they shouldn't be overlapped
- PrintString("Prepare Cpu HOB information ...\n");
+ PrintString ("Prepare Cpu HOB information ...\n");
PrepareHobCpu ();
//
// 1. BFV
//
- PrintString("Prepare BFV HOB information ...\n");
+ PrintString ("Prepare BFV HOB information ...\n");
PrepareHobBfv (Handoff->BfvBase, Handoff->BfvSize);
//
// 2. Updates Memory information, and get the top free address under 4GB
//
- PrintString("Prepare Memory HOB information ...\n");
+ PrintString ("Prepare Memory HOB information ...\n");
MemoryTopOnDescriptor = PrepareHobMemory (Handoff->MemDescCount, Handoff->MemDesc);
//
@@ -193,17 +180,13 @@ Returns:
//
// 3.1 NV data
- PrintString("Prepare NV Storage information ...\n");
+ PrintString ("Prepare NV Storage information ...\n");
NvStorageBase = PrepareHobNvStorage (MemoryTopOnDescriptor);
- AsciiSPrint (PrintBuffer, 256, "NV Storage Base=0x%x\n", (UINTN)NvStorageBase);
- PrintString (PrintBuffer);
-
+ PrintString ("NV Storage Base = %p\n", NvStorageBase);
// 3.2 Stack
StackTop = NvStorageBase;
StackBottom = PrepareHobStack (StackTop);
- AsciiSPrint (PrintBuffer, 256, "Stack Top=0x%x, Stack Bottom=0x%x\n",
- (UINTN)StackTop, (UINTN)StackBottom);
- PrintString (PrintBuffer);
+ PrintString ("Stack Top=0x%x, Stack Bottom=0x%x\n", StackTop, StackBottom);
// 3.3 Page Table
PageTableBase = PreparePageTable (StackBottom, gHob->Cpu.SizeOfMemorySpace);
// 3.4 MemDesc (will be used in PlatformBds)
@@ -214,7 +197,7 @@ Returns:
//
// 4. Register the memory occupied by DxeCore and DxeIpl together as DxeCore
//
- PrintString("Prepare DxeCore memory Hob ...\n");
+ PrintString ("Prepare DxeCore memory Hob ...\n");
PrepareHobDxeCore (
Handoff->DxeCoreEntryPoint,
(EFI_PHYSICAL_ADDRESS)(UINTN)Handoff->DxeCoreImageBase,
@@ -227,125 +210,57 @@ Returns:
CompleteHobGeneration ();
- AsciiSPrint (PrintBuffer, 256, "HobStart=0x%x\n", (UINTN)gHob);
- PrintString (PrintBuffer);
-
- AsciiSPrint (PrintBuffer, 256, "Memory Top=0x%x, Bottom=0x%x\n",
- (UINTN)gHob->Phit.EfiMemoryTop, (UINTN)gHob->Phit.EfiMemoryBottom);
- PrintString (PrintBuffer);
-
- AsciiSPrint (PrintBuffer, 256, "Free Memory Top=0x%x, Bottom=0x%x\n",
- (UINTN)gHob->Phit.EfiFreeMemoryTop, (UINTN)gHob->Phit.EfiFreeMemoryBottom);
- PrintString (PrintBuffer);
-
- AsciiSPrint (PrintBuffer, 256, "Nv Base=0x%x, Length=0x%x\n",
- (UINTN)gHob->NvStorageFvb.FvbInfo.Entries[0].Base,
- (UINTN)gHob->NvFtwFvb.FvbInfo.Entries[0].Length);
- PrintString (PrintBuffer);
-/*
//
// Print Hob Info
//
ClearScreen();
- PrintString("Hob Info\n");
- PrintString("Phit.EfiMemoryTop = ");
- PrintValue64(gHob->Phit.EfiMemoryTop);
- PrintString(" Phit.EfiMemoryBottom = ");
- PrintValue64(gHob->Phit.EfiMemoryBottom);
- PrintString("\n");
- PrintString("Phit.EfiFreeMemoryTop = ");
- PrintValue64(gHob->Phit.EfiFreeMemoryTop);
- PrintString(" Phit.EfiFreeMemoryBottom = ");
- PrintValue64(gHob->Phit.EfiFreeMemoryBottom);
- PrintString("\n");
- PrintString("Bfv = ");
- PrintValue64(gHob->Bfv.BaseAddress);
- PrintString(" BfvLength = ");
- PrintValue64(gHob->Bfv.Length);
- PrintString("\n");
- PrintString("NvStorageFvb = ");
- PrintValue64(gHob->NvStorageFvb.FvbInfo.Entries[0].Base);
- PrintString(" Length = ");
- PrintValue64(gHob->NvStorageFvb.FvbInfo.Entries[0].Length);
- PrintString("\n");
- PrintString("NvFtwFvb = ");
- PrintValue64(gHob->NvFtwFvb.FvbInfo.Entries[0].Base);
- PrintString(" Length = ");
- PrintValue64(gHob->NvFtwFvb.FvbInfo.Entries[0].Length);
- PrintString("\n");
- PrintString("BfvResource = ");
- PrintValue64(gHob->BfvResource.PhysicalStart);
- PrintString(" Length = ");
- PrintValue64(gHob->BfvResource.ResourceLength);
- PrintString("\n");
- PrintString("NvStorageFvResource = ");
- PrintValue64(gHob->NvStorageFvResource.PhysicalStart);
- PrintString(" Length = ");
- PrintValue64(gHob->NvStorageFvResource.ResourceLength);
- PrintString("\n");
- PrintString("NvStorage = ");
- PrintValue64(gHob->NvStorage.FvbInfo.Entries[0].Base);
- PrintString(" Length = ");
- PrintValue64(gHob->NvStorage.FvbInfo.Entries[0].Length);
- PrintString("\n");
- PrintString("NvFtwFvResource = ");
- PrintValue64(gHob->NvFtwFvResource.PhysicalStart);
- PrintString(" Length = ");
- PrintValue64(gHob->NvFtwFvResource.ResourceLength);
- PrintString("\n");
- PrintString("NvFtwWorking = ");
- PrintValue64(gHob->NvFtwWorking.FvbInfo.Entries[0].Base);
- PrintString(" Length = ");
- PrintValue64(gHob->NvFtwWorking.FvbInfo.Entries[0].Length);
- PrintString("\n");
- PrintString("NvFtwSpare = ");
- PrintValue64(gHob->NvFtwSpare.FvbInfo.Entries[0].Base);
- PrintString(" Length = ");
- PrintValue64(gHob->NvFtwSpare.FvbInfo.Entries[0].Length);
- PrintString("\n");
- PrintString("Stack = ");
- PrintValue64(gHob->Stack.AllocDescriptor.MemoryBaseAddress);
- PrintString(" StackLength = ");
- PrintValue64(gHob->Stack.AllocDescriptor.MemoryLength);
- PrintString("\n");
- PrintString("PageTable = ");
- PrintValue64((UINTN)PageTableBase);
- PrintString("\n");
- PrintString("MemoryFreeUnder1MB = ");
- PrintValue64(gHob->MemoryFreeUnder1MB.PhysicalStart);
- PrintString(" MemoryFreeUnder1MBLength = ");
- PrintValue64(gHob->MemoryFreeUnder1MB.ResourceLength);
- PrintString("\n");
- PrintString("MemoryAbove1MB = ");
- PrintValue64(gHob->MemoryAbove1MB.PhysicalStart);
- PrintString(" MemoryAbove1MBLength = ");
- PrintValue64(gHob->MemoryAbove1MB.ResourceLength);
- PrintString("\n");
- PrintString("MemoryAbove4GB = ");
- PrintValue64(gHob->MemoryAbove4GB.PhysicalStart);
- PrintString(" MemoryAbove4GBLength = ");
- PrintValue64(gHob->MemoryAbove4GB.ResourceLength);
- PrintString("\n");
- PrintString("DxeCore = ");
- PrintValue64(gHob->DxeCore.MemoryAllocationHeader.MemoryBaseAddress);
- PrintString(" DxeCoreLength = ");
- PrintValue64(gHob->DxeCore.MemoryAllocationHeader.MemoryLength);
- PrintString("\n");
- PrintString("MemoryAllocation = ");
- PrintValue64(gHob->MemoryAllocation.AllocDescriptor.MemoryBaseAddress);
- PrintString(" MemoryLength = ");
- PrintValue64(gHob->MemoryAllocation.AllocDescriptor.MemoryLength);
- PrintString("\n");
- EFI_DEADLOOP();
-*/
+ PrintString (
+ "HobStart = %p\n"
+ "Memory Top = %lx, Bottom = %lx\n"
+ "Free Memory Top = %lx, Bottom = %lx\n"
+ "NvStorageFvb = %p, Length = %x\n"
+ "BfvResource = %lx, Length = %lx\n"
+ "NvStorageFvResource = %lx, Length = %lx\n"
+ "NvStorage = %lx, Length = %lx\n"
+ "NvFtwFvResource = %lx, Length = %lx\n"
+ "NvFtwWorking = %lx, Length = %lx\n"
+ "NvFtwSpare = %lx, Length = %lx\n"
+ "Stack = %lx, StackLength = %lx\n"
+ "PageTable = %p\n"
+ "MemoryFreeUnder1MB = %lx, MemoryFreeUnder1MBLength = %lx\n"
+ "MemoryAbove1MB = %lx, MemoryAbove1MBLength = %lx\n"
+ "MemoryAbove4GB = %lx, MemoryAbove4GBLength = %lx\n"
+ "DxeCore = %lx, DxeCoreLength = %lx\n"
+ "MemoryAllocation = %lx, MemoryLength = %lx\n"
+ "$",
+ gHob,
+ gHob->Phit.EfiMemoryTop, gHob->Phit.EfiMemoryBottom,
+ gHob->Phit.EfiFreeMemoryTop, gHob->Phit.EfiFreeMemoryBottom,
+ gHob->NvStorageFvb.FvbInfo.Entries[0].Base, (UINTN) gHob->NvFtwFvb.FvbInfo.Entries[0].Length,
+ gHob->BfvResource.PhysicalStart, gHob->BfvResource.ResourceLength,
+ gHob->NvStorageFvResource.PhysicalStart, gHob->NvStorageFvResource.ResourceLength,
+ gHob->NvStorage.FvbInfo.Entries[0].Base, gHob->NvStorage.FvbInfo.Entries[0].Length,
+ gHob->NvFtwFvResource.PhysicalStart, gHob->NvFtwFvResource.ResourceLength,
+ gHob->NvFtwWorking.FvbInfo.Entries[0].Base, gHob->NvFtwWorking.FvbInfo.Entries[0].Length,
+ gHob->NvFtwSpare.FvbInfo.Entries[0].Base, gHob->NvFtwSpare.FvbInfo.Entries[0].Length,
+ gHob->Stack.AllocDescriptor.MemoryBaseAddress, gHob->Stack.AllocDescriptor.MemoryLength,
+ PageTableBase,
+ gHob->MemoryFreeUnder1MB.PhysicalStart, gHob->MemoryFreeUnder1MB.ResourceLength,
+ gHob->MemoryAbove1MB.PhysicalStart, gHob->MemoryAbove1MB.ResourceLength,
+ gHob->MemoryAbove4GB.PhysicalStart, gHob->MemoryAbove4GB.ResourceLength,
+ gHob->DxeCore.MemoryAllocationHeader.MemoryBaseAddress, gHob->DxeCore.MemoryAllocationHeader.MemoryLength,
+ gHob->MemoryAllocation.AllocDescriptor.MemoryBaseAddress, gHob->MemoryAllocation.AllocDescriptor.MemoryLength
+ );
ClearScreen();
- PrintString("\n\n\n\n\n\n\n\n\n\n");
- PrintString(" WELCOME TO EFI WORLD!\n");
+ PrintString (
+ "\n\n\n\n\n\n\n\n\n\n"
+ " WELCOME TO EFI WORLD!\n"
+ );
EnterDxeMain (StackTop, Handoff->DxeCoreEntryPoint, gHob, PageTableBase);
+ PrintString ("Fail to enter DXE main!\n");
- PrintString("Fail to enter DXE main!\n");
//
// Should never get here
//
diff --git a/DuetPkg/DxeIpl/DxeIpl.inf b/DuetPkg/DxeIpl/DxeIpl.inf
index 71a04f7e83..6c00084513 100644
--- a/DuetPkg/DxeIpl/DxeIpl.inf
+++ b/DuetPkg/DxeIpl/DxeIpl.inf
@@ -1,6 +1,6 @@
## @file
#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -33,6 +33,7 @@
BaseLib
BaseMemoryLib
PrintLib
+ SerialPortLib
ReportStatusCodeLib
IoLib
@@ -63,13 +64,5 @@
Ia32/Paging.c
Ia32/VirtualMemory.h
-#[BuildOptions]
- #MSFT:*_*_IA32_DLINK_FLAGS = /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib
- #MSFT:*_*_IA32_CC_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /Od /FI$(DEST_DIR_DEBUG)/AutoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE
- #MSFT:*_*_IA32_PP_FLAGS = /nologo /E /TC /FI$(DEST_DIR_DEBUG)/AutoGen.h
- #MSFT:*_*_IA32_ASM_FLAGS = /nologo /W3 /WX /c /coff /Cx /Zd /W0 /Zi
- #MSFT:*_*_IA32_ASMLINK_FLAGS = /link /nologo /tiny
- #GCC:*_UNIXGCC_IA32_CC_FLAGS = -O2 -falign-functions -falign-jumps -falign-loops -freorder-blocks -freorder-blocks-and-partition -falign-labels -fshort-wchar -fno-strict-aliasing -Wall -Wno-missing-braces -c -include AutoGen.h
-
[Depex]
TRUE
diff --git a/DuetPkg/DxeIpl/PpisNeededByDxeCore.c b/DuetPkg/DxeIpl/PpisNeededByDxeCore.c
index 1ece7d8150..e08a148543 100644
--- a/DuetPkg/DxeIpl/PpisNeededByDxeCore.c
+++ b/DuetPkg/DxeIpl/PpisNeededByDxeCore.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -48,27 +48,8 @@ Returns:
--*/
{
- //EFI_PEI_PE_COFF_LOADER_PROTOCOL *PeCoffLoader;
- //EFI_DECOMPRESS_PROTOCOL *EfiDecompress;
- //EFI_TIANO_DECOMPRESS_PROTOCOL *TianoDecompress;
EFI_REPORT_STATUS_CODE ReportStatusCode;
- //InstallEfiPeiFlushInstructionCache (&FlushInstructionCache);
- //Hob->FlushInstructionCache.Interface = FlushInstructionCache;
-
- // R9 do not need this protocol.
- // InstallEfiPeiTransferControl (&TransferControl);
- // Hob->TransferControl.Interface = TransferControl;
-
- //InstallEfiPeiPeCoffLoader (NULL, &PeCoffLoader, NULL);
- //Hob->PeCoffLoader.Interface = PeCoffLoader;
-
- //InstallEfiDecompress (&EfiDecompress);
- //Hob->EfiDecompress.Interface = EfiDecompress;
-
- //InstallTianoDecompress (&TianoDecompress);
- //Hob->TianoDecompress.Interface = TianoDecompress;
-
InstallSerialStatusCode (&ReportStatusCode);
Hob->SerialStatusCode.Interface = (EFI_PHYSICAL_ADDRESS) (UINTN) ReportStatusCode;
diff --git a/DuetPkg/DxeIpl/SerialStatusCode.c b/DuetPkg/DxeIpl/SerialStatusCode.c
index e936db5b59..27e8644b38 100644
--- a/DuetPkg/DxeIpl/SerialStatusCode.c
+++ b/DuetPkg/DxeIpl/SerialStatusCode.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -18,16 +18,9 @@ Revision History:
**/
+#include <Library/SerialPortLib.h>
#include "SerialStatusCode.h"
-
-UINT16 gComBase = 0x3f8;
-UINTN gBps = 115200;
-UINT8 gData = 8;
-UINT8 gStop = 1;
-UINT8 gParity = 0;
-UINT8 gBreakSet = 0;
-
//
// All of the lookup tables are only needed in debug.
//
@@ -602,68 +595,6 @@ Returns:
}
-
-VOID
-DebugSerialWrite (
- IN UINT8 Character
- )
-/*++
-
-Routine Description:
-
- DebugSerialWrite - Outputs a character to the Serial port
-
- Repeatedly polls the TXRDY bit of the Line Status Register
- until the Transmitter Holding Register is empty. The character
- is then written to the Serial port.
-
-Arguments:
-
- Character - Character to write
-
-Returns:
-
- None
-
---*/
-{
- UINT8 Data;
-
- //
- // Wait for the serail port to be ready.
- //
- do {
- Data = IoRead8 (gComBase + LSR_OFFSET);
- } while ((Data & LSR_TXRDY) == 0);
-
- IoWrite8 (gComBase, Character);
-}
-
-VOID
-DebugSerialPrint (
- IN CHAR8 *OutputString
- )
-/*++
-
-Routine Description:
-
- Prints a string to the Serial port
-
-Arguments:
-
- OutputString - Ascii string to print to serial port.
-
-Returns:
-
- None
-
---*/
-{
- for ( ; *OutputString != 0; OutputString++) {
- DebugSerialWrite (*OutputString);
- }
-}
-
EFI_STATUS
EFIAPI
SerialReportStatusCode (
@@ -697,7 +628,7 @@ Returns:
CHAR8 *Format;
BASE_LIST Marker;
UINT32 ErrorLevel;
- UINTN CharCount;
+ UINTN CharCount = 0;
Buffer[0] = '\0';
@@ -706,7 +637,7 @@ Returns:
//
// Processes PEI_ASSERT ()
//
- AsciiSPrint (
+ CharCount = AsciiSPrint (
Buffer,
sizeof (Buffer),
"\nPEI_ASSERT!: %a (%d): %a\n",
@@ -720,7 +651,7 @@ Returns:
//
// Process PEI_DEBUG () macro to Serial
//
- AsciiBSPrint (Buffer, sizeof (Buffer), Format, Marker);
+ CharCount = AsciiBSPrint (Buffer, sizeof (Buffer), Format, Marker);
} else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
//
@@ -744,7 +675,7 @@ Returns:
//
// Callout to platform Lib function to do print.
//
- DebugSerialPrint (Buffer);
+ SerialPortWrite (Buffer, CharCount);
}
//
@@ -786,7 +717,7 @@ Returns:
//
// Concatenate the instance
//
- AsciiSPrint (
+ CharCount = AsciiSPrint (
Buffer,
sizeof (Buffer),
"%a:%a:%a:%d\n",
@@ -796,7 +727,7 @@ Returns:
Instance
);
- DebugSerialPrint (Buffer);
+ SerialPortWrite (Buffer, CharCount);
}
}
@@ -812,15 +743,11 @@ InstallSerialStatusCode (
Routine Description:
- Initialize Serial Port
-
- The Baud Rate Divisor registers are programmed and the LCR
- is used to configure the communications format. Hard coded
- UART config comes from globals in DebugSerialPlatform lib.
+ Initialize Serial Port and Status Code Handler
Arguments:
- None
+ ReportStatusCode - A pointer to the handler
Returns:
@@ -828,41 +755,6 @@ Returns:
--*/
{
- UINTN Divisor;
- UINT8 OutputData;
- UINT8 Data;
-
- //
- // Some init is done by the platform status code initialization.
- //
-
- //
- // Map 5..8 to 0..3
- //
- Data = (UINT8) (gData - (UINT8)5);
-
- //
- // Calculate divisor for baud generator
- //
- Divisor = 115200 / gBps;
-
- //
- // Set communications format
- //
- OutputData = (UINT8)((DLAB << 7) | ((gBreakSet << 6) | ((gParity << 3) | ((gStop << 2) | Data))));
- IoWrite8 (gComBase + LCR_OFFSET, OutputData);
-
- //
- // Configure baud rate
- //
- IoWrite8 (gComBase + BAUD_HIGH_OFFSET, (UINT8)(Divisor >> 8));
- IoWrite8 (gComBase + BAUD_LOW_OFFSET, (UINT8)(Divisor & 0xff));
-
- //
- // Switch back to bank 0
- //
- OutputData = (UINT8)((~DLAB<<7)|((gBreakSet<<6)|((gParity<<3)|((gStop<<2)| Data))));
- IoWrite8 (gComBase + LCR_OFFSET, OutputData);
-
+ SerialPortInitialize();
*ReportStatusCode = SerialReportStatusCode;
}
diff --git a/DuetPkg/DxeIpl/SerialStatusCode.h b/DuetPkg/DxeIpl/SerialStatusCode.h
index d4989d1db7..7146927011 100644
--- a/DuetPkg/DxeIpl/SerialStatusCode.h
+++ b/DuetPkg/DxeIpl/SerialStatusCode.h
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -31,50 +31,6 @@ Revision History:
//
-//---------------------------------------------
-// UART Register Offsets
-//---------------------------------------------
-#define BAUD_LOW_OFFSET 0x00
-#define BAUD_HIGH_OFFSET 0x01
-#define IER_OFFSET 0x01
-#define LCR_SHADOW_OFFSET 0x01
-#define FCR_SHADOW_OFFSET 0x02
-#define IR_CONTROL_OFFSET 0x02
-#define FCR_OFFSET 0x02
-#define EIR_OFFSET 0x02
-#define BSR_OFFSET 0x03
-#define LCR_OFFSET 0x03
-#define MCR_OFFSET 0x04
-#define LSR_OFFSET 0x05
-#define MSR_OFFSET 0x06
-
-//---------------------------------------------
-// UART Register Bit Defines
-//---------------------------------------------
-#define LSR_TXRDY 0x20
-#define LSR_RXDA 0x01
-#define DLAB 0x01
-
-//
-// Globals for Serial Port settings
-//
-extern UINT16 gComBase;
-extern UINTN gBps;
-extern UINT8 gData;
-extern UINT8 gStop;
-extern UINT8 gParity;
-extern UINT8 gBreakSet;
-
-VOID
-DebugSerialPrint (
- IN CHAR8 *OutputString
- );
-
-VOID
-DebugSerialWrite (
- IN UINT8 Character
- );
-
VOID
InstallSerialStatusCode (
IN EFI_REPORT_STATUS_CODE *ReportStatusCode