]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
Add a reference of 2nd buffer storage in a formset.
[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 #define LABEL_END 0x2223
53
54 formset
55 guid = FORMSET_GUID,
56 title = STRING_TOKEN(STR_FORM_SET_TITLE),
57 help = STRING_TOKEN(STR_FORM_SET_TITLE_HELP),
58 class = EFI_ON_BOARD_DEVICE_CLASS,
59 subclass = EFI_SETUP_APPLICATION_SUBCLASS,
60
61 //
62 // Notes: VfrCompiler will insert a Standard Default Storage declaration
63 // after the formset declaration. >00000040: 5C 06 00 00 00 00.
64 // So we don't need to declare the Standard Default.
65 // Please check the vfr.lst file for details.
66 // To enable list file for VFR, add "-l" to VfrCompile <Command> in [Build.Visual-Form-Representation-File] as follows:
67 // VfrCompile -l --no-pre-processing --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
68 //
69
70 //
71 // Define a Default Storage for Manufacturing Defauls. Attribut = 1 (EFI_HII_DEFAULT_CLASS_MANUFACTURING).
72 // Only if this Default Storage is defined, CHECKBOX_DEFAULT_MFG can be used for CheckBox.
73 //
74 defaultstore MfgDefault, prompt = STRING_TOKEN (STR_DEFAULTSTORE_MFG), attribute = 1;
75
76 //
77 // Define a Safe Deafult Storage. Attribute = 2 (EFI_HII_DEFAULT_CLASS_SAFE) as an example.
78 // It is not referenced.
79 //
80 defaultstore SafeDefault, prompt = STRING_TOKEN (STR_DEFAULTSTORE_SAFE), attribute = 2;
81
82 //
83 // Define a Buffer Storage (EFI_IFR_VARSTORE)
84 //
85 varstore DRIVER_SAMPLE_CONFIGURATION, // This is the data structure type
86 varid = 0x1234, // Optional VarStore ID
87 name = MyIfrNVData, // Define referenced name in vfr
88 guid = FORMSET_GUID; // GUID of this buffer storage
89
90 //
91 // Define another Buffer Storage
92 //
93 varstore MY_DATA2,
94 name = MyIfrNVData2,
95 guid = FORMSET_GUID;
96
97 //
98 // Define a EFI variable Storage (EFI_IFR_VARSTORE_EFI)
99 //
100 efivarstore MyEfiVar, // Define referenced name in vfr
101 attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS, // EFI variable attribures
102 name = STRING_TOKEN(STR_VAR_NAME), // EFI variable name
103 varsize = 1, // Size of the EFI variable
104 guid = FORMSET_GUID; // EFI variable GUID
105
106 //
107 // Define a Form (EFI_IFR_FORM)
108 //
109 form formid = 1, // Form ID
110 title = STRING_TOKEN(STR_FORM1_TITLE); // Form title
111
112 subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT);
113
114 subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
115
116 //
117 // Define a display only text (EFI_IFR_TEXT)
118 //
119 text
120 help = STRING_TOKEN(STR_TEXT_HELP), // Help string
121 text = STRING_TOKEN(STR_CPU_STRING), // Prompt string
122 text = STRING_TOKEN(STR_CPU_STRING2); // TextTwo
123
124 text
125 help = STRING_TOKEN(STR_EXIT_TEXT),
126 text = STRING_TOKEN(STR_EXIT_TEXT),
127 text = STRING_TOKEN(STR_EXIT_TEXT),
128 flags = INTERACTIVE,
129 key = 0x1237;
130
131 text
132 help = STRING_TOKEN(STR_SAVE_TEXT),
133 text = STRING_TOKEN(STR_SAVE_TEXT),
134 text = STRING_TOKEN(STR_SAVE_TEXT),
135 flags = INTERACTIVE,
136 key = 0x1238;
137
138 //
139 // Define oneof (EFI_IFR_ONE_OF)
140 //
141 oneof varid = MyIfrNVData.SuppressGrayOutSomething, // Use "DataStructure.Member" to reference Buffer Storage
142 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
143 help = STRING_TOKEN(STR_ONE_OF_HELP),
144 //
145 // Define an option (EFI_IFR_ONE_OF_OPTION)
146 //
147 option text = STRING_TOKEN(STR_ONE_OF_TEXT4), value = 0x0, flags = 0;
148 option text = STRING_TOKEN(STR_ONE_OF_TEXT5), value = 0x1, flags = 0;
149 //
150 // DEFAULT indicate this option will be marked with EFI_IFR_OPTION_DEFAULT
151 //
152 option text = STRING_TOKEN(STR_ONE_OF_TEXT6), value = 0x2, flags = DEFAULT;
153 endoneof;
154
155 oneof varid = MyIfrNVData.BootOrderLarge,
156 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
157 help = STRING_TOKEN(STR_ONE_OF_HELP),
158 option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = 0;
159 option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = DEFAULT;
160 endoneof;
161
162 grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
163 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
164
165 checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
166 prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
167 help = STRING_TOKEN(STR_CHECK_BOX_HELP),
168 //
169 // CHECKBOX_DEFAULT indicate this checkbox is marked with EFI_IFR_CHECKBOX_DEFAULT
170 // CHECKBOX_DEFAULT_MFG indicate EFI_IFR_CHECKBOX_DEFAULT_MFG.
171 //
172 flags = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG,
173 key = 0,
174 default = 1,
175 endcheckbox;
176 endif;
177 endif;
178
179 //
180 // Ordered list:
181 // sizeof(MyIfrNVData) storage must be UINT8 array, and
182 // size written for the variable must be size of the entire
183 // variable.
184 //
185 //
186 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
187
188 //
189 // label is defined as an anchor where you want to insert some dynamic
190 // opcodes created on-the-fly
191 //
192 label LABEL_UPDATE_BBS;
193
194 orderedlist
195 varid = MyIfrNVData.BootOrder,
196 prompt = STRING_TOKEN(STR_BOOT_OPTIONS),
197 help = STRING_TOKEN(STR_NULL_STRING),
198 option text = STRING_TOKEN(STR_BOOT_OPTION2), value = 2, flags = RESET_REQUIRED;
199 option text = STRING_TOKEN(STR_BOOT_OPTION1), value = 1, flags = RESET_REQUIRED;
200 option text = STRING_TOKEN(STR_BOOT_OPTION3), value = 3, flags = RESET_REQUIRED;
201 suppressif ideqval MyIfrNVData.BootOrderLarge == 0;
202 option text = STRING_TOKEN(STR_BOOT_OPTION4), value = 4, flags = 0;
203 endif
204 endlist;
205
206 //
207 // label should be paired with each other
208 //
209 label LABEL_END;
210
211 endif; // end suppressif
212
213 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x2;
214 orderedlist
215 varid = MyIfrNVData.OrderedList,
216 prompt = STRING_TOKEN(STR_TEST_OPCODE),
217 help = STRING_TOKEN(STR_TEXT_HELP),
218 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 3, flags = RESET_REQUIRED;
219 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 2, flags = RESET_REQUIRED;
220 option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 1, flags = RESET_REQUIRED;
221 endlist;
222 endif;
223
224 label 100;
225
226 //
227 // Define a hyperlink (EFI_IFR_REF)
228 //
229 goto 0x1234, // Destination Form ID
230 prompt = STRING_TOKEN(STR_GOTO_DYNAMIC), // Prompt string
231 help = STRING_TOKEN(STR_GOTO_HELP), // Help string
232 flags = INTERACTIVE, // INTERACTIVE indicate it's marked with EFI_IFR_FLAG_CALLBACK
233 key = 0x1234; // Question ID which will be passed-in in COnfigAccess.Callback()
234
235 goto 0x1234,
236 prompt = STRING_TOKEN(STR_GOTO_DYNAMIC2),
237 help = STRING_TOKEN(STR_GOTO_HELP),
238 flags = INTERACTIVE,
239 key = 0x1235;
240
241 oneof varid = MyIfrNVData.TestLateCheck,
242 prompt = STRING_TOKEN(STR_TEST_OPCODE),
243 help = STRING_TOKEN(STR_ONE_OF_HELP),
244 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
245 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
246
247 endoneof;
248
249 oneof varid = MyIfrNVData.TestLateCheck2,
250 prompt = STRING_TOKEN(STR_TEST_OPCODE2),
251 help = STRING_TOKEN(STR_ONE_OF_HELP),
252 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = DEFAULT | RESET_REQUIRED;
253 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = RESET_REQUIRED;
254
255 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
256 ideqid MyIfrNVData.TestLateCheck == MyIfrNVData.TestLateCheck2
257 endif
258
259 endoneof;
260
261 oneof varid = MyIfrNVData.QuestionAboutTreeHugging,
262 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
263 help = STRING_TOKEN(STR_ONE_OF_HELP),
264 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
265 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
266 option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 0x03, flags = RESET_REQUIRED;
267
268 endoneof;
269
270 //
271 // Define a string (EFI_IFR_STRING)
272 //
273 string varid = MyIfrNVData.MyStringData,
274 prompt = STRING_TOKEN(STR_MY_STRING_PROMPT2),
275 help = STRING_TOKEN(STR_MY_STRING_HELP2),
276 flags = INTERACTIVE,
277 key = 0x1236,
278 minsize = 6,
279 maxsize = 20,
280 endstring;
281
282 //
283 // Define a numeric (EFI_IFR_NUMERIC)
284 //
285 numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
286 prompt = STRING_TOKEN(STR_NUMERIC_READONLY_PROMPT),
287 help = STRING_TOKEN(STR_NUMERIC_HELP0),
288 flags = READ_ONLY, // READ_ONLY indicate it's marked with EFI_IFR_FLAG_READ_ONLY
289 minimum = 0,
290 maximum = 0xf0,
291 step = 0, // Stepping of 0 equates to a manual entering
292 // of a value, otherwise it will be adjusted by "+"/"-"
293 default = 20,
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 = 20,
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 prompt = STRING_TOKEN(STR_TALL_HEX_PROMPT),
317 help = STRING_TOKEN(STR_NUMERIC_HELP1),
318 flags = DISPLAY_UINT_HEX, // Display in HEX format (if not specified, default is in decimal format)
319 minimum = 0,
320 maximum = 250,
321 default = 175,
322
323 endnumeric;
324
325 numeric varid = MyIfrNVData2.Field8, // Reference of MyIfrNVData2 storage
326 prompt = STRING_TOKEN(STR_MYIFRNVDATA2_HEX_PROMPT),
327 help = STRING_TOKEN(STR_MYIFRNVDATA2_HEX_HELP),
328 flags = DISPLAY_UINT_HEX, // Display in HEX format (if not specified, default is in decimal format)
329 minimum = 0,
330 maximum = 250,
331 default = 175,
332
333 endnumeric;
334
335 label LABEL_1_VALUE;
336 label LABEL_2_VALUE;
337
338 grayoutif ideqval MyIfrNVData.HowOldAreYouInYearsManual == 23 AND ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
339 numeric varid = MyIfrNVData.HowOldAreYouInYears,
340 prompt = STRING_TOKEN(STR_NUMERIC_STEP_PROMPT),
341 help = STRING_TOKEN(STR_NUMERIC_HELP2),
342 minimum = 0,
343 maximum = 243,
344 step = 1,
345 default = 18,
346
347 endnumeric;
348 endif;
349
350 //
351 // Non-interactive password, validate by Setup Browser
352 //
353 password varid = MyIfrNVData.WhatIsThePassword,
354 prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
355 help = STRING_TOKEN(STR_PASSWORD_HELP),
356 minsize = 6,
357 maxsize = 20, // new opcode
358 endpassword;
359
360 string varid = MyIfrNVData.PasswordClearText,
361 prompt = STRING_TOKEN(STR_MY_STRING_PROMPT),
362 help = STRING_TOKEN(STR_MY_STRING_HELP),
363 minsize = 6,
364 maxsize = 0x14,
365 endstring;
366
367 //
368 // Interactive password, validate via ConfigAccess.Callback()
369 //
370 password varid = MyIfrNVData.WhatIsThePassword2,
371 prompt = STRING_TOKEN(STR_PASSWORD_CALLBACK_PROMPT),
372 help = STRING_TOKEN(STR_PASSWORD_HELP),
373 flags = INTERACTIVE,
374 key = 0x2000,
375 minsize = 6,
376 maxsize = 20, // new opcode
377 endpassword;
378
379 goto 2,
380 prompt = STRING_TOKEN(STR_GOTO_FORM2), //SecondSetupPage // this too has no end-op and basically it's a jump to a form ONLY
381 help = STRING_TOKEN(STR_GOTO_HELP);
382
383 goto 3,
384 prompt = STRING_TOKEN(STR_GOTO_FORM3), //ThirdSetupPage // 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 endform;
388
389 form formid = 2, // SecondSetupPage,
390 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
391
392
393 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
394 prompt = STRING_TOKEN(STR_DATE_PROMPT),
395 help = STRING_TOKEN(STR_DATE_YEAR_HELP),
396 minimum = 1998,
397 maximum = 2099,
398 step = 1,
399 default = 2004,
400
401 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
402 prompt = STRING_TOKEN(STR_DATE_PROMPT),
403 help = STRING_TOKEN(STR_DATE_MONTH_HELP),
404 minimum = 1,
405 maximum = 12,
406 step = 1,
407 default = 1,
408
409 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
410 prompt = STRING_TOKEN(STR_DATE_PROMPT),
411 help = STRING_TOKEN(STR_DATE_DAY_HELP),
412 minimum = 1,
413 maximum = 31,
414 step = 0x1,
415 default = 1,
416
417 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
418 ideqval Date.Day == 31
419 AND
420 ideqvallist Date.Month == 2 4 6 9 11
421 endif
422
423 //
424 // If the day is 30 AND month is 2
425 //
426 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
427 ideqval Date.Day == 30
428 AND
429 ideqval Date.Month == 2
430 endif
431
432 //
433 // If the day is 29 AND month is 2 AND it year is NOT a leapyear
434 //
435 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
436 ideqval Date.Day == 0x1D
437 AND
438 ideqval Date.Month == 2
439 AND
440 NOT
441 ideqvallist Date.Year == 2004 2008 20012 20016 2020 2024 2028 2032 2036
442 endif
443
444 enddate;
445
446 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
447 prompt = STRING_TOKEN(STR_TIME_PROMPT),
448 help = STRING_TOKEN(STR_TIME_HOUR_HELP),
449 minimum = 0,
450 maximum = 23,
451 step = 1,
452 default = 0,
453
454 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
455 prompt = STRING_TOKEN(STR_TIME_PROMPT),
456 help = STRING_TOKEN(STR_TIME_MINUTE_HELP),
457 minimum = 0,
458 maximum = 59,
459 step = 1,
460 default = 0,
461
462 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
463 prompt = STRING_TOKEN(STR_TIME_PROMPT),
464 help = STRING_TOKEN(STR_TIME_SECOND_HELP),
465 minimum = 0,
466 maximum = 59,
467 step = 1,
468 default = 0,
469
470 endtime;
471
472 checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
473 prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
474 help = STRING_TOKEN(STR_CHECK_BOX_HELP),
475 flags = CHECKBOX_DEFAULT,
476 key = 0,
477 endcheckbox;
478
479 text
480 help = STRING_TOKEN(STR_TEXT_HELP),
481 text = STRING_TOKEN(STR_TEXT_TEXT_1);
482
483 text
484 help = STRING_TOKEN(STR_TEXT_HELP),
485 text = STRING_TOKEN(STR_TEXT_TEXT_1),
486 text = STRING_TOKEN(STR_TEXT_TEXT_2);
487
488 goto 1,
489 prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage // this too has no end-op and basically it's a jump to a form ONLY
490 help = STRING_TOKEN(STR_GOTO_HELP);
491
492 endform;
493
494 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
495
496 grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
497 text
498 help = STRING_TOKEN(STR_TEXT_HELP),
499 text = STRING_TOKEN(STR_TEXT_TEXT_1);
500 endif;
501
502 endform;
503
504 form formid = 4, title = STRING_TOKEN(STR_FORM3_TITLE);
505
506 endform;
507
508 form formid = 0x1234, // Dynamically created page,
509 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
510
511 label 0x1234;
512 //
513 // This is where we will insert dynamic created opcodes
514 //
515 label LABEL_END;
516
517 endform;
518
519 endformset;