]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
Add Example for EFI_BROWSER_ACTION_RETRIEVE callback
[mirror_edk2.git] / MdeModulePkg / Universal / DriverSampleDxe / Vfr.vfr
1 ///** @file
2 //
3 // Sample Setup formset.
4 //
5 // Copyright (c) 2004 - 2008, Intel Corporation. <BR>
6 // All rights reserved. This program and the accompanying materials
7 // are licensed and made available under the terms and conditions of the BSD License
8 // which accompanies this distribution. The full text of the license may be found at
9 // http://opensource.org/licenses/bsd-license.php
10 //
11 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 //
14 //**/
15
16
17 #include "NVDataStruc.h"
18
19 //
20 // Formset class used by Device Manager
21 //
22 #define EFI_NON_DEVICE_CLASS 0x00
23 #define EFI_DISK_DEVICE_CLASS 0x01
24 #define EFI_VIDEO_DEVICE_CLASS 0x02
25 #define EFI_NETWORK_DEVICE_CLASS 0x04
26 #define EFI_INPUT_DEVICE_CLASS 0x08
27 #define EFI_ON_BOARD_DEVICE_CLASS 0x10
28 #define EFI_OTHER_DEVICE_CLASS 0x20
29
30 //
31 // Formset subclass
32 //
33 #define EFI_SETUP_APPLICATION_SUBCLASS 0x00
34 #define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
35 #define EFI_FRONT_PAGE_SUBCLASS 0x02
36 #define EFI_SINGLE_USE_SUBCLASS 0x03
37
38 //
39 // EFI Variable attributes
40 //
41 #define EFI_VARIABLE_NON_VOLATILE 0x00000001
42 #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
43 #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
44 #define EFI_VARIABLE_READ_ONLY 0x00000008
45
46 //
47 // Labels definition
48 //
49 #define LABEL_1_VALUE 0x01
50 #define LABEL_2_VALUE 0x1000
51 #define LABEL_UPDATE_BBS 0x2222
52
53 formset
54 guid = FORMSET_GUID,
55 title = STRING_TOKEN(STR_FORM_SET_TITLE),
56 help = STRING_TOKEN(STR_FORM_SET_TITLE_HELP),
57 classguid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID,
58
59 //
60 // Notes: VfrCompiler will insert a Standard Default Storage declaration
61 // after the formset declaration. >00000040: 5C 06 00 00 00 00.
62 // So we don't need to declare the Standard Default.
63 // Please check the vfr.lst file for details.
64 // To enable list file for VFR, add "-l" to VfrCompile <Command> in [Build.Visual-Form-Representation-File] as follows:
65 // VfrCompile -l --no-pre-processing --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
66 //
67
68 //
69 // Define a Buffer Storage (EFI_IFR_VARSTORE)
70 //
71 varstore DRIVER_SAMPLE_CONFIGURATION, // This is the data structure type
72 varid = CONFIGURATION_VARSTORE_ID, // Optional VarStore ID
73 name = MyIfrNVData, // Define referenced name in vfr
74 guid = FORMSET_GUID; // GUID of this buffer storage
75
76 //
77 // Define another Buffer Storage
78 //
79 varstore MY_DATA2,
80 name = MyIfrNVData2,
81 guid = FORMSET_GUID;
82
83 //
84 // Define a EFI variable Storage (EFI_IFR_VARSTORE_EFI)
85 //
86 efivarstore MyEfiVar, // Define referenced name in vfr
87 attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, // EFI variable attribures
88 name = STRING_TOKEN(STR_VAR_NAME), // EFI variable name
89 varsize = 1, // Size of the EFI variable
90 guid = FORMSET_GUID; // EFI variable GUID
91
92 defaultstore MyStandardDefault,
93 prompt = STRING_TOKEN(STR_STANDARD_DEFAULT_PROMPT),
94 attribute = 0x0000; // Default ID: 0000 standard default
95
96 defaultstore MyManufactureDefault,
97 prompt = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_PROMPT),
98 attribute = 0x0001; // Default ID: 0001 manufacture default
99
100 //
101 // Define a Form (EFI_IFR_FORM)
102 //
103 form formid = 1, // Form ID
104 title = STRING_TOKEN(STR_FORM1_TITLE); // Form title
105
106 subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT);
107
108 subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
109
110 //
111 // Define a display only text (EFI_IFR_TEXT)
112 //
113 text
114 help = STRING_TOKEN(STR_TEXT_HELP), // Help string
115 text = STRING_TOKEN(STR_CPU_STRING), // Prompt string
116 text = STRING_TOKEN(STR_CPU_STRING2); // TextTwo
117
118 //
119 // Define action button (EFI_IFR_ACTION)
120 //
121 text
122 help = STRING_TOKEN(STR_EXIT_TEXT),
123 text = STRING_TOKEN(STR_EXIT_TEXT),
124 text = STRING_TOKEN(STR_EXIT_TEXT),
125 flags = INTERACTIVE, // VfrCompiler will generate opcode EFI_IFR_ACTION for Text marked as INTERACTIVE
126 key = 0x1237;
127
128 text
129 help = STRING_TOKEN(STR_SAVE_TEXT),
130 text = STRING_TOKEN(STR_SAVE_TEXT),
131 text = STRING_TOKEN(STR_SAVE_TEXT),
132 flags = INTERACTIVE,
133 key = 0x1238;
134
135 //
136 // Define oneof (EFI_IFR_ONE_OF)
137 //
138 oneof name = MyOneOf, // Define reference name for Question
139 varid = MyIfrNVData.SuppressGrayOutSomething, // Use "DataStructure.Member" to reference Buffer Storage
140 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
141 help = STRING_TOKEN(STR_ONE_OF_HELP),
142 //
143 // Define an option (EFI_IFR_ONE_OF_OPTION)
144 //
145 option text = STRING_TOKEN(STR_ONE_OF_TEXT4), value = 0x0, flags = 0;
146 option text = STRING_TOKEN(STR_ONE_OF_TEXT5), value = 0x1, flags = 0;
147 //
148 // DEFAULT indicate this option will be marked with EFI_IFR_OPTION_DEFAULT
149 //
150 option text = STRING_TOKEN(STR_ONE_OF_TEXT6), value = 0x2, flags = DEFAULT;
151 endoneof;
152
153 oneof varid = MyIfrNVData.BootOrderLarge,
154 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
155 help = STRING_TOKEN(STR_ONE_OF_HELP),
156 default value = cond (pushthis == 0 ? 0 : cond ((questionref(MyOneOf) >> 0x4 & 0xF00) == 0x0 + 0x2 ? 0 : 1)),
157 option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = 0;
158 option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = 0;
159 endoneof;
160
161 grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
162 suppressif questionref(MyOneOf) == 0x0;
163
164 checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
165 prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
166 help = STRING_TOKEN(STR_CHECK_BOX_HELP),
167 //
168 // CHECKBOX_DEFAULT indicate this checkbox is marked with EFI_IFR_CHECKBOX_DEFAULT
169 // CHECKBOX_DEFAULT_MFG indicate EFI_IFR_CHECKBOX_DEFAULT_MFG.
170 //
171 flags = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG,
172 key = 0,
173 default = 1,
174 endcheckbox;
175 endif;
176 endif;
177
178 //
179 // Ordered list:
180 // sizeof(MyIfrNVData) storage must be UINT8 array, and
181 // size written for the variable must be size of the entire
182 // variable.
183 //
184 //
185 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
186
187 //
188 // label is defined as an anchor where you want to insert some dynamic
189 // opcodes created on-the-fly
190 //
191 label LABEL_UPDATE_BBS;
192
193 orderedlist
194 varid = MyIfrNVData.BootOrder,
195 prompt = STRING_TOKEN(STR_BOOT_OPTIONS),
196 help = STRING_TOKEN(STR_NULL_STRING),
197 option text = STRING_TOKEN(STR_BOOT_OPTION2), value = 2, flags = RESET_REQUIRED;
198 option text = STRING_TOKEN(STR_BOOT_OPTION1), value = 1, flags = RESET_REQUIRED;
199 option text = STRING_TOKEN(STR_BOOT_OPTION3), value = 3, flags = RESET_REQUIRED;
200 suppressif ideqval MyIfrNVData.BootOrderLarge == 0;
201 option text = STRING_TOKEN(STR_BOOT_OPTION4), value = 4, flags = RESET_REQUIRED;
202 endif
203 endlist;
204
205 //
206 // label should be paired with each other
207 //
208 label LABEL_END;
209
210 endif; // end suppressif
211
212 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x2;
213 orderedlist
214 varid = MyIfrNVData.OrderedList,
215 prompt = STRING_TOKEN(STR_TEST_OPCODE),
216 help = STRING_TOKEN(STR_TEXT_HELP),
217 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 3, flags = RESET_REQUIRED;
218 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 2, flags = RESET_REQUIRED;
219 option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 1, flags = RESET_REQUIRED;
220 endlist;
221 endif;
222
223 label 100;
224
225 //
226 // Define a hyperlink (EFI_IFR_REF)
227 //
228 goto 0x1234, // Destination Form ID
229 prompt = STRING_TOKEN(STR_GOTO_DYNAMIC), // Prompt string
230 help = STRING_TOKEN(STR_GOTO_HELP), // Help string
231 flags = INTERACTIVE, // INTERACTIVE indicate it's marked with EFI_IFR_FLAG_CALLBACK
232 key = 0x1234; // Question ID which will be passed-in in COnfigAccess.Callback()
233
234 goto 0x1234,
235 prompt = STRING_TOKEN(STR_GOTO_DYNAMIC2),
236 help = STRING_TOKEN(STR_GOTO_HELP),
237 flags = INTERACTIVE,
238 key = 0x1235;
239
240 oneof varid = MyIfrNVData.TestLateCheck,
241 prompt = STRING_TOKEN(STR_TEST_OPCODE),
242 help = STRING_TOKEN(STR_ONE_OF_HELP),
243 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
244 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
245
246 endoneof;
247
248 oneof varid = MyIfrNVData.TestLateCheck2,
249 prompt = STRING_TOKEN(STR_TEST_OPCODE2),
250 help = STRING_TOKEN(STR_ONE_OF_HELP),
251 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = DEFAULT | RESET_REQUIRED;
252 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = RESET_REQUIRED;
253
254 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
255 ideqid MyIfrNVData.TestLateCheck == MyIfrNVData.TestLateCheck2
256 endif
257
258 endoneof;
259
260 oneof varid = MyIfrNVData.QuestionAboutTreeHugging,
261 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
262 help = STRING_TOKEN(STR_ONE_OF_HELP),
263 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
264 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
265 option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 0x03, flags = RESET_REQUIRED;
266
267 endoneof;
268
269 //
270 // Define a string (EFI_IFR_STRING)
271 //
272 string varid = MyIfrNVData.MyStringData,
273 prompt = STRING_TOKEN(STR_MY_STRING_PROMPT2),
274 help = STRING_TOKEN(STR_MY_STRING_HELP2),
275 flags = INTERACTIVE,
276 key = 0x1236,
277 minsize = 6,
278 maxsize = 40,
279 endstring;
280
281 //
282 // Define a numeric (EFI_IFR_NUMERIC)
283 //
284 numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
285 prompt = STRING_TOKEN(STR_NUMERIC_READONLY_PROMPT),
286 help = STRING_TOKEN(STR_NUMERIC_HELP0),
287 flags = READ_ONLY, // READ_ONLY indicate it's marked with EFI_IFR_FLAG_READ_ONLY
288 minimum = 0,
289 maximum = 0xf0,
290 step = 0, // Stepping of 0 equates to a manual entering
291 // of a value, otherwise it will be adjusted by "+"/"-"
292 default = 21, // defaultstore could be used to specify the default type
293 // If no defaultstore is specified, it implies Standard Default
294
295 endnumeric;
296
297 numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
298 prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
299 help = STRING_TOKEN(STR_NUMERIC_HELP0),
300 minimum = 0,
301 maximum = 0xf0,
302 step = 0,
303 default = 21,
304
305 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
306 ideqval MyIfrNVData.HowOldAreYouInYearsManual == 99
307 OR
308 ideqid MyIfrNVData.HowOldAreYouInYearsManual == MyEfiVar
309 OR
310 ideqvallist MyIfrNVData.HowOldAreYouInYearsManual == 1 3 5 7
311 endif
312
313 endnumeric;
314
315 numeric varid = MyEfiVar, // Reference of EFI variable storage
316 questionid = 0x1111,
317 prompt = STRING_TOKEN(STR_TALL_HEX_PROMPT),
318 help = STRING_TOKEN(STR_NUMERIC_HELP1),
319 flags = DISPLAY_UINT_HEX | INTERACTIVE, // Display in HEX format (if not specified, default is in decimal format)
320 minimum = 0,
321 maximum = 250,
322 default = 175,
323
324 endnumeric;
325
326 label LABEL_1_VALUE;
327 label LABEL_2_VALUE;
328
329 grayoutif ideqval MyIfrNVData.HowOldAreYouInYearsManual == 23 AND ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
330 numeric varid = MyIfrNVData.HowOldAreYouInYears,
331 prompt = STRING_TOKEN(STR_NUMERIC_STEP_PROMPT),
332 help = STRING_TOKEN(STR_NUMERIC_HELP2),
333 minimum = 0,
334 maximum = 243,
335 step = 1,
336 default = 18, defaultstore = MyStandardDefault, // This is standard default value
337 default = 19, defaultstore = MyManufactureDefault, // This is manufacture default value
338
339 endnumeric;
340 endif;
341
342 resetbutton
343 defaultstore = MyStandardDefault,
344 prompt = STRING_TOKEN(STR_STANDARD_DEFAULT_PROMPT),
345 help = STRING_TOKEN(STR_STANDARD_DEFAULT_HELP),
346 endresetbutton;
347
348 resetbutton
349 defaultstore = MyManufactureDefault,
350 prompt = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_PROMPT),
351 help = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_HELP),
352 endresetbutton;
353
354 //
355 // Non-interactive password, validate by Setup Browser
356 //
357 password varid = MyIfrNVData.WhatIsThePassword,
358 prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
359 help = STRING_TOKEN(STR_PASSWORD_HELP),
360 minsize = 6,
361 maxsize = 20,
362 endpassword;
363
364 string varid = MyIfrNVData.PasswordClearText,
365 prompt = STRING_TOKEN(STR_MY_STRING_PROMPT),
366 help = STRING_TOKEN(STR_MY_STRING_HELP),
367 minsize = 6,
368 maxsize = 0x14,
369 endstring;
370
371 //
372 // Interactive password, validate via ConfigAccess.Callback()
373 //
374 password varid = MyIfrNVData.WhatIsThePassword2,
375 prompt = STRING_TOKEN(STR_PASSWORD_CALLBACK_PROMPT),
376 help = STRING_TOKEN(STR_PASSWORD_HELP),
377 flags = INTERACTIVE,
378 key = 0x2000,
379 minsize = 6,
380 maxsize = 20,
381 endpassword;
382
383 goto 2,
384 prompt = STRING_TOKEN(STR_GOTO_FORM2), //SecondSetupPage // this too has no end-op and basically it's a jump to a form ONLY
385 help = STRING_TOKEN(STR_GOTO_HELP);
386
387 goto 3,
388 prompt = STRING_TOKEN(STR_GOTO_FORM3), //ThirdSetupPage // this too has no end-op and basically it's a jump to a form ONLY
389 help = STRING_TOKEN(STR_GOTO_HELP);
390
391 endform;
392
393 form formid = 2, // SecondSetupPage,
394 title = STRING_TOKEN(STR_FORM2_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
395
396
397 date year varid = Date.Year, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
398 prompt = STRING_TOKEN(STR_DATE_PROMPT),
399 help = STRING_TOKEN(STR_DATE_HELP),
400 minimum = 1998,
401 maximum = 2099,
402 step = 1,
403 default = 2004,
404
405 month varid = Date.Month, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
406 prompt = STRING_TOKEN(STR_DATE_PROMPT),
407 help = STRING_TOKEN(STR_DATE_HELP),
408 minimum = 1,
409 maximum = 12,
410 step = 1,
411 default = 1,
412
413 day varid = Date.Day, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
414 prompt = STRING_TOKEN(STR_DATE_PROMPT),
415 help = STRING_TOKEN(STR_DATE_HELP),
416 minimum = 1,
417 maximum = 31,
418 step = 0x1,
419 default = 1,
420
421 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
422 ideqval Date.Day == 31
423 AND
424 ideqvallist Date.Month == 2 4 6 9 11
425 endif
426
427 //
428 // If the day is 30 AND month is 2
429 //
430 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
431 ideqval Date.Day == 30
432 AND
433 ideqval Date.Month == 2
434 endif
435
436 //
437 // If the day is 29 AND month is 2 AND it year is NOT a leapyear
438 //
439 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
440 ideqval Date.Day == 0x1D
441 AND
442 ideqval Date.Month == 2
443 AND
444 NOT
445 ideqvallist Date.Year == 2004 2008 20012 20016 2020 2024 2028 2032 2036
446 endif
447
448 enddate;
449
450 time hour varid = Time.Hours, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
451 prompt = STRING_TOKEN(STR_TIME_PROMPT),
452 help = STRING_TOKEN(STR_TIME_HELP),
453 minimum = 0,
454 maximum = 23,
455 step = 1,
456 default = 0,
457
458 minute varid = Time.Minutes, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
459 prompt = STRING_TOKEN(STR_TIME_PROMPT),
460 help = STRING_TOKEN(STR_TIME_HELP),
461 minimum = 0,
462 maximum = 59,
463 step = 1,
464 default = 0,
465
466 second varid = Time.Seconds, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
467 prompt = STRING_TOKEN(STR_TIME_PROMPT),
468 help = STRING_TOKEN(STR_TIME_HELP),
469 minimum = 0,
470 maximum = 59,
471 step = 1,
472 default = 0,
473
474 endtime;
475
476 checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
477 prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
478 help = STRING_TOKEN(STR_CHECK_BOX_HELP),
479 flags = CHECKBOX_DEFAULT,
480 key = 0,
481 endcheckbox;
482
483 text
484 help = STRING_TOKEN(STR_TEXT_HELP),
485 text = STRING_TOKEN(STR_TEXT_TEXT_1);
486
487 text
488 help = STRING_TOKEN(STR_TEXT_HELP),
489 text = STRING_TOKEN(STR_TEXT_TEXT_1),
490 text = STRING_TOKEN(STR_TEXT_TEXT_2);
491
492 goto 1,
493 prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage // this too has no end-op and basically it's a jump to a form ONLY
494 help = STRING_TOKEN(STR_GOTO_HELP);
495
496 endform;
497
498 form formid = 3, title = STRING_TOKEN(STR_FORM3_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
499
500 suppressif ideqval MyEfiVar == 111;
501 text
502 help = STRING_TOKEN(STR_TEXT_HELP),
503 text = STRING_TOKEN(STR_TEXT_TEXT_1);
504 endif;
505
506 goto 1,
507 prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage
508 help = STRING_TOKEN(STR_GOTO_HELP);
509
510 numeric varid = MyIfrNVData.DynamicRefresh,
511 prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
512 help = STRING_TOKEN(STR_NUMERIC_HELP0),
513 flags = INTERACTIVE,
514 key = 0x5678,
515 minimum = 0,
516 maximum = 0xff,
517 step = 0,
518 default = 0,
519 refresh interval = 3 // Refresh interval in seconds
520 endnumeric;
521
522 label LABEL_UPDATE2;
523 label LABEL_END;
524
525 endform;
526
527 form formid = 4, title = STRING_TOKEN(STR_FORM3_TITLE);
528
529 endform;
530
531 form formid = 0x1234, // Dynamically created page,
532 title = STRING_TOKEN(STR_DYNAMIC_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
533
534 label LABEL_UPDATE1;
535 //
536 // This is where we will insert dynamic created opcodes
537 //
538 label LABEL_END;
539
540 endform;
541
542 endformset;