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