8a22cb24e4b7be97f85b6f94b7e765a20f5175aa
[mirror_edk2.git] / BaseTools / Source / C / VfrCompile / VfrFormPkg.h
1 /** @file
2
3 The definition of CFormPkg's member function
4
5 Copyright (c) 2004 - 2017, 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, BOOLEAN IsBitVar) {
571 UINT64 MinValue = 0;
572 if (IsBitVar) {
573 MinValue = mMinMaxStepData->u32.MinValue;
574 return MinValue;
575 }
576 switch (VarType) {
577 case EFI_IFR_TYPE_NUM_SIZE_64:
578 MinValue = mMinMaxStepData->u64.MinValue;
579 break;
580 case EFI_IFR_TYPE_NUM_SIZE_32:
581 MinValue = (UINT64) mMinMaxStepData->u32.MinValue;
582 break;
583 case EFI_IFR_TYPE_NUM_SIZE_16:
584 MinValue = (UINT64) mMinMaxStepData->u16.MinValue;
585 break;
586 case EFI_IFR_TYPE_NUM_SIZE_8:
587 MinValue = (UINT64) mMinMaxStepData->u8.MinValue;
588 break;
589 default:
590 break;
591 }
592 return MinValue;
593 }
594
595 UINT64 GetMaxData (UINT8 VarType, BOOLEAN IsBitVar) {
596 UINT64 MaxValue = 0;
597 if (IsBitVar) {
598 MaxValue = mMinMaxStepData->u32.MaxValue;
599 return MaxValue;
600 }
601 switch (VarType) {
602 case EFI_IFR_TYPE_NUM_SIZE_64:
603 MaxValue = mMinMaxStepData->u64.MaxValue;
604 break;
605 case EFI_IFR_TYPE_NUM_SIZE_32:
606 MaxValue = (UINT64) mMinMaxStepData->u32.MaxValue;
607 break;
608 case EFI_IFR_TYPE_NUM_SIZE_16:
609 MaxValue = (UINT64) mMinMaxStepData->u16.MaxValue;
610 break;
611 case EFI_IFR_TYPE_NUM_SIZE_8:
612 MaxValue = (UINT64) mMinMaxStepData->u8.MaxValue;
613 break;
614 default:
615 break;
616 }
617 return MaxValue;
618 }
619
620 UINT64 GetStepData (UINT8 VarType, BOOLEAN IsBitVar) {
621 UINT64 MaxValue = 0;
622 if (IsBitVar) {
623 MaxValue = mMinMaxStepData->u32.Step;
624 return MaxValue;
625 }
626 switch (VarType) {
627 case EFI_IFR_TYPE_NUM_SIZE_64:
628 MaxValue = mMinMaxStepData->u64.Step;
629 break;
630 case EFI_IFR_TYPE_NUM_SIZE_32:
631 MaxValue = (UINT64) mMinMaxStepData->u32.Step;
632 break;
633 case EFI_IFR_TYPE_NUM_SIZE_16:
634 MaxValue = (UINT64) mMinMaxStepData->u16.Step;
635 break;
636 case EFI_IFR_TYPE_NUM_SIZE_8:
637 MaxValue = (UINT64) mMinMaxStepData->u8.Step;
638 break;
639 default:
640 break;
641 }
642 return MaxValue;
643 }
644
645 BOOLEAN IsNumericOpcode () {
646 return IsNumeric;
647 }
648
649 VOID UpdateCIfrMinMaxStepData (IN MINMAXSTEP_DATA *MinMaxStepData) {
650 mMinMaxStepData = MinMaxStepData;
651 }
652 };
653
654 static CIfrQuestionHeader *gCurrentQuestion = NULL;
655 static CIfrMinMaxStepData *gCurrentMinMaxData = NULL;
656 static BOOLEAN gIsOrderedList = FALSE;
657 static BOOLEAN gIsStringOp = FALSE;
658
659 /*
660 * The definition of all of the UEFI IFR Objects
661 */
662 class CIfrFormSet : public CIfrObj, public CIfrOpHeader {
663 private:
664 EFI_IFR_FORM_SET *mFormSet;
665 EFI_GUID *mClassGuid;
666
667 public:
668 CIfrFormSet (UINT8 Size) : CIfrObj (EFI_IFR_FORM_SET_OP, (CHAR8 **)&mFormSet, Size),
669 CIfrOpHeader (EFI_IFR_FORM_SET_OP, &mFormSet->Header, Size) {
670 mFormSet->Help = EFI_STRING_ID_INVALID;
671 mFormSet->FormSetTitle = EFI_STRING_ID_INVALID;
672 mFormSet->Flags = 0;
673 memset (&mFormSet->Guid, 0, sizeof (EFI_GUID));
674 mClassGuid = (EFI_GUID *) (mFormSet + 1);
675 }
676
677 VOID SetGuid (IN EFI_GUID *Guid) {
678 memmove (&mFormSet->Guid, Guid, sizeof (EFI_GUID));
679 }
680
681 VOID SetFormSetTitle (IN EFI_STRING_ID FormSetTitle) {
682 mFormSet->FormSetTitle = FormSetTitle;
683 }
684
685 VOID SetHelp (IN EFI_STRING_ID Help) {
686 mFormSet->Help = Help;
687 }
688
689 VOID SetClassGuid (IN EFI_GUID *Guid) {
690 memmove (&(mClassGuid[mFormSet->Flags++]), Guid, sizeof (EFI_GUID));
691 }
692
693 UINT8 GetFlags() {
694 return mFormSet->Flags;
695 }
696 };
697
698 class CIfrEnd : public CIfrObj, public CIfrOpHeader {
699 private:
700 EFI_IFR_END *mEnd;
701
702 public:
703 CIfrEnd () : CIfrObj (EFI_IFR_END_OP, (CHAR8 **)&mEnd),
704 CIfrOpHeader (EFI_IFR_END_OP, &mEnd->Header) {}
705 };
706
707 class CIfrDefaultStore : public CIfrObj, public CIfrOpHeader {
708 private:
709 EFI_IFR_DEFAULTSTORE *mDefaultStore;
710
711 public:
712 CIfrDefaultStore () : CIfrObj (EFI_IFR_DEFAULTSTORE_OP, (CHAR8 **)&mDefaultStore),
713 CIfrOpHeader (EFI_IFR_DEFAULTSTORE_OP, &mDefaultStore->Header) {
714 mDefaultStore->DefaultId = EFI_VARSTORE_ID_INVALID;
715 mDefaultStore->DefaultName = EFI_STRING_ID_INVALID;
716 }
717
718 VOID SetDefaultName (IN EFI_STRING_ID DefaultName) {
719 mDefaultStore->DefaultName = DefaultName;
720 }
721
722 VOID SetDefaultId (IN UINT16 DefaultId) {
723 mDefaultStore->DefaultId = DefaultId;
724 }
725 };
726
727 #define EFI_FORM_ID_MAX 0xFFFF
728 #define EFI_FREE_FORM_ID_BITMAP_SIZE ((EFI_FORM_ID_MAX + 1) / EFI_BITS_PER_UINT32)
729
730 class CIfrFormId {
731 public:
732 STATIC UINT32 FormIdBitMap[EFI_FREE_FORM_ID_BITMAP_SIZE];
733
734 STATIC BOOLEAN ChekFormIdFree (IN EFI_FORM_ID FormId) {
735 UINT32 Index = (FormId / EFI_BITS_PER_UINT32);
736 UINT32 Offset = (FormId % EFI_BITS_PER_UINT32);
737
738 return (FormIdBitMap[Index] & (0x80000000 >> Offset)) == 0;
739 }
740
741 STATIC VOID MarkFormIdUsed (IN EFI_FORM_ID FormId) {
742 UINT32 Index = (FormId / EFI_BITS_PER_UINT32);
743 UINT32 Offset = (FormId % EFI_BITS_PER_UINT32);
744
745 FormIdBitMap[Index] |= (0x80000000 >> Offset);
746 }
747 };
748
749 class CIfrForm : public CIfrObj, public CIfrOpHeader {
750 private:
751 EFI_IFR_FORM *mForm;
752
753 public:
754 CIfrForm () : CIfrObj (EFI_IFR_FORM_OP, (CHAR8 **)&mForm),
755 CIfrOpHeader (EFI_IFR_FORM_OP, &mForm->Header) {
756 mForm->FormId = 0;
757 mForm->FormTitle = EFI_STRING_ID_INVALID;
758 }
759
760 EFI_VFR_RETURN_CODE SetFormId (IN EFI_FORM_ID FormId) {
761 if (FormId == 0) {
762 //
763 // FormId can't be 0.
764 //
765 return VFR_RETURN_INVALID_PARAMETER;
766 }
767 if (CIfrFormId::ChekFormIdFree (FormId) == FALSE) {
768 return VFR_RETURN_FORMID_REDEFINED;
769 }
770 mForm->FormId = FormId;
771 CIfrFormId::MarkFormIdUsed (FormId);
772 return VFR_RETURN_SUCCESS;
773 }
774
775 VOID SetFormTitle (IN EFI_STRING_ID FormTitle) {
776 mForm->FormTitle = FormTitle;
777 }
778 };
779
780 class CIfrFormMap : public CIfrObj, public CIfrOpHeader {
781 private:
782 EFI_IFR_FORM_MAP *mFormMap;
783 EFI_IFR_FORM_MAP_METHOD *mMethodMap;
784
785 public:
786 CIfrFormMap () : CIfrObj (EFI_IFR_FORM_MAP_OP, (CHAR8 **)&mFormMap, sizeof (EFI_IFR_FORM_MAP), TRUE),
787 CIfrOpHeader (EFI_IFR_FORM_MAP_OP, &mFormMap->Header) {
788 mFormMap->FormId = 0;
789 mMethodMap = (EFI_IFR_FORM_MAP_METHOD *) (mFormMap + 1);
790 }
791
792 EFI_VFR_RETURN_CODE SetFormId (IN EFI_FORM_ID FormId) {
793 if (FormId == 0) {
794 //
795 // FormId can't be 0.
796 //
797 return VFR_RETURN_INVALID_PARAMETER;
798 }
799 if (CIfrFormId::ChekFormIdFree (FormId) == FALSE) {
800 return VFR_RETURN_FORMID_REDEFINED;
801 }
802 mFormMap->FormId = FormId;
803 CIfrFormId::MarkFormIdUsed (FormId);
804 return VFR_RETURN_SUCCESS;
805 }
806
807 VOID SetFormMapMethod (IN EFI_STRING_ID MethodTitle, IN EFI_GUID *MethodGuid) {
808 if (ExpendObjBin (sizeof (EFI_IFR_FORM_MAP_METHOD))) {
809 IncLength (sizeof (EFI_IFR_FORM_MAP_METHOD));
810
811 mMethodMap->MethodTitle = MethodTitle;
812 memmove (&(mMethodMap->MethodIdentifier), MethodGuid, sizeof (EFI_GUID));
813 mMethodMap ++;
814 }
815 }
816 };
817
818 class CIfrVarStore : public CIfrObj, public CIfrOpHeader {
819 private:
820 EFI_IFR_VARSTORE *mVarStore;
821
822 public:
823 CIfrVarStore () : CIfrObj (EFI_IFR_VARSTORE_OP, (CHAR8 **)&mVarStore, sizeof (EFI_IFR_VARSTORE), TRUE),
824 CIfrOpHeader (EFI_IFR_VARSTORE_OP, &mVarStore->Header) {
825 mVarStore->VarStoreId = EFI_VARSTORE_ID_INVALID;
826 mVarStore->Size = 0;
827 memset (&mVarStore->Guid, 0, sizeof (EFI_GUID));
828 mVarStore->Name[0] = '\0';
829 }
830
831 VOID SetGuid (IN EFI_GUID *Guid) {
832 memmove (&mVarStore->Guid, Guid, sizeof (EFI_GUID));
833 }
834
835 VOID SetVarStoreId (IN EFI_VARSTORE_ID VarStoreId) {
836 mVarStore->VarStoreId = VarStoreId;
837 }
838
839 VOID SetSize (IN UINT16 Size) {
840 mVarStore->Size = Size;
841 }
842
843 VOID SetName (IN CHAR8 *Name) {
844 UINT8 Len;
845
846 if (Name != NULL) {
847 Len = (UINT8) strlen (Name);
848 if (Len != 0) {
849 if (ExpendObjBin (Len) == TRUE) {
850 IncLength (Len);
851 strcpy ((CHAR8 *)(mVarStore->Name), Name);
852 }
853 }
854 }
855 }
856 };
857
858 class CIfrVarStoreEfi : public CIfrObj, public CIfrOpHeader {
859 private:
860 EFI_IFR_VARSTORE_EFI *mVarStoreEfi;
861
862 public:
863 CIfrVarStoreEfi () : CIfrObj (EFI_IFR_VARSTORE_EFI_OP, (CHAR8 **)&mVarStoreEfi, sizeof (EFI_IFR_VARSTORE_EFI), TRUE),
864 CIfrOpHeader (EFI_IFR_VARSTORE_EFI_OP, &mVarStoreEfi->Header) {
865 mVarStoreEfi->VarStoreId = EFI_VAROFFSET_INVALID;
866 mVarStoreEfi->Size = 0;
867 memset (&mVarStoreEfi->Guid, 0, sizeof (EFI_GUID));
868 mVarStoreEfi->Name[0] = '\0';
869 }
870
871 VOID SetGuid (IN EFI_GUID *Guid) {
872 memmove (&mVarStoreEfi->Guid, Guid, sizeof (EFI_GUID));
873 }
874
875 VOID SetVarStoreId (IN UINT16 VarStoreId) {
876 mVarStoreEfi->VarStoreId = VarStoreId;
877 }
878
879 VOID SetAttributes (IN UINT32 Attributes) {
880 mVarStoreEfi->Attributes = Attributes;
881 }
882 VOID SetSize (IN UINT16 Size) {
883 mVarStoreEfi->Size = Size;
884 }
885
886 VOID SetName (IN CHAR8 *Name) {
887 UINT8 Len;
888
889 if (Name != NULL) {
890 Len = (UINT8) strlen (Name);
891 if (Len != 0) {
892 if (ExpendObjBin (Len) == TRUE) {
893 IncLength (Len);
894 strcpy ((CHAR8 *)(mVarStoreEfi->Name), Name);
895 }
896 }
897 }
898 }
899
900 VOID SetBinaryLength (IN UINT16 Size) {
901 UINT16 Len;
902
903 Len = sizeof (EFI_IFR_VARSTORE_EFI);
904 if (Size > Len) {
905 ExpendObjBin(Size - Len);
906 IncLength(Size - Len);
907 } else {
908 ShrinkObjBin(Len - Size);
909 DecLength(Len - Size);
910 }
911 }
912 };
913
914 class CIfrVarStoreNameValue : public CIfrObj, public CIfrOpHeader {
915 private:
916 EFI_IFR_VARSTORE_NAME_VALUE *mVarStoreNameValue;
917
918 public:
919 CIfrVarStoreNameValue () : CIfrObj (EFI_IFR_VARSTORE_NAME_VALUE_OP, (CHAR8 **)&mVarStoreNameValue),
920 CIfrOpHeader (EFI_IFR_VARSTORE_NAME_VALUE_OP, &mVarStoreNameValue->Header) {
921 mVarStoreNameValue->VarStoreId = EFI_VAROFFSET_INVALID;
922 memset (&mVarStoreNameValue->Guid, 0, sizeof (EFI_GUID));
923 }
924
925 VOID SetGuid (IN EFI_GUID *Guid) {
926 memmove (&mVarStoreNameValue->Guid, Guid, sizeof (EFI_GUID));
927 }
928
929 VOID SetVarStoreId (IN UINT16 VarStoreId) {
930 mVarStoreNameValue->VarStoreId = VarStoreId;
931 }
932 };
933
934 class CIfrImage : public CIfrObj, public CIfrOpHeader {
935 private:
936 EFI_IFR_IMAGE *mImage;
937
938 public:
939 CIfrImage () : CIfrObj (EFI_IFR_IMAGE_OP, (CHAR8 **)&mImage),
940 CIfrOpHeader (EFI_IFR_IMAGE_OP, &mImage->Header) {
941 mImage->Id = EFI_IMAGE_ID_INVALID;
942 }
943
944 VOID SetImageId (IN EFI_IMAGE_ID ImageId) {
945 mImage->Id = ImageId;
946 }
947 };
948
949 class CIfrModal : public CIfrObj, public CIfrOpHeader {
950 private:
951 EFI_IFR_MODAL_TAG *mModal;
952
953 public:
954 CIfrModal () : CIfrObj (EFI_IFR_MODAL_TAG_OP, (CHAR8 **)&mModal),
955 CIfrOpHeader (EFI_IFR_MODAL_TAG_OP, &mModal->Header) {
956 }
957 };
958
959
960 class CIfrLocked : public CIfrObj, public CIfrOpHeader {
961 private:
962 EFI_IFR_LOCKED *mLocked;
963
964 public:
965 CIfrLocked () : CIfrObj (EFI_IFR_LOCKED_OP, (CHAR8 **)&mLocked),
966 CIfrOpHeader (EFI_IFR_LOCKED_OP, &mLocked->Header) {}
967 };
968
969 class CIfrRule : public CIfrObj, public CIfrOpHeader {
970 private:
971 EFI_IFR_RULE *mRule;
972
973 public:
974 CIfrRule () : CIfrObj (EFI_IFR_RULE_OP, (CHAR8 **)&mRule),
975 mRule ((EFI_IFR_RULE *)GetObjBinAddr()),
976 CIfrOpHeader (EFI_IFR_RULE_OP, &mRule->Header) {
977 mRule->RuleId = EFI_RULE_ID_INVALID;
978 }
979
980 VOID SetRuleId (IN UINT8 RuleId) {
981 mRule->RuleId = RuleId;
982 }
983 };
984
985 static EFI_IFR_TYPE_VALUE gZeroEfiIfrTypeValue = {0, };
986
987 class CIfrDefault : public CIfrObj, public CIfrOpHeader {
988 private:
989 EFI_IFR_DEFAULT *mDefault;
990
991 public:
992 CIfrDefault (
993 IN UINT8 Size,
994 IN UINT16 DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD,
995 IN UINT8 Type = EFI_IFR_TYPE_OTHER,
996 IN EFI_IFR_TYPE_VALUE Value = gZeroEfiIfrTypeValue
997 ) : CIfrObj (EFI_IFR_DEFAULT_OP, (CHAR8 **)&mDefault, Size),
998 CIfrOpHeader (EFI_IFR_DEFAULT_OP, &mDefault->Header, Size) {
999 mDefault->Type = Type;
1000 mDefault->DefaultId = DefaultId;
1001 memmove (&(mDefault->Value), &Value, Size - OFFSET_OF (EFI_IFR_DEFAULT, Value));
1002 }
1003
1004 VOID SetDefaultId (IN UINT16 DefaultId) {
1005 mDefault->DefaultId = DefaultId;
1006 }
1007
1008 VOID SetType (IN UINT8 Type) {
1009 mDefault->Type = Type;
1010 }
1011
1012 VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) {
1013 memmove (&mDefault->Value, &Value, mDefault->Header.Length - OFFSET_OF (EFI_IFR_DEFAULT, Value));
1014 }
1015 };
1016
1017 class CIfrDefault2 : public CIfrObj, public CIfrOpHeader {
1018 private:
1019 EFI_IFR_DEFAULT_2 *mDefault;
1020
1021 public:
1022 CIfrDefault2 (
1023 IN UINT16 DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD,
1024 IN UINT8 Type = EFI_IFR_TYPE_OTHER
1025 ) : CIfrObj (EFI_IFR_DEFAULT_OP, (CHAR8 **)&mDefault, sizeof (EFI_IFR_DEFAULT_2)),
1026 CIfrOpHeader (EFI_IFR_DEFAULT_OP, &mDefault->Header, sizeof (EFI_IFR_DEFAULT_2)) {
1027 mDefault->Type = Type;
1028 mDefault->DefaultId = DefaultId;
1029 }
1030
1031 VOID SetDefaultId (IN UINT16 DefaultId) {
1032 mDefault->DefaultId = DefaultId;
1033 }
1034
1035 VOID SetType (IN UINT8 Type) {
1036 mDefault->Type = Type;
1037 }
1038 };
1039
1040 class CIfrValue : public CIfrObj, public CIfrOpHeader{
1041 private:
1042 EFI_IFR_VALUE *mValue;
1043
1044 public:
1045 CIfrValue () : CIfrObj (EFI_IFR_VALUE_OP, (CHAR8 **)&mValue),
1046 CIfrOpHeader (EFI_IFR_VALUE_OP, &mValue->Header) {}
1047
1048 };
1049
1050 class CIfrRead : public CIfrObj, public CIfrOpHeader{
1051 private:
1052 EFI_IFR_READ *mRead;
1053
1054 public:
1055 CIfrRead () : CIfrObj (EFI_IFR_READ_OP, (CHAR8 **)&mRead),
1056 CIfrOpHeader (EFI_IFR_READ_OP, &mRead->Header) {}
1057
1058 };
1059
1060 class CIfrWrite : public CIfrObj, public CIfrOpHeader{
1061 private:
1062 EFI_IFR_WRITE *mWrite;
1063
1064 public:
1065 CIfrWrite () : CIfrObj (EFI_IFR_WRITE_OP, (CHAR8 **)&mWrite),
1066 CIfrOpHeader (EFI_IFR_WRITE_OP, &mWrite->Header) {}
1067
1068 };
1069
1070 class CIfrGet : public CIfrObj, public CIfrOpHeader{
1071 private:
1072 EFI_IFR_GET *mGet;
1073
1074 public:
1075 CIfrGet (
1076 IN UINT32 LineNo
1077 ) : CIfrObj (EFI_IFR_GET_OP, (CHAR8 **)&mGet),
1078 CIfrOpHeader (EFI_IFR_GET_OP, &mGet->Header) {
1079 SetLineNo (LineNo);
1080 }
1081
1082 VOID SetVarInfo (IN EFI_VARSTORE_INFO *Info) {
1083 mGet->VarStoreId = Info->mVarStoreId;
1084 mGet->VarStoreInfo.VarName = Info->mInfo.mVarName;
1085 mGet->VarStoreInfo.VarOffset = Info->mInfo.mVarOffset;
1086 mGet->VarStoreType = Info->mVarType;
1087 }
1088 };
1089
1090 class CIfrSet : public CIfrObj, public CIfrOpHeader{
1091 private:
1092 EFI_IFR_SET *mSet;
1093
1094 public:
1095 CIfrSet (
1096 IN UINT32 LineNo
1097 ) : CIfrObj (EFI_IFR_SET_OP, (CHAR8 **)&mSet),
1098 CIfrOpHeader (EFI_IFR_SET_OP, &mSet->Header) {
1099 SetLineNo (LineNo);
1100 }
1101
1102 VOID SetVarInfo (IN EFI_VARSTORE_INFO *Info) {
1103 mSet->VarStoreId = Info->mVarStoreId;
1104 mSet->VarStoreInfo.VarName = Info->mInfo.mVarName;
1105 mSet->VarStoreInfo.VarOffset = Info->mInfo.mVarOffset;
1106 mSet->VarStoreType = Info->mVarType;
1107 }
1108 };
1109
1110 class CIfrSubtitle : public CIfrObj, public CIfrOpHeader, public CIfrStatementHeader {
1111 private:
1112 EFI_IFR_SUBTITLE *mSubtitle;
1113
1114 public:
1115 CIfrSubtitle () : CIfrObj (EFI_IFR_SUBTITLE_OP, (CHAR8 **)&mSubtitle),
1116 CIfrOpHeader (EFI_IFR_SUBTITLE_OP, &mSubtitle->Header),
1117 CIfrStatementHeader (&mSubtitle->Statement) {
1118 mSubtitle->Flags = 0;
1119 }
1120
1121 EFI_VFR_RETURN_CODE SetFlags (IN UINT8 LFlags) {
1122 if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_FLAGS_HORIZONTAL)) {
1123 mSubtitle->Flags |= EFI_IFR_FLAGS_HORIZONTAL;
1124 }
1125
1126 return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
1127 }
1128 };
1129
1130 class CIfrText : public CIfrObj, public CIfrOpHeader, public CIfrStatementHeader {
1131 private:
1132 EFI_IFR_TEXT *mText;
1133
1134 public:
1135 CIfrText () : CIfrObj (EFI_IFR_TEXT_OP, (CHAR8 **)&mText),
1136 CIfrOpHeader (EFI_IFR_TEXT_OP, &mText->Header),
1137 CIfrStatementHeader (&mText->Statement) {
1138 mText->TextTwo = EFI_STRING_ID_INVALID;
1139 }
1140
1141 VOID SetTextTwo (IN EFI_STRING_ID StringId) {
1142 mText->TextTwo = StringId;
1143 }
1144 };
1145
1146 class CIfrRef : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
1147 private:
1148 EFI_IFR_REF *mRef;
1149
1150 public:
1151 CIfrRef () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)&mRef),
1152 CIfrOpHeader (EFI_IFR_REF_OP, &mRef->Header),
1153 CIfrQuestionHeader (&mRef->Question) {
1154 mRef->FormId = 0;
1155 }
1156
1157 VOID SetFormId (IN EFI_FORM_ID FormId) {
1158 mRef->FormId = FormId;
1159 }
1160 };
1161
1162 class CIfrRef2 : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
1163 private:
1164 EFI_IFR_REF2 *mRef2;
1165
1166 public:
1167 CIfrRef2 () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)&mRef2, sizeof (EFI_IFR_REF2)),
1168 CIfrOpHeader (EFI_IFR_REF_OP, &mRef2->Header, sizeof (EFI_IFR_REF2)),
1169 CIfrQuestionHeader (&mRef2->Question) {
1170 mRef2->FormId = 0;
1171 mRef2->QuestionId = EFI_QUESTION_ID_INVALID;
1172 }
1173
1174 VOID SetFormId (IN EFI_FORM_ID FormId) {
1175 mRef2->FormId = FormId;
1176 }
1177
1178 VOID SetQuestionId (IN EFI_QUESTION_ID QuestionId) {
1179 mRef2->QuestionId = QuestionId;
1180 }
1181 };
1182
1183 class CIfrRef3 : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
1184 private:
1185 EFI_IFR_REF3 *mRef3;
1186
1187 public:
1188 CIfrRef3 () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)&mRef3, sizeof(EFI_IFR_REF3)),
1189 CIfrOpHeader (EFI_IFR_REF_OP, &mRef3->Header, sizeof (EFI_IFR_REF3)),
1190 CIfrQuestionHeader (&mRef3->Question) {
1191 mRef3->FormId = 0;
1192 mRef3->QuestionId = EFI_QUESTION_ID_INVALID;
1193 memset (&mRef3->FormSetId, 0, sizeof (EFI_GUID));
1194 }
1195
1196 VOID SetFormId (IN EFI_FORM_ID FormId) {
1197 mRef3->FormId = FormId;
1198 }
1199
1200 VOID SetQuestionId (IN EFI_QUESTION_ID QuestionId) {
1201 mRef3->QuestionId = QuestionId;
1202 }
1203
1204 VOID SetFormSetId (IN EFI_GUID FormSetId) {
1205 mRef3->FormSetId = FormSetId;
1206 }
1207 };
1208
1209 class CIfrRef4 : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
1210 private:
1211 EFI_IFR_REF4 *mRef4;
1212
1213 public:
1214 CIfrRef4 () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)&mRef4, sizeof(EFI_IFR_REF4)),
1215 CIfrOpHeader (EFI_IFR_REF_OP, &mRef4->Header, sizeof(EFI_IFR_REF4)),
1216 CIfrQuestionHeader (&mRef4->Question) {
1217 mRef4->FormId = 0;
1218 mRef4->QuestionId = EFI_QUESTION_ID_INVALID;
1219 memset (&mRef4->FormSetId, 0, sizeof (EFI_GUID));
1220 mRef4->DevicePath = EFI_STRING_ID_INVALID;
1221 }
1222
1223 VOID SetFormId (IN EFI_FORM_ID FormId) {
1224 mRef4->FormId = FormId;
1225 }
1226
1227 VOID SetQuestionId (IN EFI_QUESTION_ID QuestionId) {
1228 mRef4->QuestionId = QuestionId;
1229 }
1230
1231 VOID SetFormSetId (IN EFI_GUID FormSetId) {
1232 mRef4->FormSetId = FormSetId;
1233 }
1234
1235 VOID SetDevicePath (IN EFI_STRING_ID DevicePath) {
1236 mRef4->DevicePath = DevicePath;
1237 }
1238 };
1239
1240 class CIfrRef5 : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
1241 private:
1242 EFI_IFR_REF5 *mRef5;
1243
1244 public:
1245 CIfrRef5 () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)&mRef5, sizeof (EFI_IFR_REF5)),
1246 CIfrOpHeader (EFI_IFR_REF_OP, &mRef5->Header, sizeof (EFI_IFR_REF5)),
1247 CIfrQuestionHeader (&mRef5->Question) {
1248 }
1249 };
1250
1251 class CIfrResetButton : public CIfrObj, public CIfrOpHeader, public CIfrStatementHeader {
1252 private:
1253 EFI_IFR_RESET_BUTTON *mResetButton;
1254
1255 public:
1256 CIfrResetButton () : CIfrObj (EFI_IFR_RESET_BUTTON_OP, (CHAR8 **)&mResetButton),
1257 CIfrOpHeader (EFI_IFR_RESET_BUTTON_OP, &mResetButton->Header),
1258 CIfrStatementHeader (&mResetButton->Statement) {
1259 mResetButton->DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
1260 }
1261
1262 VOID SetDefaultId (IN UINT16 DefaultId) {
1263 mResetButton->DefaultId = DefaultId;
1264 }
1265 };
1266
1267 class CIfrCheckBox : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
1268 private:
1269 EFI_IFR_CHECKBOX *mCheckBox;
1270
1271 public:
1272 CIfrCheckBox () : CIfrObj (EFI_IFR_CHECKBOX_OP, (CHAR8 **)&mCheckBox),
1273 CIfrOpHeader (EFI_IFR_CHECKBOX_OP, &mCheckBox->Header),
1274 CIfrQuestionHeader (&mCheckBox->Question) {
1275 mCheckBox->Flags = 0;
1276 gCurrentQuestion = this;
1277 }
1278
1279 ~CIfrCheckBox () {
1280 gCurrentQuestion = NULL;
1281 }
1282
1283 EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, UINT8 LFlags) {
1284 EFI_VFR_RETURN_CODE Ret;
1285
1286 Ret = CIfrQuestionHeader::SetFlags (HFlags);
1287 if (Ret != VFR_RETURN_SUCCESS) {
1288 return Ret;
1289 }
1290
1291 if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_CHECKBOX_DEFAULT)) {
1292 mCheckBox->Flags |= EFI_IFR_CHECKBOX_DEFAULT;
1293 }
1294
1295 if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_CHECKBOX_DEFAULT_MFG)) {
1296 mCheckBox->Flags |= EFI_IFR_CHECKBOX_DEFAULT_MFG;
1297 }
1298
1299 return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
1300 }
1301
1302 UINT8 GetFlags (VOID) {
1303 return mCheckBox->Flags;
1304 }
1305 };
1306
1307 class CIfrAction : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
1308 private:
1309 EFI_IFR_ACTION *mAction;
1310
1311 public:
1312 CIfrAction () : CIfrObj (EFI_IFR_ACTION_OP, (CHAR8 **)&mAction),
1313 CIfrOpHeader (EFI_IFR_ACTION_OP, &mAction->Header),
1314 CIfrQuestionHeader (&mAction->Question) {
1315 mAction->QuestionConfig = EFI_STRING_ID_INVALID;
1316 }
1317
1318 VOID SetQuestionConfig (IN EFI_STRING_ID QuestionConfig) {
1319 mAction->QuestionConfig = QuestionConfig;
1320 }
1321 };
1322
1323 class CIfrDate : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
1324 private:
1325 EFI_IFR_DATE *mDate;
1326
1327 public:
1328 CIfrDate () : CIfrObj (EFI_IFR_DATE_OP, (CHAR8 **)&mDate),
1329 CIfrOpHeader (EFI_IFR_DATE_OP, &mDate->Header),
1330 CIfrQuestionHeader (&mDate->Question) {
1331 mDate->Flags = 0;
1332 }
1333
1334 EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
1335 EFI_VFR_RETURN_CODE Ret;
1336
1337 Ret = CIfrQuestionHeader::SetFlags (HFlags);
1338 if (Ret != VFR_RETURN_SUCCESS) {
1339 return Ret;
1340 }
1341
1342 if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_QF_DATE_YEAR_SUPPRESS)) {
1343 mDate->Flags |= EFI_QF_DATE_YEAR_SUPPRESS;
1344 }
1345
1346 if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_QF_DATE_MONTH_SUPPRESS)) {
1347 mDate->Flags |= EFI_QF_DATE_MONTH_SUPPRESS;
1348 }
1349
1350 if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_QF_DATE_DAY_SUPPRESS)) {
1351 mDate->Flags |= EFI_QF_DATE_DAY_SUPPRESS;
1352 }
1353
1354 if (_FLAG_TEST_AND_CLEAR (LFlags, QF_DATE_STORAGE_NORMAL)) {
1355 mDate->Flags |= QF_DATE_STORAGE_NORMAL;
1356 } else if (_FLAG_TEST_AND_CLEAR (LFlags, QF_DATE_STORAGE_TIME)) {
1357 mDate->Flags |= QF_DATE_STORAGE_TIME;
1358 } else if (_FLAG_TEST_AND_CLEAR (LFlags, QF_DATE_STORAGE_WAKEUP)) {
1359 mDate->Flags |= QF_DATE_STORAGE_WAKEUP;
1360 }
1361
1362 return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
1363 }
1364 };
1365
1366 class CIfrNumeric : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader, public CIfrMinMaxStepData {
1367 private:
1368 EFI_IFR_NUMERIC *mNumeric;
1369
1370 public:
1371 CIfrNumeric () : CIfrObj (EFI_IFR_NUMERIC_OP, (CHAR8 **)&mNumeric, sizeof (EFI_IFR_NUMERIC), TRUE),
1372 CIfrOpHeader (EFI_IFR_NUMERIC_OP, &mNumeric->Header),
1373 CIfrQuestionHeader (&mNumeric->Question),
1374 CIfrMinMaxStepData (&mNumeric->data, TRUE) {
1375 mNumeric->Flags = EFI_IFR_NUMERIC_SIZE_1 | EFI_IFR_DISPLAY_UINT_DEC;
1376 gCurrentQuestion = this;
1377 gCurrentMinMaxData = this;
1378 }
1379
1380 ~CIfrNumeric () {
1381 gCurrentQuestion = NULL;
1382 gCurrentMinMaxData = NULL;
1383 }
1384
1385 VOID ShrinkBinSize (IN UINT16 Size) {
1386 //
1387 // Update the buffer size which is truly be used later.
1388 //
1389 ShrinkObjBin(Size);
1390 DecLength(Size);
1391
1392 //
1393 // Allocate buffer in gCFormPkg.
1394 //
1395 _EMIT_PENDING_OBJ();
1396
1397 //
1398 // Update the buffer pointer used by other class.
1399 //
1400 mNumeric = (EFI_IFR_NUMERIC *) GetObjBinAddr();
1401 UpdateHeader (&mNumeric->Header);
1402 UpdateCIfrQuestionHeader(&mNumeric->Question);
1403 UpdateCIfrMinMaxStepData(&mNumeric->data);
1404 }
1405
1406 EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags, BOOLEAN DisplaySettingsSpecified = FALSE) {
1407 EFI_VFR_RETURN_CODE Ret;
1408
1409 Ret = CIfrQuestionHeader::SetFlags (HFlags);
1410 if (Ret != VFR_RETURN_SUCCESS) {
1411 return Ret;
1412 }
1413
1414 if (DisplaySettingsSpecified == FALSE) {
1415 mNumeric->Flags = LFlags | EFI_IFR_DISPLAY_UINT_DEC;
1416 } else {
1417 mNumeric->Flags = LFlags;
1418 }
1419 return VFR_RETURN_SUCCESS;
1420 }
1421
1422 EFI_VFR_RETURN_CODE SetFlagsForBitField (IN UINT8 HFlags, IN UINT8 LFlags, BOOLEAN DisplaySettingsSpecified = FALSE) {
1423 EFI_VFR_RETURN_CODE Ret;
1424
1425 Ret = CIfrQuestionHeader::SetFlags (HFlags);
1426 if (Ret != VFR_RETURN_SUCCESS) {
1427 return Ret;
1428 }
1429
1430 if (DisplaySettingsSpecified == FALSE) {
1431 mNumeric->Flags = LFlags | EDKII_IFR_DISPLAY_UINT_DEC_BIT;
1432 } else {
1433 mNumeric->Flags = LFlags;
1434 }
1435 return VFR_RETURN_SUCCESS;
1436 }
1437
1438 UINT8 GetNumericFlags () {
1439 return mNumeric->Flags;
1440 }
1441 };
1442
1443 class CIfrOneOf : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader, public CIfrMinMaxStepData {
1444 private:
1445 EFI_IFR_ONE_OF *mOneOf;
1446
1447 public:
1448 CIfrOneOf () : CIfrObj (EFI_IFR_ONE_OF_OP, (CHAR8 **)&mOneOf, sizeof (EFI_IFR_ONE_OF), TRUE),
1449 CIfrOpHeader (EFI_IFR_ONE_OF_OP, &mOneOf->Header),
1450 CIfrQuestionHeader (&mOneOf->Question),
1451 CIfrMinMaxStepData (&mOneOf->data) {
1452 mOneOf->Flags = 0;
1453 gCurrentQuestion = this;
1454 gCurrentMinMaxData = this;
1455 }
1456
1457 ~CIfrOneOf () {
1458 gCurrentQuestion = NULL;
1459 gCurrentMinMaxData = NULL;
1460 }
1461
1462 EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
1463 EFI_VFR_RETURN_CODE Ret;
1464
1465 Ret = CIfrQuestionHeader::SetFlags (HFlags);
1466 if (Ret != VFR_RETURN_SUCCESS) {
1467 return Ret;
1468 }
1469
1470 if (LFlags & EFI_IFR_DISPLAY) {
1471 mOneOf->Flags = LFlags;
1472 } else {
1473 mOneOf->Flags = LFlags | EFI_IFR_DISPLAY_UINT_DEC;
1474 }
1475 return VFR_RETURN_SUCCESS;
1476 }
1477
1478 EFI_VFR_RETURN_CODE SetFlagsForBitField (IN UINT8 HFlags, IN UINT8 LFlags) {
1479 EFI_VFR_RETURN_CODE Ret;
1480
1481 Ret = CIfrQuestionHeader::SetFlags (HFlags);
1482 if (Ret != VFR_RETURN_SUCCESS) {
1483 return Ret;
1484 }
1485
1486 if (LFlags & EFI_IFR_DISPLAY) {
1487 mOneOf->Flags = LFlags;
1488 } else {
1489 mOneOf->Flags = LFlags | EDKII_IFR_DISPLAY_UINT_DEC_BIT;
1490 }
1491 return VFR_RETURN_SUCCESS;
1492 }
1493
1494 VOID ShrinkBinSize (IN UINT16 Size) {
1495 //
1496 // Update the buffer size which is truly be used later.
1497 //
1498 ShrinkObjBin(Size);
1499 DecLength(Size);
1500
1501 //
1502 // Allocate buffer in gCFormPkg.
1503 //
1504 _EMIT_PENDING_OBJ();
1505
1506 //
1507 // Update the buffer pointer used by other class.
1508 //
1509 mOneOf = (EFI_IFR_ONE_OF *) GetObjBinAddr();
1510 UpdateHeader (&mOneOf->Header);
1511 UpdateCIfrQuestionHeader(&mOneOf->Question);
1512 UpdateCIfrMinMaxStepData(&mOneOf->data);
1513 }
1514 };
1515
1516 class CIfrString : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
1517 private:
1518 EFI_IFR_STRING *mString;
1519
1520 public:
1521 CIfrString () : CIfrObj (EFI_IFR_STRING_OP, (CHAR8 **)&mString),
1522 CIfrOpHeader (EFI_IFR_STRING_OP, &mString->Header),
1523 CIfrQuestionHeader (&mString->Question) {
1524 mString->Flags = 0;
1525 mString->MinSize = 0;
1526 mString->MaxSize = 0;
1527 gCurrentQuestion = this;
1528 }
1529
1530 ~CIfrString () {
1531 gCurrentQuestion = NULL;
1532 }
1533
1534 EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
1535 EFI_VFR_RETURN_CODE Ret;
1536
1537 Ret = CIfrQuestionHeader::SetFlags (HFlags);
1538 if (Ret != VFR_RETURN_SUCCESS) {
1539 return Ret;
1540 }
1541
1542 if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_STRING_MULTI_LINE)) {
1543 mString->Flags |= EFI_IFR_STRING_MULTI_LINE;
1544 }
1545
1546 return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
1547 }
1548
1549 VOID SetMinSize (IN UINT8 Flags) {
1550 mString->MinSize = Flags;
1551 }
1552
1553 VOID SetMaxSize (IN UINT8 MaxSize) {
1554 mString->MaxSize = MaxSize;
1555 }
1556 };
1557
1558 class CIfrPassword : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
1559 private:
1560 EFI_IFR_PASSWORD *mPassword;
1561
1562 public:
1563 CIfrPassword () : CIfrObj (EFI_IFR_PASSWORD_OP, (CHAR8 **)&mPassword),
1564 CIfrOpHeader (EFI_IFR_PASSWORD_OP, &mPassword->Header),
1565 CIfrQuestionHeader (&mPassword->Question) {
1566 mPassword->MinSize = 0;
1567 mPassword->MaxSize = 0;
1568 gCurrentQuestion = this;
1569 }
1570
1571 ~CIfrPassword () {
1572 gCurrentQuestion = NULL;
1573 }
1574
1575 VOID SetMinSize (IN UINT16 MinSize) {
1576 mPassword->MinSize = MinSize;
1577 }
1578
1579 VOID SetMaxSize (IN UINT16 MaxSize) {
1580 mPassword->MaxSize = MaxSize;
1581 }
1582 };
1583
1584 class CIfrOrderedList : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
1585 private:
1586 EFI_IFR_ORDERED_LIST *mOrderedList;
1587
1588 public:
1589 CIfrOrderedList () : CIfrObj (EFI_IFR_ORDERED_LIST_OP, (CHAR8 **)&mOrderedList),
1590 CIfrOpHeader (EFI_IFR_ORDERED_LIST_OP, &mOrderedList->Header),
1591 CIfrQuestionHeader (&mOrderedList->Question) {
1592 mOrderedList->MaxContainers = 0;
1593 mOrderedList->Flags = 0;
1594 gCurrentQuestion = this;
1595 }
1596
1597 ~CIfrOrderedList () {
1598 gCurrentQuestion = NULL;
1599 }
1600
1601 VOID SetMaxContainers (IN UINT8 MaxContainers) {
1602 mOrderedList->MaxContainers = MaxContainers;
1603 }
1604
1605 EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
1606 EFI_VFR_RETURN_CODE Ret;
1607
1608 Ret = CIfrQuestionHeader::SetFlags (HFlags);
1609 if (Ret != VFR_RETURN_SUCCESS) {
1610 return Ret;
1611 }
1612
1613 if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_UNIQUE_SET)) {
1614 mOrderedList->Flags |= EFI_IFR_UNIQUE_SET;
1615 }
1616
1617 if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_NO_EMPTY_SET)) {
1618 mOrderedList->Flags |= EFI_IFR_NO_EMPTY_SET;
1619 }
1620
1621 return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
1622 }
1623 };
1624
1625 class CIfrTime : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
1626 private:
1627 EFI_IFR_TIME *mTime;
1628
1629 public:
1630 CIfrTime () : CIfrObj (EFI_IFR_TIME_OP, (CHAR8 **)&mTime),
1631 CIfrOpHeader (EFI_IFR_TIME_OP, &mTime->Header),
1632 CIfrQuestionHeader (&mTime->Question) {
1633 mTime->Flags = 0;
1634 }
1635
1636 EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
1637 EFI_VFR_RETURN_CODE Ret;
1638
1639 Ret = CIfrQuestionHeader::SetFlags (HFlags);
1640 if (Ret != VFR_RETURN_SUCCESS) {
1641 return Ret;
1642 }
1643
1644 if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_HOUR_SUPPRESS)) {
1645 mTime->Flags |= QF_TIME_HOUR_SUPPRESS;
1646 }
1647
1648 if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_MINUTE_SUPPRESS)) {
1649 mTime->Flags |= QF_TIME_MINUTE_SUPPRESS;
1650 }
1651
1652 if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_SECOND_SUPPRESS)) {
1653 mTime->Flags |= QF_TIME_SECOND_SUPPRESS;
1654 }
1655
1656 if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_STORAGE_NORMAL)) {
1657 mTime->Flags |= QF_TIME_STORAGE_NORMAL;
1658 } else if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_STORAGE_TIME)) {
1659 mTime->Flags |= QF_TIME_STORAGE_TIME;
1660 } else if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_STORAGE_WAKEUP)) {
1661 mTime->Flags |= QF_TIME_STORAGE_WAKEUP;
1662 }
1663
1664 return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
1665 }
1666 };
1667
1668 class CIfrDisableIf : public CIfrObj, public CIfrOpHeader {
1669 private:
1670 EFI_IFR_DISABLE_IF *mDisableIf;
1671
1672 public:
1673 CIfrDisableIf () : CIfrObj (EFI_IFR_DISABLE_IF_OP, (CHAR8 **)&mDisableIf),
1674 mDisableIf ((EFI_IFR_DISABLE_IF *) GetObjBinAddr()),
1675 CIfrOpHeader (EFI_IFR_DISABLE_IF_OP, &mDisableIf->Header) {}
1676 };
1677
1678 class CIfrSuppressIf : public CIfrObj, public CIfrOpHeader {
1679 private:
1680 EFI_IFR_SUPPRESS_IF *mSuppressIf;
1681
1682 public:
1683 CIfrSuppressIf () : CIfrObj (EFI_IFR_SUPPRESS_IF_OP, (CHAR8 **)&mSuppressIf),
1684 CIfrOpHeader (EFI_IFR_SUPPRESS_IF_OP, &mSuppressIf->Header) {}
1685 };
1686
1687 class CIfrGrayOutIf : public CIfrObj, public CIfrOpHeader {
1688 private:
1689 EFI_IFR_GRAY_OUT_IF *mGrayOutIf;
1690
1691 public:
1692 CIfrGrayOutIf () : CIfrObj (EFI_IFR_GRAY_OUT_IF_OP, (CHAR8 **)&mGrayOutIf),
1693 CIfrOpHeader (EFI_IFR_GRAY_OUT_IF_OP, &mGrayOutIf->Header) {}
1694 };
1695
1696 class CIfrInconsistentIf : public CIfrObj, public CIfrOpHeader {
1697 private:
1698 EFI_IFR_INCONSISTENT_IF *mInconsistentIf;
1699
1700 public:
1701 CIfrInconsistentIf () : CIfrObj (EFI_IFR_INCONSISTENT_IF_OP, (CHAR8 **)&mInconsistentIf),
1702 CIfrOpHeader (EFI_IFR_INCONSISTENT_IF_OP, &mInconsistentIf->Header) {
1703 mInconsistentIf->Error = EFI_STRING_ID_INVALID;
1704 }
1705
1706 VOID SetError (IN EFI_STRING_ID Error) {
1707 mInconsistentIf->Error = Error;
1708 }
1709 };
1710
1711 class CIfrWarningIf : public CIfrObj, public CIfrOpHeader {
1712 private:
1713 EFI_IFR_WARNING_IF *mWarningIf;
1714
1715 public:
1716 CIfrWarningIf () : CIfrObj (EFI_IFR_WARNING_IF_OP, (CHAR8 **)&mWarningIf),
1717 CIfrOpHeader (EFI_IFR_WARNING_IF_OP, &mWarningIf->Header) {
1718 mWarningIf->Warning = EFI_STRING_ID_INVALID;
1719 mWarningIf->TimeOut = 0;
1720 }
1721
1722 VOID SetWarning (IN EFI_STRING_ID Warning) {
1723 mWarningIf->Warning = Warning;
1724 }
1725
1726 VOID SetTimeOut (IN UINT8 TimeOut) {
1727 mWarningIf->TimeOut = TimeOut;
1728 }
1729 };
1730
1731 class CIfrNoSubmitIf : public CIfrObj, public CIfrOpHeader {
1732 private:
1733 EFI_IFR_NO_SUBMIT_IF *mNoSubmitIf;
1734
1735 public:
1736 CIfrNoSubmitIf () : CIfrObj (EFI_IFR_NO_SUBMIT_IF_OP, (CHAR8 **)&mNoSubmitIf),
1737 CIfrOpHeader (EFI_IFR_NO_SUBMIT_IF_OP, &mNoSubmitIf->Header) {
1738 mNoSubmitIf->Error = EFI_STRING_ID_INVALID;
1739 }
1740
1741 VOID SetError (IN EFI_STRING_ID Error) {
1742 mNoSubmitIf->Error = Error;
1743 }
1744 };
1745
1746 class CIfrRefresh : public CIfrObj, public CIfrOpHeader {
1747 private:
1748 EFI_IFR_REFRESH *mRefresh;
1749
1750 public:
1751 CIfrRefresh () : CIfrObj (EFI_IFR_REFRESH_OP, (CHAR8 **)&mRefresh),
1752 CIfrOpHeader (EFI_IFR_REFRESH_OP, &mRefresh->Header) {
1753 mRefresh->RefreshInterval = 0;
1754 }
1755
1756 VOID SetRefreshInterval (IN UINT8 RefreshInterval) {
1757 mRefresh->RefreshInterval = RefreshInterval;
1758 }
1759 };
1760
1761 class CIfrRefreshId : public CIfrObj, public CIfrOpHeader {
1762 private:
1763 EFI_IFR_REFRESH_ID *mRefreshId;
1764
1765 public:
1766 CIfrRefreshId () : CIfrObj (EFI_IFR_REFRESH_ID_OP, (CHAR8 **)&mRefreshId),
1767 CIfrOpHeader (EFI_IFR_REFRESH_ID_OP, &mRefreshId->Header) {
1768 memset (&mRefreshId->RefreshEventGroupId, 0, sizeof (EFI_GUID));
1769 }
1770
1771 VOID SetRefreshEventGroutId (IN EFI_GUID *RefreshEventGroupId) {
1772 memmove (&mRefreshId->RefreshEventGroupId, RefreshEventGroupId, sizeof (EFI_GUID));
1773 }
1774 };
1775
1776 class CIfrVarStoreDevice : public CIfrObj, public CIfrOpHeader {
1777 private:
1778 EFI_IFR_VARSTORE_DEVICE *mVarStoreDevice;
1779
1780 public:
1781 CIfrVarStoreDevice () : CIfrObj (EFI_IFR_VARSTORE_DEVICE_OP, (CHAR8 **)&mVarStoreDevice),
1782 CIfrOpHeader (EFI_IFR_VARSTORE_DEVICE_OP, &mVarStoreDevice->Header) {
1783 mVarStoreDevice->DevicePath = EFI_STRING_ID_INVALID;
1784 }
1785
1786 VOID SetDevicePath (IN EFI_STRING_ID DevicePath) {
1787 mVarStoreDevice->DevicePath = DevicePath;
1788 }
1789 };
1790
1791 class CIfrOneOfOption : public CIfrObj, public CIfrOpHeader {
1792 private:
1793 EFI_IFR_ONE_OF_OPTION *mOneOfOption;
1794
1795 public:
1796 CIfrOneOfOption (UINT8 Size) : CIfrObj (EFI_IFR_ONE_OF_OPTION_OP, (CHAR8 **)&mOneOfOption, Size),
1797 CIfrOpHeader (EFI_IFR_ONE_OF_OPTION_OP, &mOneOfOption->Header, Size) {
1798 mOneOfOption->Flags = 0;
1799 mOneOfOption->Option = EFI_STRING_ID_INVALID;
1800 mOneOfOption->Type = EFI_IFR_TYPE_OTHER;
1801 memset (&mOneOfOption->Value, 0, Size - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));
1802 }
1803
1804 VOID SetOption (IN EFI_STRING_ID Option) {
1805 mOneOfOption->Option = Option;
1806 }
1807
1808 EFI_VFR_RETURN_CODE SetFlags (IN UINT8 LFlags) {
1809 mOneOfOption->Flags = 0;
1810 if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_OPTION_DEFAULT)) {
1811 mOneOfOption->Flags |= EFI_IFR_OPTION_DEFAULT;
1812 }
1813
1814 if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_OPTION_DEFAULT_MFG)) {
1815 mOneOfOption->Flags |= EFI_IFR_OPTION_DEFAULT_MFG;
1816 }
1817
1818 if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_NUM_SIZE_8)) {
1819 _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_NUM_SIZE_8);
1820 mOneOfOption->Flags |= EFI_IFR_TYPE_NUM_SIZE_8;
1821 } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_NUM_SIZE_16)) {
1822 _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_NUM_SIZE_16);
1823 mOneOfOption->Flags |= EFI_IFR_TYPE_NUM_SIZE_16;
1824 } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_NUM_SIZE_32)) {
1825 _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_NUM_SIZE_32);
1826 mOneOfOption->Flags |= EFI_IFR_TYPE_NUM_SIZE_32;
1827 } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_NUM_SIZE_64)) {
1828 _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_NUM_SIZE_64);
1829 mOneOfOption->Flags |= EFI_IFR_TYPE_NUM_SIZE_64;
1830 } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_BOOLEAN)) {
1831 _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_BOOLEAN);
1832 mOneOfOption->Flags |= EFI_IFR_TYPE_BOOLEAN;
1833 } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_TIME)) {
1834 _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_TIME);
1835 mOneOfOption->Flags |= EFI_IFR_TYPE_TIME;
1836 } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_DATE)) {
1837 _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_DATE);
1838 mOneOfOption->Flags |= EFI_IFR_TYPE_DATE;
1839 } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_STRING)) {
1840 _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_STRING);
1841 mOneOfOption->Flags |= EFI_IFR_TYPE_STRING;
1842 } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_OTHER)) {
1843 _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_OTHER);
1844 mOneOfOption->Flags |= EFI_IFR_TYPE_OTHER;
1845 }
1846
1847 return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
1848 }
1849
1850 VOID SetType (IN UINT8 Type) {
1851 mOneOfOption->Type = Type;
1852 }
1853
1854 VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) {
1855 memmove (&mOneOfOption->Value, &Value, mOneOfOption->Header.Length - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));
1856 }
1857
1858 UINT8 GetFlags (VOID) {
1859 return mOneOfOption->Flags;
1860 }
1861 };
1862
1863 static EFI_GUID IfrTianoGuid = EFI_IFR_TIANO_GUID;
1864 static EFI_GUID IfrFrameworkGuid = EFI_IFR_FRAMEWORK_GUID;
1865
1866 class CIfrClass : public CIfrObj, public CIfrOpHeader {
1867 private:
1868 EFI_IFR_GUID_CLASS *mClass;
1869
1870 public:
1871 CIfrClass () : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mClass, sizeof (EFI_IFR_GUID_CLASS)),
1872 CIfrOpHeader (EFI_IFR_GUID_OP, &mClass->Header, sizeof (EFI_IFR_GUID_CLASS)) {
1873 mClass->ExtendOpCode = EFI_IFR_EXTEND_OP_CLASS;
1874 mClass->Guid = IfrTianoGuid;
1875 mClass->Class = EFI_NON_DEVICE_CLASS;
1876 }
1877
1878 VOID SetClass (IN UINT16 Class) {
1879 mClass->Class = Class;
1880 }
1881 };
1882
1883 class CIfrSubClass : public CIfrObj, public CIfrOpHeader {
1884 private:
1885 EFI_IFR_GUID_SUBCLASS *mSubClass;
1886
1887 public:
1888 CIfrSubClass () : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mSubClass, sizeof (EFI_IFR_GUID_SUBCLASS)),
1889 CIfrOpHeader (EFI_IFR_GUID_OP, &mSubClass->Header, sizeof (EFI_IFR_GUID_SUBCLASS)) {
1890 mSubClass->ExtendOpCode = EFI_IFR_EXTEND_OP_SUBCLASS;
1891 mSubClass->Guid = IfrTianoGuid;
1892 mSubClass->SubClass = EFI_SETUP_APPLICATION_SUBCLASS;
1893 }
1894
1895 VOID SetSubClass (IN UINT16 SubClass) {
1896 mSubClass->SubClass = SubClass;
1897 }
1898 };
1899
1900 class CIfrLabel : public CIfrObj, public CIfrOpHeader {
1901 private:
1902 EFI_IFR_GUID_LABEL *mLabel;
1903
1904 public:
1905 CIfrLabel () : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mLabel, sizeof (EFI_IFR_GUID_LABEL)),
1906 CIfrOpHeader (EFI_IFR_GUID_OP, &mLabel->Header, sizeof (EFI_IFR_GUID_LABEL)) {
1907 mLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
1908 mLabel->Guid = IfrTianoGuid;
1909 }
1910
1911 VOID SetNumber (IN UINT16 Number) {
1912 mLabel->Number = Number;
1913 }
1914 };
1915
1916 class CIfrBanner : public CIfrObj, public CIfrOpHeader {
1917 private:
1918 EFI_IFR_GUID_BANNER *mBanner;
1919
1920 public:
1921 CIfrBanner () : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mBanner, sizeof (EFI_IFR_GUID_BANNER)),
1922 CIfrOpHeader (EFI_IFR_GUID_OP, &mBanner->Header, sizeof (EFI_IFR_GUID_BANNER)) {
1923 mBanner->ExtendOpCode = EFI_IFR_EXTEND_OP_BANNER;
1924 mBanner->Guid = IfrTianoGuid;
1925 }
1926
1927 VOID SetTitle (IN EFI_STRING_ID StringId) {
1928 mBanner->Title = StringId;
1929 }
1930
1931 VOID SetLine (IN UINT16 Line) {
1932 mBanner->LineNumber = Line;
1933 }
1934
1935 VOID SetAlign (IN UINT8 Align) {
1936 mBanner->Alignment = Align;
1937 }
1938 };
1939
1940 class CIfrOptionKey : public CIfrObj, public CIfrOpHeader {
1941 private:
1942 EFI_IFR_GUID_OPTIONKEY *mOptionKey;
1943
1944 public:
1945 CIfrOptionKey (
1946 IN EFI_QUESTION_ID QuestionId,
1947 IN EFI_IFR_TYPE_VALUE &OptionValue,
1948 IN EFI_QUESTION_ID KeyValue
1949 ) : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mOptionKey, sizeof (EFI_IFR_GUID_OPTIONKEY)),
1950 CIfrOpHeader (EFI_IFR_GUID_OP, &mOptionKey->Header, sizeof (EFI_IFR_GUID_OPTIONKEY)) {
1951 mOptionKey->ExtendOpCode = EFI_IFR_EXTEND_OP_OPTIONKEY;
1952 mOptionKey->Guid = IfrFrameworkGuid;
1953 mOptionKey->QuestionId = QuestionId;
1954 mOptionKey->OptionValue = OptionValue;
1955 mOptionKey->KeyValue = KeyValue;
1956 }
1957 };
1958
1959 class CIfrVarEqName : public CIfrObj, public CIfrOpHeader {
1960 private:
1961 EFI_IFR_GUID_VAREQNAME *mVarEqName;
1962
1963 public:
1964 CIfrVarEqName (
1965 IN EFI_QUESTION_ID QuestionId,
1966 IN EFI_STRING_ID NameId
1967 ) : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mVarEqName, sizeof (EFI_IFR_GUID_VAREQNAME)),
1968 CIfrOpHeader (EFI_IFR_GUID_OP, &mVarEqName->Header, sizeof (EFI_IFR_GUID_VAREQNAME)) {
1969 mVarEqName->ExtendOpCode = EFI_IFR_EXTEND_OP_VAREQNAME;
1970 mVarEqName->Guid = IfrFrameworkGuid;
1971 mVarEqName->QuestionId = QuestionId;
1972 mVarEqName->NameId = NameId;
1973 }
1974 };
1975
1976 class CIfrTimeout : public CIfrObj, public CIfrOpHeader {
1977 private:
1978 EFI_IFR_GUID_TIMEOUT *mTimeout;
1979
1980 public:
1981 CIfrTimeout (IN UINT16 Timeout = 0) : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mTimeout, sizeof (EFI_IFR_GUID_TIMEOUT)),
1982 CIfrOpHeader (EFI_IFR_GUID_OP, &mTimeout->Header, sizeof (EFI_IFR_GUID_TIMEOUT)) {
1983 mTimeout->ExtendOpCode = EFI_IFR_EXTEND_OP_TIMEOUT;
1984 mTimeout->Guid = IfrTianoGuid;
1985 mTimeout->TimeOut = Timeout;
1986 }
1987
1988 VOID SetTimeout (IN UINT16 Timeout) {
1989 mTimeout->TimeOut = Timeout;
1990 }
1991 };
1992
1993 class CIfrGuid : public CIfrObj, public CIfrOpHeader {
1994 private:
1995 EFI_IFR_GUID *mGuid;
1996
1997 public:
1998 CIfrGuid (UINT8 Size) : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mGuid, sizeof (EFI_IFR_GUID)+Size),
1999 CIfrOpHeader (EFI_IFR_GUID_OP, &mGuid->Header, sizeof (EFI_IFR_GUID)+Size) {
2000 memset (&mGuid->Guid, 0, sizeof (EFI_GUID));
2001 }
2002
2003 VOID SetGuid (IN EFI_GUID *Guid) {
2004 memmove (&mGuid->Guid, Guid, sizeof (EFI_GUID));
2005 }
2006
2007 VOID SetData (IN UINT8* DataBuff, IN UINT8 Size) {
2008 memmove ((UINT8 *)mGuid + sizeof (EFI_IFR_GUID), DataBuff, Size);
2009 }
2010 };
2011
2012 class CIfrDup : public CIfrObj, public CIfrOpHeader {
2013 private:
2014 EFI_IFR_DUP *mDup;
2015
2016 public:
2017 CIfrDup (
2018 IN UINT32 LineNo
2019 ) : CIfrObj (EFI_IFR_DUP_OP, (CHAR8 **)&mDup),
2020 CIfrOpHeader (EFI_IFR_DUP_OP, &mDup->Header) {
2021 SetLineNo (LineNo);
2022 }
2023 };
2024
2025 class CIfrEqIdId : public CIfrObj, public CIfrOpHeader {
2026 private:
2027 EFI_IFR_EQ_ID_ID *mEqIdId;
2028
2029 public:
2030 CIfrEqIdId (
2031 IN UINT32 LineNo
2032 ) : CIfrObj (EFI_IFR_EQ_ID_ID_OP, (CHAR8 **)&mEqIdId),
2033 CIfrOpHeader (EFI_IFR_EQ_ID_ID_OP, &mEqIdId->Header) {
2034 SetLineNo (LineNo);
2035 mEqIdId->QuestionId1 = EFI_QUESTION_ID_INVALID;
2036 mEqIdId->QuestionId2 = EFI_QUESTION_ID_INVALID;
2037 }
2038
2039 VOID SetQuestionId1 (
2040 IN EFI_QUESTION_ID QuestionId,
2041 IN CHAR8 *VarIdStr,
2042 IN UINT32 LineNo
2043 ) {
2044 if (QuestionId != EFI_QUESTION_ID_INVALID) {
2045 mEqIdId->QuestionId1 = QuestionId;
2046 } else {
2047 gCFormPkg.AssignPending (VarIdStr, (VOID *)(&mEqIdId->QuestionId1), sizeof (EFI_QUESTION_ID), LineNo, NO_QST_REFED);
2048 }
2049 }
2050
2051 VOID SetQuestionId2 (
2052 IN EFI_QUESTION_ID QuestionId,
2053 IN CHAR8 *VarIdStr,
2054 IN UINT32 LineNo
2055 ) {
2056 if (QuestionId != EFI_QUESTION_ID_INVALID) {
2057 mEqIdId->QuestionId2 = QuestionId;
2058 } else {
2059 gCFormPkg.AssignPending (VarIdStr, (VOID *)(&mEqIdId->QuestionId2), sizeof (EFI_QUESTION_ID), LineNo, NO_QST_REFED);
2060 }
2061 }
2062 };
2063
2064 class CIfrEqIdVal : public CIfrObj, public CIfrOpHeader {
2065 private:
2066 EFI_IFR_EQ_ID_VAL *mEqIdVal;
2067
2068 public:
2069 CIfrEqIdVal (
2070 IN UINT32 LineNo
2071 ) : CIfrObj (EFI_IFR_EQ_ID_VAL_OP, (CHAR8 **)&mEqIdVal),
2072 CIfrOpHeader (EFI_IFR_EQ_ID_VAL_OP, &mEqIdVal->Header) {
2073 SetLineNo (LineNo);
2074 mEqIdVal->QuestionId = EFI_QUESTION_ID_INVALID;
2075 }
2076
2077 VOID SetQuestionId (
2078 IN EFI_QUESTION_ID QuestionId,
2079 IN CHAR8 *VarIdStr,
2080 IN UINT32 LineNo
2081 ) {
2082 if (QuestionId != EFI_QUESTION_ID_INVALID) {
2083 mEqIdVal->QuestionId = QuestionId;
2084 } else {
2085 gCFormPkg.AssignPending (VarIdStr, (VOID *)(&mEqIdVal->QuestionId), sizeof (EFI_QUESTION_ID), LineNo, NO_QST_REFED);
2086 }
2087 }
2088
2089 VOID SetValue (IN UINT16 Value) {
2090 mEqIdVal->Value = Value;
2091 }
2092 };
2093
2094 class CIfrEqIdList : public CIfrObj, public CIfrOpHeader {
2095 private:
2096 EFI_IFR_EQ_ID_VAL_LIST *mEqIdVList;
2097
2098 public:
2099 CIfrEqIdList (
2100 IN UINT32 LineNo
2101 ) : CIfrObj (EFI_IFR_EQ_ID_VAL_LIST_OP, (CHAR8 **)&mEqIdVList, sizeof (EFI_IFR_EQ_ID_VAL_LIST), TRUE),
2102 CIfrOpHeader (EFI_IFR_EQ_ID_VAL_LIST_OP, &mEqIdVList->Header) {
2103 SetLineNo (LineNo);
2104 mEqIdVList->QuestionId = EFI_QUESTION_ID_INVALID;
2105 mEqIdVList->ListLength = 0;
2106 mEqIdVList->ValueList[0] = 0;
2107 }
2108
2109 VOID UpdateIfrBuffer (
2110 ) {
2111 _EMIT_PENDING_OBJ();
2112 mEqIdVList = (EFI_IFR_EQ_ID_VAL_LIST *) GetObjBinAddr();
2113 UpdateHeader (&mEqIdVList->Header);
2114 }
2115
2116 VOID SetQuestionId (
2117 IN EFI_QUESTION_ID QuestionId,
2118 IN CHAR8 *VarIdStr,
2119 IN UINT32 LineNo
2120 ) {
2121 if (QuestionId != EFI_QUESTION_ID_INVALID) {
2122 mEqIdVList->QuestionId = QuestionId;
2123 } else {
2124 gCFormPkg.AssignPending (VarIdStr, (VOID *)(&mEqIdVList->QuestionId), sizeof (EFI_QUESTION_ID), LineNo, NO_QST_REFED);
2125 }
2126 }
2127
2128 VOID SetListLength (IN UINT16 ListLength) {
2129 mEqIdVList->ListLength = ListLength;
2130 }
2131
2132 VOID SetValueList (IN UINT16 Index, IN UINT16 Value) {
2133 if (Index == 0) {
2134 mEqIdVList->ValueList[0] = Value;
2135 return;
2136 }
2137
2138 if (ExpendObjBin (sizeof (UINT16)) ==TRUE) {
2139 IncLength (sizeof (UINT16));
2140 mEqIdVList->ValueList[Index] = Value;
2141 }
2142 }
2143 };
2144
2145 class CIfrQuestionRef1 : public CIfrObj, public CIfrOpHeader {
2146 private:
2147 EFI_IFR_QUESTION_REF1 *mQuestionRef1;
2148
2149 public:
2150 CIfrQuestionRef1 (
2151 IN UINT32 LineNo
2152 ) : CIfrObj (EFI_IFR_QUESTION_REF1_OP, (CHAR8 **)&mQuestionRef1),
2153 CIfrOpHeader (EFI_IFR_QUESTION_REF1_OP, &mQuestionRef1->Header) {
2154 SetLineNo (LineNo);
2155 mQuestionRef1->QuestionId = EFI_QUESTION_ID_INVALID;
2156 }
2157
2158 VOID SetQuestionId (
2159 IN EFI_QUESTION_ID QuestionId,
2160 IN CHAR8 *VarIdStr,
2161 IN UINT32 LineNo
2162 ) {
2163 if (QuestionId != EFI_QUESTION_ID_INVALID) {
2164 mQuestionRef1->QuestionId = QuestionId;
2165 } else {
2166 gCFormPkg.AssignPending (VarIdStr, (VOID *)(&mQuestionRef1->QuestionId), sizeof (EFI_QUESTION_ID), LineNo, NO_QST_REFED);
2167 }
2168 }
2169 };
2170
2171 class CIfrQuestionRef2 : public CIfrObj, public CIfrOpHeader {
2172 private:
2173 EFI_IFR_QUESTION_REF2 *mQuestionRef2;
2174
2175 public:
2176 CIfrQuestionRef2 (
2177 IN UINT32 LineNo
2178 ) : CIfrObj (EFI_IFR_QUESTION_REF2_OP, (CHAR8 **)&mQuestionRef2),
2179 CIfrOpHeader (EFI_IFR_QUESTION_REF2_OP, &mQuestionRef2->Header) {
2180 SetLineNo (LineNo);
2181 }
2182 };
2183
2184 class CIfrQuestionRef3 : public CIfrObj, public CIfrOpHeader {
2185 private:
2186 EFI_IFR_QUESTION_REF3 *mQuestionRef3;
2187
2188 public:
2189 CIfrQuestionRef3 (
2190 IN UINT32 LineNo
2191 ) : CIfrObj (EFI_IFR_QUESTION_REF3_OP, (CHAR8 **)&mQuestionRef3),
2192 CIfrOpHeader (EFI_IFR_QUESTION_REF3_OP, &mQuestionRef3->Header) {
2193 SetLineNo (LineNo);
2194 }
2195 };
2196
2197 class CIfrQuestionRef3_2 : public CIfrObj, public CIfrOpHeader {
2198 private:
2199 EFI_IFR_QUESTION_REF3_2 *mQuestionRef3_2;
2200
2201 public:
2202 CIfrQuestionRef3_2 (
2203 IN UINT32 LineNo
2204 ) : CIfrObj (EFI_IFR_QUESTION_REF3_OP, (CHAR8 **)&mQuestionRef3_2, sizeof (EFI_IFR_QUESTION_REF3_2)),
2205 CIfrOpHeader (EFI_IFR_QUESTION_REF3_OP, &mQuestionRef3_2->Header, sizeof (EFI_IFR_QUESTION_REF3_2)) {
2206 SetLineNo (LineNo);
2207 mQuestionRef3_2->DevicePath = EFI_STRING_ID_INVALID;
2208 }
2209
2210 VOID SetDevicePath (IN EFI_STRING_ID DevicePath) {
2211 mQuestionRef3_2->DevicePath = DevicePath;
2212 }
2213 };
2214
2215 class CIfrQuestionRef3_3 : public CIfrObj, public CIfrOpHeader {
2216 private:
2217 EFI_IFR_QUESTION_REF3_3 *mQuestionRef3_3;
2218
2219 public:
2220 CIfrQuestionRef3_3 (
2221 IN UINT32 LineNo
2222 ) : CIfrObj (EFI_IFR_QUESTION_REF3_OP, (CHAR8 **)&mQuestionRef3_3, sizeof (EFI_IFR_QUESTION_REF3_3)),
2223 CIfrOpHeader (EFI_IFR_QUESTION_REF3_OP, &mQuestionRef3_3->Header, sizeof (EFI_IFR_QUESTION_REF3_3)) {
2224 SetLineNo (LineNo);
2225 mQuestionRef3_3->DevicePath = EFI_STRING_ID_INVALID;
2226 memset (&mQuestionRef3_3->Guid, 0, sizeof (EFI_GUID));
2227 }
2228
2229 VOID SetDevicePath (IN EFI_STRING_ID DevicePath) {
2230 mQuestionRef3_3->DevicePath = DevicePath;
2231 }
2232
2233 VOID SetGuid (IN EFI_GUID *Guid) {
2234 mQuestionRef3_3->Guid = *Guid;
2235 }
2236 };
2237
2238 class CIfrRuleRef : public CIfrObj, public CIfrOpHeader {
2239 private:
2240 EFI_IFR_RULE_REF *mRuleRef;
2241
2242 public:
2243 CIfrRuleRef (
2244 IN UINT32 LineNo
2245 ) : CIfrObj (EFI_IFR_RULE_REF_OP, (CHAR8 **)&mRuleRef),
2246 CIfrOpHeader (EFI_IFR_RULE_REF_OP, &mRuleRef->Header) {
2247 SetLineNo (LineNo);
2248 mRuleRef->RuleId = EFI_RULE_ID_INVALID;
2249 }
2250
2251 VOID SetRuleId (IN UINT8 RuleId) {
2252 mRuleRef->RuleId = RuleId;
2253 }
2254 };
2255
2256 class CIfrStringRef1 : public CIfrObj, public CIfrOpHeader {
2257 private:
2258 EFI_IFR_STRING_REF1 *mStringRef1;
2259
2260 public:
2261 CIfrStringRef1 (
2262 IN UINT32 LineNo
2263 ) : CIfrObj (EFI_IFR_STRING_REF1_OP, (CHAR8 **)&mStringRef1),
2264 CIfrOpHeader (EFI_IFR_STRING_REF1_OP, &mStringRef1->Header) {
2265 SetLineNo (LineNo);
2266 mStringRef1->StringId = EFI_STRING_ID_INVALID;
2267 }
2268
2269 VOID SetStringId (IN EFI_STRING_ID StringId) {
2270 mStringRef1->StringId = StringId;
2271 }
2272 };
2273
2274 class CIfrStringRef2 : public CIfrObj, public CIfrOpHeader {
2275 private:
2276 EFI_IFR_STRING_REF2 *mStringRef2;
2277
2278 public:
2279 CIfrStringRef2 (
2280 IN UINT32 LineNo
2281 ) : CIfrObj (EFI_IFR_STRING_REF2_OP, (CHAR8 **)&mStringRef2),
2282 CIfrOpHeader (EFI_IFR_STRING_REF2_OP, &mStringRef2->Header) {
2283 SetLineNo (LineNo);
2284 }
2285 };
2286
2287 class CIfrThis : public CIfrObj, public CIfrOpHeader {
2288 private:
2289 EFI_IFR_THIS *mThis;
2290
2291 public:
2292 CIfrThis (
2293 IN UINT32 LineNo
2294 ) : CIfrObj (EFI_IFR_THIS_OP, (CHAR8 **)&mThis),
2295 CIfrOpHeader (EFI_IFR_THIS_OP, &mThis->Header) {
2296 SetLineNo (LineNo);
2297 }
2298 };
2299
2300 class CIfrSecurity : public CIfrObj, public CIfrOpHeader {
2301 private:
2302 EFI_IFR_SECURITY *mSecurity;
2303
2304 public:
2305 CIfrSecurity (
2306 IN UINT32 LineNo
2307 ) : CIfrObj (EFI_IFR_SECURITY_OP, (CHAR8 **)&mSecurity),
2308 CIfrOpHeader (EFI_IFR_SECURITY_OP, &mSecurity->Header) {
2309 SetLineNo (LineNo);
2310 memset (&mSecurity->Permissions, 0, sizeof (EFI_GUID));
2311 }
2312
2313 VOID SetPermissions (IN EFI_GUID *Permissions) {
2314 memmove (&mSecurity->Permissions, Permissions, sizeof (EFI_GUID));
2315 }
2316 };
2317
2318 class CIfrUint8 : public CIfrObj, public CIfrOpHeader {
2319 private:
2320 EFI_IFR_UINT8 *mUint8;
2321
2322 public:
2323 CIfrUint8 (
2324 IN UINT32 LineNo
2325 ) : CIfrObj (EFI_IFR_UINT8_OP, (CHAR8 **)&mUint8),
2326 CIfrOpHeader (EFI_IFR_UINT8_OP, &mUint8->Header) {
2327 SetLineNo (LineNo);
2328 }
2329
2330 VOID SetValue (IN UINT8 Value) {
2331 mUint8->Value = Value;
2332 }
2333 };
2334
2335 class CIfrUint16 : public CIfrObj, public CIfrOpHeader {
2336 private:
2337 EFI_IFR_UINT16 *mUint16;
2338
2339 public:
2340 CIfrUint16 (
2341 IN UINT32 LineNo
2342 ) : CIfrObj (EFI_IFR_UINT16_OP, (CHAR8 **)&mUint16),
2343 CIfrOpHeader (EFI_IFR_UINT16_OP, &mUint16->Header) {
2344 SetLineNo (LineNo);
2345 }
2346
2347 VOID SetValue (IN UINT16 Value) {
2348 mUint16->Value = Value;
2349 }
2350 };
2351
2352 class CIfrUint32 : public CIfrObj, public CIfrOpHeader {
2353 private:
2354 EFI_IFR_UINT32 *mUint32;
2355
2356 public:
2357 CIfrUint32 (
2358 IN UINT32 LineNo
2359 ) : CIfrObj (EFI_IFR_UINT32_OP, (CHAR8 **)&mUint32),
2360 CIfrOpHeader (EFI_IFR_UINT32_OP, &mUint32->Header) {
2361 SetLineNo (LineNo);
2362 }
2363
2364 VOID SetValue (IN UINT32 Value) {
2365 mUint32->Value = Value;
2366 }
2367 };
2368
2369 class CIfrUint64 : public CIfrObj, public CIfrOpHeader {
2370 private:
2371 EFI_IFR_UINT64 *mUint64;
2372
2373 public:
2374 CIfrUint64 (
2375 IN UINT32 LineNo
2376 ) : CIfrObj (EFI_IFR_UINT64_OP, (CHAR8 **)&mUint64),
2377 CIfrOpHeader (EFI_IFR_UINT64_OP, &mUint64->Header) {
2378 SetLineNo (LineNo);
2379 }
2380
2381 VOID SetValue (IN UINT64 Value) {
2382 mUint64->Value = Value;
2383 }
2384 };
2385
2386 class CIfrTrue : public CIfrObj, public CIfrOpHeader {
2387 private:
2388 EFI_IFR_TRUE *mTrue;
2389
2390 public:
2391 CIfrTrue (
2392 IN UINT32 LineNo
2393 ) : CIfrObj (EFI_IFR_TRUE_OP, (CHAR8 **)&mTrue),
2394 CIfrOpHeader (EFI_IFR_TRUE_OP, &mTrue->Header) {
2395 SetLineNo (LineNo);
2396 }
2397 };
2398
2399 class CIfrFalse : public CIfrObj, public CIfrOpHeader {
2400 private:
2401 EFI_IFR_FALSE *mFalse;
2402
2403 public:
2404 CIfrFalse (
2405 IN UINT32 LineNo
2406 ) : CIfrObj (EFI_IFR_FALSE_OP, (CHAR8 **)&mFalse),
2407 CIfrOpHeader (EFI_IFR_FALSE_OP, &mFalse->Header) {
2408 SetLineNo (LineNo);
2409 }
2410 };
2411
2412 class CIfrOne : public CIfrObj, public CIfrOpHeader {
2413 private:
2414 EFI_IFR_ONE *mOne;
2415
2416 public:
2417 CIfrOne (
2418 IN UINT32 LineNo
2419 ) : CIfrObj (EFI_IFR_ONE_OP, (CHAR8 **)&mOne),
2420 CIfrOpHeader (EFI_IFR_ONE_OP, &mOne->Header) {
2421 SetLineNo (LineNo);
2422 }
2423 };
2424
2425 class CIfrOnes : public CIfrObj, public CIfrOpHeader {
2426 private:
2427 EFI_IFR_ONES *mOnes;
2428
2429 public:
2430 CIfrOnes (
2431 IN UINT32 LineNo
2432 ) : CIfrObj (EFI_IFR_ONES_OP, (CHAR8 **)&mOnes),
2433 CIfrOpHeader (EFI_IFR_ONES_OP, &mOnes->Header) {
2434 SetLineNo (LineNo);
2435 }
2436 };
2437
2438 class CIfrZero : public CIfrObj, public CIfrOpHeader {
2439 private:
2440 EFI_IFR_ZERO *mZero;
2441
2442 public:
2443 CIfrZero (
2444 IN UINT32 LineNo
2445 ) : CIfrObj (EFI_IFR_ZERO_OP, (CHAR8 **)&mZero),
2446 CIfrOpHeader (EFI_IFR_ZERO_OP, &mZero->Header) {
2447 SetLineNo (LineNo);
2448 }
2449 };
2450
2451 class CIfrUndefined : public CIfrObj, public CIfrOpHeader {
2452 private:
2453 EFI_IFR_UNDEFINED *mUndefined;
2454
2455 public:
2456 CIfrUndefined (
2457 IN UINT32 LineNo
2458 ) : CIfrObj (EFI_IFR_UNDEFINED_OP, (CHAR8 **)&mUndefined),
2459 CIfrOpHeader (EFI_IFR_UNDEFINED_OP, &mUndefined->Header) {
2460 SetLineNo (LineNo);
2461 }
2462 };
2463
2464 class CIfrVersion : public CIfrObj, public CIfrOpHeader {
2465 private:
2466 EFI_IFR_VERSION *mVersion;
2467
2468 public:
2469 CIfrVersion (
2470 IN UINT32 LineNo
2471 ) : CIfrObj (EFI_IFR_VERSION_OP, (CHAR8 **)&mVersion),
2472 CIfrOpHeader (EFI_IFR_VERSION_OP, &mVersion->Header) {
2473 SetLineNo (LineNo);
2474 }
2475 };
2476
2477 class CIfrLength : public CIfrObj, public CIfrOpHeader {
2478 private:
2479 EFI_IFR_LENGTH *mLength;
2480
2481 public:
2482 CIfrLength (
2483 IN UINT32 LineNo
2484 ) : CIfrObj (EFI_IFR_LENGTH_OP, (CHAR8 **)&mLength),
2485 CIfrOpHeader (EFI_IFR_LENGTH_OP, &mLength->Header) {
2486 SetLineNo (LineNo);
2487 }
2488 };
2489
2490 class CIfrNot : public CIfrObj, public CIfrOpHeader {
2491 private:
2492 EFI_IFR_NOT *mNot;
2493
2494 public:
2495 CIfrNot (
2496 IN UINT32 LineNo
2497 ) : CIfrObj (EFI_IFR_NOT_OP, (CHAR8 **)&mNot),
2498 CIfrOpHeader (EFI_IFR_NOT_OP, &mNot->Header) {
2499 SetLineNo (LineNo);
2500 }
2501 };
2502
2503 class CIfrBitWiseNot : public CIfrObj, public CIfrOpHeader {
2504 private:
2505 EFI_IFR_BITWISE_NOT *mBitWise;
2506
2507 public:
2508 CIfrBitWiseNot (
2509 IN UINT32 LineNo
2510 ) : CIfrObj (EFI_IFR_BITWISE_NOT_OP, (CHAR8 **)&mBitWise),
2511 CIfrOpHeader (EFI_IFR_BITWISE_NOT_OP, &mBitWise->Header) {
2512 SetLineNo (LineNo);
2513 }
2514 };
2515
2516 class CIfrToBoolean : public CIfrObj, public CIfrOpHeader {
2517 private:
2518 EFI_IFR_TO_BOOLEAN *mToBoolean;
2519
2520 public:
2521 CIfrToBoolean (
2522 IN UINT32 LineNo
2523 ) : CIfrObj (EFI_IFR_TO_BOOLEAN_OP, (CHAR8 **)&mToBoolean),
2524 CIfrOpHeader (EFI_IFR_TO_BOOLEAN_OP, &mToBoolean->Header) {
2525 SetLineNo (LineNo);
2526 }
2527 };
2528
2529 class CIfrToString : public CIfrObj, public CIfrOpHeader {
2530 private:
2531 EFI_IFR_TO_STRING *mToString;
2532
2533 public:
2534 CIfrToString (
2535 IN UINT32 LineNo
2536 ) : CIfrObj (EFI_IFR_TO_STRING_OP, (CHAR8 **)&mToString),
2537 CIfrOpHeader (EFI_IFR_TO_STRING_OP, &mToString->Header) {
2538 SetLineNo (LineNo);
2539 }
2540
2541 VOID SetFormat (IN UINT8 Format) {
2542 mToString->Format = Format;
2543 }
2544 };
2545
2546 class CIfrToUint : public CIfrObj, public CIfrOpHeader {
2547 private:
2548 EFI_IFR_TO_UINT *mToUint;
2549
2550 public:
2551 CIfrToUint (
2552 IN UINT32 LineNo
2553 ) : CIfrObj (EFI_IFR_TO_UINT_OP, (CHAR8 **)&mToUint),
2554 CIfrOpHeader (EFI_IFR_TO_UINT_OP, &mToUint->Header) {
2555 SetLineNo (LineNo);
2556 }
2557 };
2558
2559 class CIfrToUpper : public CIfrObj, public CIfrOpHeader {
2560 private:
2561 EFI_IFR_TO_UPPER *mToUpper;
2562
2563 public:
2564 CIfrToUpper (
2565 IN UINT32 LineNo
2566 ) : CIfrObj (EFI_IFR_TO_UPPER_OP, (CHAR8 **)&mToUpper),
2567 CIfrOpHeader (EFI_IFR_TO_UPPER_OP, &mToUpper->Header) {
2568 SetLineNo (LineNo);
2569 }
2570 };
2571
2572 class CIfrToLower : public CIfrObj, public CIfrOpHeader {
2573 private:
2574 EFI_IFR_TO_LOWER *mToLower;
2575
2576 public:
2577 CIfrToLower (
2578 IN UINT32 LineNo
2579 ) : CIfrObj (EFI_IFR_TO_LOWER_OP, (CHAR8 **)&mToLower),
2580 CIfrOpHeader (EFI_IFR_TO_LOWER_OP, &mToLower->Header) {
2581 SetLineNo (LineNo);
2582 }
2583 };
2584
2585 class CIfrAdd : public CIfrObj, public CIfrOpHeader {
2586 private:
2587 EFI_IFR_ADD *mAdd;
2588
2589 public:
2590 CIfrAdd (
2591 IN UINT32 LineNo
2592 ) : CIfrObj (EFI_IFR_ADD_OP, (CHAR8 **)&mAdd),
2593 CIfrOpHeader (EFI_IFR_ADD_OP, &mAdd->Header) {
2594 SetLineNo (LineNo);
2595 }
2596 };
2597
2598 class CIfrBitWiseAnd : public CIfrObj, public CIfrOpHeader {
2599 private:
2600 EFI_IFR_BITWISE_AND *mBitWiseAnd;
2601
2602 public:
2603 CIfrBitWiseAnd (
2604 IN UINT32 LineNo
2605 ) : CIfrObj (EFI_IFR_BITWISE_AND_OP, (CHAR8 **)&mBitWiseAnd),
2606 CIfrOpHeader (EFI_IFR_BITWISE_AND_OP, &mBitWiseAnd->Header) {
2607 SetLineNo(LineNo);
2608 }
2609 };
2610
2611 class CIfrBitWiseOr : public CIfrObj, public CIfrOpHeader {
2612 private:
2613 EFI_IFR_BITWISE_OR *mBitWiseOr;
2614
2615 public:
2616 CIfrBitWiseOr (
2617 IN UINT32 LineNo
2618 ) : CIfrObj (EFI_IFR_BITWISE_OR_OP, (CHAR8 **)&mBitWiseOr),
2619 CIfrOpHeader (EFI_IFR_BITWISE_OR_OP, &mBitWiseOr->Header) {
2620 SetLineNo (LineNo);
2621 }
2622 };
2623
2624 class CIfrAnd : public CIfrObj, public CIfrOpHeader {
2625 private:
2626 EFI_IFR_AND *mAnd;
2627
2628 public:
2629 CIfrAnd (
2630 IN UINT32 LineNo
2631 ) : CIfrObj (EFI_IFR_AND_OP, (CHAR8 **)&mAnd),
2632 CIfrOpHeader (EFI_IFR_AND_OP, &mAnd->Header) {
2633 SetLineNo (LineNo);
2634 }
2635 };
2636
2637 class CIfrCatenate : public CIfrObj, public CIfrOpHeader {
2638 private:
2639 EFI_IFR_CATENATE *mCatenate;
2640
2641 public:
2642 CIfrCatenate (
2643 IN UINT32 LineNo
2644 ) : CIfrObj (EFI_IFR_CATENATE_OP, (CHAR8 **)&mCatenate),
2645 CIfrOpHeader (EFI_IFR_CATENATE_OP, &mCatenate->Header) {
2646 SetLineNo (LineNo);
2647 }
2648 };
2649
2650 class CIfrDivide : public CIfrObj, public CIfrOpHeader {
2651 private:
2652 EFI_IFR_DIVIDE *mDivide;
2653
2654 public:
2655 CIfrDivide (
2656 IN UINT32 LineNo
2657 ) : CIfrObj (EFI_IFR_DIVIDE_OP, (CHAR8 **)&mDivide),
2658 CIfrOpHeader (EFI_IFR_DIVIDE_OP, &mDivide->Header) {
2659 SetLineNo (LineNo);
2660 }
2661 };
2662
2663 class CIfrEqual : public CIfrObj, public CIfrOpHeader {
2664 private:
2665 EFI_IFR_EQUAL *mEqual;
2666
2667 public:
2668 CIfrEqual (
2669 IN UINT32 LineNo
2670 ) : CIfrObj (EFI_IFR_EQUAL_OP, (CHAR8 **)&mEqual),
2671 CIfrOpHeader (EFI_IFR_EQUAL_OP, &mEqual->Header) {
2672 SetLineNo (LineNo);
2673 }
2674 };
2675
2676 class CIfrGreaterEqual : public CIfrObj, public CIfrOpHeader {
2677 private:
2678 EFI_IFR_GREATER_EQUAL *mGreaterEqual;
2679
2680 public:
2681 CIfrGreaterEqual (
2682 IN UINT32 LineNo
2683 ) : CIfrObj (EFI_IFR_GREATER_EQUAL_OP, (CHAR8 **)&mGreaterEqual),
2684 CIfrOpHeader (EFI_IFR_GREATER_EQUAL_OP, &mGreaterEqual->Header) {
2685 SetLineNo (LineNo);
2686 }
2687 };
2688
2689 class CIfrGreaterThan : public CIfrObj, public CIfrOpHeader {
2690 private:
2691 EFI_IFR_GREATER_THAN *mGreaterThan;
2692
2693 public:
2694 CIfrGreaterThan (
2695 IN UINT32 LineNo
2696 ) : CIfrObj (EFI_IFR_GREATER_THAN_OP, (CHAR8 **)&mGreaterThan),
2697 CIfrOpHeader (EFI_IFR_GREATER_THAN_OP, &mGreaterThan->Header) {
2698 SetLineNo (LineNo);
2699 }
2700 };
2701
2702 class CIfrLessEqual : public CIfrObj, public CIfrOpHeader {
2703 private:
2704 EFI_IFR_LESS_EQUAL *mLessEqual;
2705
2706 public:
2707 CIfrLessEqual (
2708 IN UINT32 LineNo
2709 ) : CIfrObj (EFI_IFR_LESS_EQUAL_OP, (CHAR8 **)&mLessEqual),
2710 CIfrOpHeader (EFI_IFR_LESS_EQUAL_OP, &mLessEqual->Header) {
2711 SetLineNo (LineNo);
2712 }
2713 };
2714
2715 class CIfrLessThan : public CIfrObj, public CIfrOpHeader {
2716 private:
2717 EFI_IFR_LESS_THAN *mLessThan;
2718
2719 public:
2720 CIfrLessThan (
2721 IN UINT32 LineNo
2722 ) : CIfrObj (EFI_IFR_LESS_THAN_OP, (CHAR8 **)&mLessThan),
2723 CIfrOpHeader (EFI_IFR_LESS_THAN_OP, &mLessThan->Header) {
2724 SetLineNo (LineNo);
2725 }
2726 };
2727
2728 class CIfrMap : public CIfrObj, public CIfrOpHeader{
2729 private:
2730 EFI_IFR_MAP *mMap;
2731
2732 public:
2733 CIfrMap (
2734 IN UINT32 LineNo
2735 ) : CIfrObj (EFI_IFR_MAP_OP, (CHAR8 **)&mMap),
2736 CIfrOpHeader (EFI_IFR_MAP_OP, &mMap->Header) {
2737 SetLineNo (LineNo);
2738 }
2739 };
2740
2741 class CIfrMatch : public CIfrObj, public CIfrOpHeader {
2742 private:
2743 EFI_IFR_MATCH *mMatch;
2744
2745 public:
2746 CIfrMatch (
2747 IN UINT32 LineNo
2748 ) : CIfrObj (EFI_IFR_MATCH_OP, (CHAR8 **)&mMatch),
2749 CIfrOpHeader (EFI_IFR_MATCH_OP, &mMatch->Header) {
2750 SetLineNo (LineNo);
2751 }
2752 };
2753
2754 class CIfrMatch2 : public CIfrObj, public CIfrOpHeader {
2755 private:
2756 EFI_IFR_MATCH2 *mMatch2;
2757
2758 public:
2759 CIfrMatch2 (
2760 IN UINT32 LineNo,
2761 IN EFI_GUID *Guid
2762 ) : CIfrObj (EFI_IFR_MATCH2_OP, (CHAR8 **)&mMatch2),
2763 CIfrOpHeader (EFI_IFR_MATCH2_OP, &mMatch2->Header) {
2764 SetLineNo (LineNo);
2765 memmove (&mMatch2->SyntaxType, Guid, sizeof (EFI_GUID));
2766 }
2767 };
2768
2769 class CIfrMultiply : public CIfrObj, public CIfrOpHeader {
2770 private:
2771 EFI_IFR_MULTIPLY *mMultiply;
2772
2773 public:
2774 CIfrMultiply (
2775 IN UINT32 LineNo
2776 ) : CIfrObj (EFI_IFR_MULTIPLY_OP, (CHAR8 **)&mMultiply),
2777 CIfrOpHeader (EFI_IFR_MULTIPLY_OP, &mMultiply->Header) {
2778 SetLineNo (LineNo);
2779 }
2780 };
2781
2782 class CIfrModulo : public CIfrObj, public CIfrOpHeader {
2783 private:
2784 EFI_IFR_MODULO *mModulo;
2785
2786 public:
2787 CIfrModulo (
2788 IN UINT32 LineNo
2789 ) : CIfrObj (EFI_IFR_MODULO_OP, (CHAR8 **)&mModulo),
2790 CIfrOpHeader (EFI_IFR_MODULO_OP, &mModulo->Header) {
2791 SetLineNo (LineNo);
2792 }
2793 };
2794
2795 class CIfrNotEqual : public CIfrObj, public CIfrOpHeader {
2796 private:
2797 EFI_IFR_NOT_EQUAL *mNotEqual;
2798
2799 public:
2800 CIfrNotEqual (
2801 IN UINT32 LineNo
2802 ) : CIfrObj (EFI_IFR_NOT_EQUAL_OP, (CHAR8 **)&mNotEqual),
2803 CIfrOpHeader (EFI_IFR_NOT_EQUAL_OP, &mNotEqual->Header) {
2804 SetLineNo (LineNo);
2805 }
2806 };
2807
2808 class CIfrOr : public CIfrObj, public CIfrOpHeader {
2809 private:
2810 EFI_IFR_OR *mOr;
2811
2812 public:
2813 CIfrOr (
2814 IN UINT32 LineNo
2815 ) : CIfrObj (EFI_IFR_OR_OP, (CHAR8 **)&mOr),
2816 CIfrOpHeader (EFI_IFR_OR_OP, &mOr->Header) {
2817 SetLineNo (LineNo);
2818 }
2819 };
2820
2821 class CIfrShiftLeft : public CIfrObj, public CIfrOpHeader {
2822 private:
2823 EFI_IFR_SHIFT_LEFT *mShiftLeft;
2824
2825 public:
2826 CIfrShiftLeft (
2827 IN UINT32 LineNo
2828 ) : CIfrObj (EFI_IFR_SHIFT_LEFT_OP, (CHAR8 **)&mShiftLeft),
2829 CIfrOpHeader (EFI_IFR_SHIFT_LEFT_OP, &mShiftLeft->Header) {
2830 SetLineNo (LineNo);
2831 }
2832 };
2833
2834 class CIfrShiftRight : public CIfrObj, public CIfrOpHeader {
2835 private:
2836 EFI_IFR_SHIFT_RIGHT *mShiftRight;
2837
2838 public:
2839 CIfrShiftRight (
2840 IN UINT32 LineNo
2841 ) : CIfrObj (EFI_IFR_SHIFT_RIGHT_OP, (CHAR8 **)&mShiftRight),
2842 CIfrOpHeader (EFI_IFR_SHIFT_RIGHT_OP, &mShiftRight->Header) {
2843 SetLineNo (LineNo);
2844 }
2845 };
2846
2847 class CIfrSubtract : public CIfrObj, public CIfrOpHeader {
2848 private:
2849 EFI_IFR_SUBTRACT *mSubtract;
2850
2851 public:
2852 CIfrSubtract (
2853 IN UINT32 LineNo
2854 ) : CIfrObj (EFI_IFR_SUBTRACT_OP, (CHAR8 **)&mSubtract),
2855 CIfrOpHeader (EFI_IFR_SUBTRACT_OP, &mSubtract->Header) {
2856 SetLineNo (LineNo);
2857 }
2858 };
2859
2860 class CIfrConditional : public CIfrObj, public CIfrOpHeader {
2861 private:
2862 EFI_IFR_CONDITIONAL *mConditional;
2863
2864 public:
2865 CIfrConditional (
2866 IN UINT32 LineNo
2867 ) : CIfrObj (EFI_IFR_CONDITIONAL_OP, (CHAR8 **)&mConditional),
2868 CIfrOpHeader (EFI_IFR_CONDITIONAL_OP, &mConditional->Header) {
2869 SetLineNo (LineNo);
2870 }
2871 };
2872
2873 class CIfrFind : public CIfrObj, public CIfrOpHeader {
2874 private:
2875 EFI_IFR_FIND *mFind;
2876
2877 public:
2878 CIfrFind (
2879 IN UINT32 LineNo
2880 ) : CIfrObj (EFI_IFR_FIND_OP, (CHAR8 **)&mFind),
2881 CIfrOpHeader (EFI_IFR_FIND_OP, &mFind->Header) {
2882 SetLineNo (LineNo);
2883 }
2884
2885 VOID SetFormat (IN UINT8 Format) {
2886 mFind->Format = Format;
2887 }
2888 };
2889
2890 class CIfrMid : public CIfrObj, public CIfrOpHeader {
2891 private:
2892 EFI_IFR_MID *mMid;
2893
2894 public:
2895 CIfrMid (
2896 IN UINT32 LineNo
2897 ) : CIfrObj (EFI_IFR_MID_OP, (CHAR8 **)&mMid),
2898 CIfrOpHeader (EFI_IFR_MID_OP, &mMid->Header) {
2899 SetLineNo (LineNo);
2900 }
2901 };
2902
2903 class CIfrToken : public CIfrObj, public CIfrOpHeader {
2904 private:
2905 EFI_IFR_TOKEN *mToken;
2906
2907 public:
2908 CIfrToken (
2909 IN UINT32 LineNo
2910 ) : CIfrObj (EFI_IFR_TOKEN_OP, (CHAR8 **)&mToken),
2911 CIfrOpHeader (EFI_IFR_TOKEN_OP, &mToken->Header) {
2912 SetLineNo (LineNo);
2913 }
2914 };
2915
2916 class CIfrSpan : public CIfrObj, public CIfrOpHeader {
2917 private:
2918 EFI_IFR_SPAN *mSpan;
2919
2920 public:
2921 CIfrSpan (
2922 IN UINT32 LineNo
2923 ) : CIfrObj (EFI_IFR_SPAN_OP, (CHAR8 **)&mSpan),
2924 CIfrOpHeader (EFI_IFR_SPAN_OP, &mSpan->Header) {
2925 SetLineNo (LineNo);
2926 mSpan->Flags = EFI_IFR_FLAGS_FIRST_MATCHING;
2927 }
2928
2929 EFI_VFR_RETURN_CODE SetFlags (IN UINT8 LFlags) {
2930 if (_IS_EQUAL (LFlags, EFI_IFR_FLAGS_FIRST_MATCHING)) {
2931 mSpan->Flags |= EFI_IFR_FLAGS_FIRST_MATCHING;
2932 } else if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_FLAGS_FIRST_NON_MATCHING)) {
2933 mSpan->Flags |= EFI_IFR_FLAGS_FIRST_NON_MATCHING;
2934 }
2935
2936 return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
2937 }
2938 };
2939
2940 #endif