2 Private MACRO, structure and function definitions for Setup Browser module.
4 Copyright (c) 2007 - 2012, 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>
34 #include <Guid/MdeModuleHii.h>
35 #include <Guid/HiiPlatformSetupFormset.h>
36 #include <Guid/HiiFormMapMethodGuid.h>
38 #include <Library/PrintLib.h>
39 #include <Library/DebugLib.h>
40 #include <Library/BaseMemoryLib.h>
41 #include <Library/UefiRuntimeServicesTableLib.h>
42 #include <Library/UefiDriverEntryPoint.h>
43 #include <Library/UefiBootServicesTableLib.h>
44 #include <Library/BaseLib.h>
45 #include <Library/MemoryAllocationLib.h>
46 #include <Library/HiiLib.h>
47 #include <Library/PcdLib.h>
48 #include <Library/DevicePathLib.h>
53 // This is the generated header file which includes whatever needs to be exported (strings + IFR)
56 extern UINT8 SetupBrowserStrings
[];
61 #define BANNER_HEIGHT 6
62 #define BANNER_COLUMNS 3
63 #define BANNER_LEFT_COLUMN_INDENT 1
65 #define FRONT_PAGE_HEADER_HEIGHT 6
66 #define NONE_FRONT_PAGE_HEADER_HEIGHT 3
67 #define LEFT_SKIPPED_COLUMNS 3
68 #define FOOTER_HEIGHT 4
69 #define STATUS_BAR_HEIGHT 1
70 #define SCROLL_ARROW_HEIGHT 1
71 #define POPUP_PAD_SPACE_COUNT 5
72 #define POPUP_FRAME_WIDTH 2
75 // Definition for function key setting
77 #define NONE_FUNCTION_KEY_SETTING 0
78 #define ENABLE_FUNCTION_KEY_SETTING 1
83 } FUNCTIION_KEY_SETTING
;
86 // Character definitions
88 #define CHAR_SPACE 0x0020
89 #define UPPER_LOWER_CASE_OFFSET 0x20
94 #define ONE_SECOND 10000000
97 // Display definitions
99 #define LEFT_HYPER_DELIMITER L'<'
100 #define RIGHT_HYPER_DELIMITER L'>'
102 #define LEFT_ONEOF_DELIMITER L'<'
103 #define RIGHT_ONEOF_DELIMITER L'>'
105 #define LEFT_NUMERIC_DELIMITER L'['
106 #define RIGHT_NUMERIC_DELIMITER L']'
108 #define LEFT_CHECKBOX_DELIMITER L'['
109 #define RIGHT_CHECKBOX_DELIMITER L']'
111 #define CHECK_ON L'X'
112 #define CHECK_OFF L' '
114 #define TIME_SEPARATOR L':'
115 #define DATE_SEPARATOR L'/'
117 #define YES_ANSWER L'Y'
118 #define NO_ANSWER L'N'
121 // This is the Input Error Message
123 #define INPUT_ERROR 1
126 // This is the NV RAM update required Message
128 #define NV_UPDATE_REQUIRED 2
131 // Refresh the Status Bar with flags
133 #define REFRESH_STATUS_BAR 0xff
136 // Incremental string lenght of ConfigRequest
138 #define CONFIG_REQUEST_STRING_INCREMENTAL 1024
141 // HII value compare result
143 #define HII_VALUE_UNDEFINED 0
144 #define HII_VALUE_EQUAL 1
145 #define HII_VALUE_LESS_THAN 2
146 #define HII_VALUE_GREATER_THAN 3
149 // Incremental size of stack for expression
151 #define EXPRESSION_STACK_SIZE_INCREMENT 0x100
153 #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))
156 #define SETUP_DRIVER_SIGNATURE SIGNATURE_32 ('F', 'B', 'D', 'V')
165 EFI_FORM_BROWSER2_PROTOCOL FormBrowser2
;
167 EFI_FORM_BROWSER_EXTENSION_PROTOCOL FormBrowserEx
;
169 } SETUP_DRIVER_PRIVATE_DATA
;
172 EFI_STRING_ID Banner
[BANNER_HEIGHT
][BANNER_COLUMNS
];
176 // IFR relative definition
178 #define EFI_HII_EXPRESSION_INCONSISTENT_IF 0
179 #define EFI_HII_EXPRESSION_NO_SUBMIT_IF 1
180 #define EFI_HII_EXPRESSION_GRAY_OUT_IF 2
181 #define EFI_HII_EXPRESSION_SUPPRESS_IF 3
182 #define EFI_HII_EXPRESSION_DISABLE_IF 4
183 #define EFI_HII_EXPRESSION_VALUE 5
184 #define EFI_HII_EXPRESSION_RULE 6
185 #define EFI_HII_EXPRESSION_READ 7
186 #define EFI_HII_EXPRESSION_WRITE 8
188 #define EFI_HII_VARSTORE_BUFFER 0
189 #define EFI_HII_VARSTORE_NAME_VALUE 1
190 #define EFI_HII_VARSTORE_EFI_VARIABLE 2
191 #define EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER 3
193 #define FORM_INCONSISTENT_VALIDATION 0
194 #define FORM_NO_SUBMIT_VALIDATION 1
196 #define FORMSET_CLASS_PLATFORM_SETUP 0x0001
197 #define FORMSET_CLASS_FRONT_PAGE 0x0002
203 EFI_IFR_TYPE_VALUE Value
;
206 #define NAME_VALUE_NODE_SIGNATURE SIGNATURE_32 ('N', 'V', 'S', 'T')
216 #define NAME_VALUE_NODE_FROM_LINK(a) CR (a, NAME_VALUE_NODE, Link, NAME_VALUE_NODE_SIGNATURE)
218 #define FORMSET_STORAGE_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'G')
224 UINT8 Type
; // Storage type
229 CHAR16
*Name
; // For EFI_IFR_VARSTORE
232 UINT8
*EditBuffer
; // Edit copy for Buffer Storage
234 LIST_ENTRY NameValueListHead
; // List of NAME_VALUE_NODE
236 UINT32 Attributes
; // For EFI_IFR_VARSTORE_EFI: EFI Variable attribute
238 CHAR16
*ConfigHdr
; // <ConfigHdr>
239 CHAR16
*ConfigRequest
; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
240 UINTN ElementCount
; // Number of <RequestElement> in the <ConfigRequest>
241 UINTN SpareStrLen
; // Spare length of ConfigRequest string buffer
244 #define FORMSET_STORAGE_FROM_LINK(a) CR (a, FORMSET_STORAGE, Link, FORMSET_STORAGE_SIGNATURE)
247 EFI_STRING_ID VarName
;
251 #define EXPRESSION_OPCODE_SIGNATURE SIGNATURE_32 ('E', 'X', 'O', 'P')
259 UINT8 Format
; // For EFI_IFR_TO_STRING, EFI_IFR_FIND
260 UINT8 Flags
; // For EFI_IFR_SPAN
261 UINT8 RuleId
; // For EFI_IFR_RULE_REF
263 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
265 EFI_QUESTION_ID QuestionId
; // For EFI_IFR_EQ_ID_ID, EFI_IFR_EQ_ID_VAL_LIST, EFI_IFR_QUESTION_REF1
266 EFI_QUESTION_ID QuestionId2
;
268 UINT16 ListLength
; // For EFI_IFR_EQ_ID_VAL_LIST
271 EFI_STRING_ID DevicePath
; // For EFI_IFR_QUESTION_REF3_2, EFI_IFR_QUESTION_REF3_3
274 FORMSET_STORAGE
*VarStorage
; // For EFI_IFR_SET, EFI_IFR_GET
275 VAR_STORE_INFO VarStoreInfo
;// For EFI_IFR_SET, EFI_IFR_GET
276 UINT8 ValueType
; // For EFI_IFR_SET, EFI_IFR_GET
277 UINT8 ValueWidth
; // For EFI_IFR_SET, EFI_IFR_GET
278 CHAR16
*ValueName
; // For EFI_IFR_SET, EFI_IFR_GET
279 LIST_ENTRY MapExpressionList
; // nested expressions inside of Map opcode.
282 #define EXPRESSION_OPCODE_FROM_LINK(a) CR (a, EXPRESSION_OPCODE, Link, EXPRESSION_OPCODE_SIGNATURE)
284 #define FORM_EXPRESSION_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'P')
290 UINT8 Type
; // Type for this expression
292 UINT8 RuleId
; // For EFI_IFR_RULE only
293 EFI_STRING_ID Error
; // For EFI_IFR_NO_SUBMIT_IF, EFI_IFR_INCONSISTENT_IF only
295 EFI_HII_VALUE Result
; // Expression evaluation result
297 LIST_ENTRY OpCodeListHead
; // OpCodes consist of this expression (EXPRESSION_OPCODE)
300 #define FORM_EXPRESSION_FROM_LINK(a) CR (a, FORM_EXPRESSION, Link, FORM_EXPRESSION_SIGNATURE)
302 #define FORM_EXPRESSION_LIST_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'R')
307 FORM_EXPRESSION
*Expression
[1]; // Array[Count] of expressions
308 } FORM_EXPRESSION_LIST
;
310 #define QUESTION_DEFAULT_SIGNATURE SIGNATURE_32 ('Q', 'D', 'F', 'T')
317 EFI_HII_VALUE Value
; // Default value
319 FORM_EXPRESSION
*ValueExpression
; // Not-NULL indicates default value is provided by EFI_IFR_VALUE
322 #define QUESTION_DEFAULT_FROM_LINK(a) CR (a, QUESTION_DEFAULT, Link, QUESTION_DEFAULT_SIGNATURE)
324 #define QUESTION_OPTION_SIGNATURE SIGNATURE_32 ('Q', 'O', 'P', 'T')
333 EFI_IMAGE_ID ImageId
;
335 FORM_EXPRESSION_LIST
*SuppressExpression
; // Non-NULL indicates nested inside of SuppressIf
338 #define QUESTION_OPTION_FROM_LINK(a) CR (a, QUESTION_OPTION, Link, QUESTION_OPTION_SIGNATURE)
354 #define FORM_BROWSER_STATEMENT_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'A')
360 UINT8 Operand
; // The operand (first byte) of this Statement or Question
365 EFI_STRING_ID Prompt
;
367 EFI_STRING_ID TextTwo
; // For EFI_IFR_TEXT
372 EFI_QUESTION_ID QuestionId
; // The value of zero is reserved
373 EFI_VARSTORE_ID VarStoreId
; // A value of zero indicates no variable storage
374 FORMSET_STORAGE
*Storage
;
375 VAR_STORE_INFO VarStoreInfo
;
378 CHAR16
*VariableName
; // Name/Value or EFI Variable name
379 CHAR16
*BlockName
; // Buffer storage block name: "OFFSET=...WIDTH=..."
381 EFI_HII_VALUE HiiValue
; // Edit copy for checkbox, numberic, oneof
382 UINT8
*BufferValue
; // Edit copy for string, password, orderedlist
383 UINT8 ValueType
; // Data type for orderedlist value array
386 // OpCode specific members
388 UINT8 Flags
; // for EFI_IFR_CHECKBOX, EFI_IFR_DATE, EFI_IFR_NUMERIC, EFI_IFR_ONE_OF,
389 // EFI_IFR_ORDERED_LIST, EFI_IFR_STRING,EFI_IFR_SUBTITLE,EFI_IFR_TIME, EFI_IFR_BANNER
390 UINT8 MaxContainers
; // for EFI_IFR_ORDERED_LIST
392 UINT16 BannerLineNumber
; // for EFI_IFR_BANNER, 1-based line number
393 EFI_STRING_ID QuestionConfig
; // for EFI_IFR_ACTION, if 0 then no configuration string will be processed
395 UINT64 Minimum
; // for EFI_IFR_ONE_OF/EFI_IFR_NUMERIC, it's Min/Max value
396 UINT64 Maximum
; // for EFI_IFR_STRING/EFI_IFR_PASSWORD, it's Min/Max length
399 EFI_DEFAULT_ID DefaultId
; // for EFI_IFR_RESET_BUTTON
400 EFI_GUID RefreshGuid
; // for EFI_IFR_REFRESH_ID
401 BOOLEAN Locked
; // Whether this statement is locked.
403 // Get from IFR parsing
405 FORM_EXPRESSION
*ValueExpression
; // nested EFI_IFR_VALUE, provide Question value and indicate Question is ReadOnly
406 LIST_ENTRY DefaultListHead
; // nested EFI_IFR_DEFAULT list (QUESTION_DEFAULT), provide default values
407 LIST_ENTRY OptionListHead
; // nested EFI_IFR_ONE_OF_OPTION list (QUESTION_OPTION)
409 EFI_IMAGE_ID ImageId
; // nested EFI_IFR_IMAGE
410 UINT8 RefreshInterval
; // nested EFI_IFR_REFRESH, refresh interval(in seconds) for Question value, 0 means no refresh
411 BOOLEAN InSubtitle
; // nesting inside of EFI_IFR_SUBTITLE
413 LIST_ENTRY InconsistentListHead
;// nested inconsistent expression list (FORM_EXPRESSION)
414 LIST_ENTRY NoSubmitListHead
; // nested nosubmit expression list (FORM_EXPRESSION)
415 FORM_EXPRESSION_LIST
*Expression
; // nesting inside of GrayOutIf/DisableIf/SuppressIf
417 FORM_EXPRESSION
*ReadExpression
; // nested EFI_IFR_READ, provide this question value by read expression.
418 FORM_EXPRESSION
*WriteExpression
; // nested EFI_IFR_WRITE, evaluate write expression after this question value is set.
419 } FORM_BROWSER_STATEMENT
;
421 #define FORM_BROWSER_STATEMENT_FROM_LINK(a) CR (a, FORM_BROWSER_STATEMENT, Link, FORM_BROWSER_STATEMENT_SIGNATURE)
423 #define FORM_BROWSER_CONFIG_REQUEST_SIGNATURE SIGNATURE_32 ('F', 'C', 'R', 'S')
428 CHAR16
*ConfigRequest
; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
429 UINTN ElementCount
; // Number of <RequestElement> in the <ConfigRequest>
432 FORMSET_STORAGE
*Storage
;
433 } FORM_BROWSER_CONFIG_REQUEST
;
434 #define FORM_BROWSER_CONFIG_REQUEST_FROM_LINK(a) CR (a, FORM_BROWSER_CONFIG_REQUEST, Link, FORM_BROWSER_CONFIG_REQUEST_SIGNATURE)
436 #define FORM_BROWSER_FORM_SIGNATURE SIGNATURE_32 ('F', 'F', 'R', 'M')
437 #define STANDARD_MAP_FORM_TYPE 0x01
443 UINT16 FormId
; // FormId of normal form or formmap form.
444 EFI_STRING_ID FormTitle
; // FormTile of normal form, or FormMapMethod title of formmap form.
445 UINT16 FormType
; // Specific form type for the different form.
447 EFI_IMAGE_ID ImageId
;
449 BOOLEAN ModalForm
; // Whether this is a modal form.
450 BOOLEAN Locked
; // Whether this form is locked.
452 BOOLEAN NvUpdateRequired
; // Whether this form has NV update request.
454 LIST_ENTRY ExpressionListHead
; // List of Expressions (FORM_EXPRESSION)
455 LIST_ENTRY StatementListHead
; // List of Statements and Questions (FORM_BROWSER_STATEMENT)
456 LIST_ENTRY ConfigRequestHead
; // List of configreques for all storage.
457 FORM_EXPRESSION_LIST
*SuppressExpression
; // nesting inside of SuppressIf
460 #define FORM_BROWSER_FORM_FROM_LINK(a) CR (a, FORM_BROWSER_FORM, Link, FORM_BROWSER_FORM_SIGNATURE)
462 #define FORMSET_DEFAULTSTORE_SIGNATURE SIGNATURE_32 ('F', 'D', 'F', 'S')
469 EFI_STRING_ID DefaultName
;
470 } FORMSET_DEFAULTSTORE
;
472 #define FORMSET_DEFAULTSTORE_FROM_LINK(a) CR (a, FORMSET_DEFAULTSTORE, Link, FORMSET_DEFAULTSTORE_SIGNATURE)
474 #define FORM_BROWSER_FORMSET_SIGNATURE SIGNATURE_32 ('F', 'B', 'F', 'S')
479 EFI_HII_HANDLE HiiHandle
; // unique id for formset.
480 EFI_HANDLE DriverHandle
;
481 EFI_HII_CONFIG_ACCESS_PROTOCOL
*ConfigAccess
;
482 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
484 UINTN IfrBinaryLength
;
485 UINT8
*IfrBinaryData
;
488 EFI_STRING_ID FormSetTitle
;
490 UINT8 NumberOfClassGuid
;
491 EFI_GUID ClassGuid
[3]; // Up to three ClassGuid
492 UINT16 Class
; // Tiano extended Class code
493 UINT16 SubClass
; // Tiano extended Subclass code
494 EFI_IMAGE_ID ImageId
;
496 FORM_BROWSER_STATEMENT
*StatementBuffer
; // Buffer for all Statements and Questions
497 EXPRESSION_OPCODE
*ExpressionBuffer
; // Buffer for all Expression OpCode
499 LIST_ENTRY StorageListHead
; // Storage list (FORMSET_STORAGE)
500 LIST_ENTRY DefaultStoreListHead
; // DefaultStore list (FORMSET_DEFAULTSTORE)
501 LIST_ENTRY FormListHead
; // Form list (FORM_BROWSER_FORM)
502 LIST_ENTRY ExpressionListHead
; // List of Expressions (FORM_EXPRESSION)
503 } FORM_BROWSER_FORMSET
;
505 #define FORM_BROWSER_FORMSET_FROM_LINK(a) CR (a, FORM_BROWSER_FORMSET, Link, FORM_BROWSER_FORMSET_SIGNATURE)
507 #define BROWSER_CONTEXT_SIGNATURE SIGNATURE_32 ('B', 'C', 'T', 'X')
514 // Globals defined in Setup.c
516 BANNER_DATA
*BannerData
;
518 UINTN FunctionKeySetting
;
519 BOOLEAN ResetRequired
;
521 EFI_SCREEN_DESCRIPTOR ScreenDimensions
;
523 CHAR16
*EnterCommitString
;
524 CHAR16
*EnterEscapeString
;
525 CHAR16
*EscapeString
;
526 CHAR16
*MoveHighlight
;
527 CHAR16
*MakeSelection
;
528 CHAR16
*DecNumericInput
;
529 CHAR16
*HexNumericInput
;
530 CHAR16
*ToggleCheckBox
;
531 CHAR16
*PromptForData
;
532 CHAR16
*PromptForPassword
;
533 CHAR16
*PromptForNewPassword
;
534 CHAR16
*ConfirmPassword
;
535 CHAR16
*ConfirmError
;
536 CHAR16
*PassowordInvalid
;
545 CHAR16
*AdjustNumber
;
547 CHAR16
*OptionMismatch
;
548 CHAR16
*FormSuppress
;
549 CHAR16 PromptBlockWidth
;
550 CHAR16 OptionBlockWidth
;
551 CHAR16 HelpBlockWidth
;
552 FORM_BROWSER_FORMSET
*OldFormSet
;
555 // Globals defined in Ui.c
557 LIST_ENTRY MenuOption
;
558 VOID
*MenuRefreshHead
;
561 #define BROWSER_CONTEXT_FROM_LINK(a) CR (a, BROWSER_CONTEXT, Link, BROWSER_CONTEXT_SIGNATURE)
563 #define BROWSER_HOT_KEY_SIGNATURE SIGNATURE_32 ('B', 'H', 'K', 'S')
569 EFI_INPUT_KEY
*KeyData
;
572 IN EFI_STRING HelpString
;
575 #define BROWSER_HOT_KEY_FROM_LINK(a) CR (a, BROWSER_HOT_KEY, Link, BROWSER_HOT_KEY_SIGNATURE)
578 // Scope for get defaut value. It may be GetDefaultForNoStorage, GetDefaultForStorage or GetDefaultForAll.
581 GetDefaultForNoStorage
, // Get default value for question which not has storage.
582 GetDefaultForStorage
, // Get default value for question which has storage.
583 GetDefaultForAll
, // Get default value for all questions.
584 GetDefaultForMax
// Invalid value.
585 } BROWSER_GET_DEFAULT_VALUE
;
588 // Get/set question value from/to.
591 GetSetValueWithEditBuffer
, // Get/Set question value from/to editbuffer in the storage.
592 GetSetValueWithBuffer
, // Get/Set question value from/to buffer in the storage.
593 GetSetValueWithHiiDriver
, // Get/Set question value from/to hii driver.
594 GetSetValueWithMax
// Invalid value.
595 } GET_SET_QUESTION_VALUE_WITH
;
597 extern EFI_HII_DATABASE_PROTOCOL
*mHiiDatabase
;
598 extern EFI_HII_STRING_PROTOCOL
*mHiiString
;
599 extern EFI_HII_CONFIG_ROUTING_PROTOCOL
*mHiiConfigRouting
;
601 extern BANNER_DATA
*gBannerData
;
602 extern EFI_HII_HANDLE gFrontPageHandle
;
603 extern UINTN gClassOfVfr
;
604 extern UINTN gFunctionKeySetting
;
605 extern BOOLEAN gResetRequired
;
606 extern EFI_HII_HANDLE gHiiHandle
;
607 extern UINT16 gDirection
;
608 extern EFI_SCREEN_DESCRIPTOR gScreenDimensions
;
610 extern FORM_BROWSER_FORMSET
*gOldFormSet
;
611 extern LIST_ENTRY gBrowserFormSetList
;
612 extern LIST_ENTRY gBrowserHotKeyList
;
613 extern BROWSER_SETTING_SCOPE gBrowserSettingScope
;
614 extern EXIT_HANDLER ExitHandlerFunction
;
615 extern UINTN gFooterHeight
;
618 // Browser Global Strings
620 extern CHAR16
*gDiscardFailed
;
621 extern CHAR16
*gDefaultFailed
;
622 extern CHAR16
*gEnterString
;
623 extern CHAR16
*gEnterCommitString
;
624 extern CHAR16
*gEnterEscapeString
;
625 extern CHAR16
*gEscapeString
;
626 extern CHAR16
*gSaveFailed
;
627 extern CHAR16
*gMoveHighlight
;
628 extern CHAR16
*gMakeSelection
;
629 extern CHAR16
*gDecNumericInput
;
630 extern CHAR16
*gHexNumericInput
;
631 extern CHAR16
*gToggleCheckBox
;
632 extern CHAR16
*gPromptForData
;
633 extern CHAR16
*gPromptForPassword
;
634 extern CHAR16
*gPromptForNewPassword
;
635 extern CHAR16
*gConfirmPassword
;
636 extern CHAR16
*gConfirmError
;
637 extern CHAR16
*gPassowordInvalid
;
638 extern CHAR16
*gPressEnter
;
639 extern CHAR16
*gEmptyString
;
640 extern CHAR16
*gAreYouSure
;
641 extern CHAR16
*gYesResponse
;
642 extern CHAR16
*gNoResponse
;
643 extern CHAR16
*gMiniString
;
644 extern CHAR16
*gPlusString
;
645 extern CHAR16
*gMinusString
;
646 extern CHAR16
*gAdjustNumber
;
647 extern CHAR16
*gSaveChanges
;
648 extern CHAR16
*gOptionMismatch
;
649 extern CHAR16
*gFormSuppress
;
651 extern CHAR16 gPromptBlockWidth
;
652 extern CHAR16 gOptionBlockWidth
;
653 extern CHAR16 gHelpBlockWidth
;
655 extern EFI_GUID gZeroGuid
;
656 extern EFI_GUID gTianoHiiIfrGuid
;
660 // Global Procedure Defines
664 Initialize the HII String Token to the correct values.
668 InitializeBrowserStrings (
673 Prints a unicode string to the default console,
676 @param String String pointer.
678 @return Length of string printed to the console
687 Prints a chracter to the default console,
690 @param Character Character to print.
692 @return Length of string printed to the console.
701 Prints a formatted unicode string to the default console, at
702 the supplied cursor position.
704 @param Column The cursor position to print the string at.
705 @param Row The cursor position to print the string at
706 @param Fmt Format string
707 @param ... Variable argument list for formating string.
709 @return Length of string printed to the console
722 Prints a unicode string to the default console, at
723 the supplied cursor position, using L"%s" format.
725 @param Column The cursor position to print the string at.
726 @param Row The cursor position to print the string at
727 @param String String pointer.
729 @return Length of string printed to the console
740 Prints a chracter to the default console, at
741 the supplied cursor position, using L"%c" format.
743 @param Column The cursor position to print the string at.
744 @param Row The cursor position to print the string at.
745 @param Character Character to print.
747 @return Length of string printed to the console.
758 Parse opcodes in the formset IFR binary.
760 @param FormSet Pointer of the FormSet data structure.
762 @retval EFI_SUCCESS Opcode parse success.
763 @retval Other Opcode parse fail.
768 IN FORM_BROWSER_FORMSET
*FormSet
772 Free resources allocated for a FormSet.
774 @param FormSet Pointer of the FormSet
779 IN OUT FORM_BROWSER_FORMSET
*FormSet
783 This function displays the page frame.
785 @param Selection Selection contains the information about
786 the Selection, form and formset to be displayed.
787 Selection action may be updated in retrieve callback.
791 IN UI_MENU_SELECTION
*Selection
795 Create a new string in HII Package List.
797 @param String The String to be added
798 @param HiiHandle The package list in the HII database to insert the
801 @return The output string.
807 IN EFI_HII_HANDLE HiiHandle
811 Delete a string from HII Package List.
813 @param StringId Id of the string in HII database.
814 @param HiiHandle The HII package list handle.
816 @retval EFI_SUCCESS The string was deleted successfully.
821 IN EFI_STRING_ID StringId
,
822 IN EFI_HII_HANDLE HiiHandle
826 Get the string based on the StringId and HII Package List Handle.
828 @param Token The String's ID.
829 @param HiiHandle The package list in the HII database to search for
830 the specified string.
832 @return The output string.
837 IN EFI_STRING_ID Token
,
838 IN EFI_HII_HANDLE HiiHandle
842 Draw a pop up windows based on the dimension, number of lines and
845 @param RequestedWidth The width of the pop-up.
846 @param NumberOfLines The number of lines.
847 @param Marker The variable argument list for the list of string to be printed.
852 IN UINTN RequestedWidth
,
853 IN UINTN NumberOfLines
,
858 Routine used to abstract a generic dialog interface and return the selected key or string
860 @param NumberOfLines The number of lines for the dialog box
861 @param HotKey Defines whether a single character is parsed
862 (TRUE) and returned in KeyValue or a string is
863 returned in StringBuffer. Two special characters
864 are considered when entering a string, a SCAN_ESC
865 and an CHAR_CARRIAGE_RETURN. SCAN_ESC terminates
866 string input and returns
867 @param MaximumStringSize The maximum size in bytes of a typed in string
868 (each character is a CHAR16) and the minimum
869 string returned is two bytes
870 @param StringBuffer The passed in pointer to the buffer which will
871 hold the typed in string if HotKey is FALSE
872 @param KeyValue The EFI_KEY value returned if HotKey is TRUE..
873 @param ... A series of (quantity == NumberOfLines) text
874 strings which will be used to construct the dialog
877 @retval EFI_SUCCESS Displayed dialog and received user interaction
878 @retval EFI_INVALID_PARAMETER One of the parameters was invalid (e.g.
879 (StringBuffer == NULL) && (HotKey == FALSE))
880 @retval EFI_DEVICE_ERROR User typed in an ESC character to exit the routine
886 IN UINTN NumberOfLines
,
888 IN UINTN MaximumStringSize
,
889 OUT CHAR16
*StringBuffer
,
890 OUT EFI_INPUT_KEY
*KeyValue
,
895 Get Value for given Name from a NameValue Storage.
897 @param Storage The NameValue Storage.
898 @param Name The Name.
899 @param Value The retured Value.
900 @param GetValueFrom Where to get source value, from EditValue or Value.
902 @retval EFI_SUCCESS Value found for given Name.
903 @retval EFI_NOT_FOUND No such Name found in NameValue storage.
908 IN FORMSET_STORAGE
*Storage
,
910 IN OUT CHAR16
**Value
,
911 IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
915 Set Value of given Name in a NameValue Storage.
917 @param Storage The NameValue Storage.
918 @param Name The Name.
919 @param Value The Value to set.
920 @param SetValueTo Whether update editValue or Value.
922 @retval EFI_SUCCESS Value found for given Name.
923 @retval EFI_NOT_FOUND No such Name found in NameValue storage.
928 IN FORMSET_STORAGE
*Storage
,
931 IN GET_SET_QUESTION_VALUE_WITH SetValueTo
935 Get Question's current Value.
937 @param FormSet FormSet data structure.
938 @param Form Form data structure.
939 @param Question Question to be initialized.
940 @param GetValueFrom Where to get value, may from editbuffer, buffer or hii driver.
942 @retval EFI_SUCCESS The function completed successfully.
947 IN FORM_BROWSER_FORMSET
*FormSet
,
948 IN FORM_BROWSER_FORM
*Form
,
949 IN OUT FORM_BROWSER_STATEMENT
*Question
,
950 IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
954 Save Question Value to edit copy(cached) or Storage(uncached).
956 @param FormSet FormSet data structure.
957 @param Form Form data structure.
958 @param Question Pointer to the Question.
959 @param SetValueTo Update the question value to editbuffer , buffer or hii driver.
961 @retval EFI_SUCCESS The function completed successfully.
966 IN FORM_BROWSER_FORMSET
*FormSet
,
967 IN FORM_BROWSER_FORM
*Form
,
968 IN OUT FORM_BROWSER_STATEMENT
*Question
,
969 IN GET_SET_QUESTION_VALUE_WITH SetValueTo
973 Perform inconsistent check for a Form.
975 @param FormSet FormSet data structure.
976 @param Form Form data structure.
977 @param Question The Question to be validated.
978 @param Type Validation type: InConsistent or NoSubmit
980 @retval EFI_SUCCESS Form validation pass.
981 @retval other Form validation failed.
986 IN FORM_BROWSER_FORMSET
*FormSet
,
987 IN FORM_BROWSER_FORM
*Form
,
988 IN FORM_BROWSER_STATEMENT
*Question
,
994 Discard data based on the input setting scope (Form, FormSet or System).
996 @param FormSet FormSet data structure.
997 @param Form Form data structure.
998 @param SettingScope Setting Scope for Discard action.
1000 @retval EFI_SUCCESS The function completed successfully.
1001 @retval EFI_UNSUPPORTED Unsupport SettingScope.
1006 IN FORM_BROWSER_FORMSET
*FormSet
,
1007 IN FORM_BROWSER_FORM
*Form
,
1008 IN BROWSER_SETTING_SCOPE SettingScope
1012 Submit data based on the input Setting level (Form, FormSet or System).
1014 @param FormSet FormSet data structure.
1015 @param Form Form data structure.
1016 @param SettingScope Setting Scope for Submit action.
1018 @retval EFI_SUCCESS The function completed successfully.
1019 @retval EFI_UNSUPPORTED Unsupport SettingScope.
1024 IN FORM_BROWSER_FORMSET
*FormSet
,
1025 IN FORM_BROWSER_FORM
*Form
,
1026 IN BROWSER_SETTING_SCOPE SettingScope
1030 Reset Question to its default value.
1032 @param FormSet The form set.
1033 @param Form The form.
1034 @param Question The question.
1035 @param DefaultId The Class of the default.
1037 @retval EFI_SUCCESS Question is reset to default value.
1041 GetQuestionDefault (
1042 IN FORM_BROWSER_FORMSET
*FormSet
,
1043 IN FORM_BROWSER_FORM
*Form
,
1044 IN FORM_BROWSER_STATEMENT
*Question
,
1049 Get current setting of Questions.
1051 @param FormSet FormSet data structure.
1053 @retval EFI_SUCCESS The function completed successfully.
1057 InitializeCurrentSetting (
1058 IN OUT FORM_BROWSER_FORMSET
*FormSet
1062 Initialize the internal data structure of a FormSet.
1064 @param Handle PackageList Handle
1065 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
1066 GUID), take the first FormSet found in package
1068 @param FormSet FormSet data structure.
1069 @param UpdateGlobalVar Whether need to update the global variable.
1071 @retval EFI_SUCCESS The function completed successfully.
1072 @retval EFI_NOT_FOUND The specified FormSet could not be found.
1077 IN EFI_HII_HANDLE Handle
,
1078 IN OUT EFI_GUID
*FormSetGuid
,
1079 OUT FORM_BROWSER_FORMSET
*FormSet
,
1080 IN BOOLEAN UpdateGlobalVar
1084 Reset Questions to their default value in a Form, Formset or System.
1086 GetDefaultValueScope parameter decides which questions will reset
1087 to its default value.
1089 @param FormSet FormSet data structure.
1090 @param Form Form data structure.
1091 @param DefaultId The Class of the default.
1092 @param SettingScope Setting Scope for Default action.
1093 @param GetDefaultValueScope Get default value scope.
1094 @param Storage Get default value only for this storage.
1096 @retval EFI_SUCCESS The function completed successfully.
1097 @retval EFI_UNSUPPORTED Unsupport SettingScope.
1102 IN FORM_BROWSER_FORMSET
*FormSet
,
1103 IN FORM_BROWSER_FORM
*Form
,
1104 IN UINT16 DefaultId
,
1105 IN BROWSER_SETTING_SCOPE SettingScope
,
1106 IN BROWSER_GET_DEFAULT_VALUE GetDefaultValueScope
,
1107 IN FORMSET_STORAGE
*Storage OPTIONAL
1111 Initialize Question's Edit copy from Storage.
1113 @param Selection Selection contains the information about
1114 the Selection, form and formset to be displayed.
1115 Selection action may be updated in retrieve callback.
1116 If Selection is NULL, only initialize Question value.
1117 @param FormSet FormSet data structure.
1118 @param Form Form data structure.
1120 @retval EFI_SUCCESS The function completed successfully.
1125 IN OUT UI_MENU_SELECTION
*Selection
,
1126 IN FORM_BROWSER_FORMSET
*FormSet
,
1127 IN FORM_BROWSER_FORM
*Form
1131 Initialize Question's Edit copy from Storage for the whole Formset.
1133 @param Selection Selection contains the information about
1134 the Selection, form and formset to be displayed.
1135 Selection action may be updated in retrieve callback.
1136 If Selection is NULL, only initialize Question value.
1137 @param FormSet FormSet data structure.
1139 @retval EFI_SUCCESS The function completed successfully.
1144 IN OUT UI_MENU_SELECTION
*Selection
,
1145 IN FORM_BROWSER_FORMSET
*FormSet
1149 Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.
1151 @param Buffer The Storage to be conveted.
1152 @param ConfigResp The returned <ConfigResp>.
1153 @param SingleForm Whether update data for single form or formset level.
1155 @retval EFI_SUCCESS Convert success.
1156 @retval EFI_INVALID_PARAMETER Incorrect storage type.
1160 StorageToConfigResp (
1162 IN CHAR16
**ConfigResp
,
1163 IN BOOLEAN SingleForm
1167 Convert <ConfigResp> to settings in Buffer Storage or NameValue Storage.
1169 @param Storage The Storage to receive the settings.
1170 @param ConfigResp The <ConfigResp> to be converted.
1172 @retval EFI_SUCCESS Convert success.
1173 @retval EFI_INVALID_PARAMETER Incorrect storage type.
1177 ConfigRespToStorage (
1178 IN FORMSET_STORAGE
*Storage
,
1179 IN CHAR16
*ConfigResp
1183 Fill storage's edit copy with settings requested from Configuration Driver.
1185 @param FormSet FormSet data structure.
1186 @param Storage Buffer Storage.
1188 @retval EFI_SUCCESS The function completed successfully.
1193 IN FORM_BROWSER_FORMSET
*FormSet
,
1194 IN FORMSET_STORAGE
*Storage
1198 Fetch the Ifr binary data of a FormSet.
1200 @param Handle PackageList Handle
1201 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
1202 GUID), take the first FormSet found in package
1204 @param BinaryLength The length of the FormSet IFR binary.
1205 @param BinaryData The buffer designed to receive the FormSet.
1207 @retval EFI_SUCCESS Buffer filled with the requested FormSet.
1208 BufferLength was updated.
1209 @retval EFI_INVALID_PARAMETER The handle is unknown.
1210 @retval EFI_NOT_FOUND A form or FormSet on the requested handle cannot
1211 be found with the requested FormId.
1216 IN EFI_HII_HANDLE Handle
,
1217 IN OUT EFI_GUID
*FormSetGuid
,
1218 OUT UINTN
*BinaryLength
,
1219 OUT UINT8
**BinaryData
1223 Save globals used by previous call to SendForm(). SendForm() may be called from
1224 HiiConfigAccess.Callback(), this will cause SendForm() be reentried.
1225 So, save globals of previous call to SendForm() and restore them upon exit.
1229 SaveBrowserContext (
1234 Restore globals used by previous call to SendForm().
1238 RestoreBrowserContext (
1243 This is the routine which an external caller uses to direct the browser
1244 where to obtain it's information.
1247 @param This The Form Browser protocol instanse.
1248 @param Handles A pointer to an array of Handles. If HandleCount > 1 we
1249 display a list of the formsets for the handles specified.
1250 @param HandleCount The number of Handles specified in Handle.
1251 @param FormSetGuid This field points to the EFI_GUID which must match the Guid
1252 field in the EFI_IFR_FORM_SET op-code for the specified
1253 forms-based package. If FormSetGuid is NULL, then this
1254 function will display the first found forms package.
1255 @param FormId This field specifies which EFI_IFR_FORM to render as the first
1256 displayable page. If this field has a value of 0x0000, then
1257 the forms browser will render the specified forms in their encoded order.
1258 ScreenDimenions - This allows the browser to be called so that it occupies a
1259 portion of the physical screen instead of dynamically determining the screen dimensions.
1260 ActionRequest - Points to the action recommended by the form.
1261 @param ScreenDimensions Points to recommended form dimensions, including any non-content area, in
1263 @param ActionRequest Points to the action recommended by the form.
1265 @retval EFI_SUCCESS The function completed successfully.
1266 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1267 @retval EFI_NOT_FOUND No valid forms could be found to display.
1273 IN CONST EFI_FORM_BROWSER2_PROTOCOL
*This
,
1274 IN EFI_HII_HANDLE
*Handles
,
1275 IN UINTN HandleCount
,
1276 IN EFI_GUID
*FormSetGuid
, OPTIONAL
1277 IN UINT16 FormId
, OPTIONAL
1278 IN CONST EFI_SCREEN_DESCRIPTOR
*ScreenDimensions
, OPTIONAL
1279 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest OPTIONAL
1283 This function is called by a callback handler to retrieve uncommitted state
1284 data from the browser.
1286 @param This A pointer to the EFI_FORM_BROWSER2_PROTOCOL
1288 @param ResultsDataSize A pointer to the size of the buffer associated
1290 @param ResultsData A string returned from an IFR browser or
1291 equivalent. The results string will have no
1292 routing information in them.
1293 @param RetrieveData A BOOLEAN field which allows an agent to retrieve
1294 (if RetrieveData = TRUE) data from the uncommitted
1295 browser state information or set (if RetrieveData
1296 = FALSE) data in the uncommitted browser state
1298 @param VariableGuid An optional field to indicate the target variable
1300 @param VariableName An optional field to indicate the target
1301 human-readable variable name.
1303 @retval EFI_SUCCESS The results have been distributed or are awaiting
1305 @retval EFI_BUFFER_TOO_SMALL The ResultsDataSize specified was too small to
1306 contain the results data.
1312 IN CONST EFI_FORM_BROWSER2_PROTOCOL
*This
,
1313 IN OUT UINTN
*ResultsDataSize
,
1314 IN OUT EFI_STRING ResultsData
,
1315 IN BOOLEAN RetrieveData
,
1316 IN CONST EFI_GUID
*VariableGuid
, OPTIONAL
1317 IN CONST CHAR16
*VariableName OPTIONAL
1321 Find menu which will show next time.
1323 @param Selection On input, Selection tell setup browser the information
1324 about the Selection, form and formset to be displayed.
1325 On output, Selection return the screen item that is selected
1327 @param Repaint Whether need to repaint the menu.
1328 @param NewLine Whether need to show at new line.
1330 @retval TRUE Need return.
1331 @retval FALSE No need to return.
1335 IN OUT UI_MENU_SELECTION
*Selection
,
1336 IN BOOLEAN
*Repaint
,
1341 check whether the formset need to update the NV.
1343 @param FormSet FormSet data structure.
1344 @param SetValue Whether set new value or clear old value.
1348 UpdateNvInfoInForm (
1349 IN FORM_BROWSER_FORMSET
*FormSet
,
1354 check whether the formset need to update the NV.
1356 @param FormSet FormSet data structure.
1358 @retval TRUE Need to update the NV.
1359 @retval FALSE No need to update the NV.
1362 IsNvUpdateRequired (
1363 IN FORM_BROWSER_FORMSET
*FormSet
1367 Call the call back function for the question and process the return action.
1369 @param Selection On input, Selection tell setup browser the information
1370 about the Selection, form and formset to be displayed.
1371 On output, Selection return the screen item that is selected
1373 @param Statement The Question which need to call.
1374 @param Action The action request.
1375 @param SkipSaveOrDiscard Whether skip save or discard action.
1377 @retval EFI_SUCCESS The call back function excutes successfully.
1378 @return Other value if the call back function failed to excute.
1381 ProcessCallBackFunction (
1382 IN OUT UI_MENU_SELECTION
*Selection
,
1383 IN FORM_BROWSER_STATEMENT
*Question
,
1384 IN EFI_BROWSER_ACTION Action
,
1385 IN BOOLEAN SkipSaveOrDiscard
1389 Find the matched FormSet context in the backup maintain list based on HiiHandle.
1391 @param Handle The Hii Handle.
1393 @return the found FormSet context. If no found, NULL will return.
1396 FORM_BROWSER_FORMSET
*
1397 GetFormSetFromHiiHandle (
1398 EFI_HII_HANDLE Handle
1402 Check whether the input HII handle is the FormSet that is being used.
1404 @param Handle The Hii Handle.
1406 @retval TRUE HII handle is being used.
1407 @retval FALSE HII handle is not being used.
1411 IsHiiHandleInBrowserContext (
1412 EFI_HII_HANDLE Handle
1416 Configure what scope the hot key will impact.
1417 All hot keys have the same scope. The mixed hot keys with the different level are not supported.
1418 If no scope is set, the default scope will be FormSet level.
1419 After all registered hot keys are removed, previous Scope can reset to another level.
1421 @param[in] Scope Scope level to be set.
1423 @retval EFI_SUCCESS Scope is set correctly.
1424 @retval EFI_INVALID_PARAMETER Scope is not the valid value specified in BROWSER_SETTING_SCOPE.
1425 @retval EFI_UNSPPORTED Scope level is different from current one that the registered hot keys have.
1431 IN BROWSER_SETTING_SCOPE Scope
1435 Register the hot key with its browser action, or unregistered the hot key.
1436 Only support hot key that is not printable character (control key, function key, etc.).
1437 If the action value is zero, the hot key will be unregistered if it has been registered.
1438 If the same hot key has been registered, the new action and help string will override the previous ones.
1440 @param[in] KeyData A pointer to a buffer that describes the keystroke
1441 information for the hot key. Its type is EFI_INPUT_KEY to
1442 be supported by all ConsoleIn devices.
1443 @param[in] Action Action value that describes what action will be trigged when the hot key is pressed.
1444 @param[in] DefaultId Specifies the type of defaults to retrieve, which is only for DEFAULT action.
1445 @param[in] HelpString Help string that describes the hot key information.
1446 Its value may be NULL for the unregistered hot key.
1448 @retval EFI_SUCCESS Hot key is registered or unregistered.
1449 @retval EFI_INVALID_PARAMETER KeyData is NULL.
1450 @retval EFI_NOT_FOUND KeyData is not found to be unregistered.
1451 @retval EFI_UNSUPPORTED Key represents a printable character. It is conflicted with Browser.
1456 IN EFI_INPUT_KEY
*KeyData
,
1458 IN UINT16 DefaultId
,
1459 IN EFI_STRING HelpString OPTIONAL
1463 Register Exit handler function.
1464 When more than one handler function is registered, the latter one will override the previous one.
1465 When NULL handler is specified, the previous Exit handler will be unregistered.
1467 @param[in] Handler Pointer to handler function.
1472 RegiserExitHandler (
1473 IN EXIT_HANDLER Handler
1477 Create reminder to let user to choose save or discard the changed browser data.
1478 Caller can use it to actively check the changed browser data.
1480 @retval BROWSER_NO_CHANGES No browser data is changed.
1481 @retval BROWSER_SAVE_CHANGES The changed browser data is saved.
1482 @retval BROWSER_DISCARD_CHANGES The changed browser data is discard.
1492 Find the registered HotKey based on KeyData.
1494 @param[in] KeyData A pointer to a buffer that describes the keystroke
1495 information for the hot key.
1497 @return The registered HotKey context. If no found, NULL will return.
1500 GetHotKeyFromRegisterList (
1501 IN EFI_INPUT_KEY
*KeyData