public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Dandan Bi <dandan.bi@intel.com>
To: edk2-devel@lists.01.org
Cc: Eric Dong <eric.dong@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [patch 1/3] MdeModulePkg/SetupBrowser: Record the reset status in all SendForm
Date: Fri, 21 Jul 2017 13:39:00 +0800	[thread overview]
Message-ID: <1500615542-168644-2-git-send-email-dandan.bi@intel.com> (raw)
In-Reply-To: <1500615542-168644-1-git-send-email-dandan.bi@intel.com>

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



  reply	other threads:[~2017-07-21  5:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-21  5:38 [patch 0/3] Check reset requirement before exiting UiApp Dandan Bi
2017-07-21  5:39 ` Dandan Bi [this message]
2017-07-21  5:39 ` [patch 2/3] MdeModulePkg/BMUiLib: " Dandan Bi
2017-07-21  5:39 ` [patch 3/3] MdeModulePkg/BMMUiLib: " Dandan Bi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1500615542-168644-2-git-send-email-dandan.bi@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox