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