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