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