mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 07:34:06 +02:00
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
This commit is contained in:
parent
d63a9eb477
commit
fae736240c
@ -348,9 +348,19 @@ InitializeConfigHdr (
|
|||||||
/**
|
/**
|
||||||
Find the global storage link base on the input storate type, name and guid.
|
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 StorageType Storage type.
|
||||||
@param StorageGuid Storage guid.
|
@param StorageGuid Storage guid.
|
||||||
@param StorageName Storage Name.
|
@param StorageName Storage Name.
|
||||||
|
@param HiiHandle HiiHandle for this varstore.
|
||||||
|
|
||||||
@return Pointer to a GLOBAL_STORAGE data structure.
|
@return Pointer to a GLOBAL_STORAGE data structure.
|
||||||
|
|
||||||
@ -359,7 +369,8 @@ BROWSER_STORAGE *
|
|||||||
FindStorageInList (
|
FindStorageInList (
|
||||||
IN UINT8 StorageType,
|
IN UINT8 StorageType,
|
||||||
IN EFI_GUID *StorageGuid,
|
IN EFI_GUID *StorageGuid,
|
||||||
IN CHAR16 *StorageName
|
IN CHAR16 *StorageName,
|
||||||
|
IN EFI_HII_HANDLE HiiHandle
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
LIST_ENTRY *Link;
|
LIST_ENTRY *Link;
|
||||||
@ -370,12 +381,16 @@ FindStorageInList (
|
|||||||
BrowserStorage = BROWSER_STORAGE_FROM_LINK (Link);
|
BrowserStorage = BROWSER_STORAGE_FROM_LINK (Link);
|
||||||
|
|
||||||
if ((BrowserStorage->Type == StorageType) && CompareGuid (&BrowserStorage->Guid, StorageGuid)) {
|
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;
|
return BrowserStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrCmp (BrowserStorage->Name, StorageName) == 0) {
|
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;
|
Storage->Signature = FORMSET_STORAGE_SIGNATURE;
|
||||||
InsertTailList (&FormSet->StorageListHead, &Storage->Link);
|
InsertTailList (&FormSet->StorageListHead, &Storage->Link);
|
||||||
|
|
||||||
BrowserStorage = FindStorageInList(StorageType, StorageGuid, UnicodeString);
|
BrowserStorage = FindStorageInList(StorageType, StorageGuid, UnicodeString, FormSet->HiiHandle);
|
||||||
if (BrowserStorage == NULL) {
|
if (BrowserStorage == NULL) {
|
||||||
BrowserStorage = AllocateZeroPool (sizeof (BROWSER_STORAGE));
|
BrowserStorage = AllocateZeroPool (sizeof (BROWSER_STORAGE));
|
||||||
ASSERT (BrowserStorage != NULL);
|
ASSERT (BrowserStorage != NULL);
|
||||||
@ -508,7 +523,10 @@ CreateStorage (
|
|||||||
BrowserStorage->Name = UnicodeString;
|
BrowserStorage->Name = UnicodeString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BrowserStorage->HiiHandle = FormSet->HiiHandle;
|
||||||
InitializeConfigHdr (FormSet, BrowserStorage);
|
InitializeConfigHdr (FormSet, BrowserStorage);
|
||||||
|
|
||||||
|
BrowserStorage->Initialized = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Storage->BrowserStorage = BrowserStorage;
|
Storage->BrowserStorage = BrowserStorage;
|
||||||
|
@ -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);
|
Status = ProcessStorage (&TotalSize, &ResultsData, RetrieveData, Storage);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
@ -3880,18 +3891,20 @@ CleanBrowserStorage (
|
|||||||
Storage = FORMSET_STORAGE_FROM_LINK (Link);
|
Storage = FORMSET_STORAGE_FROM_LINK (Link);
|
||||||
Link = GetNextNode (&FormSet->StorageListHead, Link);
|
Link = GetNextNode (&FormSet->StorageListHead, Link);
|
||||||
|
|
||||||
if ((Storage->BrowserStorage->Type != EFI_HII_VARSTORE_BUFFER) &&
|
if (Storage->BrowserStorage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) {
|
||||||
(Storage->BrowserStorage->Type != EFI_HII_VARSTORE_NAME_VALUE) &&
|
if (Storage->ConfigRequest == NULL || Storage->BrowserStorage->ConfigRequest == NULL) {
|
||||||
(Storage->BrowserStorage->Type != EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER)) {
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (Storage->ConfigRequest == NULL || Storage->BrowserStorage->ConfigRequest == NULL) {
|
ConfigRequest = FormSet->QuestionInited ? Storage->ConfigRequest : Storage->ConfigElements;
|
||||||
continue;
|
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_BUFFER:
|
||||||
case EFI_HII_VARSTORE_NAME_VALUE:
|
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;
|
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;
|
Status = EFI_NOT_FOUND;
|
||||||
if (FormSet->ConfigAccess != NULL) {
|
if (FormSet->ConfigAccess != NULL) {
|
||||||
//
|
//
|
||||||
@ -4292,7 +4295,7 @@ LoadStorage (
|
|||||||
//
|
//
|
||||||
Status = FormSet->ConfigAccess->ExtractConfig (
|
Status = FormSet->ConfigAccess->ExtractConfig (
|
||||||
FormSet->ConfigAccess,
|
FormSet->ConfigAccess,
|
||||||
Storage->ConfigElements,
|
Storage->ConfigRequest,
|
||||||
&Progress,
|
&Progress,
|
||||||
&Result
|
&Result
|
||||||
);
|
);
|
||||||
@ -4315,10 +4318,13 @@ LoadStorage (
|
|||||||
//
|
//
|
||||||
// Base on the configRequest string to get default value.
|
// 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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -136,6 +136,9 @@ typedef struct {
|
|||||||
|
|
||||||
UINT8 Type; // Storage type
|
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;
|
EFI_GUID Guid;
|
||||||
|
|
||||||
CHAR16 *Name; // For EFI_IFR_VARSTORE
|
CHAR16 *Name; // For EFI_IFR_VARSTORE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user