1 /** @file
2 Private MACRO, structure and function definitions for Setup Browser module.
3 
4 Copyright (c) 2007 - 2015, 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
9 
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.
12 
13 
14 **/
15 
16 #ifndef _SETUP_H_
17 #define _SETUP_H_
18 
19 
20 #include <PiDxe.h>
21 
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>
36 
37 #include <Guid/MdeModuleHii.h>
38 #include <Guid/HiiPlatformSetupFormset.h>
39 #include <Guid/HiiFormMapMethodGuid.h>
40 #include <Guid/ZeroGuid.h>
41 
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>
54 
55 
56 //
57 // This is the generated header file which includes whatever needs to be exported (strings + IFR)
58 //
59 
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
64 
65 //
66 //
67 // Time definitions
68 //
69 #define ONE_SECOND  10000000
70 
71 // Incremental string lenght of ConfigRequest
72 //
73 #define CONFIG_REQUEST_STRING_INCREMENTAL  1024
74 
75 //
76 // Incremental size of stack for expression
77 //
78 #define EXPRESSION_STACK_SIZE_INCREMENT    0x100
79 
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))
81 
82 
83 #define SETUP_DRIVER_SIGNATURE SIGNATURE_32 ('F', 'B', 'D', 'V')
84 typedef struct {
85   UINT32                             Signature;
86 
87   EFI_HANDLE                         Handle;
88 
89   //
90   // Produced protocol
91   //
92   EFI_FORM_BROWSER2_PROTOCOL            FormBrowser2;
93   EFI_FORM_BROWSER_EXTENSION_PROTOCOL   FormBrowserEx;
94 
95   EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL FormBrowserEx2;
96 
97 } SETUP_DRIVER_PRIVATE_DATA;
98 
99 //
100 // IFR relative definition
101 //
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
112 
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.
117 
118 #define FORM_INCONSISTENT_VALIDATION         0
119 #define FORM_NO_SUBMIT_VALIDATION            1
120 
121 #define NAME_VALUE_NODE_SIGNATURE  SIGNATURE_32 ('N', 'V', 'S', 'T')
122 
123 typedef struct {
124   UINTN            Signature;
125   LIST_ENTRY       Link;
126   CHAR16           *Name;
127   CHAR16           *Value;
128   CHAR16           *EditValue;
129 } NAME_VALUE_NODE;
130 
131 #define NAME_VALUE_NODE_FROM_LINK(a)  CR (a, NAME_VALUE_NODE, Link, NAME_VALUE_NODE_SIGNATURE)
132 
133 #define BROWSER_STORAGE_SIGNATURE  SIGNATURE_32 ('B', 'S', 'T', 'G')
134 
135 typedef struct {
136   UINTN            Signature;
137   LIST_ENTRY       Link;
138 
139   UINT8            Type;           // Storage type
140 
141   BOOLEAN          Initialized;    // Whether this varstore is initialized, efi varstore not used.
142 
143   EFI_HII_HANDLE   HiiHandle;      // HiiHandle for this varstore, efi varstore not used.
144   EFI_GUID         Guid;
145 
146   CHAR16           *Name;          // For EFI_IFR_VARSTORE
147   UINT16           Size;
148   UINT8            *Buffer;
149   UINT8            *EditBuffer;    // Edit copy for Buffer Storage
150 
151   LIST_ENTRY       NameValueListHead; // List of NAME_VALUE_NODE
152 
153   UINT32           Attributes;     // For EFI_IFR_VARSTORE_EFI: EFI Variable attribute
154 
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
158 } BROWSER_STORAGE;
159 
160 #define BROWSER_STORAGE_FROM_LINK(a)  CR (a, BROWSER_STORAGE, Link, BROWSER_STORAGE_SIGNATURE)
161 
162 #define FORMSET_STORAGE_SIGNATURE  SIGNATURE_32 ('F', 'S', 'T', 'G')
163 
164 typedef struct {
165   UINTN            Signature;
166   LIST_ENTRY       Link;
167 
168   LIST_ENTRY       SaveFailLink;
169 
170   UINT16           VarStoreId;
171 
172   BROWSER_STORAGE  *BrowserStorage;
173 
174   CHAR16           *ConfigHdr;     // <ConfigHdr>
175 
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 } FORMSET_STORAGE;
182 
183 #define FORMSET_STORAGE_FROM_LINK(a)  CR (a, FORMSET_STORAGE, Link, FORMSET_STORAGE_SIGNATURE)
184 #define FORMSET_STORAGE_FROM_SAVE_FAIL_LINK(a)  CR (a, FORMSET_STORAGE, SaveFailLink, FORMSET_STORAGE_SIGNATURE)
185 
186 typedef union {
187   EFI_STRING_ID         VarName;
188   UINT16                VarOffset;
189 } VAR_STORE_INFO;
190 
191 #define EXPRESSION_OPCODE_SIGNATURE  SIGNATURE_32 ('E', 'X', 'O', 'P')
192 
193 typedef struct {
194   UINTN             Signature;
195   LIST_ENTRY        Link;
196 
197   UINT8             Operand;
198 
199   UINT8             Format;      // For EFI_IFR_TO_STRING, EFI_IFR_FIND
200   UINT8             Flags;       // For EFI_IFR_SPAN
201   UINT8             RuleId;      // For EFI_IFR_RULE_REF
202 
203   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
204 
205   EFI_QUESTION_ID   QuestionId;  // For EFI_IFR_EQ_ID_ID, EFI_IFR_EQ_ID_VAL_LIST, EFI_IFR_QUESTION_REF1
206   EFI_QUESTION_ID   QuestionId2;
207 
208   UINT16            ListLength;  // For EFI_IFR_EQ_ID_VAL_LIST
209   UINT16            *ValueList;
210 
211   EFI_STRING_ID     DevicePath;  // For EFI_IFR_QUESTION_REF3_2, EFI_IFR_QUESTION_REF3_3
212   EFI_GUID          Guid;
213 
214   BROWSER_STORAGE   *VarStorage; // For EFI_IFR_SET, EFI_IFR_GET
215   VAR_STORE_INFO    VarStoreInfo;// For EFI_IFR_SET, EFI_IFR_GET
216   UINT8             ValueType;   // For EFI_IFR_SET, EFI_IFR_GET
217   UINT8             ValueWidth;  // For EFI_IFR_SET, EFI_IFR_GET
218   CHAR16            *ValueName;  // For EFI_IFR_SET, EFI_IFR_GET
219   LIST_ENTRY        MapExpressionList;   // nested expressions inside of Map opcode.
220 } EXPRESSION_OPCODE;
221 
222 #define EXPRESSION_OPCODE_FROM_LINK(a)  CR (a, EXPRESSION_OPCODE, Link, EXPRESSION_OPCODE_SIGNATURE)
223 
224 #define FORM_EXPRESSION_SIGNATURE  SIGNATURE_32 ('F', 'E', 'X', 'P')
225 
226 typedef struct {
227   UINTN             Signature;
228   LIST_ENTRY        Link;
229 
230   UINT8             Type;            // Type for this expression
231 
232   UINT8             RuleId;          // For EFI_IFR_RULE only
233   EFI_STRING_ID     Error;           // For EFI_IFR_NO_SUBMIT_IF, EFI_IFR_INCONSISTENT_IF only
234 
235   EFI_HII_VALUE     Result;          // Expression evaluation result
236 
237   UINT8             TimeOut;         // For EFI_IFR_WARNING_IF
238   EFI_IFR_OP_HEADER *OpCode;         // Save the opcode buffer.
239 
240   LIST_ENTRY        OpCodeListHead;  // OpCodes consist of this expression (EXPRESSION_OPCODE)
241 } FORM_EXPRESSION;
242 
243 #define FORM_EXPRESSION_FROM_LINK(a)  CR (a, FORM_EXPRESSION, Link, FORM_EXPRESSION_SIGNATURE)
244 
245 #define FORM_EXPRESSION_LIST_SIGNATURE  SIGNATURE_32 ('F', 'E', 'X', 'R')
246 
247 typedef struct {
248     UINTN               Signature;
249     UINTN               Count;
250     FORM_EXPRESSION    *Expression[1];   // Array[Count] of expressions
251 } FORM_EXPRESSION_LIST;
252 
253 #define QUESTION_DEFAULT_SIGNATURE  SIGNATURE_32 ('Q', 'D', 'F', 'T')
254 
255 typedef struct {
256   UINTN               Signature;
257   LIST_ENTRY          Link;
258 
259   UINT16              DefaultId;
260   EFI_HII_VALUE       Value;              // Default value
261 
262   FORM_EXPRESSION     *ValueExpression;   // Not-NULL indicates default value is provided by EFI_IFR_VALUE
263 } QUESTION_DEFAULT;
264 
265 #define QUESTION_DEFAULT_FROM_LINK(a)  CR (a, QUESTION_DEFAULT, Link, QUESTION_DEFAULT_SIGNATURE)
266 
267 #define QUESTION_OPTION_SIGNATURE  SIGNATURE_32 ('Q', 'O', 'P', 'T')
268 
269 typedef struct {
270   UINTN                Signature;
271   LIST_ENTRY           Link;
272 
273   EFI_IFR_ONE_OF_OPTION  *OpCode;   // OneOfOption Data
274 
275   EFI_STRING_ID        Text;
276   UINT8                Flags;
277   EFI_HII_VALUE        Value;
278   EFI_IMAGE_ID         ImageId;
279 
280   FORM_EXPRESSION_LIST *SuppressExpression; // Non-NULL indicates nested inside of SuppressIf
281 } QUESTION_OPTION;
282 
283 #define QUESTION_OPTION_FROM_LINK(a)  CR (a, QUESTION_OPTION, Link, QUESTION_OPTION_SIGNATURE)
284 
285 typedef enum {
286   ExpressFalse = 0,
287   ExpressGrayOut,
288   ExpressSuppress,
289   ExpressDisable
290 } EXPRESS_RESULT;
291 
292 typedef enum {
293   ExpressNone = 0,
294   ExpressForm,
295   ExpressStatement,
296   ExpressOption
297 } EXPRESS_LEVEL;
298 
299 typedef struct _FORM_BROWSER_STATEMENT FORM_BROWSER_STATEMENT;
300 
301 #define FORM_BROWSER_STATEMENT_SIGNATURE  SIGNATURE_32 ('F', 'S', 'T', 'A')
302 
303 struct _FORM_BROWSER_STATEMENT{
304   UINTN                 Signature;
305   LIST_ENTRY            Link;
306 
307   UINT8                 Operand;          // The operand (first byte) of this Statement or Question
308   EFI_IFR_OP_HEADER     *OpCode;
309 
310   //
311   // Statement Header
312   //
313   EFI_STRING_ID         Prompt;
314   EFI_STRING_ID         Help;
315   EFI_STRING_ID         TextTwo;          // For EFI_IFR_TEXT
316 
317   //
318   // Fake Question Id, used for statement not has true QuestionId.
319   //
320   EFI_QUESTION_ID       FakeQuestionId;
321 
322   //
323   // Question Header
324   //
325   EFI_QUESTION_ID       QuestionId;       // The value of zero is reserved
326   EFI_VARSTORE_ID       VarStoreId;       // A value of zero indicates no variable storage
327   BROWSER_STORAGE       *Storage;
328   VAR_STORE_INFO        VarStoreInfo;
329   UINT16                StorageWidth;
330   UINT8                 QuestionFlags;
331   CHAR16                *VariableName;    // Name/Value or EFI Variable name
332   CHAR16                *BlockName;       // Buffer storage block name: "OFFSET=...WIDTH=..."
333 
334   EFI_HII_VALUE         HiiValue;         // Edit copy for checkbox, numberic, oneof
335   UINT8                 *BufferValue;     // Edit copy for string, password, orderedlist
336   UINT8                 ValueType;        // Data type for orderedlist value array
337 
338   //
339   // OpCode specific members
340   //
341   UINT8                 Flags;            // for EFI_IFR_CHECKBOX, EFI_IFR_DATE, EFI_IFR_NUMERIC, EFI_IFR_ONE_OF,
342                                           // EFI_IFR_ORDERED_LIST, EFI_IFR_STRING,EFI_IFR_SUBTITLE,EFI_IFR_TIME, EFI_IFR_BANNER
343   UINT8                 MaxContainers;    // for EFI_IFR_ORDERED_LIST
344 
345   UINT16                BannerLineNumber; // for EFI_IFR_BANNER, 1-based line number
346   EFI_STRING_ID         QuestionConfig;   // for EFI_IFR_ACTION, if 0 then no configuration string will be processed
347 
348   UINT64                Minimum;          // for EFI_IFR_ONE_OF/EFI_IFR_NUMERIC, it's Min/Max value
349   UINT64                Maximum;          // for EFI_IFR_STRING/EFI_IFR_PASSWORD, it's Min/Max length
350   UINT64                Step;
351 
352   EFI_DEFAULT_ID        DefaultId;        // for EFI_IFR_RESET_BUTTON
353   EFI_GUID              RefreshGuid;      // for EFI_IFR_REFRESH_ID
354   BOOLEAN               Locked;           // Whether this statement is locked.
355   BOOLEAN               ValueChanged;     // Whether this statement's value is changed.
356   //
357   // Get from IFR parsing
358   //
359   FORM_EXPRESSION       *ValueExpression;    // nested EFI_IFR_VALUE, provide Question value and indicate Question is ReadOnly
360   LIST_ENTRY            DefaultListHead;     // nested EFI_IFR_DEFAULT list (QUESTION_DEFAULT), provide default values
361   LIST_ENTRY            OptionListHead;      // nested EFI_IFR_ONE_OF_OPTION list (QUESTION_OPTION)
362 
363   EFI_IMAGE_ID          ImageId;             // nested EFI_IFR_IMAGE
364   UINT8                 RefreshInterval;     // nested EFI_IFR_REFRESH, refresh interval(in seconds) for Question value, 0 means no refresh
365 
366   FORM_BROWSER_STATEMENT *ParentStatement;
367 
368   LIST_ENTRY            InconsistentListHead;// nested inconsistent expression list (FORM_EXPRESSION)
369   LIST_ENTRY            NoSubmitListHead;    // nested nosubmit expression list (FORM_EXPRESSION)
370   LIST_ENTRY            WarningListHead;     // nested warning expression list (FORM_EXPRESSION)
371   FORM_EXPRESSION_LIST  *Expression;         // nesting inside of GrayOutIf/DisableIf/SuppressIf
372 
373   FORM_EXPRESSION       *ReadExpression;     // nested EFI_IFR_READ, provide this question value by read expression.
374   FORM_EXPRESSION       *WriteExpression;    // nested EFI_IFR_WRITE, evaluate write expression after this question value is set.
375 };
376 
377 #define FORM_BROWSER_STATEMENT_FROM_LINK(a)  CR (a, FORM_BROWSER_STATEMENT, Link, FORM_BROWSER_STATEMENT_SIGNATURE)
378 
379 #define FORM_BROWSER_CONFIG_REQUEST_SIGNATURE  SIGNATURE_32 ('F', 'C', 'R', 'S')
380 typedef struct {
381   UINTN                 Signature;
382   LIST_ENTRY            Link;
383 
384   LIST_ENTRY            SaveFailLink;
385 
386   CHAR16                *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
387   CHAR16                *ConfigAltResp; // Alt config response string for this ConfigRequest.
388   UINTN                 ElementCount;   // Number of <RequestElement> in the <ConfigRequest>
389   UINTN                 SpareStrLen;
390 
391   BROWSER_STORAGE       *Storage;
392 } FORM_BROWSER_CONFIG_REQUEST;
393 #define FORM_BROWSER_CONFIG_REQUEST_FROM_LINK(a)  CR (a, FORM_BROWSER_CONFIG_REQUEST, Link, FORM_BROWSER_CONFIG_REQUEST_SIGNATURE)
394 #define FORM_BROWSER_CONFIG_REQUEST_FROM_SAVE_FAIL_LINK(a)  CR (a, FORM_BROWSER_CONFIG_REQUEST, SaveFailLink, FORM_BROWSER_CONFIG_REQUEST_SIGNATURE)
395 
396 #define FORM_BROWSER_FORM_SIGNATURE  SIGNATURE_32 ('F', 'F', 'R', 'M')
397 #define STANDARD_MAP_FORM_TYPE 0x01
398 
399 typedef struct {
400   UINTN                Signature;
401   LIST_ENTRY           Link;
402 
403   UINT16               FormId;               // FormId of normal form or formmap form.
404   EFI_STRING_ID        FormTitle;            // FormTile of normal form, or FormMapMethod title of formmap form.
405   UINT16               FormType;             // Specific form type for the different form.
406 
407   EFI_IMAGE_ID         ImageId;
408 
409   BOOLEAN              ModalForm;            // Whether this is a modal form.
410   BOOLEAN              Locked;               // Whether this form is locked.
411   EFI_GUID             RefreshGuid;          // Form refresh event guid.
412 
413   LIST_ENTRY           FormViewListHead;     // List of type FORMID_INFO is Browser View Form History List.
414   LIST_ENTRY           ExpressionListHead;   // List of Expressions (FORM_EXPRESSION)
415   LIST_ENTRY           StatementListHead;    // List of Statements and Questions (FORM_BROWSER_STATEMENT)
416   LIST_ENTRY           ConfigRequestHead;    // List of configreques for all storage.
417   FORM_EXPRESSION_LIST *SuppressExpression;  // nesting inside of SuppressIf
418 } FORM_BROWSER_FORM;
419 
420 #define FORM_BROWSER_FORM_FROM_LINK(a)  CR (a, FORM_BROWSER_FORM, Link, FORM_BROWSER_FORM_SIGNATURE)
421 
422 #define FORMSET_DEFAULTSTORE_SIGNATURE  SIGNATURE_32 ('F', 'D', 'F', 'S')
423 
424 typedef struct {
425   UINTN            Signature;
426   LIST_ENTRY       Link;
427 
428   UINT16           DefaultId;
429   EFI_STRING_ID    DefaultName;
430 } FORMSET_DEFAULTSTORE;
431 
432 #define FORMSET_DEFAULTSTORE_FROM_LINK(a)  CR (a, FORMSET_DEFAULTSTORE, Link, FORMSET_DEFAULTSTORE_SIGNATURE)
433 
434 #define FORM_BROWSER_FORMSET_SIGNATURE  SIGNATURE_32 ('F', 'B', 'F', 'S')
435 
436 typedef struct {
437   UINTN                           Signature;
438   LIST_ENTRY                      Link;
439   LIST_ENTRY                      SaveFailLink;
440 
441   EFI_HII_HANDLE                  HiiHandle;      // unique id for formset.
442   EFI_HANDLE                      DriverHandle;
443   EFI_HII_CONFIG_ACCESS_PROTOCOL  *ConfigAccess;
444   EFI_DEVICE_PATH_PROTOCOL        *DevicePath;
445 
446   UINTN                           IfrBinaryLength;
447   UINT8                           *IfrBinaryData;
448 
449   BOOLEAN                         QuestionInited;   // Have finished question initilization?
450   EFI_GUID                        Guid;
451   EFI_STRING_ID                   FormSetTitle;
452   EFI_STRING_ID                   Help;
453   UINT8                           NumberOfClassGuid;
454   EFI_GUID                        ClassGuid[3];         // Up to three ClassGuid
455   UINT16                          Class;                // Tiano extended Class code
456   UINT16                          SubClass;             // Tiano extended Subclass code
457   EFI_IMAGE_ID                    ImageId;
458   EFI_IFR_OP_HEADER               *OpCode;              //mainly for formset op to get ClassGuid
459 
460   FORM_BROWSER_STATEMENT          *StatementBuffer;     // Buffer for all Statements and Questions
461   EXPRESSION_OPCODE               *ExpressionBuffer;    // Buffer for all Expression OpCode
462   FORM_BROWSER_FORM               *SaveFailForm;        // The form which failed to save.
463   FORM_BROWSER_STATEMENT          *SaveFailStatement;   // The Statement which failed to save.
464 
465   LIST_ENTRY                      StatementListOSF;     // Statement list out side of the form.
466   LIST_ENTRY                      StorageListHead;      // Storage list (FORMSET_STORAGE)
467   LIST_ENTRY                      SaveFailStorageListHead; // Storage list for the save fail storage.
468   LIST_ENTRY                      DefaultStoreListHead; // DefaultStore list (FORMSET_DEFAULTSTORE)
469   LIST_ENTRY                      FormListHead;         // Form list (FORM_BROWSER_FORM)
470   LIST_ENTRY                      ExpressionListHead;   // List of Expressions (FORM_EXPRESSION)
471 } FORM_BROWSER_FORMSET;
472 #define FORM_BROWSER_FORMSET_FROM_LINK(a)  CR (a, FORM_BROWSER_FORMSET, Link, FORM_BROWSER_FORMSET_SIGNATURE)
473 
474 #define FORM_BROWSER_FORMSET_FROM_SAVE_FAIL_LINK(a)  CR (a, FORM_BROWSER_FORMSET, SaveFailLink, FORM_BROWSER_FORMSET_SIGNATURE)
475 
476 typedef struct {
477   LIST_ENTRY   Link;
478   EFI_EVENT    RefreshEvent;
479 } FORM_BROWSER_REFRESH_EVENT_NODE;
480 
481 #define FORM_BROWSER_REFRESH_EVENT_FROM_LINK(a) BASE_CR (a, FORM_BROWSER_REFRESH_EVENT_NODE, Link)
482 
483 
484 typedef struct {
485   EFI_HII_HANDLE  Handle;
486 
487   //
488   // Target formset/form/Question information
489   //
490   EFI_GUID        FormSetGuid;
491   UINT16          FormId;
492   UINT16          QuestionId;
493   UINTN           Sequence;  // used for time/date only.
494 
495   UINTN           TopRow;
496   UINTN           BottomRow;
497   UINTN           PromptCol;
498   UINTN           OptionCol;
499   UINTN           CurrentRow;
500 
501   //
502   // Ation for Browser to taken:
503   //   UI_ACTION_NONE            - navigation inside a form
504   //   UI_ACTION_REFRESH_FORM    - re-evaluate expressions and repaint form
505   //   UI_ACTION_REFRESH_FORMSET - re-parse formset IFR binary
506   //
507   UINTN           Action;
508 
509   //
510   // Current selected fomset/form/Question
511   //
512   FORM_BROWSER_FORMSET    *FormSet;
513   FORM_BROWSER_FORM       *Form;
514   FORM_BROWSER_STATEMENT  *Statement;
515 
516   //
517   // Whether the Form is editable
518   //
519   BOOLEAN                 FormEditable;
520 
521   FORM_ENTRY_INFO            *CurrentMenu;
522 } UI_MENU_SELECTION;
523 
524 #define BROWSER_CONTEXT_SIGNATURE  SIGNATURE_32 ('B', 'C', 'T', 'X')
525 
526 typedef struct {
527   UINTN                 Signature;
528   LIST_ENTRY            Link;
529 
530   //
531   // Globals defined in Setup.c
532   //
533   BOOLEAN                  FlagReconnect;
534   BOOLEAN                  CallbackReconnect;
535   BOOLEAN                  ResetRequired;
536   BOOLEAN                  ExitRequired;
537   EFI_HII_HANDLE           HiiHandle;
538   EFI_GUID                 FormSetGuid;
539   EFI_FORM_ID              FormId;
540   UI_MENU_SELECTION        *Selection;
541   FORM_BROWSER_FORMSET     *SystemLevelFormSet;
542   EFI_QUESTION_ID          CurFakeQestId;
543   BOOLEAN                  HiiPackageListUpdated;
544   BOOLEAN                  FinishRetrieveCall;
545   LIST_ENTRY               FormHistoryList;
546   LIST_ENTRY               FormSetList;
547 } BROWSER_CONTEXT;
548 
549 #define BROWSER_CONTEXT_FROM_LINK(a)  CR (a, BROWSER_CONTEXT, Link, BROWSER_CONTEXT_SIGNATURE)
550 
551 //
552 // Scope for get defaut value. It may be GetDefaultForNoStorage, GetDefaultForStorage or GetDefaultForAll.
553 //
554 typedef enum {
555   GetDefaultForNoStorage,       // Get default value for question which not has storage.
556   GetDefaultForStorage,         // Get default value for question which has storage.
557   GetDefaultForAll,             // Get default value for all questions.
558   GetDefaultForMax              // Invalid value.
559 } BROWSER_GET_DEFAULT_VALUE;
560 
561 //
562 // Get/set question value from/to.
563 //
564 typedef enum {
565   GetSetValueWithEditBuffer = 0,   // Get/Set question value from/to editbuffer in the storage.
566   GetSetValueWithBuffer,           // Get/Set question value from/to buffer in the storage.
567   GetSetValueWithHiiDriver,        // Get/Set question value from/to hii driver.
568   GetSetValueWithBothBuffer,       // Compare the editbuffer with buffer for this question, not use the question value.
569   GetSetValueWithMax               // Invalid value.
570 } GET_SET_QUESTION_VALUE_WITH;
571 
572 extern EFI_HII_DATABASE_PROTOCOL         *mHiiDatabase;
573 extern EFI_HII_CONFIG_ROUTING_PROTOCOL   *mHiiConfigRouting;
574 extern EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mPathFromText;
575 extern EDKII_FORM_DISPLAY_ENGINE_PROTOCOL *mFormDisplay;
576 
577 extern BOOLEAN               gCallbackReconnect;
578 extern BOOLEAN               gFlagReconnect;
579 extern BOOLEAN               gResetRequired;
580 extern BOOLEAN               gExitRequired;
581 extern LIST_ENTRY            gBrowserFormSetList;
582 extern LIST_ENTRY            gBrowserHotKeyList;
583 extern BROWSER_SETTING_SCOPE gBrowserSettingScope;
584 extern EXIT_HANDLER          ExitHandlerFunction;
585 extern EFI_HII_HANDLE        mCurrentHiiHandle;
586 extern SETUP_DRIVER_PRIVATE_DATA mPrivateData;
587 //
588 // Browser Global Strings
589 //
590 extern CHAR16            *gEmptyString;
591 
592 extern UI_MENU_SELECTION  *gCurrentSelection;
593 extern BOOLEAN            mHiiPackageListUpdated;
594 extern UINT16             mCurFakeQestId;
595 extern BOOLEAN            mFinishRetrieveCall;
596 
597 //
598 // Global Procedure Defines
599 //
600 #include "Expression.h"
601 
602 /**
603   Initialize the HII String Token to the correct values.
604 
605 **/
606 VOID
607 InitializeBrowserStrings (
608   VOID
609   );
610 
611 /**
612   Parse opcodes in the formset IFR binary.
613 
614   @param  FormSet                Pointer of the FormSet data structure.
615 
616   @retval EFI_SUCCESS            Opcode parse success.
617   @retval Other                  Opcode parse fail.
618 
619 **/
620 EFI_STATUS
621 ParseOpCodes (
622   IN FORM_BROWSER_FORMSET              *FormSet
623   );
624 
625 /**
626   Free resources allocated for a FormSet.
627 
628   @param  FormSet                Pointer of the FormSet
629 
630 **/
631 VOID
632 DestroyFormSet (
633   IN OUT FORM_BROWSER_FORMSET  *FormSet
634   );
635 
636 
637 /**
638   Create a new string in HII Package List.
639 
640   @param  String                 The String to be added
641   @param  HiiHandle              The package list in the HII database to insert the
642                                  specified string.
643 
644   @return The output string.
645 
646 **/
647 EFI_STRING_ID
648 NewString (
649   IN  CHAR16                   *String,
650   IN  EFI_HII_HANDLE           HiiHandle
651   );
652 
653 /**
654   Delete a string from HII Package List.
655 
656   @param  StringId               Id of the string in HII database.
657   @param  HiiHandle              The HII package list handle.
658 
659   @retval EFI_SUCCESS            The string was deleted successfully.
660 
661 **/
662 EFI_STATUS
663 DeleteString (
664   IN  EFI_STRING_ID            StringId,
665   IN  EFI_HII_HANDLE           HiiHandle
666   );
667 
668 /**
669   Get the string based on the StringId and HII Package List Handle.
670 
671   @param  Token                  The String's ID.
672   @param  HiiHandle              The package list in the HII database to search for
673                                  the specified string.
674 
675   @return The output string.
676 
677 **/
678 CHAR16 *
679 GetToken (
680   IN  EFI_STRING_ID                Token,
681   IN  EFI_HII_HANDLE               HiiHandle
682   );
683 
684 /**
685   Get Value for given Name from a NameValue Storage.
686 
687   @param  Storage                The NameValue Storage.
688   @param  Name                   The Name.
689   @param  Value                  The retured Value.
690   @param  GetValueFrom           Where to get source value, from EditValue or Value.
691 
692   @retval EFI_SUCCESS            Value found for given Name.
693   @retval EFI_NOT_FOUND          No such Name found in NameValue storage.
694 
695 **/
696 EFI_STATUS
697 GetValueByName (
698   IN BROWSER_STORAGE             *Storage,
699   IN CHAR16                      *Name,
700   IN OUT CHAR16                  **Value,
701   IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
702   );
703 
704 /**
705   Set Value of given Name in a NameValue Storage.
706 
707   @param  Storage                The NameValue Storage.
708   @param  Name                   The Name.
709   @param  Value                  The Value to set.
710   @param  SetValueTo             Whether update editValue or Value.
711   @param  ReturnNode             The node use the input name.
712 
713   @retval EFI_SUCCESS            Value found for given Name.
714   @retval EFI_NOT_FOUND          No such Name found in NameValue storage.
715 
716 **/
717 EFI_STATUS
718 SetValueByName (
719   IN  BROWSER_STORAGE             *Storage,
720   IN  CHAR16                      *Name,
721   IN  CHAR16                      *Value,
722   IN  GET_SET_QUESTION_VALUE_WITH SetValueTo,
723   OUT NAME_VALUE_NODE             **ReturnNode
724   );
725 
726 /**
727   Validate whether this question's value has changed.
728 
729   @param  FormSet                FormSet data structure.
730   @param  Form                   Form data structure.
731   @param  Question               Question to be initialized.
732   @param  GetValueFrom           Where to get value, may from editbuffer, buffer or hii driver.
733 
734   @retval TRUE                   Question's value has changed.
735   @retval FALSE                  Question's value has not changed
736 
737 **/
738 BOOLEAN
739 IsQuestionValueChanged (
740   IN FORM_BROWSER_FORMSET             *FormSet,
741   IN FORM_BROWSER_FORM                *Form,
742   IN OUT FORM_BROWSER_STATEMENT       *Question,
743   IN GET_SET_QUESTION_VALUE_WITH      GetValueFrom
744   );
745 
746 /**
747   Validate the FormSet. If the formset is not validate, remove it from the list.
748 
749   @param  FormSet                The input FormSet which need to validate.
750 
751   @retval TRUE                   The handle is validate.
752   @retval FALSE                  The handle is invalidate.
753 
754 **/
755 BOOLEAN
756 ValidateFormSet (
757   FORM_BROWSER_FORMSET    *FormSet
758   );
759 
760 /**
761   Update the ValueChanged status for questions.
762 
763   @param  FormSet                FormSet data structure.
764   @param  Form                   Form data structure.
765   @param  SettingScope           Setting Scope for Default action.
766 
767 **/
768 VOID
769 UpdateStatementStatus (
770   IN FORM_BROWSER_FORMSET             *FormSet,
771   IN FORM_BROWSER_FORM                *Form,
772   IN BROWSER_SETTING_SCOPE            SettingScope
773   );
774 
775 /**
776   Get Question's current Value.
777 
778   @param  FormSet                FormSet data structure.
779   @param  Form                   Form data structure.
780   @param  Question               Question to be initialized.
781   @param  GetValueFrom           Where to get value, may from editbuffer, buffer or hii driver.
782 
783   @retval EFI_SUCCESS            The function completed successfully.
784 
785 **/
786 EFI_STATUS
787 GetQuestionValue (
788   IN FORM_BROWSER_FORMSET             *FormSet,
789   IN FORM_BROWSER_FORM                *Form,
790   IN OUT FORM_BROWSER_STATEMENT       *Question,
791   IN GET_SET_QUESTION_VALUE_WITH      GetValueFrom
792   );
793 
794 /**
795   Save Question Value to edit copy(cached) or Storage(uncached).
796 
797   @param  FormSet                FormSet data structure.
798   @param  Form                   Form data structure.
799   @param  Question               Pointer to the Question.
800   @param  SetValueTo             Update the question value to editbuffer , buffer or hii driver.
801 
802   @retval EFI_SUCCESS            The function completed successfully.
803 
804 **/
805 EFI_STATUS
806 SetQuestionValue (
807   IN FORM_BROWSER_FORMSET             *FormSet,
808   IN FORM_BROWSER_FORM                *Form,
809   IN OUT FORM_BROWSER_STATEMENT       *Question,
810   IN GET_SET_QUESTION_VALUE_WITH      SetValueTo
811   );
812 
813 /**
814   Perform inconsistent check for a Form.
815 
816   @param  FormSet                FormSet data structure.
817   @param  Form                   Form data structure.
818   @param  Question               The Question to be validated.
819   @param  Type                   Validation type: InConsistent or NoSubmit
820 
821   @retval EFI_SUCCESS            Form validation pass.
822   @retval other                  Form validation failed.
823 
824 **/
825 EFI_STATUS
826 ValidateQuestion (
827   IN  FORM_BROWSER_FORMSET            *FormSet,
828   IN  FORM_BROWSER_FORM               *Form,
829   IN  FORM_BROWSER_STATEMENT          *Question,
830   IN  UINTN                           Type
831   );
832 
833 
834 /**
835   Discard data based on the input setting scope (Form, FormSet or System).
836 
837   @param  FormSet                FormSet data structure.
838   @param  Form                   Form data structure.
839   @param  SettingScope           Setting Scope for Discard action.
840 
841   @retval EFI_SUCCESS            The function completed successfully.
842   @retval EFI_UNSUPPORTED        Unsupport SettingScope.
843 
844 **/
845 EFI_STATUS
846 DiscardForm (
847   IN FORM_BROWSER_FORMSET             *FormSet,
848   IN FORM_BROWSER_FORM                *Form,
849   IN BROWSER_SETTING_SCOPE            SettingScope
850   );
851 
852 /**
853   Submit data based on the input Setting level (Form, FormSet or System).
854 
855   @param  FormSet                FormSet data structure.
856   @param  Form                   Form data structure.
857   @param  SettingScope           Setting Scope for Submit action.
858 
859   @retval EFI_SUCCESS            The function completed successfully.
860   @retval EFI_UNSUPPORTED        Unsupport SettingScope.
861 
862 **/
863 EFI_STATUS
864 SubmitForm (
865   IN FORM_BROWSER_FORMSET             *FormSet,
866   IN FORM_BROWSER_FORM                *Form,
867   IN BROWSER_SETTING_SCOPE            SettingScope
868   );
869 
870 /**
871   Reset Question to its default value.
872 
873   @param  FormSet                The form set.
874   @param  Form                   The form.
875   @param  Question               The question.
876   @param  DefaultId              The Class of the default.
877 
878   @retval EFI_SUCCESS            Question is reset to default value.
879 
880 **/
881 EFI_STATUS
882 GetQuestionDefault (
883   IN FORM_BROWSER_FORMSET             *FormSet,
884   IN FORM_BROWSER_FORM                *Form,
885   IN FORM_BROWSER_STATEMENT           *Question,
886   IN UINT16                           DefaultId
887   );
888 
889 /**
890   Get current setting of Questions.
891 
892   @param  FormSet                FormSet data structure.
893 
894 **/
895 VOID
896 InitializeCurrentSetting (
897   IN OUT FORM_BROWSER_FORMSET             *FormSet
898   );
899 
900 /**
901   Initialize the internal data structure of a FormSet.
902 
903   @param  Handle                 PackageList Handle
904   @param  FormSetGuid            GUID of a formset. If not specified (NULL or zero
905                                  GUID), take the first FormSet found in package
906                                  list.
907   @param  FormSet                FormSet data structure.
908 
909   @retval EFI_SUCCESS            The function completed successfully.
910   @retval EFI_NOT_FOUND          The specified FormSet could not be found.
911 
912 **/
913 EFI_STATUS
914 InitializeFormSet (
915   IN  EFI_HII_HANDLE                   Handle,
916   IN OUT EFI_GUID                      *FormSetGuid,
917   OUT FORM_BROWSER_FORMSET             *FormSet
918   );
919 
920 /**
921   Reset Questions to their initial value or default value in a Form, Formset or System.
922 
923   GetDefaultValueScope parameter decides which questions will reset
924   to its default value.
925 
926   @param  FormSet                FormSet data structure.
927   @param  Form                   Form data structure.
928   @param  DefaultId              The Class of the default.
929   @param  SettingScope           Setting Scope for Default action.
930   @param  GetDefaultValueScope   Get default value scope.
931   @param  Storage                Get default value only for this storage.
932   @param  RetrieveValueFirst     Whether call the retrieve call back to
933                                  get the initial value before get default
934                                  value.
935   @param  SkipGetAltCfg          Whether skip the get altcfg string process.
936 
937   @retval EFI_SUCCESS            The function completed successfully.
938   @retval EFI_UNSUPPORTED        Unsupport SettingScope.
939 
940 **/
941 EFI_STATUS
942 ExtractDefault (
943   IN FORM_BROWSER_FORMSET             *FormSet,
944   IN FORM_BROWSER_FORM                *Form,
945   IN UINT16                           DefaultId,
946   IN BROWSER_SETTING_SCOPE            SettingScope,
947   IN BROWSER_GET_DEFAULT_VALUE        GetDefaultValueScope,
948   IN BROWSER_STORAGE                  *Storage,
949   IN BOOLEAN                          RetrieveValueFirst,
950   IN BOOLEAN                          SkipGetAltCfg
951   );
952 
953 /**
954   Initialize Question's Edit copy from Storage.
955 
956   @param  Selection              Selection contains the information about
957                                  the Selection, form and formset to be displayed.
958                                  Selection action may be updated in retrieve callback.
959                                  If Selection is NULL, only initialize Question value.
960   @param  FormSet                FormSet data structure.
961   @param  Form                   Form data structure.
962 
963   @retval EFI_SUCCESS            The function completed successfully.
964 
965 **/
966 EFI_STATUS
967 LoadFormConfig (
968   IN OUT UI_MENU_SELECTION    *Selection,
969   IN FORM_BROWSER_FORMSET     *FormSet,
970   IN FORM_BROWSER_FORM        *Form
971   );
972 
973 /**
974   Initialize Question's Edit copy from Storage for the whole Formset.
975 
976   @param  Selection              Selection contains the information about
977                                  the Selection, form and formset to be displayed.
978                                  Selection action may be updated in retrieve callback.
979                                  If Selection is NULL, only initialize Question value.
980   @param  FormSet                FormSet data structure.
981 
982   @retval EFI_SUCCESS            The function completed successfully.
983 
984 **/
985 EFI_STATUS
986 LoadFormSetConfig (
987   IN OUT UI_MENU_SELECTION    *Selection,
988   IN     FORM_BROWSER_FORMSET *FormSet
989   );
990 
991 /**
992   Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.
993 
994   @param  Storage                The Storage to be conveted.
995   @param  ConfigResp             The returned <ConfigResp>.
996   @param  ConfigRequest          The ConfigRequest string.
997   @param  GetEditBuf             Get the data from editbuffer or buffer.
998 
999   @retval EFI_SUCCESS            Convert success.
1000   @retval EFI_INVALID_PARAMETER  Incorrect storage type.
1001 
1002 **/
1003 EFI_STATUS
1004 StorageToConfigResp (
1005   IN BROWSER_STORAGE         *Storage,
1006   IN CHAR16                  **ConfigResp,
1007   IN CHAR16                  *ConfigRequest,
1008   IN BOOLEAN                 GetEditBuf
1009   );
1010 
1011 /**
1012   Convert <ConfigResp> to settings in Buffer Storage or NameValue Storage.
1013 
1014   @param  Storage                The Storage to receive the settings.
1015   @param  ConfigResp             The <ConfigResp> to be converted.
1016 
1017   @retval EFI_SUCCESS            Convert success.
1018   @retval EFI_INVALID_PARAMETER  Incorrect storage type.
1019 
1020 **/
1021 EFI_STATUS
1022 ConfigRespToStorage (
1023   IN BROWSER_STORAGE         *Storage,
1024   IN CHAR16                  *ConfigResp
1025   );
1026 
1027 /**
1028   Fill storage's edit copy with settings requested from Configuration Driver.
1029 
1030   @param  FormSet                FormSet data structure.
1031   @param  Storage                Buffer Storage.
1032 
1033 **/
1034 VOID
1035 LoadStorage (
1036   IN FORM_BROWSER_FORMSET    *FormSet,
1037   IN FORMSET_STORAGE         *Storage
1038   );
1039 
1040 /**
1041   Fetch the Ifr binary data of a FormSet.
1042 
1043   @param  Handle                 PackageList Handle
1044   @param  FormSetGuid            GUID of a formset. If not specified (NULL or zero
1045                                  GUID), take the first FormSet found in package
1046                                  list.
1047   @param  BinaryLength           The length of the FormSet IFR binary.
1048   @param  BinaryData             The buffer designed to receive the FormSet.
1049 
1050   @retval EFI_SUCCESS            Buffer filled with the requested FormSet.
1051                                  BufferLength was updated.
1052   @retval EFI_INVALID_PARAMETER  The handle is unknown.
1053   @retval EFI_NOT_FOUND          A form or FormSet on the requested handle cannot
1054                                  be found with the requested FormId.
1055 
1056 **/
1057 EFI_STATUS
1058 GetIfrBinaryData (
1059   IN  EFI_HII_HANDLE   Handle,
1060   IN OUT EFI_GUID      *FormSetGuid,
1061   OUT UINTN            *BinaryLength,
1062   OUT UINT8            **BinaryData
1063   );
1064 
1065 /**
1066   Save globals used by previous call to SendForm(). SendForm() may be called from
1067   HiiConfigAccess.Callback(), this will cause SendForm() be reentried.
1068   So, save globals of previous call to SendForm() and restore them upon exit.
1069 
1070 **/
1071 VOID
1072 SaveBrowserContext (
1073   VOID
1074   );
1075 
1076 /**
1077   Restore globals used by previous call to SendForm().
1078 
1079 **/
1080 VOID
1081 RestoreBrowserContext (
1082   VOID
1083   );
1084 
1085 /**
1086   This is the routine which an external caller uses to direct the browser
1087   where to obtain it's information.
1088 
1089 
1090   @param This            The Form Browser protocol instanse.
1091   @param Handles         A pointer to an array of Handles.  If HandleCount > 1 we
1092                          display a list of the formsets for the handles specified.
1093   @param HandleCount     The number of Handles specified in Handle.
1094   @param FormSetGuid     This field points to the EFI_GUID which must match the Guid
1095                          field in the EFI_IFR_FORM_SET op-code for the specified
1096                          forms-based package. If FormSetGuid is NULL, then this
1097                          function will display the first found forms package.
1098   @param FormId          This field specifies which EFI_IFR_FORM to render as the first
1099                          displayable page. If this field has a value of 0x0000, then
1100                          the forms browser will render the specified forms in their encoded order.
1101                          ScreenDimenions - This allows the browser to be called so that it occupies a
1102                          portion of the physical screen instead of dynamically determining the screen dimensions.
1103                          ActionRequest   - Points to the action recommended by the form.
1104   @param ScreenDimensions Points to recommended form dimensions, including any non-content area, in
1105                           characters.
1106   @param ActionRequest       Points to the action recommended by the form.
1107 
1108   @retval  EFI_SUCCESS            The function completed successfully.
1109   @retval  EFI_INVALID_PARAMETER  One of the parameters has an invalid value.
1110   @retval  EFI_NOT_FOUND          No valid forms could be found to display.
1111 
1112 **/
1113 EFI_STATUS
1114 EFIAPI
1115 SendForm (
1116   IN  CONST EFI_FORM_BROWSER2_PROTOCOL *This,
1117   IN  EFI_HII_HANDLE                   *Handles,
1118   IN  UINTN                            HandleCount,
1119   IN  EFI_GUID                         *FormSetGuid, OPTIONAL
1120   IN  UINT16                           FormId, OPTIONAL
1121   IN  CONST EFI_SCREEN_DESCRIPTOR      *ScreenDimensions, OPTIONAL
1122   OUT EFI_BROWSER_ACTION_REQUEST       *ActionRequest  OPTIONAL
1123   );
1124 
1125 /**
1126   This function is called by a callback handler to retrieve uncommitted state
1127   data from the browser.
1128 
1129   @param  This                   A pointer to the EFI_FORM_BROWSER2_PROTOCOL
1130                                  instance.
1131   @param  ResultsDataSize        A pointer to the size of the buffer associated
1132                                  with ResultsData.
1133   @param  ResultsData            A string returned from an IFR browser or
1134                                  equivalent. The results string will have no
1135                                  routing information in them.
1136   @param  RetrieveData           A BOOLEAN field which allows an agent to retrieve
1137                                  (if RetrieveData = TRUE) data from the uncommitted
1138                                  browser state information or set (if RetrieveData
1139                                  = FALSE) data in the uncommitted browser state
1140                                  information.
1141   @param  VariableGuid           An optional field to indicate the target variable
1142                                  GUID name to use.
1143   @param  VariableName           An optional field to indicate the target
1144                                  human-readable variable name.
1145 
1146   @retval EFI_SUCCESS            The results have been distributed or are awaiting
1147                                  distribution.
1148   @retval EFI_BUFFER_TOO_SMALL   The ResultsDataSize specified was too small to
1149                                  contain the results data.
1150 
1151 **/
1152 EFI_STATUS
1153 EFIAPI
1154 BrowserCallback (
1155   IN CONST EFI_FORM_BROWSER2_PROTOCOL  *This,
1156   IN OUT UINTN                         *ResultsDataSize,
1157   IN OUT EFI_STRING                    ResultsData,
1158   IN BOOLEAN                           RetrieveData,
1159   IN CONST EFI_GUID                    *VariableGuid, OPTIONAL
1160   IN CONST CHAR16                      *VariableName  OPTIONAL
1161   );
1162 
1163 /**
1164   Find menu which will show next time.
1165 
1166   @param Selection       On input, Selection tell setup browser the information
1167                          about the Selection, form and formset to be displayed.
1168                          On output, Selection return the screen item that is selected
1169                          by user.
1170   @param SettingLevel    Input Settting level, if it is FormLevel, just exit current form.
1171                          else, we need to exit current formset.
1172 
1173   @retval TRUE           Exit current form.
1174   @retval FALSE          User press ESC and keep in current form.
1175 **/
1176 BOOLEAN
1177 FindNextMenu (
1178   IN OUT UI_MENU_SELECTION        *Selection,
1179   IN       BROWSER_SETTING_SCOPE  SettingLevel
1180   );
1181 
1182 /**
1183   check whether the form need to update the NV.
1184 
1185   @param  Form                Form data structure.
1186 
1187   @retval TRUE                   Need to update the NV.
1188   @retval FALSE                  No need to update the NV.
1189 **/
1190 BOOLEAN
1191 IsNvUpdateRequiredForForm (
1192   IN FORM_BROWSER_FORM    *Form
1193   );
1194 
1195 /**
1196   check whether the formset need to update the NV.
1197 
1198   @param  FormSet                FormSet data structure.
1199 
1200   @retval TRUE                   Need to update the NV.
1201   @retval FALSE                  No need to update the NV.
1202 **/
1203 BOOLEAN
1204 IsNvUpdateRequiredForFormSet (
1205   IN FORM_BROWSER_FORMSET  *FormSet
1206   );
1207 
1208 /**
1209   Call the call back function for the question and process the return action.
1210 
1211   @param Selection             On input, Selection tell setup browser the information
1212                                about the Selection, form and formset to be displayed.
1213                                On output, Selection return the screen item that is selected
1214                                by user.
1215   @param FormSet               The formset this question belong to.
1216   @param Form                  The form this question belong to.
1217   @param Question              The Question which need to call.
1218   @param Action                The action request.
1219   @param SkipSaveOrDiscard     Whether skip save or discard action.
1220 
1221   @retval EFI_SUCCESS          The call back function excutes successfully.
1222   @return Other value if the call back function failed to excute.
1223 **/
1224 EFI_STATUS
1225 ProcessCallBackFunction (
1226   IN OUT UI_MENU_SELECTION               *Selection,
1227   IN     FORM_BROWSER_FORMSET            *FormSet,
1228   IN     FORM_BROWSER_FORM               *Form,
1229   IN     FORM_BROWSER_STATEMENT          *Question,
1230   IN     EFI_BROWSER_ACTION              Action,
1231   IN     BOOLEAN                         SkipSaveOrDiscard
1232   );
1233 
1234 /**
1235   Call the retrieve type call back function for one question to get the initialize data.
1236 
1237   This function only used when in the initialize stage, because in this stage, the
1238   Selection->Form is not ready. For other case, use the ProcessCallBackFunction instead.
1239 
1240   @param ConfigAccess          The config access protocol produced by the hii driver.
1241   @param Statement             The Question which need to call.
1242   @param FormSet               The formset this question belong to.
1243 
1244   @retval EFI_SUCCESS          The call back function excutes successfully.
1245   @return Other value if the call back function failed to excute.
1246 **/
1247 EFI_STATUS
1248 ProcessRetrieveForQuestion (
1249   IN     EFI_HII_CONFIG_ACCESS_PROTOCOL  *ConfigAccess,
1250   IN     FORM_BROWSER_STATEMENT          *Statement,
1251   IN     FORM_BROWSER_FORMSET            *FormSet
1252   );
1253 
1254 /**
1255   Find the matched FormSet context in the backup maintain list based on HiiHandle.
1256 
1257   @param Handle  The Hii Handle.
1258 
1259   @return the found FormSet context. If no found, NULL will return.
1260 
1261 **/
1262 FORM_BROWSER_FORMSET *
1263 GetFormSetFromHiiHandle (
1264   EFI_HII_HANDLE Handle
1265   );
1266 
1267 /**
1268   Check whether the input HII handle is the FormSet that is being used.
1269 
1270   @param Handle  The Hii Handle.
1271 
1272   @retval TRUE   HII handle is being used.
1273   @retval FALSE  HII handle is not being used.
1274 
1275 **/
1276 BOOLEAN
1277 IsHiiHandleInBrowserContext (
1278   EFI_HII_HANDLE Handle
1279   );
1280 
1281 /**
1282   Configure what scope the hot key will impact.
1283   All hot keys have the same scope. The mixed hot keys with the different level are not supported.
1284   If no scope is set, the default scope will be FormSet level.
1285   After all registered hot keys are removed, previous Scope can reset to another level.
1286 
1287   @param[in] Scope               Scope level to be set.
1288 
1289   @retval EFI_SUCCESS            Scope is set correctly.
1290   @retval EFI_INVALID_PARAMETER  Scope is not the valid value specified in BROWSER_SETTING_SCOPE.
1291   @retval EFI_UNSPPORTED         Scope level is different from current one that the registered hot keys have.
1292 
1293 **/
1294 EFI_STATUS
1295 EFIAPI
1296 SetScope (
1297   IN BROWSER_SETTING_SCOPE Scope
1298   );
1299 
1300 /**
1301   Register the hot key with its browser action, or unregistered the hot key.
1302   Only support hot key that is not printable character (control key, function key, etc.).
1303   If the action value is zero, the hot key will be unregistered if it has been registered.
1304   If the same hot key has been registered, the new action and help string will override the previous ones.
1305 
1306   @param[in] KeyData     A pointer to a buffer that describes the keystroke
1307                          information for the hot key. Its type is EFI_INPUT_KEY to
1308                          be supported by all ConsoleIn devices.
1309   @param[in] Action      Action value that describes what action will be trigged when the hot key is pressed.
1310   @param[in] DefaultId   Specifies the type of defaults to retrieve, which is only for DEFAULT action.
1311   @param[in] HelpString  Help string that describes the hot key information.
1312                          Its value may be NULL for the unregistered hot key.
1313 
1314   @retval EFI_SUCCESS            Hot key is registered or unregistered.
1315   @retval EFI_INVALID_PARAMETER  KeyData is NULL.
1316   @retval EFI_NOT_FOUND          KeyData is not found to be unregistered.
1317   @retval EFI_UNSUPPORTED        Key represents a printable character. It is conflicted with Browser.
1318   @retval EFI_ALREADY_STARTED    Key already been registered for one hot key.
1319 **/
1320 EFI_STATUS
1321 EFIAPI
1322 RegisterHotKey (
1323   IN EFI_INPUT_KEY *KeyData,
1324   IN UINT32        Action,
1325   IN UINT16        DefaultId,
1326   IN EFI_STRING    HelpString OPTIONAL
1327   );
1328 
1329 /**
1330   Register Exit handler function.
1331   When more than one handler function is registered, the latter one will override the previous one.
1332   When NULL handler is specified, the previous Exit handler will be unregistered.
1333 
1334   @param[in] Handler      Pointer to handler function.
1335 
1336 **/
1337 VOID
1338 EFIAPI
1339 RegiserExitHandler (
1340   IN EXIT_HANDLER Handler
1341   );
1342 
1343 /**
1344 
1345   Check whether the browser data has been modified.
1346 
1347   @retval TRUE        Browser data is changed.
1348   @retval FALSE       No browser data is changed.
1349 
1350 **/
1351 BOOLEAN
1352 EFIAPI
1353 IsBrowserDataModified (
1354   VOID
1355   );
1356 
1357 /**
1358 
1359   Execute the action requested by the Action parameter.
1360 
1361   @param[in] Action     Execute the request action.
1362   @param[in] DefaultId  The default Id info when need to load default value.
1363 
1364   @retval EFI_SUCCESS              Execute the request action succss.
1365   @retval EFI_INVALID_PARAMETER    The input action value is invalid.
1366 
1367 **/
1368 EFI_STATUS
1369 EFIAPI
1370 ExecuteAction (
1371   IN UINT32        Action,
1372   IN UINT16        DefaultId
1373   );
1374 
1375 /**
1376   Create reminder to let user to choose save or discard the changed browser data.
1377   Caller can use it to actively check the changed browser data.
1378 
1379   @retval BROWSER_NO_CHANGES       No browser data is changed.
1380   @retval BROWSER_SAVE_CHANGES     The changed browser data is saved.
1381   @retval BROWSER_DISCARD_CHANGES  The changed browser data is discard.
1382   @retval BROWSER_KEEP_CURRENT     Browser keep current changes.
1383 
1384 **/
1385 UINT32
1386 EFIAPI
1387 SaveReminder (
1388   VOID
1389   );
1390 
1391 /**
1392   Check whether the Reset Required for the browser
1393 
1394   @retval TRUE      Browser required to reset after exit.
1395   @retval FALSE     Browser not need to reset after exit.
1396 
1397 **/
1398 BOOLEAN
1399 EFIAPI
1400 IsResetRequired (
1401   VOID
1402   );
1403 
1404 /**
1405   Find the registered HotKey based on KeyData.
1406 
1407   @param[in] KeyData     A pointer to a buffer that describes the keystroke
1408                          information for the hot key.
1409 
1410   @return The registered HotKey context. If no found, NULL will return.
1411 **/
1412 BROWSER_HOT_KEY *
1413 GetHotKeyFromRegisterList (
1414   IN EFI_INPUT_KEY *KeyData
1415   );
1416 
1417 /**
1418 
1419   Get FORM_BROWSER_STATEMENT from FORM_DISPLAY_ENGINE_STATEMENT based on the OpCode info.
1420 
1421   @param DisplayStatement        The input FORM_DISPLAY_ENGINE_STATEMENT.
1422 
1423   @retval FORM_BROWSER_STATEMENT  The return FORM_BROWSER_STATEMENT info.
1424 
1425 **/
1426 FORM_BROWSER_STATEMENT *
1427 GetBrowserStatement (
1428   IN FORM_DISPLAY_ENGINE_STATEMENT *DisplayStatement
1429   );
1430 
1431 /**
1432   Password may be stored as encrypted by Configuration Driver. When change a
1433   password, user will be challenged with old password. To validate user input old
1434   password, we will send the clear text to Configuration Driver via Callback().
1435   Configuration driver is responsible to check the passed in password and return
1436   the validation result. If validation pass, state machine in password Callback()
1437   will transit from BROWSER_STATE_VALIDATE_PASSWORD to BROWSER_STATE_SET_PASSWORD.
1438   After user type in new password twice, Callback() will be invoked to send the
1439   new password to Configuration Driver.
1440 
1441   @param  Selection              Pointer to UI_MENU_SELECTION.
1442   @param  MenuOption             The MenuOption for this password Question.
1443   @param  String                 The clear text of password.
1444 
1445   @retval EFI_NOT_AVAILABLE_YET  Callback() request to terminate password input.
1446   @return In state of BROWSER_STATE_VALIDATE_PASSWORD:
1447   @retval EFI_SUCCESS            Password correct, Browser will prompt for new
1448                                  password.
1449   @retval EFI_NOT_READY          Password incorrect, Browser will show error
1450                                  message.
1451   @retval Other                  Browser will do nothing.
1452   @return In state of BROWSER_STATE_SET_PASSWORD:
1453   @retval EFI_SUCCESS            Set password success.
1454   @retval Other                  Set password failed.
1455 
1456 **/
1457 EFI_STATUS
1458 PasswordCallback (
1459   IN  UI_MENU_SELECTION           *Selection,
1460   IN  FORM_BROWSER_STATEMENT      *Question,
1461   IN  CHAR16                      *String
1462   );
1463 
1464 /**
1465   Display error message for invalid password.
1466 
1467 **/
1468 VOID
1469 PasswordInvalid (
1470   VOID
1471   );
1472 
1473 /**
1474   The worker function that send the displays to the screen. On output,
1475   the selection made by user is returned.
1476 
1477   @param Selection       On input, Selection tell setup browser the information
1478                          about the Selection, form and formset to be displayed.
1479                          On output, Selection return the screen item that is selected
1480                          by user.
1481 
1482   @retval EFI_SUCCESS    The page is displayed successfully.
1483   @return Other value if the page failed to be diplayed.
1484 
1485 **/
1486 EFI_STATUS
1487 SetupBrowser (
1488   IN OUT UI_MENU_SELECTION    *Selection
1489   );
1490 
1491 /**
1492   Free up the resource allocated for all strings required
1493   by Setup Browser.
1494 
1495 **/
1496 VOID
1497 FreeBrowserStrings (
1498   VOID
1499   );
1500 
1501 /**
1502   Create a menu with specified formset GUID and form ID, and add it as a child
1503   of the given parent menu.
1504 
1505   @param  HiiHandle              Hii handle related to this formset.
1506   @param  FormSetGuid            The Formset Guid of menu to be added.
1507   @param  FormId                 The Form ID of menu to be added.
1508   @param  QuestionId             The question id of this menu to be added.
1509 
1510   @return A pointer to the newly added menu or NULL if memory is insufficient.
1511 
1512 **/
1513 FORM_ENTRY_INFO *
1514 UiAddMenuList (
1515   IN EFI_HII_HANDLE       HiiHandle,
1516   IN EFI_GUID             *FormSetGuid,
1517   IN UINT16               FormId,
1518   IN UINT16               QuestionId
1519   );
1520 
1521 /**
1522   Search Menu with given FormSetGuid and FormId in all cached menu list.
1523 
1524   @param  HiiHandle              HiiHandle for FormSet.
1525   @param  FormSetGuid            The Formset GUID of the menu to search.
1526   @param  FormId                 The Form ID of menu to search.
1527 
1528   @return A pointer to menu found or NULL if not found.
1529 
1530 **/
1531 FORM_ENTRY_INFO *
1532 UiFindMenuList (
1533   IN EFI_HII_HANDLE       HiiHandle,
1534   IN EFI_GUID             *FormSetGuid,
1535   IN UINT16               FormId
1536   );
1537 
1538 /**
1539   Free Menu list linked list.
1540 
1541   @param  MenuListHead    One Menu list point in the menu list.
1542 
1543 **/
1544 VOID
1545 UiFreeMenuList (
1546   LIST_ENTRY   *MenuListHead
1547   );
1548 
1549 /**
1550   Find parent menu for current menu.
1551 
1552   @param  CurrentMenu    Current Menu
1553   @param  SettingLevel   Whether find parent menu in Form Level or Formset level.
1554                          In form level, just find the parent menu;
1555                          In formset level, find the parent menu which has different
1556                          formset guid value.
1557 
1558   @retval   The parent menu for current menu.
1559 **/
1560 FORM_ENTRY_INFO *
1561 UiFindParentMenu (
1562   IN FORM_ENTRY_INFO          *CurrentMenu,
1563   IN BROWSER_SETTING_SCOPE    SettingLevel
1564   );
1565 
1566 /**
1567   Validate the HiiHandle.
1568 
1569   @param  HiiHandle              The input HiiHandle which need to validate.
1570 
1571   @retval TRUE                   The handle is validate.
1572   @retval FALSE                  The handle is invalidate.
1573 
1574 **/
1575 BOOLEAN
1576 ValidateHiiHandle (
1577   EFI_HII_HANDLE          HiiHandle
1578   );
1579 
1580 /**
1581   Copy current Menu list to the new menu list.
1582 
1583   @param  NewMenuListHead        New create Menu list.
1584   @param  CurrentMenuListHead    Current Menu list.
1585 
1586 **/
1587 VOID
1588 UiCopyMenuList (
1589   OUT LIST_ENTRY   *NewMenuListHead,
1590   IN  LIST_ENTRY   *CurrentMenuListHead
1591   );
1592 
1593 /**
1594   Search an Option of a Question by its value.
1595 
1596   @param  Question               The Question
1597   @param  OptionValue            Value for Option to be searched.
1598 
1599   @retval Pointer                Pointer to the found Option.
1600   @retval NULL                   Option not found.
1601 
1602 **/
1603 QUESTION_OPTION *
1604 ValueToOption (
1605   IN FORM_BROWSER_STATEMENT   *Question,
1606   IN EFI_HII_VALUE            *OptionValue
1607   );
1608 /**
1609   Return data element in an Array by its Index.
1610 
1611   @param  Array                  The data array.
1612   @param  Type                   Type of the data in this array.
1613   @param  Index                  Zero based index for data in this array.
1614 
1615   @retval Value                  The data to be returned
1616 
1617 **/
1618 UINT64
1619 GetArrayData (
1620   IN VOID                     *Array,
1621   IN UINT8                    Type,
1622   IN UINTN                    Index
1623   );
1624 
1625 /**
1626   Set value of a data element in an Array by its Index.
1627 
1628   @param  Array                  The data array.
1629   @param  Type                   Type of the data in this array.
1630   @param  Index                  Zero based index for data in this array.
1631   @param  Value                  The value to be set.
1632 
1633 **/
1634 VOID
1635 SetArrayData (
1636   IN VOID                     *Array,
1637   IN UINT8                    Type,
1638   IN UINTN                    Index,
1639   IN UINT64                   Value
1640   );
1641 
1642 /**
1643    Compare two Hii value.
1644 
1645    @param  Value1                 Expression value to compare on left-hand.
1646    @param  Value2                 Expression value to compare on right-hand.
1647    @param  Result                 Return value after compare.
1648                                   retval 0                      Two operators equal.
1649                                   return Positive value if Value1 is greater than Value2.
1650                                   retval Negative value if Value1 is less than Value2.
1651    @param  HiiHandle              Only required for string compare.
1652 
1653    @retval other                  Could not perform compare on two values.
1654    @retval EFI_SUCCESS            Compare the value success.
1655 
1656 **/
1657 EFI_STATUS
1658 CompareHiiValue (
1659   IN  EFI_HII_VALUE   *Value1,
1660   IN  EFI_HII_VALUE   *Value2,
1661   OUT INTN            *Result,
1662   IN  EFI_HII_HANDLE  HiiHandle OPTIONAL
1663   );
1664 
1665 /**
1666   Perform Password check.
1667   Passwork may be encrypted by driver that requires the specific check.
1668 
1669   @param  Form             Form where Password Statement is in.
1670   @param  Statement        Password statement
1671   @param  PasswordString   Password string to be checked. It may be NULL.
1672                            NULL means to restore password.
1673                            "" string can be used to checked whether old password does exist.
1674 
1675   @return Status     Status of Password check.
1676 **/
1677 EFI_STATUS
1678 EFIAPI
1679 PasswordCheck (
1680   IN FORM_DISPLAY_ENGINE_FORM      *Form,
1681   IN FORM_DISPLAY_ENGINE_STATEMENT *Statement,
1682   IN EFI_STRING                    PasswordString  OPTIONAL
1683   );
1684 
1685 /**
1686 
1687   Get FORM_BROWSER_STATEMENT from FORM_DISPLAY_ENGINE_STATEMENT based on the OpCode info.
1688 
1689   @param DisplayStatement        The input FORM_DISPLAY_ENGINE_STATEMENT.
1690 
1691   @retval FORM_BROWSER_STATEMENT  The return FORM_BROWSER_STATEMENT info.
1692 
1693 **/
1694 FORM_BROWSER_STATEMENT *
1695 GetBrowserStatement (
1696   IN FORM_DISPLAY_ENGINE_STATEMENT *DisplayStatement
1697   );
1698 
1699 /**
1700 
1701   Initialize the Display form structure data.
1702 
1703 **/
1704 VOID
1705 InitializeDisplayFormData (
1706   VOID
1707   );
1708 
1709 
1710 /**
1711   Base on the current formset info, clean the ConfigRequest string in browser storage.
1712 
1713   @param  FormSet                Pointer of the FormSet
1714 
1715 **/
1716 VOID
1717 CleanBrowserStorage (
1718   IN OUT FORM_BROWSER_FORMSET  *FormSet
1719   );
1720 
1721 /**
1722   Find HII Handle in the HII database associated with given Device Path.
1723 
1724   If DevicePath is NULL, then ASSERT.
1725 
1726   @param  DevicePath             Device Path associated with the HII package list
1727                                  handle.
1728   @param  FormsetGuid            The formset guid for this formset.
1729 
1730   @retval Handle                 HII package list Handle associated with the Device
1731                                         Path.
1732   @retval NULL                   Hii Package list handle is not found.
1733 
1734 **/
1735 EFI_HII_HANDLE
1736 DevicePathToHiiHandle (
1737   IN EFI_DEVICE_PATH_PROTOCOL   *DevicePath,
1738   IN EFI_GUID                   *FormsetGuid
1739   );
1740 
1741 /**
1742   Adjust the config request info, remove the request elements which already in AllConfigRequest string.
1743 
1744   @param  Storage                Form set Storage.
1745   @param  Request                The input request string.
1746   @param  RespString             Whether the input is ConfigRequest or ConfigResp format.
1747 
1748   @retval TRUE                   Has element not covered by current used elements, need to continue to call ExtractConfig
1749   @retval FALSE                  All elements covered by current used elements.
1750 
1751 **/
1752 BOOLEAN
1753 ConfigRequestAdjust (
1754   IN  BROWSER_STORAGE         *Storage,
1755   IN  CHAR16                  *Request,
1756   IN  BOOLEAN                 RespString
1757   );
1758 
1759 /**
1760   Perform question check.
1761 
1762   If one question has more than one check, process form high priority to low.
1763 
1764   @param  FormSet                FormSet data structure.
1765   @param  Form                   Form data structure.
1766   @param  Question               The Question to be validated.
1767 
1768   @retval EFI_SUCCESS            Form validation pass.
1769   @retval other                  Form validation failed.
1770 
1771 **/
1772 EFI_STATUS
1773 ValueChangedValidation (
1774   IN  FORM_BROWSER_FORMSET            *FormSet,
1775   IN  FORM_BROWSER_FORM               *Form,
1776   IN  FORM_BROWSER_STATEMENT          *Question
1777   );
1778 
1779 /**
1780   Pop up the error info.
1781 
1782   @param      BrowserStatus    The input browser status.
1783   @param      HiiHandle        The HiiHandle for this error opcode.
1784   @param      OpCode           The opcode use to get the erro info and timeout value.
1785   @param      ErrorString      Error string used by BROWSER_NO_SUBMIT_IF.
1786 
1787 **/
1788 UINT32
1789 PopupErrorMessage (
1790   IN UINT32                BrowserStatus,
1791   IN EFI_HII_HANDLE        HiiHandle,
1792   IN EFI_IFR_OP_HEADER     *OpCode, OPTIONAL
1793   IN CHAR16                *ErrorString
1794   );
1795 
1796 /**
1797   Check whether the result is TRUE or FALSE.
1798 
1799   For the EFI_HII_VALUE value type is numeric, return TRUE if the
1800   value is not 0.
1801 
1802   @param  Result             Input the result data.
1803 
1804   @retval TRUE               The result is TRUE.
1805   @retval FALSE              The result is FALSE.
1806 
1807 **/
1808 BOOLEAN
1809 IsTrue (
1810   IN EFI_HII_VALUE     *Result
1811   );
1812 
1813 /**
1814   Get Formset_storage base on the input varstoreid info.
1815 
1816   @param  FormSet                Pointer of the current FormSet.
1817   @param  VarStoreId             Varstore ID info.
1818 
1819   @return Pointer to a FORMSET_STORAGE data structure.
1820 
1821 **/
1822 FORMSET_STORAGE *
1823 GetFstStgFromVarId (
1824   IN FORM_BROWSER_FORMSET  *FormSet,
1825   IN EFI_VARSTORE_ID       VarStoreId
1826   );
1827 
1828 /**
1829   Get Formset_storage base on the input browser storage.
1830 
1831   More than one formsets may share the same browser storage,
1832   this function just get the first formset storage which
1833   share the browser storage.
1834 
1835   @param  Storage              browser storage info.
1836 
1837   @return Pointer to a FORMSET_STORAGE data structure.
1838 
1839 
1840 **/
1841 FORMSET_STORAGE *
1842 GetFstStgFromBrsStg (
1843   IN BROWSER_STORAGE       *Storage
1844   );
1845 
1846 /**
1847   Reconnect the controller.
1848 
1849   @param DriverHandle          The controller handle which need to be reconnect.
1850 
1851   @retval   TRUE     do the reconnect behavior success.
1852   @retval   FALSE    do the reconnect behavior failed.
1853 
1854 **/
1855 BOOLEAN
1856 ReconnectController (
1857   IN EFI_HANDLE   DriverHandle
1858   );
1859 
1860 /**
1861   Converts the unicode character of the string from uppercase to lowercase.
1862   This is a internal function.
1863 
1864   @param ConfigString  String to be converted
1865 
1866 **/
1867 VOID
1868 EFIAPI
1869 HiiToLower (
1870   IN EFI_STRING  ConfigString
1871   );
1872 
1873 #endif
1874