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