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