summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library/BootManagerUiLib
diff options
context:
space:
mode:
authorBi, Dandan <dandan.bi@intel.com>2017-07-21 16:56:02 +0800
committerLiming Gao <liming.gao@intel.com>2017-07-27 10:47:15 +0800
commitc51f5f17e6fc0a13481ba2696fcb53cfe4fa556f (patch)
tree73755ec7868e61f8b8e1174bfcdc69074879c6a3 /MdeModulePkg/Library/BootManagerUiLib
parentb2dcae4c57b01c6b30ad8c074b390e55867504f7 (diff)
downloadedk2-c51f5f17e6fc0a13481ba2696fcb53cfe4fa556f.zip
edk2-c51f5f17e6fc0a13481ba2696fcb53cfe4fa556f.tar.gz
edk2-c51f5f17e6fc0a13481ba2696fcb53cfe4fa556f.tar.bz2
MdeModulePkg/BMUiLib: Check reset requirement before exiting UiApp
V2: Refine the comments. In UI page, some configuration change may require system reset. BootManagerUiLib misses this check before exiting UiApp to boot other boot options. Now add the check. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdeModulePkg/Library/BootManagerUiLib')
-rw-r--r--MdeModulePkg/Library/BootManagerUiLib/BootManager.c51
-rw-r--r--MdeModulePkg/Library/BootManagerUiLib/BootManager.h4
-rw-r--r--MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf3
3 files changed, 55 insertions, 3 deletions
diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c b/MdeModulePkg/Library/BootManagerUiLib/BootManager.c
index bf872f8..8e77632 100644
--- a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c
+++ b/MdeModulePkg/Library/BootManagerUiLib/BootManager.c
@@ -1,7 +1,7 @@
/** @file
The boot manager reference implementation
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
@@ -294,6 +294,50 @@ BmSetConsoleMode (
}
/**
+
+ Check whether a reset is needed,if reset is needed, Popup a menu to notice user.
+
+**/
+VOID
+BmSetupResetReminder (
+ VOID
+ )
+{
+ EFI_INPUT_KEY Key;
+ CHAR16 *StringBuffer1;
+ CHAR16 *StringBuffer2;
+ EFI_STATUS Status;
+ EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL *FormBrowserEx2;
+
+ //
+ // Use BrowserEx2 protocol to check whether reset is required.
+ //
+ Status = gBS->LocateProtocol (&gEdkiiFormBrowserEx2ProtocolGuid, NULL, (VOID **) &FormBrowserEx2);
+ //
+ //check any reset required change is applied? if yes, reset system
+ //
+ if (!EFI_ERROR(Status) && FormBrowserEx2->IsResetRequired ()) {
+ StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
+ ASSERT (StringBuffer1 != NULL);
+ StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
+ ASSERT (StringBuffer2 != NULL);
+ StrCpyS (StringBuffer1, MAX_STRING_LEN, L"Configuration changed. Reset to apply it Now.");
+ StrCpyS (StringBuffer2, MAX_STRING_LEN, L"Press ENTER to reset");
+ //
+ // Popup a menu to notice user
+ //
+ do {
+ CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL);
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+
+ FreePool (StringBuffer1);
+ FreePool (StringBuffer2);
+
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
+ }
+}
+
+/**
Group the legacy boot options in the BootOption.
The routine assumes the boot options in the beginning that covers all the device
@@ -782,6 +826,11 @@ BootManagerCallback (
gST->ConOut->ClearScreen (gST->ConOut);
//
+ //check any reset required change is applied? if yes, reset system
+ //
+ BmSetupResetReminder ();
+
+ //
// parse the selected option
//
BmSetConsoleMode (FALSE);
diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManager.h b/MdeModulePkg/Library/BootManagerUiLib/BootManager.h
index 1bedff4..3adddf6 100644
--- a/MdeModulePkg/Library/BootManagerUiLib/BootManager.h
+++ b/MdeModulePkg/Library/BootManagerUiLib/BootManager.h
@@ -1,7 +1,7 @@
/** @file
The boot manager reference implementation
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
@@ -20,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/HiiConfigAccess.h>
#include <Protocol/DevicePathToText.h>
+#include <Protocol/FormBrowserEx2.h>
#include <Library/PrintLib.h>
#include <Library/DebugLib.h>
@@ -55,6 +56,7 @@ typedef struct {
#define LABEL_BOOT_OPTION 0x00
#define LABEL_BOOT_OPTION_END 0x01
+#define MAX_STRING_LEN 200
//
// Variable created with this flag will be "Efi:...."
diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf b/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
index d2df24b..7983b07 100644
--- a/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
+++ b/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
@@ -1,7 +1,7 @@
## @file
# Boot Manager Library used by UiApp.
#
-# Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials are licensed and made available under
# the terms and conditions of the BSD License that accompanies this distribution.
# The full text of the license may be found at
@@ -56,6 +56,7 @@
[Protocols]
gEfiHiiConfigAccessProtocolGuid ## CONSUMES
gEfiDevicePathToTextProtocolGuid ## CONSUMES
+ gEdkiiFormBrowserEx2ProtocolGuid ## CONSUMES
[FeaturePcd]