]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
Add new call back return value; also add some 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
b18e7050
ED
429 BOOLEAN NvUpdateRequired; // Whether this form has NV update request.\r
430\r
7936fb6a 431 LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)\r
432 LIST_ENTRY StatementListHead; // List of Statements and Questions (FORM_BROWSER_STATEMENT)\r
b18e7050 433 LIST_ENTRY ConfigRequestHead; // List of configreques for all storage.\r
0c66bc76 434 FORM_EXPRESSION *SuppressExpression; // nesting inside of SuppressIf\r
7936fb6a 435} FORM_BROWSER_FORM;\r
436\r
437#define FORM_BROWSER_FORM_FROM_LINK(a) CR (a, FORM_BROWSER_FORM, Link, FORM_BROWSER_FORM_SIGNATURE)\r
438\r
f3f2e05d 439#define FORMSET_DEFAULTSTORE_SIGNATURE SIGNATURE_32 ('F', 'D', 'F', 'S')\r
7936fb6a 440\r
441typedef struct {\r
442 UINTN Signature;\r
443 LIST_ENTRY Link;\r
444\r
445 UINT16 DefaultId;\r
446 EFI_STRING_ID DefaultName;\r
447} FORMSET_DEFAULTSTORE;\r
448\r
449#define FORMSET_DEFAULTSTORE_FROM_LINK(a) CR (a, FORMSET_DEFAULTSTORE, Link, FORMSET_DEFAULTSTORE_SIGNATURE)\r
450\r
451typedef struct {\r
452 EFI_HII_HANDLE HiiHandle;\r
453 EFI_HANDLE DriverHandle;\r
454 EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;\r
455 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
456\r
457 UINTN IfrBinaryLength;\r
458 UINT8 *IfrBinaryData;\r
459\r
460 EFI_GUID Guid;\r
461 EFI_STRING_ID FormSetTitle;\r
462 EFI_STRING_ID Help;\r
0a1147ed
LG
463 UINT8 NumberOfClassGuid;\r
464 EFI_GUID ClassGuid[3]; // Up to three ClassGuid\r
465 UINT16 Class; // Tiano extended Class code\r
466 UINT16 SubClass; // Tiano extended Subclass code\r
7936fb6a 467 EFI_IMAGE_ID ImageId;\r
468\r
469 FORM_BROWSER_STATEMENT *StatementBuffer; // Buffer for all Statements and Questions\r
470 EXPRESSION_OPCODE *ExpressionBuffer; // Buffer for all Expression OpCode\r
471\r
472 LIST_ENTRY StorageListHead; // Storage list (FORMSET_STORAGE)\r
473 LIST_ENTRY DefaultStoreListHead; // DefaultStore list (FORMSET_DEFAULTSTORE)\r
474 LIST_ENTRY FormListHead; // Form list (FORM_BROWSER_FORM)\r
0c66bc76 475 LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)\r
7936fb6a 476} FORM_BROWSER_FORMSET;\r
477\r
ce6d12cc 478#define BROWSER_CONTEXT_SIGNATURE SIGNATURE_32 ('B', 'C', 'T', 'X')\r
479\r
480typedef struct {\r
481 UINTN Signature;\r
482 LIST_ENTRY Link;\r
483\r
484 //\r
485 // Globals defined in Setup.c\r
486 //\r
487 BANNER_DATA *BannerData;\r
488 UINTN ClassOfVfr;\r
489 UINTN FunctionKeySetting;\r
490 BOOLEAN ResetRequired;\r
ce6d12cc 491 UINT16 Direction;\r
492 EFI_SCREEN_DESCRIPTOR ScreenDimensions;\r
493 CHAR16 *FunctionNineString;\r
494 CHAR16 *FunctionTenString;\r
495 CHAR16 *EnterString;\r
496 CHAR16 *EnterCommitString;\r
497 CHAR16 *EnterEscapeString;\r
498 CHAR16 *EscapeString;\r
499 CHAR16 *SaveFailed;\r
500 CHAR16 *MoveHighlight;\r
501 CHAR16 *MakeSelection;\r
502 CHAR16 *DecNumericInput;\r
503 CHAR16 *HexNumericInput;\r
504 CHAR16 *ToggleCheckBox;\r
505 CHAR16 *PromptForData;\r
506 CHAR16 *PromptForPassword;\r
507 CHAR16 *PromptForNewPassword;\r
508 CHAR16 *ConfirmPassword;\r
509 CHAR16 *ConfirmError;\r
510 CHAR16 *PassowordInvalid;\r
511 CHAR16 *PressEnter;\r
512 CHAR16 *EmptyString;\r
513 CHAR16 *AreYouSure;\r
514 CHAR16 *YesResponse;\r
515 CHAR16 *NoResponse;\r
516 CHAR16 *MiniString;\r
517 CHAR16 *PlusString;\r
518 CHAR16 *MinusString;\r
519 CHAR16 *AdjustNumber;\r
520 CHAR16 *SaveChanges;\r
521 CHAR16 *OptionMismatch;\r
2bb526f3 522 CHAR16 *FormSuppress;\r
ce6d12cc 523 CHAR16 PromptBlockWidth;\r
524 CHAR16 OptionBlockWidth;\r
525 CHAR16 HelpBlockWidth;\r
526 FORM_BROWSER_FORMSET *OldFormSet;\r
527\r
528 //\r
529 // Globals defined in Ui.c\r
530 //\r
531 LIST_ENTRY MenuOption;\r
532 VOID *MenuRefreshHead;\r
533} BROWSER_CONTEXT;\r
534\r
535#define BROWSER_CONTEXT_FROM_LINK(a) CR (a, BROWSER_CONTEXT, Link, BROWSER_CONTEXT_SIGNATURE)\r
7936fb6a 536\r
537extern EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;\r
538extern EFI_HII_STRING_PROTOCOL *mHiiString;\r
539extern EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;\r
540\r
0a1147ed
LG
541extern BANNER_DATA *gBannerData;\r
542extern EFI_HII_HANDLE gFrontPageHandle;\r
7936fb6a 543extern UINTN gClassOfVfr;\r
544extern UINTN gFunctionKeySetting;\r
545extern BOOLEAN gResetRequired;\r
7936fb6a 546extern EFI_HII_HANDLE gHiiHandle;\r
7936fb6a 547extern UINT16 gDirection;\r
548extern EFI_SCREEN_DESCRIPTOR gScreenDimensions;\r
7936fb6a 549\r
d66e6c16 550extern FORM_BROWSER_FORMSET *gOldFormSet;\r
551\r
7936fb6a 552//\r
553// Browser Global Strings\r
554//\r
7936fb6a 555extern CHAR16 *gFunctionNineString;\r
556extern CHAR16 *gFunctionTenString;\r
557extern CHAR16 *gEnterString;\r
558extern CHAR16 *gEnterCommitString;\r
8d00a0f1 559extern CHAR16 *gEnterEscapeString;\r
7936fb6a 560extern CHAR16 *gEscapeString;\r
561extern CHAR16 *gSaveFailed;\r
562extern CHAR16 *gMoveHighlight;\r
563extern CHAR16 *gMakeSelection;\r
564extern CHAR16 *gDecNumericInput;\r
565extern CHAR16 *gHexNumericInput;\r
566extern CHAR16 *gToggleCheckBox;\r
567extern CHAR16 *gPromptForData;\r
568extern CHAR16 *gPromptForPassword;\r
569extern CHAR16 *gPromptForNewPassword;\r
570extern CHAR16 *gConfirmPassword;\r
571extern CHAR16 *gConfirmError;\r
572extern CHAR16 *gPassowordInvalid;\r
573extern CHAR16 *gPressEnter;\r
574extern CHAR16 *gEmptyString;\r
575extern CHAR16 *gAreYouSure;\r
576extern CHAR16 *gYesResponse;\r
577extern CHAR16 *gNoResponse;\r
578extern CHAR16 *gMiniString;\r
579extern CHAR16 *gPlusString;\r
580extern CHAR16 *gMinusString;\r
581extern CHAR16 *gAdjustNumber;\r
ebe43565 582extern CHAR16 *gSaveChanges;\r
8d00a0f1 583extern CHAR16 *gOptionMismatch;\r
0c66bc76 584extern CHAR16 *gFormSuppress;\r
7936fb6a 585\r
586extern CHAR16 gPromptBlockWidth;\r
587extern CHAR16 gOptionBlockWidth;\r
588extern CHAR16 gHelpBlockWidth;\r
589\r
590extern EFI_GUID gZeroGuid;\r
591extern EFI_GUID gTianoHiiIfrGuid;\r
592\r
eccfeab1 593#include "Ui.h"\r
7936fb6a 594//\r
595// Global Procedure Defines\r
596//\r
597\r
598/**\r
599 Initialize the HII String Token to the correct values.\r
600\r
601**/\r
602VOID\r
603InitializeBrowserStrings (\r
604 VOID\r
ed66e1bc 605 );\r
7936fb6a 606\r
607/**\r
608 Prints a unicode string to the default console,\r
609 using L"%s" format.\r
610\r
611 @param String String pointer.\r
612\r
613 @return Length of string printed to the console\r
614\r
615**/\r
616UINTN\r
617PrintString (\r
618 IN CHAR16 *String\r
ed66e1bc 619 );\r
7936fb6a 620\r
621/**\r
622 Prints a chracter to the default console,\r
623 using L"%c" format.\r
624\r
625 @param Character Character to print.\r
626\r
627 @return Length of string printed to the console.\r
628\r
629**/\r
630UINTN\r
631PrintChar (\r
632 CHAR16 Character\r
ed66e1bc 633 );\r
7936fb6a 634\r
635/**\r
636 Prints a formatted unicode string to the default console, at\r
637 the supplied cursor position.\r
638\r
639 @param Column The cursor position to print the string at.\r
640 @param Row The cursor position to print the string at\r
641 @param Fmt Format string\r
642 @param ... Variable argument list for formating string.\r
643\r
644 @return Length of string printed to the console\r
645\r
646**/\r
647UINTN\r
8091267c 648EFIAPI\r
7936fb6a 649PrintAt (\r
650 IN UINTN Column,\r
651 IN UINTN Row,\r
652 IN CHAR16 *Fmt,\r
653 ...\r
ed66e1bc 654 );\r
7936fb6a 655\r
656/**\r
657 Prints a unicode string to the default console, at\r
658 the supplied cursor position, using L"%s" format.\r
659\r
660 @param Column The cursor position to print the string at.\r
661 @param Row The cursor position to print the string at\r
662 @param String String pointer.\r
663\r
664 @return Length of string printed to the console\r
665\r
666**/\r
667UINTN\r
668PrintStringAt (\r
669 IN UINTN Column,\r
670 IN UINTN Row,\r
671 IN CHAR16 *String\r
ed66e1bc 672 );\r
7936fb6a 673\r
674/**\r
675 Prints a chracter to the default console, at\r
676 the supplied cursor position, using L"%c" format.\r
677\r
678 @param Column The cursor position to print the string at.\r
679 @param Row The cursor position to print the string at.\r
680 @param Character Character to print.\r
681\r
682 @return Length of string printed to the console.\r
683\r
684**/\r
685UINTN\r
686PrintCharAt (\r
687 IN UINTN Column,\r
688 IN UINTN Row,\r
689 CHAR16 Character\r
ed66e1bc 690 );\r
7936fb6a 691\r
692/**\r
693 Parse opcodes in the formset IFR binary.\r
694\r
695 @param FormSet Pointer of the FormSet data structure.\r
696\r
697 @retval EFI_SUCCESS Opcode parse success.\r
698 @retval Other Opcode parse fail.\r
699\r
700**/\r
701EFI_STATUS\r
702ParseOpCodes (\r
703 IN FORM_BROWSER_FORMSET *FormSet\r
ed66e1bc 704 );\r
7936fb6a 705\r
706/**\r
707 Free resources allocated for a FormSet.\r
708\r
709 @param FormSet Pointer of the FormSet\r
710\r
711**/\r
712VOID\r
713DestroyFormSet (\r
714 IN OUT FORM_BROWSER_FORMSET *FormSet\r
ed66e1bc 715 );\r
7936fb6a 716\r
717/**\r
718 This function displays the page frame.\r
719\r
720**/\r
721VOID\r
722DisplayPageFrame (\r
723 VOID\r
ed66e1bc 724 );\r
7936fb6a 725\r
726/**\r
727 Create a new string in HII Package List.\r
728\r
729 @param String The String to be added\r
730 @param HiiHandle The package list in the HII database to insert the\r
731 specified string.\r
732\r
733 @return The output string.\r
734\r
735**/\r
736EFI_STRING_ID\r
737NewString (\r
738 IN CHAR16 *String,\r
739 IN EFI_HII_HANDLE HiiHandle\r
ed66e1bc 740 );\r
7936fb6a 741\r
742/**\r
743 Delete a string from HII Package List.\r
744\r
745 @param StringId Id of the string in HII database.\r
746 @param HiiHandle The HII package list handle.\r
747\r
748 @retval EFI_SUCCESS The string was deleted successfully.\r
749\r
750**/\r
751EFI_STATUS\r
752DeleteString (\r
753 IN EFI_STRING_ID StringId,\r
754 IN EFI_HII_HANDLE HiiHandle\r
ed66e1bc 755 );\r
7936fb6a 756\r
757/**\r
758 Get the string based on the StringId and HII Package List Handle.\r
759\r
760 @param Token The String's ID.\r
761 @param HiiHandle The package list in the HII database to search for\r
762 the specified string.\r
763\r
764 @return The output string.\r
765\r
766**/\r
767CHAR16 *\r
768GetToken (\r
769 IN EFI_STRING_ID Token,\r
770 IN EFI_HII_HANDLE HiiHandle\r
ed66e1bc 771 );\r
7936fb6a 772\r
773/**\r
774 Draw a pop up windows based on the dimension, number of lines and\r
775 strings specified.\r
776\r
777 @param RequestedWidth The width of the pop-up.\r
778 @param NumberOfLines The number of lines.\r
f4bcc90f 779 @param Marker The variable argument list for the list of string to be printed.\r
7936fb6a 780\r
781**/\r
782VOID\r
783CreateSharedPopUp (\r
784 IN UINTN RequestedWidth,\r
785 IN UINTN NumberOfLines,\r
f4bcc90f 786 IN VA_LIST Marker\r
ed66e1bc 787 );\r
7936fb6a 788\r
789/**\r
790 Routine used to abstract a generic dialog interface and return the selected key or string\r
791\r
792 @param NumberOfLines The number of lines for the dialog box\r
793 @param HotKey Defines whether a single character is parsed\r
794 (TRUE) and returned in KeyValue or a string is\r
795 returned in StringBuffer. Two special characters\r
796 are considered when entering a string, a SCAN_ESC\r
797 and an CHAR_CARRIAGE_RETURN. SCAN_ESC terminates\r
798 string input and returns\r
799 @param MaximumStringSize The maximum size in bytes of a typed in string\r
800 (each character is a CHAR16) and the minimum\r
801 string returned is two bytes\r
802 @param StringBuffer The passed in pointer to the buffer which will\r
803 hold the typed in string if HotKey is FALSE\r
804 @param KeyValue The EFI_KEY value returned if HotKey is TRUE..\r
7936fb6a 805 @param ... A series of (quantity == NumberOfLines) text\r
806 strings which will be used to construct the dialog\r
807 box\r
808\r
809 @retval EFI_SUCCESS Displayed dialog and received user interaction\r
810 @retval EFI_INVALID_PARAMETER One of the parameters was invalid (e.g.\r
811 (StringBuffer == NULL) && (HotKey == FALSE))\r
812 @retval EFI_DEVICE_ERROR User typed in an ESC character to exit the routine\r
813\r
814**/\r
815EFI_STATUS\r
8091267c 816EFIAPI\r
7936fb6a 817CreateDialog (\r
818 IN UINTN NumberOfLines,\r
819 IN BOOLEAN HotKey,\r
820 IN UINTN MaximumStringSize,\r
821 OUT CHAR16 *StringBuffer,\r
822 OUT EFI_INPUT_KEY *KeyValue,\r
7936fb6a 823 ...\r
ed66e1bc 824 );\r
7936fb6a 825\r
2573712e
LG
826/**\r
827 Get Value for given Name from a NameValue Storage.\r
828\r
829 @param Storage The NameValue Storage.\r
830 @param Name The Name.\r
831 @param Value The retured Value.\r
832\r
833 @retval EFI_SUCCESS Value found for given Name.\r
834 @retval EFI_NOT_FOUND No such Name found in NameValue storage.\r
835\r
836**/\r
837EFI_STATUS\r
838GetValueByName (\r
839 IN FORMSET_STORAGE *Storage,\r
840 IN CHAR16 *Name,\r
841 IN OUT CHAR16 **Value\r
842 );\r
843\r
844/**\r
845 Set Value of given Name in a NameValue Storage.\r
846\r
847 @param Storage The NameValue Storage.\r
848 @param Name The Name.\r
849 @param Value The Value to set.\r
b18e7050 850 @param Edit Whether update editValue or Value.\r
2573712e
LG
851\r
852 @retval EFI_SUCCESS Value found for given Name.\r
853 @retval EFI_NOT_FOUND No such Name found in NameValue storage.\r
854\r
855**/\r
856EFI_STATUS\r
857SetValueByName (\r
858 IN FORMSET_STORAGE *Storage,\r
859 IN CHAR16 *Name,\r
b18e7050
ED
860 IN CHAR16 *Value,\r
861 IN BOOLEAN Edit\r
2573712e
LG
862 );\r
863\r
7936fb6a 864/**\r
865 Get Question's current Value.\r
866\r
867 @param FormSet FormSet data structure.\r
868 @param Form Form data structure.\r
869 @param Question Question to be initialized.\r
870 @param Cached TRUE: get from Edit copy FALSE: get from original\r
871 Storage\r
872\r
873 @retval EFI_SUCCESS The function completed successfully.\r
874\r
875**/\r
876EFI_STATUS\r
877GetQuestionValue (\r
878 IN FORM_BROWSER_FORMSET *FormSet,\r
879 IN FORM_BROWSER_FORM *Form,\r
880 IN OUT FORM_BROWSER_STATEMENT *Question,\r
881 IN BOOLEAN Cached\r
ed66e1bc 882 );\r
7936fb6a 883\r
884/**\r
885 Save Question Value to edit copy(cached) or Storage(uncached).\r
886\r
887 @param FormSet FormSet data structure.\r
888 @param Form Form data structure.\r
889 @param Question Pointer to the Question.\r
890 @param Cached TRUE: set to Edit copy FALSE: set to original\r
891 Storage\r
892\r
893 @retval EFI_SUCCESS The function completed successfully.\r
894\r
895**/\r
896EFI_STATUS\r
897SetQuestionValue (\r
898 IN FORM_BROWSER_FORMSET *FormSet,\r
899 IN FORM_BROWSER_FORM *Form,\r
900 IN OUT FORM_BROWSER_STATEMENT *Question,\r
901 IN BOOLEAN Cached\r
ed66e1bc 902 );\r
7936fb6a 903\r
904/**\r
905 Perform inconsistent check for a Form.\r
906\r
907 @param FormSet FormSet data structure.\r
908 @param Form Form data structure.\r
909 @param Question The Question to be validated.\r
910 @param Type Validation type: InConsistent or NoSubmit\r
911\r
912 @retval EFI_SUCCESS Form validation pass.\r
913 @retval other Form validation failed.\r
914\r
915**/\r
916EFI_STATUS\r
917ValidateQuestion (\r
918 IN FORM_BROWSER_FORMSET *FormSet,\r
919 IN FORM_BROWSER_FORM *Form,\r
920 IN FORM_BROWSER_STATEMENT *Question,\r
921 IN UINTN Type\r
ed66e1bc 922 );\r
7936fb6a 923\r
924/**\r
b18e7050 925 Discard data for form level or formset level.\r
7936fb6a 926\r
927 @param FormSet FormSet data structure.\r
928 @param Form Form data structure.\r
b18e7050
ED
929 @param SingleForm whether submit single form or formset.\r
930\r
931 @retval EFI_SUCCESS The function completed successfully.\r
932\r
933**/\r
934EFI_STATUS\r
935DiscardForm (\r
936 IN FORM_BROWSER_FORMSET *FormSet,\r
937 IN FORM_BROWSER_FORM *Form,\r
938 IN BOOLEAN SingleForm\r
939 );\r
940\r
941/**\r
942 Submit data for form level or formset level.\r
943\r
944 @param FormSet FormSet data structure.\r
945 @param Form Form data structure.\r
946 @param SingleForm whether submit single form or formset.\r
7936fb6a 947\r
948 @retval EFI_SUCCESS The function completed successfully.\r
949\r
950**/\r
951EFI_STATUS\r
952SubmitForm (\r
953 IN FORM_BROWSER_FORMSET *FormSet,\r
b18e7050
ED
954 IN FORM_BROWSER_FORM *Form,\r
955 IN BOOLEAN SingleForm\r
ed66e1bc 956 );\r
7936fb6a 957\r
958/**\r
959 Reset Question to its default value.\r
960\r
961 @param FormSet The form set.\r
962 @param Form The form.\r
963 @param Question The question.\r
964 @param DefaultId The Class of the default.\r
965\r
966 @retval EFI_SUCCESS Question is reset to default value.\r
967\r
968**/\r
969EFI_STATUS\r
970GetQuestionDefault (\r
971 IN FORM_BROWSER_FORMSET *FormSet,\r
972 IN FORM_BROWSER_FORM *Form,\r
973 IN FORM_BROWSER_STATEMENT *Question,\r
974 IN UINT16 DefaultId\r
ed66e1bc 975 );\r
7936fb6a 976\r
977/**\r
978 Get current setting of Questions.\r
979\r
980 @param FormSet FormSet data structure.\r
981\r
982 @retval EFI_SUCCESS The function completed successfully.\r
983\r
984**/\r
985EFI_STATUS\r
986InitializeCurrentSetting (\r
987 IN OUT FORM_BROWSER_FORMSET *FormSet\r
ed66e1bc 988 );\r
7936fb6a 989\r
990/**\r
991 Initialize the internal data structure of a FormSet.\r
992\r
993 @param Handle PackageList Handle\r
994 @param FormSetGuid GUID of a formset. If not specified (NULL or zero\r
995 GUID), take the first FormSet found in package\r
996 list.\r
997 @param FormSet FormSet data structure.\r
998\r
999 @retval EFI_SUCCESS The function completed successfully.\r
1000 @retval EFI_NOT_FOUND The specified FormSet could not be found.\r
1001\r
1002**/\r
1003EFI_STATUS\r
1004InitializeFormSet (\r
1005 IN EFI_HII_HANDLE Handle,\r
1006 IN OUT EFI_GUID *FormSetGuid,\r
1007 OUT FORM_BROWSER_FORMSET *FormSet\r
ed66e1bc 1008 );\r
7936fb6a 1009\r
1010/**\r
1011 Reset Questions in a Form to their default value.\r
1012\r
1013 @param FormSet FormSet data structure.\r
1014 @param Form The Form which to be reset.\r
1015 @param DefaultId The Class of the default.\r
1016\r
1017 @retval EFI_SUCCESS The function completed successfully.\r
1018\r
1019**/\r
1020EFI_STATUS\r
1021ExtractFormDefault (\r
1022 IN FORM_BROWSER_FORMSET *FormSet,\r
1023 IN FORM_BROWSER_FORM *Form,\r
1024 IN UINT16 DefaultId\r
ed66e1bc 1025 );\r
7936fb6a 1026\r
1027/**\r
1028 Initialize Question's Edit copy from Storage.\r
1029\r
eccfeab1
LG
1030 @param Selection Selection contains the information about \r
1031 the Selection, form and formset to be displayed.\r
1032 Selection action may be updated in retrieve callback.\r
7936fb6a 1033 @param FormSet FormSet data structure.\r
1034 @param Form Form data structure.\r
1035\r
1036 @retval EFI_SUCCESS The function completed successfully.\r
1037\r
1038**/\r
1039EFI_STATUS\r
1040LoadFormConfig (\r
eccfeab1
LG
1041 IN OUT UI_MENU_SELECTION *Selection,\r
1042 IN FORM_BROWSER_FORMSET *FormSet,\r
1043 IN FORM_BROWSER_FORM *Form\r
ed66e1bc 1044 );\r
7936fb6a 1045\r
d66e6c16 1046/**\r
1047 Initialize Question's Edit copy from Storage for the whole Formset.\r
1048\r
eccfeab1
LG
1049 @param Selection Selection contains the information about \r
1050 the Selection, form and formset to be displayed.\r
1051 Selection action may be updated in retrieve callback.\r
d66e6c16 1052 @param FormSet FormSet data structure.\r
1053\r
1054 @retval EFI_SUCCESS The function completed successfully.\r
1055\r
1056**/\r
1057EFI_STATUS\r
1058LoadFormSetConfig (\r
eccfeab1
LG
1059 IN OUT UI_MENU_SELECTION *Selection,\r
1060 IN FORM_BROWSER_FORMSET *FormSet\r
d66e6c16 1061 );\r
1062\r
7936fb6a 1063/**\r
1064 Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.\r
1065\r
b18e7050 1066 @param Buffer The Storage to be conveted.\r
7936fb6a 1067 @param ConfigResp The returned <ConfigResp>.\r
b18e7050 1068 @param SingleForm Whether update data for single form or formset level.\r
7936fb6a 1069\r
1070 @retval EFI_SUCCESS Convert success.\r
1071 @retval EFI_INVALID_PARAMETER Incorrect storage type.\r
1072\r
1073**/\r
1074EFI_STATUS\r
1075StorageToConfigResp (\r
b18e7050
ED
1076 IN VOID *Buffer,\r
1077 IN CHAR16 **ConfigResp,\r
1078 IN BOOLEAN SingleForm\r
ed66e1bc 1079 );\r
7936fb6a 1080\r
1081/**\r
1082 Convert <ConfigResp> to settings in Buffer Storage or NameValue Storage.\r
1083\r
1084 @param Storage The Storage to receive the settings.\r
1085 @param ConfigResp The <ConfigResp> to be converted.\r
1086\r
1087 @retval EFI_SUCCESS Convert success.\r
1088 @retval EFI_INVALID_PARAMETER Incorrect storage type.\r
1089\r
1090**/\r
1091EFI_STATUS\r
1092ConfigRespToStorage (\r
1093 IN FORMSET_STORAGE *Storage,\r
1094 IN CHAR16 *ConfigResp\r
ed66e1bc 1095 );\r
7936fb6a 1096\r
1097/**\r
1098 Fill storage's edit copy with settings requested from Configuration Driver.\r
1099\r
1100 @param FormSet FormSet data structure.\r
1101 @param Storage Buffer Storage.\r
1102\r
1103 @retval EFI_SUCCESS The function completed successfully.\r
1104\r
1105**/\r
1106EFI_STATUS\r
1107LoadStorage (\r
1108 IN FORM_BROWSER_FORMSET *FormSet,\r
1109 IN FORMSET_STORAGE *Storage\r
ed66e1bc 1110 );\r
7936fb6a 1111\r
1112/**\r
1113 Fetch the Ifr binary data of a FormSet.\r
1114\r
1115 @param Handle PackageList Handle\r
1116 @param FormSetGuid GUID of a formset. If not specified (NULL or zero\r
1117 GUID), take the first FormSet found in package\r
1118 list.\r
1119 @param BinaryLength The length of the FormSet IFR binary.\r
1120 @param BinaryData The buffer designed to receive the FormSet.\r
1121\r
1122 @retval EFI_SUCCESS Buffer filled with the requested FormSet.\r
1123 BufferLength was updated.\r
1124 @retval EFI_INVALID_PARAMETER The handle is unknown.\r
1125 @retval EFI_NOT_FOUND A form or FormSet on the requested handle cannot\r
1126 be found with the requested FormId.\r
1127\r
1128**/\r
1129EFI_STATUS\r
1130GetIfrBinaryData (\r
1131 IN EFI_HII_HANDLE Handle,\r
1132 IN OUT EFI_GUID *FormSetGuid,\r
1133 OUT UINTN *BinaryLength,\r
1134 OUT UINT8 **BinaryData\r
ed66e1bc 1135 );\r
7936fb6a 1136\r
ce6d12cc 1137/**\r
1138 Save globals used by previous call to SendForm(). SendForm() may be called from \r
1139 HiiConfigAccess.Callback(), this will cause SendForm() be reentried.\r
1140 So, save globals of previous call to SendForm() and restore them upon exit.\r
1141\r
1142**/\r
1143VOID\r
1144SaveBrowserContext (\r
1145 VOID\r
1146 );\r
1147\r
1148/**\r
1149 Restore globals used by previous call to SendForm().\r
1150\r
1151**/\r
1152VOID\r
1153RestoreBrowserContext (\r
1154 VOID\r
1155 );\r
1156\r
7936fb6a 1157/**\r
1158 This is the routine which an external caller uses to direct the browser\r
1159 where to obtain it's information.\r
1160\r
1161\r
1162 @param This The Form Browser protocol instanse.\r
1163 @param Handles A pointer to an array of Handles. If HandleCount > 1 we\r
1164 display a list of the formsets for the handles specified.\r
1165 @param HandleCount The number of Handles specified in Handle.\r
1166 @param FormSetGuid This field points to the EFI_GUID which must match the Guid\r
1167 field in the EFI_IFR_FORM_SET op-code for the specified\r
1168 forms-based package. If FormSetGuid is NULL, then this\r
1169 function will display the first found forms package.\r
1170 @param FormId This field specifies which EFI_IFR_FORM to render as the first\r
1171 displayable page. If this field has a value of 0x0000, then\r
1172 the forms browser will render the specified forms in their encoded order.\r
1173 ScreenDimenions - This allows the browser to be called so that it occupies a\r
1174 portion of the physical screen instead of dynamically determining the screen dimensions.\r
1175 ActionRequest - Points to the action recommended by the form.\r
d66e6c16 1176 @param ScreenDimensions Points to recommended form dimensions, including any non-content area, in\r
7936fb6a 1177 characters.\r
1178 @param ActionRequest Points to the action recommended by the form.\r
1179\r
1180 @retval EFI_SUCCESS The function completed successfully.\r
1181 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
1182 @retval EFI_NOT_FOUND No valid forms could be found to display.\r
1183\r
1184**/\r
1185EFI_STATUS\r
1186EFIAPI\r
1187SendForm (\r
1188 IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,\r
1189 IN EFI_HII_HANDLE *Handles,\r
1190 IN UINTN HandleCount,\r
1191 IN EFI_GUID *FormSetGuid, OPTIONAL\r
1192 IN UINT16 FormId, OPTIONAL\r
1193 IN CONST EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL\r
1194 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest OPTIONAL\r
ed66e1bc 1195 );\r
7936fb6a 1196\r
1197/**\r
1198 This function is called by a callback handler to retrieve uncommitted state\r
1199 data from the browser.\r
1200\r
1201 @param This A pointer to the EFI_FORM_BROWSER2_PROTOCOL\r
1202 instance.\r
1203 @param ResultsDataSize A pointer to the size of the buffer associated\r
1204 with ResultsData.\r
1205 @param ResultsData A string returned from an IFR browser or\r
1206 equivalent. The results string will have no\r
1207 routing information in them.\r
1208 @param RetrieveData A BOOLEAN field which allows an agent to retrieve\r
1209 (if RetrieveData = TRUE) data from the uncommitted\r
1210 browser state information or set (if RetrieveData\r
1211 = FALSE) data in the uncommitted browser state\r
1212 information.\r
1213 @param VariableGuid An optional field to indicate the target variable\r
1214 GUID name to use.\r
1215 @param VariableName An optional field to indicate the target\r
1216 human-readable variable name.\r
1217\r
1218 @retval EFI_SUCCESS The results have been distributed or are awaiting\r
1219 distribution.\r
1220 @retval EFI_BUFFER_TOO_SMALL The ResultsDataSize specified was too small to\r
1221 contain the results data.\r
1222\r
1223**/\r
1224EFI_STATUS\r
1225EFIAPI\r
1226BrowserCallback (\r
1227 IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,\r
1228 IN OUT UINTN *ResultsDataSize,\r
1229 IN OUT EFI_STRING ResultsData,\r
1230 IN BOOLEAN RetrieveData,\r
1231 IN CONST EFI_GUID *VariableGuid, OPTIONAL\r
1232 IN CONST CHAR16 *VariableName OPTIONAL\r
ed66e1bc 1233 );\r
7936fb6a 1234\r
b18e7050
ED
1235/**\r
1236 Find menu which will show next time.\r
1237\r
1238 @param Selection On input, Selection tell setup browser the information\r
1239 about the Selection, form and formset to be displayed.\r
1240 On output, Selection return the screen item that is selected\r
1241 by user.\r
1242 @param Repaint Whether need to repaint the menu.\r
1243 @param NewLine Whether need to show at new line.\r
1244 \r
1245 @retval TRUE Need return.\r
1246 @retval FALSE No need to return.\r
1247**/\r
1248BOOLEAN\r
1249FindNextMenu (\r
1250 IN OUT UI_MENU_SELECTION *Selection,\r
1251 IN BOOLEAN *Repaint, \r
1252 IN BOOLEAN *NewLine \r
1253 );\r
1254\r
1255/**\r
1256 check whether the formset need to update the NV.\r
1257\r
1258 @param FormSet FormSet data structure.\r
1259 @param SetValue Whether set new value or clear old value.\r
1260\r
1261**/\r
1262VOID\r
1263UpdateNvInfoInForm (\r
1264 IN FORM_BROWSER_FORMSET *FormSet,\r
1265 IN BOOLEAN SetValue\r
1266 );\r
1267\r
1268/**\r
1269 check whether the formset need to update the NV.\r
1270\r
1271 @param FormSet FormSet data structure.\r
1272\r
1273 @retval TRUE Need to update the NV.\r
1274 @retval FALSE No need to update the NV.\r
1275**/\r
1276BOOLEAN \r
1277IsNvUpdateRequired (\r
1278 IN FORM_BROWSER_FORMSET *FormSet\r
1279 );\r
1280\r
1281/**\r
1282 Call the call back function for the question and process the return action.\r
1283\r
1284 @param Selection On input, Selection tell setup browser the information\r
1285 about the Selection, form and formset to be displayed.\r
1286 On output, Selection return the screen item that is selected\r
1287 by user.\r
1288 @param Statement The Question which need to call.\r
1289 @param Action The action request.\r
1290 @param SkipSaveOrDiscard Whether skip save or discard action.\r
1291\r
1292 @retval EFI_SUCCESS The call back function excutes successfully.\r
1293 @return Other value if the call back function failed to excute. \r
1294**/\r
1295EFI_STATUS \r
1296ProcessCallBackFunction (\r
1297 IN OUT UI_MENU_SELECTION *Selection,\r
1298 IN FORM_BROWSER_STATEMENT *Question,\r
1299 IN EFI_BROWSER_ACTION Action,\r
1300 IN BOOLEAN SkipSaveOrDiscard\r
1301 );\r
7936fb6a 1302#endif\r