mirror of https://github.com/acidanthera/audk.git
Check whether has storage for date/time opcode, if it has storage, also generate the offset/width info for it.
Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13473 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
d5bcf13e1d
commit
d9bbabfd13
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Implementation of interfaces function for EFI_HII_CONFIG_ROUTING_PROTOCOL.
|
||||
|
||||
Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -997,6 +997,8 @@ ParseIfrData (
|
|||
EFI_IFR_CHECKBOX *IfrCheckBox;
|
||||
EFI_IFR_PASSWORD *IfrPassword;
|
||||
EFI_IFR_STRING *IfrString;
|
||||
EFI_IFR_DATE *IfrDate;
|
||||
EFI_IFR_TIME *IfrTime;
|
||||
IFR_DEFAULT_DATA DefaultData;
|
||||
IFR_DEFAULT_DATA *DefaultDataPtr;
|
||||
IFR_BLOCK_DATA *BlockData;
|
||||
|
@ -1505,6 +1507,140 @@ ParseIfrData (
|
|||
InsertDefaultValue (BlockData, &DefaultData);
|
||||
break;
|
||||
|
||||
case EFI_IFR_DATE_OP:
|
||||
//
|
||||
// offset by question header
|
||||
// width MaxSize * sizeof (CHAR16)
|
||||
// no default value, only block array
|
||||
//
|
||||
|
||||
//
|
||||
// Date question is not in IFR Form. This IFR form is not valid.
|
||||
//
|
||||
if (VarStorageData->Size == 0) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto Done;
|
||||
}
|
||||
//
|
||||
// Check whether this question is for the requested varstore.
|
||||
//
|
||||
IfrDate = (EFI_IFR_DATE *) IfrOpHdr;
|
||||
if (IfrDate->Question.VarStoreId != VarStorageData->VarStoreId) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Get Offset/Width by Question header and OneOf Flags
|
||||
//
|
||||
VarOffset = IfrDate->Question.VarStoreInfo.VarOffset;
|
||||
VarWidth = (UINT16) sizeof (EFI_HII_DATE);
|
||||
|
||||
//
|
||||
// Check whether this question is in requested block array.
|
||||
//
|
||||
if (!BlockArrayCheck (RequestBlockArray, VarOffset, VarWidth)) {
|
||||
//
|
||||
// This question is not in the requested array. Skip it.
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Check this var question is in the var storage
|
||||
//
|
||||
if ((VarOffset + VarWidth) > VarStorageData->Size) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
//
|
||||
// Set Block Data
|
||||
//
|
||||
BlockData = (IFR_BLOCK_DATA *) AllocateZeroPool (sizeof (IFR_BLOCK_DATA));
|
||||
if (BlockData == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto Done;
|
||||
}
|
||||
BlockData->Offset = VarOffset;
|
||||
BlockData->Width = VarWidth;
|
||||
BlockData->QuestionId = IfrDate->Question.QuestionId;
|
||||
BlockData->OpCode = IfrOpHdr->OpCode;
|
||||
BlockData->Scope = IfrOpHdr->Scope;
|
||||
InitializeListHead (&BlockData->DefaultValueEntry);
|
||||
|
||||
//
|
||||
// Add Block Data into VarStorageData BlockEntry
|
||||
//
|
||||
InsertBlockData (&VarStorageData->BlockEntry, &BlockData);
|
||||
break;
|
||||
|
||||
case EFI_IFR_TIME_OP:
|
||||
//
|
||||
// offset by question header
|
||||
// width MaxSize * sizeof (CHAR16)
|
||||
// no default value, only block array
|
||||
//
|
||||
|
||||
//
|
||||
// Time question is not in IFR Form. This IFR form is not valid.
|
||||
//
|
||||
if (VarStorageData->Size == 0) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto Done;
|
||||
}
|
||||
//
|
||||
// Check whether this question is for the requested varstore.
|
||||
//
|
||||
IfrTime = (EFI_IFR_TIME *) IfrOpHdr;
|
||||
if (IfrTime->Question.VarStoreId != VarStorageData->VarStoreId) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Get Offset/Width by Question header and OneOf Flags
|
||||
//
|
||||
VarOffset = IfrTime->Question.VarStoreInfo.VarOffset;
|
||||
VarWidth = (UINT16) sizeof (EFI_HII_TIME);
|
||||
|
||||
//
|
||||
// Check whether this question is in requested block array.
|
||||
//
|
||||
if (!BlockArrayCheck (RequestBlockArray, VarOffset, VarWidth)) {
|
||||
//
|
||||
// This question is not in the requested array. Skip it.
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Check this var question is in the var storage
|
||||
//
|
||||
if ((VarOffset + VarWidth) > VarStorageData->Size) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
//
|
||||
// Set Block Data
|
||||
//
|
||||
BlockData = (IFR_BLOCK_DATA *) AllocateZeroPool (sizeof (IFR_BLOCK_DATA));
|
||||
if (BlockData == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto Done;
|
||||
}
|
||||
BlockData->Offset = VarOffset;
|
||||
BlockData->Width = VarWidth;
|
||||
BlockData->QuestionId = IfrTime->Question.QuestionId;
|
||||
BlockData->OpCode = IfrOpHdr->OpCode;
|
||||
BlockData->Scope = IfrOpHdr->Scope;
|
||||
InitializeListHead (&BlockData->DefaultValueEntry);
|
||||
|
||||
//
|
||||
// Add Block Data into VarStorageData BlockEntry
|
||||
//
|
||||
InsertBlockData (&VarStorageData->BlockEntry, &BlockData);
|
||||
break;
|
||||
|
||||
case EFI_IFR_STRING_OP:
|
||||
//
|
||||
// offset by question header
|
||||
|
|
Loading…
Reference in New Issue