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