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