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