diff --git a/BaseTools/Source/C/VfrCompile/VfrError.cpp b/BaseTools/Source/C/VfrCompile/VfrError.cpp index b5167e515d..3be2bd84db 100644 --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp @@ -53,6 +53,7 @@ static SVFR_WARNING_HANDLE VFR_WARNING_HANDLE_TABLE [] = { { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value re-defined with different value"}, { VFR_WARNING_STRING_TO_UINT_OVERFLOW, ": String to UINT* Overflow"}, { 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" } }; diff --git a/BaseTools/Source/C/VfrCompile/VfrError.h b/BaseTools/Source/C/VfrCompile/VfrError.h index c0b4ec64a2..8241ce2f84 100644 --- a/BaseTools/Source/C/VfrCompile/VfrError.h +++ b/BaseTools/Source/C/VfrCompile/VfrError.h @@ -51,6 +51,7 @@ typedef enum { VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0, VFR_WARNING_STRING_TO_UINT_OVERFLOW, VFR_WARNING_ACTION_WITH_TEXT_TWO, + VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, VFR_WARNING_CODEUNDEFINED } EFI_VFR_WARNING_CODE; diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g index 4c42aa85c8..9688aad924 100644 --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g @@ -1184,9 +1184,35 @@ questionheaderFlagsField[UINT8 & Flags] : ReadOnlyFlag << $Flags |= 0x01; >> | InteractiveFlag << $Flags |= 0x04; >> | ResetRequiredFlag << $Flags |= 0x10; >> - | OptionOnlyFlag << $Flags |= 0x80; >> - | NVAccessFlag - | LateCheckFlag + | O:OptionOnlyFlag << + if (mCompatibleMode) { + $Flags |= 0x80; + } else { + gCVfrErrorHandle.HandleWarning ( + VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, + O->getLine(), + O->getText() + ); + } + >> + | N:NVAccessFlag << + if (!mCompatibleMode) { + gCVfrErrorHandle.HandleWarning ( + VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, + N->getLine(), + N->getText() + ); + } + >> + | L:LateCheckFlag << + if (!mCompatibleMode) { + gCVfrErrorHandle.HandleWarning ( + VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, + L->getLine(), + L->getText() + ); + } + >> ; vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFlag = TRUE] : @@ -1617,8 +1643,29 @@ vfrStatementInvalid : ; flagsField : - Number | InteractiveFlag | ManufacturingFlag | DefaultFlag | - NVAccessFlag | ResetRequiredFlag | LateCheckFlag + Number + | InteractiveFlag + | ManufacturingFlag + | DefaultFlag + | ResetRequiredFlag + | N:NVAccessFlag << + if (!mCompatibleMode) { + gCVfrErrorHandle.HandleWarning ( + VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, + N->getLine(), + N->getText() + ); + } + >> + | L:LateCheckFlag << + if (!mCompatibleMode) { + gCVfrErrorHandle.HandleWarning ( + VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, + L->getLine(), + L->getText() + ); + } + >> ; vfrStatementValue : @@ -3042,11 +3089,31 @@ oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] : | "OPTION_DEFAULT" << $LFlags |= 0x10; >> | "OPTION_DEFAULT_MFG" << $LFlags |= 0x20; >> | InteractiveFlag << $HFlags |= 0x04; >> - | NVAccessFlag << $HFlags |= 0x08; >> | ResetRequiredFlag << $HFlags |= 0x10; >> - | LateCheckFlag << $HFlags |= 0x20; >> | ManufacturingFlag << $LFlags |= 0x20; >> | DefaultFlag << $LFlags |= 0x10; >> + | A:NVAccessFlag << + if (mCompatibleMode) { + $HFlags |= 0x08; + } else { + gCVfrErrorHandle.HandleWarning ( + VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, + A->getLine(), + A->getText() + ); + } + >> + | L:LateCheckFlag << + if (mCompatibleMode) { + $HFlags |= 0x20; + } else { + gCVfrErrorHandle.HandleWarning ( + VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, + L->getLine(), + L->getText() + ); + } + >> ; vfrStatementLabel :