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
47 // NV data structure definition
58 #define LABEL_1_VALUE 0x01
59 #define LABEL_2_VALUE 0x1000
60 #define LABEL_UPDATE_BBS 0x2222
61 #define LABEL_END 0x2223
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,
71 // Notes: VfrCompiler will insert a Standard Default Storage declaration
72 // after the formset declaration. >00000040: 5C 06 00 00 00 00.
73 // So we don't need to declare the Standard Default.
74 // Please check the vfr.lst file for details.
75 // To enable list file for VFR, add "-l" to VfrCompile <Command> in [Build.Visual-Form-Representation-File] as follows:
76 // VfrCompile -l --no-pre-processing --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
80 // Define a Default Storage for Manufacturing Defauls. Attribut = 1 (EFI_HII_DEFAULT_CLASS_MANUFACTURING).
81 // Only if this Default Storage is defined, CHECKBOX_DEFAULT_MFG can be used for CheckBox.
83 defaultstore MfgDefault, prompt = STRING_TOKEN (STR_DEFAULTSTORE_MFG), attribute = 1;
86 // Define a Safe Deafult Storage. Attribute = 2 (EFI_HII_DEFAULT_CLASS_SAFE) as an example.
87 // It is not referenced.
89 defaultstore SafeDefault, prompt = STRING_TOKEN (STR_DEFAULTSTORE_SAFE), attribute = 2;
92 // Define a Buffer Storage (EFI_IFR_VARSTORE)
94 varstore DRIVER_SAMPLE_CONFIGURATION, // This is the data structure type
95 varid = 0x1234, // Optional VarStore ID
96 name = MyIfrNVData, // Define referenced name in vfr
97 guid = FORMSET_GUID; // GUID of this buffer storage
100 // Define another Buffer Storage
107 // Define a EFI variable Storage (EFI_IFR_VARSTORE_EFI)
109 efivarstore MyEfiVar, // Define referenced name in vfr
110 attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS, // EFI variable attribures
111 name = STRING_TOKEN(STR_VAR_NAME), // EFI variable name
112 varsize = 1, // Size of the EFI variable
113 guid = FORMSET_GUID; // EFI variable GUID
116 // Define a Form (EFI_IFR_FORM)
118 form formid = 1, // Form ID
119 title = STRING_TOKEN(STR_FORM1_TITLE); // Form title
121 subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT);
123 subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
126 // Define a display only text (EFI_IFR_TEXT)
129 help = STRING_TOKEN(STR_TEXT_HELP), // Help string
130 text = STRING_TOKEN(STR_CPU_STRING), // Prompt string
131 text = STRING_TOKEN(STR_CPU_STRING2); // TextTwo
134 help = STRING_TOKEN(STR_EXIT_TEXT),
135 text = STRING_TOKEN(STR_EXIT_TEXT),
136 text = STRING_TOKEN(STR_EXIT_TEXT),
141 help = STRING_TOKEN(STR_SAVE_TEXT),
142 text = STRING_TOKEN(STR_SAVE_TEXT),
143 text = STRING_TOKEN(STR_SAVE_TEXT),
148 // Define oneof (EFI_IFR_ONE_OF)
150 oneof varid = MyIfrNVData.SuppressGrayOutSomething, // Use "DataStructure.Member" to reference Buffer Storage
151 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
152 help = STRING_TOKEN(STR_ONE_OF_HELP),
154 // Define an option (EFI_IFR_ONE_OF_OPTION)
156 option text = STRING_TOKEN(STR_ONE_OF_TEXT4), value = 0x0, flags = 0;
157 option text = STRING_TOKEN(STR_ONE_OF_TEXT5), value = 0x1, flags = 0;
159 // DEFAULT indicate this option will be marked with EFI_IFR_OPTION_DEFAULT
161 option text = STRING_TOKEN(STR_ONE_OF_TEXT6), value = 0x2, flags = DEFAULT;
164 oneof varid = MyIfrNVData.BootOrderLarge,
165 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
166 help = STRING_TOKEN(STR_ONE_OF_HELP),
167 option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = 0;
168 option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = DEFAULT;
171 grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
172 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
174 checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
175 prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
176 help = STRING_TOKEN(STR_CHECK_BOX_HELP),
178 // CHECKBOX_DEFAULT indicate this checkbox is marked with EFI_IFR_CHECKBOX_DEFAULT
179 // CHECKBOX_DEFAULT_MFG indicate EFI_IFR_CHECKBOX_DEFAULT_MFG.
181 flags = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG,
190 // sizeof(MyIfrNVData) storage must be UINT8 array, and
191 // size written for the variable must be size of the entire
195 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
198 // label is defined as an anchor where you want to insert some dynamic
199 // opcodes created on-the-fly
201 label LABEL_UPDATE_BBS;
204 varid = MyIfrNVData.BootOrder,
205 prompt = STRING_TOKEN(STR_BOOT_OPTIONS),
206 help = STRING_TOKEN(STR_NULL_STRING),
207 option text = STRING_TOKEN(STR_BOOT_OPTION2), value = 2, flags = RESET_REQUIRED;
208 option text = STRING_TOKEN(STR_BOOT_OPTION1), value = 1, flags = RESET_REQUIRED;
209 option text = STRING_TOKEN(STR_BOOT_OPTION3), value = 3, flags = RESET_REQUIRED;
210 suppressif ideqval MyIfrNVData.BootOrderLarge == 0;
211 option text = STRING_TOKEN(STR_BOOT_OPTION4), value = 4, flags = 0;
216 // label should be paired with each other
220 endif; // end suppressif
222 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x2;
224 varid = MyIfrNVData.OrderedList,
225 prompt = STRING_TOKEN(STR_TEST_OPCODE),
226 help = STRING_TOKEN(STR_TEXT_HELP),
227 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 3, flags = RESET_REQUIRED;
228 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 2, flags = RESET_REQUIRED;
229 option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 1, flags = RESET_REQUIRED;
236 // Define a hyperlink (EFI_IFR_REF)
238 goto 0x1234, // Destination Form ID
239 prompt = STRING_TOKEN(STR_GOTO_DYNAMIC), // Prompt string
240 help = STRING_TOKEN(STR_GOTO_HELP), // Help string
241 flags = INTERACTIVE, // INTERACTIVE indicate it's marked with EFI_IFR_FLAG_CALLBACK
242 key = 0x1234; // Question ID which will be passed-in in COnfigAccess.Callback()
245 prompt = STRING_TOKEN(STR_GOTO_DYNAMIC2),
246 help = STRING_TOKEN(STR_GOTO_HELP),
250 oneof varid = MyIfrNVData.TestLateCheck,
251 prompt = STRING_TOKEN(STR_TEST_OPCODE),
252 help = STRING_TOKEN(STR_ONE_OF_HELP),
253 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
254 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
258 oneof varid = MyIfrNVData.TestLateCheck2,
259 prompt = STRING_TOKEN(STR_TEST_OPCODE2),
260 help = STRING_TOKEN(STR_ONE_OF_HELP),
261 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = DEFAULT | RESET_REQUIRED;
262 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = RESET_REQUIRED;
264 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
265 ideqid MyIfrNVData.TestLateCheck == MyIfrNVData.TestLateCheck2
270 oneof varid = MyIfrNVData.QuestionAboutTreeHugging,
271 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
272 help = STRING_TOKEN(STR_ONE_OF_HELP),
273 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
274 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
275 option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 0x03, flags = RESET_REQUIRED;
280 // Define a string (EFI_IFR_STRING)
282 string varid = MyIfrNVData.MyStringData,
283 prompt = STRING_TOKEN(STR_MY_STRING_PROMPT2),
284 help = STRING_TOKEN(STR_MY_STRING_HELP2),
292 // Define a numeric (EFI_IFR_NUMERIC)
294 numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
295 prompt = STRING_TOKEN(STR_NUMERIC_READONLY_PROMPT),
296 help = STRING_TOKEN(STR_NUMERIC_HELP0),
297 flags = READ_ONLY, // READ_ONLY indicate it's marked with EFI_IFR_FLAG_READ_ONLY
300 step = 0, // Stepping of 0 equates to a manual entering
301 // of a value, otherwise it will be adjusted by "+"/"-"
306 numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
307 prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
308 help = STRING_TOKEN(STR_NUMERIC_HELP0),
314 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
315 ideqval MyIfrNVData.HowOldAreYouInYearsManual == 99
317 ideqid MyIfrNVData.HowOldAreYouInYearsManual == MyEfiVar
319 ideqvallist MyIfrNVData.HowOldAreYouInYearsManual == 1 3 5 7
324 numeric varid = MyEfiVar, // Reference of EFI variable storage
325 prompt = STRING_TOKEN(STR_TALL_HEX_PROMPT),
326 help = STRING_TOKEN(STR_NUMERIC_HELP1),
327 flags = DISPLAY_UINT_HEX, // Display in HEX format (if not specified, default is in decimal format)
337 grayoutif ideqval MyIfrNVData.HowOldAreYouInYearsManual == 23 AND ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
338 numeric varid = MyIfrNVData.HowOldAreYouInYears,
339 prompt = STRING_TOKEN(STR_NUMERIC_STEP_PROMPT),
340 help = STRING_TOKEN(STR_NUMERIC_HELP2),
350 // Non-interactive password, validate by Setup Browser
352 password varid = MyIfrNVData.WhatIsThePassword,
353 prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
354 help = STRING_TOKEN(STR_PASSWORD_HELP),
356 maxsize = 20, // new opcode
359 string varid = MyIfrNVData.PasswordClearText,
360 prompt = STRING_TOKEN(STR_MY_STRING_PROMPT),
361 help = STRING_TOKEN(STR_MY_STRING_HELP),
367 // Interactive password, validate via ConfigAccess.Callback()
369 password varid = MyIfrNVData.WhatIsThePassword2,
370 prompt = STRING_TOKEN(STR_PASSWORD_CALLBACK_PROMPT),
371 help = STRING_TOKEN(STR_PASSWORD_HELP),
375 maxsize = 20, // new opcode
379 prompt = STRING_TOKEN(STR_GOTO_FORM2), //SecondSetupPage // this too has no end-op and basically it's a jump to a form ONLY
380 help = STRING_TOKEN(STR_GOTO_HELP);
383 prompt = STRING_TOKEN(STR_GOTO_FORM3), //ThirdSetupPage // this too has no end-op and basically it's a jump to a form ONLY
384 help = STRING_TOKEN(STR_GOTO_HELP);
388 form formid = 2, // SecondSetupPage,
389 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
392 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
393 prompt = STRING_TOKEN(STR_DATE_PROMPT),
394 help = STRING_TOKEN(STR_DATE_YEAR_HELP),
400 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
401 prompt = STRING_TOKEN(STR_DATE_PROMPT),
402 help = STRING_TOKEN(STR_DATE_MONTH_HELP),
408 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
409 prompt = STRING_TOKEN(STR_DATE_PROMPT),
410 help = STRING_TOKEN(STR_DATE_DAY_HELP),
416 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
417 ideqval Date.Day == 31
419 ideqvallist Date.Month == 2 4 6 9 11
423 // If the day is 30 AND month is 2
425 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
426 ideqval Date.Day == 30
428 ideqval Date.Month == 2
432 // If the day is 29 AND month is 2 AND it year is NOT a leapyear
434 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
435 ideqval Date.Day == 0x1D
437 ideqval Date.Month == 2
440 ideqvallist Date.Year == 2004 2008 20012 20016 2020 2024 2028 2032 2036
445 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
446 prompt = STRING_TOKEN(STR_TIME_PROMPT),
447 help = STRING_TOKEN(STR_TIME_HOUR_HELP),
453 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
454 prompt = STRING_TOKEN(STR_TIME_PROMPT),
455 help = STRING_TOKEN(STR_TIME_MINUTE_HELP),
461 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
462 prompt = STRING_TOKEN(STR_TIME_PROMPT),
463 help = STRING_TOKEN(STR_TIME_SECOND_HELP),
471 checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
472 prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
473 help = STRING_TOKEN(STR_CHECK_BOX_HELP),
474 flags = CHECKBOX_DEFAULT,
479 help = STRING_TOKEN(STR_TEXT_HELP),
480 text = STRING_TOKEN(STR_TEXT_TEXT_1);
483 help = STRING_TOKEN(STR_TEXT_HELP),
484 text = STRING_TOKEN(STR_TEXT_TEXT_1),
485 text = STRING_TOKEN(STR_TEXT_TEXT_2);
488 prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage // this too has no end-op and basically it's a jump to a form ONLY
489 help = STRING_TOKEN(STR_GOTO_HELP);
493 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 grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
497 help = STRING_TOKEN(STR_TEXT_HELP),
498 text = STRING_TOKEN(STR_TEXT_TEXT_1);
503 form formid = 4, title = STRING_TOKEN(STR_FORM3_TITLE);
507 form formid = 0x1234, // Dynamically created page,
508 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
512 // This is where we will insert dynamic created opcodes