From d9bbabfd13b77bac9e6524196f15de7115f482eb Mon Sep 17 00:00:00 2001 From: ydong10 Date: Tue, 26 Jun 2012 08:42:50 +0000 Subject: 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 Reviewed-by: Liming Gao git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13473 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/HiiDatabaseDxe/ConfigRouting.c | 138 ++++++++++++++++++++- 1 file changed, 137 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c index 356b730bed..c79a4c9ab8 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c @@ -1,7 +1,7 @@ /** @file Implementation of interfaces function for EFI_HII_CONFIG_ROUTING_PROTOCOL. -Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
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 -- cgit v1.2.3