diff options
3 files changed, 46 insertions, 30 deletions
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c index 30a6c3e6ed..6f3addb2f2 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c @@ -60,8 +60,12 @@ IsNvNeed ( On OUT, new console hanlde in system table.
@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.
+
+ @retval TRUE System Table has been updated.
+ @retval FALSE System Table hasn't been updated.
+
**/
-VOID
+BOOLEAN
UpdateSystemTableConsole (
IN CHAR16 *VarName,
IN EFI_GUID *ConsoleGuid,
@@ -93,7 +97,7 @@ UpdateSystemTableConsole ( // If ConsoleHandle is valid and console protocol on this handle also
// also matched, just return.
//
- return;
+ return FALSE;
}
}
@@ -109,7 +113,7 @@ UpdateSystemTableConsole ( //
// If there is no any console device, just return.
//
- return ;
+ return FALSE;
}
FullDevicePath = VarConsole;
@@ -147,7 +151,7 @@ UpdateSystemTableConsole ( //
*ConsoleHandle = NewHandle;
*ProtocolInterface = Interface;
- return ;
+ return TRUE;
}
}
@@ -156,7 +160,7 @@ UpdateSystemTableConsole ( //
// No any available console devcie found.
//
- ASSERT (FALSE);
+ return FALSE;
}
/**
@@ -485,6 +489,7 @@ BdsLibConnectAllDefaultConsoles ( )
{
EFI_STATUS Status;
+ BOOLEAN SystemTableUpdated;
//
// Connect all default console variables
@@ -517,12 +522,31 @@ BdsLibConnectAllDefaultConsoles ( //
BdsLibConnectConsoleVariable (L"ErrOut");
+ SystemTableUpdated = FALSE;
//
// Fill console handles in System Table if no console device assignd.
//
- UpdateSystemTableConsole (L"ConIn", &gEfiSimpleTextInProtocolGuid, &gST->ConsoleInHandle, (VOID **) &gST->ConIn);
- UpdateSystemTableConsole (L"ConOut", &gEfiSimpleTextOutProtocolGuid, &gST->ConsoleOutHandle, (VOID **) &gST->ConOut);
- UpdateSystemTableConsole (L"ErrOut", &gEfiSimpleTextOutProtocolGuid, &gST->StandardErrorHandle, (VOID **) &gST->StdErr);
+ if (UpdateSystemTableConsole (L"ConIn", &gEfiSimpleTextInProtocolGuid, &gST->ConsoleInHandle, (VOID **) &gST->ConIn)) {
+ SystemTableUpdated = TRUE;
+ }
+ 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;
diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c index 3389f62f98..109caf7306 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c @@ -1317,18 +1317,9 @@ ConSplitterStdErrDriverBindingStart ( if (mStdErr.CurrentNumberOfConsoles == 0) {
//
- // Create virtual device handle for StdErr Splitter
+ // Construct console output devices' private data
//
Status = ConSplitterTextOutConstructor (&mStdErr);
- if (!EFI_ERROR (Status)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mStdErr.VirtualHandle,
- &gEfiSimpleTextOutProtocolGuid,
- &mStdErr.TextOut,
- NULL
- );
- }
-
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1370,14 +1361,14 @@ ConSplitterStdErrDriverBindingStart ( //
// Create virtual device handle for StdErr Splitter
//
- Status = ConSplitterTextOutConstructor (&mStdErr);
- if (!EFI_ERROR (Status)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mStdErr.VirtualHandle,
- &gEfiSimpleTextOutProtocolGuid,
- &mStdErr.TextOut,
- NULL
- );
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mStdErr.VirtualHandle,
+ &gEfiSimpleTextOutProtocolGuid,
+ &mStdErr.TextOut,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
}
gST->StandardErrorHandle = mStdErr.VirtualHandle;
@@ -1779,8 +1770,8 @@ ConSplitterStdErrDriverBindingStop ( **/
EFI_STATUS
ConSplitterGrowBuffer (
- IN UINTN SizeOfCount,
- IN UINTN *Count,
+ IN UINTN SizeOfCount,
+ IN OUT UINTN *Count,
IN OUT VOID **Buffer
)
{
@@ -2968,6 +2959,7 @@ ConSplitterTextOutAddDevice ( // If the Text Out List is full, enlarge it by calling ConSplitterGrowBuffer().
//
while (CurrentNumOfConsoles >= Private->TextOutListCount) {
+ CpuBreakpoint ();
Status = ConSplitterGrowBuffer (
sizeof (TEXT_OUT_AND_GOP_DATA),
&Private->TextOutListCount,
diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h index 3bfa24548a..a3904f4a29 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h @@ -1749,8 +1749,8 @@ ConSplitterTextOutEnableCursor ( **/
EFI_STATUS
ConSplitterGrowBuffer (
- IN UINTN SizeOfCount,
- IN UINTN *Count,
+ IN UINTN SizeOfCount,
+ IN OUT UINTN *Count,
IN OUT VOID **Buffer
);
|