]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Use RETRIEVE instead of CHANGING for refresh question.
authorEric Dong <eric.dong@intel.com>
Wed, 25 Sep 2013 12:40:31 +0000 (12:40 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 25 Sep 2013 12:40:31 +0000 (12:40 +0000)
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14727 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
MdeModulePkg/Universal/SetupBrowserDxe/Setup.h

index 531829014433d4cec4f94edfc4a7348cccc720a1..8e6dff0dd4d395d1158a10a7d900fe81347d8648 100644 (file)
@@ -160,7 +160,7 @@ UpdateStatement (
   //\r
   // Question value may be changed, need invoke its Callback()\r
   //\r
   //\r
   // Question value may be changed, need invoke its Callback()\r
   //\r
-  ProcessCallBackFunction (gCurrentSelection, Statement, EFI_BROWSER_ACTION_CHANGING, FALSE);\r
+  ProcessCallBackFunction (gCurrentSelection, gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, EFI_BROWSER_ACTION_RETRIEVE, FALSE);\r
   \r
   if (mHiiPackageListUpdated) {\r
     //\r
   \r
   if (mHiiPackageListUpdated) {\r
     //\r
@@ -1364,7 +1364,7 @@ ProcessGotoOpCode (
   //\r
   // Check whether the device path string is a valid string.\r
   //\r
   //\r
   // Check whether the device path string is a valid string.\r
   //\r
-  if (Statement->HiiValue.Value.ref.DevicePath != 0 && StringPtr != NULL) {\r
+  if (Statement->HiiValue.Value.ref.DevicePath != 0 && StringPtr != NULL && StringPtr[0] != L'\0') {\r
     if (Selection->Form->ModalForm) {\r
       return Status;\r
     }\r
     if (Selection->Form->ModalForm) {\r
       return Status;\r
     }\r
@@ -2038,6 +2038,8 @@ FindNextMenu (
                                about the Selection, form and formset to be displayed.\r
                                On output, Selection return the screen item that is selected\r
                                by user.\r
                                about the Selection, form and formset to be displayed.\r
                                On output, Selection return the screen item that is selected\r
                                by user.\r
+  @param FormSet               The formset this question belong to.\r
+  @param Form                  The form this question belong to.\r
   @param Question              The Question which need to call.\r
   @param Action                The action request.\r
   @param SkipSaveOrDiscard     Whether skip save or discard action.\r
   @param Question              The Question which need to call.\r
   @param Action                The action request.\r
   @param SkipSaveOrDiscard     Whether skip save or discard action.\r
@@ -2048,6 +2050,8 @@ FindNextMenu (
 EFI_STATUS \r
 ProcessCallBackFunction (\r
   IN OUT UI_MENU_SELECTION               *Selection,\r
 EFI_STATUS \r
 ProcessCallBackFunction (\r
   IN OUT UI_MENU_SELECTION               *Selection,\r
+  IN     FORM_BROWSER_FORMSET            *FormSet,\r
+  IN     FORM_BROWSER_FORM               *Form,\r
   IN     FORM_BROWSER_STATEMENT          *Question,\r
   IN     EFI_BROWSER_ACTION              Action,\r
   IN     BOOLEAN                         SkipSaveOrDiscard\r
   IN     FORM_BROWSER_STATEMENT          *Question,\r
   IN     EFI_BROWSER_ACTION              Action,\r
   IN     BOOLEAN                         SkipSaveOrDiscard\r
@@ -2067,7 +2071,7 @@ ProcessCallBackFunction (
   EFI_IFR_TYPE_VALUE              BackUpValue;\r
   UINT8                           *BackUpBuffer;\r
 \r
   EFI_IFR_TYPE_VALUE              BackUpValue;\r
   UINT8                           *BackUpBuffer;\r
 \r
-  ConfigAccess = Selection->FormSet->ConfigAccess;\r
+  ConfigAccess = FormSet->ConfigAccess;\r
   SubmitFormIsRequired  = FALSE;\r
   SettingLevel          = FormSetLevel;\r
   DiscardFormIsRequired = FALSE;\r
   SubmitFormIsRequired  = FALSE;\r
   SettingLevel          = FormSetLevel;\r
   DiscardFormIsRequired = FALSE;\r
@@ -2080,10 +2084,10 @@ ProcessCallBackFunction (
     return EFI_SUCCESS;\r
   }\r
 \r
     return EFI_SUCCESS;\r
   }\r
 \r
-  Link = GetFirstNode (&Selection->Form->StatementListHead);\r
-  while (!IsNull (&Selection->Form->StatementListHead, Link)) {\r
+  Link = GetFirstNode (&Form->StatementListHead);\r
+  while (!IsNull (&Form->StatementListHead, Link)) {\r
     Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);\r
     Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);\r
-    Link = GetNextNode (&Selection->Form->StatementListHead, Link);\r
+    Link = GetNextNode (&Form->StatementListHead, Link);\r
 \r
     //\r
     // if Question != NULL, only process the question. Else, process all question in this form.\r
 \r
     //\r
     // if Question != NULL, only process the question. Else, process all question in this form.\r
@@ -2100,7 +2104,7 @@ ProcessCallBackFunction (
     // Check whether Statement is disabled.\r
     //\r
     if (Statement->Expression != NULL) {\r
     // Check whether Statement is disabled.\r
     //\r
     if (Statement->Expression != NULL) {\r
-      if (EvaluateExpressionList(Statement->Expression, TRUE, Selection->FormSet, Selection->Form) == ExpressDisable) {\r
+      if (EvaluateExpressionList(Statement->Expression, TRUE, FormSet, Form) == ExpressDisable) {\r
         continue;\r
       }\r
     }\r
         continue;\r
       }\r
     }\r
@@ -2188,7 +2192,7 @@ ProcessCallBackFunction (
       // "retrieve" should update to the question's temp buffer.\r
       //\r
       if (Action == EFI_BROWSER_ACTION_CHANGING || Action == EFI_BROWSER_ACTION_RETRIEVE) {\r
       // "retrieve" should update to the question's temp buffer.\r
       //\r
       if (Action == EFI_BROWSER_ACTION_CHANGING || Action == EFI_BROWSER_ACTION_RETRIEVE) {\r
-        SetQuestionValue(Selection->FormSet, Selection->Form, Statement, GetSetValueWithEditBuffer);\r
+        SetQuestionValue(FormSet, Form, Statement, GetSetValueWithEditBuffer);\r
       }\r
     } else {\r
       //\r
       }\r
     } else {\r
       //\r
@@ -2203,7 +2207,7 @@ ProcessCallBackFunction (
           CopyMem (&HiiValue->Value, &BackUpValue, sizeof (EFI_IFR_TYPE_VALUE));\r
         }\r
 \r
           CopyMem (&HiiValue->Value, &BackUpValue, sizeof (EFI_IFR_TYPE_VALUE));\r
         }\r
 \r
-        SetQuestionValue(Selection->FormSet, Selection->Form, Statement, GetSetValueWithEditBuffer);\r
+        SetQuestionValue(FormSet, Form, Statement, GetSetValueWithEditBuffer);\r
       }\r
 \r
       //\r
       }\r
 \r
       //\r
@@ -2212,7 +2216,7 @@ ProcessCallBackFunction (
       //\r
       if ((Action == EFI_BROWSER_ACTION_CHANGING && Status != EFI_UNSUPPORTED) || \r
            Action == EFI_BROWSER_ACTION_RETRIEVE) {\r
       //\r
       if ((Action == EFI_BROWSER_ACTION_CHANGING && Status != EFI_UNSUPPORTED) || \r
            Action == EFI_BROWSER_ACTION_RETRIEVE) {\r
-        GetQuestionValue(Selection->FormSet, Selection->Form, Statement, GetSetValueWithEditBuffer);\r
+        GetQuestionValue(FormSet, Form, Statement, GetSetValueWithEditBuffer);\r
       }\r
 \r
       if (Status == EFI_UNSUPPORTED) {\r
       }\r
 \r
       if (Status == EFI_UNSUPPORTED) {\r
@@ -2229,11 +2233,11 @@ ProcessCallBackFunction (
   }\r
 \r
   if (SubmitFormIsRequired && !SkipSaveOrDiscard) {\r
   }\r
 \r
   if (SubmitFormIsRequired && !SkipSaveOrDiscard) {\r
-    SubmitForm (Selection->FormSet, Selection->Form, SettingLevel);\r
+    SubmitForm (FormSet, Form, SettingLevel);\r
   }\r
 \r
   if (DiscardFormIsRequired && !SkipSaveOrDiscard) {\r
   }\r
 \r
   if (DiscardFormIsRequired && !SkipSaveOrDiscard) {\r
-    DiscardForm (Selection->FormSet, Selection->Form, SettingLevel);\r
+    DiscardForm (FormSet, Form, SettingLevel);\r
   }\r
 \r
   if (NeedExit) {\r
   }\r
 \r
   if (NeedExit) {\r
@@ -2335,6 +2339,11 @@ SetupBrowser (
     return Status;\r
   }\r
 \r
     return Status;\r
   }\r
 \r
+  if ((Selection->Handle != mCurrentHiiHandle) ||\r
+      (!CompareGuid (&Selection->FormSetGuid, &mCurrentFormSetGuid))) {\r
+    gFinishRetrieveCall = FALSE;\r
+  }\r
+\r
   //\r
   // Initialize current settings of Questions in this FormSet\r
   //\r
   //\r
   // Initialize current settings of Questions in this FormSet\r
   //\r
@@ -2413,7 +2422,7 @@ SetupBrowser (
       CopyGuid (&mCurrentFormSetGuid, &Selection->FormSetGuid);\r
       mCurrentFormId      = Selection->FormId;\r
 \r
       CopyGuid (&mCurrentFormSetGuid, &Selection->FormSetGuid);\r
       mCurrentFormId      = Selection->FormId;\r
 \r
-      Status = ProcessCallBackFunction (Selection, NULL, EFI_BROWSER_ACTION_FORM_OPEN, FALSE);\r
+      Status = ProcessCallBackFunction (Selection, gCurrentSelection->FormSet, Selection->Form, NULL, EFI_BROWSER_ACTION_FORM_OPEN, FALSE);\r
       if (EFI_ERROR (Status)) {\r
         goto Done;\r
       }\r
       if (EFI_ERROR (Status)) {\r
         goto Done;\r
       }\r
@@ -2436,6 +2445,11 @@ SetupBrowser (
       goto Done;\r
     }\r
 \r
       goto Done;\r
     }\r
 \r
+    //\r
+    // Finish call RETRIEVE callback for this formset.\r
+    //\r
+    gFinishRetrieveCall = TRUE;\r
+\r
     //\r
     // IFR is updated during callback of read value, force to reparse the IFR binary\r
     //\r
     //\r
     // IFR is updated during callback of read value, force to reparse the IFR binary\r
     //\r
@@ -2461,7 +2475,7 @@ SetupBrowser (
       if ((ConfigAccess != NULL) && \r
           ((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK) && \r
           (Statement->Operand != EFI_IFR_PASSWORD_OP)) {\r
       if ((ConfigAccess != NULL) && \r
           ((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK) && \r
           (Statement->Operand != EFI_IFR_PASSWORD_OP)) {\r
-        Status = ProcessCallBackFunction(Selection, Statement, EFI_BROWSER_ACTION_CHANGING, FALSE);\r
+        Status = ProcessCallBackFunction(Selection, Selection->FormSet, Selection->Form, Statement, EFI_BROWSER_ACTION_CHANGING, FALSE);\r
         if (Statement->Operand == EFI_IFR_REF_OP) {\r
           //\r
           // Process dynamic update ref opcode.\r
         if (Statement->Operand == EFI_IFR_REF_OP) {\r
           //\r
           // Process dynamic update ref opcode.\r
@@ -2483,7 +2497,7 @@ SetupBrowser (
         }\r
 \r
         if (!EFI_ERROR (Status) && Statement->Operand != EFI_IFR_REF_OP) {\r
         }\r
 \r
         if (!EFI_ERROR (Status) && Statement->Operand != EFI_IFR_REF_OP) {\r
-          ProcessCallBackFunction(Selection, Statement, EFI_BROWSER_ACTION_CHANGED, FALSE);\r
+          ProcessCallBackFunction(Selection, Selection->FormSet, Selection->Form, Statement, EFI_BROWSER_ACTION_CHANGED, FALSE);\r
         }\r
       } else if (Statement->Operand != EFI_IFR_PASSWORD_OP) {\r
         SetQuestionValue (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithEditBuffer);\r
         }\r
       } else if (Statement->Operand != EFI_IFR_PASSWORD_OP) {\r
         SetQuestionValue (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithEditBuffer);\r
@@ -2521,7 +2535,7 @@ SetupBrowser (
          (!CompareGuid (&Selection->FormSetGuid, &mCurrentFormSetGuid)) ||\r
          (Selection->FormId != mCurrentFormId))) {\r
 \r
          (!CompareGuid (&Selection->FormSetGuid, &mCurrentFormSetGuid)) ||\r
          (Selection->FormId != mCurrentFormId))) {\r
 \r
-      Status = ProcessCallBackFunction (Selection, NULL, EFI_BROWSER_ACTION_FORM_CLOSE, FALSE);\r
+      Status = ProcessCallBackFunction (Selection, Selection->FormSet, Selection->Form, NULL, EFI_BROWSER_ACTION_FORM_CLOSE, FALSE);\r
       if (EFI_ERROR (Status)) {\r
         goto Done;\r
       }\r
       if (EFI_ERROR (Status)) {\r
         goto Done;\r
       }\r
index 7cba785a8822d7d5e799c8be17a51446ffbb6faa..7975a1df19c9579fb050110d1b541a8161c2f24b 100644 (file)
@@ -48,6 +48,7 @@ LIST_ENTRY      gBrowserFormSetList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserFor
 LIST_ENTRY      gBrowserHotKeyList  = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserHotKeyList);\r
 LIST_ENTRY      gBrowserStorageList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserStorageList);\r
 \r
 LIST_ENTRY      gBrowserHotKeyList  = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserHotKeyList);\r
 LIST_ENTRY      gBrowserStorageList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserStorageList);\r
 \r
+BOOLEAN               gFinishRetrieveCall;\r
 BOOLEAN               gResetRequired;\r
 BOOLEAN               gExitRequired;\r
 BROWSER_SETTING_SCOPE gBrowserSettingScope = FormSetLevel;\r
 BOOLEAN               gResetRequired;\r
 BOOLEAN               gExitRequired;\r
 BROWSER_SETTING_SCOPE gBrowserSettingScope = FormSetLevel;\r
@@ -257,8 +258,11 @@ LoadAllHiiFormset (
   EFI_GUID                ZeroGuid;\r
   EFI_STATUS              Status;\r
   FORM_BROWSER_FORMSET    *OldFormset;\r
   EFI_GUID                ZeroGuid;\r
   EFI_STATUS              Status;\r
   FORM_BROWSER_FORMSET    *OldFormset;\r
+  BOOLEAN                 OldRetrieveValue;\r
 \r
   OldFormset = mSystemLevelFormSet;\r
 \r
   OldFormset = mSystemLevelFormSet;\r
+  OldRetrieveValue = gFinishRetrieveCall;\r
+  gFinishRetrieveCall = FALSE;\r
 \r
   //\r
   // Get all the Hii handles\r
 \r
   //\r
   // Get all the Hii handles\r
@@ -307,6 +311,7 @@ LoadAllHiiFormset (
   //\r
   FreePool (HiiHandles);\r
 \r
   //\r
   FreePool (HiiHandles);\r
 \r
+  gFinishRetrieveCall = OldRetrieveValue;\r
   mSystemLevelFormSet = OldFormset;\r
 }\r
 \r
   mSystemLevelFormSet = OldFormset;\r
 }\r
 \r
@@ -365,6 +370,7 @@ SendForm (
   //\r
   SaveBrowserContext ();\r
 \r
   //\r
   SaveBrowserContext ();\r
 \r
+  gFinishRetrieveCall = FALSE;\r
   gResetRequired = FALSE;\r
   gExitRequired  = FALSE;\r
   Status         = EFI_SUCCESS;\r
   gResetRequired = FALSE;\r
   gExitRequired  = FALSE;\r
   Status         = EFI_SUCCESS;\r
@@ -3651,7 +3657,8 @@ LoadFormConfig (
     // Call the Retrieve call back function for all questions.\r
     //\r
     if ((FormSet->ConfigAccess != NULL) && (Selection != NULL) &&\r
     // Call the Retrieve call back function for all questions.\r
     //\r
     if ((FormSet->ConfigAccess != NULL) && (Selection != NULL) &&\r
-        ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK)) {\r
+        ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK) &&\r
+        !gFinishRetrieveCall) {\r
       //\r
       // Check QuestionValue does exist.\r
       //\r
       //\r
       // Check QuestionValue does exist.\r
       //\r
@@ -3675,7 +3682,7 @@ LoadFormConfig (
                          );\r
       }\r
 \r
                          );\r
       }\r
 \r
-      Status = ProcessCallBackFunction(Selection, Question, EFI_BROWSER_ACTION_RETRIEVE, TRUE);\r
+      Status = ProcessCallBackFunction(Selection, FormSet, Form, Question, EFI_BROWSER_ACTION_RETRIEVE, TRUE);\r
     }\r
 \r
     //\r
     }\r
 \r
     //\r
index 7da21b713c4ae88f722315945008f932d806fd09..77a0ad1baccd3a4913417278714bc60194d07888 100644 (file)
@@ -541,7 +541,7 @@ extern EDKII_FORM_DISPLAY_ENGINE_PROTOCOL *mFormDisplay;
 \r
 extern BOOLEAN               gResetRequired;\r
 extern BOOLEAN               gExitRequired;\r
 \r
 extern BOOLEAN               gResetRequired;\r
 extern BOOLEAN               gExitRequired;\r
-\r
+extern BOOLEAN               gFinishRetrieveCall;\r
 extern LIST_ENTRY            gBrowserFormSetList;\r
 extern LIST_ENTRY            gBrowserHotKeyList;\r
 extern BROWSER_SETTING_SCOPE gBrowserSettingScope;\r
 extern LIST_ENTRY            gBrowserFormSetList;\r
 extern LIST_ENTRY            gBrowserHotKeyList;\r
 extern BROWSER_SETTING_SCOPE gBrowserSettingScope;\r
@@ -1157,7 +1157,9 @@ IsStorageDataChangedForFormSet (
                                about the Selection, form and formset to be displayed.\r
                                On output, Selection return the screen item that is selected\r
                                by user.\r
                                about the Selection, form and formset to be displayed.\r
                                On output, Selection return the screen item that is selected\r
                                by user.\r
-  @param Statement             The Question which need to call.\r
+  @param FormSet               The formset this question belong to.\r
+  @param Form                  The form this question belong to.\r
+  @param Question              The Question which need to call.\r
   @param Action                The action request.\r
   @param SkipSaveOrDiscard     Whether skip save or discard action.\r
 \r
   @param Action                The action request.\r
   @param SkipSaveOrDiscard     Whether skip save or discard action.\r
 \r
@@ -1167,6 +1169,8 @@ IsStorageDataChangedForFormSet (
 EFI_STATUS \r
 ProcessCallBackFunction (\r
   IN OUT UI_MENU_SELECTION               *Selection,\r
 EFI_STATUS \r
 ProcessCallBackFunction (\r
   IN OUT UI_MENU_SELECTION               *Selection,\r
+  IN     FORM_BROWSER_FORMSET            *FormSet,\r
+  IN     FORM_BROWSER_FORM               *Form,\r
   IN     FORM_BROWSER_STATEMENT          *Question,\r
   IN     EFI_BROWSER_ACTION              Action,\r
   IN     BOOLEAN                         SkipSaveOrDiscard\r
   IN     FORM_BROWSER_STATEMENT          *Question,\r
   IN     EFI_BROWSER_ACTION              Action,\r
   IN     BOOLEAN                         SkipSaveOrDiscard\r