Sync BaseTools Branch (version r2321) to EDKII main trunk.

Signed-off-by: lgao4
Reviewed-by: gikidy


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12372 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4
2011-09-18 12:17:25 +00:00
parent e7fe402863
commit b36d134faf
102 changed files with 2221 additions and 1060 deletions

View File

@@ -30,7 +30,21 @@ LINKER = $(CXX)
EXTRA_CLEAN_OBJECTS = EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg VfrTokens.h VfrLexer.cpp VfrLexer.h VfrSyntax.cpp tokens.h
include $(MAKEROOT)/Makefiles/app.makefile
MAKEROOT ?= ../..
include $(MAKEROOT)/Makefiles/header.makefile
APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
.PHONY:all
all: $(MAKEROOT)/bin $(APPLICATION)
$(APPLICATION): $(OBJECTS)
$(LINKER) -o $(APPLICATION) $(LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS)
VfrCompiler.o: ../Include/Common/BuildVersion.h
include $(MAKEROOT)/Makefiles/footer.makefile
VfrSyntax.cpp EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg VfrTokens.h: Pccts/antlr/antlr VfrSyntax.g
Pccts/antlr/antlr -CC -e3 -ck 3 -k 2 -fl VfrParser.dlg -ft VfrTokens.h -o . VfrSyntax.g

View File

