summaryrefslogtreecommitdiff
path: root/BaseTools/Source/C/VfrCompile
diff options
context:
space:
mode:
authorLiming Gao <liming.gao@intel.com>2013-11-18 07:41:21 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2013-11-18 07:41:21 +0000
commite8a47801a1dfdb148b1bfcd5bdc8ebc3bf51f92d (patch)
tree04e3ec271347360a5e9da898f1dccbce3d94681f /BaseTools/Source/C/VfrCompile
parentfddbbc661eeff8e9f94942fa2d47fb637404a040 (diff)
downloadedk2-platforms-e8a47801a1dfdb148b1bfcd5bdc8ebc3bf51f92d.tar.xz
Sync BaseTool trunk (version r2610) into EDKII BaseTools.
Signed-off-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14856 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/C/VfrCompile')
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrSyntax.g34
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp33
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrUtilityLib.h2
3 files changed, 59 insertions, 10 deletions
diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
index 61b68f5fb7..6f15aaa452 100644
--- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
+++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
@@ -136,6 +136,7 @@ VfrParserStart (
#token MapTitle("maptitle") "maptitle"
#token MapGuid("mapguid") "mapguid"
#token Subtitle("subtitle") "subtitle"
+#token EndSubtitle("endsubtitle") "endsubtitle"
#token Help("help") "help"
#token Text("text") "text"
#token Option("option") "option"
@@ -1018,12 +1019,29 @@ vfrStatementVarStoreNameValue :
<<
EFI_GUID Guid;
CIfrVarStoreNameValue VSNVObj;
- EFI_VARSTORE_ID VarStoreId;
+ EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;
+ BOOLEAN Created = FALSE;
>>
L:NameValueVarStore << VSNVObj.SetLineNo(L->getLine()); >>
- SN:StringIdentifier "," << _PCATCH(mCVfrDataStorage.DeclareNameVarStoreBegin (SN->getText()), SN); >>
+ SN:StringIdentifier ","
+ {
+ VarId "=" ID:Number "," <<
+ _PCATCH(
+ (INTN)(VarStoreId = _STOU16(ID->getText())) != 0,
+ (INTN)TRUE,
+ ID,
+ "varid 0 is not allowed."
+ );
+ >>
+ }
(
- Name "=" "STRING_TOKEN" "\(" N:Number "\)" "," << _PCATCH(mCVfrDataStorage.NameTableAddItem (_STOSID(N->getText())), SN); >>
+ Name "=" "STRING_TOKEN" "\(" N:Number "\)" "," <<
+ if (!Created) {
+ _PCATCH(mCVfrDataStorage.DeclareNameVarStoreBegin (SN->getText(), VarStoreId), SN);
+ Created = TRUE;
+ }
+ _PCATCH(mCVfrDataStorage.NameTableAddItem (_STOSID(N->getText())), SN);
+ >>
)+
Uuid "=" guidDefinition[Guid] << _PCATCH(mCVfrDataStorage.DeclareNameVarStoreEnd (&Guid), SN); >>
<<
@@ -1628,8 +1646,14 @@ vfrStatementSubTitle :
{
"," FLAGS "=" vfrSubtitleFlags[SObj]
}
- { vfrStatementStatTagList "," }
- E:";" << CRT_END_OP (E); >>
+ (
+ {vfrStatementStatTagList "," }
+ E:";" << CRT_END_OP (E); >>
+ |
+ { "," vfrStatementStatTagList}
+ { "," (vfrStatementStat | vfrStatementQuestions)*}
+ E: EndSubtitle ";" << CRT_END_OP (E); >>
+ )
;
vfrSubtitleFlags [CIfrSubtitle & SObj] :
diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
index 21a479db68..7c1383eb7a 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
@@ -1512,21 +1512,30 @@ CVfrDataStorage::MarkVarStoreIdUnused (
EFI_VFR_RETURN_CODE
CVfrDataStorage::DeclareNameVarStoreBegin (
- IN CHAR8 *StoreName
+ IN CHAR8 *StoreName,
+ IN EFI_VARSTORE_ID VarStoreId
)
{
SVfrVarStorageNode *pNode = NULL;
- EFI_VARSTORE_ID VarStoreId;
+ EFI_VARSTORE_ID TmpVarStoreId;
if (StoreName == NULL) {
return VFR_RETURN_FATAL_ERROR;
}
- if (GetVarStoreId (StoreName, &VarStoreId) == VFR_RETURN_SUCCESS) {
+ if (GetVarStoreId (StoreName, &TmpVarStoreId) == VFR_RETURN_SUCCESS) {
return VFR_RETURN_REDEFINED;
}
+
+ if (VarStoreId == EFI_VARSTORE_ID_INVALID) {
+ VarStoreId = GetFreeVarStoreId (EFI_VFR_VARSTORE_NAME);
+ } else {
+ if (ChekVarStoreIdFree (VarStoreId) == FALSE) {
+ return VFR_RETURN_VARSTOREID_REDEFINED;
+ }
+ MarkVarStoreIdUsed (VarStoreId);
+ }
- VarStoreId = GetFreeVarStoreId (EFI_VFR_VARSTORE_NAME);
if ((pNode = new SVfrVarStorageNode (StoreName, VarStoreId)) == NULL) {
return VFR_RETURN_UNDEFINED;
}
@@ -2619,6 +2628,14 @@ CVfrQuestionDB::RegisterNewDateQuestion (
CHAR8 Index;
if (BaseVarId == NULL && Name == NULL) {
+ if (QuestionId == EFI_QUESTION_ID_INVALID) {
+ QuestionId = GetFreeQuestionId ();
+ } else {
+ if (ChekQuestionIdFree (QuestionId) == FALSE) {
+ goto Err;
+ }
+ MarkQuestionIdUsed (QuestionId);
+ }
return;
}
@@ -2787,6 +2804,14 @@ CVfrQuestionDB::RegisterNewTimeQuestion (
CHAR8 Index;
if (BaseVarId == NULL && Name == NULL) {
+ if (QuestionId == EFI_QUESTION_ID_INVALID) {
+ QuestionId = GetFreeQuestionId ();
+ } else {
+ if (ChekQuestionIdFree (QuestionId) == FALSE) {
+ goto Err;
+ }
+ MarkQuestionIdUsed (QuestionId);
+ }
return;
}
diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
index 2847a74a7b..c8f5333641 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
@@ -300,7 +300,7 @@ public:
SVfrVarStorageNode * GetEfiVarStoreList () {
return mEfiVarStoreList;
}
- EFI_VFR_RETURN_CODE DeclareNameVarStoreBegin (CHAR8 *);
+ EFI_VFR_RETURN_CODE DeclareNameVarStoreBegin (CHAR8 *, EFI_VARSTORE_ID);
EFI_VFR_RETURN_CODE NameTableAddItem (EFI_STRING_ID);
EFI_VFR_RETURN_CODE DeclareNameVarStoreEnd (EFI_GUID *);