Update SetUp Browser doesn't set a default value to Numeric field per UEFI spec. And Update Setup Browser driver parse the introduced IFR FormSet classguid in UEFI2.1.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8146 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2009-04-22 03:18:37 +00:00
parent 96f99e1df8
commit 0a1147ed7a
6 changed files with 115 additions and 61 deletions

View File

@ -21,8 +21,10 @@ UINT16 mExpressionOpCodeIndex;
BOOLEAN mInScopeSubtitle;
BOOLEAN mInScopeSuppress;
BOOLEAN mInScopeGrayOut;
BOOLEAN mInScopeDisable;
FORM_EXPRESSION *mSuppressExpression;
FORM_EXPRESSION *mGrayOutExpression;
FORM_EXPRESSION *mDisableExpression;
/**
Initialize Statement header members.
@ -75,6 +77,11 @@ CreateStatement (
Statement->GrayOutExpression = mGrayOutExpression;
}
if (mInScopeDisable) {
Statement->DisableExpression = mDisableExpression;
}
Statement->InSubtitle = mInScopeSubtitle;
//
@ -810,7 +817,6 @@ ParseOpCodes (
BOOLEAN SuppressForOption;
BOOLEAN InScopeOptionSuppress;
FORM_EXPRESSION *OptionSuppressExpression;
BOOLEAN InScopeDisable;
UINT16 DepthOfDisable;
BOOLEAN OpCodeDisabled;
BOOLEAN SingleOpCodeExpression;
@ -822,7 +828,7 @@ ParseOpCodes (
mInScopeSuppress = FALSE;
InScopeOptionSuppress = FALSE;
mInScopeGrayOut = FALSE;
InScopeDisable = FALSE;
mInScopeDisable = FALSE;
DepthOfDisable = 0;
OpCodeDisabled = FALSE;
SingleOpCodeExpression = FALSE;
@ -890,7 +896,7 @@ ParseOpCodes (
if (ScopeOpCode == EFI_IFR_DISABLE_IF_OP) {
if (DepthOfDisable == 0) {
InScopeDisable = FALSE;
mInScopeDisable = FALSE;
OpCodeDisabled = FALSE;
} else {
DepthOfDisable--;
@ -1035,9 +1041,9 @@ ParseOpCodes (
//
SingleOpCodeExpression = FALSE;
if (InScopeDisable) {
if (mInScopeDisable && CurrentForm == NULL) {
//
// Evaluate DisableIf expression
// This is DisableIf expression for Form, it should be a constant expression
//
Status = EvaluateExpression (FormSet, CurrentForm, CurrentExpression);
if (EFI_ERROR (Status)) {
@ -1073,6 +1079,12 @@ ParseOpCodes (
CopyMem (&FormSet->FormSetTitle, &((EFI_IFR_FORM_SET *) OpCodeData)->FormSetTitle, sizeof (EFI_STRING_ID));
CopyMem (&FormSet->Help, &((EFI_IFR_FORM_SET *) OpCodeData)->Help, sizeof (EFI_STRING_ID));
//
// The formset OpCode contains ClassGuid
//
FormSet->NumberOfClassGuid = ((EFI_IFR_FORM_SET *) OpCodeData)->Flags & 0x3;
CopyMem (FormSet->ClassGuid, OpCodeData + sizeof (EFI_IFR_FORM_SET), FormSet->NumberOfClassGuid * sizeof (EFI_GUID));
break;
case EFI_IFR_FORM_OP:
@ -1208,8 +1220,10 @@ ParseOpCodes (
break;
case EFI_IFR_RESET_BUTTON_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
//
// Create Statement todo
//
CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
CopyMem (&CurrentStatement->DefaultId, &((EFI_IFR_RESET_BUTTON *) OpCodeData)->DefaultId, sizeof (EFI_DEFAULT_ID));
break;
@ -1504,8 +1518,16 @@ ParseOpCodes (
CurrentExpression->Type = EFI_HII_EXPRESSION_DISABLE_IF;
InitializeListHead (&CurrentExpression->OpCodeListHead);
InScopeDisable = TRUE;
OpCodeDisabled = FALSE;
if (CurrentForm != NULL) {
//
// This is DisableIf for Question, enqueue it to Form expression list
//
InsertTailList (&CurrentForm->ExpressionListHead, &CurrentExpression->Link);
}
mDisableExpression = CurrentExpression;
mInScopeDisable = TRUE;
OpCodeDisabled = FALSE;
//
// Take a look at next OpCode to see whether current expression consists
@ -1614,9 +1636,12 @@ ParseOpCodes (
break;
case EFI_IFR_EXTEND_OP_BANNER:
//
// By SubClass or By ClassGuid to get Banner Data?
//
if (FormSet->SubClass == EFI_FRONT_PAGE_SUBCLASS) {
CopyMem (
&BannerData->Banner[((EFI_IFR_GUID_BANNER *) OpCodeData)->LineNumber][
&gBannerData->Banner[((EFI_IFR_GUID_BANNER *) OpCodeData)->LineNumber][
((EFI_IFR_GUID_BANNER *) OpCodeData)->Alignment],
&((EFI_IFR_GUID_BANNER *) OpCodeData)->Title,
sizeof (EFI_STRING_ID)
@ -1696,7 +1721,7 @@ ParseOpCodes (
break;
case EFI_IFR_DISABLE_IF_OP:
InScopeDisable = FALSE;
mInScopeDisable = FALSE;
OpCodeDisabled = FALSE;
break;
@ -1711,9 +1736,9 @@ ParseOpCodes (
default:
if (IsExpressionOpCode (ScopeOpCode)) {
if (InScopeDisable) {
if (mInScopeDisable && CurrentForm == NULL) {
//
// Evaluate DisableIf expression
// This is DisableIf expression for Form, it should be a constant expression
//
Status = EvaluateExpression (FormSet, CurrentForm, CurrentExpression);
if (EFI_ERROR (Status)) {

View File

@ -209,7 +209,7 @@ DisplayPageFrame (
Buffer[Index] = Character;
}
if (gClassOfVfr == EFI_FRONT_PAGE_SUBCLASS) {
if (gClassOfVfr == FORMSET_CLASS_FRONT_PAGE) {
//
// ClearLines(0, LocalScreen.RightColumn, 0, BANNER_HEIGHT-1, BANNER_TEXT | BANNER_BACKGROUND);
//
@ -237,10 +237,10 @@ DisplayPageFrame (
ASSERT (RowIdx < BANNER_HEIGHT);
ASSERT (ColumnIdx < BANNER_COLUMNS);
if (BannerData->Banner[RowIdx][ColumnIdx] != 0x0000) {
if (gBannerData->Banner[RowIdx][ColumnIdx] != 0x0000) {
StrFrontPageBanner = GetToken (
BannerData->Banner[RowIdx][ColumnIdx],
FrontPageHandle
gBannerData->Banner[RowIdx][ColumnIdx],
gFrontPageHandle
);
} else {
continue;
@ -290,7 +290,7 @@ DisplayPageFrame (
KEYHELP_TEXT | KEYHELP_BACKGROUND
);
if (gClassOfVfr != EFI_FRONT_PAGE_SUBCLASS) {
if (gClassOfVfr != FORMSET_CLASS_FRONT_PAGE) {
ClearLines (
LocalScreen.LeftColumn,
LocalScreen.RightColumn,
@ -325,7 +325,7 @@ DisplayPageFrame (
Character = BOXDRAW_UP_LEFT;
PrintChar (Character);
if (gClassOfVfr == EFI_SETUP_APPLICATION_SUBCLASS) {
if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) {
//
// Print Bottom border line
// +------------------------------------------------------------------------------+
@ -472,7 +472,7 @@ DisplayForm (
StringPtr = GetToken (Selection->Form->FormTitle, Handle);
if (gClassOfVfr != EFI_FRONT_PAGE_SUBCLASS) {
if (gClassOfVfr != FORMSET_CLASS_FRONT_PAGE) {
gST->ConOut->SetAttribute (gST->ConOut, TITLE_TEXT | TITLE_BACKGROUND);
PrintStringAt (
(LocalScreen.RightColumn + LocalScreen.LeftColumn - GetStringWidth (StringPtr) / 2) / 2,
@ -481,7 +481,7 @@ DisplayForm (
);
}
if (gClassOfVfr == EFI_SETUP_APPLICATION_SUBCLASS) {
if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) {
gST->ConOut->SetAttribute (gST->ConOut, KEYHELP_TEXT | KEYHELP_BACKGROUND);
//
@ -514,6 +514,10 @@ DisplayForm (
Suppress = FALSE;
}
if (Statement->DisableExpression != NULL) {
Suppress = Suppress || Statement->DisableExpression->Result.Value.b;
}
if (!Suppress) {
StringPtr = GetToken (Statement->Prompt, Handle);
@ -671,10 +675,6 @@ UpdateKeyHelp (
TopRowOfHelp = LocalScreen.BottomRow - 4;
BottomRowOfHelp = LocalScreen.BottomRow - 3;
if (gClassOfVfr == EFI_GENERAL_APPLICATION_SUBCLASS) {
return ;
}
gST->ConOut->SetAttribute (gST->ConOut, KEYHELP_TEXT | KEYHELP_BACKGROUND);
Statement = MenuOption->ThisTag;
@ -687,7 +687,7 @@ UpdateKeyHelp (
ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND);
if (!Selected) {
if (gClassOfVfr == EFI_SETUP_APPLICATION_SUBCLASS) {
if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) {
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gFunctionOneString);
PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
@ -743,7 +743,7 @@ UpdateKeyHelp (
case EFI_IFR_CHECKBOX_OP:
ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND);
if (gClassOfVfr == EFI_SETUP_APPLICATION_SUBCLASS) {
if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) {
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gFunctionOneString);
PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
@ -763,7 +763,7 @@ UpdateKeyHelp (
ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND);
if (!Selected) {
if (gClassOfVfr == EFI_SETUP_APPLICATION_SUBCLASS) {
if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) {
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gFunctionOneString);
PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
@ -903,6 +903,13 @@ SetupBrowser (
Selection->Form = IdToForm (Selection->FormSet, Selection->FormId);
}
if (Selection->Form == NULL) {
//
// No Form to display
//
return EFI_NOT_FOUND;
}
//
// Load Questions' Value for display
//

View File

@ -29,8 +29,8 @@ EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
EFI_HII_STRING_PROTOCOL *mHiiString;
EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;
BANNER_DATA *BannerData;
EFI_HII_HANDLE FrontPageHandle;
BANNER_DATA *gBannerData;
EFI_HII_HANDLE gFrontPageHandle;
UINTN gClassOfVfr;
UINTN gFunctionKeySetting;
BOOLEAN gResetRequired;
@ -268,7 +268,7 @@ SendForm (
InitializeBrowserStrings ();
gFunctionKeySetting = DEFAULT_FUNCTION_KEY_SETTING;
gClassOfVfr = EFI_SETUP_APPLICATION_SUBCLASS;
gClassOfVfr = FORMSET_CLASS_PLATFORM_SETUP;
//
// Ensure we are in Text mode
@ -564,8 +564,8 @@ InitializeSetup (
//
// Initialize Driver private data
//
BannerData = AllocateZeroPool (sizeof (BANNER_DATA));
ASSERT (BannerData != NULL);
gBannerData = AllocateZeroPool (sizeof (BANNER_DATA));
ASSERT (gBannerData != NULL);
//
// Install FormBrowser2 protocol
@ -1874,21 +1874,16 @@ GetQuestionDefault (
// For Questions without default
//
switch (Question->Operand) {
case EFI_IFR_NUMERIC_OP:
//
// Take minimal value as numeric's default value
//
HiiValue->Value.u64 = Question->Minimum;
break;
case EFI_IFR_ONE_OF_OP:
//
// Take first oneof option as oneof's default value
//
Link = GetFirstNode (&Question->OptionListHead);
if (!IsNull (&Question->OptionListHead, Link)) {
Option = QUESTION_OPTION_FROM_LINK (Link);
CopyMem (HiiValue, &Option->Value, sizeof (EFI_HII_VALUE));
if (ValueToOption (Question, HiiValue) == NULL) {
Link = GetFirstNode (&Question->OptionListHead);
if (!IsNull (&Question->OptionListHead, Link)) {
Option = QUESTION_OPTION_FROM_LINK (Link);
CopyMem (HiiValue, &Option->Value, sizeof (EFI_HII_VALUE));
}
}
break;
@ -1948,11 +1943,11 @@ ExtractFormDefault (
Link = GetNextNode (&Form->StatementListHead, Link);
//
// If Question is suppressed, don't reset it to default
// If Question is disabled, don't reset it to default
//
if (Question->SuppressExpression != NULL) {
Status = EvaluateExpression (FormSet, Form, Question->SuppressExpression);
if (!EFI_ERROR (Status) && Question->SuppressExpression->Result.Value.b) {
if (Question->DisableExpression != NULL) {
Status = EvaluateExpression (FormSet, Form, Question->DisableExpression);
if (!EFI_ERROR (Status) && Question->DisableExpression->Result.Value.b) {
continue;
}
}
@ -2167,6 +2162,10 @@ GetIfrBinaryData (
BOOLEAN ReturnDefault;
UINT32 PackageListLength;
EFI_HII_PACKAGE_HEADER PackageHeader;
UINT8 Index;
UINT8 NumberOfClassGuid;
BOOLEAN IsSetupClassGuid;
EFI_GUID *ClassGuid;
OpCodeData = NULL;
Package = NULL;
@ -2222,7 +2221,21 @@ GetIfrBinaryData (
// Check whether return default FormSet
//
if (ReturnDefault) {
break;
//
// Check ClassGuid of formset OpCode
//
IsSetupClassGuid = FALSE;
NumberOfClassGuid = ((EFI_IFR_FORM_SET *) OpCodeData)->Flags & 0x3;
ClassGuid = (EFI_GUID *) (OpCodeData + sizeof (EFI_IFR_FORM_SET));
for (Index = 0; Index < NumberOfClassGuid; Index++) {
if (CompareGuid (ClassGuid + Index, &gEfiHiiPlatformSetupFormsetGuid)) {
IsSetupClassGuid = TRUE;
break;
}
}
if (IsSetupClassGuid) {
break;
}
}
//
@ -2341,9 +2354,10 @@ InitializeFormSet (
return Status;
}
gClassOfVfr = FormSet->SubClass;
if (gClassOfVfr == EFI_FRONT_PAGE_SUBCLASS) {
FrontPageHandle = FormSet->HiiHandle;
gClassOfVfr = FORMSET_CLASS_PLATFORM_SETUP;
if (FormSet->SubClass == EFI_FRONT_PAGE_SUBCLASS) {
gClassOfVfr = FORMSET_CLASS_FRONT_PAGE;
gFrontPageHandle = FormSet->HiiHandle;
}
//

View File

@ -30,6 +30,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/HiiString.h>
#include <Guid/MdeModuleHii.h>
#include <Guid/HiiPlatformSetupFormset.h>
#include <Library/PrintLib.h>
#include <Library/DebugLib.h>
@ -193,6 +194,9 @@ typedef struct {
#define FORM_INCONSISTENT_VALIDATION 0
#define FORM_NO_SUBMIT_VALIDATION 1
#define FORMSET_CLASS_PLATFORM_SETUP 0
#define FORMSET_CLASS_FRONT_PAGE 1
typedef struct {
UINT8 Type;
EFI_IFR_TYPE_VALUE Value;
@ -379,6 +383,7 @@ typedef struct {
LIST_ENTRY NoSubmitListHead; // nested nosubmit expression list (FORM_EXPRESSION)
FORM_EXPRESSION *GrayOutExpression; // nesting inside of GrayOutIf
FORM_EXPRESSION *SuppressExpression; // nesting inside of SuppressIf
FORM_EXPRESSION *DisableExpression; // nesting inside of DisableIf
} FORM_BROWSER_STATEMENT;
@ -425,8 +430,10 @@ typedef struct {
EFI_GUID Guid;
EFI_STRING_ID FormSetTitle;
EFI_STRING_ID Help;
UINT16 Class;
UINT16 SubClass;
UINT8 NumberOfClassGuid;
EFI_GUID ClassGuid[3]; // Up to three ClassGuid
UINT16 Class; // Tiano extended Class code
UINT16 SubClass; // Tiano extended Subclass code
EFI_IMAGE_ID ImageId;
FORM_BROWSER_STATEMENT *StatementBuffer; // Buffer for all Statements and Questions
@ -442,8 +449,8 @@ extern EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
extern EFI_HII_STRING_PROTOCOL *mHiiString;
extern EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;
extern BANNER_DATA *BannerData;
extern EFI_HII_HANDLE FrontPageHandle;
extern BANNER_DATA *gBannerData;
extern EFI_HII_HANDLE gFrontPageHandle;
extern UINTN gClassOfVfr;
extern UINTN gFunctionKeySetting;
extern BOOLEAN gResetRequired;

View File

@ -64,6 +64,7 @@
[Guids]
gEfiIfrTianoGuid ## CONSUMES ## GUID
gEfiIfrFrameworkGuid ## CONSUMES ## GUID
gEfiHiiPlatformSetupFormsetGuid
[Protocols]
gEfiHiiConfigAccessProtocolGuid ## CONSUMES

View File

@ -978,7 +978,7 @@ UpdateStatusBar (
break;
case NV_UPDATE_REQUIRED:
if (gClassOfVfr != EFI_FRONT_PAGE_SUBCLASS) {
if (gClassOfVfr != FORMSET_CLASS_FRONT_PAGE) {
if (State) {
gST->ConOut->SetAttribute (gST->ConOut, INFO_TEXT);
PrintStringAt (
@ -1629,7 +1629,7 @@ UiDisplayMenu (
ZeroMem (&Key, sizeof (EFI_INPUT_KEY));
if (gClassOfVfr == EFI_FRONT_PAGE_SUBCLASS) {
if (gClassOfVfr == FORMSET_CLASS_FRONT_PAGE) {
TopRow = LocalScreen.TopRow + FRONT_PAGE_HEADER_HEIGHT + SCROLL_ARROW_HEIGHT;
Row = LocalScreen.TopRow + FRONT_PAGE_HEADER_HEIGHT + SCROLL_ARROW_HEIGHT;
} else {
@ -2202,7 +2202,7 @@ UiDisplayMenu (
case CfUpdateHelpString:
ControlFlag = CfPrepareToReadKey;
if ((Repaint || NewLine) && (gClassOfVfr != EFI_GENERAL_APPLICATION_SUBCLASS)) {
if (Repaint || NewLine) {
//
// Don't print anything if it is a NULL help token
//
@ -2324,7 +2324,7 @@ UiDisplayMenu (
break;
case ' ':
if (gClassOfVfr != EFI_FRONT_PAGE_SUBCLASS) {
if (gClassOfVfr != FORMSET_CLASS_FRONT_PAGE) {
if (MenuOption->ThisTag->Operand == EFI_IFR_CHECKBOX_OP && !MenuOption->GrayOut) {
ScreenOperation = UiSelect;
}
@ -2585,7 +2585,7 @@ UiDisplayMenu (
//
ControlFlag = CfCheckSelection;
if (gClassOfVfr == EFI_FRONT_PAGE_SUBCLASS) {
if (gClassOfVfr == FORMSET_CLASS_FRONT_PAGE) {
//
// There is no parent menu for FrontPage
//