]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/HiiLib.h
Update function comments HiiLibListPackageLists
[mirror_edk2.git] / MdePkg / Include / Library / HiiLib.h
CommitLineData
fb3df220 1/** @file\r
2 Public include file for the HII Library\r
3\r
e52c5a9f 4 Copyright (c) 2007 - 2008, Intel Corporation \r
fb3df220 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
fb3df220 13**/\r
14\r
15#ifndef __HII_LIB_H__\r
16#define __HII_LIB_H__\r
17\r
fb3df220 18\r
e52c5a9f 19#define ISO_639_2_ENTRY_SIZE 3\r
20\r
21/**\r
22 Assemble EFI_HII_PACKAGE_LIST according to the passed in packages.\r
23\r
24 If GuidId is NULL, then ASSERT.\r
25 If not enough resource to complete the operation, then ASSERT.\r
26\r
27 @param NumberOfPackages Number of packages.\r
55f298c3 28 @param GuidId Package GUID.\r
29 @param ... Variable argument list for packages to be assembled.\r
e52c5a9f 30\r
c57da111 31 @return Pointer of EFI_HII_PACKAGE_LIST_HEADER.\r
e52c5a9f 32\r
33**/\r
34EFI_HII_PACKAGE_LIST_HEADER *\r
35EFIAPI\r
36HiiLibPreparePackageList (\r
37 IN UINTN NumberOfPackages,\r
38 IN CONST EFI_GUID *GuidId,\r
39 ...\r
ed66e1bc 40 );\r
e52c5a9f 41\r
fb3df220 42/**\r
7d582d6b 43 This function allocates pool for an EFI_HII_PACKAGE_LIST structure\r
44 with additional space that is big enough to host all packages described by the variable \r
45 argument list of package pointers. The allocated structure is initialized using NumberOfPackages, \r
46 GuidId, and the variable length argument list of package pointers.\r
fb3df220 47\r
7d582d6b 48 Then, EFI_HII_PACKAGE_LIST will be register to the default System HII Database. The\r
49 Handle to the newly registered Package List is returned throught HiiHandle.\r
50\r
e52c5a9f 51 If HiiHandle is NULL, then ASSERT.\r
52\r
01aef47b 53 @param NumberOfPackages The number of HII packages to register.\r
54 @param GuidId Package List GUID ID.\r
55 @param DriverHandle Optional. If not NULL, the DriverHandle on which an instance of DEVICE_PATH_PROTOCOL is installed.\r
56 This DriverHandle uniquely defines the device that the added packages are associated with.\r
57 @param HiiHandle On output, the HiiHandle is update with the handle which can be used to retrieve the Package \r
58 List later. If the functions failed to add the package to the default HII database, this value will\r
59 be set to NULL.\r
60 @param ... The variable argument list describing all HII Package.\r
fb3df220 61\r
e52c5a9f 62 @return EFI_SUCCESS If the packages are successfully added to the default HII database.\r
63 @return EFI_OUT_OF_RESOURCE Not enough resource to complete the operation.\r
fb3df220 64\r
65**/\r
7d582d6b 66EFI_STATUS\r
fb3df220 67EFIAPI\r
e52c5a9f 68HiiLibAddPackages (\r
7d582d6b 69 IN UINTN NumberOfPackages,\r
70 IN CONST EFI_GUID *GuidId,\r
71 IN EFI_HANDLE DriverHandle, OPTIONAL\r
e52c5a9f 72 OUT EFI_HII_HANDLE *HiiHandle,\r
fb3df220 73 ...\r
ed66e1bc 74 );\r
7d582d6b 75\r
e52c5a9f 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
e52c5a9f 85**/\r
86VOID\r
7d582d6b 87EFIAPI\r
e52c5a9f 88HiiLibRemovePackages (\r
7d582d6b 89 IN EFI_HII_HANDLE HiiHandle\r
ed66e1bc 90 );\r
7d582d6b 91\r
92/**\r
e52c5a9f 93 This function adds the string into String Package of each language\r
94 supported by the package list.\r
95\r
96 If String is NULL, then ASSERT.\r
97 If StringId is NULL, the ASSERT.\r
98 If PackageList could not be found in the default HII database, then ASSERT.\r
7d582d6b 99\r
100 @param PackageList Handle of the package list where this string will\r
e52c5a9f 101 be added.\r
7d582d6b 102 @param StringId On return, contains the new strings id, which is\r
e52c5a9f 103 unique within PackageList.\r
7d582d6b 104 @param String Points to the new null-terminated string.\r
105\r
e52c5a9f 106 @retval EFI_SUCCESS The new string was added successfully.\r
7d582d6b 107 @retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of resources.\r
7d582d6b 108\r
109**/\r
110EFI_STATUS\r
111EFIAPI\r
e52c5a9f 112HiiLibNewString (\r
7d582d6b 113 IN EFI_HII_HANDLE PackageList,\r
114 OUT EFI_STRING_ID *StringId,\r
115 IN CONST EFI_STRING String\r
ed66e1bc 116 );\r
7d582d6b 117\r
118/**\r
e52c5a9f 119 This function update the specified string in String Package of each language\r
120 supported by the package list.\r
121\r
122 If String is NULL, then ASSERT.\r
123 If PackageList could not be found in the default HII database, then ASSERT.\r
124 If StringId is not found in PackageList, then ASSERT.\r
7d582d6b 125\r
126 @param PackageList Handle of the package list where this string will\r
e52c5a9f 127 be added.\r
7d582d6b 128 @param StringId Ths String Id to be updated.\r
129 @param String Points to the new null-terminated string.\r
130\r
131 @retval EFI_SUCCESS The new string was added successfully.\r
7d582d6b 132 @retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of resources.\r
7d582d6b 133\r
134**/\r
135EFI_STATUS\r
136EFIAPI\r
e52c5a9f 137HiiLibSetString (\r
7d582d6b 138 IN EFI_HII_HANDLE PackageList,\r
139 IN EFI_STRING_ID StringId,\r
140 IN CONST EFI_STRING String\r
ed66e1bc 141 );\r
7d582d6b 142\r
e52c5a9f 143/**\r
144 This function try to retrieve string from String package of current language.\r
145 If fails, it try to retrieve string from String package of first language it support.\r
146\r
e52c5a9f 147 If StringSize is NULL, then ASSERT.\r
0276b838 148 If String is NULL and *StringSize is not 0, then ASSERT.\r
e52c5a9f 149 If PackageList could not be found in the default HII database, then ASSERT.\r
150 If StringId is not found in PackageList, then ASSERT.\r
151\r
152 @param PackageList The package list in the HII database to search for\r
153 the specified string.\r
154 @param StringId The string's id, which is unique within\r
155 PackageList.\r
156 @param String Points to the new null-terminated string.\r
157 @param StringSize On entry, points to the size of the buffer pointed\r
158 to by String, in bytes. On return, points to the\r
159 length of the string, in bytes.\r
160\r
161 @retval EFI_SUCCESS The string was returned successfully.\r
162 @retval EFI_NOT_FOUND The string specified by StringId is not available.\r
163 @retval EFI_BUFFER_TOO_SMALL The buffer specified by StringLength is too small\r
164 to hold the string.\r
7d582d6b 165\r
e52c5a9f 166**/\r
7d582d6b 167EFI_STATUS\r
168EFIAPI\r
e52c5a9f 169HiiLibGetString (\r
170 IN EFI_HII_HANDLE PackageList,\r
171 IN EFI_STRING_ID StringId,\r
172 OUT EFI_STRING String,\r
173 IN OUT UINTN *StringSize\r
ed66e1bc 174 );\r
e52c5a9f 175\r
176/**\r
177 Get string specified by StringId form the HiiHandle. The caller\r
178 is responsible to free the *String.\r
179\r
180 If String is NULL, then ASSERT.\r
181 If HiiHandle could not be found in the default HII database, then ASSERT.\r
182 If StringId is not found in PackageList, then ASSERT.\r
183\r
184 @param HiiHandle The HII handle of package list.\r
185 @param StringId The String ID.\r
186 @param String The output string.\r
187\r
188 @retval EFI_NOT_FOUND String is not found.\r
189 @retval EFI_SUCCESS Operation is successful.\r
190 @retval EFI_OUT_OF_RESOURCES There is not enought memory in the system.\r
e52c5a9f 191\r
192**/\r
193EFI_STATUS\r
194EFIAPI\r
195HiiLibGetStringFromHandle (\r
196 IN EFI_HII_HANDLE HiiHandle,\r
7d582d6b 197 IN EFI_STRING_ID StringId,\r
198 OUT EFI_STRING *String\r
ed66e1bc 199 );\r
7d582d6b 200\r
e52c5a9f 201/**\r
202 Get the string given the StringId and String package Producer's Guid. The caller\r
203 is responsible to free the *String.\r
204\r
205 If PackageList with the matching ProducerGuid is not found, then ASSERT.\r
206 If PackageList with the matching ProducerGuid is found but no String is\r
207 specified by StringId is found, then ASSERT.\r
208\r
209 @param ProducerGuid The Guid of String package list.\r
210 @param StringId The String ID.\r
211 @param String The output string.\r
212\r
213 @retval EFI_SUCCESS Operation is successful.\r
214 @retval EFI_OUT_OF_RESOURCES There is not enought memory in the system.\r
215\r
216**/\r
7d582d6b 217EFI_STATUS\r
218EFIAPI\r
e52c5a9f 219HiiLibGetStringFromToken (\r
220 IN EFI_GUID *ProducerGuid,\r
221 IN EFI_STRING_ID StringId,\r
222 OUT EFI_STRING *String\r
ed66e1bc 223 );\r
7d582d6b 224\r
e52c5a9f 225/**\r
226 Determines the handles that are currently active in the database.\r
227 It's the caller's responsibility to free handle buffer.\r
228\r
229 If HandleBufferLength is NULL, then ASSERT.\r
230 If HiiHandleBuffer is NULL, then ASSERT.\r
231\r
e52c5a9f 232 @param HandleBufferLength On input, a pointer to the length of the handle\r
233 buffer. On output, the length of the handle buffer\r
234 that is required for the handles found.\r
235 @param HiiHandleBuffer Pointer to an array of Hii Handles returned.\r
236\r
237 @retval EFI_SUCCESS Get an array of Hii Handles successfully.\r
238\r
239**/\r
7d582d6b 240EFI_STATUS\r
241EFIAPI\r
e52c5a9f 242HiiLibGetHiiHandles (\r
243 IN OUT UINTN *HandleBufferLength,\r
244 OUT EFI_HII_HANDLE **HiiHandleBuffer\r
ed66e1bc 245 );\r
7d582d6b 246\r
e52c5a9f 247/**\r
248 Extract Hii package list GUID for given HII handle.\r
249\r
250 If HiiHandle could not be found in the default HII database, then ASSERT.\r
251 If Guid is NULL, then ASSERT.\r
252\r
01aef47b 253 @param Handle Hii handle\r
254 @param Guid Package list GUID\r
7d582d6b 255\r
e52c5a9f 256 @retval EFI_SUCCESS Successfully extract GUID from Hii database.\r
257\r
258**/\r
7d582d6b 259EFI_STATUS\r
e52c5a9f 260EFIAPI\r
261HiiLibExtractGuidFromHiiHandle (\r
7d582d6b 262 IN EFI_HII_HANDLE Handle,\r
e52c5a9f 263 OUT EFI_GUID *Guid\r
ed66e1bc 264 );\r
e52c5a9f 265\r
266/**\r
267 Find HII Handle in the default HII database associated with given Device Path.\r
268\r
269 If DevicePath is NULL, then ASSERT.\r
270\r
271 @param DevicePath Device Path associated with the HII package list\r
272 handle.\r
273\r
274 @retval Handle HII package list Handle associated with the Device\r
275 Path.\r
276 @retval NULL Hii Package list handle is not found.\r
277\r
278**/\r
279EFI_HII_HANDLE\r
280EFIAPI\r
281HiiLibDevicePathToHiiHandle (\r
282 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
ed66e1bc 283 );\r
e52c5a9f 284\r
285\r
e52c5a9f 286/**\r
287 Get next language from language code list (with separator ';').\r
7d582d6b 288\r
e52c5a9f 289 If LangCode is NULL, then ASSERT.\r
290 If Lang is NULL, then ASSERT.\r
7d582d6b 291\r
e52c5a9f 292 @param LangCode On input: point to first language in the list. On\r
293 output: point to next language in the list, or\r
294 NULL if no more language in the list.\r
295 @param Lang The first language in the list.\r
7d582d6b 296\r
e52c5a9f 297**/\r
298VOID\r
299EFIAPI\r
300HiiLibGetNextLanguage (\r
301 IN OUT CHAR8 **LangCode,\r
302 OUT CHAR8 *Lang\r
ed66e1bc 303 );\r
e52c5a9f 304\r
305/**\r
306 This function returns the list of supported languages, in the format specified\r
307 in UEFI specification Appendix M.\r
308\r
309 If HiiHandle is not a valid Handle in the default HII database, then ASSERT.\r
e52c5a9f 310\r
311 @param HiiHandle The HII package list handle.\r
312\r
33b3b832 313 @retval !NULL The supported languages.\r
314 @retval NULL If Supported Languages can not be retrived.\r
e52c5a9f 315\r
316**/\r
317CHAR8 *\r
318EFIAPI\r
319HiiLibGetSupportedLanguages (\r
320 IN EFI_HII_HANDLE HiiHandle\r
ed66e1bc 321 );\r
e52c5a9f 322\r
33b3b832 323/**\r
324 This function returns the list of supported 2nd languages, in the format specified\r
325 in UEFI specification Appendix M.\r
326\r
327 If HiiHandle is not a valid Handle in the default HII database, then ASSERT.\r
328 If not enough resource to complete the operation, then ASSERT.\r
329\r
330 @param HiiHandle The HII package list handle.\r
01aef47b 331 @param FirstLanguage Pointer to language name buffer.\r
332 \r
33b3b832 333 @return The supported languages.\r
334\r
335**/\r
336CHAR8 *\r
337EFIAPI\r
338HiiLibGetSupportedSecondaryLanguages (\r
339 IN EFI_HII_HANDLE HiiHandle,\r
340 IN CONST CHAR8 *FirstLanguage\r
ed66e1bc 341 );\r
33b3b832 342\r
343\r
e52c5a9f 344/**\r
345 This function returns the number of supported languages on HiiHandle.\r
346\r
347 If HiiHandle is not a valid Handle in the default HII database, then ASSERT.\r
348 If not enough resource to complete the operation, then ASSERT.\r
349\r
350 @param HiiHandle The HII package list handle.\r
351\r
352 @return The number of supported languages.\r
353\r
354**/\r
355UINT16\r
356EFIAPI\r
357HiiLibGetSupportedLanguageNumber (\r
358 IN EFI_HII_HANDLE HiiHandle\r
ed66e1bc 359 );\r
e52c5a9f 360\r
55a9663b 361/**\r
362 Exports the contents of one or all package lists in the HII database into a buffer.\r
363\r
364 If Handle is not NULL and not a valid EFI_HII_HANDLE registered in the database, \r
365 then ASSERT.\r
366 If PackageListHeader is NULL, then ASSERT.\r
367 If PackageListSize is NULL, then ASSERT.\r
368\r
369 @param Handle The HII Handle.\r
370 @param PackageListHeader A pointer to a buffer that will contain the results of \r
371 the export function.\r
372 @param PackageListSize On output, the length of the buffer that is required for the exported data.\r
373\r
374 @retval EFI_SUCCESS Package exported.\r
375\r
376 @retval EFI_OUT_OF_RESOURCES Not enought memory to complete the operations.\r
377\r
378**/\r
379EFI_STATUS \r
380EFIAPI\r
381HiiLibExportPackageLists (\r
382 IN EFI_HII_HANDLE Handle,\r
383 OUT EFI_HII_PACKAGE_LIST_HEADER **PackageListHeader,\r
384 OUT UINTN *PackageListSize\r
ed66e1bc 385 );\r
55a9663b 386\r
1fe74953 387/**\r
388 \r
389 This function returns a list of the package handles of the \r
390 specified type that are currently active in the HII database. The \r
391 pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package \r
392 handles to be listed.\r
393\r
394 If HandleBufferLength is NULL, then ASSERT.\r
395 If HandleBuffer is NULL, the ASSERT.\r
396 If PackageType is EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is\r
397 NULL, then ASSERT.\r
398 If PackageType is not EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is not\r
399 NULL, then ASSERT.\r
400 \r
401 \r
402 @param PackageType Specifies the package type of the packages\r
403 to list or EFI_HII_PACKAGE_TYPE_ALL for\r
404 all packages to be listed.\r
405 \r
406 @param PackageGuid If PackageType is\r
407 EFI_HII_PACKAGE_TYPE_GUID, then this is\r
408 the pointer to the GUID which must match\r
409 the Guid field of\r
410 EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it\r
411 must be NULL.\r
412 \r
413 @param HandleBufferLength On output, the length of the handle buffer\r
414 that is required for the handles found.\r
415\r
416 @param HandleBuffer On output, an array of EFI_HII_HANDLE instances returned.\r
417 The caller is responcible to free this pointer allocated.\r
418\r
419 @retval EFI_SUCCESS The matching handles are outputed successfully.\r
420 HandleBufferLength is updated with the actual length.\r
421 @retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operation.\r
422 @retval EFI_NOT_FOUND No matching handle could not be found in database.\r
423**/\r
55a9663b 424EFI_STATUS\r
425EFIAPI\r
426HiiLibListPackageLists (\r
427 IN UINT8 PackageType,\r
428 IN CONST EFI_GUID *PackageGuid,\r
429 IN OUT UINTN *HandleBufferLength,\r
430 OUT EFI_HII_HANDLE **Handle\r
ed66e1bc 431 );\r
55a9663b 432\r
e52c5a9f 433/**\r
434 Convert language code from RFC3066 to ISO639-2.\r
435\r
6fd5fbe3 436 LanguageRfc3066 contain a single RFC 3066 code such as\r
437 "en-US" or "fr-FR".\r
438\r
439 The LanguageRfc3066 must be a buffer large enough\r
440 for ISO_639_2_ENTRY_SIZE characters.\r
441\r
e52c5a9f 442 If LanguageRfc3066 is NULL, then ASSERT.\r
443 If LanguageIso639 is NULL, then ASSERT.\r
444\r
445 @param LanguageRfc3066 RFC3066 language code.\r
446 @param LanguageIso639 ISO639-2 language code.\r
447\r
448 @retval EFI_SUCCESS Language code converted.\r
449 @retval EFI_NOT_FOUND Language code not found.\r
450\r
451**/\r
452EFI_STATUS\r
453EFIAPI\r
454ConvertRfc3066LanguageToIso639Language (\r
6fd5fbe3 455 IN CHAR8 *LanguageRfc3066,\r
456 OUT CHAR8 *LanguageIso639\r
ed66e1bc 457 );\r
6fd5fbe3 458\r
459/**\r
460 Convert language code from ISO639-2 to RFC3066.\r
461\r
462 LanguageIso639 contain a single ISO639-2 code such as\r
463 "eng" or "fra".\r
464\r
465 The LanguageRfc3066 must be a buffer large enough\r
466 for RFC_3066_ENTRY_SIZE characters.\r
467\r
468 If LanguageIso639 is NULL, then ASSERT.\r
469 If LanguageRfc3066 is NULL, then ASSERT.\r
470\r
471 @param LanguageIso639 ISO639-2 language code.\r
472 @param LanguageRfc3066 RFC3066 language code.\r
473\r
474 @retval EFI_SUCCESS Language code converted.\r
475 @retval EFI_NOT_FOUND Language code not found.\r
476\r
477**/\r
478EFI_STATUS\r
479EFIAPI\r
480ConvertIso639LanguageToRfc3066Language (\r
481 IN CONST CHAR8 *LanguageIso639,\r
482 OUT CHAR8 *LanguageRfc3066\r
ed66e1bc 483 );\r
e52c5a9f 484\r
485/**\r
486 Convert language code list from RFC3066 to ISO639-2, e.g. "en-US;fr-FR" will\r
487 be converted to "engfra".\r
488\r
489 If SupportedLanguages is NULL, then ASSERT.\r
490\r
491 @param SupportedLanguages The RFC3066 language list.\r
492\r
493 @return The ISO639-2 language list.\r
494\r
495**/\r
496CHAR8 *\r
497EFIAPI\r
498Rfc3066ToIso639 (\r
499 CHAR8 *SupportedLanguages\r
ed66e1bc 500 );\r
fb3df220 501\r
502#endif\r