]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
1. Correct File header to ## @file
[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 - 2010, Intel Corporation
5 All rights reserved. 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/DevicePath.h>
26 #include <Protocol/UnicodeCollation.h>
27 #include <Protocol/HiiConfigAccess.h>
28 #include <Protocol/HiiConfigRouting.h>
29 #include <Protocol/HiiDatabase.h>
30 #include <Protocol/HiiString.h>
31 #include <Protocol/UserManager.h>
32
33 #include <Guid/MdeModuleHii.h>
34 #include <Guid/HiiPlatformSetupFormset.h>
35
36 #include <Library/PrintLib.h>
37 #include <Library/DebugLib.h>
38 #include <Library/BaseMemoryLib.h>
39 #include <Library/UefiRuntimeServicesTableLib.h>
40 #include <Library/UefiDriverEntryPoint.h>
41 #include <Library/UefiBootServicesTableLib.h>
42 #include <Library/BaseLib.h>
43 #include <Library/MemoryAllocationLib.h>
44 #include <Library/HiiLib.h>
45 #include <Library/PcdLib.h>
46 #include <Library/DevicePathLib.h>
47
48 #include "Colors.h"
49
50 //
51 // This is the generated header file which includes whatever needs to be exported (strings + IFR)
52 //
53
54 extern UINT8 SetupBrowserStrings[];
55
56 //
57 // Screen definitions
58 //
59 #define BANNER_HEIGHT 6
60 #define BANNER_COLUMNS 3
61
62 #define FRONT_PAGE_HEADER_HEIGHT 6
63 #define NONE_FRONT_PAGE_HEADER_HEIGHT 3
64 #define LEFT_SKIPPED_COLUMNS 4
65 #define FOOTER_HEIGHT 4
66 #define STATUS_BAR_HEIGHT 1
67 #define SCROLL_ARROW_HEIGHT 1
68 #define POPUP_PAD_SPACE_COUNT 5
69 #define POPUP_FRAME_WIDTH 2
70
71 //
72 // Definition for function key setting
73 //
74 #define NONE_FUNCTION_KEY_SETTING 0
75 #define DEFAULT_FUNCTION_KEY_SETTING (FUNCTION_NINE | FUNCTION_TEN)
76
77 #define FUNCTION_NINE (1 << 2)
78 #define FUNCTION_TEN (1 << 3)
79
80 typedef struct {
81 EFI_GUID FormSetGuid;
82 UINTN KeySetting;
83 } FUNCTIION_KEY_SETTING;
84
85 //
86 // Character definitions
87 //
88 #define CHAR_SPACE 0x0020
89 #define UPPER_LOWER_CASE_OFFSET 0x20
90
91 //
92 // Time definitions
93 //
94 #define ONE_SECOND 10000000
95
96 //
97 // Display definitions
98 //
99 #define LEFT_HYPER_DELIMITER L'<'
100 #define RIGHT_HYPER_DELIMITER L'>'
101
102 #define LEFT_ONEOF_DELIMITER L'<'
103 #define RIGHT_ONEOF_DELIMITER L'>'
104
105 #define LEFT_NUMERIC_DELIMITER L'['
106 #define RIGHT_NUMERIC_DELIMITER L']'
107
108 #define LEFT_CHECKBOX_DELIMITER L'['
109 #define RIGHT_CHECKBOX_DELIMITER L']'
110
111 #define CHECK_ON L'X'
112 #define CHECK_OFF L' '
113
114 #define TIME_SEPARATOR L':'
115 #define DATE_SEPARATOR L'/'
116
117 #define YES_ANSWER L'Y'
118 #define NO_ANSWER L'N'
119
120 //
121 // This is the Input Error Message
122 //
123 #define INPUT_ERROR 1
124
125 //
126 // This is the NV RAM update required Message
127 //
128 #define NV_UPDATE_REQUIRED 2
129
130 //
131 // Refresh the Status Bar with flags
132 //
133 #define REFRESH_STATUS_BAR 0xff
134
135 //
136 // Incremental string lenght of ConfigRequest
137 //
138 #define CONFIG_REQUEST_STRING_INCREMENTAL 1024
139
140 //
141 // HII value compare result
142 //
143 #define HII_VALUE_UNDEFINED 0
144 #define HII_VALUE_EQUAL 1
145 #define HII_VALUE_LESS_THAN 2
146 #define HII_VALUE_GREATER_THAN 3
147
148 //
149 // Incremental size of stack for expression
150 //
151 #define EXPRESSION_STACK_SIZE_INCREMENT 0x100
152
153 #define EFI_SPECIFICATION_MAJOR_VERSION 0x2
154 #define EFI_SPECIFICATION_MINOR_VERSION 0x1
155 #define EFI_SPECIFICATION_ERRATA_VERSION 0x0
156 #define EFI_IFR_SPECIFICATION_VERSION (UINT16)((EFI_SPECIFICATION_MAJOR_VERSION << 8) | (EFI_SPECIFICATION_MINOR_VERSION << 4) | EFI_SPECIFICATION_ERRATA_VERSION)
157
158
159 #define SETUP_DRIVER_SIGNATURE SIGNATURE_32 ('F', 'B', 'D', 'V')
160 typedef struct {
161 UINT32 Signature;
162
163 EFI_HANDLE Handle;
164
165 //
166 // Produced protocol
167 //
168 EFI_FORM_BROWSER2_PROTOCOL FormBrowser2;
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
187 #define EFI_HII_VARSTORE_BUFFER 0
188 #define EFI_HII_VARSTORE_NAME_VALUE 1
189 #define EFI_HII_VARSTORE_EFI_VARIABLE 2
190
191 #define FORM_INCONSISTENT_VALIDATION 0
192 #define FORM_NO_SUBMIT_VALIDATION 1
193
194 #define FORMSET_CLASS_PLATFORM_SETUP 0x0001
195 #define FORMSET_CLASS_FRONT_PAGE 0x0002
196
197 typedef struct {
198 UINT8 Type;
199 EFI_IFR_TYPE_VALUE Value;
200 } EFI_HII_VALUE;
201
202 #define NAME_VALUE_NODE_SIGNATURE SIGNATURE_32 ('N', 'V', 'S', 'T')
203
204 typedef struct {
205 UINTN Signature;
206 LIST_ENTRY Link;
207 CHAR16 *Name;
208 CHAR16 *Value;
209 CHAR16 *EditValue;
210 } NAME_VALUE_NODE;
211
212 #define NAME_VALUE_NODE_FROM_LINK(a) CR (a, NAME_VALUE_NODE, Link, NAME_VALUE_NODE_SIGNATURE)
213
214 #define FORMSET_STORAGE_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'G')
215
216 typedef struct {
217 UINTN Signature;
218 LIST_ENTRY Link;
219
220 UINT8 Type; // Storage type
221
222 UINT16 VarStoreId;
223 EFI_GUID Guid;
224
225 CHAR16 *Name; // For EFI_IFR_VARSTORE
226 UINT16 Size;
227 UINT8 *Buffer;
228 UINT8 *EditBuffer; // Edit copy for Buffer Storage
229
230 LIST_ENTRY NameValueListHead; // List of NAME_VALUE_NODE
231
232 UINT32 Attributes; // For EFI_IFR_VARSTORE_EFI: EFI Variable attribute
233
234 CHAR16 *ConfigHdr; // <ConfigHdr>
235 CHAR16 *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
236 UINTN ElementCount; // Number of <RequestElement> in the <ConfigRequest>
237 UINTN SpareStrLen; // Spare length of ConfigRequest string buffer
238 } FORMSET_STORAGE;
239
240 #define FORMSET_STORAGE_FROM_LINK(a) CR (a, FORMSET_STORAGE, Link, FORMSET_STORAGE_SIGNATURE)
241
242 #define EXPRESSION_OPCODE_SIGNATURE SIGNATURE_32 ('E', 'X', 'O', 'P')
243
244 typedef struct {
245 UINTN Signature;
246 LIST_ENTRY Link;
247
248 UINT8 Operand;
249
250 UINT8 Format; // For EFI_IFR_TO_STRING, EFI_IFR_FIND
251 UINT8 Flags; // For EFI_IFR_SPAN
252 UINT8 RuleId; // For EFI_IFR_RULE_REF
253
254 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
255
256 EFI_QUESTION_ID QuestionId; // For EFI_IFR_EQ_ID_ID, EFI_IFR_EQ_ID_VAL_LIST, EFI_IFR_QUESTION_REF1
257 EFI_QUESTION_ID QuestionId2;
258
259 UINT16 ListLength; // For EFI_IFR_EQ_ID_VAL_LIST
260 UINT16 *ValueList;
261
262 EFI_STRING_ID DevicePath; // For EFI_IFR_QUESTION_REF3_2, EFI_IFR_QUESTION_REF3_3
263 EFI_GUID Guid;
264 } EXPRESSION_OPCODE;
265
266 #define EXPRESSION_OPCODE_FROM_LINK(a) CR (a, EXPRESSION_OPCODE, Link, EXPRESSION_OPCODE_SIGNATURE)
267
268 #define FORM_EXPRESSION_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'P')
269
270 typedef struct {
271 UINTN Signature;
272 LIST_ENTRY Link;
273
274 UINT8 Type; // Type for this expression
275
276 UINT8 RuleId; // For EFI_IFR_RULE only
277 EFI_STRING_ID Error; // For EFI_IFR_NO_SUBMIT_IF, EFI_IFR_INCONSISTENT_IF only
278
279 EFI_HII_VALUE Result; // Expression evaluation result
280
281 LIST_ENTRY OpCodeListHead; // OpCodes consist of this expression (EXPRESSION_OPCODE)
282 } FORM_EXPRESSION;
283
284 #define FORM_EXPRESSION_FROM_LINK(a) CR (a, FORM_EXPRESSION, Link, FORM_EXPRESSION_SIGNATURE)
285
286 #define QUESTION_DEFAULT_SIGNATURE SIGNATURE_32 ('Q', 'D', 'F', 'T')
287
288 typedef struct {
289 UINTN Signature;
290 LIST_ENTRY Link;
291
292 UINT16 DefaultId;
293 EFI_HII_VALUE Value; // Default value
294
295 FORM_EXPRESSION *ValueExpression; // Not-NULL indicates default value is provided by EFI_IFR_VALUE
296 } QUESTION_DEFAULT;
297
298 #define QUESTION_DEFAULT_FROM_LINK(a) CR (a, QUESTION_DEFAULT, Link, QUESTION_DEFAULT_SIGNATURE)
299
300 #define QUESTION_OPTION_SIGNATURE SIGNATURE_32 ('Q', 'O', 'P', 'T')
301
302 typedef struct {
303 UINTN Signature;
304 LIST_ENTRY Link;
305
306 EFI_STRING_ID Text;
307 UINT8 Flags;
308 EFI_HII_VALUE Value;
309 EFI_IMAGE_ID ImageId;
310
311 FORM_EXPRESSION *SuppressExpression; // Non-NULL indicates nested inside of SuppressIf
312 } QUESTION_OPTION;
313
314 #define QUESTION_OPTION_FROM_LINK(a) CR (a, QUESTION_OPTION, Link, QUESTION_OPTION_SIGNATURE)
315
316 #define FORM_BROWSER_STATEMENT_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'A')
317
318 typedef union {
319 EFI_STRING_ID VarName;
320 UINT16 VarOffset;
321 } VAR_STORE_INFO;
322
323 typedef struct {
324 UINTN Signature;
325 LIST_ENTRY Link;
326
327 UINT8 Operand; // The operand (first byte) of this Statement or Question
328
329 //
330 // Statement Header
331 //
332 EFI_STRING_ID Prompt;
333 EFI_STRING_ID Help;
334 EFI_STRING_ID TextTwo; // For EFI_IFR_TEXT
335
336 //
337 // Question Header
338 //
339 EFI_QUESTION_ID QuestionId; // The value of zero is reserved
340 EFI_VARSTORE_ID VarStoreId; // A value of zero indicates no variable storage
341 FORMSET_STORAGE *Storage;
342 VAR_STORE_INFO VarStoreInfo;
343 UINT16 StorageWidth;
344 UINT8 QuestionFlags;
345 CHAR16 *VariableName; // Name/Value or EFI Variable name
346 CHAR16 *BlockName; // Buffer storage block name: "OFFSET=...WIDTH=..."
347
348 EFI_HII_VALUE HiiValue; // Edit copy for checkbox, numberic, oneof
349 UINT8 *BufferValue; // Edit copy for string, password, orderedlist
350 UINT8 ValueType; // Data type for orderedlist value array
351
352 //
353 // OpCode specific members
354 //
355 UINT8 Flags; // for EFI_IFR_CHECKBOX, EFI_IFR_DATE, EFI_IFR_NUMERIC, EFI_IFR_ONE_OF,
356 // EFI_IFR_ORDERED_LIST, EFI_IFR_STRING,EFI_IFR_SUBTITLE,EFI_IFR_TIME, EFI_IFR_BANNER
357 UINT8 MaxContainers; // for EFI_IFR_ORDERED_LIST
358
359 UINT16 BannerLineNumber; // for EFI_IFR_BANNER, 1-based line number
360 EFI_STRING_ID QuestionConfig; // for EFI_IFR_ACTION, if 0 then no configuration string will be processed
361
362 UINT64 Minimum; // for EFI_IFR_ONE_OF/EFI_IFR_NUMERIC, it's Min/Max value
363 UINT64 Maximum; // for EFI_IFR_STRING/EFI_IFR_PASSWORD, it's Min/Max length
364 UINT64 Step;
365
366 EFI_DEFAULT_ID DefaultId; // for EFI_IFR_RESET_BUTTON
367 EFI_FORM_ID RefFormId; // for EFI_IFR_REF
368 EFI_QUESTION_ID RefQuestionId; // for EFI_IFR_REF2
369 EFI_GUID RefFormSetId; // for EFI_IFR_REF3
370 EFI_STRING_ID RefDevicePath; // for EFI_IFR_REF4
371
372 //
373 // Get from IFR parsing
374 //
375 FORM_EXPRESSION *ValueExpression; // nested EFI_IFR_VALUE, provide Question value and indicate Question is ReadOnly
376 LIST_ENTRY DefaultListHead; // nested EFI_IFR_DEFAULT list (QUESTION_DEFAULT), provide default values
377 LIST_ENTRY OptionListHead; // nested EFI_IFR_ONE_OF_OPTION list (QUESTION_OPTION)
378
379 EFI_IMAGE_ID ImageId; // nested EFI_IFR_IMAGE
380 UINT8 RefreshInterval; // nested EFI_IFR_REFRESH, refresh interval(in seconds) for Question value, 0 means no refresh
381 BOOLEAN InSubtitle; // nesting inside of EFI_IFR_SUBTITLE
382
383 LIST_ENTRY InconsistentListHead;// nested inconsistent expression list (FORM_EXPRESSION)
384 LIST_ENTRY NoSubmitListHead; // nested nosubmit expression list (FORM_EXPRESSION)
385 FORM_EXPRESSION *GrayOutExpression; // nesting inside of GrayOutIf
386 FORM_EXPRESSION *SuppressExpression; // nesting inside of SuppressIf
387 FORM_EXPRESSION *DisableExpression; // nesting inside of DisableIf
388
389 } FORM_BROWSER_STATEMENT;
390
391 #define FORM_BROWSER_STATEMENT_FROM_LINK(a) CR (a, FORM_BROWSER_STATEMENT, Link, FORM_BROWSER_STATEMENT_SIGNATURE)
392
393 #define FORM_BROWSER_FORM_SIGNATURE SIGNATURE_32 ('F', 'F', 'R', 'M')
394
395 typedef struct {
396 UINTN Signature;
397 LIST_ENTRY Link;
398
399 UINT16 FormId;
400 EFI_STRING_ID FormTitle;
401
402 EFI_IMAGE_ID ImageId;
403
404 LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
405 LIST_ENTRY StatementListHead; // List of Statements and Questions (FORM_BROWSER_STATEMENT)
406 FORM_EXPRESSION *SuppressExpression; // nesting inside of SuppressIf
407 } FORM_BROWSER_FORM;
408
409 #define FORM_BROWSER_FORM_FROM_LINK(a) CR (a, FORM_BROWSER_FORM, Link, FORM_BROWSER_FORM_SIGNATURE)
410
411 #define FORMSET_DEFAULTSTORE_SIGNATURE SIGNATURE_32 ('F', 'D', 'F', 'S')
412
413 typedef struct {
414 UINTN Signature;
415 LIST_ENTRY Link;
416
417 UINT16 DefaultId;
418 EFI_STRING_ID DefaultName;
419 } FORMSET_DEFAULTSTORE;
420
421 #define FORMSET_DEFAULTSTORE_FROM_LINK(a) CR (a, FORMSET_DEFAULTSTORE, Link, FORMSET_DEFAULTSTORE_SIGNATURE)
422
423 typedef struct {
424 EFI_HII_HANDLE HiiHandle;
425 EFI_HANDLE DriverHandle;
426 EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
427 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
428
429 UINTN IfrBinaryLength;
430 UINT8 *IfrBinaryData;
431
432 EFI_GUID Guid;
433 EFI_STRING_ID FormSetTitle;
434 EFI_STRING_ID Help;
435 UINT8 NumberOfClassGuid;
436 EFI_GUID ClassGuid[3]; // Up to three ClassGuid
437 UINT16 Class; // Tiano extended Class code
438 UINT16 SubClass; // Tiano extended Subclass code
439 EFI_IMAGE_ID ImageId;
440
441 FORM_BROWSER_STATEMENT *StatementBuffer; // Buffer for all Statements and Questions
442 EXPRESSION_OPCODE *ExpressionBuffer; // Buffer for all Expression OpCode
443
444 LIST_ENTRY StorageListHead; // Storage list (FORMSET_STORAGE)
445 LIST_ENTRY DefaultStoreListHead; // DefaultStore list (FORMSET_DEFAULTSTORE)
446 LIST_ENTRY FormListHead; // Form list (FORM_BROWSER_FORM)
447 LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
448 } FORM_BROWSER_FORMSET;
449
450 #define BROWSER_CONTEXT_SIGNATURE SIGNATURE_32 ('B', 'C', 'T', 'X')
451
452 typedef struct {
453 UINTN Signature;
454 LIST_ENTRY Link;
455
456 //
457 // Globals defined in Setup.c
458 //
459 BANNER_DATA *BannerData;
460 UINTN ClassOfVfr;
461 UINTN FunctionKeySetting;
462 BOOLEAN ResetRequired;
463 BOOLEAN NvUpdateRequired;
464 UINT16 Direction;
465 EFI_SCREEN_DESCRIPTOR ScreenDimensions;
466 CHAR16 *FunctionNineString;
467 CHAR16 *FunctionTenString;
468 CHAR16 *EnterString;
469 CHAR16 *EnterCommitString;
470 CHAR16 *EnterEscapeString;
471 CHAR16 *EscapeString;
472 CHAR16 *SaveFailed;
473 CHAR16 *MoveHighlight;
474 CHAR16 *MakeSelection;
475 CHAR16 *DecNumericInput;
476 CHAR16 *HexNumericInput;
477 CHAR16 *ToggleCheckBox;
478 CHAR16 *PromptForData;
479 CHAR16 *PromptForPassword;
480 CHAR16 *PromptForNewPassword;
481 CHAR16 *ConfirmPassword;
482 CHAR16 *ConfirmError;
483 CHAR16 *PassowordInvalid;
484 CHAR16 *PressEnter;
485 CHAR16 *EmptyString;
486 CHAR16 *AreYouSure;
487 CHAR16 *YesResponse;
488 CHAR16 *NoResponse;
489 CHAR16 *MiniString;
490 CHAR16 *PlusString;
491 CHAR16 *MinusString;
492 CHAR16 *AdjustNumber;
493 CHAR16 *SaveChanges;
494 CHAR16 *OptionMismatch;
495 CHAR16 *FormSuppress;
496 CHAR16 PromptBlockWidth;
497 CHAR16 OptionBlockWidth;
498 CHAR16 HelpBlockWidth;
499 FORM_BROWSER_FORMSET *OldFormSet;
500
501 //
502 // Globals defined in Ui.c
503 //
504 LIST_ENTRY MenuOption;
505 VOID *MenuRefreshHead;
506 } BROWSER_CONTEXT;
507
508 #define BROWSER_CONTEXT_FROM_LINK(a) CR (a, BROWSER_CONTEXT, Link, BROWSER_CONTEXT_SIGNATURE)
509
510 extern EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
511 extern EFI_HII_STRING_PROTOCOL *mHiiString;
512 extern EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;
513
514 extern BANNER_DATA *gBannerData;
515 extern EFI_HII_HANDLE gFrontPageHandle;
516 extern UINTN gClassOfVfr;
517 extern UINTN gFunctionKeySetting;
518 extern BOOLEAN gResetRequired;
519 extern BOOLEAN gNvUpdateRequired;
520 extern EFI_HII_HANDLE gHiiHandle;
521 extern UINT16 gDirection;
522 extern EFI_SCREEN_DESCRIPTOR gScreenDimensions;
523
524 extern FORM_BROWSER_FORMSET *gOldFormSet;
525
526 //
527 // Browser Global Strings
528 //
529 extern CHAR16 *gFunctionNineString;
530 extern CHAR16 *gFunctionTenString;
531 extern CHAR16 *gEnterString;
532 extern CHAR16 *gEnterCommitString;
533 extern CHAR16 *gEnterEscapeString;
534 extern CHAR16 *gEscapeString;
535 extern CHAR16 *gSaveFailed;
536 extern CHAR16 *gMoveHighlight;
537 extern CHAR16 *gMakeSelection;
538 extern CHAR16 *gDecNumericInput;
539 extern CHAR16 *gHexNumericInput;
540 extern CHAR16 *gToggleCheckBox;
541 extern CHAR16 *gPromptForData;
542 extern CHAR16 *gPromptForPassword;
543 extern CHAR16 *gPromptForNewPassword;
544 extern CHAR16 *gConfirmPassword;
545 extern CHAR16 *gConfirmError;
546 extern CHAR16 *gPassowordInvalid;
547 extern CHAR16 *gPressEnter;
548 extern CHAR16 *gEmptyString;
549 extern CHAR16 *gAreYouSure;
550 extern CHAR16 *gYesResponse;
551 extern CHAR16 *gNoResponse;
552 extern CHAR16 *gMiniString;
553 extern CHAR16 *gPlusString;
554 extern CHAR16 *gMinusString;
555 extern CHAR16 *gAdjustNumber;
556 extern CHAR16 *gSaveChanges;
557 extern CHAR16 *gOptionMismatch;
558 extern CHAR16 *gFormSuppress;
559
560 extern CHAR16 gPromptBlockWidth;
561 extern CHAR16 gOptionBlockWidth;
562 extern CHAR16 gHelpBlockWidth;
563
564 extern EFI_GUID gZeroGuid;
565 extern EFI_GUID gTianoHiiIfrGuid;
566
567 #include "Ui.h"
568 //
569 // Global Procedure Defines
570 //
571
572 /**
573 Initialize the HII String Token to the correct values.
574
575 **/
576 VOID
577 InitializeBrowserStrings (
578 VOID
579 );
580
581 /**
582 Prints a unicode string to the default console,
583 using L"%s" format.
584
585 @param String String pointer.
586
587 @return Length of string printed to the console
588
589 **/
590 UINTN
591 PrintString (
592 IN CHAR16 *String
593 );
594
595 /**
596 Prints a chracter to the default console,
597 using L"%c" format.
598
599 @param Character Character to print.
600
601 @return Length of string printed to the console.
602
603 **/
604 UINTN
605 PrintChar (
606 CHAR16 Character
607 );
608
609 /**
610 Prints a formatted unicode string to the default console, at
611 the supplied cursor position.
612
613 @param Column The cursor position to print the string at.
614 @param Row The cursor position to print the string at
615 @param Fmt Format string
616 @param ... Variable argument list for formating string.
617
618 @return Length of string printed to the console
619
620 **/
621 UINTN
622 PrintAt (
623 IN UINTN Column,
624 IN UINTN Row,
625 IN CHAR16 *Fmt,
626 ...
627 );
628
629 /**
630 Prints a unicode string to the default console, at
631 the supplied cursor position, using L"%s" format.
632
633 @param Column The cursor position to print the string at.
634 @param Row The cursor position to print the string at
635 @param String String pointer.
636
637 @return Length of string printed to the console
638
639 **/
640 UINTN
641 PrintStringAt (
642 IN UINTN Column,
643 IN UINTN Row,
644 IN CHAR16 *String
645 );
646
647 /**
648 Prints a chracter to the default console, at
649 the supplied cursor position, using L"%c" format.
650
651 @param Column The cursor position to print the string at.
652 @param Row The cursor position to print the string at.
653 @param Character Character to print.
654
655 @return Length of string printed to the console.
656
657 **/
658 UINTN
659 PrintCharAt (
660 IN UINTN Column,
661 IN UINTN Row,
662 CHAR16 Character
663 );
664
665 /**
666 Parse opcodes in the formset IFR binary.
667
668 @param FormSet Pointer of the FormSet data structure.
669
670 @retval EFI_SUCCESS Opcode parse success.
671 @retval Other Opcode parse fail.
672
673 **/
674 EFI_STATUS
675 ParseOpCodes (
676 IN FORM_BROWSER_FORMSET *FormSet
677 );
678
679 /**
680 Free resources allocated for a FormSet.
681
682 @param FormSet Pointer of the FormSet
683
684 **/
685 VOID
686 DestroyFormSet (
687 IN OUT FORM_BROWSER_FORMSET *FormSet
688 );
689
690 /**
691 This function displays the page frame.
692
693 **/
694 VOID
695 DisplayPageFrame (
696 VOID
697 );
698
699 /**
700 Create a new string in HII Package List.
701
702 @param String The String to be added
703 @param HiiHandle The package list in the HII database to insert the
704 specified string.
705
706 @return The output string.
707
708 **/
709 EFI_STRING_ID
710 NewString (
711 IN CHAR16 *String,
712 IN EFI_HII_HANDLE HiiHandle
713 );
714
715 /**
716 Delete a string from HII Package List.
717
718 @param StringId Id of the string in HII database.
719 @param HiiHandle The HII package list handle.
720
721 @retval EFI_SUCCESS The string was deleted successfully.
722
723 **/
724 EFI_STATUS
725 DeleteString (
726 IN EFI_STRING_ID StringId,
727 IN EFI_HII_HANDLE HiiHandle
728 );
729
730 /**
731 Get the string based on the StringId and HII Package List Handle.
732
733 @param Token The String's ID.
734 @param HiiHandle The package list in the HII database to search for
735 the specified string.
736
737 @return The output string.
738
739 **/
740 CHAR16 *
741 GetToken (
742 IN EFI_STRING_ID Token,
743 IN EFI_HII_HANDLE HiiHandle
744 );
745
746 /**
747 Draw a pop up windows based on the dimension, number of lines and
748 strings specified.
749
750 @param RequestedWidth The width of the pop-up.
751 @param NumberOfLines The number of lines.
752 @param Marker The variable argument list for the list of string to be printed.
753
754 **/
755 VOID
756 CreateSharedPopUp (
757 IN UINTN RequestedWidth,
758 IN UINTN NumberOfLines,
759 IN VA_LIST Marker
760 );
761
762 /**
763 Routine used to abstract a generic dialog interface and return the selected key or string
764
765 @param NumberOfLines The number of lines for the dialog box
766 @param HotKey Defines whether a single character is parsed
767 (TRUE) and returned in KeyValue or a string is
768 returned in StringBuffer. Two special characters
769 are considered when entering a string, a SCAN_ESC
770 and an CHAR_CARRIAGE_RETURN. SCAN_ESC terminates
771 string input and returns
772 @param MaximumStringSize The maximum size in bytes of a typed in string
773 (each character is a CHAR16) and the minimum
774 string returned is two bytes
775 @param StringBuffer The passed in pointer to the buffer which will
776 hold the typed in string if HotKey is FALSE
777 @param KeyValue The EFI_KEY value returned if HotKey is TRUE..
778 @param ... A series of (quantity == NumberOfLines) text
779 strings which will be used to construct the dialog
780 box
781
782 @retval EFI_SUCCESS Displayed dialog and received user interaction
783 @retval EFI_INVALID_PARAMETER One of the parameters was invalid (e.g.
784 (StringBuffer == NULL) && (HotKey == FALSE))
785 @retval EFI_DEVICE_ERROR User typed in an ESC character to exit the routine
786
787 **/
788 EFI_STATUS
789 CreateDialog (
790 IN UINTN NumberOfLines,
791 IN BOOLEAN HotKey,
792 IN UINTN MaximumStringSize,
793 OUT CHAR16 *StringBuffer,
794 OUT EFI_INPUT_KEY *KeyValue,
795 ...
796 );
797
798 /**
799 Get Question's current Value.
800
801 @param FormSet FormSet data structure.
802 @param Form Form data structure.
803 @param Question Question to be initialized.
804 @param Cached TRUE: get from Edit copy FALSE: get from original
805 Storage
806
807 @retval EFI_SUCCESS The function completed successfully.
808
809 **/
810 EFI_STATUS
811 GetQuestionValue (
812 IN FORM_BROWSER_FORMSET *FormSet,
813 IN FORM_BROWSER_FORM *Form,
814 IN OUT FORM_BROWSER_STATEMENT *Question,
815 IN BOOLEAN Cached
816 );
817
818 /**
819 Save Question Value to edit copy(cached) or Storage(uncached).
820
821 @param FormSet FormSet data structure.
822 @param Form Form data structure.
823 @param Question Pointer to the Question.
824 @param Cached TRUE: set to Edit copy FALSE: set to original
825 Storage
826
827 @retval EFI_SUCCESS The function completed successfully.
828
829 **/
830 EFI_STATUS
831 SetQuestionValue (
832 IN FORM_BROWSER_FORMSET *FormSet,
833 IN FORM_BROWSER_FORM *Form,
834 IN OUT FORM_BROWSER_STATEMENT *Question,
835 IN BOOLEAN Cached
836 );
837
838 /**
839 Perform inconsistent check for a Form.
840
841 @param FormSet FormSet data structure.
842 @param Form Form data structure.
843 @param Question The Question to be validated.
844 @param Type Validation type: InConsistent or NoSubmit
845
846 @retval EFI_SUCCESS Form validation pass.
847 @retval other Form validation failed.
848
849 **/
850 EFI_STATUS
851 ValidateQuestion (
852 IN FORM_BROWSER_FORMSET *FormSet,
853 IN FORM_BROWSER_FORM *Form,
854 IN FORM_BROWSER_STATEMENT *Question,
855 IN UINTN Type
856 );
857
858 /**
859 Submit a Form.
860
861 @param FormSet FormSet data structure.
862 @param Form Form data structure.
863
864 @retval EFI_SUCCESS The function completed successfully.
865
866 **/
867 EFI_STATUS
868 SubmitForm (
869 IN FORM_BROWSER_FORMSET *FormSet,
870 IN FORM_BROWSER_FORM *Form
871 );
872
873 /**
874 Reset Question to its default value.
875
876 @param FormSet The form set.
877 @param Form The form.
878 @param Question The question.
879 @param DefaultId The Class of the default.
880
881 @retval EFI_SUCCESS Question is reset to default value.
882
883 **/
884 EFI_STATUS
885 GetQuestionDefault (
886 IN FORM_BROWSER_FORMSET *FormSet,
887 IN FORM_BROWSER_FORM *Form,
888 IN FORM_BROWSER_STATEMENT *Question,
889 IN UINT16 DefaultId
890 );
891
892 /**
893 Get current setting of Questions.
894
895 @param FormSet FormSet data structure.
896
897 @retval EFI_SUCCESS The function completed successfully.
898
899 **/
900 EFI_STATUS
901 InitializeCurrentSetting (
902 IN OUT FORM_BROWSER_FORMSET *FormSet
903 );
904
905 /**
906 Initialize the internal data structure of a FormSet.
907
908 @param Handle PackageList Handle
909 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
910 GUID), take the first FormSet found in package
911 list.
912 @param FormSet FormSet data structure.
913
914 @retval EFI_SUCCESS The function completed successfully.
915 @retval EFI_NOT_FOUND The specified FormSet could not be found.
916
917 **/
918 EFI_STATUS
919 InitializeFormSet (
920 IN EFI_HII_HANDLE Handle,
921 IN OUT EFI_GUID *FormSetGuid,
922 OUT FORM_BROWSER_FORMSET *FormSet
923 );
924
925 /**
926 Reset Questions in a Form to their default value.
927
928 @param FormSet FormSet data structure.
929 @param Form The Form which to be reset.
930 @param DefaultId The Class of the default.
931
932 @retval EFI_SUCCESS The function completed successfully.
933
934 **/
935 EFI_STATUS
936 ExtractFormDefault (
937 IN FORM_BROWSER_FORMSET *FormSet,
938 IN FORM_BROWSER_FORM *Form,
939 IN UINT16 DefaultId
940 );
941
942 /**
943 Initialize Question's Edit copy from Storage.
944
945 @param Selection Selection contains the information about
946 the Selection, form and formset to be displayed.
947 Selection action may be updated in retrieve callback.
948 @param FormSet FormSet data structure.
949 @param Form Form data structure.
950
951 @retval EFI_SUCCESS The function completed successfully.
952
953 **/
954 EFI_STATUS
955 LoadFormConfig (
956 IN OUT UI_MENU_SELECTION *Selection,
957 IN FORM_BROWSER_FORMSET *FormSet,
958 IN FORM_BROWSER_FORM *Form
959 );
960
961 /**
962 Initialize Question's Edit copy from Storage for the whole Formset.
963
964 @param Selection Selection contains the information about
965 the Selection, form and formset to be displayed.
966 Selection action may be updated in retrieve callback.
967 @param FormSet FormSet data structure.
968
969 @retval EFI_SUCCESS The function completed successfully.
970
971 **/
972 EFI_STATUS
973 LoadFormSetConfig (
974 IN OUT UI_MENU_SELECTION *Selection,
975 IN FORM_BROWSER_FORMSET *FormSet
976 );
977
978 /**
979 Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.
980
981 @param Storage The Storage to be conveted.
982 @param ConfigResp The returned <ConfigResp>.
983
984 @retval EFI_SUCCESS Convert success.
985 @retval EFI_INVALID_PARAMETER Incorrect storage type.
986
987 **/
988 EFI_STATUS
989 StorageToConfigResp (
990 IN FORMSET_STORAGE *Storage,
991 IN CHAR16 **ConfigResp
992 );
993
994 /**
995 Convert <ConfigResp> to settings in Buffer Storage or NameValue Storage.
996
997 @param Storage The Storage to receive the settings.
998 @param ConfigResp The <ConfigResp> to be converted.
999
1000 @retval EFI_SUCCESS Convert success.
1001 @retval EFI_INVALID_PARAMETER Incorrect storage type.
1002
1003 **/
1004 EFI_STATUS
1005 ConfigRespToStorage (
1006 IN FORMSET_STORAGE *Storage,
1007 IN CHAR16 *ConfigResp
1008 );
1009
1010 /**
1011 Fill storage's edit copy with settings requested from Configuration Driver.
1012
1013 @param FormSet FormSet data structure.
1014 @param Storage Buffer Storage.
1015
1016 @retval EFI_SUCCESS The function completed successfully.
1017
1018 **/
1019 EFI_STATUS
1020 LoadStorage (
1021 IN FORM_BROWSER_FORMSET *FormSet,
1022 IN FORMSET_STORAGE *Storage
1023 );
1024
1025 /**
1026 Fetch the Ifr binary data of a FormSet.
1027
1028 @param Handle PackageList Handle
1029 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
1030 GUID), take the first FormSet found in package
1031 list.
1032 @param BinaryLength The length of the FormSet IFR binary.
1033 @param BinaryData The buffer designed to receive the FormSet.
1034
1035 @retval EFI_SUCCESS Buffer filled with the requested FormSet.
1036 BufferLength was updated.
1037 @retval EFI_INVALID_PARAMETER The handle is unknown.
1038 @retval EFI_NOT_FOUND A form or FormSet on the requested handle cannot
1039 be found with the requested FormId.
1040
1041 **/
1042 EFI_STATUS
1043 GetIfrBinaryData (
1044 IN EFI_HII_HANDLE Handle,
1045 IN OUT EFI_GUID *FormSetGuid,
1046 OUT UINTN *BinaryLength,
1047 OUT UINT8 **BinaryData
1048 );
1049
1050 /**
1051 Save globals used by previous call to SendForm(). SendForm() may be called from
1052 HiiConfigAccess.Callback(), this will cause SendForm() be reentried.
1053 So, save globals of previous call to SendForm() and restore them upon exit.
1054
1055 **/
1056 VOID
1057 SaveBrowserContext (
1058 VOID
1059 );
1060
1061 /**
1062 Restore globals used by previous call to SendForm().
1063
1064 **/
1065 VOID
1066 RestoreBrowserContext (
1067 VOID
1068 );
1069
1070 /**
1071 This is the routine which an external caller uses to direct the browser
1072 where to obtain it's information.
1073
1074
1075 @param This The Form Browser protocol instanse.
1076 @param Handles A pointer to an array of Handles. If HandleCount > 1 we
1077 display a list of the formsets for the handles specified.
1078 @param HandleCount The number of Handles specified in Handle.
1079 @param FormSetGuid This field points to the EFI_GUID which must match the Guid
1080 field in the EFI_IFR_FORM_SET op-code for the specified
1081 forms-based package. If FormSetGuid is NULL, then this
1082 function will display the first found forms package.
1083 @param FormId This field specifies which EFI_IFR_FORM to render as the first
1084 displayable page. If this field has a value of 0x0000, then
1085 the forms browser will render the specified forms in their encoded order.
1086 ScreenDimenions - This allows the browser to be called so that it occupies a
1087 portion of the physical screen instead of dynamically determining the screen dimensions.
1088 ActionRequest - Points to the action recommended by the form.
1089 @param ScreenDimensions Points to recommended form dimensions, including any non-content area, in
1090 characters.
1091 @param ActionRequest Points to the action recommended by the form.
1092
1093 @retval EFI_SUCCESS The function completed successfully.
1094 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1095 @retval EFI_NOT_FOUND No valid forms could be found to display.
1096
1097 **/
1098 EFI_STATUS
1099 EFIAPI
1100 SendForm (
1101 IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,
1102 IN EFI_HII_HANDLE *Handles,
1103 IN UINTN HandleCount,
1104 IN EFI_GUID *FormSetGuid, OPTIONAL
1105 IN UINT16 FormId, OPTIONAL
1106 IN CONST EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL
1107 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest OPTIONAL
1108 );
1109
1110 /**
1111 This function is called by a callback handler to retrieve uncommitted state
1112 data from the browser.
1113
1114 @param This A pointer to the EFI_FORM_BROWSER2_PROTOCOL
1115 instance.
1116 @param ResultsDataSize A pointer to the size of the buffer associated
1117 with ResultsData.
1118 @param ResultsData A string returned from an IFR browser or
1119 equivalent. The results string will have no
1120 routing information in them.
1121 @param RetrieveData A BOOLEAN field which allows an agent to retrieve
1122 (if RetrieveData = TRUE) data from the uncommitted
1123 browser state information or set (if RetrieveData
1124 = FALSE) data in the uncommitted browser state
1125 information.
1126 @param VariableGuid An optional field to indicate the target variable
1127 GUID name to use.
1128 @param VariableName An optional field to indicate the target
1129 human-readable variable name.
1130
1131 @retval EFI_SUCCESS The results have been distributed or are awaiting
1132 distribution.
1133 @retval EFI_BUFFER_TOO_SMALL The ResultsDataSize specified was too small to
1134 contain the results data.
1135
1136 **/
1137 EFI_STATUS
1138 EFIAPI
1139 BrowserCallback (
1140 IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,
1141 IN OUT UINTN *ResultsDataSize,
1142 IN OUT EFI_STRING ResultsData,
1143 IN BOOLEAN RetrieveData,
1144 IN CONST EFI_GUID *VariableGuid, OPTIONAL
1145 IN CONST CHAR16 *VariableName OPTIONAL
1146 );
1147
1148 #endif