]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
Refine the logic about initialize questions value
[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
31585af4 4Copyright (c) 2007 - 2012, 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
48a9d5f7 25#include <Protocol/FormBrowserEx.h>\r
7936fb6a 26#include <Protocol/DevicePath.h>\r
27#include <Protocol/UnicodeCollation.h>\r
28#include <Protocol/HiiConfigAccess.h>\r
29#include <Protocol/HiiConfigRouting.h>\r
30#include <Protocol/HiiDatabase.h>\r
31#include <Protocol/HiiString.h>\r
cbf73e50 32#include <Protocol/UserManager.h>\r
7936fb6a 33\r
5c526736 34#include <Guid/MdeModuleHii.h>\r
0a1147ed 35#include <Guid/HiiPlatformSetupFormset.h>\r
2573712e 36#include <Guid/HiiFormMapMethodGuid.h>\r
7936fb6a 37\r
7936fb6a 38#include <Library/PrintLib.h>\r
39#include <Library/DebugLib.h>\r
40#include <Library/BaseMemoryLib.h>\r
41#include <Library/UefiRuntimeServicesTableLib.h>\r
42#include <Library/UefiDriverEntryPoint.h>\r
43#include <Library/UefiBootServicesTableLib.h>\r
44#include <Library/BaseLib.h>\r
45#include <Library/MemoryAllocationLib.h>\r
7936fb6a 46#include <Library/HiiLib.h>\r
f511d656 47#include <Library/PcdLib.h>\r
cb7d01c0 48#include <Library/DevicePathLib.h>\r
7936fb6a 49\r
50#include "Colors.h"\r
51\r
52//\r
53// This is the generated header file which includes whatever needs to be exported (strings + IFR)\r
54//\r
55\r
56extern UINT8 SetupBrowserStrings[];\r
57\r
58//\r
59// Screen definitions\r
60//\r
61#define BANNER_HEIGHT 6\r
62#define BANNER_COLUMNS 3\r
c3161b25 63#define BANNER_LEFT_COLUMN_INDENT 1\r
7936fb6a 64\r
65#define FRONT_PAGE_HEADER_HEIGHT 6\r
66#define NONE_FRONT_PAGE_HEADER_HEIGHT 3\r
b6ca1fd8 67#define LEFT_SKIPPED_COLUMNS 3\r
7936fb6a 68#define FOOTER_HEIGHT 4\r
69#define STATUS_BAR_HEIGHT 1\r
70#define SCROLL_ARROW_HEIGHT 1\r
71#define POPUP_PAD_SPACE_COUNT 5\r
72#define POPUP_FRAME_WIDTH 2\r
73\r
74//\r
75// Definition for function key setting\r
76//\r
77#define NONE_FUNCTION_KEY_SETTING 0\r
48a9d5f7 78#define ENABLE_FUNCTION_KEY_SETTING 1\r
7936fb6a 79\r
80typedef struct {\r
81 EFI_GUID FormSetGuid;\r
82 UINTN KeySetting;\r
83} FUNCTIION_KEY_SETTING;\r
84\r
85//\r
86// Character definitions\r
87//\r
88#define CHAR_SPACE 0x0020\r
89#define UPPER_LOWER_CASE_OFFSET 0x20\r
90\r
91//\r
92// Time definitions\r
93//\r
94#define ONE_SECOND 10000000\r
95\r
96//\r
97// Display definitions\r
98//\r
99#define LEFT_HYPER_DELIMITER L'<'\r
100#define RIGHT_HYPER_DELIMITER L'>'\r
101\r
102#define LEFT_ONEOF_DELIMITER L'<'\r
103#define RIGHT_ONEOF_DELIMITER L'>'\r
104\r
105#define LEFT_NUMERIC_DELIMITER L'['\r
106#define RIGHT_NUMERIC_DELIMITER L']'\r
107\r
108#define LEFT_CHECKBOX_DELIMITER L'['\r
109#define RIGHT_CHECKBOX_DELIMITER L']'\r
110\r
111#define CHECK_ON L'X'\r
112#define CHECK_OFF L' '\r
113\r
114#define TIME_SEPARATOR L':'\r
115#define DATE_SEPARATOR L'/'\r
116\r
117#define YES_ANSWER L'Y'\r
118#define NO_ANSWER L'N'\r
119\r
120//\r
121// This is the Input Error Message\r
122//\r
123#define INPUT_ERROR 1\r
124\r
125//\r
126// This is the NV RAM update required Message\r
127//\r
128#define NV_UPDATE_REQUIRED 2\r
129\r
130//\r
131// Refresh the Status Bar with flags\r
132//\r
133#define REFRESH_STATUS_BAR 0xff\r
134\r
135//\r
136// Incremental string lenght of ConfigRequest\r
137//\r
138#define CONFIG_REQUEST_STRING_INCREMENTAL 1024\r
139\r
140//\r
141// HII value compare result\r
142//\r
143#define HII_VALUE_UNDEFINED 0\r
144#define HII_VALUE_EQUAL 1\r
145#define HII_VALUE_LESS_THAN 2\r
146#define HII_VALUE_GREATER_THAN 3\r
147\r
148//\r
149// Incremental size of stack for expression\r
150//\r
151#define EXPRESSION_STACK_SIZE_INCREMENT 0x100\r
152\r
0269d14b 153#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 154\r
7936fb6a 155\r
f3f2e05d 156#define SETUP_DRIVER_SIGNATURE SIGNATURE_32 ('F', 'B', 'D', 'V')\r
7936fb6a 157typedef struct {\r
158 UINT32 Signature;\r
159\r
160 EFI_HANDLE Handle;\r
161\r
162 //\r
163 // Produced protocol\r
164 //\r
48a9d5f7
LG
165 EFI_FORM_BROWSER2_PROTOCOL FormBrowser2;\r
166 \r
167 EFI_FORM_BROWSER_EXTENSION_PROTOCOL FormBrowserEx;\r
7936fb6a 168\r
169} SETUP_DRIVER_PRIVATE_DATA;\r
170\r
171typedef struct {\r
172 EFI_STRING_ID Banner[BANNER_HEIGHT][BANNER_COLUMNS];\r
173} BANNER_DATA;\r
174\r
175//\r
176// IFR relative definition\r
177//\r
178#define EFI_HII_EXPRESSION_INCONSISTENT_IF 0\r
179#define EFI_HII_EXPRESSION_NO_SUBMIT_IF 1\r
180#define EFI_HII_EXPRESSION_GRAY_OUT_IF 2\r
181#define EFI_HII_EXPRESSION_SUPPRESS_IF 3\r
182#define EFI_HII_EXPRESSION_DISABLE_IF 4\r
183#define EFI_HII_EXPRESSION_VALUE 5\r
184#define EFI_HII_EXPRESSION_RULE 6\r
2573712e
LG
185#define EFI_HII_EXPRESSION_READ 7\r
186#define EFI_HII_EXPRESSION_WRITE 8\r
7936fb6a 187\r
188#define EFI_HII_VARSTORE_BUFFER 0\r
189#define EFI_HII_VARSTORE_NAME_VALUE 1\r
190#define EFI_HII_VARSTORE_EFI_VARIABLE 2\r
cce6230f 191#define EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER 3\r
7936fb6a 192\r
193#define FORM_INCONSISTENT_VALIDATION 0\r
194#define FORM_NO_SUBMIT_VALIDATION 1\r
195\r
40245175
LG
196#define FORMSET_CLASS_PLATFORM_SETUP 0x0001\r
197#define FORMSET_CLASS_FRONT_PAGE 0x0002\r
0a1147ed 198\r
7936fb6a 199typedef struct {\r
200 UINT8 Type;\r
901ba0e7
ED
201 UINT8 *Buffer;\r
202 UINT16 BufferLen;\r
7936fb6a 203 EFI_IFR_TYPE_VALUE Value;\r
204} EFI_HII_VALUE;\r
205\r
f3f2e05d 206#define NAME_VALUE_NODE_SIGNATURE SIGNATURE_32 ('N', 'V', 'S', 'T')\r
7936fb6a 207\r
208typedef struct {\r
209 UINTN Signature;\r
210 LIST_ENTRY Link;\r
211 CHAR16 *Name;\r
212 CHAR16 *Value;\r
213 CHAR16 *EditValue;\r
214} NAME_VALUE_NODE;\r
215\r
216#define NAME_VALUE_NODE_FROM_LINK(a) CR (a, NAME_VALUE_NODE, Link, NAME_VALUE_NODE_SIGNATURE)\r
217\r
f3f2e05d 218#define FORMSET_STORAGE_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'G')\r
7936fb6a 219\r
220typedef struct {\r
221 UINTN Signature;\r
222 LIST_ENTRY Link;\r
223\r
224 UINT8 Type; // Storage type\r
225\r
226 UINT16 VarStoreId;\r
227 EFI_GUID Guid;\r
228\r
229 CHAR16 *Name; // For EFI_IFR_VARSTORE\r
230 UINT16 Size;\r
231 UINT8 *Buffer;\r
232 UINT8 *EditBuffer; // Edit copy for Buffer Storage\r
233\r
234 LIST_ENTRY NameValueListHead; // List of NAME_VALUE_NODE\r
235\r
236 UINT32 Attributes; // For EFI_IFR_VARSTORE_EFI: EFI Variable attribute\r
237\r
238 CHAR16 *ConfigHdr; // <ConfigHdr>\r
239 CHAR16 *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement>\r
240 UINTN ElementCount; // Number of <RequestElement> in the <ConfigRequest>\r
241 UINTN SpareStrLen; // Spare length of ConfigRequest string buffer\r
242} FORMSET_STORAGE;\r
243\r
244#define FORMSET_STORAGE_FROM_LINK(a) CR (a, FORMSET_STORAGE, Link, FORMSET_STORAGE_SIGNATURE)\r
245\r
2573712e
LG
246typedef union {\r
247 EFI_STRING_ID VarName;\r
248 UINT16 VarOffset;\r
249} VAR_STORE_INFO;\r
250\r
f3f2e05d 251#define EXPRESSION_OPCODE_SIGNATURE SIGNATURE_32 ('E', 'X', 'O', 'P')\r
7936fb6a 252\r
253typedef struct {\r
254 UINTN Signature;\r
255 LIST_ENTRY Link;\r
256\r
257 UINT8 Operand;\r
258\r
259 UINT8 Format; // For EFI_IFR_TO_STRING, EFI_IFR_FIND\r
260 UINT8 Flags; // For EFI_IFR_SPAN\r
261 UINT8 RuleId; // For EFI_IFR_RULE_REF\r
262\r
263 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
264\r
2654f642 265 EFI_QUESTION_ID QuestionId; // For EFI_IFR_EQ_ID_ID, EFI_IFR_EQ_ID_VAL_LIST, EFI_IFR_QUESTION_REF1\r
7936fb6a 266 EFI_QUESTION_ID QuestionId2;\r
267\r
2654f642 268 UINT16 ListLength; // For EFI_IFR_EQ_ID_VAL_LIST\r
7936fb6a 269 UINT16 *ValueList;\r
270\r
271 EFI_STRING_ID DevicePath; // For EFI_IFR_QUESTION_REF3_2, EFI_IFR_QUESTION_REF3_3\r
272 EFI_GUID Guid;\r
2573712e
LG
273\r
274 FORMSET_STORAGE *VarStorage; // For EFI_IFR_SET, EFI_IFR_GET\r
275 VAR_STORE_INFO VarStoreInfo;// For EFI_IFR_SET, EFI_IFR_GET\r
276 UINT8 ValueType; // For EFI_IFR_SET, EFI_IFR_GET\r
277 UINT8 ValueWidth; // For EFI_IFR_SET, EFI_IFR_GET\r
278 CHAR16 *ValueName; // For EFI_IFR_SET, EFI_IFR_GET\r
279 LIST_ENTRY MapExpressionList; // nested expressions inside of Map opcode.\r
7936fb6a 280} EXPRESSION_OPCODE;\r
281\r
282#define EXPRESSION_OPCODE_FROM_LINK(a) CR (a, EXPRESSION_OPCODE, Link, EXPRESSION_OPCODE_SIGNATURE)\r
283\r
f3f2e05d 284#define FORM_EXPRESSION_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'P')\r
7936fb6a 285\r
286typedef struct {\r
287 UINTN Signature;\r
288 LIST_ENTRY Link;\r
289\r
290 UINT8 Type; // Type for this expression\r
291\r
292 UINT8 RuleId; // For EFI_IFR_RULE only\r
293 EFI_STRING_ID Error; // For EFI_IFR_NO_SUBMIT_IF, EFI_IFR_INCONSISTENT_IF only\r
294\r
295 EFI_HII_VALUE Result; // Expression evaluation result\r
296\r
297 LIST_ENTRY OpCodeListHead; // OpCodes consist of this expression (EXPRESSION_OPCODE)\r
298} FORM_EXPRESSION;\r
299\r
300#define FORM_EXPRESSION_FROM_LINK(a) CR (a, FORM_EXPRESSION, Link, FORM_EXPRESSION_SIGNATURE)\r
301\r
31585af4
ED
302#define FORM_EXPRESSION_LIST_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'R')\r
303\r
304typedef struct {\r
305 UINTN Signature;\r
306 UINTN Count;\r
307 FORM_EXPRESSION *Expression[1]; // Array[Count] of expressions\r
308} FORM_EXPRESSION_LIST;\r
309\r
f3f2e05d 310#define QUESTION_DEFAULT_SIGNATURE SIGNATURE_32 ('Q', 'D', 'F', 'T')\r
7936fb6a 311\r
312typedef struct {\r
313 UINTN Signature;\r
314 LIST_ENTRY Link;\r
315\r
316 UINT16 DefaultId;\r
317 EFI_HII_VALUE Value; // Default value\r
318\r
319 FORM_EXPRESSION *ValueExpression; // Not-NULL indicates default value is provided by EFI_IFR_VALUE\r
320} QUESTION_DEFAULT;\r
321\r
322#define QUESTION_DEFAULT_FROM_LINK(a) CR (a, QUESTION_DEFAULT, Link, QUESTION_DEFAULT_SIGNATURE)\r
323\r
f3f2e05d 324#define QUESTION_OPTION_SIGNATURE SIGNATURE_32 ('Q', 'O', 'P', 'T')\r
7936fb6a 325\r
326typedef struct {\r
31585af4
ED
327 UINTN Signature;\r
328 LIST_ENTRY Link;\r
7936fb6a 329\r
31585af4
ED
330 EFI_STRING_ID Text;\r
331 UINT8 Flags;\r
332 EFI_HII_VALUE Value;\r
333 EFI_IMAGE_ID ImageId;\r
7936fb6a 334\r
31585af4 335 FORM_EXPRESSION_LIST *SuppressExpression; // Non-NULL indicates nested inside of SuppressIf\r
7936fb6a 336} QUESTION_OPTION;\r
337\r
338#define QUESTION_OPTION_FROM_LINK(a) CR (a, QUESTION_OPTION, Link, QUESTION_OPTION_SIGNATURE)\r
339\r
31585af4
ED
340typedef enum {\r
341 ExpressFalse = 0,\r
342 ExpressGrayOut, \r
343 ExpressSuppress,\r
344 ExpressDisable\r
345} EXPRESS_RESULT;\r
346\r
347typedef enum {\r
348 ExpressNone = 0,\r
349 ExpressForm, \r
350 ExpressStatement,\r
351 ExpressOption\r
352} EXPRESS_LEVEL;\r
353\r
f3f2e05d 354#define FORM_BROWSER_STATEMENT_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'A')\r
1ccdbf2a 355\r
7936fb6a 356typedef struct {\r
357 UINTN Signature;\r
358 LIST_ENTRY Link;\r
359\r
360 UINT8 Operand; // The operand (first byte) of this Statement or Question\r
361\r
362 //\r
363 // Statement Header\r
364 //\r
365 EFI_STRING_ID Prompt;\r
366 EFI_STRING_ID Help;\r
367 EFI_STRING_ID TextTwo; // For EFI_IFR_TEXT\r
368\r
369 //\r
370 // Question Header\r
371 //\r
372 EFI_QUESTION_ID QuestionId; // The value of zero is reserved\r
373 EFI_VARSTORE_ID VarStoreId; // A value of zero indicates no variable storage\r
374 FORMSET_STORAGE *Storage;\r
1ccdbf2a 375 VAR_STORE_INFO VarStoreInfo;\r
7936fb6a 376 UINT16 StorageWidth;\r
377 UINT8 QuestionFlags;\r
378 CHAR16 *VariableName; // Name/Value or EFI Variable name\r
379 CHAR16 *BlockName; // Buffer storage block name: "OFFSET=...WIDTH=..."\r
380\r
381 EFI_HII_VALUE HiiValue; // Edit copy for checkbox, numberic, oneof\r
382 UINT8 *BufferValue; // Edit copy for string, password, orderedlist\r
d02847d3 383 UINT8 ValueType; // Data type for orderedlist value array\r
7936fb6a 384\r
385 //\r
386 // OpCode specific members\r
387 //\r
388 UINT8 Flags; // for EFI_IFR_CHECKBOX, EFI_IFR_DATE, EFI_IFR_NUMERIC, EFI_IFR_ONE_OF,\r
389 // EFI_IFR_ORDERED_LIST, EFI_IFR_STRING,EFI_IFR_SUBTITLE,EFI_IFR_TIME, EFI_IFR_BANNER\r
390 UINT8 MaxContainers; // for EFI_IFR_ORDERED_LIST\r
391\r
392 UINT16 BannerLineNumber; // for EFI_IFR_BANNER, 1-based line number\r
393 EFI_STRING_ID QuestionConfig; // for EFI_IFR_ACTION, if 0 then no configuration string will be processed\r
394\r
395 UINT64 Minimum; // for EFI_IFR_ONE_OF/EFI_IFR_NUMERIC, it's Min/Max value\r
396 UINT64 Maximum; // for EFI_IFR_STRING/EFI_IFR_PASSWORD, it's Min/Max length\r
397 UINT64 Step;\r
398\r
399 EFI_DEFAULT_ID DefaultId; // for EFI_IFR_RESET_BUTTON\r
211cc6e5 400 EFI_GUID RefreshGuid; // for EFI_IFR_REFRESH_ID\r
f67c4382 401 BOOLEAN Locked; // Whether this statement is locked.\r
7936fb6a 402 //\r
403 // Get from IFR parsing\r
404 //\r
405 FORM_EXPRESSION *ValueExpression; // nested EFI_IFR_VALUE, provide Question value and indicate Question is ReadOnly\r
406 LIST_ENTRY DefaultListHead; // nested EFI_IFR_DEFAULT list (QUESTION_DEFAULT), provide default values\r
407 LIST_ENTRY OptionListHead; // nested EFI_IFR_ONE_OF_OPTION list (QUESTION_OPTION)\r
408\r
409 EFI_IMAGE_ID ImageId; // nested EFI_IFR_IMAGE\r
410 UINT8 RefreshInterval; // nested EFI_IFR_REFRESH, refresh interval(in seconds) for Question value, 0 means no refresh\r
411 BOOLEAN InSubtitle; // nesting inside of EFI_IFR_SUBTITLE\r
412\r
413 LIST_ENTRY InconsistentListHead;// nested inconsistent expression list (FORM_EXPRESSION)\r
414 LIST_ENTRY NoSubmitListHead; // nested nosubmit expression list (FORM_EXPRESSION)\r
31585af4 415 FORM_EXPRESSION_LIST *Expression; // nesting inside of GrayOutIf/DisableIf/SuppressIf\r
7936fb6a 416\r
2573712e
LG
417 FORM_EXPRESSION *ReadExpression; // nested EFI_IFR_READ, provide this question value by read expression.\r
418 FORM_EXPRESSION *WriteExpression; // nested EFI_IFR_WRITE, evaluate write expression after this question value is set.\r
7936fb6a 419} FORM_BROWSER_STATEMENT;\r
420\r
421#define FORM_BROWSER_STATEMENT_FROM_LINK(a) CR (a, FORM_BROWSER_STATEMENT, Link, FORM_BROWSER_STATEMENT_SIGNATURE)\r
422\r
b18e7050
ED
423#define FORM_BROWSER_CONFIG_REQUEST_SIGNATURE SIGNATURE_32 ('F', 'C', 'R', 'S')\r
424typedef struct {\r
425 UINTN Signature;\r
426 LIST_ENTRY Link;\r
427\r
428 CHAR16 *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement>\r
429 UINTN ElementCount; // Number of <RequestElement> in the <ConfigRequest> \r
430 UINTN SpareStrLen;\r
431\r
432 FORMSET_STORAGE *Storage;\r
433} FORM_BROWSER_CONFIG_REQUEST;\r
434#define FORM_BROWSER_CONFIG_REQUEST_FROM_LINK(a) CR (a, FORM_BROWSER_CONFIG_REQUEST, Link, FORM_BROWSER_CONFIG_REQUEST_SIGNATURE)\r
435\r
f3f2e05d 436#define FORM_BROWSER_FORM_SIGNATURE SIGNATURE_32 ('F', 'F', 'R', 'M')\r
2573712e 437#define STANDARD_MAP_FORM_TYPE 0x01\r
7936fb6a 438\r
439typedef struct {\r
31585af4
ED
440 UINTN Signature;\r
441 LIST_ENTRY Link;\r
7936fb6a 442\r
31585af4
ED
443 UINT16 FormId; // FormId of normal form or formmap form.\r
444 EFI_STRING_ID FormTitle; // FormTile of normal form, or FormMapMethod title of formmap form.\r
445 UINT16 FormType; // Specific form type for the different form.\r
7936fb6a 446\r
31585af4 447 EFI_IMAGE_ID ImageId;\r
7936fb6a 448\r
31585af4
ED
449 BOOLEAN ModalForm; // Whether this is a modal form.\r
450 BOOLEAN Locked; // Whether this form is locked.\r
b00964a9 451\r
31585af4 452 BOOLEAN NvUpdateRequired; // Whether this form has NV update request.\r
b18e7050 453\r
31585af4
ED
454 LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)\r
455 LIST_ENTRY StatementListHead; // List of Statements and Questions (FORM_BROWSER_STATEMENT)\r
456 LIST_ENTRY ConfigRequestHead; // List of configreques for all storage.\r
457 FORM_EXPRESSION_LIST *SuppressExpression; // nesting inside of SuppressIf\r
7936fb6a 458} FORM_BROWSER_FORM;\r
459\r
460#define FORM_BROWSER_FORM_FROM_LINK(a) CR (a, FORM_BROWSER_FORM, Link, FORM_BROWSER_FORM_SIGNATURE)\r
461\r
f3f2e05d 462#define FORMSET_DEFAULTSTORE_SIGNATURE SIGNATURE_32 ('F', 'D', 'F', 'S')\r
7936fb6a 463\r
464typedef struct {\r
465 UINTN Signature;\r
466 LIST_ENTRY Link;\r
467\r
468 UINT16 DefaultId;\r
469 EFI_STRING_ID DefaultName;\r
470} FORMSET_DEFAULTSTORE;\r
471\r
472#define FORMSET_DEFAULTSTORE_FROM_LINK(a) CR (a, FORMSET_DEFAULTSTORE, Link, FORMSET_DEFAULTSTORE_SIGNATURE)\r
473\r
48a9d5f7
LG
474#define FORM_BROWSER_FORMSET_SIGNATURE SIGNATURE_32 ('F', 'B', 'F', 'S')\r
475\r
7936fb6a 476typedef struct {\r
48a9d5f7
LG
477 UINTN Signature;\r
478 LIST_ENTRY Link;\r
479 EFI_HII_HANDLE HiiHandle; // unique id for formset.\r
7936fb6a 480 EFI_HANDLE DriverHandle;\r
481 EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;\r
482 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
483\r
484 UINTN IfrBinaryLength;\r
485 UINT8 *IfrBinaryData;\r
486\r
487 EFI_GUID Guid;\r
488 EFI_STRING_ID FormSetTitle;\r
489 EFI_STRING_ID Help;\r
0a1147ed
LG
490 UINT8 NumberOfClassGuid;\r
491 EFI_GUID ClassGuid[3]; // Up to three ClassGuid\r
492 UINT16 Class; // Tiano extended Class code\r
493 UINT16 SubClass; // Tiano extended Subclass code\r
7936fb6a 494 EFI_IMAGE_ID ImageId;\r
495\r
496 FORM_BROWSER_STATEMENT *StatementBuffer; // Buffer for all Statements and Questions\r
497 EXPRESSION_OPCODE *ExpressionBuffer; // Buffer for all Expression OpCode\r
498\r
499 LIST_ENTRY StorageListHead; // Storage list (FORMSET_STORAGE)\r
500 LIST_ENTRY DefaultStoreListHead; // DefaultStore list (FORMSET_DEFAULTSTORE)\r
501 LIST_ENTRY FormListHead; // Form list (FORM_BROWSER_FORM)\r
0c66bc76 502 LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)\r
7936fb6a 503} FORM_BROWSER_FORMSET;\r
504\r
48a9d5f7
LG
505#define FORM_BROWSER_FORMSET_FROM_LINK(a) CR (a, FORM_BROWSER_FORMSET, Link, FORM_BROWSER_FORMSET_SIGNATURE)\r
506\r
ce6d12cc 507#define BROWSER_CONTEXT_SIGNATURE SIGNATURE_32 ('B', 'C', 'T', 'X')\r
508\r
509typedef struct {\r
510 UINTN Signature;\r
511 LIST_ENTRY Link;\r
512\r
513 //\r
514 // Globals defined in Setup.c\r
515 //\r
516 BANNER_DATA *BannerData;\r
517 UINTN ClassOfVfr;\r
518 UINTN FunctionKeySetting;\r
519 BOOLEAN ResetRequired;\r
ce6d12cc 520 UINT16 Direction;\r
521 EFI_SCREEN_DESCRIPTOR ScreenDimensions;\r
ce6d12cc 522 CHAR16 *EnterString;\r
523 CHAR16 *EnterCommitString;\r
524 CHAR16 *EnterEscapeString;\r
525 CHAR16 *EscapeString;\r
ce6d12cc 526 CHAR16 *MoveHighlight;\r
527 CHAR16 *MakeSelection;\r
528 CHAR16 *DecNumericInput;\r
529 CHAR16 *HexNumericInput;\r
530 CHAR16 *ToggleCheckBox;\r
531 CHAR16 *PromptForData;\r
532 CHAR16 *PromptForPassword;\r
533 CHAR16 *PromptForNewPassword;\r
534 CHAR16 *ConfirmPassword;\r
535 CHAR16 *ConfirmError;\r
536 CHAR16 *PassowordInvalid;\r
537 CHAR16 *PressEnter;\r
538 CHAR16 *EmptyString;\r
539 CHAR16 *AreYouSure;\r
540 CHAR16 *YesResponse;\r
541 CHAR16 *NoResponse;\r
542 CHAR16 *MiniString;\r
543 CHAR16 *PlusString;\r
544 CHAR16 *MinusString;\r
545 CHAR16 *AdjustNumber;\r
546 CHAR16 *SaveChanges;\r
547 CHAR16 *OptionMismatch;\r
2bb526f3 548 CHAR16 *FormSuppress;\r
ce6d12cc 549 CHAR16 PromptBlockWidth;\r
550 CHAR16 OptionBlockWidth;\r
551 CHAR16 HelpBlockWidth;\r
552 FORM_BROWSER_FORMSET *OldFormSet;\r
553\r
554 //\r
555 // Globals defined in Ui.c\r
556 //\r
557 LIST_ENTRY MenuOption;\r
558 VOID *MenuRefreshHead;\r
559} BROWSER_CONTEXT;\r
560\r
561#define BROWSER_CONTEXT_FROM_LINK(a) CR (a, BROWSER_CONTEXT, Link, BROWSER_CONTEXT_SIGNATURE)\r
7936fb6a 562\r
48a9d5f7
LG
563#define BROWSER_HOT_KEY_SIGNATURE SIGNATURE_32 ('B', 'H', 'K', 'S')\r
564\r
565typedef struct {\r
566 UINTN Signature;\r
567 LIST_ENTRY Link;\r
568 \r
569 EFI_INPUT_KEY *KeyData;\r
570 IN UINT32 Action;\r
571 IN UINT16 DefaultId;\r
572 IN EFI_STRING HelpString;\r
573} BROWSER_HOT_KEY;\r
574\r
575#define BROWSER_HOT_KEY_FROM_LINK(a) CR (a, BROWSER_HOT_KEY, Link, BROWSER_HOT_KEY_SIGNATURE)\r
576\r
7936fb6a 577extern EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;\r
578extern EFI_HII_STRING_PROTOCOL *mHiiString;\r
579extern EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;\r
580\r
0a1147ed
LG
581extern BANNER_DATA *gBannerData;\r
582extern EFI_HII_HANDLE gFrontPageHandle;\r
7936fb6a 583extern UINTN gClassOfVfr;\r
584extern UINTN gFunctionKeySetting;\r
585extern BOOLEAN gResetRequired;\r
7936fb6a 586extern EFI_HII_HANDLE gHiiHandle;\r
7936fb6a 587extern UINT16 gDirection;\r
588extern EFI_SCREEN_DESCRIPTOR gScreenDimensions;\r
7936fb6a 589\r
d66e6c16 590extern FORM_BROWSER_FORMSET *gOldFormSet;\r
48a9d5f7
LG
591extern LIST_ENTRY gBrowserFormSetList;\r
592extern LIST_ENTRY gBrowserHotKeyList;\r
593extern BROWSER_SETTING_SCOPE gBrowserSettingScope;\r
594extern EXIT_HANDLER ExitHandlerFunction;\r
595extern UINTN gFooterHeight;\r
d66e6c16 596\r
7936fb6a 597//\r
598// Browser Global Strings\r
599//\r
48a9d5f7
LG
600extern CHAR16 *gDiscardFailed;\r
601extern CHAR16 *gDefaultFailed;\r
7936fb6a 602extern CHAR16 *gEnterString;\r
603extern CHAR16 *gEnterCommitString;\r
8d00a0f1 604extern CHAR16 *gEnterEscapeString;\r
7936fb6a 605extern CHAR16 *gEscapeString;\r
606extern CHAR16 *gSaveFailed;\r
607extern CHAR16 *gMoveHighlight;\r
608extern CHAR16 *gMakeSelection;\r
609extern CHAR16 *gDecNumericInput;\r
610extern CHAR16 *gHexNumericInput;\r
611extern CHAR16 *gToggleCheckBox;\r
612extern CHAR16 *gPromptForData;\r
613extern CHAR16 *gPromptForPassword;\r
614extern CHAR16 *gPromptForNewPassword;\r
615extern CHAR16 *gConfirmPassword;\r
616extern CHAR16 *gConfirmError;\r
617extern CHAR16 *gPassowordInvalid;\r
618extern CHAR16 *gPressEnter;\r
619extern CHAR16 *gEmptyString;\r
620extern CHAR16 *gAreYouSure;\r
621extern CHAR16 *gYesResponse;\r
622extern CHAR16 *gNoResponse;\r
623extern CHAR16 *gMiniString;\r
624extern CHAR16 *gPlusString;\r
625extern CHAR16 *gMinusString;\r
626extern CHAR16 *gAdjustNumber;\r
ebe43565 627extern CHAR16 *gSaveChanges;\r
8d00a0f1 628extern CHAR16 *gOptionMismatch;\r
0c66bc76 629extern CHAR16 *gFormSuppress;\r
7936fb6a 630\r
631extern CHAR16 gPromptBlockWidth;\r
632extern CHAR16 gOptionBlockWidth;\r
633extern CHAR16 gHelpBlockWidth;\r
634\r
635extern EFI_GUID gZeroGuid;\r
636extern EFI_GUID gTianoHiiIfrGuid;\r
637\r
eccfeab1 638#include "Ui.h"\r
7936fb6a 639//\r
640// Global Procedure Defines\r
641//\r
642\r
643/**\r
644 Initialize the HII String Token to the correct values.\r
645\r
646**/\r
647VOID\r
648InitializeBrowserStrings (\r
649 VOID\r
ed66e1bc 650 );\r
7936fb6a 651\r
652/**\r
653 Prints a unicode string to the default console,\r
654 using L"%s" format.\r
655\r
656 @param String String pointer.\r
657\r
658 @return Length of string printed to the console\r
659\r
660**/\r
661UINTN\r
662PrintString (\r
663 IN CHAR16 *String\r
ed66e1bc 664 );\r
7936fb6a 665\r
666/**\r
667 Prints a chracter to the default console,\r
668 using L"%c" format.\r
669\r
670 @param Character Character to print.\r
671\r
672 @return Length of string printed to the console.\r
673\r
674**/\r
675UINTN\r
676PrintChar (\r
677 CHAR16 Character\r
ed66e1bc 678 );\r
7936fb6a 679\r
680/**\r
681 Prints a formatted unicode string to the default console, at\r
682 the supplied cursor position.\r
683\r
684 @param Column The cursor position to print the string at.\r
685 @param Row The cursor position to print the string at\r
686 @param Fmt Format string\r
687 @param ... Variable argument list for formating string.\r
688\r
689 @return Length of string printed to the console\r
690\r
691**/\r
692UINTN\r
8091267c 693EFIAPI\r
7936fb6a 694PrintAt (\r
695 IN UINTN Column,\r
696 IN UINTN Row,\r
697 IN CHAR16 *Fmt,\r
698 ...\r
ed66e1bc 699 );\r
7936fb6a 700\r
701/**\r
702 Prints a unicode string to the default console, at\r
703 the supplied cursor position, using L"%s" format.\r
704\r
705 @param Column The cursor position to print the string at.\r
706 @param Row The cursor position to print the string at\r
707 @param String String pointer.\r
708\r
709 @return Length of string printed to the console\r
710\r
711**/\r
712UINTN\r
713PrintStringAt (\r
714 IN UINTN Column,\r
715 IN UINTN Row,\r
716 IN CHAR16 *String\r
ed66e1bc 717 );\r
7936fb6a 718\r
719/**\r
720 Prints a chracter to the default console, at\r
721 the supplied cursor position, using L"%c" format.\r
722\r
723 @param Column The cursor position to print the string at.\r
724 @param Row The cursor position to print the string at.\r
725 @param Character Character to print.\r
726\r
727 @return Length of string printed to the console.\r
728\r
729**/\r
730UINTN\r
731PrintCharAt (\r
732 IN UINTN Column,\r
733 IN UINTN Row,\r
734 CHAR16 Character\r
ed66e1bc 735 );\r
7936fb6a 736\r
737/**\r
738 Parse opcodes in the formset IFR binary.\r
739\r
740 @param FormSet Pointer of the FormSet data structure.\r
741\r
742 @retval EFI_SUCCESS Opcode parse success.\r
743 @retval Other Opcode parse fail.\r
744\r
745**/\r
746EFI_STATUS\r
747ParseOpCodes (\r
748 IN FORM_BROWSER_FORMSET *FormSet\r
ed66e1bc 749 );\r
7936fb6a 750\r
751/**\r
752 Free resources allocated for a FormSet.\r
753\r
754 @param FormSet Pointer of the FormSet\r
755\r
756**/\r
757VOID\r
758DestroyFormSet (\r
759 IN OUT FORM_BROWSER_FORMSET *FormSet\r
ed66e1bc 760 );\r
7936fb6a 761\r
762/**\r
763 This function displays the page frame.\r
764\r
b00964a9
ED
765 @param Selection Selection contains the information about \r
766 the Selection, form and formset to be displayed.\r
767 Selection action may be updated in retrieve callback.\r
7936fb6a 768**/\r
769VOID\r
770DisplayPageFrame (\r
b00964a9 771 IN UI_MENU_SELECTION *Selection\r
ed66e1bc 772 );\r
7936fb6a 773\r
774/**\r
775 Create a new string in HII Package List.\r
776\r
777 @param String The String to be added\r
778 @param HiiHandle The package list in the HII database to insert the\r
779 specified string.\r
780\r
781 @return The output string.\r
782\r
783**/\r
784EFI_STRING_ID\r
785NewString (\r
786 IN CHAR16 *String,\r
787 IN EFI_HII_HANDLE HiiHandle\r
ed66e1bc 788 );\r
7936fb6a 789\r
790/**\r
791 Delete a string from HII Package List.\r
792\r
793 @param StringId Id of the string in HII database.\r
794 @param HiiHandle The HII package list handle.\r
795\r
796 @retval EFI_SUCCESS The string was deleted successfully.\r
797\r
798**/\r
799EFI_STATUS\r
800DeleteString (\r
801 IN EFI_STRING_ID StringId,\r
802 IN EFI_HII_HANDLE HiiHandle\r
ed66e1bc 803 );\r
7936fb6a 804\r
805/**\r
806 Get the string based on the StringId and HII Package List Handle.\r
807\r
808 @param Token The String's ID.\r
809 @param HiiHandle The package list in the HII database to search for\r
810 the specified string.\r
811\r
812 @return The output string.\r
813\r
814**/\r
815CHAR16 *\r
816GetToken (\r
817 IN EFI_STRING_ID Token,\r
818 IN EFI_HII_HANDLE HiiHandle\r
ed66e1bc 819 );\r
7936fb6a 820\r
821/**\r
822 Draw a pop up windows based on the dimension, number of lines and\r
823 strings specified.\r
824\r
825 @param RequestedWidth The width of the pop-up.\r
826 @param NumberOfLines The number of lines.\r
f4bcc90f 827 @param Marker The variable argument list for the list of string to be printed.\r
7936fb6a 828\r
829**/\r
830VOID\r
831CreateSharedPopUp (\r
832 IN UINTN RequestedWidth,\r
833 IN UINTN NumberOfLines,\r
f4bcc90f 834 IN VA_LIST Marker\r
ed66e1bc 835 );\r
7936fb6a 836\r
837/**\r
838 Routine used to abstract a generic dialog interface and return the selected key or string\r
839\r
840 @param NumberOfLines The number of lines for the dialog box\r
841 @param HotKey Defines whether a single character is parsed\r
842 (TRUE) and returned in KeyValue or a string is\r
843 returned in StringBuffer. Two special characters\r
844 are considered when entering a string, a SCAN_ESC\r
845 and an CHAR_CARRIAGE_RETURN. SCAN_ESC terminates\r
846 string input and returns\r
847 @param MaximumStringSize The maximum size in bytes of a typed in string\r
848 (each character is a CHAR16) and the minimum\r
849 string returned is two bytes\r
850 @param StringBuffer The passed in pointer to the buffer which will\r
851 hold the typed in string if HotKey is FALSE\r
852 @param KeyValue The EFI_KEY value returned if HotKey is TRUE..\r
7936fb6a 853 @param ... A series of (quantity == NumberOfLines) text\r
854 strings which will be used to construct the dialog\r
855 box\r
856\r
857 @retval EFI_SUCCESS Displayed dialog and received user interaction\r
858 @retval EFI_INVALID_PARAMETER One of the parameters was invalid (e.g.\r
859 (StringBuffer == NULL) && (HotKey == FALSE))\r
860 @retval EFI_DEVICE_ERROR User typed in an ESC character to exit the routine\r
861\r
862**/\r
863EFI_STATUS\r
8091267c 864EFIAPI\r
7936fb6a 865CreateDialog (\r
866 IN UINTN NumberOfLines,\r
867 IN BOOLEAN HotKey,\r
868 IN UINTN MaximumStringSize,\r
869 OUT CHAR16 *StringBuffer,\r
870 OUT EFI_INPUT_KEY *KeyValue,\r
7936fb6a 871 ...\r
ed66e1bc 872 );\r
7936fb6a 873\r
2573712e
LG
874/**\r
875 Get Value for given Name from a NameValue Storage.\r
876\r
877 @param Storage The NameValue Storage.\r
878 @param Name The Name.\r
879 @param Value The retured Value.\r
880\r
881 @retval EFI_SUCCESS Value found for given Name.\r
882 @retval EFI_NOT_FOUND No such Name found in NameValue storage.\r
883\r
884**/\r
885EFI_STATUS\r
886GetValueByName (\r
887 IN FORMSET_STORAGE *Storage,\r
888 IN CHAR16 *Name,\r
889 IN OUT CHAR16 **Value\r
890 );\r
891\r
892/**\r
893 Set Value of given Name in a NameValue Storage.\r
894\r
895 @param Storage The NameValue Storage.\r
896 @param Name The Name.\r
897 @param Value The Value to set.\r
b18e7050 898 @param Edit Whether update editValue or Value.\r
2573712e
LG
899\r
900 @retval EFI_SUCCESS Value found for given Name.\r
901 @retval EFI_NOT_FOUND No such Name found in NameValue storage.\r
902\r
903**/\r
904EFI_STATUS\r
905SetValueByName (\r
906 IN FORMSET_STORAGE *Storage,\r
907 IN CHAR16 *Name,\r
b18e7050
ED
908 IN CHAR16 *Value,\r
909 IN BOOLEAN Edit\r
2573712e
LG
910 );\r
911\r
7936fb6a 912/**\r
913 Get Question's current Value.\r
914\r
915 @param FormSet FormSet data structure.\r
916 @param Form Form data structure.\r
917 @param Question Question to be initialized.\r
918 @param Cached TRUE: get from Edit copy FALSE: get from original\r
919 Storage\r
920\r
921 @retval EFI_SUCCESS The function completed successfully.\r
922\r
923**/\r
924EFI_STATUS\r
925GetQuestionValue (\r
926 IN FORM_BROWSER_FORMSET *FormSet,\r
927 IN FORM_BROWSER_FORM *Form,\r
928 IN OUT FORM_BROWSER_STATEMENT *Question,\r
929 IN BOOLEAN Cached\r
ed66e1bc 930 );\r
7936fb6a 931\r
932/**\r
933 Save Question Value to edit copy(cached) or Storage(uncached).\r
934\r
935 @param FormSet FormSet data structure.\r
936 @param Form Form data structure.\r
937 @param Question Pointer to the Question.\r
938 @param Cached TRUE: set to Edit copy FALSE: set to original\r
939 Storage\r
940\r
941 @retval EFI_SUCCESS The function completed successfully.\r
942\r
943**/\r
944EFI_STATUS\r
945SetQuestionValue (\r
946 IN FORM_BROWSER_FORMSET *FormSet,\r
947 IN FORM_BROWSER_FORM *Form,\r
948 IN OUT FORM_BROWSER_STATEMENT *Question,\r
949 IN BOOLEAN Cached\r
ed66e1bc 950 );\r
7936fb6a 951\r
952/**\r
953 Perform inconsistent check for a Form.\r
954\r
955 @param FormSet FormSet data structure.\r
956 @param Form Form data structure.\r
957 @param Question The Question to be validated.\r
958 @param Type Validation type: InConsistent or NoSubmit\r
959\r
960 @retval EFI_SUCCESS Form validation pass.\r
961 @retval other Form validation failed.\r
962\r
963**/\r
964EFI_STATUS\r
965ValidateQuestion (\r
966 IN FORM_BROWSER_FORMSET *FormSet,\r
967 IN FORM_BROWSER_FORM *Form,\r
968 IN FORM_BROWSER_STATEMENT *Question,\r
969 IN UINTN Type\r
ed66e1bc 970 );\r
7936fb6a 971\r
48a9d5f7 972\r
7936fb6a 973/**\r
48a9d5f7 974 Discard data based on the input setting scope (Form, FormSet or System).\r
7936fb6a 975\r
976 @param FormSet FormSet data structure.\r
977 @param Form Form data structure.\r
48a9d5f7 978 @param SettingScope Setting Scope for Discard action.\r
b18e7050
ED
979\r
980 @retval EFI_SUCCESS The function completed successfully.\r
48a9d5f7 981 @retval EFI_UNSUPPORTED Unsupport SettingScope.\r
b18e7050
ED
982\r
983**/\r
984EFI_STATUS\r
985DiscardForm (\r
986 IN FORM_BROWSER_FORMSET *FormSet,\r
987 IN FORM_BROWSER_FORM *Form,\r
48a9d5f7 988 IN BROWSER_SETTING_SCOPE SettingScope\r
b18e7050
ED
989 );\r
990\r
991/**\r
48a9d5f7 992 Submit data based on the input Setting level (Form, FormSet or System).\r
b18e7050
ED
993\r
994 @param FormSet FormSet data structure.\r
995 @param Form Form data structure.\r
48a9d5f7 996 @param SettingScope Setting Scope for Submit action.\r
7936fb6a 997\r
998 @retval EFI_SUCCESS The function completed successfully.\r
48a9d5f7 999 @retval EFI_UNSUPPORTED Unsupport SettingScope.\r
7936fb6a 1000\r
1001**/\r
1002EFI_STATUS\r
1003SubmitForm (\r
1004 IN FORM_BROWSER_FORMSET *FormSet,\r
b18e7050 1005 IN FORM_BROWSER_FORM *Form,\r
48a9d5f7 1006 IN BROWSER_SETTING_SCOPE SettingScope\r
ed66e1bc 1007 );\r
7936fb6a 1008\r
1009/**\r
1010 Reset Question to its default value.\r
1011\r
1012 @param FormSet The form set.\r
1013 @param Form The form.\r
1014 @param Question The question.\r
1015 @param DefaultId The Class of the default.\r
1016\r
1017 @retval EFI_SUCCESS Question is reset to default value.\r
1018\r
1019**/\r
1020EFI_STATUS\r
1021GetQuestionDefault (\r
1022 IN FORM_BROWSER_FORMSET *FormSet,\r
1023 IN FORM_BROWSER_FORM *Form,\r
1024 IN FORM_BROWSER_STATEMENT *Question,\r
1025 IN UINT16 DefaultId\r
ed66e1bc 1026 );\r
7936fb6a 1027\r
1028/**\r
1029 Get current setting of Questions.\r
1030\r
1031 @param FormSet FormSet data structure.\r
1032\r
1033 @retval EFI_SUCCESS The function completed successfully.\r
1034\r
1035**/\r
1036EFI_STATUS\r
1037InitializeCurrentSetting (\r
1038 IN OUT FORM_BROWSER_FORMSET *FormSet\r
ed66e1bc 1039 );\r
7936fb6a 1040\r
1041/**\r
1042 Initialize the internal data structure of a FormSet.\r
1043\r
1044 @param Handle PackageList Handle\r
1045 @param FormSetGuid GUID of a formset. If not specified (NULL or zero\r
1046 GUID), take the first FormSet found in package\r
1047 list.\r
1048 @param FormSet FormSet data structure.\r
db40504e 1049 @param UpdateGlobalVar Whether need to update the global variable.\r
7936fb6a 1050\r
1051 @retval EFI_SUCCESS The function completed successfully.\r
1052 @retval EFI_NOT_FOUND The specified FormSet could not be found.\r
1053\r
1054**/\r
1055EFI_STATUS\r
1056InitializeFormSet (\r
1057 IN EFI_HII_HANDLE Handle,\r
1058 IN OUT EFI_GUID *FormSetGuid,\r
db40504e
ED
1059 OUT FORM_BROWSER_FORMSET *FormSet,\r
1060 IN BOOLEAN UpdateGlobalVar \r
ed66e1bc 1061 );\r
7936fb6a 1062\r
1063/**\r
48a9d5f7 1064 Reset Questions to their default value in a Form, Formset or System.\r
7936fb6a 1065\r
1066 @param FormSet FormSet data structure.\r
48a9d5f7 1067 @param Form Form data structure.\r
7936fb6a 1068 @param DefaultId The Class of the default.\r
48a9d5f7 1069 @param SettingScope Setting Scope for Default action.\r
3347d410 1070 @param Storage Get default value only for this storage.\r
7936fb6a 1071\r
1072 @retval EFI_SUCCESS The function completed successfully.\r
48a9d5f7 1073 @retval EFI_UNSUPPORTED Unsupport SettingScope.\r
7936fb6a 1074\r
1075**/\r
1076EFI_STATUS\r
48a9d5f7 1077ExtractDefault (\r
7936fb6a 1078 IN FORM_BROWSER_FORMSET *FormSet,\r
48a9d5f7
LG
1079 IN FORM_BROWSER_FORM *Form,\r
1080 IN UINT16 DefaultId,\r
3347d410
ED
1081 IN BROWSER_SETTING_SCOPE SettingScope,\r
1082 IN FORMSET_STORAGE *Storage OPTIONAL\r
ed66e1bc 1083 );\r
7936fb6a 1084\r
1085/**\r
1086 Initialize Question's Edit copy from Storage.\r
1087\r
eccfeab1
LG
1088 @param Selection Selection contains the information about \r
1089 the Selection, form and formset to be displayed.\r
1090 Selection action may be updated in retrieve callback.\r
7d1b202d 1091 If Selection is NULL, only initialize Question value.\r
7936fb6a 1092 @param FormSet FormSet data structure.\r
1093 @param Form Form data structure.\r
1094\r
1095 @retval EFI_SUCCESS The function completed successfully.\r
1096\r
1097**/\r
1098EFI_STATUS\r
1099LoadFormConfig (\r
eccfeab1
LG
1100 IN OUT UI_MENU_SELECTION *Selection,\r
1101 IN FORM_BROWSER_FORMSET *FormSet,\r
1102 IN FORM_BROWSER_FORM *Form\r
ed66e1bc 1103 );\r
7936fb6a 1104\r
d66e6c16 1105/**\r
1106 Initialize Question's Edit copy from Storage for the whole Formset.\r
1107\r
eccfeab1
LG
1108 @param Selection Selection contains the information about \r
1109 the Selection, form and formset to be displayed.\r
1110 Selection action may be updated in retrieve callback.\r
7d1b202d 1111 If Selection is NULL, only initialize Question value.\r
d66e6c16 1112 @param FormSet FormSet data structure.\r
1113\r
1114 @retval EFI_SUCCESS The function completed successfully.\r
1115\r
1116**/\r
1117EFI_STATUS\r
1118LoadFormSetConfig (\r
eccfeab1
LG
1119 IN OUT UI_MENU_SELECTION *Selection,\r
1120 IN FORM_BROWSER_FORMSET *FormSet\r
d66e6c16 1121 );\r
1122\r
7936fb6a 1123/**\r
1124 Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.\r
1125\r
b18e7050 1126 @param Buffer The Storage to be conveted.\r
7936fb6a 1127 @param ConfigResp The returned <ConfigResp>.\r
b18e7050 1128 @param SingleForm Whether update data for single form or formset level.\r
7936fb6a 1129\r
1130 @retval EFI_SUCCESS Convert success.\r
1131 @retval EFI_INVALID_PARAMETER Incorrect storage type.\r
1132\r
1133**/\r
1134EFI_STATUS\r
1135StorageToConfigResp (\r
b18e7050
ED
1136 IN VOID *Buffer,\r
1137 IN CHAR16 **ConfigResp,\r
1138 IN BOOLEAN SingleForm\r
ed66e1bc 1139 );\r
7936fb6a 1140\r
1141/**\r
1142 Convert <ConfigResp> to settings in Buffer Storage or NameValue Storage.\r
1143\r
1144 @param Storage The Storage to receive the settings.\r
1145 @param ConfigResp The <ConfigResp> to be converted.\r
1146\r
1147 @retval EFI_SUCCESS Convert success.\r
1148 @retval EFI_INVALID_PARAMETER Incorrect storage type.\r
1149\r
1150**/\r
1151EFI_STATUS\r
1152ConfigRespToStorage (\r
1153 IN FORMSET_STORAGE *Storage,\r
1154 IN CHAR16 *ConfigResp\r
ed66e1bc 1155 );\r
7936fb6a 1156\r
1157/**\r
1158 Fill storage's edit copy with settings requested from Configuration Driver.\r
1159\r
1160 @param FormSet FormSet data structure.\r
1161 @param Storage Buffer Storage.\r
1162\r
1163 @retval EFI_SUCCESS The function completed successfully.\r
1164\r
1165**/\r
1166EFI_STATUS\r
1167LoadStorage (\r
1168 IN FORM_BROWSER_FORMSET *FormSet,\r
1169 IN FORMSET_STORAGE *Storage\r
ed66e1bc 1170 );\r
7936fb6a 1171\r
1172/**\r
1173 Fetch the Ifr binary data of a FormSet.\r
1174\r
1175 @param Handle PackageList Handle\r
1176 @param FormSetGuid GUID of a formset. If not specified (NULL or zero\r
1177 GUID), take the first FormSet found in package\r
1178 list.\r
1179 @param BinaryLength The length of the FormSet IFR binary.\r
1180 @param BinaryData The buffer designed to receive the FormSet.\r
1181\r
1182 @retval EFI_SUCCESS Buffer filled with the requested FormSet.\r
1183 BufferLength was updated.\r
1184 @retval EFI_INVALID_PARAMETER The handle is unknown.\r
1185 @retval EFI_NOT_FOUND A form or FormSet on the requested handle cannot\r
1186 be found with the requested FormId.\r
1187\r
1188**/\r
1189EFI_STATUS\r
1190GetIfrBinaryData (\r
1191 IN EFI_HII_HANDLE Handle,\r
1192 IN OUT EFI_GUID *FormSetGuid,\r
1193 OUT UINTN *BinaryLength,\r
1194 OUT UINT8 **BinaryData\r
ed66e1bc 1195 );\r
7936fb6a 1196\r
ce6d12cc 1197/**\r
1198 Save globals used by previous call to SendForm(). SendForm() may be called from \r
1199 HiiConfigAccess.Callback(), this will cause SendForm() be reentried.\r
1200 So, save globals of previous call to SendForm() and restore them upon exit.\r
1201\r
1202**/\r
1203VOID\r
1204SaveBrowserContext (\r
1205 VOID\r
1206 );\r
1207\r
1208/**\r
1209 Restore globals used by previous call to SendForm().\r
1210\r
1211**/\r
1212VOID\r
1213RestoreBrowserContext (\r
1214 VOID\r
1215 );\r
1216\r
7936fb6a 1217/**\r
1218 This is the routine which an external caller uses to direct the browser\r
1219 where to obtain it's information.\r
1220\r
1221\r
1222 @param This The Form Browser protocol instanse.\r
1223 @param Handles A pointer to an array of Handles. If HandleCount > 1 we\r
1224 display a list of the formsets for the handles specified.\r
1225 @param HandleCount The number of Handles specified in Handle.\r
1226 @param FormSetGuid This field points to the EFI_GUID which must match the Guid\r
1227 field in the EFI_IFR_FORM_SET op-code for the specified\r
1228 forms-based package. If FormSetGuid is NULL, then this\r
1229 function will display the first found forms package.\r
1230 @param FormId This field specifies which EFI_IFR_FORM to render as the first\r
1231 displayable page. If this field has a value of 0x0000, then\r
1232 the forms browser will render the specified forms in their encoded order.\r
1233 ScreenDimenions - This allows the browser to be called so that it occupies a\r
1234 portion of the physical screen instead of dynamically determining the screen dimensions.\r
1235 ActionRequest - Points to the action recommended by the form.\r
d66e6c16 1236 @param ScreenDimensions Points to recommended form dimensions, including any non-content area, in\r
7936fb6a 1237 characters.\r
1238 @param ActionRequest Points to the action recommended by the form.\r
1239\r
1240 @retval EFI_SUCCESS The function completed successfully.\r
1241 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
1242 @retval EFI_NOT_FOUND No valid forms could be found to display.\r
1243\r
1244**/\r
1245EFI_STATUS\r
1246EFIAPI\r
1247SendForm (\r
1248 IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,\r
1249 IN EFI_HII_HANDLE *Handles,\r
1250 IN UINTN HandleCount,\r
1251 IN EFI_GUID *FormSetGuid, OPTIONAL\r
1252 IN UINT16 FormId, OPTIONAL\r
1253 IN CONST EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL\r
1254 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest OPTIONAL\r
ed66e1bc 1255 );\r
7936fb6a 1256\r
1257/**\r
1258 This function is called by a callback handler to retrieve uncommitted state\r
1259 data from the browser.\r
1260\r
1261 @param This A pointer to the EFI_FORM_BROWSER2_PROTOCOL\r
1262 instance.\r
1263 @param ResultsDataSize A pointer to the size of the buffer associated\r
1264 with ResultsData.\r
1265 @param ResultsData A string returned from an IFR browser or\r
1266 equivalent. The results string will have no\r
1267 routing information in them.\r
1268 @param RetrieveData A BOOLEAN field which allows an agent to retrieve\r
1269 (if RetrieveData = TRUE) data from the uncommitted\r
1270 browser state information or set (if RetrieveData\r
1271 = FALSE) data in the uncommitted browser state\r
1272 information.\r
1273 @param VariableGuid An optional field to indicate the target variable\r
1274 GUID name to use.\r
1275 @param VariableName An optional field to indicate the target\r
1276 human-readable variable name.\r
1277\r
1278 @retval EFI_SUCCESS The results have been distributed or are awaiting\r
1279 distribution.\r
1280 @retval EFI_BUFFER_TOO_SMALL The ResultsDataSize specified was too small to\r
1281 contain the results data.\r
1282\r
1283**/\r
1284EFI_STATUS\r
1285EFIAPI\r
1286BrowserCallback (\r
1287 IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,\r
1288 IN OUT UINTN *ResultsDataSize,\r
1289 IN OUT EFI_STRING ResultsData,\r
1290 IN BOOLEAN RetrieveData,\r
1291 IN CONST EFI_GUID *VariableGuid, OPTIONAL\r
1292 IN CONST CHAR16 *VariableName OPTIONAL\r
ed66e1bc 1293 );\r
7936fb6a 1294\r
b18e7050
ED
1295/**\r
1296 Find menu which will show next time.\r
1297\r
1298 @param Selection On input, Selection tell setup browser the information\r
1299 about the Selection, form and formset to be displayed.\r
1300 On output, Selection return the screen item that is selected\r
1301 by user.\r
1302 @param Repaint Whether need to repaint the menu.\r
1303 @param NewLine Whether need to show at new line.\r
1304 \r
1305 @retval TRUE Need return.\r
1306 @retval FALSE No need to return.\r
1307**/\r
1308BOOLEAN\r
1309FindNextMenu (\r
1310 IN OUT UI_MENU_SELECTION *Selection,\r
1311 IN BOOLEAN *Repaint, \r
1312 IN BOOLEAN *NewLine \r
1313 );\r
1314\r
1315/**\r
1316 check whether the formset need to update the NV.\r
1317\r
1318 @param FormSet FormSet data structure.\r
1319 @param SetValue Whether set new value or clear old value.\r
1320\r
1321**/\r
1322VOID\r
1323UpdateNvInfoInForm (\r
1324 IN FORM_BROWSER_FORMSET *FormSet,\r
1325 IN BOOLEAN SetValue\r
1326 );\r
1327\r
1328/**\r
1329 check whether the formset need to update the NV.\r
1330\r
1331 @param FormSet FormSet data structure.\r
1332\r
1333 @retval TRUE Need to update the NV.\r
1334 @retval FALSE No need to update the NV.\r
1335**/\r
1336BOOLEAN \r
1337IsNvUpdateRequired (\r
1338 IN FORM_BROWSER_FORMSET *FormSet\r
1339 );\r
1340\r
1341/**\r
1342 Call the call back function for the question and process the return action.\r
1343\r
1344 @param Selection On input, Selection tell setup browser the information\r
1345 about the Selection, form and formset to be displayed.\r
1346 On output, Selection return the screen item that is selected\r
1347 by user.\r
1348 @param Statement The Question which need to call.\r
1349 @param Action The action request.\r
1350 @param SkipSaveOrDiscard Whether skip save or discard action.\r
1351\r
1352 @retval EFI_SUCCESS The call back function excutes successfully.\r
1353 @return Other value if the call back function failed to excute. \r
1354**/\r
1355EFI_STATUS \r
1356ProcessCallBackFunction (\r
1357 IN OUT UI_MENU_SELECTION *Selection,\r
1358 IN FORM_BROWSER_STATEMENT *Question,\r
1359 IN EFI_BROWSER_ACTION Action,\r
1360 IN BOOLEAN SkipSaveOrDiscard\r
1361 );\r
48a9d5f7
LG
1362\r
1363/**\r
1364 Find the matched FormSet context in the backup maintain list based on HiiHandle.\r
1365 \r
1366 @param Handle The Hii Handle.\r
1367 \r
1368 @return the found FormSet context. If no found, NULL will return.\r
1369\r
1370**/\r
1371FORM_BROWSER_FORMSET * \r
1372GetFormSetFromHiiHandle (\r
1373 EFI_HII_HANDLE Handle\r
1374 );\r
1375\r
1376/**\r
1377 Check whether the input HII handle is the FormSet that is being used.\r
1378 \r
1379 @param Handle The Hii Handle.\r
1380 \r
1381 @retval TRUE HII handle is being used.\r
1382 @retval FALSE HII handle is not being used.\r
1383\r
1384**/\r
1385BOOLEAN\r
1386IsHiiHandleInBrowserContext (\r
1387 EFI_HII_HANDLE Handle\r
1388 );\r
1389\r
1390/**\r
1391 Configure what scope the hot key will impact.\r
1392 All hot keys have the same scope. The mixed hot keys with the different level are not supported.\r
1393 If no scope is set, the default scope will be FormSet level.\r
1394 After all registered hot keys are removed, previous Scope can reset to another level.\r
1395 \r
1396 @param[in] Scope Scope level to be set. \r
1397 \r
1398 @retval EFI_SUCCESS Scope is set correctly.\r
1399 @retval EFI_INVALID_PARAMETER Scope is not the valid value specified in BROWSER_SETTING_SCOPE. \r
1400 @retval EFI_UNSPPORTED Scope level is different from current one that the registered hot keys have.\r
1401\r
1402**/\r
1403EFI_STATUS\r
1404EFIAPI\r
1405SetScope (\r
1406 IN BROWSER_SETTING_SCOPE Scope\r
1407 );\r
1408\r
1409/**\r
1410 Register the hot key with its browser action, or unregistered the hot key.\r
1411 Only support hot key that is not printable character (control key, function key, etc.).\r
1412 If the action value is zero, the hot key will be unregistered if it has been registered.\r
1413 If the same hot key has been registered, the new action and help string will override the previous ones.\r
1414 \r
1415 @param[in] KeyData A pointer to a buffer that describes the keystroke\r
1416 information for the hot key. Its type is EFI_INPUT_KEY to \r
1417 be supported by all ConsoleIn devices.\r
1418 @param[in] Action Action value that describes what action will be trigged when the hot key is pressed. \r
1419 @param[in] DefaultId Specifies the type of defaults to retrieve, which is only for DEFAULT action.\r
1420 @param[in] HelpString Help string that describes the hot key information.\r
1421 Its value may be NULL for the unregistered hot key.\r
1422 \r
1423 @retval EFI_SUCCESS Hot key is registered or unregistered.\r
1424 @retval EFI_INVALID_PARAMETER KeyData is NULL.\r
1425 @retval EFI_NOT_FOUND KeyData is not found to be unregistered.\r
1426 @retval EFI_UNSUPPORTED Key represents a printable character. It is conflicted with Browser.\r
1427**/\r
1428EFI_STATUS\r
1429EFIAPI\r
1430RegisterHotKey (\r
1431 IN EFI_INPUT_KEY *KeyData,\r
1432 IN UINT32 Action,\r
1433 IN UINT16 DefaultId,\r
1434 IN EFI_STRING HelpString OPTIONAL\r
1435 );\r
1436\r
1437/**\r
1438 Register Exit handler function. \r
1439 When more than one handler function is registered, the latter one will override the previous one. \r
1440 When NULL handler is specified, the previous Exit handler will be unregistered. \r
1441 \r
1442 @param[in] Handler Pointer to handler function. \r
1443\r
1444**/\r
1445VOID\r
1446EFIAPI\r
1447RegiserExitHandler (\r
1448 IN EXIT_HANDLER Handler\r
1449 );\r
1450\r
1451/**\r
1452 Create reminder to let user to choose save or discard the changed browser data.\r
1453 Caller can use it to actively check the changed browser data.\r
1454\r
1455 @retval BROWSER_NO_CHANGES No browser data is changed.\r
1456 @retval BROWSER_SAVE_CHANGES The changed browser data is saved.\r
1457 @retval BROWSER_DISCARD_CHANGES The changed browser data is discard.\r
1458\r
1459**/\r
1460UINT32\r
1461EFIAPI\r
1462SaveReminder (\r
1463 VOID\r
1464 );\r
1465\r
1466/**\r
1467 Find the registered HotKey based on KeyData.\r
1468 \r
1469 @param[in] KeyData A pointer to a buffer that describes the keystroke\r
1470 information for the hot key.\r
1471\r
1472 @return The registered HotKey context. If no found, NULL will return.\r
1473**/\r
1474BROWSER_HOT_KEY *\r
1475GetHotKeyFromRegisterList (\r
1476 IN EFI_INPUT_KEY *KeyData\r
1477 );\r
1478\r
7936fb6a 1479#endif\r