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