2 Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
3 This program and the accompanying materials
4 are licensed and made available under the terms and conditions of the BSD License
5 which accompanies this distribution. The full text of the license may be found at
6 http://opensource.org/licenses/bsd-license.php
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 #include "VfrFormPkg.h"
23 #include "VfrUtilityLib.h"
30 #include "PBlackBox.h"
31 #include "DLexerBase.h"
35 #define GET_LINENO(Obj) ((Obj)->getLine())
36 #define SET_LINE_INFO(Obj, L) {(Obj).SetLineNo((L)->getLine());} while (0)
37 #define CRT_END_OP(Obj) {CIfrEnd EObj; if (Obj != NULL) EObj.SetLineNo ((Obj)->getLine());} while (0)
39 typedef ANTLRCommonToken ANTLRToken;
41 class CVfrDLGLexer : public VfrLexer
44 CVfrDLGLexer (DLGFileInput *F) : VfrLexer (F) {};
45 INT32 errstd (char *Text)
47 printf ("unrecognized input '%s'\n", Text);
54 IN INPUT_INFO_TO_SYNTAX *InputInfo
57 ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken> VfrParser(File);
58 VfrParser.parser()->SetCompatibleMode (InputInfo->CompatibleMode);
59 VfrParser.parser()->SetOverrideClassGuid (InputInfo->OverrideClassGuid);
60 return VfrParser.parser()->vfrProgram();
65 // Define a lexical class for parsing quoted strings. Basically
66 // starts with a double quote, and ends with a double quote that
67 // is not preceeded with a backslash.
69 #lexclass QUOTED_STRING
70 #token TheString "~[\"]*\"" << mode (START); >>
73 // Define a lexclass for skipping over C++ style comments
76 #token "~[\n]*" << skip (); >>
77 #token "\n" << skip (); mode (START); newline (); >>
80 // Standard lexclass is START
85 // Find start of C++ style comments
87 #token "//" << skip (); mode (CPP_COMMENT); >>
92 #token "[\ \t]" << skip (); >>
95 // Skip over newlines, but count them
97 #token "\n" << skip (); newline (); >>
100 // Skip over 'extern' in any included .H file
102 #token "extern" << skip (); mode (CPP_COMMENT); >>
105 // Tokens for the different keywords. Syntax is:
106 // TokenName("ErrorMessageText") "TokenString"
108 // TokenName is the token name (must be capitalized) that is used in the rules
109 // ErrorMessageText is the string the compiler emits when it detects a syntax error
110 // TokenString is the actual matching string used in the user script
112 #token FormPkgType("formpkgtype") "formpkgtype"
113 #token OpenBrace("{") "\{"
114 #token CloseBrace("}") "\}"
115 #token OpenParen("(") "\("
116 #token CloseParen(")") "\)"
117 #token OpenBracket("[") "\["
118 #token CloseBracket("]") "\]"
120 #token LineDefinition "#line\ [0-9]+\ \"~[\"]+\"[\ \t]*\n" << gCVfrErrorHandle.ParseFileScopeRecord (begexpr (), line ()); skip (); newline (); >>
121 #token DevicePath("devicepath") "devicepath"
122 #token FormSet("formset") "formset"
123 #token FormSetId("formsetid") "formsetid"
124 #token EndFormSet("endformset") "endformset"
125 #token Title("title") "title"
126 #token FormId("formid") "formid"
127 #token OneOf("oneof") "oneof"
128 #token EndOneOf("endoneof") "endoneof"
129 #token Prompt("prompt") "prompt"
130 #token OrderedList("orderedlist") "orderedlist"
131 #token MaxContainers("maxcontainers") "maxcontainers"
132 #token EndList("endlist") "endlist"
133 #token EndForm("endform") "endform"
134 #token Form("form") "form"
135 #token FormMap("formmap") "formmap"
136 #token MapTitle("maptitle") "maptitle"
137 #token MapGuid("mapguid") "mapguid"
138 #token Subtitle("subtitle") "subtitle"
139 #token Help("help") "help"
140 #token Text("text") "text"
141 #token Option("option") "option"
142 #token FLAGS("flags") "flags"
143 #token Date("date") "date"
144 #token EndDate("enddate") "enddate"
145 #token Year("year") "year"
146 #token Month("month") "month"
147 #token Day("day") "day"
148 #token Time("time") "time"
149 #token EndTime("endtime") "endtime"
150 #token Hour("hour") "hour"
151 #token Minute("minute") "minute"
152 #token Second("second") "second"
153 #token GrayOutIf("grayoutif") "grayoutif"
154 #token Label("label") "label"
155 #token Timeout("timeout") "timeout"
156 #token Inventory("inventory") "inventory"
157 #token NonNvDataMap("_NON_NV_DATA_MAP") "_NON_NV_DATA_MAP"
158 #token Struct("struct") "struct"
159 #token Boolean("BOOLEAN") "BOOLEAN"
160 #token Uint64("UINT64") "UINT64"
161 #token Uint32("UINT32") "UINT32"
162 #token Uint16("UINT16") "UINT16"
163 #token Char16("CHAR16") "CHAR16"
164 #token Uint8("UINT8") "UINT8"
165 #token Uuid("guid") "guid"
166 #token CheckBox("checkbox") "checkbox"
167 #token EndCheckBox("endcheckbox") "endcheckbox"
168 #token Numeric("numeric") "numeric"
169 #token EndNumeric("endnumeric") "endnumeric"
170 #token Minimum("minimum") "minimum"
171 #token Maximum("maximum") "maximum"
172 #token STEP("step") "step"
173 #token Default("default") "default"
174 #token Password("password") "password"
175 #token EndPassword("endpassword") "endpassword"
176 #token String("string") "string"
177 #token EndString("endstring") "endstring"
178 #token MinSize("minsize") "minsize"
179 #token MaxSize("maxsize") "maxsize"
180 #token Encoding("encoding") "encoding"
181 #token SuppressIf("suppressif") "suppressif"
182 #token DisableIf("disableif") "disableif"
183 #token Hidden("hidden") "hidden"
184 #token Goto("goto") "goto"
185 #token FormSetGuid("formsetguid") "formsetguid"
186 #token InconsistentIf("inconsistentif") "inconsistentif"
187 #token NoSubmitIf("nosubmitif") "nosubmitif"
188 #token EndIf("endif") "endif"
189 #token Key("key") "key"
190 #token DefaultFlag("DEFAULT") "DEFAULT"
191 #token ManufacturingFlag("MANUFACTURING") "MANUFACTURING"
192 #token InteractiveFlag("INTERACTIVE") "INTERACTIVE"
193 #token NVAccessFlag("NV_ACCESS") "NV_ACCESS"
194 #token ResetRequiredFlag("RESET_REQUIRED") "RESET_REQUIRED"
195 #token LateCheckFlag("LATE_CHECK") "LATE_CHECK"
196 #token ReadOnlyFlag("READ_ONLY") "READ_ONLY"
197 #token OptionOnlyFlag("OPTIONS_ONLY") "OPTIONS_ONLY"
198 #token Class("class") "class"
199 #token Subclass("subclass") "subclass"
200 #token ClassGuid("classguid") "classguid"
201 #token TypeDef("typedef") "typedef"
202 #token Restore("restore") "restore"
203 #token Save("save") "save"
204 #token Defaults("defaults") "defaults"
205 #token Banner("banner") "banner"
206 #token Align("align") "align"
207 #token Left("left") "left"
208 #token Right("right") "right"
209 #token Center("center") "center"
210 #token Line("line") "line"
211 #token Name("name") "name"
213 #token VarId("varid") "varid"
214 #token Question("question") "question"
215 #token QuestionId("questionid") "questionid"
216 #token Image("image") "image"
217 #token Locked("locked") "locked"
218 #token Rule("rule") "rule"
219 #token EndRule("endrule") "endrule"
220 #token Value("value") "value"
221 #token Read("read") "read"
222 #token Write("write") "write"
223 #token ResetButton("resetbutton") "resetbutton"
224 #token EndResetButton("endresetbutton") "endresetbutton"
225 #token DefaultStore("defaultstore") "defaultstore"
226 #token Attribute("attribute") "attribute"
227 #token Varstore("varstore") "varstore"
228 #token Efivarstore("efivarstore") "efivarstore"
229 #token VarSize("varsize") "varsize"
230 #token NameValueVarStore("namevaluevarstore") "namevaluevarstore"
231 #token Action("action") "action"
232 #token Config("config") "config"
233 #token EndAction("endaction") "endaction"
234 #token Refresh("refresh") "refresh"
235 #token Interval("interval") "interval"
236 #token VarstoreDevice("varstoredevice") "varstoredevice"
237 #token GuidOp("guidop") "guidop"
238 #token EndGuidOp("endguidop") "endguidop"
239 #token DataType("datatype") "datatype"
240 #token Data("data") "data"
241 #token Modal("modal") "modal"
244 // Define the class and subclass tokens
246 #token ClassNonDevice("NONDEVICE") "NON_DEVICE"
247 #token ClassDiskDevice("DISK_DEVICE") "DISK_DEVICE"
248 #token ClassVideoDevice("VIDEO_DEVICE") "VIDEO_DEVICE"
249 #token ClassNetworkDevice("NETWORK_DEVICE") "NETWORK_DEVICE"
250 #token ClassInputDevice("INPUT_DEVICE") "INPUT_DEVICE"
251 #token ClassOnBoardDevice("ONBOARD_DEVICE") "ONBOARD_DEVICE"
252 #token ClassOtherDevice("OTHER_DEVICE") "OTHER_DEVICE"
254 #token SubclassSetupApplication("SETUP_APPLICATION") "SETUP_APPLICATION"
255 #token SubclassGeneralApplication("GENERAL_APPLICATION") "GENERAL_APPLICATION"
256 #token SubclassFrontPage("FRONT_PAGE") "FRONT_PAGE"
257 #token SubclassSingleUse("SINGLE_USE") "SINGLE_USE"
260 // This is the overall definition of a VFR form definition script.
263 vfrProgram > [UINT8 Return] :
267 mConstantOnlyInExpression = FALSE;
270 vfrPragmaPackDefinition
271 | vfrDataStructDefinition
274 << $Return = mParserStatus; >>
278 L:"show" << gCVfrVarDataTypeDB.Pack (L->getLine(), VFR_PACK_SHOW); >>
285 CHAR8 *Identifier = NULL;
286 UINT32 PackNumber = DEFAULT_PACK_ALIGN;
289 L1:"push" << LineNum = L1->getLine(); PackAction = VFR_PACK_PUSH; >>
290 | L2:"pop" << LineNum = L2->getLine(); PackAction = VFR_PACK_POP; >>
293 "," ID:StringIdentifier << Identifier = ID->getText(); >>
296 "," N:Number << PackAction |= VFR_PACK_ASSIGN; PackNumber = _STOU32(N->getText()); >>
298 << gCVfrVarDataTypeDB.Pack (LineNum, PackAction, Identifier, PackNumber); >>
304 UINT32 PackNumber = DEFAULT_PACK_ALIGN;
306 N:Number << LineNum = N->getLine(); PackNumber = _STOU32(N->getText()); >>
307 << gCVfrVarDataTypeDB.Pack (LineNum, VFR_PACK_ASSIGN, NULL, PackNumber); >>
310 vfrPragmaPackDefinition :
311 "\#pragma" "pack" "\("
320 vfrDataStructDefinition :
321 { TypeDef } Struct << gCVfrVarDataTypeDB.DeclareDataTypeBegin (); >>
324 N1:StringIdentifier << _PCATCH(gCVfrVarDataTypeDB.SetNewTypeName (N1->getText()), N1); >>
330 N2:StringIdentifier << _PCATCH(gCVfrVarDataTypeDB.SetNewTypeName (N2->getText()), N2); >>
332 ";" << gCVfrVarDataTypeDB.DeclareDataTypeEnd (); >>
335 vfrDataStructFields :
341 dataStructFieldBool |
342 dataStructFieldString |
343 dataStructFieldDate |
344 dataStructFieldTime |
351 << UINT32 ArrayNum = 0; >>
355 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
357 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
361 << UINT32 ArrayNum = 0; >>
365 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
367 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
374 ("UINT16" | "CHAR16")
377 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
379 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), (CHAR8 *) "UINT16", ArrayNum), N); >>
383 << UINT32 ArrayNum = 0; >>
387 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
389 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
392 dataStructFieldBool :
393 << UINT32 ArrayNum = 0; >>
397 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
399 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
402 dataStructFieldString :
403 << UINT32 ArrayNum = 0; >>
407 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
409 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
412 dataStructFieldDate :
413 << UINT32 ArrayNum = 0; >>
417 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
419 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
422 dataStructFieldTime :
423 << UINT32 ArrayNum = 0; >>
427 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
429 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
433 << UINT32 ArrayNum = 0; >>
437 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
439 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
442 dataStructFieldUser :
443 << UINT32 ArrayNum = 0; >>
447 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
449 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), T->getText(), ArrayNum), T); >>
452 //*****************************************************************************
454 // the syntax of GUID definition
456 guidSubDefinition [EFI_GUID &Guid] :
457 G4:Number "," G5:Number "," G6:Number "," G7:Number "," G8:Number "," G9:Number "," G10:Number "," G11:Number
459 Guid.Data4[0] = _STOU8(G4->getText());
460 Guid.Data4[1] = _STOU8(G5->getText());
461 Guid.Data4[2] = _STOU8(G6->getText());
462 Guid.Data4[3] = _STOU8(G7->getText());
463 Guid.Data4[4] = _STOU8(G8->getText());
464 Guid.Data4[5] = _STOU8(G9->getText());
465 Guid.Data4[6] = _STOU8(G10->getText());
466 Guid.Data4[7] = _STOU8(G11->getText());
470 guidDefinition [EFI_GUID &Guid] :
472 G1:Number "," G2:Number "," G3:Number ","
474 Guid.Data1 = _STOU32 (G1->getText());
475 Guid.Data2 = _STOU16 (G2->getText());
476 Guid.Data3 = _STOU16 (G3->getText());
479 OpenBrace guidSubDefinition[Guid] CloseBrace
480 | guidSubDefinition[Guid]
485 //*****************************************************************************
487 // the syntax of form set definition
489 vfrFormSetDefinition :
492 EFI_GUID DefaultClassGuid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID;
493 EFI_GUID ClassGuid1, ClassGuid2, ClassGuid3;
494 UINT8 ClassGuidNum = 0;
495 CIfrFormSet *FSObj = NULL;
499 Uuid "=" guidDefinition[Guid] ","
500 Title "=" "STRING_TOKEN" "\(" S1:Number "\)" ","
501 Help "=" "STRING_TOKEN" "\(" S2:Number "\)" ","
503 ClassGuid "=" guidDefinition[ClassGuid1] << ++ClassGuidNum; >>
505 "\|" guidDefinition[ClassGuid2] << ++ClassGuidNum; >>
508 "\|" guidDefinition[ClassGuid3] << ++ClassGuidNum; >>
513 if (mOverrideClassGuid != NULL && ClassGuidNum >= 3) {
514 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Already has 3 class guids, can't add extra class guid!");
516 switch (ClassGuidNum) {
518 if (mOverrideClassGuid != NULL) {
523 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
524 FSObj->SetClassGuid(&DefaultClassGuid);
525 if (mOverrideClassGuid != NULL) {
526 FSObj->SetClassGuid(mOverrideClassGuid);
530 if (mOverrideClassGuid != NULL) {
533 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
534 FSObj->SetClassGuid(&ClassGuid1);
535 if (mOverrideClassGuid != NULL) {
536 FSObj->SetClassGuid(mOverrideClassGuid);
540 if (mOverrideClassGuid != NULL) {
543 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
544 FSObj->SetClassGuid(&ClassGuid1);
545 FSObj->SetClassGuid(&ClassGuid2);
546 if (mOverrideClassGuid != NULL) {
547 FSObj->SetClassGuid(mOverrideClassGuid);
551 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
552 FSObj->SetClassGuid(&ClassGuid1);
553 FSObj->SetClassGuid(&ClassGuid2);
554 FSObj->SetClassGuid(&ClassGuid3);
560 SET_LINE_INFO (*FSObj, L);
561 FSObj->SetGuid (&Guid);
563 // for framework vfr to store formset guid used by varstore and efivarstore
565 if (mCompatibleMode) {
566 memcpy (&mFormsetGuid, &Guid, sizeof (EFI_GUID));
568 FSObj->SetFormSetTitle (_STOSID(S1->getText()));
569 FSObj->SetHelp (_STOSID(S2->getText()));
572 FC:Class "=" classDefinition[C] "," << {CIfrClass CObj;SET_LINE_INFO (CObj, FC); CObj.SetClass(C);} >>
575 FSC:Subclass "=" subclassDefinition[SC] "," << {CIfrSubClass SCObj; SET_LINE_INFO (SCObj, FSC); SCObj.SetSubClass(SC);} >>
578 _DeclareStandardDefaultStorage (GET_LINENO (L));
582 if (mCompatibleMode) {
584 // declare all undefined varstore and efivarstore
586 _DeclareDefaultFrameworkVarStore (GET_LINENO(E));
588 CRT_END_OP (E); if (FSObj != NULL) delete FSObj;
596 vfrFormMapDefinition |
598 vfrStatementVarStoreLinear |
599 vfrStatementVarStoreEfi |
600 vfrStatementVarStoreNameValue |
601 vfrStatementDefaultStore |
602 vfrStatementDisableIfFormSet |
603 vfrStatementSuppressIfFormSet |
604 vfrStatementExtension
608 vfrStatementExtension:
611 CIfrGuid *GuidObj = NULL;
612 CHAR8 *TypeName = NULL;
614 UINT8 *DataBuff = NULL;
618 BOOLEAN IsStruct = FALSE;
622 Uuid "=" guidDefinition[Guid]
625 U64:"UINT64" {OpenBracket AN1:Number CloseBracket <<ArrayNum = _STOU32(AN1->getText());>>}
626 << TypeName = U64->getText(); LineNum = U64->getLine(); >>
627 | U32:"UINT32" {OpenBracket AN2:Number CloseBracket <<ArrayNum = _STOU32(AN2->getText());>>}
628 << TypeName = U32->getText(); LineNum = U32->getLine(); >>
629 | U16:"UINT16" {OpenBracket AN3:Number CloseBracket <<ArrayNum = _STOU32(AN3->getText());>>}
630 << TypeName = U16->getText(); LineNum = U16->getLine(); >>
631 | U8:"UINT8" {OpenBracket AN4:Number CloseBracket <<ArrayNum = _STOU32(AN4->getText());>>}
632 << TypeName = U8->getText(); LineNum = U8->getLine(); >>
633 | BL:"BOOLEAN" {OpenBracket AN5:Number CloseBracket <<ArrayNum = _STOU32(AN5->getText());>>}
634 << TypeName = BL->getText(); LineNum = BL->getLine(); >>
635 | SI:"EFI_STRING_ID" {OpenBracket AN6:Number CloseBracket <<ArrayNum = _STOU32(AN6->getText());>>}
636 << TypeName = SI->getText(); LineNum = SI->getLine(); >>
637 | D:"EFI_HII_DATE" {OpenBracket AN7:Number CloseBracket <<ArrayNum = _STOU32(AN7->getText());>>}
638 << TypeName = D->getText(); LineNum = D->getLine(); IsStruct = TRUE;>>
639 | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket <<ArrayNum = _STOU32(AN8->getText());>>}
640 << TypeName = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>
641 | R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = _STOU32(AN9->getText());>>}
642 << TypeName = R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
643 | TN:StringIdentifier {OpenBracket AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText());>>}
644 << TypeName = TN->getText(); LineNum = TN->getLine(); IsStruct = TRUE;>>
647 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &TypeSize), LineNum);
649 Size = TypeSize*ArrayNum;
653 if (Size > (128 - sizeof (EFI_IFR_GUID))) return;
654 DataBuff = (UINT8 *)malloc(Size);
655 for (Idx = 0; Idx < Size; Idx++) {
659 vfrExtensionData [DataBuff, Size, TypeName, TypeSize, IsStruct, ArrayNum]
663 GuidObj = new CIfrGuid(Size);
664 if (GuidObj != NULL) {
665 GuidObj->SetLineNo(L->getLine());
666 GuidObj->SetGuid (&Guid);
669 if (TypeName != NULL) {
670 GuidObj->SetData(DataBuff, Size);
675 vfrStatementExtension
677 E:EndGuidOp << GuidObj->SetScope(1); CRT_END_OP (E); >>
680 if (GuidObj != NULL) delete GuidObj;
681 if (DataBuff != NULL) free(DataBuff);
686 vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 TypeSize, BOOLEAN IsStruct, UINT32 ArrayNum]:
688 CHAR8 *TFName = NULL;
698 EFI_STRING_ID Data_SID = 0;
699 BOOLEAN IsArray = FALSE;
700 UINT8 *ByteOffset = NULL;
703 ("," "data" {OpenBracket IDX1:Number CloseBracket <<IsArray = TRUE;>>}
706 if (IsArray == TRUE) {
707 ArrayIdx = _STOU8(IDX1->getText());
708 if (ArrayIdx >= ArrayNum) return;
711 ByteOffset = DataBuff + (ArrayIdx * TypeSize);
712 if (IsStruct == TRUE) {
713 _STRCAT(&TFName, TypeName);
716 ("." FN:StringIdentifier
718 if (IsStruct == TRUE) {
719 _STRCAT(&TFName, ".");
720 _STRCAT(&TFName, FN->getText());
724 OpenBracket IDX2:Number CloseBracket
726 if (IsStruct == TRUE) {
727 _STRCAT(&TFName, "[");
728 _STRCAT(&TFName, IDX2->getText());
729 _STRCAT(&TFName, "]");
736 if (IsStruct == FALSE) {
737 if (strcmp ("UINT64", TypeName) == 0) {
738 Data_U64 = _STOU64(RD->getText());
739 memcpy (ByteOffset, &Data_U64, TypeSize);
740 }else if (strcmp ("UINT32", TypeName) == 0) {
741 Data_U32 = _STOU32(RD->getText());
742 memcpy (ByteOffset, &Data_U32, TypeSize);
743 }else if (strcmp ("UINT16", TypeName) == 0) {
744 Data_U16 = _STOU16(RD->getText());
745 memcpy (ByteOffset, &Data_U16, TypeSize);
746 }else if (strcmp ("UINT8", TypeName) == 0) {
747 Data_U8 = _STOU8(RD->getText());
748 memcpy (ByteOffset, &Data_U8, TypeSize);
749 }else if (strcmp ("BOOLEAN", TypeName)== 0) {
750 Data_BL = _STOU8(RD->getText());
751 memcpy (ByteOffset, &Data_BL, TypeSize);
752 }else if (strcmp ("EFI_STRING_ID", TypeName) == 0) {
753 Data_SID = _STOSID(RD->getText());
754 memcpy (ByteOffset, &Data_SID, TypeSize);
757 gCVfrVarDataTypeDB.GetDataFieldInfo(TFName, FieldOffset, FieldType, FieldSize);
759 case EFI_IFR_TYPE_NUM_SIZE_8:
760 Data_U8 = _STOU8(RD->getText());
761 memcpy (ByteOffset + FieldOffset, &Data_U8, FieldSize);
763 case EFI_IFR_TYPE_NUM_SIZE_16:
764 Data_U16 = _STOU16(RD->getText());
765 memcpy (ByteOffset + FieldOffset, &Data_U16, FieldSize);
767 case EFI_IFR_TYPE_NUM_SIZE_32:
768 Data_U32 = _STOU32(RD->getText());
769 memcpy (ByteOffset + FieldOffset, &Data_U32, FieldSize);
771 case EFI_IFR_TYPE_NUM_SIZE_64:
772 Data_U64 = _STOU64(RD->getText());
773 memcpy (ByteOffset + FieldOffset, &Data_U64, FieldSize);
775 case EFI_IFR_TYPE_BOOLEAN:
776 Data_BL = _STOU8(RD->getText());
777 memcpy (ByteOffset + FieldOffset, &Data_BL, FieldSize);
779 case EFI_IFR_TYPE_STRING:
780 Data_SID = _STOSID(RD->getText());
781 memcpy (ByteOffset + FieldOffset, &Data_SID, FieldSize);
787 if (TFName != NULL) { delete TFName; TFName = NULL; }
794 vfrStatementDefaultStore :
795 << UINT16 DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD; >>
796 D:DefaultStore N:StringIdentifier ","
797 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)"
799 "," Attribute "=" A:Number << DefaultId = _STOU16(A->getText()); >>
802 if (mCVfrDefaultStore.DefaultIdRegistered (DefaultId) == FALSE) {
803 CIfrDefaultStore DSObj;
804 _PCATCH(mCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr(), N->getText(), _STOSID(S->getText()), DefaultId)), D->getLine();
805 DSObj.SetLineNo(D->getLine());
806 DSObj.SetDefaultName (_STOSID(S->getText()));
807 DSObj.SetDefaultId (DefaultId);
809 _PCATCH(mCVfrDefaultStore.ReRegisterDefaultStoreById (DefaultId, N->getText(), _STOSID(S->getText()))), D->getLine();
815 vfrStatementVarStoreLinear :
822 EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;
825 V:Varstore << VSObj.SetLineNo(V->getLine()); >>
827 TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->getLine(); >>
828 | U8:"UINT8" "," << TypeName = U8->getText(); LineNum = U8->getLine(); >>
829 | U16:"UINT16" "," << TypeName = U16->getText(); LineNum = U16->getLine(); >>
830 | C16:"CHAR16" "," << TypeName = (CHAR8 *) "UINT16"; LineNum = C16->getLine(); >>
831 | U32:"UINT32" "," << TypeName = U32->getText(); LineNum = U32->getLine(); >>
832 | U64:"UINT64" "," << TypeName = U64->getText(); LineNum = U64->getLine(); >>
833 | D:"EFI_HII_DATE" "," << TypeName = D->getText(); LineNum = D->getLine(); >>
834 | T:"EFI_HII_TIME" "," << TypeName = T->getText(); LineNum = T->getLine(); >>
835 | R:"EFI_HII_REF" "," << TypeName = R->getText(); LineNum = R->getLine(); >>
837 { Key "=" FID:Number "," << // Key is used to assign Varid in Framework VFR but no use in UEFI2.1 VFR
838 if (mCompatibleMode) {
839 VarStoreId = _STOU16(FID->getText());
844 VarId "=" ID:Number "," <<
846 (INTN)(VarStoreId = _STOU16(ID->getText())) != 0,
849 "varid 0 is not allowed."
853 Name "=" SN:StringIdentifier ","
854 Uuid "=" guidDefinition[Guid]
856 if (mCompatibleMode) {
857 StoreName = TypeName;
859 StoreName = SN->getText();
861 _PCATCH(mCVfrDataStorage.DeclareBufferVarStore (
868 VSObj.SetGuid (&Guid);
869 _PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId), SN);
870 VSObj.SetVarStoreId (VarStoreId);
871 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);
872 VSObj.SetSize ((UINT16) Size);
873 VSObj.SetName (SN->getText());
878 vfrStatementVarStoreEfi :
880 BOOLEAN IsUEFI23EfiVarstore = TRUE;
882 CIfrVarStoreEfi VSEObj;
883 EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;
888 CHAR8 *StoreName = NULL;
890 E:Efivarstore << VSEObj.SetLineNo(E->getLine()); >>
892 TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->getLine(); >>
893 | U8:"UINT8" "," << TypeName = U8->getText(); LineNum = U8->getLine(); >>
894 | U16:"UINT16" "," << TypeName = U16->getText(); LineNum = U16->getLine(); >>
895 | C16:"CHAR16" "," << TypeName = (CHAR8 *) "UINT16"; LineNum = C16->getLine(); >>
896 | U32:"UINT32" "," << TypeName = U32->getText(); LineNum = U32->getLine(); >>
897 | U64:"UINT64" "," << TypeName = U64->getText(); LineNum = U64->getLine(); >>
898 | D:"EFI_HII_DATE" "," << TypeName = D->getText(); LineNum = D->getLine(); >>
899 | T:"EFI_HII_TIME" "," << TypeName = T->getText(); LineNum = T->getLine(); >>
900 | R:"EFI_HII_REF" "," << TypeName = R->getText(); LineNum = R->getLine(); >>
903 VarId "=" ID:Number "," <<
905 (INTN)(VarStoreId = _STOU16(ID->getText())) != 0,
908 "varid 0 is not allowed."
912 Attribute "=" vfrVarStoreEfiAttr[Attr] ( "\|" vfrVarStoreEfiAttr[Attr] )* ","
913 << VSEObj.SetAttributes (Attr); >>
916 Name "=" SN:StringIdentifier "," << StoreName = SN->getText(); >>
918 Name "=" "STRING_TOKEN" "\(" VN:Number "\)" ","
919 VarSize "=" N:Number "," <<
920 IsUEFI23EfiVarstore = FALSE;
921 StoreName = gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText()));
922 if (StoreName == NULL) {
923 _PCATCH (VFR_RETURN_UNSUPPORTED, VN->getLine(), "Can't get varstore name for this StringId!");
925 Size = _STOU32(N->getText());
928 TypeName = (CHAR8 *) "UINT8";
931 TypeName = (CHAR8 *) "UINT16";
934 TypeName = (CHAR8 *) "UINT32";
937 TypeName = (CHAR8 *) "UINT64";
940 _PCATCH (VFR_RETURN_UNSUPPORTED, N);
946 Uuid "=" guidDefinition[Guid] <<
947 if (IsUEFI23EfiVarstore) {
948 _PCATCH(mCVfrDataStorage.DeclareBufferVarStore (
955 _PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId), SN);
956 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);
958 _PCATCH(mCVfrDataStorage.DeclareBufferVarStore (
965 _PCATCH(mCVfrDataStorage.GetVarStoreId(TN->getText(), &VarStoreId), VN);
966 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), N->getLine());
968 VSEObj.SetGuid (&Guid);
969 VSEObj.SetVarStoreId (VarStoreId);
971 VSEObj.SetSize ((UINT16) Size);
972 VSEObj.SetName (StoreName);
973 if (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {
980 vfrVarStoreEfiAttr [UINT32 & Attr] :
981 N:Number << $Attr |= _STOU32(N->getText()); >>
984 vfrStatementVarStoreNameValue :
987 CIfrVarStoreNameValue VSNVObj;
988 EFI_VARSTORE_ID VarStoreId;
990 L:NameValueVarStore << VSNVObj.SetLineNo(L->getLine()); >>
991 SN:StringIdentifier "," << _PCATCH(mCVfrDataStorage.DeclareNameVarStoreBegin (SN->getText()), SN); >>
993 Name "=" "STRING_TOKEN" "\(" N:Number "\)" "," << _PCATCH(mCVfrDataStorage.NameTableAddItem (_STOSID(N->getText())), SN); >>
995 Uuid "=" guidDefinition[Guid] << _PCATCH(mCVfrDataStorage.DeclareNameVarStoreEnd (&Guid), SN); >>
997 VSNVObj.SetGuid (&Guid);
998 _PCATCH(mCVfrDataStorage.GetVarStoreId(SN->getText(), &VarStoreId), SN);
999 VSNVObj.SetVarStoreId (VarStoreId);
1005 // keep classDeinition and validClassNames for compatibility but not generate
1008 classDefinition[UINT16 & Class] :
1010 validClassNames[$Class] ( "\|" validClassNames[$Class] )*
1013 validClassNames[UINT16 & Class] :
1014 ClassNonDevice << $Class |= EFI_NON_DEVICE_CLASS; >>
1015 | ClassDiskDevice << $Class |= EFI_DISK_DEVICE_CLASS; >>
1016 | ClassVideoDevice << $Class |= EFI_VIDEO_DEVICE_CLASS; >>
1017 | ClassNetworkDevice << $Class |= EFI_NETWORK_DEVICE_CLASS; >>
1018 | ClassInputDevice << $Class |= EFI_INPUT_DEVICE_CLASS; >>
1019 | ClassOnBoardDevice << $Class |= EFI_ON_BOARD_DEVICE_CLASS; >>
1020 | ClassOtherDevice << $Class |= EFI_OTHER_DEVICE_CLASS; >>
1021 | N:Number << $Class |= _STOU16(N->getText()); >>
1024 subclassDefinition[UINT16 & SubClass] :
1025 << $SubClass = 0; >>
1026 SubclassSetupApplication << $SubClass |= EFI_SETUP_APPLICATION_SUBCLASS; >>
1027 | SubclassGeneralApplication << $SubClass |= EFI_GENERAL_APPLICATION_SUBCLASS; >>
1028 | SubclassFrontPage << $SubClass |= EFI_FRONT_PAGE_SUBCLASS; >>
1029 | SubclassSingleUse << $SubClass |= EFI_SINGLE_USE_SUBCLASS; >>
1030 | N:Number << $SubClass |= _STOU16(N->getText()); >>
1033 vfrStatementDisableIfFormSet :
1035 CIfrDisableIf DIObj;
1036 mConstantOnlyInExpression = TRUE;
1038 D:DisableIf << DIObj.SetLineNo(D->getLine()); >>
1039 vfrStatementExpression[0] ";" << mConstantOnlyInExpression = FALSE; >>
1041 E:EndIf << CRT_END_OP (E); >>
1045 vfrStatementSuppressIfFormSet :
1046 << CIfrSuppressIf SIObj;>>
1048 if (mCompatibleMode) {
1049 _PCATCH (VFR_RETURN_UNSUPPORTED, L);
1051 SIObj.SetLineNo(L->getLine());
1053 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
1054 vfrStatementExpression[0] ";"
1057 ";" << CRT_END_OP (E); >>
1060 //*****************************************************************************
1062 // the syntax of question header and statement header
1064 vfrStatementHeader[CIfrStatementHeader *SHObj] :
1065 Prompt "=" "STRING_TOKEN" "\(" S1:Number "\)" "," << $SHObj->SetPrompt (_STOSID(S1->getText())); >>
1066 Help "=" "STRING_TOKEN" "\(" S2:Number "\)" << $SHObj->SetHelp (_STOSID(S2->getText())); >>
1069 vfrQuestionHeader[CIfrQuestionHeader & QHObj, EFI_QUESION_TYPE QType = QUESTION_NORMAL]:
1071 EFI_VARSTORE_INFO Info;
1072 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
1073 CHAR8 *QName = NULL;
1074 CHAR8 *VarIdStr = NULL;
1077 Name "=" QN:StringIdentifier "," <<
1078 QName = QN->getText();
1079 _PCATCH(mCVfrQuestionDB.FindQuestion (QName), VFR_RETURN_UNDEFINED, QN, "has already been used please used anther name");
1082 { V:VarId "=" vfrStorageVarId[Info, VarIdStr] "," }
1084 QuestionId "=" ID:Number "," <<
1085 QId = _STOQID(ID->getText());
1086 _PCATCH(mCVfrQuestionDB.FindQuestion (QId), VFR_RETURN_UNDEFINED, ID, "has already been used please assign another number");
1091 case QUESTION_NORMAL:
1092 mCVfrQuestionDB.RegisterQuestion (QName, VarIdStr, QId);
1095 mCVfrQuestionDB.RegisterNewDateQuestion (QName, VarIdStr, QId);
1098 mCVfrQuestionDB.RegisterNewTimeQuestion (QName, VarIdStr, QId);
1102 // VarIdStr != NULL stand for question with storagae.
1104 if (VarIdStr != NULL) {
1105 mCVfrQuestionDB.RegisterRefQuestion (QName, VarIdStr, QId);
1107 mCVfrQuestionDB.RegisterQuestion (QName, NULL, QId);
1111 _PCATCH(VFR_RETURN_FATAL_ERROR);
1113 $QHObj.SetQuestionId (QId);
1114 if (VarIdStr != NULL) {
1115 $QHObj.SetVarStoreInfo (&Info);
1118 vfrStatementHeader[&$QHObj]
1120 if (VarIdStr != NULL) {
1122 _SAVE_CURRQEST_VARINFO (Info);
1127 questionheaderFlagsField[UINT8 & Flags] :
1128 ReadOnlyFlag << $Flags |= 0x01; >>
1129 | InteractiveFlag << $Flags |= 0x04; >>
1130 | ResetRequiredFlag << $Flags |= 0x10; >>
1131 | OptionOnlyFlag << $Flags |= 0x80; >>
1136 vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFlag = TRUE] :
1140 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
1141 CHAR8 *VarIdStr = NULL;
1142 CHAR8 *VarStr = NULL;
1143 CHAR8 *SName = NULL;
1144 CHAR8 *TName = NULL;
1145 EFI_VFR_RETURN_CODE VfrReturnCode = VFR_RETURN_SUCCESS;
1146 EFI_IFR_TYPE_VALUE Dummy = gZeroEfiIfrTypeValue;
1149 SN1:StringIdentifier << SName = SN1->getText(); _STRCAT(&VarIdStr, SN1->getText()); >>
1150 OpenBracket I1:Number CloseBracket <<
1151 Idx = _STOU32(I1->getText());
1152 _STRCAT(&VarIdStr, "[");
1153 _STRCAT(&VarIdStr, I1->getText());
1154 _STRCAT(&VarIdStr, "]");
1157 VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);
1158 if (mCompatibleMode && VfrReturnCode == VFR_RETURN_UNDEFINED) {
1159 mCVfrDataStorage.DeclareBufferVarStore (
1162 &gCVfrVarDataTypeDB,
1164 EFI_VARSTORE_ID_INVALID,
1167 VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);
1169 if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
1170 _PCATCH(VfrReturnCode, SN1);
1171 _PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN1);
1172 _PCATCH(mCVfrDataStorage.GetNameVarStoreInfo (&$Info, Idx), SN1);
1175 QuestVarIdStr = VarIdStr;
1180 SN2:StringIdentifier << SName = SN2->getText(); _STRCAT(&VarIdStr, SName); >>
1182 VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);
1183 if (mCompatibleMode && VfrReturnCode == VFR_RETURN_UNDEFINED) {
1184 mCVfrDataStorage.DeclareBufferVarStore (
1187 &gCVfrVarDataTypeDB,
1189 EFI_VARSTORE_ID_INVALID,
1192 VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);
1194 if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
1195 _PCATCH(VfrReturnCode, SN2);
1196 _PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN2);
1197 if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) {
1198 _PCATCH(mCVfrDataStorage.GetBufferVarStoreDataTypeName(SName, &TName), SN2);
1199 _STRCAT(&VarStr, TName);
1206 if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
1207 _PCATCH(((VarStoreType != EFI_VFR_VARSTORE_BUFFER) ? VFR_RETURN_EFIVARSTORE_USE_ERROR : VFR_RETURN_SUCCESS), SN2);
1209 _STRCAT(&VarIdStr, "."); _STRCAT(&VarStr, ".");
1211 SF:StringIdentifier << _STRCAT(&VarIdStr, SF->getText()); _STRCAT(&VarStr, SF->getText()); >>
1213 OpenBracket I2:Number CloseBracket <<
1214 Idx = _STOU32(I2->getText());
1215 if (mCompatibleMode) Idx --;
1218 // Idx == 0, [0] can be ignored.
1219 // Array[0] is same to Array for unify the varid name to cover [0]
1221 _STRCAT(&VarIdStr, "[");
1222 _STRCAT(&VarIdStr, I2->getText());
1223 _STRCAT(&VarIdStr, "]");
1225 _STRCAT(&VarStr, "[");
1226 _STRCAT(&VarStr, I2->getText());
1227 _STRCAT(&VarStr, "]");
1231 switch (VarStoreType) {
1232 case EFI_VFR_VARSTORE_EFI:
1233 _PCATCH(mCVfrDataStorage.GetEfiVarStoreInfo (&$Info), SN2);
1235 case EFI_VFR_VARSTORE_BUFFER:
1236 _PCATCH(gCVfrVarDataTypeDB.GetDataFieldInfo (VarStr, $Info.mInfo.mVarOffset, $Info.mVarType, $Info.mVarTotalSize), SN2->getLine(), VarStr);
1237 _PCATCH((EFI_VFR_RETURN_CODE)gCVfrBufferConfig.Register (
1241 _PCATCH((EFI_VFR_RETURN_CODE)gCVfrBufferConfig.Write (
1246 $Info.mInfo.mVarOffset,
1247 $Info.mVarTotalSize,
1251 case EFI_VFR_VARSTORE_NAME:
1255 QuestVarIdStr = VarIdStr;
1256 if (VarStr != NULL) {delete VarStr;}
1261 vfrQuestionDataFieldName [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr, UINT32 &LineNo] :
1264 VarIdStr = NULL; LineNo = 0;
1267 SN1:StringIdentifier << _STRCAT(&VarIdStr, SN1->getText()); LineNo = SN1->getLine(); >>
1268 OpenBracket I1:Number CloseBracket <<
1269 _STRCAT(&VarIdStr, "[");
1270 _STRCAT(&VarIdStr, I1->getText());
1271 _STRCAT(&VarIdStr, "]");
1272 mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask);
1273 if (mConstantOnlyInExpression) {
1274 _PCATCH(VFR_RETURN_CONSTANT_ONLY, LineNo);
1280 SN2:StringIdentifier << _STRCAT (&VarIdStr, SN2->getText()); LineNo = SN2->getLine(); >>
1283 _STRCAT (&VarIdStr, ".");
1284 if (mConstantOnlyInExpression) {
1285 _PCATCH(VFR_RETURN_CONSTANT_ONLY, LineNo);
1288 SF:StringIdentifier << _STRCAT (&VarIdStr, SF->getText()); >>
1290 OpenBracket I2:Number CloseBracket <<
1291 Idx = _STOU32(I2->getText());
1292 if (mCompatibleMode) Idx --;
1295 // Idx == 0, [0] can be ignored.
1296 // Array[0] is same to Array
1298 _STRCAT(&VarIdStr, "[");
1299 _STRCAT(&VarIdStr, I2->getText());
1300 _STRCAT(&VarIdStr, "]");
1305 << mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask); >>
1309 vfrConstantValueField[UINT8 Type] > [EFI_IFR_TYPE_VALUE Value] :
1315 case EFI_IFR_TYPE_NUM_SIZE_8 :
1316 $Value.u8 = _STOU8(N1->getText());
1318 case EFI_IFR_TYPE_NUM_SIZE_16 :
1319 $Value.u16 = _STOU16(N1->getText());
1321 case EFI_IFR_TYPE_NUM_SIZE_32 :
1322 $Value.u32 = _STOU32(N1->getText());
1324 case EFI_IFR_TYPE_NUM_SIZE_64 :
1325 $Value.u64 = _STOU64(N1->getText());
1327 case EFI_IFR_TYPE_BOOLEAN :
1328 $Value.b = _STOU8(N1->getText());
1330 case EFI_IFR_TYPE_STRING :
1331 $Value.string = _STOU16(N1->getText());
1333 case EFI_IFR_TYPE_TIME :
1334 case EFI_IFR_TYPE_DATE :
1335 case EFI_IFR_TYPE_REF :
1340 | B1:True << $Value.b = TRUE; >>
1341 | B2:False << $Value.b = FALSE; >>
1342 | O1:One << $Value.u8 = _STOU8(O1->getText()); >>
1343 | O2:Ones << $Value.u64 = _STOU64(O2->getText()); >>
1344 | Z:Zero << $Value.u8 = _STOU8(Z->getText()); >>
1345 | HOUR:Number ":" MINUTE:Number ":" SECOND:Number << $Value.time = _STOT(HOUR->getText(), MINUTE->getText(), SECOND->getText()); >>
1346 | YEAR:Number "/" MONTH:Number "/" DAY:Number << $Value.date = _STOD(YEAR->getText(), MONTH->getText(), DAY->getText()); >>
1347 | QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)"
1348 << $Value.ref = _STOR(QI->getText(), FI->getText(), &Guid, DP->getText()); >>
1349 | "STRING_TOKEN" "\(" S1:Number "\)" << $Value.string = _STOSID(S1->getText()); >>
1352 //*****************************************************************************
1354 // the syntax of form definition
1357 << CIfrForm FObj; >>
1358 F:Form << FObj.SetLineNo(F->getLine()); >>
1359 FormId "=" S1:Number "," << _PCATCH(FObj.SetFormId (_STOFID(S1->getText())), S1); >>
1360 Title "=" "STRING_TOKEN" "\(" S2:Number "\)" ";" << FObj.SetFormTitle (_STOSID(S2->getText())); >>
1363 vfrStatementLocked |
1365 vfrStatementDefault |
1367 vfrStatementQuestions |
1368 vfrStatementConditional |
1370 vfrStatementBanner |
1371 // Just for framework vfr compatibility
1372 vfrStatementInvalid |
1373 vfrStatementExtension |
1377 if (mCompatibleMode) {
1379 // Add Label for Framework Vfr
1382 LObj1.SetLineNo(E->getLine());
1383 LObj1.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff
1385 LObj2.SetLineNo(E->getLine());
1386 LObj2.SetNumber (0x0); //add dummy label for UEFI, label number hardcode 0x0
1388 LObj3.SetLineNo(E->getLine());
1389 LObj3.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff
1391 // Declare undefined Question
1393 if (gCFormPkg.HavePendingUnassigned()) {
1394 gCFormPkg.DeclarePendingQuestion (
1404 // mCVfrQuestionDB.PrintAllQuestion();
1411 vfrFormMapDefinition :
1413 CIfrFormMap *FMapObj = NULL;
1414 UINT32 FormMapMethodNumber = 0;
1417 F:FormMap << FMapObj = new CIfrFormMap(); FMapObj->SetLineNo(F->getLine()); >>
1418 FormId "=" S1:Number "," << _PCATCH(FMapObj->SetFormId (_STOFID(S1->getText())), S1); >>
1420 MapTitle "=" "STRING_TOKEN" "\(" S2:Number "\)" ";"
1421 MapGuid "=" guidDefinition[Guid] ";" << FMapObj->SetFormMapMethod (_STOFID(S2->getText()), &Guid); FormMapMethodNumber ++; >>
1422 )* << if (FormMapMethodNumber == 0) {_PCATCH (VFR_RETURN_INVALID_PARAMETER, F->getLine(), "No MapMethod is set for FormMap!");} delete FMapObj;>>
1425 vfrStatementLocked |
1427 vfrStatementDefault |
1429 vfrStatementQuestions |
1430 vfrStatementConditional |
1432 vfrStatementBanner |
1433 vfrStatementExtension |
1436 E:EndForm << CRT_END_OP (E); >>
1441 << CIfrRule RObj; >>
1442 R:Rule << RObj.SetLineNo(R->getLine()); >>
1443 S1:StringIdentifier "," <<
1444 mCVfrRulesDB.RegisterRule (S1->getText());
1445 RObj.SetRuleId (mCVfrRulesDB.GetRuleId(S1->getText()));
1447 vfrStatementExpression[0]
1448 E:EndRule << CRT_END_OP (E); >>
1452 vfrStatementDefault :
1454 BOOLEAN IsExp = FALSE;
1455 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
1457 EFI_DEFAULT_ID DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
1458 CHAR8 *VarStoreName = NULL;
1459 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
1461 D:Default << DObj.SetLineNo(D->getLine()); >>
1464 vfrStatementValue "," << IsExp = TRUE; DObj.SetScope (1); CIfrEnd EndObj1; EndObj1.SetLineNo(D->getLine()); >>
1465 | "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] > [Val] "," <<
1466 if (gCurrentMinMaxData != NULL && gCurrentMinMaxData->IsNumericOpcode()) {
1467 //check default value is valid for Numeric Opcode
1468 if (Val.u64 < gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE()) || Val.u64 > gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE())) {
1469 _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
1472 DObj.SetType (_GET_CURRQEST_DATATYPE());
1477 DefaultStore "=" SN:StringIdentifier "," << _PCATCH(mCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN); DObj.SetDefaultId (DefaultId); >>
1480 _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), D->getLine());
1481 _PCATCH(mCVfrDataStorage.GetVarStoreType (VarStoreName, VarStoreType), D->getLine());
1482 if ((IsExp == FALSE) && (VarStoreType == EFI_VFR_VARSTORE_BUFFER)) {
1483 _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
1485 _GET_CURRQEST_VARTINFO(),
1487 _GET_CURRQEST_DATATYPE (),
1497 vfrStatementSubTitle |
1498 vfrStatementStaticText |
1499 vfrStatementCrossReference
1502 vfrStatementQuestions :
1503 vfrStatementBooleanType |
1505 vfrStatementNumericType |
1506 vfrStatementStringType |
1507 vfrStatementOrderedList |
1511 vfrStatementConditional :
1512 vfrStatementDisableIfStat |
1513 vfrStatementSuppressIfStat | //enhance to be compatible for framework endif
1514 vfrStatementGrayOutIfStat |
1515 vfrStatementInconsistentIfStat //to be compatible for framework
1518 vfrStatementConditionalNew :
1519 vfrStatementDisableIfStat |
1520 vfrStatementSuppressIfStatNew |
1521 vfrStatementGrayOutIfStatNew |
1522 vfrStatementInconsistentIfStat //to be compatible for framework
1525 vfrStatementSuppressIfStat :
1526 <<mCompatibleMode>>? vfrStatementSuppressIfStatOld
1527 | vfrStatementSuppressIfStatNew
1530 vfrStatementGrayOutIfStat :
1531 <<mCompatibleMode>>? vfrStatementGrayOutIfStatOld
1532 | vfrStatementGrayOutIfStatNew
1535 vfrStatementInvalid :
1537 vfrStatementInvalidHidden |
1538 vfrStatementInvalidInventory |
1539 vfrStatementInvalidSaveRestoreDefaults
1541 << _CRT_OP (TRUE); >>
1545 Number | InteractiveFlag | ManufacturingFlag | DefaultFlag |
1546 NVAccessFlag | ResetRequiredFlag | LateCheckFlag
1550 << CIfrValue VObj; >>
1551 V:Value << VObj.SetLineNo(V->getLine()); >>
1552 "=" vfrStatementExpression[0] << {CIfrEnd EndObj; EndObj.SetLineNo(V->getLine());} >>
1556 << CIfrRead RObj; >>
1557 R:Read << RObj.SetLineNo(R->getLine()); >>
1558 vfrStatementExpression[0] ";"
1562 << CIfrWrite WObj; >>
1563 W:Write << WObj.SetLineNo(W->getLine()); >>
1564 vfrStatementExpression[0] ";"
1567 vfrStatementSubTitle :
1568 << CIfrSubtitle SObj; >>
1569 L:Subtitle << SObj.SetLineNo(L->getLine()); >>
1570 Text "=" "STRING_TOKEN" "\(" S:Number "\)" << SObj.SetPrompt (_STOSID(S->getText())); >>
1572 "," FLAGS "=" vfrSubtitleFlags[SObj]
1574 { vfrStatementStatTagList "," }
1575 E:";" << CRT_END_OP (E); >>
1578 vfrSubtitleFlags [CIfrSubtitle & SObj] :
1579 << UINT8 LFlags = 0; >>
1580 subtitleFlagsField[LFlags] ( "\|" subtitleFlagsField[LFlags] )*
1581 << _PCATCH(SObj.SetFlags (LFlags)); >>
1584 subtitleFlagsField [UINT8 & Flags] :
1585 N:Number << $Flags |= _STOU8(N->getText()); >>
1586 | "HORIZONTAL" << $Flags |= 0x01; >>
1589 vfrStatementStaticText :
1592 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
1593 EFI_STRING_ID TxtTwo = EFI_STRING_ID_INVALID;
1596 Help "=" "STRING_TOKEN" "\(" S1:Number "\)" ","
1597 Text "=" "STRING_TOKEN" "\(" S2:Number "\)"
1599 "," Text "=" "STRING_TOKEN" "\(" S3:Number "\)" << TxtTwo = _STOSID(S3->getText()); >>
1602 "," F:FLAGS "=" staticTextFlagsField[Flags] ( "\|" staticTextFlagsField[Flags] )*
1603 "," Key "=" KN:Number
1606 if (Flags & EFI_IFR_FLAG_CALLBACK) {
1608 mCVfrQuestionDB.RegisterQuestion (NULL, NULL, QId);
1609 AObj.SetLineNo (F->getLine());
1610 AObj.SetQuestionId (QId);
1611 AObj.SetPrompt (_STOSID(S2->getText()));
1612 AObj.SetHelp (_STOSID(S1->getText()));
1613 _PCATCH(AObj.SetFlags (Flags), F->getLine());
1614 AssignQuestionKey (AObj, KN);
1618 TObj.SetLineNo (T->getLine());
1619 TObj.SetHelp (_STOSID(S1->getText()));
1620 TObj.SetPrompt (_STOSID(S2->getText()));
1621 TObj.SetTextTwo (TxtTwo);
1624 { "," vfrStatementStatTagList }
1628 staticTextFlagsField[UINT8 & HFlags] :
1629 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
1630 | questionheaderFlagsField[HFlags]
1633 vfrStatementCrossReference :
1635 vfrStatementResetButton
1641 EFI_STRING_ID DevPath = EFI_STRING_ID_INVALID;
1642 EFI_GUID FSId = {0,};
1644 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
1646 CIfrQuestionHeader *QHObj = NULL;
1647 CIfrRef *R1Obj = NULL;
1648 CIfrRef2 *R2Obj = NULL;
1649 CIfrRef3 *R3Obj = NULL;
1650 CIfrRef4 *R4Obj = NULL;
1651 CIfrRef5 *R5Obj = NULL;
1656 DevicePath "=" "STRING_TOKEN" "\(" P:Number "\)" ","
1657 FormSetGuid "=" guidDefinition[FSId] ","
1658 FormId "=" F1:Number ","
1659 Question "=" QN1:Number ","
1662 DevPath = _STOSID(P->getText());
1663 FId = _STOFID(F1->getText());
1664 QId = _STOQID(QN1->getText());
1669 FormSetGuid "=" guidDefinition[FSId] ","
1670 FormId "=" F2:Number ","
1671 Question "=" QN2:Number ","
1674 FId = _STOFID(F2->getText());
1675 QId = _STOQID(QN2->getText());
1680 FormId "=" F3:Number "," << RefType = 2; FId = _STOFID(F3->getText()); >>
1683 QN3:StringIdentifier "," << mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask); >>
1684 | QN4:Number "," << QId = _STOQID(QN4->getText()); >>
1691 FId = _STOFID(F4->getText());
1699 R5Obj = new CIfrRef5;
1701 R5Obj->SetLineNo(G->getLine());
1706 R4Obj = new CIfrRef4;
1708 R4Obj->SetLineNo(G->getLine());
1709 R4Obj->SetDevicePath (DevPath);
1710 R4Obj->SetFormSetId (FSId);
1711 R4Obj->SetFormId (FId);
1712 R4Obj->SetQuestionId (QId);
1717 R3Obj = new CIfrRef3;
1719 R3Obj->SetLineNo(G->getLine());
1720 R3Obj->SetFormSetId (FSId);
1721 R3Obj->SetFormId (FId);
1722 R3Obj->SetQuestionId (QId);
1727 R2Obj = new CIfrRef2;
1729 R2Obj->SetLineNo(G->getLine());
1730 R2Obj->SetFormId (FId);
1731 _PCATCH(R2Obj->SetQuestionId (QId), QN3);
1736 R1Obj = new CIfrRef;
1738 R1Obj->SetLineNo(G->getLine());
1739 R1Obj->SetFormId (FId);
1745 vfrQuestionHeader[*QHObj, QUESTION_REF]
1746 { "," vfrStatementStatTagList }
1747 { "," F:FLAGS "=" vfrGotoFlags[QHObj, F->getLine()] }
1749 "," Key "=" KN:Number << AssignQuestionKey (*QHObj, KN); >>
1751 ";" << 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;}>>
1754 vfrGotoFlags [CIfrQuestionHeader *QHObj, UINT32 LineNum] :
1755 << UINT8 HFlags = 0; >>
1756 gotoFlagsField[HFlags] ( "\|" gotoFlagsField[HFlags] )*
1757 << _PCATCH(QHObj->SetFlags (HFlags), LineNum); >>
1760 gotoFlagsField[UINT8 & HFlags] :
1761 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
1762 | questionheaderFlagsField[HFlags]
1771 vfrStatementResetButton :
1773 CIfrResetButton RBObj;
1776 L:ResetButton << RBObj.SetLineNo(L->getLine()); >>
1778 "=" N:StringIdentifier "," <<
1779 _PCATCH(mCVfrDefaultStore.GetDefaultId (N->getText(), &DefaultId), N->getLine());
1780 RBObj.SetDefaultId (DefaultId);
1782 vfrStatementHeader[&RBObj] ","
1783 { vfrStatementStatTagList "," }
1784 E:EndResetButton << CRT_END_OP (E); >>
1788 vfrStatementBooleanType :
1789 vfrStatementCheckBox |
1793 //*****************************************************
1794 // Syntax of checkbox
1798 // varid = MySTestData.mField1,
1799 // prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
1800 // help = STRING_TOKEN(STR_CHECK_BOX_HELP),
1801 // flags = CHECKBOX_DEFAULT | CALLBACK,
1802 // default value = TRUE, defaultstore = MyDefaultStore,
1805 vfrStatementCheckBox :
1808 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
1809 CHAR8 *VarStoreName = NULL;
1810 UINT32 DataTypeSize;
1812 L:CheckBox << CBObj.SetLineNo(L->getLine()); >>
1813 vfrQuestionHeader[CBObj] "," << //check data type
1814 _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "CheckBox varid is not the valid data type");
1815 if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
1816 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid doesn't support array");
1817 } else if ((mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId) == EFI_VFR_VARSTORE_BUFFER) &&
1818 (_GET_CURRQEST_VARSIZE() != sizeof (BOOLEAN))) {
1819 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid only support BOOLEAN data type");
1823 F:FLAGS "=" vfrCheckBoxFlags[CBObj, F->getLine()] ","
1825 _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), VFR_RETURN_SUCCESS, L, "Failed to retrieve varstore name");
1827 if (CBObj.GetFlags () & 0x01) {
1829 mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
1830 EFI_HII_DEFAULT_CLASS_STANDARD,
1831 _GET_CURRQEST_VARTINFO(),
1833 _GET_CURRQEST_DATATYPE (),
1838 "No standard default storage found"
1841 if (CBObj.GetFlags () & 0x02) {
1843 mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
1844 EFI_HII_DEFAULT_CLASS_MANUFACTURING,
1845 _GET_CURRQEST_VARTINFO(),
1847 _GET_CURRQEST_DATATYPE (),
1852 "No manufacturing default storage found"
1858 Key "=" KN:Number "," << AssignQuestionKey (CBObj, KN); >>
1860 vfrStatementQuestionOptionList
1861 E:EndCheckBox << CRT_END_OP (E); >>
1865 vfrCheckBoxFlags [CIfrCheckBox & CBObj, UINT32 LineNum] :
1870 checkboxFlagsField[LFlags, HFlags] ( "\|" checkboxFlagsField[LFlags, HFlags] )*
1871 << _PCATCH(CBObj.SetFlags (HFlags, LFlags), LineNum); >>
1874 checkboxFlagsField[UINT8 & LFlags, UINT8 & HFlags] :
1876 if (mCompatibleMode) {
1878 // set question flag
1880 $LFlags |= _STOU8(N->getText());
1882 _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine());
1886 if (mCompatibleMode) {
1888 // set question Default flag
1892 _PCATCH (VFR_RETURN_UNSUPPORTED, D);
1895 | M:"MANUFACTURING" <<
1896 if (mCompatibleMode) {
1898 // set question MFG flag
1902 _PCATCH (VFR_RETURN_UNSUPPORTED, M);
1905 | "CHECKBOX_DEFAULT" << $LFlags |= 0x01; >>
1906 | "CHECKBOX_DEFAULT_MFG" << $LFlags |= 0x02; >>
1907 | questionheaderFlagsField[HFlags]
1910 //*****************************************************
1915 // prompt = STRING_TOKEN(STR_ACTION_PROMPT),
1916 // help = STRING_TOKEN(STR_ACTION_HELP),
1917 // flags = CALLBACK,
1918 // config = STRING_TOKEN(STR_ACTION_CONFIG),
1921 vfrStatementAction :
1922 << CIfrAction AObj; >>
1923 L:Action << AObj.SetLineNo(L->getLine()); >>
1924 vfrQuestionHeader[AObj] ","
1925 { F:FLAGS "=" vfrActionFlags[AObj, F->getLine()] "," }
1926 Config "=" "STRING_TOKEN" "\(" S:Number "\)" "," << AObj.SetQuestionConfig (_STOSID(S->getText())); >>
1927 vfrStatementQuestionTagList
1928 E:EndAction << CRT_END_OP (E); >>
1932 vfrActionFlags[CIfrAction & AObj, UINT32 LineNum] :
1933 << UINT8 HFlags = 0; >>
1934 actionFlagsField[HFlags] ( "\|" actionFlagsField[HFlags] )*
1935 << _PCATCH(AObj.SetFlags (HFlags), LineNum); >>
1938 actionFlagsField[UINT8 & HFlags] :
1939 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
1940 | questionheaderFlagsField[HFlags]
1945 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
1946 CHAR8 *VarIdStr[3] = {NULL, };
1948 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
1950 L:Date << DObj.SetLineNo(L->getLine()); >>
1953 vfrQuestionHeader[DObj, QUESTION_DATE] ","
1954 { F:FLAGS "=" vfrDateFlags[DObj, F->getLine()] "," }
1955 vfrStatementQuestionOptionList
1959 Year VarId "=" D1:StringIdentifier "." D1Y:StringIdentifier ","
1960 << _STRCAT(&VarIdStr[0], D1->getText()); _STRCAT(&VarIdStr[0], "."); _STRCAT(&VarIdStr[0], D1Y->getText()); >>
1961 Prompt "=" "STRING_TOKEN" "\(" YP:Number "\)" ","
1962 Help "=" "STRING_TOKEN" "\(" YH:Number "\)" ","
1963 minMaxDateStepDefault[Val.date, 0]
1965 Month VarId "=" D2:StringIdentifier "." D2M:StringIdentifier ","
1966 << _STRCAT(&VarIdStr[1], D2->getText()); _STRCAT(&VarIdStr[1], "."); _STRCAT(&VarIdStr[1], D2M->getText()); >>
1967 Prompt "=" "STRING_TOKEN" "\(" MP:Number "\)" ","
1968 Help "=" "STRING_TOKEN" "\(" MH:Number "\)" ","
1969 minMaxDateStepDefault[Val.date, 1]
1971 Day VarId "=" D3:StringIdentifier "." D3D:StringIdentifier ","
1972 << _STRCAT(&VarIdStr[2], D3->getText()); _STRCAT(&VarIdStr[2], "."); _STRCAT(&VarIdStr[2], D3D->getText()); >>
1973 Prompt "=" "STRING_TOKEN" "\(" DP:Number "\)" ","
1974 Help "=" "STRING_TOKEN" "\(" DH:Number "\)" ","
1975 minMaxDateStepDefault[Val.date, 2]
1977 mCVfrQuestionDB.RegisterOldDateQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId);
1978 DObj.SetQuestionId (QId);
1979 DObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_DATE_STORAGE_TIME);
1980 DObj.SetPrompt (_STOSID(YP->getText()));
1981 DObj.SetHelp (_STOSID(YH->getText()));
1982 if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }
1984 << {CIfrDefault DefaultObj(EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_DATE, Val); DefaultObj.SetLineNo(L->getLine());} >>
1986 ( vfrStatementInconsistentIf )*
1988 E:EndDate << CRT_END_OP (E); >>
1992 minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
1993 Minimum "=" MinN:Number ","
1994 Maximum "=" MaxN:Number ","
1995 { "step" "=" Number "," }
1997 "default" "=" N:Number "," <<
2000 D.Year = _STOU16(N->getText());
2001 if (D.Year < _STOU16 (MinN->getText()) || D.Year > _STOU16 (MaxN->getText())) {
2002 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value must be between Min year and Max year.");
2006 D.Month = _STOU8(N->getText());
2007 if (D.Month < 1 || D.Month > 12) {
2008 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value must be between 1 and 12.");
2012 D.Day = _STOU8(N->getText());
2013 if (D.Day < 1 || D.Day > 31) {
2014 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value must be between 1 and 31.");
2022 vfrDateFlags [CIfrDate & DObj, UINT32 LineNum] :
2023 << UINT8 LFlags = 0; >>
2024 dateFlagsField[LFlags] ( "\|" dateFlagsField[LFlags] )*
2025 << _PCATCH(DObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, LFlags), LineNum); >>
2028 dateFlagsField [UINT8 & Flags] :
2029 N:Number << $Flags |= _STOU8(N->getText()); >>
2030 | "YEAR_SUPPRESS" << $Flags |= 0x01; >>
2031 | "MONTH_SUPPRESS" << $Flags |= 0x02; >>
2032 | "DAY_SUPPRESS" << $Flags |= 0x04; >>
2033 | "STORAGE_NORMAL" << $Flags |= 0x00; >>
2034 | "STORAGE_TIME" << $Flags |= 0x10; >>
2035 | "STORAGE_WAKEUP" << $Flags |= 0x20; >>
2038 vfrStatementNumericType :
2039 vfrStatementNumeric |
2043 vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
2045 UINT64 MaxU8 = 0, MinU8 = 0, StepU8 = 0;
2046 UINT32 MaxU4 = 0, MinU4 = 0, StepU4 = 0;
2047 UINT16 MaxU2 = 0, MinU2 = 0, StepU2 = 0;
2048 UINT8 MaxU1 = 0, MinU1 = 0, StepU1 = 0;
2050 Minimum "=" I:Number ","
2052 switch (_GET_CURRQEST_DATATYPE()) {
2053 case EFI_IFR_TYPE_NUM_SIZE_64 : MinU8 = _STOU64(I->getText()); break;
2054 case EFI_IFR_TYPE_NUM_SIZE_32 : MinU4 = _STOU32(I->getText()); break;
2055 case EFI_IFR_TYPE_NUM_SIZE_16 : MinU2 = _STOU16(I->getText()); break;
2056 case EFI_IFR_TYPE_NUM_SIZE_8 : MinU1 = _STOU8(I->getText()); break;
2059 Maximum "=" A:Number ","
2061 switch (_GET_CURRQEST_DATATYPE()) {
2062 case EFI_IFR_TYPE_NUM_SIZE_64 :
2063 MaxU8 = _STOU64(A->getText());
2064 if (MaxU8 < MinU8) {
2065 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
2068 case EFI_IFR_TYPE_NUM_SIZE_32 :
2069 MaxU4 = _STOU32(A->getText());
2070 if (MaxU4 < MinU4) {
2071 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
2074 case EFI_IFR_TYPE_NUM_SIZE_16 :
2075 MaxU2 = _STOU16(A->getText());
2076 if (MaxU2 < MinU2) {
2077 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
2080 case EFI_IFR_TYPE_NUM_SIZE_8 :
2081 MaxU1 = _STOU8(A->getText());
2082 if (MaxU1 < MinU1) {
2083 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
2089 STEP "=" S:Number ","
2091 switch (_GET_CURRQEST_DATATYPE()) {
2092 case EFI_IFR_TYPE_NUM_SIZE_64 : StepU8 = _STOU64(S->getText()); break;
2093 case EFI_IFR_TYPE_NUM_SIZE_32 : StepU4 = _STOU32(S->getText()); break;
2094 case EFI_IFR_TYPE_NUM_SIZE_16 : StepU2 = _STOU16(S->getText()); break;
2095 case EFI_IFR_TYPE_NUM_SIZE_8 : StepU1 = _STOU8(S->getText()); break;
2100 switch (_GET_CURRQEST_DATATYPE()) {
2101 case EFI_IFR_TYPE_NUM_SIZE_64 : $MMSDObj.SetMinMaxStepData (MinU8, MaxU8, StepU8); break;
2102 case EFI_IFR_TYPE_NUM_SIZE_32 : $MMSDObj.SetMinMaxStepData (MinU4, MaxU4, StepU4); break;
2103 case EFI_IFR_TYPE_NUM_SIZE_16 : $MMSDObj.SetMinMaxStepData (MinU2, MaxU2, StepU2); break;
2104 case EFI_IFR_TYPE_NUM_SIZE_8 : $MMSDObj.SetMinMaxStepData (MinU1, MaxU1, StepU1); break;
2109 vfrStatementNumeric :
2112 UINT32 DataTypeSize;
2114 L:Numeric << NObj.SetLineNo(L->getLine()); >>
2115 vfrQuestionHeader[NObj] "," << // check data type
2116 _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "Numeric varid is not the valid data type");
2117 if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
2118 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric varid doesn't support array");
2120 _PCATCH(NObj.SetFlags (NObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());
2122 { F:FLAGS "=" vfrNumericFlags[NObj, F->getLine()] "," }
2124 Key "=" KN:Number "," << AssignQuestionKey (NObj, KN); >>
2126 vfrSetMinMaxStep[NObj]
2127 vfrStatementQuestionOptionList
2128 E:EndNumeric << CRT_END_OP (E); >>
2132 vfrNumericFlags [CIfrNumeric & NObj, UINT32 LineNum] :
2134 UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;
2136 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
2138 numericFlagsField[HFlags, LFlags] ( "\|" numericFlagsField[HFlags, LFlags] )*
2140 //check data type flag
2141 VarStoreType = mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
2142 if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {
2143 if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {
2144 _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");
2147 // update data type for name/value store
2148 UINT32 DataTypeSize;
2149 _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
2150 gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);
2151 _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;
2153 _PCATCH(NObj.SetFlags (HFlags, LFlags), LineNum);
2157 numericFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
2158 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
2159 | "NUMERIC_SIZE_1" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_1; >>
2160 | "NUMERIC_SIZE_2" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_2; >>
2161 | "NUMERIC_SIZE_4" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_4; >>
2162 | "NUMERIC_SIZE_8" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_8; >>
2163 | "DISPLAY_INT_DEC" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_INT_DEC; >>
2164 | "DISPLAY_UINT_DEC" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_DEC; >>
2165 | "DISPLAY_UINT_HEX" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_HEX; >>
2166 | questionheaderFlagsField[HFlags]
2172 UINT32 DataTypeSize;
2174 L:OneOf << OObj.SetLineNo(L->getLine()); >>
2175 vfrQuestionHeader[OObj] "," << //check data type
2176 _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "OneOf varid is not the valid data type");
2177 if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
2178 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf varid doesn't support array");
2180 _PCATCH(OObj.SetFlags (OObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());
2182 { F:FLAGS "=" vfrOneofFlagsField[OObj, F->getLine()] "," }
2184 vfrSetMinMaxStep[OObj]
2186 vfrStatementQuestionOptionList
2187 E:EndOneOf << CRT_END_OP (E); >>
2191 vfrOneofFlagsField [CIfrOneOf & OObj, UINT32 LineNum] :
2193 UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;
2195 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
2197 numericFlagsField[HFlags, LFlags] ( "\|" numericFlagsField[HFlags, LFlags] )*
2199 //check data type flag
2200 VarStoreType = mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
2201 if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {
2202 if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {
2203 _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");
2206 // update data type for Name/Value store
2207 UINT32 DataTypeSize;
2208 _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
2209 gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);
2210 _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;
2212 _PCATCH(OObj.SetFlags (HFlags, LFlags), LineNum);
2216 vfrStatementStringType :
2217 vfrStatementString |
2218 vfrStatementPassword
2221 vfrStatementString :
2224 UINT32 VarArraySize;
2225 UINT8 StringMinSize;
2226 UINT8 StringMaxSize;
2228 L:String << SObj.SetLineNo(L->getLine()); >>
2229 vfrQuestionHeader[SObj] ","
2230 { F:FLAGS "=" vfrStringFlagsField[SObj, F->getLine()] "," }
2232 Key "=" KN:Number "," << AssignQuestionKey (SObj, KN); >>
2234 MinSize "=" MIN:Number "," <<
2235 VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
2236 StringMinSize = _STOU8(MIN->getText());
2237 if (_STOU64(MIN->getText()) > StringMinSize) {
2238 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "String MinSize takes only one byte, which can't be larger than 0xFF.");
2239 } else if (VarArraySize != 0 && StringMinSize > VarArraySize) {
2240 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "String MinSize can't be larger than the max number of elements in string array.");
2242 SObj.SetMinSize (StringMinSize);
2244 MaxSize "=" MAX:Number "," <<
2245 StringMaxSize = _STOU8(MAX->getText());
2246 if (_STOU64(MAX->getText()) > StringMaxSize) {
2247 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize takes only one byte, which can't be larger than 0xFF.");
2248 } else if (VarArraySize != 0 && StringMaxSize > VarArraySize) {
2249 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize can't be larger than the max number of elements in string array.");
2250 } else if (StringMaxSize < StringMinSize) {
2251 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize can't be less than String MinSize.");
2253 SObj.SetMaxSize (StringMaxSize);
2255 vfrStatementQuestionOptionList
2256 E:EndString << CRT_END_OP (E); >>
2260 vfrStringFlagsField [CIfrString & SObj, UINT32 LineNum] :
2265 stringFlagsField[HFlags, LFlags] ( "\|" stringFlagsField[HFlags, LFlags] )*
2266 << _PCATCH(SObj.SetFlags (HFlags, LFlags), LineNum); >>
2269 stringFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
2270 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
2271 | "MULTI_LINE" << $LFlags = 0x01; >>
2272 | questionheaderFlagsField[HFlags]
2275 vfrStatementPassword :
2278 UINT32 VarArraySize;
2279 UINT16 PasswordMinSize;
2280 UINT16 PasswordMaxSize;
2282 L:Password << PObj.SetLineNo(L->getLine()); >>
2283 vfrQuestionHeader[PObj] ","
2284 { F:FLAGS "=" vfrPasswordFlagsField[PObj, F->getLine()] "," }
2286 Key "=" KN:Number "," << AssignQuestionKey (PObj, KN); >>
2288 MinSize "=" MIN:Number "," <<
2289 VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
2290 PasswordMinSize = _STOU16(MIN->getText());
2291 if (_STOU64(MIN->getText()) > PasswordMinSize) {
2292 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "Password MinSize takes only two byte, which can't be larger than 0xFFFF.");
2293 } else if (VarArraySize != 0 && PasswordMinSize > VarArraySize) {
2294 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "Password MinSize can't be larger than the max number of elements in password array.");
2296 PObj.SetMinSize (PasswordMinSize);
2298 MaxSize "=" MAX:Number "," <<
2299 PasswordMaxSize = _STOU16(MAX->getText());
2300 if (_STOU64(MAX->getText()) > PasswordMaxSize) {
2301 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize takes only two byte, which can't be larger than 0xFFFF.");
2302 } else if (VarArraySize != 0 && PasswordMaxSize > VarArraySize) {
2303 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize can't be larger than the max number of elements in password array.");
2304 } else if (PasswordMaxSize < PasswordMinSize) {
2305 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize can't be less than Password MinSize.");
2307 PObj.SetMaxSize (PasswordMaxSize);
2309 { Encoding "=" Number "," }
2310 vfrStatementQuestionOptionList
2311 E:EndPassword << CRT_END_OP (E); >>
2315 vfrPasswordFlagsField [CIfrPassword & PObj, UINT32 LineNum] :
2316 << UINT8 HFlags = 0; >>
2317 passwordFlagsField[HFlags] ( "\|" passwordFlagsField[HFlags] )*
2318 << _PCATCH(PObj.SetFlags(HFlags), LineNum); >>
2321 passwordFlagsField [UINT8 & HFlags] :
2322 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
2323 | questionheaderFlagsField[HFlags]
2326 vfrStatementOrderedList :
2328 CIfrOrderedList OLObj;
2329 UINT32 VarArraySize;
2331 L:OrderedList << OLObj.SetLineNo(L->getLine()); >>
2332 vfrQuestionHeader[OLObj] ","
2334 VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
2335 OLObj.SetMaxContainers ((UINT8) (VarArraySize > 0xFF ? 0xFF : VarArraySize));
2338 MaxContainers "=" M:Number "," <<
2339 if (_STOU64(M->getText()) > _STOU8(M->getText())) {
2340 _PCATCH (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList MaxContainers takes only one byte, which can't be larger than 0xFF.");
2341 } else if (VarArraySize != 0 && _STOU8(M->getText()) > VarArraySize) {
2342 _PCATCH (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList MaxContainers can't be larger than the max number of elements in array.");
2344 OLObj.SetMaxContainers (_STOU8(M->getText()));
2347 { F:FLAGS "=" vfrOrderedListFlags[OLObj, F->getLine()] }
2348 vfrStatementQuestionOptionList
2349 E:EndList << CRT_END_OP (E); >>
2353 vfrOrderedListFlags [CIfrOrderedList & OLObj, UINT32 LineNum] :
2358 orderedlistFlagsField[HFlags, LFlags] ( "\|" orderedlistFlagsField[HFlags, LFlags] )*
2359 << _PCATCH(OLObj.SetFlags (HFlags, LFlags), LineNum); >>
2362 orderedlistFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
2363 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
2364 | "UNIQUE" << $LFlags |= 0x01; >>
2365 | "NOEMPTY" << $LFlags |= 0x02; >>
2366 | questionheaderFlagsField[HFlags]
2371 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
2372 CHAR8 *VarIdStr[3] = {NULL, };
2374 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
2376 L:Time << TObj.SetLineNo(L->getLine()); >>
2379 vfrQuestionHeader[TObj, QUESTION_TIME] ","
2380 { F:FLAGS "=" vfrTimeFlags[TObj, F->getLine()] "," }
2381 vfrStatementQuestionOptionList
2385 Hour VarId "=" T1:StringIdentifier "." T1H:StringIdentifier ","
2386 << _STRCAT(&VarIdStr[0], T1->getText()); _STRCAT(&VarIdStr[0], "."); _STRCAT(&VarIdStr[0], T1H->getText()); >>
2387 Prompt "=" "STRING_TOKEN" "\(" HP:Number "\)" ","
2388 Help "=" "STRING_TOKEN" "\(" HH:Number "\)" ","
2389 minMaxTimeStepDefault[Val.time, 0]
2391 Minute VarId "=" T2:StringIdentifier "." T2M:StringIdentifier ","
2392 << _STRCAT(&VarIdStr[1], T2->getText()); _STRCAT(&VarIdStr[1], "."); _STRCAT(&VarIdStr[1], T2M->getText()); >>
2393 Prompt "=" "STRING_TOKEN" "\(" MP:Number "\)" ","
2394 Help "=" "STRING_TOKEN" "\(" MH:Number "\)" ","
2395 minMaxTimeStepDefault[Val.time, 1]
2397 Second VarId "=" T3:StringIdentifier "." T3S:StringIdentifier ","
2398 << _STRCAT(&VarIdStr[2], T3->getText()); _STRCAT(&VarIdStr[2], "."); _STRCAT(&VarIdStr[2], T3S->getText()); >>
2399 Prompt "=" "STRING_TOKEN" "\(" SP:Number "\)" ","
2400 Help "=" "STRING_TOKEN" "\(" SH:Number "\)" ","
2401 minMaxTimeStepDefault[Val.time, 2]
2403 mCVfrQuestionDB.RegisterOldTimeQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId);
2404 TObj.SetQuestionId (QId);
2405 TObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_TIME_STORAGE_TIME);
2406 TObj.SetPrompt (_STOSID(HP->getText()));
2407 TObj.SetHelp (_STOSID(HH->getText()));
2408 if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }
2410 << {CIfrDefault DefaultObj(EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_TIME, Val); DefaultObj.SetLineNo(L->getLine());} >>
2412 ( vfrStatementInconsistentIf )*
2414 E:EndTime << CRT_END_OP (E); >>
2418 minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :
2419 Minimum "=" Number ","
2420 Maximum "=" Number ","
2421 { "step" "=" Number "," }
2423 "default" "=" N:Number "," <<
2426 T.Hour = _STOU8(N->getText());
2428 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value must be between 0 and 23.");
2432 T.Minute = _STOU8(N->getText());
2433 if (T.Minute > 59) {
2434 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value must be between 0 and 59.");
2438 T.Second = _STOU8(N->getText());
2439 if (T.Second > 59) {
2440 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value must be between 0 and 59.");
2448 vfrTimeFlags [CIfrTime & TObj, UINT32 LineNum] :
2449 << UINT8 LFlags = 0; >>
2450 timeFlagsField[LFlags] ( "\|" timeFlagsField[LFlags] )*
2451 << _PCATCH(TObj.SetFlags(EFI_IFR_QUESTION_FLAG_DEFAULT, LFlags), LineNum); >>
2454 timeFlagsField [UINT8 & Flags] :
2455 N:Number << $Flags |= _STOU8(N->getText()); >>
2456 | "HOUR_SUPPRESS" << $Flags |= 0x01; >>
2457 | "MINUTE_SUPPRESS" << $Flags |= 0x02; >>
2458 | "SECOND_SUPPRESS" << $Flags |= 0x04; >>
2459 | "STORAGE_NORMAL" << $Flags |= 0x00; >>
2460 | "STORAGE_TIME" << $Flags |= 0x10; >>
2461 | "STORAGE_WAKEUP" << $Flags |= 0x20; >>
2464 vfrStatementQuestionTag :
2465 vfrStatementStatTag "," |
2466 vfrStatementInconsistentIf |
2467 vfrStatementNoSubmitIf |
2468 vfrStatementDisableIfQuest |
2469 vfrStatementRefresh |
2470 vfrStatementVarstoreDevice |
2471 vfrStatementExtension |
2472 vfrStatementRefreshEvent
2475 vfrStatementQuestionTagList :
2476 ( vfrStatementQuestionTag )*
2479 vfrStatementQuestionOptionTag :
2480 vfrStatementSuppressIfQuest |
2481 vfrStatementGrayOutIfQuest |
2483 vfrStatementDefault |
2489 vfrStatementQuestionOptionList :
2491 vfrStatementQuestionTag |
2492 vfrStatementQuestionOptionTag
2496 vfrStatementStatList :
2498 vfrStatementQuestions |
2499 vfrStatementConditionalNew |
2501 vfrStatementExtension |
2502 // Just for framework vfr compatibility
2506 vfrStatementStatListOld :
2508 vfrStatementQuestions |
2510 // Just for framework vfr compatibility
2514 vfrStatementDisableIfStat :
2516 CIfrDisableIf DIObj;
2518 L:DisableIf << DIObj.SetLineNo(L->getLine()); >>
2519 vfrStatementExpression[0] ";"
2520 ( vfrStatementStatList )*
2521 E:EndIf << CRT_END_OP (E); >>
2525 vfrStatementInconsistentIfStat :
2526 << CIfrInconsistentIf IIObj; >>
2528 if (!mCompatibleMode) {
2529 _PCATCH (VFR_RETURN_UNSUPPORTED, L);
2531 IIObj.SetLineNo(L->getLine());
2533 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << IIObj.SetError (_STOSID(S->getText())); >>
2534 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2535 vfrStatementExpression[0]
2536 E:EndIf << CRT_END_OP (E); >>
2541 // Compatible for framework vfr file
2543 vfrStatementgrayoutIfSuppressIf:
2544 << CIfrSuppressIf SIObj; >>
2545 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>
2546 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2547 vfrStatementExpression[0]
2551 vfrStatementsuppressIfGrayOutIf:
2552 << CIfrGrayOutIf GOIObj; >>
2553 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>
2554 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2555 vfrStatementExpression[0]
2559 vfrStatementSuppressIfStatNew :
2560 << CIfrSuppressIf SIObj;>>
2561 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>
2562 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2563 vfrStatementExpression[0]
2565 ( vfrStatementStatList )*
2566 E: EndIf ";" << CRT_END_OP (E); >>
2569 vfrStatementGrayOutIfStatNew :
2570 << CIfrGrayOutIf GOIObj;>>
2571 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>
2572 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2573 vfrStatementExpression[0]
2575 ( vfrStatementStatList )*
2576 E: EndIf ";" << CRT_END_OP (E); >>
2579 vfrStatementSuppressIfStatOld :
2581 CIfrSuppressIf SIObj;
2582 BOOLEAN GrayOutExist = FALSE;
2584 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>
2585 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2586 vfrStatementExpression[0]
2589 vfrStatementsuppressIfGrayOutIf
2590 << GrayOutExist = TRUE; >>
2592 ( vfrStatementStatListOld )*
2593 E: EndIf ";" << if (GrayOutExist) CRT_END_OP (E); CRT_END_OP (E);>>
2596 vfrStatementGrayOutIfStatOld :
2598 CIfrGrayOutIf GOIObj;
2599 BOOLEAN SuppressExist = FALSE;
2601 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>
2602 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2603 vfrStatementExpression[0]
2606 vfrStatementgrayoutIfSuppressIf
2607 << SuppressExist = TRUE; >>
2609 ( vfrStatementStatListOld )*
2610 E: EndIf ";" << if (SuppressExist) CRT_END_OP (E); CRT_END_OP (E); >>
2614 << CIfrImage IObj; >>
2615 L:Image "=" "IMAGE_TOKEN" "\(" S1:Number "\)" << IObj.SetImageId (_STOSID(S1->getText())); IObj.SetLineNo(L->getLine()); >>
2619 << CIfrLocked LObj; >>
2620 L:Locked << LObj.SetLineNo(L->getLine()); >>
2624 << CIfrModal MObj; >>
2625 L:Modal << MObj.SetLineNo(L->getLine()); >>
2628 vfrStatementStatTag :
2633 vfrStatementStatTagList :
2634 vfrStatementStatTag ( "," vfrStatementStatTag )*
2647 vfrStatementLocked :
2652 vfrStatementInconsistentIf :
2653 << CIfrInconsistentIf IIObj; >>
2654 L:InconsistentIf << IIObj.SetLineNo(L->getLine()); >>
2655 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << IIObj.SetError (_STOSID(S->getText())); >>
2656 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2657 vfrStatementExpression[0]
2658 E:EndIf << CRT_END_OP (E); >>
2661 vfrStatementNoSubmitIf :
2662 << CIfrNoSubmitIf NSIObj; >>
2663 L:NoSubmitIf << NSIObj.SetLineNo(L->getLine()); >>
2664 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << NSIObj.SetError (_STOSID(S->getText())); >>
2665 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2666 vfrStatementExpression[0]
2667 E:EndIf << CRT_END_OP (E); >>
2670 vfrStatementDisableIfQuest :
2672 CIfrDisableIf DIObj;
2674 L:DisableIf << DIObj.SetLineNo(L->getLine()); >>
2675 vfrStatementExpression[0] ";"
2676 vfrStatementQuestionOptionList
2677 E:EndIf << CRT_END_OP (E); >>
2680 vfrStatementRefresh :
2681 << CIfrRefresh RObj; >>
2682 L:Refresh << RObj.SetLineNo(L->getLine()); >>
2683 Interval "=" I:Number << RObj.SetRefreshInterval (_STOU8(I->getText())); >>
2686 vfrStatementRefreshEvent :
2688 CIfrRefreshId RiObj;
2691 L:RefreshGuid << RiObj.SetLineNo(L->getLine()); >>
2692 "=" guidDefinition[Guid] "," << RiObj.SetRefreshEventGroutId (&Guid); >>
2695 vfrStatementVarstoreDevice :
2696 << CIfrVarStoreDevice VDObj; >>
2697 L:VarstoreDevice << VDObj.SetLineNo(L->getLine()); >>
2698 "=" "STRING_TOKEN" "\(" S:Number "\)" "," << VDObj.SetDevicePath (_STOSID(S->getText())); >>
2701 vfrStatementSuppressIfQuest :
2702 << CIfrSuppressIf SIObj; >>
2703 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>
2704 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2705 vfrStatementExpression[0] ";"
2706 vfrStatementQuestionOptionList
2707 E:EndIf << CRT_END_OP (E); >>
2710 vfrStatementGrayOutIfQuest :
2711 << CIfrGrayOutIf GOIObj; >>
2712 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>
2713 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2714 vfrStatementExpression[0] ";"
2715 vfrStatementQuestionOptionList
2716 E:EndIf << CRT_END_OP (E); >>
2719 vfrStatementOptions :
2720 vfrStatementOneOfOption
2723 vfrStatementOneOfOption :
2725 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
2726 CIfrOneOfOption OOOObj;
2727 CHAR8 *VarStoreName = NULL;
2729 L:Option << OOOObj.SetLineNo(L->getLine()); >>
2730 Text "=" "STRING_TOKEN" "\(" S:Number "\)" "," << OOOObj.SetOption (_STOSID(S->getText())); >>
2731 Value "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] >[Val] ","
2733 if (gCurrentMinMaxData != NULL) {
2734 //set min/max value for oneof opcode
2735 UINT64 Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE());
2736 switch (_GET_CURRQEST_DATATYPE()) {
2737 case EFI_IFR_TYPE_NUM_SIZE_64:
2738 gCurrentMinMaxData->SetMinMaxStepData(Val.u64, Val.u64, Step);
2740 case EFI_IFR_TYPE_NUM_SIZE_32:
2741 gCurrentMinMaxData->SetMinMaxStepData(Val.u32, Val.u32, (UINT32) Step);
2743 case EFI_IFR_TYPE_NUM_SIZE_16:
2744 gCurrentMinMaxData->SetMinMaxStepData(Val.u16, Val.u16, (UINT16) Step);
2746 case EFI_IFR_TYPE_NUM_SIZE_8:
2747 gCurrentMinMaxData->SetMinMaxStepData(Val.u8, Val.u8, (UINT8) Step);
2753 OOOObj.SetType (_GET_CURRQEST_DATATYPE());
2754 OOOObj.SetValue (Val);
2756 F:FLAGS "=" vfrOneOfOptionFlags[OOOObj, F->getLine()]
2758 _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), L->getLine());
2759 if (OOOObj.GetFlags () & 0x10) {
2760 _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
2761 EFI_HII_DEFAULT_CLASS_STANDARD,
2762 _GET_CURRQEST_VARTINFO(),
2764 _GET_CURRQEST_DATATYPE (),
2768 if (OOOObj.GetFlags () & 0x20) {
2769 _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
2770 EFI_HII_DEFAULT_CLASS_MANUFACTURING,
2771 _GET_CURRQEST_VARTINFO(),
2773 _GET_CURRQEST_DATATYPE (),
2779 "," Key "=" KN:Number <<
2780 if (!mCompatibleMode) {
2781 _PCATCH (VFR_RETURN_UNSUPPORTED, KN);
2786 CIfrOptionKey IfrOptionKey (
2787 gCurrentQuestion->QUESTION_ID(),
2789 _STOQID(KN->getText())
2791 SET_LINE_INFO (IfrOptionKey, KN);
2795 T:"," vfrImageTag << OOOObj.SetScope (1); CRT_END_OP (T); >>
2800 vfrOneOfOptionFlags [CIfrOneOfOption & OOOObj, UINT32 LineNum] :
2802 UINT8 LFlags = _GET_CURRQEST_DATATYPE();
2805 oneofoptionFlagsField[HFlags, LFlags] ( "\|" oneofoptionFlagsField[HFlags, LFlags] )*
2806 << _PCATCH(gCurrentQuestion->SetFlags(HFlags), LineNum); >>
2807 << _PCATCH(OOOObj.SetFlags(LFlags), LineNum); >>
2810 oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
2811 N:Number << $LFlags |= _STOU8(N->getText()); >>
2812 | "OPTION_DEFAULT" << $LFlags |= 0x10; >>
2813 | "OPTION_DEFAULT_MFG" << $LFlags |= 0x20; >>
2814 | InteractiveFlag << $HFlags |= 0x04; >>
2815 | NVAccessFlag << $HFlags |= 0x08; >>
2816 | ResetRequiredFlag << $HFlags |= 0x10; >>
2817 | LateCheckFlag << $HFlags |= 0x20; >>
2818 | ManufacturingFlag << $LFlags |= 0x20; >>
2819 | DefaultFlag << $LFlags |= 0x10; >>
2825 if (mCompatibleMode) {
2827 // Add end Label for Framework Vfr
2830 LObj1.SetLineNo(L->getLine());
2831 LObj1.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff
2836 LObj2.SetLineNo(L->getLine());
2837 LObj2.SetNumber (_STOU16(N->getText()));
2843 vfrStatementBanner :
2844 << CIfrBanner BObj; >>
2845 B:Banner { "," } << BObj.SetLineNo(B->getLine()); >>
2846 Title "=" "STRING_TOKEN" "\(" S:Number "\)" "," << BObj.SetTitle (_STOSID(S->getText())); >>
2849 Line L:Number "," << BObj.SetLine (_STOU16(L->getText())); >>
2852 Left << BObj.SetAlign (0); >>
2853 | Center << BObj.SetAlign (1); >>
2854 | Right << BObj.SetAlign (2); >>
2859 Timeout "=" T:Number ";" << {CIfrTimeout TObj(_STOU16(T->getText()));} >>
2864 //******************************************************************************
2866 // keep some syntax for compatibility but not generate any IFR object
2868 vfrStatementInvalidHidden :
2870 if (!mCompatibleMode) {
2871 _PCATCH (VFR_RETURN_UNSUPPORTED, L);
2874 Value "=" Number ","
2878 vfrStatementInvalidInconsistentIf :
2880 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" ","
2881 { FLAGS "=" flagsField ( "\|" flagsField )* "," }
2882 vfrStatementExpression[0]
2887 vfrStatementInvalidInventory :
2889 if (!mCompatibleMode) {
2890 _PCATCH (VFR_RETURN_UNSUPPORTED, L);
2893 Help "=" "STRING_TOKEN" "\(" Number "\)" ","
2894 Text "=" "STRING_TOKEN" "\(" Number "\)" ","
2896 Text "=" "STRING_TOKEN" "\(" Number "\)"
2901 vfrStatementInvalidSaveRestoreDefaults :
2904 if (!mCompatibleMode) {
2905 _PCATCH (VFR_RETURN_UNSUPPORTED, L);
2910 if (!mCompatibleMode) {
2911 _PCATCH (VFR_RETURN_UNSUPPORTED, K);
2916 FormId "=" Number ","
2917 Prompt "=" "STRING_TOKEN" "\(" Number "\)" ","
2918 Help "=" "STRING_TOKEN" "\(" Number "\)"
2919 { "," FLAGS "=" flagsField ( "\|" flagsField )* }
2920 { "," Key "=" Number }
2924 //******************************************************************************
2926 // The syntax of expression
2928 #token Dup("dup") "dup"
2929 #token VarEqVal("vareqval") "vareqval"
2930 #token Var("var") "var"
2931 #token IdEqVal("ideqval") "ideqval"
2932 #token IdEqId("ideqid") "ideqid"
2933 #token IdEqValList("ideqvallist") "ideqvallist"
2934 #token QuestionRef("questionref") "questionref"
2935 #token RuleRef("ruleref") "ruleref"
2936 #token StringRef("stringref") "stringref"
2937 #token PushThis("pushthis") "pushthis"
2938 #token Security("security") "security"
2939 #token Get("get") "get"
2940 #token True("TRUE") "TRUE"
2941 #token False("FALSE") "FALSE"
2942 #token One("ONE") "ONE"
2943 #token Ones("ONES") "ONES"
2944 #token Zero("ZERO") "ZERO"
2945 #token Undefined("UNDEFINED") "UNDEFINED"
2946 #token Version("VERSION") "VERSION"
2947 #token Length("length") "length"
2948 #token AND("AND") "AND"
2949 #token OR("OR") "OR"
2950 #token NOT("NOT") "NOT"
2951 #token Set("set") "set"
2952 #token BitWiseNot("~") "\~"
2953 #token BoolVal("boolval") "boolval"
2954 #token StringVal("stringval") "stringval"
2955 #token UnIntVal("unintval") "unintval"
2956 #token ToUpper("toupper") "toupper"
2957 #token ToLower("tolower") "tolower"
2958 #token Match("match") "match"
2959 #token Catenate("catenate") "catenate"
2960 #token QuestionRefVal("questionrefval") "questionrefval"
2961 #token StringRefVal("stringrefval") "stringrefval"
2962 #token Map("map") "map"
2963 #token RefreshGuid("refreshguid") "refreshguid"
2966 // Root expression extension function called by other function.
2968 vfrStatementExpression [UINT32 RootLevel, UINT32 ExpOpCount = 0] :
2969 << if ($RootLevel == 0) {mCIfrOpHdrIndex ++; if (mCIfrOpHdrIndex >= MAX_IFR_EXPRESSION_DEPTH) _PCATCH (VFR_RETURN_INVALID_PARAMETER, 0, "The depth of expression exceeds the max supported level 8!"); _CLEAR_SAVED_OPHDR ();} >>
2970 andTerm[$RootLevel, $ExpOpCount]
2972 L:OR andTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrOr OObj(L->getLine()); >>
2976 // Extend OpCode Scope only for the root expression.
2978 if ($ExpOpCount > 1 && $RootLevel == 0) {
2979 if (_SET_SAVED_OPHDR_SCOPE()) {
2981 if (mCIfrOpHdrLineNo[mCIfrOpHdrIndex] != 0) {
2982 EObj.SetLineNo (mCIfrOpHdrLineNo[mCIfrOpHdrIndex]);
2987 if ($RootLevel == 0) {
2994 // Add new sub function for the sub expression extension to remember the ExpOpCount
2995 // This funciton is only called by sub expression.
2997 vfrStatementExpressionSub [UINT32 RootLevel, UINT32 & ExpOpCount] :
2998 andTerm[$RootLevel, $ExpOpCount]
3000 L:OR andTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrOr OObj(L->getLine()); >>
3004 andTerm[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3005 bitwiseorTerm[$RootLevel, $ExpOpCount]
3007 L:AND bitwiseorTerm [$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrAnd AObj(L->getLine()); >>
3011 bitwiseorTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3012 bitwiseandTerm[$RootLevel, $ExpOpCount]
3014 L:"\|" bitwiseandTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrBitWiseOr BWOObj(L->getLine()); >>
3018 bitwiseandTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3019 equalTerm[$RootLevel, $ExpOpCount]
3021 L:"&" equalTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrBitWiseAnd BWAObj(L->getLine()); >>
3025 equalTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3026 compareTerm[$RootLevel, $ExpOpCount]
3029 L1:"==" compareTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrEqual EObj(L1->getLine()); >>
3033 L2:"!=" compareTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrNotEqual NEObj(L2->getLine()); >>
3038 compareTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3039 shiftTerm[$RootLevel, $ExpOpCount]
3042 L1:"<" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrLessThan LTObj(L1->getLine()); >>
3046 L2:"<=" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrLessEqual LEObj(L2->getLine()); >>
3050 L3:">" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrGreaterThan GTObj(L3->getLine()); >>
3054 L4:">=" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrGreaterEqual GEObj(L4->getLine()); >>
3059 shiftTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3060 addMinusTerm[$RootLevel, $ExpOpCount]
3063 L1:"\<<" addMinusTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrShiftLeft SLObj(L1->getLine()); >>
3067 L2:"\>>" addMinusTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrShiftRight SRObj(L2->getLine()); >>
3072 addMinusTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3073 multdivmodTerm[$RootLevel, $ExpOpCount]
3076 L1:"\+" multdivmodTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrAdd AObj(L1->getLine()); >>
3080 L2:"\-" multdivmodTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrSubtract SObj(L2->getLine()); >>
3085 multdivmodTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3086 castTerm[$RootLevel, $ExpOpCount]
3089 L1:"\*" castTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrMultiply MObj(L1->getLine()); >>
3093 L2:"/" castTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrDivide DObj(L2->getLine()); >>
3097 L3:"%" castTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrModulo MObj(L3->getLine()); >>
3102 castTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3103 << UINT8 CastType = 0xFF; >>
3107 Boolean << CastType = 0; >>
3108 | Uint64 << CastType = 1; >>
3109 | Uint32 << CastType = 1; >>
3110 | Uint16 << CastType = 1; >>
3111 | Uint8 << CastType = 1; >>
3115 atomTerm[$RootLevel, $ExpOpCount]
3118 case 0: { CIfrToBoolean TBObj(L->getLine()); $ExpOpCount++; } break;
3119 case 1: { CIfrToUint TUObj(L->getLine()); $ExpOpCount++; } break;
3124 atomTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3125 vfrExpressionCatenate[$RootLevel, $ExpOpCount]
3126 | vfrExpressionMatch[$RootLevel, $ExpOpCount]
3127 | vfrExpressionParen[$RootLevel, $ExpOpCount]
3128 | vfrExpressionBuildInFunction[$RootLevel, $ExpOpCount]
3129 | vfrExpressionConstant[$RootLevel, $ExpOpCount]
3130 | vfrExpressionUnaryOp[$RootLevel, $ExpOpCount]
3131 | vfrExpressionTernaryOp[$RootLevel, $ExpOpCount]
3132 | vfrExpressionMap[$RootLevel, $ExpOpCount]
3135 atomTerm[$RootLevel, $ExpOpCount] << { CIfrNot NObj(L->getLine()); $ExpOpCount++; } >>
3139 vfrExpressionCatenate [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3142 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3144 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3145 "\)" << { CIfrCatenate CObj(L->getLine()); $ExpOpCount++; } >>
3148 vfrExpressionMatch [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3151 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3153 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3154 "\)" << { CIfrMatch MObj(L->getLine()); $ExpOpCount++; } >>
3157 vfrExpressionParen [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3159 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3163 vfrExpressionBuildInFunction [UINT32 & RootLevel, UINT32 & ExpOpCount] :
3164 dupExp[$RootLevel, $ExpOpCount]
3165 | vareqvalExp[$RootLevel, $ExpOpCount] //Compatible for Framework vareqval
3166 | ideqvalExp[$RootLevel, $ExpOpCount]
3167 | ideqidExp[$RootLevel, $ExpOpCount]
3168 | ideqvallistExp[$RootLevel, $ExpOpCount]
3169 | questionref13Exp[$RootLevel, $ExpOpCount]
3170 | rulerefExp[$RootLevel, $ExpOpCount]
3171 | stringref1Exp[$RootLevel, $ExpOpCount]
3172 | pushthisExp[$RootLevel, $ExpOpCount]
3173 | securityExp[$RootLevel, $ExpOpCount]
3174 | getExp[$RootLevel, $ExpOpCount]
3177 dupExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
3178 L:Dup << { CIfrDup DObj(L->getLine()); _SAVE_OPHDR_COND(DObj, ($ExpOpCount == 0), L->getLine()); $ExpOpCount++; } >>
3181 vareqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
3183 EFI_QUESTION_ID QId;
3188 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
3189 EFI_VFR_RETURN_CODE VfrReturnCode = VFR_RETURN_SUCCESS;
3192 if (!mCompatibleMode) {
3193 _PCATCH (VFR_RETURN_UNSUPPORTED, L);
3199 VarIdStr = NULL; _STRCAT(&VarIdStr, VK->getText()); _STRCAT(&VarIdStr, VN->getText());
3200 VfrReturnCode = mCVfrDataStorage.GetVarStoreType (VarIdStr, VarStoreType);
3201 if (VfrReturnCode == VFR_RETURN_UNDEFINED) {
3202 _PCATCH (mCVfrDataStorage.DeclareEfiVarStore (
3205 _STOSID(VN->getText()),
3206 0x2, //default type is UINT16
3210 _PCATCH (VfrReturnCode, VN);
3212 mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, QId, Mask);
3213 LineNo = GET_LINENO(VN);
3219 V1:Number << ConstVal = _STOU16(V1->getText()); >>
3222 CIfrEqIdVal EIVObj (L->getLine());
3223 _SAVE_OPHDR_COND (EIVObj, ($ExpOpCount == 0), L->getLine());
3224 EIVObj.SetQuestionId (QId, VarIdStr, LineNo);
3225 EIVObj.SetValue (ConstVal);
3228 IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, EQUAL);
3235 V2:Number << ConstVal = _STOU16(V2->getText()); >>
3236 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_EQUAL); >>
3241 V3:Number << ConstVal = _STOU16(V3->getText()); >>
3242 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_THAN); >>
3247 V4:Number << ConstVal = _STOU16(V4->getText()); >>
3248 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_EQUAL); >>
3253 V5:Number << ConstVal = _STOU16(V5->getText()); >>
3254 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_THAN); >>
3259 ideqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
3261 EFI_QUESTION_ID QId;
3268 vfrQuestionDataFieldName[QId, Mask, VarIdStr, LineNo]
3272 V1:Number << ConstVal = _STOU16(V1->getText()); >>
3275 CIfrEqIdVal EIVObj (L->getLine());
3276 _SAVE_OPHDR_COND (EIVObj, ($ExpOpCount == 0), L->getLine());
3277 EIVObj.SetQuestionId (QId, VarIdStr, LineNo);
3278 EIVObj.SetValue (ConstVal);
3281 IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, EQUAL);
3288 V2:Number << ConstVal = _STOU16(V2->getText()); >>
3289 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_EQUAL); >>
3294 V3:Number << ConstVal = _STOU16(V3->getText()); >>
3295 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_THAN); >>
3300 V4:Number << ConstVal = _STOU16(V4->getText()); >>
3301 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_EQUAL); >>
3306 V5:Number << ConstVal = _STOU16(V5->getText()); >>
3307 << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_THAN); >>
3312 ideqidExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3314 EFI_QUESTION_ID QId[2];
3320 vfrQuestionDataFieldName[QId[0], Mask[0], VarIdStr[0], LineNo[0]]
3324 vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
3326 if (Mask[0] & Mask[1]) {
3327 IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], EQUAL);
3329 CIfrEqIdId EIIObj(L->getLine());
3330 _SAVE_OPHDR_COND (EIIObj, ($ExpOpCount == 0), L->getLine());
3331 EIIObj.SetQuestionId1 (QId[0], VarIdStr[0], LineNo[0]);
3332 EIIObj.SetQuestionId2 (QId[1], VarIdStr[1], LineNo[1]);
3340 vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
3341 << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], LESS_EQUAL); >>
3346 vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
3347 << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], LESS_THAN); >>
3352 vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
3353 << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], GREATER_EQUAL); >>
3358 vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
3359 << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], GREATER_THAN); >>
3364 ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3367 EFI_QUESTION_ID QId;
3369 UINT16 ValueList[EFI_IFR_MAX_LENGTH] = {0,};
3374 vfrQuestionDataFieldName[QId, Mask, VarIdStr, LineNo]
3377 V:Number << ValueList[ListLen] = _STOU16(V->getText()); ListLen++; >>
3381 IdEqListDoSpecial ($ExpOpCount, LineNo, QId, VarIdStr, Mask, ListLen, ValueList);
3384 CIfrEqIdList EILObj(L->getLine());
3385 if (QId != EFI_QUESTION_ID_INVALID) {
3386 EILObj.SetQuestionId (QId, VarIdStr, LineNo);
3388 EILObj.SetListLength (ListLen);
3389 for (Index = 0; Index < ListLen; Index++) {
3390 EILObj.SetValueList (Index, ValueList[Index]);
3393 EILObj.UpdateIfrBuffer();
3394 _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());
3396 if (QId == EFI_QUESTION_ID_INVALID) {
3397 EILObj.SetQuestionId (QId, VarIdStr, LineNo);
3404 questionref13Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3407 EFI_STRING_ID DevPath = EFI_STRING_ID_INVALID;
3408 EFI_GUID Guid = {0,};
3409 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
3411 CHAR8 *QName = NULL;
3419 Path "=" "STRING_TOKEN" "\(" S:Number "\)" << Type = 0x4; DevPath = _STOSID(S->getText()); >>
3422 Uuid "=" guidDefinition[Guid] << Type = 0x5; >>
3429 QN:StringIdentifier <<
3430 QName = QN->getText();
3431 LineNo = QN->getLine();
3432 mCVfrQuestionDB.GetQuestionId (QN->getText(), NULL, QId, BitMask);
3434 | ID:Number << QId = _STOQID(ID->getText()); >>
3441 case 0x1: {CIfrQuestionRef1 QR1Obj(L->getLine()); _SAVE_OPHDR_COND (QR1Obj, ($ExpOpCount == 0), L->getLine()); QR1Obj.SetQuestionId (QId, QName, LineNo); break;}
3442 case 0x3: {CIfrQuestionRef3 QR3Obj(L->getLine()); _SAVE_OPHDR_COND (QR3Obj, ($ExpOpCount == 0), L->getLine()); break;}
3443 case 0x4: {CIfrQuestionRef3_2 QR3_2Obj(L->getLine()); _SAVE_OPHDR_COND (QR3_2Obj, ($ExpOpCount == 0), L->getLine()); QR3_2Obj.SetDevicePath (DevPath); break;}
3444 case 0x5: {CIfrQuestionRef3_3 QR3_3Obj(L->getLine()); _SAVE_OPHDR_COND (QR3_3Obj, ($ExpOpCount == 0), L->getLine()); QR3_3Obj.SetDevicePath (DevPath); QR3_3Obj.SetGuid (&Guid); break;}
3450 rulerefExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3452 "\(" RN:StringIdentifier "\)" << { CIfrRuleRef RRObj(L->getLine()); _SAVE_OPHDR_COND (RRObj, ($ExpOpCount == 0), L->getLine()); RRObj.SetRuleId (mCVfrRulesDB.GetRuleId (RN->getText())); } $ExpOpCount++; >>
3455 //******************************************************
3457 // stringref (STR_FORM_SET_TITLE)
3459 stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3461 EFI_STRING_ID RefStringId = EFI_STRING_ID_INVALID;
3468 S:Number << RefStringId = _STOSID(S->getText()); >>
3470 | I:Number << RefStringId = _STOSID(I->getText()); >>
3472 "\)" << { CIfrStringRef1 SR1Obj(L->getLine()); _SAVE_OPHDR_COND (SR1Obj, ($ExpOpCount == 0), L->getLine()); SR1Obj.SetStringId (RefStringId); $ExpOpCount++; } >>
3475 pushthisExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3476 L:PushThis << { CIfrThis TObj(L->getLine()); _SAVE_OPHDR_COND (TObj, ($ExpOpCount == 0), L->getLine()); $ExpOpCount++; } >>
3479 securityExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3484 "\(" guidDefinition[Guid] "\)" << { CIfrSecurity SObj(L->getLine()); _SAVE_OPHDR_COND (SObj, ($ExpOpCount == 0), L->getLine()); SObj.SetPermissions (&Guid); } $ExpOpCount++; >>
3487 numericVarStoreType [UINT8 & VarType] :
3488 "NUMERIC_SIZE_1" << $VarType = EFI_IFR_NUMERIC_SIZE_1; >>
3489 | "NUMERIC_SIZE_2" << $VarType = EFI_IFR_NUMERIC_SIZE_2; >>
3490 | "NUMERIC_SIZE_4" << $VarType = EFI_IFR_NUMERIC_SIZE_4; >>
3491 | "NUMERIC_SIZE_8" << $VarType = EFI_IFR_NUMERIC_SIZE_8; >>
3494 getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3496 EFI_VARSTORE_INFO Info;
3497 CHAR8 *VarIdStr = NULL;
3498 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
3500 EFI_QUESION_TYPE QType = QUESTION_NORMAL;
3501 UINT8 VarType = EFI_IFR_TYPE_UNDEFINED;
3503 Info.mVarStoreId = 0;
3507 vfrStorageVarId[Info, VarIdStr, FALSE]
3508 {"\|" FLAGS "=" numericVarStoreType [VarType] }
3511 if (Info.mVarStoreId == 0) {
3512 // support Date/Time question
3513 mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, QId, Mask, &QType);
3514 if (QId == EFI_QUESTION_ID_INVALID || Mask == 0 || QType == QUESTION_NORMAL) {
3515 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
3517 if (QType == QUESTION_DATE) {
3518 Info.mVarType = EFI_IFR_TYPE_DATE;
3519 } else if (QType == QUESTION_TIME) {
3520 Info.mVarType = EFI_IFR_TYPE_TIME;
3523 case DATE_YEAR_BITMASK:
3524 Info.mInfo.mVarOffset = 0;
3526 case DATE_DAY_BITMASK:
3527 Info.mInfo.mVarOffset = 3;
3529 case TIME_HOUR_BITMASK:
3530 Info.mInfo.mVarOffset = 0;
3532 case TIME_MINUTE_BITMASK:
3533 Info.mInfo.mVarOffset = 1;
3535 case TIME_SECOND_BITMASK:
3536 Info.mInfo.mVarOffset = 2;
3539 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
3543 if ((mCVfrDataStorage.GetVarStoreType(Info.mVarStoreId) == EFI_VFR_VARSTORE_NAME) && (VarType == EFI_IFR_TYPE_UNDEFINED)) {
3544 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support name string");
3546 if (VarType != EFI_IFR_TYPE_UNDEFINED) {
3547 Info.mVarType = VarType;
3548 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
3549 Info.mVarTotalSize = VarSize;
3551 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
3552 if (VarSize != Info.mVarTotalSize) {
3553 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support data array");
3556 CIfrGet GObj(L->getLine());
3557 _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine());
3558 GObj.SetVarInfo (&Info);
3565 vfrExpressionConstant[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3566 L1:True << CIfrTrue TObj(L1->getLine()); _SAVE_OPHDR_COND (TObj, ($ExpOpCount == 0), L1->getLine()); $ExpOpCount++; >>
3567 | L2:False << CIfrFalse FObj(L2->getLine()); _SAVE_OPHDR_COND (FObj, ($ExpOpCount == 0), L2->getLine()); $ExpOpCount++; >>
3568 | L3:One << CIfrOne OObj(L3->getLine()); _SAVE_OPHDR_COND (OObj, ($ExpOpCount == 0), L3->getLine()); $ExpOpCount++; >>
3569 | L4:Ones << CIfrOnes OObj(L4->getLine()); _SAVE_OPHDR_COND (OObj, ($ExpOpCount == 0), L4->getLine()); $ExpOpCount++; >>
3570 | L5:Zero << CIfrZero ZObj(L5->getLine()); _SAVE_OPHDR_COND (ZObj, ($ExpOpCount == 0), L5->getLine()); $ExpOpCount++; >>
3571 | L6:Undefined << CIfrUndefined UObj(L6->getLine()); _SAVE_OPHDR_COND (UObj, ($ExpOpCount == 0), L6->getLine()); $ExpOpCount++; >>
3572 | L7:Version << CIfrVersion VObj(L7->getLine()); _SAVE_OPHDR_COND (VObj, ($ExpOpCount == 0), L7->getLine()); $ExpOpCount++; >>
3573 | V:Number << CIfrUint64 U64Obj(V->getLine()); U64Obj.SetValue (_STOU64(V->getText())); _SAVE_OPHDR_COND (U64Obj, ($ExpOpCount == 0), V->getLine()); $ExpOpCount++; >>
3576 vfrExpressionUnaryOp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3577 lengthExp[$RootLevel, $ExpOpCount]
3578 | bitwisenotExp[$RootLevel, $ExpOpCount]
3579 | question2refExp[$RootLevel, $ExpOpCount]
3580 | stringref2Exp[$RootLevel, $ExpOpCount]
3581 | toboolExp[$RootLevel, $ExpOpCount]
3582 | unintExp[$RootLevel, $ExpOpCount]
3583 | toupperExp[$RootLevel, $ExpOpCount]
3584 | tolwerExp[$RootLevel, $ExpOpCount]
3585 | setExp[$RootLevel, $ExpOpCount]
3588 lengthExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3590 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3591 << { CIfrLength LObj(L->getLine()); $ExpOpCount++; } >>
3594 bitwisenotExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3596 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3597 << { CIfrBitWiseNot BWNObj(L->getLine()); $ExpOpCount++; } >>
3600 question2refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3602 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3603 << { CIfrQuestionRef2 QR2Obj(L->getLine()); $ExpOpCount++; } >>
3606 stringref2Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3608 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3609 << { CIfrStringRef2 SR2Obj(L->getLine()); $ExpOpCount++; } >>
3612 toboolExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3614 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3615 << { CIfrToBoolean TBObj(L->getLine()); $ExpOpCount++; } >>
3618 tostringExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3619 << UINT8 Fmt = 0; >>
3622 Format "=" F:Number "," << Fmt = _STOU8(F->getText()); >>
3624 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3625 << { CIfrToString TSObj(L->getLine()); TSObj.SetFormat (Fmt); $ExpOpCount++; } >>
3628 unintExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3630 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3631 << { CIfrToUint TUObj(L->getLine()); $ExpOpCount++; } >>
3634 toupperExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3636 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3637 << { CIfrToUpper TUObj(L->getLine()); $ExpOpCount++; } >>
3640 tolwerExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3642 "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
3643 << { CIfrToLower TLObj(L->getLine()); $ExpOpCount++; } >>
3646 setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3648 EFI_VARSTORE_INFO Info;
3649 CHAR8 *VarIdStr = NULL;
3650 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
3652 EFI_QUESION_TYPE QType = QUESTION_NORMAL;
3653 UINT8 VarType = EFI_IFR_TYPE_UNDEFINED;
3655 Info.mVarStoreId = 0;
3659 vfrStorageVarId[Info, VarIdStr, FALSE]
3660 {"\|" FLAG "=" numericVarStoreType [VarType] }
3661 "," vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3665 if (Info.mVarStoreId == 0) {
3666 // support Date/Time question
3667 mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, QId, Mask, &QType);
3668 if (QId == EFI_QUESTION_ID_INVALID || Mask == 0 || QType == QUESTION_NORMAL) {
3669 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
3671 if (QType == QUESTION_DATE) {
3672 Info.mVarType = EFI_IFR_TYPE_DATE;
3673 } else if (QType == QUESTION_TIME) {
3674 Info.mVarType = EFI_IFR_TYPE_TIME;
3677 case DATE_YEAR_BITMASK:
3678 Info.mInfo.mVarOffset = 0;
3680 case DATE_DAY_BITMASK:
3681 Info.mInfo.mVarOffset = 3;
3683 case TIME_HOUR_BITMASK:
3684 Info.mInfo.mVarOffset = 0;
3686 case TIME_MINUTE_BITMASK:
3687 Info.mInfo.mVarOffset = 1;
3689 case TIME_SECOND_BITMASK:
3690 Info.mInfo.mVarOffset = 2;
3693 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
3697 if ((mCVfrDataStorage.GetVarStoreType(Info.mVarStoreId) == EFI_VFR_VARSTORE_NAME) && (VarType == EFI_IFR_TYPE_UNDEFINED)) {
3698 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support name string");
3700 if (VarType != EFI_IFR_TYPE_UNDEFINED) {
3701 Info.mVarType = VarType;
3702 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
3703 Info.mVarTotalSize = VarSize;
3705 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
3706 if (VarSize != Info.mVarTotalSize) {
3707 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support data array");
3710 CIfrSet TSObj(L->getLine());
3711 TSObj.SetVarInfo (&Info);
3718 vfrExpressionTernaryOp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3719 conditionalExp[$RootLevel, $ExpOpCount]
3720 | findExp[$RootLevel, $ExpOpCount]
3721 | midExp[$RootLevel, $ExpOpCount]
3722 | tokenExp[$RootLevel, $ExpOpCount]
3723 | spanExp[$RootLevel, $ExpOpCount]
3726 #token Cond("cond") "cond"
3727 #token Find("find") "find"
3728 #token Mid("mid") "mid"
3729 #token Tok("token") "token"
3730 #token Span("span") "span"
3732 conditionalExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3734 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3736 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3738 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3739 "\)" << { CIfrConditional CObj(L->getLine()); $ExpOpCount++; } >>
3742 findExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3745 findFormat[Format] ( "\|" findFormat[Format] )*
3747 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3749 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3751 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3752 "\)" << { CIfrFind FObj(L->getLine()); FObj.SetFormat (Format); $ExpOpCount++; } >>
3755 findFormat [UINT8 & Format] :
3756 "SENSITIVE" << $Format = 0x00; >>
3757 | "INSENSITIVE" << $Format = 0x01; >>
3760 midExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3762 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3764 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3766 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3767 "\)" << { CIfrMid MObj(L->getLine()); $ExpOpCount++; } >>
3770 tokenExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3772 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3774 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3776 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3777 "\)" << { CIfrToken TObj(L->getLine()); $ExpOpCount++; } >>
3780 spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
3781 << UINT8 Flags = 0; >>
3783 FLAGS "=" spanFlags[Flags] ( "\|" spanFlags[Flags] )*
3785 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3787 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3789 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3790 "\)" << { CIfrSpan SObj(S->getLine()); SObj.SetFlags(Flags); $ExpOpCount++; } >>
3793 vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:
3796 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
3797 ":" << { CIfrMap MObj(L->getLine()); } >>
3799 vfrStatementExpression[0]
3801 vfrStatementExpression[0]
3804 E:"\)" << { CIfrEnd EObj; EObj.SetLineNo(E->getLine()); $ExpOpCount++; } >>
3807 spanFlags [UINT8 & Flags] :
3808 N:Number << $Flags |= _STOU8(N->getText()); >>
3809 | "LAST_NON_MATCH" << $Flags |= 0x00; >>
3810 | "FIRST_NON_MATCH" << $Flags |= 0x01; >>
3813 #token StringIdentifier("string identifier") "[A-Za-z_][A-Za-z_0-9]*"
3814 #token Number("numeric value") "(0x[0-9A-Fa-f]+) | [0-9]+"
3816 //******************************************************************************
3818 // Parser class definition.
3820 class EfiVfrParser {
3823 UINT8 mParserStatus;
3824 BOOLEAN mConstantOnlyInExpression;
3826 CVfrDefaultStore mCVfrDefaultStore;
3827 CVfrDataStorage mCVfrDataStorage;
3828 CVfrQuestionDB mCVfrQuestionDB;
3829 CVfrRulesDB mCVfrRulesDB;
3831 CIfrOpHeader * mCIfrOpHdr[MAX_IFR_EXPRESSION_DEPTH];
3832 UINT32 mCIfrOpHdrLineNo[MAX_IFR_EXPRESSION_DEPTH];
3833 UINT8 mCIfrOpHdrIndex;
3834 VOID _SAVE_OPHDR_COND (IN CIfrOpHeader &, IN BOOLEAN, UINT32 LineNo = 0);
3835 VOID _CLEAR_SAVED_OPHDR (VOID);
3836 BOOLEAN _SET_SAVED_OPHDR_SCOPE (VOID);
3839 EFI_VARSTORE_INFO mCurrQestVarInfo;
3840 EFI_GUID *mOverrideClassGuid;
3843 // For framework vfr compatibility
3845 BOOLEAN mCompatibleMode;
3846 EFI_GUID mFormsetGuid;
3848 VOID _CRT_OP (IN BOOLEAN);
3850 VOID _SAVE_CURRQEST_VARINFO (IN EFI_VARSTORE_INFO &);
3851 EFI_VARSTORE_INFO & _GET_CURRQEST_VARTINFO (VOID);
3853 UINT8 _GET_CURRQEST_DATATYPE ();
3854 UINT32 _GET_CURRQEST_VARSIZE ();
3855 UINT32 _GET_CURRQEST_ARRAY_SIZE();
3858 VOID _PCATCH (IN INTN, IN INTN, IN ANTLRTokenPtr, IN CONST CHAR8 *);
3859 VOID _PCATCH (IN EFI_VFR_RETURN_CODE);
3860 VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN ANTLRTokenPtr);
3861 VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32);
3862 VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);
3864 VOID syn (ANTLRAbstractToken *, ANTLRChar *, SetWordType *, ANTLRTokenType, INT32);
3866 CHAR8* TrimHex (IN CHAR8 *, OUT BOOLEAN *);
3867 CHAR8* _U32TOS (IN UINT32);
3868 UINT8 _STOU8 (IN CHAR8 *);
3869 UINT16 _STOU16 (IN CHAR8 *);
3870 UINT32 _STOU32 (IN CHAR8 *);
3871 UINT64 _STOU64 (IN CHAR8 *);
3872 EFI_HII_DATE _STOD (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *);
3873 EFI_HII_TIME _STOT (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *);
3874 EFI_HII_REF _STOR (IN CHAR8 *, IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *);
3876 EFI_STRING_ID _STOSID (IN CHAR8 *);
3877 EFI_FORM_ID _STOFID (IN CHAR8 *);
3878 EFI_QUESTION_ID _STOQID (IN CHAR8 *);
3880 VOID _STRCAT (IN OUT CHAR8 **, IN CONST CHAR8 *);
3882 VOID _DeclareDefaultLinearVarStore (IN UINT32);
3883 VOID _DeclareStandardDefaultStorage (IN UINT32);
3884 VOID _DeclareDefaultFrameworkVarStore (IN UINT32);
3886 VOID AssignQuestionKey (IN CIfrQuestionHeader &, IN ANTLRTokenPtr);
3888 VOID ConvertIdExpr (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32);
3889 VOID IdEqValDoSpecial (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN UINT16, IN EFI_COMPARE_TYPE);
3890 VOID IdEqIdDoSpecial (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN EFI_COMPARE_TYPE);
3891 VOID IdEqListDoSpecial (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN UINT16, IN UINT16 *);
3892 VOID SetOverrideClassGuid (IN EFI_GUID *);
3894 // For framework vfr compatibility
3896 VOID SetCompatibleMode (IN BOOLEAN);
3902 EfiVfrParser::_SAVE_OPHDR_COND (
3903 IN CIfrOpHeader &OpHdr,
3909 if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
3912 mCIfrOpHdr[mCIfrOpHdrIndex] = new CIfrOpHeader(OpHdr);
3913 mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = LineNo;
3918 EfiVfrParser::_CLEAR_SAVED_OPHDR (
3922 mCIfrOpHdr[mCIfrOpHdrIndex] = NULL;
3923 mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = 0;
3927 EfiVfrParser::_SET_SAVED_OPHDR_SCOPE (
3931 if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
3932 mCIfrOpHdr[mCIfrOpHdrIndex]->SetScope (1);
3937 // IfrOpHdr is not set, FALSE is return.
3943 EfiVfrParser::_CRT_OP (
3951 EfiVfrParser::_SAVE_CURRQEST_VARINFO (
3952 IN EFI_VARSTORE_INFO &Info
3955 mCurrQestVarInfo = Info;
3959 EfiVfrParser::_GET_CURRQEST_VARTINFO (
3963 return mCurrQestVarInfo;
3967 EfiVfrParser::_GET_CURRQEST_ARRAY_SIZE (
3973 switch (mCurrQestVarInfo.mVarType) {
3974 case EFI_IFR_TYPE_NUM_SIZE_8:
3978 case EFI_IFR_TYPE_NUM_SIZE_16:
3982 case EFI_IFR_TYPE_NUM_SIZE_32:
3986 case EFI_IFR_TYPE_NUM_SIZE_64:
3994 return (mCurrQestVarInfo.mVarTotalSize / Size);
3998 EfiVfrParser::_GET_CURRQEST_DATATYPE (
4002 return mCurrQestVarInfo.mVarType;
4006 EfiVfrParser::_GET_CURRQEST_VARSIZE (
4010 return mCurrQestVarInfo.mVarTotalSize;
4014 EfiVfrParser::_PCATCH (
4017 IN ANTLRTokenPtr Tok,
4018 IN CONST CHAR8 *ErrorMsg
4021 if (ReturnCode != ExpectCode) {
4023 gCVfrErrorHandle.PrintMsg (Tok->getLine(), Tok->getText(), "Error", ErrorMsg);
4028 EfiVfrParser::_PCATCH (
4029 IN EFI_VFR_RETURN_CODE ReturnCode
4032 mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode);
4036 EfiVfrParser::_PCATCH (
4037 IN EFI_VFR_RETURN_CODE ReturnCode,
4038 IN ANTLRTokenPtr Tok
4041 mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, Tok->getLine(), Tok->getText());
4045 EfiVfrParser::_PCATCH (
4046 IN EFI_VFR_RETURN_CODE ReturnCode,
4050 mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, LineNum);
4054 EfiVfrParser::_PCATCH (
4055 IN EFI_VFR_RETURN_CODE ReturnCode,
4057 IN CONST CHAR8 *ErrorMsg
4060 mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, LineNum, (CHAR8 *) ErrorMsg);
4065 ANTLRAbstractToken *Tok,
4068 ANTLRTokenType ETok,
4072 gCVfrErrorHandle.HandleError (VFR_RETURN_MISMATCHED, Tok->getLine(), Tok->getText());
4078 EfiVfrParser::TrimHex (
4085 while (*Str && *Str == ' ') {
4088 while (*Str && *Str == '0') {
4091 if (*Str && (*Str == 'x' || *Str == 'X')) {
4100 EfiVfrParser::_U32TOS (
4105 Str = new CHAR8[20];
4106 sprintf (Str, "%d", Value);
4111 EfiVfrParser::_STOU8 (
4119 Str = TrimHex (Str, &IsHex);
4120 for (Value = 0; (c = *Str) != '\0'; Str++) {
4122 // BUG: does not handle overflow here
4124 (IsHex == TRUE) ? (Value <<= 4) : (Value *= 10);
4126 if ((IsHex == TRUE) && (c >= 'a') && (c <= 'f')) {
4127 Value += (c - 'a' + 10);
4129 if ((IsHex == TRUE) && (c >= 'A') && (c <= 'F')) {
4130 Value += (c - 'A' + 10);
4132 if (c >= '0' && c <= '9') {
4141 EfiVfrParser::_STOU16 (
4149 Str = TrimHex (Str, &IsHex);
4150 for (Value = 0; (c = *Str) != '\0'; Str++) {
4152 // BUG: does not handle overflow here
4154 (IsHex == TRUE) ? (Value <<= 4) : (Value *= 10);
4156 if ((IsHex == TRUE) && (c >= 'a') && (c <= 'f')) {
4157 Value += (c - 'a' + 10);
4159 if ((IsHex == TRUE) && (c >= 'A') && (c <= 'F')) {
4160 Value += (c - 'A' + 10);
4162 if (c >= '0' && c <= '9') {
4171 EfiVfrParser::_STOU32 (
4179 Str = TrimHex (Str, &IsHex);
4180 for (Value = 0; (c = *Str) != '\0'; Str++) {
4182 // BUG: does not handle overflow here
4184 (IsHex == TRUE) ? (Value <<= 4) : (Value *= 10);
4186 if ((IsHex == TRUE) && (c >= 'a') && (c <= 'f')) {
4187 Value += (c - 'a' + 10);
4189 if ((IsHex == TRUE) && (c >= 'A') && (c <= 'F')) {
4190 Value += (c - 'A' + 10);
4192 if (c >= '0' && c <= '9') {
4201 EfiVfrParser::_STOU64 (
4209 Str = TrimHex (Str, &IsHex);
4210 for (Value = 0; (c = *Str) != '\0'; Str++) {
4212 // BUG: does not handle overflow here
4214 (IsHex == TRUE) ? (Value <<= 4) : (Value *= 10);
4216 if ((IsHex == TRUE) && (c >= 'a') && (c <= 'f')) {
4217 Value += (c - 'a' + 10);
4219 if ((IsHex == TRUE) && (c >= 'A') && (c <= 'F')) {
4220 Value += (c - 'A' + 10);
4222 if (c >= '0' && c <= '9') {
4231 EfiVfrParser::_STOD (
4239 Date.Year = _STOU16 (Year);
4240 Date.Month = _STOU8 (Month);
4241 Date.Day = _STOU8 (Day);
4247 EfiVfrParser::_STOT (
4255 Time.Hour = _STOU8 (Hour);
4256 Time.Minute = _STOU8 (Minute);
4257 Time.Second = _STOU8 (Second);
4263 EfiVfrParser::_STOSID (
4267 return (EFI_STRING_ID)_STOU16(Str);
4271 EfiVfrParser::_STOFID (
4275 return (EFI_FORM_ID)_STOU16(Str);
4279 EfiVfrParser::_STOQID (
4283 return (EFI_QUESTION_ID)_STOU16(Str);
4287 EfiVfrParser::_STRCAT (
4288 IN OUT CHAR8 **Dest,
4295 if ((Dest == NULL) || (Src == NULL)) {
4299 Len = (*Dest == NULL) ? 0 : strlen (*Dest);
4300 Len += strlen (Src);
4301 if ((NewStr = new CHAR8[Len + 1]) == NULL) {
4305 if (*Dest != NULL) {
4306 strcpy (NewStr, *Dest);
4309 strcat (NewStr, Src);
4315 EfiVfrParser::_STOR (
4316 IN CHAR8 *QuestionId,
4318 IN EFI_GUID *FormSetGuid,
4319 IN CHAR8 *DevicePath
4325 memcpy (&Ref.FormSetGuid, FormSetGuid, sizeof (EFI_GUID));
4326 Ref.QuestionId = _STOQID (QuestionId);
4327 Ref.FormId = _STOFID (FormId);
4328 Ref.DevicePath = _STOSID (DevicePath);
4334 // framework vfr to default declare varstore for each structure
4337 EfiVfrParser::_DeclareDefaultFrameworkVarStore (
4341 SVfrVarStorageNode *pNode;
4344 CONST CHAR8 VarName[] = "Setup";
4347 pNode = mCVfrDataStorage.GetBufferVarStoreList();
4348 if (pNode == NULL && gCVfrVarDataTypeDB.mFirstNewDataTypeName != NULL) {
4350 // Create the default Buffer Var Store when no VarStore is defined.
4351 // its name should be "Setup"
4353 gCVfrVarDataTypeDB.GetDataTypeSize (gCVfrVarDataTypeDB.mFirstNewDataTypeName, &TypeSize);
4355 VSObj.SetLineNo (LineNo);
4356 VSObj.SetVarStoreId (0x1); //the first and only one Buffer Var Store
4357 VSObj.SetSize ((UINT16) TypeSize);
4358 //VSObj.SetName (gCVfrVarDataTypeDB.mFirstNewDataTypeName);
4359 VSObj.SetName ((CHAR8 *) VarName);
4360 VSObj.SetGuid (&mFormsetGuid);
4362 printf ("Create the default VarStoreName is %s\n", gCVfrVarDataTypeDB.mFirstNewDataTypeName);
4365 for (; pNode != NULL; pNode = pNode->mNext) {
4367 // create the default varstore opcode for not declared varstore
4368 // the first varstore name should be "Setup"
4370 if (!pNode->mAssignedFlag) {
4372 VSObj.SetLineNo (LineNo);
4373 VSObj.SetVarStoreId (pNode->mVarStoreId);
4374 VSObj.SetSize ((UINT16) pNode->mStorageInfo.mDataType->mTotalSize);
4376 VSObj.SetName ((CHAR8 *) VarName);
4379 VSObj.SetName (pNode->mVarStoreName);
4381 VSObj.SetGuid (&pNode->mGuid);
4383 printf ("undefined VarStoreName is %s and Id is 0x%x\n", pNode->mVarStoreName, pNode->mVarStoreId);
4389 pNode = mCVfrDataStorage.GetEfiVarStoreList();
4390 for (; pNode != NULL; pNode = pNode->mNext) {
4392 // create the default efi varstore opcode for not exist varstore
4394 if (!pNode->mAssignedFlag) {
4395 CIfrVarStoreEfi VSEObj;
4396 VSEObj.SetLineNo (LineNo);
4397 VSEObj.SetAttributes (0x00000002); //hardcode EFI_VARIABLE_BOOTSERVICE_ACCESS attribute
4398 VSEObj.SetGuid (&pNode->mGuid);
4399 VSEObj.SetVarStoreId (pNode->mVarStoreId);
4400 // Generate old efi varstore storage structure for compatiable with old "VarEqVal" opcode,
4401 // which is 3 bytes less than new structure define in UEFI Spec 2.3.1.
4402 VSEObj.SetBinaryLength (sizeof (EFI_IFR_VARSTORE_EFI) - 3);
4404 printf ("undefined Efi VarStoreName is %s and Id is 0x%x\n", pNode->mVarStoreName, pNode->mVarStoreId);
4412 EfiVfrParser::_DeclareDefaultLinearVarStore (
4417 CHAR8 **TypeNameList;
4419 CONST CHAR8 DateName[] = "Date";
4420 CONST CHAR8 TimeName[] = "Time";
4421 CONST CHAR8 DateType[] = "EFI_HII_DATE";
4422 CONST CHAR8 TimeType[] = "EFI_HII_TIME";
4424 gCVfrVarDataTypeDB.GetUserDefinedTypeNameList (&TypeNameList, &ListSize);
4426 for (Index = 0; Index < ListSize; Index++) {
4428 EFI_VARSTORE_ID VarStoreId;
4431 VSObj.SetLineNo (LineNo);
4432 mCVfrDataStorage.DeclareBufferVarStore (
4433 TypeNameList[Index],
4435 &gCVfrVarDataTypeDB,
4436 TypeNameList[Index],
4437 EFI_VARSTORE_ID_INVALID
4439 mCVfrDataStorage.GetVarStoreId(TypeNameList[Index], &VarStoreId);
4440 VSObj.SetVarStoreId (VarStoreId);
4441 gCVfrVarDataTypeDB.GetDataTypeSize(TypeNameList[Index], &Size);
4442 VSObj.SetSize ((UINT16) Size);
4443 VSObj.SetName (TypeNameList[Index]);
4444 VSObj.SetGuid (&mFormsetGuid);
4448 // not required to declare Date and Time VarStore,
4449 // because code to support old format Data and Time
4451 if (gCVfrVarDataTypeDB.IsTypeNameDefined ((CHAR8 *) DateName) == FALSE) {
4453 EFI_VARSTORE_ID VarStoreId;
4456 VSObj.SetLineNo (LineNo);
4457 mCVfrDataStorage.DeclareBufferVarStore (
4460 &gCVfrVarDataTypeDB,
4462 EFI_VARSTORE_ID_INVALID
4464 mCVfrDataStorage.GetVarStoreId((CHAR8 *) DateName, &VarStoreId);
4465 VSObj.SetVarStoreId (VarStoreId);
4466 gCVfrVarDataTypeDB.GetDataTypeSize((CHAR8 *) DateType, &Size);
4467 VSObj.SetSize ((UINT16) Size);
4468 VSObj.SetName ((CHAR8 *) DateName);
4469 VSObj.SetGuid (&mFormsetGuid);
4472 if (gCVfrVarDataTypeDB.IsTypeNameDefined ((CHAR8 *) TimeName) == FALSE) {
4474 EFI_VARSTORE_ID VarStoreId;
4477 VSObj.SetLineNo (LineNo);
4478 mCVfrDataStorage.DeclareBufferVarStore (
4481 &gCVfrVarDataTypeDB,
4483 EFI_VARSTORE_ID_INVALID
4485 mCVfrDataStorage.GetVarStoreId((CHAR8 *) TimeName, &VarStoreId);
4486 VSObj.SetVarStoreId (VarStoreId);
4487 gCVfrVarDataTypeDB.GetDataTypeSize((CHAR8 *) TimeType, &Size);
4488 VSObj.SetSize ((UINT16) Size);
4489 VSObj.SetName ((CHAR8 *) TimeName);
4490 VSObj.SetGuid (&mFormsetGuid);
4495 EfiVfrParser::_DeclareStandardDefaultStorage (
4500 // Default Store is declared.
4502 CIfrDefaultStore DSObj;
4504 mCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr(), (CHAR8 *) "Standard Defaults", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_STANDARD);
4505 DSObj.SetLineNo (LineNo);
4506 DSObj.SetDefaultName (EFI_STRING_ID_INVALID);
4507 DSObj.SetDefaultId (EFI_HII_DEFAULT_CLASS_STANDARD);
4510 // Default MANUFACTURING Store is declared.
4512 CIfrDefaultStore DSObjMF;
4514 mCVfrDefaultStore.RegisterDefaultStore (DSObjMF.GetObjBinAddr(), (CHAR8 *) "Standard ManuFacturing", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_MANUFACTURING);
4515 DSObjMF.SetLineNo (LineNo);
4516 DSObjMF.SetDefaultName (EFI_STRING_ID_INVALID);
4517 DSObjMF.SetDefaultId (EFI_HII_DEFAULT_CLASS_MANUFACTURING);
4521 EfiVfrParser::AssignQuestionKey (
4522 IN CIfrQuestionHeader &QHObj,
4523 IN ANTLRTokenPtr KeyTok
4528 if (KeyTok == NULL) {
4532 KeyValue = _STOU16 (KeyTok->getText());
4534 if (QHObj.FLAGS () & EFI_IFR_FLAG_CALLBACK) {
4536 * if the question is not CALLBACK ignore the key.
4538 _PCATCH(mCVfrQuestionDB.UpdateQuestionId (QHObj.QUESTION_ID(), KeyValue), KeyTok);
4539 QHObj.SetQuestionId (KeyValue);
4544 EfiVfrParser::ConvertIdExpr (
4545 IN UINT32 &ExpOpCount,
4547 IN EFI_QUESTION_ID QId,
4552 CIfrQuestionRef1 QR1Obj(LineNo);
4553 QR1Obj.SetQuestionId (QId, VarIdStr, LineNo);
4554 _SAVE_OPHDR_COND (QR1Obj, (ExpOpCount == 0));
4557 CIfrUint32 U32Obj(LineNo);
4558 U32Obj.SetValue (BitMask);
4560 CIfrBitWiseAnd BWAObj(LineNo);
4562 CIfrUint8 U8Obj(LineNo);
4564 case DATE_YEAR_BITMASK : U8Obj.SetValue (0); break;
4565 case TIME_SECOND_BITMASK : U8Obj.SetValue (0x10); break;
4566 case DATE_DAY_BITMASK : U8Obj.SetValue (0x18); break;
4567 case TIME_HOUR_BITMASK : U8Obj.SetValue (0); break;
4568 case TIME_MINUTE_BITMASK : U8Obj.SetValue (0x8); break;
4571 CIfrShiftRight SRObj(LineNo);
4578 EfiVfrParser::IdEqValDoSpecial (
4579 IN UINT32 &ExpOpCount,
4581 IN EFI_QUESTION_ID QId,
4585 IN EFI_COMPARE_TYPE CompareType
4588 ConvertIdExpr (ExpOpCount, LineNo, QId, VarIdStr, BitMask);
4590 if (ConstVal > 0xFF) {
4591 CIfrUint16 U16Obj(LineNo);
4592 U16Obj.SetValue (ConstVal);
4594 CIfrUint8 U8Obj(LineNo);
4595 U8Obj.SetValue ((UINT8)ConstVal);
4598 switch (CompareType) {
4601 CIfrEqual EObj(LineNo);
4606 CIfrLessEqual LEObj(LineNo);
4611 CIfrLessThan LTObj(LineNo);
4614 case GREATER_EQUAL :
4616 CIfrGreaterEqual GEObj(LineNo);
4621 CIfrGreaterThan GTObj(LineNo);
4630 EfiVfrParser::IdEqIdDoSpecial (
4631 IN UINT32 &ExpOpCount,
4633 IN EFI_QUESTION_ID QId1,
4634 IN CHAR8 *VarId1Str,
4636 IN EFI_QUESTION_ID QId2,
4637 IN CHAR8 *VarId2Str,
4639 IN EFI_COMPARE_TYPE CompareType
4642 ConvertIdExpr (ExpOpCount, LineNo, QId1, VarId1Str, BitMask1);
4643 ConvertIdExpr (ExpOpCount, LineNo, QId2, VarId2Str, BitMask2);
4645 switch (CompareType) {
4648 CIfrEqual EObj(LineNo);
4653 CIfrLessEqual LEObj(LineNo);
4658 CIfrLessThan LTObj(LineNo);
4661 case GREATER_EQUAL :
4663 CIfrGreaterEqual GEObj(LineNo);
4668 CIfrGreaterThan GTObj(LineNo);
4677 EfiVfrParser::IdEqListDoSpecial (
4678 IN UINT32 &ExpOpCount,
4680 IN EFI_QUESTION_ID QId,
4684 IN UINT16 *ValueList
4693 IdEqValDoSpecial (ExpOpCount, LineNo, QId, VarIdStr, BitMask, ValueList[0], EQUAL);
4694 for (Index = 1; Index < ListLen; Index++) {
4695 IdEqValDoSpecial (ExpOpCount, LineNo, QId, VarIdStr, BitMask, ValueList[Index], EQUAL);
4696 CIfrOr OObj (LineNo);
4702 EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID *OverrideClassGuid)
4704 mOverrideClassGuid = OverrideClassGuid;
4708 // For framework vfr compatibility
4711 EfiVfrParser::SetCompatibleMode (IN BOOLEAN Mode)
4713 mCompatibleMode = Mode;
4714 mCVfrQuestionDB.SetCompatibleMode (Mode);