diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c index e4be921bd6..1f40058581 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c @@ -687,7 +687,10 @@ IsExpressionOpCode ( { if (((Operand >= EFI_IFR_EQ_ID_VAL_OP) && (Operand <= EFI_IFR_NOT_OP)) || ((Operand >= EFI_IFR_MATCH_OP) && (Operand <= EFI_IFR_SPAN_OP)) || - (Operand == EFI_IFR_CATENATE_OP) + (Operand == EFI_IFR_CATENATE_OP) || + (Operand == EFI_IFR_TO_LOWER_OP) || + (Operand == EFI_IFR_TO_UPPER_OP) || + (Operand == EFI_IFR_VERSION_OP) ) { return TRUE; } else { diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c index a35ca35df9..404bb31e10 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c @@ -597,6 +597,7 @@ InitializeBrowserStrings ( gPlusString = GetToken (STRING_TOKEN (PLUS_STRING), gHiiHandle); gMinusString = GetToken (STRING_TOKEN (MINUS_STRING), gHiiHandle); gAdjustNumber = GetToken (STRING_TOKEN (ADJUST_NUMBER), gHiiHandle); + gSaveChanges = GetToken (STRING_TOKEN (SAVE_CHANGES), gHiiHandle); return ; } @@ -637,6 +638,7 @@ FreeBrowserStrings ( SafeFreePool (gPlusString); SafeFreePool (gMinusString); SafeFreePool (gAdjustNumber); + SafeFreePool (gSaveChanges); return ; } @@ -857,6 +859,9 @@ SetupBrowser ( EFI_HII_VALUE *HiiValue; FORM_BROWSER_STATEMENT *Statement; EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess; + EFI_INPUT_KEY Key; + CHAR16 YesResponse; + CHAR16 NoResponse; gMenuRefreshHead = NULL; gResetRequired = FALSE; @@ -990,6 +995,32 @@ SetupBrowser ( // Force to reparse IFR binary of target Formset // Selection->Action = UI_ACTION_REFRESH_FORMSET; + + // + // Uncommitted data will be lost after IFR binary re-pasing, so confirm on whether to save + // + if (gNvUpdateRequired) { + Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); + + YesResponse = gYesResponse[0]; + NoResponse = gNoResponse[0]; + + do { + CreateDialog (3, TRUE, 0, NULL, &Key, gEmptyString, gSaveChanges, gEmptyString); + } while + ( + (Key.ScanCode != SCAN_ESC) && + ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (NoResponse | UPPER_LOWER_CASE_OFFSET)) && + ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (YesResponse | UPPER_LOWER_CASE_OFFSET)) + ); + + if ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (YesResponse | UPPER_LOWER_CASE_OFFSET)) { + // + // If the user hits the YesResponse key + // + SubmitForm (Selection->FormSet, Selection->Form); + } + } } } } while (Selection->Action == UI_ACTION_REFRESH_FORM); diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c b/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c index 3e2cd180f6..9329159b6a 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c @@ -328,6 +328,7 @@ ProcessOptions ( // // Initialize Option value array // + if (Question->BufferValue[0] == 0) { GetQuestionDefault (Selection->FormSet, Selection->Form, Question, 0); } diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c index fd5aee4ca1..f728d53910 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c @@ -24,7 +24,12 @@ SETUP_DRIVER_PRIVATE_DATA mPrivateData = { BrowserCallback }, { - UnicodeVSPrint + UnicodeVSPrint, + UnicodeVSPrintAsciiFormat, + UnicodeValueToString, + AsciiVSPrint, + AsciiVSPrintUnicodeFormat, + AsciiValueToString } }; @@ -39,7 +44,6 @@ UINTN gFunctionKeySetting; BOOLEAN gResetRequired; BOOLEAN gNvUpdateRequired; EFI_HII_HANDLE gHiiHandle; -BOOLEAN gFirstIn; UINT16 gDirection; EFI_SCREEN_DESCRIPTOR gScreenDimensions; BOOLEAN gUpArrow; @@ -76,6 +80,7 @@ CHAR16 *gMiniString; CHAR16 *gPlusString; CHAR16 *gMinusString; CHAR16 *gAdjustNumber; +CHAR16 *gSaveChanges; CHAR16 gPromptBlockWidth; CHAR16 gOptionBlockWidth; @@ -274,11 +279,8 @@ SendForm ( // // Ensure we are in Text mode // - if (gFirstIn) { - gFirstIn = FALSE; - gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)); - DisableQuietBoot (); - } + gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)); + DisableQuietBoot (); for (Index = 0; Index < HandleCount; Index++) { Selection = AllocateZeroPool (sizeof (UI_MENU_SELECTION)); @@ -576,7 +578,6 @@ InitializeSetup ( // // Initialize Driver private data // - gFirstIn = TRUE; BannerData = AllocateZeroPool (sizeof (BANNER_DATA)); ASSERT (BannerData != NULL); @@ -595,6 +596,19 @@ InitializeSetup ( // // Install Print protocol // + Status = gBS->InstallProtocolInterface ( + &mPrivateData.Handle, + &gEfiPrint2ProtocolGuid, + EFI_NATIVE_INTERFACE, + &mPrivateData.Print + ); + + // + // Install Ecp Print protocol, which is defined in + // Edk\Foundation\Protocol\Print\Print.h with protocol + // GUID of { 0xdf2d868e, 0x32fc, 0x4cf0, {0x8e, 0x6b, 0xff, 0xd9, 0x5d, 0x13, 0x43, 0xd0 }} + // This is support previous module that written to consume this protocol. + // Status = gBS->InstallProtocolInterface ( &mPrivateData.Handle, &gEfiPrintProtocolGuid, diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h index 60cd50f7fc..e41f953ac9 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h @@ -20,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include +#include #include #include #include @@ -172,7 +173,7 @@ typedef struct { // Produced protocol // EFI_FORM_BROWSER2_PROTOCOL FormBrowser2; - EFI_PRINT_PROTOCOL Print; + EFI_PRINT2_PROTOCOL Print; } SETUP_DRIVER_PRIVATE_DATA; @@ -454,7 +455,6 @@ extern UINTN gFunctionKeySetting; extern BOOLEAN gResetRequired; extern BOOLEAN gNvUpdateRequired; extern EFI_HII_HANDLE gHiiHandle; -extern BOOLEAN gFirstIn; extern UINT16 gDirection; extern EFI_SCREEN_DESCRIPTOR gScreenDimensions; extern BOOLEAN gUpArrow; @@ -491,6 +491,7 @@ extern CHAR16 *gMiniString; extern CHAR16 *gPlusString; extern CHAR16 *gMinusString; extern CHAR16 *gAdjustNumber; +extern CHAR16 *gSaveChanges; extern CHAR16 gPromptBlockWidth; extern CHAR16 gOptionBlockWidth; diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf b/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf index 784814419c..190b80c1e9 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf +++ b/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf @@ -69,6 +69,7 @@ [Protocols] gEfiPrintProtocolGuid # PROTOCOL ALWAYS_PRODUCED + gEfiPrint2ProtocolGuid gEfiHiiConfigAccessProtocolGuid gEfiHiiStringProtocolGuid gEfiFormBrowser2ProtocolGuid diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserStr.uni b/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserStr.uni index 5b5e282d84..adb33c599e 100644 Binary files a/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserStr.uni and b/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserStr.uni differ diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c index cd933e98e6..068a3e7f7f 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c @@ -2828,6 +2828,7 @@ UiDisplayMenu ( if (!EFI_ERROR (Status)) { Selection->Action = UI_ACTION_REFRESH_FORM; + Selection->Statement = NULL; // // Show NV update flag on status bar