public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature
@ 2023-12-12  9:01 Yuting Yang
  2023-12-12  9:04 ` Yuwei Chen
  0 siblings, 1 reply; 12+ messages in thread
From: Yuting Yang @ 2023-12-12  9:01 UTC (permalink / raw)
  To: devel; +Cc: Rebecca Cran, Liming Gao, Bob Feng, Christine Chen

Add --catch_default option
Raise a DefaultValueError when encountering VFR default definitions
to help remove default variables.
Add --except_list option
Exclude packages that don't require enabling the catch_default function.

Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Christine Chen <yuwei.chen@intel.com>
Cc: Yuting Yang <yuting2.yang@intel.com>

Signed-off-by: Yuting Yang <yuting2.yang@intel.com>
---
 BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  40 ++-
 BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   3 +
 BaseTools/Source/C/VfrCompile/VfrError.cpp    |   3 +-
 BaseTools/Source/C/VfrCompile/VfrError.h      |   3 +-
 BaseTools/Source/C/VfrCompile/VfrFormPkg.h    |   1 +
 BaseTools/Source/C/VfrCompile/VfrSyntax.g     | 238 ++++++++++--------
 6 files changed, 184 insertions(+), 104 deletions(-)

diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
index 5f4d262d85..e97cebff65 100644
--- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
@@ -78,6 +78,9 @@ CVfrCompiler::OptionInitialization (
   mOptions.WarningAsError                = FALSE;
   mOptions.AutoDefault                   = FALSE;
   mOptions.CheckDefault                  = FALSE;
+  mOptions.IsCatchDefaultEnable          = FALSE;
+  mOptions.ExceptionList                 = NULL;
+  mOptions.ExceptionListSize             = 0;
   memset (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));
 
   if (Argc == 1) {
@@ -95,6 +98,23 @@ CVfrCompiler::OptionInitialization (
       Version ();
       SET_RUN_STATUS (STATUS_DEAD);
       return;
+    } else if (stricmp(Argv[Index], "--catch_default") == 0){
+      mOptions.IsCatchDefaultEnable = TRUE;
+    } else if (stricmp(Argv[Index], "--except_list") == 0){
+      INT32 Start = ++Index;
+      if ((Start >= Argc) || (Argv[Start][0] == '-')) {
+        DebugError (NULL, 0, 1001, "Missing option", "-exception_list missing except list");
+        goto Fail;
+      }
+      while ((Argv[Index][0] != '-') && (Index < Argc - 1)) {
+        Index++;
+      }
+      INT32 End = Index--;
+      mOptions.ExceptionListSize = End - Start;
+      for (INT32 i = Start; i < End; i++) {
+        mOptions.ExceptionList = (CHAR8**) realloc(mOptions.ExceptionList, (i - Start + 1) * sizeof(CHAR8*));
+        mOptions.ExceptionList[i-Start] = Argv[i];
+      }
     } else if (stricmp(Argv[Index], "-l") == 0) {
       mOptions.CreateRecordListFile = TRUE;
       gCIfrRecordInfoDB.TurnOn ();
@@ -179,7 +199,11 @@ CVfrCompiler::OptionInitialization (
       goto Fail;
     }
     strcpy (mOptions.VfrFileName, Argv[Index]);
-
+    for (int i = 0; i < mOptions.ExceptionListSize; i++) {
+      if (strstr(mOptions.VfrFileName, mOptions.ExceptionList[i]) != NULL) {
+        mOptions.IsCatchDefaultEnable = FALSE;
+      }
+    }
     if (mOptions.OutputDirectory == NULL) {
       mOptions.OutputDirectory = (CHAR8 *) malloc (1);
       if (mOptions.OutputDirectory == NULL) {
@@ -217,6 +241,11 @@ Fail:
     free (mOptions.VfrFileName);
     mOptions.VfrFileName                 = NULL;
   }
+  if (mOptions.ExceptionList != NULL) {
+    free(mOptions.ExceptionList);
+    mOptions.ExceptionList               = NULL;
+
+  }
   if (mOptions.VfrBaseFileName != NULL) {
     free (mOptions.VfrBaseFileName);
     mOptions.VfrBaseFileName             = NULL;
@@ -496,6 +525,11 @@ CVfrCompiler::~CVfrCompiler (
     mOptions.VfrBaseFileName = NULL;
   }
 
+  if (mOptions.ExceptionList != NULL) {
+    free (mOptions.ExceptionList);
+    mOptions.ExceptionList = NULL;
+  }
+
   if (mOptions.OutputDirectory != NULL) {
     free (mOptions.OutputDirectory);
     mOptions.OutputDirectory = NULL;
@@ -679,7 +713,7 @@ CVfrCompiler::Compile (
     DebugError (NULL, 0, 0001, "Error opening the input file", "%s", InFileName);
     goto Fail;
   }
-
+  InputInfo.IsCatchDefaultEnable = mOptions.IsCatchDefaultEnable;
   if (mOptions.HasOverrideClassGuid) {
     InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;
   } else {
@@ -937,5 +971,3 @@ main (
 
   return GetUtilityStatus ();
 }
-
-
diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.h b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
index b6e207d2ce..39e0a89a29 100644
--- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
+++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
@@ -52,6 +52,9 @@ typedef struct {
   BOOLEAN WarningAsError;
   BOOLEAN AutoDefault;
   BOOLEAN CheckDefault;
+  BOOLEAN IsCatchDefaultEnable;
+  CHAR8**  ExceptionList;
+  INT16    ExceptionListSize;
 } OPTIONS;
 
 typedef enum {
diff --git a/BaseTools/Source/C/VfrCompile/VfrError.cpp b/BaseTools/Source/C/VfrCompile/VfrError.cpp
index 65bb8e34fd..8a706f929b 100644
--- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
@@ -49,7 +49,8 @@ static SVFR_WARNING_HANDLE VFR_WARNING_HANDLE_TABLE [] = {
   { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value re-defined with different value"},
   { VFR_WARNING_ACTION_WITH_TEXT_TWO, ": Action opcode should not have TextTwo part"},
   { VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend to use obsoleted framework opcode"},
-  { VFR_WARNING_CODEUNDEFINED, ": undefined Warning Code" }
+  { VFR_WARNING_CODEUNDEFINED, ": undefined Warning Code" },
+  { VFR_WARNING_UNSUPPORTED, ": pls remove the default values if necessary" }
 };
 
 CVfrErrorHandle::CVfrErrorHandle (
diff --git a/BaseTools/Source/C/VfrCompile/VfrError.h b/BaseTools/Source/C/VfrCompile/VfrError.h
index 7d16bd5f74..1b4bc173d2 100644
--- a/BaseTools/Source/C/VfrCompile/VfrError.h
+++ b/BaseTools/Source/C/VfrCompile/VfrError.h
@@ -47,7 +47,8 @@ typedef enum {
   VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0,
   VFR_WARNING_ACTION_WITH_TEXT_TWO,
   VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,
-  VFR_WARNING_CODEUNDEFINED
+  VFR_WARNING_CODEUNDEFINED,
+  VFR_WARNING_UNSUPPORTED
 } EFI_VFR_WARNING_CODE;
 
 typedef struct _SVFR_ERROR_HANDLE {
diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
index 9ef6f07787..d8fada3bcb 100644
--- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
+++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
@@ -96,6 +96,7 @@ struct SBufferNode {
 
 typedef struct {
   EFI_GUID *OverrideClassGuid;
+  BOOLEAN IsCatchDefaultEnable;
 } INPUT_INFO_TO_SYNTAX;
 
 class CFormPkg {
diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
index 55fd067f8a..5daf1c423c 100644
--- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
+++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
@@ -50,6 +50,7 @@ VfrParserStart (
 {
   ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken> VfrParser(File);
   VfrParser.parser()->SetOverrideClassGuid (InputInfo->OverrideClassGuid);
+  VfrParser.parser()->SetIsCatchDefaultEnable(InputInfo->IsCatchDefaultEnable);
   return VfrParser.parser()->vfrProgram();
 }
 >>
@@ -386,8 +387,8 @@ dataStructField32 [BOOLEAN  FieldInUnion]:
   ;
 
 dataStructField16 [BOOLEAN  FieldInUnion]:
-  << 
-    UINT32 ArrayNum = 0; 
+  <<
+    UINT32 ArrayNum = 0;
   >>
   ("UINT16" | "CHAR16")
   N:StringIdentifier
@@ -737,7 +738,7 @@ vfrFormSetList :
   ;
 
 vfrStatementExtension:
-  << 
+  <<
      EFI_GUID Guid;
      CIfrGuid *GuidObj = NULL;
      CHAR8    *TypeName = NULL;
@@ -751,7 +752,7 @@ vfrStatementExtension:
   >>
   L:GuidOp
   Uuid "=" guidDefinition[Guid]
-  {"," DataType "=" 
+  {"," DataType "="
     (
         U64:"UINT64" {OpenBracket AN1:Number CloseBracket <<ArrayNum = _STOU32(AN1->getText(), AN1->getLine());>>}
                                                       << TypeName = U64->getText(); LineNum = U64->getLine(); >>
@@ -770,7 +771,7 @@ vfrStatementExtension:
       | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket <<ArrayNum = _STOU32(AN8->getText(), AN8->getLine());>>}
                                                       << TypeName = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>
       | R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = _STOU32(AN9->getText(), AN9->getLine());>>}
-                                                      << TypeName = R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>                                                
+                                                      << TypeName = R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
       | TN:StringIdentifier {OpenBracket AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText(), AN10->getLine());>>}
                                                       << TypeName = TN->getText(); LineNum = TN->getLine(); IsStruct = TRUE;>>
     )
@@ -875,19 +876,19 @@ vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 TypeSize,
                 memcpy (ByteOffset, &Data_U64, TypeSize);
               }else if (strcmp ("UINT32", TypeName) == 0) {
                 Data_U32 = _STOU32(RD->getText(), RD->getLine());
-                memcpy (ByteOffset, &Data_U32, TypeSize);                                                    
+                memcpy (ByteOffset, &Data_U32, TypeSize);
               }else if (strcmp ("UINT16", TypeName) == 0) {
                 Data_U16 = _STOU16(RD->getText(), RD->getLine());
-                memcpy (ByteOffset, &Data_U16, TypeSize);                                                    
+                memcpy (ByteOffset, &Data_U16, TypeSize);
               }else if (strcmp ("UINT8", TypeName) == 0) {
                 Data_U8 = _STOU8(RD->getText(), RD->getLine());
-                memcpy (ByteOffset, &Data_U8, TypeSize);                                                    
+                memcpy (ByteOffset, &Data_U8, TypeSize);
               }else if (strcmp ("BOOLEAN", TypeName)== 0) {
                 Data_BL = _STOU8(RD->getText(), RD->getLine());
-                memcpy (ByteOffset, &Data_BL, TypeSize);                                                    
+                memcpy (ByteOffset, &Data_BL, TypeSize);
               }else if (strcmp ("EFI_STRING_ID", TypeName) == 0) {
                 Data_SID = _STOSID(RD->getText(), RD->getLine());
-                memcpy (ByteOffset, &Data_SID, TypeSize);                                                    
+                memcpy (ByteOffset, &Data_SID, TypeSize);
               }
             } else {
               gCVfrVarDataTypeDB.GetDataFieldInfo(TFName, FieldOffset, FieldType, FieldSize, BitField);
@@ -975,7 +976,15 @@ vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 TypeSize,
 
 vfrStatementDefaultStore :
   << UINT16  DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD; >>
-  D:DefaultStore N:StringIdentifier ","
+  D:DefaultStore N:StringIdentifier ","             <<
+                                                      if (mIsCatchDefaultEnable) {
+                                                      gCVfrErrorHandle.HandleWarning (
+                                                          VFR_WARNING_UNSUPPORTED,
+                                                          D->getLine(),
+                                                          D->getText()
+                                                          );
+                                                      }
+                                                    >>
   Prompt "=" "STRING_TOKEN" "\(" S:Number "\)"
   {
     "," Attribute "=" A:Number                      << DefaultId = _STOU16(A->getText(), A->getLine()); >>
@@ -1074,7 +1083,7 @@ vfrStatementVarStoreEfi :
     | U64:"UINT64" ","                              << TypeName = U64->getText(); LineNum = U64->getLine(); >>
     | D:"EFI_HII_DATE" ","                          << TypeName = D->getText(); LineNum = D->getLine(); >>
     | T:"EFI_HII_TIME" ","                          << TypeName = T->getText(); LineNum = T->getLine(); >>
-    | R:"EFI_HII_REF" ","                           << TypeName = R->getText(); LineNum = R->getLine(); >>    
+    | R:"EFI_HII_REF" ","                           << TypeName = R->getText(); LineNum = R->getLine(); >>
   )
   {
     VarId "=" ID:Number ","                         <<
@@ -1092,8 +1101,8 @@ vfrStatementVarStoreEfi :
   (
     Name    "=" SN:StringIdentifier ","             << StoreName = SN->getText();   >>
    |
-    Name    "=" "STRING_TOKEN" "\(" VN:Number "\)" ","  
-    VarSize "=" N:Number ","                        << 
+    Name    "=" "STRING_TOKEN" "\(" VN:Number "\)" ","
+    VarSize "=" N:Number ","                        <<
                                                        IsUEFI23EfiVarstore = FALSE;
                                                        StoreName = gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText(), VN->getLine()));
                                                        if (StoreName == NULL) {
@@ -1116,7 +1125,7 @@ vfrStatementVarStoreEfi :
                                                         break;
                                                        case 8:
                                                         TypeName = (CHAR8 *) "UINT64";
-                                                        break; 
+                                                        break;
                                                        default:
                                                         _PCATCH (VFR_RETURN_UNSUPPORTED, N);
                                                         break;
@@ -1124,7 +1133,7 @@ vfrStatementVarStoreEfi :
                                                     >>
   )
 
-  Uuid "=" guidDefinition[Guid]                     << 
+  Uuid "=" guidDefinition[Guid]                     <<
                                                        if (IsUEFI23EfiVarstore) {
                                                        _PCATCH(gCVfrDataStorage.DeclareBufferVarStore (
                                                                                     StoreName,
@@ -1150,7 +1159,7 @@ vfrStatementVarStoreEfi :
                                                        }
                                                        VSEObj.SetGuid (&Guid);
                                                        VSEObj.SetVarStoreId (VarStoreId);
-                                                       
+
                                                        VSEObj.SetSize ((UINT16) Size);
                                                        VSEObj.SetName (StoreName);
                                                        if (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {
@@ -1184,7 +1193,7 @@ vfrStatementVarStoreNameValue :
                                                     >>
   }
   (
-    Name "=" "STRING_TOKEN" "\(" N:Number "\)" ","  << 
+    Name "=" "STRING_TOKEN" "\(" N:Number "\)" ","  <<
                                                        if (!Created) {
                                                          _PCATCH(gCVfrDataStorage.DeclareNameVarStoreBegin (SN->getText(), VarStoreId), SN);
                                                          Created = TRUE;
@@ -1245,12 +1254,12 @@ vfrStatementDisableIfFormSet :
 vfrStatementSuppressIfFormSet :
   << CIfrSuppressIf SIObj;>>
   L:SuppressIf                                         <<
-                                                           SIObj.SetLineNo(L->getLine()); 
+                                                           SIObj.SetLineNo(L->getLine());
                                                        >>
   { FLAGS "=" flagsField ( "\|" flagsField )* "," }
   vfrStatementExpression[0] ";"
   vfrFormSetList
-  E: EndIf 
+  E: EndIf
   ";"                                                  << CRT_END_OP (E); >>
   ;
 
@@ -1491,7 +1500,7 @@ vfrQuestionDataFieldName [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
   (
     SN2:StringIdentifier                            << _STRCAT (&VarIdStr, SN2->getText()); LineNo = SN2->getLine(); >>
     (
-      "."                                           << 
+      "."                                           <<
                                                        _STRCAT (&VarIdStr, ".");
                                                        if (mConstantOnlyInExpression) {
                                                          _PCATCH(VFR_RETURN_CONSTANT_ONLY, LineNo);
@@ -1518,7 +1527,7 @@ vfrQuestionDataFieldName [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
   ;
 
 vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value, BOOLEAN &ListType] :
-  <<  
+  <<
     EFI_GUID    Guid;
     BOOLEAN     Negative = FALSE;
     BOOLEAN     IntDecStyle = FALSE;
@@ -1634,11 +1643,11 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value, BOOLEAN &ListType]
   | Z:Zero                                          << $Value.u8     = _STOU8(Z->getText(), Z->getLine()); >>
   | HOUR:Number ":" MINUTE:Number ":" SECOND:Number << $Value.time   = _STOT(HOUR->getText(), MINUTE->getText(),SECOND->getText(), HOUR->getLine()); >>
   | YEAR:Number "/" MONTH:Number "/" DAY:Number     << $Value.date   = _STOD(YEAR->getText(), MONTH->getText(), DAY->getText(), YEAR->getLine()); >>
-  | QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)" 
+  | QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)"
                                                     << $Value.ref    = _STOR(QI->getText(), FI->getText(), &Guid, DP->getText(), QI->getLine()); >>
   | "STRING_TOKEN" "\(" S1:Number "\)"              << $Value.string = _STOSID(S1->getText(), S1->getLine()); >>
   | "\{"                                            << ListType = TRUE; >>
-      L1:Number                                     << 
+      L1:Number                                     <<
                                                        switch (Type) {
                                                          case EFI_IFR_TYPE_NUM_SIZE_8 :
                                                            Type8[Index]  = _STOU8(L1->getText(), L1->getLine());
@@ -1658,8 +1667,8 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value, BOOLEAN &ListType]
                                                        Index++;
                                                     >>
       (
-        "," 
-        L2:Number                                   << 
+        ","
+        L2:Number                                   <<
                                                        switch (Type) {
                                                          case EFI_IFR_TYPE_NUM_SIZE_8 :
                                                            Type8[Index]  = _STOU8(L2->getText(), L2->getLine());
@@ -1679,7 +1688,7 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value, BOOLEAN &ListType]
                                                        Index++;
                                                     >>
       )*
-    "\}"                                           
+    "\}"
   ;
 
 //*****************************************************************************
@@ -1714,7 +1723,7 @@ vfrFormDefinition :
   ;
 
 vfrFormMapDefinition :
-  << 
+  <<
     CIfrFormMap *FMapObj = NULL;
     UINT32      FormMapMethodNumber = 0;
     EFI_GUID    Guid;
@@ -1775,11 +1784,15 @@ vfrStatementDefault :
      CIfrNumeric           *NumericQst   = NULL;
 
   >>
-  D:Default                                         
+  D:Default                                         <<
+                                                        if (mIsCatchDefaultEnable) {
+                                                          DefaultValueError(VFR_RETURN_UNSUPPORTED, D->getLine());
+                                                        }
+                                                    >>
   (
     (
-      "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","  
-                                                    << 
+      "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","
+                                                    <<
                                                         if (gCurrentMinMaxData != NULL && gCurrentMinMaxData->IsNumericOpcode()) {
                                                           //check default value is valid for Numeric Opcode
                                                           NumericQst = (CIfrNumeric *) gCurrentQuestion;
@@ -1888,14 +1901,14 @@ vfrStatementDefault :
         vfrStatementValue ","                       << CIfrEnd EndObj1; EndObj1.SetLineNo(D->getLine()); >>
     )
     {
-      DefaultStore "=" SN:StringIdentifier ","      << 
+      DefaultStore "=" SN:StringIdentifier ","      <<
                                                         _PCATCH(gCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN);
                                                         if (DObj != NULL) {
-                                                          DObj->SetDefaultId (DefaultId); 
-                                                        } 
+                                                          DObj->SetDefaultId (DefaultId);
+                                                        }
 
                                                         if (DObj2 != NULL) {
-                                                          DObj2->SetDefaultId (DefaultId); 
+                                                          DObj2->SetDefaultId (DefaultId);
                                                         }
                                                     >>
     }
@@ -1917,8 +1930,8 @@ vfrStatementDefault :
                                                                    );
                                                          }
                                                        }
-                                                       if (DObj  != NULL) {delete DObj;} 
-                                                       if (DObj2 != NULL) {delete DObj2;} 
+                                                       if (DObj  != NULL) {delete DObj;}
+                                                       if (DObj2 != NULL) {delete DObj2;}
                                                     >>
   )
   ;
@@ -1970,11 +1983,15 @@ vfrStatementInvalid :
   ;
 
 flagsField :
-  Number 
-  | InteractiveFlag 
-  | ManufacturingFlag 
-  | DefaultFlag 
-  | ResetRequiredFlag 
+  Number
+  | InteractiveFlag
+  | ManufacturingFlag
+  | D:DefaultFlag                                      <<
+                                                          if (mIsCatchDefaultEnable) {
+                                                            DefaultValueError(VFR_RETURN_UNSUPPORTED, D->getLine());
+                                                          }
+                                                       >>
+  | ResetRequiredFlag
   | ReconnectRequiredFlag
   | N:NVAccessFlag                                     <<
                                                           gCVfrErrorHandle.HandleWarning (
@@ -1989,7 +2006,7 @@ flagsField :
                                                             L->getLine(),
                                                             L->getText()
                                                             );
-                                                       >> 
+                                                       >>
   ;
 
 vfrStatementValue :
@@ -2001,13 +2018,13 @@ vfrStatementValue :
 vfrStatementRead :
   << CIfrRead RObj; >>
   R:Read                                               << RObj.SetLineNo(R->getLine()); >>
-  vfrStatementExpression[0] ";" 
+  vfrStatementExpression[0] ";"
   ;
 
 vfrStatementWrite :
   << CIfrWrite WObj; >>
   W:Write                                              << WObj.SetLineNo(W->getLine()); >>
-  vfrStatementExpression[0] ";" 
+  vfrStatementExpression[0] ";"
   ;
 
 vfrStatementSubTitle :
@@ -2140,7 +2157,7 @@ vfrStatementGoto :
       FormId "=" F3:Number ","                         << RefType = 2; FId = _STOFID(F3->getText(), F3->getLine()); >>
       Question "="
       (
-          QN3:StringIdentifier ","                     << 
+          QN3:StringIdentifier ","                     <<
                                                           mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask);
                                                           if (QId == EFI_QUESTION_ID_INVALID) {
                                                             _PCATCH(VFR_RETURN_UNDEFINED, QN3);
@@ -2222,7 +2239,7 @@ vfrStatementGoto :
     "," Key "=" KN:Number                              << AssignQuestionKey (*QHObj, KN); >>
   }
   {
-    E:"," 
+    E:","
       vfrStatementQuestionOptionList                   << OHObj->SetScope(1); CRT_END_OP (E);>>
   }
   ";"                                                  << 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;}>>
@@ -2511,20 +2528,20 @@ minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
   {
     "default" "=" N:Number ","                         <<
                                                           switch (KeyValue) {
-                                                          case 0: 
+                                                          case 0:
                                                             D.Year  = _STOU16(N->getText(), N->getLine());
                                                             if (D.Year < _STOU16 (MinN->getText(), MinN->getLine()) || D.Year > _STOU16 (MaxN->getText(), MaxN->getLine())) {
                                                               _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value must be between Min year and Max year.");
                                                             }
                                                             break;
-                                                          case 1: 
-                                                            D.Month = _STOU8(N->getText(), N->getLine()); 
+                                                          case 1:
+                                                            D.Month = _STOU8(N->getText(), N->getLine());
                                                             if (D.Month < 1 || D.Month > 12) {
                                                               _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value must be between 1 and 12.");
                                                             }
                                                             break;
-                                                          case 2: 
-                                                            D.Day = _STOU8(N->getText(), N->getLine()); 
+                                                          case 2:
+                                                            D.Day = _STOU8(N->getText(), N->getLine());
                                                             if (D.Day < 1 || D.Day > 31) {
                                                               _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value must be between 1 and 31.");
                                                             }
@@ -2570,7 +2587,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
      BOOLEAN MinNegative = FALSE;
      BOOLEAN MaxNegative = FALSE;
   >>
-  Minimum   "=" 
+  Minimum   "="
   {
     "\-"                                               << MinNegative = TRUE; >>
   }
@@ -2659,8 +2676,8 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
                                                             }
                                                           }
                                                        >>
-  Maximum   "=" 
-  { 
+  Maximum   "="
+  {
     "\-"                                               << MaxNegative = TRUE; >>
   }
   A:Number ","                                         <<
@@ -2889,7 +2906,7 @@ vfrStatementNumeric :
                                                           }
                                                        >>
   vfrStatementQuestionOptionList
-  E:EndNumeric                                         << 
+  E:EndNumeric                                         <<
                                                           CRT_END_OP (E);
                                                           if (GuidObj != NULL) {
                                                             GuidObj->SetScope(1);
@@ -3131,7 +3148,7 @@ vfrStatementString :
   {
     Key "=" KN:Number ","                              << AssignQuestionKey (SObj, KN); >>
   }
-  MinSize "=" MIN:Number ","                           << 
+  MinSize "=" MIN:Number ","                           <<
                                                           VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
                                                           StringMinSize = _STOU8(MIN->getText(), MIN->getLine());
                                                           if (_STOU64(MIN->getText(), MIN->getLine()) > StringMinSize) {
@@ -3141,7 +3158,7 @@ vfrStatementString :
                                                           }
                                                           SObj.SetMinSize (StringMinSize);
                                                        >>
-  MaxSize "=" MAX:Number ","                           << 
+  MaxSize "=" MAX:Number ","                           <<
                                                           StringMaxSize = _STOU8(MAX->getText(), MAX->getLine());
                                                           if (_STOU64(MAX->getText(), MAX->getLine()) > StringMaxSize) {
                                                             _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize takes only one byte, which can't be larger than 0xFF.");
@@ -3185,7 +3202,7 @@ vfrStatementPassword :
   {
     Key "=" KN:Number ","                              << AssignQuestionKey (PObj, KN); >>
   }
-  MinSize "=" MIN:Number ","                           << 
+  MinSize "=" MIN:Number ","                           <<
                                                           VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
                                                           PasswordMinSize = _STOU16(MIN->getText(), MIN->getLine());
                                                           if (_STOU64(MIN->getText(), MIN->getLine()) > PasswordMinSize) {
@@ -3195,7 +3212,7 @@ vfrStatementPassword :
                                                           }
                                                           PObj.SetMinSize (PasswordMinSize);
                                                        >>
-  MaxSize "=" MAX:Number ","                           << 
+  MaxSize "=" MAX:Number ","                           <<
                                                           PasswordMaxSize = _STOU16(MAX->getText(), MAX->getLine());
                                                           if (_STOU64(MAX->getText(), MAX->getLine()) > PasswordMaxSize) {
                                                             _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize takes only two byte, which can't be larger than 0xFFFF.");
@@ -3230,12 +3247,12 @@ vfrStatementOrderedList :
   >>
   L:OrderedList                                        << OLObj.SetLineNo(L->getLine()); gIsOrderedList = TRUE;>>
   vfrQuestionHeader[OLObj] ","
-                                                       << 
+                                                       <<
                                                           VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
                                                           OLObj.SetMaxContainers ((UINT8) (VarArraySize > 0xFF ? 0xFF : VarArraySize));
                                                        >>
   {
-    MaxContainers "=" M:Number ","                     << 
+    MaxContainers "=" M:Number ","                     <<
                                                           if (_STOU64(M->getText(), M->getLine()) > _STOU8(M->getText(), M->getLine())) {
                                                             _PCATCH (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList MaxContainers takes only one byte, which can't be larger than 0xFF.");
                                                           } else if (VarArraySize != 0 && _STOU8(M->getText(), M->getLine()) > VarArraySize) {
@@ -3328,19 +3345,19 @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :
   {
     "default" "=" N:Number ","                         <<
                                                           switch (KeyValue) {
-                                                          case 0: 
-                                                            T.Hour   = _STOU8(N->getText(), N->getLine()); 
+                                                          case 0:
+                                                            T.Hour   = _STOU8(N->getText(), N->getLine());
                                                             if (T.Hour > 23) {
                                                               _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value must be between 0 and 23.");
                                                             }
                                                             break;
-                                                          case 1: 
-                                                            T.Minute = _STOU8(N->getText(), N->getLine()); 
+                                                          case 1:
+                                                            T.Minute = _STOU8(N->getText(), N->getLine());
                                                             if (T.Minute > 59) {
                                                               _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value must be between 0 and 59.");
                                                             }
                                                             break;
-                                                          case 2: 
+                                                          case 2:
                                                             T.Second = _STOU8(N->getText(), N->getLine());
                                                             if (T.Second > 59) {
                                                               _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value must be between 0 and 59.");
@@ -3419,11 +3436,11 @@ vfrStatementStatListOld :
   ;
 
 vfrStatementDisableIfStat :
-  << 
-    CIfrDisableIf DIObj; 
+  <<
+    CIfrDisableIf DIObj;
   >>
   L:DisableIf                                          << DIObj.SetLineNo(L->getLine()); >>
-  vfrStatementExpression[0] ";" 
+  vfrStatementExpression[0] ";"
   ( vfrStatementStatList )*
   E:EndIf                                              << CRT_END_OP (E); >>
   ";"
@@ -3548,8 +3565,8 @@ vfrStatementWarningIf :
   ;
 
 vfrStatementDisableIfQuest :
-  << 
-    CIfrDisableIf DIObj; 
+  <<
+    CIfrDisableIf DIObj;
   >>
   L:DisableIf                                          << DIObj.SetLineNo(L->getLine()); >>
   vfrStatementExpression[0] ";"
@@ -3616,15 +3633,15 @@ vfrStatementOneOfOption :
      UINT32             *Type32       = (UINT32 *) ValueList;
      UINT64             *Type64       = (UINT64 *) ValueList;
   >>
-  L:Option                                             <<      
+  L:Option                                             <<
                                                           if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
                                                             _PCATCH (VFR_RETURN_FATAL_ERROR, L->getLine(), "Get data type error.");
                                                           }
 
                                                        >>
-  Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","      
+  Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","
   Value "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","
-                                                       << 
+                                                       <<
                                                           if (gCurrentMinMaxData != NULL) {
                                                             //set min/max value for oneof opcode
                                                             UINT64 Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE(), _GET_CURRQEST_VARTINFO().mIsBitVar);
@@ -3696,7 +3713,7 @@ vfrStatementOneOfOption :
                                                           Size += OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value);
                                                           OOOObj = new CIfrOneOfOption((UINT8)Size);
                                                           OOOObj->SetLineNo(L->getLine());
-                                                          OOOObj->SetOption (_STOSID(S->getText(), S->getLine())); 
+                                                          OOOObj->SetOption (_STOSID(S->getText(), S->getLine()));
                                                           if (ArrayType) {
                                                             OOOObj->SetType (EFI_IFR_TYPE_BUFFER);
                                                           } else {
@@ -3706,7 +3723,7 @@ vfrStatementOneOfOption :
                                                               OOOObj->SetType (_GET_CURRQEST_DATATYPE());
                                                             }
                                                           }
-                                                          OOOObj->SetValue (*Val); 
+                                                          OOOObj->SetValue (*Val);
                                                        >>
   F:FLAGS "=" vfrOneOfOptionFlags[*OOOObj, F->getLine()]
                                                        <<
@@ -3790,7 +3807,12 @@ oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
   | RestStyleFlag                                      << $HFlags |= 0x20; >>
   | ReconnectRequiredFlag                              << $HFlags |= 0x40; >>
   | ManufacturingFlag                                  << $LFlags |= 0x20; >>
-  | DefaultFlag                                        << $LFlags |= 0x10; >>
+  | D:DefaultFlag                                      <<
+                                                          $LFlags |= 0x10;
+                                                          if (mIsCatchDefaultEnable) {
+                                                            DefaultValueError(VFR_RETURN_UNSUPPORTED, D->getLine());
+                                                            }
+                                                       >>
   | A:NVAccessFlag                                     <<
                                                           gCVfrErrorHandle.HandleWarning (
                                                             VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,
@@ -3963,7 +3985,7 @@ vfrStatementExpression [UINT32 RootLevel, UINT32 ExpOpCount = 0] :
                                                               }
                                                             }
                                                           }
-                                                          
+
                                                           if ($RootLevel == 0) {
                                                             _CLEAR_SAVED_OPHDR ();
                                                             mCIfrOpHdrIndex --;
@@ -4405,10 +4427,10 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
                                                             for (Index = 0; Index < ListLen; Index++) {
                                                               EILObj.SetValueList (Index, ValueList[Index]);
                                                             }
-                                                            
+
                                                             EILObj.UpdateIfrBuffer();
-                                                            _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());                                                            
-                                                            
+                                                            _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());
+
                                                             if (QId == EFI_QUESTION_ID_INVALID) {
                                                               EILObj.SetQuestionId (QId, VarIdStr, LineNo);
                                                             }
@@ -4458,9 +4480,9 @@ stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
   >>
   L:StringRef
   "\("
-      ( 
+      (
         "STRING_TOKEN"
-        "\(" 
+        "\("
           S:Number << RefStringId = _STOSID(S->getText(), S->getLine()); >>
         "\)"
         | I:Number << RefStringId = _STOSID(I->getText(), I->getLine()); >>
@@ -4499,10 +4521,10 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
      Info.mVarStoreId = 0;
   >>
   L:Get
-  "\(" 
+  "\("
       vfrStorageVarId[Info, VarIdStr, FALSE]
       {"\|" FLAGS "=" numericVarStoreType [VarType] }
-  "\)"                                                 << 
+  "\)"                                                 <<
                                                           {
                                                             if (Info.mVarStoreId == 0) {
                                                               // support Date/Time question
@@ -4549,9 +4571,9 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
                                                                 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support data array");
                                                               }
                                                             }
-                                                            CIfrGet GObj(L->getLine()); 
-                                                            _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine()); 
-                                                            GObj.SetVarInfo (&Info); 
+                                                            CIfrGet GObj(L->getLine());
+                                                            _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine());
+                                                            GObj.SetVarInfo (&Info);
                                                             delete[] VarIdStr;
                                                             $ExpOpCount++;
                                                           }
@@ -4608,7 +4630,7 @@ question23refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
       {
         Uuid "=" guidDefinition[Guid] ","                       << Type = 0x3; >>
       }
-      vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] 
+      vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
   "\)"
                                                        <<
                                                           switch (Type) {
@@ -4675,9 +4697,9 @@ setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
   "\("
      vfrStorageVarId[Info, VarIdStr, FALSE]
      {"\|" FLAG "=" numericVarStoreType [VarType] }
-     "," vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] 
+     "," vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
   "\)"
-                                                       << 
+                                                       <<
                                                           {
                                                             if (Info.mVarStoreId == 0) {
                                                               // support Date/Time question
@@ -4724,8 +4746,8 @@ setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
                                                                 _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support data array");
                                                               }
                                                             }
-                                                            CIfrSet TSObj(L->getLine()); 
-                                                            TSObj.SetVarInfo (&Info); 
+                                                            CIfrSet TSObj(L->getLine());
+                                                            TSObj.SetVarInfo (&Info);
                                                             delete[] VarIdStr;
                                                             $ExpOpCount++;
                                                           }
@@ -4808,9 +4830,9 @@ spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
   ;
 
 vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:
-  L:Map                                                   
-  "\(" 
-  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]  
+  L:Map
+  "\("
+  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
   ":"                                                     << { CIfrMap MObj(L->getLine()); } >>
   (
     vfrStatementExpression[0]
@@ -4837,6 +4859,7 @@ spanFlags [UINT8 & Flags] :
 class EfiVfrParser {
 <<
 private:
+  BOOLEAN             mIsCatchDefaultEnable;
   UINT8               mParserStatus;
   BOOLEAN             mConstantOnlyInExpression;
 
@@ -4880,6 +4903,7 @@ public:
   VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN ANTLRTokenPtr);
   VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32);
   VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);
+  VOID                DefaultValueError (IN EFI_VFR_RETURN_CODE, IN UINT32);
 
   VOID                syn     (ANTLRAbstractToken  *, ANTLRChar *, SetWordType *, ANTLRTokenType, INT32);
 
@@ -4909,6 +4933,7 @@ public:
   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);
   VOID                IdEqListDoSpecial     (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN UINT16, IN UINT16 *);
   VOID                SetOverrideClassGuid  (IN EFI_GUID *);
+  VOID                SetIsCatchDefaultEnable (BOOLEAN IsCatchDefaultEnable);
 >>
 }
 
@@ -5086,6 +5111,17 @@ EfiVfrParser::_PCATCH (
   mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, LineNum, (CHAR8 *) ErrorMsg);
 }
 
+VOID
+EfiVfrParser::DefaultValueError (
+  IN EFI_VFR_RETURN_CODE ReturnCode,
+  IN UINT32              LineNum
+  )
+{
+  CHAR8 ErrorMsg[100];
+  sprintf(ErrorMsg, "please remove the default value / defaultstore in line %d", LineNum);
+  mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, LineNum, ErrorMsg);
+}
+
 VOID
 EfiVfrParser::syn (
   ANTLRAbstractToken  *Tok,
@@ -5682,12 +5718,18 @@ EfiVfrParser::IdEqListDoSpecial (
   }
 }
 
-VOID 
+VOID
 EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID *OverrideClassGuid)
 {
   mOverrideClassGuid = OverrideClassGuid;
 }
 
+VOID
+EfiVfrParser::SetIsCatchDefaultEnable (BOOLEAN IsCatchDefaultEnable)
+{
+  mIsCatchDefaultEnable = IsCatchDefaultEnable;
+}
+
 VOID
 EfiVfrParser::CheckDuplicateDefaultValue (
   IN EFI_DEFAULT_ID      DefaultId,
-- 
2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112434): https://edk2.groups.io/g/devel/message/112434
Mute This Topic: https://groups.io/mt/103126873/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature
  2023-12-12  9:01 [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature Yuting Yang
@ 2023-12-12  9:04 ` Yuwei Chen
  2023-12-12  9:12   ` Yuting Yang
  0 siblings, 1 reply; 12+ messages in thread
From: Yuwei Chen @ 2023-12-12  9:04 UTC (permalink / raw)
  To: Yang, Yuting2, devel@edk2.groups.io
  Cc: Rebecca Cran, Gao, Liming, Feng, Bob C

+Cc Yang, Yuting2

> -----Original Message-----
> From: Yang, Yuting2 <yuting2.yang@intel.com>
> Sent: Tuesday, December 12, 2023 5:01 PM
> To: devel@edk2.groups.io
> Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>; Chen,
> Christine <yuwei.chen@intel.com>
> Subject: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature
> 
> Add --catch_default option
> Raise a DefaultValueError when encountering VFR default definitions to help
> remove default variables.
> Add --except_list option
> Exclude packages that don't require enabling the catch_default function.
> 
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Christine Chen <yuwei.chen@intel.com>
> Cc: Yuting Yang <yuting2.yang@intel.com>
> 
> Signed-off-by: Yuting Yang <yuting2.yang@intel.com>
> ---
>  BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  40 ++-
>  BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   3 +
>  BaseTools/Source/C/VfrCompile/VfrError.cpp    |   3 +-
>  BaseTools/Source/C/VfrCompile/VfrError.h      |   3 +-
>  BaseTools/Source/C/VfrCompile/VfrFormPkg.h    |   1 +
>  BaseTools/Source/C/VfrCompile/VfrSyntax.g     | 238 ++++++++++--------
>  6 files changed, 184 insertions(+), 104 deletions(-)
> 
> diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> index 5f4d262d85..e97cebff65 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> @@ -78,6 +78,9 @@ CVfrCompiler::OptionInitialization (
>    mOptions.WarningAsError                = FALSE;   mOptions.AutoDefault
> = FALSE;   mOptions.CheckDefault                  = FALSE;+
> mOptions.IsCatchDefaultEnable          = FALSE;+  mOptions.ExceptionList
> = NULL;+  mOptions.ExceptionListSize             = 0;   memset
> (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));    if (Argc == 1) {@@ -
> 95,6 +98,23 @@ CVfrCompiler::OptionInitialization (
>        Version ();       SET_RUN_STATUS (STATUS_DEAD);       return;+    } else if
> (stricmp(Argv[Index], "--catch_default") == 0){+
> mOptions.IsCatchDefaultEnable = TRUE;+    } else if (stricmp(Argv[Index], "--
> except_list") == 0){+      INT32 Start = ++Index;+      if ((Start >= Argc) ||
> (Argv[Start][0] == '-')) {+        DebugError (NULL, 0, 1001, "Missing option", "-
> exception_list missing except list");+        goto Fail;+      }+      while
> ((Argv[Index][0] != '-') && (Index < Argc - 1)) {+        Index++;+      }+      INT32
> End = Index--;+      mOptions.ExceptionListSize = End - Start;+      for (INT32 i =
> Start; i < End; i++) {+        mOptions.ExceptionList = (CHAR8**)
> realloc(mOptions.ExceptionList, (i - Start + 1) * sizeof(CHAR8*));+
> mOptions.ExceptionList[i-Start] = Argv[i];+      }     } else if (stricmp(Argv[Index],
> "-l") == 0) {       mOptions.CreateRecordListFile = TRUE;
> gCIfrRecordInfoDB.TurnOn ();@@ -179,7 +199,11 @@
> CVfrCompiler::OptionInitialization (
>        goto Fail;     }     strcpy (mOptions.VfrFileName, Argv[Index]);-+    for (int i =
> 0; i < mOptions.ExceptionListSize; i++) {+      if (strstr(mOptions.VfrFileName,
> mOptions.ExceptionList[i]) != NULL) {+        mOptions.IsCatchDefaultEnable =
> FALSE;+      }+    }     if (mOptions.OutputDirectory == NULL)
> {       mOptions.OutputDirectory = (CHAR8 *) malloc (1);       if
> (mOptions.OutputDirectory == NULL) {@@ -217,6 +241,11 @@ Fail:
>      free (mOptions.VfrFileName);     mOptions.VfrFileName                 =
> NULL;   }+  if (mOptions.ExceptionList != NULL) {+
> free(mOptions.ExceptionList);+    mOptions.ExceptionList               = NULL;++  }
> if (mOptions.VfrBaseFileName != NULL) {     free (mOptions.VfrBaseFileName);
> mOptions.VfrBaseFileName             = NULL;@@ -496,6 +525,11 @@
> CVfrCompiler::~CVfrCompiler (
>      mOptions.VfrBaseFileName = NULL;   } +  if (mOptions.ExceptionList !=
> NULL) {+    free (mOptions.ExceptionList);+    mOptions.ExceptionList =
> NULL;+  }+   if (mOptions.OutputDirectory != NULL) {     free
> (mOptions.OutputDirectory);     mOptions.OutputDirectory = NULL;@@ -679,7
> +713,7 @@ CVfrCompiler::Compile (
>      DebugError (NULL, 0, 0001, "Error opening the input file", "%s",
> InFileName);     goto Fail;   }-+  InputInfo.IsCatchDefaultEnable =
> mOptions.IsCatchDefaultEnable;   if (mOptions.HasOverrideClassGuid)
> {     InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;   } else
> {@@ -937,5 +971,3 @@ main (
>     return GetUtilityStatus (); }--diff --git
> a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> index b6e207d2ce..39e0a89a29 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> @@ -52,6 +52,9 @@ typedef struct {
>    BOOLEAN WarningAsError;   BOOLEAN AutoDefault;   BOOLEAN
> CheckDefault;+  BOOLEAN IsCatchDefaultEnable;+  CHAR8**  ExceptionList;+
> INT16    ExceptionListSize; } OPTIONS;  typedef enum {diff --git
> a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> index 65bb8e34fd..8a706f929b 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> @@ -49,7 +49,8 @@ static SVFR_WARNING_HANDLE
> VFR_WARNING_HANDLE_TABLE [] = {
>    { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value re-defined
> with different value"},   { VFR_WARNING_ACTION_WITH_TEXT_TWO, ": Action
> opcode should not have TextTwo part"},
> { VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend to
> use obsoleted framework opcode"},-  { VFR_WARNING_CODEUNDEFINED, ":
> undefined Warning Code" }+  { VFR_WARNING_CODEUNDEFINED, ":
> undefined Warning Code" },+  { VFR_WARNING_UNSUPPORTED, ": pls remove
> the default values if necessary" } };  CVfrErrorHandle::CVfrErrorHandle (diff --
> git a/BaseTools/Source/C/VfrCompile/VfrError.h
> b/BaseTools/Source/C/VfrCompile/VfrError.h
> index 7d16bd5f74..1b4bc173d2 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrError.h
> +++ b/BaseTools/Source/C/VfrCompile/VfrError.h
> @@ -47,7 +47,8 @@ typedef enum {
>    VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0,
> VFR_WARNING_ACTION_WITH_TEXT_TWO,
> VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,-
> VFR_WARNING_CODEUNDEFINED+  VFR_WARNING_CODEUNDEFINED,+
> VFR_WARNING_UNSUPPORTED } EFI_VFR_WARNING_CODE;  typedef struct
> _SVFR_ERROR_HANDLE {diff --git
> a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> index 9ef6f07787..d8fada3bcb 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> @@ -96,6 +96,7 @@ struct SBufferNode {
>   typedef struct {   EFI_GUID *OverrideClassGuid;+  BOOLEAN
> IsCatchDefaultEnable; } INPUT_INFO_TO_SYNTAX;  class CFormPkg {diff --git
> a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> index 55fd067f8a..5daf1c423c 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> @@ -50,6 +50,7 @@ VfrParserStart (
>  {   ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken> VfrParser(File);
> VfrParser.parser()->SetOverrideClassGuid (InputInfo->OverrideClassGuid);+
> VfrParser.parser()->SetIsCatchDefaultEnable(InputInfo-
> >IsCatchDefaultEnable);   return VfrParser.parser()->vfrProgram(); } >>@@ -
> 386,8 +387,8 @@ dataStructField32 [BOOLEAN  FieldInUnion]:
>    ;  dataStructField16 [BOOLEAN  FieldInUnion]:-  << -    UINT32 ArrayNum = 0;
> +  <<+    UINT32 ArrayNum = 0;   >>   ("UINT16" | "CHAR16")
> N:StringIdentifier@@ -737,7 +738,7 @@ vfrFormSetList :
>    ;  vfrStatementExtension:-  << +  <<      EFI_GUID Guid;      CIfrGuid *GuidObj
> = NULL;      CHAR8    *TypeName = NULL;@@ -751,7 +752,7 @@
> vfrStatementExtension:
>    >>   L:GuidOp   Uuid "=" guidDefinition[Guid]-  {"," DataType "=" +  {","
> DataType "="     (         U64:"UINT64" {OpenBracket AN1:Number CloseBracket
> <<ArrayNum = _STOU32(AN1->getText(), AN1->getLine());>>}
> << TypeName = U64->getText(); LineNum = U64->getLine(); >>@@ -770,7
> +771,7 @@ vfrStatementExtension:
>        | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket <<ArrayNum
> = _STOU32(AN8->getText(), AN8->getLine());>>}
> << TypeName = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>       |
> R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum =
> _STOU32(AN9->getText(), AN9->getLine());>>}-
> << TypeName = R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
> +                                                      << TypeName = R->getText(); LineNum = R-
> >getLine(); IsStruct = TRUE;>>       | TN:StringIdentifier {OpenBracket
> AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText(), AN10-
> >getLine());>>}                                                       << TypeName = TN->getText();
> LineNum = TN->getLine(); IsStruct = TRUE;>>     )@@ -875,19 +876,19 @@
> vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32
> TypeSize,
>                  memcpy (ByteOffset, &Data_U64, TypeSize);               }else if (strcmp
> ("UINT32", TypeName) == 0) {                 Data_U32 = _STOU32(RD->getText(),
> RD->getLine());-                memcpy (ByteOffset, &Data_U32, TypeSize);
> +                memcpy (ByteOffset, &Data_U32, TypeSize);               }else if (strcmp
> ("UINT16", TypeName) == 0) {                 Data_U16 = _STOU16(RD->getText(),
> RD->getLine());-                memcpy (ByteOffset, &Data_U16, TypeSize);
> +                memcpy (ByteOffset, &Data_U16, TypeSize);               }else if (strcmp
> ("UINT8", TypeName) == 0) {                 Data_U8 = _STOU8(RD->getText(), RD-
> >getLine());-                memcpy (ByteOffset, &Data_U8, TypeSize);
> +                memcpy (ByteOffset, &Data_U8, TypeSize);               }else if (strcmp
> ("BOOLEAN", TypeName)== 0) {                 Data_BL = _STOU8(RD->getText(),
> RD->getLine());-                memcpy (ByteOffset, &Data_BL, TypeSize);
> +                memcpy (ByteOffset, &Data_BL, TypeSize);               }else if (strcmp
> ("EFI_STRING_ID", TypeName) == 0) {                 Data_SID = _STOSID(RD-
> >getText(), RD->getLine());-                memcpy (ByteOffset, &Data_SID,
> TypeSize);                                                    +                memcpy (ByteOffset,
> &Data_SID, TypeSize);               }             } else
> {               gCVfrVarDataTypeDB.GetDataFieldInfo(TFName, FieldOffset,
> FieldType, FieldSize, BitField);@@ -975,7 +976,15 @@
> vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32
> TypeSize,
>   vfrStatementDefaultStore :   << UINT16  DefaultId =
> EFI_HII_DEFAULT_CLASS_STANDARD; >>-  D:DefaultStore N:StringIdentifier
> ","+  D:DefaultStore N:StringIdentifier ","             <<+
> if (mIsCatchDefaultEnable) {+
> gCVfrErrorHandle.HandleWarning (+
> VFR_WARNING_UNSUPPORTED,+                                                          D-
> >getLine(),+                                                          D-
> >getText()+                                                          );+                                                      }+
>                                                     >>   Prompt "=" "STRING_TOKEN" "\(" S:Number
> "\)"   {     "," Attribute "=" A:Number                      << DefaultId = _STOU16(A-
> >getText(), A->getLine()); >>@@ -1074,7 +1083,7 @@
> vfrStatementVarStoreEfi :
>      | U64:"UINT64" ","                              << TypeName = U64->getText();
> LineNum = U64->getLine(); >>     | D:"EFI_HII_DATE" ","                          <<
> TypeName = D->getText(); LineNum = D->getLine(); >>     | T:"EFI_HII_TIME"
> ","                          << TypeName = T->getText(); LineNum = T->getLine(); >>-    |
> R:"EFI_HII_REF" ","                           << TypeName = R->getText(); LineNum = R-
> >getLine(); >>    +    | R:"EFI_HII_REF" ","                           << TypeName = R-
> >getText(); LineNum = R->getLine(); >>   )   {     VarId "=" ID:Number ","
> <<@@ -1092,8 +1101,8 @@ vfrStatementVarStoreEfi :
>    (     Name    "=" SN:StringIdentifier ","             << StoreName = SN-
> >getText();   >>    |-    Name    "=" "STRING_TOKEN" "\(" VN:Number "\)" ","  -
> VarSize "=" N:Number ","                        << +    Name    "=" "STRING_TOKEN"
> "\(" VN:Number "\)" ","+    VarSize "=" N:Number ","                        <<
> IsUEFI23EfiVarstore = FALSE;                                                        StoreName =
> gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText(), VN-
> >getLine()));                                                        if (StoreName == NULL) {@@ -
> 1116,7 +1125,7 @@ vfrStatementVarStoreEfi :
>                                                          break;                                                        case 8:
> TypeName = (CHAR8 *) "UINT64";-                                                        break; +
> break;                                                        default:
> _PCATCH (VFR_RETURN_UNSUPPORTED, N);
> break;@@ -1124,7 +1133,7 @@ vfrStatementVarStoreEfi :
>                                                      >>   ) -  Uuid "=" guidDefinition[Guid]
> << +  Uuid "=" guidDefinition[Guid]                     <<
> if (IsUEFI23EfiVarstore)
> {                                                        _PCATCH(gCVfrDataStorage.DeclareBufferVarS
> tore (                                                                                     StoreName,@@ -1150,7
> +1159,7 @@ vfrStatementVarStoreEfi :
>                                                         }
> VSEObj.SetGuid (&Guid);                                                        VSEObj.SetVarStoreId
> (VarStoreId);-                                                       +
> VSEObj.SetSize ((UINT16) Size);
> VSEObj.SetName (StoreName);                                                        if
> (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {@@ -1184,7 +1193,7
> @@ vfrStatementVarStoreNameValue :
>                                                      >>   }   (-    Name "=" "STRING_TOKEN" "\("
> N:Number "\)" ","  << +    Name "=" "STRING_TOKEN" "\(" N:Number "\)" ","
> <<                                                        if (!Created)
> {                                                          _PCATCH(gCVfrDataStorage.DeclareNameVar
> StoreBegin (SN->getText(), VarStoreId), SN);
> Created = TRUE;@@ -1245,12 +1254,12 @@ vfrStatementDisableIfFormSet :
>  vfrStatementSuppressIfFormSet :   << CIfrSuppressIf SIObj;>>   L:SuppressIf
> <<-                                                           SIObj.SetLineNo(L->getLine()); +
> SIObj.SetLineNo(L->getLine());                                                        >>   { FLAGS "="
> flagsField ( "\|" flagsField )* "," }   vfrStatementExpression[0] ";"
> vfrFormSetList-  E: EndIf +  E: EndIf   ";"                                                  <<
> CRT_END_OP (E); >>   ; @@ -1491,7 +1500,7 @@ vfrQuestionDataFieldName
> [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
>    (     SN2:StringIdentifier                            << _STRCAT (&VarIdStr, SN2-
> >getText()); LineNo = SN2->getLine(); >>     (-      "."                                           << +
> "."                                           <<                                                        _STRCAT
> (&VarIdStr, ".");                                                        if
> (mConstantOnlyInExpression)
> {                                                          _PCATCH(VFR_RETURN_CONSTANT_ONLY,
> LineNo);@@ -1518,7 +1527,7 @@ vfrQuestionDataFieldName
> [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
>    ;  vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> BOOLEAN &ListType] :-  <<  +  <<     EFI_GUID    Guid;     BOOLEAN     Negative =
> FALSE;     BOOLEAN     IntDecStyle = FALSE;@@ -1634,11 +1643,11 @@
> vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value, BOOLEAN
> &ListType]
>    | Z:Zero                                          << $Value.u8     = _STOU8(Z->getText(), Z-
> >getLine()); >>   | HOUR:Number ":" MINUTE:Number ":" SECOND:Number <<
> $Value.time   = _STOT(HOUR->getText(), MINUTE->getText(),SECOND-
> >getText(), HOUR->getLine()); >>   | YEAR:Number "/" MONTH:Number "/"
> DAY:Number     << $Value.date   = _STOD(YEAR->getText(), MONTH->getText(),
> DAY->getText(), YEAR->getLine()); >>-  | QI:Number";" FI:Number";"
> guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)" +  |
> QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\("
> DP:Number "\)"                                                     << $Value.ref    = _STOR(QI-
> >getText(), FI->getText(), &Guid, DP->getText(), QI->getLine()); >>   |
> "STRING_TOKEN" "\(" S1:Number "\)"              << $Value.string = _STOSID(S1-
> >getText(), S1->getLine()); >>   | "\{"                                            << ListType =
> TRUE; >>-      L1:Number                                     << +      L1:Number
> <<                                                        switch (Type)
> {                                                          case EFI_IFR_TYPE_NUM_SIZE_8 :
> Type8[Index]  = _STOU8(L1->getText(), L1->getLine());@@ -1658,8 +1667,8
> @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> BOOLEAN &ListType]
>                                                         Index++;                                                     >>       (-
> "," -        L2:Number                                   << +        ","+        L2:Number
> <<                                                        switch (Type)
> {                                                          case EFI_IFR_TYPE_NUM_SIZE_8 :
> Type8[Index]  = _STOU8(L2->getText(), L2->getLine());@@ -1679,7 +1688,7
> @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> BOOLEAN &ListType]
> 
> Index++;                                                     >>       )*-    "\}"                                           +
> "\}"   ;
> //**************************************************************
> ***************@@ -1714,7 +1723,7 @@ vfrFormDefinition :
>    ;  vfrFormMapDefinition :-  << +  <<     CIfrFormMap *FMapObj = NULL;
> UINT32      FormMapMethodNumber = 0;     EFI_GUID    Guid;@@ -1775,11
> +1784,15 @@ vfrStatementDefault :
>       CIfrNumeric           *NumericQst   = NULL;    >>-  D:Default
> +  D:Default                                         <<+                                                        if
> (mIsCatchDefaultEnable) {+
> DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> >getLine());+                                                        }+                                                    >>
> (     (-      "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val,
> ArrayType] ","  -                                                    << +      "="
> vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","+
> <<                                                         if (gCurrentMinMaxData != NULL &&
> gCurrentMinMaxData->IsNumericOpcode())
> {                                                           //check default value is valid for Numeric
> Opcode                                                           NumericQst = (CIfrNumeric *)
> gCurrentQuestion;@@ -1888,14 +1901,14 @@ vfrStatementDefault :
>          vfrStatementValue ","                       << CIfrEnd EndObj1;
> EndObj1.SetLineNo(D->getLine()); >>     )     {-      DefaultStore "="
> SN:StringIdentifier ","      << +      DefaultStore "=" SN:StringIdentifier ","      <<
> _PCATCH(gCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN);
> if (DObj != NULL) {-                                                          DObj->SetDefaultId
> (DefaultId); -                                                        } +
> DObj->SetDefaultId (DefaultId);+                                                        }
> if (DObj2 != NULL) {-                                                          DObj2->SetDefaultId
> (DefaultId); +                                                          DObj2->SetDefaultId
> (DefaultId);                                                         }                                                     >>
>  }@@ -1917,8 +1930,8 @@ vfrStatementDefault :
>                                                                     );                                                          }
>                                              }-                                                       if (DObj  != NULL)
> {delete DObj;} -                                                       if (DObj2 != NULL) {delete
> DObj2;} +                                                       if (DObj  != NULL) {delete DObj;}+
> if (DObj2 != NULL) {delete DObj2;}                                                     >>   )   ;@@ -
> 1970,11 +1983,15 @@ vfrStatementInvalid :
>    ;  flagsField :-  Number -  | InteractiveFlag -  | ManufacturingFlag -  |
> DefaultFlag -  | ResetRequiredFlag +  Number+  | InteractiveFlag+  |
> ManufacturingFlag+  | D:DefaultFlag                                      <<+
> if (mIsCatchDefaultEnable) {+
> DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> >getLine());+                                                          }+
> >>+  | ResetRequiredFlag   | ReconnectRequiredFlag   | N:NVAccessFlag
> <<                                                           gCVfrErrorHandle.HandleWarning (@@ -
> 1989,7 +2006,7 @@ flagsField :
>                                                              L->getLine(),
> L->getText()                                                             );-
>                                                        >> +                                                       >>   ;
> vfrStatementValue :@@ -2001,13 +2018,13 @@ vfrStatementValue :
>  vfrStatementRead :   << CIfrRead RObj; >>   R:Read
> << RObj.SetLineNo(R->getLine()); >>-  vfrStatementExpression[0] ";" +
> vfrStatementExpression[0] ";"   ;  vfrStatementWrite :   << CIfrWrite WObj; >>
> W:Write                                              << WObj.SetLineNo(W->getLine()); >>-
> vfrStatementExpression[0] ";" +  vfrStatementExpression[0] ";"   ;
> vfrStatementSubTitle :@@ -2140,7 +2157,7 @@ vfrStatementGoto :
>        FormId "=" F3:Number ","                         << RefType = 2; FId = _STOFID(F3-
> >getText(), F3->getLine()); >>       Question "="       (-          QN3:StringIdentifier
> ","                     << +          QN3:StringIdentifier ","                     <<
> mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask);
> if (QId == EFI_QUESTION_ID_INVALID)
> {                                                             _PCATCH(VFR_RETURN_UNDEFINED,
> QN3);@@ -2222,7 +2239,7 @@ vfrStatementGoto :
>      "," Key "=" KN:Number                              << AssignQuestionKey (*QHObj,
> KN); >>   }   {-    E:"," +    E:","       vfrStatementQuestionOptionList                   <<
> OHObj->SetScope(1); CRT_END_OP (E);>>   }   ";"
> << 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;}>>@@ -2511,20 +2528,20 @@
> minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
>    {     "default" "=" N:Number ","                         <<
> switch (KeyValue) {-                                                          case 0: +
> case 0:                                                             D.Year  = _STOU16(N->getText(), N-
> >getLine());                                                             if (D.Year < _STOU16 (MinN-
> >getText(), MinN->getLine()) || D.Year > _STOU16 (MaxN->getText(), MaxN-
> >getLine())) {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value must
> be between Min year and Max year.");                                                             }
> break;-                                                          case 1: -
> D.Month = _STOU8(N->getText(), N->getLine()); +
> case 1:+                                                            D.Month = _STOU8(N->getText(), N-
> >getLine());                                                             if (D.Month < 1 || D.Month > 12)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value
> must be between 1 and 12.");                                                             }
> break;-                                                          case 2: -
> D.Day = _STOU8(N->getText(), N->getLine()); +
> case 2:+                                                            D.Day = _STOU8(N->getText(), N-
> >getLine());                                                             if (D.Day < 1 || D.Day > 31)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value must
> be between 1 and 31.");                                                             }@@ -2570,7
> +2587,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
>       BOOLEAN MinNegative = FALSE;      BOOLEAN MaxNegative = FALSE;   >>-
> Minimum   "=" +  Minimum   "="   {     "\-"                                               <<
> MinNegative = TRUE; >>   }@@ -2659,8 +2676,8 @@
> vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
>                                                              }                                                           }
>                                       >>-  Maximum   "=" -  { +  Maximum   "="+  {     "\-"
> << MaxNegative = TRUE; >>   }   A:Number ","                                         <<@@ -
> 2889,7 +2906,7 @@ vfrStatementNumeric :
>                                                            }                                                        >>
> vfrStatementQuestionOptionList-  E:EndNumeric                                         << +
> E:EndNumeric                                         <<
> CRT_END_OP (E);                                                           if (GuidObj != NULL)
> {                                                             GuidObj->SetScope(1);@@ -3131,7
> +3148,7 @@ vfrStatementString :
>    {     Key "=" KN:Number ","                              << AssignQuestionKey (SObj,
> KN); >>   }-  MinSize "=" MIN:Number ","                           << +  MinSize "="
> MIN:Number ","                           <<
> VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
> StringMinSize = _STOU8(MIN->getText(), MIN->getLine());
> if (_STOU64(MIN->getText(), MIN->getLine()) > StringMinSize) {@@ -3141,7
> +3158,7 @@ vfrStatementString :
>                                                            }
> SObj.SetMinSize (StringMinSize);                                                        >>-  MaxSize
> "=" MAX:Number ","                           << +  MaxSize "=" MAX:Number ","
> <<                                                           StringMaxSize = _STOU8(MAX->getText(),
> MAX->getLine());                                                           if (_STOU64(MAX-
> >getText(), MAX->getLine()) > StringMaxSize)
> {                                                             _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize takes
> only one byte, which can't be larger than 0xFF.");@@ -3185,7 +3202,7 @@
> vfrStatementPassword :
>    {     Key "=" KN:Number ","                              << AssignQuestionKey (PObj,
> KN); >>   }-  MinSize "=" MIN:Number ","                           << +  MinSize "="
> MIN:Number ","                           <<
> VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
> PasswordMinSize = _STOU16(MIN->getText(), MIN->getLine());
> if (_STOU64(MIN->getText(), MIN->getLine()) > PasswordMinSize) {@@ -
> 3195,7 +3212,7 @@ vfrStatementPassword :
>                                                            }
> PObj.SetMinSize (PasswordMinSize);                                                        >>-
> MaxSize "=" MAX:Number ","                           << +  MaxSize "=" MAX:Number
> ","                           <<                                                           PasswordMaxSize =
> _STOU16(MAX->getText(), MAX->getLine());                                                           if
> (_STOU64(MAX->getText(), MAX->getLine()) > PasswordMaxSize)
> {                                                             _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize
> takes only two byte, which can't be larger than 0xFFFF.");@@ -3230,12
> +3247,12 @@ vfrStatementOrderedList :
>    >>   L:OrderedList                                        << OLObj.SetLineNo(L->getLine());
> gIsOrderedList = TRUE;>>   vfrQuestionHeader[OLObj] ","-
> << +                                                       <<
> VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
> OLObj.SetMaxContainers ((UINT8) (VarArraySize > 0xFF ? 0xFF :
> VarArraySize));                                                        >>   {-    MaxContainers "="
> M:Number ","                     << +    MaxContainers "=" M:Number ","
> <<                                                           if (_STOU64(M->getText(), M->getLine()) >
> _STOU8(M->getText(), M->getLine()))
> {                                                             _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList
> MaxContainers takes only one byte, which can't be larger than
> 0xFF.");                                                           } else if (VarArraySize != 0 &&
> _STOU8(M->getText(), M->getLine()) > VarArraySize) {@@ -3328,19 +3345,19
> @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :
>    {     "default" "=" N:Number ","                         <<
> switch (KeyValue) {-                                                          case 0: -
> T.Hour   = _STOU8(N->getText(), N->getLine()); +
> case 0:+                                                            T.Hour   = _STOU8(N->getText(), N-
> >getLine());                                                             if (T.Hour > 23)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value must
> be between 0 and 23.");                                                             }
> break;-                                                          case 1: -
> T.Minute = _STOU8(N->getText(), N->getLine()); +
> case 1:+                                                            T.Minute = _STOU8(N->getText(), N-
> >getLine());                                                             if (T.Minute > 59)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value
> must be between 0 and 59.");                                                             }
> break;-                                                          case 2: +
> case 2:                                                             T.Second = _STOU8(N->getText(), N-
> >getLine());                                                             if (T.Second > 59)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value
> must be between 0 and 59.");@@ -3419,11 +3436,11 @@
> vfrStatementStatListOld :
>    ;  vfrStatementDisableIfStat :-  << -    CIfrDisableIf DIObj; +  <<+
> CIfrDisableIf DIObj;   >>   L:DisableIf                                          <<
> DIObj.SetLineNo(L->getLine()); >>-  vfrStatementExpression[0] ";" +
> vfrStatementExpression[0] ";"   ( vfrStatementStatList )*   E:EndIf
> << CRT_END_OP (E); >>   ";"@@ -3548,8 +3565,8 @@
> vfrStatementWarningIf :
>    ;  vfrStatementDisableIfQuest :-  << -    CIfrDisableIf DIObj; +  <<+
> CIfrDisableIf DIObj;   >>   L:DisableIf                                          <<
> DIObj.SetLineNo(L->getLine()); >>   vfrStatementExpression[0] ";"@@ -
> 3616,15 +3633,15 @@ vfrStatementOneOfOption :
>       UINT32             *Type32       = (UINT32 *) ValueList;      UINT64
> *Type64       = (UINT64 *) ValueList;   >>-  L:Option                                             <<
> +  L:Option                                             <<                                                           if
> (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER)
> {                                                             _PCATCH (VFR_RETURN_FATAL_ERROR, L-
> >getLine(), "Get data type
> error.");                                                           }                                                         >>-
> Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","      +  Text  "="
> "STRING_TOKEN" "\(" S:Number "\)" ","   Value "="
> vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","-
> << +                                                       <<                                                           if
> (gCurrentMinMaxData != NULL) {                                                             //set
> min/max value for oneof opcode                                                             UINT64
> Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE(),
> _GET_CURRQEST_VARTINFO().mIsBitVar);@@ -3696,7 +3713,7 @@
> vfrStatementOneOfOption :
>                                                            Size += OFFSET_OF
> (EFI_IFR_ONE_OF_OPTION, Value);                                                           OOOObj =
> new CIfrOneOfOption((UINT8)Size);                                                           OOOObj-
> >SetLineNo(L->getLine());-                                                          OOOObj-
> >SetOption (_STOSID(S->getText(), S->getLine())); +
> OOOObj->SetOption (_STOSID(S->getText(), S->getLine()));
> if (ArrayType) {                                                             OOOObj->SetType
> (EFI_IFR_TYPE_BUFFER);                                                           } else {@@ -3706,7
> +3723,7 @@ vfrStatementOneOfOption :
>                                                                OOOObj->SetType
> (_GET_CURRQEST_DATATYPE());                                                             }
>                                       }-                                                          OOOObj->SetValue
> (*Val); +                                                          OOOObj->SetValue
> (*Val);                                                        >>   F:FLAGS "="
> vfrOneOfOptionFlags[*OOOObj, F->getLine()]
> <<@@ -3790,7 +3807,12 @@ oneofoptionFlagsField [UINT8 & HFlags, UINT8
> & LFlags] :
>    | RestStyleFlag                                      << $HFlags |= 0x20; >>   |
> ReconnectRequiredFlag                              << $HFlags |= 0x40; >>   |
> ManufacturingFlag                                  << $LFlags |= 0x20; >>-  | DefaultFlag
> << $LFlags |= 0x10; >>+  | D:DefaultFlag                                      <<+
> $LFlags |= 0x10;+                                                          if (mIsCatchDefaultEnable)
> {+
> DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> >getLine());+                                                            }+
>  >>   | A:NVAccessFlag                                     <<
> gCVfrErrorHandle.HandleWarning
> (                                                             VFR_WARNING_OBSOLETED_FRAMEWORK
> _OPCODE,@@ -3963,7 +3985,7 @@ vfrStatementExpression [UINT32
> RootLevel, UINT32 ExpOpCount = 0] :
>                                                                }                                                             }
>                                              }-                                                          +
> if ($RootLevel == 0) {                                                             _CLEAR_SAVED_OPHDR
> ();                                                             mCIfrOpHdrIndex --;@@ -4405,10
> +4427,10 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>                                                              for (Index = 0; Index < ListLen; Index++)
> {                                                               EILObj.SetValueList (Index,
> ValueList[Index]);                                                             }-
> +                                                             EILObj.UpdateIfrBuffer();-
> _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());
> -                                                            +
> _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());+
> if (QId == EFI_QUESTION_ID_INVALID)
> {                                                               EILObj.SetQuestionId (QId, VarIdStr,
> LineNo);                                                             }@@ -4458,9 +4480,9 @@
> stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>    >>   L:StringRef   "\("-      ( +      (         "STRING_TOKEN"-        "\(" +        "\("
> S:Number << RefStringId = _STOSID(S->getText(), S->getLine()); >>         "\)"
> | I:Number << RefStringId = _STOSID(I->getText(), I->getLine()); >>@@ -
> 4499,10 +4521,10 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>       Info.mVarStoreId = 0;   >>   L:Get-  "\(" +  "\("       vfrStorageVarId[Info,
> VarIdStr, FALSE]       {"\|" FLAGS "=" numericVarStoreType [VarType] }-  "\)"
> << +  "\)"                                                 <<
> {                                                             if (Info.mVarStoreId == 0)
> {                                                               // support Date/Time question@@ -
> 4549,9 +4571,9 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>                                                                  _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> >getLine(), "Get/Set opcode don't support data
> array");                                                               }                                                             }
> -                                                            CIfrGet GObj(L->getLine()); -
> _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine()); -
> GObj.SetVarInfo (&Info); +                                                            CIfrGet GObj(L-
> >getLine());+                                                            _SAVE_OPHDR_COND (GObj,
> ($ExpOpCount == 0), L->getLine());+
> GObj.SetVarInfo (&Info);                                                             delete[] VarIdStr;
> $ExpOpCount++;                                                           }@@ -4608,7 +4630,7 @@
> question23refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>        {         Uuid "=" guidDefinition[Guid] ","                       << Type = 0x3; >>       }-
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"
> <<                                                           switch (Type) {@@ -4675,9 +4697,9 @@
> setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>    "\("      vfrStorageVarId[Info, VarIdStr, FALSE]      {"\|" FLAG "="
> numericVarStoreType [VarType] }-     ","
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +     ","
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"-
> << +                                                       <<
> {                                                             if (Info.mVarStoreId == 0)
> {                                                               // support Date/Time question@@ -
> 4724,8 +4746,8 @@ setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>                                                                  _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> >getLine(), "Get/Set opcode don't support data
> array");                                                               }                                                             }
> -                                                            CIfrSet TSObj(L->getLine()); -
> TSObj.SetVarInfo (&Info); +                                                            CIfrSet TSObj(L-
> >getLine());+                                                            TSObj.SetVarInfo (&Info);
> delete[] VarIdStr;
> $ExpOpCount++;                                                           }@@ -4808,9 +4830,9 @@
> spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>    ;  vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:-  L:Map
> -  "\(" -  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]  +  L:Map+
> "\("+  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   ":"
> << { CIfrMap MObj(L->getLine()); } >>   (     vfrStatementExpression[0]@@ -
> 4837,6 +4859,7 @@ spanFlags [UINT8 & Flags] :
>  class EfiVfrParser { << private:+  BOOLEAN             mIsCatchDefaultEnable;
> UINT8               mParserStatus;   BOOLEAN             mConstantOnlyInExpression;
> @@ -4880,6 +4903,7 @@ public:
>    VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN ANTLRTokenPtr);
> VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32);   VOID
> _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);+  VOID
> DefaultValueError (IN EFI_VFR_RETURN_CODE, IN UINT32);    VOID
> syn     (ANTLRAbstractToken  *, ANTLRChar *, SetWordType *,
> ANTLRTokenType, INT32); @@ -4909,6 +4933,7 @@ public:
>    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);   VOID                IdEqListDoSpecial     (IN
> UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN
> UINT16, IN UINT16 *);   VOID                SetOverrideClassGuid  (IN EFI_GUID *);+
> VOID                SetIsCatchDefaultEnable (BOOLEAN IsCatchDefaultEnable); >> }
> @@ -5086,6 +5111,17 @@ EfiVfrParser::_PCATCH (
>    mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError
> (ReturnCode, LineNum, (CHAR8 *) ErrorMsg); }
> +VOID+EfiVfrParser::DefaultValueError (+  IN EFI_VFR_RETURN_CODE
> ReturnCode,+  IN UINT32              LineNum+  )+{+  CHAR8 ErrorMsg[100];+
> sprintf(ErrorMsg, "please remove the default value / defaultstore in line %d",
> LineNum);+  mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError
> (ReturnCode, LineNum, ErrorMsg);+}+ VOID EfiVfrParser::syn
> (   ANTLRAbstractToken  *Tok,@@ -5682,12 +5718,18 @@
> EfiVfrParser::IdEqListDoSpecial (
>    } } -VOID +VOID EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID
> *OverrideClassGuid) {   mOverrideClassGuid = OverrideClassGuid; }
> +VOID+EfiVfrParser::SetIsCatchDefaultEnable (BOOLEAN
> IsCatchDefaultEnable)+{+  mIsCatchDefaultEnable = IsCatchDefaultEnable;+}+
> VOID EfiVfrParser::CheckDuplicateDefaultValue (   IN EFI_DEFAULT_ID
> DefaultId,--
> 2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112364): https://edk2.groups.io/g/devel/message/112364
Mute This Topic: https://groups.io/mt/103126873/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature
  2023-12-12  9:04 ` Yuwei Chen
@ 2023-12-12  9:12   ` Yuting Yang
  2023-12-21  6:43     ` Zhang, Zifeng
  0 siblings, 1 reply; 12+ messages in thread
From: Yuting Yang @ 2023-12-12  9:12 UTC (permalink / raw)
  To: Zhang, Zifeng, Chen, Arthur G, devel@edk2.groups.io
  Cc: Rebecca Cran, Gao, Liming, Feng, Bob C

+Cc Zhang, Zifeng, Chen, Arthur G

-----Original Message-----
From: Chen, Christine <yuwei.chen@intel.com> 
Sent: Tuesday, December 12, 2023 5:04 PM
To: Yang, Yuting2 <yuting2.yang@intel.com>; devel@edk2.groups.io
Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature

+Cc Yang, Yuting2

> -----Original Message-----
> From: Yang, Yuting2 <yuting2.yang@intel.com>
> Sent: Tuesday, December 12, 2023 5:01 PM
> To: devel@edk2.groups.io
> Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>; Chen, 
> Christine <yuwei.chen@intel.com>
> Subject: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> Add --catch_default option
> Raise a DefaultValueError when encountering VFR default definitions to 
> help remove default variables.
> Add --except_list option
> Exclude packages that don't require enabling the catch_default function.
> 
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Christine Chen <yuwei.chen@intel.com>
> Cc: Yuting Yang <yuting2.yang@intel.com>
> 
> Signed-off-by: Yuting Yang <yuting2.yang@intel.com>
> ---
>  BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  40 ++-
>  BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   3 +
>  BaseTools/Source/C/VfrCompile/VfrError.cpp    |   3 +-
>  BaseTools/Source/C/VfrCompile/VfrError.h      |   3 +-
>  BaseTools/Source/C/VfrCompile/VfrFormPkg.h    |   1 +
>  BaseTools/Source/C/VfrCompile/VfrSyntax.g     | 238 ++++++++++--------
>  6 files changed, 184 insertions(+), 104 deletions(-)
> 
> diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> index 5f4d262d85..e97cebff65 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> @@ -78,6 +78,9 @@ CVfrCompiler::OptionInitialization (
>    mOptions.WarningAsError                = FALSE;   mOptions.AutoDefault
> = FALSE;   mOptions.CheckDefault                  = FALSE;+
> mOptions.IsCatchDefaultEnable          = FALSE;+  mOptions.ExceptionList
> = NULL;+  mOptions.ExceptionListSize             = 0;   memset
> (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));    if (Argc == 1) {@@ -
> 95,6 +98,23 @@ CVfrCompiler::OptionInitialization (
>        Version ();       SET_RUN_STATUS (STATUS_DEAD);       return;+    } else if
> (stricmp(Argv[Index], "--catch_default") == 0){+
> mOptions.IsCatchDefaultEnable = TRUE;+    } else if (stricmp(Argv[Index], "--
> except_list") == 0){+      INT32 Start = ++Index;+      if ((Start >= Argc) ||
> (Argv[Start][0] == '-')) {+        DebugError (NULL, 0, 1001, "Missing option", "-
> exception_list missing except list");+        goto Fail;+      }+      while
> ((Argv[Index][0] != '-') && (Index < Argc - 1)) {+        Index++;+      }+      INT32
> End = Index--;+      mOptions.ExceptionListSize = End - Start;+      for (INT32 i =
> Start; i < End; i++) {+        mOptions.ExceptionList = (CHAR8**)
> realloc(mOptions.ExceptionList, (i - Start + 1) * sizeof(CHAR8*));+
> mOptions.ExceptionList[i-Start] = Argv[i];+      }     } else if (stricmp(Argv[Index],
> "-l") == 0) {       mOptions.CreateRecordListFile = TRUE;
> gCIfrRecordInfoDB.TurnOn ();@@ -179,7 +199,11 @@ 
> CVfrCompiler::OptionInitialization (
>        goto Fail;     }     strcpy (mOptions.VfrFileName, Argv[Index]);-+    for (int i =
> 0; i < mOptions.ExceptionListSize; i++) {+      if (strstr(mOptions.VfrFileName,
> mOptions.ExceptionList[i]) != NULL) {+        mOptions.IsCatchDefaultEnable =
> FALSE;+      }+    }     if (mOptions.OutputDirectory == NULL)
> {       mOptions.OutputDirectory = (CHAR8 *) malloc (1);       if
> (mOptions.OutputDirectory == NULL) {@@ -217,6 +241,11 @@ Fail:
>      free (mOptions.VfrFileName);     mOptions.VfrFileName                 =
> NULL;   }+  if (mOptions.ExceptionList != NULL) {+
> free(mOptions.ExceptionList);+    mOptions.ExceptionList               = NULL;++  }
> if (mOptions.VfrBaseFileName != NULL) {     free (mOptions.VfrBaseFileName);
> mOptions.VfrBaseFileName             = NULL;@@ -496,6 +525,11 @@
> CVfrCompiler::~CVfrCompiler (
>      mOptions.VfrBaseFileName = NULL;   } +  if (mOptions.ExceptionList !=
> NULL) {+    free (mOptions.ExceptionList);+    mOptions.ExceptionList =
> NULL;+  }+   if (mOptions.OutputDirectory != NULL) {     free
> (mOptions.OutputDirectory);     mOptions.OutputDirectory = NULL;@@ -679,7
> +713,7 @@ CVfrCompiler::Compile (
>      DebugError (NULL, 0, 0001, "Error opening the input file", "%s",
> InFileName);     goto Fail;   }-+  InputInfo.IsCatchDefaultEnable =
> mOptions.IsCatchDefaultEnable;   if (mOptions.HasOverrideClassGuid)
> {     InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;   } else
> {@@ -937,5 +971,3 @@ main (
>     return GetUtilityStatus (); }--diff --git 
> a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> index b6e207d2ce..39e0a89a29 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> @@ -52,6 +52,9 @@ typedef struct {
>    BOOLEAN WarningAsError;   BOOLEAN AutoDefault;   BOOLEAN
> CheckDefault;+  BOOLEAN IsCatchDefaultEnable;+  CHAR8**  ExceptionList;+
> INT16    ExceptionListSize; } OPTIONS;  typedef enum {diff --git
> a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> index 65bb8e34fd..8a706f929b 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> @@ -49,7 +49,8 @@ static SVFR_WARNING_HANDLE VFR_WARNING_HANDLE_TABLE 
> [] = {
>    { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value re-defined
> with different value"},   { VFR_WARNING_ACTION_WITH_TEXT_TWO, ": Action
> opcode should not have TextTwo part"}, { 
> VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend to use 
> obsoleted framework opcode"},-  { VFR_WARNING_CODEUNDEFINED, ":
> undefined Warning Code" }+  { VFR_WARNING_CODEUNDEFINED, ":
> undefined Warning Code" },+  { VFR_WARNING_UNSUPPORTED, ": pls remove 
> the default values if necessary" } };  
> CVfrErrorHandle::CVfrErrorHandle (diff -- git 
> a/BaseTools/Source/C/VfrCompile/VfrError.h
> b/BaseTools/Source/C/VfrCompile/VfrError.h
> index 7d16bd5f74..1b4bc173d2 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrError.h
> +++ b/BaseTools/Source/C/VfrCompile/VfrError.h
> @@ -47,7 +47,8 @@ typedef enum {
>    VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0, 
> VFR_WARNING_ACTION_WITH_TEXT_TWO,
> VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,-
> VFR_WARNING_CODEUNDEFINED+  VFR_WARNING_CODEUNDEFINED,+ 
> VFR_WARNING_UNSUPPORTED } EFI_VFR_WARNING_CODE;  typedef struct 
> _SVFR_ERROR_HANDLE {diff --git 
> a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> index 9ef6f07787..d8fada3bcb 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> @@ -96,6 +96,7 @@ struct SBufferNode {
>   typedef struct {   EFI_GUID *OverrideClassGuid;+  BOOLEAN
> IsCatchDefaultEnable; } INPUT_INFO_TO_SYNTAX;  class CFormPkg {diff 
> --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> index 55fd067f8a..5daf1c423c 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> @@ -50,6 +50,7 @@ VfrParserStart (
>  {   ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken> VfrParser(File);
> VfrParser.parser()->SetOverrideClassGuid 
> (InputInfo->OverrideClassGuid);+
> VfrParser.parser()->SetIsCatchDefaultEnable(InputInfo-
> >IsCatchDefaultEnable);   return VfrParser.parser()->vfrProgram(); } >>@@ -
> 386,8 +387,8 @@ dataStructField32 [BOOLEAN  FieldInUnion]:
>    ;  dataStructField16 [BOOLEAN  FieldInUnion]:-  << -    UINT32 ArrayNum = 0;
> +  <<+    UINT32 ArrayNum = 0;   >>   ("UINT16" | "CHAR16")
> N:StringIdentifier@@ -737,7 +738,7 @@ vfrFormSetList :
>    ;  vfrStatementExtension:-  << +  <<      EFI_GUID Guid;      CIfrGuid *GuidObj
> = NULL;      CHAR8    *TypeName = NULL;@@ -751,7 +752,7 @@
> vfrStatementExtension:
>    >>   L:GuidOp   Uuid "=" guidDefinition[Guid]-  {"," DataType "=" +  {","
> DataType "="     (         U64:"UINT64" {OpenBracket AN1:Number CloseBracket
> <<ArrayNum = _STOU32(AN1->getText(), AN1->getLine());>>} << TypeName = 
> U64->getText(); LineNum = U64->getLine(); >>@@ -770,7
> +771,7 @@ vfrStatementExtension:
>        | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket 
> <<ArrayNum = _STOU32(AN8->getText(), AN8->getLine());>>}
> << TypeName = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>       |
> R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = 
> _STOU32(AN9->getText(), AN9->getLine());>>}- << TypeName = 
> R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
> +                                                      << TypeName = 
> + R->getText(); LineNum = R-
> >getLine(); IsStruct = TRUE;>>       | TN:StringIdentifier {OpenBracket
> AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText(), AN10-
> >getLine());>>}                                                       << TypeName = TN->getText();
> LineNum = TN->getLine(); IsStruct = TRUE;>>     )@@ -875,19 +876,19 @@
> vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 
> TypeSize,
>                  memcpy (ByteOffset, &Data_U64, TypeSize);               }else if (strcmp
> ("UINT32", TypeName) == 0) {                 Data_U32 = _STOU32(RD->getText(),
> RD->getLine());-                memcpy (ByteOffset, &Data_U32, TypeSize);
> +                memcpy (ByteOffset, &Data_U32, TypeSize);               }else if (strcmp
> ("UINT16", TypeName) == 0) {                 Data_U16 = _STOU16(RD->getText(),
> RD->getLine());-                memcpy (ByteOffset, &Data_U16, TypeSize);
> +                memcpy (ByteOffset, &Data_U16, TypeSize);               }else if (strcmp
> ("UINT8", TypeName) == 0) {                 Data_U8 = _STOU8(RD->getText(), RD-
> >getLine());-                memcpy (ByteOffset, &Data_U8, TypeSize);
> +                memcpy (ByteOffset, &Data_U8, TypeSize);               }else if (strcmp
> ("BOOLEAN", TypeName)== 0) {                 Data_BL = _STOU8(RD->getText(),
> RD->getLine());-                memcpy (ByteOffset, &Data_BL, TypeSize);
> +                memcpy (ByteOffset, &Data_BL, TypeSize);               }else if (strcmp
> ("EFI_STRING_ID", TypeName) == 0) {                 Data_SID = _STOSID(RD-
> >getText(), RD->getLine());-                memcpy (ByteOffset, &Data_SID,
> TypeSize);                                                    +                memcpy (ByteOffset,
> &Data_SID, TypeSize);               }             } else
> {               gCVfrVarDataTypeDB.GetDataFieldInfo(TFName, FieldOffset,
> FieldType, FieldSize, BitField);@@ -975,7 +976,15 @@
> vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 
> TypeSize,
>   vfrStatementDefaultStore :   << UINT16  DefaultId =
> EFI_HII_DEFAULT_CLASS_STANDARD; >>-  D:DefaultStore N:StringIdentifier
> ","+  D:DefaultStore N:StringIdentifier ","             <<+
> if (mIsCatchDefaultEnable) {+
> gCVfrErrorHandle.HandleWarning (+
> VFR_WARNING_UNSUPPORTED,+                                                          D-
> >getLine(),+                                                          D-
> >getText()+                                                          );+                                                      }+
>                                                     >>   Prompt "=" "STRING_TOKEN" "\(" S:Number
> "\)"   {     "," Attribute "=" A:Number                      << DefaultId = _STOU16(A-
> >getText(), A->getLine()); >>@@ -1074,7 +1083,7 @@
> vfrStatementVarStoreEfi :
>      | U64:"UINT64" ","                              << TypeName = U64->getText();
> LineNum = U64->getLine(); >>     | D:"EFI_HII_DATE" ","                          <<
> TypeName = D->getText(); LineNum = D->getLine(); >>     | T:"EFI_HII_TIME"
> ","                          << TypeName = T->getText(); LineNum = T->getLine(); >>-    |
> R:"EFI_HII_REF" ","                           << TypeName = R->getText(); LineNum = R-
> >getLine(); >>    +    | R:"EFI_HII_REF" ","                           << TypeName = R-
> >getText(); LineNum = R->getLine(); >>   )   {     VarId "=" ID:Number ","
> <<@@ -1092,8 +1101,8 @@ vfrStatementVarStoreEfi :
>    (     Name    "=" SN:StringIdentifier ","             << StoreName = SN-
> >getText();   >>    |-    Name    "=" "STRING_TOKEN" "\(" VN:Number "\)" ","  -
> VarSize "=" N:Number ","                        << +    Name    "=" "STRING_TOKEN"
> "\(" VN:Number "\)" ","+    VarSize "=" N:Number ","                        <<
> IsUEFI23EfiVarstore = FALSE;                                                        StoreName =
> gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText(), VN-
> >getLine()));                                                        if (StoreName == NULL) {@@ -
> 1116,7 +1125,7 @@ vfrStatementVarStoreEfi :
>                                                          break;                                                        case 8:
> TypeName = (CHAR8 *) "UINT64";-                                                        break; +
> break;                                                        default:
> _PCATCH (VFR_RETURN_UNSUPPORTED, N);
> break;@@ -1124,7 +1133,7 @@ vfrStatementVarStoreEfi :
>                                                      >>   ) -  Uuid "=" guidDefinition[Guid]
> << +  Uuid "=" guidDefinition[Guid]                     <<
> if (IsUEFI23EfiVarstore)
> {                                                        _PCATCH(gCVfrDataStorage.DeclareBufferVarS
> tore (                                                                                     StoreName,@@ -1150,7
> +1159,7 @@ vfrStatementVarStoreEfi :
>                                                         }
> VSEObj.SetGuid (&Guid);                                                        VSEObj.SetVarStoreId
> (VarStoreId);-                                                       +
> VSEObj.SetSize ((UINT16) Size);
> VSEObj.SetName (StoreName);                                                        if
> (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {@@ -1184,7 
> +1193,7 @@ vfrStatementVarStoreNameValue :
>                                                      >>   }   (-    Name "=" "STRING_TOKEN" "\("
> N:Number "\)" ","  << +    Name "=" "STRING_TOKEN" "\(" N:Number "\)" ","
> <<                                                        if (!Created)
> {                                                          _PCATCH(gCVfrDataStorage.DeclareNameVar
> StoreBegin (SN->getText(), VarStoreId), SN); Created = TRUE;@@ 
> -1245,12 +1254,12 @@ vfrStatementDisableIfFormSet :
>  vfrStatementSuppressIfFormSet :   << CIfrSuppressIf SIObj;>>   L:SuppressIf
> <<-                                                           SIObj.SetLineNo(L->getLine()); +
> SIObj.SetLineNo(L->getLine());                                                        >>   { FLAGS "="
> flagsField ( "\|" flagsField )* "," }   vfrStatementExpression[0] ";"
> vfrFormSetList-  E: EndIf +  E: EndIf   ";"                                                  <<
> CRT_END_OP (E); >>   ; @@ -1491,7 +1500,7 @@ vfrQuestionDataFieldName
> [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
>    (     SN2:StringIdentifier                            << _STRCAT (&VarIdStr, SN2-
> >getText()); LineNo = SN2->getLine(); >>     (-      "."                                           << +
> "."                                           <<                                                        _STRCAT
> (&VarIdStr, ".");                                                        if
> (mConstantOnlyInExpression)
> {                                                          _PCATCH(VFR_RETURN_CONSTANT_ONLY,
> LineNo);@@ -1518,7 +1527,7 @@ vfrQuestionDataFieldName 
> [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
>    ;  vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> BOOLEAN &ListType] :-  <<  +  <<     EFI_GUID    Guid;     BOOLEAN     Negative =
> FALSE;     BOOLEAN     IntDecStyle = FALSE;@@ -1634,11 +1643,11 @@
> vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value, BOOLEAN 
> &ListType]
>    | Z:Zero                                          << $Value.u8     = _STOU8(Z->getText(), Z-
> >getLine()); >>   | HOUR:Number ":" MINUTE:Number ":" SECOND:Number <<
> $Value.time   = _STOT(HOUR->getText(), MINUTE->getText(),SECOND-
> >getText(), HOUR->getLine()); >>   | YEAR:Number "/" MONTH:Number "/"
> DAY:Number     << $Value.date   = _STOD(YEAR->getText(), MONTH->getText(),
> DAY->getText(), YEAR->getLine()); >>-  | QI:Number";" FI:Number";"
> guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)" +  | 
> QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\("
> DP:Number "\)"                                                     << $Value.ref    = _STOR(QI-
> >getText(), FI->getText(), &Guid, DP->getText(), QI->getLine()); >>   |
> "STRING_TOKEN" "\(" S1:Number "\)"              << $Value.string = _STOSID(S1-
> >getText(), S1->getLine()); >>   | "\{"                                            << ListType =
> TRUE; >>-      L1:Number                                     << +      L1:Number
> <<                                                        switch (Type)
> {                                                          case EFI_IFR_TYPE_NUM_SIZE_8 :
> Type8[Index]  = _STOU8(L1->getText(), L1->getLine());@@ -1658,8 
> +1667,8 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE 
> &Value, BOOLEAN &ListType]
>                                                         Index++;                                                     >>       (-
> "," -        L2:Number                                   << +        ","+        L2:Number
> <<                                                        switch (Type)
> {                                                          case EFI_IFR_TYPE_NUM_SIZE_8 :
> Type8[Index]  = _STOU8(L2->getText(), L2->getLine());@@ -1679,7 
> +1688,7 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE 
> &Value, BOOLEAN &ListType]
> 
> Index++;                                                     >>       )*-    "\}"                                           +
> "\}"   ;
> //**************************************************************
> ***************@@ -1714,7 +1723,7 @@ vfrFormDefinition :
>    ;  vfrFormMapDefinition :-  << +  <<     CIfrFormMap *FMapObj = NULL;
> UINT32      FormMapMethodNumber = 0;     EFI_GUID    Guid;@@ -1775,11
> +1784,15 @@ vfrStatementDefault :
>       CIfrNumeric           *NumericQst   = NULL;    >>-  D:Default
> +  D:Default                                         <<+                                                        if
> (mIsCatchDefaultEnable) {+
> DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> >getLine());+                                                        }+                                                    >>
> (     (-      "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val,
> ArrayType] ","  -                                                    << +      "="
> vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","+
> <<                                                         if (gCurrentMinMaxData != NULL &&
> gCurrentMinMaxData->IsNumericOpcode())
> {                                                           //check default value is valid for Numeric
> Opcode                                                           NumericQst = (CIfrNumeric *)
> gCurrentQuestion;@@ -1888,14 +1901,14 @@ vfrStatementDefault :
>          vfrStatementValue ","                       << CIfrEnd EndObj1;
> EndObj1.SetLineNo(D->getLine()); >>     )     {-      DefaultStore "="
> SN:StringIdentifier ","      << +      DefaultStore "=" SN:StringIdentifier ","      <<
> _PCATCH(gCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN);
> if (DObj != NULL) {-                                                          DObj->SetDefaultId
> (DefaultId); -                                                        } +
> DObj->SetDefaultId (DefaultId);+                                                        }
> if (DObj2 != NULL) {-                                                          DObj2->SetDefaultId
> (DefaultId); +                                                          DObj2->SetDefaultId
> (DefaultId);                                                         }                                                     >>
>  }@@ -1917,8 +1930,8 @@ vfrStatementDefault :
>                                                                     );                                                          }
>                                              }-                                                       if (DObj  != NULL)
> {delete DObj;} -                                                       if (DObj2 != NULL) {delete
> DObj2;} +                                                       if (DObj  != NULL) {delete DObj;}+
> if (DObj2 != NULL) {delete DObj2;}                                                     >>   )   ;@@ -
> 1970,11 +1983,15 @@ vfrStatementInvalid :
>    ;  flagsField :-  Number -  | InteractiveFlag -  | 
> ManufacturingFlag -  | DefaultFlag -  | ResetRequiredFlag +  Number+  
> | InteractiveFlag+  |
> ManufacturingFlag+  | D:DefaultFlag                                      <<+
> if (mIsCatchDefaultEnable) {+
> DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> >getLine());+                                                          }+
> >>+  | ResetRequiredFlag   | ReconnectRequiredFlag   | N:NVAccessFlag
> <<                                                           gCVfrErrorHandle.HandleWarning (@@ -
> 1989,7 +2006,7 @@ flagsField :
>                                                              
> L->getLine(),
> L->getText()                                                             );-
>                                                        >> +                                                       >>   ;
> vfrStatementValue :@@ -2001,13 +2018,13 @@ vfrStatementValue :
>  vfrStatementRead :   << CIfrRead RObj; >>   R:Read
> << RObj.SetLineNo(R->getLine()); >>-  vfrStatementExpression[0] ";" +
> vfrStatementExpression[0] ";"   ;  vfrStatementWrite :   << CIfrWrite WObj; >>
> W:Write                                              << WObj.SetLineNo(W->getLine()); >>-
> vfrStatementExpression[0] ";" +  vfrStatementExpression[0] ";"   ;
> vfrStatementSubTitle :@@ -2140,7 +2157,7 @@ vfrStatementGoto :
>        FormId "=" F3:Number ","                         << RefType = 2; FId = _STOFID(F3-
> >getText(), F3->getLine()); >>       Question "="       (-          QN3:StringIdentifier
> ","                     << +          QN3:StringIdentifier ","                     <<
> mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask); 
> if (QId == EFI_QUESTION_ID_INVALID)
> {                                                             _PCATCH(VFR_RETURN_UNDEFINED,
> QN3);@@ -2222,7 +2239,7 @@ vfrStatementGoto :
>      "," Key "=" KN:Number                              << AssignQuestionKey (*QHObj,
> KN); >>   }   {-    E:"," +    E:","       vfrStatementQuestionOptionList                   <<
> OHObj->SetScope(1); CRT_END_OP (E);>>   }   ";"
> << 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;}>>@@ -2511,20 +2528,20 @@ 
> minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
>    {     "default" "=" N:Number ","                         <<
> switch (KeyValue) {-                                                          case 0: +
> case 0:                                                             D.Year  = _STOU16(N->getText(), N-
> >getLine());                                                             if (D.Year < _STOU16 (MinN-
> >getText(), MinN->getLine()) || D.Year > _STOU16 (MaxN->getText(), MaxN-
> >getLine())) {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value must
> be between Min year and Max year.");                                                             }
> break;-                                                          case 1: -
> D.Month = _STOU8(N->getText(), N->getLine()); +
> case 1:+                                                            D.Month = _STOU8(N->getText(), N-
> >getLine());                                                             if (D.Month < 1 || D.Month > 12)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value
> must be between 1 and 12.");                                                             }
> break;-                                                          case 2: -
> D.Day = _STOU8(N->getText(), N->getLine()); +
> case 2:+                                                            D.Day = _STOU8(N->getText(), N-
> >getLine());                                                             if (D.Day < 1 || D.Day > 31)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value must
> be between 1 and 31.");                                                             }@@ -2570,7
> +2587,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
>       BOOLEAN MinNegative = FALSE;      BOOLEAN MaxNegative = FALSE;   >>-
> Minimum   "=" +  Minimum   "="   {     "\-"                                               <<
> MinNegative = TRUE; >>   }@@ -2659,8 +2676,8 @@
> vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
>                                                              }                                                           }
>                                       >>-  Maximum   "=" -  { +  Maximum   "="+  {     "\-"
> << MaxNegative = TRUE; >>   }   A:Number ","                                         <<@@ -
> 2889,7 +2906,7 @@ vfrStatementNumeric :
>                                                            }                                                        >>
> vfrStatementQuestionOptionList-  E:EndNumeric                                         << +
> E:EndNumeric                                         <<
> CRT_END_OP (E);                                                           if (GuidObj != NULL)
> {                                                             GuidObj->SetScope(1);@@ -3131,7
> +3148,7 @@ vfrStatementString :
>    {     Key "=" KN:Number ","                              << AssignQuestionKey (SObj,
> KN); >>   }-  MinSize "=" MIN:Number ","                           << +  MinSize "="
> MIN:Number ","                           <<
> VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); StringMinSize = 
> _STOU8(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(), 
> MIN->getLine()) > StringMinSize) {@@ -3141,7
> +3158,7 @@ vfrStatementString :
>                                                            }
> SObj.SetMinSize (StringMinSize);                                                        >>-  MaxSize
> "=" MAX:Number ","                           << +  MaxSize "=" MAX:Number ","
> <<                                                           StringMaxSize = _STOU8(MAX->getText(),
> MAX->getLine());                                                           if (_STOU64(MAX-
> >getText(), MAX->getLine()) > StringMaxSize)
> {                                                             _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize takes 
> only one byte, which can't be larger than 0xFF.");@@ -3185,7 +3202,7 
> @@ vfrStatementPassword :
>    {     Key "=" KN:Number ","                              << AssignQuestionKey (PObj,
> KN); >>   }-  MinSize "=" MIN:Number ","                           << +  MinSize "="
> MIN:Number ","                           <<
> VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); PasswordMinSize = 
> _STOU16(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(), 
> MIN->getLine()) > PasswordMinSize) {@@ -
> 3195,7 +3212,7 @@ vfrStatementPassword :
>                                                            }
> PObj.SetMinSize (PasswordMinSize);                                                        >>-
> MaxSize "=" MAX:Number ","                           << +  MaxSize "=" MAX:Number
> ","                           <<                                                           PasswordMaxSize =
> _STOU16(MAX->getText(), MAX->getLine());                                                           if
> (_STOU64(MAX->getText(), MAX->getLine()) > PasswordMaxSize)
> {                                                             _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize takes 
> only two byte, which can't be larger than 0xFFFF.");@@ -3230,12
> +3247,12 @@ vfrStatementOrderedList :
>    >>   L:OrderedList                                        << OLObj.SetLineNo(L->getLine());
> gIsOrderedList = TRUE;>>   vfrQuestionHeader[OLObj] ","-
> << +                                                       <<
> VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); OLObj.SetMaxContainers 
> ((UINT8) (VarArraySize > 0xFF ? 0xFF :
> VarArraySize));                                                        >>   {-    MaxContainers "="
> M:Number ","                     << +    MaxContainers "=" M:Number ","
> <<                                                           if (_STOU64(M->getText(), M->getLine()) >
> _STOU8(M->getText(), M->getLine()))
> {                                                             _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList 
> MaxContainers takes only one byte, which can't be larger than
> 0xFF.");                                                           } else if (VarArraySize != 0 &&
> _STOU8(M->getText(), M->getLine()) > VarArraySize) {@@ -3328,19 
> +3345,19 @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :
>    {     "default" "=" N:Number ","                         <<
> switch (KeyValue) {-                                                          case 0: -
> T.Hour   = _STOU8(N->getText(), N->getLine()); +
> case 0:+                                                            T.Hour   = _STOU8(N->getText(), N-
> >getLine());                                                             if (T.Hour > 23)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value must
> be between 0 and 23.");                                                             }
> break;-                                                          case 1: -
> T.Minute = _STOU8(N->getText(), N->getLine()); +
> case 1:+                                                            T.Minute = _STOU8(N->getText(), N-
> >getLine());                                                             if (T.Minute > 59)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value
> must be between 0 and 59.");                                                             }
> break;-                                                          case 2: +
> case 2:                                                             T.Second = _STOU8(N->getText(), N-
> >getLine());                                                             if (T.Second > 59)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value 
> must be between 0 and 59.");@@ -3419,11 +3436,11 @@ 
> vfrStatementStatListOld :
>    ;  vfrStatementDisableIfStat :-  << -    CIfrDisableIf DIObj; +  <<+
> CIfrDisableIf DIObj;   >>   L:DisableIf                                          <<
> DIObj.SetLineNo(L->getLine()); >>-  vfrStatementExpression[0] ";" +
> vfrStatementExpression[0] ";"   ( vfrStatementStatList )*   E:EndIf
> << CRT_END_OP (E); >>   ";"@@ -3548,8 +3565,8 @@
> vfrStatementWarningIf :
>    ;  vfrStatementDisableIfQuest :-  << -    CIfrDisableIf DIObj; +  <<+
> CIfrDisableIf DIObj;   >>   L:DisableIf                                          <<
> DIObj.SetLineNo(L->getLine()); >>   vfrStatementExpression[0] ";"@@ -
> 3616,15 +3633,15 @@ vfrStatementOneOfOption :
>       UINT32             *Type32       = (UINT32 *) ValueList;      UINT64
> *Type64       = (UINT64 *) ValueList;   >>-  L:Option                                             <<
> +  L:Option                                             <<                                                           if
> (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER)
> {                                                             _PCATCH (VFR_RETURN_FATAL_ERROR, L-
> >getLine(), "Get data type
> error.");                                                           }                                                         >>-
> Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","      +  Text  "="
> "STRING_TOKEN" "\(" S:Number "\)" ","   Value "="
> vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","-
> << +                                                       <<                                                           if
> (gCurrentMinMaxData != NULL) {                                                             //set
> min/max value for oneof opcode                                                             UINT64
> Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE(),
> _GET_CURRQEST_VARTINFO().mIsBitVar);@@ -3696,7 +3713,7 @@ 
> vfrStatementOneOfOption :
>                                                            Size += OFFSET_OF
> (EFI_IFR_ONE_OF_OPTION, Value);                                                           OOOObj =
> new CIfrOneOfOption((UINT8)Size);                                                           OOOObj-
> >SetLineNo(L->getLine());-                                                          OOOObj-
> >SetOption (_STOSID(S->getText(), S->getLine())); +
> OOOObj->SetOption (_STOSID(S->getText(), S->getLine()));
> if (ArrayType) {                                                             OOOObj->SetType
> (EFI_IFR_TYPE_BUFFER);                                                           } else {@@ -3706,7
> +3723,7 @@ vfrStatementOneOfOption :
>                                                                OOOObj->SetType
> (_GET_CURRQEST_DATATYPE());                                                             }
>                                       }-                                                          OOOObj->SetValue
> (*Val); +                                                          OOOObj->SetValue
> (*Val);                                                        >>   F:FLAGS "="
> vfrOneOfOptionFlags[*OOOObj, F->getLine()] <<@@ -3790,7 +3807,12 @@ 
> oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
>    | RestStyleFlag                                      << $HFlags |= 0x20; >>   |
> ReconnectRequiredFlag                              << $HFlags |= 0x40; >>   |
> ManufacturingFlag                                  << $LFlags |= 0x20; >>-  | DefaultFlag
> << $LFlags |= 0x10; >>+  | D:DefaultFlag                                      <<+
> $LFlags |= 0x10;+                                                          if (mIsCatchDefaultEnable)
> {+
> DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> >getLine());+                                                            }+
>  >>   | A:NVAccessFlag                                     <<
> gCVfrErrorHandle.HandleWarning
> (                                                             VFR_WARNING_OBSOLETED_FRAMEWORK
> _OPCODE,@@ -3963,7 +3985,7 @@ vfrStatementExpression [UINT32 
> RootLevel, UINT32 ExpOpCount = 0] :
>                                                                }                                                             }
>                                              }-                                                          +
> if ($RootLevel == 0) {                                                             _CLEAR_SAVED_OPHDR
> ();                                                             mCIfrOpHdrIndex --;@@ -4405,10
> +4427,10 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>                                                              for (Index = 0; Index < ListLen; Index++)
> {                                                               EILObj.SetValueList (Index,
> ValueList[Index]);                                                             }-
> +                                                             
> + EILObj.UpdateIfrBuffer();-
> _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());
> -                                                            +
> _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());+ if (QId 
> == EFI_QUESTION_ID_INVALID)
> {                                                               EILObj.SetQuestionId (QId, VarIdStr,
> LineNo);                                                             }@@ -4458,9 +4480,9 @@
> stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>    >>   L:StringRef   "\("-      ( +      (         "STRING_TOKEN"-        "\(" +        "\("
> S:Number << RefStringId = _STOSID(S->getText(), S->getLine()); >>         "\)"
> | I:Number << RefStringId = _STOSID(I->getText(), I->getLine()); >>@@ 
> | -
> 4499,10 +4521,10 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>       Info.mVarStoreId = 0;   >>   L:Get-  "\(" +  "\("       vfrStorageVarId[Info,
> VarIdStr, FALSE]       {"\|" FLAGS "=" numericVarStoreType [VarType] }-  "\)"
> << +  "\)"                                                 <<
> {                                                             if (Info.mVarStoreId == 0)
> {                                                               // support Date/Time question@@ -
> 4549,9 +4571,9 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>                                                                  
> _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> >getLine(), "Get/Set opcode don't support data
> array");                                                               }                                                             }
> -                                                            CIfrGet GObj(L->getLine()); -
> _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine()); -
> GObj.SetVarInfo (&Info); +                                                            CIfrGet GObj(L-
> >getLine());+                                                            _SAVE_OPHDR_COND (GObj,
> ($ExpOpCount == 0), L->getLine());+
> GObj.SetVarInfo (&Info);                                                             delete[] VarIdStr;
> $ExpOpCount++;                                                           }@@ -4608,7 +4630,7 @@
> question23refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>        {         Uuid "=" guidDefinition[Guid] ","                       << Type = 0x3; >>       }-
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"
> <<                                                           switch (Type) {@@ -4675,9 +4697,9 @@
> setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>    "\("      vfrStorageVarId[Info, VarIdStr, FALSE]      {"\|" FLAG "="
> numericVarStoreType [VarType] }-     ","
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +     ","
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"-
> << +                                                       <<
> {                                                             if (Info.mVarStoreId == 0)
> {                                                               // support Date/Time question@@ -
> 4724,8 +4746,8 @@ setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>                                                                  
> _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> >getLine(), "Get/Set opcode don't support data
> array");                                                               }                                                             }
> -                                                            CIfrSet TSObj(L->getLine()); -
> TSObj.SetVarInfo (&Info); +                                                            CIfrSet TSObj(L-
> >getLine());+                                                            TSObj.SetVarInfo (&Info);
> delete[] VarIdStr;
> $ExpOpCount++;                                                           }@@ -4808,9 +4830,9 @@
> spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>    ;  vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:-  
> L:Map
> -  "\(" -  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]  +  L:Map+
> "\("+  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   ":"
> << { CIfrMap MObj(L->getLine()); } >>   (     vfrStatementExpression[0]@@ -
> 4837,6 +4859,7 @@ spanFlags [UINT8 & Flags] :
>  class EfiVfrParser { << private:+  BOOLEAN             mIsCatchDefaultEnable;
> UINT8               mParserStatus;   BOOLEAN             mConstantOnlyInExpression;
> @@ -4880,6 +4903,7 @@ public:
>    VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN ANTLRTokenPtr);
> VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32);   VOID
> _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);+  VOID
> DefaultValueError (IN EFI_VFR_RETURN_CODE, IN UINT32);    VOID
> syn     (ANTLRAbstractToken  *, ANTLRChar *, SetWordType *,
> ANTLRTokenType, INT32); @@ -4909,6 +4933,7 @@ public:
>    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);   VOID                IdEqListDoSpecial     (IN
> UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN
> UINT16, IN UINT16 *);   VOID                SetOverrideClassGuid  (IN EFI_GUID *);+
> VOID                SetIsCatchDefaultEnable (BOOLEAN IsCatchDefaultEnable); >> }
> @@ -5086,6 +5111,17 @@ EfiVfrParser::_PCATCH (
>    mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError 
> (ReturnCode, LineNum, (CHAR8 *) ErrorMsg); }
> +VOID+EfiVfrParser::DefaultValueError (+  IN EFI_VFR_RETURN_CODE
> ReturnCode,+  IN UINT32              LineNum+  )+{+  CHAR8 ErrorMsg[100];+
> sprintf(ErrorMsg, "please remove the default value / defaultstore in 
> line %d", LineNum);+  mParserStatus = mParserStatus + 
> gCVfrErrorHandle.HandleError (ReturnCode, LineNum, ErrorMsg);+}+ VOID EfiVfrParser::syn
> (   ANTLRAbstractToken  *Tok,@@ -5682,12 +5718,18 @@
> EfiVfrParser::IdEqListDoSpecial (
>    } } -VOID +VOID EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID
> *OverrideClassGuid) {   mOverrideClassGuid = OverrideClassGuid; }
> +VOID+EfiVfrParser::SetIsCatchDefaultEnable (BOOLEAN
> IsCatchDefaultEnable)+{+  mIsCatchDefaultEnable = IsCatchDefaultEnable;+}+
> VOID EfiVfrParser::CheckDuplicateDefaultValue (   IN EFI_DEFAULT_ID
> DefaultId,--
> 2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112435): https://edk2.groups.io/g/devel/message/112435
Mute This Topic: https://groups.io/mt/103126873/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature
  2023-12-12  9:12   ` Yuting Yang
@ 2023-12-21  6:43     ` Zhang, Zifeng
  2023-12-22  5:41       ` Yuting Yang
  2023-12-25  1:23       ` [edk2-devel] 回复: " gaoliming via groups.io
  0 siblings, 2 replies; 12+ messages in thread
From: Zhang, Zifeng @ 2023-12-21  6:43 UTC (permalink / raw)
  To: Gao, Liming, Yang, Yuting2
  Cc: Rebecca Cran, Feng, Bob C, Chen, Arthur G, devel@edk2.groups.io,
	Chen, Christine

Hi Liming,

Thanks for reviewing.
For background of this change, we will remove default flags in VFR/HFR in new platform. So we need help from VFR complier to make a default flag check to avoid manually adding.
@Yang, Yuting2, could you help to create a BZ for this feature and share in mail thread?
Then let me make a clarification for your questions.

#1: The purpose of --catch_default
We send --catch_default flag in build option to indicate which platform should check default flag in VFR/HFR.
Actually maybe some platforms used same EDK2 downstream branch, so we only send --catch_default flag for the platforms which need this check.

#2: The purpose of --except_list
VFR compiler will receive VFR/HFR configurations from all folders including Intel and EDK2. But in our expectation VFR compiler only do this check in Intel.
So We use --except_list to deliver package list in EDK2 to avoid this check.

Best Regards,
Zifeng

-----Original Message-----
From: Yang, Yuting2 <yuting2.yang@intel.com> 
Sent: Tuesday, December 12, 2023 5:12 PM
To: Zhang, Zifeng <zifeng.zhang@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>; devel@edk2.groups.io
Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature

+Cc Zhang, Zifeng, Chen, Arthur G

-----Original Message-----
From: Chen, Christine <yuwei.chen@intel.com>
Sent: Tuesday, December 12, 2023 5:04 PM
To: Yang, Yuting2 <yuting2.yang@intel.com>; devel@edk2.groups.io
Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature

+Cc Yang, Yuting2

> -----Original Message-----
> From: Yang, Yuting2 <yuting2.yang@intel.com>
> Sent: Tuesday, December 12, 2023 5:01 PM
> To: devel@edk2.groups.io
> Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>; Chen, 
> Christine <yuwei.chen@intel.com>
> Subject: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> Add --catch_default option
> Raise a DefaultValueError when encountering VFR default definitions to 
> help remove default variables.
> Add --except_list option
> Exclude packages that don't require enabling the catch_default function.
> 
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Christine Chen <yuwei.chen@intel.com>
> Cc: Yuting Yang <yuting2.yang@intel.com>
> 
> Signed-off-by: Yuting Yang <yuting2.yang@intel.com>
> ---
>  BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  40 ++-
>  BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   3 +
>  BaseTools/Source/C/VfrCompile/VfrError.cpp    |   3 +-
>  BaseTools/Source/C/VfrCompile/VfrError.h      |   3 +-
>  BaseTools/Source/C/VfrCompile/VfrFormPkg.h    |   1 +
>  BaseTools/Source/C/VfrCompile/VfrSyntax.g     | 238 ++++++++++--------
>  6 files changed, 184 insertions(+), 104 deletions(-)
> 
> diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> index 5f4d262d85..e97cebff65 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> @@ -78,6 +78,9 @@ CVfrCompiler::OptionInitialization (
>    mOptions.WarningAsError                = FALSE;   mOptions.AutoDefault
> = FALSE;   mOptions.CheckDefault                  = FALSE;+
> mOptions.IsCatchDefaultEnable          = FALSE;+  mOptions.ExceptionList
> = NULL;+  mOptions.ExceptionListSize             = 0;   memset
> (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));    if (Argc == 1) {@@ -
> 95,6 +98,23 @@ CVfrCompiler::OptionInitialization (
>        Version ();       SET_RUN_STATUS (STATUS_DEAD);       return;+    } else if
> (stricmp(Argv[Index], "--catch_default") == 0){+
> mOptions.IsCatchDefaultEnable = TRUE;+    } else if (stricmp(Argv[Index], "--
> except_list") == 0){+      INT32 Start = ++Index;+      if ((Start >= Argc) ||
> (Argv[Start][0] == '-')) {+        DebugError (NULL, 0, 1001, "Missing option", "-
> exception_list missing except list");+        goto Fail;+      }+      while
> ((Argv[Index][0] != '-') && (Index < Argc - 1)) {+        Index++;+      }+      INT32
> End = Index--;+      mOptions.ExceptionListSize = End - Start;+      for (INT32 i =
> Start; i < End; i++) {+        mOptions.ExceptionList = (CHAR8**)
> realloc(mOptions.ExceptionList, (i - Start + 1) * sizeof(CHAR8*));+
> mOptions.ExceptionList[i-Start] = Argv[i];+      }     } else if (stricmp(Argv[Index],
> "-l") == 0) {       mOptions.CreateRecordListFile = TRUE;
> gCIfrRecordInfoDB.TurnOn ();@@ -179,7 +199,11 @@ 
> CVfrCompiler::OptionInitialization (
>        goto Fail;     }     strcpy (mOptions.VfrFileName, Argv[Index]);-+    for (int i =
> 0; i < mOptions.ExceptionListSize; i++) {+      if (strstr(mOptions.VfrFileName,
> mOptions.ExceptionList[i]) != NULL) {+        mOptions.IsCatchDefaultEnable =
> FALSE;+      }+    }     if (mOptions.OutputDirectory == NULL)
> {       mOptions.OutputDirectory = (CHAR8 *) malloc (1);       if
> (mOptions.OutputDirectory == NULL) {@@ -217,6 +241,11 @@ Fail:
>      free (mOptions.VfrFileName);     mOptions.VfrFileName                 =
> NULL;   }+  if (mOptions.ExceptionList != NULL) {+
> free(mOptions.ExceptionList);+    mOptions.ExceptionList               = NULL;++  }
> if (mOptions.VfrBaseFileName != NULL) {     free (mOptions.VfrBaseFileName);
> mOptions.VfrBaseFileName             = NULL;@@ -496,6 +525,11 @@
> CVfrCompiler::~CVfrCompiler (
>      mOptions.VfrBaseFileName = NULL;   } +  if (mOptions.ExceptionList !=
> NULL) {+    free (mOptions.ExceptionList);+    mOptions.ExceptionList =
> NULL;+  }+   if (mOptions.OutputDirectory != NULL) {     free
> (mOptions.OutputDirectory);     mOptions.OutputDirectory = NULL;@@ -679,7
> +713,7 @@ CVfrCompiler::Compile (
>      DebugError (NULL, 0, 0001, "Error opening the input file", "%s",
> InFileName);     goto Fail;   }-+  InputInfo.IsCatchDefaultEnable =
> mOptions.IsCatchDefaultEnable;   if (mOptions.HasOverrideClassGuid)
> {     InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;   } else
> {@@ -937,5 +971,3 @@ main (
>     return GetUtilityStatus (); }--diff --git 
> a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> index b6e207d2ce..39e0a89a29 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> @@ -52,6 +52,9 @@ typedef struct {
>    BOOLEAN WarningAsError;   BOOLEAN AutoDefault;   BOOLEAN
> CheckDefault;+  BOOLEAN IsCatchDefaultEnable;+  CHAR8**  ExceptionList;+
> INT16    ExceptionListSize; } OPTIONS;  typedef enum {diff --git
> a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> index 65bb8e34fd..8a706f929b 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> @@ -49,7 +49,8 @@ static SVFR_WARNING_HANDLE VFR_WARNING_HANDLE_TABLE 
> [] = {
>    { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value re-defined
> with different value"},   { VFR_WARNING_ACTION_WITH_TEXT_TWO, ": Action
> opcode should not have TextTwo part"}, { 
> VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend to use 
> obsoleted framework opcode"},-  { VFR_WARNING_CODEUNDEFINED, ":
> undefined Warning Code" }+  { VFR_WARNING_CODEUNDEFINED, ":
> undefined Warning Code" },+  { VFR_WARNING_UNSUPPORTED, ": pls remove 
> the default values if necessary" } }; CVfrErrorHandle::CVfrErrorHandle 
> (diff -- git a/BaseTools/Source/C/VfrCompile/VfrError.h
> b/BaseTools/Source/C/VfrCompile/VfrError.h
> index 7d16bd5f74..1b4bc173d2 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrError.h
> +++ b/BaseTools/Source/C/VfrCompile/VfrError.h
> @@ -47,7 +47,8 @@ typedef enum {
>    VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0, 
> VFR_WARNING_ACTION_WITH_TEXT_TWO,
> VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,-
> VFR_WARNING_CODEUNDEFINED+  VFR_WARNING_CODEUNDEFINED,+ 
> VFR_WARNING_UNSUPPORTED } EFI_VFR_WARNING_CODE;  typedef struct 
> _SVFR_ERROR_HANDLE {diff --git 
> a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> index 9ef6f07787..d8fada3bcb 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> @@ -96,6 +96,7 @@ struct SBufferNode {
>   typedef struct {   EFI_GUID *OverrideClassGuid;+  BOOLEAN
> IsCatchDefaultEnable; } INPUT_INFO_TO_SYNTAX;  class CFormPkg {diff 
> --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> index 55fd067f8a..5daf1c423c 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> @@ -50,6 +50,7 @@ VfrParserStart (
>  {   ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken> VfrParser(File);
> VfrParser.parser()->SetOverrideClassGuid
> (InputInfo->OverrideClassGuid);+
> VfrParser.parser()->SetIsCatchDefaultEnable(InputInfo-
> >IsCatchDefaultEnable);   return VfrParser.parser()->vfrProgram(); } >>@@ -
> 386,8 +387,8 @@ dataStructField32 [BOOLEAN  FieldInUnion]:
>    ;  dataStructField16 [BOOLEAN  FieldInUnion]:-  << -    UINT32 ArrayNum = 0;
> +  <<+    UINT32 ArrayNum = 0;   >>   ("UINT16" | "CHAR16")
> N:StringIdentifier@@ -737,7 +738,7 @@ vfrFormSetList :
>    ;  vfrStatementExtension:-  << +  <<      EFI_GUID Guid;      CIfrGuid *GuidObj
> = NULL;      CHAR8    *TypeName = NULL;@@ -751,7 +752,7 @@
> vfrStatementExtension:
>    >>   L:GuidOp   Uuid "=" guidDefinition[Guid]-  {"," DataType "=" +  {","
> DataType "="     (         U64:"UINT64" {OpenBracket AN1:Number CloseBracket
> <<ArrayNum = _STOU32(AN1->getText(), AN1->getLine());>>} << TypeName =
> U64->getText(); LineNum = U64->getLine(); >>@@ -770,7
> +771,7 @@ vfrStatementExtension:
>        | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket 
> <<ArrayNum = _STOU32(AN8->getText(), AN8->getLine());>>}
> << TypeName = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>       |
> R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = 
> _STOU32(AN9->getText(), AN9->getLine());>>}- << TypeName =
> R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
> +                                                      << TypeName =
> + R->getText(); LineNum = R-
> >getLine(); IsStruct = TRUE;>>       | TN:StringIdentifier {OpenBracket
> AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText(), AN10-
> >getLine());>>}                                                       << TypeName = TN->getText();
> LineNum = TN->getLine(); IsStruct = TRUE;>>     )@@ -875,19 +876,19 @@
> vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 
> TypeSize,
>                  memcpy (ByteOffset, &Data_U64, TypeSize);               }else if (strcmp
> ("UINT32", TypeName) == 0) {                 Data_U32 = _STOU32(RD->getText(),
> RD->getLine());-                memcpy (ByteOffset, &Data_U32, TypeSize);
> +                memcpy (ByteOffset, &Data_U32, TypeSize);               }else if (strcmp
> ("UINT16", TypeName) == 0) {                 Data_U16 = _STOU16(RD->getText(),
> RD->getLine());-                memcpy (ByteOffset, &Data_U16, TypeSize);
> +                memcpy (ByteOffset, &Data_U16, TypeSize);               }else if (strcmp
> ("UINT8", TypeName) == 0) {                 Data_U8 = _STOU8(RD->getText(), RD-
> >getLine());-                memcpy (ByteOffset, &Data_U8, TypeSize);
> +                memcpy (ByteOffset, &Data_U8, TypeSize);               }else if (strcmp
> ("BOOLEAN", TypeName)== 0) {                 Data_BL = _STOU8(RD->getText(),
> RD->getLine());-                memcpy (ByteOffset, &Data_BL, TypeSize);
> +                memcpy (ByteOffset, &Data_BL, TypeSize);               }else if (strcmp
> ("EFI_STRING_ID", TypeName) == 0) {                 Data_SID = _STOSID(RD-
> >getText(), RD->getLine());-                memcpy (ByteOffset, &Data_SID,
> TypeSize);                                                    +                memcpy (ByteOffset,
> &Data_SID, TypeSize);               }             } else
> {               gCVfrVarDataTypeDB.GetDataFieldInfo(TFName, FieldOffset,
> FieldType, FieldSize, BitField);@@ -975,7 +976,15 @@
> vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 
> TypeSize,
>   vfrStatementDefaultStore :   << UINT16  DefaultId =
> EFI_HII_DEFAULT_CLASS_STANDARD; >>-  D:DefaultStore N:StringIdentifier
> ","+  D:DefaultStore N:StringIdentifier ","             <<+
> if (mIsCatchDefaultEnable) {+
> gCVfrErrorHandle.HandleWarning (+
> VFR_WARNING_UNSUPPORTED,+                                                          D-
> >getLine(),+                                                          D-
> >getText()+                                                          );+                                                      }+
>                                                     >>   Prompt "=" "STRING_TOKEN" "\(" S:Number
> "\)"   {     "," Attribute "=" A:Number                      << DefaultId = _STOU16(A-
> >getText(), A->getLine()); >>@@ -1074,7 +1083,7 @@
> vfrStatementVarStoreEfi :
>      | U64:"UINT64" ","                              << TypeName = U64->getText();
> LineNum = U64->getLine(); >>     | D:"EFI_HII_DATE" ","                          <<
> TypeName = D->getText(); LineNum = D->getLine(); >>     | T:"EFI_HII_TIME"
> ","                          << TypeName = T->getText(); LineNum = T->getLine(); >>-    |
> R:"EFI_HII_REF" ","                           << TypeName = R->getText(); LineNum = R-
> >getLine(); >>    +    | R:"EFI_HII_REF" ","                           << TypeName = R-
> >getText(); LineNum = R->getLine(); >>   )   {     VarId "=" ID:Number ","
> <<@@ -1092,8 +1101,8 @@ vfrStatementVarStoreEfi :
>    (     Name    "=" SN:StringIdentifier ","             << StoreName = SN-
> >getText();   >>    |-    Name    "=" "STRING_TOKEN" "\(" VN:Number "\)" ","  -
> VarSize "=" N:Number ","                        << +    Name    "=" "STRING_TOKEN"
> "\(" VN:Number "\)" ","+    VarSize "=" N:Number ","                        <<
> IsUEFI23EfiVarstore = FALSE;                                                        StoreName =
> gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText(), VN-
> >getLine()));                                                        if (StoreName == NULL) {@@ -
> 1116,7 +1125,7 @@ vfrStatementVarStoreEfi :
>                                                          break;                                                        case 8:
> TypeName = (CHAR8 *) "UINT64";-                                                        break; +
> break;                                                        default:
> _PCATCH (VFR_RETURN_UNSUPPORTED, N);
> break;@@ -1124,7 +1133,7 @@ vfrStatementVarStoreEfi :
>                                                      >>   ) -  Uuid "=" guidDefinition[Guid]
> << +  Uuid "=" guidDefinition[Guid]                     <<
> if (IsUEFI23EfiVarstore)
> {                                                        _PCATCH(gCVfrDataStorage.DeclareBufferVarS
> tore (                                                                                     StoreName,@@ -1150,7
> +1159,7 @@ vfrStatementVarStoreEfi :
>                                                         }
> VSEObj.SetGuid (&Guid);                                                        VSEObj.SetVarStoreId
> (VarStoreId);-                                                       +
> VSEObj.SetSize ((UINT16) Size);
> VSEObj.SetName (StoreName);                                                        if
> (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {@@ -1184,7
> +1193,7 @@ vfrStatementVarStoreNameValue :
>                                                      >>   }   (-    Name "=" "STRING_TOKEN" "\("
> N:Number "\)" ","  << +    Name "=" "STRING_TOKEN" "\(" N:Number "\)" ","
> <<                                                        if (!Created)
> {                                                          _PCATCH(gCVfrDataStorage.DeclareNameVar
> StoreBegin (SN->getText(), VarStoreId), SN); Created = TRUE;@@
> -1245,12 +1254,12 @@ vfrStatementDisableIfFormSet :
>  vfrStatementSuppressIfFormSet :   << CIfrSuppressIf SIObj;>>   L:SuppressIf
> <<-                                                           SIObj.SetLineNo(L->getLine()); +
> SIObj.SetLineNo(L->getLine());                                                        >>   { FLAGS "="
> flagsField ( "\|" flagsField )* "," }   vfrStatementExpression[0] ";"
> vfrFormSetList-  E: EndIf +  E: EndIf   ";"                                                  <<
> CRT_END_OP (E); >>   ; @@ -1491,7 +1500,7 @@ vfrQuestionDataFieldName
> [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
>    (     SN2:StringIdentifier                            << _STRCAT (&VarIdStr, SN2-
> >getText()); LineNo = SN2->getLine(); >>     (-      "."                                           << +
> "."                                           <<                                                        _STRCAT
> (&VarIdStr, ".");                                                        if
> (mConstantOnlyInExpression)
> {                                                          _PCATCH(VFR_RETURN_CONSTANT_ONLY,
> LineNo);@@ -1518,7 +1527,7 @@ vfrQuestionDataFieldName 
> [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
>    ;  vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> BOOLEAN &ListType] :-  <<  +  <<     EFI_GUID    Guid;     BOOLEAN     Negative =
> FALSE;     BOOLEAN     IntDecStyle = FALSE;@@ -1634,11 +1643,11 @@
> vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value, BOOLEAN 
> &ListType]
>    | Z:Zero                                          << $Value.u8     = _STOU8(Z->getText(), Z-
> >getLine()); >>   | HOUR:Number ":" MINUTE:Number ":" SECOND:Number <<
> $Value.time   = _STOT(HOUR->getText(), MINUTE->getText(),SECOND-
> >getText(), HOUR->getLine()); >>   | YEAR:Number "/" MONTH:Number "/"
> DAY:Number     << $Value.date   = _STOD(YEAR->getText(), MONTH->getText(),
> DAY->getText(), YEAR->getLine()); >>-  | QI:Number";" FI:Number";"
> guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)" +  | 
> QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\("
> DP:Number "\)"                                                     << $Value.ref    = _STOR(QI-
> >getText(), FI->getText(), &Guid, DP->getText(), QI->getLine()); >>   |
> "STRING_TOKEN" "\(" S1:Number "\)"              << $Value.string = _STOSID(S1-
> >getText(), S1->getLine()); >>   | "\{"                                            << ListType =
> TRUE; >>-      L1:Number                                     << +      L1:Number
> <<                                                        switch (Type)
> {                                                          case EFI_IFR_TYPE_NUM_SIZE_8 :
> Type8[Index]  = _STOU8(L1->getText(), L1->getLine());@@ -1658,8
> +1667,8 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> &Value, BOOLEAN &ListType]
>                                                         Index++;                                                     >>       (-
> "," -        L2:Number                                   << +        ","+        L2:Number
> <<                                                        switch (Type)
> {                                                          case EFI_IFR_TYPE_NUM_SIZE_8 :
> Type8[Index]  = _STOU8(L2->getText(), L2->getLine());@@ -1679,7
> +1688,7 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> &Value, BOOLEAN &ListType]
> 
> Index++;                                                     >>       )*-    "\}"                                           +
> "\}"   ;
> //**************************************************************
> ***************@@ -1714,7 +1723,7 @@ vfrFormDefinition :
>    ;  vfrFormMapDefinition :-  << +  <<     CIfrFormMap *FMapObj = NULL;
> UINT32      FormMapMethodNumber = 0;     EFI_GUID    Guid;@@ -1775,11
> +1784,15 @@ vfrStatementDefault :
>       CIfrNumeric           *NumericQst   = NULL;    >>-  D:Default
> +  D:Default                                         <<+                                                        if
> (mIsCatchDefaultEnable) {+
> DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> >getLine());+                                                        }+                                                    >>
> (     (-      "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val,
> ArrayType] ","  -                                                    << +      "="
> vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","+
> <<                                                         if (gCurrentMinMaxData != NULL &&
> gCurrentMinMaxData->IsNumericOpcode())
> {                                                           //check default value is valid for Numeric
> Opcode                                                           NumericQst = (CIfrNumeric *)
> gCurrentQuestion;@@ -1888,14 +1901,14 @@ vfrStatementDefault :
>          vfrStatementValue ","                       << CIfrEnd EndObj1;
> EndObj1.SetLineNo(D->getLine()); >>     )     {-      DefaultStore "="
> SN:StringIdentifier ","      << +      DefaultStore "=" SN:StringIdentifier ","      <<
> _PCATCH(gCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN);
> if (DObj != NULL) {-                                                          DObj->SetDefaultId
> (DefaultId); -                                                        } +
> DObj->SetDefaultId (DefaultId);+                                                        }
> if (DObj2 != NULL) {-                                                          DObj2->SetDefaultId
> (DefaultId); +                                                          DObj2->SetDefaultId
> (DefaultId);                                                         }                                                     >>
>  }@@ -1917,8 +1930,8 @@ vfrStatementDefault :
>                                                                     );                                                          }
>                                              }-                                                       if (DObj  != NULL)
> {delete DObj;} -                                                       if (DObj2 != NULL) {delete
> DObj2;} +                                                       if (DObj  != NULL) {delete DObj;}+
> if (DObj2 != NULL) {delete DObj2;}                                                     >>   )   ;@@ -
> 1970,11 +1983,15 @@ vfrStatementInvalid :
>    ;  flagsField :-  Number -  | InteractiveFlag -  | 
> ManufacturingFlag -  | DefaultFlag -  | ResetRequiredFlag +  Number+
> | InteractiveFlag+  |
> ManufacturingFlag+  | D:DefaultFlag                                      <<+
> if (mIsCatchDefaultEnable) {+
> DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> >getLine());+                                                          }+
> >>+  | ResetRequiredFlag   | ReconnectRequiredFlag   | N:NVAccessFlag
> <<                                                           gCVfrErrorHandle.HandleWarning (@@ -
> 1989,7 +2006,7 @@ flagsField :
>                                                              
> L->getLine(),
> L->getText()                                                             );-
>                                                        >> +                                                       >>   ;
> vfrStatementValue :@@ -2001,13 +2018,13 @@ vfrStatementValue :
>  vfrStatementRead :   << CIfrRead RObj; >>   R:Read
> << RObj.SetLineNo(R->getLine()); >>-  vfrStatementExpression[0] ";" +
> vfrStatementExpression[0] ";"   ;  vfrStatementWrite :   << CIfrWrite WObj; >>
> W:Write                                              << WObj.SetLineNo(W->getLine()); >>-
> vfrStatementExpression[0] ";" +  vfrStatementExpression[0] ";"   ;
> vfrStatementSubTitle :@@ -2140,7 +2157,7 @@ vfrStatementGoto :
>        FormId "=" F3:Number ","                         << RefType = 2; FId = _STOFID(F3-
> >getText(), F3->getLine()); >>       Question "="       (-          QN3:StringIdentifier
> ","                     << +          QN3:StringIdentifier ","                     <<
> mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask); 
> if (QId == EFI_QUESTION_ID_INVALID)
> {                                                             _PCATCH(VFR_RETURN_UNDEFINED,
> QN3);@@ -2222,7 +2239,7 @@ vfrStatementGoto :
>      "," Key "=" KN:Number                              << AssignQuestionKey (*QHObj,
> KN); >>   }   {-    E:"," +    E:","       vfrStatementQuestionOptionList                   <<
> OHObj->SetScope(1); CRT_END_OP (E);>>   }   ";"
> << 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;}>>@@ -2511,20 +2528,20 @@ 
> minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
>    {     "default" "=" N:Number ","                         <<
> switch (KeyValue) {-                                                          case 0: +
> case 0:                                                             D.Year  = _STOU16(N->getText(), N-
> >getLine());                                                             if (D.Year < _STOU16 (MinN-
> >getText(), MinN->getLine()) || D.Year > _STOU16 (MaxN->getText(), MaxN-
> >getLine())) {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value must
> be between Min year and Max year.");                                                             }
> break;-                                                          case 1: -
> D.Month = _STOU8(N->getText(), N->getLine()); +
> case 1:+                                                            D.Month = _STOU8(N->getText(), N-
> >getLine());                                                             if (D.Month < 1 || D.Month > 12)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value
> must be between 1 and 12.");                                                             }
> break;-                                                          case 2: -
> D.Day = _STOU8(N->getText(), N->getLine()); +
> case 2:+                                                            D.Day = _STOU8(N->getText(), N-
> >getLine());                                                             if (D.Day < 1 || D.Day > 31)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value must
> be between 1 and 31.");                                                             }@@ -2570,7
> +2587,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
>       BOOLEAN MinNegative = FALSE;      BOOLEAN MaxNegative = FALSE;   >>-
> Minimum   "=" +  Minimum   "="   {     "\-"                                               <<
> MinNegative = TRUE; >>   }@@ -2659,8 +2676,8 @@
> vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
>                                                              }                                                           }
>                                       >>-  Maximum   "=" -  { +  Maximum   "="+  {     "\-"
> << MaxNegative = TRUE; >>   }   A:Number ","                                         <<@@ -
> 2889,7 +2906,7 @@ vfrStatementNumeric :
>                                                            }                                                        >>
> vfrStatementQuestionOptionList-  E:EndNumeric                                         << +
> E:EndNumeric                                         <<
> CRT_END_OP (E);                                                           if (GuidObj != NULL)
> {                                                             GuidObj->SetScope(1);@@ -3131,7
> +3148,7 @@ vfrStatementString :
>    {     Key "=" KN:Number ","                              << AssignQuestionKey (SObj,
> KN); >>   }-  MinSize "=" MIN:Number ","                           << +  MinSize "="
> MIN:Number ","                           <<
> VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); StringMinSize = 
> _STOU8(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(),
> MIN->getLine()) > StringMinSize) {@@ -3141,7
> +3158,7 @@ vfrStatementString :
>                                                            }
> SObj.SetMinSize (StringMinSize);                                                        >>-  MaxSize
> "=" MAX:Number ","                           << +  MaxSize "=" MAX:Number ","
> <<                                                           StringMaxSize = _STOU8(MAX->getText(),
> MAX->getLine());                                                           if (_STOU64(MAX-
> >getText(), MAX->getLine()) > StringMaxSize)
> {                                                             _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize takes 
> only one byte, which can't be larger than 0xFF.");@@ -3185,7 +3202,7 
> @@ vfrStatementPassword :
>    {     Key "=" KN:Number ","                              << AssignQuestionKey (PObj,
> KN); >>   }-  MinSize "=" MIN:Number ","                           << +  MinSize "="
> MIN:Number ","                           <<
> VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); PasswordMinSize = 
> _STOU16(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(),
> MIN->getLine()) > PasswordMinSize) {@@ -
> 3195,7 +3212,7 @@ vfrStatementPassword :
>                                                            }
> PObj.SetMinSize (PasswordMinSize);                                                        >>-
> MaxSize "=" MAX:Number ","                           << +  MaxSize "=" MAX:Number
> ","                           <<                                                           PasswordMaxSize =
> _STOU16(MAX->getText(), MAX->getLine());                                                           if
> (_STOU64(MAX->getText(), MAX->getLine()) > PasswordMaxSize)
> {                                                             _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize takes 
> only two byte, which can't be larger than 0xFFFF.");@@ -3230,12
> +3247,12 @@ vfrStatementOrderedList :
>    >>   L:OrderedList                                        << OLObj.SetLineNo(L->getLine());
> gIsOrderedList = TRUE;>>   vfrQuestionHeader[OLObj] ","-
> << +                                                       <<
> VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); OLObj.SetMaxContainers
> ((UINT8) (VarArraySize > 0xFF ? 0xFF :
> VarArraySize));                                                        >>   {-    MaxContainers "="
> M:Number ","                     << +    MaxContainers "=" M:Number ","
> <<                                                           if (_STOU64(M->getText(), M->getLine()) >
> _STOU8(M->getText(), M->getLine()))
> {                                                             _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList 
> MaxContainers takes only one byte, which can't be larger than
> 0xFF.");                                                           } else if (VarArraySize != 0 &&
> _STOU8(M->getText(), M->getLine()) > VarArraySize) {@@ -3328,19
> +3345,19 @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :
>    {     "default" "=" N:Number ","                         <<
> switch (KeyValue) {-                                                          case 0: -
> T.Hour   = _STOU8(N->getText(), N->getLine()); +
> case 0:+                                                            T.Hour   = _STOU8(N->getText(), N-
> >getLine());                                                             if (T.Hour > 23)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value must
> be between 0 and 23.");                                                             }
> break;-                                                          case 1: -
> T.Minute = _STOU8(N->getText(), N->getLine()); +
> case 1:+                                                            T.Minute = _STOU8(N->getText(), N-
> >getLine());                                                             if (T.Minute > 59)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value
> must be between 0 and 59.");                                                             }
> break;-                                                          case 2: +
> case 2:                                                             T.Second = _STOU8(N->getText(), N-
> >getLine());                                                             if (T.Second > 59)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value 
> must be between 0 and 59.");@@ -3419,11 +3436,11 @@ 
> vfrStatementStatListOld :
>    ;  vfrStatementDisableIfStat :-  << -    CIfrDisableIf DIObj; +  <<+
> CIfrDisableIf DIObj;   >>   L:DisableIf                                          <<
> DIObj.SetLineNo(L->getLine()); >>-  vfrStatementExpression[0] ";" +
> vfrStatementExpression[0] ";"   ( vfrStatementStatList )*   E:EndIf
> << CRT_END_OP (E); >>   ";"@@ -3548,8 +3565,8 @@
> vfrStatementWarningIf :
>    ;  vfrStatementDisableIfQuest :-  << -    CIfrDisableIf DIObj; +  <<+
> CIfrDisableIf DIObj;   >>   L:DisableIf                                          <<
> DIObj.SetLineNo(L->getLine()); >>   vfrStatementExpression[0] ";"@@ -
> 3616,15 +3633,15 @@ vfrStatementOneOfOption :
>       UINT32             *Type32       = (UINT32 *) ValueList;      UINT64
> *Type64       = (UINT64 *) ValueList;   >>-  L:Option                                             <<
> +  L:Option                                             <<                                                           if
> (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER)
> {                                                             _PCATCH (VFR_RETURN_FATAL_ERROR, L-
> >getLine(), "Get data type
> error.");                                                           }                                                         >>-
> Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","      +  Text  "="
> "STRING_TOKEN" "\(" S:Number "\)" ","   Value "="
> vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","-
> << +                                                       <<                                                           if
> (gCurrentMinMaxData != NULL) {                                                             //set
> min/max value for oneof opcode                                                             UINT64
> Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE(),
> _GET_CURRQEST_VARTINFO().mIsBitVar);@@ -3696,7 +3713,7 @@ 
> vfrStatementOneOfOption :
>                                                            Size += OFFSET_OF
> (EFI_IFR_ONE_OF_OPTION, Value);                                                           OOOObj =
> new CIfrOneOfOption((UINT8)Size);                                                           OOOObj-
> >SetLineNo(L->getLine());-                                                          OOOObj-
> >SetOption (_STOSID(S->getText(), S->getLine())); +
> OOOObj->SetOption (_STOSID(S->getText(), S->getLine()));
> if (ArrayType) {                                                             OOOObj->SetType
> (EFI_IFR_TYPE_BUFFER);                                                           } else {@@ -3706,7
> +3723,7 @@ vfrStatementOneOfOption :
>                                                                OOOObj->SetType
> (_GET_CURRQEST_DATATYPE());                                                             }
>                                       }-                                                          OOOObj->SetValue
> (*Val); +                                                          OOOObj->SetValue
> (*Val);                                                        >>   F:FLAGS "="
> vfrOneOfOptionFlags[*OOOObj, F->getLine()] <<@@ -3790,7 +3807,12 @@ 
> oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
>    | RestStyleFlag                                      << $HFlags |= 0x20; >>   |
> ReconnectRequiredFlag                              << $HFlags |= 0x40; >>   |
> ManufacturingFlag                                  << $LFlags |= 0x20; >>-  | DefaultFlag
> << $LFlags |= 0x10; >>+  | D:DefaultFlag                                      <<+
> $LFlags |= 0x10;+                                                          if (mIsCatchDefaultEnable)
> {+
> DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> >getLine());+                                                            }+
>  >>   | A:NVAccessFlag                                     <<
> gCVfrErrorHandle.HandleWarning
> (                                                             VFR_WARNING_OBSOLETED_FRAMEWORK
> _OPCODE,@@ -3963,7 +3985,7 @@ vfrStatementExpression [UINT32 
> RootLevel, UINT32 ExpOpCount = 0] :
>                                                                }                                                             }
>                                              }-                                                          +
> if ($RootLevel == 0) {                                                             _CLEAR_SAVED_OPHDR
> ();                                                             mCIfrOpHdrIndex --;@@ -4405,10
> +4427,10 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>                                                              for (Index = 0; Index < ListLen; Index++)
> {                                                               EILObj.SetValueList (Index,
> ValueList[Index]);                                                             }-
> +                                                             
> + EILObj.UpdateIfrBuffer();-
> _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());
> -                                                            +
> _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());+ if (QId 
> == EFI_QUESTION_ID_INVALID)
> {                                                               EILObj.SetQuestionId (QId, VarIdStr,
> LineNo);                                                             }@@ -4458,9 +4480,9 @@
> stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>    >>   L:StringRef   "\("-      ( +      (         "STRING_TOKEN"-        "\(" +        "\("
> S:Number << RefStringId = _STOSID(S->getText(), S->getLine()); >>         "\)"
> | I:Number << RefStringId = _STOSID(I->getText(), I->getLine()); >>@@
> | -
> 4499,10 +4521,10 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>       Info.mVarStoreId = 0;   >>   L:Get-  "\(" +  "\("       vfrStorageVarId[Info,
> VarIdStr, FALSE]       {"\|" FLAGS "=" numericVarStoreType [VarType] }-  "\)"
> << +  "\)"                                                 <<
> {                                                             if (Info.mVarStoreId == 0)
> {                                                               // support Date/Time question@@ -
> 4549,9 +4571,9 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>                                                                  
> _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> >getLine(), "Get/Set opcode don't support data
> array");                                                               }                                                             }
> -                                                            CIfrGet GObj(L->getLine()); -
> _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine()); -
> GObj.SetVarInfo (&Info); +                                                            CIfrGet GObj(L-
> >getLine());+                                                            _SAVE_OPHDR_COND (GObj,
> ($ExpOpCount == 0), L->getLine());+
> GObj.SetVarInfo (&Info);                                                             delete[] VarIdStr;
> $ExpOpCount++;                                                           }@@ -4608,7 +4630,7 @@
> question23refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>        {         Uuid "=" guidDefinition[Guid] ","                       << Type = 0x3; >>       }-
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"
> <<                                                           switch (Type) {@@ -4675,9 +4697,9 @@
> setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>    "\("      vfrStorageVarId[Info, VarIdStr, FALSE]      {"\|" FLAG "="
> numericVarStoreType [VarType] }-     ","
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +     ","
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"-
> << +                                                       <<
> {                                                             if (Info.mVarStoreId == 0)
> {                                                               // support Date/Time question@@ -
> 4724,8 +4746,8 @@ setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>                                                                  
> _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> >getLine(), "Get/Set opcode don't support data
> array");                                                               }                                                             }
> -                                                            CIfrSet TSObj(L->getLine()); -
> TSObj.SetVarInfo (&Info); +                                                            CIfrSet TSObj(L-
> >getLine());+                                                            TSObj.SetVarInfo (&Info);
> delete[] VarIdStr;
> $ExpOpCount++;                                                           }@@ -4808,9 +4830,9 @@
> spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>    ;  vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:- 
> L:Map
> -  "\(" -  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]  +  L:Map+
> "\("+  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   ":"
> << { CIfrMap MObj(L->getLine()); } >>   (     vfrStatementExpression[0]@@ -
> 4837,6 +4859,7 @@ spanFlags [UINT8 & Flags] :
>  class EfiVfrParser { << private:+  BOOLEAN             mIsCatchDefaultEnable;
> UINT8               mParserStatus;   BOOLEAN             mConstantOnlyInExpression;
> @@ -4880,6 +4903,7 @@ public:
>    VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN ANTLRTokenPtr);
> VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32);   VOID
> _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);+  VOID
> DefaultValueError (IN EFI_VFR_RETURN_CODE, IN UINT32);    VOID
> syn     (ANTLRAbstractToken  *, ANTLRChar *, SetWordType *,
> ANTLRTokenType, INT32); @@ -4909,6 +4933,7 @@ public:
>    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);   VOID                IdEqListDoSpecial     (IN
> UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN
> UINT16, IN UINT16 *);   VOID                SetOverrideClassGuid  (IN EFI_GUID *);+
> VOID                SetIsCatchDefaultEnable (BOOLEAN IsCatchDefaultEnable); >> }
> @@ -5086,6 +5111,17 @@ EfiVfrParser::_PCATCH (
>    mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError 
> (ReturnCode, LineNum, (CHAR8 *) ErrorMsg); }
> +VOID+EfiVfrParser::DefaultValueError (+  IN EFI_VFR_RETURN_CODE
> ReturnCode,+  IN UINT32              LineNum+  )+{+  CHAR8 ErrorMsg[100];+
> sprintf(ErrorMsg, "please remove the default value / defaultstore in 
> line %d", LineNum);+  mParserStatus = mParserStatus + 
> gCVfrErrorHandle.HandleError (ReturnCode, LineNum, ErrorMsg);+}+ VOID EfiVfrParser::syn
> (   ANTLRAbstractToken  *Tok,@@ -5682,12 +5718,18 @@
> EfiVfrParser::IdEqListDoSpecial (
>    } } -VOID +VOID EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID
> *OverrideClassGuid) {   mOverrideClassGuid = OverrideClassGuid; }
> +VOID+EfiVfrParser::SetIsCatchDefaultEnable (BOOLEAN
> IsCatchDefaultEnable)+{+  mIsCatchDefaultEnable = IsCatchDefaultEnable;+}+
> VOID EfiVfrParser::CheckDuplicateDefaultValue (   IN EFI_DEFAULT_ID
> DefaultId,--
> 2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112918): https://edk2.groups.io/g/devel/message/112918
Mute This Topic: https://groups.io/mt/103126873/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature
  2023-12-21  6:43     ` Zhang, Zifeng
@ 2023-12-22  5:41       ` Yuting Yang
       [not found]         ` <023101da36cf$a50bb8f0$ef232ad0$@byosoft.com.cn>
  2023-12-25  1:23       ` [edk2-devel] 回复: " gaoliming via groups.io
  1 sibling, 1 reply; 12+ messages in thread
From: Yuting Yang @ 2023-12-22  5:41 UTC (permalink / raw)
  To: Gao, Liming
  Cc: Rebecca Cran, Feng, Bob C, Chen, Arthur G, Chen, Christine,
	Zhang, Zifeng, devel@edk2.groups.io

Hi Liming,

Thank you for reviewing ~
Could you please help me create a Bugzilla account? Currently, I do not have access to the Bugzilla.

Best Regards,
Yuting

-----Original Message-----
From: Zhang, Zifeng <zifeng.zhang@intel.com> 
Sent: Thursday, December 21, 2023 2:44 PM
To: Gao, Liming <gaoliming@byosoft.com.cn>; Yang, Yuting2 <yuting2.yang@intel.com>
Cc: Rebecca Cran <rebecca@bsdio.com>; Feng, Bob C <bob.c.feng@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>; devel@edk2.groups.io; Chen, Christine <yuwei.chen@intel.com>
Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature

Hi Liming,

Thanks for reviewing.
For background of this change, we will remove default flags in VFR/HFR in new platform. So we need help from VFR complier to make a default flag check to avoid manually adding.
@Yang, Yuting2, could you help to create a BZ for this feature and share in mail thread?
Then let me make a clarification for your questions.

#1: The purpose of --catch_default
We send --catch_default flag in build option to indicate which platform should check default flag in VFR/HFR.
Actually maybe some platforms used same EDK2 downstream branch, so we only send --catch_default flag for the platforms which need this check.

#2: The purpose of --except_list
VFR compiler will receive VFR/HFR configurations from all folders including Intel and EDK2. But in our expectation VFR compiler only do this check in Intel.
So We use --except_list to deliver package list in EDK2 to avoid this check.

Best Regards,
Zifeng

-----Original Message-----
From: Yang, Yuting2 <yuting2.yang@intel.com>
Sent: Tuesday, December 12, 2023 5:12 PM
To: Zhang, Zifeng <zifeng.zhang@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>; devel@edk2.groups.io
Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature

+Cc Zhang, Zifeng, Chen, Arthur G

-----Original Message-----
From: Chen, Christine <yuwei.chen@intel.com>
Sent: Tuesday, December 12, 2023 5:04 PM
To: Yang, Yuting2 <yuting2.yang@intel.com>; devel@edk2.groups.io
Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature

+Cc Yang, Yuting2

> -----Original Message-----
> From: Yang, Yuting2 <yuting2.yang@intel.com>
> Sent: Tuesday, December 12, 2023 5:01 PM
> To: devel@edk2.groups.io
> Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>; Chen, 
> Christine <yuwei.chen@intel.com>
> Subject: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> Add --catch_default option
> Raise a DefaultValueError when encountering VFR default definitions to 
> help remove default variables.
> Add --except_list option
> Exclude packages that don't require enabling the catch_default function.
> 
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Christine Chen <yuwei.chen@intel.com>
> Cc: Yuting Yang <yuting2.yang@intel.com>
> 
> Signed-off-by: Yuting Yang <yuting2.yang@intel.com>
> ---
>  BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  40 ++-
>  BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   3 +
>  BaseTools/Source/C/VfrCompile/VfrError.cpp    |   3 +-
>  BaseTools/Source/C/VfrCompile/VfrError.h      |   3 +-
>  BaseTools/Source/C/VfrCompile/VfrFormPkg.h    |   1 +
>  BaseTools/Source/C/VfrCompile/VfrSyntax.g     | 238 ++++++++++--------
>  6 files changed, 184 insertions(+), 104 deletions(-)
> 
> diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> index 5f4d262d85..e97cebff65 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> @@ -78,6 +78,9 @@ CVfrCompiler::OptionInitialization (
>    mOptions.WarningAsError                = FALSE;   mOptions.AutoDefault
> = FALSE;   mOptions.CheckDefault                  = FALSE;+
> mOptions.IsCatchDefaultEnable          = FALSE;+  mOptions.ExceptionList
> = NULL;+  mOptions.ExceptionListSize             = 0;   memset
> (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));    if (Argc == 1) {@@ -
> 95,6 +98,23 @@ CVfrCompiler::OptionInitialization (
>        Version ();       SET_RUN_STATUS (STATUS_DEAD);       return;+    } else if
> (stricmp(Argv[Index], "--catch_default") == 0){+
> mOptions.IsCatchDefaultEnable = TRUE;+    } else if (stricmp(Argv[Index], "--
> except_list") == 0){+      INT32 Start = ++Index;+      if ((Start >= Argc) ||
> (Argv[Start][0] == '-')) {+        DebugError (NULL, 0, 1001, "Missing option", "-
> exception_list missing except list");+        goto Fail;+      }+      while
> ((Argv[Index][0] != '-') && (Index < Argc - 1)) {+        Index++;+      }+      INT32
> End = Index--;+      mOptions.ExceptionListSize = End - Start;+      for (INT32 i =
> Start; i < End; i++) {+        mOptions.ExceptionList = (CHAR8**)
> realloc(mOptions.ExceptionList, (i - Start + 1) * sizeof(CHAR8*));+
> mOptions.ExceptionList[i-Start] = Argv[i];+      }     } else if (stricmp(Argv[Index],
> "-l") == 0) {       mOptions.CreateRecordListFile = TRUE;
> gCIfrRecordInfoDB.TurnOn ();@@ -179,7 +199,11 @@ 
> CVfrCompiler::OptionInitialization (
>        goto Fail;     }     strcpy (mOptions.VfrFileName, Argv[Index]);-+    for (int i =
> 0; i < mOptions.ExceptionListSize; i++) {+      if (strstr(mOptions.VfrFileName,
> mOptions.ExceptionList[i]) != NULL) {+        mOptions.IsCatchDefaultEnable =
> FALSE;+      }+    }     if (mOptions.OutputDirectory == NULL)
> {       mOptions.OutputDirectory = (CHAR8 *) malloc (1);       if
> (mOptions.OutputDirectory == NULL) {@@ -217,6 +241,11 @@ Fail:
>      free (mOptions.VfrFileName);     mOptions.VfrFileName                 =
> NULL;   }+  if (mOptions.ExceptionList != NULL) {+
> free(mOptions.ExceptionList);+    mOptions.ExceptionList               = NULL;++  }
> if (mOptions.VfrBaseFileName != NULL) {     free (mOptions.VfrBaseFileName);
> mOptions.VfrBaseFileName             = NULL;@@ -496,6 +525,11 @@
> CVfrCompiler::~CVfrCompiler (
>      mOptions.VfrBaseFileName = NULL;   } +  if (mOptions.ExceptionList !=
> NULL) {+    free (mOptions.ExceptionList);+    mOptions.ExceptionList =
> NULL;+  }+   if (mOptions.OutputDirectory != NULL) {     free
> (mOptions.OutputDirectory);     mOptions.OutputDirectory = NULL;@@ -679,7
> +713,7 @@ CVfrCompiler::Compile (
>      DebugError (NULL, 0, 0001, "Error opening the input file", "%s",
> InFileName);     goto Fail;   }-+  InputInfo.IsCatchDefaultEnable =
> mOptions.IsCatchDefaultEnable;   if (mOptions.HasOverrideClassGuid)
> {     InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;   } else
> {@@ -937,5 +971,3 @@ main (
>     return GetUtilityStatus (); }--diff --git 
> a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> index b6e207d2ce..39e0a89a29 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> @@ -52,6 +52,9 @@ typedef struct {
>    BOOLEAN WarningAsError;   BOOLEAN AutoDefault;   BOOLEAN
> CheckDefault;+  BOOLEAN IsCatchDefaultEnable;+  CHAR8**  ExceptionList;+
> INT16    ExceptionListSize; } OPTIONS;  typedef enum {diff --git
> a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> index 65bb8e34fd..8a706f929b 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> @@ -49,7 +49,8 @@ static SVFR_WARNING_HANDLE VFR_WARNING_HANDLE_TABLE 
> [] = {
>    { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value re-defined
> with different value"},   { VFR_WARNING_ACTION_WITH_TEXT_TWO, ": Action
> opcode should not have TextTwo part"}, { 
> VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend to use 
> obsoleted framework opcode"},-  { VFR_WARNING_CODEUNDEFINED, ":
> undefined Warning Code" }+  { VFR_WARNING_CODEUNDEFINED, ":
> undefined Warning Code" },+  { VFR_WARNING_UNSUPPORTED, ": pls remove 
> the default values if necessary" } }; CVfrErrorHandle::CVfrErrorHandle 
> (diff -- git a/BaseTools/Source/C/VfrCompile/VfrError.h
> b/BaseTools/Source/C/VfrCompile/VfrError.h
> index 7d16bd5f74..1b4bc173d2 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrError.h
> +++ b/BaseTools/Source/C/VfrCompile/VfrError.h
> @@ -47,7 +47,8 @@ typedef enum {
>    VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0, 
> VFR_WARNING_ACTION_WITH_TEXT_TWO,
> VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,-
> VFR_WARNING_CODEUNDEFINED+  VFR_WARNING_CODEUNDEFINED,+ 
> VFR_WARNING_UNSUPPORTED } EFI_VFR_WARNING_CODE;  typedef struct 
> _SVFR_ERROR_HANDLE {diff --git 
> a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> index 9ef6f07787..d8fada3bcb 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> @@ -96,6 +96,7 @@ struct SBufferNode {
>   typedef struct {   EFI_GUID *OverrideClassGuid;+  BOOLEAN
> IsCatchDefaultEnable; } INPUT_INFO_TO_SYNTAX;  class CFormPkg {diff 
> --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> index 55fd067f8a..5daf1c423c 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> @@ -50,6 +50,7 @@ VfrParserStart (
>  {   ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken> VfrParser(File);
> VfrParser.parser()->SetOverrideClassGuid
> (InputInfo->OverrideClassGuid);+
> VfrParser.parser()->SetIsCatchDefaultEnable(InputInfo-
> >IsCatchDefaultEnable);   return VfrParser.parser()->vfrProgram(); } >>@@ -
> 386,8 +387,8 @@ dataStructField32 [BOOLEAN  FieldInUnion]:
>    ;  dataStructField16 [BOOLEAN  FieldInUnion]:-  << -    UINT32 ArrayNum = 0;
> +  <<+    UINT32 ArrayNum = 0;   >>   ("UINT16" | "CHAR16")
> N:StringIdentifier@@ -737,7 +738,7 @@ vfrFormSetList :
>    ;  vfrStatementExtension:-  << +  <<      EFI_GUID Guid;      CIfrGuid *GuidObj
> = NULL;      CHAR8    *TypeName = NULL;@@ -751,7 +752,7 @@
> vfrStatementExtension:
>    >>   L:GuidOp   Uuid "=" guidDefinition[Guid]-  {"," DataType "=" +  {","
> DataType "="     (         U64:"UINT64" {OpenBracket AN1:Number CloseBracket
> <<ArrayNum = _STOU32(AN1->getText(), AN1->getLine());>>} << TypeName =
> U64->getText(); LineNum = U64->getLine(); >>@@ -770,7
> +771,7 @@ vfrStatementExtension:
>        | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket 
> <<ArrayNum = _STOU32(AN8->getText(), AN8->getLine());>>}
> << TypeName = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>       |
> R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = 
> _STOU32(AN9->getText(), AN9->getLine());>>}- << TypeName =
> R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
> +                                                      << TypeName =
> + R->getText(); LineNum = R-
> >getLine(); IsStruct = TRUE;>>       | TN:StringIdentifier {OpenBracket
> AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText(), AN10-
> >getLine());>>}                                                       << TypeName = TN->getText();
> LineNum = TN->getLine(); IsStruct = TRUE;>>     )@@ -875,19 +876,19 @@
> vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 
> TypeSize,
>                  memcpy (ByteOffset, &Data_U64, TypeSize);               }else if (strcmp
> ("UINT32", TypeName) == 0) {                 Data_U32 = _STOU32(RD->getText(),
> RD->getLine());-                memcpy (ByteOffset, &Data_U32, TypeSize);
> +                memcpy (ByteOffset, &Data_U32, TypeSize);               }else if (strcmp
> ("UINT16", TypeName) == 0) {                 Data_U16 = _STOU16(RD->getText(),
> RD->getLine());-                memcpy (ByteOffset, &Data_U16, TypeSize);
> +                memcpy (ByteOffset, &Data_U16, TypeSize);               }else if (strcmp
> ("UINT8", TypeName) == 0) {                 Data_U8 = _STOU8(RD->getText(), RD-
> >getLine());-                memcpy (ByteOffset, &Data_U8, TypeSize);
> +                memcpy (ByteOffset, &Data_U8, TypeSize);               }else if (strcmp
> ("BOOLEAN", TypeName)== 0) {                 Data_BL = _STOU8(RD->getText(),
> RD->getLine());-                memcpy (ByteOffset, &Data_BL, TypeSize);
> +                memcpy (ByteOffset, &Data_BL, TypeSize);               }else if (strcmp
> ("EFI_STRING_ID", TypeName) == 0) {                 Data_SID = _STOSID(RD-
> >getText(), RD->getLine());-                memcpy (ByteOffset, &Data_SID,
> TypeSize);                                                    +                memcpy (ByteOffset,
> &Data_SID, TypeSize);               }             } else
> {               gCVfrVarDataTypeDB.GetDataFieldInfo(TFName, FieldOffset,
> FieldType, FieldSize, BitField);@@ -975,7 +976,15 @@
> vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 
> TypeSize,
>   vfrStatementDefaultStore :   << UINT16  DefaultId =
> EFI_HII_DEFAULT_CLASS_STANDARD; >>-  D:DefaultStore N:StringIdentifier
> ","+  D:DefaultStore N:StringIdentifier ","             <<+
> if (mIsCatchDefaultEnable) {+
> gCVfrErrorHandle.HandleWarning (+
> VFR_WARNING_UNSUPPORTED,+                                                          D-
> >getLine(),+                                                          D-
> >getText()+                                                          );+                                                      }+
>                                                     >>   Prompt "=" "STRING_TOKEN" "\(" S:Number
> "\)"   {     "," Attribute "=" A:Number                      << DefaultId = _STOU16(A-
> >getText(), A->getLine()); >>@@ -1074,7 +1083,7 @@
> vfrStatementVarStoreEfi :
>      | U64:"UINT64" ","                              << TypeName = U64->getText();
> LineNum = U64->getLine(); >>     | D:"EFI_HII_DATE" ","                          <<
> TypeName = D->getText(); LineNum = D->getLine(); >>     | T:"EFI_HII_TIME"
> ","                          << TypeName = T->getText(); LineNum = T->getLine(); >>-    |
> R:"EFI_HII_REF" ","                           << TypeName = R->getText(); LineNum = R-
> >getLine(); >>    +    | R:"EFI_HII_REF" ","                           << TypeName = R-
> >getText(); LineNum = R->getLine(); >>   )   {     VarId "=" ID:Number ","
> <<@@ -1092,8 +1101,8 @@ vfrStatementVarStoreEfi :
>    (     Name    "=" SN:StringIdentifier ","             << StoreName = SN-
> >getText();   >>    |-    Name    "=" "STRING_TOKEN" "\(" VN:Number "\)" ","  -
> VarSize "=" N:Number ","                        << +    Name    "=" "STRING_TOKEN"
> "\(" VN:Number "\)" ","+    VarSize "=" N:Number ","                        <<
> IsUEFI23EfiVarstore = FALSE;                                                        StoreName =
> gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText(), VN-
> >getLine()));                                                        if (StoreName == NULL) {@@ -
> 1116,7 +1125,7 @@ vfrStatementVarStoreEfi :
>                                                          break;                                                        case 8:
> TypeName = (CHAR8 *) "UINT64";-                                                        break; +
> break;                                                        default:
> _PCATCH (VFR_RETURN_UNSUPPORTED, N);
> break;@@ -1124,7 +1133,7 @@ vfrStatementVarStoreEfi :
>                                                      >>   ) -  Uuid "=" guidDefinition[Guid]
> << +  Uuid "=" guidDefinition[Guid]                     <<
> if (IsUEFI23EfiVarstore)
> {                                                        _PCATCH(gCVfrDataStorage.DeclareBufferVarS
> tore (                                                                                     StoreName,@@ -1150,7
> +1159,7 @@ vfrStatementVarStoreEfi :
>                                                         }
> VSEObj.SetGuid (&Guid);                                                        VSEObj.SetVarStoreId
> (VarStoreId);-                                                       +
> VSEObj.SetSize ((UINT16) Size);
> VSEObj.SetName (StoreName);                                                        if
> (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {@@ -1184,7
> +1193,7 @@ vfrStatementVarStoreNameValue :
>                                                      >>   }   (-    Name "=" "STRING_TOKEN" "\("
> N:Number "\)" ","  << +    Name "=" "STRING_TOKEN" "\(" N:Number "\)" ","
> <<                                                        if (!Created)
> {                                                          _PCATCH(gCVfrDataStorage.DeclareNameVar
> StoreBegin (SN->getText(), VarStoreId), SN); Created = TRUE;@@
> -1245,12 +1254,12 @@ vfrStatementDisableIfFormSet :
>  vfrStatementSuppressIfFormSet :   << CIfrSuppressIf SIObj;>>   L:SuppressIf
> <<-                                                           SIObj.SetLineNo(L->getLine()); +
> SIObj.SetLineNo(L->getLine());                                                        >>   { FLAGS "="
> flagsField ( "\|" flagsField )* "," }   vfrStatementExpression[0] ";"
> vfrFormSetList-  E: EndIf +  E: EndIf   ";"                                                  <<
> CRT_END_OP (E); >>   ; @@ -1491,7 +1500,7 @@ vfrQuestionDataFieldName
> [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
>    (     SN2:StringIdentifier                            << _STRCAT (&VarIdStr, SN2-
> >getText()); LineNo = SN2->getLine(); >>     (-      "."                                           << +
> "."                                           <<                                                        _STRCAT
> (&VarIdStr, ".");                                                        if
> (mConstantOnlyInExpression)
> {                                                          _PCATCH(VFR_RETURN_CONSTANT_ONLY,
> LineNo);@@ -1518,7 +1527,7 @@ vfrQuestionDataFieldName 
> [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
>    ;  vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> BOOLEAN &ListType] :-  <<  +  <<     EFI_GUID    Guid;     BOOLEAN     Negative =
> FALSE;     BOOLEAN     IntDecStyle = FALSE;@@ -1634,11 +1643,11 @@
> vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value, BOOLEAN 
> &ListType]
>    | Z:Zero                                          << $Value.u8     = _STOU8(Z->getText(), Z-
> >getLine()); >>   | HOUR:Number ":" MINUTE:Number ":" SECOND:Number <<
> $Value.time   = _STOT(HOUR->getText(), MINUTE->getText(),SECOND-
> >getText(), HOUR->getLine()); >>   | YEAR:Number "/" MONTH:Number "/"
> DAY:Number     << $Value.date   = _STOD(YEAR->getText(), MONTH->getText(),
> DAY->getText(), YEAR->getLine()); >>-  | QI:Number";" FI:Number";"
> guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)" +  | 
> QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\("
> DP:Number "\)"                                                     << $Value.ref    = _STOR(QI-
> >getText(), FI->getText(), &Guid, DP->getText(), QI->getLine()); >>   |
> "STRING_TOKEN" "\(" S1:Number "\)"              << $Value.string = _STOSID(S1-
> >getText(), S1->getLine()); >>   | "\{"                                            << ListType =
> TRUE; >>-      L1:Number                                     << +      L1:Number
> <<                                                        switch (Type)
> {                                                          case EFI_IFR_TYPE_NUM_SIZE_8 :
> Type8[Index]  = _STOU8(L1->getText(), L1->getLine());@@ -1658,8
> +1667,8 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> &Value, BOOLEAN &ListType]
>                                                         Index++;                                                     >>       (-
> "," -        L2:Number                                   << +        ","+        L2:Number
> <<                                                        switch (Type)
> {                                                          case EFI_IFR_TYPE_NUM_SIZE_8 :
> Type8[Index]  = _STOU8(L2->getText(), L2->getLine());@@ -1679,7
> +1688,7 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> &Value, BOOLEAN &ListType]
> 
> Index++;                                                     >>       )*-    "\}"                                           +
> "\}"   ;
> //**************************************************************
> ***************@@ -1714,7 +1723,7 @@ vfrFormDefinition :
>    ;  vfrFormMapDefinition :-  << +  <<     CIfrFormMap *FMapObj = NULL;
> UINT32      FormMapMethodNumber = 0;     EFI_GUID    Guid;@@ -1775,11
> +1784,15 @@ vfrStatementDefault :
>       CIfrNumeric           *NumericQst   = NULL;    >>-  D:Default
> +  D:Default                                         <<+                                                        if
> (mIsCatchDefaultEnable) {+
> DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> >getLine());+                                                        }+                                                    >>
> (     (-      "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val,
> ArrayType] ","  -                                                    << +      "="
> vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","+
> <<                                                         if (gCurrentMinMaxData != NULL &&
> gCurrentMinMaxData->IsNumericOpcode())
> {                                                           //check default value is valid for Numeric
> Opcode                                                           NumericQst = (CIfrNumeric *)
> gCurrentQuestion;@@ -1888,14 +1901,14 @@ vfrStatementDefault :
>          vfrStatementValue ","                       << CIfrEnd EndObj1;
> EndObj1.SetLineNo(D->getLine()); >>     )     {-      DefaultStore "="
> SN:StringIdentifier ","      << +      DefaultStore "=" SN:StringIdentifier ","      <<
> _PCATCH(gCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN);
> if (DObj != NULL) {-                                                          DObj->SetDefaultId
> (DefaultId); -                                                        } +
> DObj->SetDefaultId (DefaultId);+                                                        }
> if (DObj2 != NULL) {-                                                          DObj2->SetDefaultId
> (DefaultId); +                                                          DObj2->SetDefaultId
> (DefaultId);                                                         }                                                     >>
>  }@@ -1917,8 +1930,8 @@ vfrStatementDefault :
>                                                                     );                                                          }
>                                              }-                                                       if (DObj  != NULL)
> {delete DObj;} -                                                       if (DObj2 != NULL) {delete
> DObj2;} +                                                       if (DObj  != NULL) {delete DObj;}+
> if (DObj2 != NULL) {delete DObj2;}                                                     >>   )   ;@@ -
> 1970,11 +1983,15 @@ vfrStatementInvalid :
>    ;  flagsField :-  Number -  | InteractiveFlag -  | 
> ManufacturingFlag -  | DefaultFlag -  | ResetRequiredFlag +  Number+
> | InteractiveFlag+  |
> ManufacturingFlag+  | D:DefaultFlag                                      <<+
> if (mIsCatchDefaultEnable) {+
> DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> >getLine());+                                                          }+
> >>+  | ResetRequiredFlag   | ReconnectRequiredFlag   | N:NVAccessFlag
> <<                                                           gCVfrErrorHandle.HandleWarning (@@ -
> 1989,7 +2006,7 @@ flagsField :
>                                                              
> L->getLine(),
> L->getText()                                                             );-
>                                                        >> +                                                       >>   ;
> vfrStatementValue :@@ -2001,13 +2018,13 @@ vfrStatementValue :
>  vfrStatementRead :   << CIfrRead RObj; >>   R:Read
> << RObj.SetLineNo(R->getLine()); >>-  vfrStatementExpression[0] ";" +
> vfrStatementExpression[0] ";"   ;  vfrStatementWrite :   << CIfrWrite WObj; >>
> W:Write                                              << WObj.SetLineNo(W->getLine()); >>-
> vfrStatementExpression[0] ";" +  vfrStatementExpression[0] ";"   ;
> vfrStatementSubTitle :@@ -2140,7 +2157,7 @@ vfrStatementGoto :
>        FormId "=" F3:Number ","                         << RefType = 2; FId = _STOFID(F3-
> >getText(), F3->getLine()); >>       Question "="       (-          QN3:StringIdentifier
> ","                     << +          QN3:StringIdentifier ","                     <<
> mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask); 
> if (QId == EFI_QUESTION_ID_INVALID)
> {                                                             _PCATCH(VFR_RETURN_UNDEFINED,
> QN3);@@ -2222,7 +2239,7 @@ vfrStatementGoto :
>      "," Key "=" KN:Number                              << AssignQuestionKey (*QHObj,
> KN); >>   }   {-    E:"," +    E:","       vfrStatementQuestionOptionList                   <<
> OHObj->SetScope(1); CRT_END_OP (E);>>   }   ";"
> << 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;}>>@@ -2511,20 +2528,20 @@ 
> minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
>    {     "default" "=" N:Number ","                         <<
> switch (KeyValue) {-                                                          case 0: +
> case 0:                                                             D.Year  = _STOU16(N->getText(), N-
> >getLine());                                                             if (D.Year < _STOU16 (MinN-
> >getText(), MinN->getLine()) || D.Year > _STOU16 (MaxN->getText(), MaxN-
> >getLine())) {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value must
> be between Min year and Max year.");                                                             }
> break;-                                                          case 1: -
> D.Month = _STOU8(N->getText(), N->getLine()); +
> case 1:+                                                            D.Month = _STOU8(N->getText(), N-
> >getLine());                                                             if (D.Month < 1 || D.Month > 12)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value
> must be between 1 and 12.");                                                             }
> break;-                                                          case 2: -
> D.Day = _STOU8(N->getText(), N->getLine()); +
> case 2:+                                                            D.Day = _STOU8(N->getText(), N-
> >getLine());                                                             if (D.Day < 1 || D.Day > 31)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value must
> be between 1 and 31.");                                                             }@@ -2570,7
> +2587,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
>       BOOLEAN MinNegative = FALSE;      BOOLEAN MaxNegative = FALSE;   >>-
> Minimum   "=" +  Minimum   "="   {     "\-"                                               <<
> MinNegative = TRUE; >>   }@@ -2659,8 +2676,8 @@
> vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
>                                                              }                                                           }
>                                       >>-  Maximum   "=" -  { +  Maximum   "="+  {     "\-"
> << MaxNegative = TRUE; >>   }   A:Number ","                                         <<@@ -
> 2889,7 +2906,7 @@ vfrStatementNumeric :
>                                                            }                                                        >>
> vfrStatementQuestionOptionList-  E:EndNumeric                                         << +
> E:EndNumeric                                         <<
> CRT_END_OP (E);                                                           if (GuidObj != NULL)
> {                                                             GuidObj->SetScope(1);@@ -3131,7
> +3148,7 @@ vfrStatementString :
>    {     Key "=" KN:Number ","                              << AssignQuestionKey (SObj,
> KN); >>   }-  MinSize "=" MIN:Number ","                           << +  MinSize "="
> MIN:Number ","                           <<
> VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); StringMinSize = 
> _STOU8(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(),
> MIN->getLine()) > StringMinSize) {@@ -3141,7
> +3158,7 @@ vfrStatementString :
>                                                            }
> SObj.SetMinSize (StringMinSize);                                                        >>-  MaxSize
> "=" MAX:Number ","                           << +  MaxSize "=" MAX:Number ","
> <<                                                           StringMaxSize = _STOU8(MAX->getText(),
> MAX->getLine());                                                           if (_STOU64(MAX-
> >getText(), MAX->getLine()) > StringMaxSize)
> {                                                             _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize takes 
> only one byte, which can't be larger than 0xFF.");@@ -3185,7 +3202,7 
> @@ vfrStatementPassword :
>    {     Key "=" KN:Number ","                              << AssignQuestionKey (PObj,
> KN); >>   }-  MinSize "=" MIN:Number ","                           << +  MinSize "="
> MIN:Number ","                           <<
> VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); PasswordMinSize = 
> _STOU16(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(),
> MIN->getLine()) > PasswordMinSize) {@@ -
> 3195,7 +3212,7 @@ vfrStatementPassword :
>                                                            }
> PObj.SetMinSize (PasswordMinSize);                                                        >>-
> MaxSize "=" MAX:Number ","                           << +  MaxSize "=" MAX:Number
> ","                           <<                                                           PasswordMaxSize =
> _STOU16(MAX->getText(), MAX->getLine());                                                           if
> (_STOU64(MAX->getText(), MAX->getLine()) > PasswordMaxSize)
> {                                                             _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize takes 
> only two byte, which can't be larger than 0xFFFF.");@@ -3230,12
> +3247,12 @@ vfrStatementOrderedList :
>    >>   L:OrderedList                                        << OLObj.SetLineNo(L->getLine());
> gIsOrderedList = TRUE;>>   vfrQuestionHeader[OLObj] ","-
> << +                                                       <<
> VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); OLObj.SetMaxContainers
> ((UINT8) (VarArraySize > 0xFF ? 0xFF :
> VarArraySize));                                                        >>   {-    MaxContainers "="
> M:Number ","                     << +    MaxContainers "=" M:Number ","
> <<                                                           if (_STOU64(M->getText(), M->getLine()) >
> _STOU8(M->getText(), M->getLine()))
> {                                                             _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList 
> MaxContainers takes only one byte, which can't be larger than
> 0xFF.");                                                           } else if (VarArraySize != 0 &&
> _STOU8(M->getText(), M->getLine()) > VarArraySize) {@@ -3328,19
> +3345,19 @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :
>    {     "default" "=" N:Number ","                         <<
> switch (KeyValue) {-                                                          case 0: -
> T.Hour   = _STOU8(N->getText(), N->getLine()); +
> case 0:+                                                            T.Hour   = _STOU8(N->getText(), N-
> >getLine());                                                             if (T.Hour > 23)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value must
> be between 0 and 23.");                                                             }
> break;-                                                          case 1: -
> T.Minute = _STOU8(N->getText(), N->getLine()); +
> case 1:+                                                            T.Minute = _STOU8(N->getText(), N-
> >getLine());                                                             if (T.Minute > 59)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value
> must be between 0 and 59.");                                                             }
> break;-                                                          case 2: +
> case 2:                                                             T.Second = _STOU8(N->getText(), N-
> >getLine());                                                             if (T.Second > 59)
> {                                                               _PCATCH
> (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value 
> must be between 0 and 59.");@@ -3419,11 +3436,11 @@ 
> vfrStatementStatListOld :
>    ;  vfrStatementDisableIfStat :-  << -    CIfrDisableIf DIObj; +  <<+
> CIfrDisableIf DIObj;   >>   L:DisableIf                                          <<
> DIObj.SetLineNo(L->getLine()); >>-  vfrStatementExpression[0] ";" +
> vfrStatementExpression[0] ";"   ( vfrStatementStatList )*   E:EndIf
> << CRT_END_OP (E); >>   ";"@@ -3548,8 +3565,8 @@
> vfrStatementWarningIf :
>    ;  vfrStatementDisableIfQuest :-  << -    CIfrDisableIf DIObj; +  <<+
> CIfrDisableIf DIObj;   >>   L:DisableIf                                          <<
> DIObj.SetLineNo(L->getLine()); >>   vfrStatementExpression[0] ";"@@ -
> 3616,15 +3633,15 @@ vfrStatementOneOfOption :
>       UINT32             *Type32       = (UINT32 *) ValueList;      UINT64
> *Type64       = (UINT64 *) ValueList;   >>-  L:Option                                             <<
> +  L:Option                                             <<                                                           if
> (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER)
> {                                                             _PCATCH (VFR_RETURN_FATAL_ERROR, L-
> >getLine(), "Get data type
> error.");                                                           }                                                         >>-
> Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","      +  Text  "="
> "STRING_TOKEN" "\(" S:Number "\)" ","   Value "="
> vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","-
> << +                                                       <<                                                           if
> (gCurrentMinMaxData != NULL) {                                                             //set
> min/max value for oneof opcode                                                             UINT64
> Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE(),
> _GET_CURRQEST_VARTINFO().mIsBitVar);@@ -3696,7 +3713,7 @@ 
> vfrStatementOneOfOption :
>                                                            Size += OFFSET_OF
> (EFI_IFR_ONE_OF_OPTION, Value);                                                           OOOObj =
> new CIfrOneOfOption((UINT8)Size);                                                           OOOObj-
> >SetLineNo(L->getLine());-                                                          OOOObj-
> >SetOption (_STOSID(S->getText(), S->getLine())); +
> OOOObj->SetOption (_STOSID(S->getText(), S->getLine()));
> if (ArrayType) {                                                             OOOObj->SetType
> (EFI_IFR_TYPE_BUFFER);                                                           } else {@@ -3706,7
> +3723,7 @@ vfrStatementOneOfOption :
>                                                                OOOObj->SetType
> (_GET_CURRQEST_DATATYPE());                                                             }
>                                       }-                                                          OOOObj->SetValue
> (*Val); +                                                          OOOObj->SetValue
> (*Val);                                                        >>   F:FLAGS "="
> vfrOneOfOptionFlags[*OOOObj, F->getLine()] <<@@ -3790,7 +3807,12 @@ 
> oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
>    | RestStyleFlag                                      << $HFlags |= 0x20; >>   |
> ReconnectRequiredFlag                              << $HFlags |= 0x40; >>   |
> ManufacturingFlag                                  << $LFlags |= 0x20; >>-  | DefaultFlag
> << $LFlags |= 0x10; >>+  | D:DefaultFlag                                      <<+
> $LFlags |= 0x10;+                                                          if (mIsCatchDefaultEnable)
> {+
> DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> >getLine());+                                                            }+
>  >>   | A:NVAccessFlag                                     <<
> gCVfrErrorHandle.HandleWarning
> (                                                             VFR_WARNING_OBSOLETED_FRAMEWORK
> _OPCODE,@@ -3963,7 +3985,7 @@ vfrStatementExpression [UINT32 
> RootLevel, UINT32 ExpOpCount = 0] :
>                                                                }                                                             }
>                                              }-                                                          +
> if ($RootLevel == 0) {                                                             _CLEAR_SAVED_OPHDR
> ();                                                             mCIfrOpHdrIndex --;@@ -4405,10
> +4427,10 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>                                                              for (Index = 0; Index < ListLen; Index++)
> {                                                               EILObj.SetValueList (Index,
> ValueList[Index]);                                                             }-
> +                                                             
> + EILObj.UpdateIfrBuffer();-
> _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());
> -                                                            +
> _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());+ if (QId 
> == EFI_QUESTION_ID_INVALID)
> {                                                               EILObj.SetQuestionId (QId, VarIdStr,
> LineNo);                                                             }@@ -4458,9 +4480,9 @@
> stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>    >>   L:StringRef   "\("-      ( +      (         "STRING_TOKEN"-        "\(" +        "\("
> S:Number << RefStringId = _STOSID(S->getText(), S->getLine()); >>         "\)"
> | I:Number << RefStringId = _STOSID(I->getText(), I->getLine()); >>@@
> | -
> 4499,10 +4521,10 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>       Info.mVarStoreId = 0;   >>   L:Get-  "\(" +  "\("       vfrStorageVarId[Info,
> VarIdStr, FALSE]       {"\|" FLAGS "=" numericVarStoreType [VarType] }-  "\)"
> << +  "\)"                                                 <<
> {                                                             if (Info.mVarStoreId == 0)
> {                                                               // support Date/Time question@@ -
> 4549,9 +4571,9 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>                                                                  
> _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> >getLine(), "Get/Set opcode don't support data
> array");                                                               }                                                             }
> -                                                            CIfrGet GObj(L->getLine()); -
> _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine()); -
> GObj.SetVarInfo (&Info); +                                                            CIfrGet GObj(L-
> >getLine());+                                                            _SAVE_OPHDR_COND (GObj,
> ($ExpOpCount == 0), L->getLine());+
> GObj.SetVarInfo (&Info);                                                             delete[] VarIdStr;
> $ExpOpCount++;                                                           }@@ -4608,7 +4630,7 @@
> question23refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>        {         Uuid "=" guidDefinition[Guid] ","                       << Type = 0x3; >>       }-
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"
> <<                                                           switch (Type) {@@ -4675,9 +4697,9 @@
> setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>    "\("      vfrStorageVarId[Info, VarIdStr, FALSE]      {"\|" FLAG "="
> numericVarStoreType [VarType] }-     ","
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +     ","
> vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"-
> << +                                                       <<
> {                                                             if (Info.mVarStoreId == 0)
> {                                                               // support Date/Time question@@ -
> 4724,8 +4746,8 @@ setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>                                                                  
> _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> >getLine(), "Get/Set opcode don't support data
> array");                                                               }                                                             }
> -                                                            CIfrSet TSObj(L->getLine()); -
> TSObj.SetVarInfo (&Info); +                                                            CIfrSet TSObj(L-
> >getLine());+                                                            TSObj.SetVarInfo (&Info);
> delete[] VarIdStr;
> $ExpOpCount++;                                                           }@@ -4808,9 +4830,9 @@
> spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
>    ;  vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:- 
> L:Map
> -  "\(" -  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]  +  L:Map+
> "\("+  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   ":"
> << { CIfrMap MObj(L->getLine()); } >>   (     vfrStatementExpression[0]@@ -
> 4837,6 +4859,7 @@ spanFlags [UINT8 & Flags] :
>  class EfiVfrParser { << private:+  BOOLEAN             mIsCatchDefaultEnable;
> UINT8               mParserStatus;   BOOLEAN             mConstantOnlyInExpression;
> @@ -4880,6 +4903,7 @@ public:
>    VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN ANTLRTokenPtr);
> VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32);   VOID
> _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);+  VOID
> DefaultValueError (IN EFI_VFR_RETURN_CODE, IN UINT32);    VOID
> syn     (ANTLRAbstractToken  *, ANTLRChar *, SetWordType *,
> ANTLRTokenType, INT32); @@ -4909,6 +4933,7 @@ public:
>    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);   VOID                IdEqListDoSpecial     (IN
> UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN
> UINT16, IN UINT16 *);   VOID                SetOverrideClassGuid  (IN EFI_GUID *);+
> VOID                SetIsCatchDefaultEnable (BOOLEAN IsCatchDefaultEnable); >> }
> @@ -5086,6 +5111,17 @@ EfiVfrParser::_PCATCH (
>    mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError 
> (ReturnCode, LineNum, (CHAR8 *) ErrorMsg); }
> +VOID+EfiVfrParser::DefaultValueError (+  IN EFI_VFR_RETURN_CODE
> ReturnCode,+  IN UINT32              LineNum+  )+{+  CHAR8 ErrorMsg[100];+
> sprintf(ErrorMsg, "please remove the default value / defaultstore in 
> line %d", LineNum);+  mParserStatus = mParserStatus + 
> gCVfrErrorHandle.HandleError (ReturnCode, LineNum, ErrorMsg);+}+ VOID EfiVfrParser::syn
> (   ANTLRAbstractToken  *Tok,@@ -5682,12 +5718,18 @@
> EfiVfrParser::IdEqListDoSpecial (
>    } } -VOID +VOID EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID
> *OverrideClassGuid) {   mOverrideClassGuid = OverrideClassGuid; }
> +VOID+EfiVfrParser::SetIsCatchDefaultEnable (BOOLEAN
> IsCatchDefaultEnable)+{+  mIsCatchDefaultEnable = IsCatchDefaultEnable;+}+
> VOID EfiVfrParser::CheckDuplicateDefaultValue (   IN EFI_DEFAULT_ID
> DefaultId,--
> 2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112836): https://edk2.groups.io/g/devel/message/112836
Mute This Topic: https://groups.io/mt/103126873/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [edk2-devel] 回复: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature
  2023-12-21  6:43     ` Zhang, Zifeng
  2023-12-22  5:41       ` Yuting Yang
@ 2023-12-25  1:23       ` gaoliming via groups.io
  2023-12-25  7:14         ` [edk2-devel] " Zhang, Zifeng
  1 sibling, 1 reply; 12+ messages in thread
From: gaoliming via groups.io @ 2023-12-25  1:23 UTC (permalink / raw)
  To: 'Zhang, Zifeng', 'Yang, Yuting2'
  Cc: 'Rebecca Cran', 'Feng, Bob C',
	'Chen, Arthur G', devel, 'Chen, Christine'

Zifeng:
 VFR_FLAGS can be set in the module INF for this module only. So, you can
set --catch_default option in the modules those you want to remove the
default opcode for. With this usage, --except_list option is not required. 

 For example, module INF can add below section to enable this option. 

 [BuildOptions]
 *_*_*_VFR_FLAGS = --catch_default

Thanks
Liming
> -----邮件原件-----
> 发件人: Zhang, Zifeng <zifeng.zhang@intel.com>
> 发送时间: 2023年12月21日 14:44
> 收件人: Gao, Liming <gaoliming@byosoft.com.cn>; Yang, Yuting2
> <yuting2.yang@intel.com>
> 抄送: Rebecca Cran <rebecca@bsdio.com>; Feng, Bob C
> <bob.c.feng@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>;
> devel@edk2.groups.io; Chen, Christine <yuwei.chen@intel.com>
> 主题: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature
> 
> Hi Liming,
> 
> Thanks for reviewing.
> For background of this change, we will remove default flags in VFR/HFR in
> new platform. So we need help from VFR complier to make a default flag
> check to avoid manually adding.
> @Yang, Yuting2, could you help to create a BZ for this feature and share
in
> mail thread?
> Then let me make a clarification for your questions.
> 
> #1: The purpose of --catch_default
> We send --catch_default flag in build option to indicate which platform
should
> check default flag in VFR/HFR.
> Actually maybe some platforms used same EDK2 downstream branch, so we
> only send --catch_default flag for the platforms which need this check.
> 
> #2: The purpose of --except_list
> VFR compiler will receive VFR/HFR configurations from all folders
including
> Intel and EDK2. But in our expectation VFR compiler only do this check in
> Intel.
> So We use --except_list to deliver package list in EDK2 to avoid this
check.
> 
> Best Regards,
> Zifeng
> 
> -----Original Message-----
> From: Yang, Yuting2 <yuting2.yang@intel.com>
> Sent: Tuesday, December 12, 2023 5:12 PM
> To: Zhang, Zifeng <zifeng.zhang@intel.com>; Chen, Arthur G
> <arthur.g.chen@intel.com>; devel@edk2.groups.io
> Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
> Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError
> Feature
> 
> +Cc Zhang, Zifeng, Chen, Arthur G
> 
> -----Original Message-----
> From: Chen, Christine <yuwei.chen@intel.com>
> Sent: Tuesday, December 12, 2023 5:04 PM
> To: Yang, Yuting2 <yuting2.yang@intel.com>; devel@edk2.groups.io
> Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
> Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError
> Feature
> 
> +Cc Yang, Yuting2
> 
> > -----Original Message-----
> > From: Yang, Yuting2 <yuting2.yang@intel.com>
> > Sent: Tuesday, December 12, 2023 5:01 PM
> > To: devel@edk2.groups.io
> > Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming
> > <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>; Chen,
> > Christine <yuwei.chen@intel.com>
> > Subject: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError
> > Feature
> >
> > Add --catch_default option
> > Raise a DefaultValueError when encountering VFR default definitions to
> > help remove default variables.
> > Add --except_list option
> > Exclude packages that don't require enabling the catch_default function.
> >
> > Cc: Rebecca Cran <rebecca@bsdio.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Bob Feng <bob.c.feng@intel.com>
> > Cc: Christine Chen <yuwei.chen@intel.com>
> > Cc: Yuting Yang <yuting2.yang@intel.com>
> >
> > Signed-off-by: Yuting Yang <yuting2.yang@intel.com>
> > ---
> >  BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  40 ++-
> >  BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   3 +
> >  BaseTools/Source/C/VfrCompile/VfrError.cpp    |   3 +-
> >  BaseTools/Source/C/VfrCompile/VfrError.h      |   3 +-
> >  BaseTools/Source/C/VfrCompile/VfrFormPkg.h    |   1 +
> >  BaseTools/Source/C/VfrCompile/VfrSyntax.g     | 238
> ++++++++++--------
> >  6 files changed, 184 insertions(+), 104 deletions(-)
> >
> > diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > index 5f4d262d85..e97cebff65 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > @@ -78,6 +78,9 @@ CVfrCompiler::OptionInitialization (
> >    mOptions.WarningAsError                = FALSE;
> mOptions.AutoDefault
> > = FALSE;   mOptions.CheckDefault                  = FALSE;+
> > mOptions.IsCatchDefaultEnable          = FALSE;+
> mOptions.ExceptionList
> > = NULL;+  mOptions.ExceptionListSize             = 0;   memset
> > (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));    if (Argc == 1)
> {@@ -
> > 95,6 +98,23 @@ CVfrCompiler::OptionInitialization (
> >        Version ();       SET_RUN_STATUS (STATUS_DEAD);
> return;+    } else if
> > (stricmp(Argv[Index], "--catch_default") == 0){+
> > mOptions.IsCatchDefaultEnable = TRUE;+    } else if
(stricmp(Argv[Index],
> "--
> > except_list") == 0){+      INT32 Start = ++Index;+      if ((Start >=
Argc)
> ||
> > (Argv[Start][0] == '-')) {+        DebugError (NULL, 0, 1001, "Missing
> option", "-
> > exception_list missing except list");+        goto Fail;+      }+
> while
> > ((Argv[Index][0] != '-') && (Index < Argc - 1)) {+        Index++;+
}+
> INT32
> > End = Index--;+      mOptions.ExceptionListSize = End - Start;+      for
> (INT32 i =
> > Start; i < End; i++) {+        mOptions.ExceptionList = (CHAR8**)
> > realloc(mOptions.ExceptionList, (i - Start + 1) * sizeof(CHAR8*));+
> > mOptions.ExceptionList[i-Start] = Argv[i];+      }     } else if
> (stricmp(Argv[Index],
> > "-l") == 0) {       mOptions.CreateRecordListFile = TRUE;
> > gCIfrRecordInfoDB.TurnOn ();@@ -179,7 +199,11 @@
> > CVfrCompiler::OptionInitialization (
> >        goto Fail;     }     strcpy (mOptions.VfrFileName,
> Argv[Index]);-+    for (int i =
> > 0; i < mOptions.ExceptionListSize; i++) {+      if
> (strstr(mOptions.VfrFileName,
> > mOptions.ExceptionList[i]) != NULL) {+
> mOptions.IsCatchDefaultEnable =
> > FALSE;+      }+    }     if (mOptions.OutputDirectory == NULL)
> > {       mOptions.OutputDirectory = (CHAR8 *) malloc (1);       if
> > (mOptions.OutputDirectory == NULL) {@@ -217,6 +241,11 @@ Fail:
> >      free (mOptions.VfrFileName);     mOptions.VfrFileName
> =
> > NULL;   }+  if (mOptions.ExceptionList != NULL) {+
> > free(mOptions.ExceptionList);+    mOptions.ExceptionList
> = NULL;++  }
> > if (mOptions.VfrBaseFileName != NULL) {     free
> (mOptions.VfrBaseFileName);
> > mOptions.VfrBaseFileName             = NULL;@@ -496,6 +525,11
> @@
> > CVfrCompiler::~CVfrCompiler (
> >      mOptions.VfrBaseFileName = NULL;   } +  if
> (mOptions.ExceptionList !=
> > NULL) {+    free (mOptions.ExceptionList);+    mOptions.ExceptionList =
> > NULL;+  }+   if (mOptions.OutputDirectory != NULL) {     free
> > (mOptions.OutputDirectory);     mOptions.OutputDirectory = NULL;@@
> -679,7
> > +713,7 @@ CVfrCompiler::Compile (
> >      DebugError (NULL, 0, 0001, "Error opening the input file", "%s",
> > InFileName);     goto Fail;   }-+  InputInfo.IsCatchDefaultEnable =
> > mOptions.IsCatchDefaultEnable;   if (mOptions.HasOverrideClassGuid)
> > {     InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;   }
> else
> > {@@ -937,5 +971,3 @@ main (
> >     return GetUtilityStatus (); }--diff --git
> > a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > index b6e207d2ce..39e0a89a29 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > @@ -52,6 +52,9 @@ typedef struct {
> >    BOOLEAN WarningAsError;   BOOLEAN AutoDefault;   BOOLEAN
> > CheckDefault;+  BOOLEAN IsCatchDefaultEnable;+  CHAR8**
> ExceptionList;+
> > INT16    ExceptionListSize; } OPTIONS;  typedef enum {diff --git
> > a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > index 65bb8e34fd..8a706f929b 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > @@ -49,7 +49,8 @@ static SVFR_WARNING_HANDLE
> VFR_WARNING_HANDLE_TABLE
> > [] = {
> >    { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value
> re-defined
> > with different value"},   { VFR_WARNING_ACTION_WITH_TEXT_TWO, ":
> Action
> > opcode should not have TextTwo part"}, {
> > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend to
> use
> > obsoleted framework opcode"},-  { VFR_WARNING_CODEUNDEFINED, ":
> > undefined Warning Code" }+  { VFR_WARNING_CODEUNDEFINED, ":
> > undefined Warning Code" },+  { VFR_WARNING_UNSUPPORTED, ": pls
> remove
> > the default values if necessary" } }; CVfrErrorHandle::CVfrErrorHandle
> > (diff -- git a/BaseTools/Source/C/VfrCompile/VfrError.h
> > b/BaseTools/Source/C/VfrCompile/VfrError.h
> > index 7d16bd5f74..1b4bc173d2 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrError.h
> > +++ b/BaseTools/Source/C/VfrCompile/VfrError.h
> > @@ -47,7 +47,8 @@ typedef enum {
> >    VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0,
> > VFR_WARNING_ACTION_WITH_TEXT_TWO,
> > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,-
> > VFR_WARNING_CODEUNDEFINED+  VFR_WARNING_CODEUNDEFINED,+
> > VFR_WARNING_UNSUPPORTED } EFI_VFR_WARNING_CODE;  typedef
> struct
> > _SVFR_ERROR_HANDLE {diff --git
> > a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > index 9ef6f07787..d8fada3bcb 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > @@ -96,6 +96,7 @@ struct SBufferNode {
> >   typedef struct {   EFI_GUID *OverrideClassGuid;+  BOOLEAN
> > IsCatchDefaultEnable; } INPUT_INFO_TO_SYNTAX;  class CFormPkg {diff
> > --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > index 55fd067f8a..5daf1c423c 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > @@ -50,6 +50,7 @@ VfrParserStart (
> >  {   ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken>
> VfrParser(File);
> > VfrParser.parser()->SetOverrideClassGuid
> > (InputInfo->OverrideClassGuid);+
> > VfrParser.parser()->SetIsCatchDefaultEnable(InputInfo-
> > >IsCatchDefaultEnable);   return
> VfrParser.parser()->vfrProgram(); } >>@@ -
> > 386,8 +387,8 @@ dataStructField32 [BOOLEAN  FieldInUnion]:
> >    ;  dataStructField16 [BOOLEAN  FieldInUnion]:-  << -    UINT32
> ArrayNum = 0;
> > +  <<+    UINT32 ArrayNum = 0;   >>   ("UINT16" | "CHAR16")
> > N:StringIdentifier@@ -737,7 +738,7 @@ vfrFormSetList :
> >    ;  vfrStatementExtension:-  << +  <<      EFI_GUID Guid;
> CIfrGuid *GuidObj
> > = NULL;      CHAR8    *TypeName = NULL;@@ -751,7 +752,7 @@
> > vfrStatementExtension:
> >    >>   L:GuidOp   Uuid "=" guidDefinition[Guid]-  {"," DataType "=" +
> {","
> > DataType "="     (         U64:"UINT64" {OpenBracket AN1:Number
> CloseBracket
> > <<ArrayNum = _STOU32(AN1->getText(), AN1->getLine());>>} << TypeName
> =
> > U64->getText(); LineNum = U64->getLine(); >>@@ -770,7
> > +771,7 @@ vfrStatementExtension:
> >        | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket
> > <<ArrayNum = _STOU32(AN8->getText(), AN8->getLine());>>}
> > << TypeName = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>
> |
> > R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum =
> > _STOU32(AN9->getText(), AN9->getLine());>>}- << TypeName =
> > R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
> > +                                                      <<
> TypeName =
> > + R->getText(); LineNum = R-
> > >getLine(); IsStruct = TRUE;>>       | TN:StringIdentifier {OpenBracket
> > AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText(),
> AN10-
> > >getLine());>>}
> << TypeName = TN->getText();
> > LineNum = TN->getLine(); IsStruct = TRUE;>>     )@@ -875,19 +876,19
> @@
> > vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName,
> UINT32
> > TypeSize,
> >                  memcpy (ByteOffset, &Data_U64,
> TypeSize);               }else if (strcmp
> > ("UINT32", TypeName) == 0) {                 Data_U32 =
> _STOU32(RD->getText(),
> > RD->getLine());-                memcpy (ByteOffset, &Data_U32,
> TypeSize);
> > +                memcpy (ByteOffset, &Data_U32,
> TypeSize);               }else if (strcmp
> > ("UINT16", TypeName) == 0) {                 Data_U16 =
> _STOU16(RD->getText(),
> > RD->getLine());-                memcpy (ByteOffset, &Data_U16,
> TypeSize);
> > +                memcpy (ByteOffset, &Data_U16,
> TypeSize);               }else if (strcmp
> > ("UINT8", TypeName) == 0) {                 Data_U8 =
> _STOU8(RD->getText(), RD-
> > >getLine());-                memcpy (ByteOffset, &Data_U8, TypeSize);
> > +                memcpy (ByteOffset, &Data_U8,
> TypeSize);               }else if (strcmp
> > ("BOOLEAN", TypeName)== 0) {                 Data_BL =
> _STOU8(RD->getText(),
> > RD->getLine());-                memcpy (ByteOffset, &Data_BL,
> TypeSize);
> > +                memcpy (ByteOffset, &Data_BL,
> TypeSize);               }else if (strcmp
> > ("EFI_STRING_ID", TypeName) == 0) {                 Data_SID =
> _STOSID(RD-
> > >getText(), RD->getLine());-                memcpy (ByteOffset,
> &Data_SID,
> > TypeSize);
> +                memcpy (ByteOffset,
> > &Data_SID, TypeSize);               }             } else
> > {               gCVfrVarDataTypeDB.GetDataFieldInfo(TFName,
> FieldOffset,
> > FieldType, FieldSize, BitField);@@ -975,7 +976,15 @@
> > vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName,
> UINT32
> > TypeSize,
> >   vfrStatementDefaultStore :   << UINT16  DefaultId =
> > EFI_HII_DEFAULT_CLASS_STANDARD; >>-  D:DefaultStore
> N:StringIdentifier
> > ","+  D:DefaultStore N:StringIdentifier ","             <<+
> > if (mIsCatchDefaultEnable) {+
> > gCVfrErrorHandle.HandleWarning (+
> > VFR_WARNING_UNSUPPORTED,+
> D-
> > >getLine(),+
> D-
> > >getText()+
>        );+
>  }+
> >                                                     >>
> Prompt "=" "STRING_TOKEN" "\(" S:Number
> > "\)"   {     "," Attribute "=" A:Number                      <<
> DefaultId = _STOU16(A-
> > >getText(), A->getLine()); >>@@ -1074,7 +1083,7 @@
> > vfrStatementVarStoreEfi :
> >      | U64:"UINT64" ","                              <<
> TypeName = U64->getText();
> > LineNum = U64->getLine(); >>     | D:"EFI_HII_DATE" ","
> <<
> > TypeName = D->getText(); LineNum = D->getLine(); >>     |
> T:"EFI_HII_TIME"
> > ","                          << TypeName = T->getText(); LineNum =
> T->getLine(); >>-    |
> > R:"EFI_HII_REF" ","                           << TypeName =
> R->getText(); LineNum = R-
> > >getLine(); >>    +    | R:"EFI_HII_REF" ","
> << TypeName = R-
> > >getText(); LineNum = R->getLine(); >>   )   {     VarId "=" ID:Number
> ","
> > <<@@ -1092,8 +1101,8 @@ vfrStatementVarStoreEfi :
> >    (     Name    "=" SN:StringIdentifier ","             <<
> StoreName = SN-
> > >getText();   >>    |-    Name    "=" "STRING_TOKEN" "\("
> VN:Number "\)" ","  -
> > VarSize "=" N:Number ","                        << +    Name
> "=" "STRING_TOKEN"
> > "\(" VN:Number "\)" ","+    VarSize "=" N:Number ","
> <<
> > IsUEFI23EfiVarstore = FALSE;
> StoreName =
> > gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText(), VN-
> > >getLine()));
> if (StoreName == NULL) {@@ -
> > 1116,7 +1125,7 @@ vfrStatementVarStoreEfi :
> >
> break;
> case 8:
> > TypeName = (CHAR8 *) "UINT64";-
> break; +
> > break;
> default:
> > _PCATCH (VFR_RETURN_UNSUPPORTED, N);
> > break;@@ -1124,7 +1133,7 @@ vfrStatementVarStoreEfi :
> >                                                      >>   ) -
> Uuid "=" guidDefinition[Guid]
> > << +  Uuid "=" guidDefinition[Guid]                     <<
> > if (IsUEFI23EfiVarstore)
> >
> {                                                        _PCAT
> CH(gCVfrDataStorage.DeclareBufferVarS
> > tore
> (
>                         StoreName,@@ -1150,7
> > +1159,7 @@ vfrStatementVarStoreEfi :
> >                                                         }
> > VSEObj.SetGuid (&Guid);
> VSEObj.SetVarStoreId
> > (VarStoreId);-
> +
> > VSEObj.SetSize ((UINT16) Size);
> > VSEObj.SetName (StoreName);
> if
> > (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {@@ -1184,7
> > +1193,7 @@ vfrStatementVarStoreNameValue :
> >                                                      >>   }
> (-    Name "=" "STRING_TOKEN" "\("
> > N:Number "\)" ","  << +    Name "=" "STRING_TOKEN" "\(" N:Number
> "\)" ","
> > <<                                                        if
> (!Created)
> >
> {                                                          _PC
> ATCH(gCVfrDataStorage.DeclareNameVar
> > StoreBegin (SN->getText(), VarStoreId), SN); Created = TRUE;@@
> > -1245,12 +1254,12 @@ vfrStatementDisableIfFormSet :
> >  vfrStatementSuppressIfFormSet :   << CIfrSuppressIf SIObj;>>
> L:SuppressIf
> > <<-
> SIObj.SetLineNo(L->getLine()); +
> >
> SIObj.SetLineNo(L->getLine());
>                   >>   { FLAGS "="
> > flagsField ( "\|" flagsField )* "," }   vfrStatementExpression[0] ";"
> > vfrFormSetList-  E: EndIf +  E: EndIf   ";"
> <<
> > CRT_END_OP (E); >>   ; @@ -1491,7 +1500,7 @@
> vfrQuestionDataFieldName
> > [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
> >    (     SN2:StringIdentifier                            <<
> _STRCAT (&VarIdStr, SN2-
> > >getText()); LineNo = SN2->getLine(); >>     (-      "."
> << +
> > "."                                           <<
> _STRCAT
> > (&VarIdStr, ".");
> if
> > (mConstantOnlyInExpression)
> >
> {                                                          _PC
> ATCH(VFR_RETURN_CONSTANT_ONLY,
> > LineNo);@@ -1518,7 +1527,7 @@ vfrQuestionDataFieldName
> > [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
> >    ;  vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> > BOOLEAN &ListType] :-  <<  +  <<     EFI_GUID    Guid;
> BOOLEAN     Negative =
> > FALSE;     BOOLEAN     IntDecStyle = FALSE;@@ -1634,11 +1643,11
> @@
> > vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> BOOLEAN
> > &ListType]
> >    | Z:Zero                                          <<
> $Value.u8     = _STOU8(Z->getText(), Z-
> > >getLine()); >>   | HOUR:Number ":" MINUTE:Number ":"
> SECOND:Number <<
> > $Value.time   = _STOT(HOUR->getText(), MINUTE->getText(),SECOND-
> > >getText(), HOUR->getLine()); >>   | YEAR:Number "/" MONTH:Number
> "/"
> > DAY:Number     << $Value.date   = _STOD(YEAR->getText(),
> MONTH->getText(),
> > DAY->getText(), YEAR->getLine()); >>-  | QI:Number";" FI:Number";"
> > guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)" +  |
> > QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\("
> > DP:Number "\)"
> << $Value.ref    = _STOR(QI-
> > >getText(), FI->getText(), &Guid, DP->getText(), QI->getLine()); >>   |
> > "STRING_TOKEN" "\(" S1:Number "\)"              << $Value.string =
> _STOSID(S1-
> > >getText(), S1->getLine()); >>   | "\{"
> << ListType =
> > TRUE; >>-      L1:Number
> << +      L1:Number
> > <<
> switch (Type)
> >
> {                                                          case
> EFI_IFR_TYPE_NUM_SIZE_8 :
> > Type8[Index]  = _STOU8(L1->getText(), L1->getLine());@@ -1658,8
> > +1667,8 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> > &Value, BOOLEAN &ListType]
> >
> Index++;                                                     >>
> (-
> > "," -        L2:Number                                   << +
> ","+        L2:Number
> > <<
> switch (Type)
> >
> {                                                          case
> EFI_IFR_TYPE_NUM_SIZE_8 :
> > Type8[Index]  = _STOU8(L2->getText(), L2->getLine());@@ -1679,7
> > +1688,7 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> > &Value, BOOLEAN &ListType]
> >
> >
> Index++;                                                     >>
>        )*-    "\}"                                           +
> > "\}"   ;
> >
> //************************************************************
> **
> > ***************@@ -1714,7 +1723,7 @@ vfrFormDefinition :
> >    ;  vfrFormMapDefinition :-  << +  <<     CIfrFormMap *FMapObj =
> NULL;
> > UINT32      FormMapMethodNumber = 0;     EFI_GUID    Guid;@@
> -1775,11
> > +1784,15 @@ vfrStatementDefault :
> >       CIfrNumeric           *NumericQst   = NULL;    >>-
> D:Default
> > +  D:Default                                         <<+
> if
> > (mIsCatchDefaultEnable) {+
> > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > >getLine());+
>       }+                                                    >>
> > (     (-      "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(),
> *Val,
> > ArrayType] ","  -
> << +      "="
> > vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","+
> > <<                                                         if
> (gCurrentMinMaxData != NULL &&
> > gCurrentMinMaxData->IsNumericOpcode())
> >
> {                                                           //c
> heck default value is valid for Numeric
> > Opcode
> NumericQst = (CIfrNumeric *)
> > gCurrentQuestion;@@ -1888,14 +1901,14 @@ vfrStatementDefault :
> >          vfrStatementValue ","                       << CIfrEnd
> EndObj1;
> > EndObj1.SetLineNo(D->getLine()); >>     )     {-      DefaultStore "="
> > SN:StringIdentifier ","      << +      DefaultStore "="
SN:StringIdentifier
> ","      <<
> > _PCATCH(gCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN);
> > if (DObj != NULL) {-
> DObj->SetDefaultId
> > (DefaultId);
> -                                                        } +
> > DObj->SetDefaultId
> (DefaultId);+
>     }
> > if (DObj2 != NULL) {-
> DObj2->SetDefaultId
> > (DefaultId); +
> DObj2->SetDefaultId
> >
> (DefaultId);
>     }                                                     >>
> >  }@@ -1917,8 +1930,8 @@ vfrStatementDefault :
> >
>         );
>      }
> >                                              }-
> if (DObj  != NULL)
> > {delete DObj;} -
> if (DObj2 != NULL) {delete
> > DObj2;} +
> if (DObj  != NULL) {delete DObj;}+
> > if (DObj2 != NULL) {delete
> DObj2;}                                                     >>
>   )   ;@@ -
> > 1970,11 +1983,15 @@ vfrStatementInvalid :
> >    ;  flagsField :-  Number -  | InteractiveFlag -  |
> > ManufacturingFlag -  | DefaultFlag -  | ResetRequiredFlag +  Number+
> > | InteractiveFlag+  |
> > ManufacturingFlag+  | D:DefaultFlag
> <<+
> > if (mIsCatchDefaultEnable) {+
> > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > >getLine());+
>         }+
> > >>+  | ResetRequiredFlag   | ReconnectRequiredFlag   |
> N:NVAccessFlag
> > <<
> gCVfrErrorHandle.HandleWarning (@@ -
> > 1989,7 +2006,7 @@ flagsField :
> >
> > L->getLine(),
> >
> L->getText()
>          );-
> >                                                        >>
> +                                                       >>   ;
> > vfrStatementValue :@@ -2001,13 +2018,13 @@ vfrStatementValue :
> >  vfrStatementRead :   << CIfrRead RObj; >>   R:Read
> > << RObj.SetLineNo(R->getLine()); >>-  vfrStatementExpression[0] ";" +
> > vfrStatementExpression[0] ";"   ;  vfrStatementWrite :   << CIfrWrite
> WObj; >>
> > W:Write                                              <<
> WObj.SetLineNo(W->getLine()); >>-
> > vfrStatementExpression[0] ";" +  vfrStatementExpression[0] ";"   ;
> > vfrStatementSubTitle :@@ -2140,7 +2157,7 @@ vfrStatementGoto :
> >        FormId "=" F3:Number ","                         <<
> RefType = 2; FId = _STOFID(F3-
> > >getText(), F3->getLine()); >>       Question "="       (-
> QN3:StringIdentifier
> > ","                     << +          QN3:StringIdentifier ","
> <<
> > mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask);
> > if (QId == EFI_QUESTION_ID_INVALID)
> >
> {
> _PCATCH(VFR_RETURN_UNDEFINED,
> > QN3);@@ -2222,7 +2239,7 @@ vfrStatementGoto :
> >      "," Key "=" KN:Number                              <<
> AssignQuestionKey (*QHObj,
> > KN); >>   }   {-    E:"," +    E:","
> vfrStatementQuestionOptionList                   <<
> > OHObj->SetScope(1); CRT_END_OP (E);>>   }   ";"
> > << 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;}>>@@ -2511,20 +2528,20 @@
> > minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
> >    {     "default" "=" N:Number ","                         <<
> > switch (KeyValue) {-
> case 0: +
> > case 0:
> D.Year  = _STOU16(N->getText(), N-
> > >getLine());
> if (D.Year < _STOU16 (MinN-
> > >getText(), MinN->getLine()) || D.Year > _STOU16 (MaxN->getText(), MaxN-
> > >getLine()))
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value
> must
> > be between Min year and Max
> year.");
>      }
> > break;-
> case 1: -
> > D.Month = _STOU8(N->getText(), N->getLine()); +
> > case 1:+
> D.Month = _STOU8(N->getText(), N-
> > >getLine());
> if (D.Month < 1 || D.Month > 12)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value
> > must be between 1 and
> 12.");
>     }
> > break;-
> case 2: -
> > D.Day = _STOU8(N->getText(), N->getLine()); +
> > case 2:+
> D.Day = _STOU8(N->getText(), N-
> > >getLine());
> if (D.Day < 1 || D.Day > 31)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value
> must
> > be between 1 and
> 31.");
>     }@@ -2570,7
> > +2587,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
> >       BOOLEAN MinNegative = FALSE;      BOOLEAN MaxNegative =
> FALSE;   >>-
> > Minimum   "=" +  Minimum   "="   {     "\-"
> <<
> > MinNegative = TRUE; >>   }@@ -2659,8 +2676,8 @@
> > vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
> >
>  }                                                           }
> >                                       >>-  Maximum   "=" -
> { +  Maximum   "="+  {     "\-"
> > << MaxNegative = TRUE; >>   }   A:Number ","
> <<@@ -
> > 2889,7 +2906,7 @@ vfrStatementNumeric :
> >                                                            }
>                                                         >>
> > vfrStatementQuestionOptionList-  E:EndNumeric
> << +
> > E:EndNumeric                                         <<
> > CRT_END_OP (E);
> if (GuidObj != NULL)
> >
> {
> GuidObj->SetScope(1);@@ -3131,7
> > +3148,7 @@ vfrStatementString :
> >    {     Key "=" KN:Number ","                              <<
> AssignQuestionKey (SObj,
> > KN); >>   }-  MinSize "=" MIN:Number ","
> << +  MinSize "="
> > MIN:Number ","                           <<
> > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); StringMinSize =
> > _STOU8(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(),
> > MIN->getLine()) > StringMinSize) {@@ -3141,7
> > +3158,7 @@ vfrStatementString :
> >                                                            }
> > SObj.SetMinSize
> (StringMinSize);
>        >>-  MaxSize
> > "=" MAX:Number ","                           << +  MaxSize "="
> MAX:Number ","
> > <<
> StringMaxSize = _STOU8(MAX->getText(),
> > MAX->getLine());
> if (_STOU64(MAX-
> > >getText(), MAX->getLine()) > StringMaxSize)
> >
> {
> _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize
> takes
> > only one byte, which can't be larger than 0xFF.");@@ -3185,7 +3202,7
> > @@ vfrStatementPassword :
> >    {     Key "=" KN:Number ","                              <<
> AssignQuestionKey (PObj,
> > KN); >>   }-  MinSize "=" MIN:Number ","
> << +  MinSize "="
> > MIN:Number ","                           <<
> > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); PasswordMinSize =
> > _STOU16(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(),
> > MIN->getLine()) > PasswordMinSize) {@@ -
> > 3195,7 +3212,7 @@ vfrStatementPassword :
> >                                                            }
> > PObj.SetMinSize
> (PasswordMinSize);
>           >>-
> > MaxSize "=" MAX:Number ","                           << +
> MaxSize "=" MAX:Number
> > ","                           <<
> PasswordMaxSize =
> > _STOU16(MAX->getText(), MAX->getLine());
> if
> > (_STOU64(MAX->getText(), MAX->getLine()) > PasswordMaxSize)
> >
> {
> _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize
> takes
> > only two byte, which can't be larger than 0xFFFF.");@@ -3230,12
> > +3247,12 @@ vfrStatementOrderedList :
> >    >>   L:OrderedList
> << OLObj.SetLineNo(L->getLine());
> > gIsOrderedList = TRUE;>>   vfrQuestionHeader[OLObj] ","-
> > << +                                                       <<
> > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); OLObj.SetMaxContainers
> > ((UINT8) (VarArraySize > 0xFF ? 0xFF :
> >
> VarArraySize));
>       >>   {-    MaxContainers "="
> > M:Number ","                     << +    MaxContainers "="
> M:Number ","
> > <<
> if (_STOU64(M->getText(), M->getLine()) >
> > _STOU8(M->getText(), M->getLine()))
> >
> {
> _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList
> > MaxContainers takes only one byte, which can't be larger than
> >
> 0xFF.");
>    } else if (VarArraySize != 0 &&
> > _STOU8(M->getText(), M->getLine()) > VarArraySize) {@@ -3328,19
> > +3345,19 @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8
> KeyValue] :
> >    {     "default" "=" N:Number ","                         <<
> > switch (KeyValue) {-
> case 0: -
> > T.Hour   = _STOU8(N->getText(), N->getLine()); +
> > case 0:+
> T.Hour   = _STOU8(N->getText(), N-
> > >getLine());
> if (T.Hour > 23)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value
> must
> > be between 0 and
> 23.");
>     }
> > break;-
> case 1: -
> > T.Minute = _STOU8(N->getText(), N->getLine()); +
> > case 1:+
> T.Minute = _STOU8(N->getText(), N-
> > >getLine());
> if (T.Minute > 59)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value
> > must be between 0 and
> 59.");
>     }
> > break;-
> case 2: +
> > case 2:
> T.Second = _STOU8(N->getText(), N-
> > >getLine());
> if (T.Second > 59)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value
> > must be between 0 and 59.");@@ -3419,11 +3436,11 @@
> > vfrStatementStatListOld :
> >    ;  vfrStatementDisableIfStat :-  << -    CIfrDisableIf DIObj; +  <<+
> > CIfrDisableIf DIObj;   >>   L:DisableIf
> <<
> > DIObj.SetLineNo(L->getLine()); >>-  vfrStatementExpression[0] ";" +
> > vfrStatementExpression[0] ";"   ( vfrStatementStatList )*   E:EndIf
> > << CRT_END_OP (E); >>   ";"@@ -3548,8 +3565,8 @@
> > vfrStatementWarningIf :
> >    ;  vfrStatementDisableIfQuest :-  << -    CIfrDisableIf DIObj; +
> <<+
> > CIfrDisableIf DIObj;   >>   L:DisableIf
> <<
> > DIObj.SetLineNo(L->getLine()); >>   vfrStatementExpression[0] ";"@@ -
> > 3616,15 +3633,15 @@ vfrStatementOneOfOption :
> >       UINT32             *Type32       = (UINT32 *) ValueList;
> UINT64
> > *Type64       = (UINT64 *) ValueList;   >>-  L:Option
> <<
> > +  L:Option                                             <<
> if
> > (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER)
> >
> {
> _PCATCH (VFR_RETURN_FATAL_ERROR, L-
> > >getLine(), "Get data type
> >
> error.");
>    }                                                         >
> >-
> > Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","      +  Text  "="
> > "STRING_TOKEN" "\(" S:Number "\)" ","   Value "="
> > vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","-
> > << +                                                       <<
> if
> > (gCurrentMinMaxData != NULL)
> {
> //set
> > min/max value for oneof opcode
> UINT64
> > Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE(),
> > _GET_CURRQEST_VARTINFO().mIsBitVar);@@ -3696,7 +3713,7 @@
> > vfrStatementOneOfOption :
> >
> Size += OFFSET_OF
> > (EFI_IFR_ONE_OF_OPTION, Value);
> OOOObj =
> > new CIfrOneOfOption((UINT8)Size);
> OOOObj-
> > >SetLineNo(L->getLine());-
> OOOObj-
> > >SetOption (_STOSID(S->getText(), S->getLine())); +
> > OOOObj->SetOption (_STOSID(S->getText(), S->getLine()));
> > if (ArrayType)
> {
> OOOObj->SetType
> >
> (EFI_IFR_TYPE_BUFFER);
>                  } else {@@ -3706,7
> > +3723,7 @@ vfrStatementOneOfOption :
> >
> OOOObj->SetType
> >
> (_GET_CURRQEST_DATATYPE());
>                          }
> >                                       }-
> OOOObj->SetValue
> > (*Val); +
> OOOObj->SetValue
> >
> (*Val);                                                        >>
> F:FLAGS "="
> > vfrOneOfOptionFlags[*OOOObj, F->getLine()] <<@@ -3790,7 +3807,12 @@
> > oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
> >    | RestStyleFlag                                      <<
> $HFlags |= 0x20; >>   |
> > ReconnectRequiredFlag                              << $HFlags |=
> 0x40; >>   |
> > ManufacturingFlag                                  << $LFlags |=
> 0x20; >>-  | DefaultFlag
> > << $LFlags |= 0x10; >>+  | D:DefaultFlag
> <<+
> > $LFlags |= 0x10;+
> if (mIsCatchDefaultEnable)
> > {+
> > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > >getLine());+
>           }+
> >  >>   | A:NVAccessFlag                                     <<
> > gCVfrErrorHandle.HandleWarning
> >
> (
> VFR_WARNING_OBSOLETED_FRAMEWORK
> > _OPCODE,@@ -3963,7 +3985,7 @@ vfrStatementExpression [UINT32
> > RootLevel, UINT32 ExpOpCount = 0] :
> >
>    }
>    }
> >                                              }-
> +
> > if ($RootLevel == 0)
> {
> _CLEAR_SAVED_OPHDR
> > ();
> mCIfrOpHdrIndex --;@@ -4405,10
> > +4427,10 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >
> for (Index = 0; Index < ListLen; Index++)
> >
> {
>   EILObj.SetValueList (Index,
> >
> ValueList[Index]);
>              }-
> > +
> > + EILObj.UpdateIfrBuffer();-
> > _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());
> > -
> +
> > _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());+ if (QId
> > == EFI_QUESTION_ID_INVALID)
> >
> {
>   EILObj.SetQuestionId (QId, VarIdStr,
> >
> LineNo);
>       }@@ -4458,9 +4480,9 @@
> > stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >    >>   L:StringRef   "\("-      ( +
> (         "STRING_TOKEN"-        "\(" +        "\("
> > S:Number << RefStringId = _STOSID(S->getText(), S->getLine()); >>
> "\)"
> > | I:Number << RefStringId = _STOSID(I->getText(), I->getLine()); >>@@
> > | -
> > 4499,10 +4521,10 @@ getExp[UINT32 & RootLevel, UINT32 &
> ExpOpCount] :
> >       Info.mVarStoreId = 0;   >>   L:Get-  "\(" +  "\("
> vfrStorageVarId[Info,
> > VarIdStr, FALSE]       {"\|" FLAGS "=" numericVarStoreType [VarType] }-
> "\)"
> > << +  "\)"                                                 <<
> >
> {                                                             i
> f (Info.mVarStoreId == 0)
> >
> {
>   // support Date/Time question@@ -
> > 4549,9 +4571,9 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >
> > _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> > >getLine(), "Get/Set opcode don't support data
> >
> array");
>        }
>        }
> > -
> CIfrGet GObj(L->getLine()); -
> > _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine()); -
> > GObj.SetVarInfo (&Info); +
> CIfrGet GObj(L-
> > >getLine());+
> _SAVE_OPHDR_COND (GObj,
> > ($ExpOpCount == 0), L->getLine());+
> > GObj.SetVarInfo (&Info);
> delete[] VarIdStr;
> >
> $ExpOpCount++;
>            }@@ -4608,7 +4630,7 @@
> > question23refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >        {         Uuid "=" guidDefinition[Guid] ","
> << Type = 0x3; >>       }-
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"
> > <<
> switch (Type) {@@ -4675,9 +4697,9 @@
> > setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >    "\("      vfrStorageVarId[Info, VarIdStr, FALSE]      {"\|" FLAG "="
> > numericVarStoreType [VarType] }-     ","
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +     ","
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"-
> > << +                                                       <<
> >
> {                                                             i
> f (Info.mVarStoreId == 0)
> >
> {
>   // support Date/Time question@@ -
> > 4724,8 +4746,8 @@ setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >
> > _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> > >getLine(), "Get/Set opcode don't support data
> >
> array");
>        }
>        }
> > -
> CIfrSet TSObj(L->getLine()); -
> > TSObj.SetVarInfo (&Info); +
> CIfrSet TSObj(L-
> > >getLine());+
> TSObj.SetVarInfo (&Info);
> > delete[] VarIdStr;
> >
> $ExpOpCount++;
>            }@@ -4808,9 +4830,9 @@
> > spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >    ;  vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:-
> > L:Map
> > -  "\(" -  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]  +
> L:Map+
> > "\("+  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   ":"
> > << { CIfrMap MObj(L->getLine()); } >>
> (     vfrStatementExpression[0]@@ -
> > 4837,6 +4859,7 @@ spanFlags [UINT8 & Flags] :
> >  class EfiVfrParser { << private:+  BOOLEAN
> mIsCatchDefaultEnable;
> > UINT8               mParserStatus;   BOOLEAN
> mConstantOnlyInExpression;
> > @@ -4880,6 +4903,7 @@ public:
> >    VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN
> ANTLRTokenPtr);
> > VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32);
> VOID
> > _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);+
> VOID
> > DefaultValueError (IN EFI_VFR_RETURN_CODE, IN UINT32);    VOID
> > syn     (ANTLRAbstractToken  *, ANTLRChar *, SetWordType *,
> > ANTLRTokenType, INT32); @@ -4909,6 +4933,7 @@ public:
> >    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);   VOID
> IdEqListDoSpecial     (IN
> > UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN
> > UINT16, IN UINT16 *);   VOID                SetOverrideClassGuid
> (IN EFI_GUID *);+
> > VOID                SetIsCatchDefaultEnable (BOOLEAN
> IsCatchDefaultEnable); >> }
> > @@ -5086,6 +5111,17 @@ EfiVfrParser::_PCATCH (
> >    mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError
> > (ReturnCode, LineNum, (CHAR8 *) ErrorMsg); }
> > +VOID+EfiVfrParser::DefaultValueError (+  IN EFI_VFR_RETURN_CODE
> > ReturnCode,+  IN UINT32              LineNum+  )+{+  CHAR8
> ErrorMsg[100];+
> > sprintf(ErrorMsg, "please remove the default value / defaultstore in
> > line %d", LineNum);+  mParserStatus = mParserStatus +
> > gCVfrErrorHandle.HandleError (ReturnCode, LineNum, ErrorMsg);+}+ VOID
> EfiVfrParser::syn
> > (   ANTLRAbstractToken  *Tok,@@ -5682,12 +5718,18 @@
> > EfiVfrParser::IdEqListDoSpecial (
> >    } } -VOID +VOID EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID
> > *OverrideClassGuid) {   mOverrideClassGuid = OverrideClassGuid; }
> > +VOID+EfiVfrParser::SetIsCatchDefaultEnable (BOOLEAN
> > IsCatchDefaultEnable)+{+  mIsCatchDefaultEnable =
> IsCatchDefaultEnable;+}+
> > VOID EfiVfrParser::CheckDuplicateDefaultValue (   IN EFI_DEFAULT_ID
> > DefaultId,--
> > 2.26.2.windows.1






-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112876): https://edk2.groups.io/g/devel/message/112876
Mute This Topic: https://groups.io/mt/103355296/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature
       [not found]         ` <023101da36cf$a50bb8f0$ef232ad0$@byosoft.com.cn>
@ 2023-12-25  7:10           ` Yuting Yang
  2024-01-12  5:20             ` Zhang, Zifeng
  0 siblings, 1 reply; 12+ messages in thread
From: Yuting Yang @ 2023-12-25  7:10 UTC (permalink / raw)
  To: Gao, Liming; +Cc: Zhang, Zifeng, Chen, Christine, devel@edk2.groups.io

Hi Liming,

Thank you for adding  the account for me.
I have created a Bugzilla https://bugzilla.tianocore.org/show_bug.cgi?id=4629 for this feature ~

Best Regards,,
Yuting

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn> 
Sent: Monday, December 25, 2023 9:14 AM
To: Yang, Yuting2 <yuting2.yang@intel.com>
Subject: 回复: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature

Your account yuting2.yang@intel.com has been added. PW: tiano@123

> -----邮件原件-----
> 发件人: Yang, Yuting2 <yuting2.yang@intel.com>
> 发送时间: 2023年12月22日 13:41
> 收件人: Gao, Liming <gaoliming@byosoft.com.cn>
> 抄送: Rebecca Cran <rebecca@bsdio.com>; Feng, Bob C 
> <bob.c.feng@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>; 
> Chen, Christine <yuwei.chen@intel.com>; Zhang, Zifeng 
> <zifeng.zhang@intel.com>; devel@edk2.groups.io
> 主题: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> Hi Liming,
> 
> Thank you for reviewing ~
> Could you please help me create a Bugzilla account? Currently, I do 
> not
have
> access to the Bugzilla.
> 
> Best Regards,
> Yuting
> 
> -----Original Message-----
> From: Zhang, Zifeng <zifeng.zhang@intel.com>
> Sent: Thursday, December 21, 2023 2:44 PM
> To: Gao, Liming <gaoliming@byosoft.com.cn>; Yang, Yuting2 
> <yuting2.yang@intel.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>; Feng, Bob C 
> <bob.c.feng@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>; 
> devel@edk2.groups.io; Chen, Christine <yuwei.chen@intel.com>
> Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> Hi Liming,
> 
> Thanks for reviewing.
> For background of this change, we will remove default flags in VFR/HFR 
> in new platform. So we need help from VFR complier to make a default 
> flag check to avoid manually adding.
> @Yang, Yuting2, could you help to create a BZ for this feature and 
> share
in
> mail thread?
> Then let me make a clarification for your questions.
> 
> #1: The purpose of --catch_default
> We send --catch_default flag in build option to indicate which 
> platform
should
> check default flag in VFR/HFR.
> Actually maybe some platforms used same EDK2 downstream branch, so we 
> only send --catch_default flag for the platforms which need this check.
> 
> #2: The purpose of --except_list
> VFR compiler will receive VFR/HFR configurations from all folders
including
> Intel and EDK2. But in our expectation VFR compiler only do this check 
> in Intel.
> So We use --except_list to deliver package list in EDK2 to avoid this
check.
> 
> Best Regards,
> Zifeng
> 
> -----Original Message-----
> From: Yang, Yuting2 <yuting2.yang@intel.com>
> Sent: Tuesday, December 12, 2023 5:12 PM
> To: Zhang, Zifeng <zifeng.zhang@intel.com>; Chen, Arthur G 
> <arthur.g.chen@intel.com>; devel@edk2.groups.io
> Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
> Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> +Cc Zhang, Zifeng, Chen, Arthur G
> 
> -----Original Message-----
> From: Chen, Christine <yuwei.chen@intel.com>
> Sent: Tuesday, December 12, 2023 5:04 PM
> To: Yang, Yuting2 <yuting2.yang@intel.com>; devel@edk2.groups.io
> Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
> Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> +Cc Yang, Yuting2
> 
> > -----Original Message-----
> > From: Yang, Yuting2 <yuting2.yang@intel.com>
> > Sent: Tuesday, December 12, 2023 5:01 PM
> > To: devel@edk2.groups.io
> > Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> > <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>; 
> > Chen, Christine <yuwei.chen@intel.com>
> > Subject: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> > Feature
> >
> > Add --catch_default option
> > Raise a DefaultValueError when encountering VFR default definitions 
> > to help remove default variables.
> > Add --except_list option
> > Exclude packages that don't require enabling the catch_default function.
> >
> > Cc: Rebecca Cran <rebecca@bsdio.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Bob Feng <bob.c.feng@intel.com>
> > Cc: Christine Chen <yuwei.chen@intel.com>
> > Cc: Yuting Yang <yuting2.yang@intel.com>
> >
> > Signed-off-by: Yuting Yang <yuting2.yang@intel.com>
> > ---
> >  BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  40 ++-
> >  BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   3 +
> >  BaseTools/Source/C/VfrCompile/VfrError.cpp    |   3 +-
> >  BaseTools/Source/C/VfrCompile/VfrError.h      |   3 +-
> >  BaseTools/Source/C/VfrCompile/VfrFormPkg.h    |   1 +
> >  BaseTools/Source/C/VfrCompile/VfrSyntax.g     | 238
> ++++++++++--------
> >  6 files changed, 184 insertions(+), 104 deletions(-)
> >
> > diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > index 5f4d262d85..e97cebff65 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > @@ -78,6 +78,9 @@ CVfrCompiler::OptionInitialization (
> >    mOptions.WarningAsError                = FALSE;
> mOptions.AutoDefault
> > = FALSE;   mOptions.CheckDefault                  = FALSE;+
> > mOptions.IsCatchDefaultEnable          = FALSE;+
> mOptions.ExceptionList
> > = NULL;+  mOptions.ExceptionListSize             = 0;   memset
> > (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));    if (Argc == 1)
> {@@ -
> > 95,6 +98,23 @@ CVfrCompiler::OptionInitialization (
> >        Version ();       SET_RUN_STATUS (STATUS_DEAD);
> return;+    } else if
> > (stricmp(Argv[Index], "--catch_default") == 0){+
> > mOptions.IsCatchDefaultEnable = TRUE;+    } else if
(stricmp(Argv[Index],
> "--
> > except_list") == 0){+      INT32 Start = ++Index;+      if ((Start >=
Argc)
> ||
> > (Argv[Start][0] == '-')) {+        DebugError (NULL, 0, 1001, "Missing
> option", "-
> > exception_list missing except list");+        goto Fail;+      }+
> while
> > ((Argv[Index][0] != '-') && (Index < Argc - 1)) {+        Index++;+
}+
> INT32
> > End = Index--;+      mOptions.ExceptionListSize = End - Start;+      for
> (INT32 i =
> > Start; i < End; i++) {+        mOptions.ExceptionList = (CHAR8**)
> > realloc(mOptions.ExceptionList, (i - Start + 1) * sizeof(CHAR8*));+
> > mOptions.ExceptionList[i-Start] = Argv[i];+      }     } else if
> (stricmp(Argv[Index],
> > "-l") == 0) {       mOptions.CreateRecordListFile = TRUE;
> > gCIfrRecordInfoDB.TurnOn ();@@ -179,7 +199,11 @@ 
> > CVfrCompiler::OptionInitialization (
> >        goto Fail;     }     strcpy (mOptions.VfrFileName,
> Argv[Index]);-+    for (int i =
> > 0; i < mOptions.ExceptionListSize; i++) {+      if
> (strstr(mOptions.VfrFileName,
> > mOptions.ExceptionList[i]) != NULL) {+
> mOptions.IsCatchDefaultEnable =
> > FALSE;+      }+    }     if (mOptions.OutputDirectory == NULL)
> > {       mOptions.OutputDirectory = (CHAR8 *) malloc (1);       if
> > (mOptions.OutputDirectory == NULL) {@@ -217,6 +241,11 @@ Fail:
> >      free (mOptions.VfrFileName);     mOptions.VfrFileName
> =
> > NULL;   }+  if (mOptions.ExceptionList != NULL) {+
> > free(mOptions.ExceptionList);+    mOptions.ExceptionList
> = NULL;++  }
> > if (mOptions.VfrBaseFileName != NULL) {     free
> (mOptions.VfrBaseFileName);
> > mOptions.VfrBaseFileName             = NULL;@@ -496,6 +525,11
> @@
> > CVfrCompiler::~CVfrCompiler (
> >      mOptions.VfrBaseFileName = NULL;   } +  if
> (mOptions.ExceptionList !=
> > NULL) {+    free (mOptions.ExceptionList);+    mOptions.ExceptionList =
> > NULL;+  }+   if (mOptions.OutputDirectory != NULL) {     free
> > (mOptions.OutputDirectory);     mOptions.OutputDirectory = NULL;@@
> -679,7
> > +713,7 @@ CVfrCompiler::Compile (
> >      DebugError (NULL, 0, 0001, "Error opening the input file", "%s",
> > InFileName);     goto Fail;   }-+  InputInfo.IsCatchDefaultEnable =
> > mOptions.IsCatchDefaultEnable;   if (mOptions.HasOverrideClassGuid)
> > {     InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;   }
> else
> > {@@ -937,5 +971,3 @@ main (
> >     return GetUtilityStatus (); }--diff --git 
> > a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > index b6e207d2ce..39e0a89a29 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > @@ -52,6 +52,9 @@ typedef struct {
> >    BOOLEAN WarningAsError;   BOOLEAN AutoDefault;   BOOLEAN
> > CheckDefault;+  BOOLEAN IsCatchDefaultEnable;+  CHAR8**
> ExceptionList;+
> > INT16    ExceptionListSize; } OPTIONS;  typedef enum {diff --git
> > a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > index 65bb8e34fd..8a706f929b 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > @@ -49,7 +49,8 @@ static SVFR_WARNING_HANDLE
> VFR_WARNING_HANDLE_TABLE
> > [] = {
> >    { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value
> re-defined
> > with different value"},   { VFR_WARNING_ACTION_WITH_TEXT_TWO, ":
> Action
> > opcode should not have TextTwo part"}, { 
> > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend to
> use
> > obsoleted framework opcode"},-  { VFR_WARNING_CODEUNDEFINED, ":
> > undefined Warning Code" }+  { VFR_WARNING_CODEUNDEFINED, ":
> > undefined Warning Code" },+  { VFR_WARNING_UNSUPPORTED, ": pls
> remove
> > the default values if necessary" } }; 
> > CVfrErrorHandle::CVfrErrorHandle (diff -- git 
> > a/BaseTools/Source/C/VfrCompile/VfrError.h
> > b/BaseTools/Source/C/VfrCompile/VfrError.h
> > index 7d16bd5f74..1b4bc173d2 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrError.h
> > +++ b/BaseTools/Source/C/VfrCompile/VfrError.h
> > @@ -47,7 +47,8 @@ typedef enum {
> >    VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0, 
> > VFR_WARNING_ACTION_WITH_TEXT_TWO,
> > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,-
> > VFR_WARNING_CODEUNDEFINED+  VFR_WARNING_CODEUNDEFINED,+ 
> > VFR_WARNING_UNSUPPORTED } EFI_VFR_WARNING_CODE;  typedef
> struct
> > _SVFR_ERROR_HANDLE {diff --git
> > a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > index 9ef6f07787..d8fada3bcb 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > @@ -96,6 +96,7 @@ struct SBufferNode {
> >   typedef struct {   EFI_GUID *OverrideClassGuid;+  BOOLEAN
> > IsCatchDefaultEnable; } INPUT_INFO_TO_SYNTAX;  class CFormPkg {diff 
> > --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > index 55fd067f8a..5daf1c423c 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > @@ -50,6 +50,7 @@ VfrParserStart (
> >  {   ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken>
> VfrParser(File);
> > VfrParser.parser()->SetOverrideClassGuid
> > (InputInfo->OverrideClassGuid);+
> > VfrParser.parser()->SetIsCatchDefaultEnable(InputInfo-
> > >IsCatchDefaultEnable);   return
> VfrParser.parser()->vfrProgram(); } >>@@ -
> > 386,8 +387,8 @@ dataStructField32 [BOOLEAN  FieldInUnion]:
> >    ;  dataStructField16 [BOOLEAN  FieldInUnion]:-  << -    UINT32
> ArrayNum = 0;
> > +  <<+    UINT32 ArrayNum = 0;   >>   ("UINT16" | "CHAR16")
> > N:StringIdentifier@@ -737,7 +738,7 @@ vfrFormSetList :
> >    ;  vfrStatementExtension:-  << +  <<      EFI_GUID Guid;
> CIfrGuid *GuidObj
> > = NULL;      CHAR8    *TypeName = NULL;@@ -751,7 +752,7 @@
> > vfrStatementExtension:
> >    >>   L:GuidOp   Uuid "=" guidDefinition[Guid]-  {"," DataType "=" +
> {","
> > DataType "="     (         U64:"UINT64" {OpenBracket AN1:Number
> CloseBracket
> > <<ArrayNum = _STOU32(AN1->getText(), AN1->getLine());>>} << TypeName
> =
> > U64->getText(); LineNum = U64->getLine(); >>@@ -770,7
> > +771,7 @@ vfrStatementExtension:
> >        | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket 
> > <<ArrayNum = _STOU32(AN8->getText(), AN8->getLine());>>} << TypeName 
> > = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>
> |
> > R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = 
> > _STOU32(AN9->getText(), AN9->getLine());>>}- << TypeName =
> > R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
> > +                                                      <<
> TypeName =
> > + R->getText(); LineNum = R-
> > >getLine(); IsStruct = TRUE;>>       | TN:StringIdentifier {OpenBracket
> > AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText(),
> AN10-
> > >getLine());>>}
> << TypeName = TN->getText();
> > LineNum = TN->getLine(); IsStruct = TRUE;>>     )@@ -875,19 +876,19
> @@
> > vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName,
> UINT32
> > TypeSize,
> >                  memcpy (ByteOffset, &Data_U64,
> TypeSize);               }else if (strcmp
> > ("UINT32", TypeName) == 0) {                 Data_U32 =
> _STOU32(RD->getText(),
> > RD->getLine());-                memcpy (ByteOffset, &Data_U32,
> TypeSize);
> > +                memcpy (ByteOffset, &Data_U32,
> TypeSize);               }else if (strcmp
> > ("UINT16", TypeName) == 0) {                 Data_U16 =
> _STOU16(RD->getText(),
> > RD->getLine());-                memcpy (ByteOffset, &Data_U16,
> TypeSize);
> > +                memcpy (ByteOffset, &Data_U16,
> TypeSize);               }else if (strcmp
> > ("UINT8", TypeName) == 0) {                 Data_U8 =
> _STOU8(RD->getText(), RD-
> > >getLine());-                memcpy (ByteOffset, &Data_U8, TypeSize);
> > +                memcpy (ByteOffset, &Data_U8,
> TypeSize);               }else if (strcmp
> > ("BOOLEAN", TypeName)== 0) {                 Data_BL =
> _STOU8(RD->getText(),
> > RD->getLine());-                memcpy (ByteOffset, &Data_BL,
> TypeSize);
> > +                memcpy (ByteOffset, &Data_BL,
> TypeSize);               }else if (strcmp
> > ("EFI_STRING_ID", TypeName) == 0) {                 Data_SID =
> _STOSID(RD-
> > >getText(), RD->getLine());-                memcpy (ByteOffset,
> &Data_SID,
> > TypeSize);
> +                memcpy (ByteOffset,
> > &Data_SID, TypeSize);               }             } else
> > {               gCVfrVarDataTypeDB.GetDataFieldInfo(TFName,
> FieldOffset,
> > FieldType, FieldSize, BitField);@@ -975,7 +976,15 @@
> > vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName,
> UINT32
> > TypeSize,
> >   vfrStatementDefaultStore :   << UINT16  DefaultId =
> > EFI_HII_DEFAULT_CLASS_STANDARD; >>-  D:DefaultStore
> N:StringIdentifier
> > ","+  D:DefaultStore N:StringIdentifier ","             <<+
> > if (mIsCatchDefaultEnable) {+
> > gCVfrErrorHandle.HandleWarning (+
> > VFR_WARNING_UNSUPPORTED,+
> D-
> > >getLine(),+
> D-
> > >getText()+
>        );+
>  }+
> >                                                     >>
> Prompt "=" "STRING_TOKEN" "\(" S:Number
> > "\)"   {     "," Attribute "=" A:Number                      <<
> DefaultId = _STOU16(A-
> > >getText(), A->getLine()); >>@@ -1074,7 +1083,7 @@
> > vfrStatementVarStoreEfi :
> >      | U64:"UINT64" ","                              <<
> TypeName = U64->getText();
> > LineNum = U64->getLine(); >>     | D:"EFI_HII_DATE" ","
> <<
> > TypeName = D->getText(); LineNum = D->getLine(); >>     |
> T:"EFI_HII_TIME"
> > ","                          << TypeName = T->getText(); LineNum =
> T->getLine(); >>-    |
> > R:"EFI_HII_REF" ","                           << TypeName =
> R->getText(); LineNum = R-
> > >getLine(); >>    +    | R:"EFI_HII_REF" ","
> << TypeName = R-
> > >getText(); LineNum = R->getLine(); >>   )   {     VarId "=" ID:Number
> ","
> > <<@@ -1092,8 +1101,8 @@ vfrStatementVarStoreEfi :
> >    (     Name    "=" SN:StringIdentifier ","             <<
> StoreName = SN-
> > >getText();   >>    |-    Name    "=" "STRING_TOKEN" "\("
> VN:Number "\)" ","  -
> > VarSize "=" N:Number ","                        << +    Name
> "=" "STRING_TOKEN"
> > "\(" VN:Number "\)" ","+    VarSize "=" N:Number ","
> <<
> > IsUEFI23EfiVarstore = FALSE;
> StoreName =
> > gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText(), VN-
> > >getLine()));
> if (StoreName == NULL) {@@ -
> > 1116,7 +1125,7 @@ vfrStatementVarStoreEfi :
> >
> break;
> case 8:
> > TypeName = (CHAR8 *) "UINT64";-
> break; +
> > break;
> default:
> > _PCATCH (VFR_RETURN_UNSUPPORTED, N); break;@@ -1124,7 +1133,7 @@ 
> > vfrStatementVarStoreEfi :
> >                                                      >>   ) -
> Uuid "=" guidDefinition[Guid]
> > << +  Uuid "=" guidDefinition[Guid]                     <<
> > if (IsUEFI23EfiVarstore)
> >
> {                                                        _PCAT
> CH(gCVfrDataStorage.DeclareBufferVarS
> > tore
> (
>                         StoreName,@@ -1150,7
> > +1159,7 @@ vfrStatementVarStoreEfi :
> >                                                         } 
> > VSEObj.SetGuid (&Guid);
> VSEObj.SetVarStoreId
> > (VarStoreId);-
> +
> > VSEObj.SetSize ((UINT16) Size);
> > VSEObj.SetName (StoreName);
> if
> > (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {@@ -1184,7
> > +1193,7 @@ vfrStatementVarStoreNameValue :
> >                                                      >>   }
> (-    Name "=" "STRING_TOKEN" "\("
> > N:Number "\)" ","  << +    Name "=" "STRING_TOKEN" "\(" N:Number
> "\)" ","
> > <<                                                        if
> (!Created)
> >
> {                                                          _PC
> ATCH(gCVfrDataStorage.DeclareNameVar
> > StoreBegin (SN->getText(), VarStoreId), SN); Created = TRUE;@@
> > -1245,12 +1254,12 @@ vfrStatementDisableIfFormSet :
> >  vfrStatementSuppressIfFormSet :   << CIfrSuppressIf SIObj;>>
> L:SuppressIf
> > <<-
> SIObj.SetLineNo(L->getLine()); +
> >
> SIObj.SetLineNo(L->getLine());
>                   >>   { FLAGS "="
> > flagsField ( "\|" flagsField )* "," }   vfrStatementExpression[0] ";"
> > vfrFormSetList-  E: EndIf +  E: EndIf   ";"
> <<
> > CRT_END_OP (E); >>   ; @@ -1491,7 +1500,7 @@
> vfrQuestionDataFieldName
> > [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
> >    (     SN2:StringIdentifier                            <<
> _STRCAT (&VarIdStr, SN2-
> > >getText()); LineNo = SN2->getLine(); >>     (-      "."
> << +
> > "."                                           <<
> _STRCAT
> > (&VarIdStr, ".");
> if
> > (mConstantOnlyInExpression)
> >
> {                                                          _PC
> ATCH(VFR_RETURN_CONSTANT_ONLY,
> > LineNo);@@ -1518,7 +1527,7 @@ vfrQuestionDataFieldName 
> > [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
> >    ;  vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> > BOOLEAN &ListType] :-  <<  +  <<     EFI_GUID    Guid;
> BOOLEAN     Negative =
> > FALSE;     BOOLEAN     IntDecStyle = FALSE;@@ -1634,11 +1643,11
> @@
> > vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> BOOLEAN
> > &ListType]
> >    | Z:Zero                                          <<
> $Value.u8     = _STOU8(Z->getText(), Z-
> > >getLine()); >>   | HOUR:Number ":" MINUTE:Number ":"
> SECOND:Number <<
> > $Value.time   = _STOT(HOUR->getText(), MINUTE->getText(),SECOND-
> > >getText(), HOUR->getLine()); >>   | YEAR:Number "/" MONTH:Number
> "/"
> > DAY:Number     << $Value.date   = _STOD(YEAR->getText(),
> MONTH->getText(),
> > DAY->getText(), YEAR->getLine()); >>-  | QI:Number";" FI:Number";"
> > guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)" +  | 
> > QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\("
> > DP:Number "\)"
> << $Value.ref    = _STOR(QI-
> > >getText(), FI->getText(), &Guid, DP->getText(), QI->getLine()); >>   |
> > "STRING_TOKEN" "\(" S1:Number "\)"              << $Value.string =
> _STOSID(S1-
> > >getText(), S1->getLine()); >>   | "\{"
> << ListType =
> > TRUE; >>-      L1:Number
> << +      L1:Number
> > <<
> switch (Type)
> >
> {                                                          case
> EFI_IFR_TYPE_NUM_SIZE_8 :
> > Type8[Index]  = _STOU8(L1->getText(), L1->getLine());@@ -1658,8
> > +1667,8 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> > &Value, BOOLEAN &ListType]
> >
> Index++;                                                     >>
> (-
> > "," -        L2:Number                                   << +
> ","+        L2:Number
> > <<
> switch (Type)
> >
> {                                                          case
> EFI_IFR_TYPE_NUM_SIZE_8 :
> > Type8[Index]  = _STOU8(L2->getText(), L2->getLine());@@ -1679,7
> > +1688,7 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> > &Value, BOOLEAN &ListType]
> >
> >
> Index++;                                                     >>
>        )*-    "\}"                                           +
> > "\}"   ;
> >
> //************************************************************
> **
> > ***************@@ -1714,7 +1723,7 @@ vfrFormDefinition :
> >    ;  vfrFormMapDefinition :-  << +  <<     CIfrFormMap *FMapObj =
> NULL;
> > UINT32      FormMapMethodNumber = 0;     EFI_GUID    Guid;@@
> -1775,11
> > +1784,15 @@ vfrStatementDefault :
> >       CIfrNumeric           *NumericQst   = NULL;    >>-
> D:Default
> > +  D:Default                                         <<+
> if
> > (mIsCatchDefaultEnable) {+
> > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > >getLine());+
>       }+                                                    >>
> > (     (-      "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(),
> *Val,
> > ArrayType] ","  -
> << +      "="
> > vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","+
> > <<                                                         if
> (gCurrentMinMaxData != NULL &&
> > gCurrentMinMaxData->IsNumericOpcode())
> >
> {                                                           //c
> heck default value is valid for Numeric
> > Opcode
> NumericQst = (CIfrNumeric *)
> > gCurrentQuestion;@@ -1888,14 +1901,14 @@ vfrStatementDefault :
> >          vfrStatementValue ","                       << CIfrEnd
> EndObj1;
> > EndObj1.SetLineNo(D->getLine()); >>     )     {-      DefaultStore "="
> > SN:StringIdentifier ","      << +      DefaultStore "="
SN:StringIdentifier
> ","      <<
> > _PCATCH(gCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), 
> > SN); if (DObj != NULL) {-
> DObj->SetDefaultId
> > (DefaultId);
> -                                                        } +
> > DObj->SetDefaultId
> (DefaultId);+
>     }
> > if (DObj2 != NULL) {-
> DObj2->SetDefaultId
> > (DefaultId); +
> DObj2->SetDefaultId
> >
> (DefaultId);
>     }                                                     >>
> >  }@@ -1917,8 +1930,8 @@ vfrStatementDefault :
> >
>         );
>      }
> >                                              }-
> if (DObj  != NULL)
> > {delete DObj;} -
> if (DObj2 != NULL) {delete
> > DObj2;} +
> if (DObj  != NULL) {delete DObj;}+
> > if (DObj2 != NULL) {delete
> DObj2;}                                                     >>
>   )   ;@@ -
> > 1970,11 +1983,15 @@ vfrStatementInvalid :
> >    ;  flagsField :-  Number -  | InteractiveFlag -  | 
> > ManufacturingFlag -  | DefaultFlag -  | ResetRequiredFlag +  Number+
> > | InteractiveFlag+  |
> > ManufacturingFlag+  | D:DefaultFlag
> <<+
> > if (mIsCatchDefaultEnable) {+
> > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > >getLine());+
>         }+
> > >>+  | ResetRequiredFlag   | ReconnectRequiredFlag   |
> N:NVAccessFlag
> > <<
> gCVfrErrorHandle.HandleWarning (@@ -
> > 1989,7 +2006,7 @@ flagsField :
> >
> > L->getLine(),
> >
> L->getText()
>          );-
> >                                                        >>
> +                                                       >>   ;
> > vfrStatementValue :@@ -2001,13 +2018,13 @@ vfrStatementValue :
> >  vfrStatementRead :   << CIfrRead RObj; >>   R:Read
> > << RObj.SetLineNo(R->getLine()); >>-  vfrStatementExpression[0] ";" +
> > vfrStatementExpression[0] ";"   ;  vfrStatementWrite :   << CIfrWrite
> WObj; >>
> > W:Write                                              <<
> WObj.SetLineNo(W->getLine()); >>-
> > vfrStatementExpression[0] ";" +  vfrStatementExpression[0] ";"   ;
> > vfrStatementSubTitle :@@ -2140,7 +2157,7 @@ vfrStatementGoto :
> >        FormId "=" F3:Number ","                         <<
> RefType = 2; FId = _STOFID(F3-
> > >getText(), F3->getLine()); >>       Question "="       (-
> QN3:StringIdentifier
> > ","                     << +          QN3:StringIdentifier ","
> <<
> > mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask); 
> > if (QId == EFI_QUESTION_ID_INVALID)
> >
> {
> _PCATCH(VFR_RETURN_UNDEFINED,
> > QN3);@@ -2222,7 +2239,7 @@ vfrStatementGoto :
> >      "," Key "=" KN:Number                              <<
> AssignQuestionKey (*QHObj,
> > KN); >>   }   {-    E:"," +    E:","
> vfrStatementQuestionOptionList                   <<
> > OHObj->SetScope(1); CRT_END_OP (E);>>   }   ";"
> > << 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;}>>@@ -2511,20 +2528,20 @@ 
> > minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
> >    {     "default" "=" N:Number ","                         <<
> > switch (KeyValue) {-
> case 0: +
> > case 0:
> D.Year  = _STOU16(N->getText(), N-
> > >getLine());
> if (D.Year < _STOU16 (MinN-
> > >getText(), MinN->getLine()) || D.Year > _STOU16 (MaxN->getText(), 
> > >MaxN-
> > >getLine()))
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value
> must
> > be between Min year and Max
> year.");
>      }
> > break;-
> case 1: -
> > D.Month = _STOU8(N->getText(), N->getLine()); + case 1:+
> D.Month = _STOU8(N->getText(), N-
> > >getLine());
> if (D.Month < 1 || D.Month > 12)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value 
> > must be between 1 and
> 12.");
>     }
> > break;-
> case 2: -
> > D.Day = _STOU8(N->getText(), N->getLine()); + case 2:+
> D.Day = _STOU8(N->getText(), N-
> > >getLine());
> if (D.Day < 1 || D.Day > 31)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value
> must
> > be between 1 and
> 31.");
>     }@@ -2570,7
> > +2587,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
> >       BOOLEAN MinNegative = FALSE;      BOOLEAN MaxNegative =
> FALSE;   >>-
> > Minimum   "=" +  Minimum   "="   {     "\-"
> <<
> > MinNegative = TRUE; >>   }@@ -2659,8 +2676,8 @@
> > vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
> >
>  }                                                           }
> >                                       >>-  Maximum   "=" -
> { +  Maximum   "="+  {     "\-"
> > << MaxNegative = TRUE; >>   }   A:Number ","
> <<@@ -
> > 2889,7 +2906,7 @@ vfrStatementNumeric :
> >                                                            }
>                                                         >>
> > vfrStatementQuestionOptionList-  E:EndNumeric
> << +
> > E:EndNumeric                                         <<
> > CRT_END_OP (E);
> if (GuidObj != NULL)
> >
> {
> GuidObj->SetScope(1);@@ -3131,7
> > +3148,7 @@ vfrStatementString :
> >    {     Key "=" KN:Number ","                              <<
> AssignQuestionKey (SObj,
> > KN); >>   }-  MinSize "=" MIN:Number ","
> << +  MinSize "="
> > MIN:Number ","                           <<
> > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); StringMinSize = 
> > _STOU8(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(),
> > MIN->getLine()) > StringMinSize) {@@ -3141,7
> > +3158,7 @@ vfrStatementString :
> >                                                            } 
> > SObj.SetMinSize
> (StringMinSize);
>        >>-  MaxSize
> > "=" MAX:Number ","                           << +  MaxSize "="
> MAX:Number ","
> > <<
> StringMaxSize = _STOU8(MAX->getText(),
> > MAX->getLine());
> if (_STOU64(MAX-
> > >getText(), MAX->getLine()) > StringMaxSize)
> >
> {
> _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize
> takes
> > only one byte, which can't be larger than 0xFF.");@@ -3185,7 +3202,7 
> > @@ vfrStatementPassword :
> >    {     Key "=" KN:Number ","                              <<
> AssignQuestionKey (PObj,
> > KN); >>   }-  MinSize "=" MIN:Number ","
> << +  MinSize "="
> > MIN:Number ","                           <<
> > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); PasswordMinSize = 
> > _STOU16(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(),
> > MIN->getLine()) > PasswordMinSize) {@@ -
> > 3195,7 +3212,7 @@ vfrStatementPassword :
> >                                                            } 
> > PObj.SetMinSize
> (PasswordMinSize);
>           >>-
> > MaxSize "=" MAX:Number ","                           << +
> MaxSize "=" MAX:Number
> > ","                           <<
> PasswordMaxSize =
> > _STOU16(MAX->getText(), MAX->getLine());
> if
> > (_STOU64(MAX->getText(), MAX->getLine()) > PasswordMaxSize)
> >
> {
> _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize
> takes
> > only two byte, which can't be larger than 0xFFFF.");@@ -3230,12
> > +3247,12 @@ vfrStatementOrderedList :
> >    >>   L:OrderedList
> << OLObj.SetLineNo(L->getLine());
> > gIsOrderedList = TRUE;>>   vfrQuestionHeader[OLObj] ","-
> > << +                                                       <<
> > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); OLObj.SetMaxContainers
> > ((UINT8) (VarArraySize > 0xFF ? 0xFF :
> >
> VarArraySize));
>       >>   {-    MaxContainers "="
> > M:Number ","                     << +    MaxContainers "="
> M:Number ","
> > <<
> if (_STOU64(M->getText(), M->getLine()) >
> > _STOU8(M->getText(), M->getLine()))
> >
> {
> _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList 
> > MaxContainers takes only one byte, which can't be larger than
> >
> 0xFF.");
>    } else if (VarArraySize != 0 &&
> > _STOU8(M->getText(), M->getLine()) > VarArraySize) {@@ -3328,19
> > +3345,19 @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8
> KeyValue] :
> >    {     "default" "=" N:Number ","                         <<
> > switch (KeyValue) {-
> case 0: -
> > T.Hour   = _STOU8(N->getText(), N->getLine()); +
> > case 0:+
> T.Hour   = _STOU8(N->getText(), N-
> > >getLine());
> if (T.Hour > 23)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value
> must
> > be between 0 and
> 23.");
>     }
> > break;-
> case 1: -
> > T.Minute = _STOU8(N->getText(), N->getLine()); + case 1:+
> T.Minute = _STOU8(N->getText(), N-
> > >getLine());
> if (T.Minute > 59)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value 
> > must be between 0 and
> 59.");
>     }
> > break;-
> case 2: +
> > case 2:
> T.Second = _STOU8(N->getText(), N-
> > >getLine());
> if (T.Second > 59)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value 
> > must be between 0 and 59.");@@ -3419,11 +3436,11 @@ 
> > vfrStatementStatListOld :
> >    ;  vfrStatementDisableIfStat :-  << -    CIfrDisableIf DIObj; +  <<+
> > CIfrDisableIf DIObj;   >>   L:DisableIf
> <<
> > DIObj.SetLineNo(L->getLine()); >>-  vfrStatementExpression[0] ";" +
> > vfrStatementExpression[0] ";"   ( vfrStatementStatList )*   E:EndIf
> > << CRT_END_OP (E); >>   ";"@@ -3548,8 +3565,8 @@
> > vfrStatementWarningIf :
> >    ;  vfrStatementDisableIfQuest :-  << -    CIfrDisableIf DIObj; +
> <<+
> > CIfrDisableIf DIObj;   >>   L:DisableIf
> <<
> > DIObj.SetLineNo(L->getLine()); >>   vfrStatementExpression[0] ";"@@ -
> > 3616,15 +3633,15 @@ vfrStatementOneOfOption :
> >       UINT32             *Type32       = (UINT32 *) ValueList;
> UINT64
> > *Type64       = (UINT64 *) ValueList;   >>-  L:Option
> <<
> > +  L:Option                                             <<
> if
> > (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER)
> >
> {
> _PCATCH (VFR_RETURN_FATAL_ERROR, L-
> > >getLine(), "Get data type
> >
> error.");
>    }                                                         >
> >-
> > Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","      +  Text  "="
> > "STRING_TOKEN" "\(" S:Number "\)" ","   Value "="
> > vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","-
> > << +                                                       <<
> if
> > (gCurrentMinMaxData != NULL)
> {
> //set
> > min/max value for oneof opcode
> UINT64
> > Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE(),
> > _GET_CURRQEST_VARTINFO().mIsBitVar);@@ -3696,7 +3713,7 @@ 
> > vfrStatementOneOfOption :
> >
> Size += OFFSET_OF
> > (EFI_IFR_ONE_OF_OPTION, Value);
> OOOObj =
> > new CIfrOneOfOption((UINT8)Size);
> OOOObj-
> > >SetLineNo(L->getLine());-
> OOOObj-
> > >SetOption (_STOSID(S->getText(), S->getLine())); +
> > OOOObj->SetOption (_STOSID(S->getText(), S->getLine()));
> > if (ArrayType)
> {
> OOOObj->SetType
> >
> (EFI_IFR_TYPE_BUFFER);
>                  } else {@@ -3706,7
> > +3723,7 @@ vfrStatementOneOfOption :
> >
> OOOObj->SetType
> >
> (_GET_CURRQEST_DATATYPE());
>                          }
> >                                       }-
> OOOObj->SetValue
> > (*Val); +
> OOOObj->SetValue
> >
> (*Val);                                                        >>
> F:FLAGS "="
> > vfrOneOfOptionFlags[*OOOObj, F->getLine()] <<@@ -3790,7 +3807,12 @@ 
> > oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
> >    | RestStyleFlag                                      <<
> $HFlags |= 0x20; >>   |
> > ReconnectRequiredFlag                              << $HFlags |=
> 0x40; >>   |
> > ManufacturingFlag                                  << $LFlags |=
> 0x20; >>-  | DefaultFlag
> > << $LFlags |= 0x10; >>+  | D:DefaultFlag
> <<+
> > $LFlags |= 0x10;+
> if (mIsCatchDefaultEnable)
> > {+
> > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > >getLine());+
>           }+
> >  >>   | A:NVAccessFlag                                     <<
> > gCVfrErrorHandle.HandleWarning
> >
> (
> VFR_WARNING_OBSOLETED_FRAMEWORK
> > _OPCODE,@@ -3963,7 +3985,7 @@ vfrStatementExpression [UINT32 
> > RootLevel, UINT32 ExpOpCount = 0] :
> >
>    }
>    }
> >                                              }-
> +
> > if ($RootLevel == 0)
> {
> _CLEAR_SAVED_OPHDR
> > ();
> mCIfrOpHdrIndex --;@@ -4405,10
> > +4427,10 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >
> for (Index = 0; Index < ListLen; Index++)
> >
> {
>   EILObj.SetValueList (Index,
> >
> ValueList[Index]);
>              }-
> > +
> > + EILObj.UpdateIfrBuffer();-
> > _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());
> > -
> +
> > _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());+ if 
> > (QId == EFI_QUESTION_ID_INVALID)
> >
> {
>   EILObj.SetQuestionId (QId, VarIdStr,
> >
> LineNo);
>       }@@ -4458,9 +4480,9 @@
> > stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >    >>   L:StringRef   "\("-      ( +
> (         "STRING_TOKEN"-        "\(" +        "\("
> > S:Number << RefStringId = _STOSID(S->getText(), S->getLine()); >>
> "\)"
> > | I:Number << RefStringId = _STOSID(I->getText(), I->getLine()); 
> > | >>@@
> > | -
> > 4499,10 +4521,10 @@ getExp[UINT32 & RootLevel, UINT32 &
> ExpOpCount] :
> >       Info.mVarStoreId = 0;   >>   L:Get-  "\(" +  "\("
> vfrStorageVarId[Info,
> > VarIdStr, FALSE]       {"\|" FLAGS "=" numericVarStoreType [VarType] }-
> "\)"
> > << +  "\)"                                                 <<
> >
> {                                                             i
> f (Info.mVarStoreId == 0)
> >
> {
>   // support Date/Time question@@ -
> > 4549,9 +4571,9 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >
> > _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> > >getLine(), "Get/Set opcode don't support data
> >
> array");
>        }
>        }
> > -
> CIfrGet GObj(L->getLine()); -
> > _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine()); - 
> > GObj.SetVarInfo (&Info); +
> CIfrGet GObj(L-
> > >getLine());+
> _SAVE_OPHDR_COND (GObj,
> > ($ExpOpCount == 0), L->getLine());+
> > GObj.SetVarInfo (&Info);
> delete[] VarIdStr;
> >
> $ExpOpCount++;
>            }@@ -4608,7 +4630,7 @@
> > question23refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >        {         Uuid "=" guidDefinition[Guid] ","
> << Type = 0x3; >>       }-
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"
> > <<
> switch (Type) {@@ -4675,9 +4697,9 @@
> > setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >    "\("      vfrStorageVarId[Info, VarIdStr, FALSE]      {"\|" FLAG "="
> > numericVarStoreType [VarType] }-     ","
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +     ","
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"-
> > << +                                                       <<
> >
> {                                                             i
> f (Info.mVarStoreId == 0)
> >
> {
>   // support Date/Time question@@ -
> > 4724,8 +4746,8 @@ setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >
> > _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> > >getLine(), "Get/Set opcode don't support data
> >
> array");
>        }
>        }
> > -
> CIfrSet TSObj(L->getLine()); -
> > TSObj.SetVarInfo (&Info); +
> CIfrSet TSObj(L-
> > >getLine());+
> TSObj.SetVarInfo (&Info);
> > delete[] VarIdStr;
> >
> $ExpOpCount++;
>            }@@ -4808,9 +4830,9 @@
> > spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >    ;  vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:- 
> > L:Map
> > -  "\(" -  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]  +
> L:Map+
> > "\("+  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   ":"
> > << { CIfrMap MObj(L->getLine()); } >>
> (     vfrStatementExpression[0]@@ -
> > 4837,6 +4859,7 @@ spanFlags [UINT8 & Flags] :
> >  class EfiVfrParser { << private:+  BOOLEAN
> mIsCatchDefaultEnable;
> > UINT8               mParserStatus;   BOOLEAN
> mConstantOnlyInExpression;
> > @@ -4880,6 +4903,7 @@ public:
> >    VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN
> ANTLRTokenPtr);
> > VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32);
> VOID
> > _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);+
> VOID
> > DefaultValueError (IN EFI_VFR_RETURN_CODE, IN UINT32);    VOID
> > syn     (ANTLRAbstractToken  *, ANTLRChar *, SetWordType *,
> > ANTLRTokenType, INT32); @@ -4909,6 +4933,7 @@ public:
> >    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);   VOID
> IdEqListDoSpecial     (IN
> > UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN
> > UINT16, IN UINT16 *);   VOID                SetOverrideClassGuid
> (IN EFI_GUID *);+
> > VOID                SetIsCatchDefaultEnable (BOOLEAN
> IsCatchDefaultEnable); >> }
> > @@ -5086,6 +5111,17 @@ EfiVfrParser::_PCATCH (
> >    mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError 
> > (ReturnCode, LineNum, (CHAR8 *) ErrorMsg); }
> > +VOID+EfiVfrParser::DefaultValueError (+  IN EFI_VFR_RETURN_CODE
> > ReturnCode,+  IN UINT32              LineNum+  )+{+  CHAR8
> ErrorMsg[100];+
> > sprintf(ErrorMsg, "please remove the default value / defaultstore in 
> > line %d", LineNum);+  mParserStatus = mParserStatus + 
> > gCVfrErrorHandle.HandleError (ReturnCode, LineNum, ErrorMsg);+}+ 
> > VOID
> EfiVfrParser::syn
> > (   ANTLRAbstractToken  *Tok,@@ -5682,12 +5718,18 @@
> > EfiVfrParser::IdEqListDoSpecial (
> >    } } -VOID +VOID EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID
> > *OverrideClassGuid) {   mOverrideClassGuid = OverrideClassGuid; }
> > +VOID+EfiVfrParser::SetIsCatchDefaultEnable (BOOLEAN
> > IsCatchDefaultEnable)+{+  mIsCatchDefaultEnable =
> IsCatchDefaultEnable;+}+
> > VOID EfiVfrParser::CheckDuplicateDefaultValue (   IN EFI_DEFAULT_ID
> > DefaultId,--
> > 2.26.2.windows.1






-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112882): https://edk2.groups.io/g/devel/message/112882
Mute This Topic: https://groups.io/mt/103126873/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature
  2023-12-25  1:23       ` [edk2-devel] 回复: " gaoliming via groups.io
@ 2023-12-25  7:14         ` Zhang, Zifeng
  0 siblings, 0 replies; 12+ messages in thread
From: Zhang, Zifeng @ 2023-12-25  7:14 UTC (permalink / raw)
  To: Gao, Liming, Yang, Yuting2
  Cc: 'Rebecca Cran', Feng, Bob C, Chen, Arthur G,
	devel@edk2.groups.io, Chen, Christine, Guo, Gua

Hi Liming,

Thanks for solution, but we have a concern for it.
Add --catch_default option in INF from module level will bring much effort to maintain, since the number of modules in Intel package is big
and we need to update for new modules in further code change.
So we prefer to transfer build option from package level.
Would you like to share your opinion?

Best Regards,
Zifeng

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn> 
Sent: Monday, December 25, 2023 9:23 AM
To: Zhang, Zifeng <zifeng.zhang@intel.com>; Yang, Yuting2 <yuting2.yang@intel.com>
Cc: 'Rebecca Cran' <rebecca@bsdio.com>; Feng, Bob C <bob.c.feng@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>; devel@edk2.groups.io; Chen, Christine <yuwei.chen@intel.com>
Subject: 回复: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature

Zifeng:
 VFR_FLAGS can be set in the module INF for this module only. So, you can set --catch_default option in the modules those you want to remove the default opcode for. With this usage, --except_list option is not required. 

 For example, module INF can add below section to enable this option. 

 [BuildOptions]
 *_*_*_VFR_FLAGS = --catch_default

Thanks
Liming
> -----邮件原件-----
> 发件人: Zhang, Zifeng <zifeng.zhang@intel.com>
> 发送时间: 2023年12月21日 14:44
> 收件人: Gao, Liming <gaoliming@byosoft.com.cn>; Yang, Yuting2 
> <yuting2.yang@intel.com>
> 抄送: Rebecca Cran <rebecca@bsdio.com>; Feng, Bob C 
> <bob.c.feng@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>; 
> devel@edk2.groups.io; Chen, Christine <yuwei.chen@intel.com>
> 主题: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> Hi Liming,
> 
> Thanks for reviewing.
> For background of this change, we will remove default flags in VFR/HFR 
> in new platform. So we need help from VFR complier to make a default 
> flag check to avoid manually adding.
> @Yang, Yuting2, could you help to create a BZ for this feature and 
> share
in
> mail thread?
> Then let me make a clarification for your questions.
> 
> #1: The purpose of --catch_default
> We send --catch_default flag in build option to indicate which 
> platform
should
> check default flag in VFR/HFR.
> Actually maybe some platforms used same EDK2 downstream branch, so we 
> only send --catch_default flag for the platforms which need this check.
> 
> #2: The purpose of --except_list
> VFR compiler will receive VFR/HFR configurations from all folders
including
> Intel and EDK2. But in our expectation VFR compiler only do this check 
> in Intel.
> So We use --except_list to deliver package list in EDK2 to avoid this
check.
> 
> Best Regards,
> Zifeng
> 
> -----Original Message-----
> From: Yang, Yuting2 <yuting2.yang@intel.com>
> Sent: Tuesday, December 12, 2023 5:12 PM
> To: Zhang, Zifeng <zifeng.zhang@intel.com>; Chen, Arthur G 
> <arthur.g.chen@intel.com>; devel@edk2.groups.io
> Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
> Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> +Cc Zhang, Zifeng, Chen, Arthur G
> 
> -----Original Message-----
> From: Chen, Christine <yuwei.chen@intel.com>
> Sent: Tuesday, December 12, 2023 5:04 PM
> To: Yang, Yuting2 <yuting2.yang@intel.com>; devel@edk2.groups.io
> Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
> Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> +Cc Yang, Yuting2
> 
> > -----Original Message-----
> > From: Yang, Yuting2 <yuting2.yang@intel.com>
> > Sent: Tuesday, December 12, 2023 5:01 PM
> > To: devel@edk2.groups.io
> > Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> > <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>; 
> > Chen, Christine <yuwei.chen@intel.com>
> > Subject: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> > Feature
> >
> > Add --catch_default option
> > Raise a DefaultValueError when encountering VFR default definitions 
> > to help remove default variables.
> > Add --except_list option
> > Exclude packages that don't require enabling the catch_default function.
> >
> > Cc: Rebecca Cran <rebecca@bsdio.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Bob Feng <bob.c.feng@intel.com>
> > Cc: Christine Chen <yuwei.chen@intel.com>
> > Cc: Yuting Yang <yuting2.yang@intel.com>
> >
> > Signed-off-by: Yuting Yang <yuting2.yang@intel.com>
> > ---
> >  BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  40 ++-
> >  BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   3 +
> >  BaseTools/Source/C/VfrCompile/VfrError.cpp    |   3 +-
> >  BaseTools/Source/C/VfrCompile/VfrError.h      |   3 +-
> >  BaseTools/Source/C/VfrCompile/VfrFormPkg.h    |   1 +
> >  BaseTools/Source/C/VfrCompile/VfrSyntax.g     | 238
> ++++++++++--------
> >  6 files changed, 184 insertions(+), 104 deletions(-)
> >
> > diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > index 5f4d262d85..e97cebff65 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > @@ -78,6 +78,9 @@ CVfrCompiler::OptionInitialization (
> >    mOptions.WarningAsError                = FALSE;
> mOptions.AutoDefault
> > = FALSE;   mOptions.CheckDefault                  = FALSE;+
> > mOptions.IsCatchDefaultEnable          = FALSE;+
> mOptions.ExceptionList
> > = NULL;+  mOptions.ExceptionListSize             = 0;   memset
> > (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));    if (Argc == 1)
> {@@ -
> > 95,6 +98,23 @@ CVfrCompiler::OptionInitialization (
> >        Version ();       SET_RUN_STATUS (STATUS_DEAD);
> return;+    } else if
> > (stricmp(Argv[Index], "--catch_default") == 0){+
> > mOptions.IsCatchDefaultEnable = TRUE;+    } else if
(stricmp(Argv[Index],
> "--
> > except_list") == 0){+      INT32 Start = ++Index;+      if ((Start >=
Argc)
> ||
> > (Argv[Start][0] == '-')) {+        DebugError (NULL, 0, 1001, "Missing
> option", "-
> > exception_list missing except list");+        goto Fail;+      }+
> while
> > ((Argv[Index][0] != '-') && (Index < Argc - 1)) {+        Index++;+
}+
> INT32
> > End = Index--;+      mOptions.ExceptionListSize = End - Start;+      for
> (INT32 i =
> > Start; i < End; i++) {+        mOptions.ExceptionList = (CHAR8**)
> > realloc(mOptions.ExceptionList, (i - Start + 1) * sizeof(CHAR8*));+
> > mOptions.ExceptionList[i-Start] = Argv[i];+      }     } else if
> (stricmp(Argv[Index],
> > "-l") == 0) {       mOptions.CreateRecordListFile = TRUE;
> > gCIfrRecordInfoDB.TurnOn ();@@ -179,7 +199,11 @@ 
> > CVfrCompiler::OptionInitialization (
> >        goto Fail;     }     strcpy (mOptions.VfrFileName,
> Argv[Index]);-+    for (int i =
> > 0; i < mOptions.ExceptionListSize; i++) {+      if
> (strstr(mOptions.VfrFileName,
> > mOptions.ExceptionList[i]) != NULL) {+
> mOptions.IsCatchDefaultEnable =
> > FALSE;+      }+    }     if (mOptions.OutputDirectory == NULL)
> > {       mOptions.OutputDirectory = (CHAR8 *) malloc (1);       if
> > (mOptions.OutputDirectory == NULL) {@@ -217,6 +241,11 @@ Fail:
> >      free (mOptions.VfrFileName);     mOptions.VfrFileName
> =
> > NULL;   }+  if (mOptions.ExceptionList != NULL) {+
> > free(mOptions.ExceptionList);+    mOptions.ExceptionList
> = NULL;++  }
> > if (mOptions.VfrBaseFileName != NULL) {     free
> (mOptions.VfrBaseFileName);
> > mOptions.VfrBaseFileName             = NULL;@@ -496,6 +525,11
> @@
> > CVfrCompiler::~CVfrCompiler (
> >      mOptions.VfrBaseFileName = NULL;   } +  if
> (mOptions.ExceptionList !=
> > NULL) {+    free (mOptions.ExceptionList);+    mOptions.ExceptionList =
> > NULL;+  }+   if (mOptions.OutputDirectory != NULL) {     free
> > (mOptions.OutputDirectory);     mOptions.OutputDirectory = NULL;@@
> -679,7
> > +713,7 @@ CVfrCompiler::Compile (
> >      DebugError (NULL, 0, 0001, "Error opening the input file", "%s",
> > InFileName);     goto Fail;   }-+  InputInfo.IsCatchDefaultEnable =
> > mOptions.IsCatchDefaultEnable;   if (mOptions.HasOverrideClassGuid)
> > {     InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;   }
> else
> > {@@ -937,5 +971,3 @@ main (
> >     return GetUtilityStatus (); }--diff --git 
> > a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > index b6e207d2ce..39e0a89a29 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > @@ -52,6 +52,9 @@ typedef struct {
> >    BOOLEAN WarningAsError;   BOOLEAN AutoDefault;   BOOLEAN
> > CheckDefault;+  BOOLEAN IsCatchDefaultEnable;+  CHAR8**
> ExceptionList;+
> > INT16    ExceptionListSize; } OPTIONS;  typedef enum {diff --git
> > a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > index 65bb8e34fd..8a706f929b 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > @@ -49,7 +49,8 @@ static SVFR_WARNING_HANDLE
> VFR_WARNING_HANDLE_TABLE
> > [] = {
> >    { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value
> re-defined
> > with different value"},   { VFR_WARNING_ACTION_WITH_TEXT_TWO, ":
> Action
> > opcode should not have TextTwo part"}, { 
> > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend to
> use
> > obsoleted framework opcode"},-  { VFR_WARNING_CODEUNDEFINED, ":
> > undefined Warning Code" }+  { VFR_WARNING_CODEUNDEFINED, ":
> > undefined Warning Code" },+  { VFR_WARNING_UNSUPPORTED, ": pls
> remove
> > the default values if necessary" } }; 
> > CVfrErrorHandle::CVfrErrorHandle (diff -- git 
> > a/BaseTools/Source/C/VfrCompile/VfrError.h
> > b/BaseTools/Source/C/VfrCompile/VfrError.h
> > index 7d16bd5f74..1b4bc173d2 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrError.h
> > +++ b/BaseTools/Source/C/VfrCompile/VfrError.h
> > @@ -47,7 +47,8 @@ typedef enum {
> >    VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0, 
> > VFR_WARNING_ACTION_WITH_TEXT_TWO,
> > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,-
> > VFR_WARNING_CODEUNDEFINED+  VFR_WARNING_CODEUNDEFINED,+ 
> > VFR_WARNING_UNSUPPORTED } EFI_VFR_WARNING_CODE;  typedef
> struct
> > _SVFR_ERROR_HANDLE {diff --git
> > a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > index 9ef6f07787..d8fada3bcb 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > @@ -96,6 +96,7 @@ struct SBufferNode {
> >   typedef struct {   EFI_GUID *OverrideClassGuid;+  BOOLEAN
> > IsCatchDefaultEnable; } INPUT_INFO_TO_SYNTAX;  class CFormPkg {diff 
> > --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > index 55fd067f8a..5daf1c423c 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > @@ -50,6 +50,7 @@ VfrParserStart (
> >  {   ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken>
> VfrParser(File);
> > VfrParser.parser()->SetOverrideClassGuid
> > (InputInfo->OverrideClassGuid);+
> > VfrParser.parser()->SetIsCatchDefaultEnable(InputInfo-
> > >IsCatchDefaultEnable);   return
> VfrParser.parser()->vfrProgram(); } >>@@ -
> > 386,8 +387,8 @@ dataStructField32 [BOOLEAN  FieldInUnion]:
> >    ;  dataStructField16 [BOOLEAN  FieldInUnion]:-  << -    UINT32
> ArrayNum = 0;
> > +  <<+    UINT32 ArrayNum = 0;   >>   ("UINT16" | "CHAR16")
> > N:StringIdentifier@@ -737,7 +738,7 @@ vfrFormSetList :
> >    ;  vfrStatementExtension:-  << +  <<      EFI_GUID Guid;
> CIfrGuid *GuidObj
> > = NULL;      CHAR8    *TypeName = NULL;@@ -751,7 +752,7 @@
> > vfrStatementExtension:
> >    >>   L:GuidOp   Uuid "=" guidDefinition[Guid]-  {"," DataType "=" +
> {","
> > DataType "="     (         U64:"UINT64" {OpenBracket AN1:Number
> CloseBracket
> > <<ArrayNum = _STOU32(AN1->getText(), AN1->getLine());>>} << TypeName
> =
> > U64->getText(); LineNum = U64->getLine(); >>@@ -770,7
> > +771,7 @@ vfrStatementExtension:
> >        | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket 
> > <<ArrayNum = _STOU32(AN8->getText(), AN8->getLine());>>} << TypeName 
> > = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>
> |
> > R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = 
> > _STOU32(AN9->getText(), AN9->getLine());>>}- << TypeName =
> > R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
> > +                                                      <<
> TypeName =
> > + R->getText(); LineNum = R-
> > >getLine(); IsStruct = TRUE;>>       | TN:StringIdentifier {OpenBracket
> > AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText(),
> AN10-
> > >getLine());>>}
> << TypeName = TN->getText();
> > LineNum = TN->getLine(); IsStruct = TRUE;>>     )@@ -875,19 +876,19
> @@
> > vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName,
> UINT32
> > TypeSize,
> >                  memcpy (ByteOffset, &Data_U64,
> TypeSize);               }else if (strcmp
> > ("UINT32", TypeName) == 0) {                 Data_U32 =
> _STOU32(RD->getText(),
> > RD->getLine());-                memcpy (ByteOffset, &Data_U32,
> TypeSize);
> > +                memcpy (ByteOffset, &Data_U32,
> TypeSize);               }else if (strcmp
> > ("UINT16", TypeName) == 0) {                 Data_U16 =
> _STOU16(RD->getText(),
> > RD->getLine());-                memcpy (ByteOffset, &Data_U16,
> TypeSize);
> > +                memcpy (ByteOffset, &Data_U16,
> TypeSize);               }else if (strcmp
> > ("UINT8", TypeName) == 0) {                 Data_U8 =
> _STOU8(RD->getText(), RD-
> > >getLine());-                memcpy (ByteOffset, &Data_U8, TypeSize);
> > +                memcpy (ByteOffset, &Data_U8,
> TypeSize);               }else if (strcmp
> > ("BOOLEAN", TypeName)== 0) {                 Data_BL =
> _STOU8(RD->getText(),
> > RD->getLine());-                memcpy (ByteOffset, &Data_BL,
> TypeSize);
> > +                memcpy (ByteOffset, &Data_BL,
> TypeSize);               }else if (strcmp
> > ("EFI_STRING_ID", TypeName) == 0) {                 Data_SID =
> _STOSID(RD-
> > >getText(), RD->getLine());-                memcpy (ByteOffset,
> &Data_SID,
> > TypeSize);
> +                memcpy (ByteOffset,
> > &Data_SID, TypeSize);               }             } else
> > {               gCVfrVarDataTypeDB.GetDataFieldInfo(TFName,
> FieldOffset,
> > FieldType, FieldSize, BitField);@@ -975,7 +976,15 @@
> > vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName,
> UINT32
> > TypeSize,
> >   vfrStatementDefaultStore :   << UINT16  DefaultId =
> > EFI_HII_DEFAULT_CLASS_STANDARD; >>-  D:DefaultStore
> N:StringIdentifier
> > ","+  D:DefaultStore N:StringIdentifier ","             <<+
> > if (mIsCatchDefaultEnable) {+
> > gCVfrErrorHandle.HandleWarning (+
> > VFR_WARNING_UNSUPPORTED,+
> D-
> > >getLine(),+
> D-
> > >getText()+
>        );+
>  }+
> >                                                     >>
> Prompt "=" "STRING_TOKEN" "\(" S:Number
> > "\)"   {     "," Attribute "=" A:Number                      <<
> DefaultId = _STOU16(A-
> > >getText(), A->getLine()); >>@@ -1074,7 +1083,7 @@
> > vfrStatementVarStoreEfi :
> >      | U64:"UINT64" ","                              <<
> TypeName = U64->getText();
> > LineNum = U64->getLine(); >>     | D:"EFI_HII_DATE" ","
> <<
> > TypeName = D->getText(); LineNum = D->getLine(); >>     |
> T:"EFI_HII_TIME"
> > ","                          << TypeName = T->getText(); LineNum =
> T->getLine(); >>-    |
> > R:"EFI_HII_REF" ","                           << TypeName =
> R->getText(); LineNum = R-
> > >getLine(); >>    +    | R:"EFI_HII_REF" ","
> << TypeName = R-
> > >getText(); LineNum = R->getLine(); >>   )   {     VarId "=" ID:Number
> ","
> > <<@@ -1092,8 +1101,8 @@ vfrStatementVarStoreEfi :
> >    (     Name    "=" SN:StringIdentifier ","             <<
> StoreName = SN-
> > >getText();   >>    |-    Name    "=" "STRING_TOKEN" "\("
> VN:Number "\)" ","  -
> > VarSize "=" N:Number ","                        << +    Name
> "=" "STRING_TOKEN"
> > "\(" VN:Number "\)" ","+    VarSize "=" N:Number ","
> <<
> > IsUEFI23EfiVarstore = FALSE;
> StoreName =
> > gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText(), VN-
> > >getLine()));
> if (StoreName == NULL) {@@ -
> > 1116,7 +1125,7 @@ vfrStatementVarStoreEfi :
> >
> break;
> case 8:
> > TypeName = (CHAR8 *) "UINT64";-
> break; +
> > break;
> default:
> > _PCATCH (VFR_RETURN_UNSUPPORTED, N); break;@@ -1124,7 +1133,7 @@ 
> > vfrStatementVarStoreEfi :
> >                                                      >>   ) -
> Uuid "=" guidDefinition[Guid]
> > << +  Uuid "=" guidDefinition[Guid]                     <<
> > if (IsUEFI23EfiVarstore)
> >
> {                                                        _PCAT
> CH(gCVfrDataStorage.DeclareBufferVarS
> > tore
> (
>                         StoreName,@@ -1150,7
> > +1159,7 @@ vfrStatementVarStoreEfi :
> >                                                         } 
> > VSEObj.SetGuid (&Guid);
> VSEObj.SetVarStoreId
> > (VarStoreId);-
> +
> > VSEObj.SetSize ((UINT16) Size);
> > VSEObj.SetName (StoreName);
> if
> > (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {@@ -1184,7
> > +1193,7 @@ vfrStatementVarStoreNameValue :
> >                                                      >>   }
> (-    Name "=" "STRING_TOKEN" "\("
> > N:Number "\)" ","  << +    Name "=" "STRING_TOKEN" "\(" N:Number
> "\)" ","
> > <<                                                        if
> (!Created)
> >
> {                                                          _PC
> ATCH(gCVfrDataStorage.DeclareNameVar
> > StoreBegin (SN->getText(), VarStoreId), SN); Created = TRUE;@@
> > -1245,12 +1254,12 @@ vfrStatementDisableIfFormSet :
> >  vfrStatementSuppressIfFormSet :   << CIfrSuppressIf SIObj;>>
> L:SuppressIf
> > <<-
> SIObj.SetLineNo(L->getLine()); +
> >
> SIObj.SetLineNo(L->getLine());
>                   >>   { FLAGS "="
> > flagsField ( "\|" flagsField )* "," }   vfrStatementExpression[0] ";"
> > vfrFormSetList-  E: EndIf +  E: EndIf   ";"
> <<
> > CRT_END_OP (E); >>   ; @@ -1491,7 +1500,7 @@
> vfrQuestionDataFieldName
> > [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
> >    (     SN2:StringIdentifier                            <<
> _STRCAT (&VarIdStr, SN2-
> > >getText()); LineNo = SN2->getLine(); >>     (-      "."
> << +
> > "."                                           <<
> _STRCAT
> > (&VarIdStr, ".");
> if
> > (mConstantOnlyInExpression)
> >
> {                                                          _PC
> ATCH(VFR_RETURN_CONSTANT_ONLY,
> > LineNo);@@ -1518,7 +1527,7 @@ vfrQuestionDataFieldName 
> > [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
> >    ;  vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> > BOOLEAN &ListType] :-  <<  +  <<     EFI_GUID    Guid;
> BOOLEAN     Negative =
> > FALSE;     BOOLEAN     IntDecStyle = FALSE;@@ -1634,11 +1643,11
> @@
> > vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> BOOLEAN
> > &ListType]
> >    | Z:Zero                                          <<
> $Value.u8     = _STOU8(Z->getText(), Z-
> > >getLine()); >>   | HOUR:Number ":" MINUTE:Number ":"
> SECOND:Number <<
> > $Value.time   = _STOT(HOUR->getText(), MINUTE->getText(),SECOND-
> > >getText(), HOUR->getLine()); >>   | YEAR:Number "/" MONTH:Number
> "/"
> > DAY:Number     << $Value.date   = _STOD(YEAR->getText(),
> MONTH->getText(),
> > DAY->getText(), YEAR->getLine()); >>-  | QI:Number";" FI:Number";"
> > guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)" +  | 
> > QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\("
> > DP:Number "\)"
> << $Value.ref    = _STOR(QI-
> > >getText(), FI->getText(), &Guid, DP->getText(), QI->getLine()); >>   |
> > "STRING_TOKEN" "\(" S1:Number "\)"              << $Value.string =
> _STOSID(S1-
> > >getText(), S1->getLine()); >>   | "\{"
> << ListType =
> > TRUE; >>-      L1:Number
> << +      L1:Number
> > <<
> switch (Type)
> >
> {                                                          case
> EFI_IFR_TYPE_NUM_SIZE_8 :
> > Type8[Index]  = _STOU8(L1->getText(), L1->getLine());@@ -1658,8
> > +1667,8 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> > &Value, BOOLEAN &ListType]
> >
> Index++;                                                     >>
> (-
> > "," -        L2:Number                                   << +
> ","+        L2:Number
> > <<
> switch (Type)
> >
> {                                                          case
> EFI_IFR_TYPE_NUM_SIZE_8 :
> > Type8[Index]  = _STOU8(L2->getText(), L2->getLine());@@ -1679,7
> > +1688,7 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> > &Value, BOOLEAN &ListType]
> >
> >
> Index++;                                                     >>
>        )*-    "\}"                                           +
> > "\}"   ;
> >
> //************************************************************
> **
> > ***************@@ -1714,7 +1723,7 @@ vfrFormDefinition :
> >    ;  vfrFormMapDefinition :-  << +  <<     CIfrFormMap *FMapObj =
> NULL;
> > UINT32      FormMapMethodNumber = 0;     EFI_GUID    Guid;@@
> -1775,11
> > +1784,15 @@ vfrStatementDefault :
> >       CIfrNumeric           *NumericQst   = NULL;    >>-
> D:Default
> > +  D:Default                                         <<+
> if
> > (mIsCatchDefaultEnable) {+
> > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > >getLine());+
>       }+                                                    >>
> > (     (-      "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(),
> *Val,
> > ArrayType] ","  -
> << +      "="
> > vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","+
> > <<                                                         if
> (gCurrentMinMaxData != NULL &&
> > gCurrentMinMaxData->IsNumericOpcode())
> >
> {                                                           //c
> heck default value is valid for Numeric
> > Opcode
> NumericQst = (CIfrNumeric *)
> > gCurrentQuestion;@@ -1888,14 +1901,14 @@ vfrStatementDefault :
> >          vfrStatementValue ","                       << CIfrEnd
> EndObj1;
> > EndObj1.SetLineNo(D->getLine()); >>     )     {-      DefaultStore "="
> > SN:StringIdentifier ","      << +      DefaultStore "="
SN:StringIdentifier
> ","      <<
> > _PCATCH(gCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), 
> > SN); if (DObj != NULL) {-
> DObj->SetDefaultId
> > (DefaultId);
> -                                                        } +
> > DObj->SetDefaultId
> (DefaultId);+
>     }
> > if (DObj2 != NULL) {-
> DObj2->SetDefaultId
> > (DefaultId); +
> DObj2->SetDefaultId
> >
> (DefaultId);
>     }                                                     >>
> >  }@@ -1917,8 +1930,8 @@ vfrStatementDefault :
> >
>         );
>      }
> >                                              }-
> if (DObj  != NULL)
> > {delete DObj;} -
> if (DObj2 != NULL) {delete
> > DObj2;} +
> if (DObj  != NULL) {delete DObj;}+
> > if (DObj2 != NULL) {delete
> DObj2;}                                                     >>
>   )   ;@@ -
> > 1970,11 +1983,15 @@ vfrStatementInvalid :
> >    ;  flagsField :-  Number -  | InteractiveFlag -  | 
> > ManufacturingFlag -  | DefaultFlag -  | ResetRequiredFlag +  Number+
> > | InteractiveFlag+  |
> > ManufacturingFlag+  | D:DefaultFlag
> <<+
> > if (mIsCatchDefaultEnable) {+
> > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > >getLine());+
>         }+
> > >>+  | ResetRequiredFlag   | ReconnectRequiredFlag   |
> N:NVAccessFlag
> > <<
> gCVfrErrorHandle.HandleWarning (@@ -
> > 1989,7 +2006,7 @@ flagsField :
> >
> > L->getLine(),
> >
> L->getText()
>          );-
> >                                                        >>
> +                                                       >>   ;
> > vfrStatementValue :@@ -2001,13 +2018,13 @@ vfrStatementValue :
> >  vfrStatementRead :   << CIfrRead RObj; >>   R:Read
> > << RObj.SetLineNo(R->getLine()); >>-  vfrStatementExpression[0] ";" +
> > vfrStatementExpression[0] ";"   ;  vfrStatementWrite :   << CIfrWrite
> WObj; >>
> > W:Write                                              <<
> WObj.SetLineNo(W->getLine()); >>-
> > vfrStatementExpression[0] ";" +  vfrStatementExpression[0] ";"   ;
> > vfrStatementSubTitle :@@ -2140,7 +2157,7 @@ vfrStatementGoto :
> >        FormId "=" F3:Number ","                         <<
> RefType = 2; FId = _STOFID(F3-
> > >getText(), F3->getLine()); >>       Question "="       (-
> QN3:StringIdentifier
> > ","                     << +          QN3:StringIdentifier ","
> <<
> > mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask); 
> > if (QId == EFI_QUESTION_ID_INVALID)
> >
> {
> _PCATCH(VFR_RETURN_UNDEFINED,
> > QN3);@@ -2222,7 +2239,7 @@ vfrStatementGoto :
> >      "," Key "=" KN:Number                              <<
> AssignQuestionKey (*QHObj,
> > KN); >>   }   {-    E:"," +    E:","
> vfrStatementQuestionOptionList                   <<
> > OHObj->SetScope(1); CRT_END_OP (E);>>   }   ";"
> > << 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;}>>@@ -2511,20 +2528,20 @@ 
> > minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
> >    {     "default" "=" N:Number ","                         <<
> > switch (KeyValue) {-
> case 0: +
> > case 0:
> D.Year  = _STOU16(N->getText(), N-
> > >getLine());
> if (D.Year < _STOU16 (MinN-
> > >getText(), MinN->getLine()) || D.Year > _STOU16 (MaxN->getText(), 
> > >MaxN-
> > >getLine()))
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value
> must
> > be between Min year and Max
> year.");
>      }
> > break;-
> case 1: -
> > D.Month = _STOU8(N->getText(), N->getLine()); + case 1:+
> D.Month = _STOU8(N->getText(), N-
> > >getLine());
> if (D.Month < 1 || D.Month > 12)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value 
> > must be between 1 and
> 12.");
>     }
> > break;-
> case 2: -
> > D.Day = _STOU8(N->getText(), N->getLine()); + case 2:+
> D.Day = _STOU8(N->getText(), N-
> > >getLine());
> if (D.Day < 1 || D.Day > 31)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value
> must
> > be between 1 and
> 31.");
>     }@@ -2570,7
> > +2587,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
> >       BOOLEAN MinNegative = FALSE;      BOOLEAN MaxNegative =
> FALSE;   >>-
> > Minimum   "=" +  Minimum   "="   {     "\-"
> <<
> > MinNegative = TRUE; >>   }@@ -2659,8 +2676,8 @@
> > vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
> >
>  }                                                           }
> >                                       >>-  Maximum   "=" -
> { +  Maximum   "="+  {     "\-"
> > << MaxNegative = TRUE; >>   }   A:Number ","
> <<@@ -
> > 2889,7 +2906,7 @@ vfrStatementNumeric :
> >                                                            }
>                                                         >>
> > vfrStatementQuestionOptionList-  E:EndNumeric
> << +
> > E:EndNumeric                                         <<
> > CRT_END_OP (E);
> if (GuidObj != NULL)
> >
> {
> GuidObj->SetScope(1);@@ -3131,7
> > +3148,7 @@ vfrStatementString :
> >    {     Key "=" KN:Number ","                              <<
> AssignQuestionKey (SObj,
> > KN); >>   }-  MinSize "=" MIN:Number ","
> << +  MinSize "="
> > MIN:Number ","                           <<
> > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); StringMinSize = 
> > _STOU8(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(),
> > MIN->getLine()) > StringMinSize) {@@ -3141,7
> > +3158,7 @@ vfrStatementString :
> >                                                            } 
> > SObj.SetMinSize
> (StringMinSize);
>        >>-  MaxSize
> > "=" MAX:Number ","                           << +  MaxSize "="
> MAX:Number ","
> > <<
> StringMaxSize = _STOU8(MAX->getText(),
> > MAX->getLine());
> if (_STOU64(MAX-
> > >getText(), MAX->getLine()) > StringMaxSize)
> >
> {
> _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize
> takes
> > only one byte, which can't be larger than 0xFF.");@@ -3185,7 +3202,7 
> > @@ vfrStatementPassword :
> >    {     Key "=" KN:Number ","                              <<
> AssignQuestionKey (PObj,
> > KN); >>   }-  MinSize "=" MIN:Number ","
> << +  MinSize "="
> > MIN:Number ","                           <<
> > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); PasswordMinSize = 
> > _STOU16(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(),
> > MIN->getLine()) > PasswordMinSize) {@@ -
> > 3195,7 +3212,7 @@ vfrStatementPassword :
> >                                                            } 
> > PObj.SetMinSize
> (PasswordMinSize);
>           >>-
> > MaxSize "=" MAX:Number ","                           << +
> MaxSize "=" MAX:Number
> > ","                           <<
> PasswordMaxSize =
> > _STOU16(MAX->getText(), MAX->getLine());
> if
> > (_STOU64(MAX->getText(), MAX->getLine()) > PasswordMaxSize)
> >
> {
> _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize
> takes
> > only two byte, which can't be larger than 0xFFFF.");@@ -3230,12
> > +3247,12 @@ vfrStatementOrderedList :
> >    >>   L:OrderedList
> << OLObj.SetLineNo(L->getLine());
> > gIsOrderedList = TRUE;>>   vfrQuestionHeader[OLObj] ","-
> > << +                                                       <<
> > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); OLObj.SetMaxContainers
> > ((UINT8) (VarArraySize > 0xFF ? 0xFF :
> >
> VarArraySize));
>       >>   {-    MaxContainers "="
> > M:Number ","                     << +    MaxContainers "="
> M:Number ","
> > <<
> if (_STOU64(M->getText(), M->getLine()) >
> > _STOU8(M->getText(), M->getLine()))
> >
> {
> _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList 
> > MaxContainers takes only one byte, which can't be larger than
> >
> 0xFF.");
>    } else if (VarArraySize != 0 &&
> > _STOU8(M->getText(), M->getLine()) > VarArraySize) {@@ -3328,19
> > +3345,19 @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8
> KeyValue] :
> >    {     "default" "=" N:Number ","                         <<
> > switch (KeyValue) {-
> case 0: -
> > T.Hour   = _STOU8(N->getText(), N->getLine()); +
> > case 0:+
> T.Hour   = _STOU8(N->getText(), N-
> > >getLine());
> if (T.Hour > 23)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value
> must
> > be between 0 and
> 23.");
>     }
> > break;-
> case 1: -
> > T.Minute = _STOU8(N->getText(), N->getLine()); + case 1:+
> T.Minute = _STOU8(N->getText(), N-
> > >getLine());
> if (T.Minute > 59)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value 
> > must be between 0 and
> 59.");
>     }
> > break;-
> case 2: +
> > case 2:
> T.Second = _STOU8(N->getText(), N-
> > >getLine());
> if (T.Second > 59)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value 
> > must be between 0 and 59.");@@ -3419,11 +3436,11 @@ 
> > vfrStatementStatListOld :
> >    ;  vfrStatementDisableIfStat :-  << -    CIfrDisableIf DIObj; +  <<+
> > CIfrDisableIf DIObj;   >>   L:DisableIf
> <<
> > DIObj.SetLineNo(L->getLine()); >>-  vfrStatementExpression[0] ";" +
> > vfrStatementExpression[0] ";"   ( vfrStatementStatList )*   E:EndIf
> > << CRT_END_OP (E); >>   ";"@@ -3548,8 +3565,8 @@
> > vfrStatementWarningIf :
> >    ;  vfrStatementDisableIfQuest :-  << -    CIfrDisableIf DIObj; +
> <<+
> > CIfrDisableIf DIObj;   >>   L:DisableIf
> <<
> > DIObj.SetLineNo(L->getLine()); >>   vfrStatementExpression[0] ";"@@ -
> > 3616,15 +3633,15 @@ vfrStatementOneOfOption :
> >       UINT32             *Type32       = (UINT32 *) ValueList;
> UINT64
> > *Type64       = (UINT64 *) ValueList;   >>-  L:Option
> <<
> > +  L:Option                                             <<
> if
> > (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER)
> >
> {
> _PCATCH (VFR_RETURN_FATAL_ERROR, L-
> > >getLine(), "Get data type
> >
> error.");
>    }                                                         >
> >-
> > Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","      +  Text  "="
> > "STRING_TOKEN" "\(" S:Number "\)" ","   Value "="
> > vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","-
> > << +                                                       <<
> if
> > (gCurrentMinMaxData != NULL)
> {
> //set
> > min/max value for oneof opcode
> UINT64
> > Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE(),
> > _GET_CURRQEST_VARTINFO().mIsBitVar);@@ -3696,7 +3713,7 @@ 
> > vfrStatementOneOfOption :
> >
> Size += OFFSET_OF
> > (EFI_IFR_ONE_OF_OPTION, Value);
> OOOObj =
> > new CIfrOneOfOption((UINT8)Size);
> OOOObj-
> > >SetLineNo(L->getLine());-
> OOOObj-
> > >SetOption (_STOSID(S->getText(), S->getLine())); +
> > OOOObj->SetOption (_STOSID(S->getText(), S->getLine()));
> > if (ArrayType)
> {
> OOOObj->SetType
> >
> (EFI_IFR_TYPE_BUFFER);
>                  } else {@@ -3706,7
> > +3723,7 @@ vfrStatementOneOfOption :
> >
> OOOObj->SetType
> >
> (_GET_CURRQEST_DATATYPE());
>                          }
> >                                       }-
> OOOObj->SetValue
> > (*Val); +
> OOOObj->SetValue
> >
> (*Val);                                                        >>
> F:FLAGS "="
> > vfrOneOfOptionFlags[*OOOObj, F->getLine()] <<@@ -3790,7 +3807,12 @@ 
> > oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
> >    | RestStyleFlag                                      <<
> $HFlags |= 0x20; >>   |
> > ReconnectRequiredFlag                              << $HFlags |=
> 0x40; >>   |
> > ManufacturingFlag                                  << $LFlags |=
> 0x20; >>-  | DefaultFlag
> > << $LFlags |= 0x10; >>+  | D:DefaultFlag
> <<+
> > $LFlags |= 0x10;+
> if (mIsCatchDefaultEnable)
> > {+
> > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > >getLine());+
>           }+
> >  >>   | A:NVAccessFlag                                     <<
> > gCVfrErrorHandle.HandleWarning
> >
> (
> VFR_WARNING_OBSOLETED_FRAMEWORK
> > _OPCODE,@@ -3963,7 +3985,7 @@ vfrStatementExpression [UINT32 
> > RootLevel, UINT32 ExpOpCount = 0] :
> >
>    }
>    }
> >                                              }-
> +
> > if ($RootLevel == 0)
> {
> _CLEAR_SAVED_OPHDR
> > ();
> mCIfrOpHdrIndex --;@@ -4405,10
> > +4427,10 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >
> for (Index = 0; Index < ListLen; Index++)
> >
> {
>   EILObj.SetValueList (Index,
> >
> ValueList[Index]);
>              }-
> > +
> > + EILObj.UpdateIfrBuffer();-
> > _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());
> > -
> +
> > _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());+ if 
> > (QId == EFI_QUESTION_ID_INVALID)
> >
> {
>   EILObj.SetQuestionId (QId, VarIdStr,
> >
> LineNo);
>       }@@ -4458,9 +4480,9 @@
> > stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >    >>   L:StringRef   "\("-      ( +
> (         "STRING_TOKEN"-        "\(" +        "\("
> > S:Number << RefStringId = _STOSID(S->getText(), S->getLine()); >>
> "\)"
> > | I:Number << RefStringId = _STOSID(I->getText(), I->getLine()); 
> > | >>@@
> > | -
> > 4499,10 +4521,10 @@ getExp[UINT32 & RootLevel, UINT32 &
> ExpOpCount] :
> >       Info.mVarStoreId = 0;   >>   L:Get-  "\(" +  "\("
> vfrStorageVarId[Info,
> > VarIdStr, FALSE]       {"\|" FLAGS "=" numericVarStoreType [VarType] }-
> "\)"
> > << +  "\)"                                                 <<
> >
> {                                                             i
> f (Info.mVarStoreId == 0)
> >
> {
>   // support Date/Time question@@ -
> > 4549,9 +4571,9 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >
> > _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> > >getLine(), "Get/Set opcode don't support data
> >
> array");
>        }
>        }
> > -
> CIfrGet GObj(L->getLine()); -
> > _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine()); - 
> > GObj.SetVarInfo (&Info); +
> CIfrGet GObj(L-
> > >getLine());+
> _SAVE_OPHDR_COND (GObj,
> > ($ExpOpCount == 0), L->getLine());+
> > GObj.SetVarInfo (&Info);
> delete[] VarIdStr;
> >
> $ExpOpCount++;
>            }@@ -4608,7 +4630,7 @@
> > question23refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >        {         Uuid "=" guidDefinition[Guid] ","
> << Type = 0x3; >>       }-
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"
> > <<
> switch (Type) {@@ -4675,9 +4697,9 @@
> > setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >    "\("      vfrStorageVarId[Info, VarIdStr, FALSE]      {"\|" FLAG "="
> > numericVarStoreType [VarType] }-     ","
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +     ","
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"-
> > << +                                                       <<
> >
> {                                                             i
> f (Info.mVarStoreId == 0)
> >
> {
>   // support Date/Time question@@ -
> > 4724,8 +4746,8 @@ setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >
> > _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> > >getLine(), "Get/Set opcode don't support data
> >
> array");
>        }
>        }
> > -
> CIfrSet TSObj(L->getLine()); -
> > TSObj.SetVarInfo (&Info); +
> CIfrSet TSObj(L-
> > >getLine());+
> TSObj.SetVarInfo (&Info);
> > delete[] VarIdStr;
> >
> $ExpOpCount++;
>            }@@ -4808,9 +4830,9 @@
> > spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >    ;  vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:- 
> > L:Map
> > -  "\(" -  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]  +
> L:Map+
> > "\("+  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   ":"
> > << { CIfrMap MObj(L->getLine()); } >>
> (     vfrStatementExpression[0]@@ -
> > 4837,6 +4859,7 @@ spanFlags [UINT8 & Flags] :
> >  class EfiVfrParser { << private:+  BOOLEAN
> mIsCatchDefaultEnable;
> > UINT8               mParserStatus;   BOOLEAN
> mConstantOnlyInExpression;
> > @@ -4880,6 +4903,7 @@ public:
> >    VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN
> ANTLRTokenPtr);
> > VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32);
> VOID
> > _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);+
> VOID
> > DefaultValueError (IN EFI_VFR_RETURN_CODE, IN UINT32);    VOID
> > syn     (ANTLRAbstractToken  *, ANTLRChar *, SetWordType *,
> > ANTLRTokenType, INT32); @@ -4909,6 +4933,7 @@ public:
> >    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);   VOID
> IdEqListDoSpecial     (IN
> > UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN
> > UINT16, IN UINT16 *);   VOID                SetOverrideClassGuid
> (IN EFI_GUID *);+
> > VOID                SetIsCatchDefaultEnable (BOOLEAN
> IsCatchDefaultEnable); >> }
> > @@ -5086,6 +5111,17 @@ EfiVfrParser::_PCATCH (
> >    mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError 
> > (ReturnCode, LineNum, (CHAR8 *) ErrorMsg); }
> > +VOID+EfiVfrParser::DefaultValueError (+  IN EFI_VFR_RETURN_CODE
> > ReturnCode,+  IN UINT32              LineNum+  )+{+  CHAR8
> ErrorMsg[100];+
> > sprintf(ErrorMsg, "please remove the default value / defaultstore in 
> > line %d", LineNum);+  mParserStatus = mParserStatus + 
> > gCVfrErrorHandle.HandleError (ReturnCode, LineNum, ErrorMsg);+}+ 
> > VOID
> EfiVfrParser::syn
> > (   ANTLRAbstractToken  *Tok,@@ -5682,12 +5718,18 @@
> > EfiVfrParser::IdEqListDoSpecial (
> >    } } -VOID +VOID EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID
> > *OverrideClassGuid) {   mOverrideClassGuid = OverrideClassGuid; }
> > +VOID+EfiVfrParser::SetIsCatchDefaultEnable (BOOLEAN
> > IsCatchDefaultEnable)+{+  mIsCatchDefaultEnable =
> IsCatchDefaultEnable;+}+
> > VOID EfiVfrParser::CheckDuplicateDefaultValue (   IN EFI_DEFAULT_ID
> > DefaultId,--
> > 2.26.2.windows.1






-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112922): https://edk2.groups.io/g/devel/message/112922
Mute This Topic: https://groups.io/mt/103369619/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature
  2023-12-25  7:10           ` Yuting Yang
@ 2024-01-12  5:20             ` Zhang, Zifeng
  2024-01-16 15:03               ` 回复: " gaoliming via groups.io
  0 siblings, 1 reply; 12+ messages in thread
From: Zhang, Zifeng @ 2024-01-12  5:20 UTC (permalink / raw)
  To: Yang, Yuting2, Gao, Liming; +Cc: Chen, Christine, devel@edk2.groups.io

Hi Liming,

Could you help to share the update for this patch solution?

Best Regards,
Zifeng

-----Original Message-----
From: Yang, Yuting2 <yuting2.yang@intel.com> 
Sent: Monday, December 25, 2023 3:10 PM
To: Gao, Liming <gaoliming@byosoft.com.cn>
Cc: Zhang, Zifeng <zifeng.zhang@intel.com>; Chen, Christine <yuwei.chen@intel.com>; devel@edk2.groups.io
Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature

Hi Liming,

Thank you for adding  the account for me.
I have created a Bugzilla https://bugzilla.tianocore.org/show_bug.cgi?id=4629 for this feature ~

Best Regards,,
Yuting

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn>
Sent: Monday, December 25, 2023 9:14 AM
To: Yang, Yuting2 <yuting2.yang@intel.com>
Subject: 回复: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature

Your account yuting2.yang@intel.com has been added. PW: tiano@123

> -----邮件原件-----
> 发件人: Yang, Yuting2 <yuting2.yang@intel.com>
> 发送时间: 2023年12月22日 13:41
> 收件人: Gao, Liming <gaoliming@byosoft.com.cn>
> 抄送: Rebecca Cran <rebecca@bsdio.com>; Feng, Bob C 
> <bob.c.feng@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>; 
> Chen, Christine <yuwei.chen@intel.com>; Zhang, Zifeng 
> <zifeng.zhang@intel.com>; devel@edk2.groups.io
> 主题: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> Hi Liming,
> 
> Thank you for reviewing ~
> Could you please help me create a Bugzilla account? Currently, I do 
> not
have
> access to the Bugzilla.
> 
> Best Regards,
> Yuting
> 
> -----Original Message-----
> From: Zhang, Zifeng <zifeng.zhang@intel.com>
> Sent: Thursday, December 21, 2023 2:44 PM
> To: Gao, Liming <gaoliming@byosoft.com.cn>; Yang, Yuting2 
> <yuting2.yang@intel.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>; Feng, Bob C 
> <bob.c.feng@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>; 
> devel@edk2.groups.io; Chen, Christine <yuwei.chen@intel.com>
> Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> Hi Liming,
> 
> Thanks for reviewing.
> For background of this change, we will remove default flags in VFR/HFR 
> in new platform. So we need help from VFR complier to make a default 
> flag check to avoid manually adding.
> @Yang, Yuting2, could you help to create a BZ for this feature and 
> share
in
> mail thread?
> Then let me make a clarification for your questions.
> 
> #1: The purpose of --catch_default
> We send --catch_default flag in build option to indicate which 
> platform
should
> check default flag in VFR/HFR.
> Actually maybe some platforms used same EDK2 downstream branch, so we 
> only send --catch_default flag for the platforms which need this check.
> 
> #2: The purpose of --except_list
> VFR compiler will receive VFR/HFR configurations from all folders
including
> Intel and EDK2. But in our expectation VFR compiler only do this check 
> in Intel.
> So We use --except_list to deliver package list in EDK2 to avoid this
check.
> 
> Best Regards,
> Zifeng
> 
> -----Original Message-----
> From: Yang, Yuting2 <yuting2.yang@intel.com>
> Sent: Tuesday, December 12, 2023 5:12 PM
> To: Zhang, Zifeng <zifeng.zhang@intel.com>; Chen, Arthur G 
> <arthur.g.chen@intel.com>; devel@edk2.groups.io
> Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
> Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> +Cc Zhang, Zifeng, Chen, Arthur G
> 
> -----Original Message-----
> From: Chen, Christine <yuwei.chen@intel.com>
> Sent: Tuesday, December 12, 2023 5:04 PM
> To: Yang, Yuting2 <yuting2.yang@intel.com>; devel@edk2.groups.io
> Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
> Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> +Cc Yang, Yuting2
> 
> > -----Original Message-----
> > From: Yang, Yuting2 <yuting2.yang@intel.com>
> > Sent: Tuesday, December 12, 2023 5:01 PM
> > To: devel@edk2.groups.io
> > Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> > <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>; 
> > Chen, Christine <yuwei.chen@intel.com>
> > Subject: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> > Feature
> >
> > Add --catch_default option
> > Raise a DefaultValueError when encountering VFR default definitions 
> > to help remove default variables.
> > Add --except_list option
> > Exclude packages that don't require enabling the catch_default function.
> >
> > Cc: Rebecca Cran <rebecca@bsdio.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Bob Feng <bob.c.feng@intel.com>
> > Cc: Christine Chen <yuwei.chen@intel.com>
> > Cc: Yuting Yang <yuting2.yang@intel.com>
> >
> > Signed-off-by: Yuting Yang <yuting2.yang@intel.com>
> > ---
> >  BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  40 ++-
> >  BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   3 +
> >  BaseTools/Source/C/VfrCompile/VfrError.cpp    |   3 +-
> >  BaseTools/Source/C/VfrCompile/VfrError.h      |   3 +-
> >  BaseTools/Source/C/VfrCompile/VfrFormPkg.h    |   1 +
> >  BaseTools/Source/C/VfrCompile/VfrSyntax.g     | 238
> ++++++++++--------
> >  6 files changed, 184 insertions(+), 104 deletions(-)
> >
> > diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > index 5f4d262d85..e97cebff65 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > @@ -78,6 +78,9 @@ CVfrCompiler::OptionInitialization (
> >    mOptions.WarningAsError                = FALSE;
> mOptions.AutoDefault
> > = FALSE;   mOptions.CheckDefault                  = FALSE;+
> > mOptions.IsCatchDefaultEnable          = FALSE;+
> mOptions.ExceptionList
> > = NULL;+  mOptions.ExceptionListSize             = 0;   memset
> > (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));    if (Argc == 1)
> {@@ -
> > 95,6 +98,23 @@ CVfrCompiler::OptionInitialization (
> >        Version ();       SET_RUN_STATUS (STATUS_DEAD);
> return;+    } else if
> > (stricmp(Argv[Index], "--catch_default") == 0){+
> > mOptions.IsCatchDefaultEnable = TRUE;+    } else if
(stricmp(Argv[Index],
> "--
> > except_list") == 0){+      INT32 Start = ++Index;+      if ((Start >=
Argc)
> ||
> > (Argv[Start][0] == '-')) {+        DebugError (NULL, 0, 1001, "Missing
> option", "-
> > exception_list missing except list");+        goto Fail;+      }+
> while
> > ((Argv[Index][0] != '-') && (Index < Argc - 1)) {+        Index++;+
}+
> INT32
> > End = Index--;+      mOptions.ExceptionListSize = End - Start;+      for
> (INT32 i =
> > Start; i < End; i++) {+        mOptions.ExceptionList = (CHAR8**)
> > realloc(mOptions.ExceptionList, (i - Start + 1) * sizeof(CHAR8*));+
> > mOptions.ExceptionList[i-Start] = Argv[i];+      }     } else if
> (stricmp(Argv[Index],
> > "-l") == 0) {       mOptions.CreateRecordListFile = TRUE;
> > gCIfrRecordInfoDB.TurnOn ();@@ -179,7 +199,11 @@ 
> > CVfrCompiler::OptionInitialization (
> >        goto Fail;     }     strcpy (mOptions.VfrFileName,
> Argv[Index]);-+    for (int i =
> > 0; i < mOptions.ExceptionListSize; i++) {+      if
> (strstr(mOptions.VfrFileName,
> > mOptions.ExceptionList[i]) != NULL) {+
> mOptions.IsCatchDefaultEnable =
> > FALSE;+      }+    }     if (mOptions.OutputDirectory == NULL)
> > {       mOptions.OutputDirectory = (CHAR8 *) malloc (1);       if
> > (mOptions.OutputDirectory == NULL) {@@ -217,6 +241,11 @@ Fail:
> >      free (mOptions.VfrFileName);     mOptions.VfrFileName
> =
> > NULL;   }+  if (mOptions.ExceptionList != NULL) {+
> > free(mOptions.ExceptionList);+    mOptions.ExceptionList
> = NULL;++  }
> > if (mOptions.VfrBaseFileName != NULL) {     free
> (mOptions.VfrBaseFileName);
> > mOptions.VfrBaseFileName             = NULL;@@ -496,6 +525,11
> @@
> > CVfrCompiler::~CVfrCompiler (
> >      mOptions.VfrBaseFileName = NULL;   } +  if
> (mOptions.ExceptionList !=
> > NULL) {+    free (mOptions.ExceptionList);+    mOptions.ExceptionList =
> > NULL;+  }+   if (mOptions.OutputDirectory != NULL) {     free
> > (mOptions.OutputDirectory);     mOptions.OutputDirectory = NULL;@@
> -679,7
> > +713,7 @@ CVfrCompiler::Compile (
> >      DebugError (NULL, 0, 0001, "Error opening the input file", "%s",
> > InFileName);     goto Fail;   }-+  InputInfo.IsCatchDefaultEnable =
> > mOptions.IsCatchDefaultEnable;   if (mOptions.HasOverrideClassGuid)
> > {     InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;   }
> else
> > {@@ -937,5 +971,3 @@ main (
> >     return GetUtilityStatus (); }--diff --git 
> > a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > index b6e207d2ce..39e0a89a29 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > @@ -52,6 +52,9 @@ typedef struct {
> >    BOOLEAN WarningAsError;   BOOLEAN AutoDefault;   BOOLEAN
> > CheckDefault;+  BOOLEAN IsCatchDefaultEnable;+  CHAR8**
> ExceptionList;+
> > INT16    ExceptionListSize; } OPTIONS;  typedef enum {diff --git
> > a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > index 65bb8e34fd..8a706f929b 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > @@ -49,7 +49,8 @@ static SVFR_WARNING_HANDLE
> VFR_WARNING_HANDLE_TABLE
> > [] = {
> >    { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value
> re-defined
> > with different value"},   { VFR_WARNING_ACTION_WITH_TEXT_TWO, ":
> Action
> > opcode should not have TextTwo part"}, { 
> > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend to
> use
> > obsoleted framework opcode"},-  { VFR_WARNING_CODEUNDEFINED, ":
> > undefined Warning Code" }+  { VFR_WARNING_CODEUNDEFINED, ":
> > undefined Warning Code" },+  { VFR_WARNING_UNSUPPORTED, ": pls
> remove
> > the default values if necessary" } }; 
> > CVfrErrorHandle::CVfrErrorHandle (diff -- git 
> > a/BaseTools/Source/C/VfrCompile/VfrError.h
> > b/BaseTools/Source/C/VfrCompile/VfrError.h
> > index 7d16bd5f74..1b4bc173d2 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrError.h
> > +++ b/BaseTools/Source/C/VfrCompile/VfrError.h
> > @@ -47,7 +47,8 @@ typedef enum {
> >    VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0, 
> > VFR_WARNING_ACTION_WITH_TEXT_TWO,
> > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,-
> > VFR_WARNING_CODEUNDEFINED+  VFR_WARNING_CODEUNDEFINED,+ 
> > VFR_WARNING_UNSUPPORTED } EFI_VFR_WARNING_CODE;  typedef
> struct
> > _SVFR_ERROR_HANDLE {diff --git
> > a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > index 9ef6f07787..d8fada3bcb 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > @@ -96,6 +96,7 @@ struct SBufferNode {
> >   typedef struct {   EFI_GUID *OverrideClassGuid;+  BOOLEAN
> > IsCatchDefaultEnable; } INPUT_INFO_TO_SYNTAX;  class CFormPkg {diff 
> > --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > index 55fd067f8a..5daf1c423c 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > @@ -50,6 +50,7 @@ VfrParserStart (
> >  {   ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken>
> VfrParser(File);
> > VfrParser.parser()->SetOverrideClassGuid
> > (InputInfo->OverrideClassGuid);+
> > VfrParser.parser()->SetIsCatchDefaultEnable(InputInfo-
> > >IsCatchDefaultEnable);   return
> VfrParser.parser()->vfrProgram(); } >>@@ -
> > 386,8 +387,8 @@ dataStructField32 [BOOLEAN  FieldInUnion]:
> >    ;  dataStructField16 [BOOLEAN  FieldInUnion]:-  << -    UINT32
> ArrayNum = 0;
> > +  <<+    UINT32 ArrayNum = 0;   >>   ("UINT16" | "CHAR16")
> > N:StringIdentifier@@ -737,7 +738,7 @@ vfrFormSetList :
> >    ;  vfrStatementExtension:-  << +  <<      EFI_GUID Guid;
> CIfrGuid *GuidObj
> > = NULL;      CHAR8    *TypeName = NULL;@@ -751,7 +752,7 @@
> > vfrStatementExtension:
> >    >>   L:GuidOp   Uuid "=" guidDefinition[Guid]-  {"," DataType "=" +
> {","
> > DataType "="     (         U64:"UINT64" {OpenBracket AN1:Number
> CloseBracket
> > <<ArrayNum = _STOU32(AN1->getText(), AN1->getLine());>>} << TypeName
> =
> > U64->getText(); LineNum = U64->getLine(); >>@@ -770,7
> > +771,7 @@ vfrStatementExtension:
> >        | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket 
> > <<ArrayNum = _STOU32(AN8->getText(), AN8->getLine());>>} << TypeName 
> > = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>
> |
> > R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = 
> > _STOU32(AN9->getText(), AN9->getLine());>>}- << TypeName =
> > R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
> > +                                                      <<
> TypeName =
> > + R->getText(); LineNum = R-
> > >getLine(); IsStruct = TRUE;>>       | TN:StringIdentifier {OpenBracket
> > AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText(),
> AN10-
> > >getLine());>>}
> << TypeName = TN->getText();
> > LineNum = TN->getLine(); IsStruct = TRUE;>>     )@@ -875,19 +876,19
> @@
> > vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName,
> UINT32
> > TypeSize,
> >                  memcpy (ByteOffset, &Data_U64,
> TypeSize);               }else if (strcmp
> > ("UINT32", TypeName) == 0) {                 Data_U32 =
> _STOU32(RD->getText(),
> > RD->getLine());-                memcpy (ByteOffset, &Data_U32,
> TypeSize);
> > +                memcpy (ByteOffset, &Data_U32,
> TypeSize);               }else if (strcmp
> > ("UINT16", TypeName) == 0) {                 Data_U16 =
> _STOU16(RD->getText(),
> > RD->getLine());-                memcpy (ByteOffset, &Data_U16,
> TypeSize);
> > +                memcpy (ByteOffset, &Data_U16,
> TypeSize);               }else if (strcmp
> > ("UINT8", TypeName) == 0) {                 Data_U8 =
> _STOU8(RD->getText(), RD-
> > >getLine());-                memcpy (ByteOffset, &Data_U8, TypeSize);
> > +                memcpy (ByteOffset, &Data_U8,
> TypeSize);               }else if (strcmp
> > ("BOOLEAN", TypeName)== 0) {                 Data_BL =
> _STOU8(RD->getText(),
> > RD->getLine());-                memcpy (ByteOffset, &Data_BL,
> TypeSize);
> > +                memcpy (ByteOffset, &Data_BL,
> TypeSize);               }else if (strcmp
> > ("EFI_STRING_ID", TypeName) == 0) {                 Data_SID =
> _STOSID(RD-
> > >getText(), RD->getLine());-                memcpy (ByteOffset,
> &Data_SID,
> > TypeSize);
> +                memcpy (ByteOffset,
> > &Data_SID, TypeSize);               }             } else
> > {               gCVfrVarDataTypeDB.GetDataFieldInfo(TFName,
> FieldOffset,
> > FieldType, FieldSize, BitField);@@ -975,7 +976,15 @@
> > vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName,
> UINT32
> > TypeSize,
> >   vfrStatementDefaultStore :   << UINT16  DefaultId =
> > EFI_HII_DEFAULT_CLASS_STANDARD; >>-  D:DefaultStore
> N:StringIdentifier
> > ","+  D:DefaultStore N:StringIdentifier ","             <<+
> > if (mIsCatchDefaultEnable) {+
> > gCVfrErrorHandle.HandleWarning (+
> > VFR_WARNING_UNSUPPORTED,+
> D-
> > >getLine(),+
> D-
> > >getText()+
>        );+
>  }+
> >                                                     >>
> Prompt "=" "STRING_TOKEN" "\(" S:Number
> > "\)"   {     "," Attribute "=" A:Number                      <<
> DefaultId = _STOU16(A-
> > >getText(), A->getLine()); >>@@ -1074,7 +1083,7 @@
> > vfrStatementVarStoreEfi :
> >      | U64:"UINT64" ","                              <<
> TypeName = U64->getText();
> > LineNum = U64->getLine(); >>     | D:"EFI_HII_DATE" ","
> <<
> > TypeName = D->getText(); LineNum = D->getLine(); >>     |
> T:"EFI_HII_TIME"
> > ","                          << TypeName = T->getText(); LineNum =
> T->getLine(); >>-    |
> > R:"EFI_HII_REF" ","                           << TypeName =
> R->getText(); LineNum = R-
> > >getLine(); >>    +    | R:"EFI_HII_REF" ","
> << TypeName = R-
> > >getText(); LineNum = R->getLine(); >>   )   {     VarId "=" ID:Number
> ","
> > <<@@ -1092,8 +1101,8 @@ vfrStatementVarStoreEfi :
> >    (     Name    "=" SN:StringIdentifier ","             <<
> StoreName = SN-
> > >getText();   >>    |-    Name    "=" "STRING_TOKEN" "\("
> VN:Number "\)" ","  -
> > VarSize "=" N:Number ","                        << +    Name
> "=" "STRING_TOKEN"
> > "\(" VN:Number "\)" ","+    VarSize "=" N:Number ","
> <<
> > IsUEFI23EfiVarstore = FALSE;
> StoreName =
> > gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText(), VN-
> > >getLine()));
> if (StoreName == NULL) {@@ -
> > 1116,7 +1125,7 @@ vfrStatementVarStoreEfi :
> >
> break;
> case 8:
> > TypeName = (CHAR8 *) "UINT64";-
> break; +
> > break;
> default:
> > _PCATCH (VFR_RETURN_UNSUPPORTED, N); break;@@ -1124,7 +1133,7 @@ 
> > vfrStatementVarStoreEfi :
> >                                                      >>   ) -
> Uuid "=" guidDefinition[Guid]
> > << +  Uuid "=" guidDefinition[Guid]                     <<
> > if (IsUEFI23EfiVarstore)
> >
> {                                                        _PCAT
> CH(gCVfrDataStorage.DeclareBufferVarS
> > tore
> (
>                         StoreName,@@ -1150,7
> > +1159,7 @@ vfrStatementVarStoreEfi :
> >                                                         } 
> > VSEObj.SetGuid (&Guid);
> VSEObj.SetVarStoreId
> > (VarStoreId);-
> +
> > VSEObj.SetSize ((UINT16) Size);
> > VSEObj.SetName (StoreName);
> if
> > (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {@@ -1184,7
> > +1193,7 @@ vfrStatementVarStoreNameValue :
> >                                                      >>   }
> (-    Name "=" "STRING_TOKEN" "\("
> > N:Number "\)" ","  << +    Name "=" "STRING_TOKEN" "\(" N:Number
> "\)" ","
> > <<                                                        if
> (!Created)
> >
> {                                                          _PC
> ATCH(gCVfrDataStorage.DeclareNameVar
> > StoreBegin (SN->getText(), VarStoreId), SN); Created = TRUE;@@
> > -1245,12 +1254,12 @@ vfrStatementDisableIfFormSet :
> >  vfrStatementSuppressIfFormSet :   << CIfrSuppressIf SIObj;>>
> L:SuppressIf
> > <<-
> SIObj.SetLineNo(L->getLine()); +
> >
> SIObj.SetLineNo(L->getLine());
>                   >>   { FLAGS "="
> > flagsField ( "\|" flagsField )* "," }   vfrStatementExpression[0] ";"
> > vfrFormSetList-  E: EndIf +  E: EndIf   ";"
> <<
> > CRT_END_OP (E); >>   ; @@ -1491,7 +1500,7 @@
> vfrQuestionDataFieldName
> > [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
> >    (     SN2:StringIdentifier                            <<
> _STRCAT (&VarIdStr, SN2-
> > >getText()); LineNo = SN2->getLine(); >>     (-      "."
> << +
> > "."                                           <<
> _STRCAT
> > (&VarIdStr, ".");
> if
> > (mConstantOnlyInExpression)
> >
> {                                                          _PC
> ATCH(VFR_RETURN_CONSTANT_ONLY,
> > LineNo);@@ -1518,7 +1527,7 @@ vfrQuestionDataFieldName 
> > [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
> >    ;  vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> > BOOLEAN &ListType] :-  <<  +  <<     EFI_GUID    Guid;
> BOOLEAN     Negative =
> > FALSE;     BOOLEAN     IntDecStyle = FALSE;@@ -1634,11 +1643,11
> @@
> > vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> BOOLEAN
> > &ListType]
> >    | Z:Zero                                          <<
> $Value.u8     = _STOU8(Z->getText(), Z-
> > >getLine()); >>   | HOUR:Number ":" MINUTE:Number ":"
> SECOND:Number <<
> > $Value.time   = _STOT(HOUR->getText(), MINUTE->getText(),SECOND-
> > >getText(), HOUR->getLine()); >>   | YEAR:Number "/" MONTH:Number
> "/"
> > DAY:Number     << $Value.date   = _STOD(YEAR->getText(),
> MONTH->getText(),
> > DAY->getText(), YEAR->getLine()); >>-  | QI:Number";" FI:Number";"
> > guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)" +  | 
> > QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\("
> > DP:Number "\)"
> << $Value.ref    = _STOR(QI-
> > >getText(), FI->getText(), &Guid, DP->getText(), QI->getLine()); >>   |
> > "STRING_TOKEN" "\(" S1:Number "\)"              << $Value.string =
> _STOSID(S1-
> > >getText(), S1->getLine()); >>   | "\{"
> << ListType =
> > TRUE; >>-      L1:Number
> << +      L1:Number
> > <<
> switch (Type)
> >
> {                                                          case
> EFI_IFR_TYPE_NUM_SIZE_8 :
> > Type8[Index]  = _STOU8(L1->getText(), L1->getLine());@@ -1658,8
> > +1667,8 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> > &Value, BOOLEAN &ListType]
> >
> Index++;                                                     >>
> (-
> > "," -        L2:Number                                   << +
> ","+        L2:Number
> > <<
> switch (Type)
> >
> {                                                          case
> EFI_IFR_TYPE_NUM_SIZE_8 :
> > Type8[Index]  = _STOU8(L2->getText(), L2->getLine());@@ -1679,7
> > +1688,7 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> > &Value, BOOLEAN &ListType]
> >
> >
> Index++;                                                     >>
>        )*-    "\}"                                           +
> > "\}"   ;
> >
> //************************************************************
> **
> > ***************@@ -1714,7 +1723,7 @@ vfrFormDefinition :
> >    ;  vfrFormMapDefinition :-  << +  <<     CIfrFormMap *FMapObj =
> NULL;
> > UINT32      FormMapMethodNumber = 0;     EFI_GUID    Guid;@@
> -1775,11
> > +1784,15 @@ vfrStatementDefault :
> >       CIfrNumeric           *NumericQst   = NULL;    >>-
> D:Default
> > +  D:Default                                         <<+
> if
> > (mIsCatchDefaultEnable) {+
> > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > >getLine());+
>       }+                                                    >>
> > (     (-      "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(),
> *Val,
> > ArrayType] ","  -
> << +      "="
> > vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","+
> > <<                                                         if
> (gCurrentMinMaxData != NULL &&
> > gCurrentMinMaxData->IsNumericOpcode())
> >
> {                                                           //c
> heck default value is valid for Numeric
> > Opcode
> NumericQst = (CIfrNumeric *)
> > gCurrentQuestion;@@ -1888,14 +1901,14 @@ vfrStatementDefault :
> >          vfrStatementValue ","                       << CIfrEnd
> EndObj1;
> > EndObj1.SetLineNo(D->getLine()); >>     )     {-      DefaultStore "="
> > SN:StringIdentifier ","      << +      DefaultStore "="
SN:StringIdentifier
> ","      <<
> > _PCATCH(gCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), 
> > SN); if (DObj != NULL) {-
> DObj->SetDefaultId
> > (DefaultId);
> -                                                        } +
> > DObj->SetDefaultId
> (DefaultId);+
>     }
> > if (DObj2 != NULL) {-
> DObj2->SetDefaultId
> > (DefaultId); +
> DObj2->SetDefaultId
> >
> (DefaultId);
>     }                                                     >>
> >  }@@ -1917,8 +1930,8 @@ vfrStatementDefault :
> >
>         );
>      }
> >                                              }-
> if (DObj  != NULL)
> > {delete DObj;} -
> if (DObj2 != NULL) {delete
> > DObj2;} +
> if (DObj  != NULL) {delete DObj;}+
> > if (DObj2 != NULL) {delete
> DObj2;}                                                     >>
>   )   ;@@ -
> > 1970,11 +1983,15 @@ vfrStatementInvalid :
> >    ;  flagsField :-  Number -  | InteractiveFlag -  | 
> > ManufacturingFlag -  | DefaultFlag -  | ResetRequiredFlag +  Number+
> > | InteractiveFlag+  |
> > ManufacturingFlag+  | D:DefaultFlag
> <<+
> > if (mIsCatchDefaultEnable) {+
> > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > >getLine());+
>         }+
> > >>+  | ResetRequiredFlag   | ReconnectRequiredFlag   |
> N:NVAccessFlag
> > <<
> gCVfrErrorHandle.HandleWarning (@@ -
> > 1989,7 +2006,7 @@ flagsField :
> >
> > L->getLine(),
> >
> L->getText()
>          );-
> >                                                        >>
> +                                                       >>   ;
> > vfrStatementValue :@@ -2001,13 +2018,13 @@ vfrStatementValue :
> >  vfrStatementRead :   << CIfrRead RObj; >>   R:Read
> > << RObj.SetLineNo(R->getLine()); >>-  vfrStatementExpression[0] ";" +
> > vfrStatementExpression[0] ";"   ;  vfrStatementWrite :   << CIfrWrite
> WObj; >>
> > W:Write                                              <<
> WObj.SetLineNo(W->getLine()); >>-
> > vfrStatementExpression[0] ";" +  vfrStatementExpression[0] ";"   ;
> > vfrStatementSubTitle :@@ -2140,7 +2157,7 @@ vfrStatementGoto :
> >        FormId "=" F3:Number ","                         <<
> RefType = 2; FId = _STOFID(F3-
> > >getText(), F3->getLine()); >>       Question "="       (-
> QN3:StringIdentifier
> > ","                     << +          QN3:StringIdentifier ","
> <<
> > mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask); 
> > if (QId == EFI_QUESTION_ID_INVALID)
> >
> {
> _PCATCH(VFR_RETURN_UNDEFINED,
> > QN3);@@ -2222,7 +2239,7 @@ vfrStatementGoto :
> >      "," Key "=" KN:Number                              <<
> AssignQuestionKey (*QHObj,
> > KN); >>   }   {-    E:"," +    E:","
> vfrStatementQuestionOptionList                   <<
> > OHObj->SetScope(1); CRT_END_OP (E);>>   }   ";"
> > << 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;}>>@@ -2511,20 +2528,20 @@ 
> > minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
> >    {     "default" "=" N:Number ","                         <<
> > switch (KeyValue) {-
> case 0: +
> > case 0:
> D.Year  = _STOU16(N->getText(), N-
> > >getLine());
> if (D.Year < _STOU16 (MinN-
> > >getText(), MinN->getLine()) || D.Year > _STOU16 (MaxN->getText(),
> > >MaxN-
> > >getLine()))
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value
> must
> > be between Min year and Max
> year.");
>      }
> > break;-
> case 1: -
> > D.Month = _STOU8(N->getText(), N->getLine()); + case 1:+
> D.Month = _STOU8(N->getText(), N-
> > >getLine());
> if (D.Month < 1 || D.Month > 12)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value 
> > must be between 1 and
> 12.");
>     }
> > break;-
> case 2: -
> > D.Day = _STOU8(N->getText(), N->getLine()); + case 2:+
> D.Day = _STOU8(N->getText(), N-
> > >getLine());
> if (D.Day < 1 || D.Day > 31)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value
> must
> > be between 1 and
> 31.");
>     }@@ -2570,7
> > +2587,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
> >       BOOLEAN MinNegative = FALSE;      BOOLEAN MaxNegative =
> FALSE;   >>-
> > Minimum   "=" +  Minimum   "="   {     "\-"
> <<
> > MinNegative = TRUE; >>   }@@ -2659,8 +2676,8 @@
> > vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
> >
>  }                                                           }
> >                                       >>-  Maximum   "=" -
> { +  Maximum   "="+  {     "\-"
> > << MaxNegative = TRUE; >>   }   A:Number ","
> <<@@ -
> > 2889,7 +2906,7 @@ vfrStatementNumeric :
> >                                                            }
>                                                         >>
> > vfrStatementQuestionOptionList-  E:EndNumeric
> << +
> > E:EndNumeric                                         <<
> > CRT_END_OP (E);
> if (GuidObj != NULL)
> >
> {
> GuidObj->SetScope(1);@@ -3131,7
> > +3148,7 @@ vfrStatementString :
> >    {     Key "=" KN:Number ","                              <<
> AssignQuestionKey (SObj,
> > KN); >>   }-  MinSize "=" MIN:Number ","
> << +  MinSize "="
> > MIN:Number ","                           <<
> > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); StringMinSize = 
> > _STOU8(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(),
> > MIN->getLine()) > StringMinSize) {@@ -3141,7
> > +3158,7 @@ vfrStatementString :
> >                                                            } 
> > SObj.SetMinSize
> (StringMinSize);
>        >>-  MaxSize
> > "=" MAX:Number ","                           << +  MaxSize "="
> MAX:Number ","
> > <<
> StringMaxSize = _STOU8(MAX->getText(),
> > MAX->getLine());
> if (_STOU64(MAX-
> > >getText(), MAX->getLine()) > StringMaxSize)
> >
> {
> _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize
> takes
> > only one byte, which can't be larger than 0xFF.");@@ -3185,7 +3202,7 
> > @@ vfrStatementPassword :
> >    {     Key "=" KN:Number ","                              <<
> AssignQuestionKey (PObj,
> > KN); >>   }-  MinSize "=" MIN:Number ","
> << +  MinSize "="
> > MIN:Number ","                           <<
> > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); PasswordMinSize = 
> > _STOU16(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(),
> > MIN->getLine()) > PasswordMinSize) {@@ -
> > 3195,7 +3212,7 @@ vfrStatementPassword :
> >                                                            } 
> > PObj.SetMinSize
> (PasswordMinSize);
>           >>-
> > MaxSize "=" MAX:Number ","                           << +
> MaxSize "=" MAX:Number
> > ","                           <<
> PasswordMaxSize =
> > _STOU16(MAX->getText(), MAX->getLine());
> if
> > (_STOU64(MAX->getText(), MAX->getLine()) > PasswordMaxSize)
> >
> {
> _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize
> takes
> > only two byte, which can't be larger than 0xFFFF.");@@ -3230,12
> > +3247,12 @@ vfrStatementOrderedList :
> >    >>   L:OrderedList
> << OLObj.SetLineNo(L->getLine());
> > gIsOrderedList = TRUE;>>   vfrQuestionHeader[OLObj] ","-
> > << +                                                       <<
> > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); OLObj.SetMaxContainers
> > ((UINT8) (VarArraySize > 0xFF ? 0xFF :
> >
> VarArraySize));
>       >>   {-    MaxContainers "="
> > M:Number ","                     << +    MaxContainers "="
> M:Number ","
> > <<
> if (_STOU64(M->getText(), M->getLine()) >
> > _STOU8(M->getText(), M->getLine()))
> >
> {
> _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList 
> > MaxContainers takes only one byte, which can't be larger than
> >
> 0xFF.");
>    } else if (VarArraySize != 0 &&
> > _STOU8(M->getText(), M->getLine()) > VarArraySize) {@@ -3328,19
> > +3345,19 @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8
> KeyValue] :
> >    {     "default" "=" N:Number ","                         <<
> > switch (KeyValue) {-
> case 0: -
> > T.Hour   = _STOU8(N->getText(), N->getLine()); +
> > case 0:+
> T.Hour   = _STOU8(N->getText(), N-
> > >getLine());
> if (T.Hour > 23)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value
> must
> > be between 0 and
> 23.");
>     }
> > break;-
> case 1: -
> > T.Minute = _STOU8(N->getText(), N->getLine()); + case 1:+
> T.Minute = _STOU8(N->getText(), N-
> > >getLine());
> if (T.Minute > 59)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value 
> > must be between 0 and
> 59.");
>     }
> > break;-
> case 2: +
> > case 2:
> T.Second = _STOU8(N->getText(), N-
> > >getLine());
> if (T.Second > 59)
> >
> {
>   _PCATCH
> > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value 
> > must be between 0 and 59.");@@ -3419,11 +3436,11 @@ 
> > vfrStatementStatListOld :
> >    ;  vfrStatementDisableIfStat :-  << -    CIfrDisableIf DIObj; +  <<+
> > CIfrDisableIf DIObj;   >>   L:DisableIf
> <<
> > DIObj.SetLineNo(L->getLine()); >>-  vfrStatementExpression[0] ";" +
> > vfrStatementExpression[0] ";"   ( vfrStatementStatList )*   E:EndIf
> > << CRT_END_OP (E); >>   ";"@@ -3548,8 +3565,8 @@
> > vfrStatementWarningIf :
> >    ;  vfrStatementDisableIfQuest :-  << -    CIfrDisableIf DIObj; +
> <<+
> > CIfrDisableIf DIObj;   >>   L:DisableIf
> <<
> > DIObj.SetLineNo(L->getLine()); >>   vfrStatementExpression[0] ";"@@ -
> > 3616,15 +3633,15 @@ vfrStatementOneOfOption :
> >       UINT32             *Type32       = (UINT32 *) ValueList;
> UINT64
> > *Type64       = (UINT64 *) ValueList;   >>-  L:Option
> <<
> > +  L:Option                                             <<
> if
> > (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER)
> >
> {
> _PCATCH (VFR_RETURN_FATAL_ERROR, L-
> > >getLine(), "Get data type
> >
> error.");
>    }                                                         >
> >-
> > Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","      +  Text  "="
> > "STRING_TOKEN" "\(" S:Number "\)" ","   Value "="
> > vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","-
> > << +                                                       <<
> if
> > (gCurrentMinMaxData != NULL)
> {
> //set
> > min/max value for oneof opcode
> UINT64
> > Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE(),
> > _GET_CURRQEST_VARTINFO().mIsBitVar);@@ -3696,7 +3713,7 @@ 
> > vfrStatementOneOfOption :
> >
> Size += OFFSET_OF
> > (EFI_IFR_ONE_OF_OPTION, Value);
> OOOObj =
> > new CIfrOneOfOption((UINT8)Size);
> OOOObj-
> > >SetLineNo(L->getLine());-
> OOOObj-
> > >SetOption (_STOSID(S->getText(), S->getLine())); +
> > OOOObj->SetOption (_STOSID(S->getText(), S->getLine()));
> > if (ArrayType)
> {
> OOOObj->SetType
> >
> (EFI_IFR_TYPE_BUFFER);
>                  } else {@@ -3706,7
> > +3723,7 @@ vfrStatementOneOfOption :
> >
> OOOObj->SetType
> >
> (_GET_CURRQEST_DATATYPE());
>                          }
> >                                       }-
> OOOObj->SetValue
> > (*Val); +
> OOOObj->SetValue
> >
> (*Val);                                                        >>
> F:FLAGS "="
> > vfrOneOfOptionFlags[*OOOObj, F->getLine()] <<@@ -3790,7 +3807,12 @@ 
> > oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
> >    | RestStyleFlag                                      <<
> $HFlags |= 0x20; >>   |
> > ReconnectRequiredFlag                              << $HFlags |=
> 0x40; >>   |
> > ManufacturingFlag                                  << $LFlags |=
> 0x20; >>-  | DefaultFlag
> > << $LFlags |= 0x10; >>+  | D:DefaultFlag
> <<+
> > $LFlags |= 0x10;+
> if (mIsCatchDefaultEnable)
> > {+
> > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > >getLine());+
>           }+
> >  >>   | A:NVAccessFlag                                     <<
> > gCVfrErrorHandle.HandleWarning
> >
> (
> VFR_WARNING_OBSOLETED_FRAMEWORK
> > _OPCODE,@@ -3963,7 +3985,7 @@ vfrStatementExpression [UINT32 
> > RootLevel, UINT32 ExpOpCount = 0] :
> >
>    }
>    }
> >                                              }-
> +
> > if ($RootLevel == 0)
> {
> _CLEAR_SAVED_OPHDR
> > ();
> mCIfrOpHdrIndex --;@@ -4405,10
> > +4427,10 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >
> for (Index = 0; Index < ListLen; Index++)
> >
> {
>   EILObj.SetValueList (Index,
> >
> ValueList[Index]);
>              }-
> > +
> > + EILObj.UpdateIfrBuffer();-
> > _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());
> > -
> +
> > _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());+ if 
> > (QId == EFI_QUESTION_ID_INVALID)
> >
> {
>   EILObj.SetQuestionId (QId, VarIdStr,
> >
> LineNo);
>       }@@ -4458,9 +4480,9 @@
> > stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >    >>   L:StringRef   "\("-      ( +
> (         "STRING_TOKEN"-        "\(" +        "\("
> > S:Number << RefStringId = _STOSID(S->getText(), S->getLine()); >>
> "\)"
> > | I:Number << RefStringId = _STOSID(I->getText(), I->getLine());
> > | >>@@
> > | -
> > 4499,10 +4521,10 @@ getExp[UINT32 & RootLevel, UINT32 &
> ExpOpCount] :
> >       Info.mVarStoreId = 0;   >>   L:Get-  "\(" +  "\("
> vfrStorageVarId[Info,
> > VarIdStr, FALSE]       {"\|" FLAGS "=" numericVarStoreType [VarType] }-
> "\)"
> > << +  "\)"                                                 <<
> >
> {                                                             i
> f (Info.mVarStoreId == 0)
> >
> {
>   // support Date/Time question@@ -
> > 4549,9 +4571,9 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >
> > _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> > >getLine(), "Get/Set opcode don't support data
> >
> array");
>        }
>        }
> > -
> CIfrGet GObj(L->getLine()); -
> > _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine()); - 
> > GObj.SetVarInfo (&Info); +
> CIfrGet GObj(L-
> > >getLine());+
> _SAVE_OPHDR_COND (GObj,
> > ($ExpOpCount == 0), L->getLine());+
> > GObj.SetVarInfo (&Info);
> delete[] VarIdStr;
> >
> $ExpOpCount++;
>            }@@ -4608,7 +4630,7 @@
> > question23refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >        {         Uuid "=" guidDefinition[Guid] ","
> << Type = 0x3; >>       }-
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"
> > <<
> switch (Type) {@@ -4675,9 +4697,9 @@
> > setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >    "\("      vfrStorageVarId[Info, VarIdStr, FALSE]      {"\|" FLAG "="
> > numericVarStoreType [VarType] }-     ","
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +     ","
> > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"-
> > << +                                                       <<
> >
> {                                                             i
> f (Info.mVarStoreId == 0)
> >
> {
>   // support Date/Time question@@ -
> > 4724,8 +4746,8 @@ setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >
> > _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> > >getLine(), "Get/Set opcode don't support data
> >
> array");
>        }
>        }
> > -
> CIfrSet TSObj(L->getLine()); -
> > TSObj.SetVarInfo (&Info); +
> CIfrSet TSObj(L-
> > >getLine());+
> TSObj.SetVarInfo (&Info);
> > delete[] VarIdStr;
> >
> $ExpOpCount++;
>            }@@ -4808,9 +4830,9 @@
> > spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> >    ;  vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:- 
> > L:Map
> > -  "\(" -  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]  +
> L:Map+
> > "\("+  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   ":"
> > << { CIfrMap MObj(L->getLine()); } >>
> (     vfrStatementExpression[0]@@ -
> > 4837,6 +4859,7 @@ spanFlags [UINT8 & Flags] :
> >  class EfiVfrParser { << private:+  BOOLEAN
> mIsCatchDefaultEnable;
> > UINT8               mParserStatus;   BOOLEAN
> mConstantOnlyInExpression;
> > @@ -4880,6 +4903,7 @@ public:
> >    VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN
> ANTLRTokenPtr);
> > VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32);
> VOID
> > _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);+
> VOID
> > DefaultValueError (IN EFI_VFR_RETURN_CODE, IN UINT32);    VOID
> > syn     (ANTLRAbstractToken  *, ANTLRChar *, SetWordType *,
> > ANTLRTokenType, INT32); @@ -4909,6 +4933,7 @@ public:
> >    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);   VOID
> IdEqListDoSpecial     (IN
> > UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN
> > UINT16, IN UINT16 *);   VOID                SetOverrideClassGuid
> (IN EFI_GUID *);+
> > VOID                SetIsCatchDefaultEnable (BOOLEAN
> IsCatchDefaultEnable); >> }
> > @@ -5086,6 +5111,17 @@ EfiVfrParser::_PCATCH (
> >    mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError 
> > (ReturnCode, LineNum, (CHAR8 *) ErrorMsg); }
> > +VOID+EfiVfrParser::DefaultValueError (+  IN EFI_VFR_RETURN_CODE
> > ReturnCode,+  IN UINT32              LineNum+  )+{+  CHAR8
> ErrorMsg[100];+
> > sprintf(ErrorMsg, "please remove the default value / defaultstore in 
> > line %d", LineNum);+  mParserStatus = mParserStatus + 
> > gCVfrErrorHandle.HandleError (ReturnCode, LineNum, ErrorMsg);+}+ 
> > VOID
> EfiVfrParser::syn
> > (   ANTLRAbstractToken  *Tok,@@ -5682,12 +5718,18 @@
> > EfiVfrParser::IdEqListDoSpecial (
> >    } } -VOID +VOID EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID
> > *OverrideClassGuid) {   mOverrideClassGuid = OverrideClassGuid; }
> > +VOID+EfiVfrParser::SetIsCatchDefaultEnable (BOOLEAN
> > IsCatchDefaultEnable)+{+  mIsCatchDefaultEnable =
> IsCatchDefaultEnable;+}+
> > VOID EfiVfrParser::CheckDuplicateDefaultValue (   IN EFI_DEFAULT_ID
> > DefaultId,--
> > 2.26.2.windows.1






-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113764): https://edk2.groups.io/g/devel/message/113764
Mute This Topic: https://groups.io/mt/103126873/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 12+ messages in thread

* 回复: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature
  2024-01-12  5:20             ` Zhang, Zifeng
@ 2024-01-16 15:03               ` gaoliming via groups.io
  2024-01-17  2:18                 ` Zhang, Zifeng
  2024-01-25  9:27                 ` Zhang, Zifeng
  0 siblings, 2 replies; 12+ messages in thread
From: gaoliming via groups.io @ 2024-01-16 15:03 UTC (permalink / raw)
  To: devel, zifeng.zhang, 'Yang, Yuting2'; +Cc: 'Chen, Christine'


This option is for the module check. I suggest to set this option in INF instead of DSC. 
If so, DSC is not required to configure the additional options. And, this module will have the same build result 
when it is specified in the different platform DSC files.

I understand your requirement to enable this option for the modules in some specific package. 
I think you can easily find those modules those have VFR/HFR, then update their INFs with new check option. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Zhang, Zifeng
> 发送时间: 2024年1月12日 13:20
> 收件人: Yang, Yuting2 <yuting2.yang@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>
> 抄送: Chen, Christine <yuwei.chen@intel.com>; devel@edk2.groups.io
> 主题: Re: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds
> DefaultValueError Feature
> 
> Hi Liming,
> 
> Could you help to share the update for this patch solution?
> 
> Best Regards,
> Zifeng
> 
> -----Original Message-----
> From: Yang, Yuting2 <yuting2.yang@intel.com>
> Sent: Monday, December 25, 2023 3:10 PM
> To: Gao, Liming <gaoliming@byosoft.com.cn>
> Cc: Zhang, Zifeng <zifeng.zhang@intel.com>; Chen, Christine
> <yuwei.chen@intel.com>; devel@edk2.groups.io
> Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError
> Feature
> 
> Hi Liming,
> 
> Thank you for adding  the account for me.
> I have created a Bugzilla https://bugzilla.tianocore.org/show_bug.cgi?id=4629
> for this feature ~
> 
> Best Regards,,
> Yuting
> 
> -----Original Message-----
> From: gaoliming <gaoliming@byosoft.com.cn>
> Sent: Monday, December 25, 2023 9:14 AM
> To: Yang, Yuting2 <yuting2.yang@intel.com>
> Subject: 回复: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError
> Feature
> 
> Your account yuting2.yang@intel.com has been added. PW: tiano@123
> 
> > -----邮件原件-----
> > 发件人: Yang, Yuting2 <yuting2.yang@intel.com>
> > 发送时间: 2023年12月22日 13:41
> > 收件人: Gao, Liming <gaoliming@byosoft.com.cn>
> > 抄送: Rebecca Cran <rebecca@bsdio.com>; Feng, Bob C
> > <bob.c.feng@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>;
> > Chen, Christine <yuwei.chen@intel.com>; Zhang, Zifeng
> > <zifeng.zhang@intel.com>; devel@edk2.groups.io
> > 主题: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError
> > Feature
> >
> > Hi Liming,
> >
> > Thank you for reviewing ~
> > Could you please help me create a Bugzilla account? Currently, I do
> > not
> have
> > access to the Bugzilla.
> >
> > Best Regards,
> > Yuting
> >
> > -----Original Message-----
> > From: Zhang, Zifeng <zifeng.zhang@intel.com>
> > Sent: Thursday, December 21, 2023 2:44 PM
> > To: Gao, Liming <gaoliming@byosoft.com.cn>; Yang, Yuting2
> > <yuting2.yang@intel.com>
> > Cc: Rebecca Cran <rebecca@bsdio.com>; Feng, Bob C
> > <bob.c.feng@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>;
> > devel@edk2.groups.io; Chen, Christine <yuwei.chen@intel.com>
> > Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError
> > Feature
> >
> > Hi Liming,
> >
> > Thanks for reviewing.
> > For background of this change, we will remove default flags in VFR/HFR
> > in new platform. So we need help from VFR complier to make a default
> > flag check to avoid manually adding.
> > @Yang, Yuting2, could you help to create a BZ for this feature and
> > share
> in
> > mail thread?
> > Then let me make a clarification for your questions.
> >
> > #1: The purpose of --catch_default
> > We send --catch_default flag in build option to indicate which
> > platform
> should
> > check default flag in VFR/HFR.
> > Actually maybe some platforms used same EDK2 downstream branch, so we
> > only send --catch_default flag for the platforms which need this check.
> >
> > #2: The purpose of --except_list
> > VFR compiler will receive VFR/HFR configurations from all folders
> including
> > Intel and EDK2. But in our expectation VFR compiler only do this check
> > in Intel.
> > So We use --except_list to deliver package list in EDK2 to avoid this
> check.
> >
> > Best Regards,
> > Zifeng
> >
> > -----Original Message-----
> > From: Yang, Yuting2 <yuting2.yang@intel.com>
> > Sent: Tuesday, December 12, 2023 5:12 PM
> > To: Zhang, Zifeng <zifeng.zhang@intel.com>; Chen, Arthur G
> > <arthur.g.chen@intel.com>; devel@edk2.groups.io
> > Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming
> > <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
> > Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError
> > Feature
> >
> > +Cc Zhang, Zifeng, Chen, Arthur G
> >
> > -----Original Message-----
> > From: Chen, Christine <yuwei.chen@intel.com>
> > Sent: Tuesday, December 12, 2023 5:04 PM
> > To: Yang, Yuting2 <yuting2.yang@intel.com>; devel@edk2.groups.io
> > Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming
> > <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
> > Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError
> > Feature
> >
> > +Cc Yang, Yuting2
> >
> > > -----Original Message-----
> > > From: Yang, Yuting2 <yuting2.yang@intel.com>
> > > Sent: Tuesday, December 12, 2023 5:01 PM
> > > To: devel@edk2.groups.io
> > > Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming
> > > <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>;
> > > Chen, Christine <yuwei.chen@intel.com>
> > > Subject: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError
> > > Feature
> > >
> > > Add --catch_default option
> > > Raise a DefaultValueError when encountering VFR default definitions
> > > to help remove default variables.
> > > Add --except_list option
> > > Exclude packages that don't require enabling the catch_default function.
> > >
> > > Cc: Rebecca Cran <rebecca@bsdio.com>
> > > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > > Cc: Bob Feng <bob.c.feng@intel.com>
> > > Cc: Christine Chen <yuwei.chen@intel.com>
> > > Cc: Yuting Yang <yuting2.yang@intel.com>
> > >
> > > Signed-off-by: Yuting Yang <yuting2.yang@intel.com>
> > > ---
> > >  BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  40 ++-
> > >  BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   3 +
> > >  BaseTools/Source/C/VfrCompile/VfrError.cpp    |   3 +-
> > >  BaseTools/Source/C/VfrCompile/VfrError.h      |   3 +-
> > >  BaseTools/Source/C/VfrCompile/VfrFormPkg.h    |   1 +
> > >  BaseTools/Source/C/VfrCompile/VfrSyntax.g     | 238
> > ++++++++++--------
> > >  6 files changed, 184 insertions(+), 104 deletions(-)
> > >
> > > diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > > b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > > index 5f4d262d85..e97cebff65 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > > @@ -78,6 +78,9 @@ CVfrCompiler::OptionInitialization (
> > >    mOptions.WarningAsError                = FALSE;
> > mOptions.AutoDefault
> > > = FALSE;   mOptions.CheckDefault                  = FALSE;+
> > > mOptions.IsCatchDefaultEnable          = FALSE;+
> > mOptions.ExceptionList
> > > = NULL;+  mOptions.ExceptionListSize             = 0;   memset
> > > (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));    if (Argc == 1)
> > {@@ -
> > > 95,6 +98,23 @@ CVfrCompiler::OptionInitialization (
> > >        Version ();       SET_RUN_STATUS (STATUS_DEAD);
> > return;+    } else if
> > > (stricmp(Argv[Index], "--catch_default") == 0){+
> > > mOptions.IsCatchDefaultEnable = TRUE;+    } else if
> (stricmp(Argv[Index],
> > "--
> > > except_list") == 0){+      INT32 Start = ++Index;+      if ((Start >=
> Argc)
> > ||
> > > (Argv[Start][0] == '-')) {+        DebugError (NULL, 0, 1001, "Missing
> > option", "-
> > > exception_list missing except list");+        goto Fail;+      }+
> > while
> > > ((Argv[Index][0] != '-') && (Index < Argc - 1)) {+        Index++;+
> }+
> > INT32
> > > End = Index--;+      mOptions.ExceptionListSize = End - Start;+
> for
> > (INT32 i =
> > > Start; i < End; i++) {+        mOptions.ExceptionList = (CHAR8**)
> > > realloc(mOptions.ExceptionList, (i - Start + 1) * sizeof(CHAR8*));+
> > > mOptions.ExceptionList[i-Start] = Argv[i];+      }     } else if
> > (stricmp(Argv[Index],
> > > "-l") == 0) {       mOptions.CreateRecordListFile = TRUE;
> > > gCIfrRecordInfoDB.TurnOn ();@@ -179,7 +199,11 @@
> > > CVfrCompiler::OptionInitialization (
> > >        goto Fail;     }     strcpy (mOptions.VfrFileName,
> > Argv[Index]);-+    for (int i =
> > > 0; i < mOptions.ExceptionListSize; i++) {+      if
> > (strstr(mOptions.VfrFileName,
> > > mOptions.ExceptionList[i]) != NULL) {+
> > mOptions.IsCatchDefaultEnable =
> > > FALSE;+      }+    }     if (mOptions.OutputDirectory == NULL)
> > > {       mOptions.OutputDirectory = (CHAR8 *) malloc (1);       if
> > > (mOptions.OutputDirectory == NULL) {@@ -217,6 +241,11 @@ Fail:
> > >      free (mOptions.VfrFileName);     mOptions.VfrFileName
> > =
> > > NULL;   }+  if (mOptions.ExceptionList != NULL) {+
> > > free(mOptions.ExceptionList);+    mOptions.ExceptionList
> > = NULL;++  }
> > > if (mOptions.VfrBaseFileName != NULL) {     free
> > (mOptions.VfrBaseFileName);
> > > mOptions.VfrBaseFileName             = NULL;@@ -496,6 +525,11
> > @@
> > > CVfrCompiler::~CVfrCompiler (
> > >      mOptions.VfrBaseFileName = NULL;   } +  if
> > (mOptions.ExceptionList !=
> > > NULL) {+    free (mOptions.ExceptionList);+    mOptions.ExceptionList
> =
> > > NULL;+  }+   if (mOptions.OutputDirectory != NULL) {     free
> > > (mOptions.OutputDirectory);     mOptions.OutputDirectory =
> NULL;@@
> > -679,7
> > > +713,7 @@ CVfrCompiler::Compile (
> > >      DebugError (NULL, 0, 0001, "Error opening the input file", "%s",
> > > InFileName);     goto Fail;   }-+  InputInfo.IsCatchDefaultEnable =
> > > mOptions.IsCatchDefaultEnable;   if (mOptions.HasOverrideClassGuid)
> > > {     InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;   }
> > else
> > > {@@ -937,5 +971,3 @@ main (
> > >     return GetUtilityStatus (); }--diff --git
> > > a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > > b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > > index b6e207d2ce..39e0a89a29 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > > @@ -52,6 +52,9 @@ typedef struct {
> > >    BOOLEAN WarningAsError;   BOOLEAN AutoDefault;   BOOLEAN
> > > CheckDefault;+  BOOLEAN IsCatchDefaultEnable;+  CHAR8**
> > ExceptionList;+
> > > INT16    ExceptionListSize; } OPTIONS;  typedef enum {diff --git
> > > a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > > b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > > index 65bb8e34fd..8a706f929b 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > > @@ -49,7 +49,8 @@ static SVFR_WARNING_HANDLE
> > VFR_WARNING_HANDLE_TABLE
> > > [] = {
> > >    { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value
> > re-defined
> > > with different value"},   { VFR_WARNING_ACTION_WITH_TEXT_TWO, ":
> > Action
> > > opcode should not have TextTwo part"}, {
> > > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend
> to
> > use
> > > obsoleted framework opcode"},-  { VFR_WARNING_CODEUNDEFINED, ":
> > > undefined Warning Code" }+  { VFR_WARNING_CODEUNDEFINED, ":
> > > undefined Warning Code" },+  { VFR_WARNING_UNSUPPORTED, ": pls
> > remove
> > > the default values if necessary" } };
> > > CVfrErrorHandle::CVfrErrorHandle (diff -- git
> > > a/BaseTools/Source/C/VfrCompile/VfrError.h
> > > b/BaseTools/Source/C/VfrCompile/VfrError.h
> > > index 7d16bd5f74..1b4bc173d2 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrError.h
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrError.h
> > > @@ -47,7 +47,8 @@ typedef enum {
> > >    VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0,
> > > VFR_WARNING_ACTION_WITH_TEXT_TWO,
> > > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,-
> > > VFR_WARNING_CODEUNDEFINED+
> VFR_WARNING_CODEUNDEFINED,+
> > > VFR_WARNING_UNSUPPORTED } EFI_VFR_WARNING_CODE;  typedef
> > struct
> > > _SVFR_ERROR_HANDLE {diff --git
> > > a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > > b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > > index 9ef6f07787..d8fada3bcb 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > > @@ -96,6 +96,7 @@ struct SBufferNode {
> > >   typedef struct {   EFI_GUID *OverrideClassGuid;+  BOOLEAN
> > > IsCatchDefaultEnable; } INPUT_INFO_TO_SYNTAX;  class CFormPkg {diff
> > > --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > > b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > > index 55fd067f8a..5daf1c423c 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > > @@ -50,6 +50,7 @@ VfrParserStart (
> > >  {   ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken>
> > VfrParser(File);
> > > VfrParser.parser()->SetOverrideClassGuid
> > > (InputInfo->OverrideClassGuid);+
> > > VfrParser.parser()->SetIsCatchDefaultEnable(InputInfo-
> > > >IsCatchDefaultEnable);   return
> > VfrParser.parser()->vfrProgram(); } >>@@ -
> > > 386,8 +387,8 @@ dataStructField32 [BOOLEAN  FieldInUnion]:
> > >    ;  dataStructField16 [BOOLEAN  FieldInUnion]:-  << -    UINT32
> > ArrayNum = 0;
> > > +  <<+    UINT32 ArrayNum = 0;   >>   ("UINT16" | "CHAR16")
> > > N:StringIdentifier@@ -737,7 +738,7 @@ vfrFormSetList :
> > >    ;  vfrStatementExtension:-  << +  <<      EFI_GUID Guid;
> > CIfrGuid *GuidObj
> > > = NULL;      CHAR8    *TypeName = NULL;@@ -751,7 +752,7 @@
> > > vfrStatementExtension:
> > >    >>   L:GuidOp   Uuid "=" guidDefinition[Guid]-  {"," DataType "="
> +
> > {","
> > > DataType "="     (         U64:"UINT64" {OpenBracket AN1:Number
> > CloseBracket
> > > <<ArrayNum = _STOU32(AN1->getText(), AN1->getLine());>>} <<
> TypeName
> > =
> > > U64->getText(); LineNum = U64->getLine(); >>@@ -770,7
> > > +771,7 @@ vfrStatementExtension:
> > >        | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket
> > > <<ArrayNum = _STOU32(AN8->getText(), AN8->getLine());>>} <<
> TypeName
> > > = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>
> > |
> > > R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum =
> > > _STOU32(AN9->getText(), AN9->getLine());>>}- << TypeName =
> > > R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
> > > +                                                      <<
> > TypeName =
> > > + R->getText(); LineNum = R-
> > > >getLine(); IsStruct = TRUE;>>       | TN:StringIdentifier {OpenBracket
> > > AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText(),
> > AN10-
> > > >getLine());>>}
> > << TypeName = TN->getText();
> > > LineNum = TN->getLine(); IsStruct = TRUE;>>     )@@ -875,19 +876,19
> > @@
> > > vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName,
> > UINT32
> > > TypeSize,
> > >                  memcpy (ByteOffset, &Data_U64,
> > TypeSize);               }else if (strcmp
> > > ("UINT32", TypeName) == 0) {                 Data_U32 =
> > _STOU32(RD->getText(),
> > > RD->getLine());-                memcpy (ByteOffset, &Data_U32,
> > TypeSize);
> > > +                memcpy (ByteOffset, &Data_U32,
> > TypeSize);               }else if (strcmp
> > > ("UINT16", TypeName) == 0) {                 Data_U16 =
> > _STOU16(RD->getText(),
> > > RD->getLine());-                memcpy (ByteOffset, &Data_U16,
> > TypeSize);
> > > +                memcpy (ByteOffset, &Data_U16,
> > TypeSize);               }else if (strcmp
> > > ("UINT8", TypeName) == 0) {                 Data_U8 =
> > _STOU8(RD->getText(), RD-
> > > >getLine());-                memcpy (ByteOffset, &Data_U8,
> TypeSize);
> > > +                memcpy (ByteOffset, &Data_U8,
> > TypeSize);               }else if (strcmp
> > > ("BOOLEAN", TypeName)== 0) {                 Data_BL =
> > _STOU8(RD->getText(),
> > > RD->getLine());-                memcpy (ByteOffset, &Data_BL,
> > TypeSize);
> > > +                memcpy (ByteOffset, &Data_BL,
> > TypeSize);               }else if (strcmp
> > > ("EFI_STRING_ID", TypeName) == 0) {                 Data_SID =
> > _STOSID(RD-
> > > >getText(), RD->getLine());-                memcpy (ByteOffset,
> > &Data_SID,
> > > TypeSize);
> > +                memcpy (ByteOffset,
> > > &Data_SID, TypeSize);               }             } else
> > > {               gCVfrVarDataTypeDB.GetDataFieldInfo(TFName,
> > FieldOffset,
> > > FieldType, FieldSize, BitField);@@ -975,7 +976,15 @@
> > > vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName,
> > UINT32
> > > TypeSize,
> > >   vfrStatementDefaultStore :   << UINT16  DefaultId =
> > > EFI_HII_DEFAULT_CLASS_STANDARD; >>-  D:DefaultStore
> > N:StringIdentifier
> > > ","+  D:DefaultStore N:StringIdentifier ","             <<+
> > > if (mIsCatchDefaultEnable) {+
> > > gCVfrErrorHandle.HandleWarning (+
> > > VFR_WARNING_UNSUPPORTED,+
> > D-
> > > >getLine(),+
> > D-
> > > >getText()+
> >        );+
> >  }+
> > >                                                     >>
> > Prompt "=" "STRING_TOKEN" "\(" S:Number
> > > "\)"   {     "," Attribute "=" A:Number                      <<
> > DefaultId = _STOU16(A-
> > > >getText(), A->getLine()); >>@@ -1074,7 +1083,7 @@
> > > vfrStatementVarStoreEfi :
> > >      | U64:"UINT64" ","                              <<
> > TypeName = U64->getText();
> > > LineNum = U64->getLine(); >>     | D:"EFI_HII_DATE" ","
> > <<
> > > TypeName = D->getText(); LineNum = D->getLine(); >>     |
> > T:"EFI_HII_TIME"
> > > ","                          << TypeName = T->getText(); LineNum
> =
> > T->getLine(); >>-    |
> > > R:"EFI_HII_REF" ","                           << TypeName =
> > R->getText(); LineNum = R-
> > > >getLine(); >>    +    | R:"EFI_HII_REF" ","
> > << TypeName = R-
> > > >getText(); LineNum = R->getLine(); >>   )   {     VarId "="
> ID:Number
> > ","
> > > <<@@ -1092,8 +1101,8 @@ vfrStatementVarStoreEfi :
> > >    (     Name    "=" SN:StringIdentifier ","             <<
> > StoreName = SN-
> > > >getText();   >>    |-    Name    "=" "STRING_TOKEN" "\("
> > VN:Number "\)" ","  -
> > > VarSize "=" N:Number ","                        << +    Name
> > "=" "STRING_TOKEN"
> > > "\(" VN:Number "\)" ","+    VarSize "=" N:Number ","
> > <<
> > > IsUEFI23EfiVarstore = FALSE;
> > StoreName =
> > > gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText(),
> VN-
> > > >getLine()));
> > if (StoreName == NULL) {@@ -
> > > 1116,7 +1125,7 @@ vfrStatementVarStoreEfi :
> > >
> > break;
> > case 8:
> > > TypeName = (CHAR8 *) "UINT64";-
> > break; +
> > > break;
> > default:
> > > _PCATCH (VFR_RETURN_UNSUPPORTED, N); break;@@ -1124,7 +1133,7
> @@
> > > vfrStatementVarStoreEfi :
> > >                                                      >>   )
> -
> > Uuid "=" guidDefinition[Guid]
> > > << +  Uuid "=" guidDefinition[Guid]                     <<
> > > if (IsUEFI23EfiVarstore)
> > >
> >
> {                                                        _PCAT
> > CH(gCVfrDataStorage.DeclareBufferVarS
> > > tore
> > (
> >                         StoreName,@@ -1150,7
> > > +1159,7 @@ vfrStatementVarStoreEfi :
> > >                                                         }
> > > VSEObj.SetGuid (&Guid);
> > VSEObj.SetVarStoreId
> > > (VarStoreId);-
> > +
> > > VSEObj.SetSize ((UINT16) Size);
> > > VSEObj.SetName (StoreName);
> > if
> > > (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {@@ -1184,7
> > > +1193,7 @@ vfrStatementVarStoreNameValue :
> > >                                                      >>   }
> > (-    Name "=" "STRING_TOKEN" "\("
> > > N:Number "\)" ","  << +    Name "=" "STRING_TOKEN" "\(" N:Number
> > "\)" ","
> > > <<                                                        if
> > (!Created)
> > >
> >
> {                                                          _PC
> > ATCH(gCVfrDataStorage.DeclareNameVar
> > > StoreBegin (SN->getText(), VarStoreId), SN); Created = TRUE;@@
> > > -1245,12 +1254,12 @@ vfrStatementDisableIfFormSet :
> > >  vfrStatementSuppressIfFormSet :   << CIfrSuppressIf SIObj;>>
> > L:SuppressIf
> > > <<-
> > SIObj.SetLineNo(L->getLine()); +
> > >
> > SIObj.SetLineNo(L->getLine());
> >                   >>   { FLAGS "="
> > > flagsField ( "\|" flagsField )* "," }   vfrStatementExpression[0] ";"
> > > vfrFormSetList-  E: EndIf +  E: EndIf   ";"
> > <<
> > > CRT_END_OP (E); >>   ; @@ -1491,7 +1500,7 @@
> > vfrQuestionDataFieldName
> > > [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
> > >    (     SN2:StringIdentifier                            <<
> > _STRCAT (&VarIdStr, SN2-
> > > >getText()); LineNo = SN2->getLine(); >>     (-      "."
> > << +
> > > "."                                           <<
> > _STRCAT
> > > (&VarIdStr, ".");
> > if
> > > (mConstantOnlyInExpression)
> > >
> >
> {                                                          _PC
> > ATCH(VFR_RETURN_CONSTANT_ONLY,
> > > LineNo);@@ -1518,7 +1527,7 @@ vfrQuestionDataFieldName
> > > [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
> > >    ;  vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> > > BOOLEAN &ListType] :-  <<  +  <<     EFI_GUID    Guid;
> > BOOLEAN     Negative =
> > > FALSE;     BOOLEAN     IntDecStyle = FALSE;@@ -1634,11 +1643,11
> > @@
> > > vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> > BOOLEAN
> > > &ListType]
> > >    | Z:Zero                                          <<
> > $Value.u8     = _STOU8(Z->getText(), Z-
> > > >getLine()); >>   | HOUR:Number ":" MINUTE:Number ":"
> > SECOND:Number <<
> > > $Value.time   = _STOT(HOUR->getText(), MINUTE->getText(),SECOND-
> > > >getText(), HOUR->getLine()); >>   | YEAR:Number "/" MONTH:Number
> > "/"
> > > DAY:Number     << $Value.date   = _STOD(YEAR->getText(),
> > MONTH->getText(),
> > > DAY->getText(), YEAR->getLine()); >>-  | QI:Number";" FI:Number";"
> > > guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)" +  |
> > > QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\("
> > > DP:Number "\)"
> > << $Value.ref    = _STOR(QI-
> > > >getText(), FI->getText(), &Guid, DP->getText(), QI->getLine()); >>   |
> > > "STRING_TOKEN" "\(" S1:Number "\)"              << $Value.string =
> > _STOSID(S1-
> > > >getText(), S1->getLine()); >>   | "\{"
> > << ListType =
> > > TRUE; >>-      L1:Number
> > << +      L1:Number
> > > <<
> > switch (Type)
> > >
> >
> {                                                          case
> > EFI_IFR_TYPE_NUM_SIZE_8 :
> > > Type8[Index]  = _STOU8(L1->getText(), L1->getLine());@@ -1658,8
> > > +1667,8 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> > > &Value, BOOLEAN &ListType]
> > >
> >
> Index++;                                                     >>
> > (-
> > > "," -        L2:Number                                   << +
> > ","+        L2:Number
> > > <<
> > switch (Type)
> > >
> >
> {                                                          case
> > EFI_IFR_TYPE_NUM_SIZE_8 :
> > > Type8[Index]  = _STOU8(L2->getText(), L2->getLine());@@ -1679,7
> > > +1688,7 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> > > &Value, BOOLEAN &ListType]
> > >
> > >
> >
> Index++;                                                     >>
> >        )*-    "\}"                                           +
> > > "\}"   ;
> > >
> >
> //************************************************************
> > **
> > > ***************@@ -1714,7 +1723,7 @@ vfrFormDefinition :
> > >    ;  vfrFormMapDefinition :-  << +  <<     CIfrFormMap *FMapObj
> =
> > NULL;
> > > UINT32      FormMapMethodNumber = 0;     EFI_GUID
> Guid;@@
> > -1775,11
> > > +1784,15 @@ vfrStatementDefault :
> > >       CIfrNumeric           *NumericQst   = NULL;    >>-
> > D:Default
> > > +  D:Default                                         <<+
> > if
> > > (mIsCatchDefaultEnable) {+
> > > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > > >getLine());+
> >       }+
> >>
> > > (     (-      "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(),
> > *Val,
> > > ArrayType] ","  -
> > << +      "="
> > > vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType]
> ","+
> > > <<
> if
> > (gCurrentMinMaxData != NULL &&
> > > gCurrentMinMaxData->IsNumericOpcode())
> > >
> >
> {                                                           //c
> > heck default value is valid for Numeric
> > > Opcode
> > NumericQst = (CIfrNumeric *)
> > > gCurrentQuestion;@@ -1888,14 +1901,14 @@ vfrStatementDefault :
> > >          vfrStatementValue ","                       << CIfrEnd
> > EndObj1;
> > > EndObj1.SetLineNo(D->getLine()); >>     )     {-      DefaultStore
> "="
> > > SN:StringIdentifier ","      << +      DefaultStore "="
> SN:StringIdentifier
> > ","      <<
> > > _PCATCH(gCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId),
> > > SN); if (DObj != NULL) {-
> > DObj->SetDefaultId
> > > (DefaultId);
> > -                                                        } +
> > > DObj->SetDefaultId
> > (DefaultId);+
> >     }
> > > if (DObj2 != NULL) {-
> > DObj2->SetDefaultId
> > > (DefaultId); +
> > DObj2->SetDefaultId
> > >
> > (DefaultId);
> >     }                                                     >>
> > >  }@@ -1917,8 +1930,8 @@ vfrStatementDefault :
> > >
> >         );
> >      }
> > >                                              }-
> > if (DObj  != NULL)
> > > {delete DObj;} -
> > if (DObj2 != NULL) {delete
> > > DObj2;} +
> > if (DObj  != NULL) {delete DObj;}+
> > > if (DObj2 != NULL) {delete
> >
> DObj2;}                                                     >>
> >   )   ;@@ -
> > > 1970,11 +1983,15 @@ vfrStatementInvalid :
> > >    ;  flagsField :-  Number -  | InteractiveFlag -  |
> > > ManufacturingFlag -  | DefaultFlag -  | ResetRequiredFlag +  Number+
> > > | InteractiveFlag+  |
> > > ManufacturingFlag+  | D:DefaultFlag
> > <<+
> > > if (mIsCatchDefaultEnable) {+
> > > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > > >getLine());+
> >         }+
> > > >>+  | ResetRequiredFlag   | ReconnectRequiredFlag   |
> > N:NVAccessFlag
> > > <<
> > gCVfrErrorHandle.HandleWarning (@@ -
> > > 1989,7 +2006,7 @@ flagsField :
> > >
> > > L->getLine(),
> > >
> > L->getText()
> >          );-
> > >                                                        >>
> >
> +                                                       >>   ;
> > > vfrStatementValue :@@ -2001,13 +2018,13 @@ vfrStatementValue :
> > >  vfrStatementRead :   << CIfrRead RObj; >>   R:Read
> > > << RObj.SetLineNo(R->getLine()); >>-  vfrStatementExpression[0] ";" +
> > > vfrStatementExpression[0] ";"   ;  vfrStatementWrite :   << CIfrWrite
> > WObj; >>
> > > W:Write                                              <<
> > WObj.SetLineNo(W->getLine()); >>-
> > > vfrStatementExpression[0] ";" +  vfrStatementExpression[0] ";"   ;
> > > vfrStatementSubTitle :@@ -2140,7 +2157,7 @@ vfrStatementGoto :
> > >        FormId "=" F3:Number ","                         <<
> > RefType = 2; FId = _STOFID(F3-
> > > >getText(), F3->getLine()); >>       Question "="       (-
> > QN3:StringIdentifier
> > > ","                     << +          QN3:StringIdentifier ","
> > <<
> > > mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask);
> > > if (QId == EFI_QUESTION_ID_INVALID)
> > >
> > {
> > _PCATCH(VFR_RETURN_UNDEFINED,
> > > QN3);@@ -2222,7 +2239,7 @@ vfrStatementGoto :
> > >      "," Key "=" KN:Number                              <<
> > AssignQuestionKey (*QHObj,
> > > KN); >>   }   {-    E:"," +    E:","
> > vfrStatementQuestionOptionList                   <<
> > > OHObj->SetScope(1); CRT_END_OP (E);>>   }   ";"
> > > << 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;}>>@@ -2511,20 +2528,20 @@
> > > minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
> > >    {     "default" "=" N:Number ","                         <<
> > > switch (KeyValue) {-
> > case 0: +
> > > case 0:
> > D.Year  = _STOU16(N->getText(), N-
> > > >getLine());
> > if (D.Year < _STOU16 (MinN-
> > > >getText(), MinN->getLine()) || D.Year > _STOU16 (MaxN->getText(),
> > > >MaxN-
> > > >getLine()))
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value
> > must
> > > be between Min year and Max
> > year.");
> >      }
> > > break;-
> > case 1: -
> > > D.Month = _STOU8(N->getText(), N->getLine()); + case 1:+
> > D.Month = _STOU8(N->getText(), N-
> > > >getLine());
> > if (D.Month < 1 || D.Month > 12)
> > >
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value
> > > must be between 1 and
> > 12.");
> >     }
> > > break;-
> > case 2: -
> > > D.Day = _STOU8(N->getText(), N->getLine()); + case 2:+
> > D.Day = _STOU8(N->getText(), N-
> > > >getLine());
> > if (D.Day < 1 || D.Day > 31)
> > >
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value
> > must
> > > be between 1 and
> > 31.");
> >     }@@ -2570,7
> > > +2587,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
> > >       BOOLEAN MinNegative = FALSE;      BOOLEAN MaxNegative =
> > FALSE;   >>-
> > > Minimum   "=" +  Minimum   "="   {     "\-"
> > <<
> > > MinNegative = TRUE; >>   }@@ -2659,8 +2676,8 @@
> > > vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
> > >
> >  }
>  }
> > >                                       >>-  Maximum   "=" -
> > { +  Maximum   "="+  {     "\-"
> > > << MaxNegative = TRUE; >>   }   A:Number ","
> > <<@@ -
> > > 2889,7 +2906,7 @@ vfrStatementNumeric :
> > >
>  }
> >                                                         >>
> > > vfrStatementQuestionOptionList-  E:EndNumeric
> > << +
> > > E:EndNumeric                                         <<
> > > CRT_END_OP (E);
> > if (GuidObj != NULL)
> > >
> > {
> > GuidObj->SetScope(1);@@ -3131,7
> > > +3148,7 @@ vfrStatementString :
> > >    {     Key "=" KN:Number ","                              <<
> > AssignQuestionKey (SObj,
> > > KN); >>   }-  MinSize "=" MIN:Number ","
> > << +  MinSize "="
> > > MIN:Number ","                           <<
> > > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); StringMinSize =
> > > _STOU8(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(),
> > > MIN->getLine()) > StringMinSize) {@@ -3141,7
> > > +3158,7 @@ vfrStatementString :
> > >
>  }
> > > SObj.SetMinSize
> > (StringMinSize);
> >        >>-  MaxSize
> > > "=" MAX:Number ","                           << +  MaxSize "="
> > MAX:Number ","
> > > <<
> > StringMaxSize = _STOU8(MAX->getText(),
> > > MAX->getLine());
> > if (_STOU64(MAX-
> > > >getText(), MAX->getLine()) > StringMaxSize)
> > >
> > {
> > _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize
> > takes
> > > only one byte, which can't be larger than 0xFF.");@@ -3185,7 +3202,7
> > > @@ vfrStatementPassword :
> > >    {     Key "=" KN:Number ","                              <<
> > AssignQuestionKey (PObj,
> > > KN); >>   }-  MinSize "=" MIN:Number ","
> > << +  MinSize "="
> > > MIN:Number ","                           <<
> > > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); PasswordMinSize =
> > > _STOU16(MIN->getText(), MIN->getLine()); if (_STOU64(MIN->getText(),
> > > MIN->getLine()) > PasswordMinSize) {@@ -
> > > 3195,7 +3212,7 @@ vfrStatementPassword :
> > >
>  }
> > > PObj.SetMinSize
> > (PasswordMinSize);
> >           >>-
> > > MaxSize "=" MAX:Number ","                           << +
> > MaxSize "=" MAX:Number
> > > ","                           <<
> > PasswordMaxSize =
> > > _STOU16(MAX->getText(), MAX->getLine());
> > if
> > > (_STOU64(MAX->getText(), MAX->getLine()) > PasswordMaxSize)
> > >
> > {
> > _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password
> MaxSize
> > takes
> > > only two byte, which can't be larger than 0xFFFF.");@@ -3230,12
> > > +3247,12 @@ vfrStatementOrderedList :
> > >    >>   L:OrderedList
> > << OLObj.SetLineNo(L->getLine());
> > > gIsOrderedList = TRUE;>>   vfrQuestionHeader[OLObj] ","-
> > > << +
> <<
> > > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); OLObj.SetMaxContainers
> > > ((UINT8) (VarArraySize > 0xFF ? 0xFF :
> > >
> > VarArraySize));
> >       >>   {-    MaxContainers "="
> > > M:Number ","                     << +    MaxContainers "="
> > M:Number ","
> > > <<
> > if (_STOU64(M->getText(), M->getLine()) >
> > > _STOU8(M->getText(), M->getLine()))
> > >
> > {
> > _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList
> > > MaxContainers takes only one byte, which can't be larger than
> > >
> > 0xFF.");
> >    } else if (VarArraySize != 0 &&
> > > _STOU8(M->getText(), M->getLine()) > VarArraySize) {@@ -3328,19
> > > +3345,19 @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8
> > KeyValue] :
> > >    {     "default" "=" N:Number ","                         <<
> > > switch (KeyValue) {-
> > case 0: -
> > > T.Hour   = _STOU8(N->getText(), N->getLine()); +
> > > case 0:+
> > T.Hour   = _STOU8(N->getText(), N-
> > > >getLine());
> > if (T.Hour > 23)
> > >
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value
> > must
> > > be between 0 and
> > 23.");
> >     }
> > > break;-
> > case 1: -
> > > T.Minute = _STOU8(N->getText(), N->getLine()); + case 1:+
> > T.Minute = _STOU8(N->getText(), N-
> > > >getLine());
> > if (T.Minute > 59)
> > >
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value
> > > must be between 0 and
> > 59.");
> >     }
> > > break;-
> > case 2: +
> > > case 2:
> > T.Second = _STOU8(N->getText(), N-
> > > >getLine());
> > if (T.Second > 59)
> > >
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value
> > > must be between 0 and 59.");@@ -3419,11 +3436,11 @@
> > > vfrStatementStatListOld :
> > >    ;  vfrStatementDisableIfStat :-  << -    CIfrDisableIf DIObj; +  <<+
> > > CIfrDisableIf DIObj;   >>   L:DisableIf
> > <<
> > > DIObj.SetLineNo(L->getLine()); >>-  vfrStatementExpression[0] ";" +
> > > vfrStatementExpression[0] ";"   ( vfrStatementStatList )*   E:EndIf
> > > << CRT_END_OP (E); >>   ";"@@ -3548,8 +3565,8 @@
> > > vfrStatementWarningIf :
> > >    ;  vfrStatementDisableIfQuest :-  << -    CIfrDisableIf DIObj; +
> > <<+
> > > CIfrDisableIf DIObj;   >>   L:DisableIf
> > <<
> > > DIObj.SetLineNo(L->getLine()); >>   vfrStatementExpression[0] ";"@@ -
> > > 3616,15 +3633,15 @@ vfrStatementOneOfOption :
> > >       UINT32             *Type32       = (UINT32 *) ValueList;
> > UINT64
> > > *Type64       = (UINT64 *) ValueList;   >>-  L:Option
> > <<
> > > +  L:Option                                             <<
> > if
> > > (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER)
> > >
> > {
> > _PCATCH (VFR_RETURN_FATAL_ERROR, L-
> > > >getLine(), "Get data type
> > >
> > error.");
> >    }
>  >
> > >-
> > > Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","      +  Text  "="
> > > "STRING_TOKEN" "\(" S:Number "\)" ","   Value "="
> > > vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","-
> > > << +
> <<
> > if
> > > (gCurrentMinMaxData != NULL)
> > {
> > //set
> > > min/max value for oneof opcode
> > UINT64
> > > Step =
> gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE(),
> > > _GET_CURRQEST_VARTINFO().mIsBitVar);@@ -3696,7 +3713,7 @@
> > > vfrStatementOneOfOption :
> > >
> > Size += OFFSET_OF
> > > (EFI_IFR_ONE_OF_OPTION, Value);
> > OOOObj =
> > > new CIfrOneOfOption((UINT8)Size);
> > OOOObj-
> > > >SetLineNo(L->getLine());-
> > OOOObj-
> > > >SetOption (_STOSID(S->getText(), S->getLine())); +
> > > OOOObj->SetOption (_STOSID(S->getText(), S->getLine()));
> > > if (ArrayType)
> > {
> > OOOObj->SetType
> > >
> > (EFI_IFR_TYPE_BUFFER);
> >                  } else {@@ -3706,7
> > > +3723,7 @@ vfrStatementOneOfOption :
> > >
> > OOOObj->SetType
> > >
> > (_GET_CURRQEST_DATATYPE());
> >                          }
> > >                                       }-
> > OOOObj->SetValue
> > > (*Val); +
> > OOOObj->SetValue
> > >
> >
> (*Val);                                                        >
> >
> > F:FLAGS "="
> > > vfrOneOfOptionFlags[*OOOObj, F->getLine()] <<@@ -3790,7 +3807,12
> @@
> > > oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
> > >    | RestStyleFlag                                      <<
> > $HFlags |= 0x20; >>   |
> > > ReconnectRequiredFlag                              << $HFlags
> |=
> > 0x40; >>   |
> > > ManufacturingFlag                                  << $LFlags
> |=
> > 0x20; >>-  | DefaultFlag
> > > << $LFlags |= 0x10; >>+  | D:DefaultFlag
> > <<+
> > > $LFlags |= 0x10;+
> > if (mIsCatchDefaultEnable)
> > > {+
> > > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > > >getLine());+
> >           }+
> > >  >>   | A:NVAccessFlag
> <<
> > > gCVfrErrorHandle.HandleWarning
> > >
> > (
> > VFR_WARNING_OBSOLETED_FRAMEWORK
> > > _OPCODE,@@ -3963,7 +3985,7 @@ vfrStatementExpression [UINT32
> > > RootLevel, UINT32 ExpOpCount = 0] :
> > >
> >    }
> >    }
> > >                                              }-
> > +
> > > if ($RootLevel == 0)
> > {
> > _CLEAR_SAVED_OPHDR
> > > ();
> > mCIfrOpHdrIndex --;@@ -4405,10
> > > +4427,10 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 &
> ExpOpCount] :
> > >
> > for (Index = 0; Index < ListLen; Index++)
> > >
> > {
> >   EILObj.SetValueList (Index,
> > >
> > ValueList[Index]);
> >              }-
> > > +
> > > + EILObj.UpdateIfrBuffer();-
> > > _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());
> > > -
> > +
> > > _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());+ if
> > > (QId == EFI_QUESTION_ID_INVALID)
> > >
> > {
> >   EILObj.SetQuestionId (QId, VarIdStr,
> > >
> > LineNo);
> >       }@@ -4458,9 +4480,9 @@
> > > stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> > >    >>   L:StringRef   "\("-      ( +
> > (         "STRING_TOKEN"-        "\(" +        "\("
> > > S:Number << RefStringId = _STOSID(S->getText(), S->getLine()); >>
> > "\)"
> > > | I:Number << RefStringId = _STOSID(I->getText(), I->getLine());
> > > | >>@@
> > > | -
> > > 4499,10 +4521,10 @@ getExp[UINT32 & RootLevel, UINT32 &
> > ExpOpCount] :
> > >       Info.mVarStoreId = 0;   >>   L:Get-  "\(" +  "\("
> > vfrStorageVarId[Info,
> > > VarIdStr, FALSE]       {"\|" FLAGS "=" numericVarStoreType
> [VarType] }-
> > "\)"
> > > << +  "\)"                                                 <<
> > >
> >
> {                                                             i
> > f (Info.mVarStoreId == 0)
> > >
> > {
> >   // support Date/Time question@@ -
> > > 4549,9 +4571,9 @@ getExp[UINT32 & RootLevel, UINT32 &
> ExpOpCount] :
> > >
> > > _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> > > >getLine(), "Get/Set opcode don't support data
> > >
> > array");
> >        }
> >        }
> > > -
> > CIfrGet GObj(L->getLine()); -
> > > _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine()); -
> > > GObj.SetVarInfo (&Info); +
> > CIfrGet GObj(L-
> > > >getLine());+
> > _SAVE_OPHDR_COND (GObj,
> > > ($ExpOpCount == 0), L->getLine());+
> > > GObj.SetVarInfo (&Info);
> > delete[] VarIdStr;
> > >
> > $ExpOpCount++;
> >            }@@ -4608,7 +4630,7 @@
> > > question23refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> > >        {         Uuid "=" guidDefinition[Guid] ","
> > << Type = 0x3; >>       }-
> > > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +
> > > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"
> > > <<
> > switch (Type) {@@ -4675,9 +4697,9 @@
> > > setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> > >    "\("      vfrStorageVarId[Info, VarIdStr, FALSE]      {"\|" FLAG
> "="
> > > numericVarStoreType [VarType] }-     ","
> > > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +     ","
> > > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"-
> > > << +
> <<
> > >
> >
> {                                                             i
> > f (Info.mVarStoreId == 0)
> > >
> > {
> >   // support Date/Time question@@ -
> > > 4724,8 +4746,8 @@ setExp[UINT32 & RootLevel, UINT32 &
> ExpOpCount] :
> > >
> > > _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> > > >getLine(), "Get/Set opcode don't support data
> > >
> > array");
> >        }
> >        }
> > > -
> > CIfrSet TSObj(L->getLine()); -
> > > TSObj.SetVarInfo (&Info); +
> > CIfrSet TSObj(L-
> > > >getLine());+
> > TSObj.SetVarInfo (&Info);
> > > delete[] VarIdStr;
> > >
> > $ExpOpCount++;
> >            }@@ -4808,9 +4830,9 @@
> > > spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> > >    ;  vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:-
> > > L:Map
> > > -  "\(" -  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]  +
> > L:Map+
> > > "\("+  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   ":"
> > > << { CIfrMap MObj(L->getLine()); } >>
> > (     vfrStatementExpression[0]@@ -
> > > 4837,6 +4859,7 @@ spanFlags [UINT8 & Flags] :
> > >  class EfiVfrParser { << private:+  BOOLEAN
> > mIsCatchDefaultEnable;
> > > UINT8               mParserStatus;   BOOLEAN
> > mConstantOnlyInExpression;
> > > @@ -4880,6 +4903,7 @@ public:
> > >    VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN
> > ANTLRTokenPtr);
> > > VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN
> UINT32);
> > VOID
> > > _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);+
> > VOID
> > > DefaultValueError (IN EFI_VFR_RETURN_CODE, IN UINT32);    VOID
> > > syn     (ANTLRAbstractToken  *, ANTLRChar *, SetWordType *,
> > > ANTLRTokenType, INT32); @@ -4909,6 +4933,7 @@ public:
> > >    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);   VOID
> > IdEqListDoSpecial     (IN
> > > UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN
> > > UINT16, IN UINT16 *);   VOID                SetOverrideClassGuid
> > (IN EFI_GUID *);+
> > > VOID                SetIsCatchDefaultEnable (BOOLEAN
> > IsCatchDefaultEnable); >> }
> > > @@ -5086,6 +5111,17 @@ EfiVfrParser::_PCATCH (
> > >    mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError
> > > (ReturnCode, LineNum, (CHAR8 *) ErrorMsg); }
> > > +VOID+EfiVfrParser::DefaultValueError (+  IN EFI_VFR_RETURN_CODE
> > > ReturnCode,+  IN UINT32              LineNum+  )+{+  CHAR8
> > ErrorMsg[100];+
> > > sprintf(ErrorMsg, "please remove the default value / defaultstore in
> > > line %d", LineNum);+  mParserStatus = mParserStatus +
> > > gCVfrErrorHandle.HandleError (ReturnCode, LineNum, ErrorMsg);+}+
> > > VOID
> > EfiVfrParser::syn
> > > (   ANTLRAbstractToken  *Tok,@@ -5682,12 +5718,18 @@
> > > EfiVfrParser::IdEqListDoSpecial (
> > >    } } -VOID +VOID EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID
> > > *OverrideClassGuid) {   mOverrideClassGuid = OverrideClassGuid; }
> > > +VOID+EfiVfrParser::SetIsCatchDefaultEnable (BOOLEAN
> > > IsCatchDefaultEnable)+{+  mIsCatchDefaultEnable =
> > IsCatchDefaultEnable;+}+
> > > VOID EfiVfrParser::CheckDuplicateDefaultValue (   IN EFI_DEFAULT_ID
> > > DefaultId,--
> > > 2.26.2.windows.1
> 
> 
> 
> 
> 
> 
> 
> 






-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113907): https://edk2.groups.io/g/devel/message/113907
Mute This Topic: https://groups.io/mt/103763345/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature
  2024-01-16 15:03               ` 回复: " gaoliming via groups.io
@ 2024-01-17  2:18                 ` Zhang, Zifeng
  2024-01-25  9:27                 ` Zhang, Zifeng
  1 sibling, 0 replies; 12+ messages in thread
From: Zhang, Zifeng @ 2024-01-17  2:18 UTC (permalink / raw)
  To: Guo, Gua, Chen, Arthur G
  Cc: Chen, Christine, gaoliming, devel@edk2.groups.io, Yang, Yuting2

Hi Gua, Arthur.

Do you have opens for this solution suggested from Liming?
Jira: https://jira.devtools.intel.com/browse/CRJ-23954

Best Regards,
Zifeng

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn> 
Sent: Tuesday, January 16, 2024 11:04 PM
To: devel@edk2.groups.io; Zhang, Zifeng <zifeng.zhang@intel.com>; Yang, Yuting2 <yuting2.yang@intel.com>
Cc: Chen, Christine <yuwei.chen@intel.com>
Subject: 回复: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature


This option is for the module check. I suggest to set this option in INF instead of DSC. 
If so, DSC is not required to configure the additional options. And, this module will have the same build result when it is specified in the different platform DSC files.

I understand your requirement to enable this option for the modules in some specific package. 
I think you can easily find those modules those have VFR/HFR, then update their INFs with new check option. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Zhang, Zifeng
> 发送时间: 2024年1月12日 13:20
> 收件人: Yang, Yuting2 <yuting2.yang@intel.com>; Gao, Liming 
> <gaoliming@byosoft.com.cn>
> 抄送: Chen, Christine <yuwei.chen@intel.com>; devel@edk2.groups.io
> 主题: Re: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds 
> DefaultValueError Feature
> 
> Hi Liming,
> 
> Could you help to share the update for this patch solution?
> 
> Best Regards,
> Zifeng
> 
> -----Original Message-----
> From: Yang, Yuting2 <yuting2.yang@intel.com>
> Sent: Monday, December 25, 2023 3:10 PM
> To: Gao, Liming <gaoliming@byosoft.com.cn>
> Cc: Zhang, Zifeng <zifeng.zhang@intel.com>; Chen, Christine 
> <yuwei.chen@intel.com>; devel@edk2.groups.io
> Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> Hi Liming,
> 
> Thank you for adding  the account for me.
> I have created a Bugzilla 
> https://bugzilla.tianocore.org/show_bug.cgi?id=4629
> for this feature ~
> 
> Best Regards,,
> Yuting
> 
> -----Original Message-----
> From: gaoliming <gaoliming@byosoft.com.cn>
> Sent: Monday, December 25, 2023 9:14 AM
> To: Yang, Yuting2 <yuting2.yang@intel.com>
> Subject: 回复: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> Your account yuting2.yang@intel.com has been added. PW: tiano@123
> 
> > -----邮件原件-----
> > 发件人: Yang, Yuting2 <yuting2.yang@intel.com>
> > 发送时间: 2023年12月22日 13:41
> > 收件人: Gao, Liming <gaoliming@byosoft.com.cn>
> > 抄送: Rebecca Cran <rebecca@bsdio.com>; Feng, Bob C 
> > <bob.c.feng@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>; 
> > Chen, Christine <yuwei.chen@intel.com>; Zhang, Zifeng 
> > <zifeng.zhang@intel.com>; devel@edk2.groups.io
> > 主题: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> > Feature
> >
> > Hi Liming,
> >
> > Thank you for reviewing ~
> > Could you please help me create a Bugzilla account? Currently, I do 
> > not
> have
> > access to the Bugzilla.
> >
> > Best Regards,
> > Yuting
> >
> > -----Original Message-----
> > From: Zhang, Zifeng <zifeng.zhang@intel.com>
> > Sent: Thursday, December 21, 2023 2:44 PM
> > To: Gao, Liming <gaoliming@byosoft.com.cn>; Yang, Yuting2 
> > <yuting2.yang@intel.com>
> > Cc: Rebecca Cran <rebecca@bsdio.com>; Feng, Bob C 
> > <bob.c.feng@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>; 
> > devel@edk2.groups.io; Chen, Christine <yuwei.chen@intel.com>
> > Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds 
> > DefaultValueError Feature
> >
> > Hi Liming,
> >
> > Thanks for reviewing.
> > For background of this change, we will remove default flags in 
> > VFR/HFR in new platform. So we need help from VFR complier to make a 
> > default flag check to avoid manually adding.
> > @Yang, Yuting2, could you help to create a BZ for this feature and 
> > share
> in
> > mail thread?
> > Then let me make a clarification for your questions.
> >
> > #1: The purpose of --catch_default
> > We send --catch_default flag in build option to indicate which 
> > platform
> should
> > check default flag in VFR/HFR.
> > Actually maybe some platforms used same EDK2 downstream branch, so 
> > we only send --catch_default flag for the platforms which need this check.
> >
> > #2: The purpose of --except_list
> > VFR compiler will receive VFR/HFR configurations from all folders
> including
> > Intel and EDK2. But in our expectation VFR compiler only do this 
> > check in Intel.
> > So We use --except_list to deliver package list in EDK2 to avoid 
> > this
> check.
> >
> > Best Regards,
> > Zifeng
> >
> > -----Original Message-----
> > From: Yang, Yuting2 <yuting2.yang@intel.com>
> > Sent: Tuesday, December 12, 2023 5:12 PM
> > To: Zhang, Zifeng <zifeng.zhang@intel.com>; Chen, Arthur G 
> > <arthur.g.chen@intel.com>; devel@edk2.groups.io
> > Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> > <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
> > Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds 
> > DefaultValueError Feature
> >
> > +Cc Zhang, Zifeng, Chen, Arthur G
> >
> > -----Original Message-----
> > From: Chen, Christine <yuwei.chen@intel.com>
> > Sent: Tuesday, December 12, 2023 5:04 PM
> > To: Yang, Yuting2 <yuting2.yang@intel.com>; devel@edk2.groups.io
> > Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> > <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
> > Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds 
> > DefaultValueError Feature
> >
> > +Cc Yang, Yuting2
> >
> > > -----Original Message-----
> > > From: Yang, Yuting2 <yuting2.yang@intel.com>
> > > Sent: Tuesday, December 12, 2023 5:01 PM
> > > To: devel@edk2.groups.io
> > > Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> > > <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>; 
> > > Chen, Christine <yuwei.chen@intel.com>
> > > Subject: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> > > Feature
> > >
> > > Add --catch_default option
> > > Raise a DefaultValueError when encountering VFR default 
> > > definitions to help remove default variables.
> > > Add --except_list option
> > > Exclude packages that don't require enabling the catch_default function.
> > >
> > > Cc: Rebecca Cran <rebecca@bsdio.com>
> > > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > > Cc: Bob Feng <bob.c.feng@intel.com>
> > > Cc: Christine Chen <yuwei.chen@intel.com>
> > > Cc: Yuting Yang <yuting2.yang@intel.com>
> > >
> > > Signed-off-by: Yuting Yang <yuting2.yang@intel.com>
> > > ---
> > >  BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  40 ++-
> > >  BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   3 +
> > >  BaseTools/Source/C/VfrCompile/VfrError.cpp    |   3 +-
> > >  BaseTools/Source/C/VfrCompile/VfrError.h      |   3 +-
> > >  BaseTools/Source/C/VfrCompile/VfrFormPkg.h    |   1 +
> > >  BaseTools/Source/C/VfrCompile/VfrSyntax.g     | 238
> > ++++++++++--------
> > >  6 files changed, 184 insertions(+), 104 deletions(-)
> > >
> > > diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > > b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > > index 5f4d262d85..e97cebff65 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > > @@ -78,6 +78,9 @@ CVfrCompiler::OptionInitialization (
> > >    mOptions.WarningAsError                = FALSE;
> > mOptions.AutoDefault
> > > = FALSE;   mOptions.CheckDefault                  = FALSE;+
> > > mOptions.IsCatchDefaultEnable          = FALSE;+
> > mOptions.ExceptionList
> > > = NULL;+  mOptions.ExceptionListSize             = 0;   memset
> > > (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));    if (Argc == 1)
> > {@@ -
> > > 95,6 +98,23 @@ CVfrCompiler::OptionInitialization (
> > >        Version ();       SET_RUN_STATUS (STATUS_DEAD);
> > return;+    } else if
> > > (stricmp(Argv[Index], "--catch_default") == 0){+
> > > mOptions.IsCatchDefaultEnable = TRUE;+    } else if
> (stricmp(Argv[Index],
> > "--
> > > except_list") == 0){+      INT32 Start = ++Index;+      if ((Start >=
> Argc)
> > ||
> > > (Argv[Start][0] == '-')) {+        DebugError (NULL, 0, 1001, "Missing
> > option", "-
> > > exception_list missing except list");+        goto Fail;+      }+
> > while
> > > ((Argv[Index][0] != '-') && (Index < Argc - 1)) {+        Index++;+
> }+
> > INT32
> > > End = Index--;+      mOptions.ExceptionListSize = End - Start;+
> for
> > (INT32 i =
> > > Start; i < End; i++) {+        mOptions.ExceptionList = (CHAR8**)
> > > realloc(mOptions.ExceptionList, (i - Start + 1) * sizeof(CHAR8*));+
> > > mOptions.ExceptionList[i-Start] = Argv[i];+      }     } else if
> > (stricmp(Argv[Index],
> > > "-l") == 0) {       mOptions.CreateRecordListFile = TRUE;
> > > gCIfrRecordInfoDB.TurnOn ();@@ -179,7 +199,11 @@ 
> > > CVfrCompiler::OptionInitialization (
> > >        goto Fail;     }     strcpy (mOptions.VfrFileName,
> > Argv[Index]);-+    for (int i =
> > > 0; i < mOptions.ExceptionListSize; i++) {+      if
> > (strstr(mOptions.VfrFileName,
> > > mOptions.ExceptionList[i]) != NULL) {+
> > mOptions.IsCatchDefaultEnable =
> > > FALSE;+      }+    }     if (mOptions.OutputDirectory == NULL)
> > > {       mOptions.OutputDirectory = (CHAR8 *) malloc (1);       if
> > > (mOptions.OutputDirectory == NULL) {@@ -217,6 +241,11 @@ Fail:
> > >      free (mOptions.VfrFileName);     mOptions.VfrFileName
> > =
> > > NULL;   }+  if (mOptions.ExceptionList != NULL) {+
> > > free(mOptions.ExceptionList);+    mOptions.ExceptionList
> > = NULL;++  }
> > > if (mOptions.VfrBaseFileName != NULL) {     free
> > (mOptions.VfrBaseFileName);
> > > mOptions.VfrBaseFileName             = NULL;@@ -496,6 +525,11
> > @@
> > > CVfrCompiler::~CVfrCompiler (
> > >      mOptions.VfrBaseFileName = NULL;   } +  if
> > (mOptions.ExceptionList !=
> > > NULL) {+    free (mOptions.ExceptionList);+    mOptions.ExceptionList
> =
> > > NULL;+  }+   if (mOptions.OutputDirectory != NULL) {     free
> > > (mOptions.OutputDirectory);     mOptions.OutputDirectory =
> NULL;@@
> > -679,7
> > > +713,7 @@ CVfrCompiler::Compile (
> > >      DebugError (NULL, 0, 0001, "Error opening the input file", "%s",
> > > InFileName);     goto Fail;   }-+  InputInfo.IsCatchDefaultEnable =
> > > mOptions.IsCatchDefaultEnable;   if (mOptions.HasOverrideClassGuid)
> > > {     InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;   }
> > else
> > > {@@ -937,5 +971,3 @@ main (
> > >     return GetUtilityStatus (); }--diff --git 
> > > a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > > b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > > index b6e207d2ce..39e0a89a29 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > > @@ -52,6 +52,9 @@ typedef struct {
> > >    BOOLEAN WarningAsError;   BOOLEAN AutoDefault;   BOOLEAN
> > > CheckDefault;+  BOOLEAN IsCatchDefaultEnable;+  CHAR8**
> > ExceptionList;+
> > > INT16    ExceptionListSize; } OPTIONS;  typedef enum {diff --git
> > > a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > > b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > > index 65bb8e34fd..8a706f929b 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > > @@ -49,7 +49,8 @@ static SVFR_WARNING_HANDLE
> > VFR_WARNING_HANDLE_TABLE
> > > [] = {
> > >    { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value
> > re-defined
> > > with different value"},   { VFR_WARNING_ACTION_WITH_TEXT_TWO, ":
> > Action
> > > opcode should not have TextTwo part"}, { 
> > > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend
> to
> > use
> > > obsoleted framework opcode"},-  { VFR_WARNING_CODEUNDEFINED, ":
> > > undefined Warning Code" }+  { VFR_WARNING_CODEUNDEFINED, ":
> > > undefined Warning Code" },+  { VFR_WARNING_UNSUPPORTED, ": pls
> > remove
> > > the default values if necessary" } }; 
> > > CVfrErrorHandle::CVfrErrorHandle (diff -- git 
> > > a/BaseTools/Source/C/VfrCompile/VfrError.h
> > > b/BaseTools/Source/C/VfrCompile/VfrError.h
> > > index 7d16bd5f74..1b4bc173d2 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrError.h
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrError.h
> > > @@ -47,7 +47,8 @@ typedef enum {
> > >    VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0, 
> > > VFR_WARNING_ACTION_WITH_TEXT_TWO,
> > > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,-
> > > VFR_WARNING_CODEUNDEFINED+
> VFR_WARNING_CODEUNDEFINED,+
> > > VFR_WARNING_UNSUPPORTED } EFI_VFR_WARNING_CODE;  typedef
> > struct
> > > _SVFR_ERROR_HANDLE {diff --git
> > > a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > > b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > > index 9ef6f07787..d8fada3bcb 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > > @@ -96,6 +96,7 @@ struct SBufferNode {
> > >   typedef struct {   EFI_GUID *OverrideClassGuid;+  BOOLEAN
> > > IsCatchDefaultEnable; } INPUT_INFO_TO_SYNTAX;  class CFormPkg 
> > > {diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > > b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > > index 55fd067f8a..5daf1c423c 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > > @@ -50,6 +50,7 @@ VfrParserStart (
> > >  {   ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken>
> > VfrParser(File);
> > > VfrParser.parser()->SetOverrideClassGuid
> > > (InputInfo->OverrideClassGuid);+
> > > VfrParser.parser()->SetIsCatchDefaultEnable(InputInfo-
> > > >IsCatchDefaultEnable);   return
> > VfrParser.parser()->vfrProgram(); } >>@@ -
> > > 386,8 +387,8 @@ dataStructField32 [BOOLEAN  FieldInUnion]:
> > >    ;  dataStructField16 [BOOLEAN  FieldInUnion]:-  << -    UINT32
> > ArrayNum = 0;
> > > +  <<+    UINT32 ArrayNum = 0;   >>   ("UINT16" | "CHAR16")
> > > N:StringIdentifier@@ -737,7 +738,7 @@ vfrFormSetList :
> > >    ;  vfrStatementExtension:-  << +  <<      EFI_GUID Guid;
> > CIfrGuid *GuidObj
> > > = NULL;      CHAR8    *TypeName = NULL;@@ -751,7 +752,7 @@
> > > vfrStatementExtension:
> > >    >>   L:GuidOp   Uuid "=" guidDefinition[Guid]-  {"," DataType "="
> +
> > {","
> > > DataType "="     (         U64:"UINT64" {OpenBracket AN1:Number
> > CloseBracket
> > > <<ArrayNum = _STOU32(AN1->getText(), AN1->getLine());>>} <<
> TypeName
> > =
> > > U64->getText(); LineNum = U64->getLine(); >>@@ -770,7
> > > +771,7 @@ vfrStatementExtension:
> > >        | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket 
> > > <<ArrayNum = _STOU32(AN8->getText(), AN8->getLine());>>} <<
> TypeName
> > > = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>
> > |
> > > R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = 
> > > _STOU32(AN9->getText(), AN9->getLine());>>}- << TypeName =
> > > R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
> > > +                                                      <<
> > TypeName =
> > > + R->getText(); LineNum = R-
> > > >getLine(); IsStruct = TRUE;>>       | TN:StringIdentifier {OpenBracket
> > > AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText(),
> > AN10-
> > > >getLine());>>}
> > << TypeName = TN->getText();
> > > LineNum = TN->getLine(); IsStruct = TRUE;>>     )@@ -875,19 +876,19
> > @@
> > > vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName,
> > UINT32
> > > TypeSize,
> > >                  memcpy (ByteOffset, &Data_U64,
> > TypeSize);               }else if (strcmp
> > > ("UINT32", TypeName) == 0) {                 Data_U32 =
> > _STOU32(RD->getText(),
> > > RD->getLine());-                memcpy (ByteOffset, &Data_U32,
> > TypeSize);
> > > +                memcpy (ByteOffset, &Data_U32,
> > TypeSize);               }else if (strcmp
> > > ("UINT16", TypeName) == 0) {                 Data_U16 =
> > _STOU16(RD->getText(),
> > > RD->getLine());-                memcpy (ByteOffset, &Data_U16,
> > TypeSize);
> > > +                memcpy (ByteOffset, &Data_U16,
> > TypeSize);               }else if (strcmp
> > > ("UINT8", TypeName) == 0) {                 Data_U8 =
> > _STOU8(RD->getText(), RD-
> > > >getLine());-                memcpy (ByteOffset, &Data_U8,
> TypeSize);
> > > +                memcpy (ByteOffset, &Data_U8,
> > TypeSize);               }else if (strcmp
> > > ("BOOLEAN", TypeName)== 0) {                 Data_BL =
> > _STOU8(RD->getText(),
> > > RD->getLine());-                memcpy (ByteOffset, &Data_BL,
> > TypeSize);
> > > +                memcpy (ByteOffset, &Data_BL,
> > TypeSize);               }else if (strcmp
> > > ("EFI_STRING_ID", TypeName) == 0) {                 Data_SID =
> > _STOSID(RD-
> > > >getText(), RD->getLine());-                memcpy (ByteOffset,
> > &Data_SID,
> > > TypeSize);
> > +                memcpy (ByteOffset,
> > > &Data_SID, TypeSize);               }             } else
> > > {               gCVfrVarDataTypeDB.GetDataFieldInfo(TFName,
> > FieldOffset,
> > > FieldType, FieldSize, BitField);@@ -975,7 +976,15 @@
> > > vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName,
> > UINT32
> > > TypeSize,
> > >   vfrStatementDefaultStore :   << UINT16  DefaultId =
> > > EFI_HII_DEFAULT_CLASS_STANDARD; >>-  D:DefaultStore
> > N:StringIdentifier
> > > ","+  D:DefaultStore N:StringIdentifier ","             <<+
> > > if (mIsCatchDefaultEnable) {+
> > > gCVfrErrorHandle.HandleWarning (+
> > > VFR_WARNING_UNSUPPORTED,+
> > D-
> > > >getLine(),+
> > D-
> > > >getText()+
> >        );+
> >  }+
> > >                                                     >>
> > Prompt "=" "STRING_TOKEN" "\(" S:Number
> > > "\)"   {     "," Attribute "=" A:Number                      <<
> > DefaultId = _STOU16(A-
> > > >getText(), A->getLine()); >>@@ -1074,7 +1083,7 @@
> > > vfrStatementVarStoreEfi :
> > >      | U64:"UINT64" ","                              <<
> > TypeName = U64->getText();
> > > LineNum = U64->getLine(); >>     | D:"EFI_HII_DATE" ","
> > <<
> > > TypeName = D->getText(); LineNum = D->getLine(); >>     |
> > T:"EFI_HII_TIME"
> > > ","                          << TypeName = T->getText(); LineNum
> =
> > T->getLine(); >>-    |
> > > R:"EFI_HII_REF" ","                           << TypeName =
> > R->getText(); LineNum = R-
> > > >getLine(); >>    +    | R:"EFI_HII_REF" ","
> > << TypeName = R-
> > > >getText(); LineNum = R->getLine(); >>   )   {     VarId "="
> ID:Number
> > ","
> > > <<@@ -1092,8 +1101,8 @@ vfrStatementVarStoreEfi :
> > >    (     Name    "=" SN:StringIdentifier ","             <<
> > StoreName = SN-
> > > >getText();   >>    |-    Name    "=" "STRING_TOKEN" "\("
> > VN:Number "\)" ","  -
> > > VarSize "=" N:Number ","                        << +    Name
> > "=" "STRING_TOKEN"
> > > "\(" VN:Number "\)" ","+    VarSize "=" N:Number ","
> > <<
> > > IsUEFI23EfiVarstore = FALSE;
> > StoreName =
> > > gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText(),
> VN-
> > > >getLine()));
> > if (StoreName == NULL) {@@ -
> > > 1116,7 +1125,7 @@ vfrStatementVarStoreEfi :
> > >
> > break;
> > case 8:
> > > TypeName = (CHAR8 *) "UINT64";-
> > break; +
> > > break;
> > default:
> > > _PCATCH (VFR_RETURN_UNSUPPORTED, N); break;@@ -1124,7 +1133,7
> @@
> > > vfrStatementVarStoreEfi :
> > >                                                      >>   )
> -
> > Uuid "=" guidDefinition[Guid]
> > > << +  Uuid "=" guidDefinition[Guid]                     <<
> > > if (IsUEFI23EfiVarstore)
> > >
> >
> {                                                        _PCAT
> > CH(gCVfrDataStorage.DeclareBufferVarS
> > > tore
> > (
> >                         StoreName,@@ -1150,7
> > > +1159,7 @@ vfrStatementVarStoreEfi :
> > >                                                         } 
> > > VSEObj.SetGuid (&Guid);
> > VSEObj.SetVarStoreId
> > > (VarStoreId);-
> > +
> > > VSEObj.SetSize ((UINT16) Size);
> > > VSEObj.SetName (StoreName);
> > if
> > > (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {@@ -1184,7
> > > +1193,7 @@ vfrStatementVarStoreNameValue :
> > >                                                      >>   }
> > (-    Name "=" "STRING_TOKEN" "\("
> > > N:Number "\)" ","  << +    Name "=" "STRING_TOKEN" "\(" N:Number
> > "\)" ","
> > > <<                                                        if
> > (!Created)
> > >
> >
> {                                                          _PC
> > ATCH(gCVfrDataStorage.DeclareNameVar
> > > StoreBegin (SN->getText(), VarStoreId), SN); Created = TRUE;@@
> > > -1245,12 +1254,12 @@ vfrStatementDisableIfFormSet :
> > >  vfrStatementSuppressIfFormSet :   << CIfrSuppressIf SIObj;>>
> > L:SuppressIf
> > > <<-
> > SIObj.SetLineNo(L->getLine()); +
> > >
> > SIObj.SetLineNo(L->getLine());
> >                   >>   { FLAGS "="
> > > flagsField ( "\|" flagsField )* "," }   vfrStatementExpression[0] ";"
> > > vfrFormSetList-  E: EndIf +  E: EndIf   ";"
> > <<
> > > CRT_END_OP (E); >>   ; @@ -1491,7 +1500,7 @@
> > vfrQuestionDataFieldName
> > > [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
> > >    (     SN2:StringIdentifier                            <<
> > _STRCAT (&VarIdStr, SN2-
> > > >getText()); LineNo = SN2->getLine(); >>     (-      "."
> > << +
> > > "."                                           <<
> > _STRCAT
> > > (&VarIdStr, ".");
> > if
> > > (mConstantOnlyInExpression)
> > >
> >
> {                                                          _PC
> > ATCH(VFR_RETURN_CONSTANT_ONLY,
> > > LineNo);@@ -1518,7 +1527,7 @@ vfrQuestionDataFieldName 
> > > [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
> > >    ;  vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> > > BOOLEAN &ListType] :-  <<  +  <<     EFI_GUID    Guid;
> > BOOLEAN     Negative =
> > > FALSE;     BOOLEAN     IntDecStyle = FALSE;@@ -1634,11 +1643,11
> > @@
> > > vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> > BOOLEAN
> > > &ListType]
> > >    | Z:Zero                                          <<
> > $Value.u8     = _STOU8(Z->getText(), Z-
> > > >getLine()); >>   | HOUR:Number ":" MINUTE:Number ":"
> > SECOND:Number <<
> > > $Value.time   = _STOT(HOUR->getText(), MINUTE->getText(),SECOND-
> > > >getText(), HOUR->getLine()); >>   | YEAR:Number "/" MONTH:Number
> > "/"
> > > DAY:Number     << $Value.date   = _STOD(YEAR->getText(),
> > MONTH->getText(),
> > > DAY->getText(), YEAR->getLine()); >>-  | QI:Number";" FI:Number";"
> > > guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)" +  | 
> > > QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\("
> > > DP:Number "\)"
> > << $Value.ref    = _STOR(QI-
> > > >getText(), FI->getText(), &Guid, DP->getText(), QI->getLine()); >>   |
> > > "STRING_TOKEN" "\(" S1:Number "\)"              << $Value.string =
> > _STOSID(S1-
> > > >getText(), S1->getLine()); >>   | "\{"
> > << ListType =
> > > TRUE; >>-      L1:Number
> > << +      L1:Number
> > > <<
> > switch (Type)
> > >
> >
> {                                                          case
> > EFI_IFR_TYPE_NUM_SIZE_8 :
> > > Type8[Index]  = _STOU8(L1->getText(), L1->getLine());@@ -1658,8
> > > +1667,8 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> > > &Value, BOOLEAN &ListType]
> > >
> >
> Index++;                                                     >>
> > (-
> > > "," -        L2:Number                                   << +
> > ","+        L2:Number
> > > <<
> > switch (Type)
> > >
> >
> {                                                          case
> > EFI_IFR_TYPE_NUM_SIZE_8 :
> > > Type8[Index]  = _STOU8(L2->getText(), L2->getLine());@@ -1679,7
> > > +1688,7 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> > > &Value, BOOLEAN &ListType]
> > >
> > >
> >
> Index++;                                                     >>
> >        )*-    "\}"                                           +
> > > "\}"   ;
> > >
> >
> //************************************************************
> > **
> > > ***************@@ -1714,7 +1723,7 @@ vfrFormDefinition :
> > >    ;  vfrFormMapDefinition :-  << +  <<     CIfrFormMap *FMapObj
> =
> > NULL;
> > > UINT32      FormMapMethodNumber = 0;     EFI_GUID
> Guid;@@
> > -1775,11
> > > +1784,15 @@ vfrStatementDefault :
> > >       CIfrNumeric           *NumericQst   = NULL;    >>-
> > D:Default
> > > +  D:Default                                         <<+
> > if
> > > (mIsCatchDefaultEnable) {+
> > > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > > >getLine());+
> >       }+
> >>
> > > (     (-      "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(),
> > *Val,
> > > ArrayType] ","  -
> > << +      "="
> > > vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType]
> ","+
> > > <<
> if
> > (gCurrentMinMaxData != NULL &&
> > > gCurrentMinMaxData->IsNumericOpcode())
> > >
> >
> {                                                           //c
> > heck default value is valid for Numeric
> > > Opcode
> > NumericQst = (CIfrNumeric *)
> > > gCurrentQuestion;@@ -1888,14 +1901,14 @@ vfrStatementDefault :
> > >          vfrStatementValue ","                       << CIfrEnd
> > EndObj1;
> > > EndObj1.SetLineNo(D->getLine()); >>     )     {-      DefaultStore
> "="
> > > SN:StringIdentifier ","      << +      DefaultStore "="
> SN:StringIdentifier
> > ","      <<
> > > _PCATCH(gCVfrDefaultStore.GetDefaultId (SN->getText(), 
> > > &DefaultId), SN); if (DObj != NULL) {-
> > DObj->SetDefaultId
> > > (DefaultId);
> > -                                                        } +
> > > DObj->SetDefaultId
> > (DefaultId);+
> >     }
> > > if (DObj2 != NULL) {-
> > DObj2->SetDefaultId
> > > (DefaultId); +
> > DObj2->SetDefaultId
> > >
> > (DefaultId);
> >     }                                                     >>
> > >  }@@ -1917,8 +1930,8 @@ vfrStatementDefault :
> > >
> >         );
> >      }
> > >                                              }-
> > if (DObj  != NULL)
> > > {delete DObj;} -
> > if (DObj2 != NULL) {delete
> > > DObj2;} +
> > if (DObj  != NULL) {delete DObj;}+
> > > if (DObj2 != NULL) {delete
> >
> DObj2;}                                                     >>
> >   )   ;@@ -
> > > 1970,11 +1983,15 @@ vfrStatementInvalid :
> > >    ;  flagsField :-  Number -  | InteractiveFlag -  | 
> > > ManufacturingFlag -  | DefaultFlag -  | ResetRequiredFlag +  
> > > Number+
> > > | InteractiveFlag+  |
> > > ManufacturingFlag+  | D:DefaultFlag
> > <<+
> > > if (mIsCatchDefaultEnable) {+
> > > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > > >getLine());+
> >         }+
> > > >>+  | ResetRequiredFlag   | ReconnectRequiredFlag   |
> > N:NVAccessFlag
> > > <<
> > gCVfrErrorHandle.HandleWarning (@@ -
> > > 1989,7 +2006,7 @@ flagsField :
> > >
> > > L->getLine(),
> > >
> > L->getText()
> >          );-
> > >                                                        >>
> >
> +                                                       >>   ;
> > > vfrStatementValue :@@ -2001,13 +2018,13 @@ vfrStatementValue :
> > >  vfrStatementRead :   << CIfrRead RObj; >>   R:Read
> > > << RObj.SetLineNo(R->getLine()); >>-  vfrStatementExpression[0] ";" +
> > > vfrStatementExpression[0] ";"   ;  vfrStatementWrite :   << CIfrWrite
> > WObj; >>
> > > W:Write                                              <<
> > WObj.SetLineNo(W->getLine()); >>-
> > > vfrStatementExpression[0] ";" +  vfrStatementExpression[0] ";"   ;
> > > vfrStatementSubTitle :@@ -2140,7 +2157,7 @@ vfrStatementGoto :
> > >        FormId "=" F3:Number ","                         <<
> > RefType = 2; FId = _STOFID(F3-
> > > >getText(), F3->getLine()); >>       Question "="       (-
> > QN3:StringIdentifier
> > > ","                     << +          QN3:StringIdentifier ","
> > <<
> > > mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, 
> > > BitMask); if (QId == EFI_QUESTION_ID_INVALID)
> > >
> > {
> > _PCATCH(VFR_RETURN_UNDEFINED,
> > > QN3);@@ -2222,7 +2239,7 @@ vfrStatementGoto :
> > >      "," Key "=" KN:Number                              <<
> > AssignQuestionKey (*QHObj,
> > > KN); >>   }   {-    E:"," +    E:","
> > vfrStatementQuestionOptionList                   <<
> > > OHObj->SetScope(1); CRT_END_OP (E);>>   }   ";"
> > > << 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;}>>@@ -2511,20 +2528,20 @@ 
> > > minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
> > >    {     "default" "=" N:Number ","                         <<
> > > switch (KeyValue) {-
> > case 0: +
> > > case 0:
> > D.Year  = _STOU16(N->getText(), N-
> > > >getLine());
> > if (D.Year < _STOU16 (MinN-
> > > >getText(), MinN->getLine()) || D.Year > _STOU16 (MaxN->getText(),
> > > >MaxN-
> > > >getLine()))
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value
> > must
> > > be between Min year and Max
> > year.");
> >      }
> > > break;-
> > case 1: -
> > > D.Month = _STOU8(N->getText(), N->getLine()); + case 1:+
> > D.Month = _STOU8(N->getText(), N-
> > > >getLine());
> > if (D.Month < 1 || D.Month > 12)
> > >
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value 
> > > must be between 1 and
> > 12.");
> >     }
> > > break;-
> > case 2: -
> > > D.Day = _STOU8(N->getText(), N->getLine()); + case 2:+
> > D.Day = _STOU8(N->getText(), N-
> > > >getLine());
> > if (D.Day < 1 || D.Day > 31)
> > >
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value
> > must
> > > be between 1 and
> > 31.");
> >     }@@ -2570,7
> > > +2587,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
> > >       BOOLEAN MinNegative = FALSE;      BOOLEAN MaxNegative =
> > FALSE;   >>-
> > > Minimum   "=" +  Minimum   "="   {     "\-"
> > <<
> > > MinNegative = TRUE; >>   }@@ -2659,8 +2676,8 @@
> > > vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
> > >
> >  }
>  }
> > >                                       >>-  Maximum   "=" -
> > { +  Maximum   "="+  {     "\-"
> > > << MaxNegative = TRUE; >>   }   A:Number ","
> > <<@@ -
> > > 2889,7 +2906,7 @@ vfrStatementNumeric :
> > >
>  }
> >                                                         >>
> > > vfrStatementQuestionOptionList-  E:EndNumeric
> > << +
> > > E:EndNumeric                                         <<
> > > CRT_END_OP (E);
> > if (GuidObj != NULL)
> > >
> > {
> > GuidObj->SetScope(1);@@ -3131,7
> > > +3148,7 @@ vfrStatementString :
> > >    {     Key "=" KN:Number ","                              <<
> > AssignQuestionKey (SObj,
> > > KN); >>   }-  MinSize "=" MIN:Number ","
> > << +  MinSize "="
> > > MIN:Number ","                           <<
> > > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); StringMinSize = 
> > > _STOU8(MIN->getText(), MIN->getLine()); if 
> > > (_STOU64(MIN->getText(),
> > > MIN->getLine()) > StringMinSize) {@@ -3141,7
> > > +3158,7 @@ vfrStatementString :
> > >
>  }
> > > SObj.SetMinSize
> > (StringMinSize);
> >        >>-  MaxSize
> > > "=" MAX:Number ","                           << +  MaxSize "="
> > MAX:Number ","
> > > <<
> > StringMaxSize = _STOU8(MAX->getText(),
> > > MAX->getLine());
> > if (_STOU64(MAX-
> > > >getText(), MAX->getLine()) > StringMaxSize)
> > >
> > {
> > _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize
> > takes
> > > only one byte, which can't be larger than 0xFF.");@@ -3185,7 
> > > +3202,7 @@ vfrStatementPassword :
> > >    {     Key "=" KN:Number ","                              <<
> > AssignQuestionKey (PObj,
> > > KN); >>   }-  MinSize "=" MIN:Number ","
> > << +  MinSize "="
> > > MIN:Number ","                           <<
> > > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); PasswordMinSize = 
> > > _STOU16(MIN->getText(), MIN->getLine()); if 
> > > (_STOU64(MIN->getText(),
> > > MIN->getLine()) > PasswordMinSize) {@@ -
> > > 3195,7 +3212,7 @@ vfrStatementPassword :
> > >
>  }
> > > PObj.SetMinSize
> > (PasswordMinSize);
> >           >>-
> > > MaxSize "=" MAX:Number ","                           << +
> > MaxSize "=" MAX:Number
> > > ","                           <<
> > PasswordMaxSize =
> > > _STOU16(MAX->getText(), MAX->getLine());
> > if
> > > (_STOU64(MAX->getText(), MAX->getLine()) > PasswordMaxSize)
> > >
> > {
> > _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password
> MaxSize
> > takes
> > > only two byte, which can't be larger than 0xFFFF.");@@ -3230,12
> > > +3247,12 @@ vfrStatementOrderedList :
> > >    >>   L:OrderedList
> > << OLObj.SetLineNo(L->getLine());
> > > gIsOrderedList = TRUE;>>   vfrQuestionHeader[OLObj] ","-
> > > << +
> <<
> > > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); OLObj.SetMaxContainers
> > > ((UINT8) (VarArraySize > 0xFF ? 0xFF :
> > >
> > VarArraySize));
> >       >>   {-    MaxContainers "="
> > > M:Number ","                     << +    MaxContainers "="
> > M:Number ","
> > > <<
> > if (_STOU64(M->getText(), M->getLine()) >
> > > _STOU8(M->getText(), M->getLine()))
> > >
> > {
> > _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList 
> > > MaxContainers takes only one byte, which can't be larger than
> > >
> > 0xFF.");
> >    } else if (VarArraySize != 0 &&
> > > _STOU8(M->getText(), M->getLine()) > VarArraySize) {@@ -3328,19
> > > +3345,19 @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8
> > KeyValue] :
> > >    {     "default" "=" N:Number ","                         <<
> > > switch (KeyValue) {-
> > case 0: -
> > > T.Hour   = _STOU8(N->getText(), N->getLine()); +
> > > case 0:+
> > T.Hour   = _STOU8(N->getText(), N-
> > > >getLine());
> > if (T.Hour > 23)
> > >
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value
> > must
> > > be between 0 and
> > 23.");
> >     }
> > > break;-
> > case 1: -
> > > T.Minute = _STOU8(N->getText(), N->getLine()); + case 1:+
> > T.Minute = _STOU8(N->getText(), N-
> > > >getLine());
> > if (T.Minute > 59)
> > >
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value 
> > > must be between 0 and
> > 59.");
> >     }
> > > break;-
> > case 2: +
> > > case 2:
> > T.Second = _STOU8(N->getText(), N-
> > > >getLine());
> > if (T.Second > 59)
> > >
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value 
> > > must be between 0 and 59.");@@ -3419,11 +3436,11 @@ 
> > > vfrStatementStatListOld :
> > >    ;  vfrStatementDisableIfStat :-  << -    CIfrDisableIf DIObj; +  <<+
> > > CIfrDisableIf DIObj;   >>   L:DisableIf
> > <<
> > > DIObj.SetLineNo(L->getLine()); >>-  vfrStatementExpression[0] ";" +
> > > vfrStatementExpression[0] ";"   ( vfrStatementStatList )*   E:EndIf
> > > << CRT_END_OP (E); >>   ";"@@ -3548,8 +3565,8 @@
> > > vfrStatementWarningIf :
> > >    ;  vfrStatementDisableIfQuest :-  << -    CIfrDisableIf DIObj; +
> > <<+
> > > CIfrDisableIf DIObj;   >>   L:DisableIf
> > <<
> > > DIObj.SetLineNo(L->getLine()); >>   vfrStatementExpression[0] ";"@@ -
> > > 3616,15 +3633,15 @@ vfrStatementOneOfOption :
> > >       UINT32             *Type32       = (UINT32 *) ValueList;
> > UINT64
> > > *Type64       = (UINT64 *) ValueList;   >>-  L:Option
> > <<
> > > +  L:Option                                             <<
> > if
> > > (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER)
> > >
> > {
> > _PCATCH (VFR_RETURN_FATAL_ERROR, L-
> > > >getLine(), "Get data type
> > >
> > error.");
> >    }
>  >
> > >-
> > > Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","      +  Text  "="
> > > "STRING_TOKEN" "\(" S:Number "\)" ","   Value "="
> > > vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] 
> > >","-  << +
> <<
> > if
> > > (gCurrentMinMaxData != NULL)
> > {
> > //set
> > > min/max value for oneof opcode
> > UINT64
> > > Step =
> gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE(),
> > > _GET_CURRQEST_VARTINFO().mIsBitVar);@@ -3696,7 +3713,7 @@ 
> > > vfrStatementOneOfOption :
> > >
> > Size += OFFSET_OF
> > > (EFI_IFR_ONE_OF_OPTION, Value);
> > OOOObj =
> > > new CIfrOneOfOption((UINT8)Size);
> > OOOObj-
> > > >SetLineNo(L->getLine());-
> > OOOObj-
> > > >SetOption (_STOSID(S->getText(), S->getLine())); +
> > > OOOObj->SetOption (_STOSID(S->getText(), S->getLine()));
> > > if (ArrayType)
> > {
> > OOOObj->SetType
> > >
> > (EFI_IFR_TYPE_BUFFER);
> >                  } else {@@ -3706,7
> > > +3723,7 @@ vfrStatementOneOfOption :
> > >
> > OOOObj->SetType
> > >
> > (_GET_CURRQEST_DATATYPE());
> >                          }
> > >                                       }-
> > OOOObj->SetValue
> > > (*Val); +
> > OOOObj->SetValue
> > >
> >
> (*Val);                                                        >
> >
> > F:FLAGS "="
> > > vfrOneOfOptionFlags[*OOOObj, F->getLine()] <<@@ -3790,7 +3807,12
> @@
> > > oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
> > >    | RestStyleFlag                                      <<
> > $HFlags |= 0x20; >>   |
> > > ReconnectRequiredFlag                              << $HFlags
> |=
> > 0x40; >>   |
> > > ManufacturingFlag                                  << $LFlags
> |=
> > 0x20; >>-  | DefaultFlag
> > > << $LFlags |= 0x10; >>+  | D:DefaultFlag
> > <<+
> > > $LFlags |= 0x10;+
> > if (mIsCatchDefaultEnable)
> > > {+
> > > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > > >getLine());+
> >           }+
> > >  >>   | A:NVAccessFlag
> <<
> > > gCVfrErrorHandle.HandleWarning
> > >
> > (
> > VFR_WARNING_OBSOLETED_FRAMEWORK
> > > _OPCODE,@@ -3963,7 +3985,7 @@ vfrStatementExpression [UINT32 
> > > RootLevel, UINT32 ExpOpCount = 0] :
> > >
> >    }
> >    }
> > >                                              }-
> > +
> > > if ($RootLevel == 0)
> > {
> > _CLEAR_SAVED_OPHDR
> > > ();
> > mCIfrOpHdrIndex --;@@ -4405,10
> > > +4427,10 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 &
> ExpOpCount] :
> > >
> > for (Index = 0; Index < ListLen; Index++)
> > >
> > {
> >   EILObj.SetValueList (Index,
> > >
> > ValueList[Index]);
> >              }-
> > > +
> > > + EILObj.UpdateIfrBuffer();-
> > > _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());
> > > -
> > +
> > > _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());+ if 
> > > (QId == EFI_QUESTION_ID_INVALID)
> > >
> > {
> >   EILObj.SetQuestionId (QId, VarIdStr,
> > >
> > LineNo);
> >       }@@ -4458,9 +4480,9 @@
> > > stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> > >    >>   L:StringRef   "\("-      ( +
> > (         "STRING_TOKEN"-        "\(" +        "\("
> > > S:Number << RefStringId = _STOSID(S->getText(), S->getLine()); >>
> > "\)"
> > > | I:Number << RefStringId = _STOSID(I->getText(), I->getLine());
> > > | >>@@
> > > | -
> > > 4499,10 +4521,10 @@ getExp[UINT32 & RootLevel, UINT32 &
> > ExpOpCount] :
> > >       Info.mVarStoreId = 0;   >>   L:Get-  "\(" +  "\("
> > vfrStorageVarId[Info,
> > > VarIdStr, FALSE]       {"\|" FLAGS "=" numericVarStoreType
> [VarType] }-
> > "\)"
> > > << +  "\)"                                                 <<
> > >
> >
> {                                                             i
> > f (Info.mVarStoreId == 0)
> > >
> > {
> >   // support Date/Time question@@ -
> > > 4549,9 +4571,9 @@ getExp[UINT32 & RootLevel, UINT32 &
> ExpOpCount] :
> > >
> > > _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> > > >getLine(), "Get/Set opcode don't support data
> > >
> > array");
> >        }
> >        }
> > > -
> > CIfrGet GObj(L->getLine()); -
> > > _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine()); - 
> > > GObj.SetVarInfo (&Info); +
> > CIfrGet GObj(L-
> > > >getLine());+
> > _SAVE_OPHDR_COND (GObj,
> > > ($ExpOpCount == 0), L->getLine());+ GObj.SetVarInfo (&Info);
> > delete[] VarIdStr;
> > >
> > $ExpOpCount++;
> >            }@@ -4608,7 +4630,7 @@
> > > question23refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> > >        {         Uuid "=" guidDefinition[Guid] ","
> > << Type = 0x3; >>       }-
> > > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +
> > > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"
> > > <<
> > switch (Type) {@@ -4675,9 +4697,9 @@
> > > setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> > >    "\("      vfrStorageVarId[Info, VarIdStr, FALSE]      {"\|" FLAG
> "="
> > > numericVarStoreType [VarType] }-     ","
> > > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +     ","
> > > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"-
> > > << +
> <<
> > >
> >
> {                                                             i
> > f (Info.mVarStoreId == 0)
> > >
> > {
> >   // support Date/Time question@@ -
> > > 4724,8 +4746,8 @@ setExp[UINT32 & RootLevel, UINT32 &
> ExpOpCount] :
> > >
> > > _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> > > >getLine(), "Get/Set opcode don't support data
> > >
> > array");
> >        }
> >        }
> > > -
> > CIfrSet TSObj(L->getLine()); -
> > > TSObj.SetVarInfo (&Info); +
> > CIfrSet TSObj(L-
> > > >getLine());+
> > TSObj.SetVarInfo (&Info);
> > > delete[] VarIdStr;
> > >
> > $ExpOpCount++;
> >            }@@ -4808,9 +4830,9 @@
> > > spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> > >    ;  vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:-
> > > L:Map
> > > -  "\(" -  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]  +
> > L:Map+
> > > "\("+  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   ":"
> > > << { CIfrMap MObj(L->getLine()); } >>
> > (     vfrStatementExpression[0]@@ -
> > > 4837,6 +4859,7 @@ spanFlags [UINT8 & Flags] :
> > >  class EfiVfrParser { << private:+  BOOLEAN
> > mIsCatchDefaultEnable;
> > > UINT8               mParserStatus;   BOOLEAN
> > mConstantOnlyInExpression;
> > > @@ -4880,6 +4903,7 @@ public:
> > >    VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN
> > ANTLRTokenPtr);
> > > VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN
> UINT32);
> > VOID
> > > _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);+
> > VOID
> > > DefaultValueError (IN EFI_VFR_RETURN_CODE, IN UINT32);    VOID
> > > syn     (ANTLRAbstractToken  *, ANTLRChar *, SetWordType *,
> > > ANTLRTokenType, INT32); @@ -4909,6 +4933,7 @@ public:
> > >    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);   VOID
> > IdEqListDoSpecial     (IN
> > > UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN
> > > UINT16, IN UINT16 *);   VOID                SetOverrideClassGuid
> > (IN EFI_GUID *);+
> > > VOID                SetIsCatchDefaultEnable (BOOLEAN
> > IsCatchDefaultEnable); >> }
> > > @@ -5086,6 +5111,17 @@ EfiVfrParser::_PCATCH (
> > >    mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError
> > > (ReturnCode, LineNum, (CHAR8 *) ErrorMsg); }
> > > +VOID+EfiVfrParser::DefaultValueError (+  IN EFI_VFR_RETURN_CODE
> > > ReturnCode,+  IN UINT32              LineNum+  )+{+  CHAR8
> > ErrorMsg[100];+
> > > sprintf(ErrorMsg, "please remove the default value / defaultstore in
> > > line %d", LineNum);+  mParserStatus = mParserStatus +
> > > gCVfrErrorHandle.HandleError (ReturnCode, LineNum, ErrorMsg);+}+
> > > VOID
> > EfiVfrParser::syn
> > > (   ANTLRAbstractToken  *Tok,@@ -5682,12 +5718,18 @@
> > > EfiVfrParser::IdEqListDoSpecial (
> > >    } } -VOID +VOID EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID
> > > *OverrideClassGuid) {   mOverrideClassGuid = OverrideClassGuid; }
> > > +VOID+EfiVfrParser::SetIsCatchDefaultEnable (BOOLEAN
> > > IsCatchDefaultEnable)+{+  mIsCatchDefaultEnable =
> > IsCatchDefaultEnable;+}+
> > > VOID EfiVfrParser::CheckDuplicateDefaultValue (   IN EFI_DEFAULT_ID
> > > DefaultId,--
> > > 2.26.2.windows.1
> 
> 
> 
> 
> 
> 
> 
> 






-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113926): https://edk2.groups.io/g/devel/message/113926
Mute This Topic: https://groups.io/mt/103780702/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature
  2024-01-16 15:03               ` 回复: " gaoliming via groups.io
  2024-01-17  2:18                 ` Zhang, Zifeng
@ 2024-01-25  9:27                 ` Zhang, Zifeng
  1 sibling, 0 replies; 12+ messages in thread
From: Zhang, Zifeng @ 2024-01-25  9:27 UTC (permalink / raw)
  To: gaoliming, devel@edk2.groups.io, Yang, Yuting2
  Cc: Chen, Christine, Chen, Arthur G

Hi Liming,

We adopt the solution to send option from module level.
We will add --catch_default option into INF for module which need to do VFR default flag check.
Thus, VFR Compiler only need to catch one option then do module check.
@Yuting, could you help to update the patch for review?

Best Regards,
Zifeng

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn> 
Sent: Tuesday, January 16, 2024 11:04 PM
To: devel@edk2.groups.io; Zhang, Zifeng <zifeng.zhang@intel.com>; Yang, Yuting2 <yuting2.yang@intel.com>
Cc: Chen, Christine <yuwei.chen@intel.com>
Subject: 回复: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature


This option is for the module check. I suggest to set this option in INF instead of DSC. 
If so, DSC is not required to configure the additional options. And, this module will have the same build result when it is specified in the different platform DSC files.

I understand your requirement to enable this option for the modules in some specific package. 
I think you can easily find those modules those have VFR/HFR, then update their INFs with new check option. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Zhang, Zifeng
> 发送时间: 2024年1月12日 13:20
> 收件人: Yang, Yuting2 <yuting2.yang@intel.com>; Gao, Liming 
> <gaoliming@byosoft.com.cn>
> 抄送: Chen, Christine <yuwei.chen@intel.com>; devel@edk2.groups.io
> 主题: Re: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds 
> DefaultValueError Feature
> 
> Hi Liming,
> 
> Could you help to share the update for this patch solution?
> 
> Best Regards,
> Zifeng
> 
> -----Original Message-----
> From: Yang, Yuting2 <yuting2.yang@intel.com>
> Sent: Monday, December 25, 2023 3:10 PM
> To: Gao, Liming <gaoliming@byosoft.com.cn>
> Cc: Zhang, Zifeng <zifeng.zhang@intel.com>; Chen, Christine 
> <yuwei.chen@intel.com>; devel@edk2.groups.io
> Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> Hi Liming,
> 
> Thank you for adding  the account for me.
> I have created a Bugzilla 
> https://bugzilla.tianocore.org/show_bug.cgi?id=4629
> for this feature ~
> 
> Best Regards,,
> Yuting
> 
> -----Original Message-----
> From: gaoliming <gaoliming@byosoft.com.cn>
> Sent: Monday, December 25, 2023 9:14 AM
> To: Yang, Yuting2 <yuting2.yang@intel.com>
> Subject: 回复: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> Feature
> 
> Your account yuting2.yang@intel.com has been added. PW: tiano@123
> 
> > -----邮件原件-----
> > 发件人: Yang, Yuting2 <yuting2.yang@intel.com>
> > 发送时间: 2023年12月22日 13:41
> > 收件人: Gao, Liming <gaoliming@byosoft.com.cn>
> > 抄送: Rebecca Cran <rebecca@bsdio.com>; Feng, Bob C 
> > <bob.c.feng@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>; 
> > Chen, Christine <yuwei.chen@intel.com>; Zhang, Zifeng 
> > <zifeng.zhang@intel.com>; devel@edk2.groups.io
> > 主题: RE: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> > Feature
> >
> > Hi Liming,
> >
> > Thank you for reviewing ~
> > Could you please help me create a Bugzilla account? Currently, I do 
> > not
> have
> > access to the Bugzilla.
> >
> > Best Regards,
> > Yuting
> >
> > -----Original Message-----
> > From: Zhang, Zifeng <zifeng.zhang@intel.com>
> > Sent: Thursday, December 21, 2023 2:44 PM
> > To: Gao, Liming <gaoliming@byosoft.com.cn>; Yang, Yuting2 
> > <yuting2.yang@intel.com>
> > Cc: Rebecca Cran <rebecca@bsdio.com>; Feng, Bob C 
> > <bob.c.feng@intel.com>; Chen, Arthur G <arthur.g.chen@intel.com>; 
> > devel@edk2.groups.io; Chen, Christine <yuwei.chen@intel.com>
> > Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds 
> > DefaultValueError Feature
> >
> > Hi Liming,
> >
> > Thanks for reviewing.
> > For background of this change, we will remove default flags in 
> > VFR/HFR in new platform. So we need help from VFR complier to make a 
> > default flag check to avoid manually adding.
> > @Yang, Yuting2, could you help to create a BZ for this feature and 
> > share
> in
> > mail thread?
> > Then let me make a clarification for your questions.
> >
> > #1: The purpose of --catch_default
> > We send --catch_default flag in build option to indicate which 
> > platform
> should
> > check default flag in VFR/HFR.
> > Actually maybe some platforms used same EDK2 downstream branch, so 
> > we only send --catch_default flag for the platforms which need this check.
> >
> > #2: The purpose of --except_list
> > VFR compiler will receive VFR/HFR configurations from all folders
> including
> > Intel and EDK2. But in our expectation VFR compiler only do this 
> > check in Intel.
> > So We use --except_list to deliver package list in EDK2 to avoid 
> > this
> check.
> >
> > Best Regards,
> > Zifeng
> >
> > -----Original Message-----
> > From: Yang, Yuting2 <yuting2.yang@intel.com>
> > Sent: Tuesday, December 12, 2023 5:12 PM
> > To: Zhang, Zifeng <zifeng.zhang@intel.com>; Chen, Arthur G 
> > <arthur.g.chen@intel.com>; devel@edk2.groups.io
> > Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> > <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
> > Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds 
> > DefaultValueError Feature
> >
> > +Cc Zhang, Zifeng, Chen, Arthur G
> >
> > -----Original Message-----
> > From: Chen, Christine <yuwei.chen@intel.com>
> > Sent: Tuesday, December 12, 2023 5:04 PM
> > To: Yang, Yuting2 <yuting2.yang@intel.com>; devel@edk2.groups.io
> > Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> > <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
> > Subject: RE: [Patch V2] BaseTools: VfrCompiler Adds 
> > DefaultValueError Feature
> >
> > +Cc Yang, Yuting2
> >
> > > -----Original Message-----
> > > From: Yang, Yuting2 <yuting2.yang@intel.com>
> > > Sent: Tuesday, December 12, 2023 5:01 PM
> > > To: devel@edk2.groups.io
> > > Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming 
> > > <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>; 
> > > Chen, Christine <yuwei.chen@intel.com>
> > > Subject: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError 
> > > Feature
> > >
> > > Add --catch_default option
> > > Raise a DefaultValueError when encountering VFR default 
> > > definitions to help remove default variables.
> > > Add --except_list option
> > > Exclude packages that don't require enabling the catch_default function.
> > >
> > > Cc: Rebecca Cran <rebecca@bsdio.com>
> > > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > > Cc: Bob Feng <bob.c.feng@intel.com>
> > > Cc: Christine Chen <yuwei.chen@intel.com>
> > > Cc: Yuting Yang <yuting2.yang@intel.com>
> > >
> > > Signed-off-by: Yuting Yang <yuting2.yang@intel.com>
> > > ---
> > >  BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  40 ++-
> > >  BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   3 +
> > >  BaseTools/Source/C/VfrCompile/VfrError.cpp    |   3 +-
> > >  BaseTools/Source/C/VfrCompile/VfrError.h      |   3 +-
> > >  BaseTools/Source/C/VfrCompile/VfrFormPkg.h    |   1 +
> > >  BaseTools/Source/C/VfrCompile/VfrSyntax.g     | 238
> > ++++++++++--------
> > >  6 files changed, 184 insertions(+), 104 deletions(-)
> > >
> > > diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > > b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > > index 5f4d262d85..e97cebff65 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> > > @@ -78,6 +78,9 @@ CVfrCompiler::OptionInitialization (
> > >    mOptions.WarningAsError                = FALSE;
> > mOptions.AutoDefault
> > > = FALSE;   mOptions.CheckDefault                  = FALSE;+
> > > mOptions.IsCatchDefaultEnable          = FALSE;+
> > mOptions.ExceptionList
> > > = NULL;+  mOptions.ExceptionListSize             = 0;   memset
> > > (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));    if (Argc == 1)
> > {@@ -
> > > 95,6 +98,23 @@ CVfrCompiler::OptionInitialization (
> > >        Version ();       SET_RUN_STATUS (STATUS_DEAD);
> > return;+    } else if
> > > (stricmp(Argv[Index], "--catch_default") == 0){+
> > > mOptions.IsCatchDefaultEnable = TRUE;+    } else if
> (stricmp(Argv[Index],
> > "--
> > > except_list") == 0){+      INT32 Start = ++Index;+      if ((Start >=
> Argc)
> > ||
> > > (Argv[Start][0] == '-')) {+        DebugError (NULL, 0, 1001, "Missing
> > option", "-
> > > exception_list missing except list");+        goto Fail;+      }+
> > while
> > > ((Argv[Index][0] != '-') && (Index < Argc - 1)) {+        Index++;+
> }+
> > INT32
> > > End = Index--;+      mOptions.ExceptionListSize = End - Start;+
> for
> > (INT32 i =
> > > Start; i < End; i++) {+        mOptions.ExceptionList = (CHAR8**)
> > > realloc(mOptions.ExceptionList, (i - Start + 1) * sizeof(CHAR8*));+
> > > mOptions.ExceptionList[i-Start] = Argv[i];+      }     } else if
> > (stricmp(Argv[Index],
> > > "-l") == 0) {       mOptions.CreateRecordListFile = TRUE;
> > > gCIfrRecordInfoDB.TurnOn ();@@ -179,7 +199,11 @@ 
> > > CVfrCompiler::OptionInitialization (
> > >        goto Fail;     }     strcpy (mOptions.VfrFileName,
> > Argv[Index]);-+    for (int i =
> > > 0; i < mOptions.ExceptionListSize; i++) {+      if
> > (strstr(mOptions.VfrFileName,
> > > mOptions.ExceptionList[i]) != NULL) {+
> > mOptions.IsCatchDefaultEnable =
> > > FALSE;+      }+    }     if (mOptions.OutputDirectory == NULL)
> > > {       mOptions.OutputDirectory = (CHAR8 *) malloc (1);       if
> > > (mOptions.OutputDirectory == NULL) {@@ -217,6 +241,11 @@ Fail:
> > >      free (mOptions.VfrFileName);     mOptions.VfrFileName
> > =
> > > NULL;   }+  if (mOptions.ExceptionList != NULL) {+
> > > free(mOptions.ExceptionList);+    mOptions.ExceptionList
> > = NULL;++  }
> > > if (mOptions.VfrBaseFileName != NULL) {     free
> > (mOptions.VfrBaseFileName);
> > > mOptions.VfrBaseFileName             = NULL;@@ -496,6 +525,11
> > @@
> > > CVfrCompiler::~CVfrCompiler (
> > >      mOptions.VfrBaseFileName = NULL;   } +  if
> > (mOptions.ExceptionList !=
> > > NULL) {+    free (mOptions.ExceptionList);+    mOptions.ExceptionList
> =
> > > NULL;+  }+   if (mOptions.OutputDirectory != NULL) {     free
> > > (mOptions.OutputDirectory);     mOptions.OutputDirectory =
> NULL;@@
> > -679,7
> > > +713,7 @@ CVfrCompiler::Compile (
> > >      DebugError (NULL, 0, 0001, "Error opening the input file", "%s",
> > > InFileName);     goto Fail;   }-+  InputInfo.IsCatchDefaultEnable =
> > > mOptions.IsCatchDefaultEnable;   if (mOptions.HasOverrideClassGuid)
> > > {     InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;   }
> > else
> > > {@@ -937,5 +971,3 @@ main (
> > >     return GetUtilityStatus (); }--diff --git 
> > > a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > > b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > > index b6e207d2ce..39e0a89a29 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> > > @@ -52,6 +52,9 @@ typedef struct {
> > >    BOOLEAN WarningAsError;   BOOLEAN AutoDefault;   BOOLEAN
> > > CheckDefault;+  BOOLEAN IsCatchDefaultEnable;+  CHAR8**
> > ExceptionList;+
> > > INT16    ExceptionListSize; } OPTIONS;  typedef enum {diff --git
> > > a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > > b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > > index 65bb8e34fd..8a706f929b 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> > > @@ -49,7 +49,8 @@ static SVFR_WARNING_HANDLE
> > VFR_WARNING_HANDLE_TABLE
> > > [] = {
> > >    { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value
> > re-defined
> > > with different value"},   { VFR_WARNING_ACTION_WITH_TEXT_TWO, ":
> > Action
> > > opcode should not have TextTwo part"}, { 
> > > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend
> to
> > use
> > > obsoleted framework opcode"},-  { VFR_WARNING_CODEUNDEFINED, ":
> > > undefined Warning Code" }+  { VFR_WARNING_CODEUNDEFINED, ":
> > > undefined Warning Code" },+  { VFR_WARNING_UNSUPPORTED, ": pls
> > remove
> > > the default values if necessary" } }; 
> > > CVfrErrorHandle::CVfrErrorHandle (diff -- git 
> > > a/BaseTools/Source/C/VfrCompile/VfrError.h
> > > b/BaseTools/Source/C/VfrCompile/VfrError.h
> > > index 7d16bd5f74..1b4bc173d2 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrError.h
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrError.h
> > > @@ -47,7 +47,8 @@ typedef enum {
> > >    VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0, 
> > > VFR_WARNING_ACTION_WITH_TEXT_TWO,
> > > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,-
> > > VFR_WARNING_CODEUNDEFINED+
> VFR_WARNING_CODEUNDEFINED,+
> > > VFR_WARNING_UNSUPPORTED } EFI_VFR_WARNING_CODE;  typedef
> > struct
> > > _SVFR_ERROR_HANDLE {diff --git
> > > a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > > b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > > index 9ef6f07787..d8fada3bcb 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
> > > @@ -96,6 +96,7 @@ struct SBufferNode {
> > >   typedef struct {   EFI_GUID *OverrideClassGuid;+  BOOLEAN
> > > IsCatchDefaultEnable; } INPUT_INFO_TO_SYNTAX;  class CFormPkg 
> > > {diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > > b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > > index 55fd067f8a..5daf1c423c 100644
> > > --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > > +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > > @@ -50,6 +50,7 @@ VfrParserStart (
> > >  {   ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken>
> > VfrParser(File);
> > > VfrParser.parser()->SetOverrideClassGuid
> > > (InputInfo->OverrideClassGuid);+
> > > VfrParser.parser()->SetIsCatchDefaultEnable(InputInfo-
> > > >IsCatchDefaultEnable);   return
> > VfrParser.parser()->vfrProgram(); } >>@@ -
> > > 386,8 +387,8 @@ dataStructField32 [BOOLEAN  FieldInUnion]:
> > >    ;  dataStructField16 [BOOLEAN  FieldInUnion]:-  << -    UINT32
> > ArrayNum = 0;
> > > +  <<+    UINT32 ArrayNum = 0;   >>   ("UINT16" | "CHAR16")
> > > N:StringIdentifier@@ -737,7 +738,7 @@ vfrFormSetList :
> > >    ;  vfrStatementExtension:-  << +  <<      EFI_GUID Guid;
> > CIfrGuid *GuidObj
> > > = NULL;      CHAR8    *TypeName = NULL;@@ -751,7 +752,7 @@
> > > vfrStatementExtension:
> > >    >>   L:GuidOp   Uuid "=" guidDefinition[Guid]-  {"," DataType "="
> +
> > {","
> > > DataType "="     (         U64:"UINT64" {OpenBracket AN1:Number
> > CloseBracket
> > > <<ArrayNum = _STOU32(AN1->getText(), AN1->getLine());>>} <<
> TypeName
> > =
> > > U64->getText(); LineNum = U64->getLine(); >>@@ -770,7
> > > +771,7 @@ vfrStatementExtension:
> > >        | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket 
> > > <<ArrayNum = _STOU32(AN8->getText(), AN8->getLine());>>} <<
> TypeName
> > > = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>
> > |
> > > R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = 
> > > _STOU32(AN9->getText(), AN9->getLine());>>}- << TypeName =
> > > R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
> > > +                                                      <<
> > TypeName =
> > > + R->getText(); LineNum = R-
> > > >getLine(); IsStruct = TRUE;>>       | TN:StringIdentifier {OpenBracket
> > > AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText(),
> > AN10-
> > > >getLine());>>}
> > << TypeName = TN->getText();
> > > LineNum = TN->getLine(); IsStruct = TRUE;>>     )@@ -875,19 +876,19
> > @@
> > > vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName,
> > UINT32
> > > TypeSize,
> > >                  memcpy (ByteOffset, &Data_U64,
> > TypeSize);               }else if (strcmp
> > > ("UINT32", TypeName) == 0) {                 Data_U32 =
> > _STOU32(RD->getText(),
> > > RD->getLine());-                memcpy (ByteOffset, &Data_U32,
> > TypeSize);
> > > +                memcpy (ByteOffset, &Data_U32,
> > TypeSize);               }else if (strcmp
> > > ("UINT16", TypeName) == 0) {                 Data_U16 =
> > _STOU16(RD->getText(),
> > > RD->getLine());-                memcpy (ByteOffset, &Data_U16,
> > TypeSize);
> > > +                memcpy (ByteOffset, &Data_U16,
> > TypeSize);               }else if (strcmp
> > > ("UINT8", TypeName) == 0) {                 Data_U8 =
> > _STOU8(RD->getText(), RD-
> > > >getLine());-                memcpy (ByteOffset, &Data_U8,
> TypeSize);
> > > +                memcpy (ByteOffset, &Data_U8,
> > TypeSize);               }else if (strcmp
> > > ("BOOLEAN", TypeName)== 0) {                 Data_BL =
> > _STOU8(RD->getText(),
> > > RD->getLine());-                memcpy (ByteOffset, &Data_BL,
> > TypeSize);
> > > +                memcpy (ByteOffset, &Data_BL,
> > TypeSize);               }else if (strcmp
> > > ("EFI_STRING_ID", TypeName) == 0) {                 Data_SID =
> > _STOSID(RD-
> > > >getText(), RD->getLine());-                memcpy (ByteOffset,
> > &Data_SID,
> > > TypeSize);
> > +                memcpy (ByteOffset,
> > > &Data_SID, TypeSize);               }             } else
> > > {               gCVfrVarDataTypeDB.GetDataFieldInfo(TFName,
> > FieldOffset,
> > > FieldType, FieldSize, BitField);@@ -975,7 +976,15 @@
> > > vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName,
> > UINT32
> > > TypeSize,
> > >   vfrStatementDefaultStore :   << UINT16  DefaultId =
> > > EFI_HII_DEFAULT_CLASS_STANDARD; >>-  D:DefaultStore
> > N:StringIdentifier
> > > ","+  D:DefaultStore N:StringIdentifier ","             <<+
> > > if (mIsCatchDefaultEnable) {+
> > > gCVfrErrorHandle.HandleWarning (+
> > > VFR_WARNING_UNSUPPORTED,+
> > D-
> > > >getLine(),+
> > D-
> > > >getText()+
> >        );+
> >  }+
> > >                                                     >>
> > Prompt "=" "STRING_TOKEN" "\(" S:Number
> > > "\)"   {     "," Attribute "=" A:Number                      <<
> > DefaultId = _STOU16(A-
> > > >getText(), A->getLine()); >>@@ -1074,7 +1083,7 @@
> > > vfrStatementVarStoreEfi :
> > >      | U64:"UINT64" ","                              <<
> > TypeName = U64->getText();
> > > LineNum = U64->getLine(); >>     | D:"EFI_HII_DATE" ","
> > <<
> > > TypeName = D->getText(); LineNum = D->getLine(); >>     |
> > T:"EFI_HII_TIME"
> > > ","                          << TypeName = T->getText(); LineNum
> =
> > T->getLine(); >>-    |
> > > R:"EFI_HII_REF" ","                           << TypeName =
> > R->getText(); LineNum = R-
> > > >getLine(); >>    +    | R:"EFI_HII_REF" ","
> > << TypeName = R-
> > > >getText(); LineNum = R->getLine(); >>   )   {     VarId "="
> ID:Number
> > ","
> > > <<@@ -1092,8 +1101,8 @@ vfrStatementVarStoreEfi :
> > >    (     Name    "=" SN:StringIdentifier ","             <<
> > StoreName = SN-
> > > >getText();   >>    |-    Name    "=" "STRING_TOKEN" "\("
> > VN:Number "\)" ","  -
> > > VarSize "=" N:Number ","                        << +    Name
> > "=" "STRING_TOKEN"
> > > "\(" VN:Number "\)" ","+    VarSize "=" N:Number ","
> > <<
> > > IsUEFI23EfiVarstore = FALSE;
> > StoreName =
> > > gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText(),
> VN-
> > > >getLine()));
> > if (StoreName == NULL) {@@ -
> > > 1116,7 +1125,7 @@ vfrStatementVarStoreEfi :
> > >
> > break;
> > case 8:
> > > TypeName = (CHAR8 *) "UINT64";-
> > break; +
> > > break;
> > default:
> > > _PCATCH (VFR_RETURN_UNSUPPORTED, N); break;@@ -1124,7 +1133,7
> @@
> > > vfrStatementVarStoreEfi :
> > >                                                      >>   )
> -
> > Uuid "=" guidDefinition[Guid]
> > > << +  Uuid "=" guidDefinition[Guid]                     <<
> > > if (IsUEFI23EfiVarstore)
> > >
> >
> {                                                        _PCAT
> > CH(gCVfrDataStorage.DeclareBufferVarS
> > > tore
> > (
> >                         StoreName,@@ -1150,7
> > > +1159,7 @@ vfrStatementVarStoreEfi :
> > >                                                         } 
> > > VSEObj.SetGuid (&Guid);
> > VSEObj.SetVarStoreId
> > > (VarStoreId);-
> > +
> > > VSEObj.SetSize ((UINT16) Size);
> > > VSEObj.SetName (StoreName);
> > if
> > > (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {@@ -1184,7
> > > +1193,7 @@ vfrStatementVarStoreNameValue :
> > >                                                      >>   }
> > (-    Name "=" "STRING_TOKEN" "\("
> > > N:Number "\)" ","  << +    Name "=" "STRING_TOKEN" "\(" N:Number
> > "\)" ","
> > > <<                                                        if
> > (!Created)
> > >
> >
> {                                                          _PC
> > ATCH(gCVfrDataStorage.DeclareNameVar
> > > StoreBegin (SN->getText(), VarStoreId), SN); Created = TRUE;@@
> > > -1245,12 +1254,12 @@ vfrStatementDisableIfFormSet :
> > >  vfrStatementSuppressIfFormSet :   << CIfrSuppressIf SIObj;>>
> > L:SuppressIf
> > > <<-
> > SIObj.SetLineNo(L->getLine()); +
> > >
> > SIObj.SetLineNo(L->getLine());
> >                   >>   { FLAGS "="
> > > flagsField ( "\|" flagsField )* "," }   vfrStatementExpression[0] ";"
> > > vfrFormSetList-  E: EndIf +  E: EndIf   ";"
> > <<
> > > CRT_END_OP (E); >>   ; @@ -1491,7 +1500,7 @@
> > vfrQuestionDataFieldName
> > > [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
> > >    (     SN2:StringIdentifier                            <<
> > _STRCAT (&VarIdStr, SN2-
> > > >getText()); LineNo = SN2->getLine(); >>     (-      "."
> > << +
> > > "."                                           <<
> > _STRCAT
> > > (&VarIdStr, ".");
> > if
> > > (mConstantOnlyInExpression)
> > >
> >
> {                                                          _PC
> > ATCH(VFR_RETURN_CONSTANT_ONLY,
> > > LineNo);@@ -1518,7 +1527,7 @@ vfrQuestionDataFieldName 
> > > [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
> > >    ;  vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> > > BOOLEAN &ListType] :-  <<  +  <<     EFI_GUID    Guid;
> > BOOLEAN     Negative =
> > > FALSE;     BOOLEAN     IntDecStyle = FALSE;@@ -1634,11 +1643,11
> > @@
> > > vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value,
> > BOOLEAN
> > > &ListType]
> > >    | Z:Zero                                          <<
> > $Value.u8     = _STOU8(Z->getText(), Z-
> > > >getLine()); >>   | HOUR:Number ":" MINUTE:Number ":"
> > SECOND:Number <<
> > > $Value.time   = _STOT(HOUR->getText(), MINUTE->getText(),SECOND-
> > > >getText(), HOUR->getLine()); >>   | YEAR:Number "/" MONTH:Number
> > "/"
> > > DAY:Number     << $Value.date   = _STOD(YEAR->getText(),
> > MONTH->getText(),
> > > DAY->getText(), YEAR->getLine()); >>-  | QI:Number";" FI:Number";"
> > > guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)" +  | 
> > > QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\("
> > > DP:Number "\)"
> > << $Value.ref    = _STOR(QI-
> > > >getText(), FI->getText(), &Guid, DP->getText(), QI->getLine()); >>   |
> > > "STRING_TOKEN" "\(" S1:Number "\)"              << $Value.string =
> > _STOSID(S1-
> > > >getText(), S1->getLine()); >>   | "\{"
> > << ListType =
> > > TRUE; >>-      L1:Number
> > << +      L1:Number
> > > <<
> > switch (Type)
> > >
> >
> {                                                          case
> > EFI_IFR_TYPE_NUM_SIZE_8 :
> > > Type8[Index]  = _STOU8(L1->getText(), L1->getLine());@@ -1658,8
> > > +1667,8 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> > > &Value, BOOLEAN &ListType]
> > >
> >
> Index++;                                                     >>
> > (-
> > > "," -        L2:Number                                   << +
> > ","+        L2:Number
> > > <<
> > switch (Type)
> > >
> >
> {                                                          case
> > EFI_IFR_TYPE_NUM_SIZE_8 :
> > > Type8[Index]  = _STOU8(L2->getText(), L2->getLine());@@ -1679,7
> > > +1688,7 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE
> > > &Value, BOOLEAN &ListType]
> > >
> > >
> >
> Index++;                                                     >>
> >        )*-    "\}"                                           +
> > > "\}"   ;
> > >
> >
> //************************************************************
> > **
> > > ***************@@ -1714,7 +1723,7 @@ vfrFormDefinition :
> > >    ;  vfrFormMapDefinition :-  << +  <<     CIfrFormMap *FMapObj
> =
> > NULL;
> > > UINT32      FormMapMethodNumber = 0;     EFI_GUID
> Guid;@@
> > -1775,11
> > > +1784,15 @@ vfrStatementDefault :
> > >       CIfrNumeric           *NumericQst   = NULL;    >>-
> > D:Default
> > > +  D:Default                                         <<+
> > if
> > > (mIsCatchDefaultEnable) {+
> > > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > > >getLine());+
> >       }+
> >>
> > > (     (-      "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(),
> > *Val,
> > > ArrayType] ","  -
> > << +      "="
> > > vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType]
> ","+
> > > <<
> if
> > (gCurrentMinMaxData != NULL &&
> > > gCurrentMinMaxData->IsNumericOpcode())
> > >
> >
> {                                                           //c
> > heck default value is valid for Numeric
> > > Opcode
> > NumericQst = (CIfrNumeric *)
> > > gCurrentQuestion;@@ -1888,14 +1901,14 @@ vfrStatementDefault :
> > >          vfrStatementValue ","                       << CIfrEnd
> > EndObj1;
> > > EndObj1.SetLineNo(D->getLine()); >>     )     {-      DefaultStore
> "="
> > > SN:StringIdentifier ","      << +      DefaultStore "="
> SN:StringIdentifier
> > ","      <<
> > > _PCATCH(gCVfrDefaultStore.GetDefaultId (SN->getText(), 
> > > &DefaultId), SN); if (DObj != NULL) {-
> > DObj->SetDefaultId
> > > (DefaultId);
> > -                                                        } +
> > > DObj->SetDefaultId
> > (DefaultId);+
> >     }
> > > if (DObj2 != NULL) {-
> > DObj2->SetDefaultId
> > > (DefaultId); +
> > DObj2->SetDefaultId
> > >
> > (DefaultId);
> >     }                                                     >>
> > >  }@@ -1917,8 +1930,8 @@ vfrStatementDefault :
> > >
> >         );
> >      }
> > >                                              }-
> > if (DObj  != NULL)
> > > {delete DObj;} -
> > if (DObj2 != NULL) {delete
> > > DObj2;} +
> > if (DObj  != NULL) {delete DObj;}+
> > > if (DObj2 != NULL) {delete
> >
> DObj2;}                                                     >>
> >   )   ;@@ -
> > > 1970,11 +1983,15 @@ vfrStatementInvalid :
> > >    ;  flagsField :-  Number -  | InteractiveFlag -  | 
> > > ManufacturingFlag -  | DefaultFlag -  | ResetRequiredFlag +  
> > > Number+
> > > | InteractiveFlag+  |
> > > ManufacturingFlag+  | D:DefaultFlag
> > <<+
> > > if (mIsCatchDefaultEnable) {+
> > > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > > >getLine());+
> >         }+
> > > >>+  | ResetRequiredFlag   | ReconnectRequiredFlag   |
> > N:NVAccessFlag
> > > <<
> > gCVfrErrorHandle.HandleWarning (@@ -
> > > 1989,7 +2006,7 @@ flagsField :
> > >
> > > L->getLine(),
> > >
> > L->getText()
> >          );-
> > >                                                        >>
> >
> +                                                       >>   ;
> > > vfrStatementValue :@@ -2001,13 +2018,13 @@ vfrStatementValue :
> > >  vfrStatementRead :   << CIfrRead RObj; >>   R:Read
> > > << RObj.SetLineNo(R->getLine()); >>-  vfrStatementExpression[0] ";" +
> > > vfrStatementExpression[0] ";"   ;  vfrStatementWrite :   << CIfrWrite
> > WObj; >>
> > > W:Write                                              <<
> > WObj.SetLineNo(W->getLine()); >>-
> > > vfrStatementExpression[0] ";" +  vfrStatementExpression[0] ";"   ;
> > > vfrStatementSubTitle :@@ -2140,7 +2157,7 @@ vfrStatementGoto :
> > >        FormId "=" F3:Number ","                         <<
> > RefType = 2; FId = _STOFID(F3-
> > > >getText(), F3->getLine()); >>       Question "="       (-
> > QN3:StringIdentifier
> > > ","                     << +          QN3:StringIdentifier ","
> > <<
> > > mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, 
> > > BitMask); if (QId == EFI_QUESTION_ID_INVALID)
> > >
> > {
> > _PCATCH(VFR_RETURN_UNDEFINED,
> > > QN3);@@ -2222,7 +2239,7 @@ vfrStatementGoto :
> > >      "," Key "=" KN:Number                              <<
> > AssignQuestionKey (*QHObj,
> > > KN); >>   }   {-    E:"," +    E:","
> > vfrStatementQuestionOptionList                   <<
> > > OHObj->SetScope(1); CRT_END_OP (E);>>   }   ";"
> > > << 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;}>>@@ -2511,20 +2528,20 @@ 
> > > minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
> > >    {     "default" "=" N:Number ","                         <<
> > > switch (KeyValue) {-
> > case 0: +
> > > case 0:
> > D.Year  = _STOU16(N->getText(), N-
> > > >getLine());
> > if (D.Year < _STOU16 (MinN-
> > > >getText(), MinN->getLine()) || D.Year > _STOU16 (MaxN->getText(),
> > > >MaxN-
> > > >getLine()))
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value
> > must
> > > be between Min year and Max
> > year.");
> >      }
> > > break;-
> > case 1: -
> > > D.Month = _STOU8(N->getText(), N->getLine()); + case 1:+
> > D.Month = _STOU8(N->getText(), N-
> > > >getLine());
> > if (D.Month < 1 || D.Month > 12)
> > >
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value 
> > > must be between 1 and
> > 12.");
> >     }
> > > break;-
> > case 2: -
> > > D.Day = _STOU8(N->getText(), N->getLine()); + case 2:+
> > D.Day = _STOU8(N->getText(), N-
> > > >getLine());
> > if (D.Day < 1 || D.Day > 31)
> > >
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value
> > must
> > > be between 1 and
> > 31.");
> >     }@@ -2570,7
> > > +2587,7 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
> > >       BOOLEAN MinNegative = FALSE;      BOOLEAN MaxNegative =
> > FALSE;   >>-
> > > Minimum   "=" +  Minimum   "="   {     "\-"
> > <<
> > > MinNegative = TRUE; >>   }@@ -2659,8 +2676,8 @@
> > > vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
> > >
> >  }
>  }
> > >                                       >>-  Maximum   "=" -
> > { +  Maximum   "="+  {     "\-"
> > > << MaxNegative = TRUE; >>   }   A:Number ","
> > <<@@ -
> > > 2889,7 +2906,7 @@ vfrStatementNumeric :
> > >
>  }
> >                                                         >>
> > > vfrStatementQuestionOptionList-  E:EndNumeric
> > << +
> > > E:EndNumeric                                         <<
> > > CRT_END_OP (E);
> > if (GuidObj != NULL)
> > >
> > {
> > GuidObj->SetScope(1);@@ -3131,7
> > > +3148,7 @@ vfrStatementString :
> > >    {     Key "=" KN:Number ","                              <<
> > AssignQuestionKey (SObj,
> > > KN); >>   }-  MinSize "=" MIN:Number ","
> > << +  MinSize "="
> > > MIN:Number ","                           <<
> > > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); StringMinSize = 
> > > _STOU8(MIN->getText(), MIN->getLine()); if 
> > > (_STOU64(MIN->getText(),
> > > MIN->getLine()) > StringMinSize) {@@ -3141,7
> > > +3158,7 @@ vfrStatementString :
> > >
>  }
> > > SObj.SetMinSize
> > (StringMinSize);
> >        >>-  MaxSize
> > > "=" MAX:Number ","                           << +  MaxSize "="
> > MAX:Number ","
> > > <<
> > StringMaxSize = _STOU8(MAX->getText(),
> > > MAX->getLine());
> > if (_STOU64(MAX-
> > > >getText(), MAX->getLine()) > StringMaxSize)
> > >
> > {
> > _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize
> > takes
> > > only one byte, which can't be larger than 0xFF.");@@ -3185,7 
> > > +3202,7 @@ vfrStatementPassword :
> > >    {     Key "=" KN:Number ","                              <<
> > AssignQuestionKey (PObj,
> > > KN); >>   }-  MinSize "=" MIN:Number ","
> > << +  MinSize "="
> > > MIN:Number ","                           <<
> > > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); PasswordMinSize = 
> > > _STOU16(MIN->getText(), MIN->getLine()); if 
> > > (_STOU64(MIN->getText(),
> > > MIN->getLine()) > PasswordMinSize) {@@ -
> > > 3195,7 +3212,7 @@ vfrStatementPassword :
> > >
>  }
> > > PObj.SetMinSize
> > (PasswordMinSize);
> >           >>-
> > > MaxSize "=" MAX:Number ","                           << +
> > MaxSize "=" MAX:Number
> > > ","                           <<
> > PasswordMaxSize =
> > > _STOU16(MAX->getText(), MAX->getLine());
> > if
> > > (_STOU64(MAX->getText(), MAX->getLine()) > PasswordMaxSize)
> > >
> > {
> > _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password
> MaxSize
> > takes
> > > only two byte, which can't be larger than 0xFFFF.");@@ -3230,12
> > > +3247,12 @@ vfrStatementOrderedList :
> > >    >>   L:OrderedList
> > << OLObj.SetLineNo(L->getLine());
> > > gIsOrderedList = TRUE;>>   vfrQuestionHeader[OLObj] ","-
> > > << +
> <<
> > > VarArraySize = _GET_CURRQEST_ARRAY_SIZE(); OLObj.SetMaxContainers
> > > ((UINT8) (VarArraySize > 0xFF ? 0xFF :
> > >
> > VarArraySize));
> >       >>   {-    MaxContainers "="
> > > M:Number ","                     << +    MaxContainers "="
> > M:Number ","
> > > <<
> > if (_STOU64(M->getText(), M->getLine()) >
> > > _STOU8(M->getText(), M->getLine()))
> > >
> > {
> > _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList 
> > > MaxContainers takes only one byte, which can't be larger than
> > >
> > 0xFF.");
> >    } else if (VarArraySize != 0 &&
> > > _STOU8(M->getText(), M->getLine()) > VarArraySize) {@@ -3328,19
> > > +3345,19 @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8
> > KeyValue] :
> > >    {     "default" "=" N:Number ","                         <<
> > > switch (KeyValue) {-
> > case 0: -
> > > T.Hour   = _STOU8(N->getText(), N->getLine()); +
> > > case 0:+
> > T.Hour   = _STOU8(N->getText(), N-
> > > >getLine());
> > if (T.Hour > 23)
> > >
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value
> > must
> > > be between 0 and
> > 23.");
> >     }
> > > break;-
> > case 1: -
> > > T.Minute = _STOU8(N->getText(), N->getLine()); + case 1:+
> > T.Minute = _STOU8(N->getText(), N-
> > > >getLine());
> > if (T.Minute > 59)
> > >
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value 
> > > must be between 0 and
> > 59.");
> >     }
> > > break;-
> > case 2: +
> > > case 2:
> > T.Second = _STOU8(N->getText(), N-
> > > >getLine());
> > if (T.Second > 59)
> > >
> > {
> >   _PCATCH
> > > (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value 
> > > must be between 0 and 59.");@@ -3419,11 +3436,11 @@ 
> > > vfrStatementStatListOld :
> > >    ;  vfrStatementDisableIfStat :-  << -    CIfrDisableIf DIObj; +  <<+
> > > CIfrDisableIf DIObj;   >>   L:DisableIf
> > <<
> > > DIObj.SetLineNo(L->getLine()); >>-  vfrStatementExpression[0] ";" +
> > > vfrStatementExpression[0] ";"   ( vfrStatementStatList )*   E:EndIf
> > > << CRT_END_OP (E); >>   ";"@@ -3548,8 +3565,8 @@
> > > vfrStatementWarningIf :
> > >    ;  vfrStatementDisableIfQuest :-  << -    CIfrDisableIf DIObj; +
> > <<+
> > > CIfrDisableIf DIObj;   >>   L:DisableIf
> > <<
> > > DIObj.SetLineNo(L->getLine()); >>   vfrStatementExpression[0] ";"@@ -
> > > 3616,15 +3633,15 @@ vfrStatementOneOfOption :
> > >       UINT32             *Type32       = (UINT32 *) ValueList;
> > UINT64
> > > *Type64       = (UINT64 *) ValueList;   >>-  L:Option
> > <<
> > > +  L:Option                                             <<
> > if
> > > (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER)
> > >
> > {
> > _PCATCH (VFR_RETURN_FATAL_ERROR, L-
> > > >getLine(), "Get data type
> > >
> > error.");
> >    }
>  >
> > >-
> > > Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","      +  Text  "="
> > > "STRING_TOKEN" "\(" S:Number "\)" ","   Value "="
> > > vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] 
> > >","-  << +
> <<
> > if
> > > (gCurrentMinMaxData != NULL)
> > {
> > //set
> > > min/max value for oneof opcode
> > UINT64
> > > Step =
> gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE(),
> > > _GET_CURRQEST_VARTINFO().mIsBitVar);@@ -3696,7 +3713,7 @@ 
> > > vfrStatementOneOfOption :
> > >
> > Size += OFFSET_OF
> > > (EFI_IFR_ONE_OF_OPTION, Value);
> > OOOObj =
> > > new CIfrOneOfOption((UINT8)Size);
> > OOOObj-
> > > >SetLineNo(L->getLine());-
> > OOOObj-
> > > >SetOption (_STOSID(S->getText(), S->getLine())); +
> > > OOOObj->SetOption (_STOSID(S->getText(), S->getLine()));
> > > if (ArrayType)
> > {
> > OOOObj->SetType
> > >
> > (EFI_IFR_TYPE_BUFFER);
> >                  } else {@@ -3706,7
> > > +3723,7 @@ vfrStatementOneOfOption :
> > >
> > OOOObj->SetType
> > >
> > (_GET_CURRQEST_DATATYPE());
> >                          }
> > >                                       }-
> > OOOObj->SetValue
> > > (*Val); +
> > OOOObj->SetValue
> > >
> >
> (*Val);                                                        >
> >
> > F:FLAGS "="
> > > vfrOneOfOptionFlags[*OOOObj, F->getLine()] <<@@ -3790,7 +3807,12
> @@
> > > oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
> > >    | RestStyleFlag                                      <<
> > $HFlags |= 0x20; >>   |
> > > ReconnectRequiredFlag                              << $HFlags
> |=
> > 0x40; >>   |
> > > ManufacturingFlag                                  << $LFlags
> |=
> > 0x20; >>-  | DefaultFlag
> > > << $LFlags |= 0x10; >>+  | D:DefaultFlag
> > <<+
> > > $LFlags |= 0x10;+
> > if (mIsCatchDefaultEnable)
> > > {+
> > > DefaultValueError(VFR_RETURN_UNSUPPORTED, D-
> > > >getLine());+
> >           }+
> > >  >>   | A:NVAccessFlag
> <<
> > > gCVfrErrorHandle.HandleWarning
> > >
> > (
> > VFR_WARNING_OBSOLETED_FRAMEWORK
> > > _OPCODE,@@ -3963,7 +3985,7 @@ vfrStatementExpression [UINT32 
> > > RootLevel, UINT32 ExpOpCount = 0] :
> > >
> >    }
> >    }
> > >                                              }-
> > +
> > > if ($RootLevel == 0)
> > {
> > _CLEAR_SAVED_OPHDR
> > > ();
> > mCIfrOpHdrIndex --;@@ -4405,10
> > > +4427,10 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 &
> ExpOpCount] :
> > >
> > for (Index = 0; Index < ListLen; Index++)
> > >
> > {
> >   EILObj.SetValueList (Index,
> > >
> > ValueList[Index]);
> >              }-
> > > +
> > > + EILObj.UpdateIfrBuffer();-
> > > _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());
> > > -
> > +
> > > _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());+ if 
> > > (QId == EFI_QUESTION_ID_INVALID)
> > >
> > {
> >   EILObj.SetQuestionId (QId, VarIdStr,
> > >
> > LineNo);
> >       }@@ -4458,9 +4480,9 @@
> > > stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> > >    >>   L:StringRef   "\("-      ( +
> > (         "STRING_TOKEN"-        "\(" +        "\("
> > > S:Number << RefStringId = _STOSID(S->getText(), S->getLine()); >>
> > "\)"
> > > | I:Number << RefStringId = _STOSID(I->getText(), I->getLine());
> > > | >>@@
> > > | -
> > > 4499,10 +4521,10 @@ getExp[UINT32 & RootLevel, UINT32 &
> > ExpOpCount] :
> > >       Info.mVarStoreId = 0;   >>   L:Get-  "\(" +  "\("
> > vfrStorageVarId[Info,
> > > VarIdStr, FALSE]       {"\|" FLAGS "=" numericVarStoreType
> [VarType] }-
> > "\)"
> > > << +  "\)"                                                 <<
> > >
> >
> {                                                             i
> > f (Info.mVarStoreId == 0)
> > >
> > {
> >   // support Date/Time question@@ -
> > > 4549,9 +4571,9 @@ getExp[UINT32 & RootLevel, UINT32 &
> ExpOpCount] :
> > >
> > > _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> > > >getLine(), "Get/Set opcode don't support data
> > >
> > array");
> >        }
> >        }
> > > -
> > CIfrGet GObj(L->getLine()); -
> > > _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine()); - 
> > > GObj.SetVarInfo (&Info); +
> > CIfrGet GObj(L-
> > > >getLine());+
> > _SAVE_OPHDR_COND (GObj,
> > > ($ExpOpCount == 0), L->getLine());+ GObj.SetVarInfo (&Info);
> > delete[] VarIdStr;
> > >
> > $ExpOpCount++;
> >            }@@ -4608,7 +4630,7 @@
> > > question23refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> > >        {         Uuid "=" guidDefinition[Guid] ","
> > << Type = 0x3; >>       }-
> > > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +
> > > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"
> > > <<
> > switch (Type) {@@ -4675,9 +4697,9 @@
> > > setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> > >    "\("      vfrStorageVarId[Info, VarIdStr, FALSE]      {"\|" FLAG
> "="
> > > numericVarStoreType [VarType] }-     ","
> > > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] +     ","
> > > vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   "\)"-
> > > << +
> <<
> > >
> >
> {                                                             i
> > f (Info.mVarStoreId == 0)
> > >
> > {
> >   // support Date/Time question@@ -
> > > 4724,8 +4746,8 @@ setExp[UINT32 & RootLevel, UINT32 &
> ExpOpCount] :
> > >
> > > _PCATCH(VFR_RETURN_UNSUPPORTED, L-
> > > >getLine(), "Get/Set opcode don't support data
> > >
> > array");
> >        }
> >        }
> > > -
> > CIfrSet TSObj(L->getLine()); -
> > > TSObj.SetVarInfo (&Info); +
> > CIfrSet TSObj(L-
> > > >getLine());+
> > TSObj.SetVarInfo (&Info);
> > > delete[] VarIdStr;
> > >
> > $ExpOpCount++;
> >            }@@ -4808,9 +4830,9 @@
> > > spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
> > >    ;  vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:-
> > > L:Map
> > > -  "\(" -  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]  +
> > L:Map+
> > > "\("+  vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]   ":"
> > > << { CIfrMap MObj(L->getLine()); } >>
> > (     vfrStatementExpression[0]@@ -
> > > 4837,6 +4859,7 @@ spanFlags [UINT8 & Flags] :
> > >  class EfiVfrParser { << private:+  BOOLEAN
> > mIsCatchDefaultEnable;
> > > UINT8               mParserStatus;   BOOLEAN
> > mConstantOnlyInExpression;
> > > @@ -4880,6 +4903,7 @@ public:
> > >    VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN
> > ANTLRTokenPtr);
> > > VOID                _PCATCH (IN EFI_VFR_RETURN_CODE, IN
> UINT32);
> > VOID
> > > _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);+
> > VOID
> > > DefaultValueError (IN EFI_VFR_RETURN_CODE, IN UINT32);    VOID
> > > syn     (ANTLRAbstractToken  *, ANTLRChar *, SetWordType *,
> > > ANTLRTokenType, INT32); @@ -4909,6 +4933,7 @@ public:
> > >    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);   VOID
> > IdEqListDoSpecial     (IN
> > > UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN
> > > UINT16, IN UINT16 *);   VOID                SetOverrideClassGuid
> > (IN EFI_GUID *);+
> > > VOID                SetIsCatchDefaultEnable (BOOLEAN
> > IsCatchDefaultEnable); >> }
> > > @@ -5086,6 +5111,17 @@ EfiVfrParser::_PCATCH (
> > >    mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError
> > > (ReturnCode, LineNum, (CHAR8 *) ErrorMsg); }
> > > +VOID+EfiVfrParser::DefaultValueError (+  IN EFI_VFR_RETURN_CODE
> > > ReturnCode,+  IN UINT32              LineNum+  )+{+  CHAR8
> > ErrorMsg[100];+
> > > sprintf(ErrorMsg, "please remove the default value / defaultstore in
> > > line %d", LineNum);+  mParserStatus = mParserStatus +
> > > gCVfrErrorHandle.HandleError (ReturnCode, LineNum, ErrorMsg);+}+
> > > VOID
> > EfiVfrParser::syn
> > > (   ANTLRAbstractToken  *Tok,@@ -5682,12 +5718,18 @@
> > > EfiVfrParser::IdEqListDoSpecial (
> > >    } } -VOID +VOID EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID
> > > *OverrideClassGuid) {   mOverrideClassGuid = OverrideClassGuid; }
> > > +VOID+EfiVfrParser::SetIsCatchDefaultEnable (BOOLEAN
> > > IsCatchDefaultEnable)+{+  mIsCatchDefaultEnable =
> > IsCatchDefaultEnable;+}+
> > > VOID EfiVfrParser::CheckDuplicateDefaultValue (   IN EFI_DEFAULT_ID
> > > DefaultId,--
> > > 2.26.2.windows.1
> 
> 
> 
> 
> 
> 
> 
> 






-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114396): https://edk2.groups.io/g/devel/message/114396
Mute This Topic: https://groups.io/mt/103952468/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-01-25 12:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-12  9:01 [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature Yuting Yang
2023-12-12  9:04 ` Yuwei Chen
2023-12-12  9:12   ` Yuting Yang
2023-12-21  6:43     ` Zhang, Zifeng
2023-12-22  5:41       ` Yuting Yang
     [not found]         ` <023101da36cf$a50bb8f0$ef232ad0$@byosoft.com.cn>
2023-12-25  7:10           ` Yuting Yang
2024-01-12  5:20             ` Zhang, Zifeng
2024-01-16 15:03               ` 回复: " gaoliming via groups.io
2024-01-17  2:18                 ` Zhang, Zifeng
2024-01-25  9:27                 ` Zhang, Zifeng
2023-12-25  1:23       ` [edk2-devel] 回复: " gaoliming via groups.io
2023-12-25  7:14         ` [edk2-devel] " Zhang, Zifeng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox