]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/BMMUiLib: Check reset requirement before exiting UiApp
authorBi, Dandan <dandan.bi@intel.com>
Fri, 21 Jul 2017 08:56:03 +0000 (16:56 +0800)
committerLiming Gao <liming.gao@intel.com>
Thu, 27 Jul 2017 02:47:19 +0000 (10:47 +0800)
V2: Refine the comments.

In UI page, some configuration change may require system reset.
BootMaintenanceManagerUiLib 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>
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c

index a8d7a0f8d0f966058066da7a18636029b418b447..99d1656b9ed90535fcd822b1dd9af41e16ef7e93 100644 (file)
@@ -28,6 +28,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/SimpleFileSystem.h>\r
 #include <Protocol/SerialIo.h>\r
 #include <Protocol/DevicePathToText.h>\r
+#include <Protocol/FormBrowserEx2.h>\r
 \r
 #include <Library/PrintLib.h>\r
 #include <Library/DebugLib.h>\r
index 6f2cda33d2d4da59fc3d6aabe57927ea556f5f90..1c0c0e1aa19c9e95074db43edfbb1cb1253f61ad 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 #  Boot Maintenance Manager Library used by UiApp.\r
 #\r
-#  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>\r
 #  This program and the accompanying materials are licensed and made available under\r
 #  the terms and conditions of the BSD License that accompanies this distribution.\r
 #  The full text of the license may be found at\r
@@ -91,6 +91,7 @@
   gEfiHiiConfigAccessProtocolGuid               ## CONSUMES\r
   gEfiSerialIoProtocolGuid                      ## CONSUMES\r
   gEfiDevicePathToTextProtocolGuid              ## CONSUMES\r
+  gEdkiiFormBrowserEx2ProtocolGuid              ## CONSUMES\r
 \r
 [FeaturePcd]\r
 \r
index 890728aff5b69cfc2867b12633ceeed25c1178eb..8680a51d78c75cb4798632d828c733dc5f0b5d42 100644 (file)
@@ -23,6 +23,51 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 ///\r
 #define MAX_CHAR            480\r
 \r
+/**\r
+\r
+  Check whether a reset is needed, if reset is needed, Popup a menu to notice user.\r
+\r
+**/\r
+VOID\r
+BmmSetupResetReminder (\r
+  VOID\r
+  )\r
+{\r
+  EFI_INPUT_KEY                 Key;\r
+  CHAR16                        *StringBuffer1;\r
+  CHAR16                        *StringBuffer2;\r
+  EFI_STATUS                    Status;\r
+  EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL *FormBrowserEx2;\r
+\r
+  //\r
+  // Use BrowserEx2 protocol to check whether reset is required.\r
+  //\r
+  Status = gBS->LocateProtocol (&gEdkiiFormBrowserEx2ProtocolGuid, NULL, (VOID **) &FormBrowserEx2);\r
+\r
+  //\r
+  //check any reset required change is applied? if yes, reset system\r
+  //\r
+  if (!EFI_ERROR(Status) && FormBrowserEx2->IsResetRequired()) {\r
+    StringBuffer1 = AllocateZeroPool (MAX_CHAR * sizeof (CHAR16));\r
+    ASSERT (StringBuffer1 != NULL);\r
+    StringBuffer2 = AllocateZeroPool (MAX_CHAR * sizeof (CHAR16));\r
+    ASSERT (StringBuffer2 != NULL);\r
+    StrCpyS (StringBuffer1, MAX_CHAR, L"Configuration changed. Reset to apply it Now.");\r
+    StrCpyS (StringBuffer2, MAX_CHAR, L"Press ENTER to reset");\r
+    //\r
+    // Popup a menu to notice user\r
+    //\r
+    do {\r
+      CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL);\r
+    } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
+\r
+    FreePool (StringBuffer1);\r
+    FreePool (StringBuffer2);\r
+\r
+    gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);\r
+  }\r
+}\r
+\r
 /**\r
   Create a menu entry by given menu type.\r
 \r
@@ -883,6 +928,10 @@ BootFromFile (
     // Since current no boot from removable media directly is allowed */\r
     //\r
     gST->ConOut->ClearScreen (gST->ConOut);\r
+    //\r
+    // Check whether need to reset system.\r
+    //\r
+    BmmSetupResetReminder ();\r
 \r
     BmmSetConsoleMode (FALSE);\r
     EfiBootManagerBoot (&BootOption);\r