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