summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-11-04 14:28:08 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-11-04 14:28:08 +0000
commit8d00a0f1955de7aa4b658009a36df5165d0a75be (patch)
tree1eec5d9bd12036da7ebf1ec38d5f7afbfd2a4e03 /MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
parent9185c388a9e992bcbcf38d10fb24321a60950562 (diff)
downloadedk2-platforms-8d00a0f1955de7aa4b658009a36df5165d0a75be.tar.xz
Sync in bug fix from EDK I:
1) issue with setup browser and IFR refresh opcode 2) [HII]HIIConfigRoutingExportConfig generate error format of <MultiConfigAltResp> 3) [HII] ConfigRouting->ExtractConfig() will cause overflow 4) [Hii Database] EFI_HII_DATABASE_NOTIFY should be invoked when a string package is created internally when a new String Token is created 5) [PT]HIIConfigAccessProtocolTest fail on NT32uefi 6) Incorrect HII package types in EDK git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6378 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/SetupBrowserDxe/Ui.c')
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Ui.c176
1 files changed, 124 insertions, 52 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
index fc715fea5b..639854e8a8 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
@@ -295,66 +295,122 @@ UiFreeRefreshList (
Refresh screen.
**/
-VOID
+EFI_STATUS
RefreshForm (
VOID
)
{
- CHAR16 *OptionString;
- MENU_REFRESH_ENTRY *MenuRefreshEntry;
- UINTN Index;
- UINTN Loop;
- EFI_STATUS Status;
- UI_MENU_SELECTION *Selection;
- FORM_BROWSER_STATEMENT *Question;
-
- OptionString = NULL;
+ CHAR16 *OptionString;
+ MENU_REFRESH_ENTRY *MenuRefreshEntry;
+ UINTN Index;
+ EFI_STATUS Status;
+ UI_MENU_SELECTION *Selection;
+ FORM_BROWSER_STATEMENT *Question;
+ EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
+ EFI_HII_VALUE *HiiValue;
+ EFI_BROWSER_ACTION_REQUEST ActionRequest;
if (gMenuRefreshHead != NULL) {
MenuRefreshEntry = gMenuRefreshHead;
+ //
+ // Reset FormPackage update flag
+ //
+ mHiiPackageListUpdated = FALSE;
+
do {
gST->ConOut->SetAttribute (gST->ConOut, MenuRefreshEntry->CurrentAttribute);
Selection = MenuRefreshEntry->Selection;
Question = MenuRefreshEntry->MenuOption->ThisTag;
+ Status = GetQuestionValue (Selection->FormSet, Selection->Form, Question, FALSE);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ OptionString = NULL;
+ ProcessOptions (Selection, MenuRefreshEntry->MenuOption, FALSE, &OptionString);
+
+ if (OptionString != NULL) {
+ //
+ // If leading spaces on OptionString - remove the spaces
+ //
+ for (Index = 0; OptionString[Index] == L' '; Index++)
+ ;
+
+ PrintStringAt (MenuRefreshEntry->CurrentColumn, MenuRefreshEntry->CurrentRow, &OptionString[Index]);
+ gBS->FreePool (OptionString);
+ }
+
//
- // Don't update Question being edited
+ // Question value may be changed, need invoke its Callback()
//
- if (Question != MenuRefreshEntry->Selection->Statement) {
+ ConfigAccess = Selection->FormSet->ConfigAccess;
+ if ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) && (ConfigAccess != NULL)) {
+ ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
- Status = GetQuestionValue (Selection->FormSet, Selection->Form, Question, FALSE);
- if (EFI_ERROR (Status)) {
- return;
+ HiiValue = &Question->HiiValue;
+ if (HiiValue->Type == EFI_IFR_TYPE_STRING) {
+ //
+ // Create String in HII database for Configuration Driver to retrieve
+ //
+ HiiValue->Value.string = NewString ((CHAR16 *) Question->BufferValue, Selection->FormSet->HiiHandle);
}
- ProcessOptions (Selection, MenuRefreshEntry->MenuOption, FALSE, &OptionString);
+ Status = ConfigAccess->Callback (
+ ConfigAccess,
+ EFI_BROWSER_ACTION_CHANGING,
+ Question->QuestionId,
+ HiiValue->Type,
+ &HiiValue->Value,
+ &ActionRequest
+ );
- if (OptionString != NULL) {
+ if (HiiValue->Type == EFI_IFR_TYPE_STRING) {
//
- // If leading spaces on OptionString - remove the spaces
+ // Clean the String in HII Database
//
- for (Index = 0; OptionString[Index] == L' '; Index++)
- ;
+ DeleteString (HiiValue->Value.string, Selection->FormSet->HiiHandle);
+ }
- for (Loop = 0; OptionString[Index] != CHAR_NULL; Index++) {
- OptionString[Loop] = OptionString[Index];
- Loop++;
- }
+ if (!EFI_ERROR (Status)) {
+ switch (ActionRequest) {
+ case EFI_BROWSER_ACTION_REQUEST_RESET:
+ gResetRequired = TRUE;
+ break;
- OptionString[Loop] = CHAR_NULL;
+ case EFI_BROWSER_ACTION_REQUEST_SUBMIT:
+ SubmitForm (Selection->FormSet, Selection->Form);
+ break;
- PrintStringAt (MenuRefreshEntry->CurrentColumn, MenuRefreshEntry->CurrentRow, OptionString);
- gBS->FreePool (OptionString);
+ case EFI_BROWSER_ACTION_REQUEST_EXIT:
+ Selection->Action = UI_ACTION_EXIT;
+ gNvUpdateRequired = FALSE;
+ break;
+
+ default:
+ break;
+ }
}
}
MenuRefreshEntry = MenuRefreshEntry->Next;
} while (MenuRefreshEntry != NULL);
+
+ if (mHiiPackageListUpdated) {
+ //
+ // Package list is updated, force to reparse IFR binary of target Formset
+ //
+ mHiiPackageListUpdated = FALSE;
+ Selection->Action = UI_ACTION_REFRESH_FORMSET;
+ return EFI_SUCCESS;
+ }
}
+
+ return EFI_TIMEOUT;
}
@@ -446,7 +502,7 @@ UiWaitForSingleEvent (
if (!EFI_ERROR (Status) && Index == 1) {
Status = EFI_TIMEOUT;
if (RefreshInterval != 0) {
- RefreshForm ();
+ Status = RefreshForm ();
}
}
@@ -1595,7 +1651,16 @@ UiDisplayMenu (
Row = OriginalRow;
gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT | FIELD_BACKGROUND);
- ProcessOptions (Selection, MenuOption, FALSE, &OptionString);
+ Status = ProcessOptions (Selection, MenuOption, FALSE, &OptionString);
+ if (EFI_ERROR (Status)) {
+ //
+ // Repaint to clear possible error prompt pop-up
+ //
+ Repaint = TRUE;
+ NewLine = TRUE;
+ ControlFlag = CfRepaint;
+ break;
+ }
if (OptionString != NULL) {
if (Statement->Operand == EFI_IFR_DATE_OP || Statement->Operand == EFI_IFR_TIME_OP) {
@@ -2023,12 +2088,8 @@ UiDisplayMenu (
}
}
- if (((NewPos->ForwardLink != &Menu) && (ScreenOperation == UiDown)) ||
- ((NewPos->BackLink != &Menu) && (ScreenOperation == UiUp)) ||
- (ScreenOperation == UiNoOperation)
- ) {
- UpdateKeyHelp (MenuOption, FALSE);
- }
+ UpdateKeyHelp (MenuOption, FALSE);
+
//
// Clear reverse attribute
//
@@ -2095,17 +2156,22 @@ UiDisplayMenu (
Status = UiWaitForSingleEvent (gST->ConIn->WaitForKey, 0, MinRefreshInterval);
} while (Status == EFI_TIMEOUT);
- if (Status == EFI_TIMEOUT) {
- Key.UnicodeChar = CHAR_CARRIAGE_RETURN;
- } else {
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
+ if (Selection->Action == UI_ACTION_REFRESH_FORMSET) {
//
- // if we encounter error, continue to read another key in.
+ // IFR is updated in Callback of refresh opcode, re-parse it
//
- if (EFI_ERROR (Status)) {
- ControlFlag = CfReadKey;
- continue;
- }
+ ControlFlag = CfUiReset;
+ Selection->Statement = NULL;
+ break;
+ }
+
+ Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
+ //
+ // if we encounter error, continue to read another key in.
+ //
+ if (EFI_ERROR (Status)) {
+ ControlFlag = CfReadKey;
+ break;
}
if (IsListEmpty (&Menu) && Key.UnicodeChar != CHAR_NULL) {
@@ -2138,6 +2204,13 @@ UiDisplayMenu (
gDirection = SCAN_LEFT;
}
Status = ProcessOptions (Selection, MenuOption, TRUE, &OptionString);
+ if (EFI_ERROR (Status)) {
+ //
+ // Repaint to clear possible error prompt pop-up
+ //
+ Repaint = TRUE;
+ NewLine = TRUE;
+ }
if (OptionString != NULL) {
FreePool (OptionString);
}
@@ -2378,15 +2451,14 @@ UiDisplayMenu (
if (EFI_ERROR (Status)) {
Repaint = TRUE;
NewLine = TRUE;
- break;
- }
-
- if (OptionString != NULL) {
- PrintStringAt (LocalScreen.LeftColumn + gPromptBlockWidth + 1, MenuOption->Row, OptionString);
- gBS->FreePool (OptionString);
- }
+ UpdateKeyHelp (MenuOption, FALSE);
+ } else {
+ Selection->Action = UI_ACTION_REFRESH_FORM;
+ }
- Selection->Action = UI_ACTION_REFRESH_FORM;
+ if (OptionString != NULL) {
+ FreePool (OptionString);
+ }
break;
}
break;