clean console control protocol in bds module.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7915 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2009-03-20 09:25:28 +00:00
parent 9efcf13fcc
commit 5d7c160908
7 changed files with 22 additions and 63 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
BDS Lib functions which contain all the code to connect console device BDS Lib functions which contain all the code to connect console device
Copyright (c) 2004 - 2008, Intel Corporation. <BR> Copyright (c) 2004 - 2009, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -728,16 +728,7 @@ LockKeyboards (
IN CHAR16 *Password IN CHAR16 *Password
) )
{ {
EFI_STATUS Status;
EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
}
Status = ConsoleControl->LockStdIn (ConsoleControl, Password);
return Status;
} }
@ -758,7 +749,6 @@ EnableQuietBoot (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
EFI_OEM_BADGING_PROTOCOL *Badging; EFI_OEM_BADGING_PROTOCOL *Badging;
UINT32 SizeOfX; UINT32 SizeOfX;
UINT32 SizeOfY; UINT32 SizeOfY;
@ -780,11 +770,6 @@ EnableQuietBoot (
UINT32 RefreshRate; UINT32 RefreshRate;
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
UgaDraw = NULL; UgaDraw = NULL;
// //
// Try to open GOP first // Try to open GOP first
@ -801,17 +786,14 @@ EnableQuietBoot (
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
//
// Erase Cursor from screen
//
gST->ConOut->EnableCursor (gST->ConOut, FALSE);
Badging = NULL; Badging = NULL;
Status = gBS->LocateProtocol (&gEfiOEMBadgingProtocolGuid, NULL, (VOID **) &Badging); Status = gBS->LocateProtocol (&gEfiOEMBadgingProtocolGuid, NULL, (VOID **) &Badging);
//
// Set console control to graphics mode.
//
Status = ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenGraphics);
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
if (GraphicsOutput != NULL) { if (GraphicsOutput != NULL) {
SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution; SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution; SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
@ -1004,17 +986,11 @@ DisableQuietBoot (
VOID VOID
) )
{ {
EFI_STATUS Status;
EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
// //
// Set console control to text mode. // Enable Cursor on Screen
// //
return ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText); gST->ConOut->EnableCursor (gST->ConOut, TRUE);
return EFI_SUCCESS;
} }

View File

@ -5,7 +5,7 @@
# 2) BDS boot device connect interface; # 2) BDS boot device connect interface;
# 3) BDS Misc interfaces for mainting boot variable, ouput string, etc. # 3) BDS Misc interfaces for mainting boot variable, ouput string, etc.
# #
# Copyright (c) 2007 - 2008, Intel Corporation. <BR> # Copyright (c) 2007 - 2009, Intel Corporation. <BR>
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # 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 # which accompanies this distribution. The full text of the license may be found at
@ -105,7 +105,6 @@
gEfiAcpiS3SaveProtocolGuid # PROTOCOL CONSUMES gEfiAcpiS3SaveProtocolGuid # PROTOCOL CONSUMES
gEfiGraphicsOutputProtocolGuid # PROTOCOL SOMETIMES_CONSUMES gEfiGraphicsOutputProtocolGuid # PROTOCOL SOMETIMES_CONSUMES
gEfiUgaDrawProtocolGuid |PcdUgaConsumeSupport # PROTOCOL SOMETIMES_CONSUMES gEfiUgaDrawProtocolGuid |PcdUgaConsumeSupport # PROTOCOL SOMETIMES_CONSUMES
gEfiConsoleControlProtocolGuid # PROTOCOL CONSUMES
gEfiOEMBadgingProtocolGuid # PROTOCOL CONSUMES gEfiOEMBadgingProtocolGuid # PROTOCOL CONSUMES
gEfiHiiFontProtocolGuid # PROTOCOL CONSUMES gEfiHiiFontProtocolGuid # PROTOCOL CONSUMES
gEfiSecurityArchProtocolGuid gEfiSecurityArchProtocolGuid

View File

@ -1,7 +1,7 @@
/** @file /** @file
BDS library definition, include the file and data structure BDS library definition, include the file and data structure
Copyright (c) 2004 - 2008, Intel Corporation. <BR> Copyright (c) 2004 - 2009, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -34,7 +34,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/PciIo.h> #include <Protocol/PciIo.h>
#include <Protocol/AcpiS3Save.h> #include <Protocol/AcpiS3Save.h>
#include <Protocol/OEMBadging.h> #include <Protocol/OEMBadging.h>
#include <Protocol/ConsoleControl.h>
#include <Protocol/GraphicsOutput.h> #include <Protocol/GraphicsOutput.h>
#include <Protocol/UgaDraw.h> #include <Protocol/UgaDraw.h>
#include <Protocol/HiiFont.h> #include <Protocol/HiiFont.h>

View File

@ -31,7 +31,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/BlockIo.h> #include <Protocol/BlockIo.h>
#include <Guid/GlobalVariable.h> #include <Guid/GlobalVariable.h>
#include <Guid/CapsuleVendor.h> #include <Guid/CapsuleVendor.h>
#include <Protocol/ConsoleControl.h>
#include <Protocol/GenericMemoryTest.h> #include <Protocol/GenericMemoryTest.h>
#include <Protocol/FormBrowser2.h> #include <Protocol/FormBrowser2.h>
#include <Protocol/HiiConfigAccess.h> #include <Protocol/HiiConfigAccess.h>

View File

@ -145,7 +145,6 @@
gEfiDataHubProtocolGuid # PROTOCOL ALWAYS_CONSUMES gEfiDataHubProtocolGuid # PROTOCOL ALWAYS_CONSUMES
gEfiGenericMemTestProtocolGuid # PROTOCOL ALWAYS_CONSUMES gEfiGenericMemTestProtocolGuid # PROTOCOL ALWAYS_CONSUMES
gEfiLegacyBiosProtocolGuid # PROTOCOL ALWAYS_CONSUMES gEfiLegacyBiosProtocolGuid # PROTOCOL ALWAYS_CONSUMES
gEfiConsoleControlProtocolGuid # PROTOCOL ALWAYS_CONSUMES
gEfiHiiDatabaseProtocolGuid # PROTOCOL ALWAYS_CONSUMES gEfiHiiDatabaseProtocolGuid # PROTOCOL ALWAYS_CONSUMES
gEfiUgaDrawProtocolGuid |PcdUgaConsumeSupport # PROTOCOL SOMETIMES_CONSUMES gEfiUgaDrawProtocolGuid |PcdUgaConsumeSupport # PROTOCOL SOMETIMES_CONSUMES
gEfiBlockIoProtocolGuid # PROTOCOL ALWAYS_CONSUMES gEfiBlockIoProtocolGuid # PROTOCOL ALWAYS_CONSUMES

View File

@ -1,7 +1,7 @@
/** @file /** @file
FrontPage routines to handle the callbacks and browser calls FrontPage routines to handle the callbacks and browser calls
Copyright (c) 2004 - 2008, Intel Corporation. <BR> Copyright (c) 2004 - 2009, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -856,7 +856,6 @@ PlatformBdsEnterFrontPage (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
PERF_START (0, "BdsTimeOut", "BDS", 0); PERF_START (0, "BdsTimeOut", "BDS", 0);
// //
@ -970,8 +969,4 @@ Exit:
// takes affect // takes affect
// //
PERF_END (0, "BdsTimeOut", "BDS", 0); PERF_END (0, "BdsTimeOut", "BDS", 0);
Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
if (Status == EFI_SUCCESS) {
ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);
}
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
Perform the platform memory test Perform the platform memory test
Copyright (c) 2004 - 2008, Intel Corporation. <BR> Copyright (c) 2004 - 2009, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -222,7 +222,7 @@ BdsMemoryTest (
BOOLEAN ErrorOut; BOOLEAN ErrorOut;
BOOLEAN TestAbort; BOOLEAN TestAbort;
EFI_INPUT_KEY Key; EFI_INPUT_KEY Key;
CHAR16 StrPercent[16]; CHAR16 StrPercent[80];
CHAR16 *StrTotalMemory; CHAR16 *StrTotalMemory;
CHAR16 *Pos; CHAR16 *Pos;
CHAR16 *TmpStr; CHAR16 *TmpStr;
@ -255,10 +255,6 @@ BdsMemoryTest (
RequireSoftECCInit = FALSE; RequireSoftECCInit = FALSE;
gST->ConOut->ClearScreen (gST->ConOut);
gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT);
gST->ConOut->EnableCursor (gST->ConOut, FALSE);
Status = gBS->LocateProtocol ( Status = gBS->LocateProtocol (
&gEfiGenericMemTestProtocolGuid, &gEfiGenericMemTestProtocolGuid,
NULL, NULL,
@ -286,11 +282,10 @@ BdsMemoryTest (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 2);
TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST)); TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST));
if (TmpStr != NULL) { if (TmpStr != NULL) {
gST->ConOut->OutputString (gST->ConOut, TmpStr); PrintXY (10, 10, NULL, NULL, TmpStr);
FreePool (TmpStr); FreePool (TmpStr);
} }
@ -306,8 +301,6 @@ BdsMemoryTest (
TmpStr = GetStringById (STRING_TOKEN (STR_SYSTEM_MEM_ERROR)); TmpStr = GetStringById (STRING_TOKEN (STR_SYSTEM_MEM_ERROR));
if (TmpStr != NULL) { if (TmpStr != NULL) {
PrintXY (10, 10, NULL, NULL, TmpStr); PrintXY (10, 10, NULL, NULL, TmpStr);
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 4);
gST->ConOut->OutputString (gST->ConOut, TmpStr);
FreePool (TmpStr); FreePool (TmpStr);
} }
@ -321,10 +314,13 @@ BdsMemoryTest (
); );
if (TestPercent != PreviousValue) { if (TestPercent != PreviousValue) {
UnicodeValueToString (StrPercent, 0, TestPercent, 0); UnicodeValueToString (StrPercent, 0, TestPercent, 0);
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);
TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT)); TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT));
if (TmpStr != NULL) { if (TmpStr != NULL) {
BdsLibOutputStrings (gST->ConOut, StrPercent, TmpStr, NULL); //
// TmpStr size is 64, StrPercent is reserved to 16.
//
StrCat (StrPercent, TmpStr);
PrintXY (10, 10, NULL, NULL, StrPercent);
FreePool (TmpStr); FreePool (TmpStr);
} }
@ -360,8 +356,7 @@ BdsMemoryTest (
FreePool (TmpStr); FreePool (TmpStr);
} }
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0); PrintXY (10, 10, NULL, NULL, L"100");
gST->ConOut->OutputString (gST->ConOut, L"100");
Status = GenMemoryTest->Finished (GenMemoryTest); Status = GenMemoryTest->Finished (GenMemoryTest);
goto Done; goto Done;
} }
@ -384,10 +379,7 @@ Done:
FreePool (TmpStr); FreePool (TmpStr);
} }
gST->ConOut->ClearScreen (gST->ConOut); PrintXY (10, 10, NULL, NULL, StrTotalMemory);
gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT);
gST->ConOut->EnableCursor (gST->ConOut, FALSE);
gST->ConOut->OutputString (gST->ConOut, StrTotalMemory);
PlatformBdsShowProgress ( PlatformBdsShowProgress (
Foreground, Foreground,
Background, Background,