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