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
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,
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
69 // Define a Buffer Storage (EFI_IFR_VARSTORE)
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
77 // Define another Buffer Storage
84 // Define a EFI variable Storage (EFI_IFR_VARSTORE_EFI)
86 efivarstore MyEfiVar, // Define referenced name in vfr
87 attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS, // 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
92 defaultstore MyStandardDefault,
93 prompt = STRING_TOKEN(STR_STANDARD_DEFAULT_PROMPT),
94 attribute = 0x0000; // Default ID: 0000 standard default
96 defaultstore MyManufactureDefault,
97 prompt = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_PROMPT),
98 attribute = 0x0001; // Default ID: 0001 manufacture default
101 // Define a Form (EFI_IFR_FORM)
103 form formid = 1, // Form ID
104 title = STRING_TOKEN(STR_FORM1_TITLE); // Form title
106 subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT);
108 subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
111 // Define a display only text (EFI_IFR_TEXT)
114 help = STRING_TOKEN(STR_TEXT_HELP), // Help string
115 text = STRING_TOKEN(STR_CPU_STRING), // Prompt string
116 text = STRING_TOKEN(STR_CPU_STRING2); // TextTwo
119 // Define action button (EFI_IFR_ACTION)
122 help = STRING_TOKEN(STR_EXIT_TEXT),
123 text = STRING_TOKEN(STR_EXIT_TEXT),
124 text = STRING_TOKEN(STR_EXIT_TEXT),
125 flags = INTERACTIVE, // VfrCompiler will generate opcode EFI_IFR_ACTION for Text marked as INTERACTIVE
129 help = STRING_TOKEN(STR_SAVE_TEXT),
130 text = STRING_TOKEN(STR_SAVE_TEXT),
131 text = STRING_TOKEN(STR_SAVE_TEXT),
136 // Define oneof (EFI_IFR_ONE_OF)
138 oneof name = MyOneOf, // Define reference name for Question
139 varid = MyIfrNVData.SuppressGrayOutSomething, // Use "DataStructure.Member" to reference Buffer Storage
140 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
141 help = STRING_TOKEN(STR_ONE_OF_HELP),
143 // Define an option (EFI_IFR_ONE_OF_OPTION)
145 option text = STRING_TOKEN(STR_ONE_OF_TEXT4), value = 0x0, flags = 0;
146 option text = STRING_TOKEN(STR_ONE_OF_TEXT5), value = 0x1, flags = 0;
148 // DEFAULT indicate this option will be marked with EFI_IFR_OPTION_DEFAULT
150 option text = STRING_TOKEN(STR_ONE_OF_TEXT6), value = 0x2, flags = DEFAULT;
153 oneof varid = MyIfrNVData.BootOrderLarge,
154 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
155 help = STRING_TOKEN(STR_ONE_OF_HELP),
156 option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = 0;
157 option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = DEFAULT;
160 grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
161 suppressif questionref(MyOneOf) == 0x0;
163 checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
164 prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
165 help = STRING_TOKEN(STR_CHECK_BOX_HELP),
167 // CHECKBOX_DEFAULT indicate this checkbox is marked with EFI_IFR_CHECKBOX_DEFAULT
168 // CHECKBOX_DEFAULT_MFG indicate EFI_IFR_CHECKBOX_DEFAULT_MFG.
170 flags = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG,
179 // sizeof(MyIfrNVData) storage must be UINT8 array, and
180 // size written for the variable must be size of the entire
184 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
187 // label is defined as an anchor where you want to insert some dynamic
188 // opcodes created on-the-fly
190 label LABEL_UPDATE_BBS;
193 varid = MyIfrNVData.BootOrder,
194 prompt = STRING_TOKEN(STR_BOOT_OPTIONS),
195 help = STRING_TOKEN(STR_NULL_STRING),
196 option text = STRING_TOKEN(STR_BOOT_OPTION2), value = 2, flags = RESET_REQUIRED;
197 option text = STRING_TOKEN(STR_BOOT_OPTION1), value = 1, flags = RESET_REQUIRED;
198 option text = STRING_TOKEN(STR_BOOT_OPTION3), value = 3, flags = RESET_REQUIRED;
199 suppressif ideqval MyIfrNVData.BootOrderLarge == 0;
200 option text = STRING_TOKEN(STR_BOOT_OPTION4), value = 4, flags = RESET_REQUIRED;
205 // label should be paired with each other
209 endif; // end suppressif
211 suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x2;
213 varid = MyIfrNVData.OrderedList,
214 prompt = STRING_TOKEN(STR_TEST_OPCODE),
215 help = STRING_TOKEN(STR_TEXT_HELP),
216 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 3, flags = RESET_REQUIRED;
217 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 2, flags = RESET_REQUIRED;
218 option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 1, flags = RESET_REQUIRED;
225 // Define a hyperlink (EFI_IFR_REF)
227 goto 0x1234, // Destination Form ID
228 prompt = STRING_TOKEN(STR_GOTO_DYNAMIC), // Prompt string
229 help = STRING_TOKEN(STR_GOTO_HELP), // Help string
230 flags = INTERACTIVE, // INTERACTIVE indicate it's marked with EFI_IFR_FLAG_CALLBACK
231 key = 0x1234; // Question ID which will be passed-in in COnfigAccess.Callback()
234 prompt = STRING_TOKEN(STR_GOTO_DYNAMIC2),
235 help = STRING_TOKEN(STR_GOTO_HELP),
239 oneof varid = MyIfrNVData.TestLateCheck,
240 prompt = STRING_TOKEN(STR_TEST_OPCODE),
241 help = STRING_TOKEN(STR_ONE_OF_HELP),
242 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
243 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
247 oneof varid = MyIfrNVData.TestLateCheck2,
248 prompt = STRING_TOKEN(STR_TEST_OPCODE2),
249 help = STRING_TOKEN(STR_ONE_OF_HELP),
250 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = DEFAULT | RESET_REQUIRED;
251 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = RESET_REQUIRED;
253 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
254 ideqid MyIfrNVData.TestLateCheck == MyIfrNVData.TestLateCheck2
259 oneof varid = MyIfrNVData.QuestionAboutTreeHugging,
260 prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
261 help = STRING_TOKEN(STR_ONE_OF_HELP),
262 option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
263 option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
264 option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 0x03, flags = RESET_REQUIRED;
269 // Define a string (EFI_IFR_STRING)
271 string varid = MyIfrNVData.MyStringData,
272 prompt = STRING_TOKEN(STR_MY_STRING_PROMPT2),
273 help = STRING_TOKEN(STR_MY_STRING_HELP2),
281 // Define a numeric (EFI_IFR_NUMERIC)
283 numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
284 prompt = STRING_TOKEN(STR_NUMERIC_READONLY_PROMPT),
285 help = STRING_TOKEN(STR_NUMERIC_HELP0),
286 flags = READ_ONLY, // READ_ONLY indicate it's marked with EFI_IFR_FLAG_READ_ONLY
289 step = 0, // Stepping of 0 equates to a manual entering
290 // of a value, otherwise it will be adjusted by "+"/"-"
291 default = 21, // defaultstore could be used to specify the default type
292 // If no defaultstore is specified, it implies Standard Default
296 numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
297 prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
298 help = STRING_TOKEN(STR_NUMERIC_HELP0),
304 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
305 ideqval MyIfrNVData.HowOldAreYouInYearsManual == 99
307 ideqid MyIfrNVData.HowOldAreYouInYearsManual == MyEfiVar
309 ideqvallist MyIfrNVData.HowOldAreYouInYearsManual == 1 3 5 7
314 numeric varid = MyEfiVar, // Reference of EFI variable storage
315 prompt = STRING_TOKEN(STR_TALL_HEX_PROMPT),
316 help = STRING_TOKEN(STR_NUMERIC_HELP1),
317 flags = DISPLAY_UINT_HEX, // Display in HEX format (if not specified, default is in decimal format)
327 grayoutif ideqval MyIfrNVData.HowOldAreYouInYearsManual == 23 AND ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
328 numeric varid = MyIfrNVData.HowOldAreYouInYears,
329 prompt = STRING_TOKEN(STR_NUMERIC_STEP_PROMPT),
330 help = STRING_TOKEN(STR_NUMERIC_HELP2),
334 default = 18, defaultstore = MyStandardDefault, // This is standard default value
335 default = 19, defaultstore = MyManufactureDefault, // This is manufacture default value
341 defaultstore = MyStandardDefault,
342 prompt = STRING_TOKEN(STR_STANDARD_DEFAULT_PROMPT),
343 help = STRING_TOKEN(STR_STANDARD_DEFAULT_HELP),
347 defaultstore = MyManufactureDefault,
348 prompt = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_PROMPT),
349 help = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_HELP),
353 // Non-interactive password, validate by Setup Browser
355 password varid = MyIfrNVData.WhatIsThePassword,
356 prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
357 help = STRING_TOKEN(STR_PASSWORD_HELP),
362 string varid = MyIfrNVData.PasswordClearText,
363 prompt = STRING_TOKEN(STR_MY_STRING_PROMPT),
364 help = STRING_TOKEN(STR_MY_STRING_HELP),
370 // Interactive password, validate via ConfigAccess.Callback()
372 password varid = MyIfrNVData.WhatIsThePassword2,
373 prompt = STRING_TOKEN(STR_PASSWORD_CALLBACK_PROMPT),
374 help = STRING_TOKEN(STR_PASSWORD_HELP),
382 prompt = STRING_TOKEN(STR_GOTO_FORM2), //SecondSetupPage // this too has no end-op and basically it's a jump to a form ONLY
383 help = STRING_TOKEN(STR_GOTO_HELP);
386 prompt = STRING_TOKEN(STR_GOTO_FORM3), //ThirdSetupPage // this too has no end-op and basically it's a jump to a form ONLY
387 help = STRING_TOKEN(STR_GOTO_HELP);
391 form formid = 2, // SecondSetupPage,
392 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
395 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
396 prompt = STRING_TOKEN(STR_DATE_PROMPT),
397 help = STRING_TOKEN(STR_DATE_HELP),
403 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
404 prompt = STRING_TOKEN(STR_DATE_PROMPT),
405 help = STRING_TOKEN(STR_DATE_HELP),
411 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
412 prompt = STRING_TOKEN(STR_DATE_PROMPT),
413 help = STRING_TOKEN(STR_DATE_HELP),
419 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
420 ideqval Date.Day == 31
422 ideqvallist Date.Month == 2 4 6 9 11
426 // If the day is 30 AND month is 2
428 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
429 ideqval Date.Day == 30
431 ideqval Date.Month == 2
435 // If the day is 29 AND month is 2 AND it year is NOT a leapyear
437 inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
438 ideqval Date.Day == 0x1D
440 ideqval Date.Month == 2
443 ideqvallist Date.Year == 2004 2008 20012 20016 2020 2024 2028 2032 2036
448 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
449 prompt = STRING_TOKEN(STR_TIME_PROMPT),
450 help = STRING_TOKEN(STR_TIME_HELP),
456 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
457 prompt = STRING_TOKEN(STR_TIME_PROMPT),
458 help = STRING_TOKEN(STR_TIME_HELP),
464 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
465 prompt = STRING_TOKEN(STR_TIME_PROMPT),
466 help = STRING_TOKEN(STR_TIME_HELP),
474 checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
475 prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
476 help = STRING_TOKEN(STR_CHECK_BOX_HELP),
477 flags = CHECKBOX_DEFAULT,
482 help = STRING_TOKEN(STR_TEXT_HELP),
483 text = STRING_TOKEN(STR_TEXT_TEXT_1);
486 help = STRING_TOKEN(STR_TEXT_HELP),
487 text = STRING_TOKEN(STR_TEXT_TEXT_1),
488 text = STRING_TOKEN(STR_TEXT_TEXT_2);
491 prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage // this too has no end-op and basically it's a jump to a form ONLY
492 help = STRING_TOKEN(STR_GOTO_HELP);
496 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
498 suppressif ideqval MyEfiVar == 111;
500 help = STRING_TOKEN(STR_TEXT_HELP),
501 text = STRING_TOKEN(STR_TEXT_TEXT_1);
505 prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage
506 help = STRING_TOKEN(STR_GOTO_HELP);
508 numeric varid = MyIfrNVData.DynamicRefresh,
509 prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
510 help = STRING_TOKEN(STR_NUMERIC_HELP0),
517 refresh interval = 3 // Refresh interval in seconds
525 form formid = 4, title = STRING_TOKEN(STR_FORM3_TITLE);
529 form formid = 0x1234, // Dynamically created page,
530 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
534 // This is where we will insert dynamic created opcodes