]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Check whether has storage for date/time opcode, if it has storage, also generate...
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Jun 2012 08:42:50 +0000 (08:42 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Jun 2012 08:42:50 +0000 (08:42 +0000)
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

MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c

index 356b730bedaeb8dec8e3f9e9049c95be130bf8fb..c79a4c9ab8f4b29b551e1995dd12631d52804c41 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Implementation of interfaces function for EFI_HII_CONFIG_ROUTING_PROTOCOL.\r
 \r
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -997,6 +997,8 @@ ParseIfrData (
   EFI_IFR_CHECKBOX         *IfrCheckBox;\r
   EFI_IFR_PASSWORD         *IfrPassword;\r
   EFI_IFR_STRING           *IfrString;\r
+  EFI_IFR_DATE             *IfrDate;\r
+  EFI_IFR_TIME             *IfrTime;\r
   IFR_DEFAULT_DATA         DefaultData;\r
   IFR_DEFAULT_DATA         *DefaultDataPtr;\r
   IFR_BLOCK_DATA           *BlockData;\r
@@ -1505,6 +1507,140 @@ ParseIfrData (
       InsertDefaultValue (BlockData, &DefaultData);\r
       break;\r
 \r
+    case EFI_IFR_DATE_OP:\r
+      //\r
+      // offset by question header\r
+      // width MaxSize * sizeof (CHAR16)\r
+      // no default value, only block array\r
+      //\r
+\r
+      //\r
+      // Date question is not in IFR Form. This IFR form is not valid. \r
+      //\r
+      if (VarStorageData->Size == 0) {\r
+        Status = EFI_INVALID_PARAMETER;\r
+        goto Done;\r
+      }\r
+      //\r
+      // Check whether this question is for the requested varstore.\r
+      //\r
+      IfrDate = (EFI_IFR_DATE *) IfrOpHdr;\r
+      if (IfrDate->Question.VarStoreId != VarStorageData->VarStoreId) {\r
+        break;\r
+      }\r
+\r
+      //\r
+      // Get Offset/Width by Question header and OneOf Flags\r
+      //\r
+      VarOffset = IfrDate->Question.VarStoreInfo.VarOffset;\r
+      VarWidth  = (UINT16) sizeof (EFI_HII_DATE);\r
+\r
+      //\r
+      // Check whether this question is in requested block array.\r
+      //\r
+      if (!BlockArrayCheck (RequestBlockArray, VarOffset, VarWidth)) {\r
+        //\r
+        // This question is not in the requested array. Skip it.\r
+        //\r
+        break;\r
+      }\r
+\r
+      //\r
+      // Check this var question is in the var storage \r
+      //\r
+      if ((VarOffset + VarWidth) > VarStorageData->Size) {\r
+        Status = EFI_INVALID_PARAMETER;\r
+        goto Done;\r
+      }\r
+\r
+      //\r
+      // Set Block Data\r
+      //\r
+      BlockData = (IFR_BLOCK_DATA *) AllocateZeroPool (sizeof (IFR_BLOCK_DATA));\r
+      if (BlockData == NULL) {\r
+        Status = EFI_OUT_OF_RESOURCES;\r
+        goto Done;\r
+      }\r
+      BlockData->Offset     = VarOffset;\r
+      BlockData->Width      = VarWidth;\r
+      BlockData->QuestionId = IfrDate->Question.QuestionId;\r
+      BlockData->OpCode     = IfrOpHdr->OpCode;\r
+      BlockData->Scope      = IfrOpHdr->Scope;\r
+      InitializeListHead (&BlockData->DefaultValueEntry);\r
+\r
+      //\r
+      // Add Block Data into VarStorageData BlockEntry\r
+      //\r
+      InsertBlockData (&VarStorageData->BlockEntry, &BlockData);\r
+      break;\r
+\r
+    case EFI_IFR_TIME_OP:\r
+      //\r
+      // offset by question header\r
+      // width MaxSize * sizeof (CHAR16)\r
+      // no default value, only block array\r
+      //\r
+\r
+      //\r
+      // Time question is not in IFR Form. This IFR form is not valid. \r
+      //\r
+      if (VarStorageData->Size == 0) {\r
+        Status = EFI_INVALID_PARAMETER;\r
+        goto Done;\r
+      }\r
+      //\r
+      // Check whether this question is for the requested varstore.\r
+      //\r
+      IfrTime = (EFI_IFR_TIME *) IfrOpHdr;\r
+      if (IfrTime->Question.VarStoreId != VarStorageData->VarStoreId) {\r
+        break;\r
+      }\r
+\r
+      //\r
+      // Get Offset/Width by Question header and OneOf Flags\r
+      //\r
+      VarOffset = IfrTime->Question.VarStoreInfo.VarOffset;\r
+      VarWidth  = (UINT16) sizeof (EFI_HII_TIME);\r
+\r
+      //\r
+      // Check whether this question is in requested block array.\r
+      //\r
+      if (!BlockArrayCheck (RequestBlockArray, VarOffset, VarWidth)) {\r
+        //\r
+        // This question is not in the requested array. Skip it.\r
+        //\r
+        break;\r
+      }\r
+\r
+      //\r
+      // Check this var question is in the var storage \r
+      //\r
+      if ((VarOffset + VarWidth) > VarStorageData->Size) {\r
+        Status = EFI_INVALID_PARAMETER;\r
+        goto Done;\r
+      }\r
+\r
+      //\r
+      // Set Block Data\r
+      //\r
+      BlockData = (IFR_BLOCK_DATA *) AllocateZeroPool (sizeof (IFR_BLOCK_DATA));\r
+      if (BlockData == NULL) {\r
+        Status = EFI_OUT_OF_RESOURCES;\r
+        goto Done;\r
+      }\r
+      BlockData->Offset     = VarOffset;\r
+      BlockData->Width      = VarWidth;\r
+      BlockData->QuestionId = IfrTime->Question.QuestionId;\r
+      BlockData->OpCode     = IfrOpHdr->OpCode;\r
+      BlockData->Scope      = IfrOpHdr->Scope;\r
+      InitializeListHead (&BlockData->DefaultValueEntry);\r
+\r
+        //\r
+      // Add Block Data into VarStorageData BlockEntry\r
+      //\r
+      InsertBlockData (&VarStorageData->BlockEntry, &BlockData);\r
+      break;\r
+\r
     case EFI_IFR_STRING_OP:\r
       //\r
       // offset by question header\r