/** @file\r
Private MACRO, structure and function definitions for Setup Browser module.\r
\r
-Copyright (c) 2007 - 2010, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
#include <Protocol/SimpleTextOut.h>\r
#include <Protocol/SimpleTextIn.h>\r
#include <Protocol/FormBrowser2.h>\r
+#include <Protocol/FormBrowserEx.h>\r
#include <Protocol/DevicePath.h>\r
#include <Protocol/UnicodeCollation.h>\r
#include <Protocol/HiiConfigAccess.h>\r
//\r
#define BANNER_HEIGHT 6\r
#define BANNER_COLUMNS 3\r
+#define BANNER_LEFT_COLUMN_INDENT 1\r
\r
#define FRONT_PAGE_HEADER_HEIGHT 6\r
#define NONE_FRONT_PAGE_HEADER_HEIGHT 3\r
-#define LEFT_SKIPPED_COLUMNS 4\r
+#define LEFT_SKIPPED_COLUMNS 3\r
#define FOOTER_HEIGHT 4\r
#define STATUS_BAR_HEIGHT 1\r
#define SCROLL_ARROW_HEIGHT 1\r
// Definition for function key setting\r
//\r
#define NONE_FUNCTION_KEY_SETTING 0\r
-#define DEFAULT_FUNCTION_KEY_SETTING (FUNCTION_NINE | FUNCTION_TEN)\r
-\r
-#define FUNCTION_NINE (1 << 2)\r
-#define FUNCTION_TEN (1 << 3)\r
+#define ENABLE_FUNCTION_KEY_SETTING 1\r
\r
typedef struct {\r
EFI_GUID FormSetGuid;\r
//\r
#define EXPRESSION_STACK_SIZE_INCREMENT 0x100\r
\r
-#define EFI_SPECIFICATION_MAJOR_VERSION 0x2\r
-#define EFI_SPECIFICATION_MINOR_VERSION 0x1\r
-#define EFI_SPECIFICATION_ERRATA_VERSION 0x0\r
-#define EFI_IFR_SPECIFICATION_VERSION (UINT16)((EFI_SPECIFICATION_MAJOR_VERSION << 8) | (EFI_SPECIFICATION_MINOR_VERSION << 4) | EFI_SPECIFICATION_ERRATA_VERSION)\r
+#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))\r
\r
\r
#define SETUP_DRIVER_SIGNATURE SIGNATURE_32 ('F', 'B', 'D', 'V')\r
//\r
// Produced protocol\r
//\r
- EFI_FORM_BROWSER2_PROTOCOL FormBrowser2;\r
+ EFI_FORM_BROWSER2_PROTOCOL FormBrowser2;\r
+ \r
+ EFI_FORM_BROWSER_EXTENSION_PROTOCOL FormBrowserEx;\r
\r
} SETUP_DRIVER_PRIVATE_DATA;\r
\r
#define EFI_HII_VARSTORE_BUFFER 0\r
#define EFI_HII_VARSTORE_NAME_VALUE 1\r
#define EFI_HII_VARSTORE_EFI_VARIABLE 2\r
+#define EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER 3\r
\r
#define FORM_INCONSISTENT_VALIDATION 0\r
#define FORM_NO_SUBMIT_VALIDATION 1\r
UINT64 Step;\r
\r
EFI_DEFAULT_ID DefaultId; // for EFI_IFR_RESET_BUTTON\r
- EFI_FORM_ID RefFormId; // for EFI_IFR_REF\r
- EFI_QUESTION_ID RefQuestionId; // for EFI_IFR_REF2\r
- EFI_GUID RefFormSetId; // for EFI_IFR_REF3\r
- EFI_STRING_ID RefDevicePath; // for EFI_IFR_REF4\r
+ EFI_GUID RefreshGuid; // for EFI_IFR_REFRESH_ID\r
\r
//\r
// Get from IFR parsing\r
\r
#define FORM_BROWSER_STATEMENT_FROM_LINK(a) CR (a, FORM_BROWSER_STATEMENT, Link, FORM_BROWSER_STATEMENT_SIGNATURE)\r
\r
+#define FORM_BROWSER_CONFIG_REQUEST_SIGNATURE SIGNATURE_32 ('F', 'C', 'R', 'S')\r
+typedef struct {\r
+ UINTN Signature;\r
+ LIST_ENTRY Link;\r
+\r
+ CHAR16 *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement>\r
+ UINTN ElementCount; // Number of <RequestElement> in the <ConfigRequest> \r
+ UINTN SpareStrLen;\r
+\r
+ FORMSET_STORAGE *Storage;\r
+} FORM_BROWSER_CONFIG_REQUEST;\r
+#define FORM_BROWSER_CONFIG_REQUEST_FROM_LINK(a) CR (a, FORM_BROWSER_CONFIG_REQUEST, Link, FORM_BROWSER_CONFIG_REQUEST_SIGNATURE)\r
+\r
#define FORM_BROWSER_FORM_SIGNATURE SIGNATURE_32 ('F', 'F', 'R', 'M')\r
#define STANDARD_MAP_FORM_TYPE 0x01\r
\r
\r
EFI_IMAGE_ID ImageId;\r
\r
+ BOOLEAN ModalForm; // Whether this is a modal form.\r
+\r
+ BOOLEAN NvUpdateRequired; // Whether this form has NV update request.\r
+\r
LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)\r
LIST_ENTRY StatementListHead; // List of Statements and Questions (FORM_BROWSER_STATEMENT)\r
+ LIST_ENTRY ConfigRequestHead; // List of configreques for all storage.\r
FORM_EXPRESSION *SuppressExpression; // nesting inside of SuppressIf\r
} FORM_BROWSER_FORM;\r
\r
\r
#define FORMSET_DEFAULTSTORE_FROM_LINK(a) CR (a, FORMSET_DEFAULTSTORE, Link, FORMSET_DEFAULTSTORE_SIGNATURE)\r
\r
+#define FORM_BROWSER_FORMSET_SIGNATURE SIGNATURE_32 ('F', 'B', 'F', 'S')\r
+\r
typedef struct {\r
- EFI_HII_HANDLE HiiHandle;\r
+ UINTN Signature;\r
+ LIST_ENTRY Link;\r
+ EFI_HII_HANDLE HiiHandle; // unique id for formset.\r
EFI_HANDLE DriverHandle;\r
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;\r
EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)\r
} FORM_BROWSER_FORMSET;\r
\r
+#define FORM_BROWSER_FORMSET_FROM_LINK(a) CR (a, FORM_BROWSER_FORMSET, Link, FORM_BROWSER_FORMSET_SIGNATURE)\r
+\r
#define BROWSER_CONTEXT_SIGNATURE SIGNATURE_32 ('B', 'C', 'T', 'X')\r
\r
typedef struct {\r
UINTN ClassOfVfr;\r
UINTN FunctionKeySetting;\r
BOOLEAN ResetRequired;\r
- BOOLEAN NvUpdateRequired;\r
UINT16 Direction;\r
EFI_SCREEN_DESCRIPTOR ScreenDimensions;\r
- CHAR16 *FunctionNineString;\r
- CHAR16 *FunctionTenString;\r
CHAR16 *EnterString;\r
CHAR16 *EnterCommitString;\r
CHAR16 *EnterEscapeString;\r
CHAR16 *EscapeString;\r
- CHAR16 *SaveFailed;\r
CHAR16 *MoveHighlight;\r
CHAR16 *MakeSelection;\r
CHAR16 *DecNumericInput;\r
\r
#define BROWSER_CONTEXT_FROM_LINK(a) CR (a, BROWSER_CONTEXT, Link, BROWSER_CONTEXT_SIGNATURE)\r
\r
+#define BROWSER_HOT_KEY_SIGNATURE SIGNATURE_32 ('B', 'H', 'K', 'S')\r
+\r
+typedef struct {\r
+ UINTN Signature;\r
+ LIST_ENTRY Link;\r
+ \r
+ EFI_INPUT_KEY *KeyData;\r
+ IN UINT32 Action;\r
+ IN UINT16 DefaultId;\r
+ IN EFI_STRING HelpString;\r
+} BROWSER_HOT_KEY;\r
+\r
+#define BROWSER_HOT_KEY_FROM_LINK(a) CR (a, BROWSER_HOT_KEY, Link, BROWSER_HOT_KEY_SIGNATURE)\r
+\r
extern EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;\r
extern EFI_HII_STRING_PROTOCOL *mHiiString;\r
extern EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;\r
extern UINTN gClassOfVfr;\r
extern UINTN gFunctionKeySetting;\r
extern BOOLEAN gResetRequired;\r
-extern BOOLEAN gNvUpdateRequired;\r
extern EFI_HII_HANDLE gHiiHandle;\r
extern UINT16 gDirection;\r
extern EFI_SCREEN_DESCRIPTOR gScreenDimensions;\r
\r
extern FORM_BROWSER_FORMSET *gOldFormSet;\r
+extern LIST_ENTRY gBrowserFormSetList;\r
+extern LIST_ENTRY gBrowserHotKeyList;\r
+extern BROWSER_SETTING_SCOPE gBrowserSettingScope;\r
+extern EXIT_HANDLER ExitHandlerFunction;\r
+extern UINTN gFooterHeight;\r
\r
//\r
// Browser Global Strings\r
//\r
-extern CHAR16 *gFunctionNineString;\r
-extern CHAR16 *gFunctionTenString;\r
+extern CHAR16 *gDiscardFailed;\r
+extern CHAR16 *gDefaultFailed;\r
extern CHAR16 *gEnterString;\r
extern CHAR16 *gEnterCommitString;\r
extern CHAR16 *gEnterEscapeString;\r
\r
**/\r
UINTN\r
+EFIAPI\r
PrintAt (\r
IN UINTN Column,\r
IN UINTN Row,\r
/**\r
This function displays the page frame.\r
\r
+ @param Selection Selection contains the information about \r
+ the Selection, form and formset to be displayed.\r
+ Selection action may be updated in retrieve callback.\r
**/\r
VOID\r
DisplayPageFrame (\r
- VOID\r
+ IN UI_MENU_SELECTION *Selection\r
);\r
\r
/**\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CreateDialog (\r
IN UINTN NumberOfLines,\r
IN BOOLEAN HotKey,\r
@param Storage The NameValue Storage.\r
@param Name The Name.\r
@param Value The Value to set.\r
+ @param Edit Whether update editValue or Value.\r
\r
@retval EFI_SUCCESS Value found for given Name.\r
@retval EFI_NOT_FOUND No such Name found in NameValue storage.\r
SetValueByName (\r
IN FORMSET_STORAGE *Storage,\r
IN CHAR16 *Name,\r
- IN CHAR16 *Value\r
+ IN CHAR16 *Value,\r
+ IN BOOLEAN Edit\r
);\r
\r
/**\r
IN UINTN Type\r
);\r
\r
+\r
+/**\r
+ Discard data based on the input setting scope (Form, FormSet or System).\r
+\r
+ @param FormSet FormSet data structure.\r
+ @param Form Form data structure.\r
+ @param SettingScope Setting Scope for Discard action.\r
+\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+ @retval EFI_UNSUPPORTED Unsupport SettingScope.\r
+\r
+**/\r
+EFI_STATUS\r
+DiscardForm (\r
+ IN FORM_BROWSER_FORMSET *FormSet,\r
+ IN FORM_BROWSER_FORM *Form,\r
+ IN BROWSER_SETTING_SCOPE SettingScope\r
+ );\r
+\r
/**\r
- Submit a Form.\r
+ Submit data based on the input Setting level (Form, FormSet or System).\r
\r
@param FormSet FormSet data structure.\r
@param Form Form data structure.\r
+ @param SettingScope Setting Scope for Submit action.\r
\r
@retval EFI_SUCCESS The function completed successfully.\r
+ @retval EFI_UNSUPPORTED Unsupport SettingScope.\r
\r
**/\r
EFI_STATUS\r
SubmitForm (\r
IN FORM_BROWSER_FORMSET *FormSet,\r
- IN FORM_BROWSER_FORM *Form\r
+ IN FORM_BROWSER_FORM *Form,\r
+ IN BROWSER_SETTING_SCOPE SettingScope\r
);\r
\r
/**\r
);\r
\r
/**\r
- Reset Questions in a Form to their default value.\r
+ Reset Questions to their default value in a Form, Formset or System.\r
\r
@param FormSet FormSet data structure.\r
- @param Form The Form which to be reset.\r
+ @param Form Form data structure.\r
@param DefaultId The Class of the default.\r
+ @param SettingScope Setting Scope for Default action.\r
\r
@retval EFI_SUCCESS The function completed successfully.\r
+ @retval EFI_UNSUPPORTED Unsupport SettingScope.\r
\r
**/\r
EFI_STATUS\r
-ExtractFormDefault (\r
+ExtractDefault (\r
IN FORM_BROWSER_FORMSET *FormSet,\r
- IN FORM_BROWSER_FORM *Form,\r
- IN UINT16 DefaultId\r
+ IN FORM_BROWSER_FORM *Form,\r
+ IN UINT16 DefaultId,\r
+ IN BROWSER_SETTING_SCOPE SettingScope\r
);\r
\r
/**\r
/**\r
Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.\r
\r
- @param Storage The Storage to be conveted.\r
+ @param Buffer The Storage to be conveted.\r
@param ConfigResp The returned <ConfigResp>.\r
+ @param SingleForm Whether update data for single form or formset level.\r
\r
@retval EFI_SUCCESS Convert success.\r
@retval EFI_INVALID_PARAMETER Incorrect storage type.\r
**/\r
EFI_STATUS\r
StorageToConfigResp (\r
- IN FORMSET_STORAGE *Storage,\r
- IN CHAR16 **ConfigResp\r
+ IN VOID *Buffer,\r
+ IN CHAR16 **ConfigResp,\r
+ IN BOOLEAN SingleForm\r
);\r
\r
/**\r
IN CONST CHAR16 *VariableName OPTIONAL\r
);\r
\r
+/**\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 Repaint Whether need to repaint the menu.\r
+ @param NewLine Whether need to show at new line.\r
+ \r
+ @retval TRUE Need return.\r
+ @retval FALSE No need to return.\r
+**/\r
+BOOLEAN\r
+FindNextMenu (\r
+ IN OUT UI_MENU_SELECTION *Selection,\r
+ IN BOOLEAN *Repaint, \r
+ IN BOOLEAN *NewLine \r
+ );\r
+\r
+/**\r
+ check whether the formset need to update the NV.\r
+\r
+ @param FormSet FormSet data structure.\r
+ @param SetValue Whether set new value or clear old value.\r
+\r
+**/\r
+VOID\r
+UpdateNvInfoInForm (\r
+ IN FORM_BROWSER_FORMSET *FormSet,\r
+ IN BOOLEAN SetValue\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
+IsNvUpdateRequired (\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 Statement 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 excutes successfully.\r
+ @return Other value if the call back function failed to excute. \r
+**/\r
+EFI_STATUS \r
+ProcessCallBackFunction (\r
+ IN OUT UI_MENU_SELECTION *Selection,\r
+ IN FORM_BROWSER_STATEMENT *Question,\r
+ IN EFI_BROWSER_ACTION Action,\r
+ IN BOOLEAN SkipSaveOrDiscard\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
+**/\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
+ 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
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+SaveReminder (\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
#endif\r