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