Add BootlogoOnly feature in BDS for BGRT

Signed-off-by: czhang46
Reviewed-by: li-elvin, hhtian


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13116 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
czhang46 2012-03-23 04:27:19 +00:00
parent 9f7f5161cf
commit 2df686c67c
14 changed files with 526 additions and 329 deletions

View File

@ -127,6 +127,9 @@
## This PCD specifies whether PS2 mouse does a extended verification during start.
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPs2MouseExtendedVerification|TRUE|BOOLEAN|0x00010047
## This PCD specifies whether only Boot logo is showed and all message output is disabled in BDS
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBootlogoOnlyEnable|FALSE|BOOLEAN|0x00010048
[PcdsFixedAtBuild]
## FFS filename to find the default BMP Logo file.
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile |{ 0x99, 0x8b, 0xB2, 0x7B, 0xBB, 0x61, 0xD5, 0x11, 0x9A, 0x5D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }|VOID*|0x40000003

View File

@ -1,7 +1,7 @@
/** @file
BDS Lib functions which relate with create or process the boot option.
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2012, 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
@ -614,6 +614,7 @@ BdsLibBootViaBootOption (
)
{
EFI_STATUS Status;
EFI_STATUS StatusLogo;
EFI_HANDLE Handle;
EFI_HANDLE ImageHandle;
EFI_DEVICE_PATH_PROTOCOL *FilePath;
@ -621,6 +622,7 @@ BdsLibBootViaBootOption (
EFI_DEVICE_PATH_PROTOCOL *WorkingDevicePath;
EFI_ACPI_S3_SAVE_PROTOCOL *AcpiS3Save;
LIST_ENTRY TempBootLists;
EFI_BOOT_LOGO_PROTOCOL *BootLogo;
//
// Record the performance data for End of BDS
@ -837,6 +839,15 @@ BdsLibBootViaBootOption (
gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);
Done:
//
// Set Logo status invalid after trying one boot option
//
BootLogo = NULL;
StatusLogo = gBS->LocateProtocol (&gEfiBootLogoProtocolGuid, NULL, (VOID **) &BootLogo);
if (!EFI_ERROR (StatusLogo) && (BootLogo != NULL)) {
BootLogo->SetBootLogo (BootLogo, NULL, 0, 0, 0, 0);
}
//
// Clear Boot Current
//

View File

@ -1,7 +1,7 @@
/** @file
BDS Lib functions which contain all the code to connect console device
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2012, 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
@ -15,7 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "InternalBdsLib.h"
#include <IndustryStandard/Bmp.h>
#include <Protocol/BootLogo.h>
/**
Check if we need to save the EFI variable with "ConVarName" as name
@ -896,7 +895,11 @@ EnableQuietBoot (
CoordinateX = 0;
CoordinateY = 0;
Attribute = EfiBadgingDisplayAttributeCenter;
if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
Attribute = EfiBadgingDisplayAttributeCenter;
} else {
Attribute = EfiBadgingDisplayAttributeCustomized;
}
}
if (Blt != NULL) {
@ -970,6 +973,11 @@ EnableQuietBoot (
DestY = (SizeOfY - Height) / 2;
break;
case EfiBadgingDisplayAttributeCustomized:
DestX = (SizeOfX - Width) / 2;
DestY = ((SizeOfY * 382) / 1000) - Height / 2;
break;
default:
DestX = CoordinateX;
DestY = CoordinateY;

View File

@ -5,7 +5,7 @@
# 2) BDS boot device connect interface;
# 3) BDS Misc interfaces for mainting boot variable, ouput string, etc.
#
# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2007 - 2012, 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
@ -118,6 +118,7 @@
[FeaturePcd]
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBootlogoOnlyEnable
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange

View File

@ -1,7 +1,7 @@
/** @file
BDS library definition, include the file and data structure
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2012, 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
@ -41,6 +41,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/HiiFont.h>
#include <Protocol/HiiImage.h>
#include <Protocol/UsbIo.h>
#include <Protocol/BootLogo.h>
#include <Guid/MemoryTypeInformation.h>
#include <Guid/FileInfo.h>

View File

@ -14,7 +14,7 @@
# BDSDxe also maintain the UI for "Boot Manager, Boot Maintaince Manager, Device Manager" which
# is used for user to configure boot option or maintain hardware device.
#
# Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2008 - 2012, 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
@ -164,6 +164,7 @@
[FeaturePcd]
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBootlogoOnlyEnable
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangCodes

View File

@ -5,7 +5,7 @@
After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry will be invoked
to enter BDS phase.
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2012, 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
@ -214,6 +214,12 @@ BdsBootDeviceSelect (
//
BdsLibConnectDevicePath (BootOption->DevicePath);
}
//
// Restore to original mode before launching boot option.
//
BdsSetConsoleMode (FALSE);
//
// All the driver options should have been processed since
// now boot will be performed.

View File

@ -1,7 +1,7 @@
/** @file
File explorer related functions.
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2012, 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
@ -157,6 +157,11 @@ UpdateFileExplorer (
} else {
switch (CallbackData->FeCurrentState) {
case FileExplorerStateBootFromFile:
//
// Restore to original mode before launching boot option.
//
BdsSetConsoleMode (FALSE);
//
// Here boot from file
//
@ -164,7 +169,7 @@ UpdateFileExplorer (
//
// Set proper video resolution and text mode for setup.
//
ChangeModeForSetup ();
BdsSetConsoleMode (TRUE);
ExitFileExplorer = TRUE;
break;

View File

@ -1,7 +1,7 @@
/** @file
The platform boot manager reference implementation
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2012, 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
@ -366,6 +366,11 @@ CallBootManager (
//
SetupResetReminder ();
//
// Restore to original mode before launching boot option.
//
BdsSetConsoleMode (FALSE);
//
// parse the selected option
//

View File

@ -1,7 +1,7 @@
/** @file
FrontPage routines to handle the callbacks and browser calls
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2012, 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
@ -17,15 +17,26 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "Language.h"
#include "Hotkey.h"
BOOLEAN mSetupModeInitialized = FALSE;
UINT32 mSetupTextModeColumn;
UINT32 mSetupTextModeRow;
UINT32 mSetupHorizontalResolution;
UINT32 mSetupVerticalResolution;
BOOLEAN mModeInitialized = FALSE;
BOOLEAN gConnectAllHappened = FALSE;
UINTN gCallbackKey;
//
// Boot video resolution and text mode.
//
UINT32 mBootHorizontalResolution = 0;
UINT32 mBootVerticalResolution = 0;
UINT32 mBootTextModeColumn = 0;
UINT32 mBootTextModeRow = 0;
//
// BIOS setup video resolution and text mode.
//
UINT32 mSetupTextModeColumn = 0;
UINT32 mSetupTextModeRow = 0;
UINT32 mSetupHorizontalResolution = 0;
UINT32 mSetupVerticalResolution = 0;
EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2;
FRONT_PAGE_CALLBACK_DATA gFrontPagePrivate = {
@ -891,20 +902,24 @@ ShowProgress (
if (TimeoutDefault == 0) {
return EFI_TIMEOUT;
}
DEBUG ((EFI_D_INFO, "\n\nStart showing progress bar... Press any key to stop it! ...Zzz....\n"));
SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
//
// Clear the progress status bar first
//
TmpStr = GetStringById (STRING_TOKEN (STR_START_BOOT_OPTION));
if (TmpStr != NULL) {
PlatformBdsShowProgress (Foreground, Background, TmpStr, Color, 0, 0);
if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
//
// Clear the progress status bar first
//
if (TmpStr != NULL) {
PlatformBdsShowProgress (Foreground, Background, TmpStr, Color, 0, 0);
}
}
TimeoutRemain = TimeoutDefault;
while (TimeoutRemain != 0) {
@ -915,22 +930,27 @@ ShowProgress (
break;
}
TimeoutRemain--;
//
// Show progress
//
if (TmpStr != NULL) {
PlatformBdsShowProgress (
Foreground,
Background,
TmpStr,
Color,
((TimeoutDefault - TimeoutRemain) * 100 / TimeoutDefault),
0
);
if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
//
// Show progress
//
if (TmpStr != NULL) {
PlatformBdsShowProgress (
Foreground,
Background,
TmpStr,
Color,
((TimeoutDefault - TimeoutRemain) * 100 / TimeoutDefault),
0
);
}
}
}
gBS->FreePool (TmpStr);
if (TmpStr != NULL) {
gBS->FreePool (TmpStr);
}
//
// Timeout expired
@ -957,186 +977,6 @@ ShowProgress (
return EFI_SUCCESS;
}
/**
This function will change video resolution and text mode for setup when setup is launched.
@param None.
@retval EFI_SUCCESS Mode is changed successfully.
@retval Others Mode failed to changed.
**/
EFI_STATUS
EFIAPI
ChangeModeForSetup (
VOID
)
{
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
UINTN SizeOfInfo;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
UINT32 MaxGopMode;
UINT32 MaxTextMode;
UINT32 ModeNumber;
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
EFI_STATUS Status;
UINTN Index;
UINTN CurrentColumn;
UINTN CurrentRow;
Status = gBS->HandleProtocol (
gST->ConsoleOutHandle,
&gEfiGraphicsOutputProtocolGuid,
(VOID**)&GraphicsOutput
);
if (EFI_ERROR (Status)) {
GraphicsOutput = NULL;
}
Status = gBS->HandleProtocol (
gST->ConsoleOutHandle,
&gEfiSimpleTextOutProtocolGuid,
(VOID**)&SimpleTextOut
);
if (EFI_ERROR (Status)) {
SimpleTextOut = NULL;
}
if ((GraphicsOutput == NULL) || (SimpleTextOut == NULL)) {
return EFI_UNSUPPORTED;
}
//
// Get user defined text mode for setup only once.
//
if (!mSetupModeInitialized) {
mSetupHorizontalResolution = PcdGet32 (PcdSetupVideoHorizontalResolution);
mSetupVerticalResolution = PcdGet32 (PcdSetupVideoVerticalResolution);
mSetupTextModeColumn = PcdGet32 (PcdSetupConOutColumn);
mSetupTextModeRow = PcdGet32 (PcdSetupConOutRow);
mSetupModeInitialized = TRUE;
}
MaxGopMode = GraphicsOutput->Mode->MaxMode;
MaxTextMode = SimpleTextOut->Mode->MaxMode;
//
// 1. If current video resolution is same with setup video resolution,
// video resolution need not be changed.
// 1.1. If current text mode is same with setup text mode, text mode need not be changed.
// 1.2. If current text mode is different with setup text mode, text mode need be changed to setup text mode.
// 2. If current video resolution is different with setup video resolution, we need restart whole console drivers.
//
for (ModeNumber = 0; ModeNumber < MaxGopMode; ModeNumber++) {
Status = GraphicsOutput->QueryMode (
GraphicsOutput,
ModeNumber,
&SizeOfInfo,
&Info
);
if (!EFI_ERROR (Status)) {
if ((Info->HorizontalResolution == mSetupHorizontalResolution) &&
(Info->VerticalResolution == mSetupVerticalResolution)) {
if ((GraphicsOutput->Mode->Info->HorizontalResolution == mSetupHorizontalResolution) &&
(GraphicsOutput->Mode->Info->VerticalResolution == mSetupVerticalResolution)) {
//
// If current video resolution is same with setup video resolution,
// then check if current text mode is same with setup text mode.
//
Status = SimpleTextOut->QueryMode (SimpleTextOut, SimpleTextOut->Mode->Mode, &CurrentColumn, &CurrentRow);
ASSERT_EFI_ERROR (Status);
if (CurrentColumn == mSetupTextModeColumn && CurrentRow == mSetupTextModeRow) {
//
// Current text mode is same with setup text mode, text mode need not be change.
//
FreePool (Info);
return EFI_SUCCESS;
} else {
//
// Current text mode is different with setup text mode, text mode need be change to new text mode.
//
for (Index = 0; Index < MaxTextMode; Index++) {
Status = SimpleTextOut->QueryMode (SimpleTextOut, Index, &CurrentColumn, &CurrentRow);
if (!EFI_ERROR(Status)) {
if ((CurrentColumn == mSetupTextModeColumn) && (CurrentRow == mSetupTextModeRow)) {
//
// setup text mode is supported, set it.
//
Status = SimpleTextOut->SetMode (SimpleTextOut, Index);
ASSERT_EFI_ERROR (Status);
//
// Update text mode PCD.
//
PcdSet32 (PcdConOutColumn, mSetupTextModeColumn);
PcdSet32 (PcdConOutRow, mSetupTextModeRow);
FreePool (Info);
return EFI_SUCCESS;
}
}
}
if (Index == MaxTextMode) {
//
// If setup text mode is not supported, return error.
//
FreePool (Info);
return EFI_UNSUPPORTED;
}
}
} else {
FreePool (Info);
//
// If current video resolution is not same with the setup video resolution, set new video resolution.
// In this case, the drivers which produce simple text out need be restarted.
//
Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);
if (!EFI_ERROR (Status)) {
//
// Set PCD to restart GraphicsConsole and Consplitter to change video resolution
// and produce new text mode based on new resolution.
//
PcdSet32 (PcdVideoHorizontalResolution, mSetupHorizontalResolution);
PcdSet32 (PcdVideoVerticalResolution, mSetupVerticalResolution);
PcdSet32 (PcdConOutColumn, mSetupTextModeColumn);
PcdSet32 (PcdConOutRow, mSetupTextModeRow);
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiSimpleTextOutProtocolGuid,
NULL,
&HandleCount,
&HandleBuffer
);
if (!EFI_ERROR (Status)) {
for (Index = 0; Index < HandleCount; Index++) {
gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
}
for (Index = 0; Index < HandleCount; Index++) {
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
}
if (HandleBuffer != NULL) {
FreePool (HandleBuffer);
}
break;
}
}
}
}
FreePool (Info);
}
}
if (ModeNumber == MaxGopMode) {
//
// If the new resolution is not supported, return error.
//
return EFI_UNSUPPORTED;
}
return EFI_SUCCESS;
}
/**
This function is the main entry of the platform setup entry.
The function will present the main menu of the system setup,
@ -1155,8 +995,16 @@ PlatformBdsEnterFrontPage (
IN BOOLEAN ConnectAllHappened
)
{
EFI_STATUS Status;
EFI_BOOT_LOGO_PROTOCOL *BootLogo;
EFI_STATUS Status;
EFI_STATUS StatusHotkey;
EFI_BOOT_LOGO_PROTOCOL *BootLogo;
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
UINTN BootTextColumn;
UINTN BootTextRow;
GraphicsOutput = NULL;
SimpleTextOut = NULL;
PERF_START (NULL, "BdsTimeOut", "BDS", 0);
//
@ -1165,17 +1013,75 @@ PlatformBdsEnterFrontPage (
if (ConnectAllHappened) {
gConnectAllHappened = TRUE;
}
if (!mModeInitialized) {
//
// After the console is ready, get current video resolution
// and text mode before launching setup at first time.
//
Status = gBS->HandleProtocol (
gST->ConsoleOutHandle,
&gEfiGraphicsOutputProtocolGuid,
(VOID**)&GraphicsOutput
);
if (EFI_ERROR (Status)) {
GraphicsOutput = NULL;
}
Status = gBS->HandleProtocol (
gST->ConsoleOutHandle,
&gEfiSimpleTextOutProtocolGuid,
(VOID**)&SimpleTextOut
);
if (EFI_ERROR (Status)) {
SimpleTextOut = NULL;
}
if (GraphicsOutput != NULL) {
//
// Get current video resolution and text mode.
//
mBootHorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
mBootVerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
}
if (SimpleTextOut != NULL) {
Status = SimpleTextOut->QueryMode (
SimpleTextOut,
SimpleTextOut->Mode->Mode,
&BootTextColumn,
&BootTextRow
);
mBootTextModeColumn = (UINT32)BootTextColumn;
mBootTextModeRow = (UINT32)BootTextRow;
}
//
// Get user defined text mode for setup.
//
mSetupHorizontalResolution = PcdGet32 (PcdSetupVideoHorizontalResolution);
mSetupVerticalResolution = PcdGet32 (PcdSetupVideoVerticalResolution);
mSetupTextModeColumn = PcdGet32 (PcdSetupConOutColumn);
mSetupTextModeRow = PcdGet32 (PcdSetupConOutRow);
mModeInitialized = TRUE;
}
HotkeyBoot ();
if (TimeoutDefault != 0xffff) {
Status = ShowProgress (TimeoutDefault);
HotkeyBoot ();
StatusHotkey = HotkeyBoot ();
//
// Ensure screen is clear when switch Console from Graphics mode to Text mode
//
gST->ConOut->EnableCursor (gST->ConOut, TRUE);
gST->ConOut->ClearScreen (gST->ConOut);
if (!FeaturePcdGet(PcdBootlogoOnlyEnable) || !EFI_ERROR(StatusHotkey)){
//
// Ensure screen is clear when switch Console from Graphics mode to Text mode
// Skip it in normal boot
//
gST->ConOut->EnableCursor (gST->ConOut, TRUE);
gST->ConOut->ClearScreen (gST->ConOut);
}
if (EFI_ERROR (Status)) {
//
@ -1198,7 +1104,7 @@ PlatformBdsEnterFrontPage (
//
// Set proper video resolution and text mode for setup
//
ChangeModeForSetup ();
BdsSetConsoleMode (TRUE);
InitializeFrontPage (FALSE);
@ -1286,3 +1192,213 @@ Exit:
//
PERF_END (NULL, "BdsTimeOut", "BDS", 0);
}
/**
This function will change video resolution and text mode
according to defined setup mode or defined boot mode
@param IsSetupMode Indicate mode is changed to setup mode or boot mode.
@retval EFI_SUCCESS Mode is changed successfully.
@retval Others Mode failed to be changed.
**/
EFI_STATUS
EFIAPI
BdsSetConsoleMode (
BOOLEAN IsSetupMode
)
{
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
UINTN SizeOfInfo;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
UINT32 MaxGopMode;
UINT32 MaxTextMode;
UINT32 ModeNumber;
UINT32 NewHorizontalResolution;
UINT32 NewVerticalResolution;
UINT32 NewColumns;
UINT32 NewRows;
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
EFI_STATUS Status;
UINTN Index;
UINTN CurrentColumn;
UINTN CurrentRow;
MaxGopMode = 0;
MaxTextMode = 0;
//
// Get current video resolution and text mode
//
Status = gBS->HandleProtocol (
gST->ConsoleOutHandle,
&gEfiGraphicsOutputProtocolGuid,
(VOID**)&GraphicsOutput
);
if (EFI_ERROR (Status)) {
GraphicsOutput = NULL;
}
Status = gBS->HandleProtocol (
gST->ConsoleOutHandle,
&gEfiSimpleTextOutProtocolGuid,
(VOID**)&SimpleTextOut
);
if (EFI_ERROR (Status)) {
SimpleTextOut = NULL;
}
if ((GraphicsOutput == NULL) || (SimpleTextOut == NULL)) {
return EFI_UNSUPPORTED;
}
if (IsSetupMode) {
//
// The requried resolution and text mode is setup mode.
//
NewHorizontalResolution = mSetupHorizontalResolution;
NewVerticalResolution = mSetupVerticalResolution;
NewColumns = mSetupTextModeColumn;
NewRows = mSetupTextModeRow;
} else {
//
// The required resolution and text mode is boot mode.
//
NewHorizontalResolution = mBootHorizontalResolution;
NewVerticalResolution = mBootVerticalResolution;
NewColumns = mBootTextModeColumn;
NewRows = mBootTextModeRow;
}
if (GraphicsOutput != NULL) {
MaxGopMode = GraphicsOutput->Mode->MaxMode;
}
if (SimpleTextOut != NULL) {
MaxTextMode = SimpleTextOut->Mode->MaxMode;
}
//
// 1. If current video resolution is same with required video resolution,
// video resolution need not be changed.
// 1.1. If current text mode is same with required text mode, text mode need not be changed.
// 1.2. If current text mode is different from required text mode, text mode need be changed.
// 2. If current video resolution is different from required video resolution, we need restart whole console drivers.
//
for (ModeNumber = 0; ModeNumber < MaxGopMode; ModeNumber++) {
Status = GraphicsOutput->QueryMode (
GraphicsOutput,
ModeNumber,
&SizeOfInfo,
&Info
);
if (!EFI_ERROR (Status)) {
if ((Info->HorizontalResolution == NewHorizontalResolution) &&
(Info->VerticalResolution == NewVerticalResolution)) {
if ((GraphicsOutput->Mode->Info->HorizontalResolution == NewHorizontalResolution) &&
(GraphicsOutput->Mode->Info->VerticalResolution == NewVerticalResolution)) {
//
// Current resolution is same with required resolution, check if text mode need be set
//
Status = SimpleTextOut->QueryMode (SimpleTextOut, SimpleTextOut->Mode->Mode, &CurrentColumn, &CurrentRow);
ASSERT_EFI_ERROR (Status);
if (CurrentColumn == NewColumns && CurrentRow == NewRows) {
//
// If current text mode is same with required text mode. Do nothing
//
FreePool (Info);
return EFI_SUCCESS;
} else {
//
// If current text mode is different from requried text mode. Set new video mode
//
for (Index = 0; Index < MaxTextMode; Index++) {
Status = SimpleTextOut->QueryMode (SimpleTextOut, Index, &CurrentColumn, &CurrentRow);
if (!EFI_ERROR(Status)) {
if ((CurrentColumn == NewColumns) && (CurrentRow == NewRows)) {
//
// Required text mode is supported, set it.
//
Status = SimpleTextOut->SetMode (SimpleTextOut, Index);
ASSERT_EFI_ERROR (Status);
//
// Update text mode PCD.
//
PcdSet32 (PcdConOutColumn, mSetupTextModeColumn);
PcdSet32 (PcdConOutRow, mSetupTextModeRow);
FreePool (Info);
return EFI_SUCCESS;
}
}
}
if (Index == MaxTextMode) {
//
// If requried text mode is not supported, return error.
//
FreePool (Info);
return EFI_UNSUPPORTED;
}
}
} else {
//
// If current video resolution is not same with the new one, set new video resolution.
// In this case, the driver which produces simple text out need be restarted.
//
Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);
if (!EFI_ERROR (Status)) {
FreePool (Info);
break;
}
}
}
FreePool (Info);
}
}
if (ModeNumber == MaxGopMode) {
//
// If the resolution is not supported, return error.
//
return EFI_UNSUPPORTED;
}
//
// Set PCD to Inform GraphicsConsole to change video resolution.
// Set PCD to Inform Consplitter to change text mode.
//
PcdSet32 (PcdVideoHorizontalResolution, NewHorizontalResolution);
PcdSet32 (PcdVideoVerticalResolution, NewVerticalResolution);
PcdSet32 (PcdConOutColumn, NewColumns);
PcdSet32 (PcdConOutRow, NewRows);
//
// Video mode is changed, so restart graphics console driver and higher level driver.
// Reconnect graphics console driver and higher level driver.
// Locate all the handles with GOP protocol and reconnect it.
//
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiSimpleTextOutProtocolGuid,
NULL,
&HandleCount,
&HandleBuffer
);
if (!EFI_ERROR (Status)) {
for (Index = 0; Index < HandleCount; Index++) {
gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
}
for (Index = 0; Index < HandleCount; Index++) {
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
}
if (HandleBuffer != NULL) {
FreePool (HandleBuffer);
}
}
return EFI_SUCCESS;
}

