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