From 798e4d22c4db5b710ca5fa98f5ee47aeeae7f9ac Mon Sep 17 00:00:00 2001 From: Eric Dong Date: Wed, 25 Sep 2013 12:40:31 +0000 Subject: [PATCH] Use RETRIEVE instead of CHANGING for refresh question. Signed-off-by: Eric Dong Reviewed-by: Liming Gao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14727 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/SetupBrowserDxe/Presentation.c | 46 ++++++++++++------- .../Universal/SetupBrowserDxe/Setup.c | 11 ++++- .../Universal/SetupBrowserDxe/Setup.h | 8 +++- 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c index 5318290144..8e6dff0dd4 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c @@ -160,7 +160,7 @@ UpdateStatement ( // // Question value may be changed, need invoke its Callback() // - ProcessCallBackFunction (gCurrentSelection, Statement, EFI_BROWSER_ACTION_CHANGING, FALSE); + ProcessCallBackFunction (gCurrentSelection, gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, EFI_BROWSER_ACTION_RETRIEVE, FALSE); if (mHiiPackageListUpdated) { // @@ -1364,7 +1364,7 @@ ProcessGotoOpCode ( // // Check whether the device path string is a valid string. // - if (Statement->HiiValue.Value.ref.DevicePath != 0 && StringPtr != NULL) { + if (Statement->HiiValue.Value.ref.DevicePath != 0 && StringPtr != NULL && StringPtr[0] != L'\0') { if (Selection->Form->ModalForm) { return Status; } @@ -2038,6 +2038,8 @@ FindNextMenu ( about the Selection, form and formset to be displayed. On output, Selection return the screen item that is selected by user. + @param FormSet The formset this question belong to. + @param Form The form this question belong to. @param Question The Question which need to call. @param Action The action request. @param SkipSaveOrDiscard Whether skip save or discard action. @@ -2048,6 +2050,8 @@ FindNextMenu ( EFI_STATUS ProcessCallBackFunction ( IN OUT UI_MENU_SELECTION *Selection, + IN FORM_BROWSER_FORMSET *FormSet, + IN FORM_BROWSER_FORM *Form, IN FORM_BROWSER_STATEMENT *Question, IN EFI_BROWSER_ACTION Action, IN BOOLEAN SkipSaveOrDiscard @@ -2067,7 +2071,7 @@ ProcessCallBackFunction ( EFI_IFR_TYPE_VALUE BackUpValue; UINT8 *BackUpBuffer; - ConfigAccess = Selection->FormSet->ConfigAccess; + ConfigAccess = FormSet->ConfigAccess; SubmitFormIsRequired = FALSE; SettingLevel = FormSetLevel; DiscardFormIsRequired = FALSE; @@ -2080,10 +2084,10 @@ ProcessCallBackFunction ( return EFI_SUCCESS; } - Link = GetFirstNode (&Selection->Form->StatementListHead); - while (!IsNull (&Selection->Form->StatementListHead, Link)) { + Link = GetFirstNode (&Form->StatementListHead); + while (!IsNull (&Form->StatementListHead, Link)) { Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link); - Link = GetNextNode (&Selection->Form->StatementListHead, Link); + Link = GetNextNode (&Form->StatementListHead, Link); // // if Question != NULL, only process the question. Else, process all question in this form. @@ -2100,7 +2104,7 @@ ProcessCallBackFunction ( // Check whether Statement is disabled. // if (Statement->Expression != NULL) { - if (EvaluateExpressionList(Statement->Expression, TRUE, Selection->FormSet, Selection->Form) == ExpressDisable) { + if (EvaluateExpressionList(Statement->Expression, TRUE, FormSet, Form) == ExpressDisable) { continue; } } @@ -2188,7 +2192,7 @@ ProcessCallBackFunction ( // "retrieve" should update to the question's temp buffer. // if (Action == EFI_BROWSER_ACTION_CHANGING || Action == EFI_BROWSER_ACTION_RETRIEVE) { - SetQuestionValue(Selection->FormSet, Selection->Form, Statement, GetSetValueWithEditBuffer); + SetQuestionValue(FormSet, Form, Statement, GetSetValueWithEditBuffer); } } else { // @@ -2203,7 +2207,7 @@ ProcessCallBackFunction ( CopyMem (&HiiValue->Value, &BackUpValue, sizeof (EFI_IFR_TYPE_VALUE)); } - SetQuestionValue(Selection->FormSet, Selection->Form, Statement, GetSetValueWithEditBuffer); + SetQuestionValue(FormSet, Form, Statement, GetSetValueWithEditBuffer); } // @@ -2212,7 +2216,7 @@ ProcessCallBackFunction ( // if ((Action == EFI_BROWSER_ACTION_CHANGING && Status != EFI_UNSUPPORTED) || Action == EFI_BROWSER_ACTION_RETRIEVE) { - GetQuestionValue(Selection->FormSet, Selection->Form, Statement, GetSetValueWithEditBuffer); + GetQuestionValue(FormSet, Form, Statement, GetSetValueWithEditBuffer); } if (Status == EFI_UNSUPPORTED) { @@ -2229,11 +2233,11 @@ ProcessCallBackFunction ( } if (SubmitFormIsRequired && !SkipSaveOrDiscard) { - SubmitForm (Selection->FormSet, Selection->Form, SettingLevel); + SubmitForm (FormSet, Form, SettingLevel); } if (DiscardFormIsRequired && !SkipSaveOrDiscard) { - DiscardForm (Selection->FormSet, Selection->Form, SettingLevel); + DiscardForm (FormSet, Form, SettingLevel); } if (NeedExit) { @@ -2335,6 +2339,11 @@ SetupBrowser ( return Status; } + if ((Selection->Handle != mCurrentHiiHandle) || + (!CompareGuid (&Selection->FormSetGuid, &mCurrentFormSetGuid))) { + gFinishRetrieveCall = FALSE; + } + // // Initialize current settings of Questions in this FormSet // @@ -2413,7 +2422,7 @@ SetupBrowser ( CopyGuid (&mCurrentFormSetGuid, &Selection->FormSetGuid); mCurrentFormId = Selection->FormId; - Status = ProcessCallBackFunction (Selection, NULL, EFI_BROWSER_ACTION_FORM_OPEN, FALSE); + Status = ProcessCallBackFunction (Selection, gCurrentSelection->FormSet, Selection->Form, NULL, EFI_BROWSER_ACTION_FORM_OPEN, FALSE); if (EFI_ERROR (Status)) { goto Done; } @@ -2436,6 +2445,11 @@ SetupBrowser ( goto Done; } + // + // Finish call RETRIEVE callback for this formset. + // + gFinishRetrieveCall = TRUE; + // // IFR is updated during callback of read value, force to reparse the IFR binary // @@ -2461,7 +2475,7 @@ SetupBrowser ( if ((ConfigAccess != NULL) && ((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK) && (Statement->Operand != EFI_IFR_PASSWORD_OP)) { - Status = ProcessCallBackFunction(Selection, Statement, EFI_BROWSER_ACTION_CHANGING, FALSE); + Status = ProcessCallBackFunction(Selection, Selection->FormSet, Selection->Form, Statement, EFI_BROWSER_ACTION_CHANGING, FALSE); if (Statement->Operand == EFI_IFR_REF_OP) { // // Process dynamic update ref opcode. @@ -2483,7 +2497,7 @@ SetupBrowser ( } if (!EFI_ERROR (Status) && Statement->Operand != EFI_IFR_REF_OP) { - ProcessCallBackFunction(Selection, Statement, EFI_BROWSER_ACTION_CHANGED, FALSE); + ProcessCallBackFunction(Selection, Selection->FormSet, Selection->Form, Statement, EFI_BROWSER_ACTION_CHANGED, FALSE); } } else if (Statement->Operand != EFI_IFR_PASSWORD_OP) { SetQuestionValue (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithEditBuffer); @@ -2521,7 +2535,7 @@ SetupBrowser ( (!CompareGuid (&Selection->FormSetGuid, &mCurrentFormSetGuid)) || (Selection->FormId != mCurrentFormId))) { - Status = ProcessCallBackFunction (Selection, NULL, EFI_BROWSER_ACTION_FORM_CLOSE, FALSE); + Status = ProcessCallBackFunction (Selection, Selection->FormSet, Selection->Form, NULL, EFI_BROWSER_ACTION_FORM_CLOSE, FALSE); if (EFI_ERROR (Status)) { goto Done; } diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c index 7cba785a88..7975a1df19 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c @@ -48,6 +48,7 @@ LIST_ENTRY gBrowserFormSetList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserFor LIST_ENTRY gBrowserHotKeyList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserHotKeyList); LIST_ENTRY gBrowserStorageList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserStorageList); +BOOLEAN gFinishRetrieveCall; BOOLEAN gResetRequired; BOOLEAN gExitRequired; BROWSER_SETTING_SCOPE gBrowserSettingScope = FormSetLevel; @@ -257,8 +258,11 @@ LoadAllHiiFormset ( EFI_GUID ZeroGuid; EFI_STATUS Status; FORM_BROWSER_FORMSET *OldFormset; + BOOLEAN OldRetrieveValue; OldFormset = mSystemLevelFormSet; + OldRetrieveValue = gFinishRetrieveCall; + gFinishRetrieveCall = FALSE; // // Get all the Hii handles @@ -307,6 +311,7 @@ LoadAllHiiFormset ( // FreePool (HiiHandles); + gFinishRetrieveCall = OldRetrieveValue; mSystemLevelFormSet = OldFormset; } @@ -365,6 +370,7 @@ SendForm ( // SaveBrowserContext (); + gFinishRetrieveCall = FALSE; gResetRequired = FALSE; gExitRequired = FALSE; Status = EFI_SUCCESS; @@ -3651,7 +3657,8 @@ LoadFormConfig ( // Call the Retrieve call back function for all questions. // if ((FormSet->ConfigAccess != NULL) && (Selection != NULL) && - ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK)) { + ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK) && + !gFinishRetrieveCall) { // // Check QuestionValue does exist. // @@ -3675,7 +3682,7 @@ LoadFormConfig ( ); } - Status = ProcessCallBackFunction(Selection, Question, EFI_BROWSER_ACTION_RETRIEVE, TRUE); + Status = ProcessCallBackFunction(Selection, FormSet, Form, Question, EFI_BROWSER_ACTION_RETRIEVE, TRUE); } // diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h index 7da21b713c..77a0ad1bac 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h @@ -541,7 +541,7 @@ extern EDKII_FORM_DISPLAY_ENGINE_PROTOCOL *mFormDisplay; extern BOOLEAN gResetRequired; extern BOOLEAN gExitRequired; - +extern BOOLEAN gFinishRetrieveCall; extern LIST_ENTRY gBrowserFormSetList; extern LIST_ENTRY gBrowserHotKeyList; extern BROWSER_SETTING_SCOPE gBrowserSettingScope; @@ -1157,7 +1157,9 @@ IsStorageDataChangedForFormSet ( about the Selection, form and formset to be displayed. On output, Selection return the screen item that is selected by user. - @param Statement The Question which need to call. + @param FormSet The formset this question belong to. + @param Form The form this question belong to. + @param Question The Question which need to call. @param Action The action request. @param SkipSaveOrDiscard Whether skip save or discard action. @@ -1167,6 +1169,8 @@ IsStorageDataChangedForFormSet ( EFI_STATUS ProcessCallBackFunction ( IN OUT UI_MENU_SELECTION *Selection, + IN FORM_BROWSER_FORMSET *FormSet, + IN FORM_BROWSER_FORM *Form, IN FORM_BROWSER_STATEMENT *Question, IN EFI_BROWSER_ACTION Action, IN BOOLEAN SkipSaveOrDiscard