1. Set Min/Max value for OneOf opcode according to its oneof option value.
authorlgao4 <lgao4@7335b38e-4728-0410-8992-fb3ffe349368>
Thu, 24 Dec 2009 11:56:41 +0000 (11:56 +0000)
committerlgao4 <lgao4@7335b38e-4728-0410-8992-fb3ffe349368>
Thu, 24 Dec 2009 11:56:41 +0000 (11:56 +0000)
2. Check Numeric flag when the varstore is buffer store.

git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1782 7335b38e-4728-0410-8992-fb3ffe349368

Source/C/VfrCompile/VfrFormPkg.h
Source/C/VfrCompile/VfrSyntax.g

index 609b434..0b84896 100644 (file)
@@ -398,49 +398,159 @@ public:
   }\r
 };\r
 \r
-static CIfrQuestionHeader *gCurrentQuestion  = NULL;\r
-static CIfrObj            *gCurrentIfrOpcode = NULL;\r
-\r
 /*\r
  * The definition of CIfrMinMaxStepData\r
  */\r
 class CIfrMinMaxStepData {\r
 private:\r
   MINMAXSTEP_DATA *mMinMaxStepData;\r
+  BOOLEAN         ValueIsSet;\r
+  BOOLEAN         IsNumeric;\r
 \r
 public:\r
-  CIfrMinMaxStepData (MINMAXSTEP_DATA *DataAddr) : mMinMaxStepData (DataAddr) {\r
+  CIfrMinMaxStepData (MINMAXSTEP_DATA *DataAddr, BOOLEAN NumericOpcode=FALSE) : mMinMaxStepData (DataAddr) {\r
     mMinMaxStepData->u64.MinValue = 0;\r
     mMinMaxStepData->u64.MaxValue = 0;\r
     mMinMaxStepData->u64.Step     = 0;\r
+    ValueIsSet = FALSE;\r
+    IsNumeric = NumericOpcode;\r
   }\r
 \r
   VOID SetMinMaxStepData (IN UINT64 MinValue, IN UINT64 MaxValue, IN UINT64 Step) {\r
-    mMinMaxStepData->u64.MinValue = MinValue;\r
-    mMinMaxStepData->u64.MaxValue = MaxValue;\r
-    mMinMaxStepData->u64.Step     = Step;\r
+    if (!ValueIsSet) {\r
+      mMinMaxStepData->u64.MinValue = MinValue;\r
+      mMinMaxStepData->u64.MaxValue = MaxValue;\r
+      ValueIsSet = TRUE;\r
+    } else {\r
+      if (MinValue < mMinMaxStepData->u64.MinValue) {\r
+        mMinMaxStepData->u64.MinValue = MinValue;\r
+      }\r
+      if (MaxValue > mMinMaxStepData->u64.MaxValue) {\r
+        mMinMaxStepData->u64.MaxValue = MaxValue;\r
+      }\r
+    }\r
+    mMinMaxStepData->u64.Step = Step;\r
   }\r
 \r
   VOID SetMinMaxStepData (IN UINT32 MinValue, IN UINT32 MaxValue, IN UINT32 Step) {\r
-    mMinMaxStepData->u32.MinValue = MinValue;\r
-    mMinMaxStepData->u32.MaxValue = MaxValue;\r
-    mMinMaxStepData->u32.Step     = Step;\r
+    if (!ValueIsSet) {\r
+      mMinMaxStepData->u32.MinValue = MinValue;\r
+      mMinMaxStepData->u32.MaxValue = MaxValue;\r
+      ValueIsSet = TRUE;\r
+    } else {\r
+      if (MinValue < mMinMaxStepData->u32.MinValue) {\r
+        mMinMaxStepData->u32.MinValue = MinValue;\r
+      }\r
+      if (MaxValue > mMinMaxStepData->u32.MaxValue) {\r
+        mMinMaxStepData->u32.MaxValue = MaxValue;\r
+      }\r
+    }\r
+    mMinMaxStepData->u32.Step = Step;\r
   }\r
 \r
   VOID SetMinMaxStepData (IN UINT16 MinValue, IN UINT16 MaxValue, IN UINT16 Step) {\r
-    mMinMaxStepData->u16.MinValue = MinValue;\r
-    mMinMaxStepData->u16.MaxValue = MaxValue;\r
-    mMinMaxStepData->u16.Step     = Step;\r
+    if (!ValueIsSet) {\r
+      mMinMaxStepData->u16.MinValue = MinValue;\r
+      mMinMaxStepData->u16.MaxValue = MaxValue;\r
+      ValueIsSet = TRUE;\r
+    } else {\r
+      if (MinValue < mMinMaxStepData->u16.MinValue) {\r
+        mMinMaxStepData->u16.MinValue = MinValue;\r
+      }\r
+      if (MaxValue > mMinMaxStepData->u16.MaxValue) {\r
+        mMinMaxStepData->u16.MaxValue = MaxValue;\r
+      }\r
+    }\r
+    mMinMaxStepData->u16.Step = Step;\r
   }\r
 \r
   VOID SetMinMaxStepData (IN UINT8 MinValue, IN UINT8 MaxValue, IN UINT8 Step) {\r
-    mMinMaxStepData->u8.MinValue = MinValue;\r
-    mMinMaxStepData->u8.MaxValue = MaxValue;\r
-    mMinMaxStepData->u8.Step     = Step;\r
+    if (!ValueIsSet) {\r
+      mMinMaxStepData->u8.MinValue = MinValue;\r
+      mMinMaxStepData->u8.MaxValue = MaxValue;\r
+      ValueIsSet = TRUE;\r
+    } else {\r
+      if (MinValue < mMinMaxStepData->u8.MinValue) {\r
+        mMinMaxStepData->u8.MinValue = MinValue;\r
+      }\r
+      if (MaxValue > mMinMaxStepData->u8.MaxValue) {\r
+        mMinMaxStepData->u8.MaxValue = MaxValue;\r
+      }\r
+    }\r
+    mMinMaxStepData->u8.Step = Step;\r
+  }\r
+\r
+  UINT64 GetMinData (UINT8 VarType) {\r
+    UINT64 MinValue = 0;\r
+    switch (VarType) {\r
+    case EFI_IFR_TYPE_NUM_SIZE_64:\r
+      MinValue = mMinMaxStepData->u64.MinValue;\r
+      break;\r
+    case EFI_IFR_TYPE_NUM_SIZE_32:\r
+      MinValue = (UINT64) mMinMaxStepData->u32.MinValue;\r
+      break;\r
+    case EFI_IFR_TYPE_NUM_SIZE_16:\r
+      MinValue = (UINT64) mMinMaxStepData->u16.MinValue;\r
+      break;\r
+    case EFI_IFR_TYPE_NUM_SIZE_8:\r
+      MinValue = (UINT64) mMinMaxStepData->u8.MinValue;\r
+      break;\r
+    default:\r
+      break;\r
+    }\r
+    return MinValue;\r
+  }\r
+\r
+  UINT64 GetMaxData (UINT8 VarType) {\r
+    UINT64 MaxValue = 0;\r
+    switch (VarType) {\r
+    case EFI_IFR_TYPE_NUM_SIZE_64:\r
+      MaxValue = mMinMaxStepData->u64.MaxValue;\r
+      break;\r
+    case EFI_IFR_TYPE_NUM_SIZE_32:\r
+      MaxValue = (UINT64) mMinMaxStepData->u32.MaxValue;\r
+      break;\r
+    case EFI_IFR_TYPE_NUM_SIZE_16:\r
+      MaxValue = (UINT64) mMinMaxStepData->u16.MaxValue;\r
+      break;\r
+    case EFI_IFR_TYPE_NUM_SIZE_8:\r
+      MaxValue = (UINT64) mMinMaxStepData->u8.MaxValue;\r
+      break;\r
+    default:\r
+      break;\r
+    }\r
+    return MaxValue;\r
+  }\r
+\r
+  UINT64 GetStepData (UINT8 VarType) {\r
+    UINT64 MaxValue = 0;\r
+    switch (VarType) {\r
+    case EFI_IFR_TYPE_NUM_SIZE_64:\r
+      MaxValue = mMinMaxStepData->u64.Step;\r
+      break;\r
+    case EFI_IFR_TYPE_NUM_SIZE_32:\r
+      MaxValue = (UINT64) mMinMaxStepData->u32.Step;\r
+      break;\r
+    case EFI_IFR_TYPE_NUM_SIZE_16:\r
+      MaxValue = (UINT64) mMinMaxStepData->u16.Step;\r
+      break;\r
+    case EFI_IFR_TYPE_NUM_SIZE_8:\r
+      MaxValue = (UINT64) mMinMaxStepData->u8.Step;\r
+      break;\r
+    default:\r
+      break;\r
+    }\r
+    return MaxValue;\r
   }\r
 \r
+  BOOLEAN IsNumericOpcode () {\r
+    return IsNumeric;\r
+  }\r
 };\r
 \r
+static CIfrQuestionHeader *gCurrentQuestion  = NULL;\r
+static CIfrMinMaxStepData *gCurrentMinMaxData = NULL;\r
+\r
 /*\r
  * The definition of all of the UEFI IFR Objects\r
  */\r
@@ -979,15 +1089,15 @@ public:
   CIfrNumeric () : CIfrObj (EFI_IFR_NUMERIC_OP, (CHAR8 **)&mNumeric),\r
                    CIfrOpHeader (EFI_IFR_NUMERIC_OP, &mNumeric->Header),\r
                    CIfrQuestionHeader (&mNumeric->Question),\r
-                   CIfrMinMaxStepData (&mNumeric->data) {\r
+                   CIfrMinMaxStepData (&mNumeric->data, TRUE) {\r
     mNumeric->Flags  = EFI_IFR_NUMERIC_SIZE_1 | EFI_IFR_DISPLAY_UINT_DEC;\r
-    gCurrentQuestion  = this;\r
-    gCurrentIfrOpcode = this;\r
+    gCurrentQuestion   = this;\r
+    gCurrentMinMaxData = this;\r
   }\r
 \r
   ~CIfrNumeric () {\r
-    gCurrentQuestion  = NULL;\r
-    gCurrentIfrOpcode = NULL;\r
+    gCurrentQuestion   = NULL;\r
+    gCurrentMinMaxData = NULL;\r
   }\r
 \r
   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {\r
@@ -1005,10 +1115,6 @@ public:
     }\r
     return VFR_RETURN_SUCCESS;\r
   }\r
-\r
-  UINT8 GetDataTypeFlags() {\r
-    return mNumeric->Flags & EFI_IFR_NUMERIC_SIZE;\r
-  }\r
 };\r
 \r
 class CIfrOneOf : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader, public CIfrMinMaxStepData {\r
@@ -1021,13 +1127,13 @@ public:
                  CIfrQuestionHeader (&mOneOf->Question),\r
                  CIfrMinMaxStepData (&mOneOf->data) {\r
     mOneOf->Flags    = 0;\r
-    gCurrentQuestion  = this;\r
-    gCurrentIfrOpcode = this;\r
+    gCurrentQuestion   = this;\r
+    gCurrentMinMaxData = this;\r
   }\r
 \r
   ~CIfrOneOf () {\r
-    gCurrentQuestion  = NULL;\r
-    gCurrentIfrOpcode = NULL;\r
+    gCurrentQuestion   = NULL;\r
+    gCurrentMinMaxData = NULL;\r
   }\r
 \r
   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {\r
@@ -1045,10 +1151,6 @@ public:
     }\r
     return VFR_RETURN_SUCCESS;\r
   }\r
