3 // Sample Setup formset.
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
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.
17 #include "NVDataStruc.h"
20 // Formset class used by Device Manager
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
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
39 // EFI Variable attributes
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
49 #define LABEL_1_VALUE 0x01
50 #define LABEL_2_VALUE 0x1000
51 #define LABEL_UPDATE_BBS 0x2222
52 #define LABEL_END 0x2223
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,
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
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.
74 defaultstore MfgDefault, prompt = STRING_TOKEN (STR_DEFAULTSTORE_MFG), attribute = 1;
77 // Define a Safe Deafult Storage. Attribute = 2 (EFI_HII_DEFAULT_CLASS_SAFE) as an example.
78 // It is not referenced.
80 defaultstore SafeDefault, prompt = STRING_TOKEN (STR_DEFAULTSTORE_SAFE), attribute = 2;
83 // Define a Buffer Storage (EFI_IFR_VARSTORE)
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
91 // Define another Buffer Storage
98 // Define a EFI variable Storage (EFI_IFR_VARSTORE_EFI)
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
107 // Define a Form (EFI_IFR_FORM)
109 form formid = 1, // Form ID
110 title = STRING_TOKEN(STR_FORM1_TITLE); // Form title
112 subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT);
114 subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
117 // Define a display only text (EFI_IFR_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
125 help = STRING_TOKEN(STR_EXIT_TEXT),
126 text = STRING_TOKEN(STR_EXIT_TEXT),
127 text = STRING_TOKEN(STR_EXIT_TEXT),
132 help = STRING_TOKEN(STR_SAVE_TEXT),
133 text = STRING_TOKEN(STR_SAVE_TEXT),
134 text = STRING_TOKEN(STR_SAVE_TEXT),
139 // Define oneof (EFI_IFR_ONE_OF)
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),
145 // Define an option (EFI_IFR_ONE_OF_OPTION)
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;
150 // DEFAULT indicate this option will be marked with EFI_IFR_OPTION_DEFAULT
152 option text = STRING_TOKEN(STR_ONE_OF_TEXT6), value = 0x2, flags = DEFAULT;
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;
162 grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
163 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
165 checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
166 prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
167 help = STRING_TOKEN(STR_CHECK_BOX_HELP),
169 // CHECKBOX_DEFAULT indicate this checkbox is marked with EFI_IFR_CHECKBOX_DEFAULT
170 // CHECKBOX_DEFAULT_MFG indicate EFI_IFR_CHECKBOX_DEFAULT_MFG.
172 flags = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG,
181 // sizeof(MyIfrNVData) storage must be UINT8 array, and
182 // size written for the variable must be size of the entire
186 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
189 // label is defined as an anchor where you want to insert some dynamic
190 // opcodes created on-the-fly
192 label LABEL_UPDATE_BBS;
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;
207 // label should be paired with each other
211 endif; // end suppressif
213 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x2;
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;
227 // Define a hyperlink (EFI_IFR_REF)
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()
236 prompt = STRING_TOKEN(STR_GOTO_DYNAMIC2),
237 help = STRING_TOKEN(STR_GOTO_HELP),
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;
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;
255 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
256 ideqid MyIfrNVData.TestLateCheck == MyIfrNVData.TestLateCheck2
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;
271 // Define a string (EFI_IFR_STRING)
273 string varid = MyIfrNVData.MyStringData,
274 prompt = STRING_TOKEN(STR_MY_STRING_PROMPT2),
275 help = STRING_TOKEN(STR_MY_STRING_HELP2),
283 // Define a numeric (EFI_IFR_NUMERIC)
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
291 step = 0, // Stepping of 0 equates to a manual entering
292 // of a value, otherwise it will be adjusted by "+"/"-"
297 numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
298 prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
299 help = STRING_TOKEN(STR_NUMERIC_HELP0),
305 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
306 ideqval MyIfrNVData.HowOldAreYouInYearsManual == 99
308 ideqid MyIfrNVData.HowOldAreYouInYearsManual == MyEfiVar
310 ideqvallist MyIfrNVData.HowOldAreYouInYearsManual == 1 3 5 7
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)
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)
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),
351 // Non-interactive password, validate by Setup Browser
353 password varid = MyIfrNVData.WhatIsThePassword,
354 prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
355 help = STRING_TOKEN(STR_PASSWORD_HELP),
357 maxsize = 20, // new opcode
360 string varid = MyIfrNVData.PasswordClearText,
361 prompt = STRING_TOKEN(STR_MY_STRING_PROMPT),
362 help = STRING_TOKEN(STR_MY_STRING_HELP),
368 // Interactive password, validate via ConfigAccess.Callback()
370 password varid = MyIfrNVData.WhatIsThePassword2,
371 prompt = STRING_TOKEN(STR_PASSWORD_CALLBACK_PROMPT),
372 help = STRING_TOKEN(STR_PASSWORD_HELP),
376 maxsize = 20, // new opcode
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);
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);
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
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),
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),
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),
417 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
418 ideqval Date.Day == 31
420 ideqvallist Date.Month == 2 4 6 9 11
424 // If the day is 30 AND month is 2
426 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
427 ideqval Date.Day == 30
429 ideqval Date.Month == 2
433 // If the day is 29 AND month is 2 AND it year is NOT a leapyear
435 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
436 ideqval Date.Day == 0x1D
438 ideqval Date.Month == 2
441 ideqvallist Date.Year == 2004 2008 20012 20016 2020 2024 2028 2032 2036
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),
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),
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),
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,
480 help = STRING_TOKEN(STR_TEXT_HELP),
481 text = STRING_TOKEN(STR_TEXT_TEXT_1);
484 help = STRING_TOKEN(STR_TEXT_HELP),
485 text = STRING_TOKEN(STR_TEXT_TEXT_1),
486 text = STRING_TOKEN(STR_TEXT_TEXT_2);
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);
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
496 grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
498 help = STRING_TOKEN(STR_TEXT_HELP),
499 text = STRING_TOKEN(STR_TEXT_TEXT_1);
504 form formid = 4, title = STRING_TOKEN(STR_FORM3_TITLE);
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
513 // This is where we will insert dynamic created opcodes