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