-\r
-  UINT8 GetDataTypeFlags() {\r
-    return mOneOf->Flags & EFI_IFR_NUMERIC_SIZE;\r
-  }\r
 };\r
 \r
 class CIfrString : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {\r
index 805d75c..125617f 100644 (file)
@@ -1105,66 +1105,10 @@ vfrStatementDefault :
     (\r
         vfrStatementValue ","                       << IsExp = TRUE; DObj.SetScope (1); CIfrEnd EndObj1; EndObj1.SetLineNo(D->getLine()); >>\r
       | "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] > [Val] ","  << \r
-\r
-                                                        if (gCurrentIfrOpcode != NULL && gCurrentIfrOpcode->GetObjBinAddr() != NULL) {\r
-                                                          EFI_IFR_OP_HEADER *TempOpCode;\r
-                                                          TempOpCode = (EFI_IFR_OP_HEADER *) gCurrentIfrOpcode->GetObjBinAddr();\r
-                                                          switch (TempOpCode->OpCode) {\r
-                                                          case EFI_IFR_NUMERIC_OP:\r
-                                                            EFI_IFR_NUMERIC *TempNumricCode;\r
-                                                            TempNumricCode = (EFI_IFR_NUMERIC *) TempOpCode;\r
-                                                            switch (_GET_CURRQEST_DATATYPE()) {\r
-                                                            case EFI_IFR_TYPE_NUM_SIZE_64:\r
-                                                              if (Val.u64 < TempNumricCode->data.u64.MinValue || Val.u64 > TempNumricCode->data.u64.MaxValue) {\r
-                                                                _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");\r
-                                                              }\r
-                                                              break;\r
-                                                            case EFI_IFR_TYPE_NUM_SIZE_32:\r
-                                                              if (Val.u32 < TempNumricCode->data.u32.MinValue || Val.u32 > TempNumricCode->data.u32.MaxValue) {\r
-                                                                _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");\r
-                                                              }\r
-                                                              break;\r
-                                                            case EFI_IFR_TYPE_NUM_SIZE_16:\r
-                                                              if (Val.u16 < TempNumricCode->data.u16.MinValue || Val.u16 > TempNumricCode->data.u16.MaxValue) {\r
-                                                                _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");\r
-                                                              }\r
-                                                              break;\r
-                                                            case EFI_IFR_TYPE_NUM_SIZE_8:\r
-                                                              if (Val.u8 < TempNumricCode->data.u8.MinValue || Val.u8 > TempNumricCode->data.u8.MaxValue) {\r
-                                                                _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");\r
-                                                              }\r
-                                                              break;\r
-                                                            }\r
-                                                            break;\r
-                                                          case EFI_IFR_ONE_OF_OP:\r
-                                                            EFI_IFR_ONE_OF *TempOneOfCode;\r
-                                                            TempOneOfCode = (EFI_IFR_ONE_OF *) TempOpCode;\r
-                                                            if (TempOneOfCode->data.u64.MinValue != 0 || TempOneOfCode->data.u64.MaxValue != 0 || TempOneOfCode->data.u64.Step != 0) {\r
-                                                              //OneOf MinMaxStep Data is set, Val value will be checked for MinMaxStep.\r
-                                                              switch (_GET_CURRQEST_DATATYPE()) {\r
-                                                              case EFI_IFR_TYPE_NUM_SIZE_64:\r
-                                                                if (Val.u64 < TempOneOfCode->data.u64.MinValue || Val.u64 > TempOneOfCode->data.u64.MaxValue) {\r
-                                                                  _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");\r
-                                                                }\r
-                                                                break;\r
-                                                              case EFI_IFR_TYPE_NUM_SIZE_32:\r
-                                                                if (Val.u32 < TempOneOfCode->data.u32.MinValue || Val.u32 > TempOneOfCode->data.u32.MaxValue) {\r
-                                                                  _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");\r
-                                                                }\r
-                                                                break;\r
-                                                              case EFI_IFR_TYPE_NUM_SIZE_16:\r
-                                                                if (Val.u16 < TempOneOfCode->data.u16.MinValue || Val.u16 > TempOneOfCode->data.u16.MaxValue) {\r
-                                                                  _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");\r
-                                                                }\r
-                                                                break;\r
-                                                              case EFI_IFR_TYPE_NUM_SIZE_8:\r
-                                                                if (Val.u8 < TempOneOfCode->data.u8.MinValue || Val.u8 > TempOneOfCode->data.u8.MaxValue) {\r
-                                                                  _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");\r
-                                                                }\r
-                                                                break;\r
-                                                              }\r
-                                                            }\r
-                                                            break;\r
+                                                        if (gCurrentMinMaxData != NULL && gCurrentMinMaxData->IsNumericOpcode()) {\r
+                                                          //check default value is valid for Numeric Opcode\r
+                                                          if (Val.u64 < gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE()) || Val.u64 > gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE())) {\r
+                                                            _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");\r
                                                           }\r
                                                         }\r
                                                         DObj.SetType (_GET_CURRQEST_DATATYPE()); \r
@@ -1718,7 +1662,7 @@ vfrStatementNumericType :
   vfrStatementOneOf\r
   ;\r
 \r
-vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj, UINT8 DataTypeFlags] :\r
+vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :\r
   <<\r
      UINT64 MaxU8 = 0, MinU8 = 0, StepU8 = 0;\r
      UINT32 MaxU4 = 0, MinU4 = 0, StepU4 = 0;\r
@@ -1727,7 +1671,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj, UINT8 DataTypeFlags] :
   >>\r
   Minimum   "=" I:Number ","\r
                                                        <<\r
