Reviewed-by: Liming Gao <liming....@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Dandan Bi
> Sent: Tuesday, October 11, 2016 3:31 PM
> To: edk2-devel@lists.01.org
> Cc: Dong, Eric <eric.d...@intel.com>; Gao, Liming <liming....@intel.com>
> Subject: [edk2] [patch] 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 river with EFI_BROWSER_ACTION_CHANGED callback.
> 
> Cc: Liming Gao <liming....@intel.com>
> Cc: Eric Dong <eric.d...@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Dandan Bi <dandan...@intel.com>
> ---
>  MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 29
> ++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
> b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
> index 3f368b5..b974bd0 100644
> --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
> +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
> @@ -3273,10 +3273,11 @@ SubmitForForm (
>            ConfigInfo->SyncConfigRequest = NULL;
>          }
> 
>          Status = EFI_SUCCESS;
>        }
> +      SendDiscardInfoToDriver (FormSet,Form);
>      } else {
>        Status = EFI_UNSUPPORTED;
>      }
> 
>      //
> @@ -3334,13 +3335,15 @@ SubmitForFormSet (
>    FORMSET_STORAGE         *FormSetStorage;
>    FORM_BROWSER_FORM       *Form;
>    BOOLEAN                 HasInserted;
>    FORM_BROWSER_STATEMENT  *Question;
>    BOOLEAN                 SubmitFormSetFail;
> +  BOOLEAN                 DiscardChange;
> 
>    HasInserted = FALSE;
>    SubmitFormSetFail = FALSE;
> +  DiscardChange     = FALSE;
> 
>    if (!IsNvUpdateRequiredForFormSet (FormSet)) {
>      return EFI_SUCCESS;
>    }
> 
> @@ -3437,10 +3440,11 @@ SubmitForFormSet (
>      if (!SkipProcessFail) {
>        //
>        // 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);
>            Storage        = FormSetStorage->BrowserStorage;
>            Link = GetNextNode (&FormSet->SaveFailStorageListHead, Link);
> @@ -3486,10 +3490,25 @@ SubmitForFormSet (
>        Status = EFI_UNSUPPORTED;
>      }
>    }
> 
>    //
> +  // 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.
>    //
>    ValueChangeResetFlagUpdate(TRUE, FormSet, NULL);
> 
>    //
> @@ -3604,10 +3623,20 @@ SubmitForSystem (
>              FormSetStorage->SyncConfigRequest = NULL;
>            }
>          }
>        }
> 
> +      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);
>          RemoveEntryList (&LocalFormSet->SaveFailLink);
>          DestroyFormSet (LocalFormSet);
> --
> 1.9.5.msysgit.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to