X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FSetupBrowserDxe%2FPresentation.c;h=356cd9cd9ab630514c25772c4dd59ec7bdb959f1;hb=8ab3c094b37472d60ff018900cdfc5a34cf9e5a8;hp=aa1fedc7b48a18602d7f0914c396b938ccb8eeff;hpb=40ad4b1a6bd2d17b6bd3f0a14f65392a7b7249a1;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c index aa1fedc7b4..356cd9cd9a 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c @@ -178,7 +178,7 @@ UpdateStatement ( **/ VOID EFIAPI -RefreshEventNotify( +RefreshEventNotifyForStatement( IN EFI_EVENT Event, IN VOID *Context ) @@ -190,6 +190,23 @@ RefreshEventNotify( gBS->SignalEvent (mValueChangedEvent); } +/** + Refresh the questions within this form. + + @param Event The event which has this function related. + @param Context The input context info related to this event or the status code return to the caller. +**/ +VOID +EFIAPI +RefreshEventNotifyForForm( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + gCurrentSelection->Action = UI_ACTION_REFRESH_FORMSET; + + gBS->SignalEvent (mValueChangedEvent); +} /** Create refresh hook event for statement which has refresh event or interval. @@ -198,7 +215,7 @@ RefreshEventNotify( **/ VOID -CreateRefreshEvent ( +CreateRefreshEventForStatement ( IN FORM_BROWSER_STATEMENT *Statement ) { @@ -212,7 +229,7 @@ CreateRefreshEvent ( Status = gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_CALLBACK, - RefreshEventNotify, + RefreshEventNotifyForStatement, Statement, &Statement->RefreshGuid, &RefreshEvent); @@ -224,6 +241,39 @@ CreateRefreshEvent ( InsertTailList(&mRefreshEventList, &EventNode->Link); } +/** + Create refresh hook event for form which has refresh event or interval. + + @param Form The form need to check. + +**/ +VOID +CreateRefreshEventForForm ( + IN FORM_BROWSER_FORM *Form + ) +{ + EFI_STATUS Status; + EFI_EVENT RefreshEvent; + FORM_BROWSER_REFRESH_EVENT_NODE *EventNode; + + // + // If question has refresh guid, create the notify function. + // + Status = gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + RefreshEventNotifyForForm, + Form, + &Form->RefreshGuid, + &RefreshEvent); + ASSERT_EFI_ERROR (Status); + + EventNode = AllocateZeroPool (sizeof (FORM_BROWSER_REFRESH_EVENT_NODE)); + ASSERT (EventNode != NULL); + EventNode->RefreshEvent = RefreshEvent; + InsertTailList(&mRefreshEventList, &EventNode->Link); +} + /** Initialize the Display statement structure data. @@ -308,7 +358,7 @@ InitializeDisplayStatement ( // Create the refresh event process function. // if (!CompareGuid (&Statement->RefreshGuid, &gZeroGuid)) { - CreateRefreshEvent (Statement); + CreateRefreshEventForStatement (Statement); } // @@ -495,6 +545,21 @@ AddStatementToDisplayForm ( InsertTailList(&gDisplayFormData.StatementListOSF, &DisplayStatement->DisplayLink); } + // + // treat formset as statement outside the form,get its opcode. + // + DisplayStatement = AllocateZeroPool (sizeof (FORM_DISPLAY_ENGINE_STATEMENT)); + ASSERT (DisplayStatement != NULL); + + DisplayStatement->Signature = FORM_DISPLAY_ENGINE_STATEMENT_SIGNATURE; + DisplayStatement->Version = FORM_DISPLAY_ENGINE_STATEMENT_VERSION_1; + DisplayStatement->OpCode = gCurrentSelection->FormSet->OpCode; + + InitializeListHead (&DisplayStatement->NestStatementList); + InitializeListHead (&DisplayStatement->OptionListHead); + + InsertTailList(&gDisplayFormData.StatementListOSF, &DisplayStatement->DisplayLink); + // // Process the statement in this form. // @@ -559,6 +624,16 @@ AddStatementToDisplayForm ( InsertTailList(&mRefreshEventList, &EventNode->Link); } + // + // Create the refresh event process function for Form. + // + if (!CompareGuid (&gCurrentSelection->Form->RefreshGuid, &gZeroGuid)) { + CreateRefreshEventForForm (gCurrentSelection->Form); + if (gDisplayFormData.FormRefreshEvent == NULL) { + gDisplayFormData.FormRefreshEvent = mValueChangedEvent; + } + } + // // Update hotkey list field. // @@ -1824,6 +1899,30 @@ FindNextMenu ( return TRUE; } +/** + Reconnect the controller. + + @param DriverHandle The controller handle which need to be reconnect. + + @retval TRUE do the reconnect behavior success. + @retval FALSE do the reconnect behavior failed. + +**/ +BOOLEAN +ReconnectController ( + IN EFI_HANDLE DriverHandle + ) +{ + EFI_STATUS Status; + + Status = gBS->DisconnectController(DriverHandle, NULL, NULL); + if (!EFI_ERROR (Status)) { + Status = gBS->ConnectController(DriverHandle, NULL, NULL, TRUE); + } + + return Status == EFI_SUCCESS; +} + /** Call the call back function for the question and process the return action. @@ -1995,6 +2094,10 @@ ProcessCallBackFunction ( SettingLevel = FormLevel; break; + case EFI_BROWSER_ACTION_REQUEST_RECONNECT: + gCallbackReconnect = TRUE; + break; + default: break; } @@ -2006,6 +2109,11 @@ ProcessCallBackFunction ( // Status = ValueChangedValidation (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement); if (!EFI_ERROR (Status)) { + // + //check whether the question value changed compared with edit buffer before updating edit buffer + // if changed, set the ValueChanged flag to TRUE,in order to trig the CHANGED callback function + // + IsQuestionValueChanged(gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithEditBuffer); // // According the spec, return value from call back of "changing" and // "retrieve" should update to the question's temp buffer. @@ -2043,6 +2151,11 @@ ProcessCallBackFunction ( // InternalStatus = ValueChangedValidation (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement); if (!EFI_ERROR (InternalStatus)) { + // + //check whether the question value changed compared with edit buffer before updating edit buffer + // if changed, set the ValueChanged flag to TRUE,in order to trig the CHANGED callback function + // + IsQuestionValueChanged(gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithEditBuffer); SetQuestionValue(FormSet, Form, Statement, GetSetValueWithEditBuffer); } } @@ -2085,6 +2198,28 @@ ProcessCallBackFunction ( } } + if (gCallbackReconnect && (EFI_BROWSER_ACTION_CHANGED == Action)) { + // + // Confirm changes with user first. + // + if (IsNvUpdateRequiredForFormSet(FormSet)) { + if (BROWSER_ACTION_DISCARD == PopupErrorMessage(BROWSER_RECONNECT_SAVE_CHANGES, NULL, NULL, NULL)) { + gCallbackReconnect = FALSE; + DiscardFormIsRequired = TRUE; + } else { + SubmitFormIsRequired = TRUE; + } + } else { + PopupErrorMessage(BROWSER_RECONNECT_REQUIRED, NULL, NULL, NULL); + } + + // + // Exit current formset before do the reconnect. + // + NeedExit = TRUE; + SettingLevel = FormSetLevel; + } + if (SubmitFormIsRequired && !SkipSaveOrDiscard) { SubmitForm (FormSet, Form, SettingLevel); } @@ -2377,10 +2512,6 @@ SetupBrowser ( } } - // - // Verify whether question value has checked, update the ValueChanged flag in Question. - // - IsQuestionValueChanged(gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithBuffer); if (!EFI_ERROR (Status) && (Statement->Operand != EFI_IFR_REF_OP) && @@ -2389,6 +2520,11 @@ SetupBrowser ( // Only question value has been changed, browser will trig CHANGED callback. // ProcessCallBackFunction(Selection, Selection->FormSet, Selection->Form, Statement, EFI_BROWSER_ACTION_CHANGED, FALSE); + // + //check whether the question value changed compared with buffer value + //if doesn't change ,set the ValueChanged flag to FALSE ,in order not to display the "configuration changed "information on the screen + // + IsQuestionValueChanged(gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithBuffer); } } else { // @@ -2405,13 +2541,18 @@ SetupBrowser ( } // - // If question has EFI_IFR_FLAG_RESET_REQUIRED flag and without storage and process question success till here, - // trig the gResetFlag. + // If question has EFI_IFR_FLAG_RESET_REQUIRED/EFI_IFR_FLAG_RECONNECT_REQUIRED flag and without storage + // and process question success till here, trig the gResetFlag/gFlagReconnect. // if ((Status == EFI_SUCCESS) && - (Statement->Storage == NULL) && - ((Statement->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) != 0)) { - gResetRequired = TRUE; + (Statement->Storage == NULL)) { + if ((Statement->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) != 0) { + gResetRequired = TRUE; + } + + if ((Statement->QuestionFlags & EFI_IFR_FLAG_RECONNECT_REQUIRED) != 0) { + gFlagReconnect = TRUE; + } } }