-                                                          switch (DataTypeFlags) {\r
+                                                          switch (_GET_CURRQEST_DATATYPE()) {\r
                                                           case EFI_IFR_TYPE_NUM_SIZE_64 : MinU8 = _STOU64(I->getText()); break;\r
                                                           case EFI_IFR_TYPE_NUM_SIZE_32 : MinU4 = _STOU32(I->getText()); break;\r
                                                           case EFI_IFR_TYPE_NUM_SIZE_16 : MinU2 = _STOU16(I->getText()); break;\r
@@ -1736,7 +1680,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj, UINT8 DataTypeFlags] :
                                                        >>\r
   Maximum   "=" A:Number ","\r
                                                        <<\r
-                                                          switch (DataTypeFlags) {\r
+                                                          switch (_GET_CURRQEST_DATATYPE()) {\r
                                                           case EFI_IFR_TYPE_NUM_SIZE_64 : \r
                                                             MaxU8 = _STOU64(A->getText()); \r
                                                             if (MaxU8 < MinU8) {\r
@@ -1766,7 +1710,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj, UINT8 DataTypeFlags] :
   {\r
     STEP    "=" S:Number ","\r
                                                        <<\r
-                                                          switch (DataTypeFlags) {\r
+                                                          switch (_GET_CURRQEST_DATATYPE()) {\r
                                                           case EFI_IFR_TYPE_NUM_SIZE_64 : StepU8 = _STOU64(S->getText()); break;\r
                                                           case EFI_IFR_TYPE_NUM_SIZE_32 : StepU4 = _STOU32(S->getText()); break;\r
                                                           case EFI_IFR_TYPE_NUM_SIZE_16 : StepU2 = _STOU16(S->getText()); break;\r
@@ -1775,7 +1719,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj, UINT8 DataTypeFlags] :
                                                        >>\r
   }\r
                                                        <<\r
-                                                          switch (DataTypeFlags) {\r
+                                                          switch (_GET_CURRQEST_DATATYPE()) {\r
                                                           case EFI_IFR_TYPE_NUM_SIZE_64 : $MMSDObj.SetMinMaxStepData (MinU8, MaxU8, StepU8); break;\r
                                                           case EFI_IFR_TYPE_NUM_SIZE_32 : $MMSDObj.SetMinMaxStepData (MinU4, MaxU4, StepU4); break;\r
                                                           case EFI_IFR_TYPE_NUM_SIZE_16 : $MMSDObj.SetMinMaxStepData (MinU2, MaxU2, StepU2); break;\r
@@ -1801,7 +1745,7 @@ vfrStatementNumeric :
   {\r
     Key   "=" KN:Number ","                            << AssignQuestionKey (NObj, KN); >>\r
   }\r
-  vfrSetMinMaxStep[NObj, NObj.GetDataTypeFlags()]\r
+  vfrSetMinMaxStep[NObj]\r
   vfrStatementQuestionOptionList\r
   E:EndNumeric                                         << CRT_END_OP (E); >>\r
   ";"\r
@@ -1821,6 +1765,12 @@ vfrNumericFlags [CIfrNumeric & NObj, UINT32 LineNum] :
                                                             if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {\r
                                                               _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");\r
                                                             }\r
+                                                          } else {\r
+                                                            // update data type for name/value store\r
+                                                            UINT32 DataTypeSize;\r
+                                                            _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;\r
+                                                            gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);\r
+                                                            _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;\r
                                                           }\r
                                                           _PCATCH(NObj.SetFlags (HFlags, LFlags), LineNum);\r
                                                        >>\r
@@ -1853,7 +1803,7 @@ vfrStatementOneOf :
                                                        >>\r
   { F:FLAGS "=" vfrOneofFlagsField[OObj, F->getLine()] "," }\r
   {\r
-    vfrSetMinMaxStep[OObj, OObj.GetDataTypeFlags()]\r
+    vfrSetMinMaxStep[OObj]\r
   }\r
   vfrStatementQuestionOptionList\r
   E:EndOneOf                                           << CRT_END_OP (E); >>\r
@@ -1874,6 +1824,12 @@ vfrOneofFlagsField [CIfrOneOf & OObj, UINT32 LineNum] :
                                                             if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {\r
                                                               _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");\r
                                                             }\r
+                                                          } else {\r
+                                                            // update data type for Name/Value store\r
+                                                            UINT32 DataTypeSize;\r
+                                                            _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;\r
+                                                            gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);\r
+                                                            _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;\r
                                                           }\r
                                                           _PCATCH(OObj.SetFlags (HFlags, LFlags), LineNum);\r
                                                        >>\r
@@ -2315,7 +2271,31 @@ vfrStatementOneOfOption :
   >>\r
   L:Option                                             << OOOObj.SetLineNo(L->getLine()); >>\r
   Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","      << OOOObj.SetOption (_STOSID(S->getText())); >>\r
-  Value "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] >[Val] ","    << OOOObj.SetType (_GET_CURRQEST_DATATYPE()); OOOObj.SetValue (Val); >>\r
+  Value "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] >[Val] ","    \r
+                                                       << \r
+                                                          if (gCurrentMinMaxData != NULL) {\r
+                                                            //set min/max value for oneof opcode\r
+                                                            UINT64 Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE());\r
+                                                            switch (_GET_CURRQEST_DATATYPE()) {\r
+                                                            case EFI_IFR_TYPE_NUM_SIZE_64:\r
+                                                              gCurrentMinMaxData->SetMinMaxStepData(Val.u64, Val.u64, Step);\r
+                                                              break;\r
+                                                            case EFI_IFR_TYPE_NUM_SIZE_32:\r
+                                                              gCurrentMinMaxData->SetMinMaxStepData(Val.u32, Val.u32, (UINT32) Step);\r
+                                                              break;\r
+                                                            case EFI_IFR_TYPE_NUM_SIZE_16:\r
+                                                              gCurrentMinMaxData->SetMinMaxStepData(Val.u16, Val.u16, (UINT16) Step);\r
+                                                              break;\r
+                                                            case EFI_IFR_TYPE_NUM_SIZE_8:\r
+                                                              gCurrentMinMaxData->SetMinMaxStepData(Val.u8, Val.u8, (UINT8) Step);\r
+                                                              break;\r
+                                                            default:\r
+                                                              break;\r
+                                                            }\r
+                                                          }\r
+                                                          OOOObj.SetType (_GET_CURRQEST_DATATYPE()); \r
+                                                          OOOObj.SetValue (Val); \r
+                                                       >>\r
   F:FLAGS "=" vfrOneOfOptionFlags[OOOObj, F->getLine()]\r
                                                        <<\r
                                                           _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), L->getLine());\r