]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
1. Update the implementation of HII ConfigRouting Protocol in HiiDataBase module...
[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 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 option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = 0;
157 option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = DEFAULT;
158 endoneof;
159
160 grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
161 suppressif questionref(MyOneOf) == 0x0;
162
163 checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
164 prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
165 help = STRING_TOKEN(STR_CHECK_BOX_HELP),
166 //
167 // CHECKBOX_DEFAULT indicate this checkbox is marked with EFI_IFR_CHECKBOX_DEFAULT
168 // CHECKBOX_DEFAULT_MFG indicate EFI_IFR_CHECKBOX_DEFAULT_MFG.
169 //
170 flags = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG,
171 key = 0,
172 default = 1,
173 endcheckbox;
174 endif;
175 endif;
176
177 //
178 // Ordered list:
179 // sizeof(MyIfrNVData) storage must be UINT8 array, and
180 // size written for the variable must be size of the entire
181 // variable.
182 //
183 //
184 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
185
186 //
187 // label is defined as an anchor where you want to insert some dynamic
188 // opcodes created on-the-fly
189 //
190 label LABEL_UPDATE_BBS;
191
192 orderedlist
193 varid = MyIfrNVData.BootOrder,
194 prompt = STRING_TOKEN(STR_BOOT_OPTIONS),
195 help = STRING_TOKEN(STR_NULL_STRING),
196 option text = STRING_TOKEN(STR_BOOT_OPTION2), value = 2, flags = RESET_REQUIRED;
197 option text = STRING_TOKEN(STR_BOOT_OPTION1), value = 1, flags = RESET_REQUIRED;
198 option text = STRING_TOKEN(STR_BOOT_OPTION3), value = 3, flags = RESET_REQUIRED;
199 suppressif ideqval MyIfrNVData.BootOrderLarge == 0;
200 option text = STRING_TOKEN(STR_BOOT_OPTION4), value = 4, flags = RESET_REQUIRED;
201 endif
202 endlist;
203
204 //
205 // label should be paired with each other
206 //
207 label LABEL_END;
208
209 endif; // end suppressif
210
211 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x2;
212 orderedlist
213 varid = MyIfrNVData.OrderedList,
214 prompt = STRING_TOKEN(STR_TEST_OPCODE),
215 help = STRING_TOKEN(STR_TEXT_HELP),
216 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 3, flags = RESET_REQUIRED;
217 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 2, flags = RESET_REQUIRED;
218 option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 1, flags = RESET_REQUIRED;
219 endlist;
220 endif;
221
222 label 100;
223
224 //
225 // Define a hyperlink (EFI_IFR_REF)
226 //
227 goto 0x1234, // Destination Form ID
228 prompt = STRING_TOKEN(STR_GOTO_DYNAMIC), // Prompt string
229 help = STRING_TOKEN(STR_GOTO_HELP), // Help string
230 flags = INTERACTIVE, // INTERACTIVE indicate it's marked with EFI_IFR_FLAG_CALLBACK
231 key = 0x1234; // Question ID which will be passed-in in COnfigAccess.Callback()
232
233 goto 0x1234,
234 prompt = STRING_TOKEN(STR_GOTO_DYNAMIC2),
235 help = STRING_TOKEN(STR_GOTO_HELP),
236 flags = INTERACTIVE,
237 key = 0x1235;
238
239 oneof varid = MyIfrNVData.TestLateCheck,
240 prompt = STRING_TOKEN(STR_TEST_OPCODE),
241 help = STRING_TOKEN(STR_ONE_OF_HELP),
242 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
243 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
244
245 endoneof;
246
247 oneof varid = MyIfrNVData.TestLateCheck2,
248 prompt = STRING_TOKEN(STR_TEST_OPCODE2),
249 help = STRING_TOKEN(STR_ONE_OF_HELP),
250 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = DEFAULT | RESET_REQUIRED;
251 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = RESET_REQUIRED;
252
253 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
254 ideqid MyIfrNVData.TestLateCheck == MyIfrNVData.TestLateCheck2
255 endif
256
257 endoneof;
258
259 oneof varid = MyIfrNVData.QuestionAboutTreeHugging,
260 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
261 help = STRING_TOKEN(STR_ONE_OF_HELP),
262 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
263 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
264 option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 0x03, flags = RESET_REQUIRED;
265
266 endoneof;
267
268 //
269 // Define a string (EFI_IFR_STRING)
270 //
271 string varid = MyIfrNVData.MyStringData,
272 prompt = STRING_TOKEN(STR_MY_STRING_PROMPT2),
273 help = STRING_TOKEN(STR_MY_STRING_HELP2),
274 flags = INTERACTIVE,
275 key = 0x1236,
276 minsize = 6,
277 maxsize = 40,
278 endstring;
279
280 //
281 // Define a numeric (EFI_IFR_NUMERIC)
282 //
283 numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
284 prompt = STRING_TOKEN(STR_NUMERIC_READONLY_PROMPT),
285 help = STRING_TOKEN(STR_NUMERIC_HELP0),
286 flags = READ_ONLY, // READ_ONLY indicate it's marked with EFI_IFR_FLAG_READ_ONLY
287 minimum = 0,
288 maximum = 0xf0,
289 step = 0, // Stepping of 0 equates to a manual entering
290 // of a value, otherwise it will be adjusted by "+"/"-"
291 default = 21, // defaultstore could be used to specify the default type
292 // If no defaultstore is specified, it implies Standard Default
293
294 endnumeric;
295
296 numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
297 prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
298 help = STRING_TOKEN(STR_NUMERIC_HELP0),
299 minimum = 0,
300 maximum = 0xf0,
301 step = 0,
302 default = 21,
303
304 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
305 ideqval MyIfrNVData.HowOldAreYouInYearsManual == 99
306 OR
307 ideqid MyIfrNVData.HowOldAreYouInYearsManual == MyEfiVar
308 OR
309 ideqvallist MyIfrNVData.HowOldAreYouInYearsManual == 1 3 5 7
310 endif
311
312 endnumeric;
313
314 numeric varid = MyEfiVar, // Reference of EFI variable storage
315 prompt = STRING_TOKEN(STR_TALL_HEX_PROMPT),
316 help = STRING_TOKEN(STR_NUMERIC_HELP1),
317 flags = DISPLAY_UINT_HEX, // Display in HEX format (if not specified, default is in decimal format)
318 minimum = 0,
319 maximum = 250,
320 default = 175,
321
322 endnumeric;
323
324 label LABEL_1_VALUE;
325 label LABEL_2_VALUE;
326
327 grayoutif ideqval MyIfrNVData.HowOldAreYouInYearsManual == 23 AND ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
328 numeric varid = MyIfrNVData.HowOldAreYouInYears,
329 prompt = STRING_TOKEN(STR_NUMERIC_STEP_PROMPT),
330 help = STRING_TOKEN(STR_NUMERIC_HELP2),
331 minimum = 0,
332 maximum = 243,
333 step = 1,
334 default = 18, defaultstore = MyStandardDefault, // This is standard default value
335 default = 19, defaultstore = MyManufactureDefault, // This is manufacture default value
336
337 endnumeric;
338 endif;
339
340 resetbutton
341 defaultstore = MyStandardDefault,
342 prompt = STRING_TOKEN(STR_STANDARD_DEFAULT_PROMPT),
343 help = STRING_TOKEN(STR_STANDARD_DEFAULT_HELP),
344 endresetbutton;
345
346 resetbutton
347 defaultstore = MyManufactureDefault,
348 prompt = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_PROMPT),
349 help = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_HELP),
350 endresetbutton;
351
352 //
353 // Non-interactive password, validate by Setup Browser
354 //
355 password varid = MyIfrNVData.WhatIsThePassword,
356 prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
357 help = STRING_TOKEN(STR_PASSWORD_HELP),
358 minsize = 6,
359 maxsize = 20,
360 endpassword;
361
362 string varid = MyIfrNVData.PasswordClearText,
363 prompt = STRING_TOKEN(STR_MY_STRING_PROMPT),
364 help = STRING_TOKEN(STR_MY_STRING_HELP),
365 minsize = 6,
366 maxsize = 0x14,
367 endstring;
368
369 //
370 // Interactive password, validate via ConfigAccess.Callback()
371 //
372 password varid = MyIfrNVData.WhatIsThePassword2,
373 prompt = STRING_TOKEN(STR_PASSWORD_CALLBACK_PROMPT),
374 help = STRING_TOKEN(STR_PASSWORD_HELP),
375 flags = INTERACTIVE,
376 key = 0x2000,
377 minsize = 6,
378 maxsize = 20,
379 endpassword;
380
381 goto 2,
382 prompt = STRING_TOKEN(STR_GOTO_FORM2), //SecondSetupPage // this too has no end-op and basically it's a jump to a form ONLY
383 help = STRING_TOKEN(STR_GOTO_HELP);
384
385 goto 3,
386 prompt = STRING_TOKEN(STR_GOTO_FORM3), //ThirdSetupPage // this too has no end-op and basically it's a jump to a form ONLY
387 help = STRING_TOKEN(STR_GOTO_HELP);
388
389 endform;
390
391 form formid = 2, // SecondSetupPage,
392 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
393
394
395 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
396 prompt = STRING_TOKEN(STR_DATE_PROMPT),
397 help = STRING_TOKEN(STR_DATE_HELP),
398 minimum = 1998,
399 maximum = 2099,
400 step = 1,
401 default = 2004,
402
403 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
404 prompt = STRING_TOKEN(STR_DATE_PROMPT),
405 help = STRING_TOKEN(STR_DATE_HELP),
406 minimum = 1,
407 maximum = 12,
408 step = 1,
409 default = 1,
410
411 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
412 prompt = STRING_TOKEN(STR_DATE_PROMPT),
413 help = STRING_TOKEN(STR_DATE_HELP),
414 minimum = 1,
415 maximum = 31,
416 step = 0x1,
417 default = 1,
418
419 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
420 ideqval Date.Day == 31
421 AND
422 ideqvallist Date.Month == 2 4 6 9 11
423 endif
424
425 //
426 // If the day is 30 AND month is 2
427 //
428 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
429 ideqval Date.Day == 30
430 AND
431 ideqval Date.Month == 2
432 endif
433
434 //
435 // If the day is 29 AND month is 2 AND it year is NOT a leapyear
436 //
437 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
438 ideqval Date.Day == 0x1D
439 AND
440 ideqval Date.Month == 2
441 AND
442 NOT
443 ideqvallist Date.Year == 2004 2008 20012 20016 2020 2024 2028 2032 2036
444 endif
445
446 enddate;
447
448 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
449 prompt = STRING_TOKEN(STR_TIME_PROMPT),
450 help = STRING_TOKEN(STR_TIME_HELP),
451 minimum = 0,
452 maximum = 23,
453 step = 1,
454 default = 0,
455
456 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
457 prompt = STRING_TOKEN(STR_TIME_PROMPT),
458 help = STRING_TOKEN(STR_TIME_HELP),
459 minimum = 0,
460 maximum = 59,
461 step = 1,
462 default = 0,
463
464 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
465 prompt = STRING_TOKEN(STR_TIME_PROMPT),
466 help = STRING_TOKEN(STR_TIME_HELP),
467 minimum = 0,
468 maximum = 59,
469 step = 1,
470 default = 0,
471
472 endtime;
473
474 checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
475 prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
476 help = STRING_TOKEN(STR_CHECK_BOX_HELP),
477 flags = CHECKBOX_DEFAULT,
478 key = 0,
479 endcheckbox;
480
481 text
482 help = STRING_TOKEN(STR_TEXT_HELP),
483 text = STRING_TOKEN(STR_TEXT_TEXT_1);
484
485 text
486 help = STRING_TOKEN(STR_TEXT_HELP),
487 text = STRING_TOKEN(STR_TEXT_TEXT_1),
488 text = STRING_TOKEN(STR_TEXT_TEXT_2);
489
490 goto 1,
491 prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage // this too has no end-op and basically it's a jump to a form ONLY
492 help = STRING_TOKEN(STR_GOTO_HELP);
493
494 endform;
495
496 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
497
498 suppressif ideqval MyEfiVar == 111;
499 text
500 help = STRING_TOKEN(STR_TEXT_HELP),
501 text = STRING_TOKEN(STR_TEXT_TEXT_1);
502 endif;
503
504 goto 1,
505 prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage
506 help = STRING_TOKEN(STR_GOTO_HELP);
507
508 numeric varid = MyIfrNVData.DynamicRefresh,
509 prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
510 help = STRING_TOKEN(STR_NUMERIC_HELP0),
511 flags = INTERACTIVE,
512 key = 0x5678,
513 minimum = 0,
514 maximum = 0xff,
515 step = 0,
516 default = 0,
517 refresh interval = 3 // Refresh interval in seconds
518 endnumeric;
519
520 label LABEL_UPDATE2;
521 label LABEL_END;
522
523 endform;
524
525 form formid = 4, title = STRING_TOKEN(STR_FORM3_TITLE);
526
527 endform;
528
529 form formid = 0x1234, // Dynamically created page,
530 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
531
532 label LABEL_UPDATE1;
533 //
534 // This is where we will insert dynamic created opcodes
535 //
536 label LABEL_END;
537
538 endform;
539
540 endformset;