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