2 Utility functions for UI presentation.
4 Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 BOOLEAN mHiiPackageListUpdated
;
18 UI_MENU_SELECTION
*gCurrentSelection
;
19 EFI_HII_HANDLE mCurrentHiiHandle
= NULL
;
20 EFI_GUID mCurrentFormSetGuid
= {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}};
21 UINT16 mCurrentFormId
= 0;
24 Clear retangle with specified text attribute.
26 @param LeftColumn Left column of retangle.
27 @param RightColumn Right column of retangle.
28 @param TopRow Start row of retangle.
29 @param BottomRow End row of retangle.
30 @param TextAttribute The character foreground and background.
39 IN UINTN TextAttribute
46 // For now, allocate an arbitrarily long buffer
48 Buffer
= AllocateZeroPool (0x10000);
49 ASSERT (Buffer
!= NULL
);
52 // Set foreground and background as defined
54 gST
->ConOut
->SetAttribute (gST
->ConOut
, TextAttribute
);
57 // Much faster to buffer the long string instead of print it a character at a time
59 SetUnicodeMem (Buffer
, RightColumn
- LeftColumn
, L
' ');
62 // Clear the desired area with the appropriate foreground/background
64 for (Row
= TopRow
; Row
<= BottomRow
; Row
++) {
65 PrintStringAt (LeftColumn
, Row
, Buffer
);
68 gST
->ConOut
->SetCursorPosition (gST
->ConOut
, LeftColumn
, TopRow
);
75 Concatenate a narrow string to another string.
77 @param Destination The destination string.
78 @param Source The source string. The string to be concatenated.
79 to the end of Destination.
84 IN OUT CHAR16
*Destination
,
90 for (Length
= 0; Destination
[Length
] != 0; Length
++)
94 // We now have the length of the original string
95 // We can safely assume for now that we are concatenating a narrow value to this string.
96 // For instance, the string is "XYZ" and cat'ing ">"
97 // If this assumption changes, we need to make this routine a bit more complex
99 Destination
[Length
] = NARROW_CHAR
;
102 StrCpy (Destination
+ Length
, Source
);
106 Count the storage space of a Unicode string.
108 This function handles the Unicode string with NARROW_CHAR
109 and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR
110 does not count in the resultant output. If a WIDE_CHAR is
111 hit, then 2 Unicode character will consume an output storage
112 space with size of CHAR16 till a NARROW_CHAR is hit.
114 If String is NULL, then ASSERT ().
116 @param String The input string to be counted.
118 @return Storage space for the input string.
128 UINTN IncrementValue
;
130 ASSERT (String
!= NULL
);
131 if (String
== NULL
) {
141 // Advance to the null-terminator or to the first width directive
144 (String
[Index
] != NARROW_CHAR
) && (String
[Index
] != WIDE_CHAR
) && (String
[Index
] != 0);
145 Index
++, Count
= Count
+ IncrementValue
150 // We hit the null-terminator, we now have a count
152 if (String
[Index
] == 0) {
156 // We encountered a narrow directive - strip it from the size calculation since it doesn't get printed
157 // and also set the flag that determines what we increment by.(if narrow, increment by 1, if wide increment by 2)
159 if (String
[Index
] == NARROW_CHAR
) {
161 // Skip to the next character
167 // Skip to the next character
172 } while (String
[Index
] != 0);
175 // Increment by one to include the null-terminator in the size
179 return Count
* sizeof (CHAR16
);
183 This function displays the page frame.
185 @param Selection Selection contains the information about
186 the Selection, form and formset to be displayed.
187 Selection action may be updated in retrieve callback.
191 IN UI_MENU_SELECTION
*Selection
199 CHAR16
*StrFrontPageBanner
;
201 EFI_SCREEN_DESCRIPTOR LocalScreen
;
205 ZeroMem (&LocalScreen
, sizeof (EFI_SCREEN_DESCRIPTOR
));
206 gST
->ConOut
->QueryMode (gST
->ConOut
, gST
->ConOut
->Mode
->Mode
, &LocalScreen
.RightColumn
, &LocalScreen
.BottomRow
);
207 ClearLines (0, LocalScreen
.RightColumn
, 0, LocalScreen
.BottomRow
, KEYHELP_BACKGROUND
);
209 if (Selection
->Form
->ModalForm
) {
213 CopyMem (&LocalScreen
, &gScreenDimensions
, sizeof (EFI_SCREEN_DESCRIPTOR
));
216 // For now, allocate an arbitrarily long buffer
218 Buffer
= AllocateZeroPool (0x10000);
219 ASSERT (Buffer
!= NULL
);
221 Character
= BOXDRAW_HORIZONTAL
;
223 for (Index
= 0; Index
+ 2 < (LocalScreen
.RightColumn
- LocalScreen
.LeftColumn
); Index
++) {
224 Buffer
[Index
] = Character
;
227 if ((gClassOfVfr
& FORMSET_CLASS_FRONT_PAGE
) == FORMSET_CLASS_FRONT_PAGE
) {
229 // ClearLines(0, LocalScreen.RightColumn, 0, BANNER_HEIGHT-1, BANNER_TEXT | BANNER_BACKGROUND);
232 LocalScreen
.LeftColumn
,
233 LocalScreen
.RightColumn
,
235 FRONT_PAGE_HEADER_HEIGHT
- 1 + LocalScreen
.TopRow
,
236 BANNER_TEXT
| BANNER_BACKGROUND
239 // for (Line = 0; Line < BANNER_HEIGHT; Line++) {
241 for (Line
= (UINT8
) LocalScreen
.TopRow
; Line
< BANNER_HEIGHT
+ (UINT8
) LocalScreen
.TopRow
; Line
++) {
243 // for (Alignment = 0; Alignment < BANNER_COLUMNS; Alignment++) {
245 for (Alignment
= (UINT8
) LocalScreen
.LeftColumn
;
246 Alignment
< BANNER_COLUMNS
+ (UINT8
) LocalScreen
.LeftColumn
;
249 RowIdx
= (UINT8
) (Line
- (UINT8
) LocalScreen
.TopRow
);
250 ColumnIdx
= (UINT8
) (Alignment
- (UINT8
) LocalScreen
.LeftColumn
);
252 ASSERT (RowIdx
< BANNER_HEIGHT
);
253 ASSERT (ColumnIdx
< BANNER_COLUMNS
);
255 if (gBannerData
->Banner
[RowIdx
][ColumnIdx
] != 0x0000) {
256 StrFrontPageBanner
= GetToken (
257 gBannerData
->Banner
[RowIdx
][ColumnIdx
],
264 switch (Alignment
- LocalScreen
.LeftColumn
) {
267 // Handle left column
269 PrintStringAt (LocalScreen
.LeftColumn
+ BANNER_LEFT_COLUMN_INDENT
, Line
, StrFrontPageBanner
);
274 // Handle center column
277 LocalScreen
.LeftColumn
+ (LocalScreen
.RightColumn
- LocalScreen
.LeftColumn
) / 3,
285 // Handle right column
288 LocalScreen
.LeftColumn
+ (LocalScreen
.RightColumn
- LocalScreen
.LeftColumn
) * 2 / 3,
295 FreePool (StrFrontPageBanner
);
301 LocalScreen
.LeftColumn
,
302 LocalScreen
.RightColumn
,
303 LocalScreen
.BottomRow
- STATUS_BAR_HEIGHT
- gFooterHeight
,
304 LocalScreen
.BottomRow
- STATUS_BAR_HEIGHT
- 1,
305 KEYHELP_TEXT
| KEYHELP_BACKGROUND
308 if ((gClassOfVfr
& FORMSET_CLASS_FRONT_PAGE
) != FORMSET_CLASS_FRONT_PAGE
) {
310 LocalScreen
.LeftColumn
,
311 LocalScreen
.RightColumn
,
313 LocalScreen
.TopRow
+ NONE_FRONT_PAGE_HEADER_HEIGHT
- 1,
314 TITLE_TEXT
| TITLE_BACKGROUND
317 // Print Top border line
318 // +------------------------------------------------------------------------------+
320 // +------------------------------------------------------------------------------+
322 Character
= BOXDRAW_DOWN_RIGHT
;
324 PrintChar (Character
);
325 PrintString (Buffer
);
327 Character
= BOXDRAW_DOWN_LEFT
;
328 PrintChar (Character
);
330 Character
= BOXDRAW_VERTICAL
;
331 for (Row
= LocalScreen
.TopRow
+ 1; Row
<= LocalScreen
.TopRow
+ NONE_FRONT_PAGE_HEADER_HEIGHT
- 2; Row
++) {
332 PrintCharAt (LocalScreen
.LeftColumn
, Row
, Character
);
333 PrintCharAt (LocalScreen
.RightColumn
- 1, Row
, Character
);
336 Character
= BOXDRAW_UP_RIGHT
;
337 PrintCharAt (LocalScreen
.LeftColumn
, LocalScreen
.TopRow
+ NONE_FRONT_PAGE_HEADER_HEIGHT
- 1, Character
);
338 PrintString (Buffer
);
340 Character
= BOXDRAW_UP_LEFT
;
341 PrintChar (Character
);
343 if ((gClassOfVfr
& FORMSET_CLASS_PLATFORM_SETUP
) == FORMSET_CLASS_PLATFORM_SETUP
) {
345 // Print Bottom border line
346 // +------------------------------------------------------------------------------+
348 // +------------------------------------------------------------------------------+
350 Character
= BOXDRAW_DOWN_RIGHT
;
351 PrintCharAt (LocalScreen
.LeftColumn
, LocalScreen
.BottomRow
- STATUS_BAR_HEIGHT
- gFooterHeight
, Character
);
353 PrintString (Buffer
);
355 Character
= BOXDRAW_DOWN_LEFT
;
356 PrintChar (Character
);
357 Character
= BOXDRAW_VERTICAL
;
358 for (Row
= LocalScreen
.BottomRow
- STATUS_BAR_HEIGHT
- gFooterHeight
+ 1;
359 Row
<= LocalScreen
.BottomRow
- STATUS_BAR_HEIGHT
- 2;
362 PrintCharAt (LocalScreen
.LeftColumn
, Row
, Character
);
363 PrintCharAt (LocalScreen
.RightColumn
- 1, Row
, Character
);
366 Character
= BOXDRAW_UP_RIGHT
;
367 PrintCharAt (LocalScreen
.LeftColumn
, LocalScreen
.BottomRow
- STATUS_BAR_HEIGHT
- 1, Character
);
369 PrintString (Buffer
);
371 Character
= BOXDRAW_UP_LEFT
;
372 PrintChar (Character
);
382 Evaluate all expressions in a Form.
384 @param FormSet FormSet this Form belongs to.
385 @param Form The Form.
387 @retval EFI_SUCCESS The expression evaluated successfuly
391 EvaluateFormExpressions (
392 IN FORM_BROWSER_FORMSET
*FormSet
,
393 IN FORM_BROWSER_FORM
*Form
398 FORM_EXPRESSION
*Expression
;
400 Link
= GetFirstNode (&Form
->ExpressionListHead
);
401 while (!IsNull (&Form
->ExpressionListHead
, Link
)) {
402 Expression
= FORM_EXPRESSION_FROM_LINK (Link
);
403 Link
= GetNextNode (&Form
->ExpressionListHead
, Link
);
405 if (Expression
->Type
== EFI_HII_EXPRESSION_INCONSISTENT_IF
||
406 Expression
->Type
== EFI_HII_EXPRESSION_NO_SUBMIT_IF
||
407 Expression
->Type
== EFI_HII_EXPRESSION_WRITE
||
408 (Expression
->Type
== EFI_HII_EXPRESSION_READ
&& Form
->FormType
!= STANDARD_MAP_FORM_TYPE
)) {
410 // Postpone Form validation to Question editing or Form submitting or Question Write or Question Read for nonstandard form.
415 Status
= EvaluateExpression (FormSet
, Form
, Expression
);
416 if (EFI_ERROR (Status
)) {
425 +------------------------------------------------------------------------------+
427 +------------------------------------------------------------------------------+
445 +------------------------------------------------------------------------------+
446 ?F1=Scroll Help F9=Reset to Defaults F10=Save and Exit ?
447 | ^"=Move Highlight <Spacebar> Toggles Checkbox Esc=Discard Changes |
448 +------------------------------------------------------------------------------+
454 Display form and wait for user to select one menu option, then return it.
456 @param Selection On input, Selection tell setup browser the information
457 about the Selection, form and formset to be displayed.
458 On output, Selection return the screen item that is selected
460 @retval EFI_SUCESSS This function always return successfully for now.
465 IN OUT UI_MENU_SELECTION
*Selection
469 UINT16 MenuItemCount
;
470 EFI_HII_HANDLE Handle
;
472 EFI_SCREEN_DESCRIPTOR LocalScreen
;
475 CHAR16
*OutputString
;
477 FORM_BROWSER_STATEMENT
*Statement
;
478 UINT16 NumberOfLines
;
480 UI_MENU_OPTION
*MenuOption
;
482 Handle
= Selection
->Handle
;
489 CopyMem (&LocalScreen
, &gScreenDimensions
, sizeof (EFI_SCREEN_DESCRIPTOR
));
491 StringPtr
= GetToken (Selection
->Form
->FormTitle
, Handle
);
493 if ((gClassOfVfr
& FORMSET_CLASS_FRONT_PAGE
) != FORMSET_CLASS_FRONT_PAGE
) {
494 if (Selection
->Form
->ModalForm
) {
495 gST
->ConOut
->SetAttribute (gST
->ConOut
, TITLE_TEXT
| EFI_BACKGROUND_BLACK
);
497 gST
->ConOut
->SetAttribute (gST
->ConOut
, TITLE_TEXT
| TITLE_BACKGROUND
);
500 (LocalScreen
.RightColumn
+ LocalScreen
.LeftColumn
- GetStringWidth (StringPtr
) / 2) / 2,
501 LocalScreen
.TopRow
+ 1,
507 // Remove Buffer allocated for StringPtr after it has been used.
509 FreePool (StringPtr
);
512 // Evaluate all the Expressions in this Form
514 Status
= EvaluateFormExpressions (Selection
->FormSet
, Selection
->Form
);
515 if (EFI_ERROR (Status
)) {
519 Selection
->FormEditable
= FALSE
;
520 Link
= GetFirstNode (&Selection
->Form
->StatementListHead
);
521 while (!IsNull (&Selection
->Form
->StatementListHead
, Link
)) {
522 Statement
= FORM_BROWSER_STATEMENT_FROM_LINK (Link
);
524 if (Statement
->SuppressExpression
!= NULL
) {
525 Suppress
= Statement
->SuppressExpression
->Result
.Value
.b
;
530 if (Statement
->DisableExpression
!= NULL
) {
531 Suppress
= (BOOLEAN
) (Suppress
|| Statement
->DisableExpression
->Result
.Value
.b
);
535 StringPtr
= GetToken (Statement
->Prompt
, Handle
);
536 ASSERT (StringPtr
!= NULL
);
538 Width
= GetWidth (Statement
, Handle
);
542 for (; GetLineByWidth (StringPtr
, Width
, &ArrayEntry
, &OutputString
) != 0x0000;) {
544 // If there is more string to process print on the next row and increment the Skip value
546 if (StrLen (&StringPtr
[ArrayEntry
]) != 0) {
550 FreePool (OutputString
);
554 // We are NOT!! removing this StringPtr buffer via FreePool since it is being used in the menuoptions, we will do
557 MenuOption
= UiAddMenuOption (StringPtr
, Selection
->Handle
, Statement
, NumberOfLines
, MenuItemCount
);
560 if (MenuOption
->IsQuestion
&& !MenuOption
->ReadOnly
) {
562 // At least one item is not readonly, this Form is considered as editable
564 Selection
->FormEditable
= TRUE
;
568 Link
= GetNextNode (&Selection
->Form
->StatementListHead
, Link
);
571 Status
= UiDisplayMenu (Selection
);
579 Initialize the HII String Token to the correct values.
583 InitializeBrowserStrings (
587 gEnterString
= GetToken (STRING_TOKEN (ENTER_STRING
), gHiiHandle
);
588 gEnterCommitString
= GetToken (STRING_TOKEN (ENTER_COMMIT_STRING
), gHiiHandle
);
589 gEnterEscapeString
= GetToken (STRING_TOKEN (ENTER_ESCAPE_STRING
), gHiiHandle
);
590 gEscapeString
= GetToken (STRING_TOKEN (ESCAPE_STRING
), gHiiHandle
);
591 gMoveHighlight
= GetToken (STRING_TOKEN (MOVE_HIGHLIGHT
), gHiiHandle
);
592 gMakeSelection
= GetToken (STRING_TOKEN (MAKE_SELECTION
), gHiiHandle
);
593 gDecNumericInput
= GetToken (STRING_TOKEN (DEC_NUMERIC_INPUT
), gHiiHandle
);
594 gHexNumericInput
= GetToken (STRING_TOKEN (HEX_NUMERIC_INPUT
), gHiiHandle
);
595 gToggleCheckBox
= GetToken (STRING_TOKEN (TOGGLE_CHECK_BOX
), gHiiHandle
);
596 gPromptForData
= GetToken (STRING_TOKEN (PROMPT_FOR_DATA
), gHiiHandle
);
597 gPromptForPassword
= GetToken (STRING_TOKEN (PROMPT_FOR_PASSWORD
), gHiiHandle
);
598 gPromptForNewPassword
= GetToken (STRING_TOKEN (PROMPT_FOR_NEW_PASSWORD
), gHiiHandle
);
599 gConfirmPassword
= GetToken (STRING_TOKEN (CONFIRM_PASSWORD
), gHiiHandle
);
600 gConfirmError
= GetToken (STRING_TOKEN (CONFIRM_ERROR
), gHiiHandle
);
601 gPassowordInvalid
= GetToken (STRING_TOKEN (PASSWORD_INVALID
), gHiiHandle
);
602 gPressEnter
= GetToken (STRING_TOKEN (PRESS_ENTER
), gHiiHandle
);
603 gEmptyString
= GetToken (STRING_TOKEN (EMPTY_STRING
), gHiiHandle
);
604 gAreYouSure
= GetToken (STRING_TOKEN (ARE_YOU_SURE
), gHiiHandle
);
605 gYesResponse
= GetToken (STRING_TOKEN (ARE_YOU_SURE_YES
), gHiiHandle
);
606 gNoResponse
= GetToken (STRING_TOKEN (ARE_YOU_SURE_NO
), gHiiHandle
);
607 gMiniString
= GetToken (STRING_TOKEN (MINI_STRING
), gHiiHandle
);
608 gPlusString
= GetToken (STRING_TOKEN (PLUS_STRING
), gHiiHandle
);
609 gMinusString
= GetToken (STRING_TOKEN (MINUS_STRING
), gHiiHandle
);
610 gAdjustNumber
= GetToken (STRING_TOKEN (ADJUST_NUMBER
), gHiiHandle
);
611 gSaveChanges
= GetToken (STRING_TOKEN (SAVE_CHANGES
), gHiiHandle
);
612 gOptionMismatch
= GetToken (STRING_TOKEN (OPTION_MISMATCH
), gHiiHandle
);
613 gFormSuppress
= GetToken (STRING_TOKEN (FORM_SUPPRESSED
), gHiiHandle
);
618 Free up the resource allocated for all strings required
627 FreePool (gEnterString
);
628 FreePool (gEnterCommitString
);
629 FreePool (gEnterEscapeString
);
630 FreePool (gEscapeString
);
631 FreePool (gMoveHighlight
);
632 FreePool (gMakeSelection
);
633 FreePool (gDecNumericInput
);
634 FreePool (gHexNumericInput
);
635 FreePool (gToggleCheckBox
);
636 FreePool (gPromptForData
);
637 FreePool (gPromptForPassword
);
638 FreePool (gPromptForNewPassword
);
639 FreePool (gConfirmPassword
);
640 FreePool (gPassowordInvalid
);
641 FreePool (gConfirmError
);
642 FreePool (gPressEnter
);
643 FreePool (gEmptyString
);
644 FreePool (gAreYouSure
);
645 FreePool (gYesResponse
);
646 FreePool (gNoResponse
);
647 FreePool (gMiniString
);
648 FreePool (gPlusString
);
649 FreePool (gMinusString
);
650 FreePool (gAdjustNumber
);
651 FreePool (gSaveChanges
);
652 FreePool (gOptionMismatch
);
653 FreePool (gFormSuppress
);
658 Show all registered HotKey help strings on bottom Rows.
662 PrintHotKeyHelpString (
668 UINTN BottomRowOfHotKeyHelp
;
671 EFI_SCREEN_DESCRIPTOR LocalScreen
;
673 BROWSER_HOT_KEY
*HotKey
;
675 CopyMem (&LocalScreen
, &gScreenDimensions
, sizeof (EFI_SCREEN_DESCRIPTOR
));
676 ColumnWidth
= (LocalScreen
.RightColumn
- LocalScreen
.LeftColumn
) / 3;
677 BottomRowOfHotKeyHelp
= LocalScreen
.BottomRow
- STATUS_BAR_HEIGHT
- 3;
680 // Calculate total number of Register HotKeys.
683 Link
= GetFirstNode (&gBrowserHotKeyList
);
684 while (!IsNull (&gBrowserHotKeyList
, Link
)) {
685 HotKey
= BROWSER_HOT_KEY_FROM_LINK (Link
);
687 // Help string can't exceed ColumnWidth. One Row will show three Help information.
689 if (StrLen (HotKey
->HelpString
) > ColumnWidth
) {
690 HotKey
->HelpString
[ColumnWidth
] = L
'\0';
693 // Calculate help information Column and Row.
695 if ((Index
% 3) != 2) {
696 CurrentCol
= LocalScreen
.LeftColumn
+ (2 - Index
% 3) * ColumnWidth
;
698 CurrentCol
= LocalScreen
.LeftColumn
+ 2;
700 CurrentRow
= BottomRowOfHotKeyHelp
- Index
/ 3;
702 // Print HotKey help string on bottom Row.
704 PrintStringAt (CurrentCol
, CurrentRow
, HotKey
->HelpString
);
709 Link
= GetNextNode (&gBrowserHotKeyList
, Link
);
717 Update key's help imformation.
719 @param Selection Tell setup browser the information about the Selection
720 @param MenuOption The Menu option
721 @param Selected Whether or not a tag be selected
726 IN UI_MENU_SELECTION
*Selection
,
727 IN UI_MENU_OPTION
*MenuOption
,
733 UINTN LeftColumnOfHelp
;
734 UINTN RightColumnOfHelp
;
736 UINTN BottomRowOfHelp
;
737 UINTN StartColumnOfHelp
;
738 EFI_SCREEN_DESCRIPTOR LocalScreen
;
739 FORM_BROWSER_STATEMENT
*Statement
;
741 gST
->ConOut
->SetAttribute (gST
->ConOut
, KEYHELP_TEXT
| KEYHELP_BACKGROUND
);
743 if (Selection
->Form
->ModalForm
) {
747 CopyMem (&LocalScreen
, &gScreenDimensions
, sizeof (EFI_SCREEN_DESCRIPTOR
));
749 SecCol
= LocalScreen
.LeftColumn
+ (LocalScreen
.RightColumn
- LocalScreen
.LeftColumn
) / 3;
750 ThdCol
= LocalScreen
.LeftColumn
+ (LocalScreen
.RightColumn
- LocalScreen
.LeftColumn
) / 3 * 2;
752 StartColumnOfHelp
= LocalScreen
.LeftColumn
+ 2;
753 LeftColumnOfHelp
= LocalScreen
.LeftColumn
+ 1;
754 RightColumnOfHelp
= LocalScreen
.RightColumn
- 2;
755 TopRowOfHelp
= LocalScreen
.BottomRow
- STATUS_BAR_HEIGHT
- gFooterHeight
+ 1;
756 BottomRowOfHelp
= LocalScreen
.BottomRow
- STATUS_BAR_HEIGHT
- 2;
758 Statement
= MenuOption
->ThisTag
;
759 switch (Statement
->Operand
) {
760 case EFI_IFR_ORDERED_LIST_OP
:
761 case EFI_IFR_ONE_OF_OP
:
762 case EFI_IFR_NUMERIC_OP
:
763 case EFI_IFR_TIME_OP
:
764 case EFI_IFR_DATE_OP
:
765 ClearLines (LeftColumnOfHelp
, RightColumnOfHelp
, TopRowOfHelp
, BottomRowOfHelp
, KEYHELP_TEXT
| KEYHELP_BACKGROUND
);
769 // On system setting, HotKey will show on every form.
771 if (gBrowserSettingScope
== SystemLevel
||
772 (Selection
->FormEditable
&& gFunctionKeySetting
!= NONE_FUNCTION_KEY_SETTING
)) {
773 PrintHotKeyHelpString ();
776 if ((gClassOfVfr
& FORMSET_CLASS_PLATFORM_SETUP
) == FORMSET_CLASS_PLATFORM_SETUP
) {
777 PrintStringAt (ThdCol
, BottomRowOfHelp
, gEscapeString
);
780 if ((Statement
->Operand
== EFI_IFR_DATE_OP
) ||
781 (Statement
->Operand
== EFI_IFR_TIME_OP
)) {
792 PrintStringAt (SecCol
, BottomRowOfHelp
, gEnterString
);
793 PrintStringAt (StartColumnOfHelp
, TopRowOfHelp
, gAdjustNumber
);
795 PrintAt (StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
796 if (Statement
->Operand
== EFI_IFR_NUMERIC_OP
&& Statement
->Step
!= 0) {
797 PrintStringAt (StartColumnOfHelp
, TopRowOfHelp
, gAdjustNumber
);
799 PrintStringAt (SecCol
, BottomRowOfHelp
, gEnterString
);
802 PrintStringAt (SecCol
, BottomRowOfHelp
, gEnterCommitString
);
805 // If it is a selected numeric with manual input, display different message
807 if ((Statement
->Operand
== EFI_IFR_NUMERIC_OP
) ||
808 (Statement
->Operand
== EFI_IFR_DATE_OP
) ||
809 (Statement
->Operand
== EFI_IFR_TIME_OP
)) {
813 ((Statement
->Flags
& EFI_IFR_DISPLAY_UINT_HEX
) == EFI_IFR_DISPLAY_UINT_HEX
) ? gHexNumericInput
: gDecNumericInput
815 } else if (Statement
->Operand
!= EFI_IFR_ORDERED_LIST_OP
) {
816 PrintAt (StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
819 if (Statement
->Operand
== EFI_IFR_ORDERED_LIST_OP
) {
820 PrintStringAt (StartColumnOfHelp
, TopRowOfHelp
, gPlusString
);
821 PrintStringAt (ThdCol
, TopRowOfHelp
, gMinusString
);
824 PrintStringAt (ThdCol
, BottomRowOfHelp
, gEnterEscapeString
);
828 case EFI_IFR_CHECKBOX_OP
:
829 ClearLines (LeftColumnOfHelp
, RightColumnOfHelp
, TopRowOfHelp
, BottomRowOfHelp
, KEYHELP_TEXT
| KEYHELP_BACKGROUND
);
832 // On system setting, HotKey will show on every form.
834 if (gBrowserSettingScope
== SystemLevel
||
835 (Selection
->FormEditable
&& gFunctionKeySetting
!= NONE_FUNCTION_KEY_SETTING
)) {
836 PrintHotKeyHelpString ();
838 if ((gClassOfVfr
& FORMSET_CLASS_PLATFORM_SETUP
) == FORMSET_CLASS_PLATFORM_SETUP
) {
839 PrintStringAt (ThdCol
, BottomRowOfHelp
, gEscapeString
);
842 PrintAt (StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
843 PrintStringAt (SecCol
, BottomRowOfHelp
, gToggleCheckBox
);
847 case EFI_IFR_PASSWORD_OP
:
848 case EFI_IFR_STRING_OP
:
849 case EFI_IFR_TEXT_OP
:
850 case EFI_IFR_ACTION_OP
:
851 case EFI_IFR_RESET_BUTTON_OP
:
852 case EFI_IFR_SUBTITLE_OP
:
853 ClearLines (LeftColumnOfHelp
, RightColumnOfHelp
, TopRowOfHelp
, BottomRowOfHelp
, KEYHELP_TEXT
| KEYHELP_BACKGROUND
);
857 // On system setting, HotKey will show on every form.
859 if (gBrowserSettingScope
== SystemLevel
||
860 (Selection
->FormEditable
&& gFunctionKeySetting
!= NONE_FUNCTION_KEY_SETTING
)) {
861 PrintHotKeyHelpString ();
863 if ((gClassOfVfr
& FORMSET_CLASS_PLATFORM_SETUP
) == FORMSET_CLASS_PLATFORM_SETUP
) {
864 PrintStringAt (ThdCol
, BottomRowOfHelp
, gEscapeString
);
867 PrintAt (StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
868 if (Statement
->Operand
!= EFI_IFR_TEXT_OP
&& Statement
->Operand
!= EFI_IFR_SUBTITLE_OP
) {
869 PrintStringAt (SecCol
, BottomRowOfHelp
, gEnterString
);
872 if (Statement
->Operand
!= EFI_IFR_REF_OP
) {
874 (LocalScreen
.RightColumn
- GetStringWidth (gEnterCommitString
) / 2) / 2,
878 PrintStringAt (ThdCol
, BottomRowOfHelp
, gEnterEscapeString
);
889 Functions which are registered to receive notification of
890 database events have this prototype. The actual event is encoded
891 in NotifyType. The following table describes how PackageType,
892 PackageGuid, Handle, and Package are used for each of the
895 @param PackageType Package type of the notification.
897 @param PackageGuid If PackageType is
898 EFI_HII_PACKAGE_TYPE_GUID, then this is
899 the pointer to the GUID from the Guid
900 field of EFI_HII_PACKAGE_GUID_HEADER.
901 Otherwise, it must be NULL.
903 @param Package Points to the package referred to by the
904 notification Handle The handle of the package
905 list which contains the specified package.
907 @param Handle The HII handle.
909 @param NotifyType The type of change concerning the
911 EFI_HII_DATABASE_NOTIFY_TYPE.
917 IN UINT8 PackageType
,
918 IN CONST EFI_GUID
*PackageGuid
,
919 IN CONST EFI_HII_PACKAGE_HEADER
*Package
,
920 IN EFI_HII_HANDLE Handle
,
921 IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType
924 mHiiPackageListUpdated
= TRUE
;
930 check whether the formset need to update the NV.
932 @param FormSet FormSet data structure.
934 @retval TRUE Need to update the NV.
935 @retval FALSE No need to update the NV.
939 IN FORM_BROWSER_FORMSET
*FormSet
943 FORM_BROWSER_FORM
*Form
;
945 Link
= GetFirstNode (&FormSet
->FormListHead
);
946 while (!IsNull (&FormSet
->FormListHead
, Link
)) {
947 Form
= FORM_BROWSER_FORM_FROM_LINK (Link
);
949 if (Form
->NvUpdateRequired
) {
953 Link
= GetNextNode (&FormSet
->FormListHead
, Link
);
960 check whether the formset need to update the NV.
962 @param FormSet FormSet data structure.
963 @param SetValue Whether set new value or clear old value.
968 IN FORM_BROWSER_FORMSET
*FormSet
,
973 FORM_BROWSER_FORM
*Form
;
975 Link
= GetFirstNode (&FormSet
->FormListHead
);
976 while (!IsNull (&FormSet
->FormListHead
, Link
)) {
977 Form
= FORM_BROWSER_FORM_FROM_LINK (Link
);
979 Form
->NvUpdateRequired
= SetValue
;
981 Link
= GetNextNode (&FormSet
->FormListHead
, Link
);
985 Find menu which will show next time.
987 @param Selection On input, Selection tell setup browser the information
988 about the Selection, form and formset to be displayed.
989 On output, Selection return the screen item that is selected
991 @param Repaint Whether need to repaint the menu.
992 @param NewLine Whether need to show at new line.
994 @retval TRUE Need return.
995 @retval FALSE No need to return.
999 IN OUT UI_MENU_SELECTION
*Selection
,
1000 IN BOOLEAN
*Repaint
,
1004 UI_MENU_LIST
*CurrentMenu
;
1009 BROWSER_SETTING_SCOPE Scope
;
1011 CurrentMenu
= Selection
->CurrentMenu
;
1013 if (CurrentMenu
!= NULL
&& CurrentMenu
->Parent
!= NULL
) {
1015 // we have a parent, so go to the parent menu
1017 if (CompareGuid (&CurrentMenu
->FormSetGuid
, &CurrentMenu
->Parent
->FormSetGuid
)) {
1019 // The parent menu and current menu are in the same formset
1021 Selection
->Action
= UI_ACTION_REFRESH_FORM
;
1024 Selection
->Action
= UI_ACTION_REFRESH_FORMSET
;
1025 CopyMem (&Selection
->FormSetGuid
, &CurrentMenu
->Parent
->FormSetGuid
, sizeof (EFI_GUID
));
1026 Selection
->Handle
= CurrentMenu
->Parent
->HiiHandle
;
1027 Scope
= FormSetLevel
;
1031 // Form Level Check whether the data is changed.
1033 if ((gBrowserSettingScope
== FormLevel
&& Selection
->Form
->NvUpdateRequired
) ||
1034 (gBrowserSettingScope
== FormSetLevel
&& IsNvUpdateRequired(Selection
->FormSet
) && Scope
== FormSetLevel
)) {
1035 Status
= gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
1037 YesResponse
= gYesResponse
[0];
1038 NoResponse
= gNoResponse
[0];
1041 // If NV flag is up, prompt user
1044 CreateDialog (4, TRUE
, 0, NULL
, &Key
, gEmptyString
, gSaveChanges
, gAreYouSure
, gEmptyString
);
1047 (Key
.ScanCode
!= SCAN_ESC
) &&
1048 ((Key
.UnicodeChar
| UPPER_LOWER_CASE_OFFSET
) != (NoResponse
| UPPER_LOWER_CASE_OFFSET
)) &&
1049 ((Key
.UnicodeChar
| UPPER_LOWER_CASE_OFFSET
) != (YesResponse
| UPPER_LOWER_CASE_OFFSET
))
1052 if (Key
.ScanCode
== SCAN_ESC
) {
1054 // User hits the ESC key, Ingore.
1056 if (Repaint
!= NULL
) {
1059 if (NewLine
!= NULL
) {
1063 Selection
->Action
= UI_ACTION_NONE
;
1067 if ((Key
.UnicodeChar
| UPPER_LOWER_CASE_OFFSET
) == (YesResponse
| UPPER_LOWER_CASE_OFFSET
)) {
1069 // If the user hits the YesResponse key
1071 Status
= SubmitForm (Selection
->FormSet
, Selection
->Form
, Scope
);
1074 // If the user hits the NoResponse key
1076 Status
= DiscardForm (Selection
->FormSet
, Selection
->Form
, Scope
);
1080 Selection
->Statement
= NULL
;
1082 Selection
->FormId
= CurrentMenu
->Parent
->FormId
;
1083 Selection
->QuestionId
= CurrentMenu
->Parent
->QuestionId
;
1086 // Clear highlight record for this menu
1088 CurrentMenu
->QuestionId
= 0;
1092 if ((gClassOfVfr
& FORMSET_CLASS_FRONT_PAGE
) == FORMSET_CLASS_FRONT_PAGE
) {
1094 // We never exit FrontPage, so skip the ESC
1096 Selection
->Action
= UI_ACTION_NONE
;
1101 // We are going to leave current FormSet, so check uncommited data in this FormSet
1103 if (gBrowserSettingScope
!= SystemLevel
&& IsNvUpdateRequired(Selection
->FormSet
)) {
1104 Status
= gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
1106 YesResponse
= gYesResponse
[0];
1107 NoResponse
= gNoResponse
[0];
1110 // If NV flag is up, prompt user
1113 CreateDialog (4, TRUE
, 0, NULL
, &Key
, gEmptyString
, gSaveChanges
, gAreYouSure
, gEmptyString
);
1116 (Key
.ScanCode
!= SCAN_ESC
) &&
1117 ((Key
.UnicodeChar
| UPPER_LOWER_CASE_OFFSET
) != (NoResponse
| UPPER_LOWER_CASE_OFFSET
)) &&
1118 ((Key
.UnicodeChar
| UPPER_LOWER_CASE_OFFSET
) != (YesResponse
| UPPER_LOWER_CASE_OFFSET
))
1121 if (Key
.ScanCode
== SCAN_ESC
) {
1123 // User hits the ESC key
1125 if (Repaint
!= NULL
) {
1129 if (NewLine
!= NULL
) {
1133 Selection
->Action
= UI_ACTION_NONE
;
1137 if ((Key
.UnicodeChar
| UPPER_LOWER_CASE_OFFSET
) == (YesResponse
| UPPER_LOWER_CASE_OFFSET
)) {
1139 // If the user hits the YesResponse key
1141 Status
= SubmitForm (Selection
->FormSet
, Selection
->Form
, FormSetLevel
);
1144 // If the user hits the NoResponse key
1146 Status
= DiscardForm (Selection
->FormSet
, Selection
->Form
, FormSetLevel
);
1150 Selection
->Statement
= NULL
;
1151 if (CurrentMenu
!= NULL
) {
1152 CurrentMenu
->QuestionId
= 0;
1155 Selection
->Action
= UI_ACTION_EXIT
;
1160 Call the call back function for the question and process the return action.
1162 @param Selection On input, Selection tell setup browser the information
1163 about the Selection, form and formset to be displayed.
1164 On output, Selection return the screen item that is selected
1166 @param Question The Question which need to call.
1167 @param Action The action request.
1168 @param SkipSaveOrDiscard Whether skip save or discard action.
1170 @retval EFI_SUCCESS The call back function excutes successfully.
1171 @return Other value if the call back function failed to excute.
1174 ProcessCallBackFunction (
1175 IN OUT UI_MENU_SELECTION
*Selection
,
1176 IN FORM_BROWSER_STATEMENT
*Question
,
1177 IN EFI_BROWSER_ACTION Action
,
1178 IN BOOLEAN SkipSaveOrDiscard
1182 EFI_BROWSER_ACTION_REQUEST ActionRequest
;
1183 EFI_HII_CONFIG_ACCESS_PROTOCOL
*ConfigAccess
;
1184 EFI_HII_VALUE
*HiiValue
;
1185 EFI_IFR_TYPE_VALUE
*TypeValue
;
1186 FORM_BROWSER_STATEMENT
*Statement
;
1187 BOOLEAN SubmitFormIsRequired
;
1188 BOOLEAN DiscardFormIsRequired
;
1191 BROWSER_SETTING_SCOPE SettingLevel
;
1193 ConfigAccess
= Selection
->FormSet
->ConfigAccess
;
1194 SubmitFormIsRequired
= FALSE
;
1195 SettingLevel
= FormSetLevel
;
1196 DiscardFormIsRequired
= FALSE
;
1198 Status
= EFI_SUCCESS
;
1199 ActionRequest
= EFI_BROWSER_ACTION_REQUEST_NONE
;
1201 if (ConfigAccess
== NULL
) {
1205 Link
= GetFirstNode (&Selection
->Form
->StatementListHead
);
1206 while (!IsNull (&Selection
->Form
->StatementListHead
, Link
)) {
1207 Statement
= FORM_BROWSER_STATEMENT_FROM_LINK (Link
);
1208 Link
= GetNextNode (&Selection
->Form
->StatementListHead
, Link
);
1211 // if Question != NULL, only process the question. Else, process all question in this form.
1213 if ((Question
!= NULL
) && (Statement
!= Question
)) {
1217 if ((Statement
->QuestionFlags
& EFI_IFR_FLAG_CALLBACK
) != EFI_IFR_FLAG_CALLBACK
) {
1222 // Check whether Statement is disabled.
1224 if (Statement
->DisableExpression
!= NULL
) {
1225 Status
= EvaluateExpression (Selection
->FormSet
, Selection
->Form
, Statement
->DisableExpression
);
1226 if (!EFI_ERROR (Status
) &&
1227 (Statement
->DisableExpression
->Result
.Type
== EFI_IFR_TYPE_BOOLEAN
) &&
1228 (Statement
->DisableExpression
->Result
.Value
.b
)) {
1233 HiiValue
= &Statement
->HiiValue
;
1234 TypeValue
= &HiiValue
->Value
;
1235 if (HiiValue
->Type
== EFI_IFR_TYPE_BUFFER
) {
1237 // For OrderedList, passing in the value buffer to Callback()
1239 TypeValue
= (EFI_IFR_TYPE_VALUE
*) Statement
->BufferValue
;
1242 ActionRequest
= EFI_BROWSER_ACTION_REQUEST_NONE
;
1243 Status
= ConfigAccess
->Callback (
1246 Statement
->QuestionId
,
1251 if (!EFI_ERROR (Status
)) {
1252 switch (ActionRequest
) {
1253 case EFI_BROWSER_ACTION_REQUEST_RESET
:
1254 gResetRequired
= TRUE
;
1255 Selection
->Action
= UI_ACTION_EXIT
;
1258 case EFI_BROWSER_ACTION_REQUEST_SUBMIT
:
1259 SubmitFormIsRequired
= TRUE
;
1260 Selection
->Action
= UI_ACTION_EXIT
;
1263 case EFI_BROWSER_ACTION_REQUEST_EXIT
:
1264 Selection
->Action
= UI_ACTION_EXIT
;
1267 case EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT
:
1268 SubmitFormIsRequired
= TRUE
;
1269 SettingLevel
= FormLevel
;
1273 case EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT
:
1274 DiscardFormIsRequired
= TRUE
;
1275 SettingLevel
= FormLevel
;
1279 case EFI_BROWSER_ACTION_REQUEST_FORM_APPLY
:
1280 SubmitFormIsRequired
= TRUE
;
1281 SettingLevel
= FormLevel
;
1284 case EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD
:
1285 DiscardFormIsRequired
= TRUE
;
1286 SettingLevel
= FormLevel
;
1294 // According the spec, return value from call back of "changing" and
1295 // "retrieve" should update to the question's temp buffer.
1297 if (Action
== EFI_BROWSER_ACTION_CHANGING
|| Action
== EFI_BROWSER_ACTION_RETRIEVE
) {
1298 SetQuestionValue(Selection
->FormSet
, Selection
->Form
, Statement
, TRUE
);
1302 // According the spec, return fail from call back of "changing" and
1303 // "retrieve", should restore the question's value.
1305 if (Action
== EFI_BROWSER_ACTION_CHANGING
|| Action
== EFI_BROWSER_ACTION_RETRIEVE
) {
1306 GetQuestionValue(Selection
->FormSet
, Selection
->Form
, Statement
, TRUE
);
1309 if (Status
== EFI_UNSUPPORTED
) {
1311 // If return EFI_UNSUPPORTED, also consider Hii driver suceess deal with it.
1313 Status
= EFI_SUCCESS
;
1318 if (SubmitFormIsRequired
&& !SkipSaveOrDiscard
) {
1319 SubmitForm (Selection
->FormSet
, Selection
->Form
, SettingLevel
);
1322 if (DiscardFormIsRequired
&& !SkipSaveOrDiscard
) {
1323 DiscardForm (Selection
->FormSet
, Selection
->Form
, SettingLevel
);
1327 FindNextMenu (Selection
, NULL
, NULL
);
1334 The worker function that send the displays to the screen. On output,
1335 the selection made by user is returned.
1337 @param Selection On input, Selection tell setup browser the information
1338 about the Selection, form and formset to be displayed.
1339 On output, Selection return the screen item that is selected
1342 @retval EFI_SUCCESS The page is displayed successfully.
1343 @return Other value if the page failed to be diplayed.
1348 IN OUT UI_MENU_SELECTION
*Selection
1353 EFI_HANDLE NotifyHandle
;
1354 FORM_BROWSER_STATEMENT
*Statement
;
1355 EFI_HII_CONFIG_ACCESS_PROTOCOL
*ConfigAccess
;
1358 gMenuRefreshHead
= NULL
;
1359 ConfigAccess
= Selection
->FormSet
->ConfigAccess
;
1362 // Register notify for Form package update
1364 Status
= mHiiDatabase
->RegisterPackageNotify (
1366 EFI_HII_PACKAGE_FORMS
,
1369 EFI_HII_DATABASE_NOTIFY_REMOVE_PACK
,
1372 if (EFI_ERROR (Status
)) {
1377 // Initialize current settings of Questions in this FormSet
1379 Status
= InitializeCurrentSetting (Selection
->FormSet
);
1380 if (EFI_ERROR (Status
)) {
1385 // Update gOldFormSet on maintain back up FormSet list.
1386 // And, make gOldFormSet point to current FormSet.
1388 if (gOldFormSet
!= NULL
) {
1389 RemoveEntryList (&gOldFormSet
->Link
);
1390 DestroyFormSet (gOldFormSet
);
1392 gOldFormSet
= Selection
->FormSet
;
1393 InsertTailList (&gBrowserFormSetList
, &gOldFormSet
->Link
);
1397 // Initialize Selection->Form
1399 if (Selection
->FormId
== 0) {
1401 // Zero FormId indicates display the first Form in a FormSet
1403 Link
= GetFirstNode (&Selection
->FormSet
->FormListHead
);
1405 Selection
->Form
= FORM_BROWSER_FORM_FROM_LINK (Link
);
1406 Selection
->FormId
= Selection
->Form
->FormId
;
1408 Selection
->Form
= IdToForm (Selection
->FormSet
, Selection
->FormId
);
1411 if (Selection
->Form
== NULL
) {
1413 // No Form to display
1415 Status
= EFI_NOT_FOUND
;
1420 // Check Form is suppressed.
1422 if (Selection
->Form
->SuppressExpression
!= NULL
) {
1423 Status
= EvaluateExpression (Selection
->FormSet
, Selection
->Form
, Selection
->Form
->SuppressExpression
);
1424 if (EFI_ERROR (Status
) || (Selection
->Form
->SuppressExpression
->Result
.Type
!= EFI_IFR_TYPE_BOOLEAN
)) {
1425 Status
= EFI_INVALID_PARAMETER
;
1429 if (Selection
->Form
->SuppressExpression
->Result
.Value
.b
) {
1431 // Form is suppressed.
1434 CreateDialog (4, TRUE
, 0, NULL
, &Key
, gEmptyString
, gFormSuppress
, gPressEnter
, gEmptyString
);
1435 } while (Key
.UnicodeChar
!= CHAR_CARRIAGE_RETURN
);
1437 Status
= EFI_NOT_FOUND
;
1443 // Reset FormPackage update flag
1445 mHiiPackageListUpdated
= FALSE
;
1448 // Before display new form, invoke ConfigAccess.Callback() with EFI_BROWSER_ACTION_FORM_OPEN
1449 // for each question with callback flag.
1450 // New form may be the first form, or the different form after another form close.
1452 if ((ConfigAccess
!= NULL
) &&
1453 ((Selection
->Handle
!= mCurrentHiiHandle
) ||
1454 (!CompareGuid (&Selection
->FormSetGuid
, &mCurrentFormSetGuid
)) ||
1455 (Selection
->FormId
!= mCurrentFormId
))) {
1458 // Keep current form information
1460 mCurrentHiiHandle
= Selection
->Handle
;
1461 CopyGuid (&mCurrentFormSetGuid
, &Selection
->FormSetGuid
);
1462 mCurrentFormId
= Selection
->FormId
;
1464 Status
= ProcessCallBackFunction (Selection
, NULL
, EFI_BROWSER_ACTION_FORM_OPEN
, FALSE
);
1465 if (EFI_ERROR (Status
)) {
1470 // EXIT requests to close form.
1472 if (Selection
->Action
== UI_ACTION_EXIT
) {
1476 // IFR is updated during callback of open form, force to reparse the IFR binary
1478 if (mHiiPackageListUpdated
) {
1479 Selection
->Action
= UI_ACTION_REFRESH_FORMSET
;
1480 mHiiPackageListUpdated
= FALSE
;
1486 // Load Questions' Value for display
1488 Status
= LoadFormSetConfig (Selection
, Selection
->FormSet
);
1489 if (EFI_ERROR (Status
)) {
1494 // EXIT requests to close form.
1496 if (Selection
->Action
== UI_ACTION_EXIT
) {
1500 // IFR is updated during callback of read value, force to reparse the IFR binary
1502 if (mHiiPackageListUpdated
) {
1503 Selection
->Action
= UI_ACTION_REFRESH_FORMSET
;
1504 mHiiPackageListUpdated
= FALSE
;
1509 // Displays the Header and Footer borders
1511 DisplayPageFrame (Selection
);
1516 Status
= DisplayForm (Selection
);
1517 if (EFI_ERROR (Status
)) {
1522 // Check Selected Statement (if press ESC, Selection->Statement will be NULL)
1524 Statement
= Selection
->Statement
;
1525 if (Statement
!= NULL
) {
1526 if ((Statement
->QuestionFlags
& EFI_IFR_FLAG_RESET_REQUIRED
) == EFI_IFR_FLAG_RESET_REQUIRED
) {
1527 gResetRequired
= TRUE
;
1531 // Reset FormPackage update flag
1533 mHiiPackageListUpdated
= FALSE
;
1535 if ((ConfigAccess
!= NULL
) &&
1536 ((Statement
->QuestionFlags
& EFI_IFR_FLAG_CALLBACK
) == EFI_IFR_FLAG_CALLBACK
) &&
1537 (Statement
->Operand
!= EFI_IFR_PASSWORD_OP
)) {
1539 Status
= ProcessCallBackFunction(Selection
, Statement
, EFI_BROWSER_ACTION_CHANGING
, FALSE
);
1540 if (Statement
->Operand
== EFI_IFR_REF_OP
&& Selection
->Action
!= UI_ACTION_EXIT
) {
1542 // Process dynamic update ref opcode.
1544 if (!EFI_ERROR (Status
)) {
1545 Status
= ProcessGotoOpCode(Statement
, Selection
, NULL
, NULL
);
1549 // Callback return error status or status return from process goto opcode.
1551 if (EFI_ERROR (Status
)) {
1553 // Cross reference will not be taken
1555 Selection
->FormId
= Selection
->Form
->FormId
;
1556 Selection
->QuestionId
= 0;
1562 // Check whether Form Package has been updated during Callback
1564 if (mHiiPackageListUpdated
&& (Selection
->Action
== UI_ACTION_REFRESH_FORM
)) {
1566 // Force to reparse IFR binary of target Formset
1568 mHiiPackageListUpdated
= FALSE
;
1569 Selection
->Action
= UI_ACTION_REFRESH_FORMSET
;
1574 // Before exit the form, invoke ConfigAccess.Callback() with EFI_BROWSER_ACTION_FORM_CLOSE
1575 // for each question with callback flag.
1577 if ((ConfigAccess
!= NULL
) &&
1578 ((Selection
->Action
== UI_ACTION_EXIT
) ||
1579 (Selection
->Handle
!= mCurrentHiiHandle
) ||
1580 (!CompareGuid (&Selection
->FormSetGuid
, &mCurrentFormSetGuid
)) ||
1581 (Selection
->FormId
!= mCurrentFormId
))) {
1583 Status
= ProcessCallBackFunction (Selection
, NULL
, EFI_BROWSER_ACTION_FORM_CLOSE
, FALSE
);
1584 if (EFI_ERROR (Status
)) {
1588 } while (Selection
->Action
== UI_ACTION_REFRESH_FORM
);
1592 // Reset current form information to the initial setting when error happens or form exit.
1594 if (EFI_ERROR (Status
) || Selection
->Action
== UI_ACTION_EXIT
) {
1595 mCurrentHiiHandle
= NULL
;
1596 CopyGuid (&mCurrentFormSetGuid
, &gZeroGuid
);
1601 // Unregister notify for Form package update
1603 mHiiDatabase
->UnregisterPackageNotify (