]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Library/HiiLib.h
Correct typo in comments, clean IfrSupportLib.h
[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
476 Convert language code from ISO639-2 to RFC3066.\r
477\r
478 LanguageIso639 contain a single ISO639-2 code such as\r
479 "eng" or "fra".\r
480\r
481 The LanguageRfc3066 must be a buffer large enough\r
482 for RFC_3066_ENTRY_SIZE characters.\r
483\r
484 If LanguageIso639 is NULL, then ASSERT.\r
485 If LanguageRfc3066 is NULL, then ASSERT.\r
486\r
487 @param LanguageIso639 ISO639-2 language code.\r
488 @param LanguageRfc3066 RFC3066 language code.\r
489\r
490 @retval EFI_SUCCESS Language code converted.\r
491 @retval EFI_NOT_FOUND Language code not found.\r
492\r
493**/\r
494EFI_STATUS\r
495EFIAPI\r
496ConvertIso639LanguageToRfc3066Language (\r
497 IN CONST CHAR8 *LanguageIso639,\r
498 OUT CHAR8 *LanguageRfc3066\r
b9982883
LG
499 )\r
500;\r
4c76e9cc 501\r
502/**\r
503 Convert language code list from RFC3066 to ISO639-2, e.g. "en-US;fr-FR" will\r
504 be converted to "engfra".\r
505\r
506 If SupportedLanguages is NULL, then ASSERT.\r
507\r
508 @param SupportedLanguages The RFC3066 language list.\r
509\r
510 @return The ISO639-2 language list.\r
511\r
512**/\r
513CHAR8 *\r
514EFIAPI\r
515Rfc3066ToIso639 (\r
516 CHAR8 *SupportedLanguages\r
b9982883
LG
517 )\r
518;\r
4c76e9cc 519\r
11e92503 520\r
521/**\r
522 Determine what is the current language setting. The space reserved for Lang\r
523 must be at least RFC_3066_ENTRY_SIZE bytes;\r
524\r
525 If Lang is NULL, then ASSERT.\r
526\r
527 @param Lang Pointer of system language. Lang will always be filled with \r
528 a valid RFC 3066 language string. If "PlatformLang" is not\r
529 set in the system, the default language specifed by PcdUefiVariableDefaultPlatformLang\r
530 is returned.\r
531\r
532 @return EFI_SUCCESS If the EFI Variable with "PlatformLang" is set and return in Lang.\r
533 @return EFI_NOT_FOUND If the EFI Variable with "PlatformLang" is not set, but a valid default language is return in Lang.\r
534\r
535**/\r
536EFI_STATUS\r
537EFIAPI\r
538GetCurrentLanguage (\r
539 OUT CHAR8 *Lang\r
b9982883
LG
540 )\r
541;\r
11e92503 542\r
4c76e9cc 543#endif\r