summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvanjeff <vanjeff>2013-09-26 02:43:43 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2013-09-26 02:43:43 +0000
commit3d7512987172b6751d7a2a9237fc8786b47e41fb (patch)
treef817772fa237cdb9b007fec05c65b172801af683
parent5079c04f2a19479d948b40f129b944e36f5439d4 (diff)
downloadedk2-3d7512987172b6751d7a2a9237fc8786b47e41fb.tar.gz
Sync patches r14614, r14624, r14625, r14673 and r14727 from main trunk.
1. Update sample code for date/time. 2. Enable warningif opcode in browser. 3. Refine question value update logic. 4. Use RETRIEVE instead of CHANGING for refresh question. git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2010.SR1@14728 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c147
-rw-r--r--MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr58
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c38
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c137
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.c25
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.h16
-rw-r--r--MdePkg/Include/Uefi/UefiInternalFormRepresentation.h9
7 files changed, 334 insertions, 96 deletions
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
index aca043a8c2..cf9f6836b3 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
@@ -15,6 +15,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "FormDisplay.h"
+typedef struct {
+ EFI_EVENT SyncEvent;
+ UINT8 *TimeOut;
+ CHAR16 *ErrorInfo;
+} WARNING_IF_CONTEXT;
+
+#define MAX_TIME_OUT_LEN 0x10
+
/**
Concatenate a narrow string to another string.
@@ -561,6 +569,136 @@ CreateMultiStringPopUp (
}
/**
+ Process nothing.
+
+ @param Event The Event need to be process
+ @param Context The context of the event.
+
+**/
+VOID
+EFIAPI
+EmptyEventProcess (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+}
+
+/**
+ Process for the refresh interval statement.
+
+ @param Event The Event need to be process
+ @param Context The context of the event.
+
+**/
+VOID
+EFIAPI
+RefreshTimeOutProcess (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ WARNING_IF_CONTEXT *EventInfo;
+ CHAR16 TimeOutString[MAX_TIME_OUT_LEN];
+
+ EventInfo = (WARNING_IF_CONTEXT *) Context;
+
+ if (*(EventInfo->TimeOut) == 0) {
+ gBS->CloseEvent (Event);
+
+ gBS->SignalEvent (EventInfo->SyncEvent);
+ return;
+ }
+
+ UnicodeSPrint(TimeOutString, MAX_TIME_OUT_LEN, L"%d", *(EventInfo->TimeOut));
+
+ CreateDialog (NULL, gEmptyString, EventInfo->ErrorInfo, gPressEnter, gEmptyString, TimeOutString, NULL);
+
+ *(EventInfo->TimeOut) -= 1;
+}
+
+/**
+ Show the warning message.
+
+ @param RetInfo The input warning string and timeout info.
+
+**/
+VOID
+WarningIfCheck (
+ IN STATEMENT_ERROR_INFO *RetInfo
+ )
+{
+ CHAR16 *ErrorInfo;
+ EFI_EVENT WaitList[2];
+ EFI_EVENT RefreshIntervalEvent;
+ EFI_EVENT TimeOutEvent;
+ UINT8 TimeOut;
+ EFI_STATUS Status;
+ UINTN Index;
+ WARNING_IF_CONTEXT EventContext;
+ EFI_INPUT_KEY Key;
+
+ TimeOutEvent = NULL;
+ RefreshIntervalEvent = NULL;
+
+ ASSERT (RetInfo->StringId != 0);
+ ErrorInfo = GetToken (RetInfo->StringId, gFormData->HiiHandle);
+ TimeOut = RetInfo->TimeOut;
+ if (RetInfo->TimeOut == 0) {
+ do {
+ CreateDialog (&Key, gEmptyString, ErrorInfo, gPressEnter, gEmptyString, NULL);
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ } else {
+ Status = gBS->CreateEvent (EVT_NOTIFY_WAIT, TPL_CALLBACK, EmptyEventProcess, NULL, &TimeOutEvent);
+ ASSERT_EFI_ERROR (Status);
+
+ EventContext.SyncEvent = TimeOutEvent;
+ EventContext.TimeOut = &TimeOut;
+ EventContext.ErrorInfo = ErrorInfo;
+
+ Status = gBS->CreateEvent (EVT_TIMER | EVT_NOTIFY_SIGNAL, TPL_CALLBACK, RefreshTimeOutProcess, &EventContext, &RefreshIntervalEvent);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Show the dialog first to avoid long time not reaction.
+ //
+ gBS->SignalEvent (RefreshIntervalEvent);
+
+ Status = gBS->SetTimer (RefreshIntervalEvent, TimerPeriodic, ONE_SECOND);
+ ASSERT_EFI_ERROR (Status);
+
+ while (TRUE) {
+ Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
+ if (!EFI_ERROR (Status) && Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
+ break;
+ }
+
+ if (Status != EFI_NOT_READY) {
+ continue;
+ }
+
+ WaitList[0] = TimeOutEvent;
+ WaitList[1] = gST->ConIn->WaitForKey;
+
+ Status = gBS->WaitForEvent (2, WaitList, &Index);
+ ASSERT_EFI_ERROR (Status);
+
+ if (Index == 0) {
+ //
+ // Timeout occur, close the hoot time out event.
+ //
+ break;
+ }
+ }
+ }
+
+ gBS->CloseEvent (TimeOutEvent);
+ gBS->CloseEvent (RefreshIntervalEvent);
+
+ FreePool (ErrorInfo);
+}
+
+/**
Process validate for one question.
@param Question The question need to be validate.
@@ -600,7 +738,14 @@ ValidateQuestion (
FreePool (ErrorInfo);
Status = EFI_INVALID_PARAMETER;
- break;
+ break;
+
+ case WARNING_IF_TRUE:
+ //
+ // Condition meet, show up warning message
+ //
+ WarningIfCheck (&RetInfo);
+ break;
default:
break;
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
index 60e9cf2a34..8563be31f6 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
+++ b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
@@ -517,30 +517,12 @@ formset
form formid = 2, // SecondSetupPage,
title = STRING_TOKEN(STR_FORM2_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
-
- date year varid = Date.Year, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_DATE_PROMPT),
- help = STRING_TOKEN(STR_DATE_HELP),
- minimum = 1998,
- maximum = 2099,
- step = 1,
- default = 2004,
-
- month varid = Date.Month, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_DATE_PROMPT),
- help = STRING_TOKEN(STR_DATE_HELP),
- minimum = 1,
- maximum = 12,
- step = 1,
- default = 1,
-
- day varid = Date.Day, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_DATE_PROMPT),
- help = STRING_TOKEN(STR_DATE_HELP),
- minimum = 1,
- maximum = 31,
- step = 0x1,
- default = 1,
+ date
+ name = Date,
+ prompt = STRING_TOKEN(STR_DATE_PROMPT),
+ help = STRING_TOKEN(STR_DATE_HELP),
+ flags = STORAGE_TIME,
+ default = 1/1/2004,
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
ideqval Date.Day == 31
@@ -585,30 +567,10 @@ formset
flags = INTERACTIVE,
key = 0x1242;
- time hour varid = Time.Hour, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_TIME_PROMPT),
- help = STRING_TOKEN(STR_TIME_HELP),
- minimum = 0,
- maximum = 23,
- step = 1,
- default = 0,
-
- minute varid = Time.Minute, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_TIME_PROMPT),
- help = STRING_TOKEN(STR_TIME_HELP),
- minimum = 0,
- maximum = 59,
- step = 1,
- default = 0,
-
- second varid = Time.Second, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_TIME_PROMPT),
- help = STRING_TOKEN(STR_TIME_HELP),
- minimum = 0,
- maximum = 59,
- step = 1,
- default = 0,
-
+ time
+ prompt = STRING_TOKEN(STR_TIME_PROMPT),
+ help = STRING_TOKEN(STR_TIME_HELP),
+ flags = STORAGE_TIME,
endtime;
time
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
index 571ac0a616..a2e336c99f 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
@@ -54,6 +54,7 @@ CreateStatement (
InitializeListHead (&Statement->OptionListHead);
InitializeListHead (&Statement->InconsistentListHead);
InitializeListHead (&Statement->NoSubmitListHead);
+ InitializeListHead (&Statement->WarningListHead);
Statement->Signature = FORM_BROWSER_STATEMENT_SIGNATURE;
@@ -806,6 +807,17 @@ DestroyStatement (
DestroyExpression (Expression);
}
+ //
+ // Free WarningIf List
+ //
+ while (!IsListEmpty (&Statement->WarningListHead)) {
+ Link = GetFirstNode (&Statement->WarningListHead);
+ Expression = FORM_EXPRESSION_FROM_LINK (Link);
+ RemoveEntryList (&Expression->Link);
+
+ DestroyExpression (Expression);
+ }
+
if (Statement->Expression != NULL) {
FreePool (Statement->Expression);
}
@@ -1615,8 +1627,14 @@ ParseOpCodes (
// Create a EFI variable Storage for this FormSet
//
if (OpCodeLength < sizeof (EFI_IFR_VARSTORE_EFI)) {
+ //
+ // Create efi varstore with format follow UEFI spec before 2.3.1.
+ //
Storage = CreateStorage (FormSet, EFI_HII_VARSTORE_EFI_VARIABLE, OpCodeData);
} else {
+ //
+ // Create efi varstore with format follow UEFI spec 2.3.1 and later.
+ //
Storage = CreateStorage (FormSet, EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER, OpCodeData);
}
CopyMem (&Storage->VarStoreId, &((EFI_IFR_VARSTORE_EFI *) OpCodeData)->VarStoreId, sizeof (EFI_VARSTORE_ID));
@@ -2004,6 +2022,25 @@ ParseOpCodes (
}
break;
+ case EFI_IFR_WARNING_IF_OP:
+ //
+ // Create an Expression node
+ //
+ CurrentExpression = CreateExpression (CurrentForm);
+ CopyMem (&CurrentExpression->Error, &((EFI_IFR_WARNING_IF *) OpCodeData)->Warning, sizeof (EFI_STRING_ID));
+ CurrentExpression->TimeOut = ((EFI_IFR_WARNING_IF *) OpCodeData)->TimeOut;
+ CurrentExpression->Type = EFI_HII_EXPRESSION_WARNING_IF;
+ InsertTailList (&CurrentStatement->WarningListHead, &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:
//
// Question and Option will appear in scope of this OpCode
@@ -2311,6 +2348,7 @@ ParseOpCodes (
case EFI_IFR_NO_SUBMIT_IF_OP:
case EFI_IFR_INCONSISTENT_IF_OP:
+ case EFI_IFR_WARNING_IF_OP:
//
// Ignore end of EFI_IFR_NO_SUBMIT_IF and EFI_IFR_INCONSISTENT_IF
//
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
index 6246cc53fc..8e6dff0dd4 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
@@ -52,6 +52,7 @@ EvaluateFormExpressions (
if (Expression->Type == EFI_HII_EXPRESSION_INCONSISTENT_IF ||
Expression->Type == EFI_HII_EXPRESSION_NO_SUBMIT_IF ||
+ Expression->Type == EFI_HII_EXPRESSION_WARNING_IF ||
Expression->Type == EFI_HII_EXPRESSION_WRITE ||
(Expression->Type == EFI_HII_EXPRESSION_READ && Form->FormType != STANDARD_MAP_FORM_TYPE)) {
//
@@ -159,7 +160,7 @@ UpdateStatement (
//
// Question value may be changed, need invoke its Callback()
//
- ProcessCallBackFunction (gCurrentSelection, Statement, EFI_BROWSER_ACTION_CHANGING, FALSE);
+ ProcessCallBackFunction (gCurrentSelection, gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, EFI_BROWSER_ACTION_RETRIEVE, FALSE);
if (mHiiPackageListUpdated) {
//
@@ -228,13 +229,15 @@ CreateRefreshEvent (
Perform value check for a question.
@param Question The question need to do check.
+ @param Type Condition type need to check.
@param ErrorInfo Return info about the error.
@retval The check result.
**/
UINT32
-InConsistentIfCheck (
+ConditionCheck (
IN FORM_BROWSER_STATEMENT *Question,
+ IN UINT8 Type,
OUT STATEMENT_ERROR_INFO *ErrorInfo
)
{
@@ -245,8 +248,23 @@ InConsistentIfCheck (
UINT32 RetVal;
RetVal = STATEMENT_VALID;
- ListHead = &Question->InconsistentListHead;
+ ListHead = NULL;
+ switch (Type) {
+ case EFI_HII_EXPRESSION_INCONSISTENT_IF:
+ ListHead = &Question->InconsistentListHead;
+ break;
+
+ case EFI_HII_EXPRESSION_WARNING_IF:
+ ListHead = &Question->WarningListHead;
+ break;
+
+ default:
+ ASSERT (FALSE);
+ return RetVal;
+ }
+
+ ASSERT (ListHead != NULL);
Link = GetFirstNode (ListHead);
while (!IsNull (ListHead, Link)) {
Expression = FORM_EXPRESSION_FROM_LINK (Link);
@@ -262,8 +280,21 @@ InConsistentIfCheck (
if ((Expression->Result.Type == EFI_IFR_TYPE_BOOLEAN) && Expression->Result.Value.b) {
ErrorInfo->StringId = Expression->Error;
- ErrorInfo->TimeOut = 0;
- RetVal = INCOSISTENT_IF_TRUE;
+ switch (Type) {
+ case EFI_HII_EXPRESSION_INCONSISTENT_IF:
+ ErrorInfo->TimeOut = 0;
+ RetVal = INCOSISTENT_IF_TRUE;
+ break;
+
+ case EFI_HII_EXPRESSION_WARNING_IF:
+ ErrorInfo->TimeOut = Expression->TimeOut;
+ RetVal = WARNING_IF_TRUE;
+ break;
+
+ default:
+ ASSERT (FALSE);
+ break;
+ }
break;
}
}
@@ -324,7 +355,14 @@ QuestionCheck (
// Do the inconsistentif check.
//
if (!IsListEmpty (&Question->InconsistentListHead)) {
- RetVal = InConsistentIfCheck(Question, ErrorInfo);
+ RetVal = ConditionCheck(Question, EFI_HII_EXPRESSION_INCONSISTENT_IF, ErrorInfo);
+ }
+
+ //
+ // Do the warningif check.
+ //
+ if (RetVal == STATEMENT_VALID && !IsListEmpty (&Question->WarningListHead)) {
+ RetVal = ConditionCheck(Question, EFI_HII_EXPRESSION_WARNING_IF, ErrorInfo);
}
//
@@ -456,7 +494,7 @@ InitializeDisplayStatement (
//
// Save the validate check question for later use.
//
- if (!IsListEmpty (&Statement->InconsistentListHead)) {
+ if (!IsListEmpty (&Statement->InconsistentListHead) || !IsListEmpty (&Statement->WarningListHead)) {
DisplayStatement->ValidateQuestion = QuestionCheck;
}
@@ -1326,7 +1364,7 @@ ProcessGotoOpCode (
//
// Check whether the device path string is a valid string.
//
- if (Statement->HiiValue.Value.ref.DevicePath != 0 && StringPtr != NULL) {
+ if (Statement->HiiValue.Value.ref.DevicePath != 0 && StringPtr != NULL && StringPtr[0] != L'\0') {
if (Selection->Form->ModalForm) {
return Status;
}
@@ -1635,9 +1673,6 @@ ProcessUserInput (
CopyMem (&Statement->HiiValue, &UserInput->InputValue, sizeof (EFI_HII_VALUE));
break;
}
- if (Statement->Operand != EFI_IFR_PASSWORD_OP) {
- SetQuestionValue (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithEditBuffer);
- }
break;
}
}
@@ -2003,6 +2038,8 @@ FindNextMenu (
about the Selection, form and formset to be displayed.
On output, Selection return the screen item that is selected
by user.
+ @param FormSet The formset this question belong to.
+ @param Form The form this question belong to.
@param Question The Question which need to call.
@param Action The action request.
@param SkipSaveOrDiscard Whether skip save or discard action.
@@ -2013,6 +2050,8 @@ FindNextMenu (
EFI_STATUS
ProcessCallBackFunction (
IN OUT UI_MENU_SELECTION *Selection,
+ IN FORM_BROWSER_FORMSET *FormSet,
+ IN FORM_BROWSER_FORM *Form,
IN FORM_BROWSER_STATEMENT *Question,
IN EFI_BROWSER_ACTION Action,
IN BOOLEAN SkipSaveOrDiscard
@@ -2029,23 +2068,26 @@ ProcessCallBackFunction (
BOOLEAN NeedExit;
LIST_ENTRY *Link;
BROWSER_SETTING_SCOPE SettingLevel;
+ EFI_IFR_TYPE_VALUE BackUpValue;
+ UINT8 *BackUpBuffer;
- ConfigAccess = Selection->FormSet->ConfigAccess;
+ ConfigAccess = FormSet->ConfigAccess;
SubmitFormIsRequired = FALSE;
SettingLevel = FormSetLevel;
DiscardFormIsRequired = FALSE;
NeedExit = FALSE;
Status = EFI_SUCCESS;
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
+ BackUpBuffer = NULL;
if (ConfigAccess == NULL) {
return EFI_SUCCESS;
}
- Link = GetFirstNode (&Selection->Form->StatementListHead);
- while (!IsNull (&Selection->Form->StatementListHead, Link)) {
+ Link = GetFirstNode (&Form->StatementListHead);
+ while (!IsNull (&Form->StatementListHead, Link)) {
Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
- Link = GetNextNode (&Selection->Form->StatementListHead, Link);
+ Link = GetNextNode (&Form->StatementListHead, Link);
//
// if Question != NULL, only process the question. Else, process all question in this form.
@@ -2062,7 +2104,7 @@ ProcessCallBackFunction (
// Check whether Statement is disabled.
//
if (Statement->Expression != NULL) {
- if (EvaluateExpressionList(Statement->Expression, TRUE, Selection->FormSet, Selection->Form) == ExpressDisable) {
+ if (EvaluateExpressionList(Statement->Expression, TRUE, FormSet, Form) == ExpressDisable) {
continue;
}
}
@@ -2075,7 +2117,18 @@ ProcessCallBackFunction (
//
TypeValue = (EFI_IFR_TYPE_VALUE *) Statement->BufferValue;
}
-
+
+ //
+ // If EFI_BROWSER_ACTION_CHANGING type, back up the new question value.
+ //
+ if (Action == EFI_BROWSER_ACTION_CHANGING) {
+ if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {
+ BackUpBuffer = AllocateCopyPool(Statement->StorageWidth + sizeof(CHAR16), Statement->BufferValue);
+ } else {
+ CopyMem (&BackUpValue, &HiiValue->Value, sizeof (EFI_IFR_TYPE_VALUE));
+ }
+ }
+
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
Status = ConfigAccess->Callback (
ConfigAccess,
@@ -2139,15 +2192,31 @@ ProcessCallBackFunction (
// "retrieve" should update to the question's temp buffer.
//
if (Action == EFI_BROWSER_ACTION_CHANGING || Action == EFI_BROWSER_ACTION_RETRIEVE) {
- SetQuestionValue(Selection->FormSet, Selection->Form, Statement, GetSetValueWithEditBuffer);
+ SetQuestionValue(FormSet, Form, Statement, GetSetValueWithEditBuffer);
}
} else {
//
+ // If the callback returns EFI_UNSUPPORTED for EFI_BROWSER_ACTION_CHANGING,
+ // then the browser will use the value passed to Callback() and ignore the
+ // value returned by Callback().
+ //
+ if (Action == EFI_BROWSER_ACTION_CHANGING && Status == EFI_UNSUPPORTED) {
+ if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {
+ CopyMem (Statement->BufferValue, BackUpBuffer, Statement->StorageWidth + sizeof(CHAR16));
+ } else {
+ CopyMem (&HiiValue->Value, &BackUpValue, sizeof (EFI_IFR_TYPE_VALUE));
+ }
+
+ SetQuestionValue(FormSet, Form, Statement, GetSetValueWithEditBuffer);
+ }
+
+ //
// According the spec, return fail from call back of "changing" and
// "retrieve", should restore the question's value.
//
- if (Action == EFI_BROWSER_ACTION_CHANGING || Action == EFI_BROWSER_ACTION_RETRIEVE) {
- GetQuestionValue(Selection->FormSet, Selection->Form, Statement, GetSetValueWithEditBuffer);
+ if ((Action == EFI_BROWSER_ACTION_CHANGING && Status != EFI_UNSUPPORTED) ||
+ Action == EFI_BROWSER_ACTION_RETRIEVE) {
+ GetQuestionValue(FormSet, Form, Statement, GetSetValueWithEditBuffer);
}
if (Status == EFI_UNSUPPORTED) {
@@ -2157,14 +2226,18 @@ ProcessCallBackFunction (
Status = EFI_SUCCESS;
}
}
+
+ if (BackUpBuffer != NULL) {
+ FreePool (BackUpBuffer);
+ }
}
if (SubmitFormIsRequired && !SkipSaveOrDiscard) {
- SubmitForm (Selection->FormSet, Selection->Form, SettingLevel);
+ SubmitForm (FormSet, Form, SettingLevel);
}
if (DiscardFormIsRequired && !SkipSaveOrDiscard) {
- DiscardForm (Selection->FormSet, Selection->Form, SettingLevel);
+ DiscardForm (FormSet, Form, SettingLevel);
}
if (NeedExit) {
@@ -2266,6 +2339,11 @@ SetupBrowser (
return Status;
}
+ if ((Selection->Handle != mCurrentHiiHandle) ||
+ (!CompareGuid (&Selection->FormSetGuid, &mCurrentFormSetGuid))) {
+ gFinishRetrieveCall = FALSE;
+ }
+
//
// Initialize current settings of Questions in this FormSet
//
@@ -2344,7 +2422,7 @@ SetupBrowser (
CopyGuid (&mCurrentFormSetGuid, &Selection->FormSetGuid);
mCurrentFormId = Selection->FormId;
- Status = ProcessCallBackFunction (Selection, NULL, EFI_BROWSER_ACTION_FORM_OPEN, FALSE);
+ Status = ProcessCallBackFunction (Selection, gCurrentSelection->FormSet, Selection->Form, NULL, EFI_BROWSER_ACTION_FORM_OPEN, FALSE);
if (EFI_ERROR (Status)) {
goto Done;
}
@@ -2368,6 +2446,11 @@ SetupBrowser (
}
//
+ // Finish call RETRIEVE callback for this formset.
+ //
+ gFinishRetrieveCall = TRUE;
+
+ //
// IFR is updated during callback of read value, force to reparse the IFR binary
//
if (mHiiPackageListUpdated) {
@@ -2392,7 +2475,7 @@ SetupBrowser (
if ((ConfigAccess != NULL) &&
((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK) &&
(Statement->Operand != EFI_IFR_PASSWORD_OP)) {
- Status = ProcessCallBackFunction(Selection, Statement, EFI_BROWSER_ACTION_CHANGING, FALSE);
+ Status = ProcessCallBackFunction(Selection, Selection->FormSet, Selection->Form, Statement, EFI_BROWSER_ACTION_CHANGING, FALSE);
if (Statement->Operand == EFI_IFR_REF_OP) {
//
// Process dynamic update ref opcode.
@@ -2414,8 +2497,10 @@ SetupBrowser (
}
if (!EFI_ERROR (Status) && Statement->Operand != EFI_IFR_REF_OP) {
- ProcessCallBackFunction(Selection, Statement, EFI_BROWSER_ACTION_CHANGED, FALSE);
+ ProcessCallBackFunction(Selection, Selection->FormSet, Selection->Form, Statement, EFI_BROWSER_ACTION_CHANGED, FALSE);
}
+ } else if (Statement->Operand != EFI_IFR_PASSWORD_OP) {
+ SetQuestionValue (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithEditBuffer);
}
}
@@ -2450,7 +2535,7 @@ SetupBrowser (
(!CompareGuid (&Selection->FormSetGuid, &mCurrentFormSetGuid)) ||
(Selection->FormId != mCurrentFormId))) {
- Status = ProcessCallBackFunction (Selection, NULL, EFI_BROWSER_ACTION_FORM_CLOSE, FALSE);
+ Status = ProcessCallBackFunction (Selection, Selection->FormSet, Selection->Form, NULL, EFI_BROWSER_ACTION_FORM_CLOSE, FALSE);
if (EFI_ERROR (Status)) {
goto Done;
}
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 4b667e54c8..7975a1df19 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -48,6 +48,7 @@ LIST_ENTRY gBrowserFormSetList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserFor
LIST_ENTRY gBrowserHotKeyList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserHotKeyList);
LIST_ENTRY gBrowserStorageList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserStorageList);
+BOOLEAN gFinishRetrieveCall;
BOOLEAN gResetRequired;
BOOLEAN gExitRequired;
BROWSER_SETTING_SCOPE gBrowserSettingScope = FormSetLevel;
@@ -257,8 +258,11 @@ LoadAllHiiFormset (
EFI_GUID ZeroGuid;
EFI_STATUS Status;
FORM_BROWSER_FORMSET *OldFormset;
+ BOOLEAN OldRetrieveValue;
OldFormset = mSystemLevelFormSet;
+ OldRetrieveValue = gFinishRetrieveCall;
+ gFinishRetrieveCall = FALSE;
//
// Get all the Hii handles
@@ -307,6 +311,7 @@ LoadAllHiiFormset (
//
FreePool (HiiHandles);
+ gFinishRetrieveCall = OldRetrieveValue;
mSystemLevelFormSet = OldFormset;
}
@@ -365,6 +370,7 @@ SendForm (
//
SaveBrowserContext ();
+ gFinishRetrieveCall = FALSE;
gResetRequired = FALSE;
gExitRequired = FALSE;
Status = EFI_SUCCESS;
@@ -1264,13 +1270,6 @@ GetQuestionValue (
}
//
- // Statement don't have storage, skip them
- //
- if (Question->QuestionId == 0) {
- return Status;
- }
-
- //
// Question value is provided by an Expression, evaluate it
//
if (Question->ValueExpression != NULL) {
@@ -1686,13 +1685,6 @@ SetQuestionValue (
}
//
- // Statement don't have storage, skip them
- //
- if (Question->QuestionId == 0) {
- return Status;
- }
-
- //
// If Question value is provided by an Expression, then it is read only
//
if (Question->ValueExpression != NULL) {
@@ -3665,7 +3657,8 @@ LoadFormConfig (
// Call the Retrieve call back function for all questions.
//
if ((FormSet->ConfigAccess != NULL) && (Selection != NULL) &&
- ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK)) {
+ ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK) &&
+ !gFinishRetrieveCall) {
//
// Check QuestionValue does exist.
//
@@ -3689,7 +3682,7 @@ LoadFormConfig (
);
}
- Status = ProcessCallBackFunction(Selection, Question, EFI_BROWSER_ACTION_RETRIEVE, TRUE);
+ Status = ProcessCallBackFunction(Selection, FormSet, Form, Question, EFI_BROWSER_ACTION_RETRIEVE, TRUE);
}
//
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
index 9f51240f52..77a0ad1bac 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
@@ -106,11 +106,12 @@ typedef struct {
#define EFI_HII_EXPRESSION_RULE 6
#define EFI_HII_EXPRESSION_READ 7
#define EFI_HII_EXPRESSION_WRITE 8
+#define EFI_HII_EXPRESSION_WARNING_IF 9
#define EFI_HII_VARSTORE_BUFFER 0
#define EFI_HII_VARSTORE_NAME_VALUE 1
-#define EFI_HII_VARSTORE_EFI_VARIABLE 2
-#define EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER 3
+#define EFI_HII_VARSTORE_EFI_VARIABLE 2 // EFI Varstore type follow UEFI spec before 2.3.1.
+#define EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER 3 // EFI varstore type follow UEFI spec 2.3.1 and later.
#define FORM_INCONSISTENT_VALIDATION 0
#define FORM_NO_SUBMIT_VALIDATION 1
@@ -223,6 +224,8 @@ typedef struct {
EFI_HII_VALUE Result; // Expression evaluation result
+ UINT8 TimeOut; // For EFI_IFR_WARNING_IF
+
LIST_ENTRY OpCodeListHead; // OpCodes consist of this expression (EXPRESSION_OPCODE)
} FORM_EXPRESSION;
@@ -350,6 +353,7 @@ typedef struct {
LIST_ENTRY InconsistentListHead;// nested inconsistent expression list (FORM_EXPRESSION)
LIST_ENTRY NoSubmitListHead; // nested nosubmit expression list (FORM_EXPRESSION)
+ LIST_ENTRY WarningListHead; // nested warning expression list (FORM_EXPRESSION)
FORM_EXPRESSION_LIST *Expression; // nesting inside of GrayOutIf/DisableIf/SuppressIf
FORM_EXPRESSION *ReadExpression; // nested EFI_IFR_READ, provide this question value by read expression.
@@ -537,7 +541,7 @@ extern EDKII_FORM_DISPLAY_ENGINE_PROTOCOL *mFormDisplay;
extern BOOLEAN gResetRequired;
extern BOOLEAN gExitRequired;
-
+extern BOOLEAN gFinishRetrieveCall;
extern LIST_ENTRY gBrowserFormSetList;
extern LIST_ENTRY gBrowserHotKeyList;
extern BROWSER_SETTING_SCOPE gBrowserSettingScope;
@@ -1153,7 +1157,9 @@ IsStorageDataChangedForFormSet (
about the Selection, form and formset to be displayed.
On output, Selection return the screen item that is selected
by user.
- @param Statement The Question which need to call.
+ @param FormSet The formset this question belong to.
+ @param Form The form this question belong to.
+ @param Question The Question which need to call.
@param Action The action request.
@param SkipSaveOrDiscard Whether skip save or discard action.
@@ -1163,6 +1169,8 @@ IsStorageDataChangedForFormSet (
EFI_STATUS
ProcessCallBackFunction (
IN OUT UI_MENU_SELECTION *Selection,
+ IN FORM_BROWSER_FORMSET *FormSet,
+ IN FORM_BROWSER_FORM *Form,
IN FORM_BROWSER_STATEMENT *Question,
IN EFI_BROWSER_ACTION Action,
IN BOOLEAN SkipSaveOrDiscard
diff --git a/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h b/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
index 8c026de2dc..cad7d0e776 100644
--- a/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
+++ b/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
@@ -3,7 +3,7 @@
IFR is primarily consumed by the EFI presentation engine, and produced by EFI
internal application and drivers as well as all add-in card option-ROM drivers
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
@@ -779,6 +779,7 @@ typedef union {
#define EFI_IFR_SECURITY_OP 0x60
#define EFI_IFR_MODAL_TAG_OP 0x61
#define EFI_IFR_REFRESH_ID_OP 0x62
+#define EFI_IFR_WARNING_IF_OP 0x63
//
// Definitions of IFR Standard Headers
@@ -1120,6 +1121,12 @@ typedef struct _EFI_IFR_NO_SUBMIT_IF {
EFI_STRING_ID Error;
} EFI_IFR_NO_SUBMIT_IF;
+typedef struct _EFI_IFR_WARNING_IF {
+ EFI_IFR_OP_HEADER Header;
+ EFI_STRING_ID Warning;
+ UINT8 TimeOut;
+} EFI_IFR_WARNING_IF;
+
typedef struct _EFI_IFR_REFRESH {
EFI_IFR_OP_HEADER Header;
UINT8 RefreshInterval;