mirror of https://github.com/acidanthera/audk.git
Add SuppressIf form support in SetupBrowser driver.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9417 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
369d5f2e98
commit
0c66bc762a
|
@ -652,6 +652,7 @@ DestroyFormSet (
|
|||
LIST_ENTRY *Link;
|
||||
FORMSET_STORAGE *Storage;
|
||||
FORMSET_DEFAULTSTORE *DefaultStore;
|
||||
FORM_EXPRESSION *Expression;
|
||||
FORM_BROWSER_FORM *Form;
|
||||
|
||||
//
|
||||
|
@ -685,6 +686,17 @@ DestroyFormSet (
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Free Formset Expressions
|
||||
//
|
||||
while (!IsListEmpty (&FormSet->ExpressionListHead)) {
|
||||
Link = GetFirstNode (&FormSet->ExpressionListHead);
|
||||
Expression = FORM_EXPRESSION_FROM_LINK (Link);
|
||||
RemoveEntryList (&Expression->Link);
|
||||
|
||||
DestroyExpression (Expression);
|
||||
}
|
||||
|
||||
//
|
||||
// Free Forms
|
||||
//
|
||||
|
@ -815,9 +827,12 @@ ParseOpCodes (
|
|||
UINT16 NumberOfStatement;
|
||||
UINT16 NumberOfExpression;
|
||||
EFI_IMAGE_ID *ImageId;
|
||||
BOOLEAN SuppressForQuestion;
|
||||
BOOLEAN SuppressForOption;
|
||||
BOOLEAN InScopeOptionSuppress;
|
||||
FORM_EXPRESSION *OptionSuppressExpression;
|
||||
BOOLEAN InScopeFormSuppress;
|
||||
FORM_EXPRESSION *FormSuppressExpression;
|
||||
UINT16 DepthOfDisable;
|
||||
BOOLEAN OpCodeDisabled;
|
||||
BOOLEAN SingleOpCodeExpression;
|
||||
|
@ -825,7 +840,9 @@ ParseOpCodes (
|
|||
EFI_HII_VALUE *Value;
|
||||
|
||||
mInScopeSubtitle = FALSE;
|
||||
SuppressForQuestion = FALSE;
|
||||
SuppressForOption = FALSE;
|
||||
InScopeFormSuppress = FALSE;
|
||||
mInScopeSuppress = FALSE;
|
||||
InScopeOptionSuppress = FALSE;
|
||||
mInScopeGrayOut = FALSE;
|
||||
|
@ -838,6 +855,7 @@ ParseOpCodes (
|
|||
CurrentDefault = NULL;
|
||||
CurrentOption = NULL;
|
||||
OptionSuppressExpression = NULL;
|
||||
FormSuppressExpression = NULL;
|
||||
ImageId = NULL;
|
||||
|
||||
//
|
||||
|
@ -1086,6 +1104,8 @@ ParseOpCodes (
|
|||
//
|
||||
FormSet->NumberOfClassGuid = (UINT8) (((EFI_IFR_FORM_SET *) OpCodeData)->Flags & 0x3);
|
||||
CopyMem (FormSet->ClassGuid, OpCodeData + sizeof (EFI_IFR_FORM_SET), FormSet->NumberOfClassGuid * sizeof (EFI_GUID));
|
||||
|
||||
InitializeListHead (&FormSet->ExpressionListHead);
|
||||
break;
|
||||
|
||||
case EFI_IFR_FORM_OP:
|
||||
|
@ -1101,6 +1121,20 @@ ParseOpCodes (
|
|||
CopyMem (&CurrentForm->FormId, &((EFI_IFR_FORM *) OpCodeData)->FormId, sizeof (UINT16));
|
||||
CopyMem (&CurrentForm->FormTitle, &((EFI_IFR_FORM *) OpCodeData)->FormTitle, sizeof (EFI_STRING_ID));
|
||||
|
||||
if (InScopeFormSuppress) {
|
||||
//
|
||||
// Form is inside of suppressif
|
||||
//
|
||||
CurrentForm->SuppressExpression = FormSuppressExpression;
|
||||
}
|
||||
|
||||
if (Scope != 0) {
|
||||
//
|
||||
// Enter scope of a Form, suppressif will be used for Question or Option
|
||||
//
|
||||
SuppressForQuestion = TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Insert into Form list of this FormSet
|
||||
//
|
||||
|
@ -1510,6 +1544,14 @@ ParseOpCodes (
|
|||
CurrentExpression->Type = EFI_HII_EXPRESSION_INCONSISTENT_IF;
|
||||
InsertTailList (&CurrentStatement->InconsistentListHead, &CurrentExpression->Link);
|
||||
}
|
||||
|
||||
//
|
||||
// Take a look at next OpCode to see whether current expression consists
|
||||
// of single OpCode
|
||||
//
|
||||
if (((EFI_IFR_OP_HEADER *) (OpCodeData + OpCodeLength))->Scope == 0) {
|
||||
SingleOpCodeExpression = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IFR_SUPPRESS_IF_OP:
|
||||
|
@ -1518,14 +1560,30 @@ ParseOpCodes (
|
|||
//
|
||||
CurrentExpression = CreateExpression (CurrentForm);
|
||||
CurrentExpression->Type = EFI_HII_EXPRESSION_SUPPRESS_IF;
|
||||
|
||||
if (CurrentForm == NULL) {
|
||||
InsertTailList (&FormSet->ExpressionListHead, &CurrentExpression->Link);
|
||||
} else {
|
||||
InsertTailList (&CurrentForm->ExpressionListHead, &CurrentExpression->Link);
|
||||
}
|
||||
|
||||
if (SuppressForOption) {
|
||||
InScopeOptionSuppress = TRUE;
|
||||
OptionSuppressExpression = CurrentExpression;
|
||||
} else {
|
||||
} else if (SuppressForQuestion) {
|
||||
mInScopeSuppress = TRUE;
|
||||
mSuppressExpression = CurrentExpression;
|
||||
} else {
|
||||
InScopeFormSuppress = TRUE;
|
||||
FormSuppressExpression = CurrentExpression;
|
||||
}
|
||||
|
||||
//
|
||||
// Take a look at next OpCode to see whether current expression consists
|
||||
// of single OpCode
|
||||
//
|
||||
if (((EFI_IFR_OP_HEADER *) (OpCodeData + OpCodeLength))->Scope == 0) {
|
||||
SingleOpCodeExpression = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1539,6 +1597,14 @@ ParseOpCodes (
|
|||
|
||||
mInScopeGrayOut = TRUE;
|
||||
mGrayOutExpression = CurrentExpression;
|
||||
|
||||
//
|
||||
// Take a look at next OpCode to see whether current expression consists
|
||||
// of single OpCode
|
||||
//
|
||||
if (((EFI_IFR_OP_HEADER *) (OpCodeData + OpCodeLength))->Scope == 0) {
|
||||
SingleOpCodeExpression = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IFR_DISABLE_IF_OP:
|
||||
|
@ -1597,6 +1663,14 @@ ParseOpCodes (
|
|||
ASSERT (CurrentStatement != NULL);
|
||||
CurrentStatement->ValueExpression = CurrentExpression;
|
||||
}
|
||||
|
||||
//
|
||||
// Take a look at next OpCode to see whether current expression consists
|
||||
// of single OpCode
|
||||
//
|
||||
if (((EFI_IFR_OP_HEADER *) (OpCodeData + OpCodeLength))->Scope == 0) {
|
||||
SingleOpCodeExpression = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IFR_RULE_OP:
|
||||
|
@ -1605,6 +1679,14 @@ ParseOpCodes (
|
|||
|
||||
CurrentExpression->RuleId = ((EFI_IFR_RULE *) OpCodeData)->RuleId;
|
||||
InsertTailList (&CurrentForm->ExpressionListHead, &CurrentExpression->Link);
|
||||
|
||||
//
|
||||
// Take a look at next OpCode to see whether current expression consists
|
||||
// of single OpCode
|
||||
//
|
||||
if (((EFI_IFR_OP_HEADER *) (OpCodeData + OpCodeLength))->Scope == 0) {
|
||||
SingleOpCodeExpression = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
//
|
||||
|
@ -1722,6 +1804,7 @@ ParseOpCodes (
|
|||
// End of Form
|
||||
//
|
||||
CurrentForm = NULL;
|
||||
SuppressForQuestion = FALSE;
|
||||
break;
|
||||
|
||||
case EFI_IFR_ONE_OF_OPTION_OP:
|
||||
|
@ -1745,8 +1828,10 @@ ParseOpCodes (
|
|||
case EFI_IFR_SUPPRESS_IF_OP:
|
||||
if (SuppressForOption) {
|
||||
InScopeOptionSuppress = FALSE;
|
||||
} else {
|
||||
} else if (SuppressForQuestion) {
|
||||
mInScopeSuppress = FALSE;
|
||||
} else {
|
||||
InScopeFormSuppress = FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -591,6 +591,7 @@ InitializeBrowserStrings (
|
|||
gAdjustNumber = GetToken (STRING_TOKEN (ADJUST_NUMBER), gHiiHandle);
|
||||
gSaveChanges = GetToken (STRING_TOKEN (SAVE_CHANGES), gHiiHandle);
|
||||
gOptionMismatch = GetToken (STRING_TOKEN (OPTION_MISMATCH), gHiiHandle);
|
||||
gFormSuppress = GetToken (STRING_TOKEN (FORM_SUPPRESSED), gHiiHandle);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -632,6 +633,7 @@ FreeBrowserStrings (
|
|||
FreePool (gAdjustNumber);
|
||||
FreePool (gSaveChanges);
|
||||
FreePool (gOptionMismatch);
|
||||
FreePool (gFormSuppress);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -858,6 +860,7 @@ SetupBrowser (
|
|||
FORM_BROWSER_STATEMENT *Statement;
|
||||
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
|
||||
FORM_BROWSER_FORMSET *FormSet;
|
||||
EFI_INPUT_KEY Key;
|
||||
|
||||
gMenuRefreshHead = NULL;
|
||||
gResetRequired = FALSE;
|
||||
|
@ -919,6 +922,7 @@ SetupBrowser (
|
|||
//
|
||||
// IFR is updated during callback, force to reparse the IFR binary
|
||||
//
|
||||
mHiiPackageListUpdated = FALSE;
|
||||
Selection->Action = UI_ACTION_REFRESH_FORMSET;
|
||||
goto Done;
|
||||
}
|
||||
|
@ -956,6 +960,27 @@ SetupBrowser (
|
|||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Form is suppressed.
|
||||
//
|
||||
if (Selection->Form->SuppressExpression != NULL) {
|
||||
Status = EvaluateExpression (Selection->FormSet, Selection->Form, Selection->Form->SuppressExpression);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (Selection->Form->SuppressExpression->Result.Value.b) {
|
||||
//
|
||||
// Form is suppressed.
|
||||
//
|
||||
do {
|
||||
CreateDialog (4, TRUE, 0, NULL, &Key, gEmptyString, gFormSuppress, gPressEnter, gEmptyString);
|
||||
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Load Questions' Value for display
|
||||
//
|
||||
|
@ -1060,6 +1085,7 @@ SetupBrowser (
|
|||
//
|
||||
// Force to reparse IFR binary of target Formset
|
||||
//
|
||||
mHiiPackageListUpdated = FALSE;
|
||||
Selection->Action = UI_ACTION_REFRESH_FORMSET;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ CHAR16 *gMinusString;
|
|||
CHAR16 *gAdjustNumber;
|
||||
CHAR16 *gSaveChanges;
|
||||
CHAR16 *gOptionMismatch;
|
||||
CHAR16 *gFormSuppress;
|
||||
|
||||
CHAR16 *mUnknownString = L"!";
|
||||
|
||||
|
@ -2313,7 +2314,7 @@ GetIfrBinaryData (
|
|||
|
||||
OpCodeData = NULL;
|
||||
Package = NULL;
|
||||
ZeroMem (&PackageHeader, sizeof (EFI_HII_PACKAGE_HEADER));;
|
||||
ZeroMem (&PackageHeader, sizeof (EFI_HII_PACKAGE_HEADER));
|
||||
|
||||
//
|
||||
// if FormSetGuid is NULL or zero GUID, return first Setup FormSet in the package list
|
||||
|
|
|
@ -401,6 +401,7 @@ typedef struct {
|
|||
|
||||
LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
|
||||
LIST_ENTRY StatementListHead; // List of Statements and Questions (FORM_BROWSER_STATEMENT)
|
||||
FORM_EXPRESSION *SuppressExpression; // nesting inside of SuppressIf
|
||||
} FORM_BROWSER_FORM;
|
||||
|
||||
#define FORM_BROWSER_FORM_FROM_LINK(a) CR (a, FORM_BROWSER_FORM, Link, FORM_BROWSER_FORM_SIGNATURE)
|
||||
|
@ -441,6 +442,7 @@ typedef struct {
|
|||
LIST_ENTRY StorageListHead; // Storage list (FORMSET_STORAGE)
|
||||
LIST_ENTRY DefaultStoreListHead; // DefaultStore list (FORMSET_DEFAULTSTORE)
|
||||
LIST_ENTRY FormListHead; // Form list (FORM_BROWSER_FORM)
|
||||
LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
|
||||
} FORM_BROWSER_FORMSET;
|
||||
|
||||
#define BROWSER_CONTEXT_SIGNATURE SIGNATURE_32 ('B', 'C', 'T', 'X')
|
||||
|
@ -550,6 +552,7 @@ extern CHAR16 *gMinusString;
|
|||
extern CHAR16 *gAdjustNumber;
|
||||
extern CHAR16 *gSaveChanges;
|
||||
extern CHAR16 *gOptionMismatch;
|
||||
extern CHAR16 *gFormSuppress;
|
||||
|
||||
extern CHAR16 gPromptBlockWidth;
|
||||
extern CHAR16 gOptionBlockWidth;
|
||||
|
|
Binary file not shown.
|
@ -1669,6 +1669,7 @@ UiDisplayMenu (
|
|||
UINT8 DigitUint8;
|
||||
UI_MENU_LIST *CurrentMenu;
|
||||
UI_MENU_LIST *MenuList;
|
||||
FORM_BROWSER_FORM *RefForm;
|
||||
|
||||
CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
|
||||
|
||||
|
@ -1690,6 +1691,7 @@ UiDisplayMenu (
|
|||
NextMenuOption = NULL;
|
||||
PreviousMenuOption = NULL;
|
||||
SavedMenuOption = NULL;
|
||||
RefForm = NULL;
|
||||
|
||||
ZeroMem (&Key, sizeof (EFI_INPUT_KEY));
|
||||
|
||||
|
@ -2494,7 +2496,6 @@ UiDisplayMenu (
|
|||
//
|
||||
// Goto another Hii Package list
|
||||
//
|
||||
ControlFlag = CfCheckSelection;
|
||||
Selection->Action = UI_ACTION_REFRESH_FORMSET;
|
||||
|
||||
StringPtr = GetToken (Statement->RefDevicePath, Selection->FormSet->HiiHandle);
|
||||
|
@ -2549,13 +2550,36 @@ UiDisplayMenu (
|
|||
//
|
||||
// Goto another Formset, check for uncommitted data
|
||||
//
|
||||
ControlFlag = CfCheckSelection;
|
||||
Selection->Action = UI_ACTION_REFRESH_FORMSET;
|
||||
|
||||
CopyMem (&Selection->FormSetGuid, &Statement->RefFormSetId, sizeof (EFI_GUID));
|
||||
Selection->FormId = Statement->RefFormId;
|
||||
Selection->QuestionId = Statement->RefQuestionId;
|
||||
} else if (Statement->RefFormId != 0) {
|
||||
//
|
||||
// Check Ref From is suppressed.
|
||||
//
|
||||
RefForm = IdToForm (Selection->FormSet, Statement->RefFormId);
|
||||
|
||||
if (RefForm->SuppressExpression != NULL) {
|
||||
Status = EvaluateExpression (Selection->FormSet, RefForm, RefForm->SuppressExpression);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (RefForm->SuppressExpression->Result.Value.b) {
|
||||
//
|
||||
// Form is suppressed.
|
||||
//
|
||||
do {
|
||||
CreateDialog (4, TRUE, 0, NULL, &Key, gEmptyString, gFormSuppress, gPressEnter, gEmptyString);
|
||||
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
|
||||
|
||||
Repaint = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Goto another form inside this formset,
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue