VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h@ 69498

Last change on this file since 69498 was 58466, checked in by vboxsync, 9 years ago

EFI/Firmware: Merged in the svn:eol-style, svn:mime-type and trailing whitespace cleanup that was done after the initial UDK2014.SP1 import: svn merge /vendor/edk2/UDK2014.SP1 /vendor/edk2/current .

  • Property svn:eol-style set to native
File size: 59.3 KB
Line 
1/** @file
2Private MACRO, structure and function definitions for Setup Browser module.
3
4Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
5This program and the accompanying materials
6are licensed and made available under the terms and conditions of the BSD License
7which accompanies this distribution. The full text of the license may be found at
8http://opensource.org/licenses/bsd-license.php
9
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11WITHOUT 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/FormBrowserEx2.h>
26#include <Protocol/DisplayProtocol.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#include <Protocol/UserManager.h>
34#include <Protocol/DevicePathFromText.h>
35
36#include <Guid/MdeModuleHii.h>
37#include <Guid/HiiPlatformSetupFormset.h>
38#include <Guid/HiiFormMapMethodGuid.h>
39
40#include <Library/PrintLib.h>
41#include <Library/DebugLib.h>
42#include <Library/BaseMemoryLib.h>
43#include <Library/UefiRuntimeServicesTableLib.h>
44#include <Library/UefiDriverEntryPoint.h>
45#include <Library/UefiBootServicesTableLib.h>
46#include <Library/BaseLib.h>
47#include <Library/MemoryAllocationLib.h>
48#include <Library/HiiLib.h>
49#include <Library/PcdLib.h>
50#include <Library/DevicePathLib.h>
51#include <Library/UefiLib.h>
52
53
54//
55// This is the generated header file which includes whatever needs to be exported (strings + IFR)
56//
57
58#define UI_ACTION_NONE 0
59#define UI_ACTION_REFRESH_FORM 1
60#define UI_ACTION_REFRESH_FORMSET 2
61#define UI_ACTION_EXIT 3
62
63//
64//
65// Time definitions
66//
67#define ONE_SECOND 10000000
68
69// Incremental string lenght of ConfigRequest
70//
71#define CONFIG_REQUEST_STRING_INCREMENTAL 1024
72
73//
74// Incremental size of stack for expression
75//
76#define EXPRESSION_STACK_SIZE_INCREMENT 0x100
77
78#define EFI_IFR_SPECIFICATION_VERSION (UINT16) (((EFI_SYSTEM_TABLE_REVISION >> 16) << 8) | (((EFI_SYSTEM_TABLE_REVISION & 0xFFFF) / 10) << 4) | ((EFI_SYSTEM_TABLE_REVISION & 0xFFFF) % 10))
79
80
81#define SETUP_DRIVER_SIGNATURE SIGNATURE_32 ('F', 'B', 'D', 'V')
82typedef struct {
83 UINT32 Signature;
84
85 EFI_HANDLE Handle;
86
87 //
88 // Produced protocol
89 //
90 EFI_FORM_BROWSER2_PROTOCOL FormBrowser2;
91 EFI_FORM_BROWSER_EXTENSION_PROTOCOL FormBrowserEx;
92
93 EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL FormBrowserEx2;
94
95} SETUP_DRIVER_PRIVATE_DATA;
96
97//
98// IFR relative definition
99//
100#define EFI_HII_EXPRESSION_INCONSISTENT_IF 0
101#define EFI_HII_EXPRESSION_NO_SUBMIT_IF 1
102#define EFI_HII_EXPRESSION_GRAY_OUT_IF 2
103#define EFI_HII_EXPRESSION_SUPPRESS_IF 3
104#define EFI_HII_EXPRESSION_DISABLE_IF 4
105#define EFI_HII_EXPRESSION_VALUE 5
106#define EFI_HII_EXPRESSION_RULE 6
107#define EFI_HII_EXPRESSION_READ 7
108#define EFI_HII_EXPRESSION_WRITE 8
109#define EFI_HII_EXPRESSION_WARNING_IF 9
110
111#define EFI_HII_VARSTORE_BUFFER 0
112#define EFI_HII_VARSTORE_NAME_VALUE 1
113#define EFI_HII_VARSTORE_EFI_VARIABLE 2 // EFI Varstore type follow UEFI spec before 2.3.1.
114#define EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER 3 // EFI varstore type follow UEFI spec 2.3.1 and later.
115
116#define FORM_INCONSISTENT_VALIDATION 0
117#define FORM_NO_SUBMIT_VALIDATION 1
118
119#define NAME_VALUE_NODE_SIGNATURE SIGNATURE_32 ('N', 'V', 'S', 'T')
120
121typedef struct {
122 UINTN Signature;
123 LIST_ENTRY Link;
124 CHAR16 *Name;
125 CHAR16 *Value;
126 CHAR16 *EditValue;
127} NAME_VALUE_NODE;
128
129#define NAME_VALUE_NODE_FROM_LINK(a) CR (a, NAME_VALUE_NODE, Link, NAME_VALUE_NODE_SIGNATURE)
130
131#define BROWSER_STORAGE_SIGNATURE SIGNATURE_32 ('B', 'S', 'T', 'G')
132
133typedef struct {
134 UINTN Signature;
135 LIST_ENTRY Link;
136
137 UINT8 Type; // Storage type
138
139 BOOLEAN Initialized; // Whether this varstore is initialized, efi varstore not used.
140
141 EFI_HII_HANDLE HiiHandle; // HiiHandle for this varstore, efi varstore not used.
142 EFI_GUID Guid;
143
144 CHAR16 *Name; // For EFI_IFR_VARSTORE
145 UINT16 Size;
146 UINT8 *Buffer;
147 UINT8 *EditBuffer; // Edit copy for Buffer Storage
148
149 LIST_ENTRY NameValueListHead; // List of NAME_VALUE_NODE
150
151 UINT32 Attributes; // For EFI_IFR_VARSTORE_EFI: EFI Variable attribute
152
153 CHAR16 *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
154 // <RequestElement> includes all fields which is used by current form sets.
155 UINTN SpareStrLen; // Spare length of ConfigRequest string buffer
156} BROWSER_STORAGE;
157
158#define BROWSER_STORAGE_FROM_LINK(a) CR (a, BROWSER_STORAGE, Link, BROWSER_STORAGE_SIGNATURE)
159
160#define FORMSET_STORAGE_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'G')
161
162typedef struct {
163 UINTN Signature;
164 LIST_ENTRY Link;
165
166 LIST_ENTRY SaveFailLink;
167
168 UINT16 VarStoreId;
169
170 BROWSER_STORAGE *BrowserStorage;
171
172 CHAR16 *ConfigHdr; // <ConfigHdr>
173
174 CHAR16 *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
175 UINTN ElementCount; // Number of <RequestElement> in the <ConfigRequest>
176 UINTN SpareStrLen; // Spare length of ConfigRequest string buffer
177} FORMSET_STORAGE;
178
179#define FORMSET_STORAGE_FROM_LINK(a) CR (a, FORMSET_STORAGE, Link, FORMSET_STORAGE_SIGNATURE)
180#define FORMSET_STORAGE_FROM_SAVE_FAIL_LINK(a) CR (a, FORMSET_STORAGE, SaveFailLink, FORMSET_STORAGE_SIGNATURE)
181
182typedef union {
183 EFI_STRING_ID VarName;
184 UINT16 VarOffset;
185} VAR_STORE_INFO;
186
187#define EXPRESSION_OPCODE_SIGNATURE SIGNATURE_32 ('E', 'X', 'O', 'P')
188
189typedef struct {
190 UINTN Signature;
191 LIST_ENTRY Link;
192
193 UINT8 Operand;
194
195 UINT8 Format; // For EFI_IFR_TO_STRING, EFI_IFR_FIND
196 UINT8 Flags; // For EFI_IFR_SPAN
197 UINT8 RuleId; // For EFI_IFR_RULE_REF
198
199 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
200
201 EFI_QUESTION_ID QuestionId; // For EFI_IFR_EQ_ID_ID, EFI_IFR_EQ_ID_VAL_LIST, EFI_IFR_QUESTION_REF1
202 EFI_QUESTION_ID QuestionId2;
203
204 UINT16 ListLength; // For EFI_IFR_EQ_ID_VAL_LIST
205 UINT16 *ValueList;
206
207 EFI_STRING_ID DevicePath; // For EFI_IFR_QUESTION_REF3_2, EFI_IFR_QUESTION_REF3_3
208 EFI_GUID Guid;
209
210 BROWSER_STORAGE *VarStorage; // For EFI_IFR_SET, EFI_IFR_GET
211 VAR_STORE_INFO VarStoreInfo;// For EFI_IFR_SET, EFI_IFR_GET
212 UINT8 ValueType; // For EFI_IFR_SET, EFI_IFR_GET
213 UINT8 ValueWidth; // For EFI_IFR_SET, EFI_IFR_GET
214 CHAR16 *ValueName; // For EFI_IFR_SET, EFI_IFR_GET
215 LIST_ENTRY MapExpressionList; // nested expressions inside of Map opcode.
216} EXPRESSION_OPCODE;
217
218#define EXPRESSION_OPCODE_FROM_LINK(a) CR (a, EXPRESSION_OPCODE, Link, EXPRESSION_OPCODE_SIGNATURE)
219
220#define FORM_EXPRESSION_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'P')
221
222typedef struct {
223 UINTN Signature;
224 LIST_ENTRY Link;
225
226 UINT8 Type; // Type for this expression
227
228 UINT8 RuleId; // For EFI_IFR_RULE only
229 EFI_STRING_ID Error; // For EFI_IFR_NO_SUBMIT_IF, EFI_IFR_INCONSISTENT_IF only
230
231 EFI_HII_VALUE Result; // Expression evaluation result
232
233 UINT8 TimeOut; // For EFI_IFR_WARNING_IF
234 EFI_IFR_OP_HEADER *OpCode; // Save the opcode buffer.
235
236 LIST_ENTRY OpCodeListHead; // OpCodes consist of this expression (EXPRESSION_OPCODE)
237} FORM_EXPRESSION;
238
239#define FORM_EXPRESSION_FROM_LINK(a) CR (a, FORM_EXPRESSION, Link, FORM_EXPRESSION_SIGNATURE)
240
241#define FORM_EXPRESSION_LIST_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'R')
242
243typedef struct {
244 UINTN Signature;
245 UINTN Count;
246 FORM_EXPRESSION *Expression[1]; // Array[Count] of expressions
247} FORM_EXPRESSION_LIST;
248
249#define QUESTION_DEFAULT_SIGNATURE SIGNATURE_32 ('Q', 'D', 'F', 'T')
250
251typedef struct {
252 UINTN Signature;
253 LIST_ENTRY Link;
254
255 UINT16 DefaultId;
256 EFI_HII_VALUE Value; // Default value
257
258 FORM_EXPRESSION *ValueExpression; // Not-NULL indicates default value is provided by EFI_IFR_VALUE
259} QUESTION_DEFAULT;
260
261#define QUESTION_DEFAULT_FROM_LINK(a) CR (a, QUESTION_DEFAULT, Link, QUESTION_DEFAULT_SIGNATURE)
262
263#define QUESTION_OPTION_SIGNATURE SIGNATURE_32 ('Q', 'O', 'P', 'T')
264
265typedef struct {
266 UINTN Signature;
267 LIST_ENTRY Link;
268
269 EFI_IFR_ONE_OF_OPTION *OpCode; // OneOfOption Data
270
271 EFI_STRING_ID Text;
272 UINT8 Flags;
273 EFI_HII_VALUE Value;
274 EFI_IMAGE_ID ImageId;
275
276 FORM_EXPRESSION_LIST *SuppressExpression; // Non-NULL indicates nested inside of SuppressIf
277} QUESTION_OPTION;
278
279#define QUESTION_OPTION_FROM_LINK(a) CR (a, QUESTION_OPTION, Link, QUESTION_OPTION_SIGNATURE)
280
281typedef enum {
282 ExpressFalse = 0,
283 ExpressGrayOut,
284 ExpressSuppress,
285 ExpressDisable
286} EXPRESS_RESULT;
287
288typedef enum {
289 ExpressNone = 0,
290 ExpressForm,
291 ExpressStatement,
292 ExpressOption
293} EXPRESS_LEVEL;
294
295typedef struct _FORM_BROWSER_STATEMENT FORM_BROWSER_STATEMENT;
296
297#define FORM_BROWSER_STATEMENT_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'A')
298
299struct _FORM_BROWSER_STATEMENT{
300 UINTN Signature;
301 LIST_ENTRY Link;
302
303 UINT8 Operand; // The operand (first byte) of this Statement or Question
304 EFI_IFR_OP_HEADER *OpCode;
305
306 //
307 // Statement Header
308 //
309 EFI_STRING_ID Prompt;
310 EFI_STRING_ID Help;
311 EFI_STRING_ID TextTwo; // For EFI_IFR_TEXT
312
313 //
314 // Fake Question Id, used for statement not has true QuestionId.
315 //
316 EFI_QUESTION_ID FakeQuestionId;
317
318 //
319 // Question Header
320 //
321 EFI_QUESTION_ID QuestionId; // The value of zero is reserved
322 EFI_VARSTORE_ID VarStoreId; // A value of zero indicates no variable storage
323 BROWSER_STORAGE *Storage;
324 VAR_STORE_INFO VarStoreInfo;
325 UINT16 StorageWidth;
326 UINT8 QuestionFlags;
327 CHAR16 *VariableName; // Name/Value or EFI Variable name
328 CHAR16 *BlockName; // Buffer storage block name: "OFFSET=...WIDTH=..."
329
330 EFI_HII_VALUE HiiValue; // Edit copy for checkbox, numberic, oneof
331 UINT8 *BufferValue; // Edit copy for string, password, orderedlist
332 UINT8 ValueType; // Data type for orderedlist value array
333
334 //
335 // OpCode specific members
336 //
337 UINT8 Flags; // for EFI_IFR_CHECKBOX, EFI_IFR_DATE, EFI_IFR_NUMERIC, EFI_IFR_ONE_OF,
338 // EFI_IFR_ORDERED_LIST, EFI_IFR_STRING,EFI_IFR_SUBTITLE,EFI_IFR_TIME, EFI_IFR_BANNER
339 UINT8 MaxContainers; // for EFI_IFR_ORDERED_LIST
340
341 UINT16 BannerLineNumber; // for EFI_IFR_BANNER, 1-based line number
342 EFI_STRING_ID QuestionConfig; // for EFI_IFR_ACTION, if 0 then no configuration string will be processed
343
344 UINT64 Minimum; // for EFI_IFR_ONE_OF/EFI_IFR_NUMERIC, it's Min/Max value
345 UINT64 Maximum; // for EFI_IFR_STRING/EFI_IFR_PASSWORD, it's Min/Max length
346 UINT64 Step;
347
348 EFI_DEFAULT_ID DefaultId; // for EFI_IFR_RESET_BUTTON
349 EFI_GUID RefreshGuid; // for EFI_IFR_REFRESH_ID
350 BOOLEAN Locked; // Whether this statement is locked.
351 BOOLEAN ValueChanged; // Whether this statement's value is changed.
352 //
353 // Get from IFR parsing
354 //
355 FORM_EXPRESSION *ValueExpression; // nested EFI_IFR_VALUE, provide Question value and indicate Question is ReadOnly
356 LIST_ENTRY DefaultListHead; // nested EFI_IFR_DEFAULT list (QUESTION_DEFAULT), provide default values
357 LIST_ENTRY OptionListHead; // nested EFI_IFR_ONE_OF_OPTION list (QUESTION_OPTION)
358
359 EFI_IMAGE_ID ImageId; // nested EFI_IFR_IMAGE
360 UINT8 RefreshInterval; // nested EFI_IFR_REFRESH, refresh interval(in seconds) for Question value, 0 means no refresh
361
362 FORM_BROWSER_STATEMENT *ParentStatement;
363
364 LIST_ENTRY InconsistentListHead;// nested inconsistent expression list (FORM_EXPRESSION)
365 LIST_ENTRY NoSubmitListHead; // nested nosubmit expression list (FORM_EXPRESSION)
366 LIST_ENTRY WarningListHead; // nested warning expression list (FORM_EXPRESSION)
367 FORM_EXPRESSION_LIST *Expression; // nesting inside of GrayOutIf/DisableIf/SuppressIf
368
369 FORM_EXPRESSION *ReadExpression; // nested EFI_IFR_READ, provide this question value by read expression.
370 FORM_EXPRESSION *WriteExpression; // nested EFI_IFR_WRITE, evaluate write expression after this question value is set.
371};
372
373#define FORM_BROWSER_STATEMENT_FROM_LINK(a) CR (a, FORM_BROWSER_STATEMENT, Link, FORM_BROWSER_STATEMENT_SIGNATURE)
374
375#define FORM_BROWSER_CONFIG_REQUEST_SIGNATURE SIGNATURE_32 ('F', 'C', 'R', 'S')
376typedef struct {
377 UINTN Signature;
378 LIST_ENTRY Link;
379
380 LIST_ENTRY SaveFailLink;
381
382 CHAR16 *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
383 UINTN ElementCount; // Number of <RequestElement> in the <ConfigRequest>
384 UINTN SpareStrLen;
385
386 BROWSER_STORAGE *Storage;
387} FORM_BROWSER_CONFIG_REQUEST;
388#define FORM_BROWSER_CONFIG_REQUEST_FROM_LINK(a) CR (a, FORM_BROWSER_CONFIG_REQUEST, Link, FORM_BROWSER_CONFIG_REQUEST_SIGNATURE)
389#define FORM_BROWSER_CONFIG_REQUEST_FROM_SAVE_FAIL_LINK(a) CR (a, FORM_BROWSER_CONFIG_REQUEST, SaveFailLink, FORM_BROWSER_CONFIG_REQUEST_SIGNATURE)
390
391#define FORM_BROWSER_FORM_SIGNATURE SIGNATURE_32 ('F', 'F', 'R', 'M')
392#define STANDARD_MAP_FORM_TYPE 0x01
393
394typedef struct {
395 UINTN Signature;
396 LIST_ENTRY Link;
397
398 UINT16 FormId; // FormId of normal form or formmap form.
399 EFI_STRING_ID FormTitle; // FormTile of normal form, or FormMapMethod title of formmap form.
400 UINT16 FormType; // Specific form type for the different form.
401
402 EFI_IMAGE_ID ImageId;
403
404 BOOLEAN ModalForm; // Whether this is a modal form.
405 BOOLEAN Locked; // Whether this form is locked.
406
407 LIST_ENTRY FormViewListHead; // List of type FORMID_INFO is Browser View Form History List.
408 LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
409 LIST_ENTRY StatementListHead; // List of Statements and Questions (FORM_BROWSER_STATEMENT)
410 LIST_ENTRY ConfigRequestHead; // List of configreques for all storage.
411 FORM_EXPRESSION_LIST *SuppressExpression; // nesting inside of SuppressIf
412} FORM_BROWSER_FORM;
413
414#define FORM_BROWSER_FORM_FROM_LINK(a) CR (a, FORM_BROWSER_FORM, Link, FORM_BROWSER_FORM_SIGNATURE)
415
416#define FORMSET_DEFAULTSTORE_SIGNATURE SIGNATURE_32 ('F', 'D', 'F', 'S')
417
418typedef struct {
419 UINTN Signature;
420 LIST_ENTRY Link;
421
422 UINT16 DefaultId;
423 EFI_STRING_ID DefaultName;
424} FORMSET_DEFAULTSTORE;
425
426#define FORMSET_DEFAULTSTORE_FROM_LINK(a) CR (a, FORMSET_DEFAULTSTORE, Link, FORMSET_DEFAULTSTORE_SIGNATURE)
427
428#define FORM_BROWSER_FORMSET_SIGNATURE SIGNATURE_32 ('F', 'B', 'F', 'S')
429
430typedef struct {
431 UINTN Signature;
432 LIST_ENTRY Link;
433 LIST_ENTRY SaveFailLink;
434
435 EFI_HII_HANDLE HiiHandle; // unique id for formset.
436 EFI_HANDLE DriverHandle;
437 EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
438 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
439
440 UINTN IfrBinaryLength;
441 UINT8 *IfrBinaryData;
442
443 BOOLEAN QuestionInited; // Have finished question initilization?
444 EFI_GUID Guid;
445 EFI_STRING_ID FormSetTitle;
446 EFI_STRING_ID Help;
447 UINT8 NumberOfClassGuid;
448 EFI_GUID ClassGuid[3]; // Up to three ClassGuid
449 UINT16 Class; // Tiano extended Class code
450 UINT16 SubClass; // Tiano extended Subclass code
451 EFI_IMAGE_ID ImageId;
452
453 FORM_BROWSER_STATEMENT *StatementBuffer; // Buffer for all Statements and Questions
454 EXPRESSION_OPCODE *ExpressionBuffer; // Buffer for all Expression OpCode
455 FORM_BROWSER_FORM *SaveFailForm; // The form which failed to save.
456 FORM_BROWSER_STATEMENT *SaveFailStatement; // The Statement which failed to save.
457
458 LIST_ENTRY StatementListOSF; // Statement list out side of the form.
459 LIST_ENTRY StorageListHead; // Storage list (FORMSET_STORAGE)
460 LIST_ENTRY SaveFailStorageListHead; // Storage list for the save fail storage.
461 LIST_ENTRY DefaultStoreListHead; // DefaultStore list (FORMSET_DEFAULTSTORE)
462 LIST_ENTRY FormListHead; // Form list (FORM_BROWSER_FORM)
463 LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
464} FORM_BROWSER_FORMSET;
465#define FORM_BROWSER_FORMSET_FROM_LINK(a) CR (a, FORM_BROWSER_FORMSET, Link, FORM_BROWSER_FORMSET_SIGNATURE)
466
467#define FORM_BROWSER_FORMSET_FROM_SAVE_FAIL_LINK(a) CR (a, FORM_BROWSER_FORMSET, SaveFailLink, FORM_BROWSER_FORMSET_SIGNATURE)
468
469typedef struct {
470 LIST_ENTRY Link;
471 EFI_EVENT RefreshEvent;
472} FORM_BROWSER_REFRESH_EVENT_NODE;
473
474#define FORM_BROWSER_REFRESH_EVENT_FROM_LINK(a) BASE_CR (a, FORM_BROWSER_REFRESH_EVENT_NODE, Link)
475
476
477typedef struct {
478 EFI_HII_HANDLE Handle;
479
480 //
481 // Target formset/form/Question information
482 //
483 EFI_GUID FormSetGuid;
484 UINT16 FormId;
485 UINT16 QuestionId;
486 UINTN Sequence; // used for time/date only.
487
488 UINTN TopRow;
489 UINTN BottomRow;
490 UINTN PromptCol;
491 UINTN OptionCol;
492 UINTN CurrentRow;
493
494 //
495 // Ation for Browser to taken:
496 // UI_ACTION_NONE - navigation inside a form
497 // UI_ACTION_REFRESH_FORM - re-evaluate expressions and repaint form
498 // UI_ACTION_REFRESH_FORMSET - re-parse formset IFR binary
499 //
500 UINTN Action;
501
502 //
503 // Current selected fomset/form/Question
504 //
505 FORM_BROWSER_FORMSET *FormSet;
506 FORM_BROWSER_FORM *Form;
507 FORM_BROWSER_STATEMENT *Statement;
508
509 //
510 // Whether the Form is editable
511 //
512 BOOLEAN FormEditable;
513
514 FORM_ENTRY_INFO *CurrentMenu;
515} UI_MENU_SELECTION;
516
517#define BROWSER_CONTEXT_SIGNATURE SIGNATURE_32 ('B', 'C', 'T', 'X')
518
519typedef struct {
520 UINTN Signature;
521 LIST_ENTRY Link;
522
523 //
524 // Globals defined in Setup.c
525 //
526 BOOLEAN ResetRequired;
527 BOOLEAN ExitRequired;
528 EFI_HII_HANDLE HiiHandle;
529 EFI_GUID FormSetGuid;
530 EFI_FORM_ID FormId;
531 UI_MENU_SELECTION *Selection;
532
533 LIST_ENTRY FormHistoryList;
534} BROWSER_CONTEXT;
535
536#define BROWSER_CONTEXT_FROM_LINK(a) CR (a, BROWSER_CONTEXT, Link, BROWSER_CONTEXT_SIGNATURE)
537
538//
539// Scope for get defaut value. It may be GetDefaultForNoStorage, GetDefaultForStorage or GetDefaultForAll.
540//
541typedef enum {
542 GetDefaultForNoStorage, // Get default value for question which not has storage.
543 GetDefaultForStorage, // Get default value for question which has storage.
544 GetDefaultForAll, // Get default value for all questions.
545 GetDefaultForMax // Invalid value.
546} BROWSER_GET_DEFAULT_VALUE;
547
548//
549// Get/set question value from/to.
550//
551typedef enum {
552 GetSetValueWithEditBuffer = 0, // Get/Set question value from/to editbuffer in the storage.
553 GetSetValueWithBuffer, // Get/Set question value from/to buffer in the storage.
554 GetSetValueWithHiiDriver, // Get/Set question value from/to hii driver.
555 GetSetValueWithBothBuffer, // Compare the editbuffer with buffer for this question, not use the question value.
556 GetSetValueWithMax // Invalid value.
557} GET_SET_QUESTION_VALUE_WITH;
558
559extern EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
560extern EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;
561extern EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mPathFromText;
562extern EDKII_FORM_DISPLAY_ENGINE_PROTOCOL *mFormDisplay;
563
564extern BOOLEAN gResetRequired;
565extern BOOLEAN gExitRequired;
566extern LIST_ENTRY gBrowserFormSetList;
567extern LIST_ENTRY gBrowserHotKeyList;
568extern BROWSER_SETTING_SCOPE gBrowserSettingScope;
569extern EXIT_HANDLER ExitHandlerFunction;
570extern EFI_HII_HANDLE mCurrentHiiHandle;
571extern SETUP_DRIVER_PRIVATE_DATA mPrivateData;
572//
573// Browser Global Strings
574//
575extern CHAR16 *gEmptyString;
576
577extern EFI_GUID gZeroGuid;
578
579extern UI_MENU_SELECTION *gCurrentSelection;
580
581//
582// Global Procedure Defines
583//
584#include "Expression.h"
585
586/**
587 Initialize the HII String Token to the correct values.
588
589**/
590VOID
591InitializeBrowserStrings (
592 VOID
593 );
594
595/**
596 Parse opcodes in the formset IFR binary.
597
598 @param FormSet Pointer of the FormSet data structure.
599
600 @retval EFI_SUCCESS Opcode parse success.
601 @retval Other Opcode parse fail.
602
603**/
604EFI_STATUS
605ParseOpCodes (
606 IN FORM_BROWSER_FORMSET *FormSet
607 );
608
609/**
610 Free resources allocated for a FormSet.
611
612 @param FormSet Pointer of the FormSet
613
614**/
615VOID
616DestroyFormSet (
617 IN OUT FORM_BROWSER_FORMSET *FormSet
618 );
619
620
621/**
622 Create a new string in HII Package List.
623
624 @param String The String to be added
625 @param HiiHandle The package list in the HII database to insert the
626 specified string.
627
628 @return The output string.
629
630**/
631EFI_STRING_ID
632NewString (
633 IN CHAR16 *String,
634 IN EFI_HII_HANDLE HiiHandle
635 );
636
637/**
638 Delete a string from HII Package List.
639
640 @param StringId Id of the string in HII database.
641 @param HiiHandle The HII package list handle.
642
643 @retval EFI_SUCCESS The string was deleted successfully.
644
645**/
646EFI_STATUS
647DeleteString (
648 IN EFI_STRING_ID StringId,
649 IN EFI_HII_HANDLE HiiHandle
650 );
651
652/**
653 Get the string based on the StringId and HII Package List Handle.
654
655 @param Token The String's ID.
656 @param HiiHandle The package list in the HII database to search for
657 the specified string.
658
659 @return The output string.
660
661**/
662CHAR16 *
663GetToken (
664 IN EFI_STRING_ID Token,
665 IN EFI_HII_HANDLE HiiHandle
666 );
667
668/**
669 Get Value for given Name from a NameValue Storage.
670
671 @param Storage The NameValue Storage.
672 @param Name The Name.
673 @param Value The retured Value.
674 @param GetValueFrom Where to get source value, from EditValue or Value.
675
676 @retval EFI_SUCCESS Value found for given Name.
677 @retval EFI_NOT_FOUND No such Name found in NameValue storage.
678
679**/
680EFI_STATUS
681GetValueByName (
682 IN BROWSER_STORAGE *Storage,
683 IN CHAR16 *Name,
684 IN OUT CHAR16 **Value,
685 IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
686 );
687
688/**
689 Set Value of given Name in a NameValue Storage.
690
691 @param Storage The NameValue Storage.
692 @param Name The Name.
693 @param Value The Value to set.
694 @param SetValueTo Whether update editValue or Value.
695 @param ReturnNode The node use the input name.
696
697 @retval EFI_SUCCESS Value found for given Name.
698 @retval EFI_NOT_FOUND No such Name found in NameValue storage.
699
700**/
701EFI_STATUS
702SetValueByName (
703 IN BROWSER_STORAGE *Storage,
704 IN CHAR16 *Name,
705 IN CHAR16 *Value,
706 IN GET_SET_QUESTION_VALUE_WITH SetValueTo,
707 OUT NAME_VALUE_NODE **ReturnNode
708 );
709
710/**
711 Validate whether this question's value has changed.
712
713 @param FormSet FormSet data structure.
714 @param Form Form data structure.
715 @param Question Question to be initialized.
716 @param GetValueFrom Where to get value, may from editbuffer, buffer or hii driver.
717
718 @retval TRUE Question's value has changed.
719 @retval FALSE Question's value has not changed
720
721**/
722BOOLEAN
723IsQuestionValueChanged (
724 IN FORM_BROWSER_FORMSET *FormSet,
725 IN FORM_BROWSER_FORM *Form,
726 IN OUT FORM_BROWSER_STATEMENT *Question,
727 IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
728 );
729
730/**
731 Validate the FormSet. If the formset is not validate, remove it from the list.
732
733 @param FormSet The input FormSet which need to validate.
734
735 @retval TRUE The handle is validate.
736 @retval FALSE The handle is invalidate.
737
738**/
739BOOLEAN
740ValidateFormSet (
741 FORM_BROWSER_FORMSET *FormSet
742 );
743
744/**
745 Update the ValueChanged status for questions.
746
747 @param FormSet FormSet data structure.
748 @param Form Form data structure.
749 @param SettingScope Setting Scope for Default action.
750
751**/
752VOID
753UpdateStatementStatus (
754 IN FORM_BROWSER_FORMSET *FormSet,
755 IN FORM_BROWSER_FORM *Form,
756 IN BROWSER_SETTING_SCOPE SettingScope
757 );
758
759/**
760 Get Question's current Value.
761
762 @param FormSet FormSet data structure.
763 @param Form Form data structure.
764 @param Question Question to be initialized.
765 @param GetValueFrom Where to get value, may from editbuffer, buffer or hii driver.
766
767 @retval EFI_SUCCESS The function completed successfully.
768
769**/
770EFI_STATUS
771GetQuestionValue (
772 IN FORM_BROWSER_FORMSET *FormSet,
773 IN FORM_BROWSER_FORM *Form,
774 IN OUT FORM_BROWSER_STATEMENT *Question,
775 IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
776 );
777
778/**
779 Save Question Value to edit copy(cached) or Storage(uncached).
780
781 @param FormSet FormSet data structure.
782 @param Form Form data structure.
783 @param Question Pointer to the Question.
784 @param SetValueTo Update the question value to editbuffer , buffer or hii driver.
785
786 @retval EFI_SUCCESS The function completed successfully.
787
788**/
789EFI_STATUS
790SetQuestionValue (
791 IN FORM_BROWSER_FORMSET *FormSet,
792 IN FORM_BROWSER_FORM *Form,
793 IN OUT FORM_BROWSER_STATEMENT *Question,
794 IN GET_SET_QUESTION_VALUE_WITH SetValueTo
795 );
796
797/**
798 Perform inconsistent check for a Form.
799
800 @param FormSet FormSet data structure.
801 @param Form Form data structure.
802 @param Question The Question to be validated.
803 @param Type Validation type: InConsistent or NoSubmit
804
805 @retval EFI_SUCCESS Form validation pass.
806 @retval other Form validation failed.
807
808**/
809EFI_STATUS
810ValidateQuestion (
811 IN FORM_BROWSER_FORMSET *FormSet,
812 IN FORM_BROWSER_FORM *Form,
813 IN FORM_BROWSER_STATEMENT *Question,
814 IN UINTN Type
815 );
816
817
818/**
819 Discard data based on the input setting scope (Form, FormSet or System).
820
821 @param FormSet FormSet data structure.
822 @param Form Form data structure.
823 @param SettingScope Setting Scope for Discard action.
824
825 @retval EFI_SUCCESS The function completed successfully.
826 @retval EFI_UNSUPPORTED Unsupport SettingScope.
827
828**/
829EFI_STATUS
830DiscardForm (
831 IN FORM_BROWSER_FORMSET *FormSet,
832 IN FORM_BROWSER_FORM *Form,
833 IN BROWSER_SETTING_SCOPE SettingScope
834 );
835
836/**
837 Submit data based on the input Setting level (Form, FormSet or System).
838
839 @param FormSet FormSet data structure.
840 @param Form Form data structure.
841 @param SettingScope Setting Scope for Submit action.
842
843 @retval EFI_SUCCESS The function completed successfully.
844 @retval EFI_UNSUPPORTED Unsupport SettingScope.
845
846**/
847EFI_STATUS
848SubmitForm (
849 IN FORM_BROWSER_FORMSET *FormSet,
850 IN FORM_BROWSER_FORM *Form,
851 IN BROWSER_SETTING_SCOPE SettingScope
852 );
853
854/**
855 Reset Question to its default value.
856
857 @param FormSet The form set.
858 @param Form The form.
859 @param Question The question.
860 @param DefaultId The Class of the default.
861
862 @retval EFI_SUCCESS Question is reset to default value.
863
864**/
865EFI_STATUS
866GetQuestionDefault (
867 IN FORM_BROWSER_FORMSET *FormSet,
868 IN FORM_BROWSER_FORM *Form,
869 IN FORM_BROWSER_STATEMENT *Question,
870 IN UINT16 DefaultId
871 );
872
873/**
874 Get current setting of Questions.
875
876 @param FormSet FormSet data structure.
877
878**/
879VOID
880InitializeCurrentSetting (
881 IN OUT FORM_BROWSER_FORMSET *FormSet
882 );
883
884/**
885 Initialize the internal data structure of a FormSet.
886
887 @param Handle PackageList Handle
888 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
889 GUID), take the first FormSet found in package
890 list.
891 @param FormSet FormSet data structure.
892
893 @retval EFI_SUCCESS The function completed successfully.
894 @retval EFI_NOT_FOUND The specified FormSet could not be found.
895
896**/
897EFI_STATUS
898InitializeFormSet (
899 IN EFI_HII_HANDLE Handle,
900 IN OUT EFI_GUID *FormSetGuid,
901 OUT FORM_BROWSER_FORMSET *FormSet
902 );
903
904/**
905 Reset Questions to their initial value or default value in a Form, Formset or System.
906
907 GetDefaultValueScope parameter decides which questions will reset
908 to its default value.
909
910 @param FormSet FormSet data structure.
911 @param Form Form data structure.
912 @param DefaultId The Class of the default.
913 @param SettingScope Setting Scope for Default action.
914 @param GetDefaultValueScope Get default value scope.
915 @param Storage Get default value only for this storage.
916 @param RetrieveValueFirst Whether call the retrieve call back to
917 get the initial value before get default
918 value.
919
920 @retval EFI_SUCCESS The function completed successfully.
921 @retval EFI_UNSUPPORTED Unsupport SettingScope.
922
923**/
924EFI_STATUS
925ExtractDefault (
926 IN FORM_BROWSER_FORMSET *FormSet,
927 IN FORM_BROWSER_FORM *Form,
928 IN UINT16 DefaultId,
929 IN BROWSER_SETTING_SCOPE SettingScope,
930 IN BROWSER_GET_DEFAULT_VALUE GetDefaultValueScope,
931 IN BROWSER_STORAGE *Storage,
932 IN BOOLEAN RetrieveValueFirst
933 );
934
935/**
936 Initialize Question's Edit copy from Storage.
937
938 @param Selection Selection contains the information about
939 the Selection, form and formset to be displayed.
940 Selection action may be updated in retrieve callback.
941 If Selection is NULL, only initialize Question value.
942 @param FormSet FormSet data structure.
943 @param Form Form data structure.
944
945 @retval EFI_SUCCESS The function completed successfully.
946
947**/
948EFI_STATUS
949LoadFormConfig (
950 IN OUT UI_MENU_SELECTION *Selection,
951 IN FORM_BROWSER_FORMSET *FormSet,
952 IN FORM_BROWSER_FORM *Form
953 );
954
955/**
956 Initialize Question's Edit copy from Storage for the whole Formset.
957
958 @param Selection Selection contains the information about
959 the Selection, form and formset to be displayed.
960 Selection action may be updated in retrieve callback.
961 If Selection is NULL, only initialize Question value.
962 @param FormSet FormSet data structure.
963
964 @retval EFI_SUCCESS The function completed successfully.
965
966**/
967EFI_STATUS
968LoadFormSetConfig (
969 IN OUT UI_MENU_SELECTION *Selection,
970 IN FORM_BROWSER_FORMSET *FormSet
971 );
972
973/**
974 Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.
975
976 @param Storage The Storage to be conveted.
977 @param ConfigResp The returned <ConfigResp>.
978 @param ConfigRequest The ConfigRequest string.
979 @param GetEditBuf Get the data from editbuffer or buffer.
980
981 @retval EFI_SUCCESS Convert success.
982 @retval EFI_INVALID_PARAMETER Incorrect storage type.
983
984**/
985EFI_STATUS
986StorageToConfigResp (
987 IN BROWSER_STORAGE *Storage,
988 IN CHAR16 **ConfigResp,
989 IN CHAR16 *ConfigRequest,
990 IN BOOLEAN GetEditBuf
991 );
992
993/**
994 Convert <ConfigResp> to settings in Buffer Storage or NameValue Storage.
995
996 @param Storage The Storage to receive the settings.
997 @param ConfigResp The <ConfigResp> to be converted.
998
999 @retval EFI_SUCCESS Convert success.
1000 @retval EFI_INVALID_PARAMETER Incorrect storage type.
1001
1002**/
1003EFI_STATUS
1004ConfigRespToStorage (
1005 IN BROWSER_STORAGE *Storage,
1006 IN CHAR16 *ConfigResp
1007 );
1008
1009/**
1010 Fill storage's edit copy with settings requested from Configuration Driver.
1011
1012 @param FormSet FormSet data structure.
1013 @param Storage Buffer Storage.
1014
1015**/
1016VOID
1017LoadStorage (
1018 IN FORM_BROWSER_FORMSET *FormSet,
1019 IN FORMSET_STORAGE *Storage
1020 );
1021
1022/**
1023 Fetch the Ifr binary data of a FormSet.
1024
1025 @param Handle PackageList Handle
1026 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
1027 GUID), take the first FormSet found in package
1028 list.
1029 @param BinaryLength The length of the FormSet IFR binary.
1030 @param BinaryData The buffer designed to receive the FormSet.
1031
1032 @retval EFI_SUCCESS Buffer filled with the requested FormSet.
1033 BufferLength was updated.
1034 @retval EFI_INVALID_PARAMETER The handle is unknown.
1035 @retval EFI_NOT_FOUND A form or FormSet on the requested handle cannot
1036 be found with the requested FormId.
1037
1038**/
1039EFI_STATUS
1040GetIfrBinaryData (
1041 IN EFI_HII_HANDLE Handle,
1042 IN OUT EFI_GUID *FormSetGuid,
1043 OUT UINTN *BinaryLength,
1044 OUT UINT8 **BinaryData
1045 );
1046
1047/**
1048 Save globals used by previous call to SendForm(). SendForm() may be called from
1049 HiiConfigAccess.Callback(), this will cause SendForm() be reentried.
1050 So, save globals of previous call to SendForm() and restore them upon exit.
1051
1052**/
1053VOID
1054SaveBrowserContext (
1055 VOID
1056 );
1057
1058/**
1059 Restore globals used by previous call to SendForm().
1060
1061**/
1062VOID
1063RestoreBrowserContext (
1064 VOID
1065 );
1066
1067/**
1068 This is the routine which an external caller uses to direct the browser
1069 where to obtain it's information.
1070
1071
1072 @param This The Form Browser protocol instanse.
1073 @param Handles A pointer to an array of Handles. If HandleCount > 1 we
1074 display a list of the formsets for the handles specified.
1075 @param HandleCount The number of Handles specified in Handle.
1076 @param FormSetGuid This field points to the EFI_GUID which must match the Guid
1077 field in the EFI_IFR_FORM_SET op-code for the specified
1078 forms-based package. If FormSetGuid is NULL, then this
1079 function will display the first found forms package.
1080 @param FormId This field specifies which EFI_IFR_FORM to render as the first
1081 displayable page. If this field has a value of 0x0000, then
1082 the forms browser will render the specified forms in their encoded order.
1083 ScreenDimenions - This allows the browser to be called so that it occupies a
1084 portion of the physical screen instead of dynamically determining the screen dimensions.
1085 ActionRequest - Points to the action recommended by the form.
1086 @param ScreenDimensions Points to recommended form dimensions, including any non-content area, in
1087 characters.
1088 @param ActionRequest Points to the action recommended by the form.
1089
1090 @retval EFI_SUCCESS The function completed successfully.
1091 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1092 @retval EFI_NOT_FOUND No valid forms could be found to display.
1093
1094**/
1095EFI_STATUS
1096EFIAPI
1097SendForm (
1098 IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,
1099 IN EFI_HII_HANDLE *Handles,
1100 IN UINTN HandleCount,
1101 IN EFI_GUID *FormSetGuid, OPTIONAL
1102 IN UINT16 FormId, OPTIONAL
1103 IN CONST EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL
1104 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest OPTIONAL
1105 );
1106
1107/**
1108 This function is called by a callback handler to retrieve uncommitted state
1109 data from the browser.
1110
1111 @param This A pointer to the EFI_FORM_BROWSER2_PROTOCOL
1112 instance.
1113 @param ResultsDataSize A pointer to the size of the buffer associated
1114 with ResultsData.
1115 @param ResultsData A string returned from an IFR browser or
1116 equivalent. The results string will have no
1117 routing information in them.
1118 @param RetrieveData A BOOLEAN field which allows an agent to retrieve
1119 (if RetrieveData = TRUE) data from the uncommitted
1120 browser state information or set (if RetrieveData
1121 = FALSE) data in the uncommitted browser state
1122 information.
1123 @param VariableGuid An optional field to indicate the target variable
1124 GUID name to use.
1125 @param VariableName An optional field to indicate the target
1126 human-readable variable name.
1127
1128 @retval EFI_SUCCESS The results have been distributed or are awaiting
1129 distribution.
1130 @retval EFI_BUFFER_TOO_SMALL The ResultsDataSize specified was too small to
1131 contain the results data.
1132
1133**/
1134EFI_STATUS
1135EFIAPI
1136BrowserCallback (
1137 IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,
1138 IN OUT UINTN *ResultsDataSize,
1139 IN OUT EFI_STRING ResultsData,
1140 IN BOOLEAN RetrieveData,
1141 IN CONST EFI_GUID *VariableGuid, OPTIONAL
1142 IN CONST CHAR16 *VariableName OPTIONAL
1143 );
1144
1145/**
1146 Find menu which will show next time.
1147
1148 @param Selection On input, Selection tell setup browser the information
1149 about the Selection, form and formset to be displayed.
1150 On output, Selection return the screen item that is selected
1151 by user.
1152 @param SettingLevel Input Settting level, if it is FormLevel, just exit current form.
1153 else, we need to exit current formset.
1154
1155 @retval TRUE Exit current form.
1156 @retval FALSE User press ESC and keep in current form.
1157**/
1158BOOLEAN
1159FindNextMenu (
1160 IN OUT UI_MENU_SELECTION *Selection,
1161 IN BROWSER_SETTING_SCOPE SettingLevel
1162 );
1163
1164/**
1165 check whether the form need to update the NV.
1166
1167 @param Form Form data structure.
1168
1169 @retval TRUE Need to update the NV.
1170 @retval FALSE No need to update the NV.
1171**/
1172BOOLEAN
1173IsNvUpdateRequiredForForm (
1174 IN FORM_BROWSER_FORM *Form
1175 );
1176
1177/**
1178 check whether the formset need to update the NV.
1179
1180 @param FormSet FormSet data structure.
1181
1182 @retval TRUE Need to update the NV.
1183 @retval FALSE No need to update the NV.
1184**/
1185BOOLEAN
1186IsNvUpdateRequiredForFormSet (
1187 IN FORM_BROWSER_FORMSET *FormSet
1188 );
1189
1190/**
1191 Call the call back function for the question and process the return action.
1192
1193 @param Selection On input, Selection tell setup browser the information
1194 about the Selection, form and formset to be displayed.
1195 On output, Selection return the screen item that is selected
1196 by user.
1197 @param FormSet The formset this question belong to.
1198 @param Form The form this question belong to.
1199 @param Question The Question which need to call.
1200 @param Action The action request.
1201 @param SkipSaveOrDiscard Whether skip save or discard action.
1202
1203 @retval EFI_SUCCESS The call back function excutes successfully.
1204 @return Other value if the call back function failed to excute.
1205**/
1206EFI_STATUS
1207ProcessCallBackFunction (
1208 IN OUT UI_MENU_SELECTION *Selection,
1209 IN FORM_BROWSER_FORMSET *FormSet,
1210 IN FORM_BROWSER_FORM *Form,
1211 IN FORM_BROWSER_STATEMENT *Question,
1212 IN EFI_BROWSER_ACTION Action,
1213 IN BOOLEAN SkipSaveOrDiscard
1214 );
1215
1216/**
1217 Call the retrieve type call back function for one question to get the initialize data.
1218
1219 This function only used when in the initialize stage, because in this stage, the
1220 Selection->Form is not ready. For other case, use the ProcessCallBackFunction instead.
1221
1222 @param ConfigAccess The config access protocol produced by the hii driver.
1223 @param Statement The Question which need to call.
1224 @param FormSet The formset this question belong to.
1225
1226 @retval EFI_SUCCESS The call back function excutes successfully.
1227 @return Other value if the call back function failed to excute.
1228**/
1229EFI_STATUS
1230ProcessRetrieveForQuestion (
1231 IN EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess,
1232 IN FORM_BROWSER_STATEMENT *Statement,
1233 IN FORM_BROWSER_FORMSET *FormSet
1234 );
1235
1236/**
1237 Find the matched FormSet context in the backup maintain list based on HiiHandle.
1238
1239 @param Handle The Hii Handle.
1240
1241 @return the found FormSet context. If no found, NULL will return.
1242
1243**/
1244FORM_BROWSER_FORMSET *
1245GetFormSetFromHiiHandle (
1246 EFI_HII_HANDLE Handle
1247 );
1248
1249/**
1250 Check whether the input HII handle is the FormSet that is being used.
1251
1252 @param Handle The Hii Handle.
1253
1254 @retval TRUE HII handle is being used.
1255 @retval FALSE HII handle is not being used.
1256
1257**/
1258BOOLEAN
1259IsHiiHandleInBrowserContext (
1260 EFI_HII_HANDLE Handle
1261 );
1262
1263/**
1264 Configure what scope the hot key will impact.
1265 All hot keys have the same scope. The mixed hot keys with the different level are not supported.
1266 If no scope is set, the default scope will be FormSet level.
1267 After all registered hot keys are removed, previous Scope can reset to another level.
1268
1269 @param[in] Scope Scope level to be set.
1270
1271 @retval EFI_SUCCESS Scope is set correctly.
1272 @retval EFI_INVALID_PARAMETER Scope is not the valid value specified in BROWSER_SETTING_SCOPE.
1273 @retval EFI_UNSPPORTED Scope level is different from current one that the registered hot keys have.
1274
1275**/
1276EFI_STATUS
1277EFIAPI
1278SetScope (
1279 IN BROWSER_SETTING_SCOPE Scope
1280 );
1281
1282/**
1283 Register the hot key with its browser action, or unregistered the hot key.
1284 Only support hot key that is not printable character (control key, function key, etc.).
1285 If the action value is zero, the hot key will be unregistered if it has been registered.
1286 If the same hot key has been registered, the new action and help string will override the previous ones.
1287
1288 @param[in] KeyData A pointer to a buffer that describes the keystroke
1289 information for the hot key. Its type is EFI_INPUT_KEY to
1290 be supported by all ConsoleIn devices.
1291 @param[in] Action Action value that describes what action will be trigged when the hot key is pressed.
1292 @param[in] DefaultId Specifies the type of defaults to retrieve, which is only for DEFAULT action.
1293 @param[in] HelpString Help string that describes the hot key information.
1294 Its value may be NULL for the unregistered hot key.
1295
1296 @retval EFI_SUCCESS Hot key is registered or unregistered.
1297 @retval EFI_INVALID_PARAMETER KeyData is NULL.
1298 @retval EFI_NOT_FOUND KeyData is not found to be unregistered.
1299 @retval EFI_UNSUPPORTED Key represents a printable character. It is conflicted with Browser.
1300**/
1301EFI_STATUS
1302EFIAPI
1303RegisterHotKey (
1304 IN EFI_INPUT_KEY *KeyData,
1305 IN UINT32 Action,
1306 IN UINT16 DefaultId,
1307 IN EFI_STRING HelpString OPTIONAL
1308 );
1309
1310/**
1311 Register Exit handler function.
1312 When more than one handler function is registered, the latter one will override the previous one.
1313 When NULL handler is specified, the previous Exit handler will be unregistered.
1314
1315 @param[in] Handler Pointer to handler function.
1316
1317**/
1318VOID
1319EFIAPI
1320RegiserExitHandler (
1321 IN EXIT_HANDLER Handler
1322 );
1323
1324/**
1325
1326 Check whether the browser data has been modified.
1327
1328 @retval TRUE Browser data is changed.
1329 @retval FALSE No browser data is changed.
1330
1331**/
1332BOOLEAN
1333EFIAPI
1334IsBrowserDataModified (
1335 VOID
1336 );
1337
1338/**
1339
1340 Execute the action requested by the Action parameter.
1341
1342 @param[in] Action Execute the request action.
1343 @param[in] DefaultId The default Id info when need to load default value.
1344
1345 @retval EFI_SUCCESS Execute the request action succss.
1346 @retval EFI_INVALID_PARAMETER The input action value is invalid.
1347
1348**/
1349EFI_STATUS
1350EFIAPI
1351ExecuteAction (
1352 IN UINT32 Action,
1353 IN UINT16 DefaultId
1354 );
1355
1356/**
1357 Create reminder to let user to choose save or discard the changed browser data.
1358 Caller can use it to actively check the changed browser data.
1359
1360 @retval BROWSER_NO_CHANGES No browser data is changed.
1361 @retval BROWSER_SAVE_CHANGES The changed browser data is saved.
1362 @retval BROWSER_DISCARD_CHANGES The changed browser data is discard.
1363 @retval BROWSER_KEEP_CURRENT Browser keep current changes.
1364
1365**/
1366UINT32
1367EFIAPI
1368SaveReminder (
1369 VOID
1370 );
1371
1372/**
1373 Check whether the Reset Required for the browser
1374
1375 @retval TRUE Browser required to reset after exit.
1376 @retval FALSE Browser not need to reset after exit.
1377
1378**/
1379BOOLEAN
1380EFIAPI
1381IsResetRequired (
1382 VOID
1383 );
1384
1385/**
1386 Find the registered HotKey based on KeyData.
1387
1388 @param[in] KeyData A pointer to a buffer that describes the keystroke
1389 information for the hot key.
1390
1391 @return The registered HotKey context. If no found, NULL will return.
1392**/
1393BROWSER_HOT_KEY *
1394GetHotKeyFromRegisterList (
1395 IN EFI_INPUT_KEY *KeyData
1396 );
1397
1398/**
1399
1400 Get FORM_BROWSER_STATEMENT from FORM_DISPLAY_ENGINE_STATEMENT based on the OpCode info.
1401
1402 @param DisplayStatement The input FORM_DISPLAY_ENGINE_STATEMENT.
1403
1404 @retval FORM_BROWSER_STATEMENT The return FORM_BROWSER_STATEMENT info.
1405
1406**/
1407FORM_BROWSER_STATEMENT *
1408GetBrowserStatement (
1409 IN FORM_DISPLAY_ENGINE_STATEMENT *DisplayStatement
1410 );
1411
1412/**
1413 Password may be stored as encrypted by Configuration Driver. When change a
1414 password, user will be challenged with old password. To validate user input old
1415 password, we will send the clear text to Configuration Driver via Callback().
1416 Configuration driver is responsible to check the passed in password and return
1417 the validation result. If validation pass, state machine in password Callback()
1418 will transit from BROWSER_STATE_VALIDATE_PASSWORD to BROWSER_STATE_SET_PASSWORD.
1419 After user type in new password twice, Callback() will be invoked to send the
1420 new password to Configuration Driver.
1421
1422 @param Selection Pointer to UI_MENU_SELECTION.
1423 @param MenuOption The MenuOption for this password Question.
1424 @param String The clear text of password.
1425
1426 @retval EFI_NOT_AVAILABLE_YET Callback() request to terminate password input.
1427 @return In state of BROWSER_STATE_VALIDATE_PASSWORD:
1428 @retval EFI_SUCCESS Password correct, Browser will prompt for new
1429 password.
1430 @retval EFI_NOT_READY Password incorrect, Browser will show error
1431 message.
1432 @retval Other Browser will do nothing.
1433 @return In state of BROWSER_STATE_SET_PASSWORD:
1434 @retval EFI_SUCCESS Set password success.
1435 @retval Other Set password failed.
1436
1437**/
1438EFI_STATUS
1439PasswordCallback (
1440 IN UI_MENU_SELECTION *Selection,
1441 IN FORM_BROWSER_STATEMENT *Question,
1442 IN CHAR16 *String
1443 );
1444
1445/**
1446 Display error message for invalid password.
1447
1448**/
1449VOID
1450PasswordInvalid (
1451 VOID
1452 );
1453
1454/**
1455 The worker function that send the displays to the screen. On output,
1456 the selection made by user is returned.
1457
1458 @param Selection On input, Selection tell setup browser the information
1459 about the Selection, form and formset to be displayed.
1460 On output, Selection return the screen item that is selected
1461 by user.
1462
1463 @retval EFI_SUCCESS The page is displayed successfully.
1464 @return Other value if the page failed to be diplayed.
1465
1466**/
1467EFI_STATUS
1468SetupBrowser (
1469 IN OUT UI_MENU_SELECTION *Selection
1470 );
1471
1472/**
1473 Free up the resource allocated for all strings required
1474 by Setup Browser.
1475
1476**/
1477VOID
1478FreeBrowserStrings (
1479 VOID
1480 );
1481
1482/**
1483 Create a menu with specified formset GUID and form ID, and add it as a child
1484 of the given parent menu.
1485
1486 @param HiiHandle Hii handle related to this formset.
1487 @param FormSetGuid The Formset Guid of menu to be added.
1488 @param FormId The Form ID of menu to be added.
1489 @param QuestionId The question id of this menu to be added.
1490
1491 @return A pointer to the newly added menu or NULL if memory is insufficient.
1492
1493**/
1494FORM_ENTRY_INFO *
1495UiAddMenuList (
1496 IN EFI_HII_HANDLE HiiHandle,
1497 IN EFI_GUID *FormSetGuid,
1498 IN UINT16 FormId,
1499 IN UINT16 QuestionId
1500 );
1501
1502/**
1503 Search Menu with given FormSetGuid and FormId in all cached menu list.
1504
1505 @param HiiHandle HiiHandle for FormSet.
1506 @param FormSetGuid The Formset GUID of the menu to search.
1507 @param FormId The Form ID of menu to search.
1508
1509 @return A pointer to menu found or NULL if not found.
1510
1511**/
1512FORM_ENTRY_INFO *
1513UiFindMenuList (
1514 IN EFI_HII_HANDLE HiiHandle,
1515 IN EFI_GUID *FormSetGuid,
1516 IN UINT16 FormId
1517 );
1518
1519/**
1520 Free Menu list linked list.
1521
1522 @param MenuListHead One Menu list point in the menu list.
1523
1524**/
1525VOID
1526UiFreeMenuList (
1527 LIST_ENTRY *MenuListHead
1528 );
1529
1530/**
1531 Find parent menu for current menu.
1532
1533 @param CurrentMenu Current Menu
1534 @param SettingLevel Whether find parent menu in Form Level or Formset level.
1535 In form level, just find the parent menu;
1536 In formset level, find the parent menu which has different
1537 formset guid value.
1538
1539 @retval The parent menu for current menu.
1540**/
1541FORM_ENTRY_INFO *
1542UiFindParentMenu (
1543 IN FORM_ENTRY_INFO *CurrentMenu,
1544 IN BROWSER_SETTING_SCOPE SettingLevel
1545 );
1546
1547/**
1548 Validate the HiiHandle.
1549
1550 @param HiiHandle The input HiiHandle which need to validate.
1551
1552 @retval TRUE The handle is validate.
1553 @retval FALSE The handle is invalidate.
1554
1555**/
1556BOOLEAN
1557ValidateHiiHandle (
1558 EFI_HII_HANDLE HiiHandle
1559 );
1560
1561/**
1562 Copy current Menu list to the new menu list.
1563
1564 @param NewMenuListHead New create Menu list.
1565 @param CurrentMenuListHead Current Menu list.
1566
1567**/
1568VOID
1569UiCopyMenuList (
1570 OUT LIST_ENTRY *NewMenuListHead,
1571 IN LIST_ENTRY *CurrentMenuListHead
1572 );
1573
1574/**
1575 Search an Option of a Question by its value.
1576
1577 @param Question The Question
1578 @param OptionValue Value for Option to be searched.
1579
1580 @retval Pointer Pointer to the found Option.
1581 @retval NULL Option not found.
1582
1583**/
1584QUESTION_OPTION *
1585ValueToOption (
1586 IN FORM_BROWSER_STATEMENT *Question,
1587 IN EFI_HII_VALUE *OptionValue
1588 );
1589/**
1590 Return data element in an Array by its Index.
1591
1592 @param Array The data array.
1593 @param Type Type of the data in this array.
1594 @param Index Zero based index for data in this array.
1595
1596 @retval Value The data to be returned
1597
1598**/
1599UINT64
1600GetArrayData (
1601 IN VOID *Array,
1602 IN UINT8 Type,
1603 IN UINTN Index
1604 );
1605
1606/**
1607 Set value of a data element in an Array by its Index.
1608
1609 @param Array The data array.
1610 @param Type Type of the data in this array.
1611 @param Index Zero based index for data in this array.
1612 @param Value The value to be set.
1613
1614**/
1615VOID
1616SetArrayData (
1617 IN VOID *Array,
1618 IN UINT8 Type,
1619 IN UINTN Index,
1620 IN UINT64 Value
1621 );
1622
1623/**
1624 Compare two Hii value.
1625
1626 @param Value1 Expression value to compare on left-hand.
1627 @param Value2 Expression value to compare on right-hand.
1628 @param Result Return value after compare.
1629 retval 0 Two operators equal.
1630 return Positive value if Value1 is greater than Value2.
1631 retval Negative value if Value1 is less than Value2.
1632 @param HiiHandle Only required for string compare.
1633
1634 @retval other Could not perform compare on two values.
1635 @retval EFI_SUCCESS Compare the value success.
1636
1637**/
1638EFI_STATUS
1639CompareHiiValue (
1640 IN EFI_HII_VALUE *Value1,
1641 IN EFI_HII_VALUE *Value2,
1642 OUT INTN *Result,
1643 IN EFI_HII_HANDLE HiiHandle OPTIONAL
1644 );
1645
1646/**
1647 Perform Password check.
1648 Passwork may be encrypted by driver that requires the specific check.
1649
1650 @param Form Form where Password Statement is in.
1651 @param Statement Password statement
1652 @param PasswordString Password string to be checked. It may be NULL.
1653 NULL means to restore password.
1654 "" string can be used to checked whether old password does exist.
1655
1656 @return Status Status of Password check.
1657**/
1658EFI_STATUS
1659EFIAPI
1660PasswordCheck (
1661 IN FORM_DISPLAY_ENGINE_FORM *Form,
1662 IN FORM_DISPLAY_ENGINE_STATEMENT *Statement,
1663 IN EFI_STRING PasswordString OPTIONAL
1664 );
1665
1666/**
1667
1668 Get FORM_BROWSER_STATEMENT from FORM_DISPLAY_ENGINE_STATEMENT based on the OpCode info.
1669
1670 @param DisplayStatement The input FORM_DISPLAY_ENGINE_STATEMENT.
1671
1672 @retval FORM_BROWSER_STATEMENT The return FORM_BROWSER_STATEMENT info.
1673
1674**/
1675FORM_BROWSER_STATEMENT *
1676GetBrowserStatement (
1677 IN FORM_DISPLAY_ENGINE_STATEMENT *DisplayStatement
1678 );
1679
1680/**
1681
1682 Initialize the Display form structure data.
1683
1684**/
1685VOID
1686InitializeDisplayFormData (
1687 VOID
1688 );
1689
1690
1691/**
1692 Base on the current formset info, clean the ConfigRequest string in browser storage.
1693
1694 @param FormSet Pointer of the FormSet
1695
1696**/
1697VOID
1698CleanBrowserStorage (
1699 IN OUT FORM_BROWSER_FORMSET *FormSet
1700 );
1701
1702/**
1703 Find HII Handle in the HII database associated with given Device Path.
1704
1705 If DevicePath is NULL, then ASSERT.
1706
1707 @param DevicePath Device Path associated with the HII package list
1708 handle.
1709 @param FormsetGuid The formset guid for this formset.
1710
1711 @retval Handle HII package list Handle associated with the Device
1712 Path.
1713 @retval NULL Hii Package list handle is not found.
1714
1715**/
1716EFI_HII_HANDLE
1717DevicePathToHiiHandle (
1718 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
1719 IN EFI_GUID *FormsetGuid
1720 );
1721
1722/**
1723 Adjust the config request info, remove the request elements which already in AllConfigRequest string.
1724
1725 @param Storage Form set Storage.
1726 @param Request The input request string.
1727 @param RespString Whether the input is ConfigRequest or ConfigResp format.
1728
1729 @retval TRUE Has element not covered by current used elements, need to continue to call ExtractConfig
1730 @retval FALSE All elements covered by current used elements.
1731
1732**/
1733BOOLEAN
1734ConfigRequestAdjust (
1735 IN BROWSER_STORAGE *Storage,
1736 IN CHAR16 *Request,
1737 IN BOOLEAN RespString
1738 );
1739
1740/**
1741 Perform question check.
1742
1743 If one question has more than one check, process form high priority to low.
1744
1745 @param FormSet FormSet data structure.
1746 @param Form Form data structure.
1747 @param Question The Question to be validated.
1748
1749 @retval EFI_SUCCESS Form validation pass.
1750 @retval other Form validation failed.
1751
1752**/
1753EFI_STATUS
1754ValueChangedValidation (
1755 IN FORM_BROWSER_FORMSET *FormSet,
1756 IN FORM_BROWSER_FORM *Form,
1757 IN FORM_BROWSER_STATEMENT *Question
1758 );
1759
1760/**
1761 Pop up the error info.
1762
1763 @param BrowserStatus The input browser status.
1764 @param HiiHandle The HiiHandle for this error opcode.
1765 @param OpCode The opcode use to get the erro info and timeout value.
1766 @param ErrorString Error string used by BROWSER_NO_SUBMIT_IF.
1767
1768**/
1769UINT32
1770PopupErrorMessage (
1771 IN UINT32 BrowserStatus,
1772 IN EFI_HII_HANDLE HiiHandle,
1773 IN EFI_IFR_OP_HEADER *OpCode, OPTIONAL
1774 IN CHAR16 *ErrorString
1775 );
1776
1777/**
1778 Check whether the result is TRUE or FALSE.
1779
1780 For the EFI_HII_VALUE value type is numeric, return TRUE if the
1781 value is not 0.
1782
1783 @param Result Input the result data.
1784
1785 @retval TRUE The result is TRUE.
1786 @retval FALSE The result is FALSE.
1787
1788**/
1789BOOLEAN
1790IsTrue (
1791 IN EFI_HII_VALUE *Result
1792 );
1793
1794/**
1795 Get Formset_storage base on the input varstoreid info.
1796
1797 @param FormSet Pointer of the current FormSet.
1798 @param VarStoreId Varstore ID info.
1799
1800 @return Pointer to a FORMSET_STORAGE data structure.
1801
1802**/
1803FORMSET_STORAGE *
1804GetFstStgFromVarId (
1805 IN FORM_BROWSER_FORMSET *FormSet,
1806 IN EFI_VARSTORE_ID VarStoreId
1807 );
1808
1809/**
1810 Get Formset_storage base on the input browser storage.
1811
1812 More than one formsets may share the same browser storage,
1813 this function just get the first formset storage which
1814 share the browser storage.
1815
1816 @param Storage browser storage info.
1817
1818 @return Pointer to a FORMSET_STORAGE data structure.
1819
1820
1821**/
1822FORMSET_STORAGE *
1823GetFstStgFromBrsStg (
1824 IN BROWSER_STORAGE *Storage
1825 );
1826
1827#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette