summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorEric Dong <eric.dong@intel.com>2014-02-12 01:45:35 +0000
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2014-02-12 01:45:35 +0000
commit892eccc8d8697ada395b50738c099f8596a78d82 (patch)
treef189ddac7c1b3faeaaede94603b7617a4429cb6c /MdeModulePkg
parentc8d54a6d8dd259a28d02bf95ed7e48efb251e414 (diff)
Update the logic, only check the value change status for user input action, not detect the change caused by Hii driver change through SetBrowserData function.
Contributed-under: TianoCore Contribution Agreement 1.0 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@15229 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c102
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.c113
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.h31
3 files changed, 223 insertions, 23 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
index f8b1d5067..cdd32c0ed 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
@@ -1,7 +1,7 @@
/** @file
Utility functions for UI presentation.
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -964,6 +964,99 @@ GetBrowserStatement (
}
/**
+ Update the ValueChanged status for questions in this form.
+
+ @param FormSet FormSet data structure.
+ @param Form Form data structure.
+
+**/
+VOID
+UpdateStatementStatusForForm (
+ IN FORM_BROWSER_FORMSET *FormSet,
+ IN FORM_BROWSER_FORM *Form
+ )
+{
+ LIST_ENTRY *Link;
+ FORM_BROWSER_STATEMENT *Question;
+
+ Link = GetFirstNode (&Form->StatementListHead);
+ while (!IsNull (&Form->StatementListHead, Link)) {
+ Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
+ Link = GetNextNode (&Form->StatementListHead, Link);
+
+ IsQuestionValueChanged(FormSet, Form, Question, GetSetValueWithBuffer);
+ }
+}
+
+/**
+ Update the ValueChanged status for questions in this formset.
+
+ @param FormSet FormSet data structure.
+
+**/
+VOID
+UpdateStatementStatusForFormSet (
+ IN FORM_BROWSER_FORMSET *FormSet
+ )
+{
+ LIST_ENTRY *Link;
+ FORM_BROWSER_FORM *Form;
+
+ Link = GetFirstNode (&FormSet->FormListHead);
+ while (!IsNull (&FormSet->FormListHead, Link)) {
+ Form = FORM_BROWSER_FORM_FROM_LINK (Link);
+ Link = GetNextNode (&FormSet->FormListHead, Link);
+
+ UpdateStatementStatusForForm (FormSet, Form);
+ }
+}
+
+/**
+ Update the ValueChanged status for questions.
+
+ @param FormSet FormSet data structure.
+ @param Form Form data structure.
+ @param SettingScope Setting Scope for Default action.
+
+**/
+VOID
+UpdateStatementStatus (
+ IN FORM_BROWSER_FORMSET *FormSet,
+ IN FORM_BROWSER_FORM *Form,
+ IN BROWSER_SETTING_SCOPE SettingScope
+ )
+{
+ LIST_ENTRY *Link;
+ FORM_BROWSER_FORMSET *LocalFormSet;
+
+ switch (SettingScope) {
+ case SystemLevel:
+ Link = GetFirstNode (&gBrowserFormSetList);
+ while (!IsNull (&gBrowserFormSetList, Link)) {
+ LocalFormSet = FORM_BROWSER_FORMSET_FROM_LINK (Link);
+ Link = GetNextNode (&gBrowserFormSetList, Link);
+ if (!ValidateFormSet(LocalFormSet)) {
+ continue;
+ }
+
+ UpdateStatementStatusForFormSet (LocalFormSet);
+ }
+ break;
+
+ case FormSetLevel:
+ UpdateStatementStatusForFormSet (FormSet);
+ break;
+
+ case FormLevel:
+ UpdateStatementStatusForForm (FormSet, Form);
+ break;
+
+ default:
+ break;
+ }
+}
+
+/**
Process the action request in user input.
@@ -998,6 +1091,7 @@ ProcessAction (
if ((Action & BROWSER_ACTION_DEFAULT) == BROWSER_ACTION_DEFAULT) {
ExtractDefault (gCurrentSelection->FormSet, gCurrentSelection->Form, DefaultId, gBrowserSettingScope, GetDefaultForAll, NULL, FALSE);
+ UpdateStatementStatus (gCurrentSelection->FormSet, gCurrentSelection->Form, gBrowserSettingScope);
}
if ((Action & BROWSER_ACTION_SUBMIT) == BROWSER_ACTION_SUBMIT) {
@@ -1618,6 +1712,7 @@ ProcessUserInput (
// Reset Question to default value specified by DefaultId
//
Status = ExtractDefault (gCurrentSelection->FormSet, NULL, Statement->DefaultId, FormSetLevel, GetDefaultForAll, NULL, FALSE);
+ UpdateStatementStatus (gCurrentSelection->FormSet, NULL, FormSetLevel);
break;
default:
@@ -2493,6 +2588,11 @@ SetupBrowser (
} else if (Statement->Operand != EFI_IFR_PASSWORD_OP) {
SetQuestionValue (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithEditBuffer);
}
+
+ //
+ // Verify whether question value has checked, update the ValueChanged flag in Question.
+ //
+ IsQuestionValueChanged(gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithBuffer);
}
//
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 9b6111c03..cf1d57549 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -1787,14 +1787,6 @@ SetQuestionValue (
//
CopyMem (Storage->Buffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
}
- //
- // Check whether question value has been changed.
- //
- if (CompareMem (Storage->Buffer + Question->VarStoreInfo.VarOffset, Storage->EditBuffer + Question->VarStoreInfo.VarOffset, StorageWidth) != 0) {
- Question->ValueChanged = TRUE;
- } else {
- Question->ValueChanged = FALSE;
- }
} else {
if (IsString) {
//
@@ -1831,14 +1823,6 @@ SetQuestionValue (
if (EFI_ERROR (Status)) {
return Status;
}
- //
- // Check whether question value has been changed.
- //
- if (StrCmp (Node->Value, Node->EditValue) != 0) {
- Question->ValueChanged = TRUE;
- } else {
- Question->ValueChanged = FALSE;
- }
}
} else if (SetValueTo == GetSetValueWithHiiDriver) {
//
@@ -3453,6 +3437,8 @@ IsQuestionValueChanged (
FreePool (BackUpBuffer);
}
+ Question->ValueChanged = ValueChanged;
+
return ValueChanged;
}
@@ -3534,11 +3520,6 @@ LoadFormConfig (
Status = ProcessCallBackFunction(Selection, FormSet, Form, Question, EFI_BROWSER_ACTION_RETRIEVE, TRUE);
}
- //
- // Update Question Value changed flag.
- //
- Question->ValueChanged = IsQuestionValueChanged(FormSet, Form, Question, GetSetValueWithBuffer);
-
Link = GetNextNode (&Form->StatementListHead, Link);
}
@@ -4175,6 +4156,94 @@ LoadStorage (
}
/**
+ Get Value changed status from old question.
+
+ @param NewFormSet FormSet data structure.
+ @param OldQuestion Old question which has value changed.
+
+**/
+VOID
+SyncStatusForQuestion (
+ IN OUT FORM_BROWSER_FORMSET *NewFormSet,
+ IN FORM_BROWSER_STATEMENT *OldQuestion
+ )
+{
+ LIST_ENTRY *Link;
+ LIST_ENTRY *QuestionLink;
+ FORM_BROWSER_FORM *Form;
+ FORM_BROWSER_STATEMENT *Question;
+
+ //
+ // For each form in one formset.
+ //
+ Link = GetFirstNode (&NewFormSet->FormListHead);
+ while (!IsNull (&NewFormSet->FormListHead, Link)) {
+ Form = FORM_BROWSER_FORM_FROM_LINK (Link);
+ Link = GetNextNode (&NewFormSet->FormListHead, Link);
+
+ //
+ // for each question in one form.
+ //
+ QuestionLink = GetFirstNode (&Form->StatementListHead);
+ while (!IsNull (&Form->StatementListHead, QuestionLink)) {
+ Question = FORM_BROWSER_STATEMENT_FROM_LINK (QuestionLink);
+ QuestionLink = GetNextNode (&Form->StatementListHead, QuestionLink);
+
+ if (Question->QuestionId == OldQuestion->QuestionId) {
+ Question->ValueChanged = TRUE;
+ return;
+ }
+ }
+ }
+}
+
+/**
+ Get Value changed status from old formset.
+
+ @param NewFormSet FormSet data structure.
+ @param OldFormSet FormSet data structure.
+
+**/
+VOID
+SyncStatusForFormSet (
+ IN OUT FORM_BROWSER_FORMSET *NewFormSet,
+ IN FORM_BROWSER_FORMSET *OldFormSet
+ )
+{
+ LIST_ENTRY *Link;
+ LIST_ENTRY *QuestionLink;
+ FORM_BROWSER_FORM *Form;
+ FORM_BROWSER_STATEMENT *Question;
+
+ //
+ // For each form in one formset.
+ //
+ Link = GetFirstNode (&OldFormSet->FormListHead);
+ while (!IsNull (&OldFormSet->FormListHead, Link)) {
+ Form = FORM_BROWSER_FORM_FROM_LINK (Link);
+ Link = GetNextNode (&OldFormSet->FormListHead, Link);
+
+ //
+ // for each question in one form.
+ //
+ QuestionLink = GetFirstNode (&Form->StatementListHead);
+ while (!IsNull (&Form->StatementListHead, QuestionLink)) {
+ Question = FORM_BROWSER_STATEMENT_FROM_LINK (QuestionLink);
+ QuestionLink = GetNextNode (&Form->StatementListHead, QuestionLink);
+
+ if (!Question->ValueChanged) {
+ continue;
+ }
+
+ //
+ // Find the same question in new formset and update the value changed flag.
+ //
+ SyncStatusForQuestion (NewFormSet, Question);
+ }
+ }
+}
+
+/**
Get current setting of Questions.
@param FormSet FormSet data structure.
@@ -4195,6 +4264,7 @@ InitializeCurrentSetting (
//
OldFormSet = GetFormSetFromHiiHandle (FormSet->HiiHandle);
if (OldFormSet != NULL) {
+ SyncStatusForFormSet (FormSet, OldFormSet);
RemoveEntryList (&OldFormSet->Link);
DestroyFormSet (OldFormSet);
}
@@ -5000,6 +5070,7 @@ ExecuteAction (
if (EFI_ERROR (Status)) {
return Status;
}
+ UpdateStatementStatus (FormSet, Form, gBrowserSettingScope);
}
//
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
index 87305bad6..8fe9e98e6 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
@@ -1,7 +1,7 @@
/** @file
Private MACRO, structure and function definitions for Setup Browser module.
-Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -713,6 +713,35 @@ IsQuestionValueChanged (
);
/**
+ Validate the FormSet. If the formset is not validate, remove it from the list.
+
+ @param FormSet The input FormSet which need to validate.
+
+ @retval TRUE The handle is validate.
+ @retval FALSE The handle is invalidate.
+
+**/
+BOOLEAN
+ValidateFormSet (
+ FORM_BROWSER_FORMSET *FormSet
+ );
+
+/**
+ Update the ValueChanged status for questions.
+
+ @param FormSet FormSet data structure.
+ @param Form Form data structure.
+ @param SettingScope Setting Scope for Default action.
+
+**/
+VOID
+UpdateStatementStatus (
+ IN FORM_BROWSER_FORMSET *FormSet,
+ IN FORM_BROWSER_FORM *Form,
+ IN BROWSER_SETTING_SCOPE SettingScope
+ );
+
+/**
Get Question's current Value.
@param FormSet FormSet data structure.