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