]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
Refine the message for Reset request.
[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
09cdd7d2
ED
577//\r
578// Scope for get defaut value. It may be GetDefaultForNoStorage, GetDefaultForStorage or GetDefaultForAll.\r
579//\r
580typedef enum {\r
581 GetDefaultForNoStorage, // Get default value for question which not has storage.\r
582 GetDefaultForStorage, // Get default value for question which has storage.\r
583 GetDefaultForAll, // Get default value for all questions.\r
584 GetDefaultForMax // Invalid value.\r
585} BROWSER_GET_DEFAULT_VALUE;\r
586\r
7936fb6a 587extern EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;\r
588extern EFI_HII_STRING_PROTOCOL *mHiiString;\r
589extern EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;\r
590\r
0a1147ed
LG
591extern BANNER_DATA *gBannerData;\r
592extern EFI_HII_HANDLE gFrontPageHandle;\r
7936fb6a 593extern UINTN gClassOfVfr;\r
594extern UINTN gFunctionKeySetting;\r
595extern BOOLEAN gResetRequired;\r
7936fb6a 596extern EFI_HII_HANDLE gHiiHandle;\r
7936fb6a 597extern UINT16 gDirection;\r
598extern EFI_SCREEN_DESCRIPTOR gScreenDimensions;\r
7936fb6a 599\r
d66e6c16 600extern FORM_BROWSER_FORMSET *gOldFormSet;\r
48a9d5f7
LG
601extern LIST_ENTRY gBrowserFormSetList;\r
602extern LIST_ENTRY gBrowserHotKeyList;\r
603extern BROWSER_SETTING_SCOPE gBrowserSettingScope;\r
604extern EXIT_HANDLER ExitHandlerFunction;\r
605extern UINTN gFooterHeight;\r
d66e6c16 606\r
7936fb6a 607//\r
608// Browser Global Strings\r
609//\r
48a9d5f7
LG
610extern CHAR16 *gDiscardFailed;\r
611extern CHAR16 *gDefaultFailed;\r
7936fb6a 612extern CHAR16 *gEnterString;\r
613extern CHAR16 *gEnterCommitString;\r
8d00a0f1 614extern CHAR16 *gEnterEscapeString;\r
7936fb6a 615extern CHAR16 *gEscapeString;\r
616extern CHAR16 *gSaveFailed;\r
617extern CHAR16 *gMoveHighlight;\r
618extern CHAR16 *gMakeSelection;\r
619extern CHAR16 *gDecNumericInput;\r
620extern CHAR16 *gHexNumericInput;\r
621extern CHAR16 *gToggleCheckBox;\r
622extern CHAR16 *gPromptForData;\r
623extern CHAR16 *gPromptForPassword;\r
624extern CHAR16 *gPromptForNewPassword;\r
625extern CHAR16 *gConfirmPassword;\r
626extern CHAR16 *gConfirmError;\r
627extern CHAR16 *gPassowordInvalid;\r
628extern CHAR16 *gPressEnter;\r
629extern CHAR16 *gEmptyString;\r
630extern CHAR16 *gAreYouSure;\r
631extern CHAR16 *gYesResponse;\r
632extern CHAR16 *gNoResponse;\r
633extern CHAR16 *gMiniString;\r
634extern CHAR16 *gPlusString;\r
635extern CHAR16 *gMinusString;\r
636extern CHAR16 *gAdjustNumber;\r
ebe43565 637extern CHAR16 *gSaveChanges;\r
8d00a0f1 638extern CHAR16 *gOptionMismatch;\r
0c66bc76 639extern CHAR16 *gFormSuppress;\r
7936fb6a 640\r
641extern CHAR16 gPromptBlockWidth;\r
642extern CHAR16 gOptionBlockWidth;\r
643extern CHAR16 gHelpBlockWidth;\r
644\r
645extern EFI_GUID gZeroGuid;\r
646extern EFI_GUID gTianoHiiIfrGuid;\r
647\r
eccfeab1 648#include "Ui.h"\r
7936fb6a 649//\r
650// Global Procedure Defines\r
651//\r
652\r
653/**\r
654 Initialize the HII String Token to the correct values.\r
655\r
656**/\r
657VOID\r
658InitializeBrowserStrings (\r
659 VOID\r
ed66e1bc 660 );\r
7936fb6a 661\r
662/**\r
663 Prints a unicode string to the default console,\r
664 using L"%s" format.\r
665\r
666 @param String String pointer.\r
667\r
668 @return Length of string printed to the console\r
669\r
670**/\r
671UINTN\r
672PrintString (\r
673 IN CHAR16 *String\r
ed66e1bc 674 );\r
7936fb6a 675\r
676/**\r
677 Prints a chracter to the default console,\r
678 using L"%c" format.\r
679\r
680 @param Character Character to print.\r
681\r
682 @return Length of string printed to the console.\r
683\r
684**/\r
685UINTN\r
686PrintChar (\r
687 CHAR16 Character\r
ed66e1bc 688 );\r
7936fb6a 689\r
690/**\r
691 Prints a formatted unicode string to the default console, at\r
692 the supplied cursor position.\r
693\r
694 @param Column The cursor position to print the string at.\r
695 @param Row The cursor position to print the string at\r
696 @param Fmt Format string\r
697 @param ... Variable argument list for formating string.\r
698\r
699 @return Length of string printed to the console\r
700\r
701**/\r
702UINTN\r
8091267c 703EFIAPI\r
7936fb6a 704PrintAt (\r
705 IN UINTN Column,\r
706 IN UINTN Row,\r
707 IN CHAR16 *Fmt,\r
708 ...\r
ed66e1bc 709 );\r
7936fb6a 710\r
711/**\r
712 Prints a unicode string to the default console, at\r
713 the supplied cursor position, using L"%s" format.\r
714\r
715 @param Column The cursor position to print the string at.\r
716 @param Row The cursor position to print the string at\r
717 @param String String pointer.\r
718\r
719 @return Length of string printed to the console\r
720\r
721**/\r
722UINTN\r
723PrintStringAt (\r
724 IN UINTN Column,\r
725 IN UINTN Row,\r
726 IN CHAR16 *String\r
ed66e1bc 727 );\r
7936fb6a 728\r
729/**\r
730 Prints a chracter to the default console, at\r
731 the supplied cursor position, using L"%c" format.\r
732\r
733 @param Column The cursor position to print the string at.\r
734 @param Row The cursor position to print the string at.\r
735 @param Character Character to print.\r
736\r
737 @return Length of string printed to the console.\r
738\r
739**/\r
740UINTN\r
741PrintCharAt (\r
742 IN UINTN Column,\r
743 IN UINTN Row,\r
744 CHAR16 Character\r
ed66e1bc 745 );\r
7936fb6a 746\r
747/**\r
748 Parse opcodes in the formset IFR binary.\r
749\r
750 @param FormSet Pointer of the FormSet data structure.\r
751\r
752 @retval EFI_SUCCESS Opcode parse success.\r
753 @retval Other Opcode parse fail.\r
754\r
755**/\r
756EFI_STATUS\r
757ParseOpCodes (\r
758 IN FORM_BROWSER_FORMSET *FormSet\r
ed66e1bc 759 );\r
7936fb6a 760\r
761/**\r
762 Free resources allocated for a FormSet.\r
763\r
764 @param FormSet Pointer of the FormSet\r
765\r
766**/\r
767VOID\r
768DestroyFormSet (\r
769 IN OUT FORM_BROWSER_FORMSET *FormSet\r
ed66e1bc 770 );\r
7936fb6a 771\r
772/**\r
773 This function displays the page frame.\r
774\r
b00964a9
ED
775 @param Selection Selection contains the information about \r
776 the Selection, form and formset to be displayed.\r
777 Selection action may be updated in retrieve callback.\r
7936fb6a 778**/\r
779VOID\r
780DisplayPageFrame (\r
b00964a9 781 IN UI_MENU_SELECTION *Selection\r
ed66e1bc 782 );\r
7936fb6a 783\r
784/**\r
785 Create a new string in HII Package List.\r
786\r
787 @param String The String to be added\r
788 @param HiiHandle The package list in the HII database to insert the\r
789 specified string.\r
790\r
791 @return The output string.\r
792\r
793**/\r
794EFI_STRING_ID\r
795NewString (\r
796 IN CHAR16 *String,\r
797 IN EFI_HII_HANDLE HiiHandle\r
ed66e1bc 798 );\r
7936fb6a 799\r
800/**\r
801 Delete a string from HII Package List.\r
802\r
803 @param StringId Id of the string in HII database.\r
804 @param HiiHandle The HII package list handle.\r
805\r
806 @retval EFI_SUCCESS The string was deleted successfully.\r
807\r
808**/\r
809EFI_STATUS\r
810DeleteString (\r
811 IN EFI_STRING_ID StringId,\r
812 IN EFI_HII_HANDLE HiiHandle\r
ed66e1bc 813 );\r
7936fb6a 814\r
815/**\r
816 Get the string based on the StringId and HII Package List Handle.\r
817\r
818 @param Token The String's ID.\r
819 @param HiiHandle The package list in the HII database to search for\r
820 the specified string.\r
821\r
822 @return The output string.\r
823\r
824**/\r
825CHAR16 *\r
826GetToken (\r
827 IN EFI_STRING_ID Token,\r
828 IN EFI_HII_HANDLE HiiHandle\r
ed66e1bc 829 );\r
7936fb6a 830\r
831/**\r
832 Draw a pop up windows based on the dimension, number of lines and\r
833 strings specified.\r
834\r
835 @param RequestedWidth The width of the pop-up.\r
836 @param NumberOfLines The number of lines.\r
f4bcc90f 837 @param Marker The variable argument list for the list of string to be printed.\r
7936fb6a 838\r
839**/\r
840VOID\r
841CreateSharedPopUp (\r
842 IN UINTN RequestedWidth,\r
843 IN UINTN NumberOfLines,\r
f4bcc90f 844 IN VA_LIST Marker\r
ed66e1bc 845 );\r
7936fb6a 846\r
847/**\r
848 Routine used to abstract a generic dialog interface and return the selected key or string\r
849\r
850 @param NumberOfLines The number of lines for the dialog box\r
851 @param HotKey Defines whether a single character is parsed\r
852 (TRUE) and returned in KeyValue or a string is\r
853 returned in StringBuffer. Two special characters\r
854 are considered when entering a string, a SCAN_ESC\r
855 and an CHAR_CARRIAGE_RETURN. SCAN_ESC terminates\r
856 string input and returns\r
857 @param MaximumStringSize The maximum size in bytes of a typed in string\r
858 (each character is a CHAR16) and the minimum\r
859 string returned is two bytes\r
860 @param StringBuffer The passed in pointer to the buffer which will\r
861 hold the typed in string if HotKey is FALSE\r
862 @param KeyValue The EFI_KEY value returned if HotKey is TRUE..\r
7936fb6a 863 @param ... A series of (quantity == NumberOfLines) text\r
864 strings which will be used to construct the dialog\r
865 box\r
866\r
867 @retval EFI_SUCCESS Displayed dialog and received user interaction\r
868 @retval EFI_INVALID_PARAMETER One of the parameters was invalid (e.g.\r
869 (StringBuffer == NULL) && (HotKey == FALSE))\r
870 @retval EFI_DEVICE_ERROR User typed in an ESC character to exit the routine\r
871\r
872**/\r
873EFI_STATUS\r
8091267c 874EFIAPI\r
7936fb6a 875CreateDialog (\r
876 IN UINTN NumberOfLines,\r
877 IN BOOLEAN HotKey,\r
878 IN UINTN MaximumStringSize,\r
879 OUT CHAR16 *StringBuffer,\r
880 OUT EFI_INPUT_KEY *KeyValue,\r
7936fb6a 881 ...\r
ed66e1bc 882 );\r
7936fb6a 883\r
2573712e
LG
884/**\r
885 Get Value for given Name from a NameValue Storage.\r
886\r
887 @param Storage The NameValue Storage.\r
888 @param Name The Name.\r
889 @param Value The retured Value.\r
890\r
891 @retval EFI_SUCCESS Value found for given Name.\r
892 @retval EFI_NOT_FOUND No such Name found in NameValue storage.\r
893\r
894**/\r
895EFI_STATUS\r
896GetValueByName (\r
897 IN FORMSET_STORAGE *Storage,\r
898 IN CHAR16 *Name,\r
899 IN OUT CHAR16 **Value\r
900 );\r
901\r
902/**\r
903 Set Value of given Name in a NameValue Storage.\r
904\r
905 @param Storage The NameValue Storage.\r
906 @param Name The Name.\r
907 @param Value The Value to set.\r
b18e7050 908 @param Edit Whether update editValue or Value.\r
2573712e
LG
909\r
910 @retval EFI_SUCCESS Value found for given Name.\r
911 @retval EFI_NOT_FOUND No such Name found in NameValue storage.\r
912\r
913**/\r
914EFI_STATUS\r
915SetValueByName (\r
916 IN FORMSET_STORAGE *Storage,\r
917 IN CHAR16 *Name,\r
b18e7050
ED
918 IN CHAR16 *Value,\r
919 IN BOOLEAN Edit\r
2573712e
LG
920 );\r
921\r
7936fb6a 922/**\r
923 Get Question's current Value.\r
924\r
925 @param FormSet FormSet data structure.\r
926 @param Form Form data structure.\r
927 @param Question Question to be initialized.\r
928 @param Cached TRUE: get from Edit copy FALSE: get from original\r
929 Storage\r
930\r
931 @retval EFI_SUCCESS The function completed successfully.\r
932\r
933**/\r
934EFI_STATUS\r
935GetQuestionValue (\r
936 IN FORM_BROWSER_FORMSET *FormSet,\r
937 IN FORM_BROWSER_FORM *Form,\r
938 IN OUT FORM_BROWSER_STATEMENT *Question,\r
939 IN BOOLEAN Cached\r
ed66e1bc 940 );\r
7936fb6a 941\r
942/**\r
943 Save Question Value to edit copy(cached) or Storage(uncached).\r
944\r
945 @param FormSet FormSet data structure.\r
946 @param Form Form data structure.\r
947 @param Question Pointer to the Question.\r
948 @param Cached TRUE: set to Edit copy FALSE: set to original\r
949 Storage\r
950\r
951 @retval EFI_SUCCESS The function completed successfully.\r
952\r
953**/\r
954EFI_STATUS\r
955SetQuestionValue (\r
956 IN FORM_BROWSER_FORMSET *FormSet,\r
957 IN FORM_BROWSER_FORM *Form,\r
958 IN OUT FORM_BROWSER_STATEMENT *Question,\r
959 IN BOOLEAN Cached\r
ed66e1bc 960 );\r
7936fb6a 961\r
962/**\r
963 Perform inconsistent check for a Form.\r
964\r
965 @param FormSet FormSet data structure.\r
966 @param Form Form data structure.\r
967 @param Question The Question to be validated.\r
968 @param Type Validation type: InConsistent or NoSubmit\r
969\r
970 @retval EFI_SUCCESS Form validation pass.\r
971 @retval other Form validation failed.\r
972\r
973**/\r
974EFI_STATUS\r
975ValidateQuestion (\r
976 IN FORM_BROWSER_FORMSET *FormSet,\r
977 IN FORM_BROWSER_FORM *Form,\r
978 IN FORM_BROWSER_STATEMENT *Question,\r
979 IN UINTN Type\r
ed66e1bc 980 );\r
7936fb6a 981\r
48a9d5f7 982\r
7936fb6a 983/**\r
48a9d5f7 984 Discard data based on the input setting scope (Form, FormSet or System).\r
7936fb6a 985\r
986 @param FormSet FormSet data structure.\r
987 @param Form Form data structure.\r
48a9d5f7 988 @param SettingScope Setting Scope for Discard action.\r
b18e7050
ED
989\r
990 @retval EFI_SUCCESS The function completed successfully.\r
48a9d5f7 991 @retval EFI_UNSUPPORTED Unsupport SettingScope.\r
b18e7050
ED
992\r
993**/\r
994EFI_STATUS\r
995DiscardForm (\r
996 IN FORM_BROWSER_FORMSET *FormSet,\r
997 IN FORM_BROWSER_FORM *Form,\r
48a9d5f7 998 IN BROWSER_SETTING_SCOPE SettingScope\r
b18e7050
ED
999 );\r
1000\r
1001/**\r
48a9d5f7 1002 Submit data based on the input Setting level (Form, FormSet or System).\r
b18e7050
ED
1003\r
1004 @param FormSet FormSet data structure.\r
1005 @param Form Form data structure.\r
48a9d5f7 1006 @param SettingScope Setting Scope for Submit action.\r
7936fb6a 1007\r
1008 @retval EFI_SUCCESS The function completed successfully.\r
48a9d5f7 1009 @retval EFI_UNSUPPORTED Unsupport SettingScope.\r
7936fb6a 1010\r
1011**/\r
1012EFI_STATUS\r
1013SubmitForm (\r
1014 IN FORM_BROWSER_FORMSET *FormSet,\r
b18e7050 1015 IN FORM_BROWSER_FORM *Form,\r
48a9d5f7 1016 IN BROWSER_SETTING_SCOPE SettingScope\r
ed66e1bc 1017 );\r
7936fb6a 1018\r
1019/**\r
1020 Reset Question to its default value.\r
1021\r
1022 @param FormSet The form set.\r
1023 @param Form The form.\r
1024 @param Question The question.\r
1025 @param DefaultId The Class of the default.\r
1026\r
1027 @retval EFI_SUCCESS Question is reset to default value.\r
1028\r
1029**/\r
1030EFI_STATUS\r
1031GetQuestionDefault (\r
1032 IN FORM_BROWSER_FORMSET *FormSet,\r
1033 IN FORM_BROWSER_FORM *Form,\r
1034 IN FORM_BROWSER_STATEMENT *Question,\r
1035 IN UINT16 DefaultId\r
ed66e1bc 1036 );\r
7936fb6a 1037\r
1038/**\r
1039 Get current setting of Questions.\r
1040\r
1041 @param FormSet FormSet data structure.\r
1042\r
1043 @retval EFI_SUCCESS The function completed successfully.\r
1044\r
1045**/\r
1046EFI_STATUS\r
1047InitializeCurrentSetting (\r
1048 IN OUT FORM_BROWSER_FORMSET *FormSet\r
ed66e1bc 1049 );\r
7936fb6a 1050\r
1051/**\r
1052 Initialize the internal data structure of a FormSet.\r
1053\r
1054 @param Handle PackageList Handle\r
1055 @param FormSetGuid GUID of a formset. If not specified (NULL or zero\r
1056 GUID), take the first FormSet found in package\r
1057 list.\r
1058 @param FormSet FormSet data structure.\r
db40504e 1059 @param UpdateGlobalVar Whether need to update the global variable.\r
7936fb6a 1060\r
1061 @retval EFI_SUCCESS The function completed successfully.\r
1062 @retval EFI_NOT_FOUND The specified FormSet could not be found.\r
1063\r
1064**/\r
1065EFI_STATUS\r
1066InitializeFormSet (\r
1067 IN EFI_HII_HANDLE Handle,\r
1068 IN OUT EFI_GUID *FormSetGuid,\r
db40504e
ED
1069 OUT FORM_BROWSER_FORMSET *FormSet,\r
1070 IN BOOLEAN UpdateGlobalVar \r
ed66e1bc 1071 );\r
7936fb6a 1072\r
1073/**\r
48a9d5f7 1074 Reset Questions to their default value in a Form, Formset or System.\r
7936fb6a 1075\r
09cdd7d2
ED
1076 GetDefaultValueScope parameter decides which questions will reset \r
1077 to its default value.\r
1078\r
7936fb6a 1079 @param FormSet FormSet data structure.\r
48a9d5f7 1080 @param Form Form data structure.\r
7936fb6a 1081 @param DefaultId The Class of the default.\r
48a9d5f7 1082 @param SettingScope Setting Scope for Default action.\r
09cdd7d2 1083 @param GetDefaultValueScope Get default value scope.\r
3347d410 1084 @param Storage Get default value only for this storage.\r
7936fb6a 1085\r
1086 @retval EFI_SUCCESS The function completed successfully.\r
48a9d5f7 1087 @retval EFI_UNSUPPORTED Unsupport SettingScope.\r
7936fb6a 1088\r
1089**/\r
1090EFI_STATUS\r
48a9d5f7 1091ExtractDefault (\r
7936fb6a 1092 IN FORM_BROWSER_FORMSET *FormSet,\r
48a9d5f7
LG
1093 IN FORM_BROWSER_FORM *Form,\r
1094 IN UINT16 DefaultId,\r
3347d410 1095 IN BROWSER_SETTING_SCOPE SettingScope,\r
09cdd7d2 1096 IN BROWSER_GET_DEFAULT_VALUE GetDefaultValueScope,\r
3347d410 1097 IN FORMSET_STORAGE *Storage OPTIONAL\r
ed66e1bc 1098 );\r
7936fb6a 1099\r
1100/**\r
1101 Initialize Question's Edit copy from Storage.\r
1102\r
eccfeab1
LG
1103 @param Selection Selection contains the information about \r
1104 the Selection, form and formset to be displayed.\r
1105 Selection action may be updated in retrieve callback.\r
7d1b202d 1106 If Selection is NULL, only initialize Question value.\r
7936fb6a 1107 @param FormSet FormSet data structure.\r
1108 @param Form Form data structure.\r
1109\r
1110 @retval EFI_SUCCESS The function completed successfully.\r
1111\r
1112**/\r
1113EFI_STATUS\r
1114LoadFormConfig (\r
eccfeab1
LG
1115 IN OUT UI_MENU_SELECTION *Selection,\r
1116 IN FORM_BROWSER_FORMSET *FormSet,\r
1117 IN FORM_BROWSER_FORM *Form\r
ed66e1bc 1118 );\r
7936fb6a 1119\r
d66e6c16 1120/**\r
1121 Initialize Question's Edit copy from Storage for the whole Formset.\r
1122\r
eccfeab1
LG
1123 @param Selection Selection contains the information about \r
1124 the Selection, form and formset to be displayed.\r
1125 Selection action may be updated in retrieve callback.\r
7d1b202d 1126 If Selection is NULL, only initialize Question value.\r
d66e6c16 1127 @param FormSet FormSet data structure.\r
1128\r
1129 @retval EFI_SUCCESS The function completed successfully.\r
1130\r
1131**/\r
1132EFI_STATUS\r
1133LoadFormSetConfig (\r
eccfeab1
LG
1134 IN OUT UI_MENU_SELECTION *Selection,\r
1135 IN FORM_BROWSER_FORMSET *FormSet\r
d66e6c16 1136 );\r
1137\r
7936fb6a 1138/**\r
1139 Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.\r
1140\r
b18e7050 1141 @param Buffer The Storage to be conveted.\r
7936fb6a 1142 @param ConfigResp The returned <ConfigResp>.\r
b18e7050 1143 @param SingleForm Whether update data for single form or formset level.\r
7936fb6a 1144\r
1145 @retval EFI_SUCCESS Convert success.\r
1146 @retval EFI_INVALID_PARAMETER Incorrect storage type.\r
1147\r
1148**/\r
1149EFI_STATUS\r
1150StorageToConfigResp (\r
b18e7050
ED
1151 IN VOID *Buffer,\r
1152 IN CHAR16 **ConfigResp,\r
1153 IN BOOLEAN SingleForm\r
ed66e1bc 1154 );\r
7936fb6a 1155\r
1156/**\r
1157 Convert <ConfigResp> to settings in Buffer Storage or NameValue Storage.\r
1158\r
1159 @param Storage The Storage to receive the settings.\r
1160 @param ConfigResp The <ConfigResp> to be converted.\r
1161\r
1162 @retval EFI_SUCCESS Convert success.\r
1163 @retval EFI_INVALID_PARAMETER Incorrect storage type.\r
1164\r
1165**/\r
1166EFI_STATUS\r
1167ConfigRespToStorage (\r
1168 IN FORMSET_STORAGE *Storage,\r
1169 IN CHAR16 *ConfigResp\r
ed66e1bc 1170 );\r
7936fb6a 1171\r
1172/**\r
1173 Fill storage's edit copy with settings requested from Configuration Driver.\r
1174\r
1175 @param FormSet FormSet data structure.\r
1176 @param Storage Buffer Storage.\r
1177\r
1178 @retval EFI_SUCCESS The function completed successfully.\r
1179\r
1180**/\r
1181EFI_STATUS\r
1182LoadStorage (\r
1183 IN FORM_BROWSER_FORMSET *FormSet,\r
1184 IN FORMSET_STORAGE *Storage\r
ed66e1bc 1185 );\r
7936fb6a 1186\r
1187/**\r
1188 Fetch the Ifr binary data of a FormSet.\r
1189\r
1190 @param Handle PackageList Handle\r
1191 @param FormSetGuid GUID of a formset. If not specified (NULL or zero\r
1192 GUID), take the first FormSet found in package\r
1193 list.\r
1194 @param BinaryLength The length of the FormSet IFR binary.\r
1195 @param BinaryData The buffer designed to receive the FormSet.\r
1196\r
1197 @retval EFI_SUCCESS Buffer filled with the requested FormSet.\r
1198 BufferLength was updated.\r
1199 @retval EFI_INVALID_PARAMETER The handle is unknown.\r
1200 @retval EFI_NOT_FOUND A form or FormSet on the requested handle cannot\r
1201 be found with the requested FormId.\r
1202\r
1203**/\r
1204EFI_STATUS\r
1205GetIfrBinaryData (\r
1206 IN EFI_HII_HANDLE Handle,\r
1207 IN OUT EFI_GUID *FormSetGuid,\r
1208 OUT UINTN *BinaryLength,\r
1209 OUT UINT8 **BinaryData\r
ed66e1bc 1210 );\r
7936fb6a 1211\r
ce6d12cc 1212/**\r
1213 Save globals used by previous call to SendForm(). SendForm() may be called from \r
1214 HiiConfigAccess.Callback(), this will cause SendForm() be reentried.\r
1215 So, save globals of previous call to SendForm() and restore them upon exit.\r
1216\r
1217**/\r
1218VOID\r
1219SaveBrowserContext (\r
1220 VOID\r
1221 );\r
1222\r
1223/**\r
1224 Restore globals used by previous call to SendForm().\r
1225\r
1226**/\r
1227VOID\r
1228RestoreBrowserContext (\r
1229 VOID\r
1230 );\r
1231\r
7936fb6a 1232/**\r
1233 This is the routine which an external caller uses to direct the browser\r
1234 where to obtain it's information.\r
1235\r
1236\r
1237 @param This The Form Browser protocol instanse.\r
1238 @param Handles A pointer to an array of Handles. If HandleCount > 1 we\r
1239 display a list of the formsets for the handles specified.\r
1240 @param HandleCount The number of Handles specified in Handle.\r
1241 @param FormSetGuid This field points to the EFI_GUID which must match the Guid\r
1242 field in the EFI_IFR_FORM_SET op-code for the specified\r
1243 forms-based package. If FormSetGuid is NULL, then this\r
1244 function will display the first found forms package.\r
1245 @param FormId This field specifies which EFI_IFR_FORM to render as the first\r
1246 displayable page. If this field has a value of 0x0000, then\r
1247 the forms browser will render the specified forms in their encoded order.\r
1248 ScreenDimenions - This allows the browser to be called so that it occupies a\r
1249 portion of the physical screen instead of dynamically determining the screen dimensions.\r
1250 ActionRequest - Points to the action recommended by the form.\r
d66e6c16 1251 @param ScreenDimensions Points to recommended form dimensions, including any non-content area, in\r
7936fb6a 1252 characters.\r
1253 @param ActionRequest Points to the action recommended by the form.\r
1254\r
1255 @retval EFI_SUCCESS The function completed successfully.\r
1256 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
1257 @retval EFI_NOT_FOUND No valid forms could be found to display.\r
1258\r
1259**/\r
1260EFI_STATUS\r
1261EFIAPI\r
1262SendForm (\r
1263 IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,\r
1264 IN EFI_HII_HANDLE *Handles,\r
1265 IN UINTN HandleCount,\r
1266 IN EFI_GUID *FormSetGuid, OPTIONAL\r
1267 IN UINT16 FormId, OPTIONAL\r
1268 IN CONST EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL\r
1269 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest OPTIONAL\r
ed66e1bc 1270 );\r
7936fb6a 1271\r
1272/**\r
1273 This function is called by a callback handler to retrieve uncommitted state\r
1274 data from the browser.\r
1275\r
1276 @param This A pointer to the EFI_FORM_BROWSER2_PROTOCOL\r
1277 instance.\r
1278 @param ResultsDataSize A pointer to the size of the buffer associated\r
1279 with ResultsData.\r
1280 @param ResultsData A string returned from an IFR browser or\r
1281 equivalent. The results string will have no\r
1282 routing information in them.\r
1283 @param RetrieveData A BOOLEAN field which allows an agent to retrieve\r
1284 (if RetrieveData = TRUE) data from the uncommitted\r
1285 browser state information or set (if RetrieveData\r
1286 = FALSE) data in the uncommitted browser state\r
1287 information.\r
1288 @param VariableGuid An optional field to indicate the target variable\r
1289 GUID name to use.\r
1290 @param VariableName An optional field to indicate the target\r
1291 human-readable variable name.\r
1292\r
1293 @retval EFI_SUCCESS The results have been distributed or are awaiting\r
1294 distribution.\r
1295 @retval EFI_BUFFER_TOO_SMALL The ResultsDataSize specified was too small to\r
1296 contain the results data.\r
1297\r
1298**/\r
1299EFI_STATUS\r
1300EFIAPI\r
1301BrowserCallback (\r
1302 IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,\r
1303 IN OUT UINTN *ResultsDataSize,\r
1304 IN OUT EFI_STRING ResultsData,\r
1305 IN BOOLEAN RetrieveData,\r
1306 IN CONST EFI_GUID *VariableGuid, OPTIONAL\r
1307 IN CONST CHAR16 *VariableName OPTIONAL\r
ed66e1bc 1308 );\r
7936fb6a 1309\r
b18e7050
ED
1310/**\r
1311 Find menu which will show next time.\r
1312\r
1313 @param Selection On input, Selection tell setup browser the information\r
1314 about the Selection, form and formset to be displayed.\r
1315 On output, Selection return the screen item that is selected\r
1316 by user.\r
1317 @param Repaint Whether need to repaint the menu.\r
1318 @param NewLine Whether need to show at new line.\r
1319 \r
1320 @retval TRUE Need return.\r
1321 @retval FALSE No need to return.\r
1322**/\r
1323BOOLEAN\r
1324FindNextMenu (\r
1325 IN OUT UI_MENU_SELECTION *Selection,\r
1326 IN BOOLEAN *Repaint, \r
1327 IN BOOLEAN *NewLine \r
1328 );\r
1329\r
1330/**\r
1331 check whether the formset need to update the NV.\r
1332\r
1333 @param FormSet FormSet data structure.\r
1334 @param SetValue Whether set new value or clear old value.\r
1335\r
1336**/\r
1337VOID\r
1338UpdateNvInfoInForm (\r
1339 IN FORM_BROWSER_FORMSET *FormSet,\r
1340 IN BOOLEAN SetValue\r
1341 );\r
1342\r
1343/**\r
1344 check whether the formset need to update the NV.\r
1345\r
1346 @param FormSet FormSet data structure.\r
1347\r
1348 @retval TRUE Need to update the NV.\r
1349 @retval FALSE No need to update the NV.\r
1350**/\r
1351BOOLEAN \r
1352IsNvUpdateRequired (\r
1353 IN FORM_BROWSER_FORMSET *FormSet\r
1354 );\r
1355\r
1356/**\r
1357 Call the call back function for the question and process the return action.\r
1358\r
1359 @param Selection On input, Selection tell setup browser the information\r
1360 about the Selection, form and formset to be displayed.\r
1361 On output, Selection return the screen item that is selected\r
1362 by user.\r
1363 @param Statement The Question which need to call.\r
1364 @param Action The action request.\r
1365 @param SkipSaveOrDiscard Whether skip save or discard action.\r
1366\r
1367 @retval EFI_SUCCESS The call back function excutes successfully.\r
1368 @return Other value if the call back function failed to excute. \r
1369**/\r
1370EFI_STATUS \r
1371ProcessCallBackFunction (\r
1372 IN OUT UI_MENU_SELECTION *Selection,\r
1373 IN FORM_BROWSER_STATEMENT *Question,\r
1374 IN EFI_BROWSER_ACTION Action,\r
1375 IN BOOLEAN SkipSaveOrDiscard\r
1376 );\r
48a9d5f7
LG
1377\r
1378/**\r
1379 Find the matched FormSet context in the backup maintain list based on HiiHandle.\r
1380 \r
1381 @param Handle The Hii Handle.\r
1382 \r
1383 @return the found FormSet context. If no found, NULL will return.\r
1384\r
1385**/\r
1386FORM_BROWSER_FORMSET * \r
1387GetFormSetFromHiiHandle (\r
1388 EFI_HII_HANDLE Handle\r
1389 );\r
1390\r
1391/**\r
1392 Check whether the input HII handle is the FormSet that is being used.\r
1393 \r
1394 @param Handle The Hii Handle.\r
1395 \r
1396 @retval TRUE HII handle is being used.\r
1397 @retval FALSE HII handle is not being used.\r
1398\r
1399**/\r
1400BOOLEAN\r
1401IsHiiHandleInBrowserContext (\r
1402 EFI_HII_HANDLE Handle\r
1403 );\r
1404\r
1405/**\r
1406 Configure what scope the hot key will impact.\r
1407 All hot keys have the same scope. The mixed hot keys with the different level are not supported.\r
1408 If no scope is set, the default scope will be FormSet level.\r
1409 After all registered hot keys are removed, previous Scope can reset to another level.\r
1410 \r
1411 @param[in] Scope Scope level to be set. \r
1412 \r
1413 @retval EFI_SUCCESS Scope is set correctly.\r
1414 @retval EFI_INVALID_PARAMETER Scope is not the valid value specified in BROWSER_SETTING_SCOPE. \r
1415 @retval EFI_UNSPPORTED Scope level is different from current one that the registered hot keys have.\r
1416\r
1417**/\r
1418EFI_STATUS\r
1419EFIAPI\r
1420SetScope (\r
1421 IN BROWSER_SETTING_SCOPE Scope\r
1422 );\r
1423\r
1424/**\r
1425 Register the hot key with its browser action, or unregistered the hot key.\r
1426 Only support hot key that is not printable character (control key, function key, etc.).\r
1427 If the action value is zero, the hot key will be unregistered if it has been registered.\r
1428 If the same hot key has been registered, the new action and help string will override the previous ones.\r
1429 \r
1430 @param[in] KeyData A pointer to a buffer that describes the keystroke\r
1431 information for the hot key. Its type is EFI_INPUT_KEY to \r
1432 be supported by all ConsoleIn devices.\r
1433 @param[in] Action Action value that describes what action will be trigged when the hot key is pressed. \r
1434 @param[in] DefaultId Specifies the type of defaults to retrieve, which is only for DEFAULT action.\r
1435 @param[in] HelpString Help string that describes the hot key information.\r
1436 Its value may be NULL for the unregistered hot key.\r
1437 \r
1438 @retval EFI_SUCCESS Hot key is registered or unregistered.\r
1439 @retval EFI_INVALID_PARAMETER KeyData is NULL.\r
1440 @retval EFI_NOT_FOUND KeyData is not found to be unregistered.\r
1441 @retval EFI_UNSUPPORTED Key represents a printable character. It is conflicted with Browser.\r
1442**/\r
1443EFI_STATUS\r
1444EFIAPI\r
1445RegisterHotKey (\r
1446 IN EFI_INPUT_KEY *KeyData,\r
1447 IN UINT32 Action,\r
1448 IN UINT16 DefaultId,\r
1449 IN EFI_STRING HelpString OPTIONAL\r
1450 );\r
1451\r
1452/**\r
1453 Register Exit handler function. \r
1454 When more than one handler function is registered, the latter one will override the previous one. \r
1455 When NULL handler is specified, the previous Exit handler will be unregistered. \r
1456 \r
1457 @param[in] Handler Pointer to handler function. \r
1458\r
1459**/\r
1460VOID\r
1461EFIAPI\r
1462RegiserExitHandler (\r
1463 IN EXIT_HANDLER Handler\r
1464 );\r
1465\r
1466/**\r
1467 Create reminder to let user to choose save or discard the changed browser data.\r
1468 Caller can use it to actively check the changed browser data.\r
1469\r
1470 @retval BROWSER_NO_CHANGES No browser data is changed.\r
1471 @retval BROWSER_SAVE_CHANGES The changed browser data is saved.\r
1472 @retval BROWSER_DISCARD_CHANGES The changed browser data is discard.\r
1473\r
1474**/\r
1475UINT32\r
1476EFIAPI\r
1477SaveReminder (\r
1478 VOID\r
1479 );\r
1480\r
1481/**\r
1482 Find the registered HotKey based on KeyData.\r
1483 \r
1484 @param[in] KeyData A pointer to a buffer that describes the keystroke\r
1485 information for the hot key.\r
1486\r
1487 @return The registered HotKey context. If no found, NULL will return.\r
1488**/\r
1489BROWSER_HOT_KEY *\r
1490GetHotKeyFromRegisterList (\r
1491 IN EFI_INPUT_KEY *KeyData\r
1492 );\r
1493\r
7936fb6a 1494#endif\r