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