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