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