Add the support of GUID opcode which enable SetupBrowser to support IFR generated by a VFR compiler in Framework VFR compatible mode.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5665 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2008-08-18 08:10:33 +00:00
parent e8e36190f4
commit f511d656d9
3 changed files with 70 additions and 0 deletions

View File

@ -25,6 +25,7 @@ FORM_EXPRESSION *mSuppressExpression;
FORM_EXPRESSION *mGrayOutExpression; FORM_EXPRESSION *mGrayOutExpression;
EFI_GUID gTianoHiiIfrGuid = EFI_IFR_TIANO_GUID; EFI_GUID gTianoHiiIfrGuid = EFI_IFR_TIANO_GUID;
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID mFrameworkHiiCompatibilityGuid = EFI_IFR_FRAMEWORK_GUID;
/** /**
@ -88,6 +89,54 @@ CreateStatement (
return Statement; return Statement;
} }
EFI_STATUS
UpdateCheckBoxStringToken (
IN CONST FORM_BROWSER_FORMSET *FormSet,
IN FORM_BROWSER_STATEMENT *Statement
)
{
CHAR16 Str[MAXIMUM_VALUE_CHARACTERS];
EFI_STRING_ID Id;
EFI_STATUS Status;
ASSERT (Statement != NULL);
ASSERT (Statement->Operand == EFI_IFR_CHECKBOX_OP);
UnicodeValueToString (Str, 0, Statement->VarStoreInfo.VarName, MAXIMUM_VALUE_CHARACTERS - 1);
Status = HiiLibNewString (FormSet->HiiHandle, &Id, Str);
if (EFI_ERROR (Status)) {
return Status;
}
Statement->VarStoreInfo.VarName = Id;
return EFI_SUCCESS;
}
BOOLEAN
IsNextOpCodeGuidedVarEqName (
UINT8 *OpCodeData
)
{
//
// Get next opcode
//
OpCodeData += ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;
if (*OpCodeData == EFI_IFR_GUID_OP) {
if (CompareGuid (&mFrameworkHiiCompatibilityGuid, (EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER)))) {
//
// Specific GUIDed opcodes to support IFR generated from Framework HII VFR
//
if ((((EFI_IFR_GUID_VAREQNAME *) OpCodeData)->ExtendOpCode) == EFI_IFR_EXTEND_OP_VAREQNAME) {
return TRUE;
}
}
}
return FALSE;
}
/** /**
Initialize Question's members. Initialize Question's members.
@ -111,6 +160,7 @@ CreateQuestion (
LIST_ENTRY *Link; LIST_ENTRY *Link;
FORMSET_STORAGE *Storage; FORMSET_STORAGE *Storage;
NAME_VALUE_NODE *NameValueNode; NAME_VALUE_NODE *NameValueNode;
EFI_STATUS Status;
Statement = CreateStatement (OpCodeData, FormSet, Form); Statement = CreateStatement (OpCodeData, FormSet, Form);
if (Statement == NULL) { if (Statement == NULL) {
@ -131,6 +181,19 @@ CreateQuestion (
return Statement; return Statement;
} }
//
// Take a look at next OpCode to see whether it is a GUIDed opcode to support
// Framework Compatibility
//
if (FeaturePcdGet (PcdFrameworkHiiCompatibilitySupport)) {
if ((*OpCodeData == EFI_IFR_CHECKBOX_OP) && IsNextOpCodeGuidedVarEqName (OpCodeData)) {
Status = UpdateCheckBoxStringToken (FormSet, Statement);
if (EFI_ERROR (Status)) {
return NULL;
}
}
}
// //
// Find Storage for this Question // Find Storage for this Question
// //
@ -675,6 +738,7 @@ CountOpCodes (
} }
/** /**
Parse opcodes in the formset IFR binary. Parse opcodes in the formset IFR binary.
@ -1202,6 +1266,7 @@ ParseOpCodes (
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_BOOLEAN; CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_BOOLEAN;
InitializeRequestElement (FormSet, CurrentStatement); InitializeRequestElement (FormSet, CurrentStatement);
break; break;
case EFI_IFR_STRING_OP: case EFI_IFR_STRING_OP:
@ -1509,6 +1574,7 @@ ParseOpCodes (
break; break;
} }
} }
break; break;
// //

View File

@ -45,6 +45,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/ExtendedIfrSupportLib.h> #include <Library/ExtendedIfrSupportLib.h>
#include <Library/HiiLib.h> #include <Library/HiiLib.h>
#include <Library/ExtendedHiiLib.h> #include <Library/ExtendedHiiLib.h>
#include <Library/PcdLib.h>
#include "Colors.h" #include "Colors.h"

View File

@ -76,6 +76,9 @@
gEfiHiiDatabaseProtocolGuid gEfiHiiDatabaseProtocolGuid
gEfiUnicodeCollation2ProtocolGuid gEfiUnicodeCollation2ProtocolGuid
[FeaturePcd.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkHiiCompatibilitySupport
[Depex] [Depex]
gEfiHiiDatabaseProtocolGuid AND gEfiHiiConfigRoutingProtocolGuid gEfiHiiDatabaseProtocolGuid AND gEfiHiiConfigRoutingProtocolGuid