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