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