diff options
author | Eric Dong <eric.dong@intel.com> | 2013-11-25 02:55:45 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-11-25 02:55:45 +0000 |
commit | fae736240cef700d99cd45c5596c6a188e0bdd4d (patch) | |
tree | 29c8dadc1a45f9dbe1de389ef87035eb996f9dff /MdeModulePkg | |
parent | d63a9eb477e67bbc6b344a99f2d14813b61d247a (diff) | |
download | edk2-fae736240cef700d99cd45c5596c6a188e0bdd4d.zip edk2-fae736240cef700d99cd45c5596c6a188e0bdd4d.tar.gz edk2-fae736240cef700d99cd45c5596c6a188e0bdd4d.tar.bz2 |
When need to find varstore in the storage list, based on the extra HiiHandle to find the storage.
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@14895 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c | 26 | ||||
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 56 | ||||
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/Setup.h | 3 |
3 files changed, 56 insertions, 29 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c index 4006fcd..ce2ba6f 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c @@ -348,9 +348,19 @@ InitializeConfigHdr ( /**
Find the global storage link base on the input storate type, name and guid.
+ For EFI_HII_VARSTORE_EFI_VARIABLE and EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER,
+ same guid + name = same storage
+
+ For EFI_HII_VARSTORE_NAME_VALUE:
+ same guid + HiiHandle = same storage
+
+ For EFI_HII_VARSTORE_BUFFER:
+ same guid + name + HiiHandle = same storage
+
@param StorageType Storage type.
@param StorageGuid Storage guid.
@param StorageName Storage Name.
+ @param HiiHandle HiiHandle for this varstore.
@return Pointer to a GLOBAL_STORAGE data structure.
@@ -359,7 +369,8 @@ BROWSER_STORAGE * FindStorageInList (
IN UINT8 StorageType,
IN EFI_GUID *StorageGuid,
- IN CHAR16 *StorageName
+ IN CHAR16 *StorageName,
+ IN EFI_HII_HANDLE HiiHandle
)
{
LIST_ENTRY *Link;
@@ -370,12 +381,16 @@ FindStorageInList ( BrowserStorage = BROWSER_STORAGE_FROM_LINK (Link);
if ((BrowserStorage->Type == StorageType) && CompareGuid (&BrowserStorage->Guid, StorageGuid)) {
- if (StorageType == EFI_HII_VARSTORE_NAME_VALUE) {
+ if (StorageType == EFI_HII_VARSTORE_NAME_VALUE && BrowserStorage->HiiHandle == HiiHandle) {
return BrowserStorage;
}
if (StrCmp (BrowserStorage->Name, StorageName) == 0) {
- return BrowserStorage;
+ if (StorageType == EFI_HII_VARSTORE_EFI_VARIABLE || StorageType == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) {
+ return BrowserStorage;
+ } else if (StorageType == EFI_HII_VARSTORE_BUFFER && BrowserStorage->HiiHandle == HiiHandle) {
+ return BrowserStorage;
+ }
}
}
@@ -494,7 +509,7 @@ CreateStorage ( Storage->Signature = FORMSET_STORAGE_SIGNATURE;
InsertTailList (&FormSet->StorageListHead, &Storage->Link);
- BrowserStorage = FindStorageInList(StorageType, StorageGuid, UnicodeString);
+ BrowserStorage = FindStorageInList(StorageType, StorageGuid, UnicodeString, FormSet->HiiHandle);
if (BrowserStorage == NULL) {
BrowserStorage = AllocateZeroPool (sizeof (BROWSER_STORAGE));
ASSERT (BrowserStorage != NULL);
@@ -508,7 +523,10 @@ CreateStorage ( BrowserStorage->Name = UnicodeString;
}
+ BrowserStorage->HiiHandle = FormSet->HiiHandle;
InitializeConfigHdr (FormSet, BrowserStorage);
+
+ BrowserStorage->Initialized = FALSE;
}
Storage->BrowserStorage = BrowserStorage;
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c index 7975a1d..f8ea4ff 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c @@ -645,6 +645,17 @@ BrowserCallback ( }
}
+ if (Storage->Type == EFI_HII_VARSTORE_NAME_VALUE ||
+ Storage->Type == EFI_HII_VARSTORE_BUFFER) {
+ if (mSystemLevelFormSet == NULL || mSystemLevelFormSet->HiiHandle == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ if (Storage->HiiHandle != mSystemLevelFormSet->HiiHandle) {
+ continue;
+ }
+ }
+
Status = ProcessStorage (&TotalSize, &ResultsData, RetrieveData, Storage);
if (EFI_ERROR (Status)) {
return Status;
@@ -3880,18 +3891,20 @@ CleanBrowserStorage ( Storage = FORMSET_STORAGE_FROM_LINK (Link);
Link = GetNextNode (&FormSet->StorageListHead, Link);
- if ((Storage->BrowserStorage->Type != EFI_HII_VARSTORE_BUFFER) &&
- (Storage->BrowserStorage->Type != EFI_HII_VARSTORE_NAME_VALUE) &&
- (Storage->BrowserStorage->Type != EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER)) {
- continue;
- }
+ if (Storage->BrowserStorage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) {
+ if (Storage->ConfigRequest == NULL || Storage->BrowserStorage->ConfigRequest == NULL) {
+ continue;
+ }
- if (Storage->ConfigRequest == NULL || Storage->BrowserStorage->ConfigRequest == NULL) {
- continue;
+ ConfigRequest = FormSet->QuestionInited ? Storage->ConfigRequest : Storage->ConfigElements;
+ RemoveConfigRequest (Storage->BrowserStorage, ConfigRequest);
+ } else if (Storage->BrowserStorage->Type == EFI_HII_VARSTORE_BUFFER ||
+ Storage->BrowserStorage->Type == EFI_HII_VARSTORE_NAME_VALUE) {
+ if (Storage->BrowserStorage->ConfigRequest != NULL) {
+ FreePool (Storage->BrowserStorage->ConfigRequest);
+ }
+ Storage->BrowserStorage->Initialized = FALSE;
}
-
- ConfigRequest = FormSet->QuestionInited ? Storage->ConfigRequest : Storage->ConfigElements;
- RemoveConfigRequest (Storage->BrowserStorage, ConfigRequest);
}
}
@@ -4269,22 +4282,12 @@ LoadStorage ( case EFI_HII_VARSTORE_BUFFER:
case EFI_HII_VARSTORE_NAME_VALUE:
//
- // Skip if there is no RequestElement
+ // Skip if there is no RequestElement or data has initilized.
//
- if (Storage->ElementCount == 0) {
+ if (Storage->ElementCount == 0 || Storage->BrowserStorage->Initialized) {
return;
}
- //
- // Adjust the ConfigRequest string, only the field not saved in BrowserStorage->AllConfig
- // will used to call ExtractConfig.
- // If not elements need to udpate, return.
- //
- if (!ConfigRequestAdjust(Storage)) {
- return;
- }
- ASSERT (Storage->ConfigElements != NULL);
-
Status = EFI_NOT_FOUND;
if (FormSet->ConfigAccess != NULL) {
//
@@ -4292,7 +4295,7 @@ LoadStorage ( //
Status = FormSet->ConfigAccess->ExtractConfig (
FormSet->ConfigAccess,
- Storage->ConfigElements,
+ Storage->ConfigRequest,
&Progress,
&Result
);
@@ -4315,10 +4318,13 @@ LoadStorage ( //
// Base on the configRequest string to get default value.
//
- GetDefaultForFormset (FormSet, Storage->BrowserStorage, Storage->ConfigElements);
+ GetDefaultForFormset (FormSet, Storage->BrowserStorage, Storage->ConfigRequest);
}
- SynchronizeStorage(FormSet, Storage->BrowserStorage, Storage->ConfigElements, TRUE);
+ SynchronizeStorage(FormSet, Storage->BrowserStorage, Storage->ConfigRequest, TRUE);
+
+ Storage->BrowserStorage->ConfigRequest = AllocateCopyPool (StrSize (Storage->ConfigRequest), Storage->ConfigRequest);
+ Storage->BrowserStorage->Initialized = TRUE;
break;
default:
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h index d6ee71d..9cb4653 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h @@ -136,6 +136,9 @@ typedef struct { UINT8 Type; // Storage type
+ BOOLEAN Initialized; // Whether this varstore is initialized, efi varstore not used.
+
+ EFI_HII_HANDLE HiiHandle; // HiiHandle for this varstore, efi varstore not used.
EFI_GUID Guid;
CHAR16 *Name; // For EFI_IFR_VARSTORE
|