View File

@ -1,7 +1,7 @@
/** @file
FrontPage routines to handle the callbacks and browser calls
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2012, 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,6 +31,21 @@ extern EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2;
extern UINTN gCallbackKey;
extern BOOLEAN gConnectAllHappened;
//
// Boot video resolution and text mode.
//
extern UINT32 mBootHorizontalResolution;
extern UINT32 mBootVerticalResolution;
extern UINT32 mBootTextModeColumn;
extern UINT32 mBootTextModeRow;
//
// BIOS setup video resolution and text mode.
//
extern UINT32 mSetupTextModeColumn;
extern UINT32 mSetupTextModeRow;
extern UINT32 mSetupHorizontalResolution;
extern UINT32 mSetupVerticalResolution;
#define ONE_SECOND 10000000
@ -237,18 +252,20 @@ PlatformBdsEnterFrontPage (
);
/**
This function will change video resolution and text mode for setup when setup is launched.
This function will change video resolution and text mode
according to defined setup mode or defined boot mode
@param None.
@param IsSetupMode Indicate mode is changed to setup mode or boot mode.
@retval EFI_SUCCESS Mode is changed successfully.
@retval Others Mode failed to changed.
@retval Others Mode failed to be changed.
**/
EFI_STATUS
EFIAPI
ChangeModeForSetup (
VOID
BdsSetConsoleMode (
BOOLEAN IsSetupMode
);
#endif // _FRONT_PAGE_H_

View File

@ -2,7 +2,7 @@
Provides a way for 3rd party applications to register themselves for launch by the
Boot Manager based on hot key
Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2007 - 2012, 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
@ -302,46 +302,52 @@ UnregisterHotkey (
/**
Try to boot the boot option triggered by hotkey.
@retval EFI_SUCCESS There is HotkeyBootOption & it is processed
@retval EFI_NOT_FOUND There is no HotkeyBootOption
**/
VOID
EFI_STATUS
HotkeyBoot (
VOID
)
{
{
EFI_STATUS Status;
UINTN ExitDataSize;
CHAR16 *ExitData;
if (mHotkeyBootOption == NULL) {
return EFI_NOT_FOUND;
}
if (mHotkeyBootOption != NULL) {
BdsLibConnectDevicePath (mHotkeyBootOption->DevicePath);
BdsLibConnectDevicePath (mHotkeyBootOption->DevicePath);
//
// Clear the screen before launch this BootOption
//
gST->ConOut->Reset (gST->ConOut, FALSE);
Status = BdsLibBootViaBootOption (mHotkeyBootOption, mHotkeyBootOption->DevicePath, &ExitDataSize, &ExitData);
if (EFI_ERROR (Status)) {
//
// Clear the screen before launch this BootOption
// Call platform action to indicate the boot fail
//
gST->ConOut->Reset (gST->ConOut, FALSE);
Status = BdsLibBootViaBootOption (mHotkeyBootOption, mHotkeyBootOption->DevicePath, &ExitDataSize, &ExitData);
if (EFI_ERROR (Status)) {
//
// Call platform action to indicate the boot fail
//
mHotkeyBootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_FAILED));
PlatformBdsBootFail (mHotkeyBootOption, Status, ExitData, ExitDataSize);
} else {
//
// Call platform action to indicate the boot success
//
mHotkeyBootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED));
PlatformBdsBootSuccess (mHotkeyBootOption);
}
FreePool (mHotkeyBootOption->Description);
FreePool (mHotkeyBootOption->DevicePath);
FreePool (mHotkeyBootOption->LoadOptions);
FreePool (mHotkeyBootOption);
mHotkeyBootOption = NULL;
mHotkeyBootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_FAILED));
PlatformBdsBootFail (mHotkeyBootOption, Status, ExitData, ExitDataSize);
} else {
//
// Call platform action to indicate the boot success
//
mHotkeyBootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED));
PlatformBdsBootSuccess (mHotkeyBootOption);
}
FreePool (mHotkeyBootOption->Description);
FreePool (mHotkeyBootOption->DevicePath);
FreePool (mHotkeyBootOption->LoadOptions);
FreePool (mHotkeyBootOption);
mHotkeyBootOption = NULL;
return EFI_SUCCESS;
}
/**

View File

@ -2,7 +2,7 @@
Provides a way for 3rd party applications to register themselves for launch by the
Boot Manager based on hot key
Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2007 - 2012, 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
@ -94,8 +94,10 @@ InitializeHotkeyService (
/**
Try to boot the boot option triggered by hotkey.
@retval EFI_SUCCESS There is HotkeyBootOption & it is processed
@retval EFI_NOT_FOUND There is no HotkeyBootOption
**/
VOID
EFI_STATUS
HotkeyBoot (
VOID
);

