Revision: 14728 http://sourceforge.net/p/edk2/code/14728 Author: vanjeff Date: 2013-09-26 02:43:43 +0000 (Thu, 26 Sep 2013) Log Message: ----------- 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.
Revision Links: -------------- http://sourceforge.net/p/edk2/code/14614 http://sourceforge.net/p/edk2/code/14624 http://sourceforge.net/p/edk2/code/14625 http://sourceforge.net/p/edk2/code/14673 http://sourceforge.net/p/edk2/code/14727 Modified Paths: -------------- branches/UDK2010.SR1/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c branches/UDK2010.SR1/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h branches/UDK2010.SR1/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h Modified: branches/UDK2010.SR1/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c =================================================================== --- branches/UDK2010.SR1/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c 2013-09-25 12:40:31 UTC (rev 14727) +++ branches/UDK2010.SR1/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c 2013-09-26 02:43:43 UTC (rev 14728) @@ -15,6 +15,14 @@ #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 @@ } /** + 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,8 +738,15 @@ FreePool (ErrorInfo); Status = EFI_INVALID_PARAMETER; - break; + break; + case WARNING_IF_TRUE: + // + // Condition meet, show up warning message + // + WarningIfCheck (&RetInfo); + break; + default: break; } Modified: branches/UDK2010.SR1/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr =================================================================== --- branches/UDK2010.SR1/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr 2013-09-25 12:40:31 UTC (rev 14727) +++ branches/UDK2010.SR1/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr 2013-09-26 02:43:43 UTC (rev 14728) @@ -517,31 +517,13 @@ 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 + name = Date, + prompt = STRING_TOKEN(STR_DATE_PROMPT), + help = STRING_TOKEN(STR_DATE_HELP), + flags = STORAGE_TIME, + default = 1/1/2004, - 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, - inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP), ideqval Date.Day == 31 AND @@ -585,30 +567,10 @@ 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 Modified: branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c =================================================================== --- branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c 2013-09-25 12:40:31 UTC (rev 14727) +++ branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c 2013-09-26 02:43:43 UTC (rev 14728) @@ -54,6 +54,7 @@ InitializeListHead (&Statement->OptionListHead); InitializeListHead (&Statement->InconsistentListHead); InitializeListHead (&Statement->NoSubmitListHead); + InitializeListHead (&Statement->WarningListHead); Statement->Signature = FORM_BROWSER_STATEMENT_SIGNATURE; @@ -806,6 +807,17 @@ 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 @@ // 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 @@ } 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 @@ 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 // Modified: branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c =================================================================== --- branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c 2013-09-25 12:40:31 UTC (rev 14727) +++ branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c 2013-09-26 02:43:43 UTC (rev 14728) @@ -52,6 +52,7 @@ 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 @@ // // 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 @@ 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 @@ 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 @@ 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,10 +355,17 @@ // 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); + } + + // // Restore the quesion value. // switch (Question->Operand) { @@ -456,7 +494,7 @@ // // 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 @@ // // 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ // 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 @@ // 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 @@ // "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 @@ 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 @@ return Status; } + if ((Selection->Handle != mCurrentHiiHandle) || + (!CompareGuid (&Selection->FormSetGuid, &mCurrentFormSetGuid))) { + gFinishRetrieveCall = FALSE; + } + // // Initialize current settings of Questions in this FormSet // @@ -2344,7 +2422,7 @@ 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 @@ } // + // 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 @@ 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 @@ } 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 @@ (!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; } Modified: branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c =================================================================== --- branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c 2013-09-25 12:40:31 UTC (rev 14727) +++ branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c 2013-09-26 02:43:43 UTC (rev 14728) @@ -48,6 +48,7 @@ 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 @@ 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 @@ // FreePool (HiiHandles); + gFinishRetrieveCall = OldRetrieveValue; mSystemLevelFormSet = OldFormset; } @@ -365,6 +370,7 @@ // SaveBrowserContext (); + gFinishRetrieveCall = FALSE; gResetRequired = FALSE; gExitRequired = FALSE; Status = EFI_SUCCESS; @@ -1264,13 +1270,6 @@ } // - // 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 @@ } // - // 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 @@ // 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 @@ ); } - Status = ProcessCallBackFunction(Selection, Question, EFI_BROWSER_ACTION_RETRIEVE, TRUE); + Status = ProcessCallBackFunction(Selection, FormSet, Form, Question, EFI_BROWSER_ACTION_RETRIEVE, TRUE); } // Modified: branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h =================================================================== --- branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h 2013-09-25 12:40:31 UTC (rev 14727) +++ branches/UDK2010.SR1/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h 2013-09-26 02:43:43 UTC (rev 14728) @@ -106,11 +106,12 @@ #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 @@ 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 @@ 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 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 @@ 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 @@ 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 Modified: branches/UDK2010.SR1/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h =================================================================== --- branches/UDK2010.SR1/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h 2013-09-25 12:40:31 UTC (rev 14727) +++ branches/UDK2010.SR1/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h 2013-09-26 02:43:43 UTC (rev 14728) @@ -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 @@ #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 @@ 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; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk _______________________________________________ edk2-commits mailing list edk2-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-commits