BaseTools/VfrCompile: Remove framework VFR support

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1464

Currently there is no usage of framework VFR,
remove the support from VfrCompile.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Dandan Bi 2019-04-16 16:36:56 +08:00 committed by Liming Gao
parent 792f0d4f12
commit 1b72fd5121
8 changed files with 15 additions and 215 deletions

@ -2,7 +2,7 @@
VfrCompiler main class and main function.
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -74,7 +74,6 @@ CVfrCompiler::OptionInitialization (
mOptions.IncludePaths = NULL;
mOptions.SkipCPreprocessor = TRUE;
mOptions.CPreprocessorOptions = NULL;
mOptions.CompatibleMode = FALSE;
mOptions.HasOverrideClassGuid = FALSE;
mOptions.WarningAsError = FALSE;
mOptions.AutoDefault = FALSE;
@ -142,8 +141,6 @@ CVfrCompiler::OptionInitialization (
}
AppendCPreprocessorOptions (Argv[Index]);
} else if (stricmp(Argv[Index], "-c") == 0 || stricmp(Argv[Index], "--compatible-framework") == 0) {
mOptions.CompatibleMode = TRUE;
} else if (stricmp(Argv[Index], "-s") == 0|| stricmp(Argv[Index], "--string-db") == 0) {
Index++;
if ((Index >= Argc) || (Argv[Index][0] == '-')) {
@ -561,8 +558,6 @@ CVfrCompiler::Usage (
" create an IFR HII pack file",
" -n, --no-pre-processing",
" do not preprocessing input file",
" -c, --compatible-framework",
" compatible framework vfr file",
" -s, --string-db",
" input uni string package file",
" -g, --guid",
@ -685,7 +680,6 @@ CVfrCompiler::Compile (
goto Fail;
}
InputInfo.CompatibleMode = mOptions.CompatibleMode;
if (mOptions.HasOverrideClassGuid) {
InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;
} else {
@ -775,27 +769,6 @@ CVfrCompiler::AdjustBin (
DebugError (NULL, 0, 0001, "Error parsing vfr file", " %s.Buffer not allocated.", mOptions.VfrFileName);
}
//
// For UEFI mode, not do OpCode Adjust
//
if (mOptions.CompatibleMode) {
//
// Adjust Opcode to be compatible with framework vfr
//
Status = gCIfrRecordInfoDB.IfrRecordAdjust ();
if (Status != VFR_RETURN_SUCCESS) {
//
// Record List Adjust Failed
//
SET_RUN_STATUS (STATUS_FAILED);
return;
}
//
// Re get the IfrRecord Buffer.
//
gCIfrRecordInfoDB.IfrRecordOutput (gRBuffer);
}
return;
}
@ -853,7 +826,7 @@ CVfrCompiler::GenCFile (
goto Fail;
}
if (!mOptions.CreateIfrPkgFile || mOptions.CompatibleMode) {
if (!mOptions.CreateIfrPkgFile) {
if ((pFile = fopen (LongFilePath (mOptions.COutputFileName), "w")) == NULL) {
DebugError (NULL, 0, 0001, "Error opening output C file", "%s", mOptions.COutputFileName);
goto Fail;
@ -863,10 +836,6 @@ CVfrCompiler::GenCFile (
fprintf (pFile, "%s\n", gSourceFileHeader[Index]);
}
if (mOptions.CompatibleMode) {
gCVfrBufferConfig.OutputCFile (pFile, mOptions.VfrBaseFileName);
}
if (gCFormPkg.GenCFile (mOptions.VfrBaseFileName, pFile, &gRBuffer) != VFR_RETURN_SUCCESS) {
fclose (pFile);
goto Fail;

@ -2,7 +2,7 @@
VfrCompiler internal definitions.
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -47,7 +47,6 @@ typedef struct {
CHAR8 *IncludePaths;
bool SkipCPreprocessor;
CHAR8 *CPreprocessorOptions;
BOOLEAN CompatibleMode;
BOOLEAN HasOverrideClassGuid;
EFI_GUID OverrideClassGuid;
BOOLEAN WarningAsError;

@ -2,7 +2,7 @@
The definition of CFormPkg's member function
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -444,21 +444,10 @@ CFormPkg::GenCFile (
return Ret;
}
//
// For framework vfr file, the extension framework header will be added.
//
if (VfrCompatibleMode) {
fprintf (pFile, " // FRAMEWORK PACKAGE HEADER Length\n");
PkgLength = PkgHdr->Length + sizeof (UINT32) + 2;
_WRITE_PKG_LINE(pFile, BYTES_PRE_LINE, " ", (CHAR8 *)&PkgLength, sizeof (UINT32));
fprintf (pFile, "\n\n // FRAMEWORK PACKAGE HEADER Type\n");
PkgLength = 3;
_WRITE_PKG_LINE(pFile, BYTES_PRE_LINE, " ", (CHAR8 *)&PkgLength, sizeof (UINT16));
} else {
fprintf (pFile, " // ARRAY LENGTH\n");
PkgLength = PkgHdr->Length + sizeof (UINT32);
_WRITE_PKG_LINE(pFile, BYTES_PRE_LINE, " ", (CHAR8 *)&PkgLength, sizeof (UINT32));
}
fprintf (pFile, " // ARRAY LENGTH\n");
PkgLength = PkgHdr->Length + sizeof (UINT32);
_WRITE_PKG_LINE(pFile, BYTES_PRE_LINE, " ", (CHAR8 *)&PkgLength, sizeof (UINT32));
fprintf (pFile, "\n\n // PACKAGE HEADER\n");
_WRITE_PKG_LINE(pFile, BYTES_PRE_LINE, " ", (CHAR8 *)PkgHdr, sizeof (EFI_HII_PACKAGE_HEADER));
@ -968,7 +957,7 @@ CFormPkg::DeclarePendingQuestion (
// For undefined Efi VarStore type question
// Append the extended guided opcode to contain VarName
//
if (VarStoreType == EFI_VFR_VARSTORE_EFI || VfrCompatibleMode) {
if (VarStoreType == EFI_VFR_VARSTORE_EFI) {
CIfrVarEqName CVNObj (QId, Info.mInfo.mVarName);
CVNObj.SetLineNo (LineNo);
}

@ -2,7 +2,7 @@
The definition of CFormPkg's member function
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -95,7 +95,6 @@ struct SBufferNode {
};
typedef struct {
BOOLEAN CompatibleMode;
EFI_GUID *OverrideClassGuid;
} INPUT_INFO_TO_SYNTAX;

@ -1,7 +1,7 @@
/*++ @file
Vfr Syntax
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
--*/
@ -49,7 +49,6 @@ VfrParserStart (
)
{
ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken> VfrParser(File);
VfrParser.parser()->SetCompatibleMode (InputInfo->CompatibleMode);
VfrParser.parser()->SetOverrideClassGuid (InputInfo->OverrideClassGuid);
return VfrParser.parser()->vfrProgram();
}
@ -675,13 +674,6 @@ vfrFormSetDefinition :
>>
vfrFormSetList
E:EndFormSet <<
if (mCompatibleMode) {
//
// declare all undefined varstore and efivarstore
//
_DeclareDefaultFrameworkVarStore (GET_LINENO(E));
}
//
// Declare undefined Question so that they can be used in expression.
//
@ -5049,7 +5041,6 @@ public:
VOID _DeclareDefaultLinearVarStore (IN UINT32);
VOID _DeclareStandardDefaultStorage (IN UINT32);
VOID _DeclareDefaultFrameworkVarStore (IN UINT32);
VOID AssignQuestionKey (IN CIfrQuestionHeader &, IN ANTLRTokenPtr);
@ -5058,10 +5049,6 @@ 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 *);
//
// For framework vfr compatibility
//
VOID SetCompatibleMode (IN BOOLEAN);
>>
}
@ -5542,84 +5529,6 @@ EfiVfrParser::_STOR (
return Ref;
}
//
// framework vfr to default declare varstore for each structure
//
VOID
EfiVfrParser::_DeclareDefaultFrameworkVarStore (
IN UINT32 LineNo
)
{
SVfrVarStorageNode *pNode;
UINT32 TypeSize;
BOOLEAN FirstNode;
CONST CHAR8 VarName[] = "Setup";
FirstNode = TRUE;
pNode = gCVfrDataStorage.GetBufferVarStoreList();
if (pNode == NULL && gCVfrVarDataTypeDB.mFirstNewDataTypeName != NULL) {
//
// Create the default Buffer Var Store when no VarStore is defined.
// its name should be "Setup"
//
gCVfrVarDataTypeDB.GetDataTypeSize (gCVfrVarDataTypeDB.mFirstNewDataTypeName, &TypeSize);
CIfrVarStore VSObj;
VSObj.SetLineNo (LineNo);
VSObj.SetVarStoreId (0x1); //the first and only one Buffer Var Store
VSObj.SetSize ((UINT16) TypeSize);
//VSObj.SetName (gCVfrVarDataTypeDB.mFirstNewDataTypeName);
VSObj.SetName ((CHAR8 *) VarName);
VSObj.SetGuid (&mFormsetGuid);
#ifdef VFREXP_DEBUG
printf ("Create the default VarStoreName is %s\n", gCVfrVarDataTypeDB.mFirstNewDataTypeName);
#endif
} else {
for (; pNode != NULL; pNode = pNode->mNext) {
//
// create the default varstore opcode for not declared varstore
// the first varstore name should be "Setup"
//
if (!pNode->mAssignedFlag) {
CIfrVarStore VSObj;
VSObj.SetLineNo (LineNo);
VSObj.SetVarStoreId (pNode->mVarStoreId);
VSObj.SetSize ((UINT16) pNode->mStorageInfo.mDataType->mTotalSize);
if (FirstNode) {
VSObj.SetName ((CHAR8 *) VarName);
FirstNode = FALSE;
} else {
VSObj.SetName (pNode->mVarStoreName);
}
VSObj.SetGuid (&pNode->mGuid);
#ifdef VFREXP_DEBUG
printf ("undefined VarStoreName is %s and Id is 0x%x\n", pNode->mVarStoreName, pNode->mVarStoreId);
#endif
}
}
}
pNode = gCVfrDataStorage.GetEfiVarStoreList();
for (; pNode != NULL; pNode = pNode->mNext) {
//
// create the default efi varstore opcode for not exist varstore
//
if (!pNode->mAssignedFlag) {
CIfrVarStoreEfi VSEObj;
VSEObj.SetLineNo (LineNo);
VSEObj.SetAttributes (0x00000002); //hardcode EFI_VARIABLE_BOOTSERVICE_ACCESS attribute
VSEObj.SetGuid (&pNode->mGuid);
VSEObj.SetVarStoreId (pNode->mVarStoreId);
// Generate old efi varstore storage structure for compatible with old "VarEqVal" opcode,
// which is 3 bytes less than new structure define in UEFI Spec 2.3.1.
VSEObj.SetBinaryLength (sizeof (EFI_IFR_VARSTORE_EFI) - 3);
#ifdef VFREXP_DEBUG
printf ("undefined Efi VarStoreName is %s and Id is 0x%x\n", pNode->mVarStoreName, pNode->mVarStoreId);
#endif
}
}
}
VOID
EfiVfrParser::_DeclareDefaultLinearVarStore (
IN UINT32 LineNo
@ -5919,16 +5828,6 @@ EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID *OverrideClassGuid)
mOverrideClassGuid = OverrideClassGuid;
}
//
// For framework vfr compatibility
//
VOID
EfiVfrParser::SetCompatibleMode (IN BOOLEAN Mode)
{
mCompatibleMode = Mode;
mCVfrQuestionDB.SetCompatibleMode (Mode);
}
VOID
EfiVfrParser::CheckDuplicateDefaultValue (
IN EFI_DEFAULT_ID DefaultId,

@ -2,7 +2,7 @@
Vfr common library functions.
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -759,17 +759,6 @@ CVfrVarDataTypeDB::GetFieldOffset (
return VFR_RETURN_FATAL_ERROR;
}
//
// Framework Vfr file Array Index is from 1.
// But Uefi Vfr file Array Index is from 0.
//
if (VfrCompatibleMode && ArrayIdx != INVALID_ARRAY_INDEX) {
if (ArrayIdx == 0) {
return VFR_RETURN_ERROR_ARRARY_NUM;
}
ArrayIdx = ArrayIdx - 1;
}
if ((ArrayIdx != INVALID_ARRAY_INDEX) && ((Field->mArrayNum == 0) || (Field->mArrayNum <= ArrayIdx))) {
return VFR_RETURN_ERROR_ARRARY_NUM;
}
@ -1683,17 +1672,7 @@ CVfrDataStorage::GetFreeVarStoreId (
{
UINT32 Index, Mask, Offset;
//
// Assign the different ID range for the different type VarStore to support Framework Vfr
//
Index = 0;
if ((!VfrCompatibleMode) || (VarType == EFI_VFR_VARSTORE_BUFFER)) {
Index = 0;
} else if (VarType == EFI_VFR_VARSTORE_EFI) {
Index = 1;
} else if (VarType == EFI_VFR_VARSTORE_NAME) {
Index = 2;
}
for (; Index < EFI_FREE_VARSTORE_ID_BITMAP_SIZE; Index++) {
if (mFreeVarStoreIdBitMap[Index] != 0xFFFFFFFF) {
@ -1915,13 +1894,6 @@ CVfrDataStorage::GetVarStoreByDataType (
SVfrVarStorageNode *pNode;
SVfrVarStorageNode *MatchNode;
//
// Framework VFR uses Data type name as varstore name, so don't need check again.
//
if (VfrCompatibleMode) {
return VFR_RETURN_UNDEFINED;
}
MatchNode = NULL;
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
if (strcmp (pNode->mStorageInfo.mDataType->mTypeName, DataTypeName) != 0) {
@ -2289,16 +2261,6 @@ CVfrDataStorage::GetNameVarStoreInfo (
return VFR_RETURN_GET_NVVARSTORE_ERROR;
}
//
// Framework Vfr file Index is from 1, but Uefi Vfr file Index is from 0.
//
if (VfrCompatibleMode) {
if (Index == 0) {
return VFR_RETURN_ERROR_ARRARY_NUM;
}
Index --;
}
Info->mInfo.mVarName = mCurrVarStorageNode->mStorageInfo.mNameSpace.mNameTable[Index];
return VFR_RETURN_SUCCESS;
@ -2861,10 +2823,7 @@ CVfrQuestionDB::RegisterQuestion (
if (QuestionId == EFI_QUESTION_ID_INVALID) {
QuestionId = GetFreeQuestionId ();
} else {
//
// For Framework Vfr, don't check question ID conflict.
//
if (!VfrCompatibleMode && ChekQuestionIdFree (QuestionId) == FALSE) {
if (ChekQuestionIdFree (QuestionId) == FALSE) {
delete pNode;
return VFR_RETURN_QUESTIONID_REDEFINED;
}
@ -3368,10 +3327,7 @@ CVfrQuestionDB::UpdateQuestionId (
return VFR_RETURN_SUCCESS;
}
//
// For Framework Vfr, don't check question ID conflict.
//
if (!VfrCompatibleMode && ChekQuestionIdFree (NewQId) == FALSE) {
if (ChekQuestionIdFree (NewQId) == FALSE) {
return VFR_RETURN_REDEFINED;
}
@ -3957,8 +3913,6 @@ CVfrStringDB::GetUnicodeStringTextSize (
return StringSize;
}
BOOLEAN VfrCompatibleMode = FALSE;
CVfrVarDataTypeDB gCVfrVarDataTypeDB;
CVfrDefaultStore gCVfrDefaultStore;
CVfrDataStorage gCVfrDataStorage;

@ -2,7 +2,7 @@
Vfr common library functions.
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -15,7 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "EfiVfr.h"
#include "VfrError.h"
extern BOOLEAN VfrCompatibleMode;
static EFI_GUID gEdkiiIfrBitVarGuid = EDKII_IFR_BIT_VARSTORE_GUID;
#define MAX_BIT_WIDTH 32
@ -424,10 +423,6 @@ public:
VOID PrintAllQuestion (IN VOID);
VOID ResetInit (IN VOID);
VOID SetCompatibleMode (IN BOOLEAN Mode) {
VfrCompatibleMode = Mode;
}
private:
CVfrQuestionDB (IN CONST CVfrQuestionDB&); // Prevent copy-construction
CVfrQuestionDB& operator= (IN CONST CVfrQuestionDB&); // Prevent assignment

@ -147,10 +147,6 @@ The generated file will be placed into the output directory sp\hich\af43\dbch\af
\fs18\cf1\insrsid2570438 \hich\af43\dbch\af31505\loch\f43 t}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1204842 \hich\af43\dbch\af31505\loch\f43 he}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43
input vfr file. The input VFR file has been pro\hich\af43\dbch\af31505\loch\f43 cessed. If this option is not specified, the default behavior is same to set this option.
\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid83254 \hich\af43\dbch\af31505\loch\f43 Selecting this option disables preprocessing of VFR files. }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2570438
\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 -c, --compatible-framework
\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 Recognize}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid83254
\hich\af43\dbch\af31505\loch\f43 s}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 the input VFR file is the framework VFR syntax. If this option is n\hich\af43\dbch\af31505\loch\f43
ot specified, the UEFI syntax is default }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid83254 \hich\af43\dbch\af31505\loch\f43 the VFR }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 syntax.
\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 -h, --help
\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 Print version and usage of this program and exit.
\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid12931970 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\insrsid12931970\charrsid6448922 \hich\af43\dbch\af31505\loch\f43 -s, --string-db