]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
Add two new methods to get default value, also add sample code in sample driver.
[mirror_edk2.git] / MdeModulePkg / Universal / DriverSampleDxe / Vfr.vfr
1 ///** @file
2 //
3 // Sample Setup formset.
4 //
5 // Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
6 // 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 //
93 // Define a Name/Value Storage (EFI_IFR_VARSTORE_NAME_VALUE)
94 //
95 namevaluevarstore MyNameValueVar, // Define storage reference name in vfr
96 name = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME0), // Define Name list of this storage, refer it by MyNameValueVar[0]
97 name = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME1), // Define Name list of this storage, refer it by MyNameValueVar[1]
98 name = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME2), // Define Name list of this storage, refer it by MyNameValueVar[2]
99 guid = FORMSET_GUID; // GUID of this Name/Value storage
100
101 defaultstore MyStandardDefault,
102 prompt = STRING_TOKEN(STR_STANDARD_DEFAULT_PROMPT),
103 attribute = 0x0000; // Default ID: 0000 standard default
104
105 defaultstore MyManufactureDefault,
106 prompt = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_PROMPT),
107 attribute = 0x0001; // Default ID: 0001 manufacture default
108
109 //
110 // Define a Form (EFI_IFR_FORM)
111 //
112 form formid = 1, // Form ID
113 title = STRING_TOKEN(STR_FORM1_TITLE); // Form title
114
115 subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT);
116
117 subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
118
119 //
120 // Define a display only text (EFI_IFR_TEXT)
121 //
122 text
123 help = STRING_TOKEN(STR_TEXT_HELP), // Help string
124 text = STRING_TOKEN(STR_CPU_STRING), // Prompt string
125 text = STRING_TOKEN(STR_CPU_STRING2); // TextTwo
126
127 //
128 // Define action button (EFI_IFR_ACTION)
129 //
130 text
131 help = STRING_TOKEN(STR_EXIT_TEXT),
132 text = STRING_TOKEN(STR_EXIT_TEXT),
133 text = STRING_TOKEN(STR_EXIT_TEXT),
134 flags = INTERACTIVE, // VfrCompiler will generate opcode EFI_IFR_ACTION for Text marked as INTERACTIVE
135 key = 0x1237;
136
137 text
138 help = STRING_TOKEN(STR_SAVE_TEXT),
139 text = STRING_TOKEN(STR_SAVE_TEXT),
140 text = STRING_TOKEN(STR_SAVE_TEXT),
141 flags = INTERACTIVE,
142 key = 0x1238;
143
144 //
145 // Define oneof (EFI_IFR_ONE_OF)
146 //
147 oneof name = MyOneOf, // Define reference name for Question
148 varid = MyIfrNVData.SuppressGrayOutSomething, // Use "DataStructure.Member" to reference Buffer Storage
149 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
150 help = STRING_TOKEN(STR_ONE_OF_HELP),
151 //
152 // Define an option (EFI_IFR_ONE_OF_OPTION)
153 //
154 option text = STRING_TOKEN(STR_ONE_OF_TEXT4), value = 0x0, flags = 0;
155 option text = STRING_TOKEN(STR_ONE_OF_TEXT5), value = 0x1, flags = 0;
156 //
157 // DEFAULT indicate this option will be marked with EFI_IFR_OPTION_DEFAULT
158 //
159 option text = STRING_TOKEN(STR_ONE_OF_TEXT6), value = 0x2, flags = DEFAULT;
160 endoneof;
161
162 oneof varid = MyIfrNVData.BootOrderLarge,
163 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
164 help = STRING_TOKEN(STR_ONE_OF_HELP),
165 default value = cond (pushthis == 0 ? 0 : cond ((questionref(MyOneOf) >> 0x4 & 0xF00) == 0x0 + 0x2 ? 0 : 1)),
166 option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = 0;
167 option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = 0;
168 endoneof;
169
170 grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
171 suppressif questionref(MyOneOf) == 0x0;
172
173 checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
174 prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
175 help = STRING_TOKEN(STR_CHECK_BOX_HELP),
176 //
177 // CHECKBOX_DEFAULT indicate this checkbox is marked with EFI_IFR_CHECKBOX_DEFAULT
178 // CHECKBOX_DEFAULT_MFG indicate EFI_IFR_CHECKBOX_DEFAULT_MFG.
179 //
180 flags = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG,
181 key = 0,
182 default = 1,
183 endcheckbox;
184 endif;
185 endif;
186
187 //
188 // Ordered list:
189 // sizeof(MyIfrNVData) storage must be UINT8 array, and
190 // size written for the variable must be size of the entire
191 // variable.
192 //
193 //
194 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
195
196 //
197 // label is defined as an anchor where you want to insert some dynamic
198 // opcodes created on-the-fly
199 //
200 label LABEL_UPDATE_BBS;
201
202 orderedlist
203 varid = MyIfrNVData.BootOrder,
204 prompt = STRING_TOKEN(STR_BOOT_OPTIONS),
205 help = STRING_TOKEN(STR_NULL_STRING),
206 option text = STRING_TOKEN(STR_BOOT_OPTION2), value = 2, flags = RESET_REQUIRED;
207 option text = STRING_TOKEN(STR_BOOT_OPTION1), value = 1, flags = RESET_REQUIRED;
208 option text = STRING_TOKEN(STR_BOOT_OPTION3), value = 3, flags = RESET_REQUIRED;
209 suppressif ideqval MyIfrNVData.BootOrderLarge == 0;
210 option text = STRING_TOKEN(STR_BOOT_OPTION4), value = 4, flags = RESET_REQUIRED;
211 endif
212 endlist;
213
214 //
215 // label should be paired with each other
216 //
217 label LABEL_END;
218
219 endif; // end suppressif
220
221 disableif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x2;
222 orderedlist
223 varid = MyIfrNVData.OrderedList,
224 prompt = STRING_TOKEN(STR_TEST_OPCODE),
225 help = STRING_TOKEN(STR_TEXT_HELP),
226 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 3, flags = RESET_REQUIRED;
227 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 2, flags = RESET_REQUIRED;
228 option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 1, flags = RESET_REQUIRED;
229 endlist;
230 endif;
231
232 label 100;
233
234 //
235 // Define a hyperlink (EFI_IFR_REF)
236 //
237 goto 0x1234, // Destination Form ID
238 prompt = STRING_TOKEN(STR_GOTO_DYNAMIC), // Prompt string
239 help = STRING_TOKEN(STR_GOTO_HELP), // Help string
240 flags = INTERACTIVE, // INTERACTIVE indicate it's marked with EFI_IFR_FLAG_CALLBACK
241 key = 0x1234; // Question ID which will be passed-in in COnfigAccess.Callback()
242
243 goto 0x1234,
244 prompt = STRING_TOKEN(STR_GOTO_DYNAMIC2),
245 help = STRING_TOKEN(STR_GOTO_HELP),
246 flags = INTERACTIVE,
247 key = 0x1235;
248
249 oneof varid = MyIfrNVData.TestLateCheck,
250 prompt = STRING_TOKEN(STR_TEST_OPCODE),
251 help = STRING_TOKEN(STR_ONE_OF_HELP),
252 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
253 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
254
255 endoneof;
256
257 oneof varid = MyIfrNVData.TestLateCheck2,
258 prompt = STRING_TOKEN(STR_TEST_OPCODE2),
259 help = STRING_TOKEN(STR_ONE_OF_HELP),
260 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = DEFAULT | RESET_REQUIRED;
261 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = RESET_REQUIRED;
262
263 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
264 ideqid MyIfrNVData.TestLateCheck == MyIfrNVData.TestLateCheck2
265 endif
266
267 endoneof;
268
269 oneof varid = MyIfrNVData.QuestionAboutTreeHugging,
270 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
271 help = STRING_TOKEN(STR_ONE_OF_HELP),
272 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
273 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
274 option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 0x03, flags = RESET_REQUIRED;
275
276 endoneof;
277
278 //
279 // Define a string (EFI_IFR_STRING)
280 //
281 string varid = MyIfrNVData.MyStringData,
282 prompt = STRING_TOKEN(STR_MY_STRING_PROMPT2),
283 help = STRING_TOKEN(STR_MY_STRING_HELP2),
284 flags = INTERACTIVE,
285 key = 0x1236,
286 minsize = 6,
287 maxsize = 40,
288 inconsistentif prompt = STRING_TOKEN(STR_STRING_CHECK_ERROR_POPUP),
289 pushthis != stringref(STRING_TOKEN(STR_STRING_CHECK))
290 endif
291 endstring;
292
293 //
294 // Define a numeric (EFI_IFR_NUMERIC)
295 //
296 numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
297 prompt = STRING_TOKEN(STR_NUMERIC_READONLY_PROMPT),
298 help = STRING_TOKEN(STR_NUMERIC_HELP0),
299 flags = READ_ONLY, // READ_ONLY indicate it's marked with EFI_IFR_FLAG_READ_ONLY
300 minimum = 0,
301 maximum = 0xf0,
302 step = 0, // Stepping of 0 equates to a manual entering
303 // of a value, otherwise it will be adjusted by "+"/"-"
304 default = 21, // defaultstore could be used to specify the default type
305 // If no defaultstore is specified, it implies Standard Default
306
307 endnumeric;
308
309 numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
310 prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
311 help = STRING_TOKEN(STR_NUMERIC_HELP0),
312 minimum = 0,
313 maximum = 0xf0,
314 step = 0,
315 default = 21,
316
317 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
318 ideqval MyIfrNVData.HowOldAreYouInYearsManual == 99
319 OR
320 ideqid MyIfrNVData.HowOldAreYouInYearsManual == MyEfiVar
321 OR
322 ideqvallist MyIfrNVData.HowOldAreYouInYearsManual == 1 3 5 7
323 endif
324
325 endnumeric;
326
327 numeric varid = MyEfiVar, // Reference of EFI variable storage
328 questionid = 0x1111,
329 prompt = STRING_TOKEN(STR_TALL_HEX_PROMPT),
330 help = STRING_TOKEN(STR_NUMERIC_HELP1),
331 flags = DISPLAY_UINT_HEX | INTERACTIVE, // Display in HEX format (if not specified, default is in decimal format)
332 minimum = 0,
333 maximum = 250,
334 default = 175,
335
336 endnumeric;
337
338 //
339 // Define numeric using Name/Value Storage
340 //
341 numeric varid = MyNameValueVar[0], // This numeric take NameValueVar0 as storage
342 prompt = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME0),
343 help = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME0_HELP),
344 //
345 // Size should be defined for numeric when use Name/Value storage
346 // Valid value for numerice size are: NUMERIC_SIZE_1, NUMERIC_SIZE_2, NUMERIC_SIZE_4 and NUMERIC_SIZE_8
347 //
348 flags = NUMERIC_SIZE_1, // Size of this numeric is 1 byte
349 minimum = 0,
350 maximum = 0xff,
351 step = 0,
352 endnumeric;
353
354 numeric varid = MyNameValueVar[1], // This numeric take NameValueVar1 as storage
355 prompt = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME1),
356 help = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME1_HELP),
357 flags = NUMERIC_SIZE_2, // Size of this numeric is 2 bytes
358 minimum = 0,
359 maximum = 0xffff,
360 step = 0,
361 endnumeric;
362
363 //
364 // Define string using Name/Value Storage
365 //
366 string varid = MyNameValueVar[2], // This string take NameValueVar2 as storage
367 prompt = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME2),
368 help = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME2_HELP),
369 minsize = 2,
370 maxsize = 0x14,
371 endstring;
372
373 label LABEL_1_VALUE;
374 label LABEL_2_VALUE;
375
376 grayoutif ideqval MyIfrNVData.HowOldAreYouInYearsManual == 23 AND ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
377 numeric varid = MyIfrNVData.HowOldAreYouInYears,
378 prompt = STRING_TOKEN(STR_NUMERIC_STEP_PROMPT),
379 help = STRING_TOKEN(STR_NUMERIC_HELP2),
380 minimum = 0,
381 maximum = 243,
382 step = 1,
383 default = 18, defaultstore = MyStandardDefault, // This is standard default value
384 default = 19, defaultstore = MyManufactureDefault, // This is manufacture default value
385
386 endnumeric;
387 endif;
388
389 numeric varid = MyIfrNVData.GetDefaultValueFromAccess,
390 questionid = 0x1239,
391 prompt = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_ACCESS_PROMPT),
392 help = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_ACCESS_HELP),
393 flags = DISPLAY_UINT_HEX | INTERACTIVE,
394 minimum = 0,
395 maximum = 255,
396 step = 1,
397 default = 18,
398 endnumeric;
399
400 numeric varid = MyIfrNVData.GetDefaultValueFromCallBack,
401 questionid = 0x1240,
402 prompt = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_CALLBACK_PROMPT),
403 help = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_CALLBACK_HELP),
404 flags = DISPLAY_UINT_HEX | INTERACTIVE,
405 minimum = 0,
406 maximum = 255,
407 step = 1,
408 default = 18,
409 endnumeric;
410
411 resetbutton
412 defaultstore = MyStandardDefault,
413 prompt = STRING_TOKEN(STR_STANDARD_DEFAULT_PROMPT),
414 help = STRING_TOKEN(STR_STANDARD_DEFAULT_HELP),
415 endresetbutton;
416
417 resetbutton
418 defaultstore = MyManufactureDefault,
419 prompt = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_PROMPT),
420 help = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_HELP),
421 endresetbutton;
422
423 //
424 // Non-interactive password, validate by Setup Browser
425 //
426 password varid = MyIfrNVData.WhatIsThePassword,
427 prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
428 help = STRING_TOKEN(STR_PASSWORD_HELP),
429 minsize = 6,
430 maxsize = 20,
431 endpassword;
432
433 string varid = MyIfrNVData.PasswordClearText,
434 prompt = STRING_TOKEN(STR_MY_STRING_PROMPT),
435 help = STRING_TOKEN(STR_MY_STRING_HELP),
436 minsize = 6,
437 maxsize = 0x14,
438 endstring;
439
440 //
441 // Interactive password, validate via ConfigAccess.Callback()
442 //
443 password varid = MyIfrNVData.WhatIsThePassword2,
444 prompt = STRING_TOKEN(STR_PASSWORD_CALLBACK_PROMPT),
445 help = STRING_TOKEN(STR_PASSWORD_HELP),
446 flags = INTERACTIVE,
447 key = 0x2000,
448 minsize = 6,
449 maxsize = 20,
450 endpassword;
451
452 //
453 // Sample use case for IFR Security op-code
454 //
455 grayoutif NOT security (EFI_USER_INFO_ACCESS_SETUP_ADMIN_GUID);
456 text
457 help = STRING_TOKEN(STR_TEXT_SECRUITY_TEST_HELP),
458 text = STRING_TOKEN(STR_TEXT_SECRUITY_TEST_TEXT);
459 endif;
460
461 goto 2,
462 prompt = STRING_TOKEN(STR_GOTO_FORM2), //SecondSetupPage // this too has no end-op and basically it's a jump to a form ONLY
463 help = STRING_TOKEN(STR_GOTO_HELP);
464
465 goto 3,
466 prompt = STRING_TOKEN(STR_GOTO_FORM3), //ThirdSetupPage // 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 goto 4,
470 prompt = STRING_TOKEN(STR_GOTO_FORM4), //FourthSetupPage // this too has no end-op and basically it's a jump to a form ONLY
471 help = STRING_TOKEN(STR_GOTO_HELP);
472
473 endform;
474
475 suppressif ideqval MyIfrNVData.BootOrderLarge == 0;
476 form formid = 2, // SecondSetupPage,
477 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
478
479
480 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
481 prompt = STRING_TOKEN(STR_DATE_PROMPT),
482 help = STRING_TOKEN(STR_DATE_HELP),
483 minimum = 1998,
484 maximum = 2099,
485 step = 1,
486 default = 2004,
487
488 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
489 prompt = STRING_TOKEN(STR_DATE_PROMPT),
490 help = STRING_TOKEN(STR_DATE_HELP),
491 minimum = 1,
492 maximum = 12,
493 step = 1,
494 default = 1,
495
496 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
497 prompt = STRING_TOKEN(STR_DATE_PROMPT),
498 help = STRING_TOKEN(STR_DATE_HELP),
499 minimum = 1,
500 maximum = 31,
501 step = 0x1,
502 default = 1,
503
504 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
505 ideqval Date.Day == 31
506 AND
507 ideqvallist Date.Month == 2 4 6 9 11
508 endif
509
510 //
511 // If the day is 30 AND month is 2
512 //
513 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
514 ideqval Date.Day == 30
515 AND
516 ideqval Date.Month == 2
517 endif
518
519 //
520 // If the day is 29 AND month is 2 AND it year is NOT a leapyear
521 //
522 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
523 ideqval Date.Day == 0x1D
524 AND
525 ideqval Date.Month == 2
526 AND
527 NOT
528 ideqvallist Date.Year == 2004 2008 20012 20016 2020 2024 2028 2032 2036
529 endif
530
531 enddate;
532
533 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
534 prompt = STRING_TOKEN(STR_TIME_PROMPT),
535 help = STRING_TOKEN(STR_TIME_HELP),
536 minimum = 0,
537 maximum = 23,
538 step = 1,
539 default = 0,
540
541 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
542 prompt = STRING_TOKEN(STR_TIME_PROMPT),
543 help = STRING_TOKEN(STR_TIME_HELP),
544 minimum = 0,
545 maximum = 59,
546 step = 1,
547 default = 0,
548
549 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
550 prompt = STRING_TOKEN(STR_TIME_PROMPT),
551 help = STRING_TOKEN(STR_TIME_HELP),
552 minimum = 0,
553 maximum = 59,
554 step = 1,
555 default = 0,
556
557 endtime;
558
559 time
560 name = MyTime,
561 varid = MyIfrNVData.Time,
562 prompt = STRING_TOKEN(STR_TIME_PROMPT),
563 help = STRING_TOKEN(STR_TIME_PROMPT),
564 flags = STORAGE_NORMAL,
565 default = 15:33:33,
566 endtime;
567
568 checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
569 prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
570 help = STRING_TOKEN(STR_CHECK_BOX_HELP),
571 flags = CHECKBOX_DEFAULT,
572 key = 0,
573 endcheckbox;
574
575 text
576 help = STRING_TOKEN(STR_TEXT_HELP),
577 text = STRING_TOKEN(STR_TEXT_TEXT_1);
578
579 text
580 help = STRING_TOKEN(STR_TEXT_HELP),
581 text = STRING_TOKEN(STR_TEXT_TEXT_1),
582 text = STRING_TOKEN(STR_TEXT_TEXT_2);
583
584 goto 1,
585 prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage // this too has no end-op and basically it's a jump to a form ONLY
586 help = STRING_TOKEN(STR_GOTO_HELP);
587
588 endform;
589 endif;
590
591 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
592
593 suppressif ideqval MyEfiVar == 111;
594 text
595 help = STRING_TOKEN(STR_TEXT_HELP),
596 text = STRING_TOKEN(STR_TEXT_TEXT_1);
597 endif;
598
599 goto 1,
600 prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage
601 help = STRING_TOKEN(STR_GOTO_HELP);
602
603 numeric varid = MyIfrNVData.DynamicRefresh,
604 prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
605 help = STRING_TOKEN(STR_NUMERIC_HELP0),
606 flags = INTERACTIVE,
607 key = 0x5678,
608 minimum = 0,
609 maximum = 0xff,
610 step = 0,
611 default = 0,
612 refresh interval = 3 // Refresh interval in seconds
613 endnumeric;
614
615 label LABEL_UPDATE2;
616 label LABEL_END;
617
618 endform;
619
620 formmap formid = 4,
621 maptitle = STRING_TOKEN(STR_SAMPL_MAP_METHOD);
622 mapguid = FORMSET_GUID;
623 maptitle = STRING_TOKEN(STR_STANDARD_MAP_METHOD);
624 mapguid = EFI_HII_STANDARD_FORM_GUID;
625
626 oneof varid = MyIfrNVData.SerialPortNo,
627 prompt = STRING_TOKEN(STR_SERIAL_PORT),
628 help = STRING_TOKEN(STR_ONE_OF_HELP),
629
630 read cond (get(MyIfrNVData.SerialPortStatus) != 0 ? 0 : cond ((get(MyIfrNVData.SerialPortIo) & 0xF00) >> 0x8 == get(MyIfrNVData.SerialPortIrq) - 1 ? UNDEFINED : map (get(MyIfrNVData.SerialPortIo) : 0x3f8,1; 0x2F8,2; 0x3E8,3; 0x2E8,4;)));
631 write set(MyIfrNVData.SerialPortStatus, pushthis != 0) AND set(MyIfrNVData.SerialPortIo, map (pushthis : 1,0x3F8; 2,0x2F8; 3,0x3E8; 4,0x2E8;)) AND set (MyIfrNVData.SerialPortIrq, map (pushthis: 1,4; 2,3; 3,4; 4,3;));
632
633 option text = STRING_TOKEN(STR_SERIAL_PORT_DISABLE), value = 0x0, flags = DEFAULT;
634 option text = STRING_TOKEN(STR_SERIAL_PORT1), value = 0x1, flags = 0;
635 option text = STRING_TOKEN(STR_SERIAL_PORT2), value = 0x2, flags = 0;
636 option text = STRING_TOKEN(STR_SERIAL_PORT3), value = 0x3, flags = 0;
637 option text = STRING_TOKEN(STR_SERIAL_PORT4), value = 0x4, flags = 0;
638 endoneof;
639
640 grayoutif TRUE;
641 checkbox varid = MyIfrNVData.SerialPortStatus,
642 prompt = STRING_TOKEN(STR_SERIAL_PORT_STATUS),
643 help = STRING_TOKEN(STR_CHECK_BOX_HELP),
644 endcheckbox;
645 endif;
646
647 grayoutif TRUE;
648 suppressif ideqval MyIfrNVData.SerialPortStatus == 0;
649 oneof varid = MyIfrNVData.SerialPortIo,
650 prompt = STRING_TOKEN(STR_SERIAL_PORT_IO_ADDRESS),
651 help = STRING_TOKEN(STR_ONE_OF_HELP),
652
653 option text = STRING_TOKEN(STR_SERIAL_PORT1_IOADDR), value = 0x3F8, flags = DEFAULT;
654 option text = STRING_TOKEN(STR_SERIAL_PORT2_IOADDR), value = 0x2F8, flags = 0;
655 option text = STRING_TOKEN(STR_SERIAL_PORT3_IOADDR), value = 0x3E8, flags = 0;
656 option text = STRING_TOKEN(STR_SERIAL_PORT4_IOADDR), value = 0x2E8, flags = 0;
657 endoneof;
658 endif;
659 endif;
660
661 grayoutif TRUE;
662 suppressif ideqval MyIfrNVData.SerialPortStatus == 0;
663 oneof varid = MyIfrNVData.SerialPortIrq,
664 prompt = STRING_TOKEN(STR_SERIAL_PORT_IRQ),
665 help = STRING_TOKEN(STR_ONE_OF_HELP),
666
667 option text = STRING_TOKEN(STR_SERIAL_PORT13_IRQ), value = 0x4, flags = DEFAULT;
668 option text = STRING_TOKEN(STR_SERIAL_PORT24_IRQ), value = 0x3, flags = 0;
669 endoneof;
670 endif;
671 endif;
672
673 goto 1,
674 prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage
675 help = STRING_TOKEN(STR_GOTO_HELP);
676
677 endform;
678
679 form formid = 0x1234, // Dynamically created page,
680 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
681
682 label LABEL_UPDATE1;
683 //
684 // This is where we will insert dynamic created opcodes
685 //
686 label LABEL_END;
687
688 endform;
689
690 endformset;