diff options
author | Dong, Eric <eric.dong@intel.com> | 2016-05-18 13:12:40 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2016-05-19 12:33:33 +0800 |
commit | cb9fcac0ea03f0d515e5138e38ae6bcb33b9acdc (patch) | |
tree | e365189f54533f21e4ebd720f5a041cb0efa60a4 /MdeModulePkg/Library | |
parent | 531c89a1edef39dc7cae02ab81d2d32d75937545 (diff) | |
download | edk2-cb9fcac0ea03f0d515e5138e38ae6bcb33b9acdc.zip edk2-cb9fcac0ea03f0d515e5138e38ae6bcb33b9acdc.tar.gz edk2-cb9fcac0ea03f0d515e5138e38ae6bcb33b9acdc.tar.bz2 |
MdeModulePkg BootManagerUiLib: Save mode info for later use.
In current code, we use different output modes for boot phase
and setup phase. When split BootManagerUiLib 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/Library')
-rw-r--r-- | MdeModulePkg/Library/BootManagerUiLib/BootManager.c | 74 | ||||
-rw-r--r-- | MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf | 5 |
2 files changed, 78 insertions, 1 deletions
diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c b/MdeModulePkg/Library/BootManagerUiLib/BootManager.c index 3ca3e74..73ca016 100644 --- a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c +++ b/MdeModulePkg/Library/BootManagerUiLib/BootManager.c @@ -31,6 +31,8 @@ UINT32 mBmSetupTextModeRow = 0; UINT32 mBmSetupHorizontalResolution = 0;
UINT32 mBmSetupVerticalResolution = 0;
+BOOLEAN mBmModeInitialized = FALSE;
+
CHAR16 *mDeviceTypeStr[] = {
L"Legacy BEV",
L"Legacy Floppy",
@@ -650,6 +652,77 @@ BootManagerRouteConfig ( }
/**
+ Initial the boot mode related parameters.
+
+**/
+VOID
+BmInitialBootModeInfo (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
+ UINTN BootTextColumn;
+ UINTN BootTextRow;
+
+ if (mBmModeInitialized) {
+ 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.
+ //
+ mBmBootHorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
+ mBmBootVerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
+ }
+
+ if (SimpleTextOut != NULL) {
+ Status = SimpleTextOut->QueryMode (
+ SimpleTextOut,
+ SimpleTextOut->Mode->Mode,
+ &BootTextColumn,
+ &BootTextRow
+ );
+ mBmBootTextModeColumn = (UINT32)BootTextColumn;
+ mBmBootTextModeRow = (UINT32)BootTextRow;
+ }
+
+ //
+ // Get user defined text mode for setup.
+ //
+ mBmSetupHorizontalResolution = PcdGet32 (PcdSetupVideoHorizontalResolution);
+ mBmSetupVerticalResolution = PcdGet32 (PcdSetupVideoVerticalResolution);
+ mBmSetupTextModeColumn = PcdGet32 (PcdSetupConOutColumn);
+ mBmSetupTextModeRow = PcdGet32 (PcdSetupConOutRow);
+
+ mBmModeInitialized = TRUE;
+}
+
+/**
This call back function is registered with Boot Manager formset.
When user selects a boot option, this call back function will
be triggered. The boot option is saved for later processing.
@@ -778,6 +851,7 @@ BootManagerUiLibConstructor ( );
ASSERT (gBootManagerPrivate.HiiHandle != NULL);
+ BmInitialBootModeInfo ();
return EFI_SUCCESS;
}
diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf b/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf index c5e1693..d2df24b 100644 --- a/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf +++ b/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf @@ -64,4 +64,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution ## CONSUMES
-
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutColumn ## CONSUMES ## SOMETIMES_PRODUCES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow ## CONSUMES ## SOMETIMES_PRODUCES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution ## CONSUMES
|