public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Check reset requirement before exiting UiApp
@ 2017-07-21  8:56 Dandan Bi
  2017-07-21  8:56 ` [PATCH v2 1/3] MdeModulePkg/SetupBrowser: Record the reset status in all SendForm Dandan Bi
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dandan Bi @ 2017-07-21  8:56 UTC (permalink / raw)
  To: edk2-devel; +Cc: Eric Dong, Liming Gao

V2: Refine the comments in patch 2 and 3.

Patch 1 enahce the IsResetRequired API to return to reset info in system level.
Patch 2 Check reset requirement before exiting UiApp (thorugh boot option).
Patch 3 Check reset requirement before exiting UiApp (through boot from file).

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Dandan Bi (3):
  MdeModulePkg/SetupBrowser: Record the reset status in all SendForm
  MdeModulePkg/BMUiLib: Check reset requirement before exiting UiApp
  MdeModulePkg/BMMUiLib: Check reset requirement before exiting UiApp

 .../BootMaintenanceManager.h                       |  1 +
 .../BootMaintenanceManagerUiLib.inf                |  3 +-
 .../BootMaintenanceManagerUiLib/BootOption.c       | 50 +++++++++++++++++++++
 .../Library/BootManagerUiLib/BootManager.c         | 52 +++++++++++++++++++++-
 .../Library/BootManagerUiLib/BootManager.h         |  4 +-
 .../Library/BootManagerUiLib/BootManagerUiLib.inf  |  3 +-
 .../Universal/SetupBrowserDxe/Presentation.c       |  9 ++--
 MdeModulePkg/Universal/SetupBrowserDxe/Setup.c     | 19 ++++----
 MdeModulePkg/Universal/SetupBrowserDxe/Setup.h     |  5 ++-
 9 files changed, 129 insertions(+), 17 deletions(-)

-- 
1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/3] MdeModulePkg/SetupBrowser: Record the reset status in all SendForm
  2017-07-21  8:56 [PATCH v2 0/3] Check reset requirement before exiting UiApp Dandan Bi
@ 2017-07-21  8:56 ` Dandan Bi
  2017-07-21  8:56 ` [PATCH v2 2/3] MdeModulePkg/BMUiLib: Check reset requirement before exiting UiApp Dandan Bi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Dandan Bi @ 2017-07-21  8:56 UTC (permalink / raw)
  To: edk2-devel; +Cc: Eric Dong, Liming Gao

After calling SendForm to enter front page, configuration change in some
driver may require system reset. Currently the reset status is saved in
SendForm level. Then SendForm can return the reset status.
IsResetRequired API also can return the reset status before exiting browser.
It return the reset status in current SendForm level now. But SendForm can
be recursive called by some module.so the reset status in previous SendForm
may be lost. Now change the IsResetRequired API to return the reset info no
matter the reset is caught in any SendForm.

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>
---
 MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c |  9 ++++++---
 MdeModulePkg/Universal/SetupBrowserDxe/Setup.c        | 19 +++++++++++--------
 MdeModulePkg/Universal/SetupBrowserDxe/Setup.h        |  5 +++--
 3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
index 08d46cf..97713eb 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
@@ -995,11 +995,12 @@ ProcessAction (
   if ((Action & BROWSER_ACTION_SUBMIT) == BROWSER_ACTION_SUBMIT) {
     SubmitForm (gCurrentSelection->FormSet, gCurrentSelection->Form, gBrowserSettingScope);
   }
 
   if ((Action & BROWSER_ACTION_RESET) == BROWSER_ACTION_RESET) {
-    gResetRequired = TRUE;
+    gResetRequiredFormLevel = TRUE;
+    gResetRequiredSystemLevel = TRUE;
   }
 
   if ((Action & BROWSER_ACTION_EXIT) == BROWSER_ACTION_EXIT) {
     //
     // Form Exit without saving, Similar to ESC Key.
@@ -2043,11 +2044,12 @@ ProcessCallBackFunction (
       switch (Action) {
       case EFI_BROWSER_ACTION_CHANGED:
         switch (ActionRequest) {
         case EFI_BROWSER_ACTION_REQUEST_RESET:
           DiscardFormIsRequired = TRUE;
-          gResetRequired = TRUE;
+          gResetRequiredFormLevel = TRUE;
+          gResetRequiredSystemLevel = TRUE;
           NeedExit              = TRUE;
           break;
 
         case EFI_BROWSER_ACTION_REQUEST_SUBMIT:
           SubmitFormIsRequired = TRUE;
@@ -2542,11 +2544,12 @@ SetupBrowser (
       // and process question success till here, trig the gResetFlag/gFlagReconnect.
       //
       if ((Status == EFI_SUCCESS) && 
           (Statement->Storage == NULL)) { 
         if ((Statement->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) != 0) {
-          gResetRequired = TRUE;
+          gResetRequiredFormLevel = TRUE;
+          gResetRequiredSystemLevel = TRUE;
         }
 
         if ((Statement->QuestionFlags & EFI_IFR_FLAG_RECONNECT_REQUIRED) != 0) {
           gFlagReconnect = TRUE;
         }
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 83dc2b8..89e06de 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -51,11 +51,12 @@ LIST_ENTRY      gBrowserFormSetList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserFor
 LIST_ENTRY      gBrowserHotKeyList  = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserHotKeyList);
 LIST_ENTRY      gBrowserStorageList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserStorageList);
 LIST_ENTRY      gBrowserSaveFailFormSetList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserSaveFailFormSetList);
 
 BOOLEAN               mSystemSubmit = FALSE;
-BOOLEAN               gResetRequired;
+BOOLEAN               gResetRequiredFormLevel;
+BOOLEAN               gResetRequiredSystemLevel = FALSE;
 BOOLEAN               gExitRequired;
 BOOLEAN               gFlagReconnect;
 BOOLEAN               gCallbackReconnect;
 BROWSER_SETTING_SCOPE gBrowserSettingScope = FormSetLevel;
 BOOLEAN               mBrowserScopeFirstSet = TRUE;
@@ -497,11 +498,11 @@ SendForm (
   // Save globals used by SendForm()
   //
   SaveBrowserContext ();
 
   gFlagReconnect = FALSE;
-  gResetRequired = FALSE;
+  gResetRequiredFormLevel = FALSE;
   gExitRequired  = FALSE;
   gCallbackReconnect = FALSE;
   Status         = EFI_SUCCESS;
   gEmptyString   = L"";
   gDisplayFormData.ScreenDimensions = (EFI_SCREEN_DESCRIPTOR *) ScreenDimensions;
@@ -577,11 +578,11 @@ SendForm (
     FreePool (Selection);
   }
 
   if (ActionRequest != NULL) {
     *ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
-    if (gResetRequired) {
+    if (gResetRequiredFormLevel) {
       *ActionRequest = EFI_BROWSER_ACTION_REQUEST_RESET;
     }
   }
 
   mFormDisplay->ExitDisplay();
@@ -2676,11 +2677,12 @@ UpdateFlagForForm (
     //
     // Only the changed data has been saved, then need to set the reset flag.
     //
     if (SetFlag && OldValue && !Question->ValueChanged) {
       if ((Question->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) != 0) {
-        gResetRequired = TRUE;
+        gResetRequiredFormLevel = TRUE;
+        gResetRequiredSystemLevel = TRUE;
       }
 
       if ((Question->QuestionFlags & EFI_IFR_FLAG_RECONNECT_REQUIRED) != 0) {
         gFlagReconnect = TRUE;
       }
@@ -5915,11 +5917,11 @@ SaveBrowserContext (
 
   //
   // Save FormBrowser context
   //
   Context->Selection            = gCurrentSelection;
-  Context->ResetRequired        = gResetRequired;
+  Context->ResetRequired        = gResetRequiredFormLevel;
   Context->FlagReconnect        = gFlagReconnect;
   Context->CallbackReconnect    = gCallbackReconnect;
   Context->ExitRequired         = gExitRequired;
   Context->HiiHandle            = mCurrentHiiHandle;
   Context->FormId               = mCurrentFormId;
@@ -5988,11 +5990,11 @@ RestoreBrowserContext (
 
   //
   // Restore FormBrowser context
   //
   gCurrentSelection     = Context->Selection;
-  gResetRequired        = Context->ResetRequired;
+  gResetRequiredFormLevel = Context->ResetRequired;
   gFlagReconnect        = Context->FlagReconnect;
   gCallbackReconnect    = Context->CallbackReconnect;
   gExitRequired         = Context->ExitRequired;
   mCurrentHiiHandle     = Context->HiiHandle;
   mCurrentFormId        = Context->FormId;
@@ -6463,11 +6465,12 @@ ExecuteAction (
 
   //
   // Executet the reset action.
   //
   if ((Action & BROWSER_ACTION_RESET) != 0) {
-    gResetRequired = TRUE;
+    gResetRequiredFormLevel = TRUE;
+    gResetRequiredSystemLevel = TRUE;
   }
 
   //
   // Executet the exit action.
   //
@@ -6563,8 +6566,8 @@ BOOLEAN
 EFIAPI
 IsResetRequired (
   VOID
   )
 {
-  return gResetRequired;
+  return gResetRequiredSystemLevel;
 }
 
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
index f1accdf..de140e9 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
@@ -1,9 +1,9 @@
 /** @file
 Private MACRO, structure and function definitions for Setup Browser module.
 
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 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
 which accompanies this distribution.  The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -578,11 +578,12 @@ extern EFI_HII_CONFIG_ROUTING_PROTOCOL   *mHiiConfigRouting;
 extern EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mPathFromText;
 extern EDKII_FORM_DISPLAY_ENGINE_PROTOCOL *mFormDisplay;
 
 extern BOOLEAN               gCallbackReconnect;
 extern BOOLEAN               gFlagReconnect;
-extern BOOLEAN               gResetRequired;
+extern BOOLEAN               gResetRequiredFormLevel;
+extern BOOLEAN               gResetRequiredSystemLevel;
 extern BOOLEAN               gExitRequired;
 extern LIST_ENTRY            gBrowserFormSetList;
 extern LIST_ENTRY            gBrowserHotKeyList;
 extern BROWSER_SETTING_SCOPE gBrowserSettingScope;
 extern EXIT_HANDLER          ExitHandlerFunction;
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/3] MdeModulePkg/BMUiLib: Check reset requirement before exiting UiApp
  2017-07-21  8:56 [PATCH v2 0/3] Check reset requirement before exiting UiApp Dandan Bi
  2017-07-21  8:56 ` [PATCH v2 1/3] MdeModulePkg/SetupBrowser: Record the reset status in all SendForm Dandan Bi
