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