]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
Base on the type field to get the width of value field for option opcode.
[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 //
588 // Get/set question value from/to.
589 //
590 typedef enum {
591 GetSetValueWithEditBuffer, // Get/Set question value from/to editbuffer in the storage.
592 GetSetValueWithBuffer, // Get/Set question value from/to buffer in the storage.
593 GetSetValueWithHiiDriver, // Get/Set question value from/to hii driver.
594 GetSetValueWithMax // Invalid value.
595 } GET_SET_QUESTION_VALUE_WITH;
596
597 extern EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
598 extern EFI_HII_STRING_PROTOCOL *mHiiString;
599 extern EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;
600
601 extern BANNER_DATA *gBannerData;
602 extern EFI_HII_HANDLE gFrontPageHandle;
603 extern UINTN gClassOfVfr;
604 extern UINTN gFunctionKeySetting;
605 extern BOOLEAN gResetRequired;
606 extern EFI_HII_HANDLE gHiiHandle;
607 extern UINT16 gDirection;
608 extern EFI_SCREEN_DESCRIPTOR gScreenDimensions;
609
610 extern FORM_BROWSER_FORMSET *gOldFormSet;
611 extern LIST_ENTRY gBrowserFormSetList;
612 extern LIST_ENTRY gBrowserHotKeyList;
613 extern BROWSER_SETTING_SCOPE gBrowserSettingScope;
614 extern EXIT_HANDLER ExitHandlerFunction;
615 extern UINTN gFooterHeight;
616
617 //
618 // Browser Global Strings
619 //
620 extern CHAR16 *gDiscardFailed;
621 extern CHAR16 *gDefaultFailed;
622 extern CHAR16 *gEnterString;
623 extern CHAR16 *gEnterCommitString;
624 extern CHAR16 *gEnterEscapeString;
625 extern CHAR16 *gEscapeString;
626 extern CHAR16 *gSaveFailed;
627 extern CHAR16 *gMoveHighlight;
628 extern CHAR16 *gMakeSelection;
629 extern CHAR16 *gDecNumericInput;
630 extern CHAR16 *gHexNumericInput;
631 extern CHAR16 *gToggleCheckBox;
632 extern CHAR16 *gPromptForData;
633 extern CHAR16 *gPromptForPassword;
634 extern CHAR16 *gPromptForNewPassword;
635 extern CHAR16 *gConfirmPassword;
636 extern CHAR16 *gConfirmError;
637 extern CHAR16 *gPassowordInvalid;
638 extern CHAR16 *gPressEnter;
639 extern CHAR16 *gEmptyString;
640 extern CHAR16 *gAreYouSure;
641 extern CHAR16 *gYesResponse;
642 extern CHAR16 *gNoResponse;
643 extern CHAR16 *gMiniString;
644 extern CHAR16 *gPlusString;
645 extern CHAR16 *gMinusString;
646 extern CHAR16 *gAdjustNumber;
647 extern CHAR16 *gSaveChanges;
648 extern CHAR16 *gOptionMismatch;
649 extern CHAR16 *gFormSuppress;
650
651 extern CHAR16 gPromptBlockWidth;
652 extern CHAR16 gOptionBlockWidth;
653 extern CHAR16 gHelpBlockWidth;
654
655 extern EFI_GUID gZeroGuid;
656 extern EFI_GUID gTianoHiiIfrGuid;
657
658 #include "Ui.h"
659 //
660 // Global Procedure Defines
661 //
662
663 /**
664 Initialize the HII String Token to the correct values.
665
666 **/
667 VOID
668 InitializeBrowserStrings (
669 VOID
670 );
671
672 /**
673 Prints a unicode string to the default console,
674 using L"%s" format.
675
676 @param String String pointer.
677
678 @return Length of string printed to the console
679
680 **/
681 UINTN
682 PrintString (
683 IN CHAR16 *String
684 );
685
686 /**
687 Prints a chracter to the default console,
688 using L"%c" format.
689
690 @param Character Character to print.
691
692 @return Length of string printed to the console.
693
694 **/
695 UINTN
696 PrintChar (
697 CHAR16 Character
698 );
699
700 /**
701 Prints a formatted unicode string to the default console, at
702 the supplied cursor position.
703
704 @param Column The cursor position to print the string at.
705 @param Row The cursor position to print the string at
706 @param Fmt Format string
707 @param ... Variable argument list for formating string.
708
709 @return Length of string printed to the console
710
711 **/
712 UINTN
713 EFIAPI
714 PrintAt (
715 IN UINTN Column,
716 IN UINTN Row,
717 IN CHAR16 *Fmt,
718 ...
719 );
720
721 /**
722 Prints a unicode string to the default console, at
723 the supplied cursor position, using L"%s" format.
724
725 @param Column The cursor position to print the string at.
726 @param Row The cursor position to print the string at
727 @param String String pointer.
728
729 @return Length of string printed to the console
730
731 **/
732 UINTN
733 PrintStringAt (
734 IN UINTN Column,
735 IN UINTN Row,
736 IN CHAR16 *String
737 );
738
739 /**
740 Prints a chracter to the default console, at
741 the supplied cursor position, using L"%c" format.
742
743 @param Column The cursor position to print the string at.
744 @param Row The cursor position to print the string at.
745 @param Character Character to print.
746
747 @return Length of string printed to the console.
748
749 **/
750 UINTN
751 PrintCharAt (
752 IN UINTN Column,
753 IN UINTN Row,
754 CHAR16 Character
755 );
756
757 /**
758 Parse opcodes in the formset IFR binary.
759
760 @param FormSet Pointer of the FormSet data structure.
761
762 @retval EFI_SUCCESS Opcode parse success.
763 @retval Other Opcode parse fail.
764
765 **/
766 EFI_STATUS
767 ParseOpCodes (
768 IN FORM_BROWSER_FORMSET *FormSet
769 );
770
771 /**
772 Free resources allocated for a FormSet.
773
774 @param FormSet Pointer of the FormSet
775
776 **/
777 VOID
778 DestroyFormSet (
779 IN OUT FORM_BROWSER_FORMSET *FormSet
780 );
781
782 /**
783 This function displays the page frame.
784
785 @param Selection Selection contains the information about
786 the Selection, form and formset to be displayed.
787 Selection action may be updated in retrieve callback.
788 **/
789 VOID
790 DisplayPageFrame (
791 IN UI_MENU_SELECTION *Selection
792 );
793
794 /**
795 Create a new string in HII Package List.
796
797 @param String The String to be added
798 @param HiiHandle The package list in the HII database to insert the
799 specified string.
800
801 @return The output string.
802
803 **/
804 EFI_STRING_ID
805 NewString (
806 IN CHAR16 *String,
807 IN EFI_HII_HANDLE HiiHandle
808 );
809
810 /**
811 Delete a string from HII Package List.
812
813 @param StringId Id of the string in HII database.
814 @param HiiHandle The HII package list handle.
815
816 @retval EFI_SUCCESS The string was deleted successfully.
817
818 **/
819 EFI_STATUS
820 DeleteString (
821 IN EFI_STRING_ID StringId,
822 IN EFI_HII_HANDLE HiiHandle
823 );
824
825 /**
826 Get the string based on the StringId and HII Package List Handle.
827
828 @param Token The String's ID.
829 @param HiiHandle The package list in the HII database to search for
830 the specified string.
831
832 @return The output string.
833
834 **/
835 CHAR16 *
836 GetToken (
837 IN EFI_STRING_ID Token,
838 IN EFI_HII_HANDLE HiiHandle
839 );
840
841 /**
842 Draw a pop up windows based on the dimension, number of lines and
843 strings specified.
844
845 @param RequestedWidth The width of the pop-up.
846 @param NumberOfLines The number of lines.
847 @param Marker The variable argument list for the list of string to be printed.
848
849 **/
850 VOID
851 CreateSharedPopUp (
852 IN UINTN RequestedWidth,
853 IN UINTN NumberOfLines,
854 IN VA_LIST Marker
855 );
856
857 /**
858 Routine used to abstract a generic dialog interface and return the selected key or string
859
860 @param NumberOfLines The number of lines for the dialog box
861 @param HotKey Defines whether a single character is parsed
862 (TRUE) and returned in KeyValue or a string is
863 returned in StringBuffer. Two special characters
864 are considered when entering a string, a SCAN_ESC
865 and an CHAR_CARRIAGE_RETURN. SCAN_ESC terminates
866 string input and returns
867 @param MaximumStringSize The maximum size in bytes of a typed in string
868 (each character is a CHAR16) and the minimum
869 string returned is two bytes
870 @param StringBuffer The passed in pointer to the buffer which will
871 hold the typed in string if HotKey is FALSE
872 @param KeyValue The EFI_KEY value returned if HotKey is TRUE..
873 @param ... A series of (quantity == NumberOfLines) text
874 strings which will be used to construct the dialog
875 box
876
877 @retval EFI_SUCCESS Displayed dialog and received user interaction
878 @retval EFI_INVALID_PARAMETER One of the parameters was invalid (e.g.
879 (StringBuffer == NULL) && (HotKey == FALSE))
880 @retval EFI_DEVICE_ERROR User typed in an ESC character to exit the routine
881
882 **/
883 EFI_STATUS
884 EFIAPI
885 CreateDialog (
886 IN UINTN NumberOfLines,
887 IN BOOLEAN HotKey,
888 IN UINTN MaximumStringSize,
889 OUT CHAR16 *StringBuffer,
890 OUT EFI_INPUT_KEY *KeyValue,
891 ...
892 );
893
894 /**
895 Get Value for given Name from a NameValue Storage.
896
897 @param Storage The NameValue Storage.
898 @param Name The Name.
899 @param Value The retured Value.
900 @param GetValueFrom Where to get source value, from EditValue or Value.
901
902 @retval EFI_SUCCESS Value found for given Name.
903 @retval EFI_NOT_FOUND No such Name found in NameValue storage.
904
905 **/
906 EFI_STATUS
907 GetValueByName (
908 IN FORMSET_STORAGE *Storage,
909 IN CHAR16 *Name,
910 IN OUT CHAR16 **Value,
911 IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
912 );
913
914 /**
915 Set Value of given Name in a NameValue Storage.
916
917 @param Storage The NameValue Storage.
918 @param Name The Name.
919 @param Value The Value to set.
920 @param SetValueTo Whether update editValue or Value.
921
922 @retval EFI_SUCCESS Value found for given Name.
923 @retval EFI_NOT_FOUND No such Name found in NameValue storage.
924
925 **/
926 EFI_STATUS
927 SetValueByName (
928 IN FORMSET_STORAGE *Storage,
929 IN CHAR16 *Name,
930 IN CHAR16 *Value,
931 IN GET_SET_QUESTION_VALUE_WITH SetValueTo
932 );
933
934 /**
935 Get Question's current Value.
936
937 @param FormSet FormSet data structure.
938 @param Form Form data structure.
939 @param Question Question to be initialized.
940 @param GetValueFrom Where to get value, may from editbuffer, buffer or hii driver.
941
942 @retval EFI_SUCCESS The function completed successfully.
943
944 **/
945 EFI_STATUS
946 GetQuestionValue (
947 IN FORM_BROWSER_FORMSET *FormSet,
948 IN FORM_BROWSER_FORM *Form,
949 IN OUT FORM_BROWSER_STATEMENT *Question,
950 IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
951 );
952
953 /**
954 Save Question Value to edit copy(cached) or Storage(uncached).
955
956 @param FormSet FormSet data structure.
957 @param Form Form data structure.
958 @param Question Pointer to the Question.
959 @param SetValueTo Update the question value to editbuffer , buffer or hii driver.
960
961 @retval EFI_SUCCESS The function completed successfully.
962
963 **/
964 EFI_STATUS
965 SetQuestionValue (
966 IN FORM_BROWSER_FORMSET *FormSet,
967 IN FORM_BROWSER_FORM *Form,
968 IN OUT FORM_BROWSER_STATEMENT *Question,
969 IN GET_SET_QUESTION_VALUE_WITH SetValueTo
970 );
971
972 /**
973 Perform inconsistent check for a Form.
974
975 @param FormSet FormSet data structure.
976 @param Form Form data structure.
977 @param Question The Question to be validated.
978 @param Type Validation type: InConsistent or NoSubmit
979
980 @retval EFI_SUCCESS Form validation pass.
981 @retval other Form validation failed.
982
983 **/
984 EFI_STATUS
985 ValidateQuestion (
986 IN FORM_BROWSER_FORMSET *FormSet,
987 IN FORM_BROWSER_FORM *Form,
988 IN FORM_BROWSER_STATEMENT *Question,
989 IN UINTN Type
990 );
991
992
993 /**
994 Discard data based on the input setting scope (Form, FormSet or System).
995
996 @param FormSet FormSet data structure.
997 @param Form Form data structure.
998 @param SettingScope Setting Scope for Discard action.
999
1000 @retval EFI_SUCCESS The function completed successfully.
1001 @retval EFI_UNSUPPORTED Unsupport SettingScope.
1002
1003 **/
1004 EFI_STATUS
1005 DiscardForm (
1006 IN FORM_BROWSER_FORMSET *FormSet,
1007 IN FORM_BROWSER_FORM *Form,
1008 IN BROWSER_SETTING_SCOPE SettingScope
1009 );
1010
1011 /**
1012 Submit data based on the input Setting level (Form, FormSet or System).
1013
1014 @param FormSet FormSet data structure.
1015 @param Form Form data structure.
1016 @param SettingScope Setting Scope for Submit action.
1017
1018 @retval EFI_SUCCESS The function completed successfully.
1019 @retval EFI_UNSUPPORTED Unsupport SettingScope.
1020
1021 **/
1022 EFI_STATUS
1023 SubmitForm (
1024 IN FORM_BROWSER_FORMSET *FormSet,
1025 IN FORM_BROWSER_FORM *Form,
1026 IN BROWSER_SETTING_SCOPE SettingScope
1027 );
1028
1029 /**
1030 Reset Question to its default value.
1031
1032 @param FormSet The form set.
1033 @param Form The form.
1034 @param Question The question.
1035 @param DefaultId The Class of the default.
1036
1037 @retval EFI_SUCCESS Question is reset to default value.
1038
1039 **/
1040 EFI_STATUS
1041 GetQuestionDefault (
1042 IN FORM_BROWSER_FORMSET *FormSet,
1043 IN FORM_BROWSER_FORM *Form,
1044 IN FORM_BROWSER_STATEMENT *Question,
1045 IN UINT16 DefaultId
1046 );
1047
1048 /**
1049 Get current setting of Questions.
1050
1051 @param FormSet FormSet data structure.
1052
1053 @retval EFI_SUCCESS The function completed successfully.
1054
1055 **/
1056 EFI_STATUS
1057 InitializeCurrentSetting (
1058 IN OUT FORM_BROWSER_FORMSET *FormSet
1059 );
1060
1061 /**
1062 Initialize the internal data structure of a FormSet.
1063
1064 @param Handle PackageList Handle
1065 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
1066 GUID), take the first FormSet found in package
1067 list.
1068 @param FormSet FormSet data structure.
1069 @param UpdateGlobalVar Whether need to update the global variable.
1070
1071 @retval EFI_SUCCESS The function completed successfully.
1072 @retval EFI_NOT_FOUND The specified FormSet could not be found.
1073
1074 **/
1075 EFI_STATUS
1076 InitializeFormSet (
1077 IN EFI_HII_HANDLE Handle,
1078 IN OUT EFI_GUID *FormSetGuid,
1079 OUT FORM_BROWSER_FORMSET *FormSet,
1080 IN BOOLEAN UpdateGlobalVar
1081 );
1082
1083 /**
1084 Reset Questions to their initial value or default value in a Form, Formset or System.
1085
1086 GetDefaultValueScope parameter decides which questions will reset
1087 to its default value.
1088
1089 @param FormSet FormSet data structure.
1090 @param Form Form data structure.
1091 @param DefaultId The Class of the default.
1092 @param SettingScope Setting Scope for Default action.
1093 @param GetDefaultValueScope Get default value scope.
1094 @param Storage Get default value only for this storage.
1095 @param RetrieveValueFirst Whether call the retrieve call back to
1096 get the initial value before get default
1097 value.
1098
1099 @retval EFI_SUCCESS The function completed successfully.
1100 @retval EFI_UNSUPPORTED Unsupport SettingScope.
1101
1102 **/
1103 EFI_STATUS
1104 ExtractDefault (
1105 IN FORM_BROWSER_FORMSET *FormSet,
1106 IN FORM_BROWSER_FORM *Form,
1107 IN UINT16 DefaultId,
1108 IN BROWSER_SETTING_SCOPE SettingScope,
1109 IN BROWSER_GET_DEFAULT_VALUE GetDefaultValueScope,
1110 IN FORMSET_STORAGE *Storage,
1111 IN BOOLEAN RetrieveValueFirst
1112 );
1113
1114 /**
1115 Initialize Question's Edit copy from Storage.
1116
1117 @param Selection Selection contains the information about
1118 the Selection, form and formset to be displayed.
1119 Selection action may be updated in retrieve callback.
1120 If Selection is NULL, only initialize Question value.
1121 @param FormSet FormSet data structure.
1122 @param Form Form data structure.
1123
1124 @retval EFI_SUCCESS The function completed successfully.
1125
1126 **/
1127 EFI_STATUS
1128 LoadFormConfig (
1129 IN OUT UI_MENU_SELECTION *Selection,
1130 IN FORM_BROWSER_FORMSET *FormSet,
1131 IN FORM_BROWSER_FORM *Form
1132 );
1133
1134 /**
1135 Initialize Question's Edit copy from Storage for the whole Formset.
1136
1137 @param Selection Selection contains the information about
1138 the Selection, form and formset to be displayed.
1139 Selection action may be updated in retrieve callback.
1140 If Selection is NULL, only initialize Question value.
1141 @param FormSet FormSet data structure.
1142
1143 @retval EFI_SUCCESS The function completed successfully.
1144
1145 **/
1146 EFI_STATUS
1147 LoadFormSetConfig (
1148 IN OUT UI_MENU_SELECTION *Selection,
1149 IN FORM_BROWSER_FORMSET *FormSet
1150 );
1151
1152 /**
1153 Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.
1154
1155 @param Buffer The Storage to be conveted.
1156 @param ConfigResp The returned <ConfigResp>.
1157 @param SingleForm Whether update data for single form or formset level.
1158
1159 @retval EFI_SUCCESS Convert success.
1160 @retval EFI_INVALID_PARAMETER Incorrect storage type.
1161
1162 **/
1163 EFI_STATUS
1164 StorageToConfigResp (
1165 IN VOID *Buffer,
1166 IN CHAR16 **ConfigResp,
1167 IN BOOLEAN SingleForm
1168 );
1169
1170 /**
1171 Convert <ConfigResp> to settings in Buffer Storage or NameValue Storage.
1172
1173 @param Storage The Storage to receive the settings.
1174 @param ConfigResp The <ConfigResp> to be converted.
1175
1176 @retval EFI_SUCCESS Convert success.
1177 @retval EFI_INVALID_PARAMETER Incorrect storage type.
1178
1179 **/
1180 EFI_STATUS
1181 ConfigRespToStorage (
1182 IN FORMSET_STORAGE *Storage,
1183 IN CHAR16 *ConfigResp
1184 );
1185
1186 /**
1187 Fill storage's edit copy with settings requested from Configuration Driver.
1188
1189 @param FormSet FormSet data structure.
1190 @param Storage Buffer Storage.
1191
1192 @retval EFI_SUCCESS The function completed successfully.
1193
1194 **/
1195 EFI_STATUS
1196 LoadStorage (
1197 IN FORM_BROWSER_FORMSET *FormSet,
1198 IN FORMSET_STORAGE *Storage
1199 );
1200
1201 /**
1202 Fetch the Ifr binary data of a FormSet.
1203
1204 @param Handle PackageList Handle
1205 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
1206 GUID), take the first FormSet found in package
1207 list.
1208 @param BinaryLength The length of the FormSet IFR binary.
1209 @param BinaryData The buffer designed to receive the FormSet.
1210
1211 @retval EFI_SUCCESS Buffer filled with the requested FormSet.
1212 BufferLength was updated.
1213 @retval EFI_INVALID_PARAMETER The handle is unknown.
1214 @retval EFI_NOT_FOUND A form or FormSet on the requested handle cannot
1215 be found with the requested FormId.
1216
1217 **/
1218 EFI_STATUS
1219 GetIfrBinaryData (
1220 IN EFI_HII_HANDLE Handle,
1221 IN OUT EFI_GUID *FormSetGuid,
1222 OUT UINTN *BinaryLength,
1223 OUT UINT8 **BinaryData
1224 );
1225
1226 /**
1227 Save globals used by previous call to SendForm(). SendForm() may be called from
1228 HiiConfigAccess.Callback(), this will cause SendForm() be reentried.
1229 So, save globals of previous call to SendForm() and restore them upon exit.
1230
1231 **/
1232 VOID
1233 SaveBrowserContext (
1234 VOID
1235 );
1236
1237 /**
1238 Restore globals used by previous call to SendForm().
1239
1240 **/
1241 VOID
1242 RestoreBrowserContext (
1243 VOID
1244 );
1245
1246 /**
1247 This is the routine which an external caller uses to direct the browser
1248 where to obtain it's information.
1249
1250
1251 @param This The Form Browser protocol instanse.
1252 @param Handles A pointer to an array of Handles. If HandleCount > 1 we
1253 display a list of the formsets for the handles specified.
1254 @param HandleCount The number of Handles specified in Handle.
1255 @param FormSetGuid This field points to the EFI_GUID which must match the Guid
1256 field in the EFI_IFR_FORM_SET op-code for the specified
1257 forms-based package. If FormSetGuid is NULL, then this
1258 function will display the first found forms package.
1259 @param FormId This field specifies which EFI_IFR_FORM to render as the first
1260 displayable page. If this field has a value of 0x0000, then
1261 the forms browser will render the specified forms in their encoded order.
1262 ScreenDimenions - This allows the browser to be called so that it occupies a
1263 portion of the physical screen instead of dynamically determining the screen dimensions.
1264 ActionRequest - Points to the action recommended by the form.
1265 @param ScreenDimensions Points to recommended form dimensions, including any non-content area, in
1266 characters.
1267 @param ActionRequest Points to the action recommended by the form.
1268
1269 @retval EFI_SUCCESS The function completed successfully.
1270 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1271 @retval EFI_NOT_FOUND No valid forms could be found to display.
1272
1273 **/
1274 EFI_STATUS
1275 EFIAPI
1276 SendForm (
1277 IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,
1278 IN EFI_HII_HANDLE *Handles,
1279 IN UINTN HandleCount,
1280 IN EFI_GUID *FormSetGuid, OPTIONAL
1281 IN UINT16 FormId, OPTIONAL
1282 IN CONST EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL
1283 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest OPTIONAL
1284 );
1285
1286 /**
1287 This function is called by a callback handler to retrieve uncommitted state
1288 data from the browser.
1289
1290 @param This A pointer to the EFI_FORM_BROWSER2_PROTOCOL
1291 instance.
1292 @param ResultsDataSize A pointer to the size of the buffer associated
1293 with ResultsData.
1294 @param ResultsData A string returned from an IFR browser or
1295 equivalent. The results string will have no
1296 routing information in them.
1297 @param RetrieveData A BOOLEAN field which allows an agent to retrieve
1298 (if RetrieveData = TRUE) data from the uncommitted
1299 browser state information or set (if RetrieveData
1300 = FALSE) data in the uncommitted browser state
1301 information.
1302 @param VariableGuid An optional field to indicate the target variable
1303 GUID name to use.
1304 @param VariableName An optional field to indicate the target
1305 human-readable variable name.
1306
1307 @retval EFI_SUCCESS The results have been distributed or are awaiting
1308 distribution.
1309 @retval EFI_BUFFER_TOO_SMALL The ResultsDataSize specified was too small to
1310 contain the results data.
1311
1312 **/
1313 EFI_STATUS
1314 EFIAPI
1315 BrowserCallback (
1316 IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,
1317 IN OUT UINTN *ResultsDataSize,
1318 IN OUT EFI_STRING ResultsData,
1319 IN BOOLEAN RetrieveData,
1320 IN CONST EFI_GUID *VariableGuid, OPTIONAL
1321 IN CONST CHAR16 *VariableName OPTIONAL
1322 );
1323
1324 /**
1325 Find menu which will show next time.
1326
1327 @param Selection On input, Selection tell setup browser the information
1328 about the Selection, form and formset to be displayed.
1329 On output, Selection return the screen item that is selected
1330 by user.
1331 @param Repaint Whether need to repaint the menu.
1332 @param NewLine Whether need to show at new line.
1333
1334 @retval TRUE Need return.
1335 @retval FALSE No need to return.
1336 **/
1337 BOOLEAN
1338 FindNextMenu (
1339 IN OUT UI_MENU_SELECTION *Selection,
1340 IN BOOLEAN *Repaint,
1341 IN BOOLEAN *NewLine
1342 );
1343
1344 /**
1345 check whether the formset need to update the NV.
1346
1347 @param FormSet FormSet data structure.
1348 @param SetValue Whether set new value or clear old value.
1349
1350 **/
1351 VOID
1352 UpdateNvInfoInForm (
1353 IN FORM_BROWSER_FORMSET *FormSet,
1354 IN BOOLEAN SetValue
1355 );
1356
1357 /**
1358 check whether the formset need to update the NV.
1359
1360 @param FormSet FormSet data structure.
1361
1362 @retval TRUE Need to update the NV.
1363 @retval FALSE No need to update the NV.
1364 **/
1365 BOOLEAN
1366 IsNvUpdateRequired (
1367 IN FORM_BROWSER_FORMSET *FormSet
1368 );
1369
1370 /**
1371 Call the call back function for the question and process the return action.
1372
1373 @param Selection On input, Selection tell setup browser the information
1374 about the Selection, form and formset to be displayed.
1375 On output, Selection return the screen item that is selected
1376 by user.
1377 @param Statement The Question which need to call.
1378 @param Action The action request.
1379 @param SkipSaveOrDiscard Whether skip save or discard action.
1380
1381 @retval EFI_SUCCESS The call back function excutes successfully.
1382 @return Other value if the call back function failed to excute.
1383 **/
1384 EFI_STATUS
1385 ProcessCallBackFunction (
1386 IN OUT UI_MENU_SELECTION *Selection,
1387 IN FORM_BROWSER_STATEMENT *Question,
1388 IN EFI_BROWSER_ACTION Action,
1389 IN BOOLEAN SkipSaveOrDiscard
1390 );
1391
1392 /**
1393 Call the retrieve type call back function for one question to get the initialize data.
1394
1395 This function only used when in the initialize stage, because in this stage, the
1396 Selection->Form is not ready. For other case, use the ProcessCallBackFunction instead.
1397
1398 @param ConfigAccess The config access protocol produced by the hii driver.
1399 @param Statement The Question which need to call.
1400
1401 @retval EFI_SUCCESS The call back function excutes successfully.
1402 @return Other value if the call back function failed to excute.
1403 **/
1404 EFI_STATUS
1405 ProcessRetrieveForQuestion (
1406 IN EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess,
1407 IN FORM_BROWSER_STATEMENT *Statement
1408 );
1409
1410 /**
1411 Find the matched FormSet context in the backup maintain list based on HiiHandle.
1412
1413 @param Handle The Hii Handle.
1414
1415 @return the found FormSet context. If no found, NULL will return.
1416
1417 **/
1418 FORM_BROWSER_FORMSET *
1419 GetFormSetFromHiiHandle (
1420 EFI_HII_HANDLE Handle
1421 );
1422
1423 /**
1424 Check whether the input HII handle is the FormSet that is being used.
1425
1426 @param Handle The Hii Handle.
1427
1428 @retval TRUE HII handle is being used.
1429 @retval FALSE HII handle is not being used.
1430
1431 **/
1432 BOOLEAN
1433 IsHiiHandleInBrowserContext (
1434 EFI_HII_HANDLE Handle
1435 );
1436
1437 /**
1438 Configure what scope the hot key will impact.
1439 All hot keys have the same scope. The mixed hot keys with the different level are not supported.
1440 If no scope is set, the default scope will be FormSet level.
1441 After all registered hot keys are removed, previous Scope can reset to another level.
1442
1443 @param[in] Scope Scope level to be set.
1444
1445 @retval EFI_SUCCESS Scope is set correctly.
1446 @retval EFI_INVALID_PARAMETER Scope is not the valid value specified in BROWSER_SETTING_SCOPE.
1447 @retval EFI_UNSPPORTED Scope level is different from current one that the registered hot keys have.
1448
1449 **/
1450 EFI_STATUS
1451 EFIAPI
1452 SetScope (
1453 IN BROWSER_SETTING_SCOPE Scope
1454 );
1455
1456 /**
1457 Register the hot key with its browser action, or unregistered the hot key.
1458 Only support hot key that is not printable character (control key, function key, etc.).
1459 If the action value is zero, the hot key will be unregistered if it has been registered.
1460 If the same hot key has been registered, the new action and help string will override the previous ones.
1461
1462 @param[in] KeyData A pointer to a buffer that describes the keystroke
1463 information for the hot key. Its type is EFI_INPUT_KEY to
1464 be supported by all ConsoleIn devices.
1465 @param[in] Action Action value that describes what action will be trigged when the hot key is pressed.
1466 @param[in] DefaultId Specifies the type of defaults to retrieve, which is only for DEFAULT action.
1467 @param[in] HelpString Help string that describes the hot key information.
1468 Its value may be NULL for the unregistered hot key.
1469
1470 @retval EFI_SUCCESS Hot key is registered or unregistered.
1471 @retval EFI_INVALID_PARAMETER KeyData is NULL.
1472 @retval EFI_NOT_FOUND KeyData is not found to be unregistered.
1473 @retval EFI_UNSUPPORTED Key represents a printable character. It is conflicted with Browser.
1474 **/
1475 EFI_STATUS
1476 EFIAPI
1477 RegisterHotKey (
1478 IN EFI_INPUT_KEY *KeyData,
1479 IN UINT32 Action,
1480 IN UINT16 DefaultId,
1481 IN EFI_STRING HelpString OPTIONAL
1482 );
1483
1484 /**
1485 Register Exit handler function.
1486 When more than one handler function is registered, the latter one will override the previous one.
1487 When NULL handler is specified, the previous Exit handler will be unregistered.
1488
1489 @param[in] Handler Pointer to handler function.
1490
1491 **/
1492 VOID
1493 EFIAPI
1494 RegiserExitHandler (
1495 IN EXIT_HANDLER Handler
1496 );
1497
1498 /**
1499 Create reminder to let user to choose save or discard the changed browser data.
1500 Caller can use it to actively check the changed browser data.
1501
1502 @retval BROWSER_NO_CHANGES No browser data is changed.
1503 @retval BROWSER_SAVE_CHANGES The changed browser data is saved.
1504 @retval BROWSER_DISCARD_CHANGES The changed browser data is discard.
1505
1506 **/
1507 UINT32
1508 EFIAPI
1509 SaveReminder (
1510 VOID
1511 );
1512
1513 /**
1514 Find the registered HotKey based on KeyData.
1515
1516 @param[in] KeyData A pointer to a buffer that describes the keystroke
1517 information for the hot key.
1518
1519 @return The registered HotKey context. If no found, NULL will return.
1520 **/
1521 BROWSER_HOT_KEY *
1522 GetHotKeyFromRegisterList (
1523 IN EFI_INPUT_KEY *KeyData
1524 );
1525
1526 #endif