1. Update the CRC32 in the EFI System Table header in BdsConsole.c

2. Removed duplicated installation for Simple Text Output protocol on ErrHandle.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8031 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2009-04-07 08:42:15 +00:00
parent 7ef76906ac
commit 406ddad31b
3 changed files with 46 additions and 30 deletions

View File

@ -60,8 +60,12 @@ IsNvNeed (
On OUT, new console hanlde in system table. On OUT, new console hanlde in system table.
@param ProtocolInterface On IN, console protocol on console handle in System Table to be checked. @param ProtocolInterface On IN, console protocol on console handle in System Table to be checked.
On OUT, new console protocol on new console hanlde in system table. On OUT, new console protocol on new console hanlde in system table.
@retval TRUE System Table has been updated.
@retval FALSE System Table hasn't been updated.
**/ **/
VOID BOOLEAN
UpdateSystemTableConsole ( UpdateSystemTableConsole (
IN CHAR16 *VarName, IN CHAR16 *VarName,
IN EFI_GUID *ConsoleGuid, IN EFI_GUID *ConsoleGuid,
@ -93,7 +97,7 @@ UpdateSystemTableConsole (
// If ConsoleHandle is valid and console protocol on this handle also // If ConsoleHandle is valid and console protocol on this handle also
// also matched, just return. // also matched, just return.
// //
return; return FALSE;
} }
} }
@ -109,7 +113,7 @@ UpdateSystemTableConsole (
// //
// If there is no any console device, just return. // If there is no any console device, just return.
// //
return ; return FALSE;
} }
FullDevicePath = VarConsole; FullDevicePath = VarConsole;
@ -147,7 +151,7 @@ UpdateSystemTableConsole (
// //
*ConsoleHandle = NewHandle; *ConsoleHandle = NewHandle;
*ProtocolInterface = Interface; *ProtocolInterface = Interface;
return ; return TRUE;
} }
} }
@ -156,7 +160,7 @@ UpdateSystemTableConsole (
// //
// No any available console devcie found. // No any available console devcie found.
// //
ASSERT (FALSE); return FALSE;
} }
/** /**
@ -485,6 +489,7 @@ BdsLibConnectAllDefaultConsoles (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
BOOLEAN SystemTableUpdated;
// //
// Connect all default console variables // Connect all default console variables
@ -517,12 +522,31 @@ BdsLibConnectAllDefaultConsoles (
// //
BdsLibConnectConsoleVariable (L"ErrOut"); BdsLibConnectConsoleVariable (L"ErrOut");
SystemTableUpdated = FALSE;
// //
// Fill console handles in System Table if no console device assignd. // Fill console handles in System Table if no console device assignd.
// //
UpdateSystemTableConsole (L"ConIn", &gEfiSimpleTextInProtocolGuid, &gST->ConsoleInHandle, (VOID **) &gST->ConIn); if (UpdateSystemTableConsole (L"ConIn", &gEfiSimpleTextInProtocolGuid, &gST->ConsoleInHandle, (VOID **) &gST->ConIn)) {
UpdateSystemTableConsole (L"ConOut", &gEfiSimpleTextOutProtocolGuid, &gST->ConsoleOutHandle, (VOID **) &gST->ConOut); SystemTableUpdated = TRUE;
UpdateSystemTableConsole (L"ErrOut", &gEfiSimpleTextOutProtocolGuid, &gST->StandardErrorHandle, (VOID **) &gST->StdErr); }
if (UpdateSystemTableConsole (L"ConOut", &gEfiSimpleTextOutProtocolGuid, &gST->ConsoleOutHandle, (VOID **) &gST->ConOut)) {
SystemTableUpdated = TRUE;
}
if (UpdateSystemTableConsole (L"ErrOut", &gEfiSimpleTextOutProtocolGuid, &gST->StandardErrorHandle, (VOID **) &gST->StdErr)) {
SystemTableUpdated = TRUE;
}
if (SystemTableUpdated) {
//
// Update the CRC32 in the EFI System Table header
//
gST->Hdr.CRC32 = 0;
gBS->CalculateCrc32 (
(UINT8 *) &gST->Hdr,
gST->Hdr.HeaderSize,
&gST->Hdr.CRC32
);
}
return EFI_SUCCESS; return EFI_SUCCESS;

View File

@ -1317,18 +1317,9 @@ ConSplitterStdErrDriverBindingStart (
if (mStdErr.CurrentNumberOfConsoles == 0) { if (mStdErr.CurrentNumberOfConsoles == 0) {
// //
// Create virtual device handle for StdErr Splitter // Construct console output devices' private data
// //
Status = ConSplitterTextOutConstructor (&mStdErr); Status = ConSplitterTextOutConstructor (&mStdErr);
if (!EFI_ERROR (Status)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&mStdErr.VirtualHandle,
&gEfiSimpleTextOutProtocolGuid,
&mStdErr.TextOut,
NULL
);
}
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -1370,14 +1361,14 @@ ConSplitterStdErrDriverBindingStart (
// //
// Create virtual device handle for StdErr Splitter // Create virtual device handle for StdErr Splitter
// //
Status = ConSplitterTextOutConstructor (&mStdErr); Status = gBS->InstallMultipleProtocolInterfaces (
if (!EFI_ERROR (Status)) { &mStdErr.VirtualHandle,
Status = gBS->InstallMultipleProtocolInterfaces ( &gEfiSimpleTextOutProtocolGuid,
&mStdErr.VirtualHandle, &mStdErr.TextOut,
&gEfiSimpleTextOutProtocolGuid, NULL
&mStdErr.TextOut, );
NULL if (EFI_ERROR (Status)) {
); return Status;
} }
gST->StandardErrorHandle = mStdErr.VirtualHandle; gST->StandardErrorHandle = mStdErr.VirtualHandle;
@ -1779,8 +1770,8 @@ ConSplitterStdErrDriverBindingStop (
**/ **/
EFI_STATUS EFI_STATUS
ConSplitterGrowBuffer ( ConSplitterGrowBuffer (
IN UINTN SizeOfCount, IN UINTN SizeOfCount,
IN UINTN *Count, IN OUT UINTN *Count,
IN OUT VOID **Buffer IN OUT VOID **Buffer
) )
{ {
@ -2968,6 +2959,7 @@ ConSplitterTextOutAddDevice (
// If the Text Out List is full, enlarge it by calling ConSplitterGrowBuffer(). // If the Text Out List is full, enlarge it by calling ConSplitterGrowBuffer().
// //
while (CurrentNumOfConsoles >= Private->TextOutListCount) { while (CurrentNumOfConsoles >= Private->TextOutListCount) {
CpuBreakpoint ();
Status = ConSplitterGrowBuffer ( Status = ConSplitterGrowBuffer (
sizeof (TEXT_OUT_AND_GOP_DATA), sizeof (TEXT_OUT_AND_GOP_DATA),
&Private->TextOutListCount, &Private->TextOutListCount,

View File

@ -1749,8 +1749,8 @@ ConSplitterTextOutEnableCursor (
**/ **/
EFI_STATUS EFI_STATUS
ConSplitterGrowBuffer ( ConSplitterGrowBuffer (
IN UINTN SizeOfCount, IN UINTN SizeOfCount,
IN UINTN *Count, IN OUT UINTN *Count,
IN OUT VOID **Buffer IN OUT VOID **Buffer
); );