summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2016-08-10 19:54:21 +0800
committerStar Zeng <star.zeng@intel.com>2016-08-11 15:36:44 +0800
commit7559672687b560e363a8849e13ec29491f2fbef9 (patch)
tree510665c27d2f991c2edaec6096c9e865b03e0d29 /MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
parent22f63ff641ae52019f5061fa20bcfdbb187eff62 (diff)
downloadedk2-platforms-7559672687b560e363a8849e13ec29491f2fbef9.tar.xz
MdeModulePkg/Browser: Share default if some default value are not specified
Add a new implementation policy of getting default value in SetupBrowser. The new policy is only for the situation that a question has default value but doesn't have default value for all supported default type. In this case, we will choose the smallest default id from the existing defaults, and share its value to other default id which has no default value. 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: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdeModulePkg/Universal/SetupBrowserDxe/Setup.c')
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 6b38547c5e..66c4313861 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -4050,9 +4050,14 @@ GetQuestionDefault (
INTN Action;
CHAR16 *NewString;
EFI_IFR_TYPE_VALUE *TypeValue;
+ UINT16 OriginalDefaultId;
+ FORMSET_DEFAULTSTORE *DefaultStore;
+ LIST_ENTRY *DefaultLink;
Status = EFI_NOT_FOUND;
StrValue = NULL;
+ OriginalDefaultId = DefaultId;
+ DefaultLink = GetFirstNode (&FormSet->DefaultStoreListHead);
//
// Statement don't have storage, skip them
@@ -4069,6 +4074,7 @@ GetQuestionDefault (
// 4, set flags of EFI_ONE_OF_OPTION (provide Standard and Manufacturing default)
// 5, set flags of EFI_IFR_CHECKBOX (provide Standard and Manufacturing default) (lowest priority)
//
+ReGetDefault:
HiiValue = &Question->HiiValue;
TypeValue = &HiiValue->Value;
if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {
@@ -4235,7 +4241,22 @@ GetQuestionDefault (
}
//
- // For Questions without default
+ // For question without default value for current default Id, we try to re-get the default value form other default id in the DefaultStoreList.
+ // If get, will exit the function, if not, will choose next default id in the DefaultStoreList.
+ // The default id in DefaultStoreList are in ascending order to make sure choose the smallest default id every time.
+ //
+ while (!IsNull(&FormSet->DefaultStoreListHead, DefaultLink)) {
+ DefaultStore = FORMSET_DEFAULTSTORE_FROM_LINK(DefaultLink);
+ DefaultLink = GetNextNode (&FormSet->DefaultStoreListHead,DefaultLink);
+ DefaultId = DefaultStore->DefaultId;
+ if (DefaultId == OriginalDefaultId) {
+ continue;
+ }
+ goto ReGetDefault;
+ }
+
+ //
+ // For Questions without default value for all the default id in the DefaultStoreList.
//
Status = EFI_NOT_FOUND;
switch (Question->Operand) {