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