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