From 32bc1227a5a75fe086970420f98c91e500fd88cb Mon Sep 17 00:00:00 2001 From: li-elvin Date: Thu, 24 Nov 2011 01:01:48 +0000 Subject: [PATCH] Update console mode setup to use PcdSetupConOutColumn and PcdSetupConOutRow which are specially for BIOS setup. Signed-off-by: li-elvin Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12770 6f19259b-4bc3-4df7-8a09-765794883524 --- .../IntelFrameworkModulePkg.dec | 40 ++++++++-------- .../BdsDxe/BootMaint/ConsoleOption.c | 4 +- .../Universal/BdsDxe/BootMaint/Variable.c | 4 +- .../Universal/BdsDxe/FrontPage.c | 47 ++++++++++--------- 4 files changed, 51 insertions(+), 44 deletions(-) diff --git a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec index 3be1df61e7..e81379d480 100644 --- a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec +++ b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec @@ -152,6 +152,26 @@ # This PCD should be set as HII type PCD by platform integrator mapped to variable L"HwErrRecSupport" gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel|0|UINT16|0x40000002 +[PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] + ## The 4 PCDs below are used to specify the video resolution and text mode of text setup. + # To make text setup work in this resolution, PcdVideoHorizontalResolution, PcdVideoVerticalResolution, + # PcdConOutColumn and PcdConOutRow in MdeModulePkg.dec should be created as PcdsDynamic or PcdsDynamicEx + # in platform DSC file. Then BDS setup will update these PCDs defined in MdeModulePkg.dec and reconnect + # console drivers (GraphicsConsole, Terminal, Consplitter) to make the video resolution and text mode work + # for text setup. + + ## The PCD is used to specify the video horizontal resolution of text setup. + gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|800|UINT32|0x50000001 + + ## The PCD is used to specify the video vertical resolution of text setup. + gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|600|UINT32|0x50000002 + + ## The PCD is used to specify the console output column of text setup. + gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupConOutColumn|80|UINT32|0x50000003 + + ## The PCD is used to specify the console output column of text setup. + gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupConOutRow|25|UINT32|0x50000004 + [PcdsFixedAtBuild, PcdsDynamic, PcdsDynamicEx, PcdsPatchableInModule] ## I/O Base address of floppy device controller. gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdFdcBaseAddress|0x3f0|UINT16|0x30000000 @@ -195,22 +215,4 @@ ## The PCD is used to specify the high PMM (Post Memory Manager) size with bytes above 1MB. # The value should be a multiple of 4KB. gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdHighPmmMemorySize|0x400000|UINT32|0x3000000a - - ## The 4 PCDs below are used to specify the video resolution and text mode of text setup. - # To make text setup work in this resolution, PcdVideoHorizontalResolution, PcdVideoVerticalResolution, - # PcdConOutColumn and PcdConOutRow in MdeModulePkg.dec should be created as PcdsDynamic or PcdsDynamicEx - # in platform DSC file. Then BDS setup will update these PCDs defined in MdeModulePkg.dec and reconnect - # console drivers (GraphicsConsole, Terminal, Consplitter) to make the video resolution and text mode work - # for text setup. - - ## The PCD is used to specify the video horizontal resolution of text setup. - gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|800|UINT32|0x3000000b - - ## The PCD is used to specify the video vertical resolution of text setup. - gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|600|UINT32|0x3000000c - - ## The PCD is used to specify the console output column of text setup. - gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupConOutColumn|80|UINT32|0x3000000d - - ## The PCD is used to specify the console output column of text setup. - gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupConOutRow|25|UINT32|0x3000000e \ No newline at end of file + \ No newline at end of file diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c index ed42304c2b..ffa88b4d85 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c @@ -1033,8 +1033,8 @@ GetConsoleOutMode ( ConOut = gST->ConOut; MaxMode = (UINTN) (ConOut->Mode->MaxMode); - CurrentCol = PcdGet32 (PcdConOutColumn); - CurrentRow = PcdGet32 (PcdConOutRow); + CurrentCol = PcdGet32 (PcdSetupConOutColumn); + CurrentRow = PcdGet32 (PcdSetupConOutRow); for (Mode = 0; Mode < MaxMode; Mode++) { Status = ConOut->QueryMode (ConOut, Mode, &Col, &Row); if (!EFI_ERROR(Status)) { diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c index c055537e37..ac7e61496f 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c @@ -1345,8 +1345,8 @@ Var_UpdateConMode ( Status = gST->ConOut->QueryMode (gST->ConOut, Mode, &(ModeInfo.Column), &(ModeInfo.Row)); if (!EFI_ERROR(Status)) { - PcdSet32 (PcdConOutColumn, (UINT32) ModeInfo.Column); - PcdSet32 (PcdConOutRow, (UINT32) ModeInfo.Row); + PcdSet32 (PcdSetupConOutColumn, (UINT32) ModeInfo.Column); + PcdSet32 (PcdSetupConOutRow, (UINT32) ModeInfo.Row); } return EFI_SUCCESS; diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c index 4bba3e0499..8a8286a704 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c @@ -17,6 +17,12 @@ 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 gConnectAllHappened = FALSE; UINTN gCallbackKey; @@ -961,10 +967,6 @@ ChangeModeForSetup ( UINT32 MaxGopMode; UINT32 MaxTextMode; UINT32 ModeNumber; - UINT32 SetupTextModeColumn; - UINT32 SetupTextModeRow; - UINT32 SetupHorizontalResolution; - UINT32 SetupVerticalResolution; UINTN HandleCount; EFI_HANDLE *HandleBuffer; EFI_STATUS Status; @@ -995,12 +997,15 @@ ChangeModeForSetup ( } // - // Get user defined text mode for setup. + // Get user defined text mode for setup only once. // - SetupHorizontalResolution = PcdGet32 (PcdSetupVideoHorizontalResolution); - SetupVerticalResolution = PcdGet32 (PcdSetupVideoVerticalResolution); - SetupTextModeColumn = PcdGet32 (PcdSetupConOutColumn); - SetupTextModeRow = PcdGet32 (PcdSetupConOutRow); + if (!mSetupModeInitialized) { + mSetupHorizontalResolution = PcdGet32 (PcdSetupVideoHorizontalResolution); + mSetupVerticalResolution = PcdGet32 (PcdSetupVideoVerticalResolution); + mSetupTextModeColumn = PcdGet32 (PcdSetupConOutColumn); + mSetupTextModeRow = PcdGet32 (PcdSetupConOutRow); + mSetupModeInitialized = TRUE; + } MaxGopMode = GraphicsOutput->Mode->MaxMode; MaxTextMode = SimpleTextOut->Mode->MaxMode; @@ -1020,17 +1025,17 @@ ChangeModeForSetup ( &Info ); if (!EFI_ERROR (Status)) { - if ((Info->HorizontalResolution == SetupHorizontalResolution) && - (Info->VerticalResolution == SetupVerticalResolution)) { - if ((GraphicsOutput->Mode->Info->HorizontalResolution == SetupHorizontalResolution) && - (GraphicsOutput->Mode->Info->VerticalResolution == SetupVerticalResolution)) { + 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 == SetupTextModeColumn && CurrentRow == SetupTextModeRow) { + if (CurrentColumn == mSetupTextModeColumn && CurrentRow == mSetupTextModeRow) { // // Current text mode is same with setup text mode, text mode need not be change. // @@ -1043,7 +1048,7 @@ ChangeModeForSetup ( for (Index = 0; Index < MaxTextMode; Index++) { Status = SimpleTextOut->QueryMode (SimpleTextOut, Index, &CurrentColumn, &CurrentRow); if (!EFI_ERROR(Status)) { - if ((CurrentColumn == SetupTextModeColumn) && (CurrentRow == SetupTextModeRow)) { + if ((CurrentColumn == mSetupTextModeColumn) && (CurrentRow == mSetupTextModeRow)) { // // setup text mode is supported, set it. // @@ -1052,8 +1057,8 @@ ChangeModeForSetup ( // // Update text mode PCD. // - PcdSet32 (PcdConOutColumn, SetupTextModeColumn); - PcdSet32 (PcdConOutRow, SetupTextModeRow); + PcdSet32 (PcdConOutColumn, mSetupTextModeColumn); + PcdSet32 (PcdConOutRow, mSetupTextModeRow); FreePool (Info); return EFI_SUCCESS; } @@ -1079,10 +1084,10 @@ ChangeModeForSetup ( // Set PCD to restart GraphicsConsole and Consplitter to change video resolution // and produce new text mode based on new resolution. // - PcdSet32 (PcdVideoHorizontalResolution, SetupHorizontalResolution); - PcdSet32 (PcdVideoVerticalResolution, SetupVerticalResolution); - PcdSet32 (PcdConOutColumn, SetupTextModeColumn); - PcdSet32 (PcdConOutRow, SetupTextModeRow); + PcdSet32 (PcdVideoHorizontalResolution, mSetupHorizontalResolution); + PcdSet32 (PcdVideoVerticalResolution, mSetupVerticalResolution); + PcdSet32 (PcdConOutColumn, mSetupTextModeColumn); + PcdSet32 (PcdConOutRow, mSetupTextModeRow); Status = gBS->LocateHandleBuffer ( ByProtocol,