summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorDong, Eric <eric.dong@intel.com>2016-05-18 13:12:41 +0800
committerLiming Gao <liming.gao@intel.com>2016-05-19 12:33:33 +0800
commit8c53b5e67cec87414fb31a811221d887410cfd97 (patch)
treee42f714cd716395cf8c99e365106f850ddd0a4cf /MdeModulePkg
parentcb9fcac0ea03f0d515e5138e38ae6bcb33b9acdc (diff)
downloadedk2-8c53b5e67cec87414fb31a811221d887410cfd97.zip
edk2-8c53b5e67cec87414fb31a811221d887410cfd97.tar.gz
edk2-8c53b5e67cec87414fb31a811221d887410cfd97.tar.bz2
BootMaintenanceMangerUiLib: Save mode info for later use.
In current code, we use different output modes for boot phase and setup phase. When split BootMaintenanceMangerUiLib from UiApp code, we not add logic to save the boot phase mode info which will be used later. This change add this logic. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c75
-rw-r--r--MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf4
2 files changed, 78 insertions, 1 deletions
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c
index 34b7809..0d54cdf 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c
@@ -30,6 +30,8 @@ UINT32 mBmmSetupTextModeRow = 0;
UINT32 mBmmSetupHorizontalResolution = 0;
UINT32 mBmmSetupVerticalResolution = 0;
+BOOLEAN mBmmModeInitialized = FALSE;
+
EFI_DEVICE_PATH_PROTOCOL EndDevicePath[] = {
{
END_DEVICE_PATH_TYPE,
@@ -1278,6 +1280,77 @@ FreeAllMenu (
}
/**
+ Initial the boot mode related parameters.
+
+**/
+VOID
+BmmInitialBootModeInfo (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
+ UINTN BootTextColumn;
+ UINTN BootTextRow;
+
+ if (mBmmModeInitialized) {
+ return;
+ }
+
+ //
+ // 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.
+ //
+ mBmmBootHorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
+ mBmmBootVerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
+ }
+
+ if (SimpleTextOut != NULL) {
+ Status = SimpleTextOut->QueryMode (
+ SimpleTextOut,
+ SimpleTextOut->Mode->Mode,
+ &BootTextColumn,
+ &BootTextRow
+ );
+ mBmmBootTextModeColumn = (UINT32)BootTextColumn;
+ mBmmBootTextModeRow = (UINT32)BootTextRow;
+ }
+
+ //
+ // Get user defined text mode for setup.
+ //
+ mBmmSetupHorizontalResolution = PcdGet32 (PcdSetupVideoHorizontalResolution);
+ mBmmSetupVerticalResolution = PcdGet32 (PcdSetupVideoVerticalResolution);
+ mBmmSetupTextModeColumn = PcdGet32 (PcdSetupConOutColumn);
+ mBmmSetupTextModeRow = PcdGet32 (PcdSetupConOutRow);
+
+ mBmmModeInitialized = TRUE;
+}
+
+/**
Install Boot Maintenance Manager Menu driver.
@@ -1365,6 +1438,8 @@ BootMaintenanceManagerUiLibConstructor (
//
InitializeBmmConfig(mBmmCallbackInfo);
+ BmmInitialBootModeInfo();
+
return EFI_SUCCESS;
}
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
index 25f990e..6f2cda3 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
@@ -101,4 +101,6 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutColumn ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow ## CONSUMES \ No newline at end of file
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution ## CONSUMES