From 6a8241983d1a35153e5c99d35d8f710fc8ae1a17 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Thu, 25 Feb 2010 03:10:54 +0000 Subject: [PATCH] Add new HII FormMap Opcode support git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10065 6f19259b-4bc3-4df7-8a09-765794883524 --- .../FrameworkHiiOnUefiHiiThunk.inf | 1 + .../FrameworkHiiOnUefiHiiThunk/HiiDatabase.h | 2 +- .../UefiIfrParser.c | 60 ++++++++++++++++++- 3 files changed, 59 insertions(+), 4 deletions(-) diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/FrameworkHiiOnUefiHiiThunk.inf b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/FrameworkHiiOnUefiHiiThunk.inf index 6175ee4e18..ddfa6fdff1 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/FrameworkHiiOnUefiHiiThunk.inf +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/FrameworkHiiOnUefiHiiThunk.inf @@ -85,6 +85,7 @@ [Guids] gEfiIfrTianoGuid gEfiIfrFrameworkGuid + gEfiHiiStandardFormGuid [Protocols] gEfiHiiImageProtocolGuid diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h index ced2ad326f..7a905c0dd3 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h @@ -35,7 +35,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include - +#include #include #include diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.c index 52b253a559..98754ec544 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.c @@ -408,9 +408,14 @@ IsExpressionOpCode ( ) { if (((Operand >= EFI_IFR_EQ_ID_VAL_OP) && (Operand <= EFI_IFR_NOT_OP)) || - ((Operand >= EFI_IFR_MATCH_OP) && (Operand <= EFI_IFR_SPAN_OP)) || - (Operand == EFI_IFR_CATENATE_OP) - ) { + ((Operand >= EFI_IFR_MATCH_OP) && (Operand <= EFI_IFR_SET_OP)) || + ((Operand >= EFI_IFR_EQUAL_OP) && (Operand <= EFI_IFR_SPAN_OP)) || + (Operand == EFI_IFR_CATENATE_OP) || + (Operand == EFI_IFR_TO_LOWER_OP) || + (Operand == EFI_IFR_TO_UPPER_OP) || + (Operand == EFI_IFR_MAP_OP) || + (Operand == EFI_IFR_VERSION_OP) || + (Operand == EFI_IFR_SECURITY_OP)) { return TRUE; } else { return FALSE; @@ -502,12 +507,14 @@ ParseOpCodes ( UINT8 OneOfType; EFI_IFR_ONE_OF *OneOfOpcode; HII_THUNK_CONTEXT *ThunkContext; + EFI_IFR_FORM_MAP_METHOD *MapMethod; mInScopeSubtitle = FALSE; mInScopeSuppress = FALSE; mInScopeGrayOut = FALSE; CurrentDefault = NULL; CurrentOption = NULL; + MapMethod = NULL; ThunkContext = UefiHiiHandleToThunkContext ((CONST HII_THUNK_PRIVATE_DATA*) mHiiThunkPrivateData, FormSet->HiiHandle); // @@ -592,6 +599,49 @@ ParseOpCodes ( InsertTailList (&FormSet->FormListHead, &CurrentForm->Link); break; + case EFI_IFR_FORM_MAP_OP: + // + // Create a new Form Map for this FormSet + // + CurrentForm = AllocateZeroPool (sizeof (FORM_BROWSER_FORM)); + CurrentForm->Signature = FORM_BROWSER_FORM_SIGNATURE; + + InitializeListHead (&CurrentForm->StatementListHead); + + CopyMem (&CurrentForm->FormId, &((EFI_IFR_FORM *) OpCodeData)->FormId, sizeof (UINT16)); + MapMethod = (EFI_IFR_FORM_MAP_METHOD *) (OpCodeData + sizeof (EFI_IFR_FORM_MAP)); + + // + // FormMap Form must contain at least one Map Method. + // + if (((EFI_IFR_OP_HEADER *) OpCodeData)->Length < ((UINTN) (UINT8 *) (MapMethod + 1) - (UINTN) OpCodeData)) { + return EFI_INVALID_PARAMETER; + } + + // + // Try to find the standard form map method. + // + while (((UINTN) (UINT8 *) MapMethod - (UINTN) OpCodeData) < ((EFI_IFR_OP_HEADER *) OpCodeData)->Length) { + if (CompareGuid ((EFI_GUID *) (VOID *) &MapMethod->MethodIdentifier, &gEfiHiiStandardFormGuid)) { + CopyMem (&CurrentForm->FormTitle, &MapMethod->MethodTitle, sizeof (EFI_STRING_ID)); + break; + } + MapMethod ++; + } + // + // If the standard form map method is not found, the first map method title will be used. + // + if (CurrentForm->FormTitle == 0) { + MapMethod = (EFI_IFR_FORM_MAP_METHOD *) (OpCodeData + sizeof (EFI_IFR_FORM_MAP)); + CopyMem (&CurrentForm->FormTitle, &MapMethod->MethodTitle, sizeof (EFI_STRING_ID)); + } + + // + // Insert into Form list of this FormSet + // + InsertTailList (&FormSet->FormListHead, &CurrentForm->Link); + break; + // // Storage // @@ -917,6 +967,8 @@ ParseOpCodes ( // Expression // case EFI_IFR_VALUE_OP: + case EFI_IFR_READ_OP: + case EFI_IFR_WRITE_OP: break; case EFI_IFR_RULE_OP: @@ -938,6 +990,7 @@ ParseOpCodes ( break; case EFI_IFR_FORM_OP: + case EFI_IFR_FORM_MAP_OP: ImageId = &CurrentForm->ImageId; break; @@ -1040,6 +1093,7 @@ ParseOpCodes ( break; case EFI_IFR_FORM_OP: + case EFI_IFR_FORM_MAP_OP: // // End of Form //