]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
Update the logic to get default value for question without storage.
[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 - 2012, 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/FormBrowserEx.h>
26 #include <Protocol/DevicePath.h>
27 #include <Protocol/UnicodeCollation.h>
28 #include <Protocol/HiiConfigAccess.h>
29 #include <Protocol/HiiConfigRouting.h>
30 #include <Protocol/HiiDatabase.h>
31 #include <Protocol/HiiString.h>
32 #include <Protocol/UserManager.h>
33
34 #include <Guid/MdeModuleHii.h>
35 #include <Guid/HiiPlatformSetupFormset.h>
36 #include <Guid/HiiFormMapMethodGuid.h>
37
38 #include <Library/PrintLib.h>
39 #include <Library/DebugLib.h>
40 #include <Library/BaseMemoryLib.h>
41 #include <Library/UefiRuntimeServicesTableLib.h>
42 #include <Library/UefiDriverEntryPoint.h>
43 #include <Library/UefiBootServicesTableLib.h>
44 #include <Library/BaseLib.h>
45 #include <Library/MemoryAllocationLib.h>
46 #include <Library/HiiLib.h>
47 #include <Library/PcdLib.h>
48 #include <Library/DevicePathLib.h>
49
50 #include "Colors.h"
51
52 //
53 // This is the generated header file which includes whatever needs to be exported (strings + IFR)
54 //
55
56 extern UINT8 SetupBrowserStrings[];
57
58 //
59 // Screen definitions
60 //
61 #define BANNER_HEIGHT 6
62 #define BANNER_COLUMNS 3
63 #define BANNER_LEFT_COLUMN_INDENT 1
64
65 #define FRONT_PAGE_HEADER_HEIGHT 6
66 #define NONE_FRONT_PAGE_HEADER_HEIGHT 3
67 #define LEFT_SKIPPED_COLUMNS 3
68 #define FOOTER_HEIGHT 4
69 #define STATUS_BAR_HEIGHT 1
70 #define SCROLL_ARROW_HEIGHT 1
71 #define POPUP_PAD_SPACE_COUNT 5
72 #define POPUP_FRAME_WIDTH 2
73
74 //
75 // Definition for function key setting
76 //
77 #define NONE_FUNCTION_KEY_SETTING 0
78 #define ENABLE_FUNCTION_KEY_SETTING 1
79
80 typedef struct {
81 EFI_GUID FormSetGuid;
82 UINTN KeySetting;
83 } FUNCTIION_KEY_SETTING;
84
85 //
86 // Character definitions
87 //
88 #define CHAR_SPACE 0x0020
89 #define UPPER_LOWER_CASE_OFFSET 0x20
90
91 //
92 // Time definitions
93 //
94 #define ONE_SECOND 10000000
95
96 //
97 // Display definitions
98 //
99 #define LEFT_HYPER_DELIMITER L'<'
100 #define RIGHT_HYPER_DELIMITER L'>'
101
102 #define LEFT_ONEOF_DELIMITER L'<'
103 #define RIGHT_ONEOF_DELIMITER L'>'
104
105 #define LEFT_NUMERIC_DELIMITER L'['
106 #define RIGHT_NUMERIC_DELIMITER L']'
107
108 #define LEFT_CHECKBOX_DELIMITER L'['
109 #define RIGHT_CHECKBOX_DELIMITER L']'
110
111 #define CHECK_ON L'X'
112 #define CHECK_OFF L' '
113
114 #define TIME_SEPARATOR L':'
115 #define DATE_SEPARATOR L'/'
116
117 #define YES_ANSWER L'Y'
118 #define NO_ANSWER L'N'
119
120 //
121 // This is the Input Error Message
122 //
123 #define INPUT_ERROR 1
124
125 //
126 // This is the NV RAM update required Message
127 //
128 #define NV_UPDATE_REQUIRED 2
129
130 //
131 // Refresh the Status Bar with flags
132 //
133 #define REFRESH_STATUS_BAR 0xff
134
135 //
136 // Incremental string lenght of ConfigRequest
137 //
138 #define CONFIG_REQUEST_STRING_INCREMENTAL 1024
139
140 //
141 // HII value compare result
142 //
143 #define HII_VALUE_UNDEFINED 0
144 #define HII_VALUE_EQUAL 1
145 #define HII_VALUE_LESS_THAN 2
146 #define HII_VALUE_GREATER_THAN 3
147
148 //
149 // Incremental size of stack for expression
150 //
151 #define EXPRESSION_STACK_SIZE_INCREMENT 0x100
152
153 #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))
154
155
156 #define SETUP_DRIVER_SIGNATURE SIGNATURE_32 ('F', 'B', 'D', 'V')
157 typedef struct {
158 UINT32 Signature;
159
160 EFI_HANDLE Handle;
161
162 //
163 // Produced protocol
164 //
165 EFI_FORM_BROWSER2_PROTOCOL FormBrowser2;
166
167 EFI_FORM_BROWSER_EXTENSION_PROTOCOL FormBrowserEx;
168
169 } SETUP_DRIVER_PRIVATE_DATA;
170
171 typedef struct {
172 EFI_STRING_ID Banner[BANNER_HEIGHT][BANNER_COLUMNS];
173 } BANNER_DATA;
174
175 //
176 // IFR relative definition
177 //
178 #define EFI_HII_EXPRESSION_INCONSISTENT_IF 0
179 #define EFI_HII_EXPRESSION_NO_SUBMIT_IF 1
180 #define EFI_HII_EXPRESSION_GRAY_OUT_IF 2
181 #define EFI_HII_EXPRESSION_SUPPRESS_IF 3
182 #define EFI_HII_EXPRESSION_DISABLE_IF 4
183 #define EFI_HII_EXPRESSION_VALUE 5
184 #define EFI_HII_EXPRESSION_RULE 6
185 #define EFI_HII_EXPRESSION_READ 7
186 #define EFI_HII_EXPRESSION_WRITE 8
187
188 #define EFI_HII_VARSTORE_BUFFER 0
189 #define EFI_HII_VARSTORE_NAME_VALUE 1
190 #define EFI_HII_VARSTORE_EFI_VARIABLE 2
191 #define EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER 3
192
193 #define FORM_INCONSISTENT_VALIDATION 0
194 #define FORM_NO_SUBMIT_VALIDATION 1
195
196 #define FORMSET_CLASS_PLATFORM_SETUP 0x0001
197 #define FORMSET_CLASS_FRONT_PAGE 0x0002
198
199 typedef struct {
200 UINT8 Type;
201 UINT8 *Buffer;
202 UINT16 BufferLen;
203 EFI_IFR_TYPE_VALUE Value;
204 } EFI_HII_VALUE;
205
206 #define NAME_VALUE_NODE_SIGNATURE SIGNATURE_32 ('N', 'V', 'S', 'T')
207
208 typedef struct {
209 UINTN Signature;
210 LIST_ENTRY Link;
211 CHAR16 *Name;
212 CHAR16 *Value;
213 CHAR16 *EditValue;
214 } NAME_VALUE_NODE;
215
216 #define NAME_VALUE_NODE_FROM_LINK(a) CR (a, NAME_VALUE_NODE, Link, NAME_VALUE_NODE_SIGNATURE)
217
218 #define FORMSET_STORAGE_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'G')
219
220 typedef struct {
221 UINTN Signature;
222 LIST_ENTRY Link;
223
224 UINT8 Type; // Storage type
225
226 UINT16 VarStoreId;
227 EFI_GUID Guid;
228
229 CHAR16 *Name; // For EFI_IFR_VARSTORE
230 UINT16 Size;
231 UINT8 *Buffer;
232 UINT8 *EditBuffer; // Edit copy for Buffer Storage
233
234 LIST_ENTRY NameValueListHead; // List of NAME_VALUE_NODE
235
236 UINT32 Attributes; // For EFI_IFR_VARSTORE_EFI: EFI Variable attribute
237
238 CHAR16 *ConfigHdr; // <ConfigHdr>
239 CHAR16 *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
240 UINTN ElementCount; // Number of <RequestElement> in the <ConfigRequest>
241 UINTN SpareStrLen; // Spare length of ConfigRequest string buffer
242 } FORMSET_STORAGE;
243
244 #define FORMSET_STORAGE_FROM_LINK(a) CR (a, FORMSET_STORAGE, Link, FORMSET_STORAGE_SIGNATURE)
245
246 typedef union {
247 EFI_STRING_ID VarName;
248 UINT16 VarOffset;
249 } VAR_STORE_INFO;
250
251 #define EXPRESSION_OPCODE_SIGNATURE SIGNATURE_32 ('E', 'X', 'O', 'P')
252
253 typedef struct {
254 UINTN Signature;
255 LIST_ENTRY Link;
256
257 UINT8 Operand;
258
259 UINT8 Format; // For EFI_IFR_TO_STRING, EFI_IFR_FIND
260 UINT8 Flags; // For EFI_IFR_SPAN
261 UINT8 RuleId; // For EFI_IFR_RULE_REF
262
263 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
264
265 EFI_QUESTION_ID QuestionId; // For EFI_IFR_EQ_ID_ID, EFI_IFR_EQ_ID_VAL_LIST, EFI_IFR_QUESTION_REF1
266 EFI_QUESTION_ID QuestionId2;
267
268 UINT16 ListLength; // For EFI_IFR_EQ_ID_VAL_LIST
269 UINT16 *ValueList;
270
271 EFI_STRING_ID DevicePath; // For EFI_IFR_QUESTION_REF3_2, EFI_IFR_QUESTION_REF3_3
272 EFI_GUID Guid;
273
274 FORMSET_STORAGE *VarStorage; // For EFI_IFR_SET, EFI_IFR_GET
275 VAR_STORE_INFO VarStoreInfo;// For EFI_IFR_SET, EFI_IFR_GET
276 UINT8 ValueType; // For EFI_IFR_SET, EFI_IFR_GET
277 UINT8 ValueWidth; // For EFI_IFR_SET, EFI_IFR_GET
278 CHAR16 *ValueName; // For EFI_IFR_SET, EFI_IFR_GET
279 LIST_ENTRY MapExpressionList; // nested expressions inside of Map opcode.
280 } EXPRESSION_OPCODE;
281
282 #define EXPRESSION_OPCODE_FROM_LINK(a) CR (a, EXPRESSION_OPCODE, Link, EXPRESSION_OPCODE_SIGNATURE)
283
284 #define FORM_EXPRESSION_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'P')
285
286 typedef struct {
287 UINTN Signature;
288 LIST_ENTRY Link;
289
290 UINT8 Type; // Type for this expression
291
292 UINT8 RuleId; // For EFI_IFR_RULE only
293 EFI_STRING_ID Error; // For EFI_IFR_NO_SUBMIT_IF, EFI_IFR_INCONSISTENT_IF only
294
295 EFI_HII_VALUE Result; // Expression evaluation result
296
297 LIST_ENTRY OpCodeListHead; // OpCodes consist of this expression (EXPRESSION_OPCODE)
298 } FORM_EXPRESSION;
299
300 #define FORM_EXPRESSION_FROM_LINK(a) CR (a, FORM_EXPRESSION, Link, FORM_EXPRESSION_SIGNATURE)
301
302 #define FORM_EXPRESSION_LIST_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'R')
303
304 typedef struct {
305 UINTN Signature;
306 UINTN Count;
307 FORM_EXPRESSION *Expression[1]; // Array[Count] of expressions
308 } FORM_EXPRESSION_LIST;
309
310 #define QUESTION_DEFAULT_SIGNATURE SIGNATURE_32 ('Q', 'D', 'F', 'T')
311
312 typedef struct {
313 UINTN Signature;
314 LIST_ENTRY Link;
315
316 UINT16 DefaultId;
317 EFI_HII_VALUE Value; // Default value
318
319 FORM_EXPRESSION *ValueExpression; // Not-NULL indicates default value is provided by EFI_IFR_VALUE
320 } QUESTION_DEFAULT;
321
322 #define QUESTION_DEFAULT_FROM_LINK(a) CR (a, QUESTION_DEFAULT, Link, QUESTION_DEFAULT_SIGNATURE)
323
324 #define QUESTION_OPTION_SIGNATURE SIGNATURE_32 ('Q', 'O', 'P', 'T')
325
326 typedef struct {
327 UINTN Signature;
328 LIST_ENTRY Link;
329
330 EFI_STRING_ID Text;
331 UINT8 Flags;
332 EFI_HII_VALUE Value;
333 EFI_IMAGE_ID ImageId;
334
335 FORM_EXPRESSION_LIST *SuppressExpression; // Non-NULL indicates nested inside of SuppressIf
336 } QUESTION_OPTION;
337
338 #define QUESTION_OPTION_FROM_LINK(a) CR (a, QUESTION_OPTION, Link, QUESTION_OPTION_SIGNATURE)
339
340 typedef enum {
341 ExpressFalse = 0,
342 ExpressGrayOut,
343 ExpressSuppress,
344 ExpressDisable
345 } EXPRESS_RESULT;
346
347 typedef enum {
348 ExpressNone = 0,
349 ExpressForm,
350 ExpressStatement,
351 ExpressOption
352 } EXPRESS_LEVEL;
353
354 #define FORM_BROWSER_STATEMENT_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'A')
355
356 typedef struct {
357 UINTN Signature;
358 LIST_ENTRY Link;
359
360 UINT8 Operand; // The operand (first byte) of this Statement or Question
361
362 //
363 // Statement Header
364 //
365 EFI_STRING_ID Prompt;
366 EFI_STRING_ID Help;
367 EFI_STRING_ID TextTwo; // For EFI_IFR_TEXT
368
369 //
370 // Question Header
371 //
372 EFI_QUESTION_ID QuestionId; // The value of zero is reserved
373 EFI_VARSTORE_ID VarStoreId; // A value of zero indicates no variable storage
374 FORMSET_STORAGE *Storage;
375 VAR_STORE_INFO VarStoreInfo;
376 UINT16 StorageWidth;
377 UINT8 QuestionFlags;
378 CHAR16 *VariableName; // Name/Value or EFI Variable name
379 CHAR16 *BlockName; // Buffer storage block name: "OFFSET=...WIDTH=..."
380
381 EFI_HII_VALUE HiiValue; // Edit copy for checkbox, numberic, oneof
382 UINT8 *BufferValue; // Edit copy for string, password, orderedlist
383 UINT8 ValueType; // Data type for orderedlist value array
384
385 //
386 // OpCode specific members
387 //
388 UINT8 Flags; // for EFI_IFR_CHECKBOX, EFI_IFR_DATE, EFI_IFR_NUMERIC, EFI_IFR_ONE_OF,
389 // EFI_IFR_ORDERED_LIST, EFI_IFR_STRING,EFI_IFR_SUBTITLE,EFI_IFR_TIME, EFI_IFR_BANNER
390 UINT8 MaxContainers; // for EFI_IFR_ORDERED_LIST
391
392 UINT16 BannerLineNumber; // for EFI_IFR_BANNER, 1-based line number
393 EFI_STRING_ID QuestionConfig; // for EFI_IFR_ACTION, if 0 then no configuration string will be processed
394
395 UINT64 Minimum; // for EFI_IFR_ONE_OF/EFI_IFR_NUMERIC, it's Min/Max value
396 UINT64 Maximum; // for EFI_IFR_STRING/EFI_IFR_PASSWORD, it's Min/Max length
397 UINT64 Step;
398
399 EFI_DEFAULT_ID DefaultId; // for EFI_IFR_RESET_BUTTON
400 EFI_GUID RefreshGuid; // for EFI_IFR_REFRESH_ID
401 BOOLEAN Locked; // Whether this statement is locked.
402 //
403 // Get from IFR parsing
404 //
405 FORM_EXPRESSION *ValueExpression; // nested EFI_IFR_VALUE, provide Question value and indicate Question is ReadOnly
406 LIST_ENTRY DefaultListHead; // nested EFI_IFR_DEFAULT list (QUESTION_DEFAULT), provide default values
407 LIST_ENTRY OptionListHead; // nested EFI_IFR_ONE_OF_OPTION list (QUESTION_OPTION)
408
409 EFI_IMAGE_ID ImageId; // nested EFI_IFR_IMAGE
410 UINT8 RefreshInterval; // nested EFI_IFR_REFRESH, refresh interval(in seconds) for Question value, 0 means no refresh
411 BOOLEAN InSubtitle; // nesting inside of EFI_IFR_SUBTITLE
412
413 LIST_ENTRY InconsistentListHead;// nested inconsistent expression list (FORM_EXPRESSION)
414 LIST_ENTRY NoSubmitListHead; // nested nosubmit expression list (FORM_EXPRESSION)
415 FORM_EXPRESSION_LIST *Expression; // nesting inside of GrayOutIf/DisableIf/SuppressIf
416
417 FORM_EXPRESSION *ReadExpression; // nested EFI_IFR_READ, provide this question value by read expression.
418 FORM_EXPRESSION *WriteExpression; // nested EFI_IFR_WRITE, evaluate write expression after this question value is set.
419 } FORM_BROWSER_STATEMENT;
420
421 #define FORM_BROWSER_STATEMENT_FROM_LINK(a) CR (a, FORM_BROWSER_STATEMENT, Link, FORM_BROWSER_STATEMENT_SIGNATURE)
422
423 #define FORM_BROWSER_CONFIG_REQUEST_SIGNATURE SIGNATURE_32 ('F', 'C', 'R', 'S')
424 typedef struct {
425 UINTN Signature;
426 LIST_ENTRY Link;
427
428 CHAR16 *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
429 UINTN ElementCount; // Number of <RequestElement> in the <ConfigRequest>
430 UINTN SpareStrLen;
431
432 FORMSET_STORAGE *Storage;
433 } FORM_BROWSER_CONFIG_REQUEST;
434 #define FORM_BROWSER_CONFIG_REQUEST_FROM_LINK(a) CR (a, FORM_BROWSER_CONFIG_REQUEST, Link, FORM_BROWSER_CONFIG_REQUEST_SIGNATURE)
435
436 #define FORM_BROWSER_FORM_SIGNATURE SIGNATURE_32 ('F', 'F', 'R', 'M')
437 #define STANDARD_MAP_FORM_TYPE 0x01
438
439 typedef struct {
440 UINTN Signature;
441 LIST_ENTRY Link;
442
443 UINT16 FormId; // FormId of normal form or formmap form.
444 EFI_STRING_ID FormTitle; // FormTile of normal form, or FormMapMethod title of formmap form.
445 UINT16 FormType; // Specific form type for the different form.
446
447 EFI_IMAGE_ID ImageId;
448
449 BOOLEAN ModalForm; // Whether this is a modal form.
450 BOOLEAN Locked; // Whether this form is locked.
451
452 BOOLEAN NvUpdateRequired; // Whether this form has NV update request.
453
454 LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
455 LIST_ENTRY StatementListHead; // List of Statements and Questions (FORM_BROWSER_STATEMENT)
456 LIST_ENTRY ConfigRequestHead; // List of configreques for all storage.
457 FORM_EXPRESSION_LIST *SuppressExpression; // nesting inside of SuppressIf
458 } FORM_BROWSER_FORM;
459
460 #define FORM_BROWSER_FORM_FROM_LINK(a) CR (a, FORM_BROWSER_FORM, Link, FORM_BROWSER_FORM_SIGNATURE)
461
462 #define FORMSET_DEFAULTSTORE_SIGNATURE SIGNATURE_32 ('F', 'D', 'F', 'S')
463
464 typedef struct {
465 UINTN Signature;
466 LIST_ENTRY Link;
467
468 UINT16 DefaultId;
469 EFI_STRING_ID DefaultName;
470 } FORMSET_DEFAULTSTORE;
471
472 #define FORMSET_DEFAULTSTORE_FROM_LINK(a) CR (a, FORMSET_DEFAULTSTORE, Link, FORMSET_DEFAULTSTORE_SIGNATURE)
473
474 #define FORM_BROWSER_FORMSET_SIGNATURE SIGNATURE_32 ('F', 'B', 'F', 'S')
475
476 typedef struct {
477 UINTN Signature;
478 LIST_ENTRY Link;
479 EFI_HII_HANDLE HiiHandle; // unique id for formset.
480 EFI_HANDLE DriverHandle;
481 EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
482 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
483
484 UINTN IfrBinaryLength;
485 UINT8 *IfrBinaryData;
486
487 EFI_GUID Guid;
488 EFI_STRING_ID FormSetTitle;
489 EFI_STRING_ID Help;
490 UINT8 NumberOfClassGuid;
491 EFI_GUID ClassGuid[3]; // Up to three ClassGuid
492 UINT16 Class; // Tiano extended Class code
493 UINT16 SubClass; // Tiano extended Subclass code
494 EFI_IMAGE_ID ImageId;
495
496 FORM_BROWSER_STATEMENT *StatementBuffer; // Buffer for all Statements and Questions
497 EXPRESSION_OPCODE *ExpressionBuffer; // Buffer for all Expression OpCode
498
499 LIST_ENTRY StorageListHead; // Storage list (FORMSET_STORAGE)
500 LIST_ENTRY DefaultStoreListHead; // DefaultStore list (FORMSET_DEFAULTSTORE)
501 LIST_ENTRY FormListHead; // Form list (FORM_BROWSER_FORM)
502 LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
503 } FORM_BROWSER_FORMSET;
504
505 #define FORM_BROWSER_FORMSET_FROM_LINK(a) CR (a, FORM_BROWSER_FORMSET, Link, FORM_BROWSER_FORMSET_SIGNATURE)
506
507 #define BROWSER_CONTEXT_SIGNATURE SIGNATURE_32 ('B', 'C', 'T', 'X')
508
509 typedef struct {
510 UINTN Signature;
511 LIST_ENTRY Link;
512
513 //
514 // Globals defined in Setup.c
515 //
516 BANNER_DATA *BannerData;
517 UINTN ClassOfVfr;
518 UINTN FunctionKeySetting;
519 BOOLEAN ResetRequired;
520 UINT16 Direction;
521 EFI_SCREEN_DESCRIPTOR ScreenDimensions;
522 CHAR16 *EnterString;
523 CHAR16 *EnterCommitString;
524 CHAR16 *EnterEscapeString;
525 CHAR16 *EscapeString;
526 CHAR16 *MoveHighlight;
527 CHAR16 *MakeSelection;
528 CHAR16 *DecNumericInput;
529 CHAR16 *HexNumericInput;
530 CHAR16 *ToggleCheckBox;
531 CHAR16 *PromptForData;
532 CHAR16 *PromptForPassword;
533 CHAR16 *PromptForNewPassword;
534 CHAR16 *ConfirmPassword;
535 CHAR16 *ConfirmError;
536 CHAR16 *PassowordInvalid;
537 CHAR16 *PressEnter;
538 CHAR16 *EmptyString;
539 CHAR16 *AreYouSure;
540 CHAR16 *YesResponse;
541 CHAR16 *NoResponse;
542 CHAR16 *MiniString;
543 CHAR16 *PlusString;
544 CHAR16 *MinusString;
545 CHAR16 *AdjustNumber;
546 CHAR16 *SaveChanges;
547 CHAR16 *OptionMismatch;
548 CHAR16 *FormSuppress;
549 CHAR16 PromptBlockWidth;
550 CHAR16 OptionBlockWidth;
551 CHAR16 HelpBlockWidth;
552 FORM_BROWSER_FORMSET *OldFormSet;
553
554 //
555 // Globals defined in Ui.c
556 //
557 LIST_ENTRY MenuOption;
558 VOID *MenuRefreshHead;
559 } BROWSER_CONTEXT;
560
561 #define BROWSER_CONTEXT_FROM_LINK(a) CR (a, BROWSER_CONTEXT, Link, BROWSER_CONTEXT_SIGNATURE)
562
563 #define BROWSER_HOT_KEY_SIGNATURE SIGNATURE_32 ('B', 'H', 'K', 'S')
564
565 typedef struct {
566 UINTN Signature;
567 LIST_ENTRY Link;
568
569 EFI_INPUT_KEY *KeyData;
570 IN UINT32 Action;
571 IN UINT16 DefaultId;
572 IN EFI_STRING HelpString;
573 } BROWSER_HOT_KEY;
574
575 #define BROWSER_HOT_KEY_FROM_LINK(a) CR (a, BROWSER_HOT_KEY, Link, BROWSER_HOT_KEY_SIGNATURE)
576
577 //
578 // Scope for get defaut value. It may be GetDefaultForNoStorage, GetDefaultForStorage or GetDefaultForAll.
579 //
580 typedef enum {
581 GetDefaultForNoStorage, // Get default value for question which not has storage.
582 GetDefaultForStorage, // Get default value for question which has storage.
583 GetDefaultForAll, // Get default value for all questions.
584 GetDefaultForMax // Invalid value.
585 } BROWSER_GET_DEFAULT_VALUE;
586
587 extern EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
588 extern EFI_HII_STRING_PROTOCOL *mHiiString;
589 extern EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;
590
591 extern BANNER_DATA *gBannerData;
592 extern EFI_HII_HANDLE gFrontPageHandle;
593 extern UINTN gClassOfVfr;
594 extern UINTN gFunctionKeySetting;
595 extern BOOLEAN gResetRequired;
596 extern EFI_HII_HANDLE gHiiHandle;
597 extern UINT16 gDirection;
598 extern EFI_SCREEN_DESCRIPTOR gScreenDimensions;
599
600 extern FORM_BROWSER_FORMSET *gOldFormSet;
601 extern LIST_ENTRY gBrowserFormSetList;
602 extern LIST_ENTRY gBrowserHotKeyList;
603 extern BROWSER_SETTING_SCOPE gBrowserSettingScope;
604 extern EXIT_HANDLER ExitHandlerFunction;
605 extern UINTN gFooterHeight;
606
607 //
608 // Browser Global Strings
609 //
610 extern CHAR16 *gDiscardFailed;
611 extern CHAR16 *gDefaultFailed;
612 extern CHAR16 *gEnterString;
613 extern CHAR16 *gEnterCommitString;
614 extern CHAR16 *gEnterEscapeString;
615 extern CHAR16 *gEscapeString;
616 extern CHAR16 *gSaveFailed;
617 extern CHAR16 *gMoveHighlight;
618 extern CHAR16 *gMakeSelection;
619 extern CHAR16 *gDecNumericInput;
620 extern CHAR16 *gHexNumericInput;
621 extern CHAR16 *gToggleCheckBox;
622 extern CHAR16 *gPromptForData;
623 extern CHAR16 *gPromptForPassword;
624 extern CHAR16 *gPromptForNewPassword;
625 extern CHAR16 *gConfirmPassword;
626 extern CHAR16 *gConfirmError;
627 extern CHAR16 *gPassowordInvalid;
628 extern CHAR16 *gPressEnter;
629 extern CHAR16 *gEmptyString;
630 extern CHAR16 *gAreYouSure;
631 extern CHAR16 *gYesResponse;
632 extern CHAR16 *gNoResponse;
633 extern CHAR16 *gMiniString;
634 extern CHAR16 *gPlusString;
635 extern CHAR16 *gMinusString;
636 extern CHAR16 *gAdjustNumber;
637 extern CHAR16 *gSaveChanges;
638 extern CHAR16 *gOptionMismatch;
639 extern CHAR16 *gFormSuppress;
640
641 extern CHAR16 gPromptBlockWidth;
642 extern CHAR16 gOptionBlockWidth;
643 extern CHAR16 gHelpBlockWidth;
644
645 extern EFI_GUID gZeroGuid;
646 extern EFI_GUID gTianoHiiIfrGuid;
647
648 #include "Ui.h"
649 //
650 // Global Procedure Defines
651 //
652
653 /**
654 Initialize the HII String Token to the correct values.
655
656 **/
657 VOID
658 InitializeBrowserStrings (
659 VOID
660 );
661
662 /**
663 Prints a unicode string to the default console,
664 using L"%s" format.
665
666 @param String String pointer.
667
668 @return Length of string printed to the console
669
670 **/
671 UINTN
672 PrintString (
673 IN CHAR16 *String
674 );
675
676 /**
677 Prints a chracter to the default console,
678 using L"%c" format.
679
680 @param Character Character to print.
681
682 @return Length of string printed to the console.
683
684 **/
685 UINTN
686 PrintChar (
687 CHAR16 Character
688 );
689
690 /**
691 Prints a formatted unicode string to the default console, at
692 the supplied cursor position.
693
694 @param Column The cursor position to print the string at.
695 @param Row The cursor position to print the string at
696 @param Fmt Format string
697 @param ... Variable argument list for formating string.
698
699 @return Length of string printed to the console
700
701 **/
702 UINTN
703 EFIAPI
704 PrintAt (
705 IN UINTN Column,
706 IN UINTN Row,
707 IN CHAR16 *Fmt,
708 ...
709 );
710
711 /**
712 Prints a unicode string to the default console, at
713 the supplied cursor position, using L"%s" format.
714
715 @param Column The cursor position to print the string at.
716 @param Row The cursor position to print the string at
717 @param String String pointer.
718
719 @return Length of string printed to the console
720
721 **/
722 UINTN
723 PrintStringAt (
724 IN UINTN Column,
725 IN UINTN Row,
726 IN CHAR16 *String
727 );
728
729 /**
730 Prints a chracter to the default console, at
731 the supplied cursor position, using L"%c" format.
732
733 @param Column The cursor position to print the string at.
734 @param Row The cursor position to print the string at.
735 @param Character Character to print.
736
737 @return Length of string printed to the console.
738
739 **/
740 UINTN
741 PrintCharAt (
742 IN UINTN Column,
743 IN UINTN Row,
744 CHAR16 Character
745 );
746
747 /**
748 Parse opcodes in the formset IFR binary.
749
750 @param FormSet Pointer of the FormSet data structure.
751
752 @retval EFI_SUCCESS Opcode parse success.
753 @retval Other Opcode parse fail.
754
755 **/
756 EFI_STATUS
757 ParseOpCodes (
758 IN FORM_BROWSER_FORMSET *FormSet
759 );
760
761 /**
762 Free resources allocated for a FormSet.
763
764 @param FormSet Pointer of the FormSet
765
766 **/
767 VOID
768 DestroyFormSet (
769 IN OUT FORM_BROWSER_FORMSET *FormSet
770 );
771
772 /**
773 This function displays the page frame.
774
775 @param Selection Selection contains the information about
776 the Selection, form and formset to be displayed.
777 Selection action may be updated in retrieve callback.
778 **/
779 VOID
780 DisplayPageFrame (
781 IN UI_MENU_SELECTION *Selection
782 );
783
784 /**
785 Create a new string in HII Package List.
786
787 @param String The String to be added
788 @param HiiHandle The package list in the HII database to insert the
789 specified string.
790
791 @return The output string.
792
793 **/
794 EFI_STRING_ID
795 NewString (
796 IN CHAR16 *String,
797 IN EFI_HII_HANDLE HiiHandle
798 );
799
800 /**
801 Delete a string from HII Package List.
802
803 @param StringId Id of the string in HII database.
804 @param HiiHandle The HII package list handle.
805
806 @retval EFI_SUCCESS The string was deleted successfully.
807
808 **/
809 EFI_STATUS
810 DeleteString (
811 IN EFI_STRING_ID StringId,
812 IN EFI_HII_HANDLE HiiHandle
813 );
814
815 /**
816 Get the string based on the StringId and HII Package List Handle.
817
818 @param Token The String's ID.
819 @param HiiHandle The package list in the HII database to search for
820 the specified string.
821
822 @return The output string.
823
824 **/
825 CHAR16 *
826 GetToken (
827 IN EFI_STRING_ID Token,
828 IN EFI_HII_HANDLE HiiHandle
829 );
830
831 /**
832 Draw a pop up windows based on the dimension, number of lines and
833 strings specified.
834
835 @param RequestedWidth The width of the pop-up.
836 @param NumberOfLines The number of lines.
837 @param Marker The variable argument list for the list of string to be printed.
838
839 **/
840 VOID
841 CreateSharedPopUp (
842 IN UINTN RequestedWidth,
843 IN UINTN NumberOfLines,
844 IN VA_LIST Marker
845 );
846
847 /**
848 Routine used to abstract a generic dialog interface and return the selected key or string
849
850 @param NumberOfLines The number of lines for the dialog box
851 @param HotKey Defines whether a single character is parsed
852 (TRUE) and returned in KeyValue or a string is
853 returned in StringBuffer. Two special characters
854 are considered when entering a string, a SCAN_ESC
855 and an CHAR_CARRIAGE_RETURN. SCAN_ESC terminates
856 string input and returns
857 @param MaximumStringSize The maximum size in bytes of a typed in string
858 (each character is a CHAR16) and the minimum
859 string returned is two bytes
860 @param StringBuffer The passed in pointer to the buffer which will
861 hold the typed in string if HotKey is FALSE
862 @param KeyValue The EFI_KEY value returned if HotKey is TRUE..
863 @param ... A series of (quantity == NumberOfLines) text
864 strings which will be used to construct the dialog
865 box
866
867 @retval EFI_SUCCESS Displayed dialog and received user interaction
868 @retval EFI_INVALID_PARAMETER One of the parameters was invalid (e.g.
869 (StringBuffer == NULL) && (HotKey == FALSE))
870 @retval EFI_DEVICE_ERROR User typed in an ESC character to exit the routine
871
872 **/
873 EFI_STATUS
874 EFIAPI
875 CreateDialog (
876 IN UINTN NumberOfLines,
877 IN BOOLEAN HotKey,
878 IN UINTN MaximumStringSize,
879 OUT CHAR16 *StringBuffer,
880 OUT EFI_INPUT_KEY *KeyValue,
881 ...
882 );
883
884 /**
885 Get Value for given Name from a NameValue Storage.
886
887 @param Storage The NameValue Storage.
888 @param Name The Name.
889 @param Value The retured Value.
890
891 @retval EFI_SUCCESS Value found for given Name.
892 @retval EFI_NOT_FOUND No such Name found in NameValue storage.
893
894 **/
895 EFI_STATUS
896 GetValueByName (
897 IN FORMSET_STORAGE *Storage,
898 IN CHAR16 *Name,
899 IN OUT CHAR16 **Value
900 );
901
902 /**
903 Set Value of given Name in a NameValue Storage.
904
905 @param Storage The NameValue Storage.
906 @param Name The Name.
907 @param Value The Value to set.
908 @param Edit Whether update editValue or Value.
909
910 @retval EFI_SUCCESS Value found for given Name.
911 @retval EFI_NOT_FOUND No such Name found in NameValue storage.
912
913 **/
914 EFI_STATUS
915 SetValueByName (
916 IN FORMSET_STORAGE *Storage,
917 IN CHAR16 *Name,
918 IN CHAR16 *Value,
919 IN BOOLEAN Edit
920 );
921
922 /**
923 Get Question's current Value.
924
925 @param FormSet FormSet data structure.
926 @param Form Form data structure.
927 @param Question Question to be initialized.
928 @param Cached TRUE: get from Edit copy FALSE: get from original
929 Storage
930
931 @retval EFI_SUCCESS The function completed successfully.
932
933 **/
934 EFI_STATUS
935 GetQuestionValue (
936 IN FORM_BROWSER_FORMSET *FormSet,
937 IN FORM_BROWSER_FORM *Form,
938 IN OUT FORM_BROWSER_STATEMENT *Question,
939 IN BOOLEAN Cached
940 );
941
942 /**
943 Save Question Value to edit copy(cached) or Storage(uncached).
944
945 @param FormSet FormSet data structure.
946 @param Form Form data structure.
947 @param Question Pointer to the Question.
948 @param Cached TRUE: set to Edit copy FALSE: set to original
949 Storage
950
951 @retval EFI_SUCCESS The function completed successfully.
952
953 **/
954 EFI_STATUS
955 SetQuestionValue (
956 IN FORM_BROWSER_FORMSET *FormSet,
957 IN FORM_BROWSER_FORM *Form,
958 IN OUT FORM_BROWSER_STATEMENT *Question,
959 IN BOOLEAN Cached
960 );
961
962 /**
963 Perform inconsistent check for a Form.
964
965 @param FormSet FormSet data structure.
966 @param Form Form data structure.
967 @param Question The Question to be validated.
968 @param Type Validation type: InConsistent or NoSubmit
969
970 @retval EFI_SUCCESS Form validation pass.
971 @retval other Form validation failed.
972
973 **/
974 EFI_STATUS
975 ValidateQuestion (
976 IN FORM_BROWSER_FORMSET *FormSet,
977 IN FORM_BROWSER_FORM *Form,
978 IN FORM_BROWSER_STATEMENT *Question,
979 IN UINTN Type
980 );
981
982
983 /**
984 Discard data based on the input setting scope (Form, FormSet or System).
985
986 @param FormSet FormSet data structure.
987 @param Form Form data structure.
988 @param SettingScope Setting Scope for Discard action.
989
990 @retval EFI_SUCCESS The function completed successfully.
991 @retval EFI_UNSUPPORTED Unsupport SettingScope.
992
993 **/
994 EFI_STATUS
995 DiscardForm (
996 IN FORM_BROWSER_FORMSET *FormSet,
997 IN FORM_BROWSER_FORM *Form,
998 IN BROWSER_SETTING_SCOPE SettingScope
999 );
1000
1001 /**
1002 Submit data based on the input Setting level (Form, FormSet or System).
1003
1004 @param FormSet FormSet data structure.
1005 @param Form Form data structure.
1006 @param SettingScope Setting Scope for Submit action.
1007
1008 @retval EFI_SUCCESS The function completed successfully.
1009 @retval EFI_UNSUPPORTED Unsupport SettingScope.
1010
1011 **/
1012 EFI_STATUS
1013 SubmitForm (
1014 IN FORM_BROWSER_FORMSET *FormSet,
1015 IN FORM_BROWSER_FORM *Form,
1016 IN BROWSER_SETTING_SCOPE SettingScope
1017 );
1018
1019 /**
1020 Reset Question to its default value.
1021
1022 @param FormSet The form set.
1023 @param Form The form.
1024 @param Question The question.
1025 @param DefaultId The Class of the default.
1026
1027 @retval EFI_SUCCESS Question is reset to default value.
1028
1029 **/
1030 EFI_STATUS
1031 GetQuestionDefault (
1032 IN FORM_BROWSER_FORMSET *FormSet,
1033 IN FORM_BROWSER_FORM *Form,
1034 IN FORM_BROWSER_STATEMENT *Question,
1035 IN UINT16 DefaultId
1036 );
1037
1038 /**
1039 Get current setting of Questions.
1040
1041 @param FormSet FormSet data structure.
1042
1043 @retval EFI_SUCCESS The function completed successfully.
1044
1045 **/
1046 EFI_STATUS
1047 InitializeCurrentSetting (
1048 IN OUT FORM_BROWSER_FORMSET *FormSet
1049 );
1050
1051 /**
1052 Initialize the internal data structure of a FormSet.
1053
1054 @param Handle PackageList Handle
1055 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
1056 GUID), take the first FormSet found in package
1057 list.
1058 @param FormSet FormSet data structure.
1059 @param UpdateGlobalVar Whether need to update the global variable.
1060
1061 @retval EFI_SUCCESS The function completed successfully.
1062 @retval EFI_NOT_FOUND The specified FormSet could not be found.
1063
1064 **/
1065 EFI_STATUS
1066 InitializeFormSet (
1067 IN EFI_HII_HANDLE Handle,
1068 IN OUT EFI_GUID *FormSetGuid,
1069 OUT FORM_BROWSER_FORMSET *FormSet,
1070 IN BOOLEAN UpdateGlobalVar
1071 );
1072
1073 /**
1074 Reset Questions to their default value in a Form, Formset or System.
1075
1076 GetDefaultValueScope parameter decides which questions will reset
1077 to its default value.
1078
1079 @param FormSet FormSet data structure.
1080 @param Form Form data structure.
1081 @param DefaultId The Class of the default.
1082 @param SettingScope Setting Scope for Default action.
1083 @param GetDefaultValueScope Get default value scope.
1084 @param Storage Get default value only for this storage.
1085
1086 @retval EFI_SUCCESS The function completed successfully.
1087 @retval EFI_UNSUPPORTED Unsupport SettingScope.
1088
1089 **/
1090 EFI_STATUS
1091 ExtractDefault (
1092 IN FORM_BROWSER_FORMSET *FormSet,
1093 IN FORM_BROWSER_FORM *Form,
1094 IN UINT16 DefaultId,
1095 IN BROWSER_SETTING_SCOPE SettingScope,
1096 IN BROWSER_GET_DEFAULT_VALUE GetDefaultValueScope,
1097 IN FORMSET_STORAGE *Storage OPTIONAL
1098 );
1099
1100 /**
1101 Initialize Question's Edit copy from Storage.
1102
1103 @param Selection Selection contains the information about
1104 the Selection, form and formset to be displayed.
1105 Selection action may be updated in retrieve callback.
1106 If Selection is NULL, only initialize Question value.
1107 @param FormSet FormSet data structure.
1108 @param Form Form data structure.
1109
1110 @retval EFI_SUCCESS The function completed successfully.
1111
1112 **/
1113 EFI_STATUS
1114 LoadFormConfig (
1115 IN OUT UI_MENU_SELECTION *Selection,
1116 IN FORM_BROWSER_FORMSET *FormSet,
1117 IN FORM_BROWSER_FORM *Form
1118 );
1119
1120 /**
1121 Initialize Question's Edit copy from Storage for the whole Formset.
1122
1123 @param Selection Selection contains the information about
1124 the Selection, form and formset to be displayed.
1125 Selection action may be updated in retrieve callback.
1126 If Selection is NULL, only initialize Question value.
1127 @param FormSet FormSet data structure.
1128
1129 @retval EFI_SUCCESS The function completed successfully.
1130
1131 **/
1132 EFI_STATUS
1133 LoadFormSetConfig (
1134 IN OUT UI_MENU_SELECTION *Selection,
1135 IN FORM_BROWSER_FORMSET *FormSet
1136 );
1137
1138 /**
1139 Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.
1140
1141 @param Buffer The Storage to be conveted.
1142 @param ConfigResp The returned <ConfigResp>.
1143 @param SingleForm Whether update data for single form or formset level.
1144
1145 @retval EFI_SUCCESS Convert success.
1146 @retval EFI_INVALID_PARAMETER Incorrect storage type.
1147
1148 **/
1149 EFI_STATUS
1150 StorageToConfigResp (
1151 IN VOID *Buffer,
1152 IN CHAR16 **ConfigResp,
1153 IN BOOLEAN SingleForm
1154 );
1155
1156 /**
1157 Convert <ConfigResp> to settings in Buffer Storage or NameValue Storage.
1158
1159 @param Storage The Storage to receive the settings.
1160 @param ConfigResp The <ConfigResp> to be converted.
1161
1162 @retval EFI_SUCCESS Convert success.
1163 @retval EFI_INVALID_PARAMETER Incorrect storage type.
1164
1165 **/
1166 EFI_STATUS
1167 ConfigRespToStorage (
1168 IN FORMSET_STORAGE *Storage,
1169 IN CHAR16 *ConfigResp
1170 );
1171
1172 /**
1173 Fill storage's edit copy with settings requested from Configuration Driver.
1174
1175 @param FormSet FormSet data structure.
1176 @param Storage Buffer Storage.
1177
1178 @retval EFI_SUCCESS The function completed successfully.
1179
1180 **/
1181 EFI_STATUS
1182 LoadStorage (
1183 IN FORM_BROWSER_FORMSET *FormSet,
1184 IN FORMSET_STORAGE *Storage
1185 );
1186
1187 /**
1188 Fetch the Ifr binary data of a FormSet.
1189
1190 @param Handle PackageList Handle
1191 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
1192 GUID), take the first FormSet found in package
1193 list.
1194 @param BinaryLength The length of the FormSet IFR binary.
1195 @param BinaryData The buffer designed to receive the FormSet.
1196
1197 @retval EFI_SUCCESS Buffer filled with the requested FormSet.
1198 BufferLength was updated.
1199 @retval EFI_INVALID_PARAMETER The handle is unknown.
1200 @retval EFI_NOT_FOUND A form or FormSet on the requested handle cannot
1201 be found with the requested FormId.
1202
1203 **/
1204 EFI_STATUS
1205 GetIfrBinaryData (
1206 IN EFI_HII_HANDLE Handle,
1207 IN OUT EFI_GUID *FormSetGuid,
1208 OUT UINTN *BinaryLength,
1209 OUT UINT8 **BinaryData
1210 );
1211
1212 /**
1213 Save globals used by previous call to SendForm(). SendForm() may be called from
1214 HiiConfigAccess.Callback(), this will cause SendForm() be reentried.
1215 So, save globals of previous call to SendForm() and restore them upon exit.
1216
1217 **/
1218 VOID
1219 SaveBrowserContext (
1220 VOID
1221 );
1222
1223 /**
1224 Restore globals used by previous call to SendForm().
1225
1226 **/
1227 VOID
1228 RestoreBrowserContext (
1229 VOID
1230 );
1231
1232 /**
1233 This is the routine which an external caller uses to direct the browser
1234 where to obtain it's information.
1235
1236
1237 @param This The Form Browser protocol instanse.
1238 @param Handles A pointer to an array of Handles. If HandleCount > 1 we
1239 display a list of the formsets for the handles specified.
1240 @param HandleCount The number of Handles specified in Handle.
1241 @param FormSetGuid This field points to the EFI_GUID which must match the Guid
1242 field in the EFI_IFR_FORM_SET op-code for the specified
1243 forms-based package. If FormSetGuid is NULL, then this
1244 function will display the first found forms package.
1245 @param FormId This field specifies which EFI_IFR_FORM to render as the first
1246 displayable page. If this field has a value of 0x0000, then
1247 the forms browser will render the specified forms in their encoded order.
1248 ScreenDimenions - This allows the browser to be called so that it occupies a
1249 portion of the physical screen instead of dynamically determining the screen dimensions.
1250 ActionRequest - Points to the action recommended by the form.
1251 @param ScreenDimensions Points to recommended form dimensions, including any non-content area, in
1252 characters.
1253 @param ActionRequest Points to the action recommended by the form.
1254
1255 @retval EFI_SUCCESS The function completed successfully.
1256 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1257 @retval EFI_NOT_FOUND No valid forms could be found to display.
1258
1259 **/
1260 EFI_STATUS
1261 EFIAPI
1262 SendForm (
1263 IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,
1264 IN EFI_HII_HANDLE *Handles,
1265 IN UINTN HandleCount,
1266 IN EFI_GUID *FormSetGuid, OPTIONAL
1267 IN UINT16 FormId, OPTIONAL
1268 IN CONST EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL
1269 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest OPTIONAL
1270 );
1271
1272 /**
1273 This function is called by a callback handler to retrieve uncommitted state
1274 data from the browser.
1275
1276 @param This A pointer to the EFI_FORM_BROWSER2_PROTOCOL
1277 instance.
1278 @param ResultsDataSize A pointer to the size of the buffer associated
1279 with ResultsData.
1280 @param ResultsData A string returned from an IFR browser or
1281 equivalent. The results string will have no
1282 routing information in them.
1283 @param RetrieveData A BOOLEAN field which allows an agent to retrieve
1284 (if RetrieveData = TRUE) data from the uncommitted
1285 browser state information or set (if RetrieveData
1286 = FALSE) data in the uncommitted browser state
1287 information.
1288 @param VariableGuid An optional field to indicate the target variable
1289 GUID name to use.
1290 @param VariableName An optional field to indicate the target
1291 human-readable variable name.
1292
1293 @retval EFI_SUCCESS The results have been distributed or are awaiting
1294 distribution.
1295 @retval EFI_BUFFER_TOO_SMALL The ResultsDataSize specified was too small to
1296 contain the results data.
1297
1298 **/
1299 EFI_STATUS
1300 EFIAPI
1301 BrowserCallback (
1302 IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,
1303 IN OUT UINTN *ResultsDataSize,
1304 IN OUT EFI_STRING ResultsData,
1305 IN BOOLEAN RetrieveData,
1306 IN CONST EFI_GUID *VariableGuid, OPTIONAL
1307 IN CONST CHAR16 *VariableName OPTIONAL
1308 );
1309
1310 /**
1311 Find menu which will show next time.
1312
1313 @param Selection On input, Selection tell setup browser the information
1314 about the Selection, form and formset to be displayed.
1315 On output, Selection return the screen item that is selected
1316 by user.
1317 @param Repaint Whether need to repaint the menu.
1318 @param NewLine Whether need to show at new line.
1319
1320 @retval TRUE Need return.
1321 @retval FALSE No need to return.
1322 **/
1323 BOOLEAN
1324 FindNextMenu (
1325 IN OUT UI_MENU_SELECTION *Selection,
1326 IN BOOLEAN *Repaint,
1327 IN BOOLEAN *NewLine
1328 );
1329
1330 /**
1331 check whether the formset need to update the NV.
1332
1333 @param FormSet FormSet data structure.
1334 @param SetValue Whether set new value or clear old value.
1335
1336 **/
1337 VOID
1338 UpdateNvInfoInForm (
1339 IN FORM_BROWSER_FORMSET *FormSet,
1340 IN BOOLEAN SetValue
1341 );
1342
1343 /**
1344 check whether the formset need to update the NV.
1345
1346 @param FormSet FormSet data structure.
1347
1348 @retval TRUE Need to update the NV.
1349 @retval FALSE No need to update the NV.
1350 **/
1351 BOOLEAN
1352 IsNvUpdateRequired (
1353 IN FORM_BROWSER_FORMSET *FormSet
1354 );
1355
1356 /**
1357 Call the call back function for the question and process the return action.
1358
1359 @param Selection On input, Selection tell setup browser the information
1360 about the Selection, form and formset to be displayed.
1361 On output, Selection return the screen item that is selected
1362 by user.
1363 @param Statement The Question which need to call.
1364 @param Action The action request.
1365 @param SkipSaveOrDiscard Whether skip save or discard action.
1366
1367 @retval EFI_SUCCESS The call back function excutes successfully.
1368 @return Other value if the call back function failed to excute.
1369 **/
1370 EFI_STATUS
1371 ProcessCallBackFunction (
1372 IN OUT UI_MENU_SELECTION *Selection,
1373 IN FORM_BROWSER_STATEMENT *Question,
1374 IN EFI_BROWSER_ACTION Action,
1375 IN BOOLEAN SkipSaveOrDiscard
1376 );
1377
1378 /**
1379 Find the matched FormSet context in the backup maintain list based on HiiHandle.
1380
1381 @param Handle The Hii Handle.
1382
1383 @return the found FormSet context. If no found, NULL will return.
1384
1385 **/
1386 FORM_BROWSER_FORMSET *
1387 GetFormSetFromHiiHandle (
1388 EFI_HII_HANDLE Handle
1389 );
1390
1391 /**
1392 Check whether the input HII handle is the FormSet that is being used.
1393
1394 @param Handle The Hii Handle.
1395
1396 @retval TRUE HII handle is being used.
1397 @retval FALSE HII handle is not being used.
1398
1399 **/
1400 BOOLEAN
1401 IsHiiHandleInBrowserContext (
1402 EFI_HII_HANDLE Handle
1403 );
1404
1405 /**
1406 Configure what scope the hot key will impact.
1407 All hot keys have the same scope. The mixed hot keys with the different level are not supported.
1408 If no scope is set, the default scope will be FormSet level.
1409 After all registered hot keys are removed, previous Scope can reset to another level.
1410
1411 @param[in] Scope Scope level to be set.
1412
1413 @retval EFI_SUCCESS Scope is set correctly.
1414 @retval EFI_INVALID_PARAMETER Scope is not the valid value specified in BROWSER_SETTING_SCOPE.
1415 @retval EFI_UNSPPORTED Scope level is different from current one that the registered hot keys have.
1416
1417 **/
1418 EFI_STATUS
1419 EFIAPI
1420 SetScope (
1421 IN BROWSER_SETTING_SCOPE Scope
1422 );
1423
1424 /**
1425 Register the hot key with its browser action, or unregistered the hot key.
1426 Only support hot key that is not printable character (control key, function key, etc.).
1427 If the action value is zero, the hot key will be unregistered if it has been registered.
1428 If the same hot key has been registered, the new action and help string will override the previous ones.
1429
1430 @param[in] KeyData A pointer to a buffer that describes the keystroke
1431 information for the hot key. Its type is EFI_INPUT_KEY to
1432 be supported by all ConsoleIn devices.
1433 @param[in] Action Action value that describes what action will be trigged when the hot key is pressed.
1434 @param[in] DefaultId Specifies the type of defaults to retrieve, which is only for DEFAULT action.
1435 @param[in] HelpString Help string that describes the hot key information.
1436 Its value may be NULL for the unregistered hot key.
1437
1438 @retval EFI_SUCCESS Hot key is registered or unregistered.
1439 @retval EFI_INVALID_PARAMETER KeyData is NULL.
1440 @retval EFI_NOT_FOUND KeyData is not found to be unregistered.
1441 @retval EFI_UNSUPPORTED Key represents a printable character. It is conflicted with Browser.
1442 **/
1443 EFI_STATUS
1444 EFIAPI
1445 RegisterHotKey (
1446 IN EFI_INPUT_KEY *KeyData,
1447 IN UINT32 Action,
1448 IN UINT16 DefaultId,
1449 IN EFI_STRING HelpString OPTIONAL
1450 );
1451
1452 /**
1453 Register Exit handler function.
1454 When more than one handler function is registered, the latter one will override the previous one.
1455 When NULL handler is specified, the previous Exit handler will be unregistered.
1456
1457 @param[in] Handler Pointer to handler function.
1458
1459 **/
1460 VOID
1461 EFIAPI
1462 RegiserExitHandler (
1463 IN EXIT_HANDLER Handler
1464 );
1465
1466 /**
1467 Create reminder to let user to choose save or discard the changed browser data.
1468 Caller can use it to actively check the changed browser data.
1469
1470 @retval BROWSER_NO_CHANGES No browser data is changed.
1471 @retval BROWSER_SAVE_CHANGES The changed browser data is saved.
1472 @retval BROWSER_DISCARD_CHANGES The changed browser data is discard.
1473
1474 **/
1475 UINT32
1476 EFIAPI
1477 SaveReminder (
1478 VOID
1479 );
1480
1481 /**
1482 Find the registered HotKey based on KeyData.
1483
1484 @param[in] KeyData A pointer to a buffer that describes the keystroke
1485 information for the hot key.
1486
1487 @return The registered HotKey context. If no found, NULL will return.
1488 **/
1489 BROWSER_HOT_KEY *
1490 GetHotKeyFromRegisterList (
1491 IN EFI_INPUT_KEY *KeyData
1492 );
1493
1494 #endif