Home | History | Annotate | Download | only in VfrCompile
      1 /** @file
      2 
      3   The definition of CFormPkg's member function
      4 
      5 Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
      6 This program and the accompanying materials
      7 are licensed and made available under the terms and conditions of the BSD License
      8 which accompanies this distribution.  The full text of the license may be found at
      9 http://opensource.org/licenses/bsd-license.php
     10 
     11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     13 
     14 **/
     15 
     16 #ifndef _EFIIFRCLASS_H_
     17 #define _EFIIFRCLASS_H_
     18 
     19 #include "string.h"
     20 #include "EfiVfr.h"
     21 #include "VfrError.h"
     22 #include "VfrUtilityLib.h"
     23 
     24 #define NO_QST_REFED "no question refered"
     25 
     26 struct PACKAGE_DATA {
     27   CHAR8   *Buffer;
     28   UINT32  Size;
     29 };
     30 
     31 /*
     32  * The functions below are used for flags setting
     33  */
     34 static inline BOOLEAN _FLAGS_ZERO (
     35   IN UINT8 &Flags
     36   )
     37 {
     38   return Flags == 0;
     39 }
     40 
     41 static inline VOID _FLAG_CLEAR (
     42   IN UINT8 &Flags,
     43   IN UINT8 Mask
     44   )
     45 {
     46   Flags &= (~Mask);
     47 }
     48 
     49 static inline UINT8 _FLAG_TEST_AND_CLEAR (
     50   IN UINT8 &Flags,
     51   IN UINT8 Mask
     52   )
     53 {
     54   UINT8 Ret = Flags & Mask;
     55   Flags &= (~Mask);
     56   return Ret;
     57 }
     58 
     59 static inline UINT8 _IS_EQUAL (
     60   IN UINT8 &Flags,
     61   IN UINT8 Value
     62   )
     63 {
     64   return Flags == Value;
     65 }
     66 
     67 /*
     68  * The definition of CIfrBin
     69  */
     70 typedef enum {
     71   PENDING,
     72   ASSIGNED
     73 } ASSIGN_FLAG;
     74 
     75 struct SPendingAssign {
     76   CHAR8                   *mKey;  // key ! unique
     77   VOID                    *mAddr;
     78   UINT32                  mLen;
     79   ASSIGN_FLAG             mFlag;
     80   UINT32                  mLineNo;
     81   CHAR8                   *mMsg;
     82   struct SPendingAssign   *mNext;
     83 
     84   SPendingAssign (IN CHAR8 *, IN VOID *, IN UINT32, IN UINT32, IN CONST CHAR8 *);
     85   ~SPendingAssign ();
     86 
     87   VOID   SetAddrAndLen (IN VOID *, IN UINT32);
     88   VOID   AssignValue (IN VOID *, IN UINT32);
     89   CHAR8 * GetKey (VOID);
     90 
     91 private:
     92   SPendingAssign (IN CONST SPendingAssign&);             // Prevent copy-construction
     93   SPendingAssign& operator= (IN CONST SPendingAssign&);  // Prevent assignment
     94 };
     95 
     96 struct SBufferNode {
     97   CHAR8              *mBufferStart;
     98   CHAR8              *mBufferEnd;
     99   CHAR8              *mBufferFree;
    100   struct SBufferNode *mNext;
    101 };
    102 
    103 typedef struct {
    104   BOOLEAN  CompatibleMode;
    105   EFI_GUID *OverrideClassGuid;
    106 } INPUT_INFO_TO_SYNTAX;
    107 
    108 class CFormPkg {
    109 private:
    110   UINT32              mBufferSize;
    111   SBufferNode         *mBufferNodeQueueHead;
    112   SBufferNode         *mBufferNodeQueueTail;
    113   SBufferNode         *mCurrBufferNode;
    114 
    115   SBufferNode         *mReadBufferNode;
    116   UINT32              mReadBufferOffset;
    117 
    118   UINT32              mPkgLength;
    119 
    120   VOID                _WRITE_PKG_LINE (IN FILE *, IN UINT32 , IN CONST CHAR8 *, IN CHAR8 *, IN UINT32);
    121   VOID                _WRITE_PKG_END (IN FILE *, IN UINT32 , IN CONST CHAR8 *, IN CHAR8 *, IN UINT32);
    122   SBufferNode *       GetBinBufferNodeForAddr (IN CHAR8 *);
    123   SBufferNode *       CreateNewNode ();
    124   SBufferNode *       GetNodeBefore (IN SBufferNode *);
    125   EFI_VFR_RETURN_CODE InsertNodeBefore (IN SBufferNode *, IN SBufferNode *);
    126 
    127 private:
    128   SPendingAssign      *PendingAssignList;
    129 
    130 public:
    131   CFormPkg (IN UINT32 BufferSize = 4096);
    132   ~CFormPkg ();
    133 
    134   CHAR8             * IfrBinBufferGet (IN UINT32);
    135   inline UINT32       GetPkgLength (VOID);
    136 
    137   VOID                Open ();
    138   UINT32              Read (IN CHAR8 *, IN UINT32);
    139   VOID                Close ();
    140 
    141   EFI_VFR_RETURN_CODE BuildPkgHdr (OUT EFI_HII_PACKAGE_HEADER **);
    142   EFI_VFR_RETURN_CODE BuildPkg (IN FILE *, IN PACKAGE_DATA *PkgData = NULL);
    143   EFI_VFR_RETURN_CODE BuildPkg (OUT PACKAGE_DATA &);
    144   EFI_VFR_RETURN_CODE GenCFile (IN CHAR8 *, IN FILE *, IN PACKAGE_DATA *PkgData = NULL);
    145 
    146 private:
    147   CFormPkg (IN CONST CFormPkg&);             // Prevent copy-construction
    148   CFormPkg& operator= (IN CONST CFormPkg&);  // Prevent assignment
    149 
    150 public:
    151   EFI_VFR_RETURN_CODE AssignPending (IN CHAR8 *, IN VOID *, IN UINT32, IN UINT32, IN CONST CHAR8 *Msg = NULL);
    152   VOID                DoPendingAssign (IN CHAR8 *, IN VOID *, IN UINT32);
    153   bool                HavePendingUnassigned (VOID);
    154   VOID                PendingAssignPrintAll (VOID);
    155   EFI_VFR_RETURN_CODE   DeclarePendingQuestion (
    156     IN CVfrVarDataTypeDB   &lCVfrVarDataTypeDB,
    157     IN CVfrDataStorage     &lCVfrDataStorage,
    158     IN CVfrQuestionDB      &lCVfrQuestionDB,
    159     IN EFI_GUID            *LocalFormSetGuid,
    160     IN UINT32              LineNo,
    161     OUT CHAR8              **InsertOpcodeAddr
    162     );
    163   EFI_VFR_RETURN_CODE AdjustDynamicInsertOpcode (
    164     IN CHAR8              *LastFormEndAddr,
    165     IN CHAR8              *InsertOpcodeAddr,
    166     IN BOOLEAN            CreateOpcodeAfterParsingVfr
    167     );
    168   CHAR8 *             GetBufAddrBaseOnOffset (
    169     IN UINT32             Offset
    170     );
    171 };
    172 
    173 extern CFormPkg       gCFormPkg;
    174 extern CVfrStringDB   gCVfrStringDB;
    175 extern UINT32         gAdjustOpcodeOffset;
    176 extern BOOLEAN        gNeedAdjustOpcode;
    177 
    178 struct SIfrRecord {
    179   UINT32     mLineNo;
    180   CHAR8      *mIfrBinBuf;
    181   UINT8      mBinBufLen;
    182   UINT32     mOffset;
    183   SIfrRecord *mNext;
    184 
    185   SIfrRecord (VOID);
    186   ~SIfrRecord (VOID);
    187 };
    188 
    189 
    190 #define EFI_IFR_RECORDINFO_IDX_INVALUD 0xFFFFFF
    191 #define EFI_IFR_RECORDINFO_IDX_START   0x0
    192 #define EFI_HII_MAX_SUPPORT_DEFAULT_TYPE  0x08
    193 
    194 struct QuestionDefaultRecord {
    195   BOOLEAN     mIsDefaultIdExist[EFI_HII_MAX_SUPPORT_DEFAULT_TYPE]; // Record the default id in mAllDefaultIdArray[EFI_HII_MAX_SUPPORT_DEFAULT_TYPE]
    196                                                                    // whether exists in current question.
    197 
    198   SIfrRecord  *mDefaultValueRecord;   // Point to the default value record in RecordList which has smallest default Id.
    199                                       // (for checkbox it may be NULL, because the dedault value is always true when the flag is set.)
    200 
    201   BOOLEAN     mIsDefaultOpcode;       // whether the default value with smallest default id is given by default opcode.
    202                                       // (for oneof and checkbox default info may be given by flag.)
    203 
    204   UINT16      mDefaultNumber;         // The default number of this question.
    205 };
    206 
    207 class CIfrRecordInfoDB {
    208 private:
    209   bool       mSwitch;
    210   UINT32     mRecordCount;
    211   SIfrRecord *mIfrRecordListHead;
    212   SIfrRecord *mIfrRecordListTail;
    213   UINT8      mAllDefaultTypeCount;
    214   UINT16     mAllDefaultIdArray[EFI_HII_MAX_SUPPORT_DEFAULT_TYPE];
    215 
    216   SIfrRecord * GetRecordInfoFromIdx (IN UINT32);
    217   BOOLEAN          CheckQuestionOpCode (IN UINT8);
    218   BOOLEAN          CheckIdOpCode (IN UINT8);
    219   EFI_QUESTION_ID  GetOpcodeQuestionId (IN EFI_IFR_OP_HEADER *);
    220 public:
    221   CIfrRecordInfoDB (VOID);
    222   ~CIfrRecordInfoDB (VOID);
    223 
    224   inline VOID TurnOn (VOID) {
    225     mSwitch = TRUE;
    226   }
    227 
    228   inline VOID TurnOff (VOID) {
    229     mSwitch = FALSE;
    230   }
    231 
    232   SIfrRecord * GetRecordInfoFromOffset (IN UINT32);
    233   VOID        IfrAdjustOffsetForRecord (VOID);
    234   BOOLEAN     IfrAdjustDynamicOpcodeInRecords (IN BOOLEAN);
    235 
    236   UINT32      IfrRecordRegister (IN UINT32, IN CHAR8 *, IN UINT8, IN UINT32);
    237   VOID        IfrRecordInfoUpdate (IN UINT32, IN UINT32, IN CHAR8*, IN UINT8, IN UINT32);
    238   VOID        IfrRecordOutput (IN FILE *, IN UINT32 LineNo);
    239   VOID        IfrRecordOutput (OUT PACKAGE_DATA &);
    240   EFI_VFR_RETURN_CODE  IfrRecordAdjust (VOID);
    241   VOID        IfrUpdateRecordInfoForDynamicOpcode (IN BOOLEAN);
    242   VOID        IfrCheckAddDefaultRecord (IN BOOLEAN, IN BOOLEAN);
    243   VOID        IfrGetDefaultStoreInfo ();
    244   VOID        IfrCreateDefaultRecord (IN UINT8 Size,IN UINT16 DefaultId,IN UINT8 Type,IN UINT32 LineNo,IN EFI_IFR_TYPE_VALUE Value);
    245   VOID        IfrCreateDefaultForQuestion (IN  SIfrRecord *, IN  QuestionDefaultRecord *);
    246   VOID        IfrParseDefaulInfoInQuestion (IN  SIfrRecord *, OUT QuestionDefaultRecord *);
    247   VOID        IfrAddDefaultToBufferConfig (IN  UINT16, IN  SIfrRecord *,IN  EFI_IFR_TYPE_VALUE);
    248 
    249 private:
    250   CIfrRecordInfoDB (IN CONST CIfrRecordInfoDB&);             // Prevent copy-construction
    251   CIfrRecordInfoDB& operator= (IN CONST CIfrRecordInfoDB&);  // Prevent assignment
    252 };
    253 
    254 extern CIfrRecordInfoDB gCIfrRecordInfoDB;
    255 
    256 /*
    257  * The definition of CIfrObj
    258  */
    259 extern BOOLEAN  gCreateOp;
    260 
    261 class CIfrObj {
    262 private:
    263   BOOLEAN mDelayEmit;
    264 
    265   CHAR8   *mObjBinBuf;
    266   UINT8   mObjBinLen;
    267   UINT32  mLineNo;
    268   UINT32  mRecordIdx;
    269   UINT32  mPkgOffset;
    270 
    271 public:
    272   CIfrObj (IN UINT8 OpCode, OUT CHAR8 **IfrObj = NULL, IN UINT8 ObjBinLen = 0, IN BOOLEAN DelayEmit = FALSE);
    273   virtual ~CIfrObj(VOID);
    274 
    275   VOID    _EMIT_PENDING_OBJ (VOID);
    276 
    277   inline VOID    SetLineNo (IN UINT32 LineNo) {
    278     mLineNo = LineNo;
    279   }
    280 
    281   inline CHAR8 * GetObjBinAddr (VOID) {
    282     return mObjBinBuf;
    283   }
    284 
    285   inline UINT32 GetObjBinOffset (VOID) {
    286     return mPkgOffset;
    287   }
    288 
    289   inline UINT8   GetObjBinLen (VOID) {
    290     return mObjBinLen;
    291   }
    292 
    293   inline bool ExpendObjBin (IN UINT8 Size) {
    294     if ((mDelayEmit == TRUE) && ((mObjBinLen + Size) > mObjBinLen)) {
    295       mObjBinLen = mObjBinLen + Size;
    296       return TRUE;
    297     } else {
    298       return FALSE;
    299     }
    300   }
    301 
    302   inline bool ShrinkObjBin (IN UINT8 Size) {
    303     if ((mDelayEmit == TRUE) && (mObjBinLen > Size)) {
    304       mObjBinLen -= Size;
    305       return TRUE;
    306     } else {
    307       return FALSE;
    308     }
    309   }
    310 };
    311 
    312 /*
    313  * The definition of CIfrOpHeader
    314  */
    315 class CIfrOpHeader {
    316 private:
    317   EFI_IFR_OP_HEADER *mHeader;
    318 
    319 public:
    320   CIfrOpHeader (IN UINT8 OpCode, IN VOID *StartAddr, IN UINT8 Length = 0);
    321   CIfrOpHeader (IN CIfrOpHeader &);
    322   CIfrOpHeader& operator=(IN CONST CIfrOpHeader &);
    323 
    324   VOID IncLength (UINT8 Size) {
    325     if ((mHeader->Length + Size) > mHeader->Length) {
    326       mHeader->Length = mHeader->Length + Size;
    327     }
    328   }
    329 
    330   VOID DecLength (UINT8 Size) {
    331     if (mHeader->Length >= Size) {
    332       mHeader->Length -= Size;
    333     }
    334   }
    335 
    336   UINT8 GetLength () {
    337     return mHeader->Length;
    338   }
    339 
    340   UINT8 GetScope () {
    341     return mHeader->Scope;
    342   }
    343 
    344   VOID SetScope (IN UINT8 Scope) {
    345     mHeader->Scope = Scope;
    346   }
    347 
    348   VOID UpdateHeader (IN EFI_IFR_OP_HEADER *Header) {
    349     mHeader = Header;
    350   }
    351 
    352   UINT8 GetOpCode () {
    353     return mHeader->OpCode;
    354   }
    355 };
    356 
    357 extern UINT8 gScopeCount;
    358 
    359 /*
    360  * The definition of CIfrStatementHeader
    361  */
    362 class CIfrStatementHeader {
    363 private:
    364   EFI_IFR_STATEMENT_HEADER *mHeader;
    365 
    366 public:
    367   CIfrStatementHeader (
    368     IN EFI_IFR_STATEMENT_HEADER *StartAddr
    369   ) : mHeader ((EFI_IFR_STATEMENT_HEADER *)StartAddr) {
    370     mHeader         = StartAddr;
    371     mHeader->Help   = EFI_STRING_ID_INVALID;
    372     mHeader->Prompt = EFI_STRING_ID_INVALID;
    373   }
    374 
    375   EFI_IFR_STATEMENT_HEADER *GetStatementHeader () {
    376     return mHeader;
    377   }
    378 
    379   VOID SetPrompt (IN EFI_STRING_ID Prompt) {
    380     mHeader->Prompt = Prompt;
    381   }
    382 
    383   VOID SetHelp (IN EFI_STRING_ID Help) {
    384     mHeader->Help = Help;
    385   }
    386 };
    387 
    388 /*
    389  * The definition of CIfrQuestionHeader
    390  */
    391 #define EFI_IFR_QUESTION_FLAG_DEFAULT 0
    392 
    393 class CIfrQuestionHeader : public CIfrStatementHeader {
    394 private:
    395   EFI_IFR_QUESTION_HEADER *mHeader;
    396 
    397   EFI_IFR_STATEMENT_HEADER * QH2SH (EFI_IFR_QUESTION_HEADER *Qheader) {
    398     return &(Qheader)->Header;
    399   }
    400 
    401 public:
    402   EFI_QUESTION_ID QUESTION_ID (VOID) {
    403     return mHeader->QuestionId;
    404   }
    405 
    406   EFI_VARSTORE_ID VARSTORE_ID (VOID) {
    407     return mHeader->VarStoreId;
    408   }
    409 
    410   VOID VARSTORE_INFO (OUT EFI_VARSTORE_INFO *Info) {
    411     if (Info != NULL) {
    412       Info->mVarStoreId   = mHeader->VarStoreId;
    413       memmove (&Info->mVarStoreId, &mHeader->VarStoreInfo, sizeof (Info->mVarStoreId));
    414     }
    415   }
    416 
    417   UINT8 FLAGS (VOID) {
    418     return mHeader->Flags;
    419   }
    420 
    421 public:
    422   CIfrQuestionHeader (
    423     IN EFI_IFR_QUESTION_HEADER *StartAddr,
    424     IN UINT8 Flags = EFI_IFR_QUESTION_FLAG_DEFAULT
    425   ) : CIfrStatementHeader (QH2SH(StartAddr)) {
    426     mHeader                         = StartAddr;
    427     mHeader->QuestionId             = EFI_QUESTION_ID_INVALID;
    428     mHeader->VarStoreId             = EFI_VARSTORE_ID_INVALID;
    429     mHeader->VarStoreInfo.VarName   = EFI_STRING_ID_INVALID;
    430     mHeader->VarStoreInfo.VarOffset = EFI_VAROFFSET_INVALID;
    431     mHeader->Flags                  = Flags;
    432   }
    433 
    434   VOID SetQuestionId (IN EFI_QUESTION_ID QuestionId) {
    435     mHeader->QuestionId = QuestionId;
    436   }
    437 
    438   VOID SetVarStoreInfo (IN EFI_VARSTORE_INFO *Info) {
    439     mHeader->VarStoreId             = Info->mVarStoreId;
    440     mHeader->VarStoreInfo.VarName   = Info->mInfo.mVarName;
    441     mHeader->VarStoreInfo.VarOffset = Info->mInfo.mVarOffset;
    442   }
    443 
    444   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 Flags) {
    445     if (_FLAG_TEST_AND_CLEAR (Flags, EFI_IFR_FLAG_READ_ONLY)) {
    446       mHeader->Flags |= EFI_IFR_FLAG_READ_ONLY;
    447     }
    448 
    449     _FLAG_CLEAR (Flags, 0x02);
    450 
    451     if (_FLAG_TEST_AND_CLEAR (Flags, EFI_IFR_FLAG_CALLBACK)) {
    452       mHeader->Flags |= EFI_IFR_FLAG_CALLBACK;
    453     }
    454 
    455     //
    456     // ignore NVAccessFlag
    457     //
    458     _FLAG_CLEAR (Flags, 0x08);
    459 
    460     if (_FLAG_TEST_AND_CLEAR (Flags, EFI_IFR_FLAG_RESET_REQUIRED)) {
    461       mHeader->Flags |= EFI_IFR_FLAG_RESET_REQUIRED;
    462     }
    463 
    464     if (_FLAG_TEST_AND_CLEAR (Flags, EFI_IFR_FLAG_RECONNECT_REQUIRED)) {
    465       mHeader->Flags |= EFI_IFR_FLAG_RECONNECT_REQUIRED;
    466     }
    467 
    468     //
    469     //  Set LateCheck Flag to compatible for framework flag
    470     //  but it uses 0x20 as its flag, if in the future UEFI may take this flag
    471     //
    472     if (_FLAG_TEST_AND_CLEAR (Flags, 0x20)) {
    473       mHeader->Flags |= 0x20;
    474     }
    475 
    476     if (_FLAG_TEST_AND_CLEAR (Flags, EFI_IFR_FLAG_OPTIONS_ONLY)) {
    477       mHeader->Flags |= EFI_IFR_FLAG_OPTIONS_ONLY;
    478     }
    479 
    480     return _FLAGS_ZERO (Flags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
    481   }
    482 
    483   VOID UpdateCIfrQuestionHeader (IN EFI_IFR_QUESTION_HEADER *Header) {
    484     mHeader = Header;
    485   }
    486 };
    487 
    488 /*
    489  * The definition of CIfrMinMaxStepData
    490  */
    491 class CIfrMinMaxStepData {
    492 private:
    493   MINMAXSTEP_DATA *mMinMaxStepData;
    494   BOOLEAN         ValueIsSet;
    495   BOOLEAN         IsNumeric;
    496 
    497 public:
    498   CIfrMinMaxStepData (MINMAXSTEP_DATA *DataAddr, BOOLEAN NumericOpcode=FALSE) : mMinMaxStepData (DataAddr) {
    499     mMinMaxStepData->u64.MinValue = 0;
    500     mMinMaxStepData->u64.MaxValue = 0;
    501     mMinMaxStepData->u64.Step     = 0;
    502     ValueIsSet = FALSE;
    503     IsNumeric = NumericOpcode;
    504   }
    505 
    506   VOID SetMinMaxStepData (IN UINT64 MinValue, IN UINT64 MaxValue, IN UINT64 Step) {
    507     if (!ValueIsSet) {
    508       mMinMaxStepData->u64.MinValue = MinValue;
    509       mMinMaxStepData->u64.MaxValue = MaxValue;
    510       ValueIsSet = TRUE;
    511     } else {
    512       if (MinValue < mMinMaxStepData->u64.MinValue) {
    513         mMinMaxStepData->u64.MinValue = MinValue;
    514       }
    515       if (MaxValue > mMinMaxStepData->u64.MaxValue) {
    516         mMinMaxStepData->u64.MaxValue = MaxValue;
    517       }
    518     }
    519     mMinMaxStepData->u64.Step = Step;
    520   }
    521 
    522   VOID SetMinMaxStepData (IN UINT32 MinValue, IN UINT32 MaxValue, IN UINT32 Step) {
    523     if (!ValueIsSet) {
    524       mMinMaxStepData->u32.MinValue = MinValue;
    525       mMinMaxStepData->u32.MaxValue = MaxValue;
    526       ValueIsSet = TRUE;
    527     } else {
    528       if (MinValue < mMinMaxStepData->u32.MinValue) {
    529         mMinMaxStepData->u32.MinValue = MinValue;
    530       }
    531       if (MaxValue > mMinMaxStepData->u32.MaxValue) {
    532         mMinMaxStepData->u32.MaxValue = MaxValue;
    533       }
    534     }
    535     mMinMaxStepData->u32.Step = Step;
    536   }
    537 
    538   VOID SetMinMaxStepData (IN UINT16 MinValue, IN UINT16 MaxValue, IN UINT16 Step) {
    539     if (!ValueIsSet) {
    540       mMinMaxStepData->u16.MinValue = MinValue;
    541       mMinMaxStepData->u16.MaxValue = MaxValue;
    542       ValueIsSet = TRUE;
    543     } else {
    544       if (MinValue < mMinMaxStepData->u16.MinValue) {
    545         mMinMaxStepData->u16.MinValue = MinValue;
    546       }
    547       if (MaxValue > mMinMaxStepData->u16.MaxValue) {
    548         mMinMaxStepData->u16.MaxValue = MaxValue;
    549       }
    550     }
    551     mMinMaxStepData->u16.Step = Step;
    552   }
    553 
    554   VOID SetMinMaxStepData (IN UINT8 MinValue, IN UINT8 MaxValue, IN UINT8 Step) {
    555     if (!ValueIsSet) {
    556       mMinMaxStepData->u8.MinValue = MinValue;
    557       mMinMaxStepData->u8.MaxValue = MaxValue;
    558       ValueIsSet = TRUE;
    559     } else {
    560       if (MinValue < mMinMaxStepData->u8.MinValue) {
    561         mMinMaxStepData->u8.MinValue = MinValue;
    562       }
    563       if (MaxValue > mMinMaxStepData->u8.MaxValue) {
    564         mMinMaxStepData->u8.MaxValue = MaxValue;
    565       }
    566     }
    567     mMinMaxStepData->u8.Step = Step;
    568   }
    569 
    570   UINT64 GetMinData (UINT8 VarType) {
    571     UINT64 MinValue = 0;
    572     switch (VarType) {
    573     case EFI_IFR_TYPE_NUM_SIZE_64:
    574       MinValue = mMinMaxStepData->u64.MinValue;
    575       break;
    576     case EFI_IFR_TYPE_NUM_SIZE_32:
    577       MinValue = (UINT64) mMinMaxStepData->u32.MinValue;
    578       break;
    579     case EFI_IFR_TYPE_NUM_SIZE_16:
    580       MinValue = (UINT64) mMinMaxStepData->u16.MinValue;
    581       break;
    582     case EFI_IFR_TYPE_NUM_SIZE_8:
    583       MinValue = (UINT64) mMinMaxStepData->u8.MinValue;
    584       break;
    585     default:
    586       break;
    587     }
    588     return MinValue;
    589   }
    590 
    591   UINT64 GetMaxData (UINT8 VarType) {
    592     UINT64 MaxValue = 0;
    593     switch (VarType) {
    594     case EFI_IFR_TYPE_NUM_SIZE_64:
    595       MaxValue = mMinMaxStepData->u64.MaxValue;
    596       break;
    597     case EFI_IFR_TYPE_NUM_SIZE_32:
    598       MaxValue = (UINT64) mMinMaxStepData->u32.MaxValue;
    599       break;
    600     case EFI_IFR_TYPE_NUM_SIZE_16:
    601       MaxValue = (UINT64) mMinMaxStepData->u16.MaxValue;
    602       break;
    603     case EFI_IFR_TYPE_NUM_SIZE_8:
    604       MaxValue = (UINT64) mMinMaxStepData->u8.MaxValue;
    605       break;
    606     default:
    607       break;
    608     }
    609     return MaxValue;
    610   }
    611 
    612   UINT64 GetStepData (UINT8 VarType) {
    613     UINT64 MaxValue = 0;
    614     switch (VarType) {
    615     case EFI_IFR_TYPE_NUM_SIZE_64:
    616       MaxValue = mMinMaxStepData->u64.Step;
    617       break;
    618     case EFI_IFR_TYPE_NUM_SIZE_32:
    619       MaxValue = (UINT64) mMinMaxStepData->u32.Step;
    620       break;
    621     case EFI_IFR_TYPE_NUM_SIZE_16:
    622       MaxValue = (UINT64) mMinMaxStepData->u16.Step;
    623       break;
    624     case EFI_IFR_TYPE_NUM_SIZE_8:
    625       MaxValue = (UINT64) mMinMaxStepData->u8.Step;
    626       break;
    627     default:
    628       break;
    629     }
    630     return MaxValue;
    631   }
    632 
    633   BOOLEAN IsNumericOpcode () {
    634     return IsNumeric;
    635   }
    636 
    637   VOID UpdateCIfrMinMaxStepData (IN MINMAXSTEP_DATA *MinMaxStepData) {
    638     mMinMaxStepData = MinMaxStepData;
    639   }
    640 };
    641 
    642 static CIfrQuestionHeader *gCurrentQuestion  = NULL;
    643 static CIfrMinMaxStepData *gCurrentMinMaxData = NULL;
    644 static BOOLEAN            gIsOrderedList = FALSE;
    645 static BOOLEAN            gIsStringOp = FALSE;
    646 
    647 /*
    648  * The definition of all of the UEFI IFR Objects
    649  */
    650 class CIfrFormSet : public CIfrObj, public CIfrOpHeader {
    651 private:
    652   EFI_IFR_FORM_SET *mFormSet;
    653   EFI_GUID *mClassGuid;
    654 
    655 public:
    656   CIfrFormSet (UINT8 Size) : CIfrObj (EFI_IFR_FORM_SET_OP, (CHAR8 **)&mFormSet, Size),
    657                    CIfrOpHeader (EFI_IFR_FORM_SET_OP, &mFormSet->Header, Size) {
    658     mFormSet->Help         = EFI_STRING_ID_INVALID;
    659     mFormSet->FormSetTitle = EFI_STRING_ID_INVALID;
    660     mFormSet->Flags        = 0;
    661     memset (&mFormSet->Guid, 0, sizeof (EFI_GUID));
    662     mClassGuid = (EFI_GUID *) (mFormSet + 1);
    663   }
    664 
    665   VOID SetGuid (IN EFI_GUID *Guid) {
    666     memmove (&mFormSet->Guid, Guid, sizeof (EFI_GUID));
    667   }
    668 
    669   VOID SetFormSetTitle (IN EFI_STRING_ID FormSetTitle) {
    670     mFormSet->FormSetTitle = FormSetTitle;
    671   }
    672 
    673   VOID SetHelp (IN EFI_STRING_ID Help) {
    674     mFormSet->Help = Help;
    675   }
    676 
    677   VOID SetClassGuid (IN EFI_GUID *Guid) {
    678     memmove (&(mClassGuid[mFormSet->Flags++]), Guid, sizeof (EFI_GUID));
    679   }
    680 
    681   UINT8 GetFlags() {
    682     return mFormSet->Flags;
    683   }
    684 };
    685 
    686 class CIfrEnd : public CIfrObj, public CIfrOpHeader {
    687 private:
    688   EFI_IFR_END  *mEnd;
    689 
    690 public:
    691   CIfrEnd () : CIfrObj (EFI_IFR_END_OP, (CHAR8 **)&mEnd),
    692                CIfrOpHeader (EFI_IFR_END_OP, &mEnd->Header) {}
    693 };
    694 
    695 class CIfrDefaultStore : public CIfrObj, public CIfrOpHeader {
    696 private:
    697   EFI_IFR_DEFAULTSTORE *mDefaultStore;
    698 
    699 public:
    700   CIfrDefaultStore () : CIfrObj (EFI_IFR_DEFAULTSTORE_OP, (CHAR8 **)&mDefaultStore),
    701                        CIfrOpHeader (EFI_IFR_DEFAULTSTORE_OP, &mDefaultStore->Header) {
    702     mDefaultStore->DefaultId   = EFI_VARSTORE_ID_INVALID;
    703     mDefaultStore->DefaultName = EFI_STRING_ID_INVALID;
    704   }
    705 
    706   VOID SetDefaultName (IN EFI_STRING_ID DefaultName) {
    707     mDefaultStore->DefaultName = DefaultName;
    708   }
    709 
    710   VOID SetDefaultId (IN UINT16 DefaultId) {
    711     mDefaultStore->DefaultId = DefaultId;
    712   }
    713 };
    714 
    715 #define EFI_FORM_ID_MAX                    0xFFFF
    716 #define EFI_FREE_FORM_ID_BITMAP_SIZE     ((EFI_FORM_ID_MAX + 1) / EFI_BITS_PER_UINT32)
    717 
    718 class CIfrFormId {
    719 public:
    720   STATIC UINT32 FormIdBitMap[EFI_FREE_FORM_ID_BITMAP_SIZE];
    721 
    722   STATIC BOOLEAN ChekFormIdFree (IN EFI_FORM_ID FormId) {
    723     UINT32 Index  = (FormId / EFI_BITS_PER_UINT32);
    724     UINT32 Offset = (FormId % EFI_BITS_PER_UINT32);
    725 
    726     return (FormIdBitMap[Index] & (0x80000000 >> Offset)) == 0;
    727   }
    728 
    729   STATIC VOID MarkFormIdUsed (IN EFI_FORM_ID FormId) {
    730     UINT32 Index  = (FormId / EFI_BITS_PER_UINT32);
    731     UINT32 Offset = (FormId % EFI_BITS_PER_UINT32);
    732 
    733     FormIdBitMap[Index] |= (0x80000000 >> Offset);
    734   }
    735 };
    736 
    737 class CIfrForm : public CIfrObj, public CIfrOpHeader {
    738 private:
    739   EFI_IFR_FORM  *mForm;
    740 
    741 public:
    742   CIfrForm () : CIfrObj (EFI_IFR_FORM_OP, (CHAR8 **)&mForm),
    743                 CIfrOpHeader (EFI_IFR_FORM_OP, &mForm->Header) {
    744     mForm->FormId    = 0;
    745     mForm->FormTitle = EFI_STRING_ID_INVALID;
    746   }
    747 
    748   EFI_VFR_RETURN_CODE SetFormId (IN EFI_FORM_ID FormId) {
    749     if (FormId == 0) {
    750       //
    751       // FormId can't be 0.
    752       //
    753       return VFR_RETURN_INVALID_PARAMETER;
    754     }
    755     if (CIfrFormId::ChekFormIdFree (FormId) == FALSE) {
    756       return VFR_RETURN_FORMID_REDEFINED;
    757     }
    758     mForm->FormId = FormId;
    759     CIfrFormId::MarkFormIdUsed (FormId);
    760     return VFR_RETURN_SUCCESS;
    761   }
    762 
    763   VOID SetFormTitle (IN EFI_STRING_ID FormTitle) {
    764     mForm->FormTitle = FormTitle;
    765   }
    766 };
    767 
    768 class CIfrFormMap : public CIfrObj, public CIfrOpHeader {
    769 private:
    770   EFI_IFR_FORM_MAP        *mFormMap;
    771   EFI_IFR_FORM_MAP_METHOD *mMethodMap;
    772 
    773 public:
    774   CIfrFormMap () : CIfrObj (EFI_IFR_FORM_MAP_OP, (CHAR8 **)&mFormMap, sizeof (EFI_IFR_FORM_MAP), TRUE),
    775                    CIfrOpHeader (EFI_IFR_FORM_MAP_OP, &mFormMap->Header) {
    776     mFormMap->FormId = 0;
    777     mMethodMap       = (EFI_IFR_FORM_MAP_METHOD *) (mFormMap + 1);
    778   }
    779 
    780   EFI_VFR_RETURN_CODE SetFormId (IN EFI_FORM_ID FormId) {
    781     if (FormId == 0) {
    782       //
    783       // FormId can't be 0.
    784       //
    785       return VFR_RETURN_INVALID_PARAMETER;
    786     }
    787     if (CIfrFormId::ChekFormIdFree (FormId) == FALSE) {
    788       return VFR_RETURN_FORMID_REDEFINED;
    789     }
    790     mFormMap->FormId = FormId;
    791     CIfrFormId::MarkFormIdUsed (FormId);
    792     return VFR_RETURN_SUCCESS;
    793   }
    794 
    795   VOID SetFormMapMethod (IN EFI_STRING_ID MethodTitle, IN EFI_GUID *MethodGuid) {
    796     if (ExpendObjBin (sizeof (EFI_IFR_FORM_MAP_METHOD))) {
    797       IncLength (sizeof (EFI_IFR_FORM_MAP_METHOD));
    798 
    799       mMethodMap->MethodTitle = MethodTitle;
    800       memmove (&(mMethodMap->MethodIdentifier), MethodGuid, sizeof (EFI_GUID));
    801       mMethodMap ++;
    802     }
    803   }
    804 };
    805 
    806 class CIfrVarStore : public CIfrObj, public CIfrOpHeader {
    807 private:
    808   EFI_IFR_VARSTORE *mVarStore;
    809 
    810 public:
    811   CIfrVarStore () : CIfrObj (EFI_IFR_VARSTORE_OP, (CHAR8 **)&mVarStore, sizeof (EFI_IFR_VARSTORE), TRUE),
    812                    CIfrOpHeader (EFI_IFR_VARSTORE_OP, &mVarStore->Header) {
    813     mVarStore->VarStoreId = EFI_VARSTORE_ID_INVALID;
    814     mVarStore->Size       = 0;
    815     memset (&mVarStore->Guid, 0, sizeof (EFI_GUID));
    816     mVarStore->Name[0]    = '\0';
    817   }
    818 
    819   VOID SetGuid (IN EFI_GUID *Guid) {
    820     memmove (&mVarStore->Guid, Guid, sizeof (EFI_GUID));
    821   }
    822 
    823   VOID SetVarStoreId (IN EFI_VARSTORE_ID VarStoreId) {
    824     mVarStore->VarStoreId = VarStoreId;
    825   }
    826 
    827   VOID SetSize (IN UINT16 Size) {
    828     mVarStore->Size = Size;
    829   }
    830 
    831   VOID SetName (IN CHAR8 *Name) {
    832     UINT8 Len;
    833 
    834     if (Name != NULL) {
    835       Len = (UINT8) strlen (Name);
    836       if (Len != 0) {
    837         if (ExpendObjBin (Len) == TRUE) {
    838           IncLength (Len);
    839           strcpy ((CHAR8 *)(mVarStore->Name), Name);
    840         }
    841       }
    842     }
    843   }
    844 };
    845 
    846 class CIfrVarStoreEfi : public CIfrObj, public CIfrOpHeader {
    847 private:
    848   EFI_IFR_VARSTORE_EFI *mVarStoreEfi;
    849 
    850 public:
    851   CIfrVarStoreEfi () : CIfrObj (EFI_IFR_VARSTORE_EFI_OP, (CHAR8 **)&mVarStoreEfi, sizeof (EFI_IFR_VARSTORE_EFI), TRUE),
    852                       CIfrOpHeader (EFI_IFR_VARSTORE_EFI_OP, &mVarStoreEfi->Header) {
    853     mVarStoreEfi->VarStoreId = EFI_VAROFFSET_INVALID;
    854     mVarStoreEfi->Size       = 0;
    855     memset (&mVarStoreEfi->Guid, 0, sizeof (EFI_GUID));
    856     mVarStoreEfi->Name[0]    = '\0';
    857   }
    858 
    859   VOID SetGuid (IN EFI_GUID *Guid) {
    860     memmove (&mVarStoreEfi->Guid, Guid, sizeof (EFI_GUID));
    861   }
    862 
    863   VOID SetVarStoreId (IN UINT16 VarStoreId) {
    864     mVarStoreEfi->VarStoreId = VarStoreId;
    865   }
    866 
    867   VOID SetAttributes (IN UINT32 Attributes) {
    868     mVarStoreEfi->Attributes = Attributes;
    869   }
    870   VOID SetSize (IN UINT16 Size) {
    871     mVarStoreEfi->Size = Size;
    872   }
    873 
    874   VOID SetName (IN CHAR8 *Name) {
    875     UINT8 Len;
    876 
    877     if (Name != NULL) {
    878       Len = (UINT8) strlen (Name);
    879       if (Len != 0) {
    880         if (ExpendObjBin (Len) == TRUE) {
    881           IncLength (Len);
    882           strcpy ((CHAR8 *)(mVarStoreEfi->Name), Name);
    883         }
    884       }
    885     }
    886   }
    887 
    888   VOID SetBinaryLength (IN UINT16 Size) {
    889     UINT16 Len;
    890 
    891     Len = sizeof (EFI_IFR_VARSTORE_EFI);
    892     if (Size > Len) {
    893       ExpendObjBin(Size - Len);
    894       IncLength(Size - Len);
    895     } else {
    896       ShrinkObjBin(Len - Size);
    897       DecLength(Len - Size);
    898     }
    899   }
    900 };
    901 
    902 class CIfrVarStoreNameValue : public CIfrObj, public CIfrOpHeader {
    903 private:
    904   EFI_IFR_VARSTORE_NAME_VALUE *mVarStoreNameValue;
    905 
    906 public:
    907   CIfrVarStoreNameValue () : CIfrObj (EFI_IFR_VARSTORE_NAME_VALUE_OP, (CHAR8 **)&mVarStoreNameValue),
    908                               CIfrOpHeader (EFI_IFR_VARSTORE_NAME_VALUE_OP, &mVarStoreNameValue->Header) {
    909     mVarStoreNameValue->VarStoreId = EFI_VAROFFSET_INVALID;
    910     memset (&mVarStoreNameValue->Guid, 0, sizeof (EFI_GUID));
    911   }
    912 
    913   VOID SetGuid (IN EFI_GUID *Guid) {
    914     memmove (&mVarStoreNameValue->Guid, Guid, sizeof (EFI_GUID));
    915   }
    916 
    917   VOID SetVarStoreId (IN UINT16 VarStoreId) {
    918     mVarStoreNameValue->VarStoreId = VarStoreId;
    919   }
    920 };
    921 
    922 class CIfrImage : public CIfrObj, public CIfrOpHeader {
    923 private:
    924   EFI_IFR_IMAGE *mImage;
    925 
    926 public:
    927   CIfrImage () : CIfrObj (EFI_IFR_IMAGE_OP, (CHAR8 **)&mImage),
    928                  CIfrOpHeader (EFI_IFR_IMAGE_OP, &mImage->Header) {
    929     mImage->Id = EFI_IMAGE_ID_INVALID;
    930   }
    931 
    932   VOID SetImageId (IN EFI_IMAGE_ID ImageId) {
    933     mImage->Id = ImageId;
    934   }
    935 };
    936 
    937 class CIfrModal : public CIfrObj, public CIfrOpHeader {
    938 private:
    939   EFI_IFR_MODAL_TAG *mModal;
    940 
    941 public:
    942   CIfrModal () : CIfrObj (EFI_IFR_MODAL_TAG_OP, (CHAR8 **)&mModal),
    943                  CIfrOpHeader (EFI_IFR_MODAL_TAG_OP, &mModal->Header) {
    944   }
    945 };
    946 
    947 
    948 class CIfrLocked : public CIfrObj, public CIfrOpHeader {
    949 private:
    950   EFI_IFR_LOCKED *mLocked;
    951 
    952 public:
    953   CIfrLocked () : CIfrObj (EFI_IFR_LOCKED_OP, (CHAR8 **)&mLocked),
    954                   CIfrOpHeader (EFI_IFR_LOCKED_OP, &mLocked->Header) {}
    955 };
    956 
    957 class CIfrRule : public CIfrObj, public CIfrOpHeader {
    958 private:
    959   EFI_IFR_RULE *mRule;
    960 
    961 public:
    962   CIfrRule () : CIfrObj (EFI_IFR_RULE_OP, (CHAR8 **)&mRule),
    963                 mRule ((EFI_IFR_RULE *)GetObjBinAddr()),
    964                 CIfrOpHeader (EFI_IFR_RULE_OP, &mRule->Header) {
    965     mRule->RuleId = EFI_RULE_ID_INVALID;
    966   }
    967 
    968   VOID SetRuleId (IN UINT8 RuleId) {
    969     mRule->RuleId = RuleId;
    970   }
    971 };
    972 
    973 static EFI_IFR_TYPE_VALUE gZeroEfiIfrTypeValue = {0, };
    974 
    975 class CIfrDefault : public CIfrObj, public CIfrOpHeader {
    976 private:
    977   EFI_IFR_DEFAULT *mDefault;
    978 
    979 public:
    980   CIfrDefault (
    981     IN UINT8              Size,
    982     IN UINT16             DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD,
    983     IN UINT8              Type      = EFI_IFR_TYPE_OTHER,
    984     IN EFI_IFR_TYPE_VALUE Value     = gZeroEfiIfrTypeValue
    985     ) : CIfrObj (EFI_IFR_DEFAULT_OP, (CHAR8 **)&mDefault, Size),
    986         CIfrOpHeader (EFI_IFR_DEFAULT_OP, &mDefault->Header, Size) {
    987     mDefault->Type      = Type;
    988     mDefault->DefaultId = DefaultId;
    989     memmove (&(mDefault->Value), &Value, Size - OFFSET_OF (EFI_IFR_DEFAULT, Value));
    990   }
    991 
    992   VOID SetDefaultId (IN UINT16 DefaultId) {
    993     mDefault->DefaultId = DefaultId;
    994   }
    995 
    996   VOID SetType (IN UINT8 Type) {
    997     mDefault->Type = Type;
    998   }
    999 
   1000   VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) {
   1001     memmove (&mDefault->Value, &Value, mDefault->Header.Length - OFFSET_OF (EFI_IFR_DEFAULT, Value));
   1002   }
   1003 };
   1004 
   1005 class CIfrDefault2 : public CIfrObj, public CIfrOpHeader {
   1006 private:
   1007   EFI_IFR_DEFAULT_2 *mDefault;
   1008 
   1009 public:
   1010   CIfrDefault2 (
   1011     IN UINT16             DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD,
   1012     IN UINT8              Type      = EFI_IFR_TYPE_OTHER
   1013     ) : CIfrObj (EFI_IFR_DEFAULT_OP, (CHAR8 **)&mDefault, sizeof (EFI_IFR_DEFAULT_2)),
   1014         CIfrOpHeader (EFI_IFR_DEFAULT_OP, &mDefault->Header, sizeof (EFI_IFR_DEFAULT_2)) {
   1015     mDefault->Type      = Type;
   1016     mDefault->DefaultId = DefaultId;
   1017   }
   1018 
   1019   VOID SetDefaultId (IN UINT16 DefaultId) {
   1020     mDefault->DefaultId = DefaultId;
   1021   }
   1022 
   1023   VOID SetType (IN UINT8 Type) {
   1024     mDefault->Type = Type;
   1025   }
   1026 };
   1027 
   1028 class CIfrValue : public CIfrObj, public CIfrOpHeader{
   1029 private:
   1030   EFI_IFR_VALUE *mValue;
   1031 
   1032 public:
   1033   CIfrValue () : CIfrObj (EFI_IFR_VALUE_OP, (CHAR8 **)&mValue),
   1034                 CIfrOpHeader (EFI_IFR_VALUE_OP, &mValue->Header) {}
   1035 
   1036 };
   1037 
   1038 class CIfrRead : public CIfrObj, public CIfrOpHeader{
   1039 private:
   1040   EFI_IFR_READ *mRead;
   1041 
   1042 public:
   1043   CIfrRead () : CIfrObj (EFI_IFR_READ_OP, (CHAR8 **)&mRead),
   1044                 CIfrOpHeader (EFI_IFR_READ_OP, &mRead->Header) {}
   1045 
   1046 };
   1047 
   1048 class CIfrWrite : public CIfrObj, public CIfrOpHeader{
   1049 private:
   1050   EFI_IFR_WRITE *mWrite;
   1051 
   1052 public:
   1053   CIfrWrite () : CIfrObj (EFI_IFR_WRITE_OP, (CHAR8 **)&mWrite),
   1054                 CIfrOpHeader (EFI_IFR_WRITE_OP, &mWrite->Header) {}
   1055 
   1056 };
   1057 
   1058 class CIfrGet : public CIfrObj, public CIfrOpHeader{
   1059 private:
   1060   EFI_IFR_GET *mGet;
   1061 
   1062 public:
   1063   CIfrGet (
   1064   IN UINT32 LineNo
   1065   ) : CIfrObj (EFI_IFR_GET_OP, (CHAR8 **)&mGet),
   1066       CIfrOpHeader (EFI_IFR_GET_OP, &mGet->Header) {
   1067     SetLineNo (LineNo);
   1068   }
   1069 
   1070   VOID SetVarInfo (IN EFI_VARSTORE_INFO *Info) {
   1071     mGet->VarStoreId             = Info->mVarStoreId;
   1072     mGet->VarStoreInfo.VarName   = Info->mInfo.mVarName;
   1073     mGet->VarStoreInfo.VarOffset = Info->mInfo.mVarOffset;
   1074     mGet->VarStoreType           = Info->mVarType;
   1075   }
   1076 };
   1077 
   1078 class CIfrSet : public CIfrObj, public CIfrOpHeader{
   1079 private:
   1080   EFI_IFR_SET *mSet;
   1081 
   1082 public:
   1083   CIfrSet (
   1084   IN UINT32 LineNo
   1085   ) : CIfrObj (EFI_IFR_SET_OP, (CHAR8 **)&mSet),
   1086       CIfrOpHeader (EFI_IFR_SET_OP, &mSet->Header) {
   1087     SetLineNo (LineNo);
   1088   }
   1089 
   1090   VOID SetVarInfo (IN EFI_VARSTORE_INFO *Info) {
   1091     mSet->VarStoreId             = Info->mVarStoreId;
   1092     mSet->VarStoreInfo.VarName   = Info->mInfo.mVarName;
   1093     mSet->VarStoreInfo.VarOffset = Info->mInfo.mVarOffset;
   1094     mSet->VarStoreType           = Info->mVarType;
   1095   }
   1096 };
   1097 
   1098 class CIfrSubtitle : public CIfrObj, public CIfrOpHeader, public CIfrStatementHeader {
   1099 private:
   1100   EFI_IFR_SUBTITLE   *mSubtitle;
   1101 
   1102 public:
   1103   CIfrSubtitle () : CIfrObj (EFI_IFR_SUBTITLE_OP, (CHAR8 **)&mSubtitle),
   1104                   CIfrOpHeader (EFI_IFR_SUBTITLE_OP, &mSubtitle->Header),
   1105   CIfrStatementHeader (&mSubtitle->Statement) {
   1106     mSubtitle->Flags = 0;
   1107   }
   1108 
   1109   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 LFlags) {
   1110     if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_FLAGS_HORIZONTAL)) {
   1111       mSubtitle->Flags |= EFI_IFR_FLAGS_HORIZONTAL;
   1112     }
   1113 
   1114     return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
   1115   }
   1116 };
   1117 
   1118 class CIfrText : public CIfrObj, public CIfrOpHeader, public CIfrStatementHeader {
   1119 private:
   1120   EFI_IFR_TEXT *mText;
   1121 
   1122 public:
   1123   CIfrText () : CIfrObj (EFI_IFR_TEXT_OP, (CHAR8 **)&mText),
   1124                CIfrOpHeader (EFI_IFR_TEXT_OP, &mText->Header),
   1125                CIfrStatementHeader (&mText->Statement) {
   1126     mText->TextTwo = EFI_STRING_ID_INVALID;
   1127   }
   1128 
   1129   VOID SetTextTwo (IN EFI_STRING_ID StringId) {
   1130     mText->TextTwo = StringId;
   1131   }
   1132 };
   1133 
   1134 class CIfrRef : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
   1135 private:
   1136   EFI_IFR_REF *mRef;
   1137 
   1138 public:
   1139   CIfrRef () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)&mRef),
   1140               CIfrOpHeader (EFI_IFR_REF_OP, &mRef->Header),
   1141               CIfrQuestionHeader (&mRef->Question) {
   1142     mRef->FormId = 0;
   1143   }
   1144 
   1145   VOID SetFormId (IN EFI_FORM_ID FormId) {
   1146     mRef->FormId = FormId;
   1147   }
   1148 };
   1149 
   1150 class CIfrRef2 : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
   1151 private:
   1152   EFI_IFR_REF2 *mRef2;
   1153 
   1154 public:
   1155   CIfrRef2 () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)&mRef2, sizeof (EFI_IFR_REF2)),
   1156                CIfrOpHeader (EFI_IFR_REF_OP, &mRef2->Header, sizeof (EFI_IFR_REF2)),
   1157                CIfrQuestionHeader (&mRef2->Question) {
   1158     mRef2->FormId     = 0;
   1159     mRef2->QuestionId = EFI_QUESTION_ID_INVALID;
   1160   }
   1161 
   1162   VOID SetFormId (IN EFI_FORM_ID FormId) {
   1163     mRef2->FormId = FormId;
   1164   }
   1165 
   1166   VOID SetQuestionId (IN EFI_QUESTION_ID QuestionId) {
   1167     mRef2->QuestionId = QuestionId;
   1168   }
   1169 };
   1170 
   1171 class CIfrRef3 : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
   1172 private:
   1173   EFI_IFR_REF3 *mRef3;
   1174 
   1175 public:
   1176   CIfrRef3 () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)&mRef3, sizeof(EFI_IFR_REF3)),
   1177                CIfrOpHeader (EFI_IFR_REF_OP, &mRef3->Header, sizeof (EFI_IFR_REF3)),
   1178                CIfrQuestionHeader (&mRef3->Question) {
   1179     mRef3->FormId     = 0;
   1180     mRef3->QuestionId = EFI_QUESTION_ID_INVALID;
   1181     memset (&mRef3->FormSetId, 0, sizeof (EFI_GUID));
   1182   }
   1183 
   1184   VOID SetFormId (IN EFI_FORM_ID FormId) {
   1185     mRef3->FormId = FormId;
   1186   }
   1187 
   1188   VOID SetQuestionId (IN EFI_QUESTION_ID QuestionId) {
   1189     mRef3->QuestionId = QuestionId;
   1190   }
   1191 
   1192   VOID SetFormSetId (IN EFI_GUID FormSetId) {
   1193     mRef3->FormSetId = FormSetId;
   1194   }
   1195 };
   1196 
   1197 class CIfrRef4 : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
   1198 private:
   1199   EFI_IFR_REF4 *mRef4;
   1200 
   1201 public:
   1202   CIfrRef4 () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)&mRef4, sizeof(EFI_IFR_REF4)),
   1203                CIfrOpHeader (EFI_IFR_REF_OP, &mRef4->Header, sizeof(EFI_IFR_REF4)),
   1204                CIfrQuestionHeader (&mRef4->Question) {
   1205     mRef4->FormId     = 0;
   1206     mRef4->QuestionId = EFI_QUESTION_ID_INVALID;
   1207     memset (&mRef4->FormSetId, 0, sizeof (EFI_GUID));
   1208     mRef4->DevicePath = EFI_STRING_ID_INVALID;
   1209   }
   1210 
   1211   VOID SetFormId (IN EFI_FORM_ID FormId) {
   1212     mRef4->FormId = FormId;
   1213   }
   1214 
   1215   VOID SetQuestionId (IN EFI_QUESTION_ID QuestionId) {
   1216     mRef4->QuestionId = QuestionId;
   1217   }
   1218 
   1219   VOID SetFormSetId (IN EFI_GUID FormSetId) {
   1220     mRef4->FormSetId = FormSetId;
   1221   }
   1222 
   1223   VOID SetDevicePath (IN EFI_STRING_ID DevicePath) {
   1224     mRef4->DevicePath = DevicePath;
   1225   }
   1226 };
   1227 
   1228 class CIfrRef5 : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
   1229 private:
   1230   EFI_IFR_REF5 *mRef5;
   1231 
   1232 public:
   1233   CIfrRef5 () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)&mRef5, sizeof (EFI_IFR_REF5)),
   1234               CIfrOpHeader (EFI_IFR_REF_OP, &mRef5->Header, sizeof (EFI_IFR_REF5)),
   1235               CIfrQuestionHeader (&mRef5->Question) {
   1236   }
   1237 };
   1238 
   1239 class CIfrResetButton : public CIfrObj, public CIfrOpHeader, public CIfrStatementHeader {
   1240 private:
   1241   EFI_IFR_RESET_BUTTON *mResetButton;
   1242 
   1243 public:
   1244   CIfrResetButton () : CIfrObj (EFI_IFR_RESET_BUTTON_OP, (CHAR8 **)&mResetButton),
   1245                        CIfrOpHeader (EFI_IFR_RESET_BUTTON_OP, &mResetButton->Header),
   1246   CIfrStatementHeader (&mResetButton->Statement) {
   1247     mResetButton->DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
   1248   }
   1249 
   1250   VOID SetDefaultId (IN UINT16 DefaultId) {
   1251     mResetButton->DefaultId = DefaultId;
   1252   }
   1253 };
   1254 
   1255 class CIfrCheckBox : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader  {
   1256 private:
   1257   EFI_IFR_CHECKBOX *mCheckBox;
   1258 
   1259 public:
   1260   CIfrCheckBox () : CIfrObj (EFI_IFR_CHECKBOX_OP, (CHAR8 **)&mCheckBox),
   1261                      CIfrOpHeader (EFI_IFR_CHECKBOX_OP, &mCheckBox->Header),
   1262                      CIfrQuestionHeader (&mCheckBox->Question) {
   1263     mCheckBox->Flags = 0;
   1264     gCurrentQuestion  = this;
   1265   }
   1266 
   1267   ~CIfrCheckBox () {
   1268     gCurrentQuestion  = NULL;
   1269   }
   1270 
   1271   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, UINT8 LFlags) {
   1272     EFI_VFR_RETURN_CODE Ret;
   1273 
   1274     Ret = CIfrQuestionHeader::SetFlags (HFlags);
   1275     if (Ret != VFR_RETURN_SUCCESS) {
   1276       return Ret;
   1277     }
   1278 
   1279     if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_CHECKBOX_DEFAULT)) {
   1280       mCheckBox->Flags |= EFI_IFR_CHECKBOX_DEFAULT;
   1281     }
   1282 
   1283     if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_CHECKBOX_DEFAULT_MFG)) {
   1284       mCheckBox->Flags |= EFI_IFR_CHECKBOX_DEFAULT_MFG;
   1285     }
   1286 
   1287     return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
   1288   }
   1289 
   1290   UINT8 GetFlags (VOID) {
   1291     return mCheckBox->Flags;
   1292   }
   1293 };
   1294 
   1295 class CIfrAction : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
   1296 private:
   1297   EFI_IFR_ACTION *mAction;
   1298 
   1299 public:
   1300   CIfrAction () : CIfrObj (EFI_IFR_ACTION_OP, (CHAR8 **)&mAction),
   1301                  CIfrOpHeader (EFI_IFR_ACTION_OP, &mAction->Header),
   1302                  CIfrQuestionHeader (&mAction->Question) {
   1303     mAction->QuestionConfig = EFI_STRING_ID_INVALID;
   1304   }
   1305 
   1306   VOID SetQuestionConfig (IN EFI_STRING_ID QuestionConfig) {
   1307     mAction->QuestionConfig = QuestionConfig;
   1308   }
   1309 };
   1310 
   1311 class CIfrDate : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
   1312 private:
   1313   EFI_IFR_DATE *mDate;
   1314 
   1315 public:
   1316   CIfrDate () : CIfrObj (EFI_IFR_DATE_OP, (CHAR8 **)&mDate),
   1317                CIfrOpHeader (EFI_IFR_DATE_OP, &mDate->Header),
   1318                CIfrQuestionHeader (&mDate->Question) {
   1319     mDate->Flags = 0;
   1320   }
   1321 
   1322   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
   1323     EFI_VFR_RETURN_CODE Ret;
   1324 
   1325     Ret = CIfrQuestionHeader::SetFlags (HFlags);
   1326     if (Ret != VFR_RETURN_SUCCESS) {
   1327       return Ret;
   1328     }
   1329 
   1330     if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_QF_DATE_YEAR_SUPPRESS)) {
   1331       mDate->Flags |= EFI_QF_DATE_YEAR_SUPPRESS;
   1332     }
   1333 
   1334     if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_QF_DATE_MONTH_SUPPRESS)) {
   1335       mDate->Flags |= EFI_QF_DATE_MONTH_SUPPRESS;
   1336     }
   1337 
   1338     if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_QF_DATE_DAY_SUPPRESS)) {
   1339       mDate->Flags |= EFI_QF_DATE_DAY_SUPPRESS;
   1340     }
   1341 
   1342     if (_FLAG_TEST_AND_CLEAR (LFlags, QF_DATE_STORAGE_NORMAL)) {
   1343       mDate->Flags |= QF_DATE_STORAGE_NORMAL;
   1344     } else if (_FLAG_TEST_AND_CLEAR (LFlags, QF_DATE_STORAGE_TIME)) {
   1345       mDate->Flags |= QF_DATE_STORAGE_TIME;
   1346     } else if (_FLAG_TEST_AND_CLEAR (LFlags, QF_DATE_STORAGE_WAKEUP)) {
   1347       mDate->Flags |= QF_DATE_STORAGE_WAKEUP;
   1348     }
   1349 
   1350     return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
   1351   }
   1352 };
   1353 
   1354 class CIfrNumeric : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader, public CIfrMinMaxStepData {
   1355 private:
   1356   EFI_IFR_NUMERIC *mNumeric;
   1357 
   1358 public:
   1359   CIfrNumeric () : CIfrObj (EFI_IFR_NUMERIC_OP, (CHAR8 **)&mNumeric, sizeof (EFI_IFR_NUMERIC), TRUE),
   1360                    CIfrOpHeader (EFI_IFR_NUMERIC_OP, &mNumeric->Header),
   1361                    CIfrQuestionHeader (&mNumeric->Question),
   1362                    CIfrMinMaxStepData (&mNumeric->data, TRUE) {
   1363     mNumeric->Flags  = EFI_IFR_NUMERIC_SIZE_1 | EFI_IFR_DISPLAY_UINT_DEC;
   1364     gCurrentQuestion   = this;
   1365     gCurrentMinMaxData = this;
   1366   }
   1367 
   1368   ~CIfrNumeric () {
   1369     gCurrentQuestion   = NULL;
   1370     gCurrentMinMaxData = NULL;
   1371   }
   1372 
   1373   VOID ShrinkBinSize (IN UINT16 Size) {
   1374     //
   1375     // Update the buffer size which is truly be used later.
   1376     //
   1377     ShrinkObjBin(Size);
   1378     DecLength(Size);
   1379 
   1380     //
   1381     // Allocate buffer in gCFormPkg.
   1382     //
   1383     _EMIT_PENDING_OBJ();
   1384 
   1385     //
   1386     // Update the buffer pointer used by other class.
   1387     //
   1388     mNumeric = (EFI_IFR_NUMERIC *) GetObjBinAddr();
   1389     UpdateHeader (&mNumeric->Header);
   1390     UpdateCIfrQuestionHeader(&mNumeric->Question);
   1391     UpdateCIfrMinMaxStepData(&mNumeric->data);
   1392   }
   1393 
   1394   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags, BOOLEAN DisplaySettingsSpecified = FALSE) {
   1395     EFI_VFR_RETURN_CODE Ret;
   1396 
   1397     Ret = CIfrQuestionHeader::SetFlags (HFlags);
   1398     if (Ret != VFR_RETURN_SUCCESS) {
   1399       return Ret;
   1400     }
   1401 
   1402     if (DisplaySettingsSpecified == FALSE) {
   1403       mNumeric->Flags = LFlags | EFI_IFR_DISPLAY_UINT_DEC;
   1404     } else {
   1405       mNumeric->Flags = LFlags;
   1406     }
   1407     return VFR_RETURN_SUCCESS;
   1408   }
   1409 
   1410   UINT8 GetNumericFlags () {
   1411     return mNumeric->Flags;
   1412   }
   1413 };
   1414 
   1415 class CIfrOneOf : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader, public CIfrMinMaxStepData {
   1416 private:
   1417   EFI_IFR_ONE_OF *mOneOf;
   1418 
   1419 public:
   1420   CIfrOneOf () : CIfrObj (EFI_IFR_ONE_OF_OP, (CHAR8 **)&mOneOf, sizeof (EFI_IFR_ONE_OF), TRUE),
   1421                  CIfrOpHeader (EFI_IFR_ONE_OF_OP, &mOneOf->Header),
   1422                  CIfrQuestionHeader (&mOneOf->Question),
   1423                  CIfrMinMaxStepData (&mOneOf->data) {
   1424     mOneOf->Flags    = 0;
   1425     gCurrentQuestion   = this;
   1426     gCurrentMinMaxData = this;
   1427   }
   1428 
   1429   ~CIfrOneOf () {
   1430     gCurrentQuestion   = NULL;
   1431     gCurrentMinMaxData = NULL;
   1432   }
   1433 
   1434   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
   1435     EFI_VFR_RETURN_CODE Ret;
   1436 
   1437     Ret = CIfrQuestionHeader::SetFlags (HFlags);
   1438     if (Ret != VFR_RETURN_SUCCESS) {
   1439       return Ret;
   1440     }
   1441 
   1442     if (LFlags & EFI_IFR_DISPLAY) {
   1443       mOneOf->Flags = LFlags;
   1444     } else {
   1445       mOneOf->Flags = LFlags | EFI_IFR_DISPLAY_UINT_DEC;
   1446     }
   1447     return VFR_RETURN_SUCCESS;
   1448   }
   1449 
   1450   VOID ShrinkBinSize (IN UINT16 Size) {
   1451     //
   1452     // Update the buffer size which is truly be used later.
   1453     //
   1454     ShrinkObjBin(Size);
   1455     DecLength(Size);
   1456 
   1457     //
   1458     // Allocate buffer in gCFormPkg.
   1459     //
   1460     _EMIT_PENDING_OBJ();
   1461 
   1462     //
   1463     // Update the buffer pointer used by other class.
   1464     //
   1465     mOneOf = (EFI_IFR_ONE_OF *) GetObjBinAddr();
   1466     UpdateHeader (&mOneOf->Header);
   1467     UpdateCIfrQuestionHeader(&mOneOf->Question);
   1468     UpdateCIfrMinMaxStepData(&mOneOf->data);
   1469   }
   1470 };
   1471 
   1472 class CIfrString : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
   1473 private:
   1474   EFI_IFR_STRING *mString;
   1475 
   1476 public:
   1477   CIfrString () : CIfrObj (EFI_IFR_STRING_OP, (CHAR8 **)&mString),
   1478                  CIfrOpHeader (EFI_IFR_STRING_OP, &mString->Header),
   1479                  CIfrQuestionHeader (&mString->Question) {
   1480     mString->Flags   = 0;
   1481     mString->MinSize = 0;
   1482     mString->MaxSize = 0;
   1483     gCurrentQuestion = this;
   1484   }
   1485 
   1486   ~CIfrString () {
   1487     gCurrentQuestion = NULL;
   1488   }
   1489 
   1490   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
   1491     EFI_VFR_RETURN_CODE Ret;
   1492 
   1493     Ret = CIfrQuestionHeader::SetFlags (HFlags);
   1494     if (Ret != VFR_RETURN_SUCCESS) {
   1495       return Ret;
   1496     }
   1497 
   1498     if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_STRING_MULTI_LINE)) {
   1499       mString->Flags |= EFI_IFR_STRING_MULTI_LINE;
   1500     }
   1501 
   1502     return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
   1503   }
   1504 
   1505   VOID SetMinSize (IN UINT8 Flags) {
   1506     mString->MinSize = Flags;
   1507   }
   1508 
   1509   VOID SetMaxSize (IN UINT8 MaxSize) {
   1510     mString->MaxSize = MaxSize;
   1511   }
   1512 };
   1513 
   1514 class CIfrPassword : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
   1515 private:
   1516   EFI_IFR_PASSWORD *mPassword;
   1517 
   1518 public:
   1519   CIfrPassword () : CIfrObj (EFI_IFR_PASSWORD_OP, (CHAR8 **)&mPassword),
   1520                     CIfrOpHeader (EFI_IFR_PASSWORD_OP, &mPassword->Header),
   1521                     CIfrQuestionHeader (&mPassword->Question) {
   1522     mPassword->MinSize = 0;
   1523     mPassword->MaxSize = 0;
   1524     gCurrentQuestion   = this;
   1525   }
   1526 
   1527   ~CIfrPassword () {
   1528     gCurrentQuestion = NULL;
   1529   }
   1530 
   1531   VOID SetMinSize (IN UINT16 MinSize) {
   1532     mPassword->MinSize = MinSize;
   1533   }
   1534 
   1535   VOID SetMaxSize (IN UINT16 MaxSize) {
   1536     mPassword->MaxSize = MaxSize;
   1537   }
   1538 };
   1539 
   1540 class CIfrOrderedList : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
   1541 private:
   1542   EFI_IFR_ORDERED_LIST *mOrderedList;
   1543 
   1544 public:
   1545   CIfrOrderedList () : CIfrObj (EFI_IFR_ORDERED_LIST_OP, (CHAR8 **)&mOrderedList),
   1546                       CIfrOpHeader (EFI_IFR_ORDERED_LIST_OP, &mOrderedList->Header),
   1547                       CIfrQuestionHeader (&mOrderedList->Question) {
   1548     mOrderedList->MaxContainers = 0;
   1549     mOrderedList->Flags         = 0;
   1550     gCurrentQuestion            = this;
   1551   }
   1552 
   1553   ~CIfrOrderedList () {
   1554     gCurrentQuestion = NULL;
   1555   }
   1556 
   1557   VOID SetMaxContainers (IN UINT8 MaxContainers) {
   1558     mOrderedList->MaxContainers = MaxContainers;
   1559   }
   1560 
   1561   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
   1562     EFI_VFR_RETURN_CODE Ret;
   1563 
   1564     Ret = CIfrQuestionHeader::SetFlags (HFlags);
   1565     if (Ret != VFR_RETURN_SUCCESS) {
   1566       return Ret;
   1567     }
   1568 
   1569     if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_UNIQUE_SET)) {
   1570       mOrderedList->Flags |= EFI_IFR_UNIQUE_SET;
   1571     }
   1572 
   1573     if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_NO_EMPTY_SET)) {
   1574       mOrderedList->Flags |= EFI_IFR_NO_EMPTY_SET;
   1575     }
   1576 
   1577     return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
   1578   }
   1579 };
   1580 
   1581 class CIfrTime : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
   1582 private:
   1583   EFI_IFR_TIME *mTime;
   1584 
   1585 public:
   1586   CIfrTime () : CIfrObj (EFI_IFR_TIME_OP, (CHAR8 **)&mTime),
   1587                 CIfrOpHeader (EFI_IFR_TIME_OP, &mTime->Header),
   1588                 CIfrQuestionHeader (&mTime->Question) {
   1589     mTime->Flags = 0;
   1590   }
   1591 
   1592   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
   1593     EFI_VFR_RETURN_CODE Ret;
   1594 
   1595     Ret = CIfrQuestionHeader::SetFlags (HFlags);
   1596     if (Ret != VFR_RETURN_SUCCESS) {
   1597       return Ret;
   1598     }
   1599 
   1600     if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_HOUR_SUPPRESS)) {
   1601       mTime->Flags |= QF_TIME_HOUR_SUPPRESS;
   1602     }
   1603 
   1604     if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_MINUTE_SUPPRESS)) {
   1605       mTime->Flags |= QF_TIME_MINUTE_SUPPRESS;
   1606     }
   1607 
   1608     if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_SECOND_SUPPRESS)) {
   1609       mTime->Flags |= QF_TIME_SECOND_SUPPRESS;
   1610     }
   1611 
   1612     if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_STORAGE_NORMAL)) {
   1613       mTime->Flags |= QF_TIME_STORAGE_NORMAL;
   1614     } else if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_STORAGE_TIME)) {
   1615       mTime->Flags |= QF_TIME_STORAGE_TIME;
   1616     } else if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_STORAGE_WAKEUP)) {
   1617       mTime->Flags |= QF_TIME_STORAGE_WAKEUP;
   1618     }
   1619 
   1620     return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
   1621   }
   1622 };
   1623 
   1624 class CIfrDisableIf : public CIfrObj, public CIfrOpHeader {
   1625 private:
   1626   EFI_IFR_DISABLE_IF *mDisableIf;
   1627 
   1628 public:
   1629   CIfrDisableIf () : CIfrObj (EFI_IFR_DISABLE_IF_OP, (CHAR8 **)&mDisableIf),
   1630                    mDisableIf ((EFI_IFR_DISABLE_IF *) GetObjBinAddr()),
   1631                    CIfrOpHeader (EFI_IFR_DISABLE_IF_OP, &mDisableIf->Header) {}
   1632 };
   1633 
   1634 class CIfrSuppressIf : public CIfrObj, public CIfrOpHeader {
   1635 private:
   1636   EFI_IFR_SUPPRESS_IF *mSuppressIf;
   1637 
   1638 public:
   1639   CIfrSuppressIf () : CIfrObj (EFI_IFR_SUPPRESS_IF_OP, (CHAR8 **)&mSuppressIf),
   1640                      CIfrOpHeader (EFI_IFR_SUPPRESS_IF_OP, &mSuppressIf->Header) {}
   1641 };
   1642 
   1643 class CIfrGrayOutIf : public CIfrObj, public CIfrOpHeader {
   1644 private:
   1645   EFI_IFR_GRAY_OUT_IF *mGrayOutIf;
   1646 
   1647 public:
   1648   CIfrGrayOutIf () : CIfrObj (EFI_IFR_GRAY_OUT_IF_OP, (CHAR8 **)&mGrayOutIf),
   1649                     CIfrOpHeader (EFI_IFR_GRAY_OUT_IF_OP, &mGrayOutIf->Header) {}
   1650 };
   1651 
   1652 class CIfrInconsistentIf : public CIfrObj, public CIfrOpHeader {
   1653 private:
   1654   EFI_IFR_INCONSISTENT_IF *mInconsistentIf;
   1655 
   1656 public:
   1657   CIfrInconsistentIf () : CIfrObj (EFI_IFR_INCONSISTENT_IF_OP, (CHAR8 **)&mInconsistentIf),
   1658                         CIfrOpHeader (EFI_IFR_INCONSISTENT_IF_OP, &mInconsistentIf->Header) {
   1659     mInconsistentIf->Error = EFI_STRING_ID_INVALID;
   1660   }
   1661 
   1662   VOID SetError (IN EFI_STRING_ID Error) {
   1663     mInconsistentIf->Error = Error;
   1664   }
   1665 };
   1666 
   1667 class CIfrWarningIf : public CIfrObj, public CIfrOpHeader {
   1668 private:
   1669   EFI_IFR_WARNING_IF *mWarningIf;
   1670 
   1671 public:
   1672   CIfrWarningIf () : CIfrObj (EFI_IFR_WARNING_IF_OP, (CHAR8 **)&mWarningIf),
   1673                         CIfrOpHeader (EFI_IFR_WARNING_IF_OP, &mWarningIf->Header) {
   1674     mWarningIf->Warning = EFI_STRING_ID_INVALID;
   1675     mWarningIf->TimeOut = 0;
   1676   }
   1677 
   1678   VOID SetWarning (IN EFI_STRING_ID Warning) {
   1679     mWarningIf->Warning = Warning;
   1680   }
   1681 
   1682   VOID SetTimeOut (IN UINT8 TimeOut) {
   1683     mWarningIf->TimeOut = TimeOut;
   1684   }
   1685 };
   1686 
   1687 class CIfrNoSubmitIf : public CIfrObj, public CIfrOpHeader {
   1688 private:
   1689   EFI_IFR_NO_SUBMIT_IF *mNoSubmitIf;
   1690 
   1691 public:
   1692   CIfrNoSubmitIf () : CIfrObj (EFI_IFR_NO_SUBMIT_IF_OP, (CHAR8 **)&mNoSubmitIf),
   1693                      CIfrOpHeader (EFI_IFR_NO_SUBMIT_IF_OP, &mNoSubmitIf->Header) {
   1694     mNoSubmitIf->Error = EFI_STRING_ID_INVALID;
   1695   }
   1696 
   1697   VOID SetError (IN EFI_STRING_ID Error) {
   1698     mNoSubmitIf->Error = Error;
   1699   }
   1700 };
   1701 
   1702 class CIfrRefresh : public CIfrObj, public CIfrOpHeader {
   1703 private:
   1704   EFI_IFR_REFRESH *mRefresh;
   1705 
   1706 public:
   1707   CIfrRefresh () : CIfrObj (EFI_IFR_REFRESH_OP, (CHAR8 **)&mRefresh),
   1708                   CIfrOpHeader (EFI_IFR_REFRESH_OP, &mRefresh->Header) {
   1709     mRefresh->RefreshInterval = 0;
   1710   }
   1711 
   1712   VOID SetRefreshInterval (IN UINT8 RefreshInterval) {
   1713     mRefresh->RefreshInterval = RefreshInterval;
   1714   }
   1715 };
   1716 
   1717 class CIfrRefreshId : public CIfrObj, public CIfrOpHeader {
   1718 private:
   1719   EFI_IFR_REFRESH_ID *mRefreshId;
   1720 
   1721 public:
   1722   CIfrRefreshId () : CIfrObj (EFI_IFR_REFRESH_ID_OP, (CHAR8 **)&mRefreshId),
   1723       CIfrOpHeader (EFI_IFR_REFRESH_ID_OP, &mRefreshId->Header) {
   1724     memset (&mRefreshId->RefreshEventGroupId, 0, sizeof (EFI_GUID));
   1725   }
   1726 
   1727   VOID SetRefreshEventGroutId (IN EFI_GUID *RefreshEventGroupId) {
   1728     memmove (&mRefreshId->RefreshEventGroupId, RefreshEventGroupId, sizeof (EFI_GUID));
   1729   }
   1730 };
   1731 
   1732 class CIfrVarStoreDevice : public CIfrObj, public CIfrOpHeader {
   1733 private:
   1734   EFI_IFR_VARSTORE_DEVICE *mVarStoreDevice;
   1735 
   1736 public:
   1737   CIfrVarStoreDevice () : CIfrObj (EFI_IFR_VARSTORE_DEVICE_OP, (CHAR8 **)&mVarStoreDevice),
   1738                           CIfrOpHeader (EFI_IFR_VARSTORE_DEVICE_OP, &mVarStoreDevice->Header) {
   1739     mVarStoreDevice->DevicePath = EFI_STRING_ID_INVALID;
   1740   }
   1741 
   1742   VOID SetDevicePath (IN EFI_STRING_ID DevicePath) {
   1743     mVarStoreDevice->DevicePath = DevicePath;
   1744   }
   1745 };
   1746 
   1747 class CIfrOneOfOption : public CIfrObj, public CIfrOpHeader {
   1748 private:
   1749   EFI_IFR_ONE_OF_OPTION *mOneOfOption;
   1750 
   1751 public:
   1752   CIfrOneOfOption (UINT8 Size) : CIfrObj (EFI_IFR_ONE_OF_OPTION_OP, (CHAR8 **)&mOneOfOption, Size),
   1753                        CIfrOpHeader (EFI_IFR_ONE_OF_OPTION_OP, &mOneOfOption->Header, Size) {
   1754     mOneOfOption->Flags  = 0;
   1755     mOneOfOption->Option = EFI_STRING_ID_INVALID;
   1756     mOneOfOption->Type   = EFI_IFR_TYPE_OTHER;
   1757     memset (&mOneOfOption->Value, 0, Size - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));
   1758   }
   1759 
   1760   VOID SetOption (IN EFI_STRING_ID Option) {
   1761     mOneOfOption->Option = Option;
   1762   }
   1763 
   1764   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 LFlags) {
   1765     mOneOfOption->Flags = 0;
   1766     if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_OPTION_DEFAULT)) {
   1767       mOneOfOption->Flags |= EFI_IFR_OPTION_DEFAULT;
   1768     }
   1769 
   1770     if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_OPTION_DEFAULT_MFG)) {
   1771       mOneOfOption->Flags |= EFI_IFR_OPTION_DEFAULT_MFG;
   1772     }
   1773 
   1774     if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_NUM_SIZE_8)) {
   1775       _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_NUM_SIZE_8);
   1776       mOneOfOption->Flags |= EFI_IFR_TYPE_NUM_SIZE_8;
   1777     } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_NUM_SIZE_16)) {
   1778       _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_NUM_SIZE_16);
   1779       mOneOfOption->Flags |= EFI_IFR_TYPE_NUM_SIZE_16;
   1780     } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_NUM_SIZE_32)) {
   1781       _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_NUM_SIZE_32);
   1782       mOneOfOption->Flags |= EFI_IFR_TYPE_NUM_SIZE_32;
   1783     } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_NUM_SIZE_64)) {
   1784       _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_NUM_SIZE_64);
   1785       mOneOfOption->Flags |= EFI_IFR_TYPE_NUM_SIZE_64;
   1786     } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_BOOLEAN)) {
   1787       _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_BOOLEAN);
   1788       mOneOfOption->Flags |= EFI_IFR_TYPE_BOOLEAN;
   1789     } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_TIME)) {
   1790       _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_TIME);
   1791       mOneOfOption->Flags |= EFI_IFR_TYPE_TIME;
   1792     } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_DATE)) {
   1793       _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_DATE);
   1794       mOneOfOption->Flags |= EFI_IFR_TYPE_DATE;
   1795     } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_STRING)) {
   1796       _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_STRING);
   1797       mOneOfOption->Flags |= EFI_IFR_TYPE_STRING;
   1798     } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_OTHER)) {
   1799       _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_OTHER);
   1800       mOneOfOption->Flags |= EFI_IFR_TYPE_OTHER;
   1801     }
   1802 
   1803     return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
   1804   }
   1805 
   1806   VOID SetType (IN UINT8 Type) {
   1807     mOneOfOption->Type = Type;
   1808   }
   1809 
   1810   VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) {
   1811     memmove (&mOneOfOption->Value, &Value, mOneOfOption->Header.Length - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));
   1812   }
   1813 
   1814   UINT8 GetFlags (VOID) {
   1815     return mOneOfOption->Flags;
   1816   }
   1817 };
   1818 
   1819 static EFI_GUID IfrTianoGuid     = EFI_IFR_TIANO_GUID;
   1820 static EFI_GUID IfrFrameworkGuid = EFI_IFR_FRAMEWORK_GUID;
   1821 
   1822 class CIfrClass : public CIfrObj, public CIfrOpHeader {
   1823 private:
   1824   EFI_IFR_GUID_CLASS *mClass;
   1825 
   1826 public:
   1827   CIfrClass () : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mClass, sizeof (EFI_IFR_GUID_CLASS)),
   1828                 CIfrOpHeader (EFI_IFR_GUID_OP, &mClass->Header, sizeof (EFI_IFR_GUID_CLASS)) {
   1829     mClass->ExtendOpCode = EFI_IFR_EXTEND_OP_CLASS;
   1830     mClass->Guid         = IfrTianoGuid;
   1831     mClass->Class        = EFI_NON_DEVICE_CLASS;
   1832   }
   1833 
   1834   VOID SetClass (IN UINT16 Class) {
   1835     mClass->Class        = Class;
   1836   }
   1837 };
   1838 
   1839 class CIfrSubClass : public CIfrObj, public CIfrOpHeader {
   1840 private:
   1841   EFI_IFR_GUID_SUBCLASS *mSubClass;
   1842 
   1843 public:
   1844   CIfrSubClass () : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mSubClass, sizeof (EFI_IFR_GUID_SUBCLASS)),
   1845                     CIfrOpHeader (EFI_IFR_GUID_OP, &mSubClass->Header, sizeof (EFI_IFR_GUID_SUBCLASS)) {
   1846     mSubClass->ExtendOpCode = EFI_IFR_EXTEND_OP_SUBCLASS;
   1847     mSubClass->Guid         = IfrTianoGuid;
   1848     mSubClass->SubClass     = EFI_SETUP_APPLICATION_SUBCLASS;
   1849   }
   1850 
   1851   VOID SetSubClass (IN UINT16 SubClass) {
   1852     mSubClass->SubClass = SubClass;
   1853   }
   1854 };
   1855 
   1856 class CIfrLabel : public CIfrObj, public CIfrOpHeader {
   1857 private:
   1858   EFI_IFR_GUID_LABEL *mLabel;
   1859 
   1860 public:
   1861   CIfrLabel () : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mLabel, sizeof (EFI_IFR_GUID_LABEL)),
   1862                 CIfrOpHeader (EFI_IFR_GUID_OP, &mLabel->Header, sizeof (EFI_IFR_GUID_LABEL)) {
   1863     mLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
   1864     mLabel->Guid         = IfrTianoGuid;
   1865   }
   1866 
   1867   VOID SetNumber (IN UINT16 Number) {
   1868     mLabel->Number = Number;
   1869   }
   1870 };
   1871 
   1872 class CIfrBanner : public CIfrObj, public CIfrOpHeader {
   1873 private:
   1874   EFI_IFR_GUID_BANNER *mBanner;
   1875 
   1876 public:
   1877   CIfrBanner () : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mBanner, sizeof (EFI_IFR_GUID_BANNER)),
   1878                   CIfrOpHeader (EFI_IFR_GUID_OP, &mBanner->Header, sizeof (EFI_IFR_GUID_BANNER)) {
   1879     mBanner->ExtendOpCode = EFI_IFR_EXTEND_OP_BANNER;
   1880     mBanner->Guid         = IfrTianoGuid;
   1881   }
   1882 
   1883   VOID SetTitle (IN EFI_STRING_ID StringId) {
   1884     mBanner->Title = StringId;
   1885   }
   1886 
   1887   VOID SetLine (IN UINT16 Line) {
   1888     mBanner->LineNumber = Line;
   1889   }
   1890 
   1891   VOID SetAlign (IN UINT8 Align) {
   1892     mBanner->Alignment = Align;
   1893   }
   1894 };
   1895 
   1896 class CIfrOptionKey : public CIfrObj, public CIfrOpHeader {
   1897 private:
   1898   EFI_IFR_GUID_OPTIONKEY *mOptionKey;
   1899 
   1900 public:
   1901   CIfrOptionKey (
   1902     IN EFI_QUESTION_ID QuestionId,
   1903     IN EFI_IFR_TYPE_VALUE &OptionValue,
   1904     IN EFI_QUESTION_ID KeyValue
   1905   ) : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mOptionKey, sizeof (EFI_IFR_GUID_OPTIONKEY)),
   1906       CIfrOpHeader (EFI_IFR_GUID_OP, &mOptionKey->Header, sizeof (EFI_IFR_GUID_OPTIONKEY)) {
   1907     mOptionKey->ExtendOpCode = EFI_IFR_EXTEND_OP_OPTIONKEY;
   1908     mOptionKey->Guid         = IfrFrameworkGuid;
   1909     mOptionKey->QuestionId   = QuestionId;
   1910     mOptionKey->OptionValue  = OptionValue;
   1911     mOptionKey->KeyValue     = KeyValue;
   1912   }
   1913 };
   1914 
   1915 class CIfrVarEqName : public CIfrObj, public CIfrOpHeader {
   1916 private:
   1917   EFI_IFR_GUID_VAREQNAME *mVarEqName;
   1918 
   1919 public:
   1920   CIfrVarEqName (
   1921     IN EFI_QUESTION_ID QuestionId,
   1922     IN EFI_STRING_ID   NameId
   1923   ) : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mVarEqName, sizeof (EFI_IFR_GUID_VAREQNAME)),
   1924       CIfrOpHeader (EFI_IFR_GUID_OP, &mVarEqName->Header, sizeof (EFI_IFR_GUID_VAREQNAME)) {
   1925     mVarEqName->ExtendOpCode = EFI_IFR_EXTEND_OP_VAREQNAME;
   1926     mVarEqName->Guid         = IfrFrameworkGuid;
   1927     mVarEqName->QuestionId   = QuestionId;
   1928     mVarEqName->NameId       = NameId;
   1929   }
   1930 };
   1931 
   1932 class CIfrTimeout : public CIfrObj, public CIfrOpHeader {
   1933 private:
   1934   EFI_IFR_GUID_TIMEOUT *mTimeout;
   1935 
   1936 public:
   1937   CIfrTimeout (IN UINT16 Timeout = 0) : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mTimeout, sizeof (EFI_IFR_GUID_TIMEOUT)),
   1938                                         CIfrOpHeader (EFI_IFR_GUID_OP, &mTimeout->Header, sizeof (EFI_IFR_GUID_TIMEOUT)) {
   1939     mTimeout->ExtendOpCode = EFI_IFR_EXTEND_OP_TIMEOUT;
   1940     mTimeout->Guid         = IfrTianoGuid;
   1941     mTimeout->TimeOut      = Timeout;
   1942   }
   1943 
   1944   VOID SetTimeout (IN UINT16 Timeout) {
   1945     mTimeout->TimeOut = Timeout;
   1946   }
   1947 };
   1948 
   1949 class CIfrGuid : public CIfrObj, public CIfrOpHeader {
   1950 private:
   1951   EFI_IFR_GUID *mGuid;
   1952 
   1953 public:
   1954   CIfrGuid (UINT8 Size) : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mGuid, sizeof (EFI_IFR_GUID)+Size),
   1955                   CIfrOpHeader (EFI_IFR_GUID_OP, &mGuid->Header, sizeof (EFI_IFR_GUID)+Size) {
   1956     memset (&mGuid->Guid, 0, sizeof (EFI_GUID));
   1957   }
   1958 
   1959   VOID SetGuid (IN EFI_GUID *Guid) {
   1960     memmove (&mGuid->Guid, Guid, sizeof (EFI_GUID));
   1961   }
   1962 
   1963   VOID SetData (IN UINT8* DataBuff, IN UINT8 Size) {
   1964     memmove ((UINT8 *)mGuid + sizeof (EFI_IFR_GUID), DataBuff, Size);
   1965   }
   1966 };
   1967 
   1968 class CIfrDup : public CIfrObj, public CIfrOpHeader {
   1969 private:
   1970   EFI_IFR_DUP *mDup;
   1971 
   1972 public:
   1973   CIfrDup (
   1974   IN UINT32 LineNo
   1975   ) : CIfrObj (EFI_IFR_DUP_OP, (CHAR8 **)&mDup),
   1976       CIfrOpHeader (EFI_IFR_DUP_OP, &mDup->Header) {
   1977     SetLineNo (LineNo);
   1978   }
   1979 };
   1980 
   1981 class CIfrEqIdId : public CIfrObj, public CIfrOpHeader {
   1982 private:
   1983   EFI_IFR_EQ_ID_ID   *mEqIdId;
   1984 
   1985 public:
   1986   CIfrEqIdId (
   1987   IN UINT32 LineNo
   1988   ) : CIfrObj (EFI_IFR_EQ_ID_ID_OP, (CHAR8 **)&mEqIdId),
   1989                  CIfrOpHeader (EFI_IFR_EQ_ID_ID_OP, &mEqIdId->Header) {
   1990     SetLineNo (LineNo);
   1991     mEqIdId->QuestionId1 = EFI_QUESTION_ID_INVALID;
   1992     mEqIdId->QuestionId2 = EFI_QUESTION_ID_INVALID;
   1993   }
   1994 
   1995   VOID SetQuestionId1 (
   1996   IN EFI_QUESTION_ID QuestionId,
   1997   IN CHAR8            *VarIdStr,
   1998   IN UINT32          LineNo
   1999   ) {
   2000     if (QuestionId != EFI_QUESTION_ID_INVALID) {
   2001       mEqIdId->QuestionId1 = QuestionId;
   2002     } else {
   2003       gCFormPkg.AssignPending (VarIdStr, (VOID *)(&mEqIdId->QuestionId1), sizeof (EFI_QUESTION_ID), LineNo, NO_QST_REFED);
   2004     }
   2005   }
   2006 
   2007   VOID SetQuestionId2 (
   2008   IN EFI_QUESTION_ID QuestionId,
   2009   IN CHAR8            *VarIdStr,
   2010   IN UINT32          LineNo
   2011   ) {
   2012     if (QuestionId != EFI_QUESTION_ID_INVALID) {
   2013       mEqIdId->QuestionId2 = QuestionId;
   2014     } else {
   2015       gCFormPkg.AssignPending (VarIdStr, (VOID *)(&mEqIdId->QuestionId2), sizeof (EFI_QUESTION_ID), LineNo, NO_QST_REFED);
   2016     }
   2017   }
   2018 };
   2019 
   2020 class CIfrEqIdVal : public CIfrObj, public CIfrOpHeader {
   2021 private:
   2022   EFI_IFR_EQ_ID_VAL *mEqIdVal;
   2023 
   2024 public:
   2025   CIfrEqIdVal (
   2026   IN UINT32 LineNo
   2027   ) : CIfrObj (EFI_IFR_EQ_ID_VAL_OP, (CHAR8 **)&mEqIdVal),
   2028       CIfrOpHeader (EFI_IFR_EQ_ID_VAL_OP, &mEqIdVal->Header) {
   2029     SetLineNo (LineNo);
   2030     mEqIdVal->QuestionId = EFI_QUESTION_ID_INVALID;
   2031   }
   2032 
   2033   VOID SetQuestionId (
   2034   IN EFI_QUESTION_ID QuestionId,
   2035   IN CHAR8           *VarIdStr,
   2036   IN UINT32          LineNo
   2037   ) {
   2038     if (QuestionId != EFI_QUESTION_ID_INVALID) {
   2039       mEqIdVal->QuestionId = QuestionId;
   2040     } else {
   2041       gCFormPkg.AssignPending (VarIdStr, (VOID *)(&mEqIdVal->QuestionId), sizeof (EFI_QUESTION_ID), LineNo, NO_QST_REFED);
   2042     }
   2043   }
   2044 
   2045   VOID SetValue (IN UINT16 Value) {
   2046     mEqIdVal->Value = Value;
   2047   }
   2048 };
   2049 
   2050 class CIfrEqIdList : public CIfrObj, public CIfrOpHeader {
   2051 private:
   2052   EFI_IFR_EQ_ID_VAL_LIST *mEqIdVList;
   2053 
   2054 public:
   2055   CIfrEqIdList (
   2056   IN UINT32 LineNo
   2057   ) : CIfrObj (EFI_IFR_EQ_ID_VAL_LIST_OP, (CHAR8 **)&mEqIdVList, sizeof (EFI_IFR_EQ_ID_VAL_LIST), TRUE),
   2058                    CIfrOpHeader (EFI_IFR_EQ_ID_VAL_LIST_OP, &mEqIdVList->Header) {
   2059     SetLineNo (LineNo);
   2060     mEqIdVList->QuestionId   = EFI_QUESTION_ID_INVALID;
   2061     mEqIdVList->ListLength   = 0;
   2062     mEqIdVList->ValueList[0] = 0;
   2063   }
   2064 
   2065   VOID UpdateIfrBuffer (
   2066   ) {
   2067     _EMIT_PENDING_OBJ();
   2068     mEqIdVList = (EFI_IFR_EQ_ID_VAL_LIST *) GetObjBinAddr();
   2069     UpdateHeader (&mEqIdVList->Header);
   2070   }
   2071 
   2072   VOID SetQuestionId (
   2073   IN EFI_QUESTION_ID QuestionId,
   2074   IN CHAR8           *VarIdStr,
   2075   IN UINT32          LineNo
   2076   ) {
   2077     if (QuestionId != EFI_QUESTION_ID_INVALID) {
   2078       mEqIdVList->QuestionId = QuestionId;
   2079     } else {
   2080       gCFormPkg.AssignPending (VarIdStr, (VOID *)(&mEqIdVList->QuestionId), sizeof (EFI_QUESTION_ID), LineNo, NO_QST_REFED);
   2081     }
   2082   }
   2083 
   2084   VOID SetListLength (IN UINT16 ListLength) {
   2085     mEqIdVList->ListLength = ListLength;
   2086   }
   2087 
   2088   VOID SetValueList (IN UINT16 Index, IN UINT16 Value) {
   2089     if (Index == 0) {
   2090       mEqIdVList->ValueList[0] = Value;
   2091       return;
   2092     }
   2093 
   2094     if (ExpendObjBin (sizeof (UINT16)) ==TRUE) {
   2095       IncLength (sizeof (UINT16));
   2096       mEqIdVList->ValueList[Index] = Value;
   2097     }
   2098   }
   2099 };
   2100 
   2101 class CIfrQuestionRef1 : public CIfrObj, public CIfrOpHeader {
   2102 private:
   2103   EFI_IFR_QUESTION_REF1 *mQuestionRef1;
   2104 
   2105 public:
   2106   CIfrQuestionRef1 (
   2107   IN UINT32 LineNo
   2108   ) : CIfrObj (EFI_IFR_QUESTION_REF1_OP, (CHAR8 **)&mQuestionRef1),
   2109       CIfrOpHeader (EFI_IFR_QUESTION_REF1_OP, &mQuestionRef1->Header) {
   2110     SetLineNo (LineNo);
   2111     mQuestionRef1->QuestionId = EFI_QUESTION_ID_INVALID;
   2112   }
   2113 
   2114   VOID SetQuestionId (
   2115   IN EFI_QUESTION_ID QuestionId,
   2116   IN CHAR8           *VarIdStr,
   2117   IN UINT32          LineNo
   2118   ) {
   2119     if (QuestionId != EFI_QUESTION_ID_INVALID) {
   2120       mQuestionRef1->QuestionId = QuestionId;
   2121     } else {
   2122       gCFormPkg.AssignPending (VarIdStr, (VOID *)(&mQuestionRef1->QuestionId), sizeof (EFI_QUESTION_ID), LineNo, NO_QST_REFED);
   2123     }
   2124   }
   2125 };
   2126 
   2127 class CIfrQuestionRef2 : public CIfrObj, public CIfrOpHeader {
   2128 private:
   2129   EFI_IFR_QUESTION_REF2 *mQuestionRef2;
   2130 
   2131 public:
   2132   CIfrQuestionRef2 (
   2133   IN UINT32 LineNo
   2134   ) : CIfrObj (EFI_IFR_QUESTION_REF2_OP, (CHAR8 **)&mQuestionRef2),
   2135       CIfrOpHeader (EFI_IFR_QUESTION_REF2_OP, &mQuestionRef2->Header) {
   2136     SetLineNo (LineNo);
   2137   }
   2138 };
   2139 
   2140 class CIfrQuestionRef3 : public CIfrObj, public CIfrOpHeader {
   2141 private:
   2142   EFI_IFR_QUESTION_REF3 *mQuestionRef3;
   2143 
   2144 public:
   2145   CIfrQuestionRef3 (
   2146   IN UINT32 LineNo
   2147   ) : CIfrObj (EFI_IFR_QUESTION_REF3_OP, (CHAR8 **)&mQuestionRef3),
   2148       CIfrOpHeader (EFI_IFR_QUESTION_REF3_OP, &mQuestionRef3->Header) {
   2149     SetLineNo (LineNo);
   2150   }
   2151 };
   2152 
   2153 class CIfrQuestionRef3_2 : public CIfrObj, public CIfrOpHeader {
   2154 private:
   2155   EFI_IFR_QUESTION_REF3_2 *mQuestionRef3_2;
   2156 
   2157 public:
   2158   CIfrQuestionRef3_2 (
   2159   IN UINT32 LineNo
   2160   ) : CIfrObj (EFI_IFR_QUESTION_REF3_OP, (CHAR8 **)&mQuestionRef3_2, sizeof (EFI_IFR_QUESTION_REF3_2)),
   2161       CIfrOpHeader (EFI_IFR_QUESTION_REF3_OP, &mQuestionRef3_2->Header, sizeof (EFI_IFR_QUESTION_REF3_2)) {
   2162     SetLineNo (LineNo);
   2163     mQuestionRef3_2->DevicePath = EFI_STRING_ID_INVALID;
   2164   }
   2165 
   2166   VOID SetDevicePath (IN EFI_STRING_ID DevicePath) {
   2167     mQuestionRef3_2->DevicePath = DevicePath;
   2168   }
   2169 };
   2170 
   2171 class CIfrQuestionRef3_3 : public CIfrObj, public CIfrOpHeader {
   2172 private:
   2173   EFI_IFR_QUESTION_REF3_3 *mQuestionRef3_3;
   2174 
   2175 public:
   2176   CIfrQuestionRef3_3 (
   2177   IN UINT32 LineNo
   2178   ) : CIfrObj (EFI_IFR_QUESTION_REF3_OP, (CHAR8 **)&mQuestionRef3_3, sizeof (EFI_IFR_QUESTION_REF3_3)),
   2179       CIfrOpHeader (EFI_IFR_QUESTION_REF3_OP, &mQuestionRef3_3->Header, sizeof (EFI_IFR_QUESTION_REF3_3)) {
   2180     SetLineNo (LineNo);
   2181     mQuestionRef3_3->DevicePath = EFI_STRING_ID_INVALID;
   2182     memset (&mQuestionRef3_3->Guid, 0, sizeof (EFI_GUID));
   2183   }
   2184 
   2185   VOID SetDevicePath (IN EFI_STRING_ID DevicePath) {
   2186     mQuestionRef3_3->DevicePath = DevicePath;
   2187   }
   2188 
   2189   VOID SetGuid (IN EFI_GUID *Guid) {
   2190     mQuestionRef3_3->Guid = *Guid;
   2191   }
   2192 };
   2193 
   2194 class CIfrRuleRef : public CIfrObj, public CIfrOpHeader {
   2195 private:
   2196   EFI_IFR_RULE_REF *mRuleRef;
   2197 
   2198 public:
   2199   CIfrRuleRef (
   2200   IN UINT32 LineNo
   2201   ) : CIfrObj (EFI_IFR_RULE_REF_OP, (CHAR8 **)&mRuleRef),
   2202       CIfrOpHeader (EFI_IFR_RULE_REF_OP, &mRuleRef->Header) {
   2203     SetLineNo (LineNo);
   2204     mRuleRef->RuleId = EFI_RULE_ID_INVALID;
   2205   }
   2206 
   2207   VOID SetRuleId (IN UINT8 RuleId) {
   2208     mRuleRef->RuleId = RuleId;
   2209   }
   2210 };
   2211 
   2212 class CIfrStringRef1 : public CIfrObj, public CIfrOpHeader {
   2213 private:
   2214   EFI_IFR_STRING_REF1 *mStringRef1;
   2215 
   2216 public:
   2217   CIfrStringRef1 (
   2218   IN UINT32 LineNo
   2219   ) : CIfrObj (EFI_IFR_STRING_REF1_OP, (CHAR8 **)&mStringRef1),
   2220       CIfrOpHeader (EFI_IFR_STRING_REF1_OP, &mStringRef1->Header) {
   2221     SetLineNo (LineNo);
   2222     mStringRef1->StringId = EFI_STRING_ID_INVALID;
   2223   }
   2224 
   2225   VOID SetStringId (IN EFI_STRING_ID StringId) {
   2226     mStringRef1->StringId = StringId;
   2227   }
   2228 };
   2229 
   2230 class CIfrStringRef2 : public CIfrObj, public CIfrOpHeader {
   2231 private:
   2232   EFI_IFR_STRING_REF2 *mStringRef2;
   2233 
   2234 public:
   2235   CIfrStringRef2 (
   2236   IN UINT32 LineNo
   2237   ) : CIfrObj (EFI_IFR_STRING_REF2_OP, (CHAR8 **)&mStringRef2),
   2238       CIfrOpHeader (EFI_IFR_STRING_REF2_OP, &mStringRef2->Header) {
   2239     SetLineNo (LineNo);
   2240   }
   2241 };
   2242 
   2243 class CIfrThis : public CIfrObj, public CIfrOpHeader {
   2244 private:
   2245   EFI_IFR_THIS *mThis;
   2246 
   2247 public:
   2248   CIfrThis (
   2249   IN UINT32 LineNo
   2250   ) : CIfrObj (EFI_IFR_THIS_OP, (CHAR8 **)&mThis),
   2251       CIfrOpHeader (EFI_IFR_THIS_OP, &mThis->Header) {
   2252     SetLineNo (LineNo);
   2253   }
   2254 };
   2255 
   2256 class CIfrSecurity : public CIfrObj, public CIfrOpHeader {
   2257 private:
   2258   EFI_IFR_SECURITY *mSecurity;
   2259 
   2260 public:
   2261   CIfrSecurity (
   2262   IN UINT32 LineNo
   2263   ) : CIfrObj (EFI_IFR_SECURITY_OP, (CHAR8 **)&mSecurity),
   2264       CIfrOpHeader (EFI_IFR_SECURITY_OP, &mSecurity->Header) {
   2265     SetLineNo (LineNo);
   2266     memset (&mSecurity->Permissions, 0, sizeof (EFI_GUID));
   2267   }
   2268 
   2269   VOID SetPermissions (IN EFI_GUID *Permissions) {
   2270     memmove (&mSecurity->Permissions, Permissions, sizeof (EFI_GUID));
   2271   }
   2272 };
   2273 
   2274 class CIfrUint8 : public CIfrObj, public CIfrOpHeader {
   2275 private:
   2276   EFI_IFR_UINT8 *mUint8;
   2277 
   2278 public:
   2279   CIfrUint8 (
   2280   IN UINT32 LineNo
   2281   ) : CIfrObj (EFI_IFR_UINT8_OP, (CHAR8 **)&mUint8),
   2282       CIfrOpHeader (EFI_IFR_UINT8_OP, &mUint8->Header) {
   2283     SetLineNo (LineNo);
   2284   }
   2285 
   2286   VOID SetValue (IN UINT8 Value) {
   2287     mUint8->Value = Value;
   2288   }
   2289 };
   2290 
   2291 class CIfrUint16 : public CIfrObj, public CIfrOpHeader {
   2292 private:
   2293   EFI_IFR_UINT16 *mUint16;
   2294 
   2295 public:
   2296   CIfrUint16 (
   2297   IN UINT32 LineNo
   2298   ) : CIfrObj (EFI_IFR_UINT16_OP, (CHAR8 **)&mUint16),
   2299       CIfrOpHeader (EFI_IFR_UINT16_OP, &mUint16->Header) {
   2300     SetLineNo (LineNo);
   2301   }
   2302 
   2303   VOID SetValue (IN UINT16 Value) {
   2304     mUint16->Value = Value;
   2305   }
   2306 };
   2307 
   2308 class CIfrUint32 : public CIfrObj, public CIfrOpHeader {
   2309 private:
   2310   EFI_IFR_UINT32 *mUint32;
   2311 
   2312 public:
   2313   CIfrUint32 (
   2314   IN UINT32 LineNo
   2315   ) : CIfrObj (EFI_IFR_UINT32_OP, (CHAR8 **)&mUint32),
   2316       CIfrOpHeader (EFI_IFR_UINT32_OP, &mUint32->Header) {
   2317     SetLineNo (LineNo);
   2318   }
   2319 
   2320   VOID SetValue (IN UINT32 Value) {
   2321     mUint32->Value = Value;
   2322   }
   2323 };
   2324 
   2325 class CIfrUint64 : public CIfrObj, public CIfrOpHeader {
   2326 private:
   2327   EFI_IFR_UINT64 *mUint64;
   2328 
   2329 public:
   2330   CIfrUint64 (
   2331   IN UINT32 LineNo
   2332   ) : CIfrObj (EFI_IFR_UINT64_OP, (CHAR8 **)&mUint64),
   2333       CIfrOpHeader (EFI_IFR_UINT64_OP, &mUint64->Header) {
   2334     SetLineNo (LineNo);
   2335   }
   2336 
   2337   VOID SetValue (IN UINT64 Value) {
   2338     mUint64->Value = Value;
   2339   }
   2340 };
   2341 
   2342 class CIfrTrue : public CIfrObj, public CIfrOpHeader {
   2343 private:
   2344   EFI_IFR_TRUE *mTrue;
   2345 
   2346 public:
   2347   CIfrTrue (
   2348   IN UINT32 LineNo
   2349   ) : CIfrObj (EFI_IFR_TRUE_OP, (CHAR8 **)&mTrue),
   2350       CIfrOpHeader (EFI_IFR_TRUE_OP, &mTrue->Header) {
   2351     SetLineNo (LineNo);
   2352   }
   2353 };
   2354 
   2355 class CIfrFalse : public CIfrObj, public CIfrOpHeader {
   2356 private:
   2357   EFI_IFR_FALSE *mFalse;
   2358 
   2359 public:
   2360   CIfrFalse (
   2361   IN UINT32 LineNo
   2362   ) : CIfrObj (EFI_IFR_FALSE_OP, (CHAR8 **)&mFalse),
   2363       CIfrOpHeader (EFI_IFR_FALSE_OP, &mFalse->Header) {
   2364     SetLineNo (LineNo);
   2365   }
   2366 };
   2367 
   2368 class CIfrOne : public CIfrObj, public CIfrOpHeader {
   2369 private:
   2370   EFI_IFR_ONE *mOne;
   2371 
   2372 public:
   2373   CIfrOne (
   2374   IN UINT32 LineNo
   2375   ) : CIfrObj (EFI_IFR_ONE_OP, (CHAR8 **)&mOne),
   2376       CIfrOpHeader (EFI_IFR_ONE_OP, &mOne->Header) {
   2377     SetLineNo (LineNo);
   2378   }
   2379 };
   2380 
   2381 class CIfrOnes : public CIfrObj, public CIfrOpHeader {
   2382 private:
   2383   EFI_IFR_ONES *mOnes;
   2384 
   2385 public:
   2386   CIfrOnes (
   2387   IN UINT32 LineNo
   2388   ) : CIfrObj (EFI_IFR_ONES_OP, (CHAR8 **)&mOnes),
   2389       CIfrOpHeader (EFI_IFR_ONES_OP, &mOnes->Header) {
   2390     SetLineNo (LineNo);
   2391   }
   2392 };
   2393 
   2394 class CIfrZero : public CIfrObj, public CIfrOpHeader {
   2395 private:
   2396   EFI_IFR_ZERO *mZero;
   2397 
   2398 public:
   2399   CIfrZero (
   2400   IN UINT32 LineNo
   2401   ) : CIfrObj (EFI_IFR_ZERO_OP, (CHAR8 **)&mZero),
   2402       CIfrOpHeader (EFI_IFR_ZERO_OP, &mZero->Header) {
   2403     SetLineNo (LineNo);
   2404   }
   2405 };
   2406 
   2407 class CIfrUndefined : public CIfrObj, public CIfrOpHeader {
   2408 private:
   2409   EFI_IFR_UNDEFINED *mUndefined;
   2410 
   2411 public:
   2412   CIfrUndefined (
   2413   IN UINT32 LineNo
   2414   ) : CIfrObj (EFI_IFR_UNDEFINED_OP, (CHAR8 **)&mUndefined),
   2415       CIfrOpHeader (EFI_IFR_UNDEFINED_OP, &mUndefined->Header) {
   2416     SetLineNo (LineNo);
   2417   }
   2418 };
   2419 
   2420 class CIfrVersion : public CIfrObj, public CIfrOpHeader {
   2421 private:
   2422   EFI_IFR_VERSION *mVersion;
   2423 
   2424 public:
   2425   CIfrVersion (
   2426   IN UINT32 LineNo
   2427   ) : CIfrObj (EFI_IFR_VERSION_OP, (CHAR8 **)&mVersion),
   2428       CIfrOpHeader (EFI_IFR_VERSION_OP, &mVersion->Header) {
   2429     SetLineNo (LineNo);
   2430   }
   2431 };
   2432 
   2433 class CIfrLength : public CIfrObj, public CIfrOpHeader {
   2434 private:
   2435   EFI_IFR_LENGTH *mLength;
   2436 
   2437 public:
   2438   CIfrLength (
   2439   IN UINT32 LineNo
   2440   ) : CIfrObj (EFI_IFR_LENGTH_OP, (CHAR8 **)&mLength),
   2441       CIfrOpHeader (EFI_IFR_LENGTH_OP, &mLength->Header) {
   2442     SetLineNo (LineNo);
   2443   }
   2444 };
   2445 
   2446 class CIfrNot : public CIfrObj, public CIfrOpHeader {
   2447 private:
   2448   EFI_IFR_NOT *mNot;
   2449 
   2450 public:
   2451   CIfrNot (
   2452   IN UINT32 LineNo
   2453   ) : CIfrObj (EFI_IFR_NOT_OP, (CHAR8 **)&mNot),
   2454       CIfrOpHeader (EFI_IFR_NOT_OP, &mNot->Header) {
   2455     SetLineNo (LineNo);
   2456   }
   2457 };
   2458 
   2459 class CIfrBitWiseNot : public CIfrObj, public CIfrOpHeader {
   2460 private:
   2461   EFI_IFR_BITWISE_NOT *mBitWise;
   2462 
   2463 public:
   2464   CIfrBitWiseNot (
   2465   IN UINT32 LineNo
   2466   ) : CIfrObj (EFI_IFR_BITWISE_NOT_OP, (CHAR8 **)&mBitWise),
   2467       CIfrOpHeader (EFI_IFR_BITWISE_NOT_OP, &mBitWise->Header) {
   2468     SetLineNo (LineNo);
   2469   }
   2470 };
   2471 
   2472 class CIfrToBoolean : public CIfrObj, public CIfrOpHeader {
   2473 private:
   2474   EFI_IFR_TO_BOOLEAN *mToBoolean;
   2475 
   2476 public:
   2477   CIfrToBoolean (
   2478   IN UINT32 LineNo
   2479   ) : CIfrObj (EFI_IFR_TO_BOOLEAN_OP, (CHAR8 **)&mToBoolean),
   2480       CIfrOpHeader (EFI_IFR_TO_BOOLEAN_OP, &mToBoolean->Header) {
   2481     SetLineNo (LineNo);
   2482   }
   2483 };
   2484 
   2485 class CIfrToString : public CIfrObj, public CIfrOpHeader {
   2486 private:
   2487   EFI_IFR_TO_STRING *mToString;
   2488 
   2489 public:
   2490   CIfrToString (
   2491   IN UINT32 LineNo
   2492   ) : CIfrObj (EFI_IFR_TO_STRING_OP, (CHAR8 **)&mToString),
   2493       CIfrOpHeader (EFI_IFR_TO_STRING_OP, &mToString->Header) {
   2494     SetLineNo (LineNo);
   2495   }
   2496 
   2497   VOID SetFormat (IN UINT8 Format) {
   2498     mToString->Format = Format;
   2499   }
   2500 };
   2501 
   2502 class CIfrToUint : public CIfrObj, public CIfrOpHeader {
   2503 private:
   2504   EFI_IFR_TO_UINT *mToUint;
   2505 
   2506 public:
   2507   CIfrToUint (
   2508   IN UINT32 LineNo
   2509   ) : CIfrObj (EFI_IFR_TO_UINT_OP, (CHAR8 **)&mToUint),
   2510       CIfrOpHeader (EFI_IFR_TO_UINT_OP, &mToUint->Header) {
   2511     SetLineNo (LineNo);
   2512   }
   2513 };
   2514 
   2515 class CIfrToUpper : public CIfrObj, public CIfrOpHeader {
   2516 private:
   2517   EFI_IFR_TO_UPPER *mToUpper;
   2518 
   2519 public:
   2520   CIfrToUpper (
   2521   IN UINT32 LineNo
   2522   ) : CIfrObj (EFI_IFR_TO_UPPER_OP, (CHAR8 **)&mToUpper),
   2523       CIfrOpHeader (EFI_IFR_TO_UPPER_OP, &mToUpper->Header) {
   2524     SetLineNo (LineNo);
   2525   }
   2526 };
   2527 
   2528 class CIfrToLower : public CIfrObj, public CIfrOpHeader {
   2529 private:
   2530   EFI_IFR_TO_LOWER *mToLower;
   2531 
   2532 public:
   2533   CIfrToLower (
   2534   IN UINT32 LineNo
   2535   ) : CIfrObj (EFI_IFR_TO_LOWER_OP, (CHAR8 **)&mToLower),
   2536       CIfrOpHeader (EFI_IFR_TO_LOWER_OP, &mToLower->Header) {
   2537     SetLineNo (LineNo);
   2538   }
   2539 };
   2540 
   2541 class CIfrAdd : public CIfrObj, public CIfrOpHeader {
   2542 private:
   2543   EFI_IFR_ADD *mAdd;
   2544 
   2545 public:
   2546   CIfrAdd (
   2547   IN UINT32 LineNo
   2548   ) : CIfrObj (EFI_IFR_ADD_OP, (CHAR8 **)&mAdd),
   2549       CIfrOpHeader (EFI_IFR_ADD_OP, &mAdd->Header) {
   2550     SetLineNo (LineNo);
   2551   }
   2552 };
   2553 
   2554 class CIfrBitWiseAnd : public CIfrObj, public CIfrOpHeader {
   2555 private:
   2556   EFI_IFR_BITWISE_AND *mBitWiseAnd;
   2557 
   2558 public:
   2559   CIfrBitWiseAnd (
   2560   IN UINT32 LineNo
   2561   ) : CIfrObj (EFI_IFR_BITWISE_AND_OP, (CHAR8 **)&mBitWiseAnd),
   2562       CIfrOpHeader (EFI_IFR_BITWISE_AND_OP, &mBitWiseAnd->Header) {
   2563     SetLineNo(LineNo);
   2564   }
   2565 };
   2566 
   2567 class CIfrBitWiseOr : public CIfrObj, public CIfrOpHeader {
   2568 private:
   2569   EFI_IFR_BITWISE_OR *mBitWiseOr;
   2570 
   2571 public:
   2572   CIfrBitWiseOr (
   2573   IN UINT32 LineNo
   2574   ) : CIfrObj (EFI_IFR_BITWISE_OR_OP, (CHAR8 **)&mBitWiseOr),
   2575       CIfrOpHeader (EFI_IFR_BITWISE_OR_OP, &mBitWiseOr->Header) {
   2576     SetLineNo (LineNo);
   2577   }
   2578 };
   2579 
   2580 class CIfrAnd : public CIfrObj, public CIfrOpHeader {
   2581 private:
   2582   EFI_IFR_AND *mAnd;
   2583 
   2584 public:
   2585   CIfrAnd (
   2586   IN UINT32 LineNo
   2587   ) : CIfrObj (EFI_IFR_AND_OP, (CHAR8 **)&mAnd),
   2588       CIfrOpHeader (EFI_IFR_AND_OP, &mAnd->Header) {
   2589     SetLineNo (LineNo);
   2590   }
   2591 };
   2592 
   2593 class CIfrCatenate : public CIfrObj, public CIfrOpHeader {
   2594 private:
   2595   EFI_IFR_CATENATE *mCatenate;
   2596 
   2597 public:
   2598   CIfrCatenate (
   2599   IN UINT32 LineNo
   2600   ) : CIfrObj (EFI_IFR_CATENATE_OP, (CHAR8 **)&mCatenate),
   2601       CIfrOpHeader (EFI_IFR_CATENATE_OP, &mCatenate->Header) {
   2602     SetLineNo (LineNo);
   2603   }
   2604 };
   2605 
   2606 class CIfrDivide : public CIfrObj, public CIfrOpHeader {
   2607 private:
   2608   EFI_IFR_DIVIDE *mDivide;
   2609 
   2610 public:
   2611   CIfrDivide (
   2612   IN UINT32 LineNo
   2613   ) : CIfrObj (EFI_IFR_DIVIDE_OP, (CHAR8 **)&mDivide),
   2614       CIfrOpHeader (EFI_IFR_DIVIDE_OP, &mDivide->Header) {
   2615     SetLineNo (LineNo);
   2616   }
   2617 };
   2618 
   2619 class CIfrEqual : public CIfrObj, public CIfrOpHeader {
   2620 private:
   2621   EFI_IFR_EQUAL *mEqual;
   2622 
   2623 public:
   2624   CIfrEqual (
   2625   IN UINT32 LineNo
   2626   ) : CIfrObj (EFI_IFR_EQUAL_OP, (CHAR8 **)&mEqual),
   2627       CIfrOpHeader (EFI_IFR_EQUAL_OP, &mEqual->Header) {
   2628     SetLineNo (LineNo);
   2629   }
   2630 };
   2631 
   2632 class CIfrGreaterEqual : public CIfrObj, public CIfrOpHeader {
   2633 private:
   2634   EFI_IFR_GREATER_EQUAL *mGreaterEqual;
   2635 
   2636 public:
   2637   CIfrGreaterEqual (
   2638   IN UINT32 LineNo
   2639   ) : CIfrObj (EFI_IFR_GREATER_EQUAL_OP, (CHAR8 **)&mGreaterEqual),
   2640       CIfrOpHeader (EFI_IFR_GREATER_EQUAL_OP, &mGreaterEqual->Header) {
   2641     SetLineNo (LineNo);
   2642   }
   2643 };
   2644 
   2645 class CIfrGreaterThan : public CIfrObj, public CIfrOpHeader {
   2646 private:
   2647   EFI_IFR_GREATER_THAN *mGreaterThan;
   2648 
   2649 public:
   2650   CIfrGreaterThan (
   2651   IN UINT32 LineNo
   2652   ) : CIfrObj (EFI_IFR_GREATER_THAN_OP, (CHAR8 **)&mGreaterThan),
   2653       CIfrOpHeader (EFI_IFR_GREATER_THAN_OP, &mGreaterThan->Header) {
   2654     SetLineNo (LineNo);
   2655   }
   2656 };
   2657 
   2658 class CIfrLessEqual : public CIfrObj, public CIfrOpHeader {
   2659 private:
   2660   EFI_IFR_LESS_EQUAL *mLessEqual;
   2661 
   2662 public:
   2663   CIfrLessEqual (
   2664   IN UINT32 LineNo
   2665   ) : CIfrObj (EFI_IFR_LESS_EQUAL_OP, (CHAR8 **)&mLessEqual),
   2666       CIfrOpHeader (EFI_IFR_LESS_EQUAL_OP, &mLessEqual->Header) {
   2667     SetLineNo (LineNo);
   2668   }
   2669 };
   2670 
   2671 class CIfrLessThan : public CIfrObj, public CIfrOpHeader {
   2672 private:
   2673   EFI_IFR_LESS_THAN *mLessThan;
   2674 
   2675 public:
   2676   CIfrLessThan (
   2677   IN UINT32 LineNo
   2678   ) : CIfrObj (EFI_IFR_LESS_THAN_OP, (CHAR8 **)&mLessThan),
   2679       CIfrOpHeader (EFI_IFR_LESS_THAN_OP, &mLessThan->Header) {
   2680     SetLineNo (LineNo);
   2681   }
   2682 };
   2683 
   2684 class CIfrMap : public CIfrObj, public CIfrOpHeader{
   2685 private:
   2686   EFI_IFR_MAP *mMap;
   2687 
   2688 public:
   2689   CIfrMap (
   2690   IN UINT32 LineNo
   2691   ) : CIfrObj (EFI_IFR_MAP_OP, (CHAR8 **)&mMap),
   2692       CIfrOpHeader (EFI_IFR_MAP_OP, &mMap->Header) {
   2693     SetLineNo (LineNo);
   2694   }
   2695 };
   2696 
   2697 class CIfrMatch : public CIfrObj, public CIfrOpHeader {
   2698 private:
   2699   EFI_IFR_MATCH *mMatch;
   2700 
   2701 public:
   2702   CIfrMatch (
   2703   IN UINT32 LineNo
   2704   ) : CIfrObj (EFI_IFR_MATCH_OP, (CHAR8 **)&mMatch),
   2705       CIfrOpHeader (EFI_IFR_MATCH_OP, &mMatch->Header) {
   2706     SetLineNo (LineNo);
   2707   }
   2708 };
   2709 
   2710 class CIfrMatch2 : public CIfrObj, public CIfrOpHeader {
   2711 private:
   2712   EFI_IFR_MATCH2 *mMatch2;
   2713 
   2714 public:
   2715   CIfrMatch2 (
   2716   IN UINT32   LineNo,
   2717   IN EFI_GUID *Guid
   2718   ) : CIfrObj (EFI_IFR_MATCH2_OP, (CHAR8 **)&mMatch2),
   2719       CIfrOpHeader (EFI_IFR_MATCH2_OP, &mMatch2->Header) {
   2720     SetLineNo (LineNo);
   2721     memmove (&mMatch2->SyntaxType, Guid, sizeof (EFI_GUID));
   2722   }
   2723 };
   2724 
   2725 class CIfrMultiply : public CIfrObj, public CIfrOpHeader {
   2726 private:
   2727   EFI_IFR_MULTIPLY *mMultiply;
   2728 
   2729 public:
   2730   CIfrMultiply (
   2731   IN UINT32 LineNo
   2732   ) : CIfrObj (EFI_IFR_MULTIPLY_OP, (CHAR8 **)&mMultiply),
   2733       CIfrOpHeader (EFI_IFR_MULTIPLY_OP, &mMultiply->Header) {
   2734     SetLineNo (LineNo);
   2735   }
   2736 };
   2737 
   2738 class CIfrModulo : public CIfrObj, public CIfrOpHeader {
   2739 private:
   2740   EFI_IFR_MODULO *mModulo;
   2741 
   2742 public:
   2743   CIfrModulo (
   2744   IN UINT32 LineNo
   2745   ) : CIfrObj (EFI_IFR_MODULO_OP, (CHAR8 **)&mModulo),
   2746       CIfrOpHeader (EFI_IFR_MODULO_OP, &mModulo->Header) {
   2747     SetLineNo (LineNo);
   2748   }
   2749 };
   2750 
   2751 class CIfrNotEqual : public CIfrObj, public CIfrOpHeader {
   2752 private:
   2753   EFI_IFR_NOT_EQUAL *mNotEqual;
   2754 
   2755 public:
   2756   CIfrNotEqual (
   2757   IN UINT32 LineNo
   2758   ) : CIfrObj (EFI_IFR_NOT_EQUAL_OP, (CHAR8 **)&mNotEqual),
   2759       CIfrOpHeader (EFI_IFR_NOT_EQUAL_OP, &mNotEqual->Header) {
   2760     SetLineNo (LineNo);
   2761   }
   2762 };
   2763 
   2764 class CIfrOr : public CIfrObj, public CIfrOpHeader {
   2765 private:
   2766   EFI_IFR_OR *mOr;
   2767 
   2768 public:
   2769   CIfrOr (
   2770   IN UINT32 LineNo
   2771   ) : CIfrObj (EFI_IFR_OR_OP, (CHAR8 **)&mOr),
   2772       CIfrOpHeader (EFI_IFR_OR_OP, &mOr->Header) {
   2773     SetLineNo (LineNo);
   2774   }
   2775 };
   2776 
   2777 class CIfrShiftLeft : public CIfrObj, public CIfrOpHeader {
   2778 private:
   2779   EFI_IFR_SHIFT_LEFT *mShiftLeft;
   2780 
   2781 public:
   2782   CIfrShiftLeft (
   2783   IN UINT32 LineNo
   2784   ) : CIfrObj (EFI_IFR_SHIFT_LEFT_OP, (CHAR8 **)&mShiftLeft),
   2785       CIfrOpHeader (EFI_IFR_SHIFT_LEFT_OP, &mShiftLeft->Header) {
   2786     SetLineNo (LineNo);
   2787   }
   2788 };
   2789 
   2790 class CIfrShiftRight : public CIfrObj, public CIfrOpHeader {
   2791 private:
   2792   EFI_IFR_SHIFT_RIGHT *mShiftRight;
   2793 
   2794 public:
   2795   CIfrShiftRight (
   2796   IN UINT32 LineNo
   2797   ) : CIfrObj (EFI_IFR_SHIFT_RIGHT_OP, (CHAR8 **)&mShiftRight),
   2798       CIfrOpHeader (EFI_IFR_SHIFT_RIGHT_OP, &mShiftRight->Header) {
   2799     SetLineNo (LineNo);
   2800   }
   2801 };
   2802 
   2803 class CIfrSubtract : public CIfrObj, public CIfrOpHeader {
   2804 private:
   2805   EFI_IFR_SUBTRACT *mSubtract;
   2806 
   2807 public:
   2808   CIfrSubtract (
   2809   IN UINT32 LineNo
   2810   ) : CIfrObj (EFI_IFR_SUBTRACT_OP, (CHAR8 **)&mSubtract),
   2811       CIfrOpHeader (EFI_IFR_SUBTRACT_OP, &mSubtract->Header) {
   2812     SetLineNo (LineNo);
   2813   }
   2814 };
   2815 
   2816 class CIfrConditional : public CIfrObj, public CIfrOpHeader {
   2817 private:
   2818   EFI_IFR_CONDITIONAL *mConditional;
   2819 
   2820 public:
   2821   CIfrConditional (
   2822   IN UINT32 LineNo
   2823   ) : CIfrObj (EFI_IFR_CONDITIONAL_OP, (CHAR8 **)&mConditional),
   2824       CIfrOpHeader (EFI_IFR_CONDITIONAL_OP, &mConditional->Header) {
   2825     SetLineNo (LineNo);
   2826   }
   2827 };
   2828 
   2829 class CIfrFind : public CIfrObj, public CIfrOpHeader {
   2830 private:
   2831   EFI_IFR_FIND *mFind;
   2832 
   2833 public:
   2834   CIfrFind (
   2835   IN UINT32 LineNo
   2836   ) : CIfrObj (EFI_IFR_FIND_OP, (CHAR8 **)&mFind),
   2837       CIfrOpHeader (EFI_IFR_FIND_OP, &mFind->Header) {
   2838     SetLineNo (LineNo);
   2839   }
   2840 
   2841   VOID SetFormat (IN UINT8 Format) {
   2842     mFind->Format = Format;
   2843   }
   2844 };
   2845 
   2846 class CIfrMid : public CIfrObj, public CIfrOpHeader {
   2847 private:
   2848   EFI_IFR_MID *mMid;
   2849 
   2850 public:
   2851   CIfrMid (
   2852   IN UINT32 LineNo
   2853   ) : CIfrObj (EFI_IFR_MID_OP, (CHAR8 **)&mMid),
   2854       CIfrOpHeader (EFI_IFR_MID_OP, &mMid->Header) {
   2855     SetLineNo (LineNo);
   2856   }
   2857 };
   2858 
   2859 class CIfrToken : public CIfrObj, public CIfrOpHeader {
   2860 private:
   2861   EFI_IFR_TOKEN *mToken;
   2862 
   2863 public:
   2864   CIfrToken (
   2865   IN UINT32 LineNo
   2866   ) : CIfrObj (EFI_IFR_TOKEN_OP, (CHAR8 **)&mToken),
   2867       CIfrOpHeader (EFI_IFR_TOKEN_OP, &mToken->Header) {
   2868     SetLineNo (LineNo);
   2869   }
   2870 };
   2871 
   2872 class CIfrSpan : public CIfrObj, public CIfrOpHeader {
   2873 private:
   2874   EFI_IFR_SPAN *mSpan;
   2875 
   2876 public:
   2877   CIfrSpan (
   2878   IN UINT32 LineNo
   2879   ) : CIfrObj (EFI_IFR_SPAN_OP, (CHAR8 **)&mSpan),
   2880       CIfrOpHeader (EFI_IFR_SPAN_OP, &mSpan->Header) {
   2881     SetLineNo (LineNo);
   2882     mSpan->Flags = EFI_IFR_FLAGS_FIRST_MATCHING;
   2883   }
   2884 
   2885   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 LFlags) {
   2886     if (_IS_EQUAL (LFlags, EFI_IFR_FLAGS_FIRST_MATCHING)) {
   2887       mSpan->Flags |= EFI_IFR_FLAGS_FIRST_MATCHING;
   2888     } else if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_FLAGS_FIRST_NON_MATCHING)) {
   2889       mSpan->Flags |= EFI_IFR_FLAGS_FIRST_NON_MATCHING;
   2890     }
   2891 
   2892     return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
   2893   }
   2894 };
   2895 
   2896 #endif
   2897