MdeModulePkg/SetupBrowser: Send discard info to driver when fail to submit

When fail to submit data and user discard the change, we should send
the discard info to driver with EFI_BROWSER_ACTION_CHANGED callback.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Dandan Bi 2016-09-06 18:14:58 +08:00 committed by Star Zeng
parent dff49edc2b
commit b6f07bdd2a
1 changed files with 29 additions and 0 deletions

View File

@ -3275,6 +3275,7 @@ SubmitForForm (
Status = EFI_SUCCESS;
}
SendDiscardInfoToDriver (FormSet,Form);
} else {
Status = EFI_UNSUPPORTED;
}
@ -3336,9 +3337,11 @@ SubmitForFormSet (
BOOLEAN HasInserted;
FORM_BROWSER_STATEMENT *Question;
BOOLEAN SubmitFormSetFail;
BOOLEAN DiscardChange;
HasInserted = FALSE;
SubmitFormSetFail = FALSE;
DiscardChange = FALSE;
if (!IsNvUpdateRequiredForFormSet (FormSet)) {
return EFI_SUCCESS;
@ -3439,6 +3442,7 @@ SubmitForFormSet (
// If not in system level, just handl the save failed storage here.
//
if (ConfirmSaveFail (Form->FormTitle, FormSet->HiiHandle) == BROWSER_ACTION_DISCARD) {
DiscardChange = TRUE;
Link = GetFirstNode (&FormSet->SaveFailStorageListHead);
while (!IsNull (&FormSet->SaveFailStorageListHead, Link)) {
FormSetStorage = FORMSET_STORAGE_FROM_SAVE_FAIL_LINK (Link);
@ -3487,6 +3491,21 @@ SubmitForFormSet (
}
}
//
// If user discard the change, send the discard info to driver.
//
if (DiscardChange) {
Link = GetFirstNode (&FormSet->FormListHead);
while (!IsNull (&FormSet->FormListHead, Link)) {
Form = FORM_BROWSER_FORM_FROM_LINK (Link);
Link = GetNextNode (&FormSet->FormListHead, Link);
//
// Call callback with Changed type to inform the driver.
//
SendDiscardInfoToDriver (FormSet, Form);
}
}
//
// 5. Update the NV flag.
//
@ -3606,6 +3625,16 @@ SubmitForSystem (
}
}
Link = GetFirstNode (&LocalFormSet->FormListHead);
while (!IsNull (&LocalFormSet->FormListHead, Link)) {
Form = FORM_BROWSER_FORM_FROM_LINK (Link);
Link = GetNextNode (&LocalFormSet->FormListHead, Link);
//
// Call callback with Changed type to inform the driver.
//
SendDiscardInfoToDriver (LocalFormSet, Form);
}
if (!IsHiiHandleInBrowserContext (LocalFormSet->HiiHandle)) {
CleanBrowserStorage(LocalFormSet);
RemoveEntryList (&LocalFormSet->Link);