253834508ac42a49c61dfcedb548120735d6e010
[mirror_edk2.git] / BaseTools / Source / C / VfrCompile / VfrSyntax.g
1 /*++
2 Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
3 This program and the accompanying materials
4 are licensed and made available under the terms and conditions of the BSD License
5 which accompanies this distribution. The full text of the license may be found at
6 http://opensource.org/licenses/bsd-license.php
7
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
11 Module Name:
12 VfrSyntax.g
13
14 Abstract:
15
16 --*/
17
18 #header<<
19
20 #include "EfiVfr.h"
21 #include "VfrFormPkg.h"
22 #include "VfrError.h"
23 #include "VfrUtilityLib.h"
24 #include "AToken.h"
25 #include "ATokPtr.h"
26 >>
27
28 <<
29 #include "stdio.h"
30 #include "PBlackBox.h"
31 #include "DLexerBase.h"
32 #include "VfrLexer.h"
33 #include "AToken.h"
34
35 #define GET_LINENO(Obj) ((Obj)->getLine())
36 #define SET_LINE_INFO(Obj, L) {(Obj).SetLineNo((L)->getLine());} while (0)
37 #define CRT_END_OP(Obj) {CIfrEnd EObj; if (Obj != NULL) EObj.SetLineNo ((Obj)->getLine());} while (0)
38
39 typedef ANTLRCommonToken ANTLRToken;
40
41 class CVfrDLGLexer : public VfrLexer
42 {
43 public:
44 CVfrDLGLexer (DLGFileInput *F) : VfrLexer (F) {};
45 INT32 errstd (char *Text)
46 {
47 printf ("unrecognized input '%s'\n", Text);
48 }
49 };
50
51 UINT8
52 VfrParserStart (
53 IN FILE *File,
54 IN INPUT_INFO_TO_SYNTAX *InputInfo
55 )
56 {
57 ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken> VfrParser(File);
58 VfrParser.parser()->SetCompatibleMode (InputInfo->CompatibleMode);
59 VfrParser.parser()->SetOverrideClassGuid (InputInfo->OverrideClassGuid);
60 return VfrParser.parser()->vfrProgram();
61 }
62 >>
63
64 //
65 // Define a lexical class for parsing quoted strings. Basically
66 // starts with a double quote, and ends with a double quote that
67 // is not preceeded with a backslash.
68 //
69 #lexclass QUOTED_STRING
70 #token TheString "~[\"]*\"" << mode (START); >>
71
72 //
73 // Define a lexclass for skipping over C++ style comments
74 //
75 #lexclass CPP_COMMENT
76 #token "~[\n]*" << skip (); >>
77 #token "\n" << skip (); mode (START); newline (); >>
78
79 //
80 // Standard lexclass is START
81 //
82 #lexclass START
83
84 //
85 // Find start of C++ style comments
86 //
87 #token "//" << skip (); mode (CPP_COMMENT); >>
88
89 //
90 // Skip whitespace
91 //
92 #token "[\ \t]" << skip (); >>
93
94 //
95 // Skip over newlines, but count them
96 //
97 #token "\n" << skip (); newline (); >>
98
99 //
100 // Skip over 'extern' in any included .H file
101 //
102 #token "extern" << skip (); mode (CPP_COMMENT); >>
103
104 //
105 // Tokens for the different keywords. Syntax is:
106 // TokenName("ErrorMessageText") "TokenString"
107 // where:
108 // TokenName is the token name (must be capitalized) that is used in the rules
109 // ErrorMessageText is the string the compiler emits when it detects a syntax error
110 // TokenString is the actual matching string used in the user script
111 //
112 #token FormPkgType("formpkgtype") "formpkgtype"
113 #token OpenBrace("{") "\{"
114 #token CloseBrace("}") "\}"
115 #token OpenParen("(") "\("
116 #token CloseParen(")") "\)"
117 #token OpenBracket("[") "\["
118 #token CloseBracket("]") "\]"
119
120 #token LineDefinition "#line\ [0-9]+\ \"~[\"]+\"[\ \t]*\n" << gCVfrErrorHandle.ParseFileScopeRecord (begexpr (), line ()); skip (); newline (); >>
121 #token DevicePath("devicepath") "devicepath"
122 #token FormSet("formset") "formset"
123 #token FormSetId("formsetid") "formsetid"
124 #token EndFormSet("endformset") "endformset"
125 #token Title("title") "title"
126 #token FormId("formid") "formid"
127 #token OneOf("oneof") "oneof"
128 #token EndOneOf("endoneof") "endoneof"
129 #token Prompt("prompt") "prompt"
130 #token OrderedList("orderedlist") "orderedlist"
131 #token MaxContainers("maxcontainers") "maxcontainers"
132 #token EndList("endlist") "endlist"
133 #token EndForm("endform") "endform"
134 #token Form("form") "form"
135 #token FormMap("formmap") "formmap"
136 #token MapTitle("maptitle") "maptitle"
137 #token MapGuid("mapguid") "mapguid"
138 #token Subtitle("subtitle") "subtitle"
139 #token Help("help") "help"
140 #token Text("text") "text"
141 #token Option("option") "option"
142 #token FLAGS("flags") "flags"
143 #token Date("date") "date"
144 #token EndDate("enddate") "enddate"
145 #token Year("year") "year"
146 #token Month("month") "month"
147 #token Day("day") "day"
148 #token Time("time") "time"
149 #token EndTime("endtime") "endtime"
150 #token Hour("hour") "hour"
151 #token Minute("minute") "minute"
152 #token Second("second") "second"
153 #token GrayOutIf("grayoutif") "grayoutif"
154 #token Label("label") "label"
155 #token Timeout("timeout") "timeout"
156 #token Inventory("inventory") "inventory"
157 #token NonNvDataMap("_NON_NV_DATA_MAP") "_NON_NV_DATA_MAP"
158 #token Struct("struct") "struct"
159 #token Boolean("BOOLEAN") "BOOLEAN"
160 #token Uint64("UINT64") "UINT64"
161 #token Uint32("UINT32") "UINT32"
162 #token Uint16("UINT16") "UINT16"
163 #token Char16("CHAR16") "CHAR16"
164 #token Uint8("UINT8") "UINT8"
165 #token Uuid("guid") "guid"
166 #token CheckBox("checkbox") "checkbox"
167 #token EndCheckBox("endcheckbox") "endcheckbox"
168 #token Numeric("numeric") "numeric"
169 #token EndNumeric("endnumeric") "endnumeric"
170 #token Minimum("minimum") "minimum"
171 #token Maximum("maximum") "maximum"
172 #token STEP("step") "step"
173 #token Default("default") "default"
174 #token Password("password") "password"
175 #token EndPassword("endpassword") "endpassword"
176 #token String("string") "string"
177 #token EndString("endstring") "endstring"
178 #token MinSize("minsize") "minsize"
179 #token MaxSize("maxsize") "maxsize"
180 #token Encoding("encoding") "encoding"
181 #token SuppressIf("suppressif") "suppressif"
182 #token DisableIf("disableif") "disableif"
183 #token Hidden("hidden") "hidden"
184 #token Goto("goto") "goto"
185 #token FormSetGuid("formsetguid") "formsetguid"
186 #token InconsistentIf("inconsistentif") "inconsistentif"
187 #token NoSubmitIf("nosubmitif") "nosubmitif"
188 #token EndIf("endif") "endif"
189 #token Key("key") "key"
190 #token DefaultFlag("DEFAULT") "DEFAULT"
191 #token ManufacturingFlag("MANUFACTURING") "MANUFACTURING"
192 #token InteractiveFlag("INTERACTIVE") "INTERACTIVE"
193 #token NVAccessFlag("NV_ACCESS") "NV_ACCESS"
194 #token ResetRequiredFlag("RESET_REQUIRED") "RESET_REQUIRED"
195 #token LateCheckFlag("LATE_CHECK") "LATE_CHECK"
196 #token ReadOnlyFlag("READ_ONLY") "READ_ONLY"
197 #token OptionOnlyFlag("OPTIONS_ONLY") "OPTIONS_ONLY"
198 #token Class("class") "class"
199 #token Subclass("subclass") "subclass"
200 #token ClassGuid("classguid") "classguid"
201 #token TypeDef("typedef") "typedef"
202 #token Restore("restore") "restore"
203 #token Save("save") "save"
204 #token Defaults("defaults") "defaults"
205 #token Banner("banner") "banner"
206 #token Align("align") "align"
207 #token Left("left") "left"
208 #token Right("right") "right"
209 #token Center("center") "center"
210 #token Line("line") "line"
211 #token Name("name") "name"
212
213 #token VarId("varid") "varid"
214 #token Question("question") "question"
215 #token QuestionId("questionid") "questionid"
216 #token Image("image") "image"
217 #token Locked("locked") "locked"
218 #token Rule("rule") "rule"
219 #token EndRule("endrule") "endrule"
220 #token Value("value") "value"
221 #token Read("read") "read"
222 #token Write("write") "write"
223 #token ResetButton("resetbutton") "resetbutton"
224 #token EndResetButton("endresetbutton") "endresetbutton"
225 #token DefaultStore("defaultstore") "defaultstore"
226 #token Attribute("attribute") "attribute"
227 #token Varstore("varstore") "varstore"
228 #token Efivarstore("efivarstore") "efivarstore"
229 #token VarSize("varsize") "varsize"
230 #token NameValueVarStore("namevaluevarstore") "namevaluevarstore"
231 #token Action("action") "action"
232 #token Config("config") "config"
233 #token EndAction("endaction") "endaction"
234 #token Refresh("refresh") "refresh"
235 #token Interval("interval") "interval"
236 #token VarstoreDevice("varstoredevice") "varstoredevice"
237 #token GuidOp("guidop") "guidop"
238 #token EndGuidOp("endguidop") "endguidop"
239 #token DataType("datatype") "datatype"
240 #token Data("data") "data"
241 #token Modal("modal") "modal"
242
243 //
244 // Define the class and subclass tokens
245 //
246 #token ClassNonDevice("NONDEVICE") "NON_DEVICE"
247 #token ClassDiskDevice("DISK_DEVICE") "DISK_DEVICE"
248 #token ClassVideoDevice("VIDEO_DEVICE") "VIDEO_DEVICE"
249 #token ClassNetworkDevice("NETWORK_DEVICE") "NETWORK_DEVICE"
250 #token ClassInputDevice("INPUT_DEVICE") "INPUT_DEVICE"
251 #token ClassOnBoardDevice("ONBOARD_DEVICE") "ONBOARD_DEVICE"
252 #token ClassOtherDevice("OTHER_DEVICE") "OTHER_DEVICE"
253
254 #token SubclassSetupApplication("SETUP_APPLICATION") "SETUP_APPLICATION"
255 #token SubclassGeneralApplication("GENERAL_APPLICATION") "GENERAL_APPLICATION"
256 #token SubclassFrontPage("FRONT_PAGE") "FRONT_PAGE"
257 #token SubclassSingleUse("SINGLE_USE") "SINGLE_USE"
258
259 //
260 // This is the overall definition of a VFR form definition script.
261 //
262
263 vfrProgram > [UINT8 Return] :
264 <<
265 mParserStatus = 0;
266 mCIfrOpHdrIndex = 0;
267 mConstantOnlyInExpression = FALSE;
268 >>
269 (
270 vfrPragmaPackDefinition
271 | vfrDataStructDefinition
272 )*
273 vfrFormSetDefinition
274 << $Return = mParserStatus; >>
275 ;
276
277 pragmaPackShowDef :
278 L:"show" << gCVfrVarDataTypeDB.Pack (L->getLine(), VFR_PACK_SHOW); >>
279 ;
280
281 pragmaPackStackDef :
282 <<
283 UINT32 LineNum;
284 UINT8 PackAction;
285 CHAR8 *Identifier = NULL;
286 UINT32 PackNumber = DEFAULT_PACK_ALIGN;
287 >>
288 (
289 L1:"push" << LineNum = L1->getLine(); PackAction = VFR_PACK_PUSH; >>
290 | L2:"pop" << LineNum = L2->getLine(); PackAction = VFR_PACK_POP; >>
291 )
292 {
293 "," ID:StringIdentifier << Identifier = ID->getText(); >>
294 }
295 {
296 "," N:Number << PackAction |= VFR_PACK_ASSIGN; PackNumber = _STOU32(N->getText()); >>
297 }
298 << gCVfrVarDataTypeDB.Pack (LineNum, PackAction, Identifier, PackNumber); >>
299 ;
300
301 pragmaPackNumber :
302 <<
303 UINT32 LineNum;
304 UINT32 PackNumber = DEFAULT_PACK_ALIGN;
305 >>
306 N:Number << LineNum = N->getLine(); PackNumber = _STOU32(N->getText()); >>
307 << gCVfrVarDataTypeDB.Pack (LineNum, VFR_PACK_ASSIGN, NULL, PackNumber); >>
308 ;
309
310 vfrPragmaPackDefinition :
311 "\#pragma" "pack" "\("
312 {
313 pragmaPackShowDef
314 | pragmaPackStackDef
315 | pragmaPackNumber
316 }
317 "\)"
318 ;
319
320 vfrDataStructDefinition :
321 { TypeDef } Struct << gCVfrVarDataTypeDB.DeclareDataTypeBegin (); >>
322 { NonNvDataMap }
323 {
324 N1:StringIdentifier << _PCATCH(gCVfrVarDataTypeDB.SetNewTypeName (N1->getText()), N1); >>
325 }
326 OpenBrace
327 vfrDataStructFields
328 CloseBrace
329 {
330 N2:StringIdentifier << _PCATCH(gCVfrVarDataTypeDB.SetNewTypeName (N2->getText()), N2); >>
331 }
332 ";" << gCVfrVarDataTypeDB.DeclareDataTypeEnd (); >>
333 ;
334
335 vfrDataStructFields :
336 (
337 dataStructField64 |
338 dataStructField32 |
339 dataStructField16 |
340 dataStructField8 |
341 dataStructFieldBool |
342 dataStructFieldString |
343 dataStructFieldDate |
344 dataStructFieldTime |
345 dataStructFieldRef |
346 dataStructFieldUser
347 )*
348 ;
349
350 dataStructField64 :
351 << UINT32 ArrayNum = 0; >>
352 D:"UINT64"
353 N:StringIdentifier
354 {
355 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
356 }
357 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
358 ;
359
360 dataStructField32 :
361 << UINT32 ArrayNum = 0; >>
362 D:"UINT32"
363 N:StringIdentifier
364 {
365 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
366 }
367 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
368 ;
369
370 dataStructField16 :
371 <<
372 UINT32 ArrayNum = 0;
373 >>
374 ("UINT16" | "CHAR16")
375 N:StringIdentifier
376 {
377 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
378 }
379 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), (CHAR8 *) "UINT16", ArrayNum), N); >>
380 ;
381
382 dataStructField8 :
383 << UINT32 ArrayNum = 0; >>
384 D:"UINT8"
385 N:StringIdentifier
386 {
387 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
388 }
389 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
390 ;
391
392 dataStructFieldBool :
393 << UINT32 ArrayNum = 0; >>
394 D:"BOOLEAN"
395 N:StringIdentifier
396 {
397 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
398 }
399 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
400 ;
401
402 dataStructFieldString :
403 << UINT32 ArrayNum = 0; >>
404 D:"EFI_STRING_ID"
405 N:StringIdentifier
406 {
407 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
408 }
409 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
410 ;
411
412 dataStructFieldDate :
413 << UINT32 ArrayNum = 0; >>
414 D:"EFI_HII_DATE"
415 N:StringIdentifier
416 {
417 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
418 }
419 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
420 ;
421
422 dataStructFieldTime :
423 << UINT32 ArrayNum = 0; >>
424 D:"EFI_HII_TIME"
425 N:StringIdentifier
426 {
427 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
428 }
429 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
430 ;
431
432 dataStructFieldRef :
433 << UINT32 ArrayNum = 0; >>
434 D:"EFI_HII_REF"
435 N:StringIdentifier
436 {
437 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
438 }
439 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
440 ;
441
442 dataStructFieldUser :
443 << UINT32 ArrayNum = 0; >>
444 T:StringIdentifier
445 N:StringIdentifier
446 {
447 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
448 }
449 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), T->getText(), ArrayNum), T); >>
450 ;
451
452 //*****************************************************************************
453 //
454 // the syntax of GUID definition
455 //
456 guidSubDefinition [EFI_GUID &Guid] :
457 G4:Number "," G5:Number "," G6:Number "," G7:Number "," G8:Number "," G9:Number "," G10:Number "," G11:Number
458 <<
459 Guid.Data4[0] = _STOU8(G4->getText());
460 Guid.Data4[1] = _STOU8(G5->getText());
461 Guid.Data4[2] = _STOU8(G6->getText());
462 Guid.Data4[3] = _STOU8(G7->getText());
463 Guid.Data4[4] = _STOU8(G8->getText());
464 Guid.Data4[5] = _STOU8(G9->getText());
465 Guid.Data4[6] = _STOU8(G10->getText());
466 Guid.Data4[7] = _STOU8(G11->getText());
467 >>
468 ;
469
470 guidDefinition [EFI_GUID &Guid] :
471 OpenBrace
472 G1:Number "," G2:Number "," G3:Number ","
473 <<
474 Guid.Data1 = _STOU32 (G1->getText());
475 Guid.Data2 = _STOU16 (G2->getText());
476 Guid.Data3 = _STOU16 (G3->getText());
477 >>
478 (
479 OpenBrace guidSubDefinition[Guid] CloseBrace
480 | guidSubDefinition[Guid]
481 )
482 CloseBrace
483 ;
484
485 //*****************************************************************************
486 //
487 // the syntax of form set definition
488 //
489 vfrFormSetDefinition :
490 <<
491 EFI_GUID Guid;
492 EFI_GUID DefaultClassGuid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID;
493 EFI_GUID ClassGuid1, ClassGuid2, ClassGuid3;
494 UINT8 ClassGuidNum = 0;
495 CIfrFormSet *FSObj = NULL;
496 UINT16 C, SC;
497 CHAR8* InsertOpcodeAddr = NULL;
498 >>
499 L:FormSet
500 Uuid "=" guidDefinition[Guid] ","
501 Title "=" "STRING_TOKEN" "\(" S1:Number "\)" ","
502 Help "=" "STRING_TOKEN" "\(" S2:Number "\)" ","
503 {
504 ClassGuid "=" guidDefinition[ClassGuid1] << ++ClassGuidNum; >>
505 {
506 "\|" guidDefinition[ClassGuid2] << ++ClassGuidNum; >>
507 }
508 {
509 "\|" guidDefinition[ClassGuid3] << ++ClassGuidNum; >>
510 }
511 ","
512 }
513 <<
514 if (mOverrideClassGuid != NULL && ClassGuidNum >= 3) {
515 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Already has 3 class guids, can't add extra class guid!");
516 }
517 switch (ClassGuidNum) {
518 case 0:
519 if (mOverrideClassGuid != NULL) {
520 ClassGuidNum = 2;
521 } else {
522 ClassGuidNum = 1;
523 }
524 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
525 FSObj->SetClassGuid(&DefaultClassGuid);
526 if (mOverrideClassGuid != NULL) {
527 FSObj->SetClassGuid(mOverrideClassGuid);
528 }
529 break;
530 case 1:
531 if (mOverrideClassGuid != NULL) {
532 ClassGuidNum ++;
533 }
534 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
535 FSObj->SetClassGuid(&ClassGuid1);
536 if (mOverrideClassGuid != NULL) {
537 FSObj->SetClassGuid(mOverrideClassGuid);
538 }
539 break;
540 case 2:
541 if (mOverrideClassGuid != NULL) {
542 ClassGuidNum ++;
543 }
544 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
545 FSObj->SetClassGuid(&ClassGuid1);
546 FSObj->SetClassGuid(&ClassGuid2);
547 if (mOverrideClassGuid != NULL) {
548 FSObj->SetClassGuid(mOverrideClassGuid);
549 }
550 break;
551 case 3:
552 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
553 FSObj->SetClassGuid(&ClassGuid1);
554 FSObj->SetClassGuid(&ClassGuid2);
555 FSObj->SetClassGuid(&ClassGuid3);
556 break;
557 default:
558 break;
559 }
560
561 SET_LINE_INFO (*FSObj, L);
562 FSObj->SetGuid (&Guid);
563 //
564 // for framework vfr to store formset guid used by varstore and efivarstore
565 //
566 if (mCompatibleMode) {
567 memcpy (&mFormsetGuid, &Guid, sizeof (EFI_GUID));
568 }
569 FSObj->SetFormSetTitle (_STOSID(S1->getText()));
570 FSObj->SetHelp (_STOSID(S2->getText()));
571 >>
572 {
573 FC:Class "=" classDefinition[C] "," << {CIfrClass CObj;SET_LINE_INFO (CObj, FC); CObj.SetClass(C);} >>
574 }
575 {
576 FSC:Subclass "=" subclassDefinition[SC] "," << {CIfrSubClass SCObj; SET_LINE_INFO (SCObj, FSC); SCObj.SetSubClass(SC);} >>
577 }
578 <<
579 _DeclareStandardDefaultStorage (GET_LINENO (L));
580 >>
581 vfrFormSetList
582 E:EndFormSet <<
583 if (mCompatibleMode) {
584 //
585 // declare all undefined varstore and efivarstore
586 //
587 _DeclareDefaultFrameworkVarStore (GET_LINENO(E));
588 }
589
590 //
591 // Declare undefined Question so that they can be used in expression.
592 //
593 if (gCFormPkg.HavePendingUnassigned()) {
594 mParserStatus += gCFormPkg.DeclarePendingQuestion (
595 gCVfrVarDataTypeDB,
596 mCVfrDataStorage,
597 mCVfrQuestionDB,
598 &mFormsetGuid,
599 E->getLine(),
600 &InsertOpcodeAddr
601 );
602 gNeedAdjustOpcode = TRUE;
603 }
604
605 CRT_END_OP (E);
606
607 //
608 // Adjust the pending question position.
609 // Move the position from current to before the end of the last form in the form set.
610 //
611 if (gNeedAdjustOpcode) {
612 gCFormPkg.AdjustDynamicInsertOpcode (
613 mLastFormEndAddr,
614 InsertOpcodeAddr
615 );
616 }
617
618 if (FSObj != NULL) {
619 delete FSObj;
620 }
621 >>
622 ";"
623 ;
624
625 vfrFormSetList :
626 (
627 vfrFormDefinition |
628 vfrFormMapDefinition |
629 vfrStatementImage |
630 vfrStatementVarStoreLinear |
631 vfrStatementVarStoreEfi |
632 vfrStatementVarStoreNameValue |
633 vfrStatementDefaultStore |
634 vfrStatementDisableIfFormSet |
635 vfrStatementSuppressIfFormSet |
636 vfrStatementExtension
637 )*
638 ;
639
640 vfrStatementExtension:
641 <<
642 EFI_GUID Guid;
643 CIfrGuid *GuidObj = NULL;
644 CHAR8 *TypeName = NULL;
645 UINT32 TypeSize = 0;
646 UINT8 *DataBuff = NULL;
647 UINT32 Size = 0;
648 UINT8 Idx = 0;
649 UINT32 LineNum;
650 BOOLEAN IsStruct = FALSE;
651 UINT32 ArrayNum = 0;
652 >>
653 L:GuidOp
654 Uuid "=" guidDefinition[Guid]
655 {"," DataType "="
656 (
657 U64:"UINT64" {OpenBracket AN1:Number CloseBracket <<ArrayNum = _STOU32(AN1->getText());>>}
658 << TypeName = U64->getText(); LineNum = U64->getLine(); >>
659 | U32:"UINT32" {OpenBracket AN2:Number CloseBracket <<ArrayNum = _STOU32(AN2->getText());>>}
660 << TypeName = U32->getText(); LineNum = U32->getLine(); >>
661 | U16:"UINT16" {OpenBracket AN3:Number CloseBracket <<ArrayNum = _STOU32(AN3->getText());>>}
662 << TypeName = U16->getText(); LineNum = U16->getLine(); >>
663 | U8:"UINT8" {OpenBracket AN4:Number CloseBracket <<ArrayNum = _STOU32(AN4->getText());>>}
664 << TypeName = U8->getText(); LineNum = U8->getLine(); >>
665 | BL:"BOOLEAN" {OpenBracket AN5:Number CloseBracket <<ArrayNum = _STOU32(AN5->getText());>>}
666 << TypeName = BL->getText(); LineNum = BL->getLine(); >>
667 | SI:"EFI_STRING_ID" {OpenBracket AN6:Number CloseBracket <<ArrayNum = _STOU32(AN6->getText());>>}
668 << TypeName = SI->getText(); LineNum = SI->getLine(); >>
669 | D:"EFI_HII_DATE" {OpenBracket AN7:Number CloseBracket <<ArrayNum = _STOU32(AN7->getText());>>}
670 << TypeName = D->getText(); LineNum = D->getLine(); IsStruct = TRUE;>>
671 | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket <<ArrayNum = _STOU32(AN8->getText());>>}
672 << TypeName = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>
673 | R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = _STOU32(AN9->getText());>>}
674 << TypeName = R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
675 | TN:StringIdentifier {OpenBracket AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText());>>}
676 << TypeName = TN->getText(); LineNum = TN->getLine(); IsStruct = TRUE;>>
677 )
678 <<
679 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &TypeSize), LineNum);
680 if (ArrayNum > 0) {
681 Size = TypeSize*ArrayNum;
682 } else {
683 Size = TypeSize;
684 }
685 if (Size > (128 - sizeof (EFI_IFR_GUID))) return;
686 DataBuff = (UINT8 *)malloc(Size);
687 for (Idx = 0; Idx < Size; Idx++) {
688 DataBuff[Idx] = 0;
689 }
690 >>
691 vfrExtensionData [DataBuff, Size, TypeName, TypeSize, IsStruct, ArrayNum]
692 }
693 <<
694 {
695 GuidObj = new CIfrGuid(Size);
696 if (GuidObj != NULL) {
697 GuidObj->SetLineNo(L->getLine());
698 GuidObj->SetGuid (&Guid);
699 }
700 }
701 if (TypeName != NULL) {
702 GuidObj->SetData(DataBuff, Size);
703 }
704 >>
705 {","
706 (
707 vfrStatementExtension
708 )*
709 E:EndGuidOp << GuidObj->SetScope(1); CRT_END_OP (E); >>
710 }
711 <<
712 if (GuidObj != NULL) delete GuidObj;
713 if (DataBuff != NULL) free(DataBuff);
714 >>
715 ";"
716 ;
717
718 vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 TypeSize, BOOLEAN IsStruct, UINT32 ArrayNum]:
719 <<
720 CHAR8 *TFName = NULL;
721 UINT32 ArrayIdx = 0;
722 UINT16 FieldOffset;
723 UINT8 FieldType;
724 UINT32 FieldSize;
725 UINT64 Data_U64 = 0;
726 UINT32 Data_U32 = 0;
727 UINT16 Data_U16 = 0;
728 UINT8 Data_U8 = 0;
729 BOOLEAN Data_BL = 0;
730 EFI_STRING_ID Data_SID = 0;
731 BOOLEAN IsArray = FALSE;
732 UINT8 *ByteOffset = NULL;
733 >>
734 (
735 ("," "data" {OpenBracket IDX1:Number CloseBracket <<IsArray = TRUE;>>}
736 <<
737 ArrayIdx = 0;
738 if (IsArray == TRUE) {
739 ArrayIdx = _STOU8(IDX1->getText());
740 if (ArrayIdx >= ArrayNum) return;
741 IsArray = FALSE;
742 }
743 ByteOffset = DataBuff + (ArrayIdx * TypeSize);
744 if (IsStruct == TRUE) {
745 _STRCAT(&TFName, TypeName);
746 }
747 >>
748 ("." FN:StringIdentifier
749 <<
750 if (IsStruct == TRUE) {
751 _STRCAT(&TFName, ".");
752 _STRCAT(&TFName, FN->getText());
753 }
754 >>
755 {
756 OpenBracket IDX2:Number CloseBracket
757 <<
758 if (IsStruct == TRUE) {
759 _STRCAT(&TFName, "[");
760 _STRCAT(&TFName, IDX2->getText());
761 _STRCAT(&TFName, "]");
762 }
763 >>
764 }
765 )*
766 "=" RD:Number
767 <<
768 if (IsStruct == FALSE) {
769 if (strcmp ("UINT64", TypeName) == 0) {
770 Data_U64 = _STOU64(RD->getText());
771 memcpy (ByteOffset, &Data_U64, TypeSize);
772 }else if (strcmp ("UINT32", TypeName) == 0) {
773 Data_U32 = _STOU32(RD->getText());
774 memcpy (ByteOffset, &Data_U32, TypeSize);
775 }else if (strcmp ("UINT16", TypeName) == 0) {
776 Data_U16 = _STOU16(RD->getText());
777 memcpy (ByteOffset, &Data_U16, TypeSize);
778 }else if (strcmp ("UINT8", TypeName) == 0) {
779 Data_U8 = _STOU8(RD->getText());
780 memcpy (ByteOffset, &Data_U8, TypeSize);
781 }else if (strcmp ("BOOLEAN", TypeName)== 0) {
782 Data_BL = _STOU8(RD->getText());
783 memcpy (ByteOffset, &Data_BL, TypeSize);
784 }else if (strcmp ("EFI_STRING_ID", TypeName) == 0) {
785 Data_SID = _STOSID(RD->getText());
786 memcpy (ByteOffset, &Data_SID, TypeSize);
787 }
788 } else {
789 gCVfrVarDataTypeDB.GetDataFieldInfo(TFName, FieldOffset, FieldType, FieldSize);
790 switch (FieldType) {
791 case EFI_IFR_TYPE_NUM_SIZE_8:
792 Data_U8 = _STOU8(RD->getText());
793 memcpy (ByteOffset + FieldOffset, &Data_U8, FieldSize);
794 break;
795 case EFI_IFR_TYPE_NUM_SIZE_16:
796 Data_U16 = _STOU16(RD->getText());
797 memcpy (ByteOffset + FieldOffset, &Data_U16, FieldSize);
798 break;
799 case EFI_IFR_TYPE_NUM_SIZE_32:
800 Data_U32 = _STOU32(RD->getText());
801 memcpy (ByteOffset + FieldOffset, &Data_U32, FieldSize);
802 break;
803 case EFI_IFR_TYPE_NUM_SIZE_64:
804 Data_U64 = _STOU64(RD->getText());
805 memcpy (ByteOffset + FieldOffset, &Data_U64, FieldSize);
806 break;
807 case EFI_IFR_TYPE_BOOLEAN:
808 Data_BL = _STOU8(RD->getText());
809 memcpy (ByteOffset + FieldOffset, &Data_BL, FieldSize);
810 break;
811 case EFI_IFR_TYPE_STRING:
812 Data_SID = _STOSID(RD->getText());
813 memcpy (ByteOffset + FieldOffset, &Data_SID, FieldSize);
814 break;
815 default:
816 break;
817 }
818 }
819 if (TFName != NULL) { delete TFName; TFName = NULL; }
820 >>
821 )*
822 )
823 ;
824
825
826 vfrStatementDefaultStore :
827 << UINT16 DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD; >>
828 D:DefaultStore N:StringIdentifier ","
829 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)"
830 {
831 "," Attribute "=" A:Number << DefaultId = _STOU16(A->getText()); >>
832 }
833 <<
834 if (mCVfrDefaultStore.DefaultIdRegistered (DefaultId) == FALSE) {
835 CIfrDefaultStore DSObj;
836 _PCATCH(mCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr(), N->getText(), _STOSID(S->getText()), DefaultId)), D->getLine();
837 DSObj.SetLineNo(D->getLine());
838 DSObj.SetDefaultName (_STOSID(S->getText()));
839 DSObj.SetDefaultId (DefaultId);
840 } else {
841 _PCATCH(mCVfrDefaultStore.ReRegisterDefaultStoreById (DefaultId, N->getText(), _STOSID(S->getText()))), D->getLine();
842 }
843 >>
844 ";"
845 ;
846
847 vfrStatementVarStoreLinear :
848 <<
849 EFI_GUID Guid;
850 CIfrVarStore VSObj;
851 CHAR8 *TypeName;
852 CHAR8 *StoreName;
853 UINT32 LineNum;
854 EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;
855 UINT32 Size;
856 >>
857 V:Varstore << VSObj.SetLineNo(V->getLine()); >>
858 (
859 TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->getLine(); >>
860 | U8:"UINT8" "," << TypeName = U8->getText(); LineNum = U8->getLine(); >>
861 | U16:"UINT16" "," << TypeName = U16->getText(); LineNum = U16->getLine(); >>
862 | C16:"CHAR16" "," << TypeName = (CHAR8 *) "UINT16"; LineNum = C16->getLine(); >>
863 | U32:"UINT32" "," << TypeName = U32->getText(); LineNum = U32->getLine(); >>
864 | U64:"UINT64" "," << TypeName = U64->getText(); LineNum = U64->getLine(); >>
865 | D:"EFI_HII_DATE" "," << TypeName = D->getText(); LineNum = D->getLine(); >>
866 | T:"EFI_HII_TIME" "," << TypeName = T->getText(); LineNum = T->getLine(); >>
867 | R:"EFI_HII_REF" "," << TypeName = R->getText(); LineNum = R->getLine(); >>
868 )
869 { Key "=" FID:Number "," << // Key is used to assign Varid in Framework VFR but no use in UEFI2.1 VFR
870 if (mCompatibleMode) {
871 VarStoreId = _STOU16(FID->getText());
872 }
873 >>
874 }
875 {
876 VarId "=" ID:Number "," <<
877 _PCATCH(
878 (INTN)(VarStoreId = _STOU16(ID->getText())) != 0,
879 (INTN)TRUE,
880 ID,
881 "varid 0 is not allowed."
882 );
883 >>
884 }
885 Name "=" SN:StringIdentifier ","
886 Uuid "=" guidDefinition[Guid]
887 <<
888 if (mCompatibleMode) {
889 StoreName = TypeName;
890 } else {
891 StoreName = SN->getText();
892 }
893 _PCATCH(mCVfrDataStorage.DeclareBufferVarStore (
894 StoreName,
895 &Guid,
896 &gCVfrVarDataTypeDB,
897 TypeName,
898 VarStoreId
899 ), LineNum);
900 VSObj.SetGuid (&Guid);
901 _PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId, &Guid), SN);
902 VSObj.SetVarStoreId (VarStoreId);
903 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);
904 VSObj.SetSize ((UINT16) Size);
905 VSObj.SetName (SN->getText());
906 >>
907 ";"
908 ;
909
910 vfrStatementVarStoreEfi :
911 <<
912 BOOLEAN IsUEFI23EfiVarstore = TRUE;
913 EFI_GUID Guid;
914 CIfrVarStoreEfi VSEObj;
915 EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;
916 UINT32 Attr = 0;
917 UINT32 Size;
918 CHAR8 *TypeName;
919 UINT32 LineNum;
920 CHAR8 *StoreName = NULL;
921 >>
922 E:Efivarstore << VSEObj.SetLineNo(E->getLine()); >>
923 (
924 TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->getLine(); >>
925 | U8:"UINT8" "," << TypeName = U8->getText(); LineNum = U8->getLine(); >>
926 | U16:"UINT16" "," << TypeName = U16->getText(); LineNum = U16->getLine(); >>
927 | C16:"CHAR16" "," << TypeName = (CHAR8 *) "UINT16"; LineNum = C16->getLine(); >>
928 | U32:"UINT32" "," << TypeName = U32->getText(); LineNum = U32->getLine(); >>
929 | U64:"UINT64" "," << TypeName = U64->getText(); LineNum = U64->getLine(); >>
930 | D:"EFI_HII_DATE" "," << TypeName = D->getText(); LineNum = D->getLine(); >>
931 | T:"EFI_HII_TIME" "," << TypeName = T->getText(); LineNum = T->getLine(); >>
932 | R:"EFI_HII_REF" "," << TypeName = R->getText(); LineNum = R->getLine(); >>
933 )
934 {
935 VarId "=" ID:Number "," <<
936 _PCATCH(
937 (INTN)(VarStoreId = _STOU16(ID->getText())) != 0,
938 (INTN)TRUE,
939 ID,
940 "varid 0 is not allowed."
941 );
942 >>
943 }
944 Attribute "=" vfrVarStoreEfiAttr[Attr] ( "\|" vfrVarStoreEfiAttr[Attr] )* ","
945 << VSEObj.SetAttributes (Attr); >>
946
947 (
948 Name "=" SN:StringIdentifier "," << StoreName = SN->getText(); >>
949 |
950 Name "=" "STRING_TOKEN" "\(" VN:Number "\)" ","
951 VarSize "=" N:Number "," <<
952 IsUEFI23EfiVarstore = FALSE;
953 StoreName = gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText()));
954 if (StoreName == NULL) {
955 _PCATCH (VFR_RETURN_UNSUPPORTED, VN->getLine(), "Can't get varstore name for this StringId!");
956 }
957 Size = _STOU32(N->getText());
958 switch (Size) {
959 case 1:
960 TypeName = (CHAR8 *) "UINT8";
961 break;
962 case 2:
963 TypeName = (CHAR8 *) "UINT16";
964 break;
965 case 4:
966 TypeName = (CHAR8 *) "UINT32";
967 break;
968 case 8:
969 TypeName = (CHAR8 *) "UINT64";
970 break;
971 default:
972 _PCATCH (VFR_RETURN_UNSUPPORTED, N);
973 break;
974 }
975 >>
976 )
977
978 Uuid "=" guidDefinition[Guid] <<
979 if (IsUEFI23EfiVarstore) {
980 _PCATCH(mCVfrDataStorage.DeclareBufferVarStore (
981 StoreName,
982 &Guid,
983 &gCVfrVarDataTypeDB,
984 TypeName,
985 VarStoreId
986 ), LineNum);
987 _PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId, &Guid), SN);
988 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);
989 } else {
990 _PCATCH(mCVfrDataStorage.DeclareBufferVarStore (
991 TN->getText(),
992 &Guid,
993 &gCVfrVarDataTypeDB,
994 TypeName,
995 VarStoreId
996 ), LineNum);
997 _PCATCH(mCVfrDataStorage.GetVarStoreId(TN->getText(), &VarStoreId, &Guid), VN);
998 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), N->getLine());
999 }
1000 VSEObj.SetGuid (&Guid);
1001 VSEObj.SetVarStoreId (VarStoreId);
1002
1003 VSEObj.SetSize ((UINT16) Size);
1004 VSEObj.SetName (StoreName);
1005 if (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {
1006 delete StoreName;
1007 }
1008 >>
1009 ";"
1010 ;
1011
1012 vfrVarStoreEfiAttr [UINT32 & Attr] :
1013 N:Number << $Attr |= _STOU32(N->getText()); >>
1014 ;
1015
1016 vfrStatementVarStoreNameValue :
1017 <<
1018 EFI_GUID Guid;
1019 CIfrVarStoreNameValue VSNVObj;
1020 EFI_VARSTORE_ID VarStoreId;
1021 >>
1022 L:NameValueVarStore << VSNVObj.SetLineNo(L->getLine()); >>
1023 SN:StringIdentifier "," << _PCATCH(mCVfrDataStorage.DeclareNameVarStoreBegin (SN->getText()), SN); >>
1024 (
1025 Name "=" "STRING_TOKEN" "\(" N:Number "\)" "," << _PCATCH(mCVfrDataStorage.NameTableAddItem (_STOSID(N->getText())), SN); >>
1026 )+
1027 Uuid "=" guidDefinition[Guid] << _PCATCH(mCVfrDataStorage.DeclareNameVarStoreEnd (&Guid), SN); >>
1028 <<
1029 VSNVObj.SetGuid (&Guid);
1030 _PCATCH(mCVfrDataStorage.GetVarStoreId(SN->getText(), &VarStoreId, &Guid), SN);
1031 VSNVObj.SetVarStoreId (VarStoreId);
1032 >>
1033 ";"
1034 ;
1035
1036 //
1037 // keep classDeinition and validClassNames for compatibility but not generate
1038 // any IFR object
1039 //
1040 classDefinition[UINT16 & Class] :
1041 << $Class = 0; >>
1042 validClassNames[$Class] ( "\|" validClassNames[$Class] )*
1043 ;
1044
1045 validClassNames[UINT16 & Class] :
1046 ClassNonDevice << $Class |= EFI_NON_DEVICE_CLASS; >>
1047 | ClassDiskDevice << $Class |= EFI_DISK_DEVICE_CLASS; >>
1048 | ClassVideoDevice << $Class |= EFI_VIDEO_DEVICE_CLASS; >>
1049 | ClassNetworkDevice << $Class |= EFI_NETWORK_DEVICE_CLASS; >>
1050 | ClassInputDevice << $Class |= EFI_INPUT_DEVICE_CLASS; >>
1051 | ClassOnBoardDevice << $Class |= EFI_ON_BOARD_DEVICE_CLASS; >>
1052 | ClassOtherDevice << $Class |= EFI_OTHER_DEVICE_CLASS; >>
1053 | N:Number << $Class |= _STOU16(N->getText()); >>
1054 ;
1055
1056 subclassDefinition[UINT16 & SubClass] :
1057 << $SubClass = 0; >>
1058 SubclassSetupApplication << $SubClass |= EFI_SETUP_APPLICATION_SUBCLASS; >>
1059 | SubclassGeneralApplication << $SubClass |= EFI_GENERAL_APPLICATION_SUBCLASS; >>
1060 | SubclassFrontPage << $SubClass |= EFI_FRONT_PAGE_SUBCLASS; >>
1061 | SubclassSingleUse << $SubClass |= EFI_SINGLE_USE_SUBCLASS; >>
1062 | N:Number << $SubClass |= _STOU16(N->getText()); >>
1063 ;
1064
1065 vfrStatementDisableIfFormSet :
1066 <<
1067 CIfrDisableIf DIObj;
1068 mConstantOnlyInExpression = TRUE;
1069 >>
1070 D:DisableIf << DIObj.SetLineNo(D->getLine()); >>
1071 vfrStatementExpression[0] ";" << mConstantOnlyInExpression = FALSE; >>
1072 vfrFormSetList
1073 E:EndIf << CRT_END_OP (E); >>
1074 ";"
1075 ;
1076
1077 vfrStatementSuppressIfFormSet :
1078 << CIfrSuppressIf SIObj;>>
1079 L:SuppressIf <<
1080 if (mCompatibleMode) {
1081 _PCATCH (VFR_RETURN_UNSUPPORTED, L);
1082 }
1083 SIObj.SetLineNo(L->getLine());
1084 >>
1085 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
1086 vfrStatementExpression[0] ";"
1087 vfrFormSetList
1088 E: EndIf
1089 ";" << CRT_END_OP (E); >>
1090 ;
1091
1092 //*****************************************************************************
1093 //
1094 // the syntax of question header and statement header
1095 //
1096 vfrStatementHeader[CIfrStatementHeader *SHObj] :
1097 Prompt "=" "STRING_TOKEN" "\(" S1:Number "\)" "," << $SHObj->SetPrompt (_STOSID(S1->getText())); >>
1098 Help "=" "STRING_TOKEN" "\(" S2:Number "\)" << $SHObj->SetHelp (_STOSID(S2->getText())); >>
1099 ;
1100
1101 vfrQuestionHeader[CIfrQuestionHeader & QHObj, EFI_QUESION_TYPE QType = QUESTION_NORMAL]:
1102 <<
1103 EFI_VARSTORE_INFO Info;
1104 Info.mVarType = EFI_IFR_TYPE_OTHER;
1105 Info.mVarTotalSize = 0;
1106 Info.mInfo.mVarOffset = EFI_VAROFFSET_INVALID;
1107 Info.mVarStoreId = EFI_VARSTORE_ID_INVALID;
1108 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
1109 CHAR8 *QName = NULL;
1110 CHAR8 *VarIdStr = NULL;
1111 mUsedDefaultCount = 0;
1112 >>
1113 {
1114 Name "=" QN:StringIdentifier "," <<
1115 QName = QN->getText();
1116 _PCATCH(mCVfrQuestionDB.FindQuestion (QName), VFR_RETURN_UNDEFINED, QN, "has already been used please used anther name");
1117 >>
1118 }
1119 { V:VarId "=" vfrStorageVarId[Info, VarIdStr] "," }
1120 {
1121 QuestionId "=" ID:Number "," <<
1122 QId = _STOQID(ID->getText());
1123 _PCATCH(mCVfrQuestionDB.FindQuestion (QId), VFR_RETURN_UNDEFINED, ID, "has already been used please assign another number");
1124 >>
1125 }
1126 <<
1127 switch (QType) {
1128 case QUESTION_NORMAL:
1129 mCVfrQuestionDB.RegisterQuestion (QName, VarIdStr, QId);
1130 break;
1131 case QUESTION_DATE:
1132 mCVfrQuestionDB.RegisterNewDateQuestion (QName, VarIdStr, QId);
1133 break;
1134 case QUESTION_TIME:
1135 mCVfrQuestionDB.RegisterNewTimeQuestion (QName, VarIdStr, QId);
1136 break;
1137 case QUESTION_REF:
1138 //
1139 // VarIdStr != NULL stand for question with storagae.
1140 //
1141 if (VarIdStr != NULL) {
1142 mCVfrQuestionDB.RegisterRefQuestion (QName, VarIdStr, QId);
1143 } else {
1144 mCVfrQuestionDB.RegisterQuestion (QName, NULL, QId);
1145 }
1146 break;
1147 default:
1148 _PCATCH(VFR_RETURN_FATAL_ERROR);
1149 }
1150 $QHObj.SetQuestionId (QId);
1151 if (VarIdStr != NULL) {
1152 $QHObj.SetVarStoreInfo (&Info);
1153 }
1154 >>
1155 vfrStatementHeader[&$QHObj]
1156 <<
1157 if (VarIdStr != NULL) {
1158 delete VarIdStr;
1159 }
1160 _SAVE_CURRQEST_VARINFO (Info);
1161 >>
1162 ;
1163
1164 questionheaderFlagsField[UINT8 & Flags] :
1165 ReadOnlyFlag << $Flags |= 0x01; >>
1166 | InteractiveFlag << $Flags |= 0x04; >>
1167 | ResetRequiredFlag << $Flags |= 0x10; >>
1168 | OptionOnlyFlag << $Flags |= 0x80; >>
1169 | NVAccessFlag
1170 | LateCheckFlag
1171 ;
1172
1173 vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFlag = TRUE] :
1174 <<
1175 UINT32 Idx;
1176 UINT32 LineNo;
1177 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
1178 CHAR8 *VarIdStr = NULL;
1179 CHAR8 *VarStr = NULL;
1180 CHAR8 *SName = NULL;
1181 CHAR8 *TName = NULL;
1182 EFI_VFR_RETURN_CODE VfrReturnCode = VFR_RETURN_SUCCESS;
1183 EFI_IFR_TYPE_VALUE Dummy = gZeroEfiIfrTypeValue;
1184 EFI_GUID *VarGuid = NULL;
1185 >>
1186 (
1187 SN1:StringIdentifier << SName = SN1->getText(); _STRCAT(&VarIdStr, SN1->getText()); >>
1188 OpenBracket I1:Number CloseBracket <<
1189 Idx = _STOU32(I1->getText());
1190 _STRCAT(&VarIdStr, "[");
1191 _STRCAT(&VarIdStr, I1->getText());
1192 _STRCAT(&VarIdStr, "]");
1193 >>
1194 <<
1195 VfrReturnCode = mCVfrDataStorage.GetVarStoreId(SName, &$Info.mVarStoreId);
1196 if (mCompatibleMode && VfrReturnCode == VFR_RETURN_UNDEFINED) {
1197 mCVfrDataStorage.DeclareBufferVarStore (
1198 SName,
1199 &mFormsetGuid,
1200 &gCVfrVarDataTypeDB,
1201 SName,
1202 EFI_VARSTORE_ID_INVALID,
1203 FALSE
1204 );
1205 VfrReturnCode = mCVfrDataStorage.GetVarStoreId(SName, &$Info.mVarStoreId, &mFormsetGuid);
1206 }
1207 if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
1208 _PCATCH(VfrReturnCode, SN1);
1209 _PCATCH(mCVfrDataStorage.GetNameVarStoreInfo (&$Info, Idx), SN1);
1210 }
1211
1212 QuestVarIdStr = VarIdStr;
1213 >>
1214 )
1215 |
1216 (
1217 SN2:StringIdentifier << SName = SN2->getText(); _STRCAT(&VarIdStr, SName); >>
1218 <<
1219 VfrReturnCode = mCVfrDataStorage.GetVarStoreId(SName, &$Info.mVarStoreId);
1220 if (mCompatibleMode && VfrReturnCode == VFR_RETURN_UNDEFINED) {
1221 mCVfrDataStorage.DeclareBufferVarStore (
1222 SName,
1223 &mFormsetGuid,
1224 &gCVfrVarDataTypeDB,
1225 SName,
1226 EFI_VARSTORE_ID_INVALID,
1227 FALSE
1228 );
1229 VfrReturnCode = mCVfrDataStorage.GetVarStoreId(SName, &$Info.mVarStoreId, &mFormsetGuid);
1230 }
1231 if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
1232 _PCATCH(VfrReturnCode, SN2);
1233 VarStoreType = mCVfrDataStorage.GetVarStoreType ($Info.mVarStoreId);
1234 if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) {
1235 _PCATCH(mCVfrDataStorage.GetBufferVarStoreDataTypeName(Info.mVarStoreId, &TName), SN2);
1236 _STRCAT(&VarStr, TName);
1237 }
1238 }
1239 >>
1240
1241 (
1242 "." <<
1243 if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
1244 _PCATCH(((VarStoreType != EFI_VFR_VARSTORE_BUFFER) ? VFR_RETURN_EFIVARSTORE_USE_ERROR : VFR_RETURN_SUCCESS), SN2);
1245 }
1246 _STRCAT(&VarIdStr, "."); _STRCAT(&VarStr, ".");
1247 >>
1248 SF:StringIdentifier << _STRCAT(&VarIdStr, SF->getText()); _STRCAT(&VarStr, SF->getText()); >>
1249 {
1250 OpenBracket I2:Number CloseBracket <<
1251 Idx = _STOU32(I2->getText());
1252 if (mCompatibleMode) Idx --;
1253 if (Idx > 0) {
1254 //
1255 // Idx == 0, [0] can be ignored.
1256 // Array[0] is same to Array for unify the varid name to cover [0]
1257 //
1258 _STRCAT(&VarIdStr, "[");
1259 _STRCAT(&VarIdStr, I2->getText());
1260 _STRCAT(&VarIdStr, "]");
1261 }
1262 _STRCAT(&VarStr, "[");
1263 _STRCAT(&VarStr, I2->getText());
1264 _STRCAT(&VarStr, "]");
1265 >>
1266 }
1267 )* <<
1268 switch (VarStoreType) {
1269 case EFI_VFR_VARSTORE_EFI:
1270 _PCATCH(mCVfrDataStorage.GetEfiVarStoreInfo (&$Info), SN2);
1271 break;
1272 case EFI_VFR_VARSTORE_BUFFER:
1273 _PCATCH(gCVfrVarDataTypeDB.GetDataFieldInfo (VarStr, $Info.mInfo.mVarOffset, $Info.mVarType, $Info.mVarTotalSize), SN2->getLine(), VarStr);
1274 VarGuid = mCVfrDataStorage.GetVarStoreGuid($Info.mVarStoreId);
1275 _PCATCH((EFI_VFR_RETURN_CODE)gCVfrBufferConfig.Register (
1276 SName,
1277 VarGuid,
1278 NULL),
1279 SN2->getLine());
1280 _PCATCH((EFI_VFR_RETURN_CODE)gCVfrBufferConfig.Write (
1281 'a',
1282 SName,
1283 VarGuid,
1284 NULL,
1285 $Info.mVarType,
1286 $Info.mInfo.mVarOffset,
1287 $Info.mVarTotalSize,
1288 Dummy),
1289 SN2->getLine());
1290 break;
1291 case EFI_VFR_VARSTORE_NAME:
1292 default: break;
1293 }
1294
1295 QuestVarIdStr = VarIdStr;
1296 if (VarStr != NULL) {delete VarStr;}
1297 >>
1298 )
1299 ;
1300
1301 vfrQuestionDataFieldName [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr, UINT32 &LineNo] :
1302 <<
1303 UINT32 Idx;
1304 VarIdStr = NULL; LineNo = 0;
1305 >>
1306 (
1307 SN1:StringIdentifier << _STRCAT(&VarIdStr, SN1->getText()); LineNo = SN1->getLine(); >>
1308 OpenBracket I1:Number CloseBracket <<
1309 _STRCAT(&VarIdStr, "[");
1310 _STRCAT(&VarIdStr, I1->getText());
1311 _STRCAT(&VarIdStr, "]");
1312 mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask);
1313 if (mConstantOnlyInExpression) {
1314 _PCATCH(VFR_RETURN_CONSTANT_ONLY, LineNo);
1315 }
1316 >>
1317 )
1318 |
1319 (
1320 SN2:StringIdentifier << _STRCAT (&VarIdStr, SN2->getText()); LineNo = SN2->getLine(); >>
1321 (
1322 "." <<
1323 _STRCAT (&VarIdStr, ".");
1324 if (mConstantOnlyInExpression) {
1325 _PCATCH(VFR_RETURN_CONSTANT_ONLY, LineNo);
1326 }
1327 >>
1328 SF:StringIdentifier << _STRCAT (&VarIdStr, SF->getText()); >>
1329 {
1330 OpenBracket I2:Number CloseBracket <<
1331 Idx = _STOU32(I2->getText());
1332 if (mCompatibleMode) Idx --;
1333 if (Idx > 0) {
1334 //
1335 // Idx == 0, [0] can be ignored.
1336 // Array[0] is same to Array
1337 //
1338 _STRCAT(&VarIdStr, "[");
1339 _STRCAT(&VarIdStr, I2->getText());
1340 _STRCAT(&VarIdStr, "]");
1341 }
1342 >>
1343 }
1344 )*
1345 << mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask); >>
1346 )
1347 ;
1348
1349 vfrConstantValueField[UINT8 Type] > [EFI_IFR_TYPE_VALUE Value] :
1350 <<
1351 EFI_GUID Guid;
1352 >>
1353 N1:Number <<
1354 switch ($Type) {
1355 case EFI_IFR_TYPE_NUM_SIZE_8 :
1356 $Value.u8 = _STOU8(N1->getText());
1357 break;
1358 case EFI_IFR_TYPE_NUM_SIZE_16 :
1359 $Value.u16 = _STOU16(N1->getText());
1360 break;
1361 case EFI_IFR_TYPE_NUM_SIZE_32 :
1362 $Value.u32 = _STOU32(N1->getText());
1363 break;
1364 case EFI_IFR_TYPE_NUM_SIZE_64 :
1365 $Value.u64 = _STOU64(N1->getText());
1366 break;
1367 case EFI_IFR_TYPE_BOOLEAN :
1368 $Value.b = _STOU8(N1->getText());
1369 break;
1370 case EFI_IFR_TYPE_STRING :
1371 $Value.string = _STOU16(N1->getText());
1372 break;
1373 case EFI_IFR_TYPE_TIME :
1374 case EFI_IFR_TYPE_DATE :
1375 case EFI_IFR_TYPE_REF :
1376 default :
1377 break;
1378 }
1379 >>
1380 | B1:True << $Value.b = TRUE; >>
1381 | B2:False << $Value.b = FALSE; >>
1382 | O1:One << $Value.u8 = _STOU8(O1->getText()); >>
1383 | O2:Ones << $Value.u64 = _STOU64(O2->getText()); >>
1384 | Z:Zero << $Value.u8 = _STOU8(Z->getText()); >>
1385 | HOUR:Number ":" MINUTE:Number ":" SECOND:Number << $Value.time = _STOT(HOUR->getText(), MINUTE->getText(), SECOND->getText()); >>
1386 | YEAR:Number "/" MONTH:Number "/" DAY:Number << $Value.date = _STOD(YEAR->getText(), MONTH->getText(), DAY->getText()); >>
1387 | QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)"
1388 << $Value.ref = _STOR(QI->getText(), FI->getText(), &Guid, DP->getText()); >>
1389 | "STRING_TOKEN" "\(" S1:Number "\)" << $Value.string = _STOSID(S1->getText()); >>
1390 ;
1391
1392 //*****************************************************************************
1393 //
1394 // the syntax of form definition
1395 //
1396 vfrFormDefinition :
1397 << CIfrForm FObj; >>
1398 F:Form << FObj.SetLineNo(F->getLine()); >>
1399 FormId "=" S1:Number "," << _PCATCH(FObj.SetFormId (_STOFID(S1->getText())), S1); >>
1400 Title "=" "STRING_TOKEN" "\(" S2:Number "\)" ";" << FObj.SetFormTitle (_STOSID(S2->getText())); >>
1401 (
1402 vfrStatementImage |
1403 vfrStatementLocked |
1404 vfrStatementRules |
1405 vfrStatementDefault |
1406 vfrStatementStat |
1407 vfrStatementQuestions |
1408 vfrStatementConditional |
1409 vfrStatementLabel |
1410 vfrStatementBanner |
1411 // Just for framework vfr compatibility
1412 vfrStatementInvalid |
1413 vfrStatementExtension |
1414 vfrStatementModal
1415 )*
1416 E:EndForm <<
1417 if (mCompatibleMode) {
1418 //
1419 // Add Label for Framework Vfr
1420 //
1421 CIfrLabel LObj1;
1422 LObj1.SetLineNo(E->getLine());
1423 LObj1.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff
1424 CIfrLabel LObj2;
1425 LObj2.SetLineNo(E->getLine());
1426 LObj2.SetNumber (0x0); //add dummy label for UEFI, label number hardcode 0x0
1427 CIfrLabel LObj3;
1428 LObj3.SetLineNo(E->getLine());
1429 LObj3.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff
1430 }
1431
1432 {CIfrEnd EObj; EObj.SetLineNo (E->getLine()); mLastFormEndAddr = EObj.GetObjBinAddr (); gAdjustOpcodeOffset = EObj.GetObjBinOffset ();}
1433 >>
1434 ";"
1435 ;
1436
1437 vfrFormMapDefinition :
1438 <<
1439 CIfrFormMap *FMapObj = NULL;
1440 UINT32 FormMapMethodNumber = 0;
1441 EFI_GUID Guid;
1442 >>
1443 F:FormMap << FMapObj = new CIfrFormMap(); FMapObj->SetLineNo(F->getLine()); >>
1444 FormId "=" S1:Number "," << _PCATCH(FMapObj->SetFormId (_STOFID(S1->getText())), S1); >>
1445 (
1446 MapTitle "=" "STRING_TOKEN" "\(" S2:Number "\)" ";"
1447 MapGuid "=" guidDefinition[Guid] ";" << FMapObj->SetFormMapMethod (_STOFID(S2->getText()), &Guid); FormMapMethodNumber ++; >>
1448 )* << if (FormMapMethodNumber == 0) {_PCATCH (VFR_RETURN_INVALID_PARAMETER, F->getLine(), "No MapMethod is set for FormMap!");} delete FMapObj;>>
1449 (
1450 vfrStatementImage |
1451 vfrStatementLocked |
1452 vfrStatementRules |
1453 vfrStatementDefault |
1454 vfrStatementStat |
1455 vfrStatementQuestions |
1456 vfrStatementConditional |
1457 vfrStatementLabel |
1458 vfrStatementBanner |
1459 vfrStatementExtension |
1460 vfrStatementModal
1461 )*
1462 E:EndForm << CRT_END_OP (E); >>
1463 ";"
1464 ;
1465
1466 vfrStatementRules :
1467 << CIfrRule RObj; >>
1468 R:Rule << RObj.SetLineNo(R->getLine()); >>
1469 S1:StringIdentifier "," <<
1470 mCVfrRulesDB.RegisterRule (S1->getText());
1471 RObj.SetRuleId (mCVfrRulesDB.GetRuleId(S1->getText()));
1472 >>
1473 vfrStatementExpression[0]
1474 E:EndRule << CRT_END_OP (E); >>
1475 ";"
1476 ;
1477
1478 vfrStatementDefault :
1479 <<
1480 BOOLEAN IsExp = FALSE;
1481 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
1482 CIfrDefault *DObj = NULL;
1483 CIfrDefault2 *DObj2 = NULL;
1484 EFI_DEFAULT_ID DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
1485 CHAR8 *VarStoreName = NULL;
1486 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
1487 UINT32 Size = 0;
1488 EFI_GUID *VarGuid = NULL;
1489 >>
1490 D:Default
1491 (
1492 (
1493 "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] > [Val] ","
1494 <<
1495 if (gCurrentMinMaxData != NULL && gCurrentMinMaxData->IsNumericOpcode()) {
1496 //check default value is valid for Numeric Opcode
1497 if (Val.u64 < gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE()) || Val.u64 > gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE())) {
1498 _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
1499 }
1500 }
1501 if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
1502 _PCATCH (VFR_RETURN_FATAL_ERROR, D->getLine(), "Default data type error.");
1503 Size = sizeof (EFI_IFR_TYPE_VALUE);
1504 } else {
1505 _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &Size), D->getLine());
1506 }
1507 Size += OFFSET_OF (EFI_IFR_DEFAULT, Value);
1508 DObj = new CIfrDefault ((UINT8)Size);
1509 DObj->SetLineNo(D->getLine());
1510 DObj->SetType (_GET_CURRQEST_DATATYPE());
1511 DObj->SetValue(Val);
1512 >>
1513 | << IsExp = TRUE; DObj2 = new CIfrDefault2; DObj2->SetLineNo(D->getLine()); DObj2->SetScope (1); >>
1514 vfrStatementValue "," << CIfrEnd EndObj1; EndObj1.SetLineNo(D->getLine()); >>
1515 )
1516 {
1517 DefaultStore "=" SN:StringIdentifier "," <<
1518 _PCATCH(mCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN);
1519 if (DObj != NULL) {
1520 DObj->SetDefaultId (DefaultId);
1521 }
1522
1523 if (DObj2 != NULL) {
1524 DObj2->SetDefaultId (DefaultId);
1525 }
1526 >>
1527 }
1528 <<
1529 CheckDuplicateDefaultValue (DefaultId, D);
1530 if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
1531 _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), D->getLine());
1532 VarGuid = mCVfrDataStorage.GetVarStoreGuid(_GET_CURRQEST_VARTINFO().mVarStoreId);
1533 VarStoreType = mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
1534 if ((IsExp == FALSE) && (VarStoreType == EFI_VFR_VARSTORE_BUFFER)) {
1535 _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
1536 DefaultId,
1537 _GET_CURRQEST_VARTINFO(),
1538 VarStoreName,
1539 VarGuid,
1540 _GET_CURRQEST_DATATYPE (),
1541 Val),
1542 D->getLine()
1543 );
1544 }
1545 }
1546 if (DObj != NULL) {delete DObj;}
1547 if (DObj2 != NULL) {delete DObj2;}
1548 >>
1549 )
1550 ;
1551
1552 vfrStatementStat :
1553 vfrStatementSubTitle |
1554 vfrStatementStaticText |
1555 vfrStatementCrossReference
1556 ;
1557
1558 vfrStatementQuestions :
1559 vfrStatementBooleanType |
1560 vfrStatementDate |
1561 vfrStatementNumericType |
1562 vfrStatementStringType |
1563 vfrStatementOrderedList |
1564 vfrStatementTime
1565 ;
1566
1567 vfrStatementConditional :
1568 vfrStatementDisableIfStat |
1569 vfrStatementSuppressIfStat | //enhance to be compatible for framework endif
1570 vfrStatementGrayOutIfStat |
1571 vfrStatementInconsistentIfStat //to be compatible for framework
1572 ;
1573
1574 vfrStatementConditionalNew :
1575 vfrStatementDisableIfStat |
1576 vfrStatementSuppressIfStatNew |
1577 vfrStatementGrayOutIfStatNew |
1578 vfrStatementInconsistentIfStat //to be compatible for framework
1579 ;
1580
1581 vfrStatementSuppressIfStat :
1582 <<mCompatibleMode>>? vfrStatementSuppressIfStatOld
1583 | vfrStatementSuppressIfStatNew
1584 ;
1585
1586 vfrStatementGrayOutIfStat :
1587 <<mCompatibleMode>>? vfrStatementGrayOutIfStatOld
1588 | vfrStatementGrayOutIfStatNew
1589 ;
1590
1591 vfrStatementInvalid :
1592 (
1593 vfrStatementInvalidHidden |
1594 vfrStatementInvalidInventory |
1595 vfrStatementInvalidSaveRestoreDefaults
1596 )
1597 << _CRT_OP (TRUE); >>
1598 ;
1599
1600 flagsField :
1601 Number | InteractiveFlag | ManufacturingFlag | DefaultFlag |
1602 NVAccessFlag | ResetRequiredFlag | LateCheckFlag
1603 ;
1604
1605 vfrStatementValue :
1606 << CIfrValue VObj; >>
1607 V:Value << VObj.SetLineNo(V->getLine()); >>
1608 "=" vfrStatementExpression[0] << {CIfrEnd EndObj; EndObj.SetLineNo(V->getLine());} >>
1609 ;
1610
1611 vfrStatementRead :
1612 << CIfrRead RObj; >>
1613 R:Read << RObj.SetLineNo(R->getLine()); >>
1614 vfrStatementExpression[0] ";"
1615 ;
1616
1617 vfrStatementWrite :
1618 << CIfrWrite WObj; >>
1619 W:Write << WObj.SetLineNo(W->getLine()); >>
1620 vfrStatementExpression[0] ";"
1621 ;
1622
1623 vfrStatementSubTitle :
1624 << CIfrSubtitle SObj; >>
1625 L:Subtitle << SObj.SetLineNo(L->getLine()); >>
1626 Text "=" "STRING_TOKEN" "\(" S:Number "\)" << SObj.SetPrompt (_STOSID(S->getText())); >>
1627 {
1628 "," FLAGS "=" vfrSubtitleFlags[SObj]
1629 }
1630 { vfrStatementStatTagList "," }
1631 E:";" << CRT_END_OP (E); >>
1632 ;
1633
1634 vfrSubtitleFlags [CIfrSubtitle & SObj] :
1635 << UINT8 LFlags = 0; >>
1636 subtitleFlagsField[LFlags] ( "\|" subtitleFlagsField[LFlags] )*
1637 << _PCATCH(SObj.SetFlags (LFlags)); >>
1638 ;
1639
1640 subtitleFlagsField [UINT8 & Flags] :
1641 N:Number << $Flags |= _STOU8(N->getText()); >>
1642 | "HORIZONTAL" << $Flags |= 0x01; >>
1643 ;
1644
1645 vfrStatementStaticText :
1646 <<
1647 UINT8 Flags = 0;
1648 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
1649 EFI_STRING_ID TxtTwo = EFI_STRING_ID_INVALID;
1650 >>
1651 T:Text
1652 Help "=" "STRING_TOKEN" "\(" S1:Number "\)" ","
1653 Text "=" "STRING_TOKEN" "\(" S2:Number "\)"
1654 {
1655 "," Text "=" "STRING_TOKEN" "\(" S3:Number "\)" << TxtTwo = _STOSID(S3->getText()); >>
1656 }
1657 {
1658 "," F:FLAGS "=" staticTextFlagsField[Flags] ( "\|" staticTextFlagsField[Flags] )*
1659 "," Key "=" KN:Number
1660 }
1661 <<
1662 if (Flags & EFI_IFR_FLAG_CALLBACK) {
1663 CIfrAction AObj;
1664 mCVfrQuestionDB.RegisterQuestion (NULL, NULL, QId);
1665 AObj.SetLineNo (F->getLine());
1666 AObj.SetQuestionId (QId);
1667 AObj.SetPrompt (_STOSID(S2->getText()));
1668 AObj.SetHelp (_STOSID(S1->getText()));
1669 _PCATCH(AObj.SetFlags (Flags), F->getLine());
1670 AssignQuestionKey (AObj, KN);
1671 CRT_END_OP (KN);
1672 } else {
1673 CIfrText TObj;
1674 TObj.SetLineNo (T->getLine());
1675 TObj.SetHelp (_STOSID(S1->getText()));
1676 TObj.SetPrompt (_STOSID(S2->getText()));
1677 TObj.SetTextTwo (TxtTwo);
1678 }
1679 >>
1680 { "," vfrStatementStatTagList }
1681 ";"
1682 ;
1683
1684 staticTextFlagsField[UINT8 & HFlags] :
1685 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
1686 | questionheaderFlagsField[HFlags]
1687 ;
1688
1689 vfrStatementCrossReference :
1690 vfrStatementGoto |
1691 vfrStatementResetButton
1692 ;
1693
1694 vfrStatementGoto :
1695 <<
1696 UINT8 RefType = 5;
1697 EFI_STRING_ID DevPath = EFI_STRING_ID_INVALID;
1698 EFI_GUID FSId = {0,};
1699 EFI_FORM_ID FId;
1700 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
1701 UINT32 BitMask;
1702 CIfrQuestionHeader *QHObj = NULL;
1703 CIfrOpHeader *OHObj = NULL;
1704 CIfrRef *R1Obj = NULL;
1705 CIfrRef2 *R2Obj = NULL;
1706 CIfrRef3 *R3Obj = NULL;
1707 CIfrRef4 *R4Obj = NULL;
1708 CIfrRef5 *R5Obj = NULL;
1709 >>
1710 G:Goto
1711 {
1712 (
1713 DevicePath "=" "STRING_TOKEN" "\(" P:Number "\)" ","
1714 FormSetGuid "=" guidDefinition[FSId] ","
1715 FormId "=" F1:Number ","
1716 Question "=" QN1:Number ","
1717 <<
1718 RefType = 4;
1719 DevPath = _STOSID(P->getText());
1720 FId = _STOFID(F1->getText());
1721 QId = _STOQID(QN1->getText());
1722 >>
1723 )
1724 |
1725 (
1726 FormSetGuid "=" guidDefinition[FSId] ","
1727 FormId "=" F2:Number ","
1728 Question "=" QN2:Number ","
1729 <<
1730 RefType = 3;
1731 FId = _STOFID(F2->getText());
1732 QId = _STOQID(QN2->getText());
1733 >>
1734 )
1735 |
1736 (
1737 FormId "=" F3:Number "," << RefType = 2; FId = _STOFID(F3->getText()); >>
1738 Question "="
1739 (
1740 QN3:StringIdentifier "," <<
1741 mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask);
1742 if (QId == EFI_QUESTION_ID_INVALID) {
1743 _PCATCH(VFR_RETURN_UNDEFINED, QN3);
1744 }
1745 >>
1746 | QN4:Number "," << QId = _STOQID(QN4->getText()); >>
1747 )
1748 )
1749 |
1750 (
1751 F4:Number "," <<
1752 RefType = 1;
1753 FId = _STOFID(F4->getText());
1754 >>
1755 )
1756 }
1757 <<
1758 switch (RefType) {
1759 case 5:
1760 {
1761 R5Obj = new CIfrRef5;
1762 QHObj = R5Obj;
1763 OHObj = R5Obj;
1764 R5Obj->SetLineNo(G->getLine());
1765 break;
1766 }
1767 case 4:
1768 {
1769 R4Obj = new CIfrRef4;
1770 QHObj = R4Obj;
1771 OHObj = R4Obj;
1772 R4Obj->SetLineNo(G->getLine());
1773 R4Obj->SetDevicePath (DevPath);
1774 R4Obj->SetFormSetId (FSId);
1775 R4Obj->SetFormId (FId);
1776 R4Obj->SetQuestionId (QId);
1777 break;
1778 }
1779 case 3:
1780 {
1781 R3Obj = new CIfrRef3;
1782 QHObj = R3Obj;
1783 OHObj = R3Obj;
1784 R3Obj->SetLineNo(G->getLine());
1785 R3Obj->SetFormSetId (FSId);
1786 R3Obj->SetFormId (FId);
1787 R3Obj->SetQuestionId (QId);
1788 break;
1789 }
1790 case 2:
1791 {
1792 R2Obj = new CIfrRef2;
1793 QHObj = R2Obj;
1794 OHObj = R2Obj;
1795 R2Obj->SetLineNo(G->getLine());
1796 R2Obj->SetFormId (FId);
1797 R2Obj->SetQuestionId (QId);
1798 break;
1799 }
1800 case 1:
1801 {
1802 R1Obj = new CIfrRef;
1803 QHObj = R1Obj;
1804 OHObj = R1Obj;
1805 R1Obj->SetLineNo(G->getLine());
1806 R1Obj->SetFormId (FId);
1807 break;
1808 }
1809 default: break;
1810 }
1811 >>
1812 vfrQuestionHeader[*QHObj, QUESTION_REF] <<
1813 if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
1814 _GET_CURRQEST_VARTINFO().mVarType = EFI_IFR_TYPE_REF;
1815 }
1816 >>
1817 { "," F:FLAGS "=" vfrGotoFlags[QHObj, F->getLine()] }
1818 {
1819 "," Key "=" KN:Number << AssignQuestionKey (*QHObj, KN); >>
1820 }
1821 {
1822 E:","
1823 vfrStatementQuestionOptionList << OHObj->SetScope(1); CRT_END_OP (E);>>
1824 }
1825 ";" << if (R1Obj != NULL) {delete R1Obj;} if (R2Obj != NULL) {delete R2Obj;} if (R3Obj != NULL) {delete R3Obj;} if (R4Obj != NULL) {delete R4Obj;} if (R5Obj != NULL) {delete R5Obj;}>>
1826 ;
1827
1828 vfrGotoFlags [CIfrQuestionHeader *QHObj, UINT32 LineNum] :
1829 << UINT8 HFlags = 0; >>
1830 gotoFlagsField[HFlags] ( "\|" gotoFlagsField[HFlags] )*
1831 << _PCATCH(QHObj->SetFlags (HFlags), LineNum); >>
1832 ;
1833
1834 gotoFlagsField[UINT8 & HFlags] :
1835 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
1836 | questionheaderFlagsField[HFlags]
1837 ;
1838
1839 getStringId :
1840 "STRING_TOKEN" "\("
1841 IdVal:Number
1842 "\)"
1843 ;
1844
1845 vfrStatementResetButton :
1846 <<
1847 CIfrResetButton RBObj;
1848 UINT16 DefaultId;
1849 >>
1850 L:ResetButton << RBObj.SetLineNo(L->getLine()); >>
1851 DefaultStore
1852 "=" N:StringIdentifier "," <<
1853 _PCATCH(mCVfrDefaultStore.GetDefaultId (N->getText(), &DefaultId), N->getLine());
1854 RBObj.SetDefaultId (DefaultId);
1855 >>
1856 vfrStatementHeader[&RBObj] ","
1857 { vfrStatementStatTagList "," }
1858 E:EndResetButton << CRT_END_OP (E); >>
1859 ";"
1860 ;
1861
1862 vfrStatementBooleanType :
1863 vfrStatementCheckBox |
1864 vfrStatementAction
1865 ;
1866
1867 //*****************************************************
1868 // Syntax of checkbox
1869 //
1870 // Example:
1871 // checkbox
1872 // varid = MySTestData.mField1,
1873 // prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
1874 // help = STRING_TOKEN(STR_CHECK_BOX_HELP),
1875 // flags = CHECKBOX_DEFAULT | CALLBACK,
1876 // default value = TRUE, defaultstore = MyDefaultStore,
1877 // endcheckbox;
1878 //
1879 vfrStatementCheckBox :
1880 <<
1881 CIfrCheckBox CBObj;
1882 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
1883 CHAR8 *VarStoreName = NULL;
1884 UINT32 DataTypeSize;
1885 EFI_GUID *VarStoreGuid = NULL;
1886 >>
1887 L:CheckBox << CBObj.SetLineNo(L->getLine()); >>
1888 vfrQuestionHeader[CBObj] "," << //check data type
1889 if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
1890 _GET_CURRQEST_VARTINFO().mVarType = EFI_IFR_TYPE_BOOLEAN;
1891 }
1892 if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
1893 _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "CheckBox varid is not the valid data type");
1894 if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
1895 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid doesn't support array");
1896 } else if ((mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId) == EFI_VFR_VARSTORE_BUFFER) &&
1897 (_GET_CURRQEST_VARSIZE() != sizeof (BOOLEAN))) {
1898 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid only support BOOLEAN data type");
1899 }
1900 }
1901 >>
1902 {
1903 F:FLAGS "=" vfrCheckBoxFlags[CBObj, F->getLine()] ","
1904 <<
1905 if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
1906 _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), VFR_RETURN_SUCCESS, L, "Failed to retrieve varstore name");
1907 VarStoreGuid = mCVfrDataStorage.GetVarStoreGuid(_GET_CURRQEST_VARTINFO().mVarStoreId);
1908 Val.b = TRUE;
1909 if (CBObj.GetFlags () & 0x01) {
1910 CheckDuplicateDefaultValue (EFI_HII_DEFAULT_CLASS_STANDARD, F);
1911 _PCATCH(
1912 mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
1913 EFI_HII_DEFAULT_CLASS_STANDARD,
1914 _GET_CURRQEST_VARTINFO(),
1915 VarStoreName,
1916 VarStoreGuid,
1917 _GET_CURRQEST_DATATYPE (),
1918 Val
1919 ),
1920 VFR_RETURN_SUCCESS,
1921 L,
1922 "No standard default storage found"
1923 );
1924 }
1925 if (CBObj.GetFlags () & 0x02) {
1926 CheckDuplicateDefaultValue (EFI_HII_DEFAULT_CLASS_MANUFACTURING, F);
1927 _PCATCH(
1928 mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
1929 EFI_HII_DEFAULT_CLASS_MANUFACTURING,
1930 _GET_CURRQEST_VARTINFO(),
1931 VarStoreName,
1932 VarStoreGuid,
1933 _GET_CURRQEST_DATATYPE (),
1934 Val
1935 ),
1936 VFR_RETURN_SUCCESS,
1937 L,
1938 "No manufacturing default storage found"
1939 );
1940 }
1941 }
1942 >>
1943 }
1944 {
1945 Key "=" KN:Number "," << AssignQuestionKey (CBObj, KN); >>
1946 }
1947 vfrStatementQuestionOptionList
1948 E:EndCheckBox << CRT_END_OP (E); >>
1949 ";"
1950 ;
1951
1952 vfrCheckBoxFlags [CIfrCheckBox & CBObj, UINT32 LineNum] :
1953 <<
1954 UINT8 LFlags = 0;
1955 UINT8 HFlags = 0;
1956 >>
1957 checkboxFlagsField[LFlags, HFlags] ( "\|" checkboxFlagsField[LFlags, HFlags] )*
1958 << _PCATCH(CBObj.SetFlags (HFlags, LFlags), LineNum); >>
1959 ;
1960
1961 checkboxFlagsField[UINT8 & LFlags, UINT8 & HFlags] :
1962 N:Number <<
1963 if (mCompatibleMode) {
1964 //
1965 // set question flag
1966 //
1967 $LFlags |= _STOU8(N->getText());
1968 } else {
1969 _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine());
1970 }
1971 >>
1972 | D:"DEFAULT" <<
1973 if (mCompatibleMode) {
1974 //
1975 // set question Default flag
1976 //
1977 $LFlags |= 0x01;
1978 } else {
1979 _PCATCH (VFR_RETURN_UNSUPPORTED, D);
1980 }
1981 >>
1982 | M:"MANUFACTURING" <<
1983 if (mCompatibleMode) {
1984 //
1985 // set question MFG flag
1986 //
1987 $LFlags |= 0x02;
1988 } else {
1989 _PCATCH (VFR_RETURN_UNSUPPORTED, M);
1990 }
1991 >>
1992 | "CHECKBOX_DEFAULT" << $LFlags |= 0x01; >>
1993 | "CHECKBOX_DEFAULT_MFG" << $LFlags |= 0x02; >>
1994 | questionheaderFlagsField[HFlags]
1995 ;
1996
1997 //*****************************************************
1998 // Syntax of action
1999 //
2000 // Example:
2001 // action
2002 // prompt = STRING_TOKEN(STR_ACTION_PROMPT),
2003 // help = STRING_TOKEN(STR_ACTION_HELP),
2004 // flags = CALLBACK,
2005 // config = STRING_TOKEN(STR_ACTION_CONFIG),
2006 // endaction;
2007 //
2008 vfrStatementAction :
2009 << CIfrAction AObj; >>
2010 L:Action << AObj.SetLineNo(L->getLine()); >>
2011 vfrQuestionHeader[AObj] ","
2012 { F:FLAGS "=" vfrActionFlags[AObj, F->getLine()] "," }
2013 Config "=" "STRING_TOKEN" "\(" S:Number "\)" "," << AObj.SetQuestionConfig (_STOSID(S->getText())); >>
2014 vfrStatementQuestionTagList
2015 E:EndAction << CRT_END_OP (E); >>
2016 ";"
2017 ;
2018
2019 vfrActionFlags[CIfrAction & AObj, UINT32 LineNum] :
2020 << UINT8 HFlags = 0; >>
2021 actionFlagsField[HFlags] ( "\|" actionFlagsField[HFlags] )*
2022 << _PCATCH(AObj.SetFlags (HFlags), LineNum); >>
2023 ;
2024
2025 actionFlagsField[UINT8 & HFlags] :
2026 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
2027 | questionheaderFlagsField[HFlags]
2028 ;
2029
2030 vfrStatementDate :
2031 <<
2032 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
2033 CHAR8 *VarIdStr[3] = {NULL, };
2034 CIfrDate DObj;
2035 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
2036 UINT8 Size = OFFSET_OF (EFI_IFR_DEFAULT, Value) + sizeof (EFI_HII_DATE);
2037 >>
2038 L:Date << DObj.SetLineNo(L->getLine()); >>
2039 (
2040 (
2041 vfrQuestionHeader[DObj, QUESTION_DATE] "," <<
2042 if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
2043 _GET_CURRQEST_VARTINFO().mVarType = EFI_IFR_TYPE_DATE;
2044 }
2045 >>
2046 { F:FLAGS "=" vfrDateFlags[DObj, F->getLine()] "," }
2047 vfrStatementQuestionOptionList
2048 )
2049 |
2050 (
2051 Year VarId "=" D1:StringIdentifier "." D1Y:StringIdentifier ","
2052 << _STRCAT(&VarIdStr[0], D1->getText()); _STRCAT(&VarIdStr[0], "."); _STRCAT(&VarIdStr[0], D1Y->getText()); >>
2053 Prompt "=" "STRING_TOKEN" "\(" YP:Number "\)" ","
2054 Help "=" "STRING_TOKEN" "\(" YH:Number "\)" ","
2055 minMaxDateStepDefault[Val.date, 0]
2056
2057 Month VarId "=" D2:StringIdentifier "." D2M:StringIdentifier ","
2058 << _STRCAT(&VarIdStr[1], D2->getText()); _STRCAT(&VarIdStr[1], "."); _STRCAT(&VarIdStr[1], D2M->getText()); >>
2059 Prompt "=" "STRING_TOKEN" "\(" MP:Number "\)" ","
2060 Help "=" "STRING_TOKEN" "\(" MH:Number "\)" ","
2061 minMaxDateStepDefault[Val.date, 1]
2062
2063 Day VarId "=" D3:StringIdentifier "." D3D:StringIdentifier ","
2064 << _STRCAT(&VarIdStr[2], D3->getText()); _STRCAT(&VarIdStr[2], "."); _STRCAT(&VarIdStr[2], D3D->getText()); >>
2065 Prompt "=" "STRING_TOKEN" "\(" DP:Number "\)" ","
2066 Help "=" "STRING_TOKEN" "\(" DH:Number "\)" ","
2067 minMaxDateStepDefault[Val.date, 2]
2068 { G:FLAGS "=" vfrDateFlags[DObj, G->getLine()] "," }
2069 <<
2070 mCVfrQuestionDB.RegisterOldDateQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId);
2071 DObj.SetQuestionId (QId);
2072 DObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_DATE_STORAGE_TIME);
2073 DObj.SetPrompt (_STOSID(YP->getText()));
2074 DObj.SetHelp (_STOSID(YH->getText()));
2075 if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }
2076 >>
2077 << {CIfrDefault DefaultObj(Size, EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_DATE, Val); DefaultObj.SetLineNo(L->getLine());} >>
2078 )
2079 ( vfrStatementInconsistentIf )*
2080 )
2081 E:EndDate << CRT_END_OP (E); >>
2082 ";"
2083 ;
2084
2085 minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
2086 Minimum "=" MinN:Number ","
2087 Maximum "=" MaxN:Number ","
2088 { "step" "=" Number "," }
2089 {
2090 "default" "=" N:Number "," <<
2091 switch (KeyValue) {
2092 case 0:
2093 D.Year = _STOU16(N->getText());
2094 if (D.Year < _STOU16 (MinN->getText()) || D.Year > _STOU16 (MaxN->getText())) {
2095 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value must be between Min year and Max year.");
2096 }
2097 break;
2098 case 1:
2099 D.Month = _STOU8(N->getText());
2100 if (D.Month < 1 || D.Month > 12) {
2101 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value must be between 1 and 12.");
2102 }
2103 break;
2104 case 2:
2105 D.Day = _STOU8(N->getText());
2106 if (D.Day < 1 || D.Day > 31) {
2107 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value must be between 1 and 31.");
2108 }
2109 break;
2110 }
2111 >>
2112 }
2113 ;
2114
2115 vfrDateFlags [CIfrDate & DObj, UINT32 LineNum] :
2116 << UINT8 LFlags = 0; >>
2117 dateFlagsField[LFlags] ( "\|" dateFlagsField[LFlags] )*
2118 << _PCATCH(DObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, LFlags), LineNum); >>
2119 ;
2120
2121 dateFlagsField [UINT8 & Flags] :
2122 N:Number << $Flags |= _STOU8(N->getText()); >>
2123 | "YEAR_SUPPRESS" << $Flags |= 0x01; >>
2124 | "MONTH_SUPPRESS" << $Flags |= 0x02; >>
2125 | "DAY_SUPPRESS" << $Flags |= 0x04; >>
2126 | "STORAGE_NORMAL" << $Flags |= 0x00; >>
2127 | "STORAGE_TIME" << $Flags |= 0x10; >>
2128 | "STORAGE_WAKEUP" << $Flags |= 0x20; >>
2129 ;
2130
2131 vfrStatementNumericType :
2132 vfrStatementNumeric |
2133 vfrStatementOneOf
2134 ;
2135
2136 vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
2137 <<
2138 UINT64 MaxU8 = 0, MinU8 = 0, StepU8 = 0;
2139 UINT32 MaxU4 = 0, MinU4 = 0, StepU4 = 0;
2140 UINT16 MaxU2 = 0, MinU2 = 0, StepU2 = 0;
2141 UINT8 MaxU1 = 0, MinU1 = 0, StepU1 = 0;
2142 >>
2143 Minimum "=" I:Number ","
2144 <<
2145 switch (_GET_CURRQEST_DATATYPE()) {
2146 case EFI_IFR_TYPE_NUM_SIZE_64 : MinU8 = _STOU64(I->getText()); break;
2147 case EFI_IFR_TYPE_NUM_SIZE_32 : MinU4 = _STOU32(I->getText()); break;
2148 case EFI_IFR_TYPE_NUM_SIZE_16 : MinU2 = _STOU16(I->getText()); break;
2149 case EFI_IFR_TYPE_NUM_SIZE_8 : MinU1 = _STOU8(I->getText()); break;
2150 }
2151 >>
2152 Maximum "=" A:Number ","
2153 <<
2154 switch (_GET_CURRQEST_DATATYPE()) {
2155 case EFI_IFR_TYPE_NUM_SIZE_64 :
2156 MaxU8 = _STOU64(A->getText());
2157 if (MaxU8 < MinU8) {
2158 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
2159 }
2160 break;
2161 case EFI_IFR_TYPE_NUM_SIZE_32 :
2162 MaxU4 = _STOU32(A->getText());
2163 if (MaxU4 < MinU4) {
2164 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
2165 }
2166 break;
2167 case EFI_IFR_TYPE_NUM_SIZE_16 :
2168 MaxU2 = _STOU16(A->getText());
2169 if (MaxU2 < MinU2) {
2170 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
2171 }
2172 break;
2173 case EFI_IFR_TYPE_NUM_SIZE_8 :
2174 MaxU1 = _STOU8(A->getText());
2175 if (MaxU1 < MinU1) {
2176 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
2177 }
2178 break;
2179 }
2180 >>
2181 {
2182 STEP "=" S:Number ","
2183 <<
2184 switch (_GET_CURRQEST_DATATYPE()) {
2185 case EFI_IFR_TYPE_NUM_SIZE_64 : StepU8 = _STOU64(S->getText()); break;
2186 case EFI_IFR_TYPE_NUM_SIZE_32 : StepU4 = _STOU32(S->getText()); break;
2187 case EFI_IFR_TYPE_NUM_SIZE_16 : StepU2 = _STOU16(S->getText()); break;
2188 case EFI_IFR_TYPE_NUM_SIZE_8 : StepU1 = _STOU8(S->getText()); break;
2189 }
2190 >>
2191 }
2192 <<
2193 switch (_GET_CURRQEST_DATATYPE()) {
2194 case EFI_IFR_TYPE_NUM_SIZE_64 : $MMSDObj.SetMinMaxStepData (MinU8, MaxU8, StepU8); break;
2195 case EFI_IFR_TYPE_NUM_SIZE_32 : $MMSDObj.SetMinMaxStepData (MinU4, MaxU4, StepU4); break;
2196 case EFI_IFR_TYPE_NUM_SIZE_16 : $MMSDObj.SetMinMaxStepData (MinU2, MaxU2, StepU2); break;
2197 case EFI_IFR_TYPE_NUM_SIZE_8 : $MMSDObj.SetMinMaxStepData (MinU1, MaxU1, StepU1); break;
2198 }
2199 >>
2200 ;
2201
2202 vfrStatementNumeric :
2203 <<
2204 CIfrNumeric NObj;
2205 UINT32 DataTypeSize;
2206 BOOLEAN IsSupported = TRUE;
2207 UINT8 ShrinkSize = 0;
2208 >>
2209 L:Numeric << NObj.SetLineNo(L->getLine()); >>
2210 vfrQuestionHeader[NObj] "," << // check data type
2211 if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
2212 _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "Numeric varid is not the valid data type");
2213 if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
2214 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric varid doesn't support array");
2215 }
2216 _PCATCH(NObj.SetFlags (NObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());
2217 }
2218 >>
2219 { F:FLAGS "=" vfrNumericFlags[NObj, F->getLine()] "," }
2220 {
2221 Key "=" KN:Number "," << AssignQuestionKey (NObj, KN); >>
2222 }
2223 vfrSetMinMaxStep[NObj] <<
2224 switch (_GET_CURRQEST_DATATYPE()) {
2225 //
2226 // Base on the type to know the actual used size,shrink the buffer
2227 // size allocate before.
2228 //
2229 case EFI_IFR_TYPE_NUM_SIZE_8: ShrinkSize = 21;break;
2230 case EFI_IFR_TYPE_NUM_SIZE_16:ShrinkSize = 18;break;
2231 case EFI_IFR_TYPE_NUM_SIZE_32:ShrinkSize = 12;break;
2232 case EFI_IFR_TYPE_NUM_SIZE_64:break;
2233 default:
2234 IsSupported = FALSE;
2235 break;
2236 }
2237 NObj.ShrinkBinSize (ShrinkSize);
2238 if (!IsSupported) {
2239 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric question only support UINT8, UINT16, UINT32 and UINT64 data type.");
2240 }
2241 >>
2242 vfrStatementQuestionOptionList
2243 E:EndNumeric <<
2244 CRT_END_OP (E);
2245 >>
2246 ";"
2247 ;
2248
2249 vfrNumericFlags [CIfrNumeric & NObj, UINT32 LineNum] :
2250 <<
2251 UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;
2252 UINT8 HFlags = 0;
2253 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
2254 BOOLEAN IsSetType = FALSE;
2255 >>
2256 numericFlagsField[HFlags, LFlags, IsSetType] ( "\|" numericFlagsField[HFlags, LFlags, IsSetType] )*
2257 <<
2258 //check data type flag
2259 if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
2260 VarStoreType = mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
2261 if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {
2262 if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {
2263 _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");
2264 }
2265 } else {
2266 // update data type for name/value store
2267 UINT32 DataTypeSize;
2268 _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
2269 gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);
2270 _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;
2271 }
2272 } else if (IsSetType){
2273 _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
2274 }
2275 _PCATCH(NObj.SetFlags (HFlags, LFlags), LineNum);
2276 >>
2277 ;
2278
2279 numericFlagsField [UINT8 & HFlags, UINT8 & LFlags, BOOLEAN & IsSetType] :
2280 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
2281 | "NUMERIC_SIZE_1" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_1; IsSetType = TRUE;>>
2282 | "NUMERIC_SIZE_2" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_2; IsSetType = TRUE;>>
2283 | "NUMERIC_SIZE_4" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_4; IsSetType = TRUE;>>
2284 | "NUMERIC_SIZE_8" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_8; IsSetType = TRUE;>>
2285 | "DISPLAY_INT_DEC" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_INT_DEC; >>
2286 | "DISPLAY_UINT_DEC" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_DEC; >>
2287 | "DISPLAY_UINT_HEX" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_HEX; >>
2288 | questionheaderFlagsField[HFlags]
2289 ;
2290
2291 vfrStatementOneOf :
2292 <<
2293 CIfrOneOf OObj;
2294 UINT32 DataTypeSize;
2295 BOOLEAN IsSupported = TRUE;
2296 UINT8 ShrinkSize = 0;
2297 >>
2298 L:OneOf << OObj.SetLineNo(L->getLine()); >>
2299 vfrQuestionHeader[OObj] "," << //check data type
2300 if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
2301 _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "OneOf varid is not the valid data type");
2302 if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
2303 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf varid doesn't support array");
2304 }
2305 _PCATCH(OObj.SetFlags (OObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());
2306 }
2307 >>
2308 { F:FLAGS "=" vfrOneofFlagsField[OObj, F->getLine()] "," }
2309 {
2310 vfrSetMinMaxStep[OObj]
2311 }
2312 <<
2313 switch (_GET_CURRQEST_DATATYPE()) {
2314 //
2315 // Base on the type to know the actual used size,shrink the buffer
2316 // size allocate before.
2317 //
2318 case EFI_IFR_TYPE_NUM_SIZE_8: ShrinkSize = 21;break;
2319 case EFI_IFR_TYPE_NUM_SIZE_16:ShrinkSize = 18;break;
2320 case EFI_IFR_TYPE_NUM_SIZE_32:ShrinkSize = 12;break;
2321 case EFI_IFR_TYPE_NUM_SIZE_64:break;
2322 default:
2323 IsSupported = FALSE;
2324 break;
2325 }
2326 OObj.ShrinkBinSize (ShrinkSize);
2327 if (!IsSupported) {
2328 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf question only support UINT8, UINT16, UINT32 and UINT64 data type.");
2329 }
2330 >>
2331 vfrStatementQuestionOptionList
2332 E:EndOneOf <<
2333 CRT_END_OP (E);
2334 >>
2335 ";"
2336 ;
2337
2338 vfrOneofFlagsField [CIfrOneOf & OObj, UINT32 LineNum] :
2339 <<
2340 UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;
2341 UINT8 HFlags = 0;
2342 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
2343 BOOLEAN IsSetType = FALSE;
2344 >>
2345 numericFlagsField[HFlags, LFlags, IsSetType] ( "\|" numericFlagsField[HFlags, LFlags, IsSetType] )*
2346 <<
2347 //check data type flag
2348 if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
2349 VarStoreType = mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
2350 if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {
2351 if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {
2352 _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");
2353 }
2354 } else {
2355 // update data type for Name/Value store
2356 UINT32 DataTypeSize;
2357 _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
2358 gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);
2359 _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;
2360 }
2361 } else if (IsSetType){
2362 _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
2363 }
2364 _PCATCH(OObj.SetFlags (HFlags, LFlags), LineNum);
2365 >>
2366 ;
2367
2368 vfrStatementStringType :
2369 vfrStatementString |
2370 vfrStatementPassword
2371 ;
2372
2373 vfrStatementString :
2374 <<
2375 CIfrString SObj;
2376 UINT32 VarArraySize;
2377 UINT8 StringMinSize;
2378 UINT8 StringMaxSize;
2379 >>
2380 L:String << SObj.SetLineNo(L->getLine()); >>
2381 vfrQuestionHeader[SObj] ","
2382 { F:FLAGS "=" vfrStringFlagsField[SObj, F->getLine()] "," }
2383 {
2384 Key "=" KN:Number "," << AssignQuestionKey (SObj, KN); >>
2385 }
2386 MinSize "=" MIN:Number "," <<
2387 VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
2388 StringMinSize = _STOU8(MIN->getText());
2389 if (_STOU64(MIN->getText()) > StringMinSize) {
2390 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "String MinSize takes only one byte, which can't be larger than 0xFF.");
2391 } else if (VarArraySize != 0 && StringMinSize > VarArraySize) {
2392 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "String MinSize can't be larger than the max number of elements in string array.");
2393 }
2394 SObj.SetMinSize (StringMinSize);
2395 >>
2396 MaxSize "=" MAX:Number "," <<
2397 StringMaxSize = _STOU8(MAX->getText());
2398 if (_STOU64(MAX->getText()) > StringMaxSize) {
2399 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize takes only one byte, which can't be larger than 0xFF.");
2400 } else if (VarArraySize != 0 && StringMaxSize > VarArraySize) {
2401 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize can't be larger than the max number of elements in string array.");
2402 } else if (StringMaxSize < StringMinSize) {
2403 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize can't be less than String MinSize.");
2404 }
2405 SObj.SetMaxSize (StringMaxSize);
2406 >>
2407 vfrStatementQuestionOptionList
2408 E:EndString << CRT_END_OP (E); >>
2409 ";"
2410 ;
2411
2412 vfrStringFlagsField [CIfrString & SObj, UINT32 LineNum] :
2413 <<
2414 UINT8 LFlags = 0;
2415 UINT8 HFlags = 0;
2416 >>
2417 stringFlagsField[HFlags, LFlags] ( "\|" stringFlagsField[HFlags, LFlags] )*
2418 << _PCATCH(SObj.SetFlags (HFlags, LFlags), LineNum); >>
2419 ;
2420
2421 stringFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
2422 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
2423 | "MULTI_LINE" << $LFlags = 0x01; >>
2424 | questionheaderFlagsField[HFlags]
2425 ;
2426
2427 vfrStatementPassword :
2428 <<
2429 CIfrPassword PObj;
2430 UINT32 VarArraySize;
2431 UINT16 PasswordMinSize;
2432 UINT16 PasswordMaxSize;
2433 >>
2434 L:Password << PObj.SetLineNo(L->getLine()); >>
2435 vfrQuestionHeader[PObj] ","
2436 { F:FLAGS "=" vfrPasswordFlagsField[PObj, F->getLine()] "," }
2437 {
2438 Key "=" KN:Number "," << AssignQuestionKey (PObj, KN); >>
2439 }
2440 MinSize "=" MIN:Number "," <<
2441 VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
2442 PasswordMinSize = _STOU16(MIN->getText());
2443 if (_STOU64(MIN->getText()) > PasswordMinSize) {
2444 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "Password MinSize takes only two byte, which can't be larger than 0xFFFF.");
2445 } else if (VarArraySize != 0 && PasswordMinSize > VarArraySize) {
2446 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "Password MinSize can't be larger than the max number of elements in password array.");
2447 }
2448 PObj.SetMinSize (PasswordMinSize);
2449 >>
2450 MaxSize "=" MAX:Number "," <<
2451 PasswordMaxSize = _STOU16(MAX->getText());
2452 if (_STOU64(MAX->getText()) > PasswordMaxSize) {
2453 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize takes only two byte, which can't be larger than 0xFFFF.");
2454 } else if (VarArraySize != 0 && PasswordMaxSize > VarArraySize) {
2455 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize can't be larger than the max number of elements in password array.");
2456 } else if (PasswordMaxSize < PasswordMinSize) {
2457 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize can't be less than Password MinSize.");
2458 }
2459 PObj.SetMaxSize (PasswordMaxSize);
2460 >>
2461 { Encoding "=" Number "," }
2462 vfrStatementQuestionOptionList
2463 E:EndPassword << CRT_END_OP (E); >>
2464 ";"
2465 ;
2466
2467 vfrPasswordFlagsField [CIfrPassword & PObj, UINT32 LineNum] :
2468 << UINT8 HFlags = 0; >>
2469 passwordFlagsField[HFlags] ( "\|" passwordFlagsField[HFlags] )*
2470 << _PCATCH(PObj.SetFlags(HFlags), LineNum); >>
2471 ;
2472
2473 passwordFlagsField [UINT8 & HFlags] :
2474 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
2475 | questionheaderFlagsField[HFlags]
2476 ;
2477
2478 vfrStatementOrderedList :
2479 <<
2480 CIfrOrderedList OLObj;
2481 UINT32 VarArraySize;
2482 >>
2483 L:OrderedList << OLObj.SetLineNo(L->getLine()); >>
2484 vfrQuestionHeader[OLObj] ","
2485 <<
2486 VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
2487 OLObj.SetMaxContainers ((UINT8) (VarArraySize > 0xFF ? 0xFF : VarArraySize));
2488 >>
2489 {
2490 MaxContainers "=" M:Number "," <<
2491 if (_STOU64(M->getText()) > _STOU8(M->getText())) {
2492 _PCATCH (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList MaxContainers takes only one byte, which can't be larger than 0xFF.");
2493 } else if (VarArraySize != 0 && _STOU8(M->getText()) > VarArraySize) {
2494 _PCATCH (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList MaxContainers can't be larger than the max number of elements in array.");
2495 }
2496 OLObj.SetMaxContainers (_STOU8(M->getText()));
2497 >>
2498 }
2499 { F:FLAGS "=" vfrOrderedListFlags[OLObj, F->getLine()] }
2500 vfrStatementQuestionOptionList
2501 E:EndList << CRT_END_OP (E); >>
2502 ";"
2503 ;
2504
2505 vfrOrderedListFlags [CIfrOrderedList & OLObj, UINT32 LineNum] :
2506 <<
2507 UINT8 HFlags = 0;
2508 UINT8 LFlags = 0;
2509 >>
2510 orderedlistFlagsField[HFlags, LFlags] ( "\|" orderedlistFlagsField[HFlags, LFlags] )*
2511 << _PCATCH(OLObj.SetFlags (HFlags, LFlags), LineNum); >>
2512 ;
2513
2514 orderedlistFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
2515 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
2516 | "UNIQUE" << $LFlags |= 0x01; >>
2517 | "NOEMPTY" << $LFlags |= 0x02; >>
2518 | questionheaderFlagsField[HFlags]
2519 ;
2520
2521 vfrStatementTime :
2522 <<
2523 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
2524 CHAR8 *VarIdStr[3] = {NULL, };
2525 CIfrTime TObj;
2526 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
2527 UINT8 Size = OFFSET_OF (EFI_IFR_DEFAULT, Value) + sizeof (EFI_HII_TIME);
2528 >>
2529 L:Time << TObj.SetLineNo(L->getLine()); >>
2530 (
2531 (
2532 vfrQuestionHeader[TObj, QUESTION_TIME] "," <<
2533 if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
2534 _GET_CURRQEST_VARTINFO().mVarType = EFI_IFR_TYPE_TIME;
2535 }
2536 >>
2537 { F:FLAGS "=" vfrTimeFlags[TObj, F->getLine()] "," }
2538 vfrStatementQuestionOptionList
2539 )
2540 |
2541 (
2542 Hour VarId "=" T1:StringIdentifier "." T1H:StringIdentifier ","
2543 << _STRCAT(&VarIdStr[0], T1->getText()); _STRCAT(&VarIdStr[0], "."); _STRCAT(&VarIdStr[0], T1H->getText()); >>
2544 Prompt "=" "STRING_TOKEN" "\(" HP:Number "\)" ","
2545 Help "=" "STRING_TOKEN" "\(" HH:Number "\)" ","
2546 minMaxTimeStepDefault[Val.time, 0]
2547
2548 Minute VarId "=" T2:StringIdentifier "." T2M:StringIdentifier ","
2549 << _STRCAT(&VarIdStr[1], T2->getText()); _STRCAT(&VarIdStr[1], "."); _STRCAT(&VarIdStr[1], T2M->getText()); >>
2550 Prompt "=" "STRING_TOKEN" "\(" MP:Number "\)" ","
2551 Help "=" "STRING_TOKEN" "\(" MH:Number "\)" ","
2552 minMaxTimeStepDefault[Val.time, 1]
2553
2554 Second VarId "=" T3:StringIdentifier "." T3S:StringIdentifier ","
2555 << _STRCAT(&VarIdStr[2], T3->getText()); _STRCAT(&VarIdStr[2], "."); _STRCAT(&VarIdStr[2], T3S->getText()); >>
2556 Prompt "=" "STRING_TOKEN" "\(" SP:Number "\)" ","
2557 Help "=" "STRING_TOKEN" "\(" SH:Number "\)" ","
2558 minMaxTimeStepDefault[Val.time, 2]
2559 { G:FLAGS "=" vfrTimeFlags[TObj, G->getLine()] "," }
2560 <<
2561 mCVfrQuestionDB.RegisterOldTimeQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId);
2562 TObj.SetQuestionId (QId);
2563 TObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_TIME_STORAGE_TIME);
2564 TObj.SetPrompt (_STOSID(HP->getText()));
2565 TObj.SetHelp (_STOSID(HH->getText()));
2566 if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }
2567 >>
2568 << {CIfrDefault DefaultObj(Size, EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_TIME, Val); DefaultObj.SetLineNo(L->getLine());} >>
2569 )
2570 ( vfrStatementInconsistentIf )*
2571 )
2572 E:EndTime << CRT_END_OP (E); >>
2573 ";"
2574 ;
2575
2576 minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :
2577 Minimum "=" Number ","
2578 Maximum "=" Number ","
2579 { "step" "=" Number "," }
2580 {
2581 "default" "=" N:Number "," <<
2582 switch (KeyValue) {
2583 case 0:
2584 T.Hour = _STOU8(N->getText());
2585 if (T.Hour > 23) {
2586 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value must be between 0 and 23.");
2587 }
2588 break;
2589 case 1:
2590 T.Minute = _STOU8(N->getText());
2591 if (T.Minute > 59) {
2592 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value must be between 0 and 59.");
2593 }
2594 break;
2595 case 2:
2596 T.Second = _STOU8(N->getText());
2597 if (T.Second > 59) {
2598 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value must be between 0 and 59.");
2599 }
2600 break;
2601 }
2602 >>
2603 }
2604 ;
2605
2606 vfrTimeFlags [CIfrTime & TObj, UINT32 LineNum] :
2607 << UINT8 LFlags = 0; >>
2608 timeFlagsField[LFlags] ( "\|" timeFlagsField[LFlags] )*
2609 << _PCATCH(TObj.SetFlags(EFI_IFR_QUESTION_FLAG_DEFAULT, LFlags), LineNum); >>
2610 ;
2611
2612 timeFlagsField [UINT8 & Flags] :
2613 N:Number << $Flags |= _STOU8(N->getText()); >>
2614 | "HOUR_SUPPRESS" << $Flags |= 0x01; >>
2615 | "MINUTE_SUPPRESS" << $Flags |= 0x02; >>
2616 | "SECOND_SUPPRESS" << $Flags |= 0x04; >>
2617 | "STORAGE_NORMAL" << $Flags |= 0x00; >>
2618 | "STORAGE_TIME" << $Flags |= 0x10; >>
2619 | "STORAGE_WAKEUP" << $Flags |= 0x20; >>
2620 ;
2621
2622 vfrStatementQuestionTag :
2623 vfrStatementStatTag "," |
2624 vfrStatementInconsistentIf |
2625 vfrStatementNoSubmitIf |
2626 vfrStatementDisableIfQuest |
2627 vfrStatementRefresh |
2628 vfrStatementVarstoreDevice |
2629 vfrStatementExtension |
2630 vfrStatementRefreshEvent
2631 ;
2632
2633 vfrStatementQuestionTagList :
2634 ( vfrStatementQuestionTag )*
2635 ;
2636
2637 vfrStatementQuestionOptionTag :
2638 vfrStatementSuppressIfQuest |
2639 vfrStatementGrayOutIfQuest |
2640 vfrStatementValue |
2641 vfrStatementDefault |
2642 vfrStatementRead |
2643 vfrStatementWrite |
2644 vfrStatementOptions
2645 ;
2646
2647 vfrStatementQuestionOptionList :
2648 (
2649 vfrStatementQuestionTag |
2650 vfrStatementQuestionOptionTag
2651 )*
2652 ;
2653
2654 vfrStatementStatList :
2655 vfrStatementStat |
2656 vfrStatementQuestions |
2657 vfrStatementConditionalNew |
2658 vfrStatementLabel |
2659 vfrStatementExtension |
2660 // Just for framework vfr compatibility
2661 vfrStatementInvalid
2662 ;
2663
2664 vfrStatementStatListOld :
2665 vfrStatementStat |
2666 vfrStatementQuestions |
2667 vfrStatementLabel |
2668 // Just for framework vfr compatibility
2669 vfrStatementInvalid
2670 ;
2671
2672 vfrStatementDisableIfStat :
2673 <<
2674 CIfrDisableIf DIObj;
2675 >>
2676 L:DisableIf << DIObj.SetLineNo(L->getLine()); >>
2677 vfrStatementExpression[0] ";"
2678 ( vfrStatementStatList )*
2679 E:EndIf << CRT_END_OP (E); >>
2680 ";"
2681 ;
2682
2683 vfrStatementInconsistentIfStat :
2684 << CIfrInconsistentIf IIObj; >>
2685 L:InconsistentIf <<
2686 if (!mCompatibleMode) {
2687 _PCATCH (VFR_RETURN_UNSUPPORTED, L);
2688 }
2689 IIObj.SetLineNo(L->getLine());
2690 >>
2691 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << IIObj.SetError (_STOSID(S->getText())); >>
2692 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2693 vfrStatementExpression[0]
2694 E:EndIf << CRT_END_OP (E); >>
2695 ";"
2696 ;
2697
2698 //
2699 // Compatible for framework vfr file
2700 //
2701 vfrStatementgrayoutIfSuppressIf:
2702 << CIfrSuppressIf SIObj; >>
2703 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>
2704 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2705 vfrStatementExpression[0]
2706 ";"
2707 ;
2708
2709 vfrStatementsuppressIfGrayOutIf:
2710 << CIfrGrayOutIf GOIObj; >>
2711 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>
2712 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2713 vfrStatementExpression[0]
2714 ";"
2715 ;
2716
2717 vfrStatementSuppressIfStatNew :
2718 << CIfrSuppressIf SIObj;>>
2719 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>
2720 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2721 vfrStatementExpression[0]
2722 ";"
2723 ( vfrStatementStatList )*
2724 E: EndIf ";" << CRT_END_OP (E); >>
2725 ;
2726
2727 vfrStatementGrayOutIfStatNew :
2728 << CIfrGrayOutIf GOIObj;>>
2729 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>
2730 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2731 vfrStatementExpression[0]
2732 ";"
2733 ( vfrStatementStatList )*
2734 E: EndIf ";" << CRT_END_OP (E); >>
2735 ;
2736
2737 vfrStatementSuppressIfStatOld :
2738 <<
2739 CIfrSuppressIf SIObj;
2740 BOOLEAN GrayOutExist = FALSE;
2741 >>
2742 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>
2743 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2744 vfrStatementExpression[0]
2745 ";"
2746 {
2747 vfrStatementsuppressIfGrayOutIf
2748 << GrayOutExist = TRUE; >>
2749 }
2750 ( vfrStatementStatListOld )*
2751 E: EndIf ";" << if (GrayOutExist) CRT_END_OP (E); CRT_END_OP (E);>>
2752 ;
2753
2754 vfrStatementGrayOutIfStatOld :
2755 <<
2756 CIfrGrayOutIf GOIObj;
2757 BOOLEAN SuppressExist = FALSE;
2758 >>
2759 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>
2760 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2761 vfrStatementExpression[0]
2762 ";"
2763 {
2764 vfrStatementgrayoutIfSuppressIf
2765 << SuppressExist = TRUE; >>
2766 }
2767 ( vfrStatementStatListOld )*
2768 E: EndIf ";" << if (SuppressExist) CRT_END_OP (E); CRT_END_OP (E); >>
2769 ;
2770
2771 vfrImageTag :
2772 << CIfrImage IObj; >>
2773 L:Image "=" "IMAGE_TOKEN" "\(" S1:Number "\)" << IObj.SetImageId (_STOSID(S1->getText())); IObj.SetLineNo(L->getLine()); >>
2774 ;
2775
2776 vfrLockedTag :
2777 << CIfrLocked LObj; >>
2778 L:Locked << LObj.SetLineNo(L->getLine()); >>
2779 ;
2780
2781 vfrModalTag :
2782 << CIfrModal MObj; >>
2783 L:Modal << MObj.SetLineNo(L->getLine()); >>
2784 ;
2785
2786 vfrStatementStatTag :
2787 vfrImageTag |
2788 vfrLockedTag
2789 ;
2790
2791 vfrStatementStatTagList :
2792 vfrStatementStatTag ( "," vfrStatementStatTag )*
2793 ;
2794
2795 vfrStatementImage :
2796 vfrImageTag
2797 ";"
2798 ;
2799
2800 vfrStatementModal :
2801 vfrModalTag
2802 ";"
2803 ;
2804
2805 vfrStatementLocked :
2806 vfrLockedTag
2807 ";"
2808 ;
2809
2810 vfrStatementInconsistentIf :
2811 << CIfrInconsistentIf IIObj; >>
2812 L:InconsistentIf << IIObj.SetLineNo(L->getLine()); >>
2813 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << IIObj.SetError (_STOSID(S->getText())); >>
2814 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2815 vfrStatementExpression[0]
2816 E:EndIf << CRT_END_OP (E); >>
2817 ;
2818
2819 vfrStatementNoSubmitIf :
2820 << CIfrNoSubmitIf NSIObj; >>
2821 L:NoSubmitIf << NSIObj.SetLineNo(L->getLine()); >>
2822 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << NSIObj.SetError (_STOSID(S->getText())); >>
2823 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2824 vfrStatementExpression[0]
2825 E:EndIf << CRT_END_OP (E); >>
2826 ;
2827
2828 vfrStatementDisableIfQuest :
2829 <<
2830 CIfrDisableIf DIObj;
2831 >>
2832 L:DisableIf << DIObj.SetLineNo(L->getLine()); >>
2833 vfrStatementExpression[0] ";"
2834 vfrStatementQuestionOptionList
2835 E:EndIf << CRT_END_OP (E); >>
2836 ;
2837
2838 vfrStatementRefresh :
2839 << CIfrRefresh RObj; >>
2840 L:Refresh << RObj.SetLineNo(L->getLine()); >>
2841 Interval "=" I:Number << RObj.SetRefreshInterval (_STOU8(I->getText())); >>
2842 ;
2843
2844 vfrStatementRefreshEvent :
2845 <<
2846 CIfrRefreshId RiObj;
2847 EFI_GUID Guid;
2848 >>
2849 L:RefreshGuid << RiObj.SetLineNo(L->getLine()); >>
2850 "=" guidDefinition[Guid] "," << RiObj.SetRefreshEventGroutId (&Guid); >>
2851 ;
2852
2853 vfrStatementVarstoreDevice :
2854 << CIfrVarStoreDevice VDObj; >>
2855 L:VarstoreDevice << VDObj.SetLineNo(L->getLine()); >>
2856 "=" "STRING_TOKEN" "\(" S:Number "\)" "," << VDObj.SetDevicePath (_STOSID(S->getText())); >>
2857 ;
2858
2859 vfrStatementSuppressIfQuest :
2860 << CIfrSuppressIf SIObj; >>
2861 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>
2862 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2863 vfrStatementExpression[0] ";"
2864 vfrStatementQuestionOptionList
2865 E:EndIf << CRT_END_OP (E); >>
2866 ;
2867
2868 vfrStatementGrayOutIfQuest :
2869 << CIfrGrayOutIf GOIObj; >>
2870 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>
2871 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2872 vfrStatementExpression[0] ";"
2873 vfrStatementQuestionOptionList
2874 E:EndIf << CRT_END_OP (E); >>
2875 ;
2876
2877 vfrStatementOptions :
2878 vfrStatementOneOfOption
2879 ;
2880
2881 vfrStatementOneOfOption :
2882 <<
2883 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
2884 CHAR8 *VarStoreName = NULL;
2885 UINT32 Size = 0;
2886 BOOLEAN TypeError = FALSE;
2887 EFI_VFR_RETURN_CODE ReturnCode = VFR_RETURN_SUCCESS;
2888 EFI_GUID *VarStoreGuid = NULL;
2889
2890 if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
2891 TypeError = TRUE;
2892 Size = sizeof (EFI_IFR_TYPE_VALUE);
2893 } else {
2894 ReturnCode = gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &Size);
2895 }
2896
2897 Size += OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value);
2898 CIfrOneOfOption OOOObj ((UINT8)Size);
2899 >>
2900 L:Option <<
2901 OOOObj.SetLineNo(L->getLine());
2902 if (TypeError) {
2903 _PCATCH (VFR_RETURN_FATAL_ERROR, L->getLine(), "Get data type error.");
2904 }
2905 if (ReturnCode != VFR_RETURN_SUCCESS) {
2906 _PCATCH (ReturnCode, L->getLine());
2907 }
2908 >>
2909 Text "=" "STRING_TOKEN" "\(" S:Number "\)" "," << OOOObj.SetOption (_STOSID(S->getText())); >>
2910 Value "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] >[Val] ","
2911 <<
2912 if (gCurrentMinMaxData != NULL) {
2913 //set min/max value for oneof opcode
2914 UINT64 Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE());
2915 switch (_GET_CURRQEST_DATATYPE()) {
2916 case EFI_IFR_TYPE_NUM_SIZE_64:
2917 gCurrentMinMaxData->SetMinMaxStepData(Val.u64, Val.u64, Step);
2918 break;
2919 case EFI_IFR_TYPE_NUM_SIZE_32:
2920 gCurrentMinMaxData->SetMinMaxStepData(Val.u32, Val.u32, (UINT32) Step);
2921 break;
2922 case EFI_IFR_TYPE_NUM_SIZE_16:
2923 gCurrentMinMaxData->SetMinMaxStepData(Val.u16, Val.u16, (UINT16) Step);
2924 break;
2925 case EFI_IFR_TYPE_NUM_SIZE_8:
2926 gCurrentMinMaxData->SetMinMaxStepData(Val.u8, Val.u8, (UINT8) Step);
2927 break;
2928 default:
2929 break;
2930 }
2931 }
2932 OOOObj.SetType (_GET_CURRQEST_DATATYPE());
2933 OOOObj.SetValue (Val);
2934 >>
2935 F:FLAGS "=" vfrOneOfOptionFlags[OOOObj, F->getLine()]
2936 <<
2937 if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
2938 _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), L->getLine());
2939 VarStoreGuid = mCVfrDataStorage.GetVarStoreGuid(_GET_CURRQEST_VARTINFO().mVarStoreId);
2940 if (OOOObj.GetFlags () & 0x10) {
2941 CheckDuplicateDefaultValue (EFI_HII_DEFAULT_CLASS_STANDARD, F);
2942 _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
2943 EFI_HII_DEFAULT_CLASS_STANDARD,
2944 _GET_CURRQEST_VARTINFO(),
2945 VarStoreName,
2946 VarStoreGuid,
2947 _GET_CURRQEST_DATATYPE (),
2948 Val
2949 ), L->getLine());
2950 }
2951 if (OOOObj.GetFlags () & 0x20) {
2952 CheckDuplicateDefaultValue (EFI_HII_DEFAULT_CLASS_MANUFACTURING, F);
2953 _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
2954 EFI_HII_DEFAULT_CLASS_MANUFACTURING,
2955 _GET_CURRQEST_VARTINFO(),
2956 VarStoreName,
2957 VarStoreGuid,
2958 _GET_CURRQEST_DATATYPE (),
2959 Val
2960 ), L->getLine());
2961 }
2962 }
2963 >>
2964 {
2965 "," Key "=" KN:Number <<
2966 if (!mCompatibleMode) {
2967 _PCATCH (VFR_RETURN_UNSUPPORTED, KN);
2968 }
2969 //
2970 // Guid Option Key
2971 //
2972 CIfrOptionKey IfrOptionKey (
2973 gCurrentQuestion->QUESTION_ID(),
2974 Val,
2975 _STOQID(KN->getText())
2976 );
2977 SET_LINE_INFO (IfrOptionKey, KN);
2978 >>
2979 }
2980 (
2981 T:"," vfrImageTag << OOOObj.SetScope (1); CRT_END_OP (T); >>
2982 )*
2983 ";"
2984 ;
2985
2986 vfrOneOfOptionFlags [CIfrOneOfOption & OOOObj, UINT32 LineNum] :
2987 <<
2988 UINT8 LFlags = _GET_CURRQEST_DATATYPE();
2989 UINT8 HFlags = 0;
2990 >>
2991 oneofoptionFlagsField[HFlags, LFlags] ( "\|" oneofoptionFlagsField[HFlags, LFlags] )*
2992 << _PCATCH(gCurrentQuestion->SetFlags(HFlags), LineNum); >>
2993 << _PCATCH(OOOObj.SetFlags(LFlags), LineNum); >>
2994 ;
2995
2996 oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
2997 N:Number << $LFlags |= _STOU8(N->getText()); >>
2998 | "OPTION_DEFAULT" << $LFlags |= 0x10; >>
2999 | "OPTION_DEFAULT_MFG" << $LFlags |= 0x20; >>
3000 | InteractiveFlag << $HFlags |= 0x04; >>
3001 | NVAccessFlag << $HFlags |= 0x08; >>
3002 | ResetRequiredFlag << $HFlags |= 0x10; >>
3003 | LateCheckFlag << $HFlags |= 0x20; >>
3004 | ManufacturingFlag << $LFlags |= 0x20; >>
3005 | DefaultFlag << $LFlags |= 0x10; >>
3006 ;
3007
3008 vfrStatementLabel :
3009 L:Label
3010 N:Number <<
3011 if (mCompatibleMode) {
3012 //
3013 // Add end Label for Framework Vfr
3014 //
3015 CIfrLabel LObj1;
3016 LObj1.SetLineNo(L->getLine());
3017 LObj1.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff
3018 }
3019
3020 {
3021 CIfrLabel LObj2;
3022 LObj2.SetLineNo(L->getLine());
3023 LObj2.SetNumber (_STOU16(N->getText()));
3024 }
3025 >>
3026 ";"
3027 ;
3028
3029 vfrStatementBanner :
3030 << CIfrBanner BObj; >>
3031 B:Banner { "," } << BObj.SetLineNo(B->getLine()); >>
3032 Title "=" "STRING_TOKEN" "\(" S:Number "\)" "," << BObj.SetTitle (_STOSID(S->getText())); >>
3033 (
3034 (
3035 Line L:Number "," << BObj.SetLine (_STOU16(L->getText())); >>
3036 Align
3037 (
3038 Left << BObj.SetAlign (0); >>
3039 | Center << BObj.SetAlign (1); >>
3040 | Right << BObj.SetAlign (2); >>
3041 ) ";"
3042 )
3043 |
3044 (
3045 Timeout "=" T:Number ";" << {CIfrTimeout TObj(_STOU16(T->getText()));} >>
3046 )
3047 )
3048 ;
3049
3050 //******************************************************************************
3051 //
3052 // keep some syntax for compatibility but not generate any IFR object
3053 //
3054 vfrStatementInvalidHidden :
3055 L:Hidden <<
3056 if (!mCompatibleMode) {
3057 _PCATCH (VFR_RETURN_UNSUPPORTED, L);
3058 }
3059 >>
3060 Value "=" Number ","
3061 Key "=" Number ";"
3062 ;
3063
3064 vfrStatementInvalidInconsistentIf :
3065 InconsistentIf
3066 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" ","
3067 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
3068 vfrStatementExpression[0]
3069 EndIf
3070 ";"
3071 ;
3072
3073 vfrStatementInvalidInventory :
3074 L:Inventory <<
3075 if (!mCompatibleMode) {
3076 _PCATCH (VFR_RETURN_UNSUPPORTED, L);
3077 }
3078 >>
3079 Help "=" "STRING_TOKEN" "\(" Number "\)" ","
3080 Text "=" "STRING_TOKEN" "\(" Number "\)" ","
3081 {
3082 Text "=" "STRING_TOKEN" "\(" Number "\)"
3083 }
3084 ";"
3085 ;
3086
3087 vfrStatementInvalidSaveRestoreDefaults :
3088 (
3089 L:Save <<
3090 if (!mCompatibleMode) {
3091 _PCATCH (VFR_RETURN_UNSUPPORTED, L);
3092 }
3093 >>
3094 |
3095 K:Restore <<
3096 if (!mCompatibleMode) {
3097 _PCATCH (VFR_RETURN_UNSUPPORTED, K);
3098 }
3099 >>
3100 )
3101 Defaults ","
3102 FormId "=" Number ","
3103 Prompt "=" "STRING_TOKEN" "\(" Number "\)" ","
3104 Help "=" "STRING_TOKEN" "\(" Number "\)"
3105 { "," FLAGS "=" flagsField ( "\|" flagsField )* }
3106 { "," Key "=" Number }
3107 ";"
3108 ;
3109
3110 //******************************************************************************
3111 //
3112 // The syntax of expression
3113 //
3114 #token Dup("dup") "dup"
3115 #token VarEqVal("vareqval") "vareqval"
3116 #token Var("var") "var"
3117 #token IdEqVal("ideqval") "ideqval"
3118 #token IdEqId("ideqid") "ideqid"
3119 #token IdEqValList("ideqvallist") "ideqvallist"
3120 #token QuestionRef("questionref") "questionref"
3121 #token RuleRef("ruleref") "ruleref"
3122 #token StringRef("stringref") "stringref"
3123 #token PushThis("pushthis") "pushthis"
3124 #token Security("security") "security"
3125 #token Get("get") "get"
3126 #token True("TRUE") "TRUE"
3127 #token False("FALSE") "FALSE"
3128 #token One("ONE") "ONE"
3129 #token Ones("ONES") "ONES"
3130 #token Zero("ZERO") "ZERO"
3131 #token Undefined("UNDEFINED") "UNDEFINED"
3132 #token Version("VERSION") "VERSION"
3133 #token Length("length") "length"
3134 #token AND("AND") "AND"
3135 #token OR("OR") "OR"
3136 #token NOT("NOT") "NOT"
3137 #token Set("set") "set"
3138 #token BitWiseNot("~") "\~"
3139 #token BoolVal("boolval") "boolval"
3140 #token StringVal("stringval") "stringval"
3141 #token UnIntVal("unintval") "unintval"
3142 #token ToUpper("toupper") "toupper"
3143 #token ToLower("tolower") "tolower"
3144 #token Match("match") "match"
3145 #token Catenate("catenate") "catenate"
3146 #token QuestionRefVal("questionrefval") "questionrefval"
3147 #token StringRefVal("stringrefval") "stringrefval"
3148 #token Map("map") "map"
3149 #token RefreshGuid("refreshguid") "refreshguid"
3150
3151 //
3152 // Root expression extension function called by other function.
3153 //
3154 vfrStatementExpression [UINT32 RootLevel, UINT32 ExpOpCount = 0] :
3155 << if ($RootLevel == 0) {mCIfrOpHdrIndex ++; if (mCIfrOpHdrIndex >= MAX_IFR_EXPRESSION_DEPTH) _PCATCH (VFR_RETURN_INVALID_PARAMETER, 0, "The depth of expression exceeds the max supported level 8!"); _CLEAR_SAVED_OPHDR ();} >>
3156 andTerm[$RootLevel, $ExpOpCount]
3157 (
3158 L:OR andTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrOr OObj(L->getLine()); >>
3159 )*
3160 <<
3161 //
3162 // Extend OpCode Scope only for the root expression.
3163 //
3164 if ($ExpOpCount > 1 && $RootLevel == 0) {
3165 if (_SET_SAVED_OPHDR_SCOPE()) {
3166 CIfrEnd EObj;
3167 if (mCIfrOpHdrLineNo[mCIfrOpHdrIndex] != 0) {
3168 EObj.SetLineNo (mCIfrOpHdrLineNo[mCIfrOpHdrIndex]);
3169 }
3170 }
3171 }
3172
3173 if ($RootLevel == 0) {
3174 mCIfrOpHdrIndex --;
3175 }
3176 >>
3177 ;
3178
3179 //
3180 // Add new sub function for the sub expression extension to remember the ExpOpCount
3181 // This funciton is only called by sub expression.
3182 //
3183 vfrStatementExpressionSub [UINT32 RootLevel, UINT32 & ExpOpCount] :
3184 andTerm[$RootLevel, $ExpOpCount]
3185 (
3186 L:OR andTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrOr OObj(L->getLine()); >>
3187 )*
3188 ;
3189
3190 andTerm[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3191 bitwiseorTerm[$RootLevel, $ExpOpCount]
3192 (
3193 L:AND bitwiseorTerm [$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrAnd AObj(L->getLine()); >>
3194 )*
3195 ;
3196
3197 bitwiseorTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3198 bitwiseandTerm[$RootLevel, $ExpOpCount]
3199 (
3200 L:"\|" bitwiseandTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrBitWiseOr BWOObj(L->getLine()); >>
3201 )*
3202 ;
3203
3204 bitwiseandTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3205 equalTerm[$RootLevel, $ExpOpCount]
3206 (
3207 L:"&" equalTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrBitWiseAnd BWAObj(L->getLine()); >>
3208 )*
3209 ;
3210
3211 equalTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3212 compareTerm[$RootLevel, $ExpOpCount]
3213 (
3214 (
3215 L1:"==" compareTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrEqual EObj(L1->getLine()); >>
3216 )
3217 |
3218 (
3219 L2:"!=" compareTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrNotEqual NEObj(L2->getLine()); >>
3220 )
3221 )*
3222 ;
3223
3224 compareTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3225 shiftTerm[$RootLevel, $ExpOpCount]
3226 (
3227 (
3228 L1:"<" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrLessThan LTObj(L1->getLine()); >>
3229 )
3230 |
3231 (
3232 L2:"<=" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrLessEqual LEObj(L2->getLine()); >>
3233 )
3234 |
3235 (
3236 L3:">" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrGreaterThan GTObj(L3->getLine()); >>
3237 )
3238 |
3239 (
3240 L4:">=" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrGreaterEqual GEObj(L4->getLine()); >>
3241 )
3242 )*
3243 ;
3244
3245 shiftTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3246 addMinusTerm[$RootLevel, $ExpOpCount]
3247 (
3248 (
3249 L1:"\<<" addMinusTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrShiftLeft SLObj(L1->getLine()); >>
3250 )
3251 |
3252 (
3253 L2:"\>>" addMinusTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrShiftRight SRObj(L2->getLine()); >>
3254 )
3255 )*
3256 ;
3257
3258 addMinusTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3259 multdivmodTerm[$RootLevel, $ExpOpCount]
3260 (
3261 (
3262 L1:"\+" multdivmodTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrAdd AObj(L1->getLine()); >>
3263 )
3264 |
3265 (
3266 L2:"\-" multdivmodTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrSubtract SObj(L2->getLine()); >>
3267 )
3268 )*
3269 ;
3270
3271 multdivmodTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3272 castTerm[$RootLevel, $ExpOpCount]
3273 (
3274 (
3275 L1:"\*" castTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrMultiply MObj(L1->getLine()); >>
3276 )
3277 |
3278 (
3279 L2:"/" castTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrDivide DObj(L2->getLine()); >>
3280 )
3281 |
3282 (
3283 L3:"%" castTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrModulo MObj(L3->getLine()); >>
3284 )
3285 )*
3286 ;
3287
3288 castTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3289 << UINT8 CastType = 0xFF; >>
3290 (
3291 L:"\("
3292 (
3293 Boolean << CastType = 0; >>
3294 | Uint64 << CastType = 1; >>
3295 | Uint32 << CastType = 1; >>
3296 | Uint16 << CastType = 1; >>
3297 | Uint8 << CastType = 1; >>
3298 )
3299 "\)"
3300 )*
3301 atomTerm[$RootLevel, $ExpOpCount]
3302 <<
3303 switch (CastType) {
3304 case 0: { CIfrToBoolean TBObj(L->getLine()); $ExpOpCount++; } break;
3305 case 1: { CIfrToUint TUObj(L->getLine()); $ExpOpCount++; } break;
3306 }
3307 >>
3308 ;
3309
3310 atomTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3311 vfrExpressionCatenate[$RootLevel, $ExpOpCount]
3312 | vfrExpressionMatch[$RootLevel, $ExpOpCount]
3313 | vfrExpressionParen[$RootLevel, $ExpOpCount]
3314 | vfrExpressionBuildInFunction[$RootLevel, $ExpOpCount]
3315 | vfrExpressionConstant[$RootLevel, $ExpOpCount]
3316 | vfrExpressionUnaryOp[$RootLevel, $ExpOpCount]
3317 | vfrExpressionTernaryOp[$RootLevel, $ExpOpCount]
3318 | vfrExpressionMap[$RootLevel, $ExpOpCount]
3319 | (
3320 L:NOT
3321 atomTerm[$RootLevel, $ExpOpCount] << { CIfrNot NObj(L->getLine()); $ExpOpCount++; } >>
3322 )
3323 ;
3324
3325 vfrExpressionCatenate [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3326 L:Catenate
3327 "\("
3328 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3329 ","
3330 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3331 "\)" << { CIfrCatenate CObj(L->getLine()); $ExpOpCount++; } >>
3332 ;
3333
3334 vfrExpressionMatch [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3335 L:Match
3336 "\("
3337 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3338 ","
3339 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3340 "\)" << { CIfrMatch MObj(L->getLine()); $ExpOpCount++; } >>
3341 ;
3342
3343 vfrExpressionParen [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3344 "\("
3345 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3346 "\)"
3347 ;
3348
3349 vfrExpressionBuildInFunction [UINT32 & RootLevel, UINT32 & ExpOpCount] :
3350 dupExp[$RootLevel, $ExpOpCount]
3351 | vareqvalExp[$RootLevel, $ExpOpCount] //Compatible for Framework vareqval
3352 | ideqvalExp[$RootLevel, $ExpOpCount]
3353 | ideqidExp[$RootLevel, $ExpOpCount]
3354 | ideqvallistExp[$RootLevel, $ExpOpCount]
3355 | questionref1Exp[$RootLevel, $ExpOpCount]
3356 | rulerefExp[$RootLevel, $ExpOpCount]
3357 | stringref1Exp[$RootLevel, $ExpOpCount]
3358 | pushthisExp[$RootLevel, $ExpOpCount]
3359 | securityExp[$RootLevel, $ExpOpCount]
3360 | getExp[$RootLevel, $ExpOpCount]
3361 ;
3362
3363 dupExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
3364 L:Dup << { CIfrDup DObj(L->getLine()); _SAVE_OPHDR_COND(DObj, ($ExpOpCount == 0), L->getLine()); $ExpOpCount++; } >>
3365 ;
3366
3367 vareqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
3368 <<
3369 EFI_QUESTION_ID QId;
3370 UINT32 Mask;
3371 UINT16 ConstVal;
3372 CHAR8 *VarIdStr;
3373 UINT32 LineNo;
3374 EFI_VFR_RETURN_CODE VfrReturnCode = VFR_RETURN_SUCCESS;
3375 EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;
3376 >>
3377 L:VarEqVal <<
3378 if (!mCompatibleMode) {
3379 _PCATCH (VFR_RETURN_UNSUPPORTED, L);
3380 }
3381 >>
3382 VK:Var
3383 OpenParen
3384 VN:Number <<
3385 VarIdStr = NULL; _STRCAT(&VarIdStr, VK->getText()); _STRCAT(&VarIdStr, VN->getText());
3386 VfrReturnCode = mCVfrDataStorage.GetVarStoreId (VarIdStr, &VarStoreId);
3387 if (VfrReturnCode == VFR_RETURN_UNDEFINED) {
3388 _PCATCH (mCVfrDataStorage.DeclareEfiVarStore (
3389 VarIdStr,
3390 &mFormsetGuid,
3391 _STOSID(VN->getText()),
3392 0x2, //default type is UINT16
3393 FALSE
3394 ), VN);
3395 } else {
3396 _PCATCH (VfrReturnCode, VN);
3397 }
3398 mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, QId, Mask);
3399 LineNo = GET_LINENO(VN);
3400 >>
3401 CloseParen
3402 (
3403 (
3404 "=="
3405 V1:Number << ConstVal = _STOU16(V1->getText()); >>
3406 <<
3407 if (Mask == 0) {
3408 CIfrEqIdVal EIVObj (L->getLine());
3409 _SAVE_OPHDR_COND (EIVObj, ($ExpOpCount == 0), L->getLine());
3410 EIVObj.SetQuestionId (QId, VarIdStr, LineNo);
3411 EIVObj.SetValue (ConstVal);
3412 $ExpOpCount++;
3413 } else {
3414 IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, EQUAL);
3415 }
3416 >>
3417 )
3418 |
3419 (
3420 "<="
3421 V2:Number << ConstVal = _STOU16(V2->getText()); >>
3422 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_EQUAL); >>
3423 )
3424 |
3425 (
3426 "<"
3427 V3:Number << ConstVal = _STOU16(V3->getText()); >>
3428 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_THAN); >>
3429 )
3430 |
3431 (
3432 ">="
3433 V4:Number << ConstVal = _STOU16(V4->getText()); >>
3434 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_EQUAL); >>
3435 )
3436 |
3437 (
3438 ">"
3439 V5:Number << ConstVal = _STOU16(V5->getText()); >>
3440 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_THAN); >>
3441 )
3442 )
3443 ;
3444
3445 ideqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
3446 <<
3447 EFI_QUESTION_ID QId;
3448 UINT32 Mask;
3449 UINT16 ConstVal;
3450 CHAR8 *VarIdStr;
3451 UINT32 LineNo;
3452 >>
3453 L:IdEqVal
3454 vfrQuestionDataFieldName[QId, Mask, VarIdStr, LineNo]
3455 (
3456 (
3457 "=="
3458 V1:Number << ConstVal = _STOU16(V1->getText()); >>
3459 <<
3460 if (Mask == 0) {
3461 CIfrEqIdVal EIVObj (L->getLine());
3462 _SAVE_OPHDR_COND (EIVObj, ($ExpOpCount == 0), L->getLine());
3463 EIVObj.SetQuestionId (QId, VarIdStr, LineNo);
3464 EIVObj.SetValue (ConstVal);
3465 $ExpOpCount++;
3466 } else {
3467 IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, EQUAL);
3468 }
3469 >>
3470 )
3471 |
3472 (
3473 "<="
3474 V2:Number << ConstVal = _STOU16(V2->getText()); >>
3475 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_EQUAL); >>
3476 )
3477 |
3478 (
3479 "<"
3480 V3:Number << ConstVal = _STOU16(V3->getText()); >>
3481 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_THAN); >>
3482 )
3483 |
3484 (
3485 ">="
3486 V4:Number << ConstVal = _STOU16(V4->getText()); >>
3487 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_EQUAL); >>
3488 )
3489 |
3490 (
3491 ">"
3492 V5:Number << ConstVal = _STOU16(V5->getText()); >>
3493 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_THAN); >>
3494 )
3495 )
3496 ;
3497
3498 ideqidExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3499 <<
3500 EFI_QUESTION_ID QId[2];
3501 UINT32 Mask[2];
3502 CHAR8 *VarIdStr[2];
3503 UINT32 LineNo[2];
3504 >>
3505 L:IdEqId
3506 vfrQuestionDataFieldName[QId[0], Mask[0], VarIdStr[0], LineNo[0]]
3507 (
3508 (
3509 "=="
3510 vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
3511 <<
3512 if (Mask[0] & Mask[1]) {
3513 IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], EQUAL);
3514 } else {
3515 CIfrEqIdId EIIObj(L->getLine());
3516 _SAVE_OPHDR_COND (EIIObj, ($ExpOpCount == 0), L->getLine());
3517 EIIObj.SetQuestionId1 (QId[0], VarIdStr[0], LineNo[0]);
3518 EIIObj.SetQuestionId2 (QId[1], VarIdStr[1], LineNo[1]);
3519 $ExpOpCount++;
3520 }
3521 >>
3522 )
3523 |
3524 (
3525 "<="
3526 vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
3527 << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], LESS_EQUAL); >>
3528 )
3529 |
3530 (
3531 "<"
3532 vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
3533 << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], LESS_THAN); >>
3534 )
3535 |
3536 (
3537 ">="
3538 vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
3539 << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], GREATER_EQUAL); >>
3540 )
3541 |
3542 (
3543 ">"
3544 vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
3545 << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], GREATER_THAN); >>
3546 )
3547 )
3548 ;
3549
3550 ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3551 <<
3552 UINT16 ListLen = 0;
3553 EFI_QUESTION_ID QId;
3554 UINT32 Mask;
3555 UINT16 ValueList[EFI_IFR_MAX_LENGTH] = {0,};
3556 CHAR8 *VarIdStr;
3557 UINT32 LineNo;
3558 >>
3559 L:IdEqValList
3560 vfrQuestionDataFieldName[QId, Mask, VarIdStr, LineNo]
3561 "=="
3562 (
3563 V:Number << ValueList[ListLen] = _STOU16(V->getText()); ListLen++; >>
3564 )+
3565 <<
3566 if (Mask != 0) {
3567 IdEqListDoSpecial ($ExpOpCount, LineNo, QId, VarIdStr, Mask, ListLen, ValueList);
3568 } else {
3569 UINT16 Index;
3570 CIfrEqIdList EILObj(L->getLine());
3571 if (QId != EFI_QUESTION_ID_INVALID) {
3572 EILObj.SetQuestionId (QId, VarIdStr, LineNo);
3573 }
3574 EILObj.SetListLength (ListLen);
3575 for (Index = 0; Index < ListLen; Index++) {
3576 EILObj.SetValueList (Index, ValueList[Index]);
3577 }
3578
3579 EILObj.UpdateIfrBuffer();
3580 _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());
3581
3582 if (QId == EFI_QUESTION_ID_INVALID) {
3583 EILObj.SetQuestionId (QId, VarIdStr, LineNo);
3584 }
3585 $ExpOpCount++;
3586 }
3587 >>
3588 ;
3589
3590 questionref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3591 <<
3592 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
3593 UINT32 BitMask;
3594 CHAR8 *QName = NULL;
3595 UINT32 LineNo = 0;
3596 >>
3597 L:QuestionRef
3598 "\("
3599 (
3600 QN:StringIdentifier <<
3601 QName = QN->getText();
3602 LineNo = QN->getLine();
3603 mCVfrQuestionDB.GetQuestionId (QN->getText(), NULL, QId, BitMask);
3604 >>
3605 | ID:Number << QId = _STOQID(ID->getText()); >>
3606 )
3607 "\)"
3608 <<
3609 { CIfrQuestionRef1 QR1Obj(L->getLine()); _SAVE_OPHDR_COND (QR1Obj, ($ExpOpCount == 0), L->getLine()); QR1Obj.SetQuestionId (QId, QName, LineNo); } $ExpOpCount++; >>
3610 ;
3611
3612 rulerefExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3613 L:RuleRef
3614 "\(" RN:StringIdentifier "\)" << { CIfrRuleRef RRObj(L->getLine()); _SAVE_OPHDR_COND (RRObj, ($ExpOpCount == 0), L->getLine()); RRObj.SetRuleId (mCVfrRulesDB.GetRuleId (RN->getText())); } $ExpOpCount++; >>
3615 ;
3616
3617 //******************************************************
3618 // PARSE:
3619 // stringref (STR_FORM_SET_TITLE)
3620 //
3621 stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3622 <<
3623 EFI_STRING_ID RefStringId = EFI_STRING_ID_INVALID;
3624 >>
3625 L:StringRef
3626 "\("
3627 (
3628 "STRING_TOKEN"
3629 "\("
3630 S:Number << RefStringId = _STOSID(S->getText()); >>
3631 "\)"
3632 | I:Number << RefStringId = _STOSID(I->getText()); >>
3633 )
3634 "\)" << { CIfrStringRef1 SR1Obj(L->getLine()); _SAVE_OPHDR_COND (SR1Obj, ($ExpOpCount == 0), L->getLine()); SR1Obj.SetStringId (RefStringId); $ExpOpCount++; } >>
3635 ;
3636
3637 pushthisExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3638 L:PushThis << { CIfrThis TObj(L->getLine()); _SAVE_OPHDR_COND (TObj, ($ExpOpCount == 0), L->getLine()); $ExpOpCount++; } >>
3639 ;
3640
3641 securityExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3642 <<
3643 EFI_GUID Guid;
3644 >>
3645 L:Security
3646 "\(" guidDefinition[Guid] "\)" << { CIfrSecurity SObj(L->getLine()); _SAVE_OPHDR_COND (SObj, ($ExpOpCount == 0), L->getLine()); SObj.SetPermissions (&Guid); } $ExpOpCount++; >>
3647 ;
3648
3649 numericVarStoreType [UINT8 & VarType] :
3650 "NUMERIC_SIZE_1" << $VarType = EFI_IFR_NUMERIC_SIZE_1; >>
3651 | "NUMERIC_SIZE_2" << $VarType = EFI_IFR_NUMERIC_SIZE_2; >>
3652 | "NUMERIC_SIZE_4" << $VarType = EFI_IFR_NUMERIC_SIZE_4; >>
3653 | "NUMERIC_SIZE_8" << $VarType = EFI_IFR_NUMERIC_SIZE_8; >>
3654 ;
3655
3656 getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3657 <<
3658 EFI_VARSTORE_INFO Info;
3659 CHAR8 *VarIdStr = NULL;
3660 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
3661 UINT32 Mask = 0;
3662 EFI_QUESION_TYPE QType = QUESTION_NORMAL;
3663 UINT8 VarType = EFI_IFR_TYPE_UNDEFINED;
3664 UINT32 VarSize = 0;
3665 Info.mVarStoreId = 0;
3666 >>
3667 L:Get
3668 "\("
3669 vfrStorageVarId[Info, VarIdStr, FALSE]
3670 {"\|" FLAGS "=" numericVarStoreType [VarType] }
3671 "\)" <<
3672 {
3673 if (Info.mVarStoreId == 0) {
3674 // support Date/Time question
3675 mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, QId, Mask, &QType);
3676 if (QId == EFI_QUESTION_ID_INVALID || Mask == 0 || QType == QUESTION_NORMAL) {
3677 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
3678 }
3679 if (QType == QUESTION_DATE) {
3680 Info.mVarType = EFI_IFR_TYPE_DATE;
3681 } else if (QType == QUESTION_TIME) {
3682 Info.mVarType = EFI_IFR_TYPE_TIME;
3683 }
3684 switch (Mask) {
3685 case DATE_YEAR_BITMASK:
3686 Info.mInfo.mVarOffset = 0;
3687 break;
3688 case DATE_DAY_BITMASK:
3689 Info.mInfo.mVarOffset = 3;
3690 break;
3691 case TIME_HOUR_BITMASK:
3692 Info.mInfo.mVarOffset = 0;
3693 break;
3694 case TIME_MINUTE_BITMASK:
3695 Info.mInfo.mVarOffset = 1;
3696 break;
3697 case TIME_SECOND_BITMASK:
3698 Info.mInfo.mVarOffset = 2;
3699 break;
3700 default:
3701 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
3702 break;
3703 }
3704 } else {
3705 if ((mCVfrDataStorage.GetVarStoreType(Info.mVarStoreId) == EFI_VFR_VARSTORE_NAME) && (VarType == EFI_IFR_TYPE_UNDEFINED)) {
3706 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support name string");
3707 }
3708 if (VarType != EFI_IFR_TYPE_UNDEFINED) {
3709 Info.mVarType = VarType;
3710 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
3711 Info.mVarTotalSize = VarSize;
3712 }
3713 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
3714 if (VarSize != Info.mVarTotalSize) {
3715 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support data array");
3716 }
3717 }
3718 CIfrGet GObj(L->getLine());
3719 _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine());
3720 GObj.SetVarInfo (&Info);
3721 delete VarIdStr;
3722 $ExpOpCount++;
3723 }
3724 >>
3725 ;
3726
3727 vfrExpressionConstant[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3728 L1:True << CIfrTrue TObj(L1->getLine()); _SAVE_OPHDR_COND (TObj, ($ExpOpCount == 0), L1->getLine()); $ExpOpCount++; >>
3729 | L2:False << CIfrFalse FObj(L2->getLine()); _SAVE_OPHDR_COND (FObj, ($ExpOpCount == 0), L2->getLine()); $ExpOpCount++; >>
3730 | L3:One << CIfrOne OObj(L3->getLine()); _SAVE_OPHDR_COND (OObj, ($ExpOpCount == 0), L3->getLine()); $ExpOpCount++; >>
3731 | L4:Ones << CIfrOnes OObj(L4->getLine()); _SAVE_OPHDR_COND (OObj, ($ExpOpCount == 0), L4->getLine()); $ExpOpCount++; >>
3732 | L5:Zero << CIfrZero ZObj(L5->getLine()); _SAVE_OPHDR_COND (ZObj, ($ExpOpCount == 0), L5->getLine()); $ExpOpCount++; >>
3733 | L6:Undefined << CIfrUndefined UObj(L6->getLine()); _SAVE_OPHDR_COND (UObj, ($ExpOpCount == 0), L6->getLine()); $ExpOpCount++; >>
3734 | L7:Version << CIfrVersion VObj(L7->getLine()); _SAVE_OPHDR_COND (VObj, ($ExpOpCount == 0), L7->getLine()); $ExpOpCount++; >>
3735 | V:Number << CIfrUint64 U64Obj(V->getLine()); U64Obj.SetValue (_STOU64(V->getText())); _SAVE_OPHDR_COND (U64Obj, ($ExpOpCount == 0), V->getLine()); $ExpOpCount++; >>
3736 ;
3737
3738 vfrExpressionUnaryOp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3739 lengthExp[$RootLevel, $ExpOpCount]
3740 | bitwisenotExp[$RootLevel, $ExpOpCount]
3741 | question23refExp[$RootLevel, $ExpOpCount]
3742 | stringref2Exp[$RootLevel, $ExpOpCount]
3743 | toboolExp[$RootLevel, $ExpOpCount]
3744 | tostringExp[$RootLevel, $ExpOpCount]
3745 | unintExp[$RootLevel, $ExpOpCount]
3746 | toupperExp[$RootLevel, $ExpOpCount]
3747 | tolwerExp[$RootLevel, $ExpOpCount]
3748 | setExp[$RootLevel, $ExpOpCount]
3749 ;
3750
3751 lengthExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3752 L:Length
3753 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3754 << { CIfrLength LObj(L->getLine()); $ExpOpCount++; } >>
3755 ;
3756
3757 bitwisenotExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3758 L:BitWiseNot
3759 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3760 << { CIfrBitWiseNot BWNObj(L->getLine()); $ExpOpCount++; } >>
3761 ;
3762
3763 question23refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3764 <<
3765 UINT8 Type = 0x1;
3766 EFI_STRING_ID DevPath = EFI_STRING_ID_INVALID;
3767 EFI_GUID Guid = {0,};
3768 >>
3769 L:QuestionRefVal
3770 "\("
3771 {
3772 DevicePath "=" "STRING_TOKEN" "\(" S:Number "\)" "," << Type = 0x2; DevPath = _STOSID(S->getText()); >>
3773 }
3774 {
3775 Uuid "=" guidDefinition[Guid] "," << Type = 0x3; >>
3776 }
3777 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3778 "\)"
3779 <<
3780 switch (Type) {
3781 case 0x1: {CIfrQuestionRef2 QR2Obj(L->getLine()); _SAVE_OPHDR_COND (QR2Obj, ($ExpOpCount == 0), L->getLine()); break;}
3782 case 0x2: {CIfrQuestionRef3_2 QR3_2Obj(L->getLine()); _SAVE_OPHDR_COND (QR3_2Obj, ($ExpOpCount == 0), L->getLine()); QR3_2Obj.SetDevicePath (DevPath); break;}
3783 case 0x3: {CIfrQuestionRef3_3 QR3_3Obj(L->getLine()); _SAVE_OPHDR_COND (QR3_3Obj, ($ExpOpCount == 0), L->getLine()); QR3_3Obj.SetDevicePath (DevPath); QR3_3Obj.SetGuid (&Guid); break;}
3784 }
3785 $ExpOpCount++;
3786 >>
3787 ;
3788
3789 stringref2Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3790 L:StringRefVal
3791 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3792 << { CIfrStringRef2 SR2Obj(L->getLine()); $ExpOpCount++; } >>
3793 ;
3794
3795 toboolExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3796 L:BoolVal
3797 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3798 << { CIfrToBoolean TBObj(L->getLine()); $ExpOpCount++; } >>
3799 ;
3800
3801 tostringExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3802 << UINT8 Fmt = 0; >>
3803 L:StringVal
3804 {
3805 Format "=" F:Number "," << Fmt = _STOU8(F->getText()); >>
3806 }
3807 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3808 << { CIfrToString TSObj(L->getLine()); TSObj.SetFormat (Fmt); $ExpOpCount++; } >>
3809 ;
3810
3811 unintExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3812 L:UnIntVal
3813 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3814 << { CIfrToUint TUObj(L->getLine()); $ExpOpCount++; } >>
3815 ;
3816
3817 toupperExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3818 L:ToUpper
3819 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3820 << { CIfrToUpper TUObj(L->getLine()); $ExpOpCount++; } >>
3821 ;
3822
3823 tolwerExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3824 L:ToLower
3825 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3826 << { CIfrToLower TLObj(L->getLine()); $ExpOpCount++; } >>
3827 ;
3828
3829 setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3830 <<
3831 EFI_VARSTORE_INFO Info;
3832 CHAR8 *VarIdStr = NULL;
3833 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
3834 UINT32 Mask = 0;
3835 EFI_QUESION_TYPE QType = QUESTION_NORMAL;
3836 UINT8 VarType = EFI_IFR_TYPE_UNDEFINED;
3837 UINT32 VarSize = 0;
3838 Info.mVarStoreId = 0;
3839 >>
3840 L:Set
3841 "\("
3842 vfrStorageVarId[Info, VarIdStr, FALSE]
3843 {"\|" FLAG "=" numericVarStoreType [VarType] }
3844 "," vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3845 "\)"
3846 <<
3847 {
3848 if (Info.mVarStoreId == 0) {
3849 // support Date/Time question
3850 mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, QId, Mask, &QType);
3851 if (QId == EFI_QUESTION_ID_INVALID || Mask == 0 || QType == QUESTION_NORMAL) {
3852 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
3853 }
3854 if (QType == QUESTION_DATE) {
3855 Info.mVarType = EFI_IFR_TYPE_DATE;
3856 } else if (QType == QUESTION_TIME) {
3857 Info.mVarType = EFI_IFR_TYPE_TIME;
3858 }
3859 switch (Mask) {
3860 case DATE_YEAR_BITMASK:
3861 Info.mInfo.mVarOffset = 0;
3862 break;
3863 case DATE_DAY_BITMASK:
3864 Info.mInfo.mVarOffset = 3;
3865 break;
3866 case TIME_HOUR_BITMASK:
3867 Info.mInfo.mVarOffset = 0;
3868 break;
3869 case TIME_MINUTE_BITMASK:
3870 Info.mInfo.mVarOffset = 1;
3871 break;
3872 case TIME_SECOND_BITMASK:
3873 Info.mInfo.mVarOffset = 2;
3874 break;
3875 default:
3876 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
3877 break;
3878 }
3879 } else {
3880 if ((mCVfrDataStorage.GetVarStoreType(Info.mVarStoreId) == EFI_VFR_VARSTORE_NAME) && (VarType == EFI_IFR_TYPE_UNDEFINED)) {
3881 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support name string");
3882 }
3883 if (VarType != EFI_IFR_TYPE_UNDEFINED) {
3884 Info.mVarType = VarType;
3885 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
3886 Info.mVarTotalSize = VarSize;
3887 }
3888 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
3889 if (VarSize != Info.mVarTotalSize) {
3890 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support data array");
3891 }
3892 }
3893 CIfrSet TSObj(L->getLine());
3894 TSObj.SetVarInfo (&Info);
3895 delete VarIdStr;
3896 $ExpOpCount++;
3897 }
3898 >>
3899 ;
3900
3901 vfrExpressionTernaryOp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3902 conditionalExp[$RootLevel, $ExpOpCount]
3903 | findExp[$RootLevel, $ExpOpCount]
3904 | midExp[$RootLevel, $ExpOpCount]
3905 | tokenExp[$RootLevel, $ExpOpCount]
3906 | spanExp[$RootLevel, $ExpOpCount]
3907 ;
3908
3909 #token Cond("cond") "cond"
3910 #token Find("find") "find"
3911 #token Mid("mid") "mid"
3912 #token Tok("token") "token"
3913 #token Span("span") "span"
3914
3915 conditionalExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3916 L:Cond "\("
3917 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3918 "?"
3919 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3920 ":"
3921 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3922 "\)" << { CIfrConditional CObj(L->getLine()); $ExpOpCount++; } >>
3923 ;
3924
3925 findExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3926 << UINT8 Format; >>
3927 L:Find "\("
3928 findFormat[Format] ( "\|" findFormat[Format] )*
3929 ","
3930 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3931 ","
3932 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3933 ","
3934 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3935 "\)" << { CIfrFind FObj(L->getLine()); FObj.SetFormat (Format); $ExpOpCount++; } >>
3936 ;
3937
3938 findFormat [UINT8 & Format] :
3939 "SENSITIVE" << $Format = 0x00; >>
3940 | "INSENSITIVE" << $Format = 0x01; >>
3941 ;
3942
3943 midExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3944 L:Mid "\("
3945 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3946 ","
3947 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3948 ","
3949 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3950 "\)" << { CIfrMid MObj(L->getLine()); $ExpOpCount++; } >>
3951 ;
3952
3953 tokenExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3954 L:Tok "\("
3955 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3956 ","
3957 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3958 ","
3959 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3960 "\)" << { CIfrToken TObj(L->getLine()); $ExpOpCount++; } >>
3961 ;
3962
3963 spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3964 << UINT8 Flags = 0; >>
3965 S:Span "\("
3966 FLAGS "=" spanFlags[Flags] ( "\|" spanFlags[Flags] )*
3967 ","
3968 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3969 ","
3970 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3971 ","
3972 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3973 "\)" << { CIfrSpan SObj(S->getLine()); SObj.SetFlags(Flags); $ExpOpCount++; } >>
3974 ;
3975
3976 vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3977 L:Map
3978 "\("
3979 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3980 ":" << { CIfrMap MObj(L->getLine()); } >>
3981 (
3982 vfrStatementExpression[0]
3983 ","
3984 vfrStatementExpression[0]
3985 ";"
3986 ) *
3987 E:"\)" << { CIfrEnd EObj; EObj.SetLineNo(E->getLine()); $ExpOpCount++; } >>
3988 ;
3989
3990 spanFlags [UINT8 & Flags] :
3991 N:Number << $Flags |= _STOU8(N->getText()); >>
3992 | "LAST_NON_MATCH" << $Flags |= 0x00; >>
3993 | "FIRST_NON_MATCH" << $Flags |= 0x01; >>
3994 ;
3995
3996 #token StringIdentifier("string identifier") "[A-Za-z_][A-Za-z_0-9]*"
3997 #token Number("numeric value") "(0x[0-9A-Fa-f]+) | [0-9]+"
3998
3999 //******************************************************************************
4000 //
4001 // Parser class definition.
4002 //
4003 class EfiVfrParser {
4004 <<
4005 private:
4006 UINT8 mParserStatus;
4007 BOOLEAN mConstantOnlyInExpression;
4008
4009 CVfrDefaultStore mCVfrDefaultStore;
4010 CVfrDataStorage mCVfrDataStorage;
4011 CVfrQuestionDB mCVfrQuestionDB;
4012 CVfrRulesDB mCVfrRulesDB;
4013
4014 CIfrOpHeader * mCIfrOpHdr[MAX_IFR_EXPRESSION_DEPTH];
4015 UINT32 mCIfrOpHdrLineNo[MAX_IFR_EXPRESSION_DEPTH];
4016 UINT8 mCIfrOpHdrIndex;
4017 VOID _SAVE_OPHDR_COND (IN CIfrOpHeader &, IN BOOLEAN, UINT32 LineNo = 0);
4018 VOID _CLEAR_SAVED_OPHDR (VOID);
4019 BOOLEAN _SET_SAVED_OPHDR_SCOPE (VOID);
4020
4021
4022 EFI_VARSTORE_INFO mCurrQestVarInfo;
4023 EFI_GUID *mOverrideClassGuid;
4024 CHAR8* mLastFormEndAddr;
4025
4026 //
4027 // Whether the question already has default value.
4028 //
4029 UINT16 mUsedDefaultArray[EFI_IFR_MAX_DEFAULT_TYPE];
4030 UINT16 mUsedDefaultCount;
4031
4032 //
4033 // For framework vfr compatibility
4034 //
4035 BOOLEAN mCompatibleMode;
4036 EFI_GUID mFormsetGuid;
4037
4038 VOID _CRT_OP (IN BOOLEAN);
4039
4040 VOID _SAVE_CURRQEST_VARINFO (IN EFI_VARSTORE_INFO &);
4041 EFI_VARSTORE_INFO & _GET_CURRQEST_VARTINFO (VOID);
4042
4043 UINT8 _GET_CURRQEST_DATATYPE ();
4044 UINT32 _GET_CURRQEST_VARSIZE ();
4045 UINT32 _GET_CURRQEST_ARRAY_SIZE();
4046 VOID CheckDuplicateDefaultValue (IN EFI_DEFAULT_ID, IN ANTLRTokenPtr);
4047
4048 public:
4049 VOID _PCATCH (IN INTN, IN INTN, IN ANTLRTokenPtr, IN CONST CHAR8 *);
4050 VOID _PCATCH (IN EFI_VFR_RETURN_CODE);
4051 VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN ANTLRTokenPtr);
4052 VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32);
4053 VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);
4054
4055 VOID syn (ANTLRAbstractToken *, ANTLRChar *, SetWordType *, ANTLRTokenType, INT32);
4056
4057 CHAR8* TrimHex (IN CHAR8 *, OUT BOOLEAN *);
4058 CHAR8* _U32TOS (IN UINT32);
4059 UINT8 _STOU8 (IN CHAR8 *);
4060 UINT16 _STOU16 (IN CHAR8 *);
4061 UINT32 _STOU32 (IN CHAR8 *);
4062 UINT64 _STOU64 (IN CHAR8 *);
4063 EFI_HII_DATE _STOD (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *);
4064 EFI_HII_TIME _STOT (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *);
4065 EFI_HII_REF _STOR (IN CHAR8 *, IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *);
4066
4067 EFI_STRING_ID _STOSID (IN CHAR8 *);
4068 EFI_FORM_ID _STOFID (IN CHAR8 *);
4069 EFI_QUESTION_ID _STOQID (IN CHAR8 *);
4070
4071 VOID _STRCAT (IN OUT CHAR8 **, IN CONST CHAR8 *);
4072
4073 VOID _DeclareDefaultLinearVarStore (IN UINT32);
4074 VOID _DeclareStandardDefaultStorage (IN UINT32);
4075 VOID _DeclareDefaultFrameworkVarStore (IN UINT32);
4076
4077 VOID AssignQuestionKey (IN CIfrQuestionHeader &, IN ANTLRTokenPtr);
4078
4079 VOID ConvertIdExpr (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32);
4080 VOID IdEqValDoSpecial (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN UINT16, IN EFI_COMPARE_TYPE);
4081 VOID IdEqIdDoSpecial (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN EFI_COMPARE_TYPE);
4082 VOID IdEqListDoSpecial (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN UINT16, IN UINT16 *);
4083 VOID SetOverrideClassGuid (IN EFI_GUID *);
4084 //
4085 // For framework vfr compatibility
4086 //
4087 VOID SetCompatibleMode (IN BOOLEAN);
4088 >>
4089 }
4090
4091 <<
4092 VOID
4093 EfiVfrParser::_SAVE_OPHDR_COND (
4094 IN CIfrOpHeader &OpHdr,
4095 IN BOOLEAN Cond,
4096 IN UINT32 LineNo
4097 )
4098 {
4099 if (Cond == TRUE) {
4100 if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
4101 return ;
4102 }
4103 mCIfrOpHdr[mCIfrOpHdrIndex] = new CIfrOpHeader(OpHdr);
4104 mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = LineNo;
4105 }
4106 }
4107
4108 VOID
4109 EfiVfrParser::_CLEAR_SAVED_OPHDR (
4110 VOID
4111 )
4112 {
4113 mCIfrOpHdr[mCIfrOpHdrIndex] = NULL;
4114 mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = 0;
4115 }
4116
4117 BOOLEAN
4118 EfiVfrParser::_SET_SAVED_OPHDR_SCOPE (
4119 VOID
4120 )
4121 {
4122 if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
4123 mCIfrOpHdr[mCIfrOpHdrIndex]->SetScope (1);
4124 return TRUE;
4125 }
4126
4127 //
4128 // IfrOpHdr is not set, FALSE is return.
4129 //
4130 return FALSE;
4131 }
4132
4133 VOID
4134 EfiVfrParser::_CRT_OP (
4135 IN BOOLEAN Crt
4136 )
4137 {
4138 gCreateOp = Crt;
4139 }
4140
4141 VOID
4142 EfiVfrParser::_SAVE_CURRQEST_VARINFO (
4143 IN EFI_VARSTORE_INFO &Info
4144 )
4145 {
4146 mCurrQestVarInfo = Info;
4147 }
4148
4149 EFI_VARSTORE_INFO &
4150 EfiVfrParser::_GET_CURRQEST_VARTINFO (
4151 VOID
4152 )
4153 {
4154 return mCurrQestVarInfo;
4155 }
4156
4157 UINT32
4158 EfiVfrParser::_GET_CURRQEST_ARRAY_SIZE (
4159 VOID
4160 )
4161 {
4162 UINT8 Size = 1;
4163
4164 switch (mCurrQestVarInfo.mVarType) {
4165 case EFI_IFR_TYPE_NUM_SIZE_8:
4166 Size = 1;
4167 break;
4168
4169 case EFI_IFR_TYPE_NUM_SIZE_16:
4170 Size = 2;
4171 break;
4172
4173 case EFI_IFR_TYPE_NUM_SIZE_32:
4174 Size = 4;
4175 break;
4176
4177 case EFI_IFR_TYPE_NUM_SIZE_64:
4178 Size = 8;
4179 break;
4180
4181 default:
4182 break;
4183 }
4184
4185 return (mCurrQestVarInfo.mVarTotalSize / Size);
4186 }
4187
4188 UINT8
4189 EfiVfrParser::_GET_CURRQEST_DATATYPE (
4190 VOID
4191 )
4192 {
4193 return mCurrQestVarInfo.mVarType;
4194 }
4195
4196 UINT32
4197 EfiVfrParser::_GET_CURRQEST_VARSIZE (
4198 VOID
4199 )
4200 {
4201 return mCurrQestVarInfo.mVarTotalSize;
4202 }
4203
4204 VOID
4205 EfiVfrParser::_PCATCH (
4206 IN INTN ReturnCode,
4207 IN INTN ExpectCode,
4208 IN ANTLRTokenPtr Tok,
4209 IN CONST CHAR8 *ErrorMsg
4210 )
4211 {
4212 if (ReturnCode != ExpectCode) {
4213 mParserStatus++;
4214 gCVfrErrorHandle.PrintMsg (Tok->getLine(), Tok->getText(), "Error", ErrorMsg);
4215 }
4216 }
4217
4218 VOID
4219 EfiVfrParser::_PCATCH (
4220 IN EFI_VFR_RETURN_CODE ReturnCode
4221 )
4222 {
4223 mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode);
4224 }
4225
4226 VOID
4227 EfiVfrParser::_PCATCH (
4228 IN EFI_VFR_RETURN_CODE ReturnCode,
4229 IN ANTLRTokenPtr Tok
4230 )
4231 {
4232 mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, Tok->getLine(), Tok->getText());
4233 }
4234
4235 VOID
4236 EfiVfrParser::_PCATCH (
4237 IN EFI_VFR_RETURN_CODE ReturnCode,
4238 IN UINT32 LineNum
4239 )
4240 {
4241 mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, LineNum);
4242 }
4243
4244 VOID
4245 EfiVfrParser::_PCATCH (
4246 IN EFI_VFR_RETURN_CODE ReturnCode,
4247 IN UINT32 LineNum,
4248 IN CONST CHAR8 *ErrorMsg
4249 )
4250 {
4251 mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, LineNum, (CHAR8 *) ErrorMsg);
4252 }
4253
4254 VOID
4255 EfiVfrParser::syn (
4256 ANTLRAbstractToken *Tok,
4257 ANTLRChar *Egroup,
4258 SetWordType *Eset,