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