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