]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Library/HiiLib.h
Add UefiHiiServicesLib library instance in every one DSC
[mirror_edk2.git] / MdeModulePkg / Include / Library / HiiLib.h
CommitLineData
4c76e9cc 1/** @file\r
2 Public include file for the HII Library\r
3\r
4 Copyright (c) 2007 - 2008, Intel Corporation \r
5 All rights reserved. This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
13**/\r
14\r
15#ifndef __HII_LIB_H__\r
16#define __HII_LIB_H__\r
17\r
18\r
19/**\r
20 Assemble EFI_HII_PACKAGE_LIST according to the passed in packages.\r
21\r
22 If GuidId is NULL, then ASSERT.\r
23 If not enough resource to complete the operation, then ASSERT.\r
24\r
25 @param NumberOfPackages Number of packages.\r
26 @param GuidId Package GUID.\r
27 @param ... Variable argument list for packages to be assembled.\r
28\r
29 @return Pointer of EFI_HII_PACKAGE_LIST_HEADER.\r
30\r
31**/\r
32EFI_HII_PACKAGE_LIST_HEADER *\r
33EFIAPI\r
34HiiLibPreparePackageList (\r
35 IN UINTN NumberOfPackages,\r
36 IN CONST EFI_GUID *GuidId,\r
37 ...\r
b9982883
LG
38 )\r
39;\r
4c76e9cc 40\r
41/**\r
42 This function allocates pool for an EFI_HII_PACKAGE_LIST structure\r
43 with additional space that is big enough to host all packages described by the variable \r
44 argument list of package pointers. The allocated structure is initialized using NumberOfPackages, \r
45 GuidId, and the variable length argument list of package pointers.\r
46\r
47 Then, EFI_HII_PACKAGE_LIST will be register to the default System HII Database. The\r
48 Handle to the newly registered Package List is returned throught HiiHandle.\r
49\r
50 If HiiHandle is NULL, then ASSERT.\r
51\r
52 @param NumberOfPackages The number of HII packages to register.\r
53 @param GuidId Package List GUID ID.\r
54 @param DriverHandle Optional. If not NULL, the DriverHandle on which an instance of DEVICE_PATH_PROTOCOL is installed.\r
55 This DriverHandle uniquely defines the device that the added packages are associated with.\r
56 @param HiiHandle On output, the HiiHandle is update with the handle which can be used to retrieve the Package \r
57 List later. If the functions failed to add the package to the default HII database, this value will\r
58 be set to NULL.\r
59 @param ... The variable argument list describing all HII Package.\r
60\r
61 @return EFI_SUCCESS If the packages are successfully added to the default HII database.\r
62 @return EFI_OUT_OF_RESOURCE Not enough resource to complete the operation.\r
63\r
64**/\r
65EFI_STATUS\r
66EFIAPI\r
67HiiLibAddPackages (\r
68 IN UINTN NumberOfPackages,\r
69 IN CONST EFI_GUID *GuidId,\r
70 IN EFI_HANDLE DriverHandle, OPTIONAL\r
71 OUT EFI_HII_HANDLE *HiiHandle,\r
72 ...\r
b9982883
LG
73 )\r
74;\r
4c76e9cc 75\r
76/**\r
77 Removes a package list from the default HII database.\r
78\r
79 If HiiHandle is NULL, then ASSERT.\r
80 If HiiHandle is not a valid EFI_HII_HANDLE in the default HII database, then ASSERT.\r
81\r
82 @param HiiHandle The handle that was previously registered to the data base that is requested for removal.\r
83 List later.\r
84\r
85**/\r
86VOID\r
87EFIAPI\r
88HiiLibRemovePackages (\r
89 IN EFI_HII_HANDLE HiiHandle\r
b9982883
LG
90 )\r
91;\r
4c76e9cc 92\r
93/**\r
94 This function adds the string into String Package of each language\r
95 supported by the package list.\r
96\r
97 If String is NULL, then ASSERT.\r
98 If StringId is NULL, the ASSERT.\r
99 If PackageList could not be found in the default HII database, then ASSERT.\r
100\r
101 @param PackageList Handle of the package list where this string will\r
102 be added.\r
103 @param StringId On return, contains the new strings id, which is\r
104 unique within PackageList.\r
105 @param String Points to the new null-terminated string.\r
106\r
107 @retval EFI_SUCCESS The new string was added successfully.\r
108 @retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of resources.\r
109\r
110**/\r
111EFI_STATUS\r
112EFIAPI\r
113HiiLibNewString (\r
114 IN EFI_HII_HANDLE PackageList,\r
115 OUT EFI_STRING_ID *StringId,\r
116 IN CONST EFI_STRING String\r
b9982883
LG
117 )\r
118;\r
4c76e9cc 119\r
120/**\r
121 This function update the specified string in String Package of each language\r
122 supported by the package list.\r
123\r
124 If String is NULL, then ASSERT.\r
125 If PackageList could not be found in the default HII database, then ASSERT.\r
126 If StringId is not found in PackageList, then ASSERT.\r
127\r
128 @param PackageList Handle of the package list where this string will\r
129 be added.\r
130 @param StringId Ths String Id to be updated.\r
131 @param String Points to the new null-terminated string.\r
132\r
133 @retval EFI_SUCCESS The new string was added successfully.\r
134 @retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of resources.\r
135\r
136**/\r
137EFI_STATUS\r
138EFIAPI\r
139HiiLibSetString (\r
140 IN EFI_HII_HANDLE PackageList,\r
141 IN EFI_STRING_ID StringId,\r
142 IN CONST EFI_STRING String\r
b9982883
LG
143 )\r
144;\r
4c76e9cc 145\r
146/**\r
147 This function try to retrieve string from String package of current language.\r
148 If fails, it try to retrieve string from String package of first language it support.\r
149\r
150 If StringSize is NULL, then ASSERT.\r
151 If String is NULL and *StringSize is not 0, then ASSERT.\r
152 If PackageList could not be found in the default HII database, then ASSERT.\r
153 If StringId is not found in PackageList, then ASSERT.\r
154\r
155 @param PackageList The package list in the HII database to search for\r
156 the specified string.\r
157 @param StringId The string's id, which is unique within\r
158 PackageList.\r
159 @param String Points to the new null-terminated string.\r
160 @param StringSize On entry, points to the size of the buffer pointed\r
161 to by String, in bytes. On return, points to the\r
162 length of the string, in bytes.\r
163\r
164 @retval EFI_SUCCESS The string was returned successfully.\r
165 @retval EFI_NOT_FOUND The string specified by StringId is not available.\r
166 @retval EFI_BUFFER_TOO_SMALL The buffer specified by StringLength is too small\r
167 to hold the string.\r
168\r
169**/\r
170EFI_STATUS\r
171EFIAPI\r
172HiiLibGetString (\r
173 IN EFI_HII_HANDLE PackageList,\r
174 IN EFI_STRING_ID StringId,\r
175 OUT EFI_STRING String,\r
176 IN OUT UINTN *StringSize\r
b9982883
LG
177 )\r
178;\r
4c76e9cc 179\r
180/**\r
181 Get string specified by StringId form the HiiHandle. The caller\r
182 is responsible to free the *String.\r
183\r
184 If String is NULL, then ASSERT.\r
185 If HiiHandle could not be found in the default HII database, then ASSERT.\r
186 If StringId is not found in PackageList, then ASSERT.\r
187\r
188 @param HiiHandle The HII handle of package list.\r
189 @param StringId The String ID.\r
190 @param String The output string.\r
191\r
192 @retval EFI_NOT_FOUND String is not found.\r
193 @retval EFI_SUCCESS Operation is successful.\r
194 @retval EFI_OUT_OF_RESOURCES There is not enought memory in the system.\r
195\r
196**/\r
197EFI_STATUS\r
198EFIAPI\r
199HiiLibGetStringFromHandle (\r
200 IN EFI_HII_HANDLE HiiHandle,\r
201 IN EFI_STRING_ID StringId,\r
202 OUT EFI_STRING *String\r
b9982883
LG
203 )\r
204;\r
4c76e9cc 205\r
206/**\r
207 Get the string given the StringId and String package Producer's Guid. The caller\r
208 is responsible to free the *String.\r
209\r
210 If PackageList with the matching ProducerGuid is not found, then ASSERT.\r
211 If PackageList with the matching ProducerGuid is found but no String is\r
212 specified by StringId is found, then ASSERT.\r
213\r
214 @param ProducerGuid The Guid of String package list.\r
215 @param StringId The String ID.\r
216 @param String The output string.\r
217\r
218 @retval EFI_SUCCESS Operation is successful.\r
219 @retval EFI_OUT_OF_RESOURCES There is not enought memory in the system.\r
220\r
221**/\r
222EFI_STATUS\r
223EFIAPI\r
224HiiLibGetStringFromToken (\r
225 IN EFI_GUID *ProducerGuid,\r
226 IN EFI_STRING_ID StringId,\r
227 OUT EFI_STRING *String\r
b9982883
LG
228 )\r
229;\r
4c76e9cc 230\r
231/**\r
232 Determines the handles that are currently active in the database.\r
233 It's the caller's responsibility to free handle buffer.\r
234\r
235 If HandleBufferLength is NULL, then ASSERT.\r
236 If HiiHandleBuffer is NULL, then ASSERT.\r
237\r
238 @param HandleBufferLength On input, a pointer to the length of the handle\r
239 buffer. On output, the length of the handle buffer\r
240 that is required for the handles found.\r
241 @param HiiHandleBuffer Pointer to an array of Hii Handles returned.\r
242\r
243 @retval EFI_SUCCESS Get an array of Hii Handles successfully.\r
244\r
245**/\r
246EFI_STATUS\r
247EFIAPI\r
248HiiLibGetHiiHandles (\r
249 IN OUT UINTN *HandleBufferLength,\r
250 OUT EFI_HII_HANDLE **HiiHandleBuffer\r
b9982883
LG
251 )\r
252;\r
4c76e9cc 253\r
254/**\r
255 Extract Hii package list GUID for given HII handle.\r
256\r
257 If HiiHandle could not be found in the default HII database, then ASSERT.\r
258 If Guid is NULL, then ASSERT.\r
259\r
260 @param Handle Hii handle\r
261 @param Guid Package list GUID\r
262\r
263 @retval EFI_SUCCESS Successfully extract GUID from Hii database.\r
264\r
265**/\r
266EFI_STATUS\r
267EFIAPI\r
268HiiLibExtractGuidFromHiiHandle (\r
269 IN EFI_HII_HANDLE Handle,\r
270 OUT EFI_GUID *Guid\r
b9982883
LG
271 )\r
272;\r
4c76e9cc 273\r
274/**\r
275 Find HII Handle in the default HII database associated with given Device Path.\r
276\r
277 If DevicePath is NULL, then ASSERT.\r
278\r
279 @param DevicePath Device Path associated with the HII package list\r
280 handle.\r
281\r
282 @retval Handle HII package list Handle associated with the Device\r
283 Path.\r
284 @retval NULL Hii Package list handle is not found.\r
285\r
286**/\r
287EFI_HII_HANDLE\r
288EFIAPI\r
289HiiLibDevicePathToHiiHandle (\r
290 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
b9982883
LG
291 )\r
292;\r
4c76e9cc 293\r
294\r
295/**\r
296 Get next language from language code list (with separator ';').\r
297\r
298 If LangCode is NULL, then ASSERT.\r
299 If Lang is NULL, then ASSERT.\r
300\r
301 @param LangCode On input: point to first language in the list. On\r
302 output: point to next language in the list, or\r
303 NULL if no more language in the list.\r
304 @param Lang The first language in the list.\r
305\r
306**/\r
307VOID\r
308EFIAPI\r
309HiiLibGetNextLanguage (\r
310 IN OUT CHAR8 **LangCode,\r
311 OUT CHAR8 *Lang\r
b9982883
LG
312 )\r
313;\r
4c76e9cc 314\r
315/**\r
316 This function returns the list of supported languages, in the format specified\r
317 in UEFI specification Appendix M.\r
318\r
319 If HiiHandle is not a valid Handle in the default HII database, then ASSERT.\r
320\r
321 @param HiiHandle The HII package list handle.\r
322\r
323 @retval !NULL The supported languages.\r
324 @retval NULL If Supported Languages can not be retrived.\r
325\r
326**/\r
327CHAR8 *\r
328EFIAPI\r
329HiiLibGetSupportedLanguages (\r
330 IN EFI_HII_HANDLE HiiHandle\r
b9982883
LG
331 )\r
332;\r
4c76e9cc 333\r
334/**\r
335 This function returns the list of supported 2nd languages, in the format specified\r
336 in UEFI specification Appendix M.\r
337\r
338 If HiiHandle is not a valid Handle in the default HII database, then ASSERT.\r
339 If not enough resource to complete the operation, then ASSERT.\r
340\r
341 @param HiiHandle The HII package list handle.\r
342 @param FirstLanguage Pointer to language name buffer.\r
343 \r
344 @return The supported languages.\r
345\r
346**/\r
347CHAR8 *\r
348EFIAPI\r
349HiiLibGetSupportedSecondaryLanguages (\r
350 IN EFI_HII_HANDLE HiiHandle,\r
351 IN CONST CHAR8 *FirstLanguage\r
b9982883
LG
352 )\r
353;\r
4c76e9cc 354\r
355\r
356/**\r
357 This function returns the number of supported languages on HiiHandle.\r
358\r
359 If HiiHandle is not a valid Handle in the default HII database, then ASSERT.\r
360 If not enough resource to complete the operation, then ASSERT.\r
361\r
362 @param HiiHandle The HII package list handle.\r
363\r
364 @return The number of supported languages.\r
365\r
366**/\r
367UINT16\r
368EFIAPI\r
369HiiLibGetSupportedLanguageNumber (\r
370 IN EFI_HII_HANDLE HiiHandle\r
b9982883
LG
371 )\r
372;\r
4c76e9cc 373\r
374/**\r
375 Exports the contents of one or all package lists in the HII database into a buffer.\r
376\r
377 If Handle is not NULL and not a valid EFI_HII_HANDLE registered in the database, \r
378 then ASSERT.\r
379 If PackageListHeader is NULL, then ASSERT.\r
380 If PackageListSize is NULL, then ASSERT.\r
381\r
382 @param Handle The HII Handle.\r
383 @param PackageListHeader A pointer to a buffer that will contain the results of \r
384 the export function.\r
385 @param PackageListSize On output, the length of the buffer that is required for the exported data.\r
386\r
387 @retval EFI_SUCCESS Package exported.\r
388\r
389 @retval EFI_OUT_OF_RESOURCES Not enought memory to complete the operations.\r
390\r
391**/\r
392EFI_STATUS \r
393EFIAPI\r
394HiiLibExportPackageLists (\r
395 IN EFI_HII_HANDLE Handle,\r
396 OUT EFI_HII_PACKAGE_LIST_HEADER **PackageListHeader,\r
397 OUT UINTN *PackageListSize\r
b9982883
LG
398 )\r
399;\r
4c76e9cc 400\r
401/**\r
402 \r
403 This function returns a list of the package handles of the \r
404 specified type that are currently active in the HII database. The \r
405 pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package \r
406 handles to be listed.\r
407\r
408 If HandleBufferLength is NULL, then ASSERT.\r
409 If HandleBuffer is NULL, the ASSERT.\r
410 If PackageType is EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is\r
411 NULL, then ASSERT.\r
412 If PackageType is not EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is not\r
413 NULL, then ASSERT.\r
414 \r
415 \r
416 @param PackageType Specifies the package type of the packages\r
417 to list or EFI_HII_PACKAGE_TYPE_ALL for\r
418 all packages to be listed.\r
419 \r
420 @param PackageGuid If PackageType is\r
421 EFI_HII_PACKAGE_TYPE_GUID, then this is\r
422 the pointer to the GUID which must match\r
423 the Guid field of\r
424 EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it\r
425 must be NULL.\r
426 \r
427 @param HandleBufferLength On output, the length of the handle buffer\r
428 that is required for the handles found.\r
429\r
430 @param HandleBuffer On output, an array of EFI_HII_HANDLE instances returned.\r
431 The caller is responcible to free this pointer allocated.\r
432\r
433 @retval EFI_SUCCESS The matching handles are outputed successfully.\r
434 HandleBufferLength is updated with the actual length.\r
435 @retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operation.\r
436 @retval EFI_NOT_FOUND No matching handle could not be found in database.\r
437**/\r
438EFI_STATUS\r
439EFIAPI\r
440HiiLibListPackageLists (\r
441 IN UINT8 PackageType,\r
442 IN CONST EFI_GUID *PackageGuid,\r
443 IN OUT UINTN *HandleBufferLength,\r
444 OUT EFI_HII_HANDLE **Handle\r
b9982883
LG
445 )\r
446;\r
4c76e9cc 447\r
448/**\r
449 Convert language code from RFC3066 to ISO639-2.\r
450\r
451 LanguageRfc3066 contain a single RFC 3066 code such as\r
452 "en-US" or "fr-FR".\r
453\r
454 The LanguageRfc3066 must be a buffer large enough\r
455 for ISO_639_2_ENTRY_SIZE characters.\r
456\r
457 If LanguageRfc3066 is NULL, then ASSERT.\r
458 If LanguageIso639 is NULL, then ASSERT.\r
459\r
460 @param LanguageRfc3066 RFC3066 language code.\r
461 @param LanguageIso639 ISO639-2 language code.\r
462\r
463 @retval EFI_SUCCESS Language code converted.\r
464 @retval EFI_NOT_FOUND Language code not found.\r
465\r
466**/\r
467EFI_STATUS\r
468EFIAPI\r
469ConvertRfc3066LanguageToIso639Language (\r
470 IN CHAR8 *LanguageRfc3066,\r
471 OUT CHAR8 *LanguageIso639\r
b9982883
LG
472 )\r
473;\r
4c76e9cc 474\r
475/**\r
ea7cd3ec 476 Convert language code from ISO639-2 to RFC3066 and return the converted language.\r
477 Caller is responsible for freeing the allocated buffer.\r
4c76e9cc 478\r
479 LanguageIso639 contain a single ISO639-2 code such as\r
480 "eng" or "fra".\r
481\r
4c76e9cc 482 If LanguageIso639 is NULL, then ASSERT.\r
483 If LanguageRfc3066 is NULL, then ASSERT.\r
484\r
485 @param LanguageIso639 ISO639-2 language code.\r
4c76e9cc 486\r
ea7cd3ec 487 @return the allocated buffer or NULL, if the language is not found.\r
4c76e9cc 488\r
489**/\r
ea7cd3ec 490CHAR8*\r
4c76e9cc 491EFIAPI\r
492ConvertIso639LanguageToRfc3066Language (\r
ea7cd3ec 493 IN CONST CHAR8 *LanguageIso639\r
b9982883
LG
494 )\r
495;\r
4c76e9cc 496\r
497/**\r
498 Convert language code list from RFC3066 to ISO639-2, e.g. "en-US;fr-FR" will\r
499 be converted to "engfra".\r
500\r
501 If SupportedLanguages is NULL, then ASSERT.\r
502\r
503 @param SupportedLanguages The RFC3066 language list.\r
504\r
505 @return The ISO639-2 language list.\r
506\r
507**/\r
508CHAR8 *\r
509EFIAPI\r
510Rfc3066ToIso639 (\r
511 CHAR8 *SupportedLanguages\r
b9982883
LG
512 )\r
513;\r
4c76e9cc 514\r
7e3bcccb
LG
515\r
516////////////////////////////////////////////////////////\r
517////////////////////////////////////////////////////////\r
518// HiiLib Functions\r
519////////////////////////////////////////////////////////\r
520////////////////////////////////////////////////////////\r
521\r
522/**\r
523 Registers a list of packages in the HII Database and returns the HII Handle\r
524 associated with that registration. If an HII Handle has already been registered\r
525 with the same PackageListGuid, then NULL is returned. If there are not enough \r
526 resources to perform the registration, then NULL is returned. If an empty list \r
527 of packages is passed in, then NULL is returned. If the size of the list of \r
528 package is 0, then NULL is returned.\r
529\r
530 @param[in] PackageListGuid An optional parameter that is used to identify \r
531 the GUID of the package list. If this parameter \r
532 is NULL, then gEfiCallerIdGuid is used.\r
533 @param[in] DeviceHandle Optional. If not NULL, the Device Handle on which \r
534 an instance of DEVICE_PATH_PROTOCOL is installed.\r
535 This Device Handle uniquely defines the device that \r
536 the added packages are associated with.\r
537 @param[in] ... The variable argument list that contains pointers \r
538 to packages terminated by a NULL.\r
539\r
540 @retval NULL A HII Handle has already been registered in the HII Database with\r
541 the same PackageListGuid.\r
542 @retval NULL The HII Handle could not be created.\r
543 @retval Other The HII Handle associated with the newly registered package list.\r
544\r
545**/\r
546EFI_HII_HANDLE\r
547EFIAPI\r
548HiiAddPackages (\r
549 IN CONST EFI_GUID *PackageListGuid, OPTIONAL\r
550 IN EFI_HANDLE DeviceHandle, OPTIONAL\r
551 ...\r
552 );\r
553\r
554/**\r
555 Removes a package list from the HII Database.\r
556\r
557 If HiiHandle is NULL, then ASSERT().\r
558 If HiiHandle is not a valid EFI_HII_HANDLE in the HII Database, then ASSERT().\r
559\r
560 @param[in] HiiHandle A handle that was previously registered in the HII Database.\r
561\r
562**/\r
563VOID\r
564EFIAPI\r
565HiiRemovePackages (\r
566 IN EFI_HII_HANDLE HiiHandle\r
567 );\r
568\r
569/**\r
570 Retrieves the array of all the HII Handles in the HII Database.\r
571 This array is terminated with a NULL HII Handle.\r
572 This function allocates the returned array using AllocatePool().\r
573 The caller is responsible for freeing the array with FreePool().\r
574\r
575 @param[in] PackageListGuid An optional parameter that is used to request \r
576 an HII Handle that is associatd with a specific\r
577 Package List GUID. If this parameter is NULL\r
578 then all the HII Handles in the HII Database\r
579 are returned. If this parameter is not NULL\r
580 then at most 1 HII Handle is returned.\r
581\r
582 @retval NULL There are no HII handles in the HII database\r
583 @retval NULL The array of HII Handles could not be retrieved\r
584 @retval Other A pointer to the NULL terminated array of HII Handles\r
585\r
586**/\r
587EFI_HII_HANDLE *\r
588EFIAPI\r
589HiiGetHiiHandles (\r
590 IN CONST EFI_GUID *PackageListGuid OPTIONAL\r
591 );\r
592\r
593/**\r
594 Retrieves a pointer to the a Null-terminated ASCII string containing the list \r
595 of languages that an HII handle in the HII Database supports. The returned \r
596 string is allocated using AllocatePool(). The caller is responsible for freeing\r
597 the returned string using FreePool(). The format of the returned string follows\r
598 the language format assumed the HII Database.\r
599 \r
600 If HiiHandle is NULL, then ASSERT().\r
601\r
602 @param[in] HiiHandle A handle that was previously registered in the HII Database.\r
603\r
604 @retval NULL HiiHandle is not registered in the HII database\r
605 @retval NULL There are not enough resources available to retrieve the suported \r
606 languages.\r
607 @retval NULL The list of suported languages could not be retrieved.\r
608 @retval Other A pointer to the Null-terminated ASCII string of supported languages.\r
609\r
610**/\r
611CHAR8 *\r
612EFIAPI\r
613HiiGetSupportedLanguages (\r
614 IN EFI_HII_HANDLE HiiHandle\r
615 );\r
616\r
617/**\r
618 Retrieves a string from a string package in a specific language. If the language\r
619 is not specified, then a string from a string package in the current platform \r
620 language is retrieved. If the string can not be retrieved using the specified \r
621 language or the current platform language, then the string is retrieved from \r
622 the string package in the first language the string package supports. The \r
623 returned string is allocated using AllocatePool(). The caller is responsible \r
624 for freeing the allocated buffer using FreePool().\r
625 \r
626 If HiiHandle is NULL, then ASSERT().\r
627 If StringId is 0, then ASSET.\r
628\r
629 @param[in] HiiHandle A handle that was previously registered in the HII Database.\r
630 @param[in] StringId The identifier of the string to retrieved from the string \r
631 package associated with HiiHandle.\r
632 @param[in] Language The language of the string to retrieve. If this parameter \r
633 is NULL, then the current platform language is used. The \r
634 format of Language must follow the language format assumed \r
635 the HII Database.\r
636\r
637 @retval NULL The string specified by StringId is not present in the string package.\r
638 @retval Other The string was returned.\r
639\r
640**/\r
641EFI_STRING\r
642EFIAPI\r
643HiiGetString (\r
644 IN EFI_HII_HANDLE HiiHandle,\r
645 IN EFI_STRING_ID StringId,\r
646 IN CONST CHAR8 *Language OPTIONAL\r
647 );\r
648\r
649/**\r
650 Retrieves a string from a string package names by GUID in a specific language. \r
651 If the language is not specified, then a string from a string package in the \r
652 current platform language is retrieved. If the string can not be retrieved \r
653 using the specified language or the current platform language, then the string \r
654 is retrieved from the string package in the first language the string package \r
655 supports. The returned string is allocated using AllocatePool(). The caller \r
656 is responsible for freeing the allocated buffer using FreePool().\r
657 \r
658 If PackageListGuid is NULL, then ASSERT().\r
659 If StringId is 0, then ASSET.\r
660\r
661 @param[in] PackageListGuid The GUID of a package list that was previously \r
662 registered in the HII Database.\r
663 @param[in] StringId The identifier of the string to retrieved from the \r
664 string package associated with PackageListGuid.\r
665 @param[in] Language The language of the string to retrieve. If this \r
666 parameter is NULL, then the current platform \r
667 language is used. The format of Language must \r
668 follow the language format assumed the HII Database.\r
669\r
670 @retval NULL The package list specified by PackageListGuid is not present in the\r
671 HII Database.\r
672 @retval NULL The string specified by StringId is not present in the string package.\r
673 @retval Other The string was returned.\r
674\r
675**/\r
676EFI_STRING\r
677EFIAPI\r
678HiiGetPackageString (\r
679 IN CONST EFI_GUID *PackageListGuid,\r
680 IN EFI_STRING_ID StringId,\r
681 IN CONST CHAR8 *Language OPTIONAL\r
682 );\r
683\r
684/**\r
685 This function create a new string in String Package or updates an existing \r
686 string in a String Package. If StringId is 0, then a new string is added to\r
687 a String Package. If StringId is not zero, then a string in String Package is\r
688 updated. If SupportedLanguages is NULL, then the string is added or updated\r
689 for all the languages that the String Package supports. If SupportedLanguages\r
690 is not NULL, then the string is added or updated for the set of languages \r
691 specified by SupportedLanguages.\r
692 \r
693 If HiiHandle is NULL, then ASSERT().\r
694 If String is NULL, then ASSERT().\r
695\r
696 @param[in] HiiHandle A handle that was previously registered in the \r
697 HII Database.\r
698 @param[in] StringId If zero, then a new string is created in the \r
699 String Package associated with HiiHandle. If \r
700 non-zero, then the string specified by StringId \r
701 is updated in the String Package associated \r
702 with HiiHandle. \r
703 @param[in] String A pointer to the Null-terminated Unicode string \r
704 to add or update in the String Package associated \r
705 with HiiHandle.\r
706 @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string of \r
707 language codes. If this parameter is NULL, then \r
708 String is added or updated in the String Package \r
709 associated with HiiHandle for all the languages \r
710 that the String Package supports. If this \r
711 parameter is not NULL, then then String is added \r
712 or updated in the String Package associated with \r
713 HiiHandle for the set oflanguages specified by \r
714 SupportedLanguages. The format of \r
715 SupportedLanguages must follow the language \r
716 format assumed the HII Database.\r
717\r
718 @retval 0 The string could not be added or updated in the String Package.\r
719 @retval Other The EFI_STRING_ID of the newly added or updated string.\r
720\r
721**/\r
722EFI_STRING_ID\r
723EFIAPI\r
724HiiSetString (\r
725 IN EFI_HII_HANDLE HiiHandle,\r
726 IN EFI_STRING_ID StringId, OPTIONAL\r
727 IN CONST EFI_STRING String,\r
728 IN CONST CHAR8 *SupportedLanguages OPTIONAL\r
729 );\r
730\r
731/**\r
732 Validates the config data associated with an HII handle in the HII Database.\r
733 \r
734 If HiiHandle is NULL, then ASSERT().\r
735\r
736 @param[in] HiiHandle A handle that was previously registered in the HII Database.\r
737\r
738 @retval TRUE The config data associated with HiiHandle passes all validation\r
739 checks.\r
740 @retval FALSE The config data associated with HiiHandle failed one or more \r
741 validation checks.\r
742\r
743**/\r
744BOOLEAN\r
745EFIAPI\r
746HiiValidateDataFromHiiHandle (\r
747 IN EFI_HII_HANDLE HiiHandle\r
748 );\r
749\r
750/**\r
751 Allocates and returns a Null-terminated Unicode <ConfigHdr> string using routing \r
752 information that includes a GUID, an optional Unicode string name, and a device\r
753 path. The string returned is allocated with AllocatePool(). The caller is \r
754 responsible for freeing the allocated string with FreePool().\r
755 \r
756 The format of a <ConfigHdr> is as follows:\r
757\r
758 GUID=<HexCh>32&NAME=<Char>NameLength&PATH=<HexChar>DevicePathSize<Null>\r
759\r
760 @param[in] Guid Pointer to an EFI_GUID that is the routing information\r
761 GUID. Each of the 16 bytes in Guid is converted to \r
762 a 2 Unicode character hexidecimal string. This is \r
763 an optional parameter that may be NULL.\r
764 @param[in] Name Pointer to a Null-terminated Unicode string that is \r
765 the routing information NAME. This is an optional \r
766 parameter that may be NULL. Each 16-bit Unicode \r
767 character in Name is converted to a 4 character Unicode \r
768 hexidecimal string. \r
769 @param[in] DriverHandle The driver handle which supports a Device Path Protocol\r
770 that is the routing information PATH. Each byte of\r
771 the Device Path associated with DriverHandle is converted\r
772 to a 2 Unicode character hexidecimal string.\r
773\r
774 @retval NULL DriverHandle does not support the Device Path Protocol.\r
775 @retval NULL DriverHandle does not support the Device Path Protocol.\r
776 @retval Other A pointer to the Null-terminate Unicode <ConfigHdr> string\r
777\r
778**/\r
779EFI_STRING\r
780EFIAPI\r
781HiiConstructConfigHdr (\r
782 IN CONST EFI_GUID *Guid, OPTIONAL\r
783 IN CONST CHAR16 *Name, OPTIONAL\r
784 IN EFI_HANDLE DriverHandle\r
785 );\r
786\r
787/**\r
788 Allocates and returns a Null-terminated Unicode <ConfigAltResp> string.\r
789\r
790 If Guid is NULL, then ASSERT().\r
791 If Name is NULL, then ASSERT().\r
792 If BlockNameArray is NULL, then ASSERT().\r
793\r
794 @param[in] Guid GUID of the buffer storage.\r
795 @param[in] Name Name of the buffer storage.\r
796 @param[in] DriverHandle The DriverHandle that support a Device Path\r
797 Protocol. \r
798 @param[in] BufferStorage Content of the buffer storage.\r
799 @param[in] BufferStorageSize Length in bytes of the buffer storage.\r
800 @param[in] BlockNameArray Array generated by VFR compiler. This array\r
801 contains a UINT32 value that is the length\r
802 of BlockNameArray in bytes, followed by pairs\r
803 of 16-bit values that are the offset and length\r
804 values used to contruct a <ConfigRequest> string.\r
805 @param[in] ... A variable argument list that contains pairs of 16-bit\r
806 ALTCFG identifiers and pointers to DefaultValueArrays.\r
807 The variable argument list is terminated by a NULL \r
808 DefaultValueArray pointer. A DefaultValueArray \r
809 contains a UINT32 value that is the length, in bytes,\r
810 of the DefaultValueArray. The UINT32 length value \r
811 is followed by a series of records that contain\r
812 a 16-bit WIDTH value followed by a byte array with \r
813 WIDTH entries. The records must be parsed from\r
814 beginning to end until the UINT32 length limit\r
815 is reached. \r
816\r
817 @retval NULL There are not enough resources to process the request.\r
818 @retval NULL A <ConfigResp> could not be retrieved from the Config \r
819 Routing Protocol.\r
820 @retval Other A pointer to the Null-terminate Unicode <ConfigAltResp>\r
821 string.\r
822\r
823**/\r
824EFI_STRING\r
825EFIAPI\r
826HiiConstructConfigAltResp (\r
827 IN CONST EFI_GUID *Guid,\r
828 IN CONST CHAR16 *Name,\r
829 IN EFI_HANDLE DriverHandle,\r
830 IN CONST VOID *BufferStorage,\r
831 IN UINTN BufferStorageSize,\r
832 IN CONST VOID *BlockNameArray, \r
833 ...\r
834 );\r
835\r
836/**\r
837 Determines if the routing data specified by GUID and NAME match a <ConfigHdr>.\r
838\r
839 If ConfigHdr is NULL, then ASSERT().\r
840\r
841 @param[in] ConfigHdr Either <ConfigRequest> or <ConfigResp>.\r
842 @param[in] Guid GUID of the storage.\r
843 @param[in] Name NAME of the storage.\r
844\r
845 @retval TRUE Routing information matches <ConfigHdr>.\r
846 @retval FALSE Routing information does not match <ConfigHdr>.\r
847\r
848**/\r
849BOOLEAN\r
850EFIAPI\r
851HiiIsConfigHdrMatch (\r
852 IN CONST EFI_STRING ConfigHdr,\r
853 IN CONST EFI_GUID *Guid, OPTIONAL\r
854 IN CONST CHAR16 *Name OPTIONAL\r
855 );\r
856\r
857/**\r
858 Retrieves uncommited data from the Form Browser and converts it to a binary\r
859 buffer. The returned buffer is allocated using AllocatePool(). The caller\r
860 is responsible for freeing the returned buffer using FreePool().\r
861\r
862 @param[in] VariableName Pointer to a Null-terminated Unicode string. This \r
863 is an optional parameter that may be NULL.\r
864 @param[in] VariableGuid Pointer to an EFI_GUID structure. This is an optional \r
865 parameter that may be NULL.\r
866 @param[in] BufferSize Length in bytes of buffer to hold retrived data. \r
867\r
868 @retval NULL The uncommitted data could not be retrieved.\r
869 @retval Other A pointer to a buffer containing the uncommitted data.\r
870\r
871**/\r
872UINT8 *\r
873EFIAPI\r
874HiiGetBrowserData (\r
875 IN CONST EFI_GUID *VariableGuid, OPTIONAL\r
876 IN CONST CHAR16 *VariableName, OPTIONAL\r
877 IN UINTN BlockSize\r
878 );\r
879\r
880/**\r
881 Updates uncommitted data in the Form Browser.\r
882\r
883 If Buffer is NULL, then ASSERT().\r
884\r
885 @param[in] VariableName Pointer to a Null-terminated Unicode string. This\r
886 is an optional parameter that may be NULL.\r
887 @param[in] VariableGuid Pointer to an EFI_GUID structure. This is an optional\r
888 parameter that may be NULL.\r
889 @param[in] BufferSize Length, in bytes, of Buffer.\r
890 @param[in] Buffer Buffer of data to commit.\r
891 @param[in] RequestElement An optional field to specify which part of the\r
892 buffer data will be send back to Browser. If NULL,\r
893 the whole buffer of data will be committed to\r
894 Browser. \r
895 <RequestElement> ::= &OFFSET=<Number>&WIDTH=<Number>*\r
896\r
897 @retval FALSE The uncommitted data could not be updated.\r
898 @retval TRUE The uncommitted data was updated.\r
899\r
900**/\r
901BOOLEAN\r
902EFIAPI\r
903HiiSetBrowserData (\r
904 IN CONST EFI_GUID *VariableGuid, OPTIONAL\r
905 IN CONST CHAR16 *VariableName, OPTIONAL\r
906 IN UINTN BufferSize,\r
907 IN CONST UINT8 *Buffer,\r
908 IN CONST CHAR16 *RequestElement OPTIONAL\r
909 );\r
910\r
911/////////////////////////////////////////\r
912/////////////////////////////////////////\r
913/// IFR Functions\r
914/////////////////////////////////////////\r
915/////////////////////////////////////////\r
916\r
917/**\r
918 Returns a UINT64 value that contains bitfields for Hour, Minute, and Second.\r
919 The lower 8-bits of Hour are placed in bits 0..7. The lower 8-bits of Minute \r
920 are placed in bits 8..15, and the lower 8-bits of Second are placed in bits \r
921 16..23. This format is selected because it can be easily translated to \r
922 an EFI_HII_TIME structure in an EFI_IFR_TYPE_VALUE union.\r
923\r
924 @param Hour The hour value to be encoded.\r
925 @param Minute The miniute value to be encoded.\r
926 @param Second The second value to be encoded.\r
927\r
928 @return A 64-bit containing Hour, Minute, and Second.\r
929**/\r
930#define EFI_HII_TIME_UINT64(Hour, Minute, Second) \\r
931 (UINT64)((Hour & 0xff) | ((Minute & 0xff) << 8) | ((Second & 0xff) << 16))\r
932\r
933/**\r
934 Returns a UINT64 value that contains bitfields for Year, Month, and Day.\r
935 The lower 16-bits of Year are placed in bits 0..15. The lower 8-bits of Month \r
936 are placed in bits 16..23, and the lower 8-bits of Day are placed in bits \r
937 24..31. This format is selected because it can be easily translated to \r
938 an EFI_HII_DATE structure in an EFI_IFR_TYPE_VALUE union.\r
939\r
940 @param Year The year value to be encoded.\r
941 @param Month The month value to be encoded.\r
942 @param Day The day value to be encoded.\r
943\r
944 @return A 64-bit containing Year, Month, and Day.\r
945**/\r
946#define EFI_HII_DATE_UINT64(Year, Month, Day) \\r
947 (UINT64)((Year & 0xffff) | ((Month & 0xff) << 16) | ((Day & 0xff) << 24))\r
948\r
949/**\r
950 Allocates and returns a new OpCode Handle. OpCode Handles must be freed with \r
951 HiiFreeOpCodeHandle().\r
952\r
953 @retval NULL There are not enough resources to allocate a new OpCode Handle.\r
954 @retval Other A new OpCode handle.\r
955\r
956**/\r
957VOID *\r
958EFIAPI\r
959HiiAllocateOpCodeHandle (\r
960 VOID\r
961 );\r
962\r
963/**\r
964 Frees an OpCode Handle that was peviously allocated with HiiAllocateOpCodeHandle().\r
965 When an OpCode Handle is freed, all of the opcodes associated with the OpCode\r
966 Handle are also freed.\r
967\r
968 If OpCodeHandle is NULL, then ASSERT().\r
969\r
970**/\r
971VOID\r
972EFIAPI\r
973HiiFreeOpCodeHandle (\r
974 VOID *OpCodeHandle\r
975 );\r
976\r
977/**\r
978 Create EFI_IFR_END_OP opcode.\r
979\r
980 If OpCodeHandle is NULL, then ASSERT().\r
981\r
982 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
983\r
984 @retval NULL There is not enough space left in Buffer to add the opcode.\r
985 @retval Other A pointer to the created opcode.\r
986\r
987**/\r
988UINT8 *\r
989EFIAPI\r
990HiiCreateEndOpCode (\r
991 IN VOID *OpCodeHandle\r
992 );\r
993\r
994/**\r
995 Create EFI_IFR_ONE_OF_OPTION_OP opcode.\r
996\r
997 If OpCodeHandle is NULL, then ASSERT().\r
998 If Type is invalid, then ASSERT().\r
999 If Flags is invalid, then ASSERT().\r
1000\r
1001 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
1002 @param[in] StringId StringId for the option\r
1003 @param[in] Flags Flags for the option\r
1004 @param[in] Type Type for the option\r
1005 @param[in] Value Value for the option\r
1006\r
1007 @retval NULL There is not enough space left in Buffer to add the opcode.\r
1008 @retval Other A pointer to the created opcode.\r
1009\r
1010**/\r
1011UINT8 *\r
1012EFIAPI\r
1013HiiCreateOneOfOptionOpCode (\r
1014 IN VOID *OpCodeHandle,\r
1015 IN UINT16 StringId,\r
1016 IN UINT8 Flags,\r
1017 IN UINT8 Type,\r
1018 IN UINT64 Value\r
1019 );\r
1020\r
1021/**\r
1022 Create EFI_IFR_DEFAULT_OP opcode.\r
1023\r
1024 If OpCodeHandle is NULL, then ASSERT().\r
1025 If Type is invalid, then ASSERT().\r
1026\r
1027 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
1028 @param[in] DefaultId DefaultId for the default\r
1029 @param[in] Type Type for the default\r
1030 @param[in] Value Value for the default\r
1031\r
1032 @retval NULL There is not enough space left in Buffer to add the opcode.\r
1033 @retval Other A pointer to the created opcode.\r
1034\r
1035**/\r
1036UINT8 *\r
1037EFIAPI\r
1038HiiCreateDefaultOpCode (\r
1039 IN VOID *OpCodeHandle,\r
1040 IN UINT16 DefaultId,\r
1041 IN UINT8 Type,\r
1042 IN UINT64 Value\r
1043 );\r
1044\r
1045/**\r
1046 Create EFI_IFR_GUID opcode.\r
1047\r
1048 If OpCodeHandle is NULL, then ASSERT().\r
1049 If Guid is NULL, then ASSERT().\r
1050 If OpCodeSize < sizeof (EFI_IFR_GUID), then ASSERT().\r
1051\r
1052 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
1053 @param[in] Guid Pointer to EFI_GUID of this guided opcode.\r
1054 @param[in] GuidOpCode Pointer to an EFI_IFR_GUID opcode. This is an \r
1055 optional parameter that may be NULL. If this\r
1056 parameter is NULL, then the GUID extension \r
1057 region of the created opcode is filled with zeros.\r
1058 If this parameter is not NULL, then the GUID \r
1059 extension region of GuidData will be copied to \r
1060 the GUID extension region of the created opcode.\r
1061 @param[in] OpCodeSize The size, in bytes, of created opcode. This value \r
1062 must be >= sizeof(EFI_IFR_GUID).\r
1063\r
1064 @retval NULL There is not enough space left in Buffer to add the opcode.\r
1065 @retval Other A pointer to the created opcode.\r
1066\r
1067**/\r
1068UINT8 *\r
1069EFIAPI\r
1070HiiCreateGuidOpCode (\r
1071 IN VOID *OpCodeHandle,\r
1072 IN CONST EFI_GUID *Guid,\r
1073 IN CONST VOID *GuidOpCode, OPTIONAL\r
1074 IN UINTN OpCodeSize\r
1075 );\r
1076\r
1077/**\r
1078 Create EFI_IFR_ACTION_OP opcode.\r
1079\r
1080 If OpCodeHandle is NULL, then ASSERT().\r
1081 If any reserved bits are set in QuestionFlags, then ASSERT().\r
1082\r
1083 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
1084 @param[in] QuestionId Question ID\r
1085 @param[in] Prompt String ID for Prompt\r
1086 @param[in] Help String ID for Help\r
1087 @param[in] QuestionFlags Flags in Question Header\r
1088 @param[in] QuestionConfig String ID for configuration\r
1089\r
1090 @retval NULL There is not enough space left in Buffer to add the opcode.\r
1091 @retval Other A pointer to the created opcode.\r
1092\r
1093**/\r
1094UINT8 *\r
1095EFIAPI\r
1096HiiCreateActionOpCode (\r
1097 IN VOID *OpCodeHandle,\r
1098 IN EFI_QUESTION_ID QuestionId,\r
1099 IN EFI_STRING_ID Prompt,\r
1100 IN EFI_STRING_ID Help,\r
1101 IN UINT8 QuestionFlags,\r
1102 IN EFI_STRING_ID QuestionConfig\r
1103 );\r
1104\r
1105/**\r
1106 Create EFI_IFR_SUBTITLE_OP opcode.\r
1107\r
1108 If OpCodeHandle is NULL, then ASSERT().\r
1109 If any reserved bits are set in Flags, then ASSERT().\r
1110 If Scope > 1, then ASSERT().\r
1111\r
1112 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
1113 @param[in] Prompt String ID for Prompt\r
1114 @param[in] Help String ID for Help\r
1115 @param[in] Flags Subtitle opcode flags\r
1116 @param[in] Scope 1 if this opcpde is the beginning of a new scope.\r
1117 0 if this opcode is within the current scope.\r
1118\r
1119 @retval NULL There is not enough space left in Buffer to add the opcode.\r
1120 @retval Other A pointer to the created opcode.\r
1121\r
1122**/\r
1123UINT8 *\r
1124EFIAPI\r
1125HiiCreateSubTitleOpCode (\r
1126 IN VOID *OpCodeHandle,\r
1127 IN EFI_STRING_ID Prompt,\r
1128 IN EFI_STRING_ID Help,\r
1129 IN UINT8 Flags,\r
1130 IN UINT8 Scope\r
1131 );\r
1132\r
1133/**\r
1134 Create EFI_IFR_REF_OP opcode.\r
1135\r
1136 If OpCodeHandle is NULL, then ASSERT().\r
1137 If any reserved bits are set in QuestionFlags, then ASSERT().\r
1138\r
1139 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
1140 @param[in] FormId Destination Form ID\r
1141 @param[in] Prompt String ID for Prompt\r
1142 @param[in] Help String ID for Help\r
1143 @param[in] QuestionFlags Flags in Question Header\r
1144 @param[in] QuestionId Question ID\r
1145\r
1146 @retval NULL There is not enough space left in Buffer to add the opcode.\r
1147 @retval Other A pointer to the created opcode.\r
1148\r
1149**/\r
1150UINT8 *\r
1151EFIAPI\r
1152HiiCreateGotoOpCode (\r
1153 IN VOID *OpCodeHandle,\r
1154 IN EFI_FORM_ID FormId,\r
1155 IN EFI_STRING_ID Prompt,\r
1156 IN EFI_STRING_ID Help,\r
1157 IN UINT8 QuestionFlags,\r
1158 IN EFI_QUESTION_ID QuestionId\r
1159 );\r
1160\r
1161/**\r
1162 Create EFI_IFR_CHECKBOX_OP opcode.\r
1163\r
1164 If OpCodeHandle is NULL, then ASSERT().\r
1165 If any reserved bits are set in QuestionFlags, then ASSERT().\r
1166 If any reserved bits are set in CheckBoxFlags, then ASSERT().\r
1167\r
1168 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
1169 @param[in] QuestionId Question ID\r
1170 @param[in] VarStoreId Storage ID\r
1171 @param[in] VarOffset Offset in Storage\r
1172 @param[in] Prompt String ID for Prompt\r
1173 @param[in] Help String ID for Help\r
1174 @param[in] QuestionFlags Flags in Question Header\r
1175 @param[in] CheckBoxFlags Flags for checkbox opcode\r
1176 @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This\r
1177 is an optional parameter that may be NULL.\r
1178\r
1179 @retval NULL There is not enough space left in Buffer to add the opcode.\r
1180 @retval Other A pointer to the created opcode.\r
1181\r
1182**/\r
1183UINT8 *\r
1184EFIAPI\r
1185HiiCreateCheckBoxOpCode (\r
1186 IN VOID *OpCodeHandle,\r
1187 IN EFI_QUESTION_ID QuestionId,\r
1188 IN EFI_VARSTORE_ID VarStoreId,\r
1189 IN UINT16 VarOffset,\r
1190 IN EFI_STRING_ID Prompt,\r
1191 IN EFI_STRING_ID Help,\r
1192 IN UINT8 QuestionFlags,\r
1193 IN UINT8 CheckBoxFlags,\r
1194 IN VOID *DefaultsOpCodeHandle OPTIONAL\r
1195 );\r
1196\r
1197/**\r
1198 Create EFI_IFR_NUMERIC_OP opcode.\r
1199\r
1200 If OpCodeHandle is NULL, then ASSERT().\r
1201 If any reserved bits are set in QuestionFlags, then ASSERT().\r
1202 If any reserved bits are set in NumericFlags, then ASSERT().\r
1203\r
1204 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
1205 @param[in] QuestionId Question ID\r
1206 @param[in] VarStoreId Storage ID\r
1207 @param[in] VarOffset Offset in Storage\r
1208 @param[in] Prompt String ID for Prompt\r
1209 @param[in] Help String ID for Help\r
1210 @param[in] QuestionFlags Flags in Question Header\r
1211 @param[in] NumericFlags Flags for numeric opcode\r
1212 @param[in] Minimum Numeric minimum value\r
1213 @param[in] Maximum Numeric maximum value\r
1214 @param[in] Step Numeric step for edit\r
1215 @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This\r
1216 is an optional parameter that may be NULL.\r
1217\r
1218 @retval NULL There is not enough space left in Buffer to add the opcode.\r
1219 @retval Other A pointer to the created opcode.\r
1220\r
1221**/\r
1222UINT8 *\r
1223EFIAPI\r
1224HiiCreateNumericOpCode (\r
1225 IN VOID *OpCodeHandle,\r
1226 IN EFI_QUESTION_ID QuestionId,\r
1227 IN EFI_VARSTORE_ID VarStoreId,\r
1228 IN UINT16 VarOffset,\r
1229 IN EFI_STRING_ID Prompt,\r
1230 IN EFI_STRING_ID Help,\r
1231 IN UINT8 QuestionFlags,\r
1232 IN UINT8 NumericFlags,\r
1233 IN UINT64 Minimum,\r
1234 IN UINT64 Maximum,\r
1235 IN UINT64 Step,\r
1236 IN VOID *DefaultsOpCodeHandle OPTIONAL\r
1237 );\r
1238\r
1239/**\r
1240 Create EFI_IFR_STRING_OP opcode.\r
1241\r
1242 If OpCodeHandle is NULL, then ASSERT().\r
1243 If any reserved bits are set in QuestionFlags, then ASSERT().\r
1244 If any reserved bits are set in StringFlags, then ASSERT().\r
1245\r
1246 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
1247 @param[in] QuestionId Question ID\r
1248 @param[in] VarStoreId Storage ID\r
1249 @param[in] VarOffset Offset in Storage\r
1250 @param[in] Prompt String ID for Prompt\r
1251 @param[in] Help String ID for Help\r
1252 @param[in] QuestionFlags Flags in Question Header\r
1253 @param[in] StringFlags Flags for string opcode\r
1254 @param[in] MinSize String minimum length\r
1255 @param[in] MaxSize String maximum length\r
1256 @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This\r
1257 is an optional parameter that may be NULL.\r
1258\r
1259 @retval NULL There is not enough space left in Buffer to add the opcode.\r
1260 @retval Other A pointer to the created opcode.\r
1261\r
1262**/\r
1263UINT8 *\r
1264EFIAPI\r
1265HiiCreateStringOpCode (\r
1266 IN VOID *OpCodeHandle,\r
1267 IN EFI_QUESTION_ID QuestionId,\r
1268 IN EFI_VARSTORE_ID VarStoreId,\r
1269 IN UINT16 VarOffset,\r
1270 IN EFI_STRING_ID Prompt,\r
1271 IN EFI_STRING_ID Help,\r
1272 IN UINT8 QuestionFlags,\r
1273 IN UINT8 StringFlags,\r
1274 IN UINT8 MinSize,\r
1275 IN UINT8 MaxSize,\r
1276 IN VOID *DefaultsOpCodeHandle OPTIONAL\r
1277 );\r
1278\r
1279/**\r
1280 Create EFI_IFR_ONE_OF_OP opcode.\r
1281\r
1282 If OpCodeHandle is NULL, then ASSERT().\r
1283 If any reserved bits are set in QuestionFlags, then ASSERT().\r
1284 If any reserved bits are set in OneOfFlags, then ASSERT().\r
1285\r
1286 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
1287 @param[in] QuestionId Question ID\r
1288 @param[in] VarStoreId Storage ID\r
1289 @param[in] VarOffset Offset in Storage\r
1290 @param[in] Prompt String ID for Prompt\r
1291 @param[in] Help String ID for Help\r
1292 @param[in] QuestionFlags Flags in Question Header\r
1293 @param[in] OneOfFlags Flags for oneof opcode\r
1294 @param[in] OptionsOpCodeHandle Handle for a buffer of ONE_OF_OPTION opcodes.\r
1295 @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This\r
1296 is an optional parameter that may be NULL.\r
1297\r
1298 @retval NULL There is not enough space left in Buffer to add the opcode.\r
1299 @retval Other A pointer to the created opcode.\r
1300\r
1301**/\r
1302UINT8 *\r
1303EFIAPI\r
1304HiiCreateOneOfOpCode (\r
1305 IN VOID *OpCodeHandle,\r
1306 IN EFI_QUESTION_ID QuestionId,\r
1307 IN EFI_VARSTORE_ID VarStoreId,\r
1308 IN UINT16 VarOffset,\r
1309 IN EFI_STRING_ID Prompt,\r
1310 IN EFI_STRING_ID Help,\r
1311 IN UINT8 QuestionFlags,\r
1312 IN UINT8 OneOfFlags,\r
1313 IN VOID *OptionsOpCodeHandle,\r
1314 IN VOID *DefaultsOpCodeHandle OPTIONAL\r
1315 );\r
1316\r
1317/**\r
1318 Create EFI_IFR_ORDERED_LIST_OP opcode.\r
1319\r
1320 If OpCodeHandle is NULL, then ASSERT().\r
1321 If any reserved bits are set in QuestionFlags, then ASSERT().\r
1322 If any reserved bits are set in OrderedListFlags, then ASSERT().\r
1323\r
1324 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
1325 @param[in] QuestionId Question ID\r
1326 @param[in] VarStoreId Storage ID\r
1327 @param[in] VarOffset Offset in Storage\r
1328 @param[in] Prompt String ID for Prompt\r
1329 @param[in] Help String ID for Help\r
1330 @param[in] QuestionFlags Flags in Question Header\r
1331 @param[in] OrderedListFlags Flags for ordered list opcode\r
1332 @param[in] DataType Type for option value\r
1333 @param[in] MaxContainers Maximum count for options in this ordered list\r
1334 @param[in] OptionsOpCodeHandle Handle for a buffer of ONE_OF_OPTION opcodes.\r
1335 @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This\r
1336 is an optional parameter that may be NULL.\r
1337\r
1338 @retval NULL There is not enough space left in Buffer to add the opcode.\r
1339 @retval Other A pointer to the created opcode.\r
1340\r
1341**/\r
1342UINT8 *\r
1343EFIAPI\r
1344HiiCreateOrderedListOpCode (\r
1345 IN VOID *OpCodeHandle,\r
1346 IN EFI_QUESTION_ID QuestionId,\r
1347 IN EFI_VARSTORE_ID VarStoreId,\r
1348 IN UINT16 VarOffset,\r
1349 IN EFI_STRING_ID Prompt,\r
1350 IN EFI_STRING_ID Help,\r
1351 IN UINT8 QuestionFlags,\r
1352 IN UINT8 OrderedListFlags,\r
1353 IN UINT8 DataType,\r
1354 IN UINT8 MaxContainers,\r
1355 IN VOID *OptionsOpCodeHandle,\r
1356 IN VOID *DefaultsOpCodeHandle OPTIONAL\r
1357 );\r
1358\r
1359/**\r
1360 This function updates a form that has previously been registered with the HII \r
1361 Database. This function will perform at most one update operation.\r
1362 \r
1363 The form to update is specified by Handle, FormSetGuid, and FormId. Binary \r
1364 comparisons of IFR opcodes are performed from the beginning of the form being \r
1365 updated until an IFR opcode is found that exactly matches the first IFR opcode \r
1366 specifed by StartOpCodeHandle. The following rules are used to determine if\r
1367 an insert, replace, or delete operation is performed.\r
1368 \r
1369 1) If no matches are found, then NULL is returned. \r
1370 2) If a match is found, and EndOpCodeHandle is NULL, then all of the IFR opcodes\r
1371 from StartOpcodeHandle except the first opcode are inserted immediately after \r
1372 the matching IFR opcode in the form beng updated.\r
1373 3) If a match is found, and EndOpCodeHandle is not NULL, then a search is made \r
1374 from the matching IFR opcode until an IFR opcode exatly matches the first \r
1375 IFR opcode specified by EndOpCodeHandle. If no match is found for the first\r
1376 IFR opcode specified by EndOpCodeHandle, then NULL is returned. If a match\r
1377 is found, then all of the IFR opcodes between the start match and the end \r
1378 match are deleted from the form being updated and all of the IFR opcodes\r
1379 from StartOpcodeHandle except the first opcode are inserted immediately after \r
1380 the matching start IFR opcode. If StartOpCcodeHandle only contains one\r
1381 IFR instruction, then the result of ths operation will delete all of the IFR\r
1382 opcodes between the start end matches.\r
1383\r
1384 If HiiHandle is NULL, then ASSERT().\r
1385 If StartOpCodeHandle is NULL, then ASSERT().\r
1386\r
1387 @param[in] HiiHandle The HII Handle of the form to update.\r
1388 @param[in] FormSetGuid The Formset GUID of the form to update. This\r
1389 is an optional parameter that may be NULL.\r
1390 If it is NULL, all FormSet will be updated.\r
1391 @param[in] FormId The ID of the form to update.\r
1392 @param[in] StartOpCodeHandle An OpCode Handle that contains the set of IFR \r
1393 opcodes to be inserted or replaced in the form.\r
1394 The first IFR instruction in StartOpCodeHandle \r
1395 is used to find matching IFR opcode in the \r
1396 form. \r
1397 @param[in] EndOpCodeHandle An OpCcode Handle that contains the IFR opcode\r
1398 that marks the end of a replace operation in\r
1399 the form. This is an optional parameter that\r
1400 may be NULL. If it is NULL, then an the IFR\r
1401 opcodes specified by StartOpCodeHandle are \r
1402 inserted into the form.\r
1403 \r
1404 @retval EFI_OUT_OF_RESOURCES No enough memory resource is allocated.\r
1405 @retval EFI_NOT_FOUND The following cases will return EFI_NOT_FOUND.\r
1406 1) The form specified by HiiHandle, FormSetGuid, \r
1407 and FormId could not be found in the HII Database.\r
1408 2) No IFR opcodes in the target form match the first\r
1409 IFR opcode in StartOpCodeHandle.\r
1410 3) EndOpCOde is not NULL, and no IFR opcodes in the \r
1411 target form following a matching start opcode match \r
1412 the first IFR opcode in EndOpCodeHandle.\r
1413 @retval EFI_SUCCESS The matched form is updated by StartOpcode.\r
1414\r
1415**/\r
1416EFI_STATUS\r
1417EFIAPI\r
1418HiiUpdateForm (\r
1419 IN EFI_HII_HANDLE HiiHandle,\r
1420 IN EFI_GUID *FormSetGuid, OPTIONAL\r
1421 IN EFI_FORM_ID FormId,\r
1422 IN VOID *StartOpcodeHandle,\r
1423 IN VOID *EndOpcodeHandle OPTIONAL\r
1424 );\r
1425\r
1426/**\r
1427 Configure the buffer accrording to ConfigBody strings in the format of\r
1428 <Length:4 bytes>, <Offset: 2 bytes>, <Width:2 bytes>, <Data:n bytes>.\r
1429 This ConfigBody strings is generated by EDKII UEFI VfrCompiler for the default\r
1430 values in a Form Set. The name of the ConfigBody strings is VfrMyIfrNVDataDefault0000\r
1431 constructed following this rule: \r
1432 "Vfr" + varstore.name + "Default" + defaultstore.attributes.\r
1433 Check the generated C file in Output for details.\r
1434\r
1435 @param Buffer the start address of buffer.\r
1436 @param BufferSize the size of buffer.\r
1437 @param Number the number of the ConfigBody strings.\r
1438 @param ... the ConfigBody strings\r
1439\r
1440 @retval EFI_BUFFER_TOO_SMALL the BufferSize is too small to operate.\r
1441 @retval EFI_INVALID_PARAMETER Buffer is NULL or BufferSize is 0.\r
1442 @retval EFI_SUCCESS Operation successful.\r
1443\r
1444**/\r
1445EFI_STATUS\r
1446EFIAPI\r
1447IfrLibExtractDefault(\r
1448 IN VOID *Buffer,\r
1449 IN UINTN *BufferSize,\r
1450 UINTN Number,\r
1451 ...\r
1452 );\r
1453\r
4c76e9cc 1454#endif\r