summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2012-06-12 03:27:45 +0000
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2012-06-12 03:27:45 +0000
commit3347d410cc16429118a39f354f985bf2ac009007 (patch)
treeb178f0d1119f7579156ef7561bf33c36c2fda297
parent856d643816fc04c5645bba4eafce4de675649c4f (diff)
downloadedk2-3347d410cc16429118a39f354f985bf2ac009007.tar.gz
edk2-3347d410cc16429118a39f354f985bf2ac009007.tar.bz2
edk2-3347d410cc16429118a39f354f985bf2ac009007.zip
Refine the logic about initialize questions value
Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13443 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.c42
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.h4
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Ui.c4
3 files changed, 33 insertions, 17 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index d4f3fa01d6..9f01cd3f1a 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -2974,6 +2974,7 @@ GetQuestionDefault (
@param Form Form data structure.
@param DefaultId The Class of the default.
@param SettingScope Setting Scope for Default action.
+ @param Storage Get default value only for this storage.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_UNSUPPORTED Unsupport SettingScope.
@@ -2984,7 +2985,8 @@ ExtractDefault (
IN FORM_BROWSER_FORMSET *FormSet,
IN FORM_BROWSER_FORM *Form,
IN UINT16 DefaultId,
- IN BROWSER_SETTING_SCOPE SettingScope
+ IN BROWSER_SETTING_SCOPE SettingScope,
+ IN FORMSET_STORAGE *Storage OPTIONAL
)
{
EFI_STATUS Status;
@@ -3012,7 +3014,14 @@ ExtractDefault (
while (!IsNull (&Form->StatementListHead, Link)) {
Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
Link = GetNextNode (&Form->StatementListHead, Link);
-
+
+ //
+ // If get default value only for this storage, check the storage first.
+ //
+ if ((Storage != NULL) && (Question->Storage != Storage)) {
+ continue;
+ }
+
//
// If Question is disabled, don't reset it to default
//
@@ -3046,7 +3055,7 @@ ExtractDefault (
FormLink = GetFirstNode (&FormSet->FormListHead);
while (!IsNull (&FormSet->FormListHead, FormLink)) {
Form = FORM_BROWSER_FORM_FROM_LINK (FormLink);
- ExtractDefault (FormSet, Form, DefaultId, FormLevel);
+ ExtractDefault (FormSet, Form, DefaultId, FormLevel, Storage);
FormLink = GetNextNode (&FormSet->FormListHead, FormLink);
}
} else if (SettingScope == SystemLevel) {
@@ -3117,7 +3126,7 @@ ExtractDefault (
Link = GetFirstNode (&gBrowserFormSetList);
while (!IsNull (&gBrowserFormSetList, Link)) {
LocalFormSet = FORM_BROWSER_FORMSET_FROM_LINK (Link);
- ExtractDefault (LocalFormSet, NULL, DefaultId, FormSetLevel);
+ ExtractDefault (LocalFormSet, NULL, DefaultId, FormSetLevel, Storage);
Link = GetNextNode (&gBrowserFormSetList, Link);
}
}
@@ -3403,12 +3412,6 @@ InitializeCurrentSetting (
EFI_STATUS Status;
//
- // Extract default from IFR binary
- //
- ExtractDefault (FormSet, NULL, EFI_HII_DEFAULT_CLASS_STANDARD, FormSetLevel);
- UpdateNvInfoInForm (FormSet, FALSE);
-
- //
// Request current settings from Configuration Driver
//
Link = GetFirstNode (&FormSet->StorageListHead);
@@ -3438,13 +3441,24 @@ InitializeCurrentSetting (
// Storage is not found in backup formset, request it from ConfigDriver
//
Status = LoadStorage (FormSet, Storage);
+
+ if (EFI_ERROR (Status)) {
+ //
+ // If get last time changed value failed, extract default from IFR binary
+ //
+ ExtractDefault (FormSet, NULL, EFI_HII_DEFAULT_CLASS_STANDARD, FormSetLevel, Storage);
+ //
+ // ExtractDefault will set the NV flag to TRUE, so need this function to clean the flag
+ // in current situation.
+ //
+ UpdateNvInfoInForm (FormSet, FALSE);
+ }
+
//
- // Now Edit Buffer is filled with default values(lower priority) and current
+ // Now Edit Buffer is filled with default values(lower priority) or current
// settings(higher priority), sychronize it to shadow Buffer
//
- if (!EFI_ERROR (Status)) {
- SynchronizeStorage (Storage, TRUE);
- }
+ SynchronizeStorage (Storage, TRUE);
} else {
//
// Storage found in backup formset, use it
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
index 6a5ddf1f2b..f043a6bbcd 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
@@ -1067,6 +1067,7 @@ InitializeFormSet (
@param Form Form data structure.
@param DefaultId The Class of the default.
@param SettingScope Setting Scope for Default action.
+ @param Storage Get default value only for this storage.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_UNSUPPORTED Unsupport SettingScope.
@@ -1077,7 +1078,8 @@ ExtractDefault (
IN FORM_BROWSER_FORMSET *FormSet,
IN FORM_BROWSER_FORM *Form,
IN UINT16 DefaultId,
- IN BROWSER_SETTING_SCOPE SettingScope
+ IN BROWSER_SETTING_SCOPE SettingScope,
+ IN FORMSET_STORAGE *Storage OPTIONAL
);
/**
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
index d59109317d..137115196c 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
@@ -3787,7 +3787,7 @@ UiDisplayMenu (
// Reterieve default setting. After it. NV flag will be showed.
//
if ((HotKey->Action & BROWSER_ACTION_DEFAULT) == BROWSER_ACTION_DEFAULT) {
- Status = ExtractDefault (Selection->FormSet, Selection->Form, HotKey->DefaultId, gBrowserSettingScope);
+ Status = ExtractDefault (Selection->FormSet, Selection->Form, HotKey->DefaultId, gBrowserSettingScope, NULL);
if (!EFI_ERROR (Status)) {
Selection->Action = UI_ACTION_REFRESH_FORM;
Selection->Statement = NULL;
@@ -3865,7 +3865,7 @@ UiDisplayMenu (
//
// Reset to default value for all forms in the whole system.
//
- Status = ExtractDefault (Selection->FormSet, NULL, DefaultId, FormSetLevel);
+ Status = ExtractDefault (Selection->FormSet, NULL, DefaultId, FormSetLevel, NULL);
if (!EFI_ERROR (Status)) {
Selection->Action = UI_ACTION_REFRESH_FORM;