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