mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 07:34:06 +02:00
Update configrequest string at runtime for dynamic created question.
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@15247 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
a6c0ad816a
commit
27c304f442
@ -1957,70 +1957,6 @@ IsNvUpdateRequiredForForm (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Check whether the storage data for current form set is changed.
|
|
||||||
|
|
||||||
@param FormSet FormSet data structure.
|
|
||||||
|
|
||||||
@retval TRUE Data is changed.
|
|
||||||
@retval FALSE Data is not changed.
|
|
||||||
**/
|
|
||||||
BOOLEAN
|
|
||||||
IsStorageDataChangedForFormSet (
|
|
||||||
IN FORM_BROWSER_FORMSET *FormSet
|
|
||||||
)
|
|
||||||
{
|
|
||||||
LIST_ENTRY *Link;
|
|
||||||
FORMSET_STORAGE *Storage;
|
|
||||||
BROWSER_STORAGE *BrowserStorage;
|
|
||||||
CHAR16 *ConfigRespNew;
|
|
||||||
CHAR16 *ConfigRespOld;
|
|
||||||
BOOLEAN RetVal;
|
|
||||||
|
|
||||||
RetVal = FALSE;
|
|
||||||
ConfigRespNew = NULL;
|
|
||||||
ConfigRespOld = NULL;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Request current settings from Configuration Driver
|
|
||||||
//
|
|
||||||
Link = GetFirstNode (&FormSet->StorageListHead);
|
|
||||||
while (!IsNull (&FormSet->StorageListHead, Link)) {
|
|
||||||
Storage = FORMSET_STORAGE_FROM_LINK (Link);
|
|
||||||
Link = GetNextNode (&FormSet->StorageListHead, Link);
|
|
||||||
|
|
||||||
BrowserStorage = Storage->BrowserStorage;
|
|
||||||
|
|
||||||
if (BrowserStorage->Type == EFI_HII_VARSTORE_EFI_VARIABLE) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Storage->ElementCount == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
StorageToConfigResp (BrowserStorage, &ConfigRespNew, Storage->ConfigRequest, TRUE);
|
|
||||||
StorageToConfigResp (BrowserStorage, &ConfigRespOld, Storage->ConfigRequest, FALSE);
|
|
||||||
ASSERT (ConfigRespNew != NULL && ConfigRespOld != NULL);
|
|
||||||
|
|
||||||
if (StrCmp (ConfigRespNew, ConfigRespOld) != 0) {
|
|
||||||
RetVal = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
FreePool (ConfigRespNew);
|
|
||||||
ConfigRespNew = NULL;
|
|
||||||
|
|
||||||
FreePool (ConfigRespOld);
|
|
||||||
ConfigRespOld = NULL;
|
|
||||||
|
|
||||||
if (RetVal) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return RetVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Find menu which will show next time.
|
Find menu which will show next time.
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ SendForm (
|
|||||||
//
|
//
|
||||||
// If no data is changed, don't need to save current FormSet into the maintain list.
|
// If no data is changed, don't need to save current FormSet into the maintain list.
|
||||||
//
|
//
|
||||||
if (!IsNvUpdateRequiredForFormSet (FormSet) && !IsStorageDataChangedForFormSet(FormSet)) {
|
if (!IsNvUpdateRequiredForFormSet (FormSet)) {
|
||||||
CleanBrowserStorage(FormSet);
|
CleanBrowserStorage(FormSet);
|
||||||
RemoveEntryList (&FormSet->Link);
|
RemoveEntryList (&FormSet->Link);
|
||||||
DestroyFormSet (FormSet);
|
DestroyFormSet (FormSet);
|
||||||
@ -4081,39 +4081,51 @@ LoadStorage (
|
|||||||
ConfigRequestAdjust(Storage);
|
ConfigRequestAdjust(Storage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Create the config request string to get all fields for this storage.
|
|
||||||
// Allocate and fill a buffer large enough to hold the <ConfigHdr> template
|
|
||||||
// followed by "&OFFSET=0&WIDTH=WWWW"followed by a Null-terminator
|
|
||||||
//
|
|
||||||
StrLen = StrSize (Storage->BrowserStorage->ConfigHdr) + 20 * sizeof (CHAR16);
|
|
||||||
ConfigRequest = AllocateZeroPool (StrLen);
|
|
||||||
ASSERT (ConfigRequest != NULL);
|
|
||||||
UnicodeSPrint (
|
|
||||||
ConfigRequest,
|
|
||||||
StrLen,
|
|
||||||
L"%s&OFFSET=0&WIDTH=%04x",
|
|
||||||
Storage->BrowserStorage->ConfigHdr,
|
|
||||||
Storage->BrowserStorage->Size);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
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 or data has initilized.
|
// Skip if there is no RequestElement.
|
||||||
//
|
//
|
||||||
if (Storage->ElementCount == 0 || Storage->BrowserStorage->Initialized) {
|
if (Storage->ElementCount == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Just update the ConfigRequest, if storage already initialized.
|
||||||
|
//
|
||||||
|
if (Storage->BrowserStorage->Initialized) {
|
||||||
|
ConfigRequestAdjust(Storage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Storage->BrowserStorage->Initialized = TRUE;
|
Storage->BrowserStorage->Initialized = TRUE;
|
||||||
ConfigRequest = Storage->ConfigRequest;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Storage->BrowserStorage->Type != EFI_HII_VARSTORE_NAME_VALUE) {
|
||||||
|
//
|
||||||
|
// Create the config request string to get all fields for this storage.
|
||||||
|
// Allocate and fill a buffer large enough to hold the <ConfigHdr> template
|
||||||
|
// followed by "&OFFSET=0&WIDTH=WWWW"followed by a Null-terminator
|
||||||
|
//
|
||||||
|
StrLen = StrSize (Storage->BrowserStorage->ConfigHdr) + 20 * sizeof (CHAR16);
|
||||||
|
ConfigRequest = AllocateZeroPool (StrLen);
|
||||||
|
ASSERT (ConfigRequest != NULL);
|
||||||
|
UnicodeSPrint (
|
||||||
|
ConfigRequest,
|
||||||
|
StrLen,
|
||||||
|
L"%s&OFFSET=0&WIDTH=%04x",
|
||||||
|
Storage->BrowserStorage->ConfigHdr,
|
||||||
|
Storage->BrowserStorage->Size);
|
||||||
|
} else {
|
||||||
|
ConfigRequest = Storage->ConfigRequest;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Request current settings from Configuration Driver
|
// Request current settings from Configuration Driver
|
||||||
//
|
//
|
||||||
@ -4149,7 +4161,7 @@ LoadStorage (
|
|||||||
//
|
//
|
||||||
SynchronizeStorage(FormSet, Storage->BrowserStorage, NULL, TRUE);
|
SynchronizeStorage(FormSet, Storage->BrowserStorage, NULL, TRUE);
|
||||||
|
|
||||||
if (Storage->BrowserStorage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) {
|
if (Storage->BrowserStorage->Type != EFI_HII_VARSTORE_NAME_VALUE) {
|
||||||
if (ConfigRequest != NULL) {
|
if (ConfigRequest != NULL) {
|
||||||
FreePool (ConfigRequest);
|
FreePool (ConfigRequest);
|
||||||
}
|
}
|
||||||
|
@ -1172,19 +1172,6 @@ IsNvUpdateRequiredForFormSet (
|
|||||||
IN FORM_BROWSER_FORMSET *FormSet
|
IN FORM_BROWSER_FORMSET *FormSet
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
Check whether the storage data for current form set is changed.
|
|
||||||
|
|
||||||
@param FormSet FormSet data structure.
|
|
||||||
|
|
||||||
@retval TRUE Data is changed.
|
|
||||||
@retval FALSE Data is not changed.
|
|
||||||
**/
|
|
||||||
BOOLEAN
|
|
||||||
IsStorageDataChangedForFormSet (
|
|
||||||
IN FORM_BROWSER_FORMSET *FormSet
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Call the call back function for the question and process the return action.
|
Call the call back function for the question and process the return action.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user