#include "Language.h"\r
#include "Hotkey.h"\r
\r
+BOOLEAN mSetupModeInitialized = FALSE;\r
+UINT32 mSetupTextModeColumn;\r
+UINT32 mSetupTextModeRow;\r
+UINT32 mSetupHorizontalResolution;\r
+UINT32 mSetupVerticalResolution;\r
+\r
BOOLEAN gConnectAllHappened = FALSE;\r
UINTN gCallbackKey;\r
\r
UINT32 MaxGopMode;\r
UINT32 MaxTextMode;\r
UINT32 ModeNumber;\r
- UINT32 SetupTextModeColumn;\r
- UINT32 SetupTextModeRow;\r
- UINT32 SetupHorizontalResolution;\r
- UINT32 SetupVerticalResolution;\r
UINTN HandleCount;\r
EFI_HANDLE *HandleBuffer;\r
EFI_STATUS Status;\r
}\r
\r
//\r
- // Get user defined text mode for setup.\r
+ // Get user defined text mode for setup only once.\r
// \r
- SetupHorizontalResolution = PcdGet32 (PcdSetupVideoHorizontalResolution);\r
- SetupVerticalResolution = PcdGet32 (PcdSetupVideoVerticalResolution); \r
- SetupTextModeColumn = PcdGet32 (PcdSetupConOutColumn);\r
- SetupTextModeRow = PcdGet32 (PcdSetupConOutRow);\r
+ if (!mSetupModeInitialized) {\r
+ mSetupHorizontalResolution = PcdGet32 (PcdSetupVideoHorizontalResolution);\r
+ mSetupVerticalResolution = PcdGet32 (PcdSetupVideoVerticalResolution); \r
+ mSetupTextModeColumn = PcdGet32 (PcdSetupConOutColumn);\r
+ mSetupTextModeRow = PcdGet32 (PcdSetupConOutRow);\r
+ mSetupModeInitialized = TRUE;\r
+ }\r
\r
MaxGopMode = GraphicsOutput->Mode->MaxMode;\r
MaxTextMode = SimpleTextOut->Mode->MaxMode;\r
&Info\r
);\r
if (!EFI_ERROR (Status)) {\r
- if ((Info->HorizontalResolution == SetupHorizontalResolution) &&\r
- (Info->VerticalResolution == SetupVerticalResolution)) {\r
- if ((GraphicsOutput->Mode->Info->HorizontalResolution == SetupHorizontalResolution) &&\r
- (GraphicsOutput->Mode->Info->VerticalResolution == SetupVerticalResolution)) {\r
+ if ((Info->HorizontalResolution == mSetupHorizontalResolution) &&\r
+ (Info->VerticalResolution == mSetupVerticalResolution)) {\r
+ if ((GraphicsOutput->Mode->Info->HorizontalResolution == mSetupHorizontalResolution) &&\r
+ (GraphicsOutput->Mode->Info->VerticalResolution == mSetupVerticalResolution)) {\r
//\r
// If current video resolution is same with setup video resolution, \r
// then check if current text mode is same with setup text mode.\r
//\r
Status = SimpleTextOut->QueryMode (SimpleTextOut, SimpleTextOut->Mode->Mode, &CurrentColumn, &CurrentRow);\r
ASSERT_EFI_ERROR (Status);\r
- if (CurrentColumn == SetupTextModeColumn && CurrentRow == SetupTextModeRow) {\r
+ if (CurrentColumn == mSetupTextModeColumn && CurrentRow == mSetupTextModeRow) {\r
//\r
// Current text mode is same with setup text mode, text mode need not be change.\r
//\r
for (Index = 0; Index < MaxTextMode; Index++) {\r
Status = SimpleTextOut->QueryMode (SimpleTextOut, Index, &CurrentColumn, &CurrentRow);\r
if (!EFI_ERROR(Status)) {\r
- if ((CurrentColumn == SetupTextModeColumn) && (CurrentRow == SetupTextModeRow)) {\r
+ if ((CurrentColumn == mSetupTextModeColumn) && (CurrentRow == mSetupTextModeRow)) {\r
//\r
// setup text mode is supported, set it.\r
//\r
//\r
// Update text mode PCD.\r
//\r
- PcdSet32 (PcdConOutColumn, SetupTextModeColumn);\r
- PcdSet32 (PcdConOutRow, SetupTextModeRow);\r
+ PcdSet32 (PcdConOutColumn, mSetupTextModeColumn);\r
+ PcdSet32 (PcdConOutRow, mSetupTextModeRow);\r
FreePool (Info);\r
return EFI_SUCCESS;\r
}\r
// Set PCD to restart GraphicsConsole and Consplitter to change video resolution \r
// and produce new text mode based on new resolution.\r
//\r
- PcdSet32 (PcdVideoHorizontalResolution, SetupHorizontalResolution);\r
- PcdSet32 (PcdVideoVerticalResolution, SetupVerticalResolution);\r
- PcdSet32 (PcdConOutColumn, SetupTextModeColumn);\r
- PcdSet32 (PcdConOutRow, SetupTextModeRow);\r
+ PcdSet32 (PcdVideoHorizontalResolution, mSetupHorizontalResolution);\r
+ PcdSet32 (PcdVideoVerticalResolution, mSetupVerticalResolution);\r
+ PcdSet32 (PcdConOutColumn, mSetupTextModeColumn);\r
+ PcdSet32 (PcdConOutRow, mSetupTextModeRow);\r
\r
Status = gBS->LocateHandleBuffer (\r
ByProtocol,\r