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