+/**\r
+ Find menu which will show next time.\r
+\r
+ @param Selection On input, Selection tell setup browser the information\r
+ about the Selection, form and formset to be displayed.\r
+ On output, Selection return the screen item that is selected\r
+ by user.\r
+ @param SettingLevel Input Settting level, if it is FormLevel, just exit current form. \r
+ else, we need to exit current formset.\r
+ \r
+ @retval TRUE Exit current form.\r
+ @retval FALSE User press ESC and keep in current form.\r
+**/\r
+BOOLEAN\r
+FindNextMenu (\r
+ IN OUT UI_MENU_SELECTION *Selection,\r
+ IN BROWSER_SETTING_SCOPE SettingLevel\r
+ );\r
+\r
+/**\r
+ check whether the form need to update the NV.\r
+\r
+ @param Form Form data structure.\r
+\r
+ @retval TRUE Need to update the NV.\r
+ @retval FALSE No need to update the NV.\r
+**/\r
+BOOLEAN\r
+IsNvUpdateRequiredForForm (\r
+ IN FORM_BROWSER_FORM *Form\r
+ );\r
+\r
+/**\r
+ check whether the formset need to update the NV.\r
+\r
+ @param FormSet FormSet data structure.\r
+\r
+ @retval TRUE Need to update the NV.\r
+ @retval FALSE No need to update the NV.\r
+**/\r
+BOOLEAN\r
+IsNvUpdateRequiredForFormSet (\r
+ IN FORM_BROWSER_FORMSET *FormSet\r
+ );\r
+\r
+/**\r
+ Call the call back function for the question and process the return action.\r
+\r
+ @param Selection On input, Selection tell setup browser the information\r
+ about the Selection, form and formset to be displayed.\r
+ On output, Selection return the screen item that is selected\r
+ by user.\r
+ @param FormSet The formset this question belong to.\r
+ @param Form The form this question belong to.\r
+ @param Question The Question which need to call.\r
+ @param Action The action request.\r
+ @param SkipSaveOrDiscard Whether skip save or discard action.\r
+\r
+ @retval EFI_SUCCESS The call back function executes successfully.\r
+ @return Other value if the call back function failed to execute.\r
+**/\r
+EFI_STATUS \r
+ProcessCallBackFunction (\r
+ IN OUT UI_MENU_SELECTION *Selection,\r
+ IN FORM_BROWSER_FORMSET *FormSet,\r
+ IN FORM_BROWSER_FORM *Form,\r
+ IN FORM_BROWSER_STATEMENT *Question,\r
+ IN EFI_BROWSER_ACTION Action,\r
+ IN BOOLEAN SkipSaveOrDiscard\r
+ );\r
+ \r
+/**\r
+ Call the retrieve type call back function for one question to get the initialize data.\r
+ \r
+ This function only used when in the initialize stage, because in this stage, the \r
+ Selection->Form is not ready. For other case, use the ProcessCallBackFunction instead.\r
+\r
+ @param ConfigAccess The config access protocol produced by the hii driver.\r
+ @param Statement The Question which need to call.\r
+ @param FormSet The formset this question belong to.\r
+\r
+ @retval EFI_SUCCESS The call back function executes successfully.\r
+ @return Other value if the call back function failed to execute.\r
+**/\r
+EFI_STATUS \r
+ProcessRetrieveForQuestion (\r
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess,\r
+ IN FORM_BROWSER_STATEMENT *Statement,\r
+ IN FORM_BROWSER_FORMSET *FormSet\r
+ );\r
+\r
+/**\r
+ Find the matched FormSet context in the backup maintain list based on HiiHandle.\r
+ \r
+ @param Handle The Hii Handle.\r
+ \r
+ @return the found FormSet context. If no found, NULL will return.\r
+\r
+**/\r
+FORM_BROWSER_FORMSET * \r
+GetFormSetFromHiiHandle (\r
+ EFI_HII_HANDLE Handle\r
+ );\r
+\r
+/**\r
+ Check whether the input HII handle is the FormSet that is being used.\r
+ \r
+ @param Handle The Hii Handle.\r
+ \r
+ @retval TRUE HII handle is being used.\r
+ @retval FALSE HII handle is not being used.\r
+\r
+**/\r
+BOOLEAN\r
+IsHiiHandleInBrowserContext (\r
+ EFI_HII_HANDLE Handle\r
+ );\r
+\r
+/**\r
+ Configure what scope the hot key will impact.\r
+ All hot keys have the same scope. The mixed hot keys with the different level are not supported.\r
+ If no scope is set, the default scope will be FormSet level.\r
+ After all registered hot keys are removed, previous Scope can reset to another level.\r
+ \r
+ @param[in] Scope Scope level to be set. \r
+ \r
+ @retval EFI_SUCCESS Scope is set correctly.\r
+ @retval EFI_INVALID_PARAMETER Scope is not the valid value specified in BROWSER_SETTING_SCOPE. \r
+ @retval EFI_UNSPPORTED Scope level is different from current one that the registered hot keys have.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SetScope (\r
+ IN BROWSER_SETTING_SCOPE Scope\r
+ );\r
+\r
+/**\r
+ Register the hot key with its browser action, or unregistered the hot key.\r
+ Only support hot key that is not printable character (control key, function key, etc.).\r
+ If the action value is zero, the hot key will be unregistered if it has been registered.\r
+ If the same hot key has been registered, the new action and help string will override the previous ones.\r
+ \r
+ @param[in] KeyData A pointer to a buffer that describes the keystroke\r
+ information for the hot key. Its type is EFI_INPUT_KEY to \r
+ be supported by all ConsoleIn devices.\r
+ @param[in] Action Action value that describes what action will be trigged when the hot key is pressed. \r
+ @param[in] DefaultId Specifies the type of defaults to retrieve, which is only for DEFAULT action.\r
+ @param[in] HelpString Help string that describes the hot key information.\r
+ Its value may be NULL for the unregistered hot key.\r
+ \r
+ @retval EFI_SUCCESS Hot key is registered or unregistered.\r
+ @retval EFI_INVALID_PARAMETER KeyData is NULL.\r
+ @retval EFI_NOT_FOUND KeyData is not found to be unregistered.\r
+ @retval EFI_UNSUPPORTED Key represents a printable character. It is conflicted with Browser.\r
+ @retval EFI_ALREADY_STARTED Key already been registered for one hot key.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+RegisterHotKey (\r
+ IN EFI_INPUT_KEY *KeyData,\r
+ IN UINT32 Action,\r
+ IN UINT16 DefaultId,\r
+ IN EFI_STRING HelpString OPTIONAL\r
+ );\r
+\r
+/**\r
+ Register Exit handler function. \r
+ When more than one handler function is registered, the latter one will override the previous one. \r
+ When NULL handler is specified, the previous Exit handler will be unregistered. \r
+ \r
+ @param[in] Handler Pointer to handler function. \r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+RegiserExitHandler (\r
+ IN EXIT_HANDLER Handler\r
+ );\r
+\r
+/**\r
+ \r
+ Check whether the browser data has been modified. \r
+\r
+ @retval TRUE Browser data is changed.\r
+ @retval FALSE No browser data is changed.\r
+\r
+**/\r
+BOOLEAN \r
+EFIAPI\r
+IsBrowserDataModified (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ \r
+ Execute the action requested by the Action parameter. \r
+\r
+ @param[in] Action Execute the request action.\r
+ @param[in] DefaultId The default Id info when need to load default value.\r
+\r
+ @retval EFI_SUCCESS Execute the request action succss.\r
+ @retval EFI_INVALID_PARAMETER The input action value is invalid.\r
+\r
+**/\r
+EFI_STATUS \r
+EFIAPI\r
+ExecuteAction (\r
+ IN UINT32 Action,\r
+ IN UINT16 DefaultId\r
+ );\r
+\r
+/**\r
+ Create reminder to let user to choose save or discard the changed browser data.\r
+ Caller can use it to actively check the changed browser data.\r
+\r
+ @retval BROWSER_NO_CHANGES No browser data is changed.\r
+ @retval BROWSER_SAVE_CHANGES The changed browser data is saved.\r
+ @retval BROWSER_DISCARD_CHANGES The changed browser data is discard.\r
+ @retval BROWSER_KEEP_CURRENT Browser keep current changes.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+SaveReminder (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ Check whether the Reset Required for the browser\r
+\r
+ @retval TRUE Browser required to reset after exit.\r
+ @retval FALSE Browser not need to reset after exit.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsResetRequired (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ Find the registered HotKey based on KeyData.\r
+ \r
+ @param[in] KeyData A pointer to a buffer that describes the keystroke\r
+ information for the hot key.\r
+\r
+ @return The registered HotKey context. If no found, NULL will return.\r
+**/\r
+BROWSER_HOT_KEY *\r
+GetHotKeyFromRegisterList (\r
+ IN EFI_INPUT_KEY *KeyData\r
+ );\r
+\r
+/**\r
+\r
+ Get FORM_BROWSER_STATEMENT from FORM_DISPLAY_ENGINE_STATEMENT based on the OpCode info.\r
+\r
+ @param DisplayStatement The input FORM_DISPLAY_ENGINE_STATEMENT.\r
+\r
+ @retval FORM_BROWSER_STATEMENT The return FORM_BROWSER_STATEMENT info.\r
+\r
+**/\r
+FORM_BROWSER_STATEMENT *\r
+GetBrowserStatement (\r
+ IN FORM_DISPLAY_ENGINE_STATEMENT *DisplayStatement\r
+ );\r
+ \r
+/**\r
+ Password may be stored as encrypted by Configuration Driver. When change a\r
+ password, user will be challenged with old password. To validate user input old\r
+ password, we will send the clear text to Configuration Driver via Callback().\r
+ Configuration driver is responsible to check the passed in password and return\r
+ the validation result. If validation pass, state machine in password Callback()\r
+ will transit from BROWSER_STATE_VALIDATE_PASSWORD to BROWSER_STATE_SET_PASSWORD.\r
+ After user type in new password twice, Callback() will be invoked to send the\r
+ new password to Configuration Driver.\r
+\r
+ @param Selection Pointer to UI_MENU_SELECTION.\r
+ @param MenuOption The MenuOption for this password Question.\r
+ @param String The clear text of password.\r
+\r
+ @retval EFI_NOT_AVAILABLE_YET Callback() request to terminate password input.\r
+ @return In state of BROWSER_STATE_VALIDATE_PASSWORD:\r
+ @retval EFI_SUCCESS Password correct, Browser will prompt for new\r
+ password.\r
+ @retval EFI_NOT_READY Password incorrect, Browser will show error\r
+ message.\r
+ @retval Other Browser will do nothing.\r
+ @return In state of BROWSER_STATE_SET_PASSWORD:\r
+ @retval EFI_SUCCESS Set password success.\r
+ @retval Other Set password failed.\r
+\r
+**/\r
+EFI_STATUS\r
+PasswordCallback (\r
+ IN UI_MENU_SELECTION *Selection,\r
+ IN FORM_BROWSER_STATEMENT *Question,\r
+ IN CHAR16 *String\r
+ );\r
+\r
+/**\r
+ Display error message for invalid password.\r
+\r
+**/\r
+VOID\r
+PasswordInvalid (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ The worker function that send the displays to the screen. On output,\r
+ the selection made by user is returned.\r
+\r
+ @param Selection On input, Selection tell setup browser the information\r
+ about the Selection, form and formset to be displayed.\r
+ On output, Selection return the screen item that is selected\r
+ by user.\r
+\r
+ @retval EFI_SUCCESS The page is displayed successfully.\r
+ @return Other value if the page failed to be diplayed.\r
+\r
+**/\r
+EFI_STATUS\r
+SetupBrowser (\r
+ IN OUT UI_MENU_SELECTION *Selection\r
+ );\r
+ \r
+/**\r
+ Free up the resource allocated for all strings required\r
+ by Setup Browser.\r
+\r
+**/\r
+VOID\r
+FreeBrowserStrings (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ Create a menu with specified formset GUID and form ID, and add it as a child\r
+ of the given parent menu.\r
+\r
+ @param HiiHandle Hii handle related to this formset.\r
+ @param FormSetGuid The Formset Guid of menu to be added.\r
+ @param FormId The Form ID of menu to be added.\r
+ @param QuestionId The question id of this menu to be added.\r
+\r
+ @return A pointer to the newly added menu or NULL if memory is insufficient.\r
+\r
+**/\r
+FORM_ENTRY_INFO *\r
+UiAddMenuList (\r
+ IN EFI_HII_HANDLE HiiHandle,\r
+ IN EFI_GUID *FormSetGuid,\r
+ IN UINT16 FormId,\r
+ IN UINT16 QuestionId\r
+ );\r
+\r
+/**\r
+ Search Menu with given FormSetGuid and FormId in all cached menu list.\r
+\r
+ @param HiiHandle HiiHandle for FormSet.\r
+ @param FormSetGuid The Formset GUID of the menu to search.\r
+ @param FormId The Form ID of menu to search.\r
+\r
+ @return A pointer to menu found or NULL if not found.\r
+\r
+**/\r
+FORM_ENTRY_INFO *\r
+UiFindMenuList (\r
+ IN EFI_HII_HANDLE HiiHandle, \r
+ IN EFI_GUID *FormSetGuid,\r
+ IN UINT16 FormId\r
+ );\r
+\r
+/**\r
+ Free Menu list linked list.\r
+\r
+ @param MenuListHead One Menu list point in the menu list.\r
+\r
+**/\r
+VOID\r
+UiFreeMenuList (\r
+ LIST_ENTRY *MenuListHead\r
+ );\r
+\r
+/**\r
+ Find parent menu for current menu.\r
+\r
+ @param CurrentMenu Current Menu\r
+ @param SettingLevel Whether find parent menu in Form Level or Formset level.\r
+ In form level, just find the parent menu; \r
+ In formset level, find the parent menu which has different\r
+ formset guid value.\r
+\r
+ @retval The parent menu for current menu.\r
+**/\r
+FORM_ENTRY_INFO *\r
+UiFindParentMenu (\r
+ IN FORM_ENTRY_INFO *CurrentMenu,\r
+ IN BROWSER_SETTING_SCOPE SettingLevel\r
+ );\r
+ \r
+/**\r
+ Validate the HiiHandle.\r
+\r
+ @param HiiHandle The input HiiHandle which need to validate.\r
+\r
+ @retval TRUE The handle is validate.\r
+ @retval FALSE The handle is invalidate.\r
+\r
+**/\r
+BOOLEAN\r
+ValidateHiiHandle (\r
+ EFI_HII_HANDLE HiiHandle\r
+ );\r
+\r
+/**\r
+ Copy current Menu list to the new menu list.\r
+ \r
+ @param NewMenuListHead New create Menu list.\r
+ @param CurrentMenuListHead Current Menu list.\r
+\r
+**/\r
+VOID\r
+UiCopyMenuList (\r
+ OUT LIST_ENTRY *NewMenuListHead,\r
+ IN LIST_ENTRY *CurrentMenuListHead\r
+ );\r
+\r
+/**\r
+ Search an Option of a Question by its value.\r
+\r
+ @param Question The Question\r
+ @param OptionValue Value for Option to be searched.\r
+\r
+ @retval Pointer Pointer to the found Option.\r
+ @retval NULL Option not found.\r
+\r
+**/\r
+QUESTION_OPTION *\r
+ValueToOption (\r
+ IN FORM_BROWSER_STATEMENT *Question,\r
+ IN EFI_HII_VALUE *OptionValue\r
+ );\r
+/**\r
+ Return data element in an Array by its Index.\r
+\r
+ @param Array The data array.\r
+ @param Type Type of the data in this array.\r
+ @param Index Zero based index for data in this array.\r
+\r
+ @retval Value The data to be returned\r
+\r
+**/\r
+UINT64\r
+GetArrayData (\r
+ IN VOID *Array,\r
+ IN UINT8 Type,\r
+ IN UINTN Index\r
+ );\r
+\r
+/**\r
+ Set value of a data element in an Array by its Index.\r
+\r
+ @param Array The data array.\r
+ @param Type Type of the data in this array.\r
+ @param Index Zero based index for data in this array.\r
+ @param Value The value to be set.\r
+\r
+**/\r
+VOID\r
+SetArrayData (\r
+ IN VOID *Array,\r
+ IN UINT8 Type,\r
+ IN UINTN Index,\r
+ IN UINT64 Value\r
+ );\r
+\r
+/**\r
+ Compare two Hii value.\r
+ \r
+ @param Value1 Expression value to compare on left-hand.\r
+ @param Value2 Expression value to compare on right-hand.\r
+ @param Result Return value after compare.\r
+ retval 0 Two operators equal.\r
+ return Positive value if Value1 is greater than Value2.\r
+ retval Negative value if Value1 is less than Value2.\r
+ @param HiiHandle Only required for string compare.\r
+ \r
+ @retval other Could not perform compare on two values.\r
+ @retval EFI_SUCCESS Compare the value success.\r
+ \r
+**/\r
+EFI_STATUS\r
+CompareHiiValue (\r
+ IN EFI_HII_VALUE *Value1,\r
+ IN EFI_HII_VALUE *Value2,\r
+ OUT INTN *Result,\r
+ IN EFI_HII_HANDLE HiiHandle OPTIONAL\r
+ );\r
+\r
+/**\r
+ Perform Password check. \r
+ Passwork may be encrypted by driver that requires the specific check.\r
+ \r
+ @param Form Form where Password Statement is in.\r
+ @param Statement Password statement\r
+ @param PasswordString Password string to be checked. It may be NULL.\r
+ NULL means to restore password.\r
+ "" string can be used to checked whether old password does exist.\r
+ \r
+ @return Status Status of Password check.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PasswordCheck (\r
+ IN FORM_DISPLAY_ENGINE_FORM *Form,\r
+ IN FORM_DISPLAY_ENGINE_STATEMENT *Statement,\r
+ IN EFI_STRING PasswordString OPTIONAL\r
+ );\r
+\r
+/**\r
+\r
+ Get FORM_BROWSER_STATEMENT from FORM_DISPLAY_ENGINE_STATEMENT based on the OpCode info.\r
+\r
+ @param DisplayStatement The input FORM_DISPLAY_ENGINE_STATEMENT.\r
+\r
+ @retval FORM_BROWSER_STATEMENT The return FORM_BROWSER_STATEMENT info.\r
+\r
+**/\r
+FORM_BROWSER_STATEMENT *\r
+GetBrowserStatement (\r
+ IN FORM_DISPLAY_ENGINE_STATEMENT *DisplayStatement\r
+ );\r
+ \r
+/**\r
+\r
+ Initialize the Display form structure data.\r
+\r
+**/\r
+VOID\r
+InitializeDisplayFormData (\r
+ VOID\r
+ );\r
+\r
+\r
+/**\r
+ Base on the current formset info, clean the ConfigRequest string in browser storage.\r
+\r
+ @param FormSet Pointer of the FormSet\r
+\r
+**/\r
+VOID\r
+CleanBrowserStorage (\r
+ IN OUT FORM_BROWSER_FORMSET *FormSet\r
+ );\r
+\r
+/**\r
+ Find HII Handle in the HII database associated with given Device Path.\r
+\r
+ If DevicePath is NULL, then ASSERT.\r
+\r
+ @param DevicePath Device Path associated with the HII package list\r
+ handle.\r
+ @param FormsetGuid The formset guid for this formset.\r
+\r
+ @retval Handle HII package list Handle associated with the Device\r
+ Path.\r
+ @retval NULL Hii Package list handle is not found.\r
+\r
+**/\r
+EFI_HII_HANDLE\r
+DevicePathToHiiHandle (\r
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
+ IN EFI_GUID *FormsetGuid\r
+ );\r
+\r
+/**\r
+ Adjust the config request info, remove the request elements which already in AllConfigRequest string.\r
+\r
+ @param Storage Form set Storage.\r
+ @param Request The input request string.\r
+ @param RespString Whether the input is ConfigRequest or ConfigResp format.\r
+\r
+ @retval TRUE Has element not covered by current used elements, need to continue to call ExtractConfig\r
+ @retval FALSE All elements covered by current used elements.\r
+\r
+**/\r
+BOOLEAN \r
+ConfigRequestAdjust (\r
+ IN BROWSER_STORAGE *Storage,\r
+ IN CHAR16 *Request,\r
+ IN BOOLEAN RespString\r
+ );\r
+\r
+/**\r
+ Perform question check. \r
+ \r
+ If one question has more than one check, process form high priority to low.\r
+\r
+ @param FormSet FormSet data structure.\r
+ @param Form Form data structure.\r
+ @param Question The Question to be validated.\r
+\r
+ @retval EFI_SUCCESS Form validation pass.\r
+ @retval other Form validation failed.\r
+\r
+**/\r
+EFI_STATUS\r
+ValueChangedValidation (\r
+ IN FORM_BROWSER_FORMSET *FormSet,\r
+ IN FORM_BROWSER_FORM *Form,\r
+ IN FORM_BROWSER_STATEMENT *Question\r
+ );\r
+\r
+/**\r
+ Pop up the error info.\r
+\r
+ @param BrowserStatus The input browser status.\r
+ @param HiiHandle The HiiHandle for this error opcode.\r
+ @param OpCode The opcode use to get the erro info and timeout value.\r
+ @param ErrorString Error string used by BROWSER_NO_SUBMIT_IF.\r
+\r
+**/\r
+UINT32\r
+PopupErrorMessage (\r
+ IN UINT32 BrowserStatus,\r
+ IN EFI_HII_HANDLE HiiHandle,\r
+ IN EFI_IFR_OP_HEADER *OpCode, OPTIONAL\r
+ IN CHAR16 *ErrorString\r
+ );\r
+\r
+/**\r
+ Check whether the result is TRUE or FALSE.\r
+\r
+ For the EFI_HII_VALUE value type is numeric, return TRUE if the\r
+ value is not 0.\r
+\r
+ @param Result Input the result data.\r
+\r
+ @retval TRUE The result is TRUE.\r
+ @retval FALSE The result is FALSE.\r
+\r
+**/\r
+BOOLEAN\r
+IsTrue (\r
+ IN EFI_HII_VALUE *Result\r
+ );\r
+\r
+/**\r
+ Get Formset_storage base on the input varstoreid info.\r
+\r
+ @param FormSet Pointer of the current FormSet.\r
+ @param VarStoreId Varstore ID info.\r
+\r
+ @return Pointer to a FORMSET_STORAGE data structure.\r
+\r
+**/\r
+FORMSET_STORAGE *\r
+GetFstStgFromVarId (\r
+ IN FORM_BROWSER_FORMSET *FormSet,\r
+ IN EFI_VARSTORE_ID VarStoreId\r
+ );\r
+\r
+/**\r
+ Get Formset_storage base on the input browser storage.\r
+\r
+ More than one formsets may share the same browser storage,\r
+ this function just get the first formset storage which\r
+ share the browser storage.\r
+\r
+ @param Storage browser storage info.\r
+\r
+ @return Pointer to a FORMSET_STORAGE data structure.\r
+ \r
+\r
+**/\r
+FORMSET_STORAGE *\r
+GetFstStgFromBrsStg (\r
+ IN BROWSER_STORAGE *Storage\r
+ );\r
+\r
+/**\r
+ Reconnect the controller.\r
+\r
+ @param DriverHandle The controller handle which need to be reconnect.\r
+\r
+ @retval TRUE do the reconnect behavior success.\r
+ @retval FALSE do the reconnect behavior failed.\r
+ \r
+**/\r
+BOOLEAN\r
+ReconnectController (\r
+ IN EFI_HANDLE DriverHandle\r
+ );\r
+\r
+/**\r
+ Converts the unicode character of the string from uppercase to lowercase.\r
+ This is a internal function.\r
+\r
+ @param ConfigString String to be converted\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+HiiToLower (\r
+ IN EFI_STRING ConfigString\r
+ );\r
+\r