Support Framework IFR SELECT OP code.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10240 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2010-03-14 07:07:46 +00:00
parent 213fecefbb
commit 61a2420125
1 changed files with 40 additions and 0 deletions

View File

@ -860,9 +860,19 @@ FwUpdateDataToUefiUpdateData (
UINTN Index;
UINTN DataCount;
UINT8 *OpCodeBuffer;
LIST_ENTRY *StorageList;
FORMSET_STORAGE *Storage;
FORM_BROWSER_FORMSET *FormSet;
CHAR16 *DefaultVarStoreName;
UINT16 DefaultVarStoreId;
EFI_IFR_VARSTORE_SELECT *SelectVarOp;
FwOpCode = (FRAMEWORK_EFI_IFR_OP_HEADER *) &FwUpdateData->Data;
FormSet = ThunkContext->FormSet;
DefaultVarStoreId = FormSet->DefaultVarStoreId;
DefaultVarStoreName = FormSet->OriginalDefaultVarStoreName;
for (Index = 0; Index < FwUpdateData->DataCount; Index += DataCount) {
switch (FwOpCode->OpCode) {
case FRAMEWORK_EFI_IFR_SUBTITLE_OP:
@ -926,6 +936,31 @@ FwUpdateDataToUefiUpdateData (
OpCodeBuffer = F2UCreateNumericOpCode (UefiOpCodeHandle, ThunkContext, (FRAMEWORK_EFI_IFR_NUMERIC *) FwOpCode);
DataCount = 1;
break;
case EFI_IFR_VARSTORE_SELECT_OP:
OpCodeBuffer = (UINT8 *) FwOpCode;
SelectVarOp = (EFI_IFR_VARSTORE_SELECT *) FwOpCode;
//
// Check whether the selected VarId is in StorageList.
//
StorageList = GetFirstNode (&FormSet->StorageListHead);
while (!IsNull (&FormSet->StorageListHead, StorageList)) {
Storage = FORMSET_STORAGE_FROM_LINK (StorageList);
if (Storage->VarStoreId == SelectVarOp->VarId) {
break;
}
StorageList = GetNextNode (&FormSet->StorageListHead, StorageList);
}
ASSERT (!IsNull (&FormSet->StorageListHead, StorageList));
//
// Change VarStoreId to the selected VarId.
//
FormSet->DefaultVarStoreId = SelectVarOp->VarId;
if (SelectVarOp->VarId == DefaultVarStoreId) {
FormSet->OriginalDefaultVarStoreName = DefaultVarStoreName;
}
DataCount = 1;
break;
default:
ASSERT (FALSE);
@ -939,6 +974,11 @@ FwUpdateDataToUefiUpdateData (
FwOpCode = (FRAMEWORK_EFI_IFR_OP_HEADER *)((UINT8 *) FwOpCode + FwOpCode->Length);
}
//
// Revert FromSet default varstore ID.
//
FormSet->DefaultVarStoreId = DefaultVarStoreId;
FormSet->OriginalDefaultVarStoreName = DefaultVarStoreName;
return EFI_SUCCESS;
}