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