From 5d3776166198cad1d9274d6bc76d47c15188a24e Mon Sep 17 00:00:00 2001 From: Eric Dong Date: Wed, 6 May 2015 10:38:04 +0000 Subject: [PATCH] BaseTools: Enable Match2 Opcode. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong Reviewed-by: Liming Gao Reviewed-by: Samer El-Haj-Mahmoud git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17338 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Common/UefiInternalFormRepresentation.h | 6 ++++++ BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp | 3 ++- BaseTools/Source/C/VfrCompile/VfrFormPkg.h | 15 +++++++++++++++ BaseTools/Source/C/VfrCompile/VfrSyntax.g | 16 ++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h b/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h index 2da3f547bd..d17b633c2e 100644 --- a/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h +++ b/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h @@ -690,6 +690,7 @@ typedef union { #define EFI_IFR_MODAL_TAG_OP 0x61 #define EFI_IFR_REFRESH_ID_OP 0x62 #define EFI_IFR_WARNING_IF_OP 0x63 +#define EFI_IFR_MATCH2_OP 0x64 typedef struct _EFI_IFR_OP_HEADER { @@ -1268,6 +1269,11 @@ typedef struct _EFI_IFR_MATCH { EFI_IFR_OP_HEADER Header; } EFI_IFR_MATCH; +typedef struct _EFI_IFR_MATCH2 { + EFI_IFR_OP_HEADER Header; + EFI_GUID SyntaxType; +} EFI_IFR_MATCH2; + typedef struct _EFI_IFR_MULTIPLY { EFI_IFR_OP_HEADER Header; } EFI_IFR_MULTIPLY; diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp index 376a454e02..1612217272 100644 --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp @@ -1663,6 +1663,7 @@ static struct { { sizeof (EFI_IFR_MODAL_TAG), 0}, // EFI_IFR_MODAL_TAG_OP - 0x61 { sizeof (EFI_IFR_REFRESH_ID), 0}, // EFI_IFR_REFRESH_ID_OP - 0x62 { sizeof (EFI_IFR_WARNING_IF), 1}, // EFI_IFR_WARNING_IF_OP - 0x63 + { sizeof (EFI_IFR_MATCH2), 0 }, // EFI_IFR_MATCH2_OP - 0x64 }; #ifdef CIFROBJ_DEUBG @@ -1685,7 +1686,7 @@ static struct { "EFI_IFR_STRING_REF1","EFI_IFR_STRING_REF2", "EFI_IFR_CONDITIONAL", "EFI_IFR_QUESTION_REF3", "EFI_IFR_ZERO", "EFI_IFR_ONE", "EFI_IFR_ONES", "EFI_IFR_UNDEFINED", "EFI_IFR_LENGTH", "EFI_IFR_DUP", "EFI_IFR_THIS", "EFI_IFR_SPAN", "EFI_IFR_VALUE", "EFI_IFR_DEFAULT", "EFI_IFR_DEFAULTSTORE", "EFI_IFR_FORM_MAP", "EFI_IFR_CATENATE", "EFI_IFR_GUID", - "EFI_IFR_SECURITY", "EFI_IFR_MODAL_TAG", "EFI_IFR_REFRESH_ID", "EFI_IFR_WARNING_IF", + "EFI_IFR_SECURITY", "EFI_IFR_MODAL_TAG", "EFI_IFR_REFRESH_ID", "EFI_IFR_WARNING_IF", "EFI_IFR_MATCH2", }; VOID diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h index 71ff02371b..d2d56cd110 100644 --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h @@ -2656,6 +2656,21 @@ public: } }; +class CIfrMatch2 : public CIfrObj, public CIfrOpHeader { +private: + EFI_IFR_MATCH2 *mMatch2; + +public: + CIfrMatch2 ( + IN UINT32 LineNo, + IN EFI_GUID *Guid + ) : CIfrObj (EFI_IFR_MATCH2_OP, (CHAR8 **)&mMatch2), + CIfrOpHeader (EFI_IFR_MATCH2_OP, &mMatch2->Header) { + SetLineNo (LineNo); + memmove (&mMatch2->SyntaxType, Guid, sizeof (EFI_GUID)); + } +}; + class CIfrMultiply : public CIfrObj, public CIfrOpHeader { private: EFI_IFR_MULTIPLY *mMultiply; diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g index 891effad79..1c719aa755 100644 --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g @@ -3401,6 +3401,7 @@ vfrStatementInvalidSaveRestoreDefaults : #token ToUpper("toupper") "toupper" #token ToLower("tolower") "tolower" #token Match("match") "match" +#token Match2("match2") "match2" #token Catenate("catenate") "catenate" #token QuestionRefVal("questionrefval") "questionrefval" #token StringRefVal("stringrefval") "stringrefval" @@ -3569,6 +3570,7 @@ castTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]: atomTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]: vfrExpressionCatenate[$RootLevel, $ExpOpCount] | vfrExpressionMatch[$RootLevel, $ExpOpCount] + | vfrExpressionMatch2[$RootLevel, $ExpOpCount] | vfrExpressionParen[$RootLevel, $ExpOpCount] | vfrExpressionBuildInFunction[$RootLevel, $ExpOpCount] | vfrExpressionConstant[$RootLevel, $ExpOpCount] @@ -3599,6 +3601,20 @@ vfrExpressionMatch [UINT32 & RootLevel, UINT32 & ExpOpCount]: "\)" << { CIfrMatch MObj(L->getLine()); $ExpOpCount++; } >> ; +vfrExpressionMatch2 [UINT32 & RootLevel, UINT32 & ExpOpCount]: + << + EFI_GUID Guid; + >> + L:Match2 + "\(" + vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] + "," + vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] + "," + guidDefinition[Guid] + "\)" << { CIfrMatch2 M2Obj(L->getLine(), &Guid); $ExpOpCount++; } >> + ; + vfrExpressionParen [UINT32 & RootLevel, UINT32 & ExpOpCount]: "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] -- 2.39.2