]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/SetupBrowserDxe/Ui.h
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Universal / SetupBrowserDxe / Ui.h
index e402248204c7e21fc307b0959a5a0c1a982d28c4..cdd661ca9913c0a25690d31fe99c0414d341f9a4 100644 (file)
-/** @file
-
-Copyright (c) 2004 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution.  The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
-  Ui.h
-
-Abstract:
-
-  Head file UI
-
-Revision History
-
-
-**/
-
-#ifndef _UI_H
-#define _UI_H
-
-#include "Setup.h"
-
-//
-// Globals
-//
-#define REGULAR_NUMERIC 0
-#define TIME_NUMERIC    1
-#define DATE_NUMERIC    2
-
-#define SUBTITLE_INDENT  2
-
-typedef enum {
-  UiNoOperation,
-  UiDefault,
-  UiSelect,
-  UiUp,
-  UiDown,
-  UiLeft,
-  UiRight,
-  UiReset,
-  UiSave,
-  UiPrevious,
-  UiPageUp,
-  UiPageDown,
-  UiMaxOperation
-} UI_SCREEN_OPERATION;
-
-typedef enum {
-  CfInitialization,
-  CfCheckSelection,
-  CfRepaint,
-  CfRefreshHighLight,
-  CfUpdateHelpString,
-  CfPrepareToReadKey,
-  CfReadKey,
-  CfScreenOperation,
-  CfUiPrevious,
-  CfUiSelect,
-  CfUiReset,
-  CfUiLeft,
-  CfUiRight,
-  CfUiUp,
-  CfUiPageUp,
-  CfUiPageDown,
-  CfUiDown,
-  CfUiSave,
-  CfUiDefault,
-  CfUiNoOperation,
-  CfExit,
-  CfMaxControlFlag
-} UI_CONTROL_FLAG;
-
-#define UI_ACTION_NONE               0
-#define UI_ACTION_REFRESH_FORM       1
-#define UI_ACTION_REFRESH_FORMSET    2
-#define UI_ACTION_EXIT               3
-
-typedef struct {
-  EFI_HII_HANDLE  Handle;
-
-  //
-  // Target formset/form/Question information
-  //
-  EFI_GUID        FormSetGuid;
-  UINT16          FormId;
-  UINT16          QuestionId;
-
-  UINTN           TopRow;
-  UINTN           BottomRow;
-  UINTN           PromptCol;
-  UINTN           OptionCol;
-  UINTN           CurrentRow;
-
-  //
-  // Ation for Browser to taken:
-  //   UI_ACTION_NONE            - navigation inside a form
-  //   UI_ACTION_REFRESH_FORM    - re-evaluate expressions and repaint form
-  //   UI_ACTION_REFRESH_FORMSET - re-parse formset IFR binary
-  //
-  UINTN           Action;
-
-  //
-  // Current selected fomset/form/Question
-  //
-  FORM_BROWSER_FORMSET    *FormSet;
-  FORM_BROWSER_FORM       *Form;
-  FORM_BROWSER_STATEMENT  *Statement;
-} UI_MENU_SELECTION;
-
-#define UI_MENU_OPTION_SIGNATURE  EFI_SIGNATURE_32 ('u', 'i', 'm', 'm')
-#define UI_MENU_LIST_SIGNATURE    EFI_SIGNATURE_32 ('u', 'i', 'm', 'l')
-
-typedef struct {
-  UINTN                   Signature;
-  LIST_ENTRY              Link;
-
-  EFI_HII_HANDLE          Handle;
-  FORM_BROWSER_STATEMENT  *ThisTag;
-  UINT16                  EntryNumber;
-
-  UINTN                   Row;
-  UINTN                   Col;
-  UINTN                   OptCol;
-  CHAR16                  *Description;
-  UINTN                   Skip;           // Number of lines
-
-  //
-  // Display item sequence for date/time
-  //  Date:      Month/Day/Year
-  //  Sequence:  0     1   2
-  //
-  //  Time:      Hour : Minute : Second
-  //  Sequence:  0      1        2
-  //
-  //
-  UINTN                   Sequence;
-
-  BOOLEAN                 GrayOut;
-  BOOLEAN                 ReadOnly;
-} UI_MENU_OPTION;
-
-#define MENU_OPTION_FROM_LINK(a)  CR (a, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE)
-
-typedef struct {
-  UINTN           Signature;
-  LIST_ENTRY      MenuLink;
-
-  UINT16          FormId;
-  UINT16          QuestionId;
-} UI_MENU_LIST;
-
-typedef struct _MENU_REFRESH_ENTRY {
-  struct _MENU_REFRESH_ENTRY  *Next;
-  UI_MENU_OPTION              *MenuOption;  // Describes the entry needing an update
-  UI_MENU_SELECTION           *Selection;
-  UINTN                       CurrentColumn;
-  UINTN                       CurrentRow;
-  UINTN                       CurrentAttribute;
-} MENU_REFRESH_ENTRY;
-
-typedef struct {
-  UINT16              ScanCode;
-  UI_SCREEN_OPERATION ScreenOperation;
-} SCAN_CODE_TO_SCREEN_OPERATION;
-
-typedef struct {
-  UI_SCREEN_OPERATION ScreenOperation;
-  UI_CONTROL_FLAG     ControlFlag;
-} SCREEN_OPERATION_T0_CONTROL_FLAG;
-
-
-extern LIST_ENTRY          gMenuList;
-extern MENU_REFRESH_ENTRY  *gMenuRefreshHead;
-extern UI_MENU_SELECTION   *gCurrentSelection;
-
-//
-// Global Functions
-//
-VOID
-UiInitMenu (
-  VOID
-  )
-;
-
-VOID
-UiInitMenuList (
-  VOID
-  )
-;
-
-VOID
-UiRemoveMenuListEntry (
-  OUT UI_MENU_SELECTION  *Selection
-  )
-;
-
-VOID
-UiFreeMenuList (
-  VOID
-  )
-;
-
-VOID
-UiAddMenuListEntry (
-  IN UI_MENU_SELECTION            *Selection
-  )
-;
-
-VOID
-UiFreeMenu (
-  VOID
-  )
-;
-
-VOID
-UiAddMenuOption (
-  IN CHAR16                  *String,
-  IN EFI_HII_HANDLE          Handle,
-  IN FORM_BROWSER_STATEMENT  *Statement,
-  IN UINT16                  NumberOfLines,
-  IN UINT16                  MenuItemCount
-  )
-;
-
-EFI_STATUS
-UiDisplayMenu (
-  IN OUT UI_MENU_SELECTION           *Selection
-  )
-;
-
-VOID
-FreeBrowserStrings (
-  VOID
-  )
-;
-
-EFI_STATUS
-SetupBrowser (
-  IN OUT UI_MENU_SELECTION    *Selection
-  )
-;
-
-VOID
-ValueToString (
-  IN CHAR16   *Buffer,
-  IN BOOLEAN  Comma,
-  IN INT64    v
-  )
-;
-
-EFI_STATUS
-UiIntToString (
-  IN UINTN      num,
-  IN OUT CHAR16 *str,
-  IN UINT16     size
-  )
-;
-
-VOID
-SetUnicodeMem (
-  IN VOID   *Buffer,
-  IN UINTN  Size,
-  IN CHAR16 Value
-  )
-;
-
-EFI_STATUS
-UiWaitForSingleEvent (
-  IN EFI_EVENT                Event,
-  IN UINT64                   Timeout, OPTIONAL
-  IN UINT8                    RefreshInterval OPTIONAL
-  )
-;
-
-VOID
-CreatePopUp (
-  IN  UINTN                       ScreenWidth,
-  IN  UINTN                       NumberOfLines,
-  IN  CHAR16                      *ArrayOfStrings,
-  ...
-  )
-;
-
-EFI_STATUS
-ReadString (
-  IN  UI_MENU_OPTION              *MenuOption,
-  IN  CHAR16                      *Prompt,
-  OUT CHAR16                      *StringPtr
-  )
-;
-
-EFI_STATUS
-GetSelectionInputPopUp (
-  IN  UI_MENU_SELECTION           *Selection,
-  IN  UI_MENU_OPTION              *MenuOption
-  )
-;
-
-EFI_STATUS
-GetNumericInput (
-  IN  UI_MENU_SELECTION           *Selection,
-  IN  UI_MENU_OPTION              *MenuOption
-  )
-;
-
-VOID
-UpdateStatusBar (
-  IN  UINTN                       MessageType,
-  IN  UINT8                       Flags,
-  IN  BOOLEAN                     State
-  )
-;
-
-EFI_STATUS
-ProcessQuestionConfig (
-  IN  UI_MENU_SELECTION       *Selection,
-  IN  FORM_BROWSER_STATEMENT  *Question
-  )
-;
-
-EFI_STATUS
-PrintFormattedNumber (
-  IN FORM_BROWSER_STATEMENT   *Question,
-  IN OUT CHAR16               *FormattedNumber,
-  IN UINTN                    BufferSize
-  )
-;
-
-QUESTION_OPTION *
-ValueToOption (
-  IN FORM_BROWSER_STATEMENT   *Question,
-  IN EFI_HII_VALUE            *OptionValue
-  )
-;
-
-EFI_STATUS
-ProcessOptions (
-  IN  UI_MENU_SELECTION           *Selection,
-  IN  UI_MENU_OPTION              *MenuOption,
-  IN  BOOLEAN                     Selected,
-  OUT CHAR16                      **OptionString
-  )
-;
-
-VOID
-ProcessHelpString (
-  IN  CHAR16                      *StringPtr,
-  OUT CHAR16                      **FormattedString,
-  IN  UINTN                       RowCount
-  )
-;
-
-VOID
-UpdateKeyHelp (
-  IN  UI_MENU_OPTION              *MenuOption,
-  IN  BOOLEAN                     Selected
-  )
-;
-
-VOID
-ClearLines (
-  UINTN                                       LeftColumn,
-  UINTN                                       RightColumn,
-  UINTN                                       TopRow,
-  UINTN                                       BottomRow,
-  UINTN                                       TextAttribute
-  )
-;
-
-UINTN
-GetStringWidth (
-  CHAR16                                      *String
-  )
-;
-
-UINT16
-GetLineByWidth (
-  IN      CHAR16                      *InputString,
-  IN      UINT16                      LineWidth,
-  IN OUT  UINTN                       *Index,
-  OUT     CHAR16                      **OutputString
-  )
-;
-
-UINT16
-GetWidth (
-  IN FORM_BROWSER_STATEMENT        *Statement,
-  IN EFI_HII_HANDLE                 Handle
-  )
-;
-
-VOID
-NewStrCat (
-  CHAR16                                      *Destination,
-  CHAR16                                      *Source
-  )
-;
-
-EFI_STATUS
-WaitForKeyStroke (
-  OUT  EFI_INPUT_KEY           *Key
-  )
-;
-
-VOID
-ResetScopeStack (
-  VOID
-  )
-;
-
-EFI_STATUS
-PushScope (
-  IN UINT8   Operand
-  )
-;
-
-EFI_STATUS
-PopScope (
-  OUT UINT8     *Operand
-  )
-;
-
-FORM_BROWSER_FORM *
-IdToForm (
-  IN FORM_BROWSER_FORMSET  *FormSet,
-  IN UINT16                FormId
-)
-;
-
-FORM_BROWSER_STATEMENT *
-IdToQuestion (
-  IN FORM_BROWSER_FORMSET  *FormSet,
-  IN FORM_BROWSER_FORM     *Form,
-  IN UINT16                QuestionId
-  )
-;
-
-FORM_EXPRESSION *
-IdToExpression (
-  IN FORM_BROWSER_FORM  *Form,
-  IN UINT8              RuleId
-  )
-;
-
-VOID
-ExtendValueToU64 (
-  IN  EFI_HII_VALUE   *Value
-  )
-;
-
-INTN
-CompareHiiValue (
-  IN  EFI_HII_VALUE   *Value1,
-  IN  EFI_HII_VALUE   *Value2,
-  IN  EFI_HII_HANDLE  HiiHandle OPTIONAL
-  )
-;
-
-EFI_STATUS
-EvaluateExpression (
-  IN FORM_BROWSER_FORMSET  *FormSet,
-  IN FORM_BROWSER_FORM     *Form,
-  IN OUT FORM_EXPRESSION   *Expression
-  )
-;
-
-#endif // _UI_H
+/** @file\r
+Private structure, MACRO and function definitions for User Interface related functionalities.\r
+\r
+Copyright (c) 2004 - 2010, 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
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _UI_H_\r
+#define _UI_H_\r
+\r
+//\r
+// Globals\r
+//\r
+#define REGULAR_NUMERIC 0\r
+#define TIME_NUMERIC    1\r
+#define DATE_NUMERIC    2\r
+\r
+#define SUBTITLE_INDENT  2\r
+\r
+\r
+//\r
+// It take 23 characters including the NULL to print a 64 bits number with "[" and "]".\r
+// pow(2, 64) = [18446744073709551616]\r
+//\r
+#define MAX_NUMERIC_INPUT_WIDTH 23\r
+\r
+typedef enum {\r
+  UiNoOperation,\r
+  UiDefault,\r
+  UiSelect,\r
+  UiUp,\r
+  UiDown,\r
+  UiLeft,\r
+  UiRight,\r
+  UiReset,\r
+  UiSave,\r
+  UiPrevious,\r
+  UiPageUp,\r
+  UiPageDown,\r
+  UiMaxOperation\r
+} UI_SCREEN_OPERATION;\r
+\r
+typedef enum {\r
+  CfInitialization,\r
+  CfCheckSelection,\r
+  CfRepaint,\r
+  CfRefreshHighLight,\r
+  CfUpdateHelpString,\r
+  CfPrepareToReadKey,\r
+  CfReadKey,\r
+  CfScreenOperation,\r
+  CfUiSelect,\r
+  CfUiReset,\r
+  CfUiLeft,\r
+  CfUiRight,\r
+  CfUiUp,\r
+  CfUiPageUp,\r
+  CfUiPageDown,\r
+  CfUiDown,\r
+  CfUiSave,\r
+  CfUiDefault,\r
+  CfUiNoOperation,\r
+  CfExit,\r
+  CfMaxControlFlag\r
+} UI_CONTROL_FLAG;\r
+\r
+#define UI_ACTION_NONE               0\r
+#define UI_ACTION_REFRESH_FORM       1\r
+#define UI_ACTION_REFRESH_FORMSET    2\r
+#define UI_ACTION_EXIT               3\r
+\r
+typedef struct {\r
+  EFI_HII_HANDLE  Handle;\r
+\r
+  //\r
+  // Target formset/form/Question information\r
+  //\r
+  EFI_GUID        FormSetGuid;\r
+  UINT16          FormId;\r
+  UINT16          QuestionId;\r
+\r
+  UINTN           TopRow;\r
+  UINTN           BottomRow;\r
+  UINTN           PromptCol;\r
+  UINTN           OptionCol;\r
+  UINTN           CurrentRow;\r
+\r
+  //\r
+  // Ation for Browser to taken:\r
+  //   UI_ACTION_NONE            - navigation inside a form\r
+  //   UI_ACTION_REFRESH_FORM    - re-evaluate expressions and repaint form\r
+  //   UI_ACTION_REFRESH_FORMSET - re-parse formset IFR binary\r
+  //\r
+  UINTN           Action;\r
+\r
+  //\r
+  // Current selected fomset/form/Question\r
+  //\r
+  FORM_BROWSER_FORMSET    *FormSet;\r
+  FORM_BROWSER_FORM       *Form;\r
+  FORM_BROWSER_STATEMENT  *Statement;\r
+\r
+  //\r
+  // Whether the Form is editable\r
+  //\r
+  BOOLEAN                 FormEditable;\r
+} UI_MENU_SELECTION;\r
+\r
+#define UI_MENU_OPTION_SIGNATURE  SIGNATURE_32 ('u', 'i', 'm', 'm')\r
+#define UI_MENU_LIST_SIGNATURE    SIGNATURE_32 ('u', 'i', 'm', 'l')\r
+\r
+typedef struct {\r
+  UINTN                   Signature;\r
+  LIST_ENTRY              Link;\r
+\r
+  EFI_HII_HANDLE          Handle;\r
+  FORM_BROWSER_STATEMENT  *ThisTag;\r
+  UINT16                  EntryNumber;\r
+\r
+  UINTN                   Row;\r
+  UINTN                   Col;\r
+  UINTN                   OptCol;\r
+  CHAR16                  *Description;\r
+  UINTN                   Skip;           // Number of lines\r
+\r
+  //\r
+  // Display item sequence for date/time\r
+  //  Date:      Month/Day/Year\r
+  //  Sequence:  0     1   2\r
+  //\r
+  //  Time:      Hour : Minute : Second\r
+  //  Sequence:  0      1        2\r
+  //\r
+  //\r
+  UINTN                   Sequence;\r
+\r
+  BOOLEAN                 GrayOut;\r
+  BOOLEAN                 ReadOnly;\r
+\r
+  //\r
+  // Whether user could change value of this item\r
+  //\r
+  BOOLEAN                 IsQuestion;\r
+} UI_MENU_OPTION;\r
+\r
+#define MENU_OPTION_FROM_LINK(a)  CR (a, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE)\r
+\r
+typedef struct _UI_MENU_LIST UI_MENU_LIST;\r
+\r
+struct _UI_MENU_LIST {\r
+  UINTN           Signature;\r
+  LIST_ENTRY      Link;\r
+\r
+  EFI_GUID        FormSetGuid;\r
+  UINT16          FormId;\r
+  UINT16          QuestionId;\r
+\r
+  UI_MENU_LIST    *Parent;\r
+  LIST_ENTRY      ChildListHead;\r
+};\r
+\r
+#define UI_MENU_LIST_FROM_LINK(a)  CR (a, UI_MENU_LIST, Link, UI_MENU_LIST_SIGNATURE)\r
+\r
+typedef struct _MENU_REFRESH_ENTRY MENU_REFRESH_ENTRY;\r
+struct _MENU_REFRESH_ENTRY {\r
+  MENU_REFRESH_ENTRY          *Next;\r
+  UI_MENU_OPTION              *MenuOption;  // Describes the entry needing an update\r
+  UI_MENU_SELECTION           *Selection;\r
+  UINTN                       CurrentColumn;\r
+  UINTN                       CurrentRow;\r
+  UINTN                       CurrentAttribute;\r
+};\r
+\r
+typedef struct {\r
+  UINT16              ScanCode;\r
+  UI_SCREEN_OPERATION ScreenOperation;\r
+} SCAN_CODE_TO_SCREEN_OPERATION;\r
+\r
+typedef struct {\r
+  UI_SCREEN_OPERATION ScreenOperation;\r
+  UI_CONTROL_FLAG     ControlFlag;\r
+} SCREEN_OPERATION_T0_CONTROL_FLAG;\r
+\r
+\r
+extern LIST_ENTRY          gMenuOption;\r
+extern MENU_REFRESH_ENTRY  *gMenuRefreshHead;\r
+extern UI_MENU_SELECTION   *gCurrentSelection;\r
+extern BOOLEAN             mHiiPackageListUpdated;\r
+\r
+//\r
+// Global Functions\r
+//\r
+/**\r
+  Initialize Menu option list.\r
+\r
+**/\r
+VOID\r
+UiInitMenu (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Initialize Menu option list.\r
+\r
+**/\r
+VOID\r
+UiInitMenuList (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Free Menu option linked list.\r
+\r
+**/\r
+VOID\r
+UiFreeMenu (\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  Parent                 The parent of menu to be added.\r
+  @param  FormSetGuid            The Formset Guid of menu to be added.\r
+  @param  FormId                 The Form ID of menu to be added.\r
+\r
+  @return A pointer to the newly added menu or NULL if memory is insufficient.\r
+\r
+**/\r
+UI_MENU_LIST *\r
+UiAddMenuList (\r
+  IN OUT UI_MENU_LIST     *Parent,\r
+  IN EFI_GUID             *FormSetGuid,\r
+  IN UINT16               FormId\r
+  );\r
+\r
+/**\r
+  Search Menu with given FormId in the parent menu and all its child menus.\r
+\r
+  @param  Parent                 The parent of 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
+UI_MENU_LIST *\r
+UiFindChildMenuList (\r
+  IN UI_MENU_LIST         *Parent,\r
+  IN UINT16               FormId\r
+  );\r
+\r
+/**\r
+  Search Menu with given FormSetGuid and FormId in all cached menu list.\r
+\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
+UI_MENU_LIST *\r
+UiFindMenuList (\r
+  IN EFI_GUID             *FormSetGuid,\r
+  IN UINT16               FormId\r
+  );\r
+\r
+/**\r
+  Free Menu option linked list.\r
+\r
+**/\r
+VOID\r
+UiFreeRefreshList (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Add one menu option by specified description and context.\r
+\r
+  @param  String                 String description for this option.\r
+  @param  Handle                 Hii handle for the package list.\r
+  @param  Statement              Statement of this Menu Option.\r
+  @param  NumberOfLines          Display lines for this Menu Option.\r
+  @param  MenuItemCount          The index for this Option in the Menu.\r
+\r
+  @retval Pointer                Pointer to the added Menu Option.\r
+\r
+**/\r
+UI_MENU_OPTION *\r
+UiAddMenuOption (\r
+  IN CHAR16                  *String,\r
+  IN EFI_HII_HANDLE          Handle,\r
+  IN FORM_BROWSER_STATEMENT  *Statement,\r
+  IN UINT16                  NumberOfLines,\r
+  IN UINT16                  MenuItemCount\r
+  );\r
+\r
+/**\r
+  Display menu and wait for user to select one menu option, then return it.\r
+  If AutoBoot is enabled, then if user doesn't select any option,\r
+  after period of time, it will automatically return the first menu option.\r
+\r
+  @param  Selection              Menu selection.\r
+\r
+  @return Return the pointer of the menu which selected,\r
+  @return otherwise return NULL.\r
+\r
+**/\r
+EFI_STATUS\r
+UiDisplayMenu (\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
+  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
+  Set Buffer to Value for Size bytes.\r
+\r
+  @param  Buffer                 Memory to set.\r
+  @param  Size                   Number of bytes to set\r
+  @param  Value                  Value of the set operation.\r
+\r
+**/\r
+VOID\r
+SetUnicodeMem (\r
+  IN VOID   *Buffer,\r
+  IN UINTN  Size,\r
+  IN CHAR16 Value\r
+  );\r
+\r
+/**\r
+  Wait for a given event to fire, or for an optional timeout to expire.\r
+\r
+  @param  Event                  The event to wait for\r
+  @param  Timeout                An optional timeout value in 100 ns units.\r
+  @param  RefreshInterval        Menu refresh interval (in seconds).\r
+\r
+  @retval EFI_SUCCESS            Event fired before Timeout expired.\r
+  @retval EFI_TIME_OUT           Timout expired before Event fired.\r
+\r
+**/\r
+EFI_STATUS\r
+UiWaitForSingleEvent (\r
+  IN EFI_EVENT                Event,\r
+  IN UINT64                   Timeout, OPTIONAL\r
+  IN UINT8                    RefreshInterval OPTIONAL\r
+  );\r
+\r
+/**\r
+  Draw a pop up windows based on the dimension, number of lines and\r
+  strings specified.\r
+\r
+  @param ScreenWidth     The width of the pop-up.\r
+  @param NumberOfLines   The number of lines.\r
+  @param ...             A series of text strings that displayed in the pop-up.\r
+\r
+**/\r
+VOID\r
+CreateMultiStringPopUp (\r
+  IN  UINTN                       ScreenWidth,\r
+  IN  UINTN                       NumberOfLines,\r
+  ...\r
+  );\r
+\r
+/**\r
+  Get string or password input from user.\r
+\r
+  @param  MenuOption        Pointer to the current input menu.\r
+  @param  Prompt            The prompt string shown on popup window.\r
+  @param  StringPtr         Destination for use input string.\r
+\r
+  @retval EFI_SUCCESS       If string input is read successfully\r
+  @retval EFI_DEVICE_ERROR  If operation fails\r
+\r
+**/\r
+EFI_STATUS\r
+ReadString (\r
+  IN  UI_MENU_OPTION              *MenuOption,\r
+  IN  CHAR16                      *Prompt,\r
+  OUT CHAR16                      *StringPtr\r
+  );\r
+\r
+/**\r
+  Get selection for OneOf and OrderedList (Left/Right will be ignored).\r
+\r
+  @param  Selection         Pointer to current selection.\r
+  @param  MenuOption        Pointer to the current input menu.\r
+\r
+  @retval EFI_SUCCESS       If Option input is processed successfully\r
+  @retval EFI_DEVICE_ERROR  If operation fails\r
+\r
+**/\r
+EFI_STATUS\r
+GetSelectionInputPopUp (\r
+  IN  UI_MENU_SELECTION           *Selection,\r
+  IN  UI_MENU_OPTION              *MenuOption\r
+  );\r
+\r
+/**\r
+  This routine reads a numeric value from the user input.\r
+\r
+  @param  Selection         Pointer to current selection.\r
+  @param  MenuOption        Pointer to the current input menu.\r
+\r
+  @retval EFI_SUCCESS       If numerical input is read successfully\r
+  @retval EFI_DEVICE_ERROR  If operation fails\r
+\r
+**/\r
+EFI_STATUS\r
+GetNumericInput (\r
+  IN  UI_MENU_SELECTION           *Selection,\r
+  IN  UI_MENU_OPTION              *MenuOption\r
+  );\r
+\r
+/**\r
+  Update status bar on the bottom of menu.\r
+\r
+  @param  MessageType            The type of message to be shown.\r
+  @param  Flags                  The flags in Question header.\r
+  @param  State                  Set or clear.\r
+\r
+**/\r
+VOID\r
+UpdateStatusBar (\r
+  IN  UINTN                       MessageType,\r
+  IN  UINT8                       Flags,\r
+  IN  BOOLEAN                     State\r
+  );\r
+\r
+/**\r
+  Process Question Config.\r
+\r
+  @param  Selection              The UI menu selection.\r
+  @param  Question               The Question to be peocessed.\r
+\r
+  @retval EFI_SUCCESS            Question Config process success.\r
+  @retval Other                  Question Config process fail.\r
+\r
+**/\r
+EFI_STATUS\r
+ProcessQuestionConfig (\r
+  IN  UI_MENU_SELECTION       *Selection,\r
+  IN  FORM_BROWSER_STATEMENT  *Question\r
+  );\r
+\r
+/**\r
+  Print Question Value according to it's storage width and display attributes.\r
+\r
+  @param  Question               The Question to be printed.\r
+  @param  FormattedNumber        Buffer for output string.\r
+  @param  BufferSize             The FormattedNumber buffer size in bytes.\r
+\r
+  @retval EFI_SUCCESS            Print success.\r
+  @retval EFI_BUFFER_TOO_SMALL   Buffer size is not enough for formatted number.\r
+\r
+**/\r
+EFI_STATUS\r
+PrintFormattedNumber (\r
+  IN FORM_BROWSER_STATEMENT   *Question,\r
+  IN OUT CHAR16               *FormattedNumber,\r
+  IN UINTN                    BufferSize\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
+/**\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
+  Process a Question's Option (whether selected or un-selected).\r
+\r
+  @param  Selection              Pointer to UI_MENU_SELECTION.\r
+  @param  MenuOption             The MenuOption for this Question.\r
+  @param  Selected               TRUE: if Question is selected.\r
+  @param  OptionString           Pointer of the Option String to be displayed.\r
+\r
+  @retval EFI_SUCCESS            Question Option process success.\r
+  @retval Other                  Question Option process fail.\r
+\r
+**/\r
+EFI_STATUS\r
+ProcessOptions (\r
+  IN  UI_MENU_SELECTION           *Selection,\r
+  IN  UI_MENU_OPTION              *MenuOption,\r
+  IN  BOOLEAN                     Selected,\r
+  OUT CHAR16                      **OptionString\r
+  );\r
+\r
+/**\r
+  Process the help string: Split StringPtr to several lines of strings stored in\r
+  FormattedString and the glyph width of each line cannot exceed gHelpBlockWidth.\r
+\r
+  @param  StringPtr              The entire help string.\r
+  @param  FormattedString        The oupput formatted string.\r
+  @param  RowCount               TRUE: if Question is selected.\r
+\r
+**/\r
+VOID\r
+ProcessHelpString (\r
+  IN  CHAR16                      *StringPtr,\r
+  OUT CHAR16                      **FormattedString,\r
+  IN  UINTN                       RowCount\r
+  );\r
+\r
+/**\r
+  Update key's help imformation.\r
+\r
+  @param Selection       Tell setup browser the information about the Selection\r
+  @param  MenuOption     The Menu option\r
+  @param  Selected       Whether or not a tag be selected\r
+\r
+**/\r
+VOID\r
+UpdateKeyHelp (\r
+  IN  UI_MENU_SELECTION           *Selection,\r
+  IN  UI_MENU_OPTION              *MenuOption,\r
+  IN  BOOLEAN                     Selected\r
+  );\r
+\r
+/**\r
+  Clear retangle with specified text attribute.\r
+\r
+  @param  LeftColumn     Left column of retangle.\r
+  @param  RightColumn    Right column of retangle.\r
+  @param  TopRow         Start row of retangle.\r
+  @param  BottomRow      End row of retangle.\r
+  @param  TextAttribute  The character foreground and background.\r
+\r
+**/\r
+VOID\r
+ClearLines (\r
+  IN UINTN               LeftColumn,\r
+  IN UINTN               RightColumn,\r
+  IN UINTN               TopRow,\r
+  IN UINTN               BottomRow,\r
+  IN UINTN               TextAttribute\r
+  );\r
+\r
+/**\r
+  Count the storage space of a Unicode string.\r
+\r
+  This function handles the Unicode string with NARROW_CHAR\r
+  and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR\r
+  does not count in the resultant output. If a WIDE_CHAR is\r
+  hit, then 2 Unicode character will consume an output storage\r
+  space with size of CHAR16 till a NARROW_CHAR is hit.\r
+\r
+  If String is NULL, then ASSERT ().\r
+\r
+  @param String          The input string to be counted.\r
+\r
+  @return Storage space for the input string.\r
+\r
+**/\r
+UINTN\r
+GetStringWidth (\r
+  IN CHAR16               *String\r
+  );\r
+\r
+/**\r
+  Will copy LineWidth amount of a string in the OutputString buffer and return the\r
+  number of CHAR16 characters that were copied into the OutputString buffer.\r
+\r
+  @param  InputString            String description for this option.\r
+  @param  LineWidth              Width of the desired string to extract in CHAR16\r
+                                 characters\r
+  @param  Index                  Where in InputString to start the copy process\r
+  @param  OutputString           Buffer to copy the string into\r
+\r
+  @return Returns the number of CHAR16 characters that were copied into the OutputString buffer.\r
+\r
+**/\r
+UINT16\r
+GetLineByWidth (\r
+  IN      CHAR16                      *InputString,\r
+  IN      UINT16                      LineWidth,\r
+  IN OUT  UINTN                       *Index,\r
+  OUT     CHAR16                      **OutputString\r
+  );\r
+\r
+/**\r
+  Get the supported width for a particular op-code\r
+\r
+  @param  Statement              The FORM_BROWSER_STATEMENT structure passed in.\r
+  @param  Handle                 The handle in the HII database being used\r
+\r
+  @return Returns the number of CHAR16 characters that is support.\r
+\r
+**/\r
+UINT16\r
+GetWidth (\r
+  IN FORM_BROWSER_STATEMENT        *Statement,\r
+  IN EFI_HII_HANDLE                 Handle\r
+  );\r
+\r
+/**\r
+  Concatenate a narrow string to another string.\r
+\r
+  @param Destination The destination string.\r
+  @param Source      The source string. The string to be concatenated.\r
+                     to the end of Destination.\r
+\r
+**/\r
+VOID\r
+NewStrCat (\r
+  IN OUT CHAR16               *Destination,\r
+  IN     CHAR16               *Source\r
+  );\r
+\r
+/**\r
+  Wait for a key to be pressed by user.\r
+\r
+  @param Key         The key which is pressed by user.\r
+\r
+  @retval EFI_SUCCESS The function always completed successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+WaitForKeyStroke (\r
+  OUT  EFI_INPUT_KEY           *Key\r
+  );\r
+\r
+/**\r
+  Reset stack pointer to begin of the stack.\r
+\r
+**/\r
+VOID\r
+ResetScopeStack (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Push an Operand onto the Stack\r
+\r
+  @param  Operand                Operand to push.\r
+\r
+  @retval EFI_SUCCESS            The value was pushed onto the stack.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enough system memory to grow the\r
+                                 stack.\r
+\r
+**/\r
+EFI_STATUS\r
+PushScope (\r
+  IN UINT8   Operand\r
+  );\r
+\r
+/**\r
+  Pop an Operand from the Stack\r
+\r
+  @param  Operand                Operand to pop.\r
+\r
+  @retval EFI_SUCCESS            The value was pushed onto the stack.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enough system memory to grow the\r
+                                 stack.\r
+\r
+**/\r
+EFI_STATUS\r
+PopScope (\r
+  OUT UINT8     *Operand\r
+  );\r
+\r
+/**\r
+  Reset stack pointer to begin of the stack.\r
+\r
+**/\r
+VOID\r
+ResetCurrentExpressionStack (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Push current expression onto the Stack\r
+\r
+  @param  Pointer                Pointer to current expression.\r
+\r
+  @retval EFI_SUCCESS            The value was pushed onto the stack.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enough system memory to grow the stack.\r
+\r
+**/\r
+EFI_STATUS\r
+PushCurrentExpression (\r
+  IN VOID  *Pointer\r
+  );\r
+\r
+/**\r
+  Pop current expression from the Stack\r
+\r
+  @param  Pointer                Pointer to current expression to be pop.\r
+\r
+  @retval EFI_SUCCESS            The value was pushed onto the stack.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enough system memory to grow the stack.\r
+\r
+**/\r
+EFI_STATUS\r
+PopCurrentExpression (\r
+  OUT VOID    **Pointer\r
+  );\r
+\r
+/**\r
+  Reset stack pointer to begin of the stack.\r
+\r
+**/\r
+VOID\r
+ResetMapExpressionListStack (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Push the list of map expression onto the Stack\r
+\r
+  @param  Pointer                Pointer to the list of map expression to be pushed.\r
+\r
+  @retval EFI_SUCCESS            The value was pushed onto the stack.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enough system memory to grow the stack.\r
+\r
+**/\r
+EFI_STATUS\r
+PushMapExpressionList (\r
+  IN VOID  *Pointer\r
+  );\r
+\r
+/**\r
+  Pop the list of map expression from the Stack\r
+\r
+  @param  Pointer                Pointer to the list of map expression to be pop.\r
+\r
+  @retval EFI_SUCCESS            The value was pushed onto the stack.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enough system memory to grow the stack.\r
+\r
+**/\r
+EFI_STATUS\r
+PopMapExpressionList (\r
+  OUT VOID    **Pointer\r
+  );\r
+\r
+/**\r
+  Get Form given its FormId.\r
+\r
+  @param  FormSet                The formset which contains this form.\r
+  @param  FormId                 Id of this form.\r
+\r
+  @retval Pointer                The form.\r
+  @retval NULL                   Specified Form is not found in the formset.\r
+\r
+**/\r
+FORM_BROWSER_FORM *\r
+IdToForm (\r
+  IN FORM_BROWSER_FORMSET  *FormSet,\r
+  IN UINT16                FormId\r
+  );\r
+\r
+/**\r
+  Search a Question in Formset scope using its QuestionId.\r
+\r
+  @param  FormSet                The formset which contains this form.\r
+  @param  Form                   The form which contains this Question.\r
+  @param  QuestionId             Id of this Question.\r
+\r
+  @retval Pointer                The Question.\r
+  @retval NULL                   Specified Question not found in the form.\r
+\r
+**/\r
+FORM_BROWSER_STATEMENT *\r
+IdToQuestion (\r
+  IN FORM_BROWSER_FORMSET  *FormSet,\r
+  IN FORM_BROWSER_FORM     *Form,\r
+  IN UINT16                QuestionId\r
+  );\r
+\r
+/**\r
+  Zero extend integer/boolean/date/time to UINT64 for comparing.\r
+\r
+  @param  Value                  HII Value to be converted.\r
+\r
+**/\r
+VOID\r
+ExtendValueToU64 (\r
+  IN  EFI_HII_VALUE   *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  HiiHandle              Only required for string compare.\r
+\r
+  @retval EFI_INVALID_PARAMETER  Could not perform comparation on two values.\r
+  @retval 0                      Two operators equeal.\r
+  @return Positive value if Value1 is greater than Value2.\r
+  @retval Negative value if Value1 is less than Value2.\r
+\r
+**/\r
+INTN\r
+CompareHiiValue (\r
+  IN  EFI_HII_VALUE   *Value1,\r
+  IN  EFI_HII_VALUE   *Value2,\r
+  IN  EFI_HII_HANDLE  HiiHandle OPTIONAL\r
+  );\r
+\r
+/**\r
+  Evaluate the result of a HII expression\r
+\r
+  If Expression is NULL, then ASSERT.\r
+\r
+  @param  FormSet                FormSet associated with this expression.\r
+  @param  Form                   Form associated with this expression.\r
+  @param  Expression             Expression to be evaluated.\r
+\r
+  @retval EFI_SUCCESS            The expression evaluated successfuly\r
+  @retval EFI_NOT_FOUND          The Question which referenced by a QuestionId\r
+                                 could not be found.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enough system memory to grow the\r
+                                 stack.\r
+  @retval EFI_ACCESS_DENIED      The pop operation underflowed the stack\r
+  @retval EFI_INVALID_PARAMETER  Syntax error with the Expression\r
+\r
+**/\r
+EFI_STATUS\r
+EvaluateExpression (\r
+  IN FORM_BROWSER_FORMSET  *FormSet,\r
+  IN FORM_BROWSER_FORM     *Form,\r
+  IN OUT FORM_EXPRESSION   *Expression\r
+  );\r
+\r
+#endif // _UI_H\r