Fix a bug in secure boot configuration driver: Enroll DB/KEK will disable Attempt...
[mirror_edk2.git] / BaseTools / Source / C / VfrCompile / VfrSyntax.g
CommitLineData
30fdf114 1/*++\r
da92f276 2Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
40d841f6 3This program and the accompanying materials\r
30fdf114
LG
4are licensed and made available under the terms and conditions of the BSD License\r
5which accompanies this distribution. The full text of the license may be found at\r
6http://opensource.org/licenses/bsd-license.php\r
7\r
8THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
9WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
10\r
11Module Name:\r
12 VfrSyntax.g\r
13\r
14Abstract:\r
15\r
16--*/\r
17\r
18#header<<\r
19\r
20#include "EfiVfr.h"\r
21#include "VfrFormPkg.h"\r
22#include "VfrError.h"\r
23#include "VfrUtilityLib.h"\r
24#include "AToken.h"\r
25#include "ATokPtr.h"\r
26>>\r
27\r
28<<\r
29#include "stdio.h"\r
30#include "PBlackBox.h"\r
31#include "DLexerBase.h"\r
32#include "VfrLexer.h"\r
33#include "AToken.h"\r
34\r
35#define GET_LINENO(Obj) ((Obj)->getLine())\r
36#define SET_LINE_INFO(Obj, L) {(Obj).SetLineNo((L)->getLine());} while (0)\r
37#define CRT_END_OP(Obj) {CIfrEnd EObj; if (Obj != NULL) EObj.SetLineNo ((Obj)->getLine());} while (0)\r
38\r
39typedef ANTLRCommonToken ANTLRToken;\r
40\r
41class CVfrDLGLexer : public VfrLexer\r
42{\r
43public:\r
44 CVfrDLGLexer (DLGFileInput *F) : VfrLexer (F) {};\r
45 INT32 errstd (char *Text)\r
46 {\r
47 printf ("unrecognized input '%s'\n", Text);\r
48 }\r
49};\r
50\r
51UINT8\r
52VfrParserStart (\r
53 IN FILE *File,\r
4234283c 54 IN INPUT_INFO_TO_SYNTAX *InputInfo\r
30fdf114
LG
55 )\r
56{\r
57 ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken> VfrParser(File);\r
4234283c
LG
58 VfrParser.parser()->SetCompatibleMode (InputInfo->CompatibleMode);\r
59 VfrParser.parser()->SetOverrideClassGuid (InputInfo->OverrideClassGuid);\r
30fdf114
LG
60 return VfrParser.parser()->vfrProgram();\r
61}\r
62>>\r
63\r
64//\r
65// Define a lexical class for parsing quoted strings. Basically\r
66// starts with a double quote, and ends with a double quote that\r
67// is not preceeded with a backslash.\r
68//\r
69#lexclass QUOTED_STRING\r
70#token TheString "~[\"]*\"" << mode (START); >>\r
71\r
72//\r
73// Define a lexclass for skipping over C++ style comments\r
74//\r
75#lexclass CPP_COMMENT\r
76#token "~[\n]*" << skip (); >>\r
77#token "\n" << skip (); mode (START); newline (); >>\r
78\r
79//\r
80// Standard lexclass is START\r
81//\r
82#lexclass START\r
83\r
84//\r
85// Find start of C++ style comments\r
86//\r
87#token "//" << skip (); mode (CPP_COMMENT); >>\r
88\r
89//\r
90// Skip whitespace\r
91//\r
92#token "[\ \t]" << skip (); >>\r
93\r
94//\r
95// Skip over newlines, but count them\r
96//\r
97#token "\n" << skip (); newline (); >>\r
98\r
99//\r
100// Skip over 'extern' in any included .H file\r
101//\r
102#token "extern" << skip (); mode (CPP_COMMENT); >>\r
103\r
104//\r
105// Tokens for the different keywords. Syntax is:\r
106// TokenName("ErrorMessageText") "TokenString"\r
107// where:\r
108// TokenName is the token name (must be capitalized) that is used in the rules\r
109// ErrorMessageText is the string the compiler emits when it detects a syntax error\r
110// TokenString is the actual matching string used in the user script\r
111//\r
112#token FormPkgType("formpkgtype") "formpkgtype"\r
113#token OpenBrace("{") "\{"\r
114#token CloseBrace("}") "\}"\r
115#token OpenParen("(") "\("\r
116#token CloseParen(")") "\)"\r
117#token OpenBracket("[") "\["\r
118#token CloseBracket("]") "\]"\r
119\r
120#token LineDefinition "#line\ [0-9]+\ \"~[\"]+\"[\ \t]*\n" << gCVfrErrorHandle.ParseFileScopeRecord (begexpr (), line ()); skip (); newline (); >>\r
121#token DevicePath("devicepath") "devicepath"\r
122#token FormSet("formset") "formset"\r
123#token FormSetId("formsetid") "formsetid"\r
124#token EndFormSet("endformset") "endformset"\r
125#token Title("title") "title"\r
126#token FormId("formid") "formid"\r
127#token OneOf("oneof") "oneof"\r
128#token EndOneOf("endoneof") "endoneof"\r
129#token Prompt("prompt") "prompt"\r
130#token OrderedList("orderedlist") "orderedlist"\r
131#token MaxContainers("maxcontainers") "maxcontainers"\r
132#token EndList("endlist") "endlist"\r
133#token EndForm("endform") "endform"\r
134#token Form("form") "form"\r
52302d4d
LG
135#token FormMap("formmap") "formmap"\r
136#token MapTitle("maptitle") "maptitle"\r
137#token MapGuid("mapguid") "mapguid"\r
30fdf114
LG
138#token Subtitle("subtitle") "subtitle"\r
139#token Help("help") "help"\r
140#token Text("text") "text"\r
141#token Option("option") "option"\r
142#token FLAGS("flags") "flags"\r
143#token Date("date") "date"\r
144#token EndDate("enddate") "enddate"\r
145#token Year("year") "year"\r
146#token Month("month") "month"\r
147#token Day("day") "day"\r
148#token Time("time") "time"\r
149#token EndTime("endtime") "endtime"\r
150#token Hour("hour") "hour"\r
151#token Minute("minute") "minute"\r
152#token Second("second") "second"\r
153#token GrayOutIf("grayoutif") "grayoutif"\r
154#token Label("label") "label"\r
155#token Timeout("timeout") "timeout"\r
156#token Inventory("inventory") "inventory"\r
157#token NonNvDataMap("_NON_NV_DATA_MAP") "_NON_NV_DATA_MAP"\r
158#token Struct("struct") "struct"\r
159#token Boolean("BOOLEAN") "BOOLEAN"\r
160#token Uint64("UINT64") "UINT64"\r
161#token Uint32("UINT32") "UINT32"\r
162#token Uint16("UINT16") "UINT16"\r
163#token Char16("CHAR16") "CHAR16"\r
164#token Uint8("UINT8") "UINT8"\r
165#token Uuid("guid") "guid"\r
166#token CheckBox("checkbox") "checkbox"\r
167#token EndCheckBox("endcheckbox") "endcheckbox"\r
168#token Numeric("numeric") "numeric"\r
169#token EndNumeric("endnumeric") "endnumeric"\r
170#token Minimum("minimum") "minimum"\r
171#token Maximum("maximum") "maximum"\r
172#token STEP("step") "step"\r
173#token Default("default") "default"\r
174#token Password("password") "password"\r
175#token EndPassword("endpassword") "endpassword"\r
176#token String("string") "string"\r
177#token EndString("endstring") "endstring"\r
178#token MinSize("minsize") "minsize"\r
179#token MaxSize("maxsize") "maxsize"\r
180#token Encoding("encoding") "encoding"\r
181#token SuppressIf("suppressif") "suppressif"\r
182#token DisableIf("disableif") "disableif"\r
183#token Hidden("hidden") "hidden"\r
184#token Goto("goto") "goto"\r
185#token FormSetGuid("formsetguid") "formsetguid"\r
186#token InconsistentIf("inconsistentif") "inconsistentif"\r
187#token NoSubmitIf("nosubmitif") "nosubmitif"\r
188#token EndIf("endif") "endif"\r
189#token Key("key") "key"\r
190#token DefaultFlag("DEFAULT") "DEFAULT"\r
191#token ManufacturingFlag("MANUFACTURING") "MANUFACTURING"\r
192#token InteractiveFlag("INTERACTIVE") "INTERACTIVE"\r
193#token NVAccessFlag("NV_ACCESS") "NV_ACCESS"\r
194#token ResetRequiredFlag("RESET_REQUIRED") "RESET_REQUIRED"\r
195#token LateCheckFlag("LATE_CHECK") "LATE_CHECK"\r
196#token ReadOnlyFlag("READ_ONLY") "READ_ONLY"\r
197#token OptionOnlyFlag("OPTIONS_ONLY") "OPTIONS_ONLY"\r
198#token Class("class") "class"\r
199#token Subclass("subclass") "subclass"\r
200#token ClassGuid("classguid") "classguid"\r
201#token TypeDef("typedef") "typedef"\r
202#token Restore("restore") "restore"\r
203#token Save("save") "save"\r
204#token Defaults("defaults") "defaults"\r
205#token Banner("banner") "banner"\r
206#token Align("align") "align"\r
207#token Left("left") "left"\r
208#token Right("right") "right"\r
209#token Center("center") "center"\r
210#token Line("line") "line"\r
211#token Name("name") "name"\r
212\r
213#token VarId("varid") "varid"\r
214#token Question("question") "question"\r
215#token QuestionId("questionid") "questionid"\r
216#token Image("image") "image"\r
217#token Locked("locked") "locked"\r
218#token Rule("rule") "rule"\r
219#token EndRule("endrule") "endrule"\r
220#token Value("value") "value"\r
52302d4d
LG
221#token Read("read") "read"\r
222#token Write("write") "write"\r
30fdf114
LG
223#token ResetButton("resetbutton") "resetbutton"\r
224#token EndResetButton("endresetbutton") "endresetbutton"\r
225#token DefaultStore("defaultstore") "defaultstore"\r
226#token Attribute("attribute") "attribute"\r
227#token Varstore("varstore") "varstore"\r
228#token Efivarstore("efivarstore") "efivarstore"\r
229#token VarSize("varsize") "varsize"\r
230#token NameValueVarStore("namevaluevarstore") "namevaluevarstore"\r
231#token Action("action") "action"\r
232#token Config("config") "config"\r
233#token EndAction("endaction") "endaction"\r
234#token Refresh("refresh") "refresh"\r
235#token Interval("interval") "interval"\r
236#token VarstoreDevice("varstoredevice") "varstoredevice"\r
da92f276
LG
237#token GuidOp("guidop") "guidop"\r
238#token EndGuidOp("endguidop") "endguidop"\r
239#token DataType("datatype") "datatype"\r
240#token Data("data") "data"\r
4234283c 241#token Modal("modal") "modal"\r
da92f276 242\r
30fdf114
LG
243//\r
244// Define the class and subclass tokens\r
245//\r
246#token ClassNonDevice("NONDEVICE") "NON_DEVICE"\r
247#token ClassDiskDevice("DISK_DEVICE") "DISK_DEVICE"\r
248#token ClassVideoDevice("VIDEO_DEVICE") "VIDEO_DEVICE"\r
249#token ClassNetworkDevice("NETWORK_DEVICE") "NETWORK_DEVICE"\r
250#token ClassInputDevice("INPUT_DEVICE") "INPUT_DEVICE"\r
251#token ClassOnBoardDevice("ONBOARD_DEVICE") "ONBOARD_DEVICE"\r
252#token ClassOtherDevice("OTHER_DEVICE") "OTHER_DEVICE"\r
253\r
254#token SubclassSetupApplication("SETUP_APPLICATION") "SETUP_APPLICATION"\r
255#token SubclassGeneralApplication("GENERAL_APPLICATION") "GENERAL_APPLICATION"\r
256#token SubclassFrontPage("FRONT_PAGE") "FRONT_PAGE"\r
257#token SubclassSingleUse("SINGLE_USE") "SINGLE_USE"\r
258\r
259//\r
260// This is the overall definition of a VFR form definition script.\r
261//\r
262\r
263vfrProgram > [UINT8 Return] :\r
264 <<\r
52302d4d
LG
265 mParserStatus = 0;\r
266 mCIfrOpHdrIndex = 0;\r
30fdf114
LG
267 mConstantOnlyInExpression = FALSE;\r
268 >>\r
269 (\r
270 vfrPragmaPackDefinition\r
271 | vfrDataStructDefinition\r
272 )*\r
273 vfrFormSetDefinition\r
274 << $Return = mParserStatus; >>\r
275 ;\r
276\r
277pragmaPackShowDef :\r
278 L:"show" << gCVfrVarDataTypeDB.Pack (L->getLine(), VFR_PACK_SHOW); >>\r
279 ;\r
280\r
281pragmaPackStackDef :\r
282 <<\r
283 UINT32 LineNum;\r
284 UINT8 PackAction;\r
285 CHAR8 *Identifier = NULL;\r
286 UINT32 PackNumber = DEFAULT_PACK_ALIGN;\r
287 >>\r
288 (\r
289 L1:"push" << LineNum = L1->getLine(); PackAction = VFR_PACK_PUSH; >>\r
290 | L2:"pop" << LineNum = L2->getLine(); PackAction = VFR_PACK_POP; >>\r
291 )\r
292 {\r
293 "," ID:StringIdentifier << Identifier = ID->getText(); >>\r
294 }\r
295 {\r
296 "," N:Number << PackAction |= VFR_PACK_ASSIGN; PackNumber = _STOU32(N->getText()); >>\r
297 }\r
298 << gCVfrVarDataTypeDB.Pack (LineNum, PackAction, Identifier, PackNumber); >>\r
299 ;\r
300\r
301pragmaPackNumber :\r
302 <<\r
303 UINT32 LineNum;\r
304 UINT32 PackNumber = DEFAULT_PACK_ALIGN;\r
305 >>\r
306 N:Number << LineNum = N->getLine(); PackNumber = _STOU32(N->getText()); >>\r
307 << gCVfrVarDataTypeDB.Pack (LineNum, VFR_PACK_ASSIGN, NULL, PackNumber); >>\r
308 ;\r
309\r
310vfrPragmaPackDefinition :\r
311 "\#pragma" "pack" "\("\r
312 {\r
313 pragmaPackShowDef\r
314 | pragmaPackStackDef\r
315 | pragmaPackNumber\r
316 }\r
317 "\)"\r
318 ;\r
319\r
320vfrDataStructDefinition :\r
321 { TypeDef } Struct << gCVfrVarDataTypeDB.DeclareDataTypeBegin (); >>\r
322 { NonNvDataMap }\r
323 {\r
324 N1:StringIdentifier << _PCATCH(gCVfrVarDataTypeDB.SetNewTypeName (N1->getText()), N1); >>\r
325 }\r
326 OpenBrace\r
327 vfrDataStructFields\r
328 CloseBrace\r
329 {\r
330 N2:StringIdentifier << _PCATCH(gCVfrVarDataTypeDB.SetNewTypeName (N2->getText()), N2); >>\r
331 }\r
332 ";" << gCVfrVarDataTypeDB.DeclareDataTypeEnd (); >>\r
333 ;\r
334\r
335vfrDataStructFields :\r
336 (\r
337 dataStructField64 |\r
338 dataStructField32 |\r
339 dataStructField16 |\r
340 dataStructField8 |\r
341 dataStructFieldBool |\r
342 dataStructFieldString |\r
343 dataStructFieldDate |\r
344 dataStructFieldTime |\r
4234283c 345 dataStructFieldRef |\r
30fdf114
LG
346 dataStructFieldUser\r
347 )*\r
348 ;\r
349\r
350dataStructField64 :\r
351 << UINT32 ArrayNum = 0; >>\r
52302d4d 352 D:"UINT64"\r
30fdf114
LG
353 N:StringIdentifier\r
354 {\r
355 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
356 }\r
52302d4d 357 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>\r
30fdf114
LG
358 ;\r
359\r
360dataStructField32 :\r
361 << UINT32 ArrayNum = 0; >>\r
52302d4d 362 D:"UINT32"\r
30fdf114
LG
363 N:StringIdentifier\r
364 {\r
365 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
366 }\r
52302d4d 367 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>\r
30fdf114
LG
368 ;\r
369\r
370dataStructField16 :\r
52302d4d
LG
371 << \r
372 UINT32 ArrayNum = 0; \r
373 >>\r
30fdf114
LG
374 ("UINT16" | "CHAR16")\r
375 N:StringIdentifier\r
376 {\r
377 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
378 }\r
52302d4d 379 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), (CHAR8 *) "UINT16", ArrayNum), N); >>\r
30fdf114
LG
380 ;\r
381\r
382dataStructField8 :\r
383 << UINT32 ArrayNum = 0; >>\r
52302d4d 384 D:"UINT8"\r
30fdf114
LG
385 N:StringIdentifier\r
386 {\r
387 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
388 }\r
52302d4d 389 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>\r
30fdf114
LG
390 ;\r
391\r
392dataStructFieldBool :\r
393 << UINT32 ArrayNum = 0; >>\r
52302d4d 394 D:"BOOLEAN"\r
30fdf114
LG
395 N:StringIdentifier\r
396 {\r
397 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
398 }\r
52302d4d 399 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>\r
30fdf114
LG
400 ;\r
401\r
402dataStructFieldString :\r
403 << UINT32 ArrayNum = 0; >>\r
52302d4d 404 D:"EFI_STRING_ID"\r
30fdf114
LG
405 N:StringIdentifier\r
406 {\r
407 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
408 }\r
52302d4d 409 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>\r
30fdf114
LG
410 ;\r
411\r
412dataStructFieldDate :\r
413 << UINT32 ArrayNum = 0; >>\r
52302d4d 414 D:"EFI_HII_DATE"\r
30fdf114
LG
415 N:StringIdentifier\r
416 {\r
417 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
418 }\r
52302d4d 419 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>\r
30fdf114
LG
420 ;\r
421\r
422dataStructFieldTime :\r
423 << UINT32 ArrayNum = 0; >>\r
52302d4d 424 D:"EFI_HII_TIME"\r
30fdf114
LG
425 N:StringIdentifier\r
426 {\r
427 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
428 }\r
52302d4d 429 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>\r
30fdf114
LG
430 ;\r
431\r
4234283c
LG
432dataStructFieldRef :\r
433 << UINT32 ArrayNum = 0; >>\r
434 D:"EFI_HII_REF"\r
435 N:StringIdentifier\r
436 {\r
437 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
438 }\r
439 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>\r
440 ;\r
441\r
30fdf114
LG
442dataStructFieldUser :\r
443 << UINT32 ArrayNum = 0; >>\r
444 T:StringIdentifier\r
445 N:StringIdentifier\r
446 {\r
447 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
448 }\r
449 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), T->getText(), ArrayNum), T); >>\r
450 ;\r
451\r
452//*****************************************************************************\r
453//\r
454// the syntax of GUID definition\r
455//\r
456guidSubDefinition [EFI_GUID &Guid] :\r
457 G4:Number "," G5:Number "," G6:Number "," G7:Number "," G8:Number "," G9:Number "," G10:Number "," G11:Number\r
458 <<\r
459 Guid.Data4[0] = _STOU8(G4->getText());\r
460 Guid.Data4[1] = _STOU8(G5->getText());\r
461 Guid.Data4[2] = _STOU8(G6->getText());\r
462 Guid.Data4[3] = _STOU8(G7->getText());\r
463 Guid.Data4[4] = _STOU8(G8->getText());\r
464 Guid.Data4[5] = _STOU8(G9->getText());\r
465 Guid.Data4[6] = _STOU8(G10->getText());\r
466 Guid.Data4[7] = _STOU8(G11->getText());\r
467 >>\r
468 ;\r
469\r
470guidDefinition [EFI_GUID &Guid] :\r
471 OpenBrace\r
472 G1:Number "," G2:Number "," G3:Number ","\r
473 <<\r
474 Guid.Data1 = _STOU32 (G1->getText());\r
475 Guid.Data2 = _STOU16 (G2->getText());\r
476 Guid.Data3 = _STOU16 (G3->getText());\r
477 >>\r
478 (\r
479 OpenBrace guidSubDefinition[Guid] CloseBrace\r
480 | guidSubDefinition[Guid]\r
481 )\r
482 CloseBrace\r
483 ;\r
484\r
485//*****************************************************************************\r
486//\r
487// the syntax of form set definition\r
488//\r
489vfrFormSetDefinition :\r
490 <<\r
491 EFI_GUID Guid;\r
492 EFI_GUID DefaultClassGuid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID;\r
493 EFI_GUID ClassGuid1, ClassGuid2, ClassGuid3;\r
494 UINT8 ClassGuidNum = 0;\r
495 CIfrFormSet *FSObj = NULL;\r
496 UINT16 C, SC;\r
497 >>\r
498 L:FormSet\r
499 Uuid "=" guidDefinition[Guid] ","\r
500 Title "=" "STRING_TOKEN" "\(" S1:Number "\)" ","\r
501 Help "=" "STRING_TOKEN" "\(" S2:Number "\)" ","\r
502 {\r
503 ClassGuid "=" guidDefinition[ClassGuid1] << ++ClassGuidNum; >>\r
504 {\r
505 "\|" guidDefinition[ClassGuid2] << ++ClassGuidNum; >>\r
506 }\r
507 {\r
508 "\|" guidDefinition[ClassGuid3] << ++ClassGuidNum; >>\r
509 }\r
510 ","\r
511 }\r
512 <<\r
4234283c
LG
513 if (mOverrideClassGuid != NULL && ClassGuidNum >= 3) {\r
514 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Already has 3 class guids, can't add extra class guid!");\r
515 }\r
30fdf114
LG
516 switch (ClassGuidNum) {\r
517 case 0:\r
4234283c
LG
518 if (mOverrideClassGuid != NULL) {\r
519 ClassGuidNum = 2;\r
520 } else {\r
521 ClassGuidNum = 1;\r
522 }\r
523 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));\r
30fdf114 524 FSObj->SetClassGuid(&DefaultClassGuid);\r
4234283c
LG
525 if (mOverrideClassGuid != NULL) {\r
526 FSObj->SetClassGuid(mOverrideClassGuid);\r
0d2711a6 527 }\r
30fdf114
LG
528 break;\r
529 case 1:\r
4234283c
LG
530 if (mOverrideClassGuid != NULL) {\r
531 ClassGuidNum ++;\r
0d2711a6 532 }\r
52302d4d 533 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));\r
30fdf114 534 FSObj->SetClassGuid(&ClassGuid1);\r
4234283c
LG
535 if (mOverrideClassGuid != NULL) {\r
536 FSObj->SetClassGuid(mOverrideClassGuid);\r
0d2711a6 537 }\r
30fdf114
LG
538 break;\r
539 case 2:\r
4234283c
LG
540 if (mOverrideClassGuid != NULL) {\r
541 ClassGuidNum ++;\r
0d2711a6 542 }\r
52302d4d 543 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));\r
30fdf114
LG
544 FSObj->SetClassGuid(&ClassGuid1);\r
545 FSObj->SetClassGuid(&ClassGuid2);\r
4234283c
LG
546 if (mOverrideClassGuid != NULL) {\r
547 FSObj->SetClassGuid(mOverrideClassGuid);\r
0d2711a6 548 }\r
30fdf114 549 break;\r
52302d4d
LG
550 case 3:\r
551 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));\r
30fdf114
LG
552 FSObj->SetClassGuid(&ClassGuid1);\r
553 FSObj->SetClassGuid(&ClassGuid2);\r
554 FSObj->SetClassGuid(&ClassGuid3);\r
555 break;\r
52302d4d
LG
556 default:\r
557 break;\r
30fdf114
LG
558 }\r
559\r
560 SET_LINE_INFO (*FSObj, L);\r
561 FSObj->SetGuid (&Guid);\r
562 //\r
563 // for framework vfr to store formset guid used by varstore and efivarstore\r
564 //\r
565 if (mCompatibleMode) {\r
566 memcpy (&mFormsetGuid, &Guid, sizeof (EFI_GUID));\r
567 }\r
568 FSObj->SetFormSetTitle (_STOSID(S1->getText()));\r
569 FSObj->SetHelp (_STOSID(S2->getText()));\r
570 >>\r
571 {\r
572 FC:Class "=" classDefinition[C] "," << {CIfrClass CObj;SET_LINE_INFO (CObj, FC); CObj.SetClass(C);} >>\r
573 }\r
574 {\r
575 FSC:Subclass "=" subclassDefinition[SC] "," << {CIfrSubClass SCObj; SET_LINE_INFO (SCObj, FSC); SCObj.SetSubClass(SC);} >>\r
576 }\r
577 <<\r
578 _DeclareStandardDefaultStorage (GET_LINENO (L));\r
579 >>\r
580 vfrFormSetList\r
581 E:EndFormSet <<\r
582 if (mCompatibleMode) {\r
583 //\r
584 // declare all undefined varstore and efivarstore\r
585 //\r
586 _DeclareDefaultFrameworkVarStore (GET_LINENO(E));\r
587 }\r
588 CRT_END_OP (E); if (FSObj != NULL) delete FSObj;\r
589 >>\r
590 ";"\r
591 ;\r
592\r
593vfrFormSetList :\r
594 (\r
595 vfrFormDefinition |\r
52302d4d 596 vfrFormMapDefinition |\r
30fdf114
LG
597 vfrStatementImage |\r
598 vfrStatementVarStoreLinear |\r
599 vfrStatementVarStoreEfi |\r
600 vfrStatementVarStoreNameValue |\r
601 vfrStatementDefaultStore |\r
a709adfa 602 vfrStatementDisableIfFormSet |\r
da92f276
LG
603 vfrStatementSuppressIfFormSet |\r
604 vfrStatementExtension\r
30fdf114
LG
605 )*\r
606 ;\r
607\r
da92f276
LG
608vfrStatementExtension:\r
609 << \r
610 EFI_GUID Guid;\r
611 CIfrGuid *GuidObj = NULL;\r
612 CHAR8 *TypeName = NULL;\r
613 UINT32 TypeSize = 0;\r
614 UINT8 *DataBuff = NULL;\r
615 UINT32 Size = 0;\r
616 UINT8 Idx = 0;\r
617 UINT32 LineNum;\r
618 BOOLEAN IsStruct = FALSE;\r
619 UINT32 ArrayNum = 0;\r
620 >>\r
621 L:GuidOp\r
622 Uuid "=" guidDefinition[Guid]\r
623 {"," DataType "=" \r
624 (\r
625 U64:"UINT64" {OpenBracket AN1:Number CloseBracket <<ArrayNum = _STOU32(AN1->getText());>>}\r
626 << TypeName = U64->getText(); LineNum = U64->getLine(); >>\r
627 | U32:"UINT32" {OpenBracket AN2:Number CloseBracket <<ArrayNum = _STOU32(AN2->getText());>>}\r
628 << TypeName = U32->getText(); LineNum = U32->getLine(); >>\r
629 | U16:"UINT16" {OpenBracket AN3:Number CloseBracket <<ArrayNum = _STOU32(AN3->getText());>>}\r
630 << TypeName = U16->getText(); LineNum = U16->getLine(); >>\r
631 | U8:"UINT8" {OpenBracket AN4:Number CloseBracket <<ArrayNum = _STOU32(AN4->getText());>>}\r
632 << TypeName = U8->getText(); LineNum = U8->getLine(); >>\r
633 | BL:"BOOLEAN" {OpenBracket AN5:Number CloseBracket <<ArrayNum = _STOU32(AN5->getText());>>}\r
634 << TypeName = BL->getText(); LineNum = BL->getLine(); >>\r
635 | SI:"EFI_STRING_ID" {OpenBracket AN6:Number CloseBracket <<ArrayNum = _STOU32(AN6->getText());>>}\r
636 << TypeName = SI->getText(); LineNum = SI->getLine(); >>\r
637 | D:"EFI_HII_DATE" {OpenBracket AN7:Number CloseBracket <<ArrayNum = _STOU32(AN7->getText());>>}\r
638 << TypeName = D->getText(); LineNum = D->getLine(); IsStruct = TRUE;>>\r
639 | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket <<ArrayNum = _STOU32(AN8->getText());>>}\r
640 << TypeName = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>\r
4234283c
LG
641 | R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = _STOU32(AN9->getText());>>}\r
642 << TypeName = R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>> \r
643 | TN:StringIdentifier {OpenBracket AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText());>>}\r
da92f276
LG
644 << TypeName = TN->getText(); LineNum = TN->getLine(); IsStruct = TRUE;>>\r
645 )\r
646 <<\r
647 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &TypeSize), LineNum);\r
648 if (ArrayNum > 0) {\r
649 Size = TypeSize*ArrayNum;\r
650 } else {\r
651 Size = TypeSize;\r
652 }\r
653 if (Size > (128 - sizeof (EFI_IFR_GUID))) return;\r
654 DataBuff = (UINT8 *)malloc(Size);\r
655 for (Idx = 0; Idx < Size; Idx++) {\r
656 DataBuff[Idx] = 0;\r
657 }\r
658 >>\r
659 vfrExtensionData [DataBuff, Size, TypeName, TypeSize, IsStruct, ArrayNum]\r
660 }\r
661 <<\r
662 {\r
663 GuidObj = new CIfrGuid(Size);\r
664 if (GuidObj != NULL) {\r
665 GuidObj->SetLineNo(L->getLine());\r
666 GuidObj->SetGuid (&Guid);\r
667 }\r
668 }\r
669 if (TypeName != NULL) {\r
670 GuidObj->SetData(DataBuff, Size);\r
671 }\r
672 >>\r
673 {","\r
674 (\r
675 vfrStatementExtension\r
676 )*\r
677 E:EndGuidOp << GuidObj->SetScope(1); CRT_END_OP (E); >>\r
678 }\r
679 <<\r
680 if (GuidObj != NULL) delete GuidObj;\r
681 if (DataBuff != NULL) free(DataBuff);\r
682 >>\r
683 ";"\r
684;\r
685\r
686vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 TypeSize, BOOLEAN IsStruct, UINT32 ArrayNum]:\r
687 <<\r
688 CHAR8 *TFName = NULL;\r
689 UINT32 ArrayIdx = 0;\r
690 UINT16 FieldOffset;\r
691 UINT8 FieldType;\r
692 UINT32 FieldSize;\r
693 UINT64 Data_U64 = 0;\r
694 UINT32 Data_U32 = 0;\r
695 UINT16 Data_U16 = 0;\r
696 UINT8 Data_U8 = 0;\r
697 BOOLEAN Data_BL = 0;\r
698 EFI_STRING_ID Data_SID = 0;\r
699 BOOLEAN IsArray = FALSE;\r
700 UINT8 *ByteOffset = NULL;\r
701 >>\r
702(\r
703 ("," "data" {OpenBracket IDX1:Number CloseBracket <<IsArray = TRUE;>>}\r
704 <<\r
705 ArrayIdx = 0;\r
706 if (IsArray == TRUE) {\r
707 ArrayIdx = _STOU8(IDX1->getText());\r
708 if (ArrayIdx >= ArrayNum) return;\r
709 IsArray = FALSE;\r
710 }\r
711 ByteOffset = DataBuff + (ArrayIdx * TypeSize);\r
712 if (IsStruct == TRUE) {\r
713 _STRCAT(&TFName, TypeName);\r
714 }\r
715 >>\r
716 ("." FN:StringIdentifier\r
717 <<\r
718 if (IsStruct == TRUE) {\r
719 _STRCAT(&TFName, ".");\r
720 _STRCAT(&TFName, FN->getText());\r
721 }\r
722 >>\r
723 {\r
724 OpenBracket IDX2:Number CloseBracket\r
725 <<\r
726 if (IsStruct == TRUE) {\r
727 _STRCAT(&TFName, "[");\r
728 _STRCAT(&TFName, IDX2->getText());\r
729 _STRCAT(&TFName, "]");\r
730 }\r
731 >>\r
732 }\r
733 )*\r
734 "=" RD:Number\r
735 <<\r
736 if (IsStruct == FALSE) {\r
737 if (strcmp ("UINT64", TypeName) == 0) {\r
738 Data_U64 = _STOU64(RD->getText());\r
739 memcpy (ByteOffset, &Data_U64, TypeSize);\r
740 }else if (strcmp ("UINT32", TypeName) == 0) {\r
741 Data_U32 = _STOU32(RD->getText());\r
742 memcpy (ByteOffset, &Data_U32, TypeSize); \r
743 }else if (strcmp ("UINT16", TypeName) == 0) {\r
744 Data_U16 = _STOU16(RD->getText());\r
745 memcpy (ByteOffset, &Data_U16, TypeSize); \r
746 }else if (strcmp ("UINT8", TypeName) == 0) {\r
747 Data_U8 = _STOU8(RD->getText());\r
748 memcpy (ByteOffset, &Data_U8, TypeSize); \r
749 }else if (strcmp ("BOOLEAN", TypeName)== 0) {\r
750 Data_BL = _STOU8(RD->getText());\r
751 memcpy (ByteOffset, &Data_BL, TypeSize); \r
752 }else if (strcmp ("EFI_STRING_ID", TypeName) == 0) {\r
753 Data_SID = _STOSID(RD->getText());\r
754 memcpy (ByteOffset, &Data_SID, TypeSize); \r
755 }\r
756 } else {\r
757 gCVfrVarDataTypeDB.GetDataFieldInfo(TFName, FieldOffset, FieldType, FieldSize);\r
758 switch (FieldType) {\r
759 case EFI_IFR_TYPE_NUM_SIZE_8:\r
760 Data_U8 = _STOU8(RD->getText());\r
761 memcpy (ByteOffset + FieldOffset, &Data_U8, FieldSize);\r
762 break;\r
763 case EFI_IFR_TYPE_NUM_SIZE_16:\r
764 Data_U16 = _STOU16(RD->getText());\r
765 memcpy (ByteOffset + FieldOffset, &Data_U16, FieldSize);\r
766 break;\r
767 case EFI_IFR_TYPE_NUM_SIZE_32:\r
768 Data_U32 = _STOU32(RD->getText());\r
769 memcpy (ByteOffset + FieldOffset, &Data_U32, FieldSize);\r
770 break;\r
771 case EFI_IFR_TYPE_NUM_SIZE_64:\r
772 Data_U64 = _STOU64(RD->getText());\r
773 memcpy (ByteOffset + FieldOffset, &Data_U64, FieldSize);\r
774 break;\r
775 case EFI_IFR_TYPE_BOOLEAN:\r
776 Data_BL = _STOU8(RD->getText());\r
777 memcpy (ByteOffset + FieldOffset, &Data_BL, FieldSize);\r
778 break;\r
779 case EFI_IFR_TYPE_STRING:\r
780 Data_SID = _STOSID(RD->getText());\r
781 memcpy (ByteOffset + FieldOffset, &Data_SID, FieldSize);\r
782 break;\r
783 default:\r
784 break;\r
785 }\r
786 }\r
787 if (TFName != NULL) { delete TFName; TFName = NULL; }\r
788 >>\r
789 )*\r
790)\r
791;\r
792\r
793\r
30fdf114
LG
794vfrStatementDefaultStore :\r
795 << UINT16 DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD; >>\r
796 D:DefaultStore N:StringIdentifier ","\r
797 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)"\r
798 {\r
799 "," Attribute "=" A:Number << DefaultId = _STOU16(A->getText()); >>\r
800 }\r
801 <<\r
802 if (mCVfrDefaultStore.DefaultIdRegistered (DefaultId) == FALSE) {\r
803 CIfrDefaultStore DSObj;\r
804 _PCATCH(mCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr(), N->getText(), _STOSID(S->getText()), DefaultId)), D->getLine();\r
805 DSObj.SetLineNo(D->getLine());\r
806 DSObj.SetDefaultName (_STOSID(S->getText()));\r
807 DSObj.SetDefaultId (DefaultId);\r
808 } else {\r
809 _PCATCH(mCVfrDefaultStore.ReRegisterDefaultStoreById (DefaultId, N->getText(), _STOSID(S->getText()))), D->getLine();\r
810 }\r
811 >>\r
812 ";"\r
813 ;\r
814\r
815vfrStatementVarStoreLinear :\r
816 <<\r
817 EFI_GUID Guid;\r
818 CIfrVarStore VSObj;\r
819 CHAR8 *TypeName;\r
820 CHAR8 *StoreName;\r
821 UINT32 LineNum;\r
822 EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;\r
823 UINT32 Size;\r
824 >>\r
825 V:Varstore << VSObj.SetLineNo(V->getLine()); >>\r
826 (\r
827 TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->getLine(); >>\r
52302d4d
LG
828 | U8:"UINT8" "," << TypeName = U8->getText(); LineNum = U8->getLine(); >>\r
829 | U16:"UINT16" "," << TypeName = U16->getText(); LineNum = U16->getLine(); >>\r
830 | C16:"CHAR16" "," << TypeName = (CHAR8 *) "UINT16"; LineNum = C16->getLine(); >>\r
831 | U32:"UINT32" "," << TypeName = U32->getText(); LineNum = U32->getLine(); >>\r
832 | U64:"UINT64" "," << TypeName = U64->getText(); LineNum = U64->getLine(); >>\r
833 | D:"EFI_HII_DATE" "," << TypeName = D->getText(); LineNum = D->getLine(); >>\r
834 | T:"EFI_HII_TIME" "," << TypeName = T->getText(); LineNum = T->getLine(); >>\r
4234283c 835 | R:"EFI_HII_REF" "," << TypeName = R->getText(); LineNum = R->getLine(); >>\r
30fdf114
LG
836 )\r
837 { Key "=" FID:Number "," << // Key is used to assign Varid in Framework VFR but no use in UEFI2.1 VFR\r
838 if (mCompatibleMode) {\r
839 VarStoreId = _STOU16(FID->getText());\r
840 }\r
841 >>\r
842 }\r
843 {\r
844 VarId "=" ID:Number "," <<\r
845 _PCATCH(\r
846 (INTN)(VarStoreId = _STOU16(ID->getText())) != 0,\r
847 (INTN)TRUE,\r
848 ID,\r
849 "varid 0 is not allowed."\r
850 );\r
851 >>\r
852 }\r
853 Name "=" SN:StringIdentifier ","\r
854 Uuid "=" guidDefinition[Guid]\r
855 <<\r
856 if (mCompatibleMode) {\r
857 StoreName = TypeName;\r
858 } else {\r
859 StoreName = SN->getText();\r
860 }\r
861 _PCATCH(mCVfrDataStorage.DeclareBufferVarStore (\r
862 StoreName,\r
863 &Guid,\r
864 &gCVfrVarDataTypeDB,\r
865 TypeName,\r
866 VarStoreId\r
867 ), LineNum);\r
30fdf114
LG
868 VSObj.SetGuid (&Guid);\r
869 _PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId), SN);\r
870 VSObj.SetVarStoreId (VarStoreId);\r
871 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);\r
52302d4d 872 VSObj.SetSize ((UINT16) Size);\r
df1780f8 873 VSObj.SetName (SN->getText());\r
30fdf114
LG
874 >>\r
875 ";"\r
876 ;\r
877\r
878vfrStatementVarStoreEfi :\r
879 <<\r
4234283c 880 BOOLEAN IsUEFI23EfiVarstore = TRUE;\r
30fdf114
LG
881 EFI_GUID Guid;\r
882 CIfrVarStoreEfi VSEObj;\r
4234283c 883 EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;\r
30fdf114 884 UINT32 Attr = 0;\r
4234283c
LG
885 UINT32 Size;\r
886 CHAR8 *TypeName;\r
887 UINT32 LineNum;\r
888 CHAR8 *StoreName = NULL;\r
30fdf114
LG
889 >>\r
890 E:Efivarstore << VSEObj.SetLineNo(E->getLine()); >>\r
4234283c
LG
891 (\r
892 TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->getLine(); >>\r
893 | U8:"UINT8" "," << TypeName = U8->getText(); LineNum = U8->getLine(); >>\r
894 | U16:"UINT16" "," << TypeName = U16->getText(); LineNum = U16->getLine(); >>\r
895 | C16:"CHAR16" "," << TypeName = (CHAR8 *) "UINT16"; LineNum = C16->getLine(); >>\r
896 | U32:"UINT32" "," << TypeName = U32->getText(); LineNum = U32->getLine(); >>\r
897 | U64:"UINT64" "," << TypeName = U64->getText(); LineNum = U64->getLine(); >>\r
898 | D:"EFI_HII_DATE" "," << TypeName = D->getText(); LineNum = D->getLine(); >>\r
899 | T:"EFI_HII_TIME" "," << TypeName = T->getText(); LineNum = T->getLine(); >>\r
900 | R:"EFI_HII_REF" "," << TypeName = R->getText(); LineNum = R->getLine(); >> \r
901 )\r
902 {\r
903 VarId "=" ID:Number "," <<\r
904 _PCATCH(\r
905 (INTN)(VarStoreId = _STOU16(ID->getText())) != 0,\r
906 (INTN)TRUE,\r
907 ID,\r
908 "varid 0 is not allowed."\r
909 );\r
910 >>\r
911 }\r
30fdf114
LG
912 Attribute "=" vfrVarStoreEfiAttr[Attr] ( "\|" vfrVarStoreEfiAttr[Attr] )* ","\r
913 << VSEObj.SetAttributes (Attr); >>\r
4234283c
LG
914\r
915 (\r
916 Name "=" SN:StringIdentifier "," << StoreName = SN->getText(); >>\r
917 |\r
918 Name "=" "STRING_TOKEN" "\(" VN:Number "\)" "," \r
919 VarSize "=" N:Number "," << \r
920 IsUEFI23EfiVarstore = FALSE;\r
921 StoreName = gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText()));\r
922 if (StoreName == NULL) {\r
923 _PCATCH (VFR_RETURN_UNSUPPORTED, VN->getLine(), "Can't get varstore name for this StringId!");\r
924 }\r
925 Size = _STOU32(N->getText());\r
926 switch (Size) {\r
927 case 1:\r
928 TypeName = (CHAR8 *) "UINT8";\r
929 break;\r
930 case 2:\r
931 TypeName = (CHAR8 *) "UINT16";\r
932 break;\r
933 case 4:\r
934 TypeName = (CHAR8 *) "UINT32";\r
935 break;\r
936 case 8:\r
937 TypeName = (CHAR8 *) "UINT64";\r
938 break; \r
939 default:\r
940 _PCATCH (VFR_RETURN_UNSUPPORTED, N);\r
941 break;\r
942 }\r
943 >>\r
944 )\r
945\r
946 Uuid "=" guidDefinition[Guid] << \r
947 if (IsUEFI23EfiVarstore) {\r
948 _PCATCH(mCVfrDataStorage.DeclareBufferVarStore (\r
949 StoreName,\r
950 &Guid,\r
951 &gCVfrVarDataTypeDB,\r
952 TypeName,\r
953 VarStoreId\r
954 ), LineNum); \r
955 _PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId), SN);\r
956 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);\r
957 } else {\r
958 _PCATCH(mCVfrDataStorage.DeclareBufferVarStore (\r
959 TN->getText(),\r
960 &Guid,\r
961 &gCVfrVarDataTypeDB,\r
962 TypeName,\r
963 VarStoreId\r
964 ), LineNum); \r
965 _PCATCH(mCVfrDataStorage.GetVarStoreId(TN->getText(), &VarStoreId), VN);\r
966 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), N->getLine());\r
967 }\r
968 VSEObj.SetGuid (&Guid); \r
30fdf114 969 VSEObj.SetVarStoreId (VarStoreId);\r
4234283c
LG
970 \r
971 VSEObj.SetSize ((UINT16) Size);\r
972 VSEObj.SetName (StoreName);\r
973 if (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {\r
974 delete StoreName; \r
975 }\r
30fdf114
LG
976 >>\r
977 ";"\r
978 ;\r
979\r
980vfrVarStoreEfiAttr [UINT32 & Attr] :\r
981 N:Number << $Attr |= _STOU32(N->getText()); >>\r
982 ;\r
983\r
984vfrStatementVarStoreNameValue :\r
985 <<\r
986 EFI_GUID Guid;\r
987 CIfrVarStoreNameValue VSNVObj;\r
988 EFI_VARSTORE_ID VarStoreId;\r
989 >>\r
990 L:NameValueVarStore << VSNVObj.SetLineNo(L->getLine()); >>\r
991 SN:StringIdentifier "," << _PCATCH(mCVfrDataStorage.DeclareNameVarStoreBegin (SN->getText()), SN); >>\r
992 (\r
993 Name "=" "STRING_TOKEN" "\(" N:Number "\)" "," << _PCATCH(mCVfrDataStorage.NameTableAddItem (_STOSID(N->getText())), SN); >>\r
994 )+\r
995 Uuid "=" guidDefinition[Guid] << _PCATCH(mCVfrDataStorage.DeclareNameVarStoreEnd (&Guid), SN); >>\r
996 <<\r
997 VSNVObj.SetGuid (&Guid);\r
998 _PCATCH(mCVfrDataStorage.GetVarStoreId(SN->getText(), &VarStoreId), SN);\r
999 VSNVObj.SetVarStoreId (VarStoreId);\r
1000 >>\r
1001 ";"\r
1002 ;\r
1003\r
1004//\r
1005// keep classDeinition and validClassNames for compatibility but not generate\r
1006// any IFR object\r
1007//\r
1008classDefinition[UINT16 & Class] :\r
1009 << $Class = 0; >>\r
1010 validClassNames[$Class] ( "\|" validClassNames[$Class] )*\r
1011 ;\r
1012\r
1013validClassNames[UINT16 & Class] :\r
1014 ClassNonDevice << $Class |= EFI_NON_DEVICE_CLASS; >>\r
1015 | ClassDiskDevice << $Class |= EFI_DISK_DEVICE_CLASS; >>\r
1016 | ClassVideoDevice << $Class |= EFI_VIDEO_DEVICE_CLASS; >>\r
1017 | ClassNetworkDevice << $Class |= EFI_NETWORK_DEVICE_CLASS; >>\r
1018 | ClassInputDevice << $Class |= EFI_INPUT_DEVICE_CLASS; >>\r
1019 | ClassOnBoardDevice << $Class |= EFI_ON_BOARD_DEVICE_CLASS; >>\r
1020 | ClassOtherDevice << $Class |= EFI_OTHER_DEVICE_CLASS; >>\r
1021 | N:Number << $Class |= _STOU16(N->getText()); >>\r
1022 ;\r
1023\r
1024subclassDefinition[UINT16 & SubClass] :\r
1025 << $SubClass = 0; >>\r
1026 SubclassSetupApplication << $SubClass |= EFI_SETUP_APPLICATION_SUBCLASS; >>\r
1027 | SubclassGeneralApplication << $SubClass |= EFI_GENERAL_APPLICATION_SUBCLASS; >>\r
1028 | SubclassFrontPage << $SubClass |= EFI_FRONT_PAGE_SUBCLASS; >>\r
1029 | SubclassSingleUse << $SubClass |= EFI_SINGLE_USE_SUBCLASS; >>\r
1030 | N:Number << $SubClass |= _STOU16(N->getText()); >>\r
1031 ;\r
1032\r
1033vfrStatementDisableIfFormSet :\r
1034 <<\r
1035 CIfrDisableIf DIObj;\r
1036 mConstantOnlyInExpression = TRUE;\r
1037 >>\r
1038 D:DisableIf << DIObj.SetLineNo(D->getLine()); >>\r
1039 vfrStatementExpression[0] ";" << mConstantOnlyInExpression = FALSE; >>\r
1040 vfrFormSetList\r
1041 E:EndIf << CRT_END_OP (E); >>\r
1042 ";"\r
1043 ;\r
1044\r
a709adfa
LG
1045vfrStatementSuppressIfFormSet :\r
1046 << CIfrSuppressIf SIObj;>>\r
1047 L:SuppressIf <<\r
1048 if (mCompatibleMode) {\r
1049 _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
1050 }\r
1051 SIObj.SetLineNo(L->getLine()); \r
1052 >>\r
1053 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1054 vfrStatementExpression[0] ";"\r
1055 vfrFormSetList\r
1056 E: EndIf \r
1057 ";" << CRT_END_OP (E); >>\r
1058 ;\r
1059\r
30fdf114
LG
1060//*****************************************************************************\r
1061//\r
1062// the syntax of question header and statement header\r
1063//\r
1064vfrStatementHeader[CIfrStatementHeader *SHObj] :\r
1065 Prompt "=" "STRING_TOKEN" "\(" S1:Number "\)" "," << $SHObj->SetPrompt (_STOSID(S1->getText())); >>\r
1066 Help "=" "STRING_TOKEN" "\(" S2:Number "\)" << $SHObj->SetHelp (_STOSID(S2->getText())); >>\r
1067 ;\r
1068\r
1069vfrQuestionHeader[CIfrQuestionHeader & QHObj, EFI_QUESION_TYPE QType = QUESTION_NORMAL]:\r
1070 <<\r
1071 EFI_VARSTORE_INFO Info;\r
1072 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;\r
1073 CHAR8 *QName = NULL;\r
1074 CHAR8 *VarIdStr = NULL;\r
1075 >>\r
1076 {\r
1077 Name "=" QN:StringIdentifier "," <<\r
1078 QName = QN->getText();\r
1079 _PCATCH(mCVfrQuestionDB.FindQuestion (QName), VFR_RETURN_UNDEFINED, QN, "has already been used please used anther name");\r
1080 >>\r
1081 }\r
1082 { V:VarId "=" vfrStorageVarId[Info, VarIdStr] "," }\r
1083 {\r
1084 QuestionId "=" ID:Number "," <<\r
1085 QId = _STOQID(ID->getText());\r
1086 _PCATCH(mCVfrQuestionDB.FindQuestion (QId), VFR_RETURN_UNDEFINED, ID, "has already been used please assign another number");\r
1087 >>\r
1088 }\r
1089 <<\r
1090 switch (QType) {\r
1091 case QUESTION_NORMAL:\r
1092 mCVfrQuestionDB.RegisterQuestion (QName, VarIdStr, QId);\r
1093 break;\r
1094 case QUESTION_DATE:\r
52302d4d
LG
1095 mCVfrQuestionDB.RegisterNewDateQuestion (QName, VarIdStr, QId);\r
1096 break;\r
30fdf114 1097 case QUESTION_TIME:\r
52302d4d
LG
1098 mCVfrQuestionDB.RegisterNewTimeQuestion (QName, VarIdStr, QId);\r
1099 break;\r
4234283c
LG
1100 case QUESTION_REF:\r
1101 //\r
1102 // VarIdStr != NULL stand for question with storagae.\r
1103 //\r
1104 if (VarIdStr != NULL) {\r
1105 mCVfrQuestionDB.RegisterRefQuestion (QName, VarIdStr, QId);\r
1106 } else {\r
1107 mCVfrQuestionDB.RegisterQuestion (QName, NULL, QId);\r
1108 }\r
1109 break;\r
30fdf114
LG
1110 default:\r
1111 _PCATCH(VFR_RETURN_FATAL_ERROR);\r
1112 }\r
1113 $QHObj.SetQuestionId (QId);\r
4234283c
LG
1114 if (VarIdStr != NULL) {\r
1115 $QHObj.SetVarStoreInfo (&Info);\r
1116 }\r
30fdf114
LG
1117 >>\r
1118 vfrStatementHeader[&$QHObj]\r
4234283c
LG
1119 << \r
1120 if (VarIdStr != NULL) {\r
1121 delete VarIdStr; \r
1122 _SAVE_CURRQEST_VARINFO (Info);\r
1123 }\r
30fdf114 1124 >>\r
30fdf114
LG
1125 ;\r
1126\r
1127questionheaderFlagsField[UINT8 & Flags] :\r
1128 ReadOnlyFlag << $Flags |= 0x01; >>\r
1129 | InteractiveFlag << $Flags |= 0x04; >>\r
1130 | ResetRequiredFlag << $Flags |= 0x10; >>\r
1131 | OptionOnlyFlag << $Flags |= 0x80; >>\r
1132 | NVAccessFlag\r
1133 | LateCheckFlag\r
1134 ;\r
1135\r
52302d4d 1136vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFlag = TRUE] :\r
30fdf114
LG
1137 <<\r
1138 UINT32 Idx;\r
1139 UINT32 LineNo;\r
1140 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;\r
1141 CHAR8 *VarIdStr = NULL;\r
1142 CHAR8 *VarStr = NULL;\r
1143 CHAR8 *SName = NULL;\r
1144 CHAR8 *TName = NULL;\r
1145 EFI_VFR_RETURN_CODE VfrReturnCode = VFR_RETURN_SUCCESS;\r
1146 EFI_IFR_TYPE_VALUE Dummy = gZeroEfiIfrTypeValue;\r
1147 >>\r
1148 (\r
1149 SN1:StringIdentifier << SName = SN1->getText(); _STRCAT(&VarIdStr, SN1->getText()); >>\r
1150 OpenBracket I1:Number CloseBracket <<\r
1151 Idx = _STOU32(I1->getText());\r
1152 _STRCAT(&VarIdStr, "[");\r
1153 _STRCAT(&VarIdStr, I1->getText());\r
1154 _STRCAT(&VarIdStr, "]");\r
1155 >>\r
1156 <<\r
1157 VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);\r
1158 if (mCompatibleMode && VfrReturnCode == VFR_RETURN_UNDEFINED) {\r
1159 mCVfrDataStorage.DeclareBufferVarStore (\r
1160 SName,\r
1161 &mFormsetGuid,\r
1162 &gCVfrVarDataTypeDB,\r
1163 SName,\r
1164 EFI_VARSTORE_ID_INVALID,\r
1165 FALSE\r
1166 );\r
1167 VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);\r
1168 }\r
52302d4d
LG
1169 if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {\r
1170 _PCATCH(VfrReturnCode, SN1);\r
1171 _PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN1);\r
1172 _PCATCH(mCVfrDataStorage.GetNameVarStoreInfo (&$Info, Idx), SN1);\r
1173 }\r
4234283c
LG
1174\r
1175 QuestVarIdStr = VarIdStr;\r
30fdf114
LG
1176 >>\r
1177 )\r
1178 |\r
1179 (\r
1180 SN2:StringIdentifier << SName = SN2->getText(); _STRCAT(&VarIdStr, SName); >>\r
1181 <<\r
1182 VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);\r
1183 if (mCompatibleMode && VfrReturnCode == VFR_RETURN_UNDEFINED) {\r
1184 mCVfrDataStorage.DeclareBufferVarStore (\r
1185 SName,\r
1186 &mFormsetGuid,\r
1187 &gCVfrVarDataTypeDB,\r
1188 SName,\r
1189 EFI_VARSTORE_ID_INVALID,\r
1190 FALSE\r
1191 );\r
1192 VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);\r
1193 }\r
52302d4d
LG
1194 if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {\r
1195 _PCATCH(VfrReturnCode, SN2);\r
1196 _PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN2);\r
1197 if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) {\r
1198 _PCATCH(mCVfrDataStorage.GetBufferVarStoreDataTypeName(SName, &TName), SN2);\r
1199 _STRCAT(&VarStr, TName);\r
1200 }\r
30fdf114
LG
1201 }\r
1202 >>\r
1203\r
1204 (\r
1205 "." <<\r
52302d4d
LG
1206 if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {\r
1207 _PCATCH(((VarStoreType != EFI_VFR_VARSTORE_BUFFER) ? VFR_RETURN_EFIVARSTORE_USE_ERROR : VFR_RETURN_SUCCESS), SN2);\r
1208 }\r
30fdf114
LG
1209 _STRCAT(&VarIdStr, "."); _STRCAT(&VarStr, ".");\r
1210 >>\r
1211 SF:StringIdentifier << _STRCAT(&VarIdStr, SF->getText()); _STRCAT(&VarStr, SF->getText()); >>\r
1212 {\r
1213 OpenBracket I2:Number CloseBracket <<\r
1214 Idx = _STOU32(I2->getText());\r
1215 if (mCompatibleMode) Idx --;\r
1216 if (Idx > 0) {\r
1217 //\r
1218 // Idx == 0, [0] can be ignored.\r
1219 // Array[0] is same to Array for unify the varid name to cover [0]\r
1220 //\r
1221 _STRCAT(&VarIdStr, "[");\r
1222 _STRCAT(&VarIdStr, I2->getText());\r
1223 _STRCAT(&VarIdStr, "]");\r
1224 }\r
1225 _STRCAT(&VarStr, "[");\r
1226 _STRCAT(&VarStr, I2->getText());\r
1227 _STRCAT(&VarStr, "]");\r
1228 >>\r
1229 }\r
1230 )* <<\r
1231 switch (VarStoreType) {\r
1232 case EFI_VFR_VARSTORE_EFI:\r
1233 _PCATCH(mCVfrDataStorage.GetEfiVarStoreInfo (&$Info), SN2);\r
1234 break;\r
1235 case EFI_VFR_VARSTORE_BUFFER:\r
1236 _PCATCH(gCVfrVarDataTypeDB.GetDataFieldInfo (VarStr, $Info.mInfo.mVarOffset, $Info.mVarType, $Info.mVarTotalSize), SN2->getLine(), VarStr);\r
1237 _PCATCH((EFI_VFR_RETURN_CODE)gCVfrBufferConfig.Register (\r
1238 SName,\r
1239 NULL),\r
1240 SN2->getLine());\r
1241 _PCATCH((EFI_VFR_RETURN_CODE)gCVfrBufferConfig.Write (\r
1242 'a',\r
1243 SName,\r
1244 NULL,\r
1245 $Info.mVarType,\r
1246 $Info.mInfo.mVarOffset,\r
1247 $Info.mVarTotalSize,\r
1248 Dummy),\r
1249 SN2->getLine());\r
1250 break;\r
1251 case EFI_VFR_VARSTORE_NAME:\r
1252 default: break;\r
1253 }\r
1254\r
1255 QuestVarIdStr = VarIdStr;\r
1256 if (VarStr != NULL) {delete VarStr;}\r
1257 >>\r
1258 )\r
1259 ;\r
1260\r
1261vfrQuestionDataFieldName [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr, UINT32 &LineNo] :\r
1262 <<\r
1263 UINT32 Idx;\r
1264 VarIdStr = NULL; LineNo = 0;\r
1265 >>\r
1266 (\r
1267 SN1:StringIdentifier << _STRCAT(&VarIdStr, SN1->getText()); LineNo = SN1->getLine(); >>\r
1268 OpenBracket I1:Number CloseBracket <<\r
1269 _STRCAT(&VarIdStr, "[");\r
1270 _STRCAT(&VarIdStr, I1->getText());\r
1271 _STRCAT(&VarIdStr, "]");\r
1272 mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask);\r
1273 if (mConstantOnlyInExpression) {\r
1274 _PCATCH(VFR_RETURN_CONSTANT_ONLY, LineNo);\r
1275 }\r
1276 >>\r
1277 )\r
1278 |\r
1279 (\r
1280 SN2:StringIdentifier << _STRCAT (&VarIdStr, SN2->getText()); LineNo = SN2->getLine(); >>\r
1281 (\r
1282 "." << \r
1283 _STRCAT (&VarIdStr, ".");\r
1284 if (mConstantOnlyInExpression) {\r
1285 _PCATCH(VFR_RETURN_CONSTANT_ONLY, LineNo);\r
1286 }\r
1287 >>\r
1288 SF:StringIdentifier << _STRCAT (&VarIdStr, SF->getText()); >>\r
1289 {\r
1290 OpenBracket I2:Number CloseBracket <<\r
1291 Idx = _STOU32(I2->getText());\r
1292 if (mCompatibleMode) Idx --;\r
1293 if (Idx > 0) {\r
1294 //\r
1295 // Idx == 0, [0] can be ignored.\r
1296 // Array[0] is same to Array\r
1297 //\r
1298 _STRCAT(&VarIdStr, "[");\r
1299 _STRCAT(&VarIdStr, I2->getText());\r
1300 _STRCAT(&VarIdStr, "]");\r
1301 }\r
1302 >>\r
1303 }\r
1304 )*\r
1305 << mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask); >>\r
1306 )\r
1307 ;\r
1308\r
1309vfrConstantValueField[UINT8 Type] > [EFI_IFR_TYPE_VALUE Value] :\r
4234283c
LG
1310 <<\r
1311 EFI_GUID Guid;\r
1312 >>\r
30fdf114
LG
1313 N1:Number <<\r
1314 switch ($Type) {\r
1315 case EFI_IFR_TYPE_NUM_SIZE_8 :\r
1316 $Value.u8 = _STOU8(N1->getText());\r
1317 break;\r
1318 case EFI_IFR_TYPE_NUM_SIZE_16 :\r
1319 $Value.u16 = _STOU16(N1->getText());\r
1320 break;\r
1321 case EFI_IFR_TYPE_NUM_SIZE_32 :\r
1322 $Value.u32 = _STOU32(N1->getText());\r
1323 break;\r
1324 case EFI_IFR_TYPE_NUM_SIZE_64 :\r
1325 $Value.u64 = _STOU64(N1->getText());\r
1326 break;\r
1327 case EFI_IFR_TYPE_BOOLEAN :\r
1328 $Value.b = _STOU8(N1->getText());\r
1329 break;\r
1330 case EFI_IFR_TYPE_STRING :\r
1331 $Value.string = _STOU16(N1->getText());\r
1332 break;\r
1333 case EFI_IFR_TYPE_TIME :\r
1334 case EFI_IFR_TYPE_DATE :\r
4234283c 1335 case EFI_IFR_TYPE_REF :\r
30fdf114
LG
1336 default :\r
1337 break;\r
1338 }\r
1339 >>\r
1340 | B1:True << $Value.b = TRUE; >>\r
1341 | B2:False << $Value.b = FALSE; >>\r
1342 | O1:One << $Value.u8 = _STOU8(O1->getText()); >>\r
1343 | O2:Ones << $Value.u64 = _STOU64(O2->getText()); >>\r
1344 | Z:Zero << $Value.u8 = _STOU8(Z->getText()); >>\r
1345 | HOUR:Number ":" MINUTE:Number ":" SECOND:Number << $Value.time = _STOT(HOUR->getText(), MINUTE->getText(), SECOND->getText()); >>\r
1346 | YEAR:Number "/" MONTH:Number "/" DAY:Number << $Value.date = _STOD(YEAR->getText(), MONTH->getText(), DAY->getText()); >>\r
4234283c
LG
1347 | QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)" \r
1348 << $Value.ref = _STOR(QI->getText(), FI->getText(), &Guid, DP->getText()); >>\r
30fdf114
LG
1349 | "STRING_TOKEN" "\(" S1:Number "\)" << $Value.string = _STOSID(S1->getText()); >>\r
1350 ;\r
1351\r
1352//*****************************************************************************\r
1353//\r
1354// the syntax of form definition\r
1355//\r
1356vfrFormDefinition :\r
1357 << CIfrForm FObj; >>\r
1358 F:Form << FObj.SetLineNo(F->getLine()); >>\r
1359 FormId "=" S1:Number "," << _PCATCH(FObj.SetFormId (_STOFID(S1->getText())), S1); >>\r
1360 Title "=" "STRING_TOKEN" "\(" S2:Number "\)" ";" << FObj.SetFormTitle (_STOSID(S2->getText())); >>\r
1361 (\r
1362 vfrStatementImage |\r
1363 vfrStatementLocked |\r
1364 vfrStatementRules |\r
1365 vfrStatementDefault |\r
1366 vfrStatementStat |\r
1367 vfrStatementQuestions |\r
1368 vfrStatementConditional |\r
1369 vfrStatementLabel |\r
1370 vfrStatementBanner |\r
1371 // Just for framework vfr compatibility\r
da92f276 1372 vfrStatementInvalid |\r
4234283c
LG
1373 vfrStatementExtension |\r
1374 vfrStatementModal\r
30fdf114
LG
1375 )*\r
1376 E:EndForm <<\r
1377 if (mCompatibleMode) {\r
1378 //\r
1379 // Add Label for Framework Vfr\r
1380 //\r
1381 CIfrLabel LObj1;\r
1382 LObj1.SetLineNo(E->getLine());\r
1383 LObj1.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff\r
1384 CIfrLabel LObj2;\r
1385 LObj2.SetLineNo(E->getLine());\r
1386 LObj2.SetNumber (0x0); //add dummy label for UEFI, label number hardcode 0x0\r
1387 CIfrLabel LObj3;\r
1388 LObj3.SetLineNo(E->getLine());\r
1389 LObj3.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff\r
30fdf114 1390 }\r
b36d134f
LG
1391\r
1392 //\r
1393 // Declare undefined Question so that they can be used in expression.\r
1394 //\r
1395 if (gCFormPkg.HavePendingUnassigned()) {\r
1396 gCFormPkg.DeclarePendingQuestion (\r
1397 gCVfrVarDataTypeDB,\r
1398 mCVfrDataStorage,\r
1399 mCVfrQuestionDB,\r
1400 &mFormsetGuid,\r
1401 E->getLine()\r
1402 );\r
1403 }\r
1404\r
30fdf114
LG
1405 //\r
1406 // mCVfrQuestionDB.PrintAllQuestion();\r
1407 //\r
1408 CRT_END_OP (E);\r
1409 >>\r
1410 ";"\r
1411 ;\r
1412\r
52302d4d
LG
1413vfrFormMapDefinition :\r
1414 << \r
1415 CIfrFormMap *FMapObj = NULL;\r
1416 UINT32 FormMapMethodNumber = 0;\r
1417 EFI_GUID Guid;\r
1418 >>\r
1419 F:FormMap << FMapObj = new CIfrFormMap(); FMapObj->SetLineNo(F->getLine()); >>\r
1420 FormId "=" S1:Number "," << _PCATCH(FMapObj->SetFormId (_STOFID(S1->getText())), S1); >>\r
1421 (\r
1422 MapTitle "=" "STRING_TOKEN" "\(" S2:Number "\)" ";"\r
1423 MapGuid "=" guidDefinition[Guid] ";" << FMapObj->SetFormMapMethod (_STOFID(S2->getText()), &Guid); FormMapMethodNumber ++; >>\r
1424 )* << if (FormMapMethodNumber == 0) {_PCATCH (VFR_RETURN_INVALID_PARAMETER, F->getLine(), "No MapMethod is set for FormMap!");} delete FMapObj;>>\r
1425 (\r
1426 vfrStatementImage |\r
1427 vfrStatementLocked |\r
1428 vfrStatementRules |\r
1429 vfrStatementDefault |\r
1430 vfrStatementStat |\r
1431 vfrStatementQuestions |\r
1432 vfrStatementConditional |\r
1433 vfrStatementLabel |\r
da92f276 1434 vfrStatementBanner |\r
4234283c
LG
1435 vfrStatementExtension |\r
1436 vfrStatementModal\r
52302d4d
LG
1437 )*\r
1438 E:EndForm << CRT_END_OP (E); >>\r
1439 ";"\r
1440 ;\r
1441\r
30fdf114
LG
1442vfrStatementRules :\r
1443 << CIfrRule RObj; >>\r
1444 R:Rule << RObj.SetLineNo(R->getLine()); >>\r
1445 S1:StringIdentifier "," <<\r
1446 mCVfrRulesDB.RegisterRule (S1->getText());\r
1447 RObj.SetRuleId (mCVfrRulesDB.GetRuleId(S1->getText()));\r
1448 >>\r
1449 vfrStatementExpression[0]\r
1450 E:EndRule << CRT_END_OP (E); >>\r
1451 ";"\r
1452 ;\r
1453\r
1454vfrStatementDefault :\r
1455 <<\r
1456 BOOLEAN IsExp = FALSE;\r
fd171542 1457 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;\r
30fdf114
LG
1458 CIfrDefault DObj;\r
1459 EFI_DEFAULT_ID DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;\r
1460 CHAR8 *VarStoreName = NULL;\r
1461 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;\r
1462 >>\r
1463 D:Default << DObj.SetLineNo(D->getLine()); >>\r
1464 (\r
1465 (\r
fd171542 1466 vfrStatementValue "," << IsExp = TRUE; DObj.SetScope (1); CIfrEnd EndObj1; EndObj1.SetLineNo(D->getLine()); >>\r
1467 | "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] > [Val] "," << \r
a709adfa
LG
1468 if (gCurrentMinMaxData != NULL && gCurrentMinMaxData->IsNumericOpcode()) {\r
1469 //check default value is valid for Numeric Opcode\r
1470 if (Val.u64 < gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE()) || Val.u64 > gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE())) {\r
1471 _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");\r
fd171542 1472 }\r
1473 }\r
1474 DObj.SetType (_GET_CURRQEST_DATATYPE()); \r
1475 DObj.SetValue(Val);\r
1476 >>\r
30fdf114
LG
1477 )\r
1478 {\r
1479 DefaultStore "=" SN:StringIdentifier "," << _PCATCH(mCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN); DObj.SetDefaultId (DefaultId); >>\r
1480 }\r
1481 <<\r
1482 _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), D->getLine());\r
1483 _PCATCH(mCVfrDataStorage.GetVarStoreType (VarStoreName, VarStoreType), D->getLine());\r
1484 if ((IsExp == FALSE) && (VarStoreType == EFI_VFR_VARSTORE_BUFFER)) {\r
1485 _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
1486 DefaultId,\r
1487 _GET_CURRQEST_VARTINFO(),\r
1488 VarStoreName,\r
1489 _GET_CURRQEST_DATATYPE (),\r
1490 Val),\r
1491 D->getLine()\r
1492 );\r
1493 }\r
1494 >>\r
1495 )\r
1496 ;\r
1497\r
1498vfrStatementStat :\r
1499 vfrStatementSubTitle |\r
1500 vfrStatementStaticText |\r
1501 vfrStatementCrossReference\r
1502 ;\r
1503\r
1504vfrStatementQuestions :\r
1505 vfrStatementBooleanType |\r
1506 vfrStatementDate |\r
1507 vfrStatementNumericType |\r
1508 vfrStatementStringType |\r
1509 vfrStatementOrderedList |\r
1510 vfrStatementTime\r
1511 ;\r
1512\r
1513vfrStatementConditional :\r
1514 vfrStatementDisableIfStat |\r
1515 vfrStatementSuppressIfStat | //enhance to be compatible for framework endif\r
1516 vfrStatementGrayOutIfStat |\r
1517 vfrStatementInconsistentIfStat //to be compatible for framework\r
1518 ;\r
1519\r
1520vfrStatementConditionalNew :\r
1521 vfrStatementDisableIfStat |\r
1522 vfrStatementSuppressIfStatNew |\r
1523 vfrStatementGrayOutIfStatNew |\r
1524 vfrStatementInconsistentIfStat //to be compatible for framework\r
1525 ;\r
1526\r
1527vfrStatementSuppressIfStat :\r
1528 <<mCompatibleMode>>? vfrStatementSuppressIfStatOld\r
1529 | vfrStatementSuppressIfStatNew\r
1530 ;\r
1531\r
1532vfrStatementGrayOutIfStat :\r
1533 <<mCompatibleMode>>? vfrStatementGrayOutIfStatOld\r
1534 | vfrStatementGrayOutIfStatNew\r
1535 ;\r
1536\r
1537vfrStatementInvalid :\r
1538 (\r
1539 vfrStatementInvalidHidden |\r
1540 vfrStatementInvalidInventory |\r
1541 vfrStatementInvalidSaveRestoreDefaults\r
1542 )\r
1543 << _CRT_OP (TRUE); >>\r
1544 ;\r
1545\r
1546flagsField :\r
1547 Number | InteractiveFlag | ManufacturingFlag | DefaultFlag |\r
1548 NVAccessFlag | ResetRequiredFlag | LateCheckFlag\r
1549 ;\r
1550\r
1551vfrStatementValue :\r
1552 << CIfrValue VObj; >>\r
1553 V:Value << VObj.SetLineNo(V->getLine()); >>\r
fd171542 1554 "=" vfrStatementExpression[0] << {CIfrEnd EndObj; EndObj.SetLineNo(V->getLine());} >>\r
30fdf114
LG
1555 ;\r
1556\r
52302d4d
LG
1557vfrStatementRead :\r
1558 << CIfrRead RObj; >>\r
1559 R:Read << RObj.SetLineNo(R->getLine()); >>\r
1560 vfrStatementExpression[0] ";" \r
1561 ;\r
1562\r
1563vfrStatementWrite :\r
1564 << CIfrWrite WObj; >>\r
1565 W:Write << WObj.SetLineNo(W->getLine()); >>\r
1566 vfrStatementExpression[0] ";" \r
1567 ;\r
1568\r
30fdf114
LG
1569vfrStatementSubTitle :\r
1570 << CIfrSubtitle SObj; >>\r
1571 L:Subtitle << SObj.SetLineNo(L->getLine()); >>\r
1572 Text "=" "STRING_TOKEN" "\(" S:Number "\)" << SObj.SetPrompt (_STOSID(S->getText())); >>\r
1573 {\r
1574 "," FLAGS "=" vfrSubtitleFlags[SObj]\r
1575 }\r
1576 { vfrStatementStatTagList "," }\r
1577 E:";" << CRT_END_OP (E); >>\r
1578 ;\r
1579\r
1580vfrSubtitleFlags [CIfrSubtitle & SObj] :\r
1581 << UINT8 LFlags = 0; >>\r
1582 subtitleFlagsField[LFlags] ( "\|" subtitleFlagsField[LFlags] )*\r
1583 << _PCATCH(SObj.SetFlags (LFlags)); >>\r
1584 ;\r
1585\r
1586subtitleFlagsField [UINT8 & Flags] :\r
1587 N:Number << $Flags |= _STOU8(N->getText()); >>\r
1588 | "HORIZONTAL" << $Flags |= 0x01; >>\r
1589 ;\r
1590\r
1591vfrStatementStaticText :\r
1592 <<\r
1593 UINT8 Flags = 0;\r
1594 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;\r
1595 EFI_STRING_ID TxtTwo = EFI_STRING_ID_INVALID;\r
1596 >>\r
1597 T:Text\r
1598 Help "=" "STRING_TOKEN" "\(" S1:Number "\)" ","\r
1599 Text "=" "STRING_TOKEN" "\(" S2:Number "\)"\r
1600 {\r
1601 "," Text "=" "STRING_TOKEN" "\(" S3:Number "\)" << TxtTwo = _STOSID(S3->getText()); >>\r
1602 }\r
1603 {\r
1604 "," F:FLAGS "=" staticTextFlagsField[Flags] ( "\|" staticTextFlagsField[Flags] )*\r
1605 "," Key "=" KN:Number\r
1606 }\r
1607 <<\r
1608 if (Flags & EFI_IFR_FLAG_CALLBACK) {\r
1609 CIfrAction AObj;\r
1610 mCVfrQuestionDB.RegisterQuestion (NULL, NULL, QId);\r
1611 AObj.SetLineNo (F->getLine());\r
1612 AObj.SetQuestionId (QId);\r
1613 AObj.SetPrompt (_STOSID(S2->getText()));\r
1614 AObj.SetHelp (_STOSID(S1->getText()));\r
1615 _PCATCH(AObj.SetFlags (Flags), F->getLine());\r
1616 AssignQuestionKey (AObj, KN);\r
1617 CRT_END_OP (KN);\r
1618 } else {\r
1619 CIfrText TObj;\r
1620 TObj.SetLineNo (T->getLine());\r
1621 TObj.SetHelp (_STOSID(S1->getText()));\r
1622 TObj.SetPrompt (_STOSID(S2->getText()));\r
1623 TObj.SetTextTwo (TxtTwo);\r
1624 }\r
1625 >>\r
1626 { "," vfrStatementStatTagList }\r
1627 ";"\r
1628 ;\r
1629\r
1630staticTextFlagsField[UINT8 & HFlags] :\r
1631 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1632 | questionheaderFlagsField[HFlags]\r
1633 ;\r
1634\r
1635vfrStatementCrossReference :\r
1636 vfrStatementGoto |\r
1637 vfrStatementResetButton\r
1638 ;\r
1639\r
1640vfrStatementGoto :\r
1641 <<\r
4234283c 1642 UINT8 RefType = 5;\r
52302d4d
LG
1643 EFI_STRING_ID DevPath = EFI_STRING_ID_INVALID;\r
1644 EFI_GUID FSId = {0,};\r
30fdf114
LG
1645 EFI_FORM_ID FId;\r
1646 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;\r
1647 UINT32 BitMask;\r
1648 CIfrQuestionHeader *QHObj = NULL;\r
0d2711a6 1649 CIfrOpHeader *OHObj = NULL;\r
30fdf114
LG
1650 CIfrRef *R1Obj = NULL;\r
1651 CIfrRef2 *R2Obj = NULL;\r
1652 CIfrRef3 *R3Obj = NULL;\r
1653 CIfrRef4 *R4Obj = NULL;\r
4234283c 1654 CIfrRef5 *R5Obj = NULL;\r
30fdf114
LG
1655 >>\r
1656 G:Goto\r
4234283c 1657 {\r
30fdf114
LG
1658 (\r
1659 DevicePath "=" "STRING_TOKEN" "\(" P:Number "\)" ","\r
1660 FormSetGuid "=" guidDefinition[FSId] ","\r
1661 FormId "=" F1:Number ","\r
1662 Question "=" QN1:Number ","\r
1663 <<\r
1664 RefType = 4;\r
1665 DevPath = _STOSID(P->getText());\r
1666 FId = _STOFID(F1->getText());\r
1667 QId = _STOQID(QN1->getText());\r
1668 >>\r
1669 )\r
1670 |\r
1671 (\r
1672 FormSetGuid "=" guidDefinition[FSId] ","\r
1673 FormId "=" F2:Number ","\r
1674 Question "=" QN2:Number ","\r
1675 <<\r
1676 RefType = 3;\r
1677 FId = _STOFID(F2->getText());\r
1678 QId = _STOQID(QN2->getText());\r
1679 >>\r
1680 )\r
1681 |\r
1682 (\r
1683 FormId "=" F3:Number "," << RefType = 2; FId = _STOFID(F3->getText()); >>\r
1684 Question "="\r
1685 (\r
0d2711a6
LG
1686 QN3:StringIdentifier "," << \r
1687 mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask);\r
1688 if (QId == EFI_QUESTION_ID_INVALID) {\r
1689 _PCATCH(VFR_RETURN_UNDEFINED, QN3);\r
1690 }\r
1691 >>\r
1692 | QN4:Number "," << QId = _STOQID(QN4->getText()); >>\r
30fdf114
LG
1693 )\r
1694 )\r
1695 |\r
1696 (\r
1697 F4:Number "," <<\r
1698 RefType = 1;\r
1699 FId = _STOFID(F4->getText());\r
1700 >>\r
1701 )\r
4234283c 1702 }\r
30fdf114
LG
1703 <<\r
1704 switch (RefType) {\r
4234283c
LG
1705 case 5:\r
1706 {\r
1707 R5Obj = new CIfrRef5;\r
1708 QHObj = R5Obj;\r
0d2711a6 1709 OHObj = R5Obj;\r
4234283c
LG
1710 R5Obj->SetLineNo(G->getLine());\r
1711 break;\r
1712 }\r
30fdf114
LG
1713 case 4:\r
1714 {\r
1715 R4Obj = new CIfrRef4;\r
1716 QHObj = R4Obj;\r
0d2711a6 1717 OHObj = R4Obj;\r
30fdf114
LG
1718 R4Obj->SetLineNo(G->getLine());\r
1719 R4Obj->SetDevicePath (DevPath);\r
1720 R4Obj->SetFormSetId (FSId);\r
1721 R4Obj->SetFormId (FId);\r
1722 R4Obj->SetQuestionId (QId);\r
1723 break;\r
1724 }\r
1725 case 3:\r
1726 {\r
1727 R3Obj = new CIfrRef3;\r
1728 QHObj = R3Obj;\r
0d2711a6 1729 OHObj = R3Obj;\r
30fdf114
LG
1730 R3Obj->SetLineNo(G->getLine());\r
1731 R3Obj->SetFormSetId (FSId);\r
1732 R3Obj->SetFormId (FId);\r
1733 R3Obj->SetQuestionId (QId);\r
1734 break;\r
1735 }\r
1736 case 2:\r
1737 {\r
1738 R2Obj = new CIfrRef2;\r
1739 QHObj = R2Obj;\r
0d2711a6 1740 OHObj = R2Obj;\r
30fdf114
LG
1741 R2Obj->SetLineNo(G->getLine());\r
1742 R2Obj->SetFormId (FId);\r
0d2711a6 1743 R2Obj->SetQuestionId (QId);\r
30fdf114
LG
1744 break;\r
1745 }\r
1746 case 1:\r
1747 {\r
1748 R1Obj = new CIfrRef;\r
1749 QHObj = R1Obj;\r
0d2711a6 1750 OHObj = R1Obj;\r
30fdf114
LG
1751 R1Obj->SetLineNo(G->getLine());\r
1752 R1Obj->SetFormId (FId);\r
1753 break;\r
1754 }\r
1755 default: break;\r
1756 }\r
1757 >>\r
4234283c 1758 vfrQuestionHeader[*QHObj, QUESTION_REF]\r
30fdf114
LG
1759 { "," F:FLAGS "=" vfrGotoFlags[QHObj, F->getLine()] }\r
1760 {\r
1761 "," Key "=" KN:Number << AssignQuestionKey (*QHObj, KN); >>\r
1762 }\r
0d2711a6
LG
1763 {\r
1764 E:"," \r
1765 vfrStatementQuestionOptionList << OHObj->SetScope(1); CRT_END_OP (E);>>\r
1766 }\r
4234283c 1767 ";" << 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;}>>\r
30fdf114
LG
1768 ;\r
1769\r
1770vfrGotoFlags [CIfrQuestionHeader *QHObj, UINT32 LineNum] :\r
1771 << UINT8 HFlags = 0; >>\r
1772 gotoFlagsField[HFlags] ( "\|" gotoFlagsField[HFlags] )*\r
1773 << _PCATCH(QHObj->SetFlags (HFlags), LineNum); >>\r
1774 ;\r
1775\r
1776gotoFlagsField[UINT8 & HFlags] :\r
1777 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1778 | questionheaderFlagsField[HFlags]\r
1779 ;\r
1780\r
1781getStringId :\r
1782 "STRING_TOKEN" "\("\r
1783 IdVal:Number\r
1784 "\)"\r
1785 ;\r
1786\r
1787vfrStatementResetButton :\r
1788 <<\r
1789 CIfrResetButton RBObj;\r
1790 UINT16 DefaultId;\r
1791 >>\r
1792 L:ResetButton << RBObj.SetLineNo(L->getLine()); >>\r
1793 DefaultStore\r
1794 "=" N:StringIdentifier "," <<\r
1795 _PCATCH(mCVfrDefaultStore.GetDefaultId (N->getText(), &DefaultId), N->getLine());\r
1796 RBObj.SetDefaultId (DefaultId);\r
1797 >>\r
1798 vfrStatementHeader[&RBObj] ","\r
1799 { vfrStatementStatTagList "," }\r
1800 E:EndResetButton << CRT_END_OP (E); >>\r
1801 ";"\r
1802 ;\r
1803\r
1804vfrStatementBooleanType :\r
1805 vfrStatementCheckBox |\r
1806 vfrStatementAction\r
1807 ;\r
1808\r
1809//*****************************************************\r
1810// Syntax of checkbox\r
1811//\r
1812// Example:\r
1813// checkbox\r
1814// varid = MySTestData.mField1,\r
1815// prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),\r
1816// help = STRING_TOKEN(STR_CHECK_BOX_HELP),\r
1817// flags = CHECKBOX_DEFAULT | CALLBACK,\r
1818// default value = TRUE, defaultstore = MyDefaultStore,\r
1819// endcheckbox;\r
1820//\r
1821vfrStatementCheckBox :\r
1822 <<\r
1823 CIfrCheckBox CBObj;\r
1824 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;\r
1825 CHAR8 *VarStoreName = NULL;\r
1826 UINT32 DataTypeSize;\r
1827 >>\r
1828 L:CheckBox << CBObj.SetLineNo(L->getLine()); >>\r
1829 vfrQuestionHeader[CBObj] "," << //check data type\r
1830 _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "CheckBox varid is not the valid data type");\r
1831 if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {\r
1832 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid doesn't support array");\r
1833 } else if ((mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId) == EFI_VFR_VARSTORE_BUFFER) &&\r
1834 (_GET_CURRQEST_VARSIZE() != sizeof (BOOLEAN))) {\r
1835 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid only support BOOLEAN data type");\r
1836 }\r
1837 >>\r
1838 {\r
1839 F:FLAGS "=" vfrCheckBoxFlags[CBObj, F->getLine()] ","\r
1840 <<\r
1841 _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), VFR_RETURN_SUCCESS, L, "Failed to retrieve varstore name");\r
1842 Val.b = TRUE;\r
1843 if (CBObj.GetFlags () & 0x01) {\r
1844 _PCATCH(\r
1845 mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
1846 EFI_HII_DEFAULT_CLASS_STANDARD,\r
1847 _GET_CURRQEST_VARTINFO(),\r
1848 VarStoreName,\r
1849 _GET_CURRQEST_DATATYPE (),\r
1850 Val\r
1851 ),\r
1852 VFR_RETURN_SUCCESS,\r
1853 L,\r
1854 "No standard default storage found"\r
1855 );\r
1856 }\r
1857 if (CBObj.GetFlags () & 0x02) {\r
1858 _PCATCH(\r
1859 mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
1860 EFI_HII_DEFAULT_CLASS_MANUFACTURING,\r
1861 _GET_CURRQEST_VARTINFO(),\r
1862 VarStoreName,\r
1863 _GET_CURRQEST_DATATYPE (),\r
1864 Val\r
1865 ),\r
1866 VFR_RETURN_SUCCESS,\r
1867 L,\r
1868 "No manufacturing default storage found"\r
1869 );\r
1870 }\r
1871 >>\r
1872 }\r
1873 {\r
1874 Key "=" KN:Number "," << AssignQuestionKey (CBObj, KN); >>\r
1875 }\r
1876 vfrStatementQuestionOptionList\r
1877 E:EndCheckBox << CRT_END_OP (E); >>\r
1878 ";"\r
1879 ;\r
1880\r
1881vfrCheckBoxFlags [CIfrCheckBox & CBObj, UINT32 LineNum] :\r
1882 <<\r
1883 UINT8 LFlags = 0;\r
1884 UINT8 HFlags = 0;\r
1885 >>\r
1886 checkboxFlagsField[LFlags, HFlags] ( "\|" checkboxFlagsField[LFlags, HFlags] )*\r
1887 << _PCATCH(CBObj.SetFlags (HFlags, LFlags), LineNum); >>\r
1888 ;\r
1889\r
1890checkboxFlagsField[UINT8 & LFlags, UINT8 & HFlags] :\r
1891 N:Number <<\r
1892 if (mCompatibleMode) {\r
1893 //\r
1894 // set question flag\r
1895 //\r
1896 $LFlags |= _STOU8(N->getText());\r
1897 } else {\r
1898 _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine());\r
1899 }\r
1900 >>\r
1901 | D:"DEFAULT" <<\r
1902 if (mCompatibleMode) {\r
1903 //\r
1904 // set question Default flag\r
1905 //\r
1906 $LFlags |= 0x01;\r
1907 } else {\r
1908 _PCATCH (VFR_RETURN_UNSUPPORTED, D);\r
1909 }\r
1910 >>\r
1911 | M:"MANUFACTURING" <<\r
1912 if (mCompatibleMode) {\r
1913 //\r
1914 // set question MFG flag\r
1915 //\r
1916 $LFlags |= 0x02;\r
1917 } else {\r
1918 _PCATCH (VFR_RETURN_UNSUPPORTED, M);\r
1919 }\r
1920 >>\r
1921 | "CHECKBOX_DEFAULT" << $LFlags |= 0x01; >>\r
1922 | "CHECKBOX_DEFAULT_MFG" << $LFlags |= 0x02; >>\r
1923 | questionheaderFlagsField[HFlags]\r
1924 ;\r
1925\r
1926//*****************************************************\r
1927// Syntax of action\r
1928//\r
1929// Example:\r
1930// action\r
1931// prompt = STRING_TOKEN(STR_ACTION_PROMPT),\r
1932// help = STRING_TOKEN(STR_ACTION_HELP),\r
1933// flags = CALLBACK,\r
1934// config = STRING_TOKEN(STR_ACTION_CONFIG),\r
1935// endaction;\r
1936//\r
1937vfrStatementAction :\r
1938 << CIfrAction AObj; >>\r
1939 L:Action << AObj.SetLineNo(L->getLine()); >>\r
4234283c 1940 vfrQuestionHeader[AObj] ","\r
30fdf114
LG
1941 { F:FLAGS "=" vfrActionFlags[AObj, F->getLine()] "," }\r
1942 Config "=" "STRING_TOKEN" "\(" S:Number "\)" "," << AObj.SetQuestionConfig (_STOSID(S->getText())); >>\r
1943 vfrStatementQuestionTagList\r
1944 E:EndAction << CRT_END_OP (E); >>\r
1945 ";"\r
1946 ;\r
1947\r
1948vfrActionFlags[CIfrAction & AObj, UINT32 LineNum] :\r
1949 << UINT8 HFlags = 0; >>\r
1950 actionFlagsField[HFlags] ( "\|" actionFlagsField[HFlags] )*\r
1951 << _PCATCH(AObj.SetFlags (HFlags), LineNum); >>\r
1952 ;\r
1953\r
1954actionFlagsField[UINT8 & HFlags] :\r
1955 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1956 | questionheaderFlagsField[HFlags]\r
1957 ;\r
1958\r
1959vfrStatementDate :\r
1960 <<\r
1961 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;\r
1962 CHAR8 *VarIdStr[3] = {NULL, };\r
1963 CIfrDate DObj;\r
1964 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;\r
1965 >>\r
1966 L:Date << DObj.SetLineNo(L->getLine()); >>\r
1967 (\r
1968 (\r
1969 vfrQuestionHeader[DObj, QUESTION_DATE] ","\r
1970 { F:FLAGS "=" vfrDateFlags[DObj, F->getLine()] "," }\r
1971 vfrStatementQuestionOptionList\r
1972 )\r
1973 |\r
1974 (\r
1975 Year VarId "=" D1:StringIdentifier "." D1Y:StringIdentifier ","\r
1976 << _STRCAT(&VarIdStr[0], D1->getText()); _STRCAT(&VarIdStr[0], "."); _STRCAT(&VarIdStr[0], D1Y->getText()); >>\r
1977 Prompt "=" "STRING_TOKEN" "\(" YP:Number "\)" ","\r
1978 Help "=" "STRING_TOKEN" "\(" YH:Number "\)" ","\r
1979 minMaxDateStepDefault[Val.date, 0]\r
1980\r
1981 Month VarId "=" D2:StringIdentifier "." D2M:StringIdentifier ","\r
1982 << _STRCAT(&VarIdStr[1], D2->getText()); _STRCAT(&VarIdStr[1], "."); _STRCAT(&VarIdStr[1], D2M->getText()); >>\r
1983 Prompt "=" "STRING_TOKEN" "\(" MP:Number "\)" ","\r
1984 Help "=" "STRING_TOKEN" "\(" MH:Number "\)" ","\r
1985 minMaxDateStepDefault[Val.date, 1]\r
1986\r
1987 Day VarId "=" D3:StringIdentifier "." D3D:StringIdentifier ","\r
1988 << _STRCAT(&VarIdStr[2], D3->getText()); _STRCAT(&VarIdStr[2], "."); _STRCAT(&VarIdStr[2], D3D->getText()); >>\r
1989 Prompt "=" "STRING_TOKEN" "\(" DP:Number "\)" ","\r
1990 Help "=" "STRING_TOKEN" "\(" DH:Number "\)" ","\r
1991 minMaxDateStepDefault[Val.date, 2]\r
2bcc713e 1992 { G:FLAGS "=" vfrDateFlags[DObj, G->getLine()] "," }\r
30fdf114
LG
1993 <<\r
1994 mCVfrQuestionDB.RegisterOldDateQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId);\r
1995 DObj.SetQuestionId (QId);\r
1996 DObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_DATE_STORAGE_TIME);\r
1997 DObj.SetPrompt (_STOSID(YP->getText()));\r
1998 DObj.SetHelp (_STOSID(YH->getText()));\r
1999 if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }\r
2000 >>\r
2001 << {CIfrDefault DefaultObj(EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_DATE, Val); DefaultObj.SetLineNo(L->getLine());} >>\r
2002 )\r
2003 ( vfrStatementInconsistentIf )*\r
2004 )\r
2005 E:EndDate << CRT_END_OP (E); >>\r
2006 ";"\r
2007 ;\r
2008\r
2009minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :\r
fd171542 2010 Minimum "=" MinN:Number ","\r
2011 Maximum "=" MaxN:Number ","\r
30fdf114
LG
2012 { "step" "=" Number "," }\r
2013 {\r
2014 "default" "=" N:Number "," <<\r
2015 switch (KeyValue) {\r
fd171542 2016 case 0: \r
2017 D.Year = _STOU16(N->getText());\r
2018 if (D.Year < _STOU16 (MinN->getText()) || D.Year > _STOU16 (MaxN->getText())) {\r
2019 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value must be between Min year and Max year.");\r
2020 }\r
2021 break;\r
2022 case 1: \r
2023 D.Month = _STOU8(N->getText()); \r
2024 if (D.Month < 1 || D.Month > 12) {\r
2025 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value must be between 1 and 12.");\r
2026 }\r
2027 break;\r
2028 case 2: \r
2029 D.Day = _STOU8(N->getText()); \r
2030 if (D.Day < 1 || D.Day > 31) {\r
2031 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value must be between 1 and 31.");\r
2032 }\r
2033 break;\r
30fdf114
LG
2034 }\r
2035 >>\r
2036 }\r
2037 ;\r
2038\r
2039vfrDateFlags [CIfrDate & DObj, UINT32 LineNum] :\r
2040 << UINT8 LFlags = 0; >>\r
2041 dateFlagsField[LFlags] ( "\|" dateFlagsField[LFlags] )*\r
2042 << _PCATCH(DObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, LFlags), LineNum); >>\r
2043 ;\r
2044\r
2045dateFlagsField [UINT8 & Flags] :\r
2046 N:Number << $Flags |= _STOU8(N->getText()); >>\r
2047 | "YEAR_SUPPRESS" << $Flags |= 0x01; >>\r
2048 | "MONTH_SUPPRESS" << $Flags |= 0x02; >>\r
2049 | "DAY_SUPPRESS" << $Flags |= 0x04; >>\r
2050 | "STORAGE_NORMAL" << $Flags |= 0x00; >>\r
2051 | "STORAGE_TIME" << $Flags |= 0x10; >>\r
2052 | "STORAGE_WAKEUP" << $Flags |= 0x20; >>\r
2053 ;\r
2054\r
2055vfrStatementNumericType :\r
2056 vfrStatementNumeric |\r
2057 vfrStatementOneOf\r
2058 ;\r
2059\r
2060vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :\r
2061 <<\r
2062 UINT64 MaxU8 = 0, MinU8 = 0, StepU8 = 0;\r
2063 UINT32 MaxU4 = 0, MinU4 = 0, StepU4 = 0;\r
2064 UINT16 MaxU2 = 0, MinU2 = 0, StepU2 = 0;\r
2065 UINT8 MaxU1 = 0, MinU1 = 0, StepU1 = 0;\r
2066 >>\r
2067 Minimum "=" I:Number ","\r
2068 <<\r
a709adfa 2069 switch (_GET_CURRQEST_DATATYPE()) {\r
30fdf114
LG
2070 case EFI_IFR_TYPE_NUM_SIZE_64 : MinU8 = _STOU64(I->getText()); break;\r
2071 case EFI_IFR_TYPE_NUM_SIZE_32 : MinU4 = _STOU32(I->getText()); break;\r
2072 case EFI_IFR_TYPE_NUM_SIZE_16 : MinU2 = _STOU16(I->getText()); break;\r
2073 case EFI_IFR_TYPE_NUM_SIZE_8 : MinU1 = _STOU8(I->getText()); break;\r
2074 }\r
2075 >>\r
2076 Maximum "=" A:Number ","\r
2077 <<\r
a709adfa 2078 switch (_GET_CURRQEST_DATATYPE()) {\r
fd171542 2079 case EFI_IFR_TYPE_NUM_SIZE_64 : \r
2080 MaxU8 = _STOU64(A->getText()); \r
2081 if (MaxU8 < MinU8) {\r
2082 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");\r
2083 }\r
2084 break;\r
2085 case EFI_IFR_TYPE_NUM_SIZE_32 : \r
2086 MaxU4 = _STOU32(A->getText()); \r
2087 if (MaxU4 < MinU4) {\r
2088 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");\r
2089 }\r
2090 break;\r
2091 case EFI_IFR_TYPE_NUM_SIZE_16 : \r
2092 MaxU2 = _STOU16(A->getText()); \r
2093 if (MaxU2 < MinU2) {\r
2094 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");\r
2095 }\r
2096 break;\r
2097 case EFI_IFR_TYPE_NUM_SIZE_8 : \r
2098 MaxU1 = _STOU8(A->getText()); \r
2099 if (MaxU1 < MinU1) {\r
2100 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");\r
2101 }\r
2102 break;\r
30fdf114
LG
2103 }\r
2104 >>\r
2105 {\r
2106 STEP "=" S:Number ","\r
2107 <<\r
a709adfa 2108 switch (_GET_CURRQEST_DATATYPE()) {\r
30fdf114
LG
2109 case EFI_IFR_TYPE_NUM_SIZE_64 : StepU8 = _STOU64(S->getText()); break;\r
2110 case EFI_IFR_TYPE_NUM_SIZE_32 : StepU4 = _STOU32(S->getText()); break;\r
2111 case EFI_IFR_TYPE_NUM_SIZE_16 : StepU2 = _STOU16(S->getText()); break;\r
2112 case EFI_IFR_TYPE_NUM_SIZE_8 : StepU1 = _STOU8(S->getText()); break;\r
2113 }\r
2114 >>\r
2115 }\r
2116 <<\r
a709adfa 2117 switch (_GET_CURRQEST_DATATYPE()) {\r
30fdf114
LG
2118 case EFI_IFR_TYPE_NUM_SIZE_64 : $MMSDObj.SetMinMaxStepData (MinU8, MaxU8, StepU8); break;\r
2119 case EFI_IFR_TYPE_NUM_SIZE_32 : $MMSDObj.SetMinMaxStepData (MinU4, MaxU4, StepU4); break;\r
2120 case EFI_IFR_TYPE_NUM_SIZE_16 : $MMSDObj.SetMinMaxStepData (MinU2, MaxU2, StepU2); break;\r
2121 case EFI_IFR_TYPE_NUM_SIZE_8 : $MMSDObj.SetMinMaxStepData (MinU1, MaxU1, StepU1); break;\r
2122 }\r
2123 >>\r
2124 ;\r
2125\r
2126vfrStatementNumeric :\r
2127 <<\r
2128 CIfrNumeric NObj;\r
2129 UINT32 DataTypeSize;\r
b36d134f 2130 BOOLEAN IsSupported;\r
30fdf114
LG
2131 >>\r
2132 L:Numeric << NObj.SetLineNo(L->getLine()); >>\r
2133 vfrQuestionHeader[NObj] "," << // check data type\r
2134 _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "Numeric varid is not the valid data type");\r
2135 if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {\r
2136 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric varid doesn't support array");\r
2137 }\r
2138 _PCATCH(NObj.SetFlags (NObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());\r
2139 >>\r
2140 { F:FLAGS "=" vfrNumericFlags[NObj, F->getLine()] "," }\r
2141 {\r
2142 Key "=" KN:Number "," << AssignQuestionKey (NObj, KN); >>\r
2143 }\r
2144 vfrSetMinMaxStep[NObj]\r
2145 vfrStatementQuestionOptionList\r
b36d134f
LG
2146 E:EndNumeric << \r
2147 IsSupported = FALSE;\r
2148 switch (_GET_CURRQEST_DATATYPE()) {\r
2149 case EFI_IFR_TYPE_NUM_SIZE_8:\r
2150 case EFI_IFR_TYPE_NUM_SIZE_16:\r
2151 case EFI_IFR_TYPE_NUM_SIZE_32:\r
2152 case EFI_IFR_TYPE_NUM_SIZE_64:\r
2153 IsSupported = TRUE;\r
2154 break;\r
2155 default:\r
2156 break;\r
2157 }\r
2158 if (!IsSupported) {\r
2159 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric question only support UINT8, UINT16, UINT32 and UINT64 data type.");\r
2160 }\r
2161 CRT_END_OP (E); \r
2162 >>\r
30fdf114
LG
2163 ";"\r
2164 ;\r
2165\r
2166vfrNumericFlags [CIfrNumeric & NObj, UINT32 LineNum] :\r
2167 <<\r
a709adfa 2168 UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;\r
30fdf114 2169 UINT8 HFlags = 0;\r
a709adfa 2170 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;\r
30fdf114
LG
2171 >>\r
2172 numericFlagsField[HFlags, LFlags] ( "\|" numericFlagsField[HFlags, LFlags] )*\r
a709adfa
LG
2173 <<\r
2174 //check data type flag\r
2175 VarStoreType = mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);\r
2176 if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {\r
2177 if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {\r
2178 _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");\r
2179 }\r
2180 } else {\r
2181 // update data type for name/value store\r
2182 UINT32 DataTypeSize;\r
2183 _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;\r
2184 gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);\r
2185 _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;\r
2186 }\r
2187 _PCATCH(NObj.SetFlags (HFlags, LFlags), LineNum);\r
2188 >>\r
30fdf114
LG
2189 ;\r
2190\r
2191numericFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
2192 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
a709adfa
LG
2193 | "NUMERIC_SIZE_1" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_1; >>\r
2194 | "NUMERIC_SIZE_2" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_2; >>\r
2195 | "NUMERIC_SIZE_4" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_4; >>\r
2196 | "NUMERIC_SIZE_8" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_8; >>\r
2197 | "DISPLAY_INT_DEC" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_INT_DEC; >>\r
2198 | "DISPLAY_UINT_DEC" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_DEC; >>\r
2199 | "DISPLAY_UINT_HEX" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_HEX; >>\r
30fdf114
LG
2200 | questionheaderFlagsField[HFlags]\r
2201 ;\r
2202\r
2203vfrStatementOneOf :\r
2204 <<\r
2205 CIfrOneOf OObj;\r
2206 UINT32 DataTypeSize;\r
b36d134f 2207 BOOLEAN IsSupported;\r
30fdf114
LG
2208 >>\r
2209 L:OneOf << OObj.SetLineNo(L->getLine()); >>\r
2210 vfrQuestionHeader[OObj] "," << //check data type\r
2211 _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "OneOf varid is not the valid data type");\r
2212 if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {\r
2213 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf varid doesn't support array");\r
2214 }\r
2215 _PCATCH(OObj.SetFlags (OObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());\r
2216 >>\r
2217 { F:FLAGS "=" vfrOneofFlagsField[OObj, F->getLine()] "," }\r
2218 {\r
2219 vfrSetMinMaxStep[OObj]\r
2220 }\r
2221 vfrStatementQuestionOptionList\r
b36d134f
LG
2222 E:EndOneOf << \r
2223 IsSupported = FALSE;\r
2224 switch (_GET_CURRQEST_DATATYPE()) {\r
2225 case EFI_IFR_TYPE_NUM_SIZE_8:\r
2226 case EFI_IFR_TYPE_NUM_SIZE_16:\r
2227 case EFI_IFR_TYPE_NUM_SIZE_32:\r
2228 case EFI_IFR_TYPE_NUM_SIZE_64:\r
2229 IsSupported = TRUE;\r
2230 break;\r
2231 default:\r
2232 break;\r
2233 }\r
2234 if (!IsSupported) {\r
2235 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf question only support UINT8, UINT16, UINT32 and UINT64 data type.");\r
2236 }\r
2237 CRT_END_OP (E); \r
2238 >>\r
30fdf114
LG
2239 ";"\r
2240 ;\r
2241\r
2242vfrOneofFlagsField [CIfrOneOf & OObj, UINT32 LineNum] :\r
2243 <<\r
a709adfa 2244 UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;\r
30fdf114 2245 UINT8 HFlags = 0;\r
a709adfa 2246 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;\r
30fdf114
LG
2247 >>\r
2248 numericFlagsField[HFlags, LFlags] ( "\|" numericFlagsField[HFlags, LFlags] )*\r
a709adfa
LG
2249 <<\r
2250 //check data type flag\r
2251 VarStoreType = mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);\r
2252 if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {\r
2253 if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {\r
2254 _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");\r
2255 }\r
2256 } else {\r
2257 // update data type for Name/Value store\r
2258 UINT32 DataTypeSize;\r
2259 _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;\r
2260 gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);\r
2261 _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;\r
2262 }\r
2263 _PCATCH(OObj.SetFlags (HFlags, LFlags), LineNum);\r
2264 >>\r
30fdf114
LG
2265 ;\r
2266\r
2267vfrStatementStringType :\r
2268 vfrStatementString |\r
2269 vfrStatementPassword\r
2270 ;\r
2271\r
2272vfrStatementString :\r
2273 <<\r
2274 CIfrString SObj;\r
40d841f6
LG
2275 UINT32 VarArraySize;\r
2276 UINT8 StringMinSize;\r
2277 UINT8 StringMaxSize;\r
30fdf114
LG
2278 >>\r
2279 L:String << SObj.SetLineNo(L->getLine()); >>\r
2280 vfrQuestionHeader[SObj] ","\r
2281 { F:FLAGS "=" vfrStringFlagsField[SObj, F->getLine()] "," }\r
2282 {\r
2283 Key "=" KN:Number "," << AssignQuestionKey (SObj, KN); >>\r
2284 }\r
40d841f6
LG
2285 MinSize "=" MIN:Number "," << \r
2286 VarArraySize = _GET_CURRQEST_ARRAY_SIZE();\r
2287 StringMinSize = _STOU8(MIN->getText());\r
2288 if (_STOU64(MIN->getText()) > StringMinSize) {\r
2289 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "String MinSize takes only one byte, which can't be larger than 0xFF.");\r
2290 } else if (VarArraySize != 0 && StringMinSize > VarArraySize) {\r
2291 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "String MinSize can't be larger than the max number of elements in string array.");\r
2292 }\r
2293 SObj.SetMinSize (StringMinSize);\r
2294 >>\r
2295 MaxSize "=" MAX:Number "," << \r
2296 StringMaxSize = _STOU8(MAX->getText());\r
2297 if (_STOU64(MAX->getText()) > StringMaxSize) {\r
2298 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize takes only one byte, which can't be larger than 0xFF.");\r
2299 } else if (VarArraySize != 0 && StringMaxSize > VarArraySize) {\r
2300 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize can't be larger than the max number of elements in string array.");\r
2301 } else if (StringMaxSize < StringMinSize) {\r
2302 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize can't be less than String MinSize.");\r
2303 }\r
2304 SObj.SetMaxSize (StringMaxSize);\r
2305 >>\r
30fdf114
LG
2306 vfrStatementQuestionOptionList\r
2307 E:EndString << CRT_END_OP (E); >>\r
2308 ";"\r
2309 ;\r
2310\r
2311vfrStringFlagsField [CIfrString & SObj, UINT32 LineNum] :\r
2312 <<\r
2313 UINT8 LFlags = 0;\r
2314 UINT8 HFlags = 0;\r
2315 >>\r
2316 stringFlagsField[HFlags, LFlags] ( "\|" stringFlagsField[HFlags, LFlags] )*\r
2317 << _PCATCH(SObj.SetFlags (HFlags, LFlags), LineNum); >>\r
2318 ;\r
2319\r
2320stringFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
2321 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
2322 | "MULTI_LINE" << $LFlags = 0x01; >>\r
2323 | questionheaderFlagsField[HFlags]\r
2324 ;\r
2325\r
2326vfrStatementPassword :\r
2327 <<\r
2328 CIfrPassword PObj;\r
40d841f6
LG
2329 UINT32 VarArraySize;\r
2330 UINT16 PasswordMinSize;\r
2331 UINT16 PasswordMaxSize;\r
30fdf114
LG
2332 >>\r
2333 L:Password << PObj.SetLineNo(L->getLine()); >>\r
2334 vfrQuestionHeader[PObj] ","\r
2335 { F:FLAGS "=" vfrPasswordFlagsField[PObj, F->getLine()] "," }\r
2336 {\r
2337 Key "=" KN:Number "," << AssignQuestionKey (PObj, KN); >>\r
2338 }\r
40d841f6
LG
2339 MinSize "=" MIN:Number "," << \r
2340 VarArraySize = _GET_CURRQEST_ARRAY_SIZE();\r
2341 PasswordMinSize = _STOU16(MIN->getText());\r
2342 if (_STOU64(MIN->getText()) > PasswordMinSize) {\r
2343 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "Password MinSize takes only two byte, which can't be larger than 0xFFFF.");\r
2344 } else if (VarArraySize != 0 && PasswordMinSize > VarArraySize) {\r
2345 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "Password MinSize can't be larger than the max number of elements in password array.");\r
2346 }\r
2347 PObj.SetMinSize (PasswordMinSize);\r
2348 >>\r
2349 MaxSize "=" MAX:Number "," << \r
2350 PasswordMaxSize = _STOU16(MAX->getText());\r
2351 if (_STOU64(MAX->getText()) > PasswordMaxSize) {\r
2352 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize takes only two byte, which can't be larger than 0xFFFF.");\r
2353 } else if (VarArraySize != 0 && PasswordMaxSize > VarArraySize) {\r
2354 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize can't be larger than the max number of elements in password array.");\r
2355 } else if (PasswordMaxSize < PasswordMinSize) {\r
2356 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize can't be less than Password MinSize.");\r
2357 }\r
2358 PObj.SetMaxSize (PasswordMaxSize);\r
2359 >>\r
30fdf114
LG
2360 { Encoding "=" Number "," }\r
2361 vfrStatementQuestionOptionList\r
2362 E:EndPassword << CRT_END_OP (E); >>\r
2363 ";"\r
2364 ;\r
2365\r
2366vfrPasswordFlagsField [CIfrPassword & PObj, UINT32 LineNum] :\r
2367 << UINT8 HFlags = 0; >>\r
2368 passwordFlagsField[HFlags] ( "\|" passwordFlagsField[HFlags] )*\r
2369 << _PCATCH(PObj.SetFlags(HFlags), LineNum); >>\r
2370 ;\r
2371\r
2372passwordFlagsField [UINT8 & HFlags] :\r
2373 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
2374 | questionheaderFlagsField[HFlags]\r
2375 ;\r
2376\r
2377vfrStatementOrderedList :\r
2378 <<\r
2379 CIfrOrderedList OLObj;\r
40d841f6 2380 UINT32 VarArraySize;\r
30fdf114
LG
2381 >>\r
2382 L:OrderedList << OLObj.SetLineNo(L->getLine()); >>\r
2383 vfrQuestionHeader[OLObj] ","\r
40d841f6
LG
2384 << \r
2385 VarArraySize = _GET_CURRQEST_ARRAY_SIZE();\r
2386 OLObj.SetMaxContainers ((UINT8) (VarArraySize > 0xFF ? 0xFF : VarArraySize));\r
2387 >>\r
30fdf114 2388 {\r
40d841f6
LG
2389 MaxContainers "=" M:Number "," << \r
2390 if (_STOU64(M->getText()) > _STOU8(M->getText())) {\r
2391 _PCATCH (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList MaxContainers takes only one byte, which can't be larger than 0xFF.");\r
2392 } else if (VarArraySize != 0 && _STOU8(M->getText()) > VarArraySize) {\r
2393 _PCATCH (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList MaxContainers can't be larger than the max number of elements in array.");\r
2394 }\r
2395 OLObj.SetMaxContainers (_STOU8(M->getText()));\r
2396 >>\r
30fdf114
LG
2397 }\r
2398 { F:FLAGS "=" vfrOrderedListFlags[OLObj, F->getLine()] }\r
2399 vfrStatementQuestionOptionList\r
2400 E:EndList << CRT_END_OP (E); >>\r
2401 ";"\r
2402 ;\r
2403\r
2404vfrOrderedListFlags [CIfrOrderedList & OLObj, UINT32 LineNum] :\r
2405 <<\r
2406 UINT8 HFlags = 0;\r
2407 UINT8 LFlags = 0;\r
2408 >>\r
2409 orderedlistFlagsField[HFlags, LFlags] ( "\|" orderedlistFlagsField[HFlags, LFlags] )*\r
2410 << _PCATCH(OLObj.SetFlags (HFlags, LFlags), LineNum); >>\r
2411 ;\r
2412\r
2413orderedlistFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
2414 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
2415 | "UNIQUE" << $LFlags |= 0x01; >>\r
2416 | "NOEMPTY" << $LFlags |= 0x02; >>\r
2417 | questionheaderFlagsField[HFlags]\r
2418 ;\r
2419\r
2420vfrStatementTime :\r
2421 <<\r
2422 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;\r
2423 CHAR8 *VarIdStr[3] = {NULL, };\r
2424 CIfrTime TObj;\r
2425 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;\r
2426 >>\r
2427 L:Time << TObj.SetLineNo(L->getLine()); >>\r
2428 (\r
2429 (\r
2430 vfrQuestionHeader[TObj, QUESTION_TIME] ","\r
2431 { F:FLAGS "=" vfrTimeFlags[TObj, F->getLine()] "," }\r
40d841f6 2432 vfrStatementQuestionOptionList\r
30fdf114
LG
2433 )\r
2434 |\r
2435 (\r
2436 Hour VarId "=" T1:StringIdentifier "." T1H:StringIdentifier ","\r
2437 << _STRCAT(&VarIdStr[0], T1->getText()); _STRCAT(&VarIdStr[0], "."); _STRCAT(&VarIdStr[0], T1H->getText()); >>\r
2438 Prompt "=" "STRING_TOKEN" "\(" HP:Number "\)" ","\r
2439 Help "=" "STRING_TOKEN" "\(" HH:Number "\)" ","\r
2440 minMaxTimeStepDefault[Val.time, 0]\r
2441\r
2442 Minute VarId "=" T2:StringIdentifier "." T2M:StringIdentifier ","\r
2443 << _STRCAT(&VarIdStr[1], T2->getText()); _STRCAT(&VarIdStr[1], "."); _STRCAT(&VarIdStr[1], T2M->getText()); >>\r
2444 Prompt "=" "STRING_TOKEN" "\(" MP:Number "\)" ","\r
2445 Help "=" "STRING_TOKEN" "\(" MH:Number "\)" ","\r
2446 minMaxTimeStepDefault[Val.time, 1]\r
2447\r
2448 Second VarId "=" T3:StringIdentifier "." T3S:StringIdentifier ","\r
2449 << _STRCAT(&VarIdStr[2], T3->getText()); _STRCAT(&VarIdStr[2], "."); _STRCAT(&VarIdStr[2], T3S->getText()); >>\r
2450 Prompt "=" "STRING_TOKEN" "\(" SP:Number "\)" ","\r
2451 Help "=" "STRING_TOKEN" "\(" SH:Number "\)" ","\r
2452 minMaxTimeStepDefault[Val.time, 2]\r
2bcc713e 2453 { G:FLAGS "=" vfrTimeFlags[TObj, G->getLine()] "," }\r
30fdf114
LG
2454 <<\r
2455 mCVfrQuestionDB.RegisterOldTimeQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId);\r
2456 TObj.SetQuestionId (QId);\r
2457 TObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_TIME_STORAGE_TIME);\r
2458 TObj.SetPrompt (_STOSID(HP->getText()));\r
2459 TObj.SetHelp (_STOSID(HH->getText()));\r
2460 if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }\r
2461 >>\r
2462 << {CIfrDefault DefaultObj(EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_TIME, Val); DefaultObj.SetLineNo(L->getLine());} >>\r
2463 )\r
2464 ( vfrStatementInconsistentIf )*\r
2465 )\r
2466 E:EndTime << CRT_END_OP (E); >>\r
2467 ";"\r
2468 ;\r
2469\r
2470minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :\r
2471 Minimum "=" Number ","\r
2472 Maximum "=" Number ","\r
2473 { "step" "=" Number "," }\r
2474 {\r
2475 "default" "=" N:Number "," <<\r
2476 switch (KeyValue) {\r
fd171542 2477 case 0: \r
2478 T.Hour = _STOU8(N->getText()); \r
2479 if (T.Hour > 23) {\r
2480 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value must be between 0 and 23.");\r
2481 }\r
2482 break;\r
2483 case 1: \r
2484 T.Minute = _STOU8(N->getText()); \r
2485 if (T.Minute > 59) {\r
2486 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value must be between 0 and 59.");\r
2487 }\r
2488 break;\r
2489 case 2: \r
2490 T.Second = _STOU8(N->getText());\r
2491 if (T.Second > 59) {\r
2492 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value must be between 0 and 59.");\r
2493 }\r
2494 break;\r
30fdf114
LG
2495 }\r
2496 >>\r
2497 }\r
2498 ;\r
2499\r
2500vfrTimeFlags [CIfrTime & TObj, UINT32 LineNum] :\r
2501 << UINT8 LFlags = 0; >>\r
2502 timeFlagsField[LFlags] ( "\|" timeFlagsField[LFlags] )*\r
2503 << _PCATCH(TObj.SetFlags(EFI_IFR_QUESTION_FLAG_DEFAULT, LFlags), LineNum); >>\r
2504 ;\r
2505\r
2506timeFlagsField [UINT8 & Flags] :\r
2507 N:Number << $Flags |= _STOU8(N->getText()); >>\r
2508 | "HOUR_SUPPRESS" << $Flags |= 0x01; >>\r
2509 | "MINUTE_SUPPRESS" << $Flags |= 0x02; >>\r
2510 | "SECOND_SUPPRESS" << $Flags |= 0x04; >>\r
2511 | "STORAGE_NORMAL" << $Flags |= 0x00; >>\r
2512 | "STORAGE_TIME" << $Flags |= 0x10; >>\r
2513 | "STORAGE_WAKEUP" << $Flags |= 0x20; >>\r
2514 ;\r
2515\r
2516vfrStatementQuestionTag :\r
2517 vfrStatementStatTag "," |\r
2518 vfrStatementInconsistentIf |\r
2519 vfrStatementNoSubmitIf |\r
2520 vfrStatementDisableIfQuest |\r
2521 vfrStatementRefresh |\r
da92f276 2522 vfrStatementVarstoreDevice |\r
4234283c
LG
2523 vfrStatementExtension |\r
2524 vfrStatementRefreshEvent\r
30fdf114
LG
2525 ;\r
2526\r
2527vfrStatementQuestionTagList :\r
2528 ( vfrStatementQuestionTag )*\r
2529 ;\r
2530\r
2531vfrStatementQuestionOptionTag :\r
2532 vfrStatementSuppressIfQuest |\r
2533 vfrStatementGrayOutIfQuest |\r
2534 vfrStatementValue |\r
2535 vfrStatementDefault |\r
52302d4d
LG
2536 vfrStatementRead |\r
2537 vfrStatementWrite |\r
30fdf114
LG
2538 vfrStatementOptions\r
2539 ;\r
2540\r
2541vfrStatementQuestionOptionList :\r
2542 (\r
2543 vfrStatementQuestionTag |\r
2544 vfrStatementQuestionOptionTag\r
2545 )*\r
2546 ;\r
2547\r
2548vfrStatementStatList :\r
2549 vfrStatementStat |\r
2550 vfrStatementQuestions |\r
2551 vfrStatementConditionalNew |\r
2552 vfrStatementLabel |\r
da92f276 2553 vfrStatementExtension |\r
30fdf114
LG
2554 // Just for framework vfr compatibility\r
2555 vfrStatementInvalid\r
2556 ;\r
2557\r
2558vfrStatementStatListOld :\r
2559 vfrStatementStat |\r
2560 vfrStatementQuestions |\r
2561 vfrStatementLabel |\r
2562 // Just for framework vfr compatibility\r
2563 vfrStatementInvalid\r
2564 ;\r
2565\r
2566vfrStatementDisableIfStat :\r
2567 << \r
2568 CIfrDisableIf DIObj; \r
30fdf114
LG
2569 >>\r
2570 L:DisableIf << DIObj.SetLineNo(L->getLine()); >>\r
a709adfa 2571 vfrStatementExpression[0] ";" \r
30fdf114
LG
2572 ( vfrStatementStatList )*\r
2573 E:EndIf << CRT_END_OP (E); >>\r
2574 ";"\r
2575 ;\r
2576\r
2577vfrStatementInconsistentIfStat :\r
2578 << CIfrInconsistentIf IIObj; >>\r
2579 L:InconsistentIf <<\r
2580 if (!mCompatibleMode) {\r
2581 _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2582 }\r
2583 IIObj.SetLineNo(L->getLine());\r
2584 >>\r
2585 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << IIObj.SetError (_STOSID(S->getText())); >>\r
2586 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2587 vfrStatementExpression[0]\r
2588 E:EndIf << CRT_END_OP (E); >>\r
2589 ";"\r
2590 ;\r
2591\r
2592//\r
2593// Compatible for framework vfr file\r
2594//\r
2595vfrStatementgrayoutIfSuppressIf:\r
2596 << CIfrSuppressIf SIObj; >>\r
2597 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>\r
2598 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2599 vfrStatementExpression[0]\r
2600 ";"\r
2601 ;\r
2602\r
2603vfrStatementsuppressIfGrayOutIf:\r
2604 << CIfrGrayOutIf GOIObj; >>\r
2605 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>\r
2606 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2607 vfrStatementExpression[0]\r
2608 ";"\r
2609 ;\r
2610\r
2611vfrStatementSuppressIfStatNew :\r
2612 << CIfrSuppressIf SIObj;>>\r
2613 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>\r
2614 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2615 vfrStatementExpression[0]\r
2616 ";"\r
2617 ( vfrStatementStatList )*\r
2618 E: EndIf ";" << CRT_END_OP (E); >>\r
2619 ;\r
2620\r
2621vfrStatementGrayOutIfStatNew :\r
2622 << CIfrGrayOutIf GOIObj;>>\r
2623 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>\r
2624 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2625 vfrStatementExpression[0]\r
2626 ";"\r
2627 ( vfrStatementStatList )*\r
2628 E: EndIf ";" << CRT_END_OP (E); >>\r
2629 ;\r
2630\r
2631vfrStatementSuppressIfStatOld :\r
2632 <<\r
2633 CIfrSuppressIf SIObj;\r
2634 BOOLEAN GrayOutExist = FALSE;\r
2635 >>\r
2636 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>\r
2637 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2638 vfrStatementExpression[0]\r
2639 ";"\r
2640 {\r
2641 vfrStatementsuppressIfGrayOutIf\r
2642 << GrayOutExist = TRUE; >>\r
2643 }\r
2644 ( vfrStatementStatListOld )*\r
2645 E: EndIf ";" << if (GrayOutExist) CRT_END_OP (E); CRT_END_OP (E);>>\r
2646 ;\r
2647\r
2648vfrStatementGrayOutIfStatOld :\r
2649 <<\r
2650 CIfrGrayOutIf GOIObj;\r
2651 BOOLEAN SuppressExist = FALSE;\r
2652 >>\r
2653 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>\r
2654 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2655 vfrStatementExpression[0]\r
2656 ";"\r
2657 {\r
2658 vfrStatementgrayoutIfSuppressIf\r
2659 << SuppressExist = TRUE; >>\r
2660 }\r
2661 ( vfrStatementStatListOld )*\r
2662 E: EndIf ";" << if (SuppressExist) CRT_END_OP (E); CRT_END_OP (E); >>\r
2663 ;\r
2664\r
2665vfrImageTag :\r
2666 << CIfrImage IObj; >>\r
2667 L:Image "=" "IMAGE_TOKEN" "\(" S1:Number "\)" << IObj.SetImageId (_STOSID(S1->getText())); IObj.SetLineNo(L->getLine()); >>\r
2668 ;\r
2669\r
2670vfrLockedTag :\r
2671 << CIfrLocked LObj; >>\r
2672 L:Locked << LObj.SetLineNo(L->getLine()); >>\r
2673 ;\r
2674\r
4234283c
LG
2675vfrModalTag :\r
2676 << CIfrModal MObj; >>\r
2677 L:Modal << MObj.SetLineNo(L->getLine()); >>\r
2678 ;\r
2679\r
30fdf114
LG
2680vfrStatementStatTag :\r
2681 vfrImageTag |\r
2682 vfrLockedTag\r
2683 ;\r
2684\r
2685vfrStatementStatTagList :\r
2686 vfrStatementStatTag ( "," vfrStatementStatTag )*\r
2687 ;\r
2688\r
2689vfrStatementImage :\r
2690 vfrImageTag\r
2691 ";"\r
2692 ;\r
2693\r
4234283c
LG
2694vfrStatementModal :\r
2695 vfrModalTag\r
2696 ";"\r
2697 ;\r
2698\r
30fdf114
LG
2699vfrStatementLocked :\r
2700 vfrLockedTag\r
2701 ";"\r
2702 ;\r
2703\r
2704vfrStatementInconsistentIf :\r
2705 << CIfrInconsistentIf IIObj; >>\r
2706 L:InconsistentIf << IIObj.SetLineNo(L->getLine()); >>\r
2707 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << IIObj.SetError (_STOSID(S->getText())); >>\r
2708 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2709 vfrStatementExpression[0]\r
2710 E:EndIf << CRT_END_OP (E); >>\r
2711 ;\r
2712\r
2713vfrStatementNoSubmitIf :\r
2714 << CIfrNoSubmitIf NSIObj; >>\r
2715 L:NoSubmitIf << NSIObj.SetLineNo(L->getLine()); >>\r
2716 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << NSIObj.SetError (_STOSID(S->getText())); >>\r
2717 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2718 vfrStatementExpression[0]\r
2719 E:EndIf << CRT_END_OP (E); >>\r
2720 ;\r
2721\r
2722vfrStatementDisableIfQuest :\r
2723 << \r
2724 CIfrDisableIf DIObj; \r
30fdf114
LG
2725 >>\r
2726 L:DisableIf << DIObj.SetLineNo(L->getLine()); >>\r
a709adfa 2727 vfrStatementExpression[0] ";"\r
30fdf114
LG
2728 vfrStatementQuestionOptionList\r
2729 E:EndIf << CRT_END_OP (E); >>\r
2730 ;\r
2731\r
2732vfrStatementRefresh :\r
2733 << CIfrRefresh RObj; >>\r
2734 L:Refresh << RObj.SetLineNo(L->getLine()); >>\r
2735 Interval "=" I:Number << RObj.SetRefreshInterval (_STOU8(I->getText())); >>\r
2736 ;\r
2737\r
4234283c
LG
2738vfrStatementRefreshEvent :\r
2739 <<\r
2740 CIfrRefreshId RiObj;\r
2741 EFI_GUID Guid;\r
2742 >>\r
2743 L:RefreshGuid << RiObj.SetLineNo(L->getLine()); >>\r
2744 "=" guidDefinition[Guid] "," << RiObj.SetRefreshEventGroutId (&Guid); >>\r
2745 ;\r
2746\r
30fdf114
LG
2747vfrStatementVarstoreDevice :\r
2748 << CIfrVarStoreDevice VDObj; >>\r
2749 L:VarstoreDevice << VDObj.SetLineNo(L->getLine()); >>\r
2750 "=" "STRING_TOKEN" "\(" S:Number "\)" "," << VDObj.SetDevicePath (_STOSID(S->getText())); >>\r
2751 ;\r
2752\r
2753vfrStatementSuppressIfQuest :\r
2754 << CIfrSuppressIf SIObj; >>\r
2755 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>\r
2756 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2757 vfrStatementExpression[0] ";"\r
2758 vfrStatementQuestionOptionList\r
2759 E:EndIf << CRT_END_OP (E); >>\r
2760 ;\r
2761\r
2762vfrStatementGrayOutIfQuest :\r
2763 << CIfrGrayOutIf GOIObj; >>\r
2764 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>\r
2765 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2766 vfrStatementExpression[0] ";"\r
2767 vfrStatementQuestionOptionList\r
2768 E:EndIf << CRT_END_OP (E); >>\r
2769 ;\r
2770\r
2771vfrStatementOptions :\r
2772 vfrStatementOneOfOption\r
2773 ;\r
2774\r
2775vfrStatementOneOfOption :\r
2776 <<\r
2777 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;\r
2778 CIfrOneOfOption OOOObj;\r
2779 CHAR8 *VarStoreName = NULL;\r
2780 >>\r
2781 L:Option << OOOObj.SetLineNo(L->getLine()); >>\r
2782 Text "=" "STRING_TOKEN" "\(" S:Number "\)" "," << OOOObj.SetOption (_STOSID(S->getText())); >>\r
a709adfa
LG
2783 Value "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] >[Val] "," \r
2784 << \r
2785 if (gCurrentMinMaxData != NULL) {\r
2786 //set min/max value for oneof opcode\r
2787 UINT64 Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE());\r
2788 switch (_GET_CURRQEST_DATATYPE()) {\r
2789 case EFI_IFR_TYPE_NUM_SIZE_64:\r
2790 gCurrentMinMaxData->SetMinMaxStepData(Val.u64, Val.u64, Step);\r
2791 break;\r
2792 case EFI_IFR_TYPE_NUM_SIZE_32:\r
2793 gCurrentMinMaxData->SetMinMaxStepData(Val.u32, Val.u32, (UINT32) Step);\r
2794 break;\r
2795 case EFI_IFR_TYPE_NUM_SIZE_16:\r
2796 gCurrentMinMaxData->SetMinMaxStepData(Val.u16, Val.u16, (UINT16) Step);\r
2797 break;\r
2798 case EFI_IFR_TYPE_NUM_SIZE_8:\r
2799 gCurrentMinMaxData->SetMinMaxStepData(Val.u8, Val.u8, (UINT8) Step);\r
2800 break;\r
2801 default:\r
2802 break;\r
2803 }\r
2804 }\r
2805 OOOObj.SetType (_GET_CURRQEST_DATATYPE()); \r
2806 OOOObj.SetValue (Val); \r
2807 >>\r
30fdf114
LG
2808 F:FLAGS "=" vfrOneOfOptionFlags[OOOObj, F->getLine()]\r
2809 <<\r
2810 _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), L->getLine());\r
2811 if (OOOObj.GetFlags () & 0x10) {\r
2812 _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
2813 EFI_HII_DEFAULT_CLASS_STANDARD,\r
2814 _GET_CURRQEST_VARTINFO(),\r
2815 VarStoreName,\r
2816 _GET_CURRQEST_DATATYPE (),\r
2817 Val\r
2818 ), L->getLine());\r
2819 }\r
2820 if (OOOObj.GetFlags () & 0x20) {\r
2821 _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
2822 EFI_HII_DEFAULT_CLASS_MANUFACTURING,\r
2823 _GET_CURRQEST_VARTINFO(),\r
2824 VarStoreName,\r
2825 _GET_CURRQEST_DATATYPE (),\r
2826 Val\r
2827 ), L->getLine());\r
2828 }\r
2829 >>\r
2830 {\r
2831 "," Key "=" KN:Number <<\r
2832 if (!mCompatibleMode) {\r
2833 _PCATCH (VFR_RETURN_UNSUPPORTED, KN);\r
2834 }\r
2835 //\r
2836 // Guid Option Key\r
2837 //\r
2838 CIfrOptionKey IfrOptionKey (\r
2839 gCurrentQuestion->QUESTION_ID(),\r
2840 Val,\r
2841 _STOQID(KN->getText())\r
2842 );\r
2843 SET_LINE_INFO (IfrOptionKey, KN);\r
2844 >>\r
2845 }\r
2846 (\r
2847 T:"," vfrImageTag << OOOObj.SetScope (1); CRT_END_OP (T); >>\r
2848 )*\r
2849 ";"\r
2850 ;\r
2851\r
2852vfrOneOfOptionFlags [CIfrOneOfOption & OOOObj, UINT32 LineNum] :\r
2853 <<\r
2854 UINT8 LFlags = _GET_CURRQEST_DATATYPE();\r
2855 UINT8 HFlags = 0;\r
2856 >>\r
2857 oneofoptionFlagsField[HFlags, LFlags] ( "\|" oneofoptionFlagsField[HFlags, LFlags] )*\r
2858 << _PCATCH(gCurrentQuestion->SetFlags(HFlags), LineNum); >>\r
2859 << _PCATCH(OOOObj.SetFlags(LFlags), LineNum); >>\r
2860 ;\r
2861\r
2862oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
2863 N:Number << $LFlags |= _STOU8(N->getText()); >>\r
2864 | "OPTION_DEFAULT" << $LFlags |= 0x10; >>\r
2865 | "OPTION_DEFAULT_MFG" << $LFlags |= 0x20; >>\r
2866 | InteractiveFlag << $HFlags |= 0x04; >>\r
2867 | NVAccessFlag << $HFlags |= 0x08; >>\r
2868 | ResetRequiredFlag << $HFlags |= 0x10; >>\r
2869 | LateCheckFlag << $HFlags |= 0x20; >>\r
2870 | ManufacturingFlag << $LFlags |= 0x20; >>\r
2871 | DefaultFlag << $LFlags |= 0x10; >>\r
2872 ;\r
2873\r
2874vfrStatementLabel :\r
2875 L:Label\r
2876 N:Number <<\r
2877 if (mCompatibleMode) {\r
2878 //\r
2879 // Add end Label for Framework Vfr\r
2880 //\r
2881 CIfrLabel LObj1;\r
2882 LObj1.SetLineNo(L->getLine());\r
2883 LObj1.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff\r
2884 }\r
2885\r
2886 {\r
2887 CIfrLabel LObj2;\r
2888 LObj2.SetLineNo(L->getLine());\r
2889 LObj2.SetNumber (_STOU16(N->getText()));\r
2890 }\r
2891 >>\r
2892 ";"\r
2893 ;\r
2894\r
2895vfrStatementBanner :\r
2896 << CIfrBanner BObj; >>\r
2897 B:Banner { "," } << BObj.SetLineNo(B->getLine()); >>\r
2898 Title "=" "STRING_TOKEN" "\(" S:Number "\)" "," << BObj.SetTitle (_STOSID(S->getText())); >>\r
2899 (\r
2900 (\r
2901 Line L:Number "," << BObj.SetLine (_STOU16(L->getText())); >>\r
2902 Align\r
2903 (\r
2904 Left << BObj.SetAlign (0); >>\r
2905 | Center << BObj.SetAlign (1); >>\r
2906 | Right << BObj.SetAlign (2); >>\r
2907 ) ";"\r
2908 )\r
2909 |\r
2910 (\r
2911 Timeout "=" T:Number ";" << {CIfrTimeout TObj(_STOU16(T->getText()));} >>\r
2912 )\r
2913 )\r
2914 ;\r
2915\r
2916//******************************************************************************\r
2917//\r
2918// keep some syntax for compatibility but not generate any IFR object\r
2919//\r
2920vfrStatementInvalidHidden :\r
2921 L:Hidden <<\r
2922 if (!mCompatibleMode) {\r
2923 _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2924 }\r
2925 >>\r
2926 Value "=" Number ","\r
2927 Key "=" Number ";"\r
2928 ;\r
2929\r
2930vfrStatementInvalidInconsistentIf :\r
2931 InconsistentIf\r
2932 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" ","\r
2933 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2934 vfrStatementExpression[0]\r
2935 EndIf\r
2936 ";"\r
2937 ;\r
2938\r
2939vfrStatementInvalidInventory :\r
2940 L:Inventory <<\r
2941 if (!mCompatibleMode) {\r
2942 _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2943 }\r
2944 >>\r
2945 Help "=" "STRING_TOKEN" "\(" Number "\)" ","\r
2946 Text "=" "STRING_TOKEN" "\(" Number "\)" ","\r
2947 {\r
2948 Text "=" "STRING_TOKEN" "\(" Number "\)"\r
2949 }\r
2950 ";"\r
2951 ;\r
2952\r
2953vfrStatementInvalidSaveRestoreDefaults :\r
2954 (\r
2955 L:Save <<\r
2956 if (!mCompatibleMode) {\r
2957 _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2958 }\r
2959 >>\r
2960 |\r
2961 K:Restore <<\r
2962 if (!mCompatibleMode) {\r
2963 _PCATCH (VFR_RETURN_UNSUPPORTED, K);\r
2964 }\r
2965 >>\r