@ 2017-07-21  8:56 ` Dandan Bi
  2017-07-21  8:56 ` [PATCH v2 3/3] MdeModulePkg/BMMUiLib: " Dandan Bi
  2017-07-26  1:34 ` [PATCH v2 0/3] " Gao, Liming
  3 siblings, 0 replies; 5+ messages in thread
From: Dandan Bi @ 2017-07-21  8:56 UTC (permalink / raw)
  To: edk2-devel; +Cc: Eric Dong, Liming Gao

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>
---
 .../Library/BootManagerUiLib/BootManager.c         | 51 +++++++++++++++++++++-
 .../Library/BootManagerUiLib/BootManager.h         |  4 +-
 .../Library/BootManagerUiLib/BootManagerUiLib.inf  |  3 +-
 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,9 +1,9 @@
 /** @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
 http://opensource.org/licenses/bsd-license.php.
 
@@ -292,10 +292,54 @@ BmSetConsoleMode (
 
   return EFI_SUCCESS;
 }
 
 /**
+
+  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 
   types are ordered properly and re-position the following boot options just after
   the corresponding boot options with the same device type.
@@ -780,10 +824,15 @@ BootManagerCallback (
   //
   gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
   gST->ConOut->ClearScreen (gST->ConOut);
 
   //
+  //check any reset required change is applied? if yes, reset system
+  //
+  BmSetupResetReminder ();
+
+  //
   // parse the selected option
   //
   BmSetConsoleMode (FALSE);
   EfiBootManagerBoot (&BootOption[QuestionId - 1]);
   BmSetConsoleMode (TRUE);
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,9 +1,9 @@
 /** @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
 http://opensource.org/licenses/bsd-license.php.
 
@@ -18,10 +18,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Guid/MdeModuleHii.h>
 #include <Guid/GlobalVariable.h>
 
 #include <Protocol/HiiConfigAccess.h>
 #include <Protocol/DevicePathToText.h>
+#include <Protocol/FormBrowserEx2.h>
 
 #include <Library/PrintLib.h>
 #include <Library/DebugLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/UefiBootServicesTableLib.h>
@@ -53,10 +54,11 @@ typedef struct {
 
 #define BOOT_MANAGER_FORM_ID     0x1000
 
 #define LABEL_BOOT_OPTION        0x00
 #define LABEL_BOOT_OPTION_END    0x01
+#define MAX_STRING_LEN           200
 
 //
 // Variable created with this flag will be "Efi:...."
 //
 #define VAR_FLAG  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
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,9 +1,9 @@
 ## @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
 #  http://opensource.org/licenses/bsd-license.php.
 #  
@@ -54,10 +54,11 @@
   gEfiIfrFrontPageGuid                          ## CONSUMES ## GUID
 
 [Protocols]
   gEfiHiiConfigAccessProtocolGuid               ## CONSUMES
   gEfiDevicePathToTextProtocolGuid              ## CONSUMES
+  gEdkiiFormBrowserEx2ProtocolGuid              ## CONSUMES
 
 [FeaturePcd]
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow                         ## CONSUMES
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 3/3] MdeModulePkg/BMMUiLib: Check reset requirement before exiting UiApp
  2017-07-21  8:56 [PATCH v2 0/3] Check reset requirement before exiting UiApp Dandan Bi
  2017-07-21  8:56 ` [PATCH v2 1/3] MdeModulePkg/SetupBrowser: Record the reset status in all SendForm Dandan Bi
  2017-07-21  8:56 ` [PATCH v2 2/3] MdeModulePkg/BMUiLib: Check reset requirement before exiting UiApp Dandan Bi
@ 2017-07-21  8:56 ` Dandan Bi
  2017-07-26  1:34 ` [PATCH v2 0/3] " Gao, Liming
  3 siblings, 0 replies; 5+ messages in thread
From: Dandan Bi @ 2017-07-21  8:56 UTC (permalink / raw)
  To: edk2-devel; +Cc: Eric Dong, Liming Gao

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>
---
 .../BootMaintenanceManager.h                       |  1 +
 .../BootMaintenanceManagerUiLib.inf                |  3 +-
 .../BootMaintenanceManagerUiLib/BootOption.c       | 49 ++++++++++++++++++++++
 3 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
index a8d7a0f..99d1656 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
@@ -26,10 +26,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/LoadFile.h>
 #include <Protocol/HiiConfigAccess.h>
 #include <Protocol/SimpleFileSystem.h>
 #include <Protocol/SerialIo.h>
 #include <Protocol/DevicePathToText.h>
+#include <Protocol/FormBrowserEx2.h>
 
 #include <Library/PrintLib.h>
 #include <Library/DebugLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/UefiBootServicesTableLib.h>
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
index 6f2cda3..1c0c0e1 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
@@ -1,9 +1,9 @@
 ## @file
 #  Boot Maintenance 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
 #  http://opensource.org/licenses/bsd-license.php.
 #  
@@ -89,10 +89,11 @@
   gEfiSimpleFileSystemProtocolGuid              ## CONSUMES
   gEfiLoadFileProtocolGuid                      ## CONSUMES
   gEfiHiiConfigAccessProtocolGuid               ## CONSUMES
   gEfiSerialIoProtocolGuid                      ## CONSUMES
   gEfiDevicePathToTextProtocolGuid              ## CONSUMES
+  gEdkiiFormBrowserEx2ProtocolGuid              ## CONSUMES
 
 [FeaturePcd]
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow                  ## CONSUMES
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
index 890728a..8680a51 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
@@ -22,10 +22,55 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 /// Define the maximum characters that will be accepted.
 ///
 #define MAX_CHAR            480
 
 /**
+
+  Check whether a reset is needed, if reset is needed, Popup a menu to notice user.
+
+**/
+VOID
+BmmSetupResetReminder (
+  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_CHAR * sizeof (CHAR16));
+    ASSERT (StringBuffer1 != NULL);
+    StringBuffer2 = AllocateZeroPool (MAX_CHAR * sizeof (CHAR16));
+    ASSERT (StringBuffer2 != NULL);
+    StrCpyS (StringBuffer1, MAX_CHAR, L"Configuration changed. Reset to apply it Now.");
+    StrCpyS (StringBuffer2, MAX_CHAR, 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);
+  }
+}
+
+/**
   Create a menu entry by given menu type.
 
   @param MenuType        The Menu type to be created.
 
   @retval NULL           If failed to create the menu.
@@ -881,10 +926,14 @@ BootFromFile (
       );
     //
     // Since current no boot from removable media directly is allowed */
     //
     gST->ConOut->ClearScreen (gST->ConOut);
+    //
+    // Check whether need to reset system.
+    //
+    BmmSetupResetReminder ();
 
     BmmSetConsoleMode (FALSE);
     EfiBootManagerBoot (&BootOption);
     BmmSetConsoleMode (TRUE);
 
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/3] Check reset requirement before exiting UiApp
  2017-07-21  8:56 [PATCH v2 0/3] Check reset requirement before exiting UiApp Dandan Bi
                   ` (2 preceding siblings ...)
  2017-07-21  8:56 ` [PATCH v2 3/3] MdeModulePkg/BMMUiLib: " Dandan Bi
@ 2017-07-26  1:34 ` Gao, Liming
  3 siblings, 0 replies; 5+ messages in thread
