2 Private MACRO, structure and function definitions for Setup Browser module.
4 Copyright (c) 2007 - 2017, 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/FormBrowserEx2.h>
26 #include <Protocol/DisplayProtocol.h>
27 #include <Protocol/DevicePath.h>
28 #include <Protocol/UnicodeCollation.h>
29 #include <Protocol/HiiConfigAccess.h>
30 #include <Protocol/HiiConfigRouting.h>
31 #include <Protocol/HiiDatabase.h>
32 #include <Protocol/HiiString.h>
33 #include <Protocol/UserManager.h>
34 #include <Protocol/DevicePathFromText.h>
35 #include <Protocol/RegularExpressionProtocol.h>
37 #include <Guid/MdeModuleHii.h>
38 #include <Guid/HiiPlatformSetupFormset.h>
39 #include <Guid/HiiFormMapMethodGuid.h>
40 #include <Guid/ZeroGuid.h>
42 #include <Library/PrintLib.h>
43 #include <Library/DebugLib.h>
44 #include <Library/BaseMemoryLib.h>
45 #include <Library/UefiRuntimeServicesTableLib.h>
46 #include <Library/UefiDriverEntryPoint.h>
47 #include <Library/UefiBootServicesTableLib.h>
48 #include <Library/BaseLib.h>
49 #include <Library/MemoryAllocationLib.h>
50 #include <Library/HiiLib.h>
51 #include <Library/PcdLib.h>
52 #include <Library/DevicePathLib.h>
53 #include <Library/UefiLib.h>
57 // This is the generated header file which includes whatever needs to be exported (strings + IFR)
60 #define UI_ACTION_NONE 0
61 #define UI_ACTION_REFRESH_FORM 1
62 #define UI_ACTION_REFRESH_FORMSET 2
63 #define UI_ACTION_EXIT 3
69 #define ONE_SECOND 10000000
71 // Incremental string lenght of ConfigRequest
73 #define CONFIG_REQUEST_STRING_INCREMENTAL 1024
76 // Incremental size of stack for expression
78 #define EXPRESSION_STACK_SIZE_INCREMENT 0x100
80 #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))
83 #define SETUP_DRIVER_SIGNATURE SIGNATURE_32 ('F', 'B', 'D', 'V')
92 EFI_FORM_BROWSER2_PROTOCOL FormBrowser2
;
93 EDKII_FORM_BROWSER_EXTENSION_PROTOCOL FormBrowserEx
;
95 EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL FormBrowserEx2
;
97 } SETUP_DRIVER_PRIVATE_DATA
;
100 // IFR relative definition
102 #define EFI_HII_EXPRESSION_INCONSISTENT_IF 0
103 #define EFI_HII_EXPRESSION_NO_SUBMIT_IF 1
104 #define EFI_HII_EXPRESSION_GRAY_OUT_IF 2
105 #define EFI_HII_EXPRESSION_SUPPRESS_IF 3
106 #define EFI_HII_EXPRESSION_DISABLE_IF 4
107 #define EFI_HII_EXPRESSION_VALUE 5
108 #define EFI_HII_EXPRESSION_RULE 6
109 #define EFI_HII_EXPRESSION_READ 7
110 #define EFI_HII_EXPRESSION_WRITE 8
111 #define EFI_HII_EXPRESSION_WARNING_IF 9
113 #define EFI_HII_VARSTORE_BUFFER 0
114 #define EFI_HII_VARSTORE_NAME_VALUE 1
115 #define EFI_HII_VARSTORE_EFI_VARIABLE 2 // EFI Varstore type follow UEFI spec before 2.3.1.
116 #define EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER 3 // EFI varstore type follow UEFI spec 2.3.1 and later.
118 #define FORM_INCONSISTENT_VALIDATION 0
119 #define FORM_NO_SUBMIT_VALIDATION 1
121 #define NAME_VALUE_NODE_SIGNATURE SIGNATURE_32 ('N', 'V', 'S', 'T')
131 #define NAME_VALUE_NODE_FROM_LINK(a) CR (a, NAME_VALUE_NODE, Link, NAME_VALUE_NODE_SIGNATURE)
133 #define BROWSER_STORAGE_SIGNATURE SIGNATURE_32 ('B', 'S', 'T', 'G')
139 UINT8 Type
; // Storage type
141 BOOLEAN Initialized
; // Whether this varstore is initialized, efi varstore not used.
143 EFI_HII_HANDLE HiiHandle
; // HiiHandle for this varstore, efi varstore not used.
146 CHAR16
*Name
; // For EFI_IFR_VARSTORE
149 UINT8
*EditBuffer
; // Edit copy for Buffer Storage
151 LIST_ENTRY NameValueListHead
; // List of NAME_VALUE_NODE
153 UINT32 Attributes
; // For EFI_IFR_VARSTORE_EFI: EFI Variable attribute
155 CHAR16
*ConfigRequest
; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
156 // <RequestElement> includes all fields which is used by current form sets.
157 UINTN SpareStrLen
; // Spare length of ConfigRequest string buffer
160 #define BROWSER_STORAGE_FROM_LINK(a) CR (a, BROWSER_STORAGE, Link, BROWSER_STORAGE_SIGNATURE)
162 #define FORMSET_STORAGE_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'G')
168 LIST_ENTRY SaveFailLink
;
172 BROWSER_STORAGE
*BrowserStorage
;
174 CHAR16
*ConfigHdr
; // <ConfigHdr>
176 CHAR16
*ConfigRequest
; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
177 CHAR16
*ConfigAltResp
; // Alt config response string for this ConfigRequest.
178 BOOLEAN HasCallAltCfg
; // Flag to show whether browser has call ExtractConfig to get Altcfg string.
179 UINTN ElementCount
; // Number of <RequestElement> in the <ConfigRequest>
180 UINTN SpareStrLen
; // Spare length of ConfigRequest string buffer
181 CHAR16
*RestoreConfigRequest
; // When submit formset fail, the element need to be restored
182 CHAR16
*SyncConfigRequest
; // When submit formset fail, the element need to be synced
185 #define FORMSET_STORAGE_FROM_LINK(a) CR (a, FORMSET_STORAGE, Link, FORMSET_STORAGE_SIGNATURE)
186 #define FORMSET_STORAGE_FROM_SAVE_FAIL_LINK(a) CR (a, FORMSET_STORAGE, SaveFailLink, FORMSET_STORAGE_SIGNATURE)
189 EFI_STRING_ID VarName
;
193 #define EXPRESSION_OPCODE_SIGNATURE SIGNATURE_32 ('E', 'X', 'O', 'P')
201 UINT8 Format
; // For EFI_IFR_TO_STRING, EFI_IFR_FIND
202 UINT8 Flags
; // For EFI_IFR_SPAN
203 UINT8 RuleId
; // For EFI_IFR_RULE_REF
205 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
207 EFI_QUESTION_ID QuestionId
; // For EFI_IFR_EQ_ID_ID, EFI_IFR_EQ_ID_VAL_LIST, EFI_IFR_QUESTION_REF1
208 EFI_QUESTION_ID QuestionId2
;
210 UINT16 ListLength
; // For EFI_IFR_EQ_ID_VAL_LIST
213 EFI_STRING_ID DevicePath
; // For EFI_IFR_QUESTION_REF3_2, EFI_IFR_QUESTION_REF3_3
216 BROWSER_STORAGE
*VarStorage
; // For EFI_IFR_SET, EFI_IFR_GET
217 VAR_STORE_INFO VarStoreInfo
;// For EFI_IFR_SET, EFI_IFR_GET
218 UINT8 ValueType
; // For EFI_IFR_SET, EFI_IFR_GET
219 UINT8 ValueWidth
; // For EFI_IFR_SET, EFI_IFR_GET
220 CHAR16
*ValueName
; // For EFI_IFR_SET, EFI_IFR_GET
221 LIST_ENTRY MapExpressionList
; // nested expressions inside of Map opcode.
224 #define EXPRESSION_OPCODE_FROM_LINK(a) CR (a, EXPRESSION_OPCODE, Link, EXPRESSION_OPCODE_SIGNATURE)
226 #define FORM_EXPRESSION_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'P')
232 UINT8 Type
; // Type for this expression
234 UINT8 RuleId
; // For EFI_IFR_RULE only
235 EFI_STRING_ID Error
; // For EFI_IFR_NO_SUBMIT_IF, EFI_IFR_INCONSISTENT_IF only
237 EFI_HII_VALUE Result
; // Expression evaluation result
239 UINT8 TimeOut
; // For EFI_IFR_WARNING_IF
240 EFI_IFR_OP_HEADER
*OpCode
; // Save the opcode buffer.
242 LIST_ENTRY OpCodeListHead
; // OpCodes consist of this expression (EXPRESSION_OPCODE)
245 #define FORM_EXPRESSION_FROM_LINK(a) CR (a, FORM_EXPRESSION, Link, FORM_EXPRESSION_SIGNATURE)
247 #define FORM_EXPRESSION_LIST_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'R')
252 FORM_EXPRESSION
*Expression
[1]; // Array[Count] of expressions
253 } FORM_EXPRESSION_LIST
;
255 #define QUESTION_DEFAULT_SIGNATURE SIGNATURE_32 ('Q', 'D', 'F', 'T')
262 EFI_HII_VALUE Value
; // Default value
264 FORM_EXPRESSION
*ValueExpression
; // Not-NULL indicates default value is provided by EFI_IFR_VALUE
267 #define QUESTION_DEFAULT_FROM_LINK(a) CR (a, QUESTION_DEFAULT, Link, QUESTION_DEFAULT_SIGNATURE)
269 #define QUESTION_OPTION_SIGNATURE SIGNATURE_32 ('Q', 'O', 'P', 'T')
275 EFI_IFR_ONE_OF_OPTION
*OpCode
; // OneOfOption Data
280 EFI_IMAGE_ID ImageId
;
282 FORM_EXPRESSION_LIST
*SuppressExpression
; // Non-NULL indicates nested inside of SuppressIf
285 #define QUESTION_OPTION_FROM_LINK(a) CR (a, QUESTION_OPTION, Link, QUESTION_OPTION_SIGNATURE)
301 typedef struct _FORM_BROWSER_STATEMENT FORM_BROWSER_STATEMENT
;
303 #define FORM_BROWSER_STATEMENT_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'A')
305 struct _FORM_BROWSER_STATEMENT
{
309 UINT8 Operand
; // The operand (first byte) of this Statement or Question
310 EFI_IFR_OP_HEADER
*OpCode
;
315 EFI_STRING_ID Prompt
;
317 EFI_STRING_ID TextTwo
; // For EFI_IFR_TEXT
320 // Fake Question Id, used for statement not has true QuestionId.
322 EFI_QUESTION_ID FakeQuestionId
;
327 EFI_QUESTION_ID QuestionId
; // The value of zero is reserved
328 EFI_VARSTORE_ID VarStoreId
; // A value of zero indicates no variable storage
329 BROWSER_STORAGE
*Storage
;
330 VAR_STORE_INFO VarStoreInfo
;
333 CHAR16
*VariableName
; // Name/Value or EFI Variable name
334 CHAR16
*BlockName
; // Buffer storage block name: "OFFSET=...WIDTH=..."
336 EFI_HII_VALUE HiiValue
; // Edit copy for checkbox, numberic, oneof
337 UINT8
*BufferValue
; // Edit copy for string, password, orderedlist
338 UINT8 ValueType
; // Data type for orderedlist value array
341 // OpCode specific members
343 UINT8 Flags
; // for EFI_IFR_CHECKBOX, EFI_IFR_DATE, EFI_IFR_NUMERIC, EFI_IFR_ONE_OF,
344 // EFI_IFR_ORDERED_LIST, EFI_IFR_STRING,EFI_IFR_SUBTITLE,EFI_IFR_TIME, EFI_IFR_BANNER
345 UINT8 MaxContainers
; // for EFI_IFR_ORDERED_LIST
347 UINT16 BannerLineNumber
; // for EFI_IFR_BANNER, 1-based line number
348 EFI_STRING_ID QuestionConfig
; // for EFI_IFR_ACTION, if 0 then no configuration string will be processed
350 UINT64 Minimum
; // for EFI_IFR_ONE_OF/EFI_IFR_NUMERIC, it's Min/Max value
351 UINT64 Maximum
; // for EFI_IFR_STRING/EFI_IFR_PASSWORD, it's Min/Max length
354 EFI_DEFAULT_ID DefaultId
; // for EFI_IFR_RESET_BUTTON
355 EFI_GUID RefreshGuid
; // for EFI_IFR_REFRESH_ID
356 BOOLEAN Locked
; // Whether this statement is locked.
357 BOOLEAN ValueChanged
; // Whether this statement's value is changed.
359 // Get from IFR parsing
361 FORM_EXPRESSION
*ValueExpression
; // nested EFI_IFR_VALUE, provide Question value and indicate Question is ReadOnly
362 LIST_ENTRY DefaultListHead
; // nested EFI_IFR_DEFAULT list (QUESTION_DEFAULT), provide default values
363 LIST_ENTRY OptionListHead
; // nested EFI_IFR_ONE_OF_OPTION list (QUESTION_OPTION)
365 EFI_IMAGE_ID ImageId
; // nested EFI_IFR_IMAGE
366 UINT8 RefreshInterval
; // nested EFI_IFR_REFRESH, refresh interval(in seconds) for Question value, 0 means no refresh
368 FORM_BROWSER_STATEMENT
*ParentStatement
;
370 LIST_ENTRY InconsistentListHead
;// nested inconsistent expression list (FORM_EXPRESSION)
371 LIST_ENTRY NoSubmitListHead
; // nested nosubmit expression list (FORM_EXPRESSION)
372 LIST_ENTRY WarningListHead
; // nested warning expression list (FORM_EXPRESSION)
373 FORM_EXPRESSION_LIST
*Expression
; // nesting inside of GrayOutIf/DisableIf/SuppressIf
375 FORM_EXPRESSION
*ReadExpression
; // nested EFI_IFR_READ, provide this question value by read expression.
376 FORM_EXPRESSION
*WriteExpression
; // nested EFI_IFR_WRITE, evaluate write expression after this question value is set.
379 #define FORM_BROWSER_STATEMENT_FROM_LINK(a) CR (a, FORM_BROWSER_STATEMENT, Link, FORM_BROWSER_STATEMENT_SIGNATURE)
381 #define FORM_BROWSER_CONFIG_REQUEST_SIGNATURE SIGNATURE_32 ('F', 'C', 'R', 'S')
386 LIST_ENTRY SaveFailLink
;
388 CHAR16
*ConfigRequest
; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
389 CHAR16
*ConfigAltResp
; // Alt config response string for this ConfigRequest.
390 UINTN ElementCount
; // Number of <RequestElement> in the <ConfigRequest>
392 CHAR16
*RestoreConfigRequest
; // When submit form fail, the element need to be restored
393 CHAR16
*SyncConfigRequest
; // When submit form fail, the element need to be synced
395 BROWSER_STORAGE
*Storage
;
396 } FORM_BROWSER_CONFIG_REQUEST
;
397 #define FORM_BROWSER_CONFIG_REQUEST_FROM_LINK(a) CR (a, FORM_BROWSER_CONFIG_REQUEST, Link, FORM_BROWSER_CONFIG_REQUEST_SIGNATURE)
398 #define FORM_BROWSER_CONFIG_REQUEST_FROM_SAVE_FAIL_LINK(a) CR (a, FORM_BROWSER_CONFIG_REQUEST, SaveFailLink, FORM_BROWSER_CONFIG_REQUEST_SIGNATURE)
400 #define FORM_BROWSER_FORM_SIGNATURE SIGNATURE_32 ('F', 'F', 'R', 'M')
401 #define STANDARD_MAP_FORM_TYPE 0x01
407 UINT16 FormId
; // FormId of normal form or formmap form.
408 EFI_STRING_ID FormTitle
; // FormTile of normal form, or FormMapMethod title of formmap form.
409 UINT16 FormType
; // Specific form type for the different form.
411 EFI_IMAGE_ID ImageId
;
413 BOOLEAN ModalForm
; // Whether this is a modal form.
414 BOOLEAN Locked
; // Whether this form is locked.
415 EFI_GUID RefreshGuid
; // Form refresh event guid.
417 LIST_ENTRY FormViewListHead
; // List of type FORMID_INFO is Browser View Form History List.
418 LIST_ENTRY ExpressionListHead
; // List of Expressions (FORM_EXPRESSION)
419 LIST_ENTRY StatementListHead
; // List of Statements and Questions (FORM_BROWSER_STATEMENT)
420 LIST_ENTRY ConfigRequestHead
; // List of configreques for all storage.
421 FORM_EXPRESSION_LIST
*SuppressExpression
; // nesting inside of SuppressIf
424 #define FORM_BROWSER_FORM_FROM_LINK(a) CR (a, FORM_BROWSER_FORM, Link, FORM_BROWSER_FORM_SIGNATURE)
426 #define FORMSET_DEFAULTSTORE_SIGNATURE SIGNATURE_32 ('F', 'D', 'F', 'S')
433 EFI_STRING_ID DefaultName
;
434 } FORMSET_DEFAULTSTORE
;
436 #define FORMSET_DEFAULTSTORE_FROM_LINK(a) CR (a, FORMSET_DEFAULTSTORE, Link, FORMSET_DEFAULTSTORE_SIGNATURE)
438 #define FORM_BROWSER_FORMSET_SIGNATURE SIGNATURE_32 ('F', 'B', 'F', 'S')
443 LIST_ENTRY SaveFailLink
;
445 EFI_HII_HANDLE HiiHandle
; // unique id for formset.
446 EFI_HANDLE DriverHandle
;
447 EFI_HII_CONFIG_ACCESS_PROTOCOL
*ConfigAccess
;
448 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
450 UINTN IfrBinaryLength
;
451 UINT8
*IfrBinaryData
;
453 BOOLEAN QuestionInited
; // Have finished question initilization?
455 EFI_STRING_ID FormSetTitle
;
457 UINT8 NumberOfClassGuid
;
458 EFI_GUID ClassGuid
[3]; // Up to three ClassGuid
459 UINT16 Class
; // Tiano extended Class code
460 UINT16 SubClass
; // Tiano extended Subclass code
461 EFI_IMAGE_ID ImageId
;
462 EFI_IFR_OP_HEADER
*OpCode
; //mainly for formset op to get ClassGuid
464 FORM_BROWSER_STATEMENT
*StatementBuffer
; // Buffer for all Statements and Questions
465 EXPRESSION_OPCODE
*ExpressionBuffer
; // Buffer for all Expression OpCode
466 FORM_BROWSER_FORM
*SaveFailForm
; // The form which failed to save.
467 FORM_BROWSER_STATEMENT
*SaveFailStatement
; // The Statement which failed to save.
469 LIST_ENTRY StatementListOSF
; // Statement list out side of the form.
470 LIST_ENTRY StorageListHead
; // Storage list (FORMSET_STORAGE)
471 LIST_ENTRY SaveFailStorageListHead
; // Storage list for the save fail storage.
472 LIST_ENTRY DefaultStoreListHead
; // DefaultStore list (FORMSET_DEFAULTSTORE)
473 LIST_ENTRY FormListHead
; // Form list (FORM_BROWSER_FORM)
474 LIST_ENTRY ExpressionListHead
; // List of Expressions (FORM_EXPRESSION)
475 } FORM_BROWSER_FORMSET
;
476 #define FORM_BROWSER_FORMSET_FROM_LINK(a) CR (a, FORM_BROWSER_FORMSET, Link, FORM_BROWSER_FORMSET_SIGNATURE)
478 #define FORM_BROWSER_FORMSET_FROM_SAVE_FAIL_LINK(a) CR (a, FORM_BROWSER_FORMSET, SaveFailLink, FORM_BROWSER_FORMSET_SIGNATURE)
482 EFI_EVENT RefreshEvent
;
483 } FORM_BROWSER_REFRESH_EVENT_NODE
;
485 #define FORM_BROWSER_REFRESH_EVENT_FROM_LINK(a) BASE_CR (a, FORM_BROWSER_REFRESH_EVENT_NODE, Link)
489 EFI_HII_HANDLE Handle
;
492 // Target formset/form/Question information
494 EFI_GUID FormSetGuid
;
497 UINTN Sequence
; // used for time/date only.
506 // Ation for Browser to taken:
507 // UI_ACTION_NONE - navigation inside a form
508 // UI_ACTION_REFRESH_FORM - re-evaluate expressions and repaint form
509 // UI_ACTION_REFRESH_FORMSET - re-parse formset IFR binary
514 // Current selected fomset/form/Question
516 FORM_BROWSER_FORMSET
*FormSet
;
517 FORM_BROWSER_FORM
*Form
;
518 FORM_BROWSER_STATEMENT
*Statement
;
521 // Whether the Form is editable
523 BOOLEAN FormEditable
;
525 FORM_ENTRY_INFO
*CurrentMenu
;
528 #define BROWSER_CONTEXT_SIGNATURE SIGNATURE_32 ('B', 'C', 'T', 'X')
535 // Globals defined in Setup.c
537 BOOLEAN FlagReconnect
;
538 BOOLEAN CallbackReconnect
;
539 BOOLEAN ResetRequired
;
540 BOOLEAN ExitRequired
;
541 EFI_HII_HANDLE HiiHandle
;
542 EFI_GUID FormSetGuid
;
544 UI_MENU_SELECTION
*Selection
;
545 FORM_BROWSER_FORMSET
*SystemLevelFormSet
;
546 EFI_QUESTION_ID CurFakeQestId
;
547 BOOLEAN HiiPackageListUpdated
;
548 BOOLEAN FinishRetrieveCall
;
549 LIST_ENTRY FormHistoryList
;
550 LIST_ENTRY FormSetList
;
553 #define BROWSER_CONTEXT_FROM_LINK(a) CR (a, BROWSER_CONTEXT, Link, BROWSER_CONTEXT_SIGNATURE)
556 // Scope for get defaut value. It may be GetDefaultForNoStorage, GetDefaultForStorage or GetDefaultForAll.
559 GetDefaultForNoStorage
, // Get default value for question which not has storage.
560 GetDefaultForStorage
, // Get default value for question which has storage.
561 GetDefaultForAll
, // Get default value for all questions.
562 GetDefaultForMax
// Invalid value.
563 } BROWSER_GET_DEFAULT_VALUE
;
566 // Get/set question value from/to.
569 GetSetValueWithEditBuffer
= 0, // Get/Set question value from/to editbuffer in the storage.
570 GetSetValueWithBuffer
, // Get/Set question value from/to buffer in the storage.
571 GetSetValueWithHiiDriver
, // Get/Set question value from/to hii driver.
572 GetSetValueWithBothBuffer
, // Compare the editbuffer with buffer for this question, not use the question value.
573 GetSetValueWithMax
// Invalid value.
574 } GET_SET_QUESTION_VALUE_WITH
;
576 extern EFI_HII_DATABASE_PROTOCOL
*mHiiDatabase
;
577 extern EFI_HII_CONFIG_ROUTING_PROTOCOL
*mHiiConfigRouting
;
578 extern EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL
*mPathFromText
;
579 extern EDKII_FORM_DISPLAY_ENGINE_PROTOCOL
*mFormDisplay
;
581 extern BOOLEAN gCallbackReconnect
;
582 extern BOOLEAN gFlagReconnect
;
583 extern BOOLEAN gResetRequiredFormLevel
;
584 extern BOOLEAN gResetRequiredSystemLevel
;
585 extern BOOLEAN gExitRequired
;
586 extern LIST_ENTRY gBrowserFormSetList
;
587 extern LIST_ENTRY gBrowserHotKeyList
;
588 extern BROWSER_SETTING_SCOPE gBrowserSettingScope
;
589 extern EXIT_HANDLER ExitHandlerFunction
;
590 extern EFI_HII_HANDLE mCurrentHiiHandle
;
591 extern SETUP_DRIVER_PRIVATE_DATA mPrivateData
;
593 // Browser Global Strings
595 extern CHAR16
*gEmptyString
;
597 extern UI_MENU_SELECTION
*gCurrentSelection
;
598 extern BOOLEAN mHiiPackageListUpdated
;
599 extern UINT16 mCurFakeQestId
;
600 extern BOOLEAN mFinishRetrieveCall
;
603 // Global Procedure Defines
605 #include "Expression.h"
608 Initialize the HII String Token to the correct values.
612 InitializeBrowserStrings (
617 Parse opcodes in the formset IFR binary.
619 @param FormSet Pointer of the FormSet data structure.
621 @retval EFI_SUCCESS Opcode parse success.
622 @retval Other Opcode parse fail.
627 IN FORM_BROWSER_FORMSET
*FormSet
631 Free resources allocated for a FormSet.
633 @param FormSet Pointer of the FormSet
638 IN OUT FORM_BROWSER_FORMSET
*FormSet
643 Create a new string in HII Package List.
645 @param String The String to be added
646 @param HiiHandle The package list in the HII database to insert the
649 @return The output string.
655 IN EFI_HII_HANDLE HiiHandle
659 Delete a string from HII Package List.
661 @param StringId Id of the string in HII database.
662 @param HiiHandle The HII package list handle.
664 @retval EFI_SUCCESS The string was deleted successfully.
669 IN EFI_STRING_ID StringId
,
670 IN EFI_HII_HANDLE HiiHandle
674 Get the string based on the StringId and HII Package List Handle.
676 @param Token The String's ID.
677 @param HiiHandle The package list in the HII database to search for
678 the specified string.
680 @return The output string.
685 IN EFI_STRING_ID Token
,
686 IN EFI_HII_HANDLE HiiHandle
690 Get Value for given Name from a NameValue Storage.
692 @param Storage The NameValue Storage.
693 @param Name The Name.
694 @param Value The retured Value.
695 @param GetValueFrom Where to get source value, from EditValue or Value.
697 @retval EFI_SUCCESS Value found for given Name.
698 @retval EFI_NOT_FOUND No such Name found in NameValue storage.
703 IN BROWSER_STORAGE
*Storage
,
705 IN OUT CHAR16
**Value
,
706 IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
710 Set Value of given Name in a NameValue Storage.
712 @param Storage The NameValue Storage.
713 @param Name The Name.
714 @param Value The Value to set.
715 @param SetValueTo Whether update editValue or Value.
716 @param ReturnNode The node use the input name.
718 @retval EFI_SUCCESS Value found for given Name.
719 @retval EFI_NOT_FOUND No such Name found in NameValue storage.
724 IN BROWSER_STORAGE
*Storage
,
727 IN GET_SET_QUESTION_VALUE_WITH SetValueTo
,
728 OUT NAME_VALUE_NODE
**ReturnNode
732 Validate whether this question's value has changed.
734 @param FormSet FormSet data structure.
735 @param Form Form data structure.
736 @param Question Question to be initialized.
737 @param GetValueFrom Where to get value, may from editbuffer, buffer or hii driver.
739 @retval TRUE Question's value has changed.
740 @retval FALSE Question's value has not changed
744 IsQuestionValueChanged (
745 IN FORM_BROWSER_FORMSET
*FormSet
,
746 IN FORM_BROWSER_FORM
*Form
,
747 IN OUT FORM_BROWSER_STATEMENT
*Question
,
748 IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
752 Validate the FormSet. If the formset is not validate, remove it from the list.
754 @param FormSet The input FormSet which need to validate.
756 @retval TRUE The handle is validate.
757 @retval FALSE The handle is invalidate.
762 FORM_BROWSER_FORMSET
*FormSet
766 Update the ValueChanged status for questions.
768 @param FormSet FormSet data structure.
769 @param Form Form data structure.
770 @param SettingScope Setting Scope for Default action.
774 UpdateStatementStatus (
775 IN FORM_BROWSER_FORMSET
*FormSet
,
776 IN FORM_BROWSER_FORM
*Form
,
777 IN BROWSER_SETTING_SCOPE SettingScope
781 Get Question's current Value.
783 @param FormSet FormSet data structure.
784 @param Form Form data structure.
785 @param Question Question to be initialized.
786 @param GetValueFrom Where to get value, may from editbuffer, buffer or hii driver.
788 @retval EFI_SUCCESS The function completed successfully.
793 IN FORM_BROWSER_FORMSET
*FormSet
,
794 IN FORM_BROWSER_FORM
*Form
,
795 IN OUT FORM_BROWSER_STATEMENT
*Question
,
796 IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
800 Save Question Value to edit copy(cached) or Storage(uncached).
802 @param FormSet FormSet data structure.
803 @param Form Form data structure.
804 @param Question Pointer to the Question.
805 @param SetValueTo Update the question value to editbuffer , buffer or hii driver.
807 @retval EFI_SUCCESS The function completed successfully.
812 IN FORM_BROWSER_FORMSET
*FormSet
,
813 IN FORM_BROWSER_FORM
*Form
,
814 IN OUT FORM_BROWSER_STATEMENT
*Question
,
815 IN GET_SET_QUESTION_VALUE_WITH SetValueTo
819 Perform inconsistent check for a Form.
821 @param FormSet FormSet data structure.
822 @param Form Form data structure.
823 @param Question The Question to be validated.
824 @param Type Validation type: InConsistent or NoSubmit
826 @retval EFI_SUCCESS Form validation pass.
827 @retval other Form validation failed.
832 IN FORM_BROWSER_FORMSET
*FormSet
,
833 IN FORM_BROWSER_FORM
*Form
,
834 IN FORM_BROWSER_STATEMENT
*Question
,
840 Discard data based on the input setting scope (Form, FormSet or System).
842 @param FormSet FormSet data structure.
843 @param Form Form data structure.
844 @param SettingScope Setting Scope for Discard action.
846 @retval EFI_SUCCESS The function completed successfully.
847 @retval EFI_UNSUPPORTED Unsupport SettingScope.
852 IN FORM_BROWSER_FORMSET
*FormSet
,
853 IN FORM_BROWSER_FORM
*Form
,
854 IN BROWSER_SETTING_SCOPE SettingScope
858 Submit data based on the input Setting level (Form, FormSet or System).
860 @param FormSet FormSet data structure.
861 @param Form Form data structure.
862 @param SettingScope Setting Scope for Submit action.
864 @retval EFI_SUCCESS The function completed successfully.
865 @retval EFI_UNSUPPORTED Unsupport SettingScope.
870 IN FORM_BROWSER_FORMSET
*FormSet
,
871 IN FORM_BROWSER_FORM
*Form
,
872 IN BROWSER_SETTING_SCOPE SettingScope
876 Reset Question to its default value.
878 @param FormSet The form set.
879 @param Form The form.
880 @param Question The question.
881 @param DefaultId The Class of the default.
883 @retval EFI_SUCCESS Question is reset to default value.
888 IN FORM_BROWSER_FORMSET
*FormSet
,
889 IN FORM_BROWSER_FORM
*Form
,
890 IN FORM_BROWSER_STATEMENT
*Question
,
895 Get current setting of Questions.
897 @param FormSet FormSet data structure.
901 InitializeCurrentSetting (
902 IN OUT FORM_BROWSER_FORMSET
*FormSet
906 Initialize the internal data structure of a FormSet.
908 @param Handle PackageList Handle
909 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
910 GUID), take the first FormSet found in package
912 @param FormSet FormSet data structure.
914 @retval EFI_SUCCESS The function completed successfully.
915 @retval EFI_NOT_FOUND The specified FormSet could not be found.
920 IN EFI_HII_HANDLE Handle
,
921 IN OUT EFI_GUID
*FormSetGuid
,
922 OUT FORM_BROWSER_FORMSET
*FormSet
926 Reset Questions to their initial value or default value in a Form, Formset or System.
928 GetDefaultValueScope parameter decides which questions will reset
929 to its default value.
931 @param FormSet FormSet data structure.
932 @param Form Form data structure.
933 @param DefaultId The Class of the default.
934 @param SettingScope Setting Scope for Default action.
935 @param GetDefaultValueScope Get default value scope.
936 @param Storage Get default value only for this storage.
937 @param RetrieveValueFirst Whether call the retrieve call back to
938 get the initial value before get default
940 @param SkipGetAltCfg Whether skip the get altcfg string process.
942 @retval EFI_SUCCESS The function completed successfully.
943 @retval EFI_UNSUPPORTED Unsupport SettingScope.
948 IN FORM_BROWSER_FORMSET
*FormSet
,
949 IN FORM_BROWSER_FORM
*Form
,
951 IN BROWSER_SETTING_SCOPE SettingScope
,
952 IN BROWSER_GET_DEFAULT_VALUE GetDefaultValueScope
,
953 IN BROWSER_STORAGE
*Storage
,
954 IN BOOLEAN RetrieveValueFirst
,
955 IN BOOLEAN SkipGetAltCfg
959 Initialize Question's Edit copy from Storage.
961 @param Selection Selection contains the information about
962 the Selection, form and formset to be displayed.
963 Selection action may be updated in retrieve callback.
964 If Selection is NULL, only initialize Question value.
965 @param FormSet FormSet data structure.
966 @param Form Form data structure.
968 @retval EFI_SUCCESS The function completed successfully.
973 IN OUT UI_MENU_SELECTION
*Selection
,
974 IN FORM_BROWSER_FORMSET
*FormSet
,
975 IN FORM_BROWSER_FORM
*Form
979 Initialize Question's Edit copy from Storage for the whole Formset.
981 @param Selection Selection contains the information about
982 the Selection, form and formset to be displayed.
983 Selection action may be updated in retrieve callback.
984 If Selection is NULL, only initialize Question value.
985 @param FormSet FormSet data structure.
987 @retval EFI_SUCCESS The function completed successfully.
992 IN OUT UI_MENU_SELECTION
*Selection
,
993 IN FORM_BROWSER_FORMSET
*FormSet
997 Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.
999 @param Storage The Storage to be conveted.
1000 @param ConfigResp The returned <ConfigResp>.
1001 @param ConfigRequest The ConfigRequest string.
1002 @param GetEditBuf Get the data from editbuffer or buffer.
1004 @retval EFI_SUCCESS Convert success.
1005 @retval EFI_INVALID_PARAMETER Incorrect storage type.
1009 StorageToConfigResp (
1010 IN BROWSER_STORAGE
*Storage
,
1011 IN CHAR16
**ConfigResp
,
1012 IN CHAR16
*ConfigRequest
,
1013 IN BOOLEAN GetEditBuf
1017 Convert <ConfigResp> to settings in Buffer Storage or NameValue Storage.
1019 @param Storage The Storage to receive the settings.
1020 @param ConfigResp The <ConfigResp> to be converted.
1022 @retval EFI_SUCCESS Convert success.
1023 @retval EFI_INVALID_PARAMETER Incorrect storage type.
1027 ConfigRespToStorage (
1028 IN BROWSER_STORAGE
*Storage
,
1029 IN CHAR16
*ConfigResp
1033 Fill storage's edit copy with settings requested from Configuration Driver.
1035 @param FormSet FormSet data structure.
1036 @param Storage Buffer Storage.
1041 IN FORM_BROWSER_FORMSET
*FormSet
,
1042 IN FORMSET_STORAGE
*Storage
1046 Fetch the Ifr binary data of a FormSet.
1048 @param Handle PackageList Handle
1049 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
1050 GUID), take the first FormSet found in package
1052 @param BinaryLength The length of the FormSet IFR binary.
1053 @param BinaryData The buffer designed to receive the FormSet.
1055 @retval EFI_SUCCESS Buffer filled with the requested FormSet.
1056 BufferLength was updated.
1057 @retval EFI_INVALID_PARAMETER The handle is unknown.
1058 @retval EFI_NOT_FOUND A form or FormSet on the requested handle cannot
1059 be found with the requested FormId.
1064 IN EFI_HII_HANDLE Handle
,
1065 IN OUT EFI_GUID
*FormSetGuid
,
1066 OUT UINTN
*BinaryLength
,
1067 OUT UINT8
**BinaryData
1071 Save globals used by previous call to SendForm(). SendForm() may be called from
1072 HiiConfigAccess.Callback(), this will cause SendForm() be reentried.
1073 So, save globals of previous call to SendForm() and restore them upon exit.
1077 SaveBrowserContext (
1082 Restore globals used by previous call to SendForm().
1086 RestoreBrowserContext (
1091 This is the routine which an external caller uses to direct the browser
1092 where to obtain it's information.
1095 @param This The Form Browser protocol instanse.
1096 @param Handles A pointer to an array of Handles. If HandleCount > 1 we
1097 display a list of the formsets for the handles specified.
1098 @param HandleCount The number of Handles specified in Handle.
1099 @param FormSetGuid This field points to the EFI_GUID which must match the Guid
1100 field in the EFI_IFR_FORM_SET op-code for the specified
1101 forms-based package. If FormSetGuid is NULL, then this
1102 function will display the first found forms package.
1103 @param FormId This field specifies which EFI_IFR_FORM to render as the first
1104 displayable page. If this field has a value of 0x0000, then
1105 the forms browser will render the specified forms in their encoded order.
1106 ScreenDimenions - This allows the browser to be called so that it occupies a
1107 portion of the physical screen instead of dynamically determining the screen dimensions.
1108 ActionRequest - Points to the action recommended by the form.
1109 @param ScreenDimensions Points to recommended form dimensions, including any non-content area, in
1111 @param ActionRequest Points to the action recommended by the form.
1113 @retval EFI_SUCCESS The function completed successfully.
1114 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1115 @retval EFI_NOT_FOUND No valid forms could be found to display.
1121 IN CONST EFI_FORM_BROWSER2_PROTOCOL
*This
,
1122 IN EFI_HII_HANDLE
*Handles
,
1123 IN UINTN HandleCount
,
1124 IN EFI_GUID
*FormSetGuid
, OPTIONAL
1125 IN UINT16 FormId
, OPTIONAL
1126 IN CONST EFI_SCREEN_DESCRIPTOR
*ScreenDimensions
, OPTIONAL
1127 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest OPTIONAL
1131 This function is called by a callback handler to retrieve uncommitted state
1132 data from the browser.
1134 @param This A pointer to the EFI_FORM_BROWSER2_PROTOCOL
1136 @param ResultsDataSize A pointer to the size of the buffer associated
1138 @param ResultsData A string returned from an IFR browser or
1139 equivalent. The results string will have no
1140 routing information in them.
1141 @param RetrieveData A BOOLEAN field which allows an agent to retrieve
1142 (if RetrieveData = TRUE) data from the uncommitted
1143 browser state information or set (if RetrieveData
1144 = FALSE) data in the uncommitted browser state
1146 @param VariableGuid An optional field to indicate the target variable
1148 @param VariableName An optional field to indicate the target
1149 human-readable variable name.
1151 @retval EFI_SUCCESS The results have been distributed or are awaiting
1153 @retval EFI_BUFFER_TOO_SMALL The ResultsDataSize specified was too small to
1154 contain the results data.
1160 IN CONST EFI_FORM_BROWSER2_PROTOCOL
*This
,
1161 IN OUT UINTN
*ResultsDataSize
,
1162 IN OUT EFI_STRING ResultsData
,
1163 IN BOOLEAN RetrieveData
,
1164 IN CONST EFI_GUID
*VariableGuid
, OPTIONAL
1165 IN CONST CHAR16
*VariableName OPTIONAL
1169 Find menu which will show next time.
1171 @param Selection On input, Selection tell setup browser the information
1172 about the Selection, form and formset to be displayed.
1173 On output, Selection return the screen item that is selected
1175 @param SettingLevel Input Settting level, if it is FormLevel, just exit current form.
1176 else, we need to exit current formset.
1178 @retval TRUE Exit current form.
1179 @retval FALSE User press ESC and keep in current form.
1183 IN OUT UI_MENU_SELECTION
*Selection
,
1184 IN BROWSER_SETTING_SCOPE SettingLevel
1188 check whether the form need to update the NV.
1190 @param Form Form data structure.
1192 @retval TRUE Need to update the NV.
1193 @retval FALSE No need to update the NV.
1196 IsNvUpdateRequiredForForm (
1197 IN FORM_BROWSER_FORM
*Form
1201 check whether the formset need to update the NV.
1203 @param FormSet FormSet data structure.
1205 @retval TRUE Need to update the NV.
1206 @retval FALSE No need to update the NV.
1209 IsNvUpdateRequiredForFormSet (
1210 IN FORM_BROWSER_FORMSET
*FormSet
1214 Call the call back function for the question and process the return action.
1216 @param Selection On input, Selection tell setup browser the information
1217 about the Selection, form and formset to be displayed.
1218 On output, Selection return the screen item that is selected
1220 @param FormSet The formset this question belong to.
1221 @param Form The form this question belong to.
1222 @param Question The Question which need to call.
1223 @param Action The action request.
1224 @param SkipSaveOrDiscard Whether skip save or discard action.
1226 @retval EFI_SUCCESS The call back function executes successfully.
1227 @return Other value if the call back function failed to execute.
1230 ProcessCallBackFunction (
1231 IN OUT UI_MENU_SELECTION
*Selection
,
1232 IN FORM_BROWSER_FORMSET
*FormSet
,
1233 IN FORM_BROWSER_FORM
*Form
,
1234 IN FORM_BROWSER_STATEMENT
*Question
,
1235 IN EFI_BROWSER_ACTION Action
,
1236 IN BOOLEAN SkipSaveOrDiscard
1240 Call the retrieve type call back function for one question to get the initialize data.
1242 This function only used when in the initialize stage, because in this stage, the
1243 Selection->Form is not ready. For other case, use the ProcessCallBackFunction instead.
1245 @param ConfigAccess The config access protocol produced by the hii driver.
1246 @param Statement The Question which need to call.
1247 @param FormSet The formset this question belong to.
1249 @retval EFI_SUCCESS The call back function executes successfully.
1250 @return Other value if the call back function failed to execute.
1253 ProcessRetrieveForQuestion (
1254 IN EFI_HII_CONFIG_ACCESS_PROTOCOL
*ConfigAccess
,
1255 IN FORM_BROWSER_STATEMENT
*Statement
,
1256 IN FORM_BROWSER_FORMSET
*FormSet
1260 Find the matched FormSet context in the backup maintain list based on HiiHandle.
1262 @param Handle The Hii Handle.
1264 @return the found FormSet context. If no found, NULL will return.
1267 FORM_BROWSER_FORMSET
*
1268 GetFormSetFromHiiHandle (
1269 EFI_HII_HANDLE Handle
1273 Check whether the input HII handle is the FormSet that is being used.
1275 @param Handle The Hii Handle.
1277 @retval TRUE HII handle is being used.
1278 @retval FALSE HII handle is not being used.
1282 IsHiiHandleInBrowserContext (
1283 EFI_HII_HANDLE Handle
1287 Configure what scope the hot key will impact.
1288 All hot keys have the same scope. The mixed hot keys with the different level are not supported.
1289 If no scope is set, the default scope will be FormSet level.
1290 After all registered hot keys are removed, previous Scope can reset to another level.
1292 @param[in] Scope Scope level to be set.
1294 @retval EFI_SUCCESS Scope is set correctly.
1295 @retval EFI_INVALID_PARAMETER Scope is not the valid value specified in BROWSER_SETTING_SCOPE.
1296 @retval EFI_UNSPPORTED Scope level is different from current one that the registered hot keys have.
1302 IN BROWSER_SETTING_SCOPE Scope
1306 Register the hot key with its browser action, or unregistered the hot key.
1307 Only support hot key that is not printable character (control key, function key, etc.).
1308 If the action value is zero, the hot key will be unregistered if it has been registered.
1309 If the same hot key has been registered, the new action and help string will override the previous ones.
1311 @param[in] KeyData A pointer to a buffer that describes the keystroke
1312 information for the hot key. Its type is EFI_INPUT_KEY to
1313 be supported by all ConsoleIn devices.
1314 @param[in] Action Action value that describes what action will be trigged when the hot key is pressed.
1315 @param[in] DefaultId Specifies the type of defaults to retrieve, which is only for DEFAULT action.
1316 @param[in] HelpString Help string that describes the hot key information.
1317 Its value may be NULL for the unregistered hot key.
1319 @retval EFI_SUCCESS Hot key is registered or unregistered.
1320 @retval EFI_INVALID_PARAMETER KeyData is NULL.
1321 @retval EFI_NOT_FOUND KeyData is not found to be unregistered.
1322 @retval EFI_UNSUPPORTED Key represents a printable character. It is conflicted with Browser.
1323 @retval EFI_ALREADY_STARTED Key already been registered for one hot key.
1328 IN EFI_INPUT_KEY
*KeyData
,
1330 IN UINT16 DefaultId
,
1331 IN EFI_STRING HelpString OPTIONAL
1335 Register Exit handler function.
1336 When more than one handler function is registered, the latter one will override the previous one.
1337 When NULL handler is specified, the previous Exit handler will be unregistered.
1339 @param[in] Handler Pointer to handler function.
1344 RegiserExitHandler (
1345 IN EXIT_HANDLER Handler
1350 Check whether the browser data has been modified.
1352 @retval TRUE Browser data is changed.
1353 @retval FALSE No browser data is changed.
1358 IsBrowserDataModified (
1364 Execute the action requested by the Action parameter.
1366 @param[in] Action Execute the request action.
1367 @param[in] DefaultId The default Id info when need to load default value.
1369 @retval EFI_SUCCESS Execute the request action succss.
1370 @retval EFI_INVALID_PARAMETER The input action value is invalid.
1381 Create reminder to let user to choose save or discard the changed browser data.
1382 Caller can use it to actively check the changed browser data.
1384 @retval BROWSER_NO_CHANGES No browser data is changed.
1385 @retval BROWSER_SAVE_CHANGES The changed browser data is saved.
1386 @retval BROWSER_DISCARD_CHANGES The changed browser data is discard.
1387 @retval BROWSER_KEEP_CURRENT Browser keep current changes.
1397 Check whether the Reset Required for the browser
1399 @retval TRUE Browser required to reset after exit.
1400 @retval FALSE Browser not need to reset after exit.
1410 Find the registered HotKey based on KeyData.
1412 @param[in] KeyData A pointer to a buffer that describes the keystroke
1413 information for the hot key.
1415 @return The registered HotKey context. If no found, NULL will return.
1418 GetHotKeyFromRegisterList (
1419 IN EFI_INPUT_KEY
*KeyData
1424 Get FORM_BROWSER_STATEMENT from FORM_DISPLAY_ENGINE_STATEMENT based on the OpCode info.
1426 @param DisplayStatement The input FORM_DISPLAY_ENGINE_STATEMENT.
1428 @retval FORM_BROWSER_STATEMENT The return FORM_BROWSER_STATEMENT info.
1431 FORM_BROWSER_STATEMENT
*
1432 GetBrowserStatement (
1433 IN FORM_DISPLAY_ENGINE_STATEMENT
*DisplayStatement
1437 Password may be stored as encrypted by Configuration Driver. When change a
1438 password, user will be challenged with old password. To validate user input old
1439 password, we will send the clear text to Configuration Driver via Callback().
1440 Configuration driver is responsible to check the passed in password and return
1441 the validation result. If validation pass, state machine in password Callback()
1442 will transit from BROWSER_STATE_VALIDATE_PASSWORD to BROWSER_STATE_SET_PASSWORD.
1443 After user type in new password twice, Callback() will be invoked to send the
1444 new password to Configuration Driver.
1446 @param Selection Pointer to UI_MENU_SELECTION.
1447 @param MenuOption The MenuOption for this password Question.
1448 @param String The clear text of password.
1450 @retval EFI_NOT_AVAILABLE_YET Callback() request to terminate password input.
1451 @return In state of BROWSER_STATE_VALIDATE_PASSWORD:
1452 @retval EFI_SUCCESS Password correct, Browser will prompt for new
1454 @retval EFI_NOT_READY Password incorrect, Browser will show error
1456 @retval Other Browser will do nothing.
1457 @return In state of BROWSER_STATE_SET_PASSWORD:
1458 @retval EFI_SUCCESS Set password success.
1459 @retval Other Set password failed.
1464 IN UI_MENU_SELECTION
*Selection
,
1465 IN FORM_BROWSER_STATEMENT
*Question
,
1470 Display error message for invalid password.
1479 The worker function that send the displays to the screen. On output,
1480 the selection made by user is returned.
1482 @param Selection On input, Selection tell setup browser the information
1483 about the Selection, form and formset to be displayed.
1484 On output, Selection return the screen item that is selected
1487 @retval EFI_SUCCESS The page is displayed successfully.
1488 @return Other value if the page failed to be diplayed.
1493 IN OUT UI_MENU_SELECTION
*Selection
1497 Free up the resource allocated for all strings required
1502 FreeBrowserStrings (
1507 Create a menu with specified formset GUID and form ID, and add it as a child
1508 of the given parent menu.
1510 @param HiiHandle Hii handle related to this formset.
1511 @param FormSetGuid The Formset Guid of menu to be added.
1512 @param FormId The Form ID of menu to be added.
1513 @param QuestionId The question id of this menu to be added.
1515 @return A pointer to the newly added menu or NULL if memory is insufficient.
1520 IN EFI_HII_HANDLE HiiHandle
,
1521 IN EFI_GUID
*FormSetGuid
,
1523 IN UINT16 QuestionId
1527 Search Menu with given FormSetGuid and FormId in all cached menu list.
1529 @param HiiHandle HiiHandle for FormSet.
1530 @param FormSetGuid The Formset GUID of the menu to search.
1531 @param FormId The Form ID of menu to search.
1533 @return A pointer to menu found or NULL if not found.
1538 IN EFI_HII_HANDLE HiiHandle
,
1539 IN EFI_GUID
*FormSetGuid
,
1544 Free Menu list linked list.
1546 @param MenuListHead One Menu list point in the menu list.
1551 LIST_ENTRY
*MenuListHead
1555 Find parent menu for current menu.
1557 @param CurrentMenu Current Menu
1558 @param SettingLevel Whether find parent menu in Form Level or Formset level.
1559 In form level, just find the parent menu;
1560 In formset level, find the parent menu which has different
1563 @retval The parent menu for current menu.
1567 IN FORM_ENTRY_INFO
*CurrentMenu
,
1568 IN BROWSER_SETTING_SCOPE SettingLevel
1572 Validate the HiiHandle.
1574 @param HiiHandle The input HiiHandle which need to validate.
1576 @retval TRUE The handle is validate.
1577 @retval FALSE The handle is invalidate.
1582 EFI_HII_HANDLE HiiHandle
1586 Copy current Menu list to the new menu list.
1588 @param NewMenuListHead New create Menu list.
1589 @param CurrentMenuListHead Current Menu list.
1594 OUT LIST_ENTRY
*NewMenuListHead
,
1595 IN LIST_ENTRY
*CurrentMenuListHead
1599 Search an Option of a Question by its value.
1601 @param Question The Question
1602 @param OptionValue Value for Option to be searched.
1604 @retval Pointer Pointer to the found Option.
1605 @retval NULL Option not found.
1610 IN FORM_BROWSER_STATEMENT
*Question
,
1611 IN EFI_HII_VALUE
*OptionValue
1614 Return data element in an Array by its Index.
1616 @param Array The data array.
1617 @param Type Type of the data in this array.
1618 @param Index Zero based index for data in this array.
1620 @retval Value The data to be returned
1631 Set value of a data element in an Array by its Index.
1633 @param Array The data array.
1634 @param Type Type of the data in this array.
1635 @param Index Zero based index for data in this array.
1636 @param Value The value to be set.
1648 Compare two Hii value.
1650 @param Value1 Expression value to compare on left-hand.
1651 @param Value2 Expression value to compare on right-hand.
1652 @param Result Return value after compare.
1653 retval 0 Two operators equal.
1654 return Positive value if Value1 is greater than Value2.
1655 retval Negative value if Value1 is less than Value2.
1656 @param HiiHandle Only required for string compare.
1658 @retval other Could not perform compare on two values.
1659 @retval EFI_SUCCESS Compare the value success.
1664 IN EFI_HII_VALUE
*Value1
,
1665 IN EFI_HII_VALUE
*Value2
,
1667 IN EFI_HII_HANDLE HiiHandle OPTIONAL
1671 Perform Password check.
1672 Passwork may be encrypted by driver that requires the specific check.
1674 @param Form Form where Password Statement is in.
1675 @param Statement Password statement
1676 @param PasswordString Password string to be checked. It may be NULL.
1677 NULL means to restore password.
1678 "" string can be used to checked whether old password does exist.
1680 @return Status Status of Password check.
1685 IN FORM_DISPLAY_ENGINE_FORM
*Form
,
1686 IN FORM_DISPLAY_ENGINE_STATEMENT
*Statement
,
1687 IN EFI_STRING PasswordString OPTIONAL
1692 Get FORM_BROWSER_STATEMENT from FORM_DISPLAY_ENGINE_STATEMENT based on the OpCode info.
1694 @param DisplayStatement The input FORM_DISPLAY_ENGINE_STATEMENT.
1696 @retval FORM_BROWSER_STATEMENT The return FORM_BROWSER_STATEMENT info.
1699 FORM_BROWSER_STATEMENT
*
1700 GetBrowserStatement (
1701 IN FORM_DISPLAY_ENGINE_STATEMENT
*DisplayStatement
1706 Initialize the Display form structure data.
1710 InitializeDisplayFormData (
1716 Base on the current formset info, clean the ConfigRequest string in browser storage.
1718 @param FormSet Pointer of the FormSet
1722 CleanBrowserStorage (
1723 IN OUT FORM_BROWSER_FORMSET
*FormSet
1727 Find HII Handle in the HII database associated with given Device Path.
1729 If DevicePath is NULL, then ASSERT.
1731 @param DevicePath Device Path associated with the HII package list
1733 @param FormsetGuid The formset guid for this formset.
1735 @retval Handle HII package list Handle associated with the Device
1737 @retval NULL Hii Package list handle is not found.
1741 DevicePathToHiiHandle (
1742 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
1743 IN EFI_GUID
*FormsetGuid
1747 Adjust the config request info, remove the request elements which already in AllConfigRequest string.
1749 @param Storage Form set Storage.
1750 @param Request The input request string.
1751 @param RespString Whether the input is ConfigRequest or ConfigResp format.
1753 @retval TRUE Has element not covered by current used elements, need to continue to call ExtractConfig
1754 @retval FALSE All elements covered by current used elements.
1758 ConfigRequestAdjust (
1759 IN BROWSER_STORAGE
*Storage
,
1761 IN BOOLEAN RespString
1765 Perform question check.
1767 If one question has more than one check, process form high priority to low.
1769 @param FormSet FormSet data structure.
1770 @param Form Form data structure.
1771 @param Question The Question to be validated.
1773 @retval EFI_SUCCESS Form validation pass.
1774 @retval other Form validation failed.
1778 ValueChangedValidation (
1779 IN FORM_BROWSER_FORMSET
*FormSet
,
1780 IN FORM_BROWSER_FORM
*Form
,
1781 IN FORM_BROWSER_STATEMENT
*Question
1785 Pop up the error info.
1787 @param BrowserStatus The input browser status.
1788 @param HiiHandle The HiiHandle for this error opcode.
1789 @param OpCode The opcode use to get the erro info and timeout value.
1790 @param ErrorString Error string used by BROWSER_NO_SUBMIT_IF.
1795 IN UINT32 BrowserStatus
,
1796 IN EFI_HII_HANDLE HiiHandle
,
1797 IN EFI_IFR_OP_HEADER
*OpCode
, OPTIONAL
1798 IN CHAR16
*ErrorString
1802 Check whether the result is TRUE or FALSE.
1804 For the EFI_HII_VALUE value type is numeric, return TRUE if the
1807 @param Result Input the result data.
1809 @retval TRUE The result is TRUE.
1810 @retval FALSE The result is FALSE.
1815 IN EFI_HII_VALUE
*Result
1819 Get Formset_storage base on the input varstoreid info.
1821 @param FormSet Pointer of the current FormSet.
1822 @param VarStoreId Varstore ID info.
1824 @return Pointer to a FORMSET_STORAGE data structure.
1828 GetFstStgFromVarId (
1829 IN FORM_BROWSER_FORMSET
*FormSet
,
1830 IN EFI_VARSTORE_ID VarStoreId
1834 Get Formset_storage base on the input browser storage.
1836 More than one formsets may share the same browser storage,
1837 this function just get the first formset storage which
1838 share the browser storage.
1840 @param Storage browser storage info.
1842 @return Pointer to a FORMSET_STORAGE data structure.
1847 GetFstStgFromBrsStg (
1848 IN BROWSER_STORAGE
*Storage
1852 Reconnect the controller.
1854 @param DriverHandle The controller handle which need to be reconnect.
1856 @retval TRUE do the reconnect behavior success.
1857 @retval FALSE do the reconnect behavior failed.
1861 ReconnectController (
1862 IN EFI_HANDLE DriverHandle
1866 Converts the unicode character of the string from uppercase to lowercase.
1867 This is a internal function.
1869 @param ConfigString String to be converted
1875 IN EFI_STRING ConfigString