Fill all EFI_IFR_DATA_ARRAY fields before call FormCallBack function.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8982 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2009-07-23 09:27:17 +00:00
parent 1c9a755423
commit b6c72071c0

View File

@ -83,14 +83,15 @@ GetFirstStorageOfFormSet (
} }
/** /**
Get the EFI_IFR_VARSTORE where the Question's value is stored. Get the FORM_BROWSER_STATEMENT that matches the Question's value.
@param FormSet The Form Set. @param FormSet The Form Set.
@param QuestionId QuestionId
@retval FORMSET_STORAGE * The EFI_IFR_VARSTORE where the Question's value is stored. @retval FORM_BROWSER_STATEMENT* FORM_BROWSER_STATEMENT that match Question's value.
@retval NULL If the Form Set does not have EFI_IFR_VARSTORE. @retval NULL If the Form Set does not have EFI_IFR_VARSTORE.
**/ **/
FORMSET_STORAGE * FORM_BROWSER_STATEMENT *
GetStorageFromQuestionId ( GetStorageFromQuestionId (
IN CONST FORM_BROWSER_FORMSET * FormSet, IN CONST FORM_BROWSER_FORMSET * FormSet,
IN EFI_QUESTION_ID QuestionId IN EFI_QUESTION_ID QuestionId
@ -115,7 +116,7 @@ GetStorageFromQuestionId (
// UEFI Question ID is unique in a FormSet. // UEFI Question ID is unique in a FormSet.
// //
ASSERT (Statement->Storage->Type == EFI_HII_VARSTORE_BUFFER); ASSERT (Statement->Storage->Type == EFI_HII_VARSTORE_BUFFER);
return Statement->Storage; return Statement;
} }
StatementList = GetNextNode (&Form->StatementListHead, StatementList); StatementList = GetNextNode (&Form->StatementListHead, StatementList);
} }
@ -674,6 +675,7 @@ CreateIfrDataArray (
FORMSET_STORAGE *BufferStorage; FORMSET_STORAGE *BufferStorage;
UINTN Size; UINTN Size;
EFI_STRING String; EFI_STRING String;
FORM_BROWSER_STATEMENT *Statement;
*NvMapAllocated = FALSE; *NvMapAllocated = FALSE;
@ -707,19 +709,25 @@ CreateIfrDataArray (
IfrDataArray = AllocateZeroPool (sizeof (EFI_IFR_DATA_ARRAY) + sizeof (EFI_IFR_DATA_ENTRY) + Size); IfrDataArray = AllocateZeroPool (sizeof (EFI_IFR_DATA_ARRAY) + sizeof (EFI_IFR_DATA_ENTRY) + Size);
ASSERT (IfrDataArray != NULL); ASSERT (IfrDataArray != NULL);
IfrDataArray->EntryCount = 1;
IfrDataEntry = (EFI_IFR_DATA_ENTRY *) (IfrDataArray + 1);
BufferStorage = GetStorageFromQuestionId (ConfigAccess->ThunkContext->FormSet, QuestionId); Statement = GetStorageFromQuestionId (ConfigAccess->ThunkContext->FormSet, QuestionId);
if (BufferStorage == NULL) { if (Statement == NULL || Statement->Storage == NULL) {
// //
// The QuestionId is not associated with a Buffer Storage. // The QuestionId is not associated with a Buffer Storage.
// Try to get the first Buffer Storage then. // Try to get the first Buffer Storage then.
// //
BufferStorage = GetFirstStorageOfFormSet (ConfigAccess->ThunkContext->FormSet); BufferStorage = GetFirstStorageOfFormSet (ConfigAccess->ThunkContext->FormSet);
} else {
BufferStorage = Statement->Storage;
IfrDataEntry->OpCode = Statement->Operand;
} }
if (BufferStorage != NULL) { if (BufferStorage != NULL) {
BrowserDataSize = BufferStorage->Size; BrowserDataSize = BufferStorage->Size;
IfrDataEntry->Length = (UINT8) (sizeof (EFI_IFR_DATA_ENTRY) + Size);
if (ConfigAccess->ThunkContext->NvMapOverride == NULL) { if (ConfigAccess->ThunkContext->NvMapOverride == NULL) {
*NvMapAllocated = TRUE; *NvMapAllocated = TRUE;
@ -730,7 +738,6 @@ CreateIfrDataArray (
} }
ASSERT (HiiGetBrowserData (&BufferStorage->Guid, BufferStorage->Name, BrowserDataSize, (UINT8 *) IfrDataArray->NvRamMap)); ASSERT (HiiGetBrowserData (&BufferStorage->Guid, BufferStorage->Name, BrowserDataSize, (UINT8 *) IfrDataArray->NvRamMap));
IfrDataEntry = (EFI_IFR_DATA_ENTRY *) (IfrDataArray + 1);
switch (Type) { switch (Type) {
case EFI_IFR_TYPE_NUM_SIZE_8: case EFI_IFR_TYPE_NUM_SIZE_8:
@ -789,18 +796,21 @@ SyncBrowserDataForNvMapOverride (
FORMSET_STORAGE *BufferStorage; FORMSET_STORAGE *BufferStorage;
BOOLEAN CheckFlag; BOOLEAN CheckFlag;
UINTN BrowserDataSize; UINTN BrowserDataSize;
FORM_BROWSER_STATEMENT *Statement;
if (ConfigAccess->ThunkContext->NvMapOverride != NULL) { if (ConfigAccess->ThunkContext->NvMapOverride != NULL) {
BufferStorage = GetStorageFromQuestionId (ConfigAccess->ThunkContext->FormSet, QuestionId); Statement = GetStorageFromQuestionId (ConfigAccess->ThunkContext->FormSet, QuestionId);
if (BufferStorage == NULL) { if (Statement == NULL || Statement->Storage == NULL) {
// //
// QuestionId is a statement without Storage. // QuestionId is a statement without Storage.
// 1) It is a Goto. // 1) It is a Goto.
// //
// //
BufferStorage = GetFirstStorageOfFormSet (ConfigAccess->ThunkContext->FormSet); BufferStorage = GetFirstStorageOfFormSet (ConfigAccess->ThunkContext->FormSet);
} else {
BufferStorage = Statement->Storage;
} }
// //