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