@@ -403,7 +403,7 @@ CVfrCompiler::Usage (
UINT32 Index;
CONST CHAR8 *Help[] = {
" ",
"VfrCompile version " VFR_COMPILER_VERSION VFR_COMPILER_UPDATE_TIME,
"VfrCompile version " VFR_COMPILER_VERSION __BUILD_VERSION VFR_COMPILER_UPDATE_TIME,
"Copyright (c) 2004-2011 Intel Corporation. All rights reserved.",
" ",
"Usage: VfrCompile [options] VfrFile",
@@ -728,7 +728,7 @@ CVfrCompiler::GenRecordListFile (
goto Err1;
}
fprintf (pOutFile, "//\n// VFR compiler version " VFR_COMPILER_VERSION "\n//\n");
fprintf (pOutFile, "//\n// VFR compiler version " VFR_COMPILER_VERSION __BUILD_VERSION "\n//\n");
LineNo = 0;
while (!feof (pInFile)) {
if (fgets (LineBuf, MAX_VFR_LINE_LEN, pInFile) != NULL) {

View File

@@ -561,22 +561,24 @@ CFormPkg::DeclarePendingQuestion (
CHAR8 *VarStr;
UINT32 ArrayIdx;
CHAR8 FName[MAX_NAME_LEN];
CHAR8 *SName;
CHAR8 *NewStr;
EFI_VFR_RETURN_CODE ReturnCode;
EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
//
// Declare all questions as Numeric in DisableIf True
//
// DisableIf
CIfrDisableIf DIObj;
DIObj.SetLineNo (LineNo);
//TrueOpcode
CIfrTrue TObj (LineNo);
// Declare Numeric qeustion for each undefined question.
for (pNode = PendingAssignList; pNode != NULL; pNode = pNode->mNext) {
if (pNode->mFlag == PENDING) {
//
// declare this question as Numeric in SuppressIf True
//
// SuppressIf
CIfrSuppressIf SIObj;
SIObj.SetLineNo (LineNo);
//TrueOpcode
CIfrTrue TObj (LineNo);
//Numeric qeustion
CIfrNumeric CNObj;
EFI_VARSTORE_INFO Info;
EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
@@ -639,7 +641,16 @@ CFormPkg::DeclarePendingQuestion (
ReturnCode = lCVfrDataStorage.GetEfiVarStoreInfo (&Info);
} else if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) {
VarStr = pNode->mKey;
ReturnCode = lCVfrVarDataTypeDB.GetDataFieldInfo (VarStr, Info.mInfo.mVarOffset, Info.mVarType, Info.mVarTotalSize);
//convert VarStr with store name to VarStr with structure name
ReturnCode = lCVfrDataStorage.GetBufferVarStoreDataTypeName (FName, &SName);
if (ReturnCode == VFR_RETURN_SUCCESS) {
NewStr = new CHAR8[strlen (VarStr) + strlen (SName) + 1];
NewStr[0] = '\0';
strcpy (NewStr, SName);
strcat (NewStr, VarStr + strlen (FName));
ReturnCode = lCVfrVarDataTypeDB.GetDataFieldInfo (NewStr, Info.mInfo.mVarOffset, Info.mVarType, Info.mVarTotalSize);
delete NewStr;
}
} else {
ReturnCode = VFR_RETURN_UNSUPPORTED;
}
@@ -657,7 +668,7 @@ CFormPkg::DeclarePendingQuestion (
// For undefined Efi VarStore type question
// Append the extended guided opcode to contain VarName
//
if (VarStoreType == EFI_VFR_VARSTORE_EFI) {
if (VarStoreType == EFI_VFR_VARSTORE_EFI || VfrCompatibleMode) {
CIfrVarEqName CVNObj (QId, Info.mInfo.mVarName);
CVNObj.SetLineNo (LineNo);
}
@@ -667,13 +678,15 @@ CFormPkg::DeclarePendingQuestion (
//
CIfrEnd CEObj;
CEObj.SetLineNo (LineNo);
//
// End for SuppressIf
//
CIfrEnd SEObj;
SEObj.SetLineNo (LineNo);
}
}
//
// End for DisableIf
//
CIfrEnd SEObj;
SEObj.SetLineNo (LineNo);
return VFR_RETURN_SUCCESS;
}

View File

@@ -1387,19 +1387,21 @@ vfrFormDefinition :
CIfrLabel LObj3;
LObj3.SetLineNo(E->getLine());
LObj3.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff
//
// Declare undefined Question
//
if (gCFormPkg.HavePendingUnassigned()) {
gCFormPkg.DeclarePendingQuestion (
gCVfrVarDataTypeDB,
mCVfrDataStorage,
mCVfrQuestionDB,
&mFormsetGuid,
E->getLine()
);
}
}
//
// Declare undefined Question so that they can be used in expression.
//
if (gCFormPkg.HavePendingUnassigned()) {
gCFormPkg.DeclarePendingQuestion (
gCVfrVarDataTypeDB,
mCVfrDataStorage,
mCVfrQuestionDB,
&mFormsetGuid,
E->getLine()
);
}
//
// mCVfrQuestionDB.PrintAllQuestion();
//
@@ -2110,6 +2112,7 @@ vfrStatementNumeric :
<<
CIfrNumeric NObj;
UINT32 DataTypeSize;
BOOLEAN IsSupported;
>>
L:Numeric << NObj.SetLineNo(L->getLine()); >>
vfrQuestionHeader[NObj] "," << // check data type
@@ -2125,7 +2128,23 @@ vfrStatementNumeric :
}
vfrSetMinMaxStep[NObj]
vfrStatementQuestionOptionList
E:EndNumeric << CRT_END_OP (E); >>
E:EndNumeric <<
IsSupported = FALSE;
switch (_GET_CURRQEST_DATATYPE()) {
case EFI_IFR_TYPE_NUM_SIZE_8:
case EFI_IFR_TYPE_NUM_SIZE_16:
case EFI_IFR_TYPE_NUM_SIZE_32:
case EFI_IFR_TYPE_NUM_SIZE_64:
IsSupported = TRUE;
break;
default:
break;
}
if (!IsSupported) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric question only support UINT8, UINT16, UINT32 and UINT64 data type.");
}
CRT_END_OP (E);
>>
";"
;
@@ -2170,6 +2189,7 @@ vfrStatementOneOf :
<<
CIfrOneOf OObj;
UINT32 DataTypeSize;
BOOLEAN IsSupported;
>>
L:OneOf << OObj.SetLineNo(L->getLine()); >>
vfrQuestionHeader[OObj] "," << //check data type
@@ -2184,7 +2204,23 @@ vfrStatementOneOf :
vfrSetMinMaxStep[OObj]
}
vfrStatementQuestionOptionList
E:EndOneOf << CRT_END_OP (E); >>
E:EndOneOf <<
IsSupported = FALSE;
switch (_GET_CURRQEST_DATATYPE()) {
case EFI_IFR_TYPE_NUM_SIZE_8:
case EFI_IFR_TYPE_NUM_SIZE_16:
case EFI_IFR_TYPE_NUM_SIZE_32:
case EFI_IFR_TYPE_NUM_SIZE_64:
IsSupported = TRUE;
break;
default:
break;
}
if (!IsSupported) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf question only support UINT8, UINT16, UINT32 and UINT64 data type.");
}
CRT_END_OP (E);
>>
";"
;