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