]>
Commit | Line | Data |
---|---|---|
cf7e50f8 | 1 | /** @file\r |
4a71b21a | 2 | Library class name: FrameworkIfrSupportLib\r |
df298090 | 3 | \r |
4a71b21a | 4 | FrameworkIfrSupportLib is designed for produce IFR operation interface .\r |
5 | The IFR format follows framework specification.\r | |
6 | \r | |
df298090 | 7 | Copyright (c) 2006, Intel Corporation \r |
8 | All rights reserved. This program and the accompanying materials \r | |
9 | are licensed and made available under the terms and conditions of the BSD License \r | |
10 | which accompanies this distribution. The full text of the license may be found at \r | |
11 | http://opensource.org/licenses/bsd-license.php \r | |
12 | \r | |
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
15 | \r | |
cf7e50f8 | 16 | **/\r |
df298090 | 17 | \r |
dddb694d | 18 | #ifndef _IFRSUPPORTLIBRARY_H_\r |
19 | #define _IFRSUPPORTLIBRARY_H_\r | |
df298090 | 20 | \r |
21 | #define DEFAULT_FORM_BUFFER_SIZE 0xFFFF\r | |
22 | #define DEFAULT_STRING_BUFFER_SIZE 0xFFFF\r | |
23 | \r | |
24 | #pragma pack(1)\r | |
25 | typedef struct {\r | |
26 | CHAR16 *OptionString; // Passed in string to generate a token for in a truly dynamic form creation\r | |
27 | STRING_REF StringToken; // This is used when creating a single op-code without generating a StringToken (have one already)\r | |
28 | UINT16 Value;\r | |
29 | UINT8 Flags;\r | |
30 | UINT16 Key;\r | |
31 | } IFR_OPTION;\r | |
32 | #pragma pack()\r | |
33 | \r | |
dddb694d | 34 | /**\r |
35 | Determine what is the current language setting.\r | |
36 | \r | |
37 | The setting is stored in language variable in flash. This routine\r | |
38 | will get setting by accesssing that variable. If failed to access\r | |
39 | language variable, then use default setting that 'eng' as current\r | |
40 | language setting.\r | |
41 | \r | |
42 | @param Lang Pointer of system language\r | |
43 | \r | |
44 | @return whether sucess to get setting from variable\r | |
45 | **/\r | |
df298090 | 46 | EFI_STATUS\r |
47 | GetCurrentLanguage (\r | |
48 | OUT CHAR16 *Lang\r | |
dddb694d | 49 | );\r |
df298090 | 50 | \r |
dddb694d | 51 | /**\r |
52 | Add a string to the incoming buffer and return the token and offset data.\r | |
df298090 | 53 | \r |
dddb694d | 54 | @param StringBuffer The incoming buffer\r |
55 | @param Language Currrent language\r | |
56 | @param String The string to be added\r | |
57 | @param StringToken The index where the string placed \r | |
df298090 | 58 | \r |
dddb694d | 59 | @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r |
60 | @retval EFI_SUCCESS String successfully added to the incoming buffer\r | |
61 | **/\r | |
df298090 | 62 | EFI_STATUS\r |
63 | AddString (\r | |
64 | IN VOID *StringBuffer,\r | |
65 | IN CHAR16 *Language,\r | |
66 | IN CHAR16 *String,\r | |
67 | IN OUT STRING_REF *StringToken\r | |
dddb694d | 68 | );\r |
df298090 | 69 | \r |
dddb694d | 70 | /**\r |
71 | Add op-code data to the FormBuffer.\r | |
df298090 | 72 | \r |
dddb694d | 73 | @param FormBuffer Form buffer to be inserted to\r |
74 | @param OpCodeData Op-code data to be inserted\r | |
df298090 | 75 | \r |
dddb694d | 76 | @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r |
77 | @retval EFI_SUCCESS Op-code data successfully inserted\r | |
78 | **/\r | |
df298090 | 79 | EFI_STATUS\r |
80 | AddOpCode (\r | |
81 | IN VOID *FormBuffer,\r | |
82 | IN OUT VOID *OpCodeData\r | |
dddb694d | 83 | );\r |
df298090 | 84 | \r |
dddb694d | 85 | /**\r |
86 | Create a formset\r | |
df298090 | 87 | \r |
dddb694d | 88 | The form package is a collection of forms that are intended to describe the pages that will be\r |
89 | displayed to the user.\r | |
df298090 | 90 | \r |
dddb694d | 91 | @param FormSetTitle Title of formset\r |
92 | @param Guid Guid of formset\r | |
93 | @param Class Class of formset\r | |
94 | @param SubClass Sub class of formset\r | |
95 | @param FormBuffer Pointer of the formset created\r | |
96 | @param StringBuffer Pointer of FormSetTitile string created\r | |
df298090 | 97 | \r |
dddb694d | 98 | @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r |
99 | @retval EFI_SUCCESS Formset successfully created \r | |
100 | **/\r | |
df298090 | 101 | EFI_STATUS\r |
102 | CreateFormSet (\r | |
103 | IN CHAR16 *FormSetTitle,\r | |
104 | IN EFI_GUID *Guid,\r | |
105 | IN UINT8 Class,\r | |
106 | IN UINT8 SubClass,\r | |
107 | IN OUT VOID **FormBuffer,\r | |
108 | IN OUT VOID **StringBuffer\r | |
dddb694d | 109 | );\r |
df298090 | 110 | \r |
dddb694d | 111 | /**\r |
112 | Create a form.\r | |
113 | A form is the encapsulation of what amounts to a browser page. The header defines a FormId,\r | |
114 | which is referenced by the form package, among others. It also defines a FormTitle, which is a\r | |
115 | string to be used as the title for the form\r | |
df298090 | 116 | \r |
dddb694d | 117 | @param FormTitle Title of the form\r |
118 | @param FormId Id of the form\r | |
119 | @param FormBuffer Pointer of the form created\r | |
120 | @param StringBuffer Pointer of FormTitil string created\r | |
df298090 | 121 | \r |
dddb694d | 122 | @retval EFI_SUCCESS Form successfully created\r |
123 | **/\r | |
df298090 | 124 | EFI_STATUS\r |
125 | CreateForm (\r | |
126 | IN CHAR16 *FormTitle,\r | |
127 | IN UINT16 FormId,\r | |
128 | IN OUT VOID *FormBuffer,\r | |
129 | IN OUT VOID *StringBuffer\r | |
dddb694d | 130 | );\r |
df298090 | 131 | \r |
dddb694d | 132 | /**\r |
133 | Create a SubTitle\r | |
df298090 | 134 | \r |
dddb694d | 135 | Subtitle strings are intended to be used by authors to separate sections of questions into semantic\r |
136 | groups.\r | |
df298090 | 137 | \r |
dddb694d | 138 | @param SubTitle Sub title to be created\r |
139 | @param FormBuffer Where this subtitle to add to\r | |
140 | @param StringBuffer String buffer created for subtitle\r | |
df298090 | 141 | \r |
dddb694d | 142 | @retval EFI_SUCCESS Subtitle successfully created\r |
143 | **/\r | |
df298090 | 144 | EFI_STATUS\r |
145 | CreateSubTitle (\r | |
146 | IN CHAR16 *SubTitle,\r | |
147 | IN OUT VOID *FormBuffer,\r | |
148 | IN OUT VOID *StringBuffer\r | |
dddb694d | 149 | );\r |
df298090 | 150 | \r |
dddb694d | 151 | /**\r |
152 | Create a line of text\r | |
153 | Unlike HTML, text is simply another tag. \r | |
154 | This tag type enables IFR to be more easily localized.\r | |
155 | \r | |
156 | @param String First string of the text\r | |
157 | @param String2 Second string of the text\r | |
158 | @param String3 Help string of the text\r | |
159 | @param Flags Flag of the text\r | |
160 | @param Key Key of the text\r | |
161 | @param FormBuffer The form where this text adds to\r | |
162 | @param StringBuffer String buffer created for String, String2 and String3\r | |
163 | \r | |
164 | @retval EFI_SUCCESS Text successfully created\r | |
165 | **/\r | |
df298090 | 166 | EFI_STATUS\r |
167 | CreateText (\r | |
168 | IN CHAR16 *String,\r | |
169 | IN CHAR16 *String2,\r | |
170 | IN CHAR16 *String3,\r | |
171 | IN UINT8 Flags,\r | |
172 | IN UINT16 Key,\r | |
173 | IN OUT VOID *FormBuffer,\r | |
174 | IN OUT VOID *StringBuffer\r | |
dddb694d | 175 | );\r |
df298090 | 176 | \r |
dddb694d | 177 | /**\r |
178 | Create a hyperlink.\r | |
df298090 | 179 | \r |
dddb694d | 180 | @param FormId Form ID of the hyperlink\r |
181 | @param Prompt Prompt of the hyperlink\r | |
182 | @param FormBuffer The form where this hyperlink adds to\r | |
183 | @param StringBuffer String buffer created for Prompt\r | |
df298090 | 184 | \r |
dddb694d | 185 | @retval EFI_SUCCESS Hyperlink successfully created \r |
186 | **/\r | |
df298090 | 187 | EFI_STATUS\r |
188 | CreateGoto (\r | |
189 | IN UINT16 FormId,\r | |
190 | IN CHAR16 *Prompt,\r | |
191 | IN OUT VOID *FormBuffer,\r | |
192 | IN OUT VOID *StringBuffer\r | |
dddb694d | 193 | );\r |
df298090 | 194 | \r |
dddb694d | 195 | /**\r |
196 | Create a one-of question with a set of options to choose from. The\r | |
197 | OptionsList is a pointer to a null-terminated list of option descriptions.\r | |
df298090 | 198 | \r |
dddb694d | 199 | @param QuestionId Question ID of the one-of box\r |
200 | @param DataWidth DataWidth of the one-of box\r | |
201 | @param Prompt Prompt of the one-of box\r | |
202 | @param Help Help of the one-of box\r | |
203 | @param OptionsList Each string in it is an option of the one-of box\r | |
204 | @param OptionCount Option string count\r | |
205 | @param FormBuffer The form where this one-of box adds to\r | |
206 | @param StringBuffer String buffer created for Prompt, Help and Option strings\r | |
207 | \r | |
208 | @retval EFI_DEVICE_ERROR DataWidth > 2\r | |
209 | @retval EFI_SUCCESS One-Of box successfully created.\r | |
210 | **/\r | |
df298090 | 211 | EFI_STATUS\r |
212 | CreateOneOf (\r | |
213 | IN UINT16 QuestionId,\r | |
214 | IN UINT8 DataWidth,\r | |
215 | IN CHAR16 *Prompt,\r | |
216 | IN CHAR16 *Help,\r | |
217 | IN IFR_OPTION *OptionsList,\r | |
218 | IN UINTN OptionCount,\r | |
219 | IN OUT VOID *FormBuffer,\r | |
220 | IN OUT VOID *StringBuffer\r | |
dddb694d | 221 | );\r |
df298090 | 222 | \r |
dddb694d | 223 | /**\r |
df298090 | 224 | Create a one-of question with a set of options to choose from. The\r |
225 | OptionsList is a pointer to a null-terminated list of option descriptions.\r | |
226 | \r | |
dddb694d | 227 | @param QuestionId Question ID of the ordered list\r |
228 | @param MaxEntries MaxEntries of the ordered list\r | |
229 | @param Prompt Prompt of the ordered list\r | |
230 | @param Help Help of the ordered list\r | |
231 | @param OptionsList Each string in it is an option of the ordered list\r | |
232 | @param OptionCount Option string count\r | |
233 | @param FormBuffer The form where this ordered list adds to\r | |
234 | @param StringBuffer String buffer created for Prompt, Help and Option strings\r | |
df298090 | 235 | \r |
dddb694d | 236 | @retval EFI_SUCCESS Ordered list successfully created.\r |
237 | **/\r | |
df298090 | 238 | EFI_STATUS\r |
239 | CreateOrderedList (\r | |
240 | IN UINT16 QuestionId,\r | |
241 | IN UINT8 MaxEntries,\r | |
242 | IN CHAR16 *Prompt,\r | |
243 | IN CHAR16 *Help,\r | |
244 | IN IFR_OPTION *OptionsList,\r | |
245 | IN UINTN OptionCount,\r | |
246 | IN OUT VOID *FormBuffer,\r | |
247 | IN OUT VOID *StringBuffer\r | |
dddb694d | 248 | );\r |
df298090 | 249 | \r |
dddb694d | 250 | /**\r |
251 | Create a checkbox\r | |
df298090 | 252 | \r |
dddb694d | 253 | @param QuestionId Question ID of the check box\r |
254 | @param DataWidth DataWidth of the check box\r | |
255 | @param Prompt Prompt of the check box\r | |
256 | @param Help Help of the check box \r | |
257 | @param Flags Flags of the check box\r | |
258 | @param FormBuffer The form where this check box adds to\r | |
259 | @param StringBuffer String buffer created for Prompt and Help.\r | |
df298090 | 260 | \r |
dddb694d | 261 | @retval EFI_DEVICE_ERROR DataWidth > 1\r |
262 | @retval EFI_SUCCESS Check box successfully created\r | |
263 | **/\r | |
df298090 | 264 | EFI_STATUS\r |
265 | CreateCheckBox (\r | |
266 | IN UINT16 QuestionId,\r | |
267 | IN UINT8 DataWidth,\r | |
268 | IN CHAR16 *Prompt,\r | |
269 | IN CHAR16 *Help,\r | |
270 | IN UINT8 Flags,\r | |
271 | IN OUT VOID *FormBuffer,\r | |
272 | IN OUT VOID *StringBuffer\r | |
dddb694d | 273 | );\r |
df298090 | 274 | \r |
dddb694d | 275 | /**\r |
276 | Create a numeric\r | |
df298090 | 277 | \r |
dddb694d | 278 | @param QuestionId Question ID of the numeric\r |
279 | @param DataWidth DataWidth of the numeric\r | |
280 | @param Prompt Prompt of the numeric\r | |
281 | @param Help Help of the numeric\r | |
282 | @param Minimum Minumun boundary of the numeric\r | |
283 | @param Maximum Maximum boundary of the numeric\r | |
284 | @param Step Step of the numeric\r | |
285 | @param Default Default value\r | |
286 | @param Flags Flags of the numeric\r | |
287 | @param Key Key of the numeric\r | |
288 | @param FormBuffer The form where this numeric adds to\r | |
289 | @param StringBuffer String buffer created for Prompt and Help.\r | |
290 | \r | |
291 | @retval EFI_DEVICE_ERROR DataWidth > 2\r | |
292 | @retval EFI_SUCCESS Numeric is successfully created \r | |
293 | **/\r | |
df298090 | 294 | EFI_STATUS\r |
295 | CreateNumeric (\r | |
296 | IN UINT16 QuestionId,\r | |
297 | IN UINT8 DataWidth,\r | |
298 | IN CHAR16 *Prompt,\r | |
299 | IN CHAR16 *Help,\r | |
300 | IN UINT16 Minimum,\r | |
301 | IN UINT16 Maximum,\r | |
302 | IN UINT16 Step,\r | |
303 | IN UINT16 Default,\r | |
304 | IN UINT8 Flags,\r | |
305 | IN UINT16 Key,\r | |
306 | IN OUT VOID *FormBuffer,\r | |
307 | IN OUT VOID *StringBuffer\r | |
dddb694d | 308 | );\r |
309 | \r | |
310 | /**\r | |
311 | Create a string.\r | |
312 | \r | |
313 | @param QuestionId Question ID of the string\r | |
314 | @param DataWidth DataWidth of the string\r | |
315 | @param Prompt Prompt of the string\r | |
316 | @param Help Help of the string\r | |
317 | @param MinSize Min size boundary of the string\r | |
318 | @param MaxSize Max size boundary of the string\r | |
319 | @param Flags Flags of the string\r | |
320 | @param Key Key of the string\r | |
321 | @param FormBuffer The form where this string adds to\r | |
322 | @param StringBuffer String buffer created for Prompt and Help.\r | |
323 | @retval EFI_SUCCESS String successfully created. \r | |
324 | **/\r | |
df298090 | 325 | EFI_STATUS\r |
326 | CreateString (\r | |
327 | IN UINT16 QuestionId,\r | |
328 | IN UINT8 DataWidth,\r | |
329 | IN CHAR16 *Prompt,\r | |
330 | IN CHAR16 *Help,\r | |
331 | IN UINT8 MinSize,\r | |
332 | IN UINT8 MaxSize,\r | |
333 | IN UINT8 Flags,\r | |
334 | IN UINT16 Key,\r | |
335 | IN OUT VOID *FormBuffer,\r | |
336 | IN OUT VOID *StringBuffer\r | |
dddb694d | 337 | );\r |
df298090 | 338 | \r |
dddb694d | 339 | /**\r |
340 | Extract information pertaining to the HiiHandle.\r | |
df298090 | 341 | \r |
dddb694d | 342 | @param HiiHandle Hii handle\r |
343 | @param ImageLength For input, length of DefaultImage;\r | |
344 | For output, length of actually required\r | |
345 | @param DefaultImage Image buffer prepared by caller\r | |
346 | @param Guid Guid information about the form \r | |
df298090 | 347 | \r |
dddb694d | 348 | @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r |
349 | @retval EFI_BUFFER_TOO_SMALL DefualtImage has no enough ImageLength\r | |
350 | @retval EFI_SUCCESS Successfully extract data from Hii database.\r | |
351 | **/\r | |
df298090 | 352 | EFI_STATUS\r |
353 | ExtractDataFromHiiHandle (\r | |
dddb694d | 354 | IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,\r |
df298090 | 355 | IN OUT UINT16 *ImageLength,\r |
356 | OUT UINT8 *DefaultImage,\r | |
357 | OUT EFI_GUID *Guid\r | |
dddb694d | 358 | );\r |
df298090 | 359 | \r |
dddb694d | 360 | /**\r |
361 | Finds HII handle for given pack GUID previously registered with the HII.\r | |
df298090 | 362 | \r |
dddb694d | 363 | @param HiiProtocol pointer to pointer to HII protocol interface.\r |
364 | If NULL, the interface will be found but not returned.\r | |
365 | If it points to NULL, the interface will be found and\r | |
366 | written back to the pointer that is pointed to.\r | |
367 | @param Guid The GUID of the pack that registered with the HII.\r | |
df298090 | 368 | \r |
dddb694d | 369 | @return Handle to the HII pack previously registered by the memory driver.\r |
370 | **/\r | |
dc7b4a5c | 371 | FRAMEWORK_EFI_HII_HANDLE \r |
df298090 | 372 | FindHiiHandle (\r |
373 | IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL\r | |
374 | IN EFI_GUID *Guid\r | |
dddb694d | 375 | );\r |
df298090 | 376 | \r |
dddb694d | 377 | /**\r |
378 | Create a SubTitle opcode independent of string creation\r | |
379 | This is used primarily by users who need to create just one particular valid op-code and the string\r | |
380 | data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r | |
381 | location to pre-defined forms in HII)\r | |
382 | \r | |
383 | @param StringToken StringToken of the subtitle\r | |
384 | @param FormBuffer Output of subtitle as a form\r | |
385 | \r | |
386 | @retval EFI_SUCCESS Subtitle created to be a form\r | |
387 | **/\r | |
df298090 | 388 | EFI_STATUS\r |
389 | CreateSubTitleOpCode (\r | |
390 | IN STRING_REF StringToken,\r | |
391 | IN OUT VOID *FormBuffer\r | |
dddb694d | 392 | );\r |
df298090 | 393 | \r |
dddb694d | 394 | /**\r |
395 | Create a Text opcode independent of string creation.\r | |
396 | \r | |
df298090 | 397 | This is used primarily by users who need to create just one particular valid op-code and the string\r |
398 | data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r | |
399 | location to pre-defined forms in HII)\r | |
df298090 | 400 | \r |
dddb694d | 401 | @param StringToken First string token of the text\r |
402 | @param StringTokenTwo Second string token of the text\r | |
403 | @param StringTokenThree Help string token of the text\r | |
404 | @param Flags Flag of the text\r | |
405 | @param Key Key of the text\r | |
406 | @param FormBuffer Output of text as a form\r | |
df298090 | 407 | \r |
dddb694d | 408 | @retval EFI_SUCCESS Text created to be a form\r |
409 | **/\r | |
df298090 | 410 | EFI_STATUS\r |
411 | CreateTextOpCode (\r | |
412 | IN STRING_REF StringToken,\r | |
413 | IN STRING_REF StringTokenTwo,\r | |
414 | IN STRING_REF StringTokenThree,\r | |
415 | IN UINT8 Flags,\r | |
416 | IN UINT16 Key,\r | |
417 | IN OUT VOID *FormBuffer\r | |
dddb694d | 418 | );\r |
df298090 | 419 | \r |
dddb694d | 420 | /**\r |
421 | Create a hyperlink opcode independent of string creation.\r | |
422 | \r | |
df298090 | 423 | This is used primarily by users who need to create just one particular valid op-code and the string\r |
424 | data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r | |
425 | location to pre-defined forms in HII)\r | |
426 | \r | |
df298090 | 427 | \r |
dddb694d | 428 | @param FormId Form ID of the hyperlink\r |
429 | @param StringToken Prompt string token of the hyperlink\r | |
430 | @param StringTokenTwo Help string token of the hyperlink\r | |
431 | @param Flags Flags of the hyperlink\r | |
432 | @param Key Key of the hyperlink\r | |
433 | @param FormBuffer Output of hyperlink as a form\r | |
434 | @retval EFI_SUCCESS Hyperlink created to be a form\r | |
435 | **/\r | |
df298090 | 436 | EFI_STATUS\r |
437 | CreateGotoOpCode (\r | |
438 | IN UINT16 FormId,\r | |
439 | IN STRING_REF StringToken,\r | |
440 | IN STRING_REF StringTokenTwo,\r | |
441 | IN UINT8 Flags,\r | |
442 | IN UINT16 Key,\r | |
443 | IN OUT VOID *FormBuffer\r | |
dddb694d | 444 | );\r |
df298090 | 445 | \r |
dddb694d | 446 | /**\r |
447 | Create a one-of opcode with a set of option op-codes to choose from independent of string creation.\r | |
df298090 | 448 | This is used primarily by users who need to create just one particular valid op-code and the string\r |
449 | data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r | |
450 | location to pre-defined forms in HII)\r | |
df298090 | 451 | \r |
dddb694d | 452 | OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken\r |
453 | has been filled in since this routine will not generate StringToken values.\r | |
df298090 | 454 | \r |
dddb694d | 455 | @param QuestionId Question ID of the one-of box\r |
456 | @param DataWidth DataWidth of the one-of box\r | |
457 | @param PromptToken Prompt string token of the one-of box\r | |
458 | @param HelpToken Help string token of the one-of box\r | |
459 | @param OptionsList Each string in it is an option of the one-of box\r | |
460 | @param OptionCount Option string count\r | |
461 | @param FormBuffer Output of One-Of box as a form\r | |
df298090 | 462 | \r |
df298090 | 463 | \r |
dddb694d | 464 | @retval EFI_SUCCESS One-Of box created to be a form\r |
465 | @retval EFI_DEVICE_ERROR DataWidth > 2\r | |
466 | **/\r | |
df298090 | 467 | EFI_STATUS\r |
468 | CreateOneOfOpCode (\r | |
469 | IN UINT16 QuestionId,\r | |
470 | IN UINT8 DataWidth,\r | |
471 | IN STRING_REF PromptToken,\r | |
472 | IN STRING_REF HelpToken,\r | |
473 | IN IFR_OPTION *OptionsList,\r | |
474 | IN UINTN OptionCount,\r | |
475 | IN OUT VOID *FormBuffer\r | |
dddb694d | 476 | );\r |
df298090 | 477 | \r |
dddb694d | 478 | /**\r |
479 | Create a ordered list opcode with a set of option op-codes to choose from independent of string creation.\r | |
df298090 | 480 | This is used primarily by users who need to create just one particular valid op-code and the string\r |
481 | data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r | |
482 | location to pre-defined forms in HII)\r | |
483 | \r | |
484 | OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken\r | |
485 | has been filled in since this routine will not generate StringToken values.\r | |
486 | \r | |
dddb694d | 487 | @param QuestionId Question ID of the ordered list\r |
488 | @param MaxEntries MaxEntries of the ordered list\r | |
489 | @param PromptToken Prompt string token of the ordered list\r | |
490 | @param HelpToken Help string token of the ordered list\r | |
491 | @param OptionsList Each string in it is an option of the ordered list\r | |
492 | @param OptionCount Option string count\r | |
493 | @param FormBuffer Output of ordered list as a form\r | |
df298090 | 494 | \r |
dddb694d | 495 | @retval EFI_SUCCESS Ordered list created to be a form\r |
496 | **/\r | |
df298090 | 497 | EFI_STATUS\r |
498 | CreateOrderedListOpCode (\r | |
499 | IN UINT16 QuestionId,\r | |
500 | IN UINT8 MaxEntries,\r | |
501 | IN STRING_REF PromptToken,\r | |
502 | IN STRING_REF HelpToken,\r | |
503 | IN IFR_OPTION *OptionsList,\r | |
504 | IN UINTN OptionCount,\r | |
505 | IN OUT VOID *FormBuffer\r | |
dddb694d | 506 | );\r |
df298090 | 507 | \r |
dddb694d | 508 | /**\r |
509 | Create a checkbox opcode independent of string creation\r | |
df298090 | 510 | This is used primarily by users who need to create just one particular valid op-code and the string\r |
511 | data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r | |
512 | location to pre-defined forms in HII)\r | |
513 | \r | |
dddb694d | 514 | @param QuestionId Question ID of the check box\r |
515 | @param DataWidth DataWidth of the check box\r | |
516 | @param PromptToken Prompt string token of the check box\r | |
517 | @param HelpToken Help string token of the check box\r | |
518 | @param Flags Flags of the check box\r | |
519 | @param Key Key of the check box\r | |
520 | @param FormBuffer Output of the check box as a form\r | |
df298090 | 521 | \r |
dddb694d | 522 | @retval EFI_SUCCESS Checkbox created to be a form\r |
523 | @retval EFI_DEVICE_ERROR DataWidth > 1\r | |
524 | **/\r | |
df298090 | 525 | EFI_STATUS\r |
526 | CreateCheckBoxOpCode (\r | |
527 | IN UINT16 QuestionId,\r | |
528 | IN UINT8 DataWidth,\r | |
529 | IN STRING_REF PromptToken,\r | |
530 | IN STRING_REF HelpToken,\r | |
531 | IN UINT8 Flags,\r | |
532 | IN UINT16 Key,\r | |
533 | IN OUT VOID *FormBuffer\r | |
dddb694d | 534 | );\r |
df298090 | 535 | \r |
dddb694d | 536 | /**\r |
537 | Create a numeric opcode independent of string creation.\r | |
df298090 | 538 | This is used primarily by users who need to create just one particular valid op-code and the string\r |
539 | data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r | |
540 | location to pre-defined forms in HII)\r | |
541 | \r | |
dddb694d | 542 | @param QuestionId Question ID of the numeric\r |
543 | @param DataWidth DataWidth of the numeric\r | |
544 | @param PromptToken Prompt string token of the numeric\r | |
545 | @param HelpToken Help string token of the numeric\r | |
546 | @param Minimum Minumun boundary of the numeric\r | |
547 | @param Maximum Maximum boundary of the numeric\r | |
548 | @param Step Step of the numeric\r | |
549 | @param Default Default value of the numeric\r | |
550 | @param Flags Flags of the numeric\r | |
551 | @param Key Key of the numeric\r | |
552 | @param FormBuffer Output of the numeric as a form\r | |
553 | \r | |
554 | \r | |
555 | @retval EFI_SUCCESS The numeric created to be a form.\r | |
556 | @retval EFI_DEVICE_ERROR DataWidth > 2\r | |
557 | **/\r | |
df298090 | 558 | EFI_STATUS\r |
559 | CreateNumericOpCode (\r | |
560 | IN UINT16 QuestionId,\r | |
561 | IN UINT8 DataWidth,\r | |
562 | IN STRING_REF PromptToken,\r | |
563 | IN STRING_REF HelpToken,\r | |
564 | IN UINT16 Minimum,\r | |
565 | IN UINT16 Maximum,\r | |
566 | IN UINT16 Step,\r | |
567 | IN UINT16 Default,\r | |
568 | IN UINT8 Flags,\r | |
569 | IN UINT16 Key,\r | |
570 | IN OUT VOID *FormBuffer\r | |
dddb694d | 571 | );\r |
df298090 | 572 | \r |
dddb694d | 573 | /**\r |
df298090 | 574 | Create a numeric opcode independent of string creation\r |
575 | This is used primarily by users who need to create just one particular valid op-code and the string\r | |
576 | data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r | |
577 | location to pre-defined forms in HII)\r | |
578 | \r | |
dddb694d | 579 | @param QuestionId Question ID of the string\r |
580 | @param DataWidth DataWidth of the string\r | |
581 | @param PromptToken Prompt token of the string\r | |
582 | @param HelpToken Help token of the string\r | |
583 | @param MinSize Min size boundary of the string\r | |
584 | @param MaxSize Max size boundary of the string\r | |
585 | @param Flags Flags of the string\r | |
586 | @param Key Key of the string\r | |
587 | @param FormBuffer Output of the string as a form\r | |
588 | \r | |
589 | @retval EFI_SUCCESS String created to be a form.\r | |
590 | **/\r | |
df298090 | 591 | EFI_STATUS\r |
592 | CreateStringOpCode (\r | |
593 | IN UINT16 QuestionId,\r | |
594 | IN UINT8 DataWidth,\r | |
595 | IN STRING_REF PromptToken,\r | |
596 | IN STRING_REF HelpToken,\r | |
597 | IN UINT8 MinSize,\r | |
598 | IN UINT8 MaxSize,\r | |
599 | IN UINT8 Flags,\r | |
600 | IN UINT16 Key,\r | |
601 | IN OUT VOID *FormBuffer\r | |
dddb694d | 602 | );\r |
df298090 | 603 | \r |
dddb694d | 604 | /**\r |
605 | Validate that the data associated with the HiiHandle in NVRAM is within\r | |
606 | the reasonable parameters for that FormSet. Values for strings and passwords\r | |
607 | are not verified due to their not having the equivalent of valid range settings.\r | |
df298090 | 608 | \r |
dddb694d | 609 | @param HiiHandle Handle of the HII database entry to query\r |
df298090 | 610 | \r |
dddb694d | 611 | @param Results If return Status is EFI_SUCCESS, Results provides valid data\r |
612 | TRUE = NVRAM Data is within parameters\r | |
613 | FALSE = NVRAM Data is NOT within parameters\r | |
614 | @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r | |
615 | @retval EFI_SUCCESS Data successfully validated\r | |
616 | **/\r | |
df298090 | 617 | EFI_STATUS\r |
618 | ValidateDataFromHiiHandle (\r | |
dc7b4a5c | 619 | IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,\r |
df298090 | 620 | OUT BOOLEAN *Results\r |
dddb694d | 621 | );\r |
df298090 | 622 | \r |
dddb694d | 623 | /**\r |
624 | Create a banner opcode. This is primarily used by the FrontPage implementation from BDS.\r | |
df298090 | 625 | \r |
dddb694d | 626 | @param Title Title of the banner\r |
627 | @param LineNumber LineNumber of the banner\r | |
628 | @param Alignment Alignment of the banner\r | |
629 | @param FormBuffer Output of banner as a form\r | |
df298090 | 630 | \r |
dddb694d | 631 | @retval EFI_SUCCESS Banner created to be a form.\r |
632 | **/\r | |
df298090 | 633 | EFI_STATUS\r |
634 | CreateBannerOpCode (\r | |
635 | IN UINT16 Title,\r | |
636 | IN UINT16 LineNumber,\r | |
637 | IN UINT8 Alignment,\r | |
638 | IN OUT VOID *FormBuffer\r | |
dddb694d | 639 | );\r |
640 | \r | |
641 | /**\r | |
642 | Extracts a variable form a Pack.\r | |
df298090 | 643 | \r |
dddb694d | 644 | @param Pack List of variables\r |
645 | @param Name Name of the variable/map\r | |
646 | @param Guid GUID of the variable/map\r | |
647 | @param Id The index of the variable/map to retrieve\r | |
648 | @param Var Pointer to the variable/map\r | |
649 | @param Size Size of the variable/map in bytes\r | |
650 | **/\r | |
df298090 | 651 | VOID\r |
652 | EfiLibHiiVariablePackGetMap (\r | |
dddb694d | 653 | IN EFI_HII_VARIABLE_PACK *Pack, \r |
654 | OUT CHAR16 **Name, OPTIONAL\r | |
655 | OUT EFI_GUID **Guid, OPTIONAL\r | |
656 | OUT UINT16 *Id, OPTIONAL\r | |
657 | OUT VOID **Var, OPTIONAL\r | |
658 | OUT UINTN *Size OPTIONAL\r | |
659 | );\r | |
660 | \r | |
661 | /**\r | |
662 | Finds a count of the variables/maps in the List.\r | |
df298090 | 663 | \r |
dddb694d | 664 | @param List List of variables\r |
df298090 | 665 | \r |
dddb694d | 666 | @return The number of map count.\r |
667 | **/\r | |
df298090 | 668 | UINTN\r |
669 | EfiLibHiiVariablePackListGetMapCnt (\r | |
670 | IN EFI_HII_VARIABLE_PACK_LIST *List\r | |
dddb694d | 671 | );\r |
672 | \r | |
673 | /**\r | |
df298090 | 674 | type definition for the callback to be \r |
675 | used with EfiLibHiiVariablePackListForEachVar().\r | |
676 | \r | |
dddb694d | 677 | @param Id Variable/Map ID\r |
678 | @param Name Name of the variable/map\r | |
679 | @param Guid GUID of the variable/map\r | |
680 | @param Var Pointer to the variable/map\r | |
681 | @param Size Size of the variable/map in bytes\r | |
682 | **/\r | |
683 | typedef VOID (EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK) (\r | |
684 | IN CHAR16 *Name,\r | |
685 | IN EFI_GUID *Guid,\r | |
686 | IN UINT16 Id,\r | |
687 | IN VOID *Var,\r | |
688 | IN UINTN Size\r | |
689 | );\r | |
690 | \r | |
691 | /**\r | |
692 | Will iterate all variable/maps as appearing \r | |
693 | in List and for each, it will call the Callback.\r | |
df298090 | 694 | \r |
dddb694d | 695 | @param List List of variables\r |
696 | @param Callback Routine to be called for each iterated variable.\r | |
697 | **/\r | |
df298090 | 698 | VOID\r |
699 | EfiLibHiiVariablePackListForEachVar (\r | |
700 | IN EFI_HII_VARIABLE_PACK_LIST *List,\r | |
701 | IN EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK *Callback\r | |
dddb694d | 702 | );\r |
703 | \r | |
704 | /**\r | |
705 | Finds a variable form List given \r | |
706 | the order number as appears in the List.\r | |
df298090 | 707 | \r |
dddb694d | 708 | @param Idx The index of the variable/map to retrieve\r |
709 | @param List List of variables\r | |
710 | @param Name Name of the variable/map\r | |
711 | @param Guid GUID of the variable/map\r | |
712 | @param Id Id of the variable/map\r | |
713 | @param Var Pointer to the variable/map\r | |
714 | @param Size Size of the variable/map in bytes\r | |
df298090 | 715 | \r |
dddb694d | 716 | @return EFI_SUCCESS Variable is found, OUT parameters are valid\r |
717 | @return EFI_NOT_FOUND Variable is not found, OUT parameters are not valid\r | |
718 | **/\r | |
df298090 | 719 | EFI_STATUS\r |
720 | EfiLibHiiVariablePackListGetMapByIdx (\r | |
721 | IN UINTN Idx, \r | |
722 | IN EFI_HII_VARIABLE_PACK_LIST *List, \r | |
723 | OUT CHAR16 **Name, OPTIONAL\r | |
724 | OUT EFI_GUID **Guid, OPTIONAL\r | |
dddb694d | 725 | OUT UINT16 *Id, OPTIONAL\r |
df298090 | 726 | OUT VOID **Var,\r |
727 | OUT UINTN *Size\r | |
dddb694d | 728 | );\r |
729 | \r | |
730 | /**\r | |
731 | Finds a variable form List given the \r | |
732 | order number as appears in the List.\r | |
df298090 | 733 | \r |
dddb694d | 734 | @param Id The ID of the variable/map to retrieve\r |
735 | @param List List of variables\r | |
736 | @param Name Name of the variable/map\r | |
737 | @param Guid GUID of the variable/map\r | |
738 | @param Var Pointer to the variable/map\r | |
739 | @param Size Size of the variable/map in bytes\r | |
df298090 | 740 | \r |
dddb694d | 741 | @retval EFI_SUCCESS Variable is found, OUT parameters are valid\r |
742 | @retval EFI_NOT_FOUND Variable is not found, OUT parameters are not valid\r | |
743 | **/\r | |
df298090 | 744 | EFI_STATUS\r |
745 | EfiLibHiiVariablePackListGetMapById (\r | |
746 | IN UINT16 Id, \r | |
747 | IN EFI_HII_VARIABLE_PACK_LIST *List,\r | |
748 | OUT CHAR16 **Name, OPTIONAL\r | |
749 | OUT EFI_GUID **Guid, OPTIONAL\r | |
750 | OUT VOID **Var,\r | |
751 | OUT UINTN *Size\r | |
dddb694d | 752 | );\r |
df298090 | 753 | \r |
dddb694d | 754 | /**\r |
755 | Finds a variable form EFI_HII_VARIABLE_PACK_LIST given name and GUID.\r | |
df298090 | 756 | \r |
dddb694d | 757 | @param List List of variables\r |
758 | @param Name Name of the variable/map to be found\r | |
759 | @param Guid GUID of the variable/map to be found\r | |
760 | @param Id Id of the variable/map to be found\r | |
761 | @param Var Pointer to the variable/map found\r | |
762 | @param Size Size of the variable/map in bytes found\r | |
df298090 | 763 | \r |
dddb694d | 764 | @retval EFI_SUCCESS variable is found, OUT parameters are valid\r |
765 | @retval EFI_NOT_FOUND variable is not found, OUT parameters are not valid\r | |
766 | **/\r | |
df298090 | 767 | EFI_STATUS\r |
768 | EfiLibHiiVariablePackListGetMap (\r | |
769 | IN EFI_HII_VARIABLE_PACK_LIST *List,\r | |
770 | IN CHAR16 *Name,\r | |
771 | IN EFI_GUID *Guid,\r | |
772 | OUT UINT16 *Id,\r | |
773 | OUT VOID **Var, \r | |
774 | OUT UINTN *Size\r | |
dddb694d | 775 | );\r |
df298090 | 776 | \r |
dddb694d | 777 | /**\r |
778 | Finds out if a variable of specific Name/Guid/Size exists in NV. \r | |
779 | If it does, it will retrieve it into the Var. \r | |
df298090 | 780 | \r |
dddb694d | 781 | @param Name Parameters of the variable to retrieve. Must match exactly.\r |
782 | @param Guid Parameters of the variable to retrieve. Must match exactly.\r | |
783 | @param Size Parameters of the variable to retrieve. Must match exactly.\r | |
784 | @param Var Variable will be retrieved into buffer pointed by this pointer.\r | |
785 | If pointing to NULL, the buffer will be allocated. Caller is responsible for releasing the buffer.\r | |
df298090 | 786 | \r |
dddb694d | 787 | @retval EFI_SUCCESS The variable of exact Name/Guid/Size parameters was retrieved and written to Var.\r |
788 | @retval EFI_NOT_FOUND The variable of this Name/Guid was not found in the NV.\r | |
789 | @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.\r | |
790 | **/\r | |
df298090 | 791 | EFI_STATUS\r |
792 | EfiLibHiiVariableRetrieveFromNv (\r | |
793 | IN CHAR16 *Name,\r | |
794 | IN EFI_GUID *Guid,\r | |
795 | IN UINTN Size,\r | |
796 | OUT VOID **Var\r | |
dddb694d | 797 | );\r |
df298090 | 798 | \r |
dddb694d | 799 | /**\r |
df298090 | 800 | Overrrides the variable with NV data if found.\r |
801 | But it only does it if the Name ends with specified Suffix.\r | |
802 | For example, if Suffix="MyOverride" and the Name="XyzSetupMyOverride",\r | |
803 | the Suffix matches the end of Name, so the variable will be loaded from NV\r | |
804 | provided the variable exists and the GUID and Size matches.\r | |
805 | \r | |
dddb694d | 806 | @param Suffix Suffix the Name should end with.\r |
807 | @param Name Name of the variable to retrieve.\r | |
808 | @Param Guid Guid of the variable to retrieve.\r | |
809 | @Param Size Parameters of the variable to retrieve.\r | |
810 | @param Var Variable will be retrieved into this buffer.\r | |
811 | Caller is responsible for providing storage of exactly Size size in bytes.\r | |
812 | \r | |
813 | @retval EFI_SUCCESS The variable was overriden with NV variable of same Name/Guid/Size.\r | |
814 | @retval EFI_INVALID_PARAMETER The name of the variable does not end with <Suffix>.\r | |
815 | @retval EFI_NOT_FOUND The variable of this Name/Guid was not found in the NV.\r | |
816 | @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.\r | |
817 | **/\r | |
df298090 | 818 | EFI_STATUS\r |
dddb694d | 819 | EfiLibHiiVariableOverrideIfSuffix (\r |
df298090 | 820 | IN CHAR16 *Suffix,\r |
821 | IN CHAR16 *Name,\r | |
822 | IN EFI_GUID *Guid,\r | |
823 | IN UINTN Size,\r | |
824 | OUT VOID *Var\r | |
dddb694d | 825 | );\r |
df298090 | 826 | \r |
dddb694d | 827 | /**\r |
df298090 | 828 | Overrrides the variable with NV data if found.\r |
829 | But it only does it if the NV contains the same variable with Name is appended with Suffix. \r | |
830 | For example, if Suffix="MyOverride" and the Name="XyzSetup",\r | |
831 | the Suffix will be appended to the end of Name, and the variable with Name="XyzSetupMyOverride"\r | |
832 | will be loaded from NV provided the variable exists and the GUID and Size matches.\r | |
833 | \r | |
dddb694d | 834 | @param Suffix Suffix the variable will be appended with.\r |
835 | @param Name Parameters of the Name variable to retrieve.\r | |
836 | @param Guid Parameters of the Guid variable to retrieve.\r | |
837 | @param Size Parameters of the Size variable to retrieve.\r | |
838 | @param Var Variable will be retrieved into this buffer.\r | |
839 | Caller is responsible for providing storage of exactly Size size in bytes.\r | |
df298090 | 840 | \r |
dddb694d | 841 | @retval EFI_SUCCESS The variable was overriden with NV variable of same Name/Guid/Size.\r |
842 | @retval EFI_NOT_FOUND The variable of this Name/Guid was not found in the NV.\r | |
843 | @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.\r | |
844 | **/\r | |
845 | EFI_STATUS\r | |
846 | EfiLibHiiVariableOverrideBySuffix (\r | |
847 | IN CHAR16 *Suffix,\r | |
848 | IN CHAR16 *Name,\r | |
849 | IN EFI_GUID *Guid,\r | |
850 | IN UINTN Size,\r | |
851 | OUT VOID *Var\r | |
852 | );\r | |
df298090 | 853 | \r |
854 | #endif\r |