2 Private MACRO, structure and function definitions for Setup Browser module.
4 Copyright (c) 2007 - 2013, 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.
22 #include <Protocol/SimpleTextOut.h>
23 #include <Protocol/SimpleTextIn.h>
24 #include <Protocol/FormBrowser2.h>
25 #include <Protocol/FormBrowserEx.h>
26 #include <Protocol/DevicePath.h>
27 #include <Protocol/UnicodeCollation.h>
28 #include <Protocol/HiiConfigAccess.h>
29 #include <Protocol/HiiConfigRouting.h>
30 #include <Protocol/HiiDatabase.h>
31 #include <Protocol/HiiString.h>
32 #include <Protocol/UserManager.h>
33 #include <Protocol/DevicePathFromText.h>
35 #include <Guid/MdeModuleHii.h>
36 #include <Guid/HiiPlatformSetupFormset.h>
37 #include <Guid/HiiFormMapMethodGuid.h>
39 #include <Library/PrintLib.h>
40 #include <Library/DebugLib.h>
41 #include <Library/BaseMemoryLib.h>
42 #include <Library/UefiRuntimeServicesTableLib.h>
43 #include <Library/UefiDriverEntryPoint.h>
44 #include <Library/UefiBootServicesTableLib.h>
45 #include <Library/BaseLib.h>
46 #include <Library/MemoryAllocationLib.h>
47 #include <Library/HiiLib.h>
48 #include <Library/PcdLib.h>
49 #include <Library/DevicePathLib.h>
54 // This is the generated header file which includes whatever needs to be exported (strings + IFR)
57 extern UINT8 SetupBrowserStrings
[];
62 #define BANNER_HEIGHT 6
63 #define BANNER_COLUMNS 3
64 #define BANNER_LEFT_COLUMN_INDENT 1
66 #define FRONT_PAGE_HEADER_HEIGHT 6
67 #define NONE_FRONT_PAGE_HEADER_HEIGHT 3
68 #define LEFT_SKIPPED_COLUMNS 3
69 #define FOOTER_HEIGHT 4
70 #define STATUS_BAR_HEIGHT 1
71 #define SCROLL_ARROW_HEIGHT 1
72 #define POPUP_PAD_SPACE_COUNT 5
73 #define POPUP_FRAME_WIDTH 2
76 // Definition for function key setting
78 #define NONE_FUNCTION_KEY_SETTING 0
79 #define ENABLE_FUNCTION_KEY_SETTING 1
84 } FUNCTIION_KEY_SETTING
;
87 // Character definitions
89 #define CHAR_SPACE 0x0020
90 #define UPPER_LOWER_CASE_OFFSET 0x20
95 #define ONE_SECOND 10000000
98 // Display definitions
100 #define LEFT_HYPER_DELIMITER L'<'
101 #define RIGHT_HYPER_DELIMITER L'>'
103 #define LEFT_ONEOF_DELIMITER L'<'
104 #define RIGHT_ONEOF_DELIMITER L'>'
106 #define LEFT_NUMERIC_DELIMITER L'['
107 #define RIGHT_NUMERIC_DELIMITER L']'
109 #define LEFT_CHECKBOX_DELIMITER L'['
110 #define RIGHT_CHECKBOX_DELIMITER L']'
112 #define CHECK_ON L'X'
113 #define CHECK_OFF L' '
115 #define TIME_SEPARATOR L':'
116 #define DATE_SEPARATOR L'/'
118 #define YES_ANSWER L'Y'
119 #define NO_ANSWER L'N'
122 // This is the Input Error Message
124 #define INPUT_ERROR 1
127 // This is the NV RAM update required Message
129 #define NV_UPDATE_REQUIRED 2
132 // Refresh the Status Bar with flags
134 #define REFRESH_STATUS_BAR 0xff
137 // Incremental string lenght of ConfigRequest
139 #define CONFIG_REQUEST_STRING_INCREMENTAL 1024
142 // HII value compare result
144 #define HII_VALUE_UNDEFINED 0
145 #define HII_VALUE_EQUAL 1
146 #define HII_VALUE_LESS_THAN 2
147 #define HII_VALUE_GREATER_THAN 3
150 // Incremental size of stack for expression
152 #define EXPRESSION_STACK_SIZE_INCREMENT 0x100
154 #define EFI_IFR_SPECIFICATION_VERSION (UINT16) (((EFI_SYSTEM_TABLE_REVISION >> 16) << 8) | (((EFI_SYSTEM_TABLE_REVISION & 0xFFFF) / 10) << 4) | ((EFI_SYSTEM_TABLE_REVISION & 0xFFFF) % 10))
157 #define SETUP_DRIVER_SIGNATURE SIGNATURE_32 ('F', 'B', 'D', 'V')
166 EFI_FORM_BROWSER2_PROTOCOL FormBrowser2
;
168 EFI_FORM_BROWSER_EXTENSION_PROTOCOL FormBrowserEx
;
170 } SETUP_DRIVER_PRIVATE_DATA
;
173 EFI_STRING_ID Banner
[BANNER_HEIGHT
][BANNER_COLUMNS
];
177 // IFR relative definition
179 #define EFI_HII_EXPRESSION_INCONSISTENT_IF 0
180 #define EFI_HII_EXPRESSION_NO_SUBMIT_IF 1
181 #define EFI_HII_EXPRESSION_GRAY_OUT_IF 2
182 #define EFI_HII_EXPRESSION_SUPPRESS_IF 3
183 #define EFI_HII_EXPRESSION_DISABLE_IF 4
184 #define EFI_HII_EXPRESSION_VALUE 5
185 #define EFI_HII_EXPRESSION_RULE 6
186 #define EFI_HII_EXPRESSION_READ 7
187 #define EFI_HII_EXPRESSION_WRITE 8
189 #define EFI_HII_VARSTORE_BUFFER 0
190 #define EFI_HII_VARSTORE_NAME_VALUE 1
191 #define EFI_HII_VARSTORE_EFI_VARIABLE 2
192 #define EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER 3
194 #define FORM_INCONSISTENT_VALIDATION 0
195 #define FORM_NO_SUBMIT_VALIDATION 1
197 #define FORMSET_CLASS_PLATFORM_SETUP 0x0001
198 #define FORMSET_CLASS_FRONT_PAGE 0x0002
204 EFI_IFR_TYPE_VALUE Value
;
207 #define NAME_VALUE_NODE_SIGNATURE SIGNATURE_32 ('N', 'V', 'S', 'T')
217 #define NAME_VALUE_NODE_FROM_LINK(a) CR (a, NAME_VALUE_NODE, Link, NAME_VALUE_NODE_SIGNATURE)
219 #define FORMSET_STORAGE_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'G')
225 UINT8 Type
; // Storage type
230 CHAR16
*Name
; // For EFI_IFR_VARSTORE
233 UINT8
*EditBuffer
; // Edit copy for Buffer Storage
235 LIST_ENTRY NameValueListHead
; // List of NAME_VALUE_NODE
237 UINT32 Attributes
; // For EFI_IFR_VARSTORE_EFI: EFI Variable attribute
239 CHAR16
*ConfigHdr
; // <ConfigHdr>
240 CHAR16
*ConfigRequest
; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
241 UINTN ElementCount
; // Number of <RequestElement> in the <ConfigRequest>
242 UINTN SpareStrLen
; // Spare length of ConfigRequest string buffer
245 #define FORMSET_STORAGE_FROM_LINK(a) CR (a, FORMSET_STORAGE, Link, FORMSET_STORAGE_SIGNATURE)
248 EFI_STRING_ID VarName
;
252 #define EXPRESSION_OPCODE_SIGNATURE SIGNATURE_32 ('E', 'X', 'O', 'P')
260 UINT8 Format
; // For EFI_IFR_TO_STRING, EFI_IFR_FIND
261 UINT8 Flags
; // For EFI_IFR_SPAN
262 UINT8 RuleId
; // For EFI_IFR_RULE_REF
264 EFI_HII_VALUE Value
; // For EFI_IFR_EQ_ID_VAL, EFI_IFR_UINT64, EFI_IFR_UINT32, EFI_IFR_UINT16, EFI_IFR_UINT8, EFI_IFR_STRING_REF1
266 EFI_QUESTION_ID QuestionId
; // For EFI_IFR_EQ_ID_ID, EFI_IFR_EQ_ID_VAL_LIST, EFI_IFR_QUESTION_REF1
267 EFI_QUESTION_ID QuestionId2
;
269 UINT16 ListLength
; // For EFI_IFR_EQ_ID_VAL_LIST
272 EFI_STRING_ID DevicePath
; // For EFI_IFR_QUESTION_REF3_2, EFI_IFR_QUESTION_REF3_3
275 FORMSET_STORAGE
*VarStorage
; // For EFI_IFR_SET, EFI_IFR_GET
276 VAR_STORE_INFO VarStoreInfo
;// For EFI_IFR_SET, EFI_IFR_GET
277 UINT8 ValueType
; // For EFI_IFR_SET, EFI_IFR_GET
278 UINT8 ValueWidth
; // For EFI_IFR_SET, EFI_IFR_GET
279 CHAR16
*ValueName
; // For EFI_IFR_SET, EFI_IFR_GET
280 LIST_ENTRY MapExpressionList
; // nested expressions inside of Map opcode.
283 #define EXPRESSION_OPCODE_FROM_LINK(a) CR (a, EXPRESSION_OPCODE, Link, EXPRESSION_OPCODE_SIGNATURE)
285 #define FORM_EXPRESSION_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'P')
291 UINT8 Type
; // Type for this expression
293 UINT8 RuleId
; // For EFI_IFR_RULE only
294 EFI_STRING_ID Error
; // For EFI_IFR_NO_SUBMIT_IF, EFI_IFR_INCONSISTENT_IF only
296 EFI_HII_VALUE Result
; // Expression evaluation result
298 LIST_ENTRY OpCodeListHead
; // OpCodes consist of this expression (EXPRESSION_OPCODE)
301 #define FORM_EXPRESSION_FROM_LINK(a) CR (a, FORM_EXPRESSION, Link, FORM_EXPRESSION_SIGNATURE)
303 #define FORM_EXPRESSION_LIST_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'R')
308 FORM_EXPRESSION
*Expression
[1]; // Array[Count] of expressions
309 } FORM_EXPRESSION_LIST
;
311 #define QUESTION_DEFAULT_SIGNATURE SIGNATURE_32 ('Q', 'D', 'F', 'T')
318 EFI_HII_VALUE Value
; // Default value
320 FORM_EXPRESSION
*ValueExpression
; // Not-NULL indicates default value is provided by EFI_IFR_VALUE
323 #define QUESTION_DEFAULT_FROM_LINK(a) CR (a, QUESTION_DEFAULT, Link, QUESTION_DEFAULT_SIGNATURE)
325 #define QUESTION_OPTION_SIGNATURE SIGNATURE_32 ('Q', 'O', 'P', 'T')
334 EFI_IMAGE_ID ImageId
;
336 FORM_EXPRESSION_LIST
*SuppressExpression
; // Non-NULL indicates nested inside of SuppressIf
339 #define QUESTION_OPTION_FROM_LINK(a) CR (a, QUESTION_OPTION, Link, QUESTION_OPTION_SIGNATURE)
355 #define FORM_BROWSER_STATEMENT_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'A')
361 UINT8 Operand
; // The operand (first byte) of this Statement or Question
366 EFI_STRING_ID Prompt
;
368 EFI_STRING_ID TextTwo
; // For EFI_IFR_TEXT
373 EFI_QUESTION_ID QuestionId
; // The value of zero is reserved
374 EFI_VARSTORE_ID VarStoreId
; // A value of zero indicates no variable storage
375 FORMSET_STORAGE
*Storage
;
376 VAR_STORE_INFO VarStoreInfo
;
379 CHAR16
*VariableName
; // Name/Value or EFI Variable name
380 CHAR16
*BlockName
; // Buffer storage block name: "OFFSET=...WIDTH=..."
382 EFI_HII_VALUE HiiValue
; // Edit copy for checkbox, numberic, oneof
383 UINT8
*BufferValue
; // Edit copy for string, password, orderedlist
384 UINT8 ValueType
; // Data type for orderedlist value array
387 // OpCode specific members
389 UINT8 Flags
; // for EFI_IFR_CHECKBOX, EFI_IFR_DATE, EFI_IFR_NUMERIC, EFI_IFR_ONE_OF,
390 // EFI_IFR_ORDERED_LIST, EFI_IFR_STRING,EFI_IFR_SUBTITLE,EFI_IFR_TIME, EFI_IFR_BANNER
391 UINT8 MaxContainers
; // for EFI_IFR_ORDERED_LIST
393 UINT16 BannerLineNumber
; // for EFI_IFR_BANNER, 1-based line number
394 EFI_STRING_ID QuestionConfig
; // for EFI_IFR_ACTION, if 0 then no configuration string will be processed
396 UINT64 Minimum
; // for EFI_IFR_ONE_OF/EFI_IFR_NUMERIC, it's Min/Max value
397 UINT64 Maximum
; // for EFI_IFR_STRING/EFI_IFR_PASSWORD, it's Min/Max length
400 EFI_DEFAULT_ID DefaultId
; // for EFI_IFR_RESET_BUTTON
401 EFI_GUID RefreshGuid
; // for EFI_IFR_REFRESH_ID
402 BOOLEAN Locked
; // Whether this statement is locked.
404 // Get from IFR parsing
406 FORM_EXPRESSION
*ValueExpression
; // nested EFI_IFR_VALUE, provide Question value and indicate Question is ReadOnly
407 LIST_ENTRY DefaultListHead
; // nested EFI_IFR_DEFAULT list (QUESTION_DEFAULT), provide default values
408 LIST_ENTRY OptionListHead
; // nested EFI_IFR_ONE_OF_OPTION list (QUESTION_OPTION)
410 EFI_IMAGE_ID ImageId
; // nested EFI_IFR_IMAGE
411 UINT8 RefreshInterval
; // nested EFI_IFR_REFRESH, refresh interval(in seconds) for Question value, 0 means no refresh
412 BOOLEAN InSubtitle
; // nesting inside of EFI_IFR_SUBTITLE
414 LIST_ENTRY InconsistentListHead
;// nested inconsistent expression list (FORM_EXPRESSION)
415 LIST_ENTRY NoSubmitListHead
; // nested nosubmit expression list (FORM_EXPRESSION)
416 FORM_EXPRESSION_LIST
*Expression
; // nesting inside of GrayOutIf/DisableIf/SuppressIf
418 FORM_EXPRESSION
*ReadExpression
; // nested EFI_IFR_READ, provide this question value by read expression.
419 FORM_EXPRESSION
*WriteExpression
; // nested EFI_IFR_WRITE, evaluate write expression after this question value is set.
420 } FORM_BROWSER_STATEMENT
;
422 #define FORM_BROWSER_STATEMENT_FROM_LINK(a) CR (a, FORM_BROWSER_STATEMENT, Link, FORM_BROWSER_STATEMENT_SIGNATURE)
424 #define FORM_BROWSER_CONFIG_REQUEST_SIGNATURE SIGNATURE_32 ('F', 'C', 'R', 'S')
429 CHAR16
*ConfigRequest
; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
430 UINTN ElementCount
; // Number of <RequestElement> in the <ConfigRequest>
433 FORMSET_STORAGE
*Storage
;
434 } FORM_BROWSER_CONFIG_REQUEST
;
435 #define FORM_BROWSER_CONFIG_REQUEST_FROM_LINK(a) CR (a, FORM_BROWSER_CONFIG_REQUEST, Link, FORM_BROWSER_CONFIG_REQUEST_SIGNATURE)
437 #define FORM_BROWSER_FORM_SIGNATURE SIGNATURE_32 ('F', 'F', 'R', 'M')
438 #define STANDARD_MAP_FORM_TYPE 0x01
444 UINT16 FormId
; // FormId of normal form or formmap form.
445 EFI_STRING_ID FormTitle
; // FormTile of normal form, or FormMapMethod title of formmap form.
446 UINT16 FormType
; // Specific form type for the different form.
448 EFI_IMAGE_ID ImageId
;
450 BOOLEAN ModalForm
; // Whether this is a modal form.
451 BOOLEAN Locked
; // Whether this form is locked.
453 BOOLEAN NvUpdateRequired
; // Whether this form has NV update request.
455 LIST_ENTRY ExpressionListHead
; // List of Expressions (FORM_EXPRESSION)
456 LIST_ENTRY StatementListHead
; // List of Statements and Questions (FORM_BROWSER_STATEMENT)
457 LIST_ENTRY ConfigRequestHead
; // List of configreques for all storage.
458 FORM_EXPRESSION_LIST
*SuppressExpression
; // nesting inside of SuppressIf
461 #define FORM_BROWSER_FORM_FROM_LINK(a) CR (a, FORM_BROWSER_FORM, Link, FORM_BROWSER_FORM_SIGNATURE)
463 #define FORMSET_DEFAULTSTORE_SIGNATURE SIGNATURE_32 ('F', 'D', 'F', 'S')
470 EFI_STRING_ID DefaultName
;
471 } FORMSET_DEFAULTSTORE
;
473 #define FORMSET_DEFAULTSTORE_FROM_LINK(a) CR (a, FORMSET_DEFAULTSTORE, Link, FORMSET_DEFAULTSTORE_SIGNATURE)
475 #define FORM_BROWSER_FORMSET_SIGNATURE SIGNATURE_32 ('F', 'B', 'F', 'S')
480 EFI_HII_HANDLE HiiHandle
; // unique id for formset.
481 EFI_HANDLE DriverHandle
;
482 EFI_HII_CONFIG_ACCESS_PROTOCOL
*ConfigAccess
;
483 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
485 UINTN IfrBinaryLength
;
486 UINT8
*IfrBinaryData
;
489 EFI_STRING_ID FormSetTitle
;
491 UINT8 NumberOfClassGuid
;
492 EFI_GUID ClassGuid
[3]; // Up to three ClassGuid
493 UINT16 Class
; // Tiano extended Class code
494 UINT16 SubClass
; // Tiano extended Subclass code
495 EFI_IMAGE_ID ImageId
;
497 FORM_BROWSER_STATEMENT
*StatementBuffer
; // Buffer for all Statements and Questions
498 EXPRESSION_OPCODE
*ExpressionBuffer
; // Buffer for all Expression OpCode
500 LIST_ENTRY StorageListHead
; // Storage list (FORMSET_STORAGE)
501 LIST_ENTRY DefaultStoreListHead
; // DefaultStore list (FORMSET_DEFAULTSTORE)
502 LIST_ENTRY FormListHead
; // Form list (FORM_BROWSER_FORM)
503 LIST_ENTRY ExpressionListHead
; // List of Expressions (FORM_EXPRESSION)
504 } FORM_BROWSER_FORMSET
;
506 #define FORM_BROWSER_FORMSET_FROM_LINK(a) CR (a, FORM_BROWSER_FORMSET, Link, FORM_BROWSER_FORMSET_SIGNATURE)
508 #define BROWSER_CONTEXT_SIGNATURE SIGNATURE_32 ('B', 'C', 'T', 'X')
515 // Globals defined in Setup.c
517 BANNER_DATA
*BannerData
;
519 UINTN FunctionKeySetting
;
520 BOOLEAN ResetRequired
;
522 EFI_SCREEN_DESCRIPTOR ScreenDimensions
;
524 CHAR16
*EnterCommitString
;
525 CHAR16
*EnterEscapeString
;
526 CHAR16
*EscapeString
;
527 CHAR16
*MoveHighlight
;
528 CHAR16
*MakeSelection
;
529 CHAR16
*DecNumericInput
;
530 CHAR16
*HexNumericInput
;
531 CHAR16
*ToggleCheckBox
;
532 CHAR16
*PromptForData
;
533 CHAR16
*PromptForPassword
;
534 CHAR16
*PromptForNewPassword
;
535 CHAR16
*ConfirmPassword
;
536 CHAR16
*ConfirmError
;
537 CHAR16
*PassowordInvalid
;
546 CHAR16
*AdjustNumber
;
548 CHAR16
*OptionMismatch
;
549 CHAR16
*FormSuppress
;
550 CHAR16
*ProtocolNotFound
;
551 CHAR16 PromptBlockWidth
;
552 CHAR16 OptionBlockWidth
;
553 CHAR16 HelpBlockWidth
;
554 FORM_BROWSER_FORMSET
*OldFormSet
;
557 // Globals defined in Ui.c
559 LIST_ENTRY MenuOption
;
560 VOID
*MenuRefreshHead
;
563 #define BROWSER_CONTEXT_FROM_LINK(a) CR (a, BROWSER_CONTEXT, Link, BROWSER_CONTEXT_SIGNATURE)
565 #define BROWSER_HOT_KEY_SIGNATURE SIGNATURE_32 ('B', 'H', 'K', 'S')
571 EFI_INPUT_KEY
*KeyData
;
574 IN EFI_STRING HelpString
;
577 #define BROWSER_HOT_KEY_FROM_LINK(a) CR (a, BROWSER_HOT_KEY, Link, BROWSER_HOT_KEY_SIGNATURE)
580 // Scope for get defaut value. It may be GetDefaultForNoStorage, GetDefaultForStorage or GetDefaultForAll.
583 GetDefaultForNoStorage
, // Get default value for question which not has storage.
584 GetDefaultForStorage
, // Get default value for question which has storage.
585 GetDefaultForAll
, // Get default value for all questions.
586 GetDefaultForMax
// Invalid value.
587 } BROWSER_GET_DEFAULT_VALUE
;
590 // Get/set question value from/to.
593 GetSetValueWithEditBuffer
, // Get/Set question value from/to editbuffer in the storage.
594 GetSetValueWithBuffer
, // Get/Set question value from/to buffer in the storage.
595 GetSetValueWithHiiDriver
, // Get/Set question value from/to hii driver.
596 GetSetValueWithMax
// Invalid value.
597 } GET_SET_QUESTION_VALUE_WITH
;
599 extern EFI_HII_DATABASE_PROTOCOL
*mHiiDatabase
;
600 extern EFI_HII_STRING_PROTOCOL
*mHiiString
;
601 extern EFI_HII_CONFIG_ROUTING_PROTOCOL
*mHiiConfigRouting
;
602 extern EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL
*mPathFromText
;
604 extern BANNER_DATA
*gBannerData
;
605 extern EFI_HII_HANDLE gFrontPageHandle
;
606 extern UINTN gClassOfVfr
;
607 extern UINTN gFunctionKeySetting
;
608 extern BOOLEAN gResetRequired
;
609 extern EFI_HII_HANDLE gHiiHandle
;
610 extern UINT16 gDirection
;
611 extern EFI_SCREEN_DESCRIPTOR gScreenDimensions
;
613 extern FORM_BROWSER_FORMSET
*gOldFormSet
;
614 extern LIST_ENTRY gBrowserFormSetList
;
615 extern LIST_ENTRY gBrowserHotKeyList
;
616 extern BROWSER_SETTING_SCOPE gBrowserSettingScope
;
617 extern EXIT_HANDLER ExitHandlerFunction
;
618 extern UINTN gFooterHeight
;
621 // Browser Global Strings
623 extern CHAR16
*gDiscardFailed
;
624 extern CHAR16
*gDefaultFailed
;
625 extern CHAR16
*gEnterString
;
626 extern CHAR16
*gEnterCommitString
;
627 extern CHAR16
*gEnterEscapeString
;
628 extern CHAR16
*gEscapeString
;
629 extern CHAR16
*gSaveFailed
;
630 extern CHAR16
*gMoveHighlight
;
631 extern CHAR16
*gMakeSelection
;
632 extern CHAR16
*gDecNumericInput
;
633 extern CHAR16
*gHexNumericInput
;
634 extern CHAR16
*gToggleCheckBox
;
635 extern CHAR16
*gPromptForData
;
636 extern CHAR16
*gPromptForPassword
;
637 extern CHAR16
*gPromptForNewPassword
;
638 extern CHAR16
*gConfirmPassword
;
639 extern CHAR16
*gConfirmError
;
640 extern CHAR16
*gPassowordInvalid
;
641 extern CHAR16
*gPressEnter
;
642 extern CHAR16
*gEmptyString
;
643 extern CHAR16
*gAreYouSure
;
644 extern CHAR16
*gYesResponse
;
645 extern CHAR16
*gNoResponse
;
646 extern CHAR16
*gMiniString
;
647 extern CHAR16
*gPlusString
;
648 extern CHAR16
*gMinusString
;
649 extern CHAR16
*gAdjustNumber
;
650 extern CHAR16
*gSaveChanges
;
651 extern CHAR16
*gOptionMismatch
;
652 extern CHAR16
*gFormSuppress
;
653 extern CHAR16
*gProtocolNotFound
;
655 extern CHAR16 gPromptBlockWidth
;
656 extern CHAR16 gOptionBlockWidth
;
657 extern CHAR16 gHelpBlockWidth
;
659 extern EFI_GUID gZeroGuid
;
660 extern EFI_GUID gTianoHiiIfrGuid
;
664 // Global Procedure Defines
668 Initialize the HII String Token to the correct values.
672 InitializeBrowserStrings (
677 Prints a unicode string to the default console,
680 @param String String pointer.
682 @return Length of string printed to the console
691 Prints a chracter to the default console,
694 @param Character Character to print.
696 @return Length of string printed to the console.
705 Prints a formatted unicode string to the default console, at
706 the supplied cursor position.
708 @param Column The cursor position to print the string at.
709 @param Row The cursor position to print the string at
710 @param Fmt Format string
711 @param ... Variable argument list for formating string.
713 @return Length of string printed to the console
726 Prints a unicode string to the default console, at
727 the supplied cursor position, using L"%s" format.
729 @param Column The cursor position to print the string at.
730 @param Row The cursor position to print the string at
731 @param String String pointer.
733 @return Length of string printed to the console
744 Prints a chracter to the default console, at
745 the supplied cursor position, using L"%c" format.
747 @param Column The cursor position to print the string at.
748 @param Row The cursor position to print the string at.
749 @param Character Character to print.
751 @return Length of string printed to the console.
762 Parse opcodes in the formset IFR binary.
764 @param FormSet Pointer of the FormSet data structure.
766 @retval EFI_SUCCESS Opcode parse success.
767 @retval Other Opcode parse fail.
772 IN FORM_BROWSER_FORMSET
*FormSet
776 Free resources allocated for a FormSet.
778 @param FormSet Pointer of the FormSet
783 IN OUT FORM_BROWSER_FORMSET
*FormSet
787 This function displays the page frame.
789 @param Selection Selection contains the information about
790 the Selection, form and formset to be displayed.
791 Selection action may be updated in retrieve callback.
795 IN UI_MENU_SELECTION
*Selection
799 Create a new string in HII Package List.
801 @param String The String to be added
802 @param HiiHandle The package list in the HII database to insert the
805 @return The output string.
811 IN EFI_HII_HANDLE HiiHandle
815 Delete a string from HII Package List.
817 @param StringId Id of the string in HII database.
818 @param HiiHandle The HII package list handle.
820 @retval EFI_SUCCESS The string was deleted successfully.
825 IN EFI_STRING_ID StringId
,
826 IN EFI_HII_HANDLE HiiHandle
830 Get the string based on the StringId and HII Package List Handle.
832 @param Token The String's ID.
833 @param HiiHandle The package list in the HII database to search for
834 the specified string.
836 @return The output string.
841 IN EFI_STRING_ID Token
,
842 IN EFI_HII_HANDLE HiiHandle
846 Draw a pop up windows based on the dimension, number of lines and
849 @param RequestedWidth The width of the pop-up.
850 @param NumberOfLines The number of lines.
851 @param Marker The variable argument list for the list of string to be printed.
856 IN UINTN RequestedWidth
,
857 IN UINTN NumberOfLines
,
862 Routine used to abstract a generic dialog interface and return the selected key or string
864 @param NumberOfLines The number of lines for the dialog box
865 @param HotKey Defines whether a single character is parsed
866 (TRUE) and returned in KeyValue or a string is
867 returned in StringBuffer. Two special characters
868 are considered when entering a string, a SCAN_ESC
869 and an CHAR_CARRIAGE_RETURN. SCAN_ESC terminates
870 string input and returns
871 @param MaximumStringSize The maximum size in bytes of a typed in string
872 (each character is a CHAR16) and the minimum
873 string returned is two bytes
874 @param StringBuffer The passed in pointer to the buffer which will
875 hold the typed in string if HotKey is FALSE
876 @param KeyValue The EFI_KEY value returned if HotKey is TRUE..
877 @param ... A series of (quantity == NumberOfLines) text
878 strings which will be used to construct the dialog
881 @retval EFI_SUCCESS Displayed dialog and received user interaction
882 @retval EFI_INVALID_PARAMETER One of the parameters was invalid (e.g.
883 (StringBuffer == NULL) && (HotKey == FALSE))
884 @retval EFI_DEVICE_ERROR User typed in an ESC character to exit the routine
890 IN UINTN NumberOfLines
,
892 IN UINTN MaximumStringSize
,
893 OUT CHAR16
*StringBuffer
,
894 OUT EFI_INPUT_KEY
*KeyValue
,
899 Get Value for given Name from a NameValue Storage.
901 @param Storage The NameValue Storage.
902 @param Name The Name.
903 @param Value The retured Value.
904 @param GetValueFrom Where to get source value, from EditValue or Value.
906 @retval EFI_SUCCESS Value found for given Name.
907 @retval EFI_NOT_FOUND No such Name found in NameValue storage.
912 IN FORMSET_STORAGE
*Storage
,
914 IN OUT CHAR16
**Value
,
915 IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
919 Set Value of given Name in a NameValue Storage.
921 @param Storage The NameValue Storage.
922 @param Name The Name.
923 @param Value The Value to set.
924 @param SetValueTo Whether update editValue or Value.
926 @retval EFI_SUCCESS Value found for given Name.
927 @retval EFI_NOT_FOUND No such Name found in NameValue storage.
932 IN FORMSET_STORAGE
*Storage
,
935 IN GET_SET_QUESTION_VALUE_WITH SetValueTo
939 Get Question's current Value.
941 @param FormSet FormSet data structure.
942 @param Form Form data structure.
943 @param Question Question to be initialized.
944 @param GetValueFrom Where to get value, may from editbuffer, buffer or hii driver.
946 @retval EFI_SUCCESS The function completed successfully.
951 IN FORM_BROWSER_FORMSET
*FormSet
,
952 IN FORM_BROWSER_FORM
*Form
,
953 IN OUT FORM_BROWSER_STATEMENT
*Question
,
954 IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
958 Save Question Value to edit copy(cached) or Storage(uncached).
960 @param FormSet FormSet data structure.
961 @param Form Form data structure.
962 @param Question Pointer to the Question.
963 @param SetValueTo Update the question value to editbuffer , buffer or hii driver.
965 @retval EFI_SUCCESS The function completed successfully.
970 IN FORM_BROWSER_FORMSET
*FormSet
,
971 IN FORM_BROWSER_FORM
*Form
,
972 IN OUT FORM_BROWSER_STATEMENT
*Question
,
973 IN GET_SET_QUESTION_VALUE_WITH SetValueTo
977 Perform inconsistent check for a Form.
979 @param FormSet FormSet data structure.
980 @param Form Form data structure.
981 @param Question The Question to be validated.
982 @param Type Validation type: InConsistent or NoSubmit
984 @retval EFI_SUCCESS Form validation pass.
985 @retval other Form validation failed.
990 IN FORM_BROWSER_FORMSET
*FormSet
,
991 IN FORM_BROWSER_FORM
*Form
,
992 IN FORM_BROWSER_STATEMENT
*Question
,
998 Discard data based on the input setting scope (Form, FormSet or System).
1000 @param FormSet FormSet data structure.
1001 @param Form Form data structure.
1002 @param SettingScope Setting Scope for Discard action.
1004 @retval EFI_SUCCESS The function completed successfully.
1005 @retval EFI_UNSUPPORTED Unsupport SettingScope.
1010 IN FORM_BROWSER_FORMSET
*FormSet
,
1011 IN FORM_BROWSER_FORM
*Form
,
1012 IN BROWSER_SETTING_SCOPE SettingScope
1016 Submit data based on the input Setting level (Form, FormSet or System).
1018 @param FormSet FormSet data structure.
1019 @param Form Form data structure.
1020 @param SettingScope Setting Scope for Submit action.
1022 @retval EFI_SUCCESS The function completed successfully.
1023 @retval EFI_UNSUPPORTED Unsupport SettingScope.
1028 IN FORM_BROWSER_FORMSET
*FormSet
,
1029 IN FORM_BROWSER_FORM
*Form
,
1030 IN BROWSER_SETTING_SCOPE SettingScope
1034 Reset Question to its default value.
1036 @param FormSet The form set.
1037 @param Form The form.
1038 @param Question The question.
1039 @param DefaultId The Class of the default.
1041 @retval EFI_SUCCESS Question is reset to default value.
1045 GetQuestionDefault (
1046 IN FORM_BROWSER_FORMSET
*FormSet
,
1047 IN FORM_BROWSER_FORM
*Form
,
1048 IN FORM_BROWSER_STATEMENT
*Question
,
1053 Get current setting of Questions.
1055 @param FormSet FormSet data structure.
1057 @retval EFI_SUCCESS The function completed successfully.
1061 InitializeCurrentSetting (
1062 IN OUT FORM_BROWSER_FORMSET
*FormSet
1066 Initialize the internal data structure of a FormSet.
1068 @param Handle PackageList Handle
1069 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
1070 GUID), take the first FormSet found in package
1072 @param FormSet FormSet data structure.
1073 @param UpdateGlobalVar Whether need to update the global variable.
1075 @retval EFI_SUCCESS The function completed successfully.
1076 @retval EFI_NOT_FOUND The specified FormSet could not be found.
1081 IN EFI_HII_HANDLE Handle
,
1082 IN OUT EFI_GUID
*FormSetGuid
,
1083 OUT FORM_BROWSER_FORMSET
*FormSet
,
1084 IN BOOLEAN UpdateGlobalVar
1088 Reset Questions to their initial value or default value in a Form, Formset or System.
1090 GetDefaultValueScope parameter decides which questions will reset
1091 to its default value.
1093 @param FormSet FormSet data structure.
1094 @param Form Form data structure.
1095 @param DefaultId The Class of the default.
1096 @param SettingScope Setting Scope for Default action.
1097 @param GetDefaultValueScope Get default value scope.
1098 @param Storage Get default value only for this storage.
1099 @param RetrieveValueFirst Whether call the retrieve call back to
1100 get the initial value before get default
1103 @retval EFI_SUCCESS The function completed successfully.
1104 @retval EFI_UNSUPPORTED Unsupport SettingScope.
1109 IN FORM_BROWSER_FORMSET
*FormSet
,
1110 IN FORM_BROWSER_FORM
*Form
,
1111 IN UINT16 DefaultId
,
1112 IN BROWSER_SETTING_SCOPE SettingScope
,
1113 IN BROWSER_GET_DEFAULT_VALUE GetDefaultValueScope
,
1114 IN FORMSET_STORAGE
*Storage
,
1115 IN BOOLEAN RetrieveValueFirst
1119 Initialize Question's Edit copy from Storage.
1121 @param Selection Selection contains the information about
1122 the Selection, form and formset to be displayed.
1123 Selection action may be updated in retrieve callback.
1124 If Selection is NULL, only initialize Question value.
1125 @param FormSet FormSet data structure.
1126 @param Form Form data structure.
1128 @retval EFI_SUCCESS The function completed successfully.
1133 IN OUT UI_MENU_SELECTION
*Selection
,
1134 IN FORM_BROWSER_FORMSET
*FormSet
,
1135 IN FORM_BROWSER_FORM
*Form
1139 Initialize Question's Edit copy from Storage for the whole Formset.
1141 @param Selection Selection contains the information about
1142 the Selection, form and formset to be displayed.
1143 Selection action may be updated in retrieve callback.
1144 If Selection is NULL, only initialize Question value.
1145 @param FormSet FormSet data structure.
1147 @retval EFI_SUCCESS The function completed successfully.
1152 IN OUT UI_MENU_SELECTION
*Selection
,
1153 IN FORM_BROWSER_FORMSET
*FormSet
1157 Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.
1159 @param Buffer The Storage to be conveted.
1160 @param ConfigResp The returned <ConfigResp>.
1161 @param SingleForm Whether update data for single form or formset level.
1163 @retval EFI_SUCCESS Convert success.
1164 @retval EFI_INVALID_PARAMETER Incorrect storage type.
1168 StorageToConfigResp (
1170 IN CHAR16
**ConfigResp
,
1171 IN BOOLEAN SingleForm
1175 Convert <ConfigResp> to settings in Buffer Storage or NameValue Storage.
1177 @param Storage The Storage to receive the settings.
1178 @param ConfigResp The <ConfigResp> to be converted.
1180 @retval EFI_SUCCESS Convert success.
1181 @retval EFI_INVALID_PARAMETER Incorrect storage type.
1185 ConfigRespToStorage (
1186 IN FORMSET_STORAGE
*Storage
,
1187 IN CHAR16
*ConfigResp
1191 Fill storage's edit copy with settings requested from Configuration Driver.
1193 @param FormSet FormSet data structure.
1194 @param Storage Buffer Storage.
1196 @retval EFI_SUCCESS The function completed successfully.
1201 IN FORM_BROWSER_FORMSET
*FormSet
,
1202 IN FORMSET_STORAGE
*Storage
1206 Fetch the Ifr binary data of a FormSet.
1208 @param Handle PackageList Handle
1209 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
1210 GUID), take the first FormSet found in package
1212 @param BinaryLength The length of the FormSet IFR binary.
1213 @param BinaryData The buffer designed to receive the FormSet.
1215 @retval EFI_SUCCESS Buffer filled with the requested FormSet.
1216 BufferLength was updated.
1217 @retval EFI_INVALID_PARAMETER The handle is unknown.
1218 @retval EFI_NOT_FOUND A form or FormSet on the requested handle cannot
1219 be found with the requested FormId.
1224 IN EFI_HII_HANDLE Handle
,
1225 IN OUT EFI_GUID
*FormSetGuid
,
1226 OUT UINTN
*BinaryLength
,
1227 OUT UINT8
**BinaryData
1231 Save globals used by previous call to SendForm(). SendForm() may be called from
1232 HiiConfigAccess.Callback(), this will cause SendForm() be reentried.
1233 So, save globals of previous call to SendForm() and restore them upon exit.
1237 SaveBrowserContext (
1242 Restore globals used by previous call to SendForm().
1246 RestoreBrowserContext (
1251 This is the routine which an external caller uses to direct the browser
1252 where to obtain it's information.
1255 @param This The Form Browser protocol instanse.
1256 @param Handles A pointer to an array of Handles. If HandleCount > 1 we
1257 display a list of the formsets for the handles specified.
1258 @param HandleCount The number of Handles specified in Handle.
1259 @param FormSetGuid This field points to the EFI_GUID which must match the Guid
1260 field in the EFI_IFR_FORM_SET op-code for the specified
1261 forms-based package. If FormSetGuid is NULL, then this
1262 function will display the first found forms package.
1263 @param FormId This field specifies which EFI_IFR_FORM to render as the first
1264 displayable page. If this field has a value of 0x0000, then
1265 the forms browser will render the specified forms in their encoded order.
1266 ScreenDimenions - This allows the browser to be called so that it occupies a
1267 portion of the physical screen instead of dynamically determining the screen dimensions.
1268 ActionRequest - Points to the action recommended by the form.
1269 @param ScreenDimensions Points to recommended form dimensions, including any non-content area, in
1271 @param ActionRequest Points to the action recommended by the form.
1273 @retval EFI_SUCCESS The function completed successfully.
1274 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1275 @retval EFI_NOT_FOUND No valid forms could be found to display.
1281 IN CONST EFI_FORM_BROWSER2_PROTOCOL
*This
,
1282 IN EFI_HII_HANDLE
*Handles
,
1283 IN UINTN HandleCount
,
1284 IN EFI_GUID
*FormSetGuid
, OPTIONAL
1285 IN UINT16 FormId
, OPTIONAL
1286 IN CONST EFI_SCREEN_DESCRIPTOR
*ScreenDimensions
, OPTIONAL
1287 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest OPTIONAL
1291 This function is called by a callback handler to retrieve uncommitted state
1292 data from the browser.
1294 @param This A pointer to the EFI_FORM_BROWSER2_PROTOCOL
1296 @param ResultsDataSize A pointer to the size of the buffer associated
1298 @param ResultsData A string returned from an IFR browser or
1299 equivalent. The results string will have no
1300 routing information in them.
1301 @param RetrieveData A BOOLEAN field which allows an agent to retrieve
1302 (if RetrieveData = TRUE) data from the uncommitted
1303 browser state information or set (if RetrieveData
1304 = FALSE) data in the uncommitted browser state
1306 @param VariableGuid An optional field to indicate the target variable
1308 @param VariableName An optional field to indicate the target
1309 human-readable variable name.
1311 @retval EFI_SUCCESS The results have been distributed or are awaiting
1313 @retval EFI_BUFFER_TOO_SMALL The ResultsDataSize specified was too small to
1314 contain the results data.
1320 IN CONST EFI_FORM_BROWSER2_PROTOCOL
*This
,
1321 IN OUT UINTN
*ResultsDataSize
,
1322 IN OUT EFI_STRING ResultsData
,
1323 IN BOOLEAN RetrieveData
,
1324 IN CONST EFI_GUID
*VariableGuid
, OPTIONAL
1325 IN CONST CHAR16
*VariableName OPTIONAL
1329 Find menu which will show next time.
1331 @param Selection On input, Selection tell setup browser the information
1332 about the Selection, form and formset to be displayed.
1333 On output, Selection return the screen item that is selected
1335 @param Repaint Whether need to repaint the menu.
1336 @param NewLine Whether need to show at new line.
1338 @retval TRUE Need return.
1339 @retval FALSE No need to return.
1343 IN OUT UI_MENU_SELECTION
*Selection
,
1344 IN BOOLEAN
*Repaint
,
1349 check whether the formset need to update the NV.
1351 @param FormSet FormSet data structure.
1352 @param SetValue Whether set new value or clear old value.
1356 UpdateNvInfoInForm (
1357 IN FORM_BROWSER_FORMSET
*FormSet
,
1362 check whether the formset need to update the NV.
1364 @param FormSet FormSet data structure.
1366 @retval TRUE Need to update the NV.
1367 @retval FALSE No need to update the NV.
1370 IsNvUpdateRequired (
1371 IN FORM_BROWSER_FORMSET
*FormSet
1375 Call the call back function for the question and process the return action.
1377 @param Selection On input, Selection tell setup browser the information
1378 about the Selection, form and formset to be displayed.
1379 On output, Selection return the screen item that is selected
1381 @param Statement The Question which need to call.
1382 @param Action The action request.
1383 @param SkipSaveOrDiscard Whether skip save or discard action.
1385 @retval EFI_SUCCESS The call back function excutes successfully.
1386 @return Other value if the call back function failed to excute.
1389 ProcessCallBackFunction (
1390 IN OUT UI_MENU_SELECTION
*Selection
,
1391 IN FORM_BROWSER_STATEMENT
*Question
,
1392 IN EFI_BROWSER_ACTION Action
,
1393 IN BOOLEAN SkipSaveOrDiscard
1397 Call the retrieve type call back function for one question to get the initialize data.
1399 This function only used when in the initialize stage, because in this stage, the
1400 Selection->Form is not ready. For other case, use the ProcessCallBackFunction instead.
1402 @param ConfigAccess The config access protocol produced by the hii driver.
1403 @param Statement The Question which need to call.
1405 @retval EFI_SUCCESS The call back function excutes successfully.
1406 @return Other value if the call back function failed to excute.
1409 ProcessRetrieveForQuestion (
1410 IN EFI_HII_CONFIG_ACCESS_PROTOCOL
*ConfigAccess
,
1411 IN FORM_BROWSER_STATEMENT
*Statement
1415 Find the matched FormSet context in the backup maintain list based on HiiHandle.
1417 @param Handle The Hii Handle.
1419 @return the found FormSet context. If no found, NULL will return.
1422 FORM_BROWSER_FORMSET
*
1423 GetFormSetFromHiiHandle (
1424 EFI_HII_HANDLE Handle
1428 Check whether the input HII handle is the FormSet that is being used.
1430 @param Handle The Hii Handle.
1432 @retval TRUE HII handle is being used.
1433 @retval FALSE HII handle is not being used.
1437 IsHiiHandleInBrowserContext (
1438 EFI_HII_HANDLE Handle
1442 Configure what scope the hot key will impact.
1443 All hot keys have the same scope. The mixed hot keys with the different level are not supported.
1444 If no scope is set, the default scope will be FormSet level.
1445 After all registered hot keys are removed, previous Scope can reset to another level.
1447 @param[in] Scope Scope level to be set.
1449 @retval EFI_SUCCESS Scope is set correctly.
1450 @retval EFI_INVALID_PARAMETER Scope is not the valid value specified in BROWSER_SETTING_SCOPE.
1451 @retval EFI_UNSPPORTED Scope level is different from current one that the registered hot keys have.
1457 IN BROWSER_SETTING_SCOPE Scope
1461 Register the hot key with its browser action, or unregistered the hot key.
1462 Only support hot key that is not printable character (control key, function key, etc.).
1463 If the action value is zero, the hot key will be unregistered if it has been registered.
1464 If the same hot key has been registered, the new action and help string will override the previous ones.
1466 @param[in] KeyData A pointer to a buffer that describes the keystroke
1467 information for the hot key. Its type is EFI_INPUT_KEY to
1468 be supported by all ConsoleIn devices.
1469 @param[in] Action Action value that describes what action will be trigged when the hot key is pressed.
1470 @param[in] DefaultId Specifies the type of defaults to retrieve, which is only for DEFAULT action.
1471 @param[in] HelpString Help string that describes the hot key information.
1472 Its value may be NULL for the unregistered hot key.
1474 @retval EFI_SUCCESS Hot key is registered or unregistered.
1475 @retval EFI_INVALID_PARAMETER KeyData is NULL.
1476 @retval EFI_NOT_FOUND KeyData is not found to be unregistered.
1477 @retval EFI_UNSUPPORTED Key represents a printable character. It is conflicted with Browser.
1482 IN EFI_INPUT_KEY
*KeyData
,
1484 IN UINT16 DefaultId
,
1485 IN EFI_STRING HelpString OPTIONAL
1489 Register Exit handler function.
1490 When more than one handler function is registered, the latter one will override the previous one.
1491 When NULL handler is specified, the previous Exit handler will be unregistered.
1493 @param[in] Handler Pointer to handler function.
1498 RegiserExitHandler (
1499 IN EXIT_HANDLER Handler
1503 Create reminder to let user to choose save or discard the changed browser data.
1504 Caller can use it to actively check the changed browser data.
1506 @retval BROWSER_NO_CHANGES No browser data is changed.
1507 @retval BROWSER_SAVE_CHANGES The changed browser data is saved.
1508 @retval BROWSER_DISCARD_CHANGES The changed browser data is discard.
1518 Find the registered HotKey based on KeyData.
1520 @param[in] KeyData A pointer to a buffer that describes the keystroke
1521 information for the hot key.
1523 @return The registered HotKey context. If no found, NULL will return.
1526 GetHotKeyFromRegisterList (
1527 IN EFI_INPUT_KEY
*KeyData