View File

@ -1,7 +1,7 @@
/** @file
Perform the platform memory test
Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2012, 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
@ -280,14 +280,17 @@ BdsMemoryTest (
FreePool (Pos);
return EFI_SUCCESS;
}
if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST));
TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST));
if (TmpStr != NULL) {
PrintXY (10, 10, NULL, NULL, TmpStr);
FreePool (TmpStr);
if (TmpStr != NULL) {
PrintXY (10, 10, NULL, NULL, TmpStr);
FreePool (TmpStr);
}
} else {
DEBUG ((EFI_D_INFO, "Enter memory test.\n"));
}
do {
Status = GenMemoryTest->PerformMemoryTest (
GenMemoryTest,
@ -305,43 +308,25 @@ BdsMemoryTest (
ASSERT (0);
}
if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
TempData = (UINT32) DivU64x32 (TotalMemorySize, 16);
TestPercent = (UINTN) DivU64x32 (
DivU64x32 (MultU64x32 (TestedMemorySize, 100), 16),
TempData
);
if (TestPercent != PreviousValue) {
UnicodeValueToString (StrPercent, 0, TestPercent, 0);
TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT));
if (TmpStr != NULL) {
//
// TmpStr size is 64, StrPercent is reserved to 16.
//
StrCat (StrPercent, TmpStr);
PrintXY (10, 10, NULL, NULL, StrPercent);
FreePool (TmpStr);
}
TempData = (UINT32) DivU64x32 (TotalMemorySize, 16);
TestPercent = (UINTN) DivU64x32 (
DivU64x32 (MultU64x32 (TestedMemorySize, 100), 16),
TempData
);
if (TestPercent != PreviousValue) {
UnicodeValueToString (StrPercent, 0, TestPercent, 0);
TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT));
if (TmpStr != NULL) {
//
// TmpStr size is 64, StrPercent is reserved to 16.
//
StrCat (StrPercent, TmpStr);
PrintXY (10, 10, NULL, NULL, StrPercent);
FreePool (TmpStr);
}
TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));
if (TmpStr != NULL) {
PlatformBdsShowProgress (
Foreground,
Background,
TmpStr,
Color,
TestPercent,
(UINTN) PreviousValue
);
FreePool (TmpStr);
}
}
PreviousValue = TestPercent;
KeyStatus = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
if (!EFI_ERROR (KeyStatus) && (Key.ScanCode == SCAN_ESC)) {
if (!RequireSoftECCInit) {
TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));
if (TmpStr != NULL) {
PlatformBdsShowProgress (
@ -349,13 +334,37 @@ BdsMemoryTest (
Background,
TmpStr,
Color,
100,
TestPercent,
(UINTN) PreviousValue
);
FreePool (TmpStr);
}
}
PrintXY (10, 10, NULL, NULL, L"100");
PreviousValue = TestPercent;
} else {
DEBUG ((EFI_D_INFO, "Perform memory test (ESC to skip).\n"));
}
KeyStatus = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
if (!EFI_ERROR (KeyStatus) && (Key.ScanCode == SCAN_ESC)) {
if (!RequireSoftECCInit) {
if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));
if (TmpStr != NULL) {
PlatformBdsShowProgress (
Foreground,
Background,
TmpStr,
Color,
100,
(UINTN) PreviousValue
);
FreePool (TmpStr);
}
PrintXY (10, 10, NULL, NULL, L"100");
}
Status = GenMemoryTest->Finished (GenMemoryTest);
goto Done;
}
@ -367,29 +376,35 @@ BdsMemoryTest (
Status = GenMemoryTest->Finished (GenMemoryTest);
Done:
UnicodeValueToString (StrTotalMemory, COMMA_TYPE, TotalMemorySize, 0);
if (StrTotalMemory[0] == L',') {
StrTotalMemory++;
if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
UnicodeValueToString (StrTotalMemory, COMMA_TYPE, TotalMemorySize, 0);
if (StrTotalMemory[0] == L',') {
StrTotalMemory++;
}
TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED));
if (TmpStr != NULL) {
StrCat (StrTotalMemory, TmpStr);
FreePool (TmpStr);
}
PrintXY (10, 10, NULL, NULL, StrTotalMemory);
PlatformBdsShowProgress (
Foreground,
Background,
StrTotalMemory,
Color,
100,
(UINTN) PreviousValue
);
} else {
DEBUG ((EFI_D_INFO, "%d bytes of system memory tested OK\r\n", TotalMemorySize));
}
TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED));
if (TmpStr != NULL) {
StrCat (StrTotalMemory, TmpStr);
FreePool (TmpStr);
}
PrintXY (10, 10, NULL, NULL, StrTotalMemory);
PlatformBdsShowProgress (
Foreground,
Background,
StrTotalMemory,
Color,
100,
(UINTN) PreviousValue
);
FreePool (Pos);
//
// Use a DynamicHii type pcd to save the boot status, which is used to
// control configuration mode, such as FULL/MINIMAL/NO_CHANGES configuration.