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