]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
Enhance the browser parse opcode logic, skip the opcode which is not defined in UEFI...
[mirror_edk2.git] / MdeModulePkg / Universal / SetupBrowserDxe / Setup.h
index 99418543dfb581ad6ec52803cae455620edb5eef..cb3cc320bca4135f75ed0104431c32d6397b67a3 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Private MACRO, structure and function definitions for Setup Browser module.\r
 \r
-Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2014, 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
@@ -136,6 +136,9 @@ typedef struct {
 \r
   UINT8            Type;           // Storage type\r
 \r
+  BOOLEAN          Initialized;    // Whether this varstore is initialized, efi varstore not used.\r
+\r
+  EFI_HII_HANDLE   HiiHandle;      // HiiHandle for this varstore, efi varstore not used.\r
   EFI_GUID         Guid;\r
 \r
   CHAR16           *Name;          // For EFI_IFR_VARSTORE\r
@@ -151,7 +154,6 @@ typedef struct {
   CHAR16           *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement>\r
                                    // <RequestElement> includes all fields which is used by current form sets.\r
   UINTN            SpareStrLen;    // Spare length of ConfigRequest string buffer\r
-  UINT8            ReferenceCount; // How many form set storage refrence this storage.\r
 } BROWSER_STORAGE;\r
 \r
 #define BROWSER_STORAGE_FROM_LINK(a)  CR (a, BROWSER_STORAGE, Link, BROWSER_STORAGE_SIGNATURE)\r
@@ -167,7 +169,6 @@ typedef struct {
   BROWSER_STORAGE  *BrowserStorage;\r
 \r
   CHAR16           *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement>\r
-  CHAR16           *ConfigElements;// Elements need to load initial data.\r
   UINTN            ElementCount;   // Number of <RequestElement> in the <ConfigRequest>\r
   UINTN            SpareStrLen;    // Spare length of ConfigRequest string buffer\r
 } FORMSET_STORAGE;\r
@@ -226,6 +227,7 @@ typedef struct {
   EFI_HII_VALUE     Result;          // Expression evaluation result\r
 \r
   UINT8             TimeOut;         // For EFI_IFR_WARNING_IF\r
+  EFI_IFR_OP_HEADER *OpCode;         // Save the opcode buffer.\r
 \r
   LIST_ENTRY        OpCodeListHead;  // OpCodes consist of this expression (EXPRESSION_OPCODE)\r
 } FORM_EXPRESSION;\r
@@ -286,9 +288,11 @@ typedef enum {
   ExpressOption\r
 } EXPRESS_LEVEL;\r
 \r
+typedef struct _FORM_BROWSER_STATEMENT FORM_BROWSER_STATEMENT;\r
+\r
 #define FORM_BROWSER_STATEMENT_SIGNATURE  SIGNATURE_32 ('F', 'S', 'T', 'A')\r
 \r
-typedef struct {\r
+struct _FORM_BROWSER_STATEMENT{\r
   UINTN                 Signature;\r
   LIST_ENTRY            Link;\r
 \r
@@ -350,7 +354,8 @@ typedef struct {
 \r
   EFI_IMAGE_ID          ImageId;             // nested EFI_IFR_IMAGE\r
   UINT8                 RefreshInterval;     // nested EFI_IFR_REFRESH, refresh interval(in seconds) for Question value, 0 means no refresh\r
-  BOOLEAN               InSubtitle;          // nesting inside of EFI_IFR_SUBTITLE\r
+\r
+  FORM_BROWSER_STATEMENT *ParentStatement;\r
 \r
   LIST_ENTRY            InconsistentListHead;// nested inconsistent expression list (FORM_EXPRESSION)\r
   LIST_ENTRY            NoSubmitListHead;    // nested nosubmit expression list (FORM_EXPRESSION)\r
@@ -359,7 +364,7 @@ typedef struct {
 \r
   FORM_EXPRESSION       *ReadExpression;     // nested EFI_IFR_READ, provide this question value by read expression.\r
   FORM_EXPRESSION       *WriteExpression;    // nested EFI_IFR_WRITE, evaluate write expression after this question value is set.\r
-} FORM_BROWSER_STATEMENT;\r
+};\r
 \r
 #define FORM_BROWSER_STATEMENT_FROM_LINK(a)  CR (a, FORM_BROWSER_STATEMENT, Link, FORM_BROWSER_STATEMENT_SIGNATURE)\r
 \r
@@ -542,12 +547,12 @@ extern EDKII_FORM_DISPLAY_ENGINE_PROTOCOL *mFormDisplay;
 \r
 extern BOOLEAN               gResetRequired;\r
 extern BOOLEAN               gExitRequired;\r
-\r
 extern LIST_ENTRY            gBrowserFormSetList;\r
 extern LIST_ENTRY            gBrowserHotKeyList;\r
 extern BROWSER_SETTING_SCOPE gBrowserSettingScope;\r
 extern EXIT_HANDLER          ExitHandlerFunction;\r
 extern EFI_HII_HANDLE        mCurrentHiiHandle;\r
+extern SETUP_DRIVER_PRIVATE_DATA mPrivateData;\r
 //\r
 // Browser Global Strings\r
 //\r
@@ -706,6 +711,35 @@ IsQuestionValueChanged (
   IN GET_SET_QUESTION_VALUE_WITH      GetValueFrom\r
   );\r
 \r
+/**\r
+  Validate the FormSet. If the formset is not validate, remove it from the list.\r
+\r
+  @param  FormSet                The input FormSet which need to validate.\r
+\r
+  @retval TRUE                   The handle is validate.\r
+  @retval FALSE                  The handle is invalidate.\r
+\r
+**/\r
+BOOLEAN\r
+ValidateFormSet (\r
+  FORM_BROWSER_FORMSET    *FormSet\r
+  );\r
+\r
+/**\r
+  Update the ValueChanged status for questions.\r
+\r
+  @param  FormSet                FormSet data structure.\r
+  @param  Form                   Form data structure.\r
+  @param  SettingScope           Setting Scope for Default action.\r
+\r
+**/\r
+VOID \r
+UpdateStatementStatus (\r
+  IN FORM_BROWSER_FORMSET             *FormSet,\r
+  IN FORM_BROWSER_FORM                *Form, \r
+  IN BROWSER_SETTING_SCOPE            SettingScope\r
+  );\r
+\r
 /**\r
   Get Question's current Value.\r
 \r
@@ -1137,19 +1171,6 @@ IsNvUpdateRequiredForFormSet (
   IN FORM_BROWSER_FORMSET  *FormSet\r
   );\r
 \r
-/**\r
-  Check whether the storage data for current form set is changed.\r
-\r
-  @param  FormSet           FormSet data structure.\r
-\r
-  @retval TRUE              Data is changed.\r
-  @retval FALSE             Data is not changed.\r
-**/\r
-BOOLEAN \r
-IsStorageDataChangedForFormSet (\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
@@ -1157,7 +1178,9 @@ IsStorageDataChangedForFormSet (
                                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 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
@@ -1167,6 +1190,8 @@ IsStorageDataChangedForFormSet (
 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
@@ -1180,6 +1205,7 @@ ProcessCallBackFunction (
 \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 excutes successfully.\r
   @return Other value if the call back function failed to excute.  \r
@@ -1187,7 +1213,8 @@ ProcessCallBackFunction (
 EFI_STATUS \r
 ProcessRetrieveForQuestion (\r
   IN     EFI_HII_CONFIG_ACCESS_PROTOCOL  *ConfigAccess,\r
-  IN     FORM_BROWSER_STATEMENT          *Statement\r
+  IN     FORM_BROWSER_STATEMENT          *Statement,\r
+  IN     FORM_BROWSER_FORMSET            *FormSet\r
   );\r
 \r
 /**\r
@@ -1317,6 +1344,7 @@ ExecuteAction (
   @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
@@ -1609,5 +1637,78 @@ VOID
 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      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
+VOID\r
+PopupErrorMessage (\r
+  IN UINT32                BrowserStatus,\r
+  IN EFI_IFR_OP_HEADER     *OpCode, OPTIONAL\r
+  IN CHAR16                *ErrorString\r
+  );\r
+\r
 #endif\r