From: Gao, Liming @ 2017-07-26  1:34 UTC (permalink / raw)
  To: Bi, Dandan, edk2-devel@lists.01.org; +Cc: Dong, Eric

Reviewed-by: Liming Gao <liming.gao@intel.com> for this serial.

>-----Original Message-----
>From: Bi, Dandan
>Sent: Friday, July 21, 2017 4:56 PM
>To: edk2-devel@lists.01.org
>Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [PATCH v2 0/3] Check reset requirement before exiting UiApp
>
>V2: Refine the comments in patch 2 and 3.
>
>Patch 1 enahce the IsResetRequired API to return to reset info in system level.
>Patch 2 Check reset requirement before exiting UiApp (thorugh boot option).
>Patch 3 Check reset requirement before exiting UiApp (through boot from
>file).
>
>Cc: Eric Dong <eric.dong@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>Dandan Bi (3):
>  MdeModulePkg/SetupBrowser: Record the reset status in all SendForm
>  MdeModulePkg/BMUiLib: Check reset requirement before exiting UiApp
>  MdeModulePkg/BMMUiLib: Check reset requirement before exiting UiApp
>
> .../BootMaintenanceManager.h                       |  1 +
> .../BootMaintenanceManagerUiLib.inf                |  3 +-
> .../BootMaintenanceManagerUiLib/BootOption.c       | 50
>+++++++++++++++++++++
> .../Library/BootManagerUiLib/BootManager.c         | 52
>+++++++++++++++++++++-
> .../Library/BootManagerUiLib/BootManager.h         |  4 +-
> .../Library/BootManagerUiLib/BootManagerUiLib.inf  |  3 +-
> .../Universal/SetupBrowserDxe/Presentation.c       |  9 ++--
> MdeModulePkg/Universal/SetupBrowserDxe/Setup.c     | 19 ++++----
> MdeModulePkg/Universal/SetupBrowserDxe/Setup.h     |  5 ++-
> 9 files changed, 129 insertions(+), 17 deletions(-)
>
>--
>1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-07-26  1:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-21  8:56 [PATCH v2 0/3] Check reset requirement before exiting UiApp Dandan Bi
2017-07-21  8:56 ` [PATCH v2 1/3] MdeModulePkg/SetupBrowser: Record the reset status in all SendForm Dandan Bi
2017-07-21  8:56 ` [PATCH v2 2/3] MdeModulePkg/BMUiLib: Check reset requirement before exiting UiApp Dandan Bi
2017-07-21  8:56 ` [PATCH v2 3/3] MdeModulePkg/BMMUiLib: " Dandan Bi
2017-07-26  1:34 ` [PATCH v2 0/3] " Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox