]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Library/HiiLib.h
Remove duplicate HII Library API prototypes.
[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
33ae1b2d 18////////////////////////////////////////////////////////\r
19////////////////////////////////////////////////////////\r
20// HiiLib Functions\r
21////////////////////////////////////////////////////////\r
22////////////////////////////////////////////////////////\r
4c76e9cc 23\r
24/**\r
cb7d01c0 25 Registers a list of packages in the HII Database and returns the HII Handle\r
26 associated with that registration. If an HII Handle has already been registered\r
27 with the same PackageListGuid, then NULL is returned. If there are not enough \r
28 resources to perform the registration, then NULL is returned. If an empty list \r
29 of packages is passed in, then NULL is returned. If the size of the list of \r
30 package is 0, then NULL is returned.\r
31\r
32 The variable arguments are pointers which point to package header that defined \r
33 by UEFI VFR compiler and StringGather tool.\r
34\r
35 #pragma pack (push, 1)\r
36 typedef struct {\r
37 UINT32 BinaryLength;\r
38 EFI_HII_PACKAGE_HEADER PackageHeader;\r
39 } EDKII_AUTOGEN_PACKAGES_HEADER;\r
40 #pragma pack (pop)\r
41 \r
42 @param[in] PackageListGuid The GUID of the package list.\r
43 @param[in] DeviceHandle If not NULL, the Device Handle on which \r
44 an instance of DEVICE_PATH_PROTOCOL is installed.\r
45 This Device Handle uniquely defines the device that \r
46 the added packages are associated with.\r
47 @param[in] ... The variable argument list that contains pointers \r
48 to packages terminated by a NULL.\r
49\r
50 @retval NULL A HII Handle has already been registered in the HII Database with\r
51 the same PackageListGuid.\r
52 @retval NULL The HII Handle could not be created.\r
53 @retval NULL An empty list of packages was passed in.\r
54 @retval NULL All packages are empty.\r
55 @retval Other The HII Handle associated with the newly registered package list.\r
4c76e9cc 56\r
57**/\r
cb7d01c0 58EFI_HII_HANDLE\r
4c76e9cc 59EFIAPI\r
cb7d01c0 60HiiAddPackages (\r
61 IN CONST EFI_GUID *PackageListGuid,\r
62 IN EFI_HANDLE DeviceHandle OPTIONAL,\r
4c76e9cc 63 ...\r
b9982883
LG
64 )\r
65;\r
4c76e9cc 66\r
67/**\r
cb7d01c0 68 Removes a package list from the HII database.\r
4c76e9cc 69\r
70 If HiiHandle is NULL, then ASSERT.\r
cb7d01c0 71 If HiiHandle is not a valid EFI_HII_HANDLE in the HII database, then ASSERT.\r
4c76e9cc 72\r
cb7d01c0 73 @param[in] HiiHandle The handle that was previously registered in the HII database\r
4c76e9cc 74\r
75**/\r
76VOID\r
77EFIAPI\r
cb7d01c0 78HiiRemovePackages (\r
4c76e9cc 79 IN EFI_HII_HANDLE HiiHandle\r
b9982883
LG
80 )\r
81;\r
4c76e9cc 82\r
83/**\r
cb7d01c0 84 This function create a new string in String Package or updates an existing \r
85 string in a String Package. If StringId is 0, then a new string is added to\r
86 a String Package. If StringId is not zero, then a string in String Package is\r
87 updated. If SupportedLanguages is NULL, then the string is added or updated\r
88 for all the languages that the String Package supports. If SupportedLanguages\r
89 is not NULL, then the string is added or updated for the set of languages \r
90 specified by SupportedLanguages.\r
91 \r
92 If HiiHandle is NULL, then ASSERT().\r
93 If String is NULL, then ASSERT().\r
94\r
95 @param[in] HiiHandle A handle that was previously registered in the \r
96 HII Database.\r
97 @param[in] StringId If zero, then a new string is created in the \r
98 String Package associated with HiiHandle. If \r
99 non-zero, then the string specified by StringId \r
100 is updated in the String Package associated \r
101 with HiiHandle. \r
102 @param[in] String A pointer to the Null-terminated Unicode string \r
103 to add or update in the String Package associated \r
104 with HiiHandle.\r
105 @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string of \r
106 language codes. If this parameter is NULL, then \r
107 String is added or updated in the String Package \r
108 associated with HiiHandle for all the languages \r
109 that the String Package supports. If this \r
110 parameter is not NULL, then then String is added \r
111 or updated in the String Package associated with \r
112 HiiHandle for the set oflanguages specified by \r
113 SupportedLanguages. The format of \r
114 SupportedLanguages must follow the language \r
115 format assumed the HII Database.\r
116\r
117 @retval 0 The string could not be added or updated in the String Package.\r
118 @retval Other The EFI_STRING_ID of the newly added or updated string.\r
4c76e9cc 119\r
120**/\r
cb7d01c0 121EFI_STRING_ID\r
4c76e9cc 122EFIAPI\r
cb7d01c0 123HiiSetString (\r
124 IN EFI_HII_HANDLE HiiHandle,\r
125 IN EFI_STRING_ID StringId, OPTIONAL\r
126 IN CONST EFI_STRING String,\r
127 IN CONST CHAR8 *SupportedLanguages OPTIONAL\r
b9982883
LG
128 )\r
129;\r
4c76e9cc 130\r
131/**\r
cb7d01c0 132 Retrieves a string from a string package in a specific language. If the language\r
133 is not specified, then a string from a string package in the current platform \r
134 language is retrieved. If the string can not be retrieved using the specified \r
135 language or the current platform language, then the string is retrieved from \r
136 the string package in the first language the string package supports. The \r
137 returned string is allocated using AllocatePool(). The caller is responsible \r
138 for freeing the allocated buffer using FreePool().\r
139 \r
140 If HiiHandle is NULL, then ASSERT().\r
141 If StringId is 0, then ASSET.\r
4c76e9cc 142\r
cb7d01c0 143 @param[in] HiiHandle A handle that was previously registered in the HII Database.\r
144 @param[in] StringId The identifier of the string to retrieved from the string \r
145 package associated with HiiHandle.\r
146 @param[in] Language The language of the string to retrieve. If this parameter \r
147 is NULL, then the current platform language is used. The \r
148 format of Language must follow the language format assumed \r
149 the HII Database.\r
4c76e9cc 150\r
cb7d01c0 151 @retval NULL The string specified by StringId is not present in the string package.\r
152 @retval Other The string was returned.\r
4c76e9cc 153\r
154**/\r
cb7d01c0 155EFI_STRING\r
4c76e9cc 156EFIAPI\r
cb7d01c0 157HiiGetString (\r
158 IN EFI_HII_HANDLE HiiHandle,\r
159 IN EFI_STRING_ID StringId,\r
160 IN CONST CHAR8 *Language OPTIONAL\r
b9982883
LG
161 )\r
162;\r
4c76e9cc 163\r
164/**\r
cb7d01c0 165 Retrieves a string from a string package names by GUID in a specific language. \r
166 If the language is not specified, then a string from a string package in the \r
167 current platform language is retrieved. If the string can not be retrieved \r
168 using the specified language or the current platform language, then the string \r
169 is retrieved from the string package in the first language the string package \r
170 supports. The returned string is allocated using AllocatePool(). The caller \r
171 is responsible for freeing the allocated buffer using FreePool().\r
172 \r
173 If PackageListGuid is NULL, then ASSERT().\r
174 If StringId is 0, then ASSERT.\r
175\r
176 @param[in] PackageListGuid The GUID of a package list that was previously \r
177 registered in the HII Database.\r
178 @param[in] StringId The identifier of the string to retrieved from the \r
179 string package associated with PackageListGuid.\r
180 @param[in] Language The language of the string to retrieve. If this \r
181 parameter is NULL, then the current platform \r
182 language is used. The format of Language must \r
183 follow the language format assumed the HII Database.\r
184\r
185 @retval NULL The package list specified by PackageListGuid is not present in the\r
186 HII Database.\r
187 @retval NULL The string specified by StringId is not present in the string package.\r
188 @retval Other The string was returned.\r
4c76e9cc 189\r
190**/\r
cb7d01c0 191EFI_STRING\r
4c76e9cc 192EFIAPI\r
cb7d01c0 193HiiGetPackageString (\r
194 IN CONST EFI_GUID *PackageListGuid,\r
195 IN EFI_STRING_ID StringId,\r
196 IN CONST CHAR8 *Language OPTIONAL\r
b9982883
LG
197 )\r
198;\r
4c76e9cc 199\r
200/**\r
cb7d01c0 201 Retrieves the array of all the HII Handles or the HII handle of a specific\r
202 package list in the HII Database.\r
203 This array is terminated with a NULL HII Handle.\r
204 This function allocates the returned array using AllocatePool().\r
205 The caller is responsible for freeing the array with FreePool().\r
206\r
207 @param[in] PackageListGuid An optional parameter that is used to request \r
208 an HII Handle that is associatd with a specific\r
209 Package List GUID. If this parameter is NULL\r
210 then all the HII Handles in the HII Database\r
211 are returned. If this parameter is not NULL\r
212 then at most 1 HII Handle is returned.\r
213\r
214 @retval NULL No HII handles were found in the HII database\r
215 @retval NULL The array of HII Handles could not be retrieved\r
216 @retval Other A pointer to the NULL terminated array of HII Handles\r
4c76e9cc 217\r
218**/\r
cb7d01c0 219EFI_HII_HANDLE *\r
4c76e9cc 220EFIAPI\r
cb7d01c0 221HiiGetHiiHandles (\r
222 IN CONST EFI_GUID *PackageListGuid OPTIONAL\r
b9982883
LG
223 )\r
224;\r
4c76e9cc 225\r
4c76e9cc 226/**\r
227 Get next language from language code list (with separator ';').\r
228\r
229 If LangCode is NULL, then ASSERT.\r
230 If Lang is NULL, then ASSERT.\r
231\r
232 @param LangCode On input: point to first language in the list. On\r
233 output: point to next language in the list, or\r
234 NULL if no more language in the list.\r
235 @param Lang The first language in the list.\r
236\r
237**/\r
238VOID\r
239EFIAPI\r
240HiiLibGetNextLanguage (\r
241 IN OUT CHAR8 **LangCode,\r
242 OUT CHAR8 *Lang\r
b9982883
LG
243 )\r
244;\r
4c76e9cc 245\r
246/**\r
cb7d01c0 247 Retrieves a pointer to the a Null-terminated ASCII string containing the list \r
248 of languages that an HII handle in the HII Database supports. The returned \r
249 string is allocated using AllocatePool(). The caller is responsible for freeing\r
250 the returned string using FreePool(). The format of the returned string follows\r
251 the language format assumed the HII Database.\r
4c76e9cc 252 \r
cb7d01c0 253 If HiiHandle is NULL, then ASSERT().\r
4c76e9cc 254\r
cb7d01c0 255 @param[in] HiiHandle A handle that was previously registered in the HII Database.\r
4c76e9cc 256\r
cb7d01c0 257 @retval NULL HiiHandle is not registered in the HII database\r
258 @retval NULL There are not enough resources available to retrieve the suported \r
259 languages.\r
260 @retval NULL The list of suported languages could not be retrieved.\r
261 @retval Other A pointer to the Null-terminated ASCII string of supported languages.\r
4c76e9cc 262\r
263**/\r
cb7d01c0 264CHAR8 *\r
4c76e9cc 265EFIAPI\r
cb7d01c0 266HiiGetSupportedLanguages (\r
4c76e9cc 267 IN EFI_HII_HANDLE HiiHandle\r
b9982883
LG
268 )\r
269;\r
4c76e9cc 270\r
4c76e9cc 271/**\r
272 Convert language code from RFC3066 to ISO639-2.\r
273\r
274 LanguageRfc3066 contain a single RFC 3066 code such as\r
275 "en-US" or "fr-FR".\r
276\r
277 The LanguageRfc3066 must be a buffer large enough\r
278 for ISO_639_2_ENTRY_SIZE characters.\r
279\r
280 If LanguageRfc3066 is NULL, then ASSERT.\r
281 If LanguageIso639 is NULL, then ASSERT.\r
282\r
283 @param LanguageRfc3066 RFC3066 language code.\r
284 @param LanguageIso639 ISO639-2 language code.\r
285\r
286 @retval EFI_SUCCESS Language code converted.\r
287 @retval EFI_NOT_FOUND Language code not found.\r
288\r
289**/\r
290EFI_STATUS\r
291EFIAPI\r
292ConvertRfc3066LanguageToIso639Language (\r
293 IN CHAR8 *LanguageRfc3066,\r
294 OUT CHAR8 *LanguageIso639\r
b9982883
LG
295 )\r
296;\r
4c76e9cc 297\r
298/**\r
ea7cd3ec 299 Convert language code from ISO639-2 to RFC3066 and return the converted language.\r
300 Caller is responsible for freeing the allocated buffer.\r
4c76e9cc 301\r
302 LanguageIso639 contain a single ISO639-2 code such as\r
303 "eng" or "fra".\r
304\r
4c76e9cc 305 If LanguageIso639 is NULL, then ASSERT.\r
306 If LanguageRfc3066 is NULL, then ASSERT.\r
307\r
308 @param LanguageIso639 ISO639-2 language code.\r
4c76e9cc 309\r
ea7cd3ec 310 @return the allocated buffer or NULL, if the language is not found.\r
4c76e9cc 311\r
312**/\r
ea7cd3ec 313CHAR8*\r
4c76e9cc 314EFIAPI\r
315ConvertIso639LanguageToRfc3066Language (\r
ea7cd3ec 316 IN CONST CHAR8 *LanguageIso639\r
b9982883
LG
317 )\r
318;\r
4c76e9cc 319\r
320/**\r
321 Convert language code list from RFC3066 to ISO639-2, e.g. "en-US;fr-FR" will\r
322 be converted to "engfra".\r
323\r
324 If SupportedLanguages is NULL, then ASSERT.\r
325\r
326 @param SupportedLanguages The RFC3066 language list.\r
327\r
328 @return The ISO639-2 language list.\r
329\r
330**/\r
331CHAR8 *\r
332EFIAPI\r
333Rfc3066ToIso639 (\r
334 CHAR8 *SupportedLanguages\r
b9982883
LG
335 )\r
336;\r
4c76e9cc 337\r
7e3bcccb
LG
338/**\r
339 Allocates and returns a Null-terminated Unicode <ConfigHdr> string using routing \r
340 information that includes a GUID, an optional Unicode string name, and a device\r
341 path. The string returned is allocated with AllocatePool(). The caller is \r
342 responsible for freeing the allocated string with FreePool().\r
343 \r
344 The format of a <ConfigHdr> is as follows:\r
345\r
346 GUID=<HexCh>32&NAME=<Char>NameLength&PATH=<HexChar>DevicePathSize<Null>\r
347\r
348 @param[in] Guid Pointer to an EFI_GUID that is the routing information\r
349 GUID. Each of the 16 bytes in Guid is converted to \r
350 a 2 Unicode character hexidecimal string. This is \r
351 an optional parameter that may be NULL.\r
352 @param[in] Name Pointer to a Null-terminated Unicode string that is \r
353 the routing information NAME. This is an optional \r
354 parameter that may be NULL. Each 16-bit Unicode \r
355 character in Name is converted to a 4 character Unicode \r
356 hexidecimal string. \r
357 @param[in] DriverHandle The driver handle which supports a Device Path Protocol\r
358 that is the routing information PATH. Each byte of\r
359 the Device Path associated with DriverHandle is converted\r
360 to a 2 Unicode character hexidecimal string.\r
361\r
362 @retval NULL DriverHandle does not support the Device Path Protocol.\r
363 @retval NULL DriverHandle does not support the Device Path Protocol.\r
364 @retval Other A pointer to the Null-terminate Unicode <ConfigHdr> string\r
365\r
366**/\r
367EFI_STRING\r
368EFIAPI\r
369HiiConstructConfigHdr (\r
370 IN CONST EFI_GUID *Guid, OPTIONAL\r
371 IN CONST CHAR16 *Name, OPTIONAL\r
372 IN EFI_HANDLE DriverHandle\r
373 );\r
374\r
375/**\r
376 Allocates and returns a Null-terminated Unicode <ConfigAltResp> string.\r
377\r
378 If Guid is NULL, then ASSERT().\r
379 If Name is NULL, then ASSERT().\r
380 If BlockNameArray is NULL, then ASSERT().\r
381\r
382 @param[in] Guid GUID of the buffer storage.\r
383 @param[in] Name Name of the buffer storage.\r
384 @param[in] DriverHandle The DriverHandle that support a Device Path\r
385 Protocol. \r
386 @param[in] BufferStorage Content of the buffer storage.\r
387 @param[in] BufferStorageSize Length in bytes of the buffer storage.\r
388 @param[in] BlockNameArray Array generated by VFR compiler. This array\r
389 contains a UINT32 value that is the length\r
390 of BlockNameArray in bytes, followed by pairs\r
391 of 16-bit values that are the offset and length\r
392 values used to contruct a <ConfigRequest> string.\r
393 @param[in] ... A variable argument list that contains pairs of 16-bit\r
394 ALTCFG identifiers and pointers to DefaultValueArrays.\r
395 The variable argument list is terminated by a NULL \r
396 DefaultValueArray pointer. A DefaultValueArray \r
397 contains a UINT32 value that is the length, in bytes,\r
398 of the DefaultValueArray. The UINT32 length value \r
399 is followed by a series of records that contain\r
400 a 16-bit WIDTH value followed by a byte array with \r
401 WIDTH entries. The records must be parsed from\r
402 beginning to end until the UINT32 length limit\r
403 is reached. \r
404\r
405 @retval NULL There are not enough resources to process the request.\r
406 @retval NULL A <ConfigResp> could not be retrieved from the Config \r
407 Routing Protocol.\r
408 @retval Other A pointer to the Null-terminate Unicode <ConfigAltResp>\r
409 string.\r
410\r
411**/\r
412EFI_STRING\r
413EFIAPI\r
414HiiConstructConfigAltResp (\r
415 IN CONST EFI_GUID *Guid,\r
416 IN CONST CHAR16 *Name,\r
417 IN EFI_HANDLE DriverHandle,\r
418 IN CONST VOID *BufferStorage,\r
419 IN UINTN BufferStorageSize,\r
420 IN CONST VOID *BlockNameArray, \r
421 ...\r
422 );\r
423\r
424/**\r
425 Determines if the routing data specified by GUID and NAME match a <ConfigHdr>.\r
426\r
427 If ConfigHdr is NULL, then ASSERT().\r
428\r
429 @param[in] ConfigHdr Either <ConfigRequest> or <ConfigResp>.\r
430 @param[in] Guid GUID of the storage.\r
431 @param[in] Name NAME of the storage.\r
432\r
433 @retval TRUE Routing information matches <ConfigHdr>.\r
434 @retval FALSE Routing information does not match <ConfigHdr>.\r
435\r
436**/\r
437BOOLEAN\r
438EFIAPI\r
439HiiIsConfigHdrMatch (\r
440 IN CONST EFI_STRING ConfigHdr,\r
441 IN CONST EFI_GUID *Guid, OPTIONAL\r
442 IN CONST CHAR16 *Name OPTIONAL\r
443 );\r
444\r
445/**\r
446 Retrieves uncommited data from the Form Browser and converts it to a binary\r
447 buffer. The returned buffer is allocated using AllocatePool(). The caller\r
448 is responsible for freeing the returned buffer using FreePool().\r
449\r
450 @param[in] VariableName Pointer to a Null-terminated Unicode string. This \r
451 is an optional parameter that may be NULL.\r
452 @param[in] VariableGuid Pointer to an EFI_GUID structure. This is an optional \r
453 parameter that may be NULL.\r
454 @param[in] BufferSize Length in bytes of buffer to hold retrived data. \r
455\r
456 @retval NULL The uncommitted data could not be retrieved.\r
457 @retval Other A pointer to a buffer containing the uncommitted data.\r
458\r
459**/\r
460UINT8 *\r
461EFIAPI\r
462HiiGetBrowserData (\r
463 IN CONST EFI_GUID *VariableGuid, OPTIONAL\r
464 IN CONST CHAR16 *VariableName, OPTIONAL\r
465 IN UINTN BlockSize\r
466 );\r
467\r
468/**\r
469 Updates uncommitted data in the Form Browser.\r
470\r
471 If Buffer is NULL, then ASSERT().\r
472\r
473 @param[in] VariableName Pointer to a Null-terminated Unicode string. This\r
474 is an optional parameter that may be NULL.\r
475 @param[in] VariableGuid Pointer to an EFI_GUID structure. This is an optional\r
476 parameter that may be NULL.\r
477 @param[in] BufferSize Length, in bytes, of Buffer.\r
478 @param[in] Buffer Buffer of data to commit.\r
479 @param[in] RequestElement An optional field to specify which part of the\r
480 buffer data will be send back to Browser. If NULL,\r
481 the whole buffer of data will be committed to\r
482 Browser. \r
483 <RequestElement> ::= &OFFSET=<Number>&WIDTH=<Number>*\r
484\r
485 @retval FALSE The uncommitted data could not be updated.\r
486 @retval TRUE The uncommitted data was updated.\r
487\r
488**/\r
489BOOLEAN\r
490EFIAPI\r
491HiiSetBrowserData (\r
492 IN CONST EFI_GUID *VariableGuid, OPTIONAL\r
493 IN CONST CHAR16 *VariableName, OPTIONAL\r
494 IN UINTN BufferSize,\r
495 IN CONST UINT8 *Buffer,\r
496 IN CONST CHAR16 *RequestElement OPTIONAL\r
497 );\r
498\r
499/////////////////////////////////////////\r
500/////////////////////////////////////////\r
501/// IFR Functions\r
502/////////////////////////////////////////\r
503/////////////////////////////////////////\r
504\r
505/**\r
506 Returns a UINT64 value that contains bitfields for Hour, Minute, and Second.\r
507 The lower 8-bits of Hour are placed in bits 0..7. The lower 8-bits of Minute \r
508 are placed in bits 8..15, and the lower 8-bits of Second are placed in bits \r
509 16..23. This format is selected because it can be easily translated to \r
510 an EFI_HII_TIME structure in an EFI_IFR_TYPE_VALUE union.\r
511\r
512 @param Hour The hour value to be encoded.\r
513 @param Minute The miniute value to be encoded.\r
514 @param Second The second value to be encoded.\r
515\r
516 @return A 64-bit containing Hour, Minute, and Second.\r
517**/\r
518#define EFI_HII_TIME_UINT64(Hour, Minute, Second) \\r
519 (UINT64)((Hour & 0xff) | ((Minute & 0xff) << 8) | ((Second & 0xff) << 16))\r
520\r
521/**\r
522 Returns a UINT64 value that contains bitfields for Year, Month, and Day.\r
523 The lower 16-bits of Year are placed in bits 0..15. The lower 8-bits of Month \r
524 are placed in bits 16..23, and the lower 8-bits of Day are placed in bits \r
525 24..31. This format is selected because it can be easily translated to \r
526 an EFI_HII_DATE structure in an EFI_IFR_TYPE_VALUE union.\r
527\r
528 @param Year The year value to be encoded.\r
529 @param Month The month value to be encoded.\r
530 @param Day The day value to be encoded.\r
531\r
532 @return A 64-bit containing Year, Month, and Day.\r
533**/\r
534#define EFI_HII_DATE_UINT64(Year, Month, Day) \\r
535 (UINT64)((Year & 0xffff) | ((Month & 0xff) << 16) | ((Day & 0xff) << 24))\r
536\r
537/**\r
538 Allocates and returns a new OpCode Handle. OpCode Handles must be freed with \r
539 HiiFreeOpCodeHandle().\r
540\r
541 @retval NULL There are not enough resources to allocate a new OpCode Handle.\r
542 @retval Other A new OpCode handle.\r
543\r
544**/\r
545VOID *\r
546EFIAPI\r
547HiiAllocateOpCodeHandle (\r
548 VOID\r
549 );\r
550\r
551/**\r
552 Frees an OpCode Handle that was peviously allocated with HiiAllocateOpCodeHandle().\r
553 When an OpCode Handle is freed, all of the opcodes associated with the OpCode\r
554 Handle are also freed.\r
555\r
556 If OpCodeHandle is NULL, then ASSERT().\r
557\r
558**/\r
559VOID\r
560EFIAPI\r
561HiiFreeOpCodeHandle (\r
562 VOID *OpCodeHandle\r
563 );\r
564\r
565/**\r
566 Create EFI_IFR_END_OP opcode.\r
567\r
568 If OpCodeHandle is NULL, then ASSERT().\r
569\r
570 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
571\r
572 @retval NULL There is not enough space left in Buffer to add the opcode.\r
573 @retval Other A pointer to the created opcode.\r
574\r
575**/\r
576UINT8 *\r
577EFIAPI\r
578HiiCreateEndOpCode (\r
579 IN VOID *OpCodeHandle\r
580 );\r
581\r
582/**\r
583 Create EFI_IFR_ONE_OF_OPTION_OP opcode.\r
584\r
585 If OpCodeHandle is NULL, then ASSERT().\r
586 If Type is invalid, then ASSERT().\r
587 If Flags is invalid, then ASSERT().\r
588\r
589 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
590 @param[in] StringId StringId for the option\r
591 @param[in] Flags Flags for the option\r
592 @param[in] Type Type for the option\r
593 @param[in] Value Value for the option\r
594\r
595 @retval NULL There is not enough space left in Buffer to add the opcode.\r
596 @retval Other A pointer to the created opcode.\r
597\r
598**/\r
599UINT8 *\r
600EFIAPI\r
601HiiCreateOneOfOptionOpCode (\r
602 IN VOID *OpCodeHandle,\r
603 IN UINT16 StringId,\r
604 IN UINT8 Flags,\r
605 IN UINT8 Type,\r
606 IN UINT64 Value\r
607 );\r
608\r
609/**\r
610 Create EFI_IFR_DEFAULT_OP opcode.\r
611\r
612 If OpCodeHandle is NULL, then ASSERT().\r
613 If Type is invalid, then ASSERT().\r
614\r
615 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
616 @param[in] DefaultId DefaultId for the default\r
617 @param[in] Type Type for the default\r
618 @param[in] Value Value for the default\r
619\r
620 @retval NULL There is not enough space left in Buffer to add the opcode.\r
621 @retval Other A pointer to the created opcode.\r
622\r
623**/\r
624UINT8 *\r
625EFIAPI\r
626HiiCreateDefaultOpCode (\r
627 IN VOID *OpCodeHandle,\r
628 IN UINT16 DefaultId,\r
629 IN UINT8 Type,\r
630 IN UINT64 Value\r
631 );\r
632\r
633/**\r
634 Create EFI_IFR_GUID opcode.\r
635\r
636 If OpCodeHandle is NULL, then ASSERT().\r
637 If Guid is NULL, then ASSERT().\r
638 If OpCodeSize < sizeof (EFI_IFR_GUID), then ASSERT().\r
639\r
640 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
641 @param[in] Guid Pointer to EFI_GUID of this guided opcode.\r
642 @param[in] GuidOpCode Pointer to an EFI_IFR_GUID opcode. This is an \r
643 optional parameter that may be NULL. If this\r
644 parameter is NULL, then the GUID extension \r
645 region of the created opcode is filled with zeros.\r
646 If this parameter is not NULL, then the GUID \r
647 extension region of GuidData will be copied to \r
648 the GUID extension region of the created opcode.\r
649 @param[in] OpCodeSize The size, in bytes, of created opcode. This value \r
650 must be >= sizeof(EFI_IFR_GUID).\r
651\r
652 @retval NULL There is not enough space left in Buffer to add the opcode.\r
653 @retval Other A pointer to the created opcode.\r
654\r
655**/\r
656UINT8 *\r
657EFIAPI\r
658HiiCreateGuidOpCode (\r
659 IN VOID *OpCodeHandle,\r
660 IN CONST EFI_GUID *Guid,\r
661 IN CONST VOID *GuidOpCode, OPTIONAL\r
662 IN UINTN OpCodeSize\r
663 );\r
664\r
665/**\r
666 Create EFI_IFR_ACTION_OP opcode.\r
667\r
668 If OpCodeHandle is NULL, then ASSERT().\r
669 If any reserved bits are set in QuestionFlags, then ASSERT().\r
670\r
671 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
672 @param[in] QuestionId Question ID\r
673 @param[in] Prompt String ID for Prompt\r
674 @param[in] Help String ID for Help\r
675 @param[in] QuestionFlags Flags in Question Header\r
676 @param[in] QuestionConfig String ID for configuration\r
677\r
678 @retval NULL There is not enough space left in Buffer to add the opcode.\r
679 @retval Other A pointer to the created opcode.\r
680\r
681**/\r
682UINT8 *\r
683EFIAPI\r
684HiiCreateActionOpCode (\r
685 IN VOID *OpCodeHandle,\r
686 IN EFI_QUESTION_ID QuestionId,\r
687 IN EFI_STRING_ID Prompt,\r
688 IN EFI_STRING_ID Help,\r
689 IN UINT8 QuestionFlags,\r
690 IN EFI_STRING_ID QuestionConfig\r
691 );\r
692\r
693/**\r
694 Create EFI_IFR_SUBTITLE_OP opcode.\r
695\r
696 If OpCodeHandle is NULL, then ASSERT().\r
697 If any reserved bits are set in Flags, then ASSERT().\r
698 If Scope > 1, then ASSERT().\r
699\r
700 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
701 @param[in] Prompt String ID for Prompt\r
702 @param[in] Help String ID for Help\r
703 @param[in] Flags Subtitle opcode flags\r
704 @param[in] Scope 1 if this opcpde is the beginning of a new scope.\r
705 0 if this opcode is within the current scope.\r
706\r
707 @retval NULL There is not enough space left in Buffer to add the opcode.\r
708 @retval Other A pointer to the created opcode.\r
709\r
710**/\r
711UINT8 *\r
712EFIAPI\r
713HiiCreateSubTitleOpCode (\r
714 IN VOID *OpCodeHandle,\r
715 IN EFI_STRING_ID Prompt,\r
716 IN EFI_STRING_ID Help,\r
717 IN UINT8 Flags,\r
718 IN UINT8 Scope\r
719 );\r
720\r
721/**\r
722 Create EFI_IFR_REF_OP opcode.\r
723\r
724 If OpCodeHandle is NULL, then ASSERT().\r
725 If any reserved bits are set in QuestionFlags, then ASSERT().\r
726\r
727 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
728 @param[in] FormId Destination Form ID\r
729 @param[in] Prompt String ID for Prompt\r
730 @param[in] Help String ID for Help\r
731 @param[in] QuestionFlags Flags in Question Header\r
732 @param[in] QuestionId Question ID\r
733\r
734 @retval NULL There is not enough space left in Buffer to add the opcode.\r
735 @retval Other A pointer to the created opcode.\r
736\r
737**/\r
738UINT8 *\r
739EFIAPI\r
740HiiCreateGotoOpCode (\r
741 IN VOID *OpCodeHandle,\r
742 IN EFI_FORM_ID FormId,\r
743 IN EFI_STRING_ID Prompt,\r
744 IN EFI_STRING_ID Help,\r
745 IN UINT8 QuestionFlags,\r
746 IN EFI_QUESTION_ID QuestionId\r
747 );\r
748\r
749/**\r
750 Create EFI_IFR_CHECKBOX_OP opcode.\r
751\r
752 If OpCodeHandle is NULL, then ASSERT().\r
753 If any reserved bits are set in QuestionFlags, then ASSERT().\r
754 If any reserved bits are set in CheckBoxFlags, then ASSERT().\r
755\r
756 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
757 @param[in] QuestionId Question ID\r
758 @param[in] VarStoreId Storage ID\r
759 @param[in] VarOffset Offset in Storage\r
760 @param[in] Prompt String ID for Prompt\r
761 @param[in] Help String ID for Help\r
762 @param[in] QuestionFlags Flags in Question Header\r
763 @param[in] CheckBoxFlags Flags for checkbox opcode\r
764 @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This\r
765 is an optional parameter that may be NULL.\r
766\r
767 @retval NULL There is not enough space left in Buffer to add the opcode.\r
768 @retval Other A pointer to the created opcode.\r
769\r
770**/\r
771UINT8 *\r
772EFIAPI\r
773HiiCreateCheckBoxOpCode (\r
774 IN VOID *OpCodeHandle,\r
775 IN EFI_QUESTION_ID QuestionId,\r
776 IN EFI_VARSTORE_ID VarStoreId,\r
777 IN UINT16 VarOffset,\r
778 IN EFI_STRING_ID Prompt,\r
779 IN EFI_STRING_ID Help,\r
780 IN UINT8 QuestionFlags,\r
781 IN UINT8 CheckBoxFlags,\r
782 IN VOID *DefaultsOpCodeHandle OPTIONAL\r
783 );\r
784\r
785/**\r
786 Create EFI_IFR_NUMERIC_OP opcode.\r
787\r
788 If OpCodeHandle is NULL, then ASSERT().\r
789 If any reserved bits are set in QuestionFlags, then ASSERT().\r
790 If any reserved bits are set in NumericFlags, then ASSERT().\r
791\r
792 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
793 @param[in] QuestionId Question ID\r
794 @param[in] VarStoreId Storage ID\r
795 @param[in] VarOffset Offset in Storage\r
796 @param[in] Prompt String ID for Prompt\r
797 @param[in] Help String ID for Help\r
798 @param[in] QuestionFlags Flags in Question Header\r
799 @param[in] NumericFlags Flags for numeric opcode\r
800 @param[in] Minimum Numeric minimum value\r
801 @param[in] Maximum Numeric maximum value\r
802 @param[in] Step Numeric step for edit\r
803 @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This\r
804 is an optional parameter that may be NULL.\r
805\r
806 @retval NULL There is not enough space left in Buffer to add the opcode.\r
807 @retval Other A pointer to the created opcode.\r
808\r
809**/\r
810UINT8 *\r
811EFIAPI\r
812HiiCreateNumericOpCode (\r
813 IN VOID *OpCodeHandle,\r
814 IN EFI_QUESTION_ID QuestionId,\r
815 IN EFI_VARSTORE_ID VarStoreId,\r
816 IN UINT16 VarOffset,\r
817 IN EFI_STRING_ID Prompt,\r
818 IN EFI_STRING_ID Help,\r
819 IN UINT8 QuestionFlags,\r
820 IN UINT8 NumericFlags,\r
821 IN UINT64 Minimum,\r
822 IN UINT64 Maximum,\r
823 IN UINT64 Step,\r
824 IN VOID *DefaultsOpCodeHandle OPTIONAL\r
825 );\r
826\r
827/**\r
828 Create EFI_IFR_STRING_OP opcode.\r
829\r
830 If OpCodeHandle is NULL, then ASSERT().\r
831 If any reserved bits are set in QuestionFlags, then ASSERT().\r
832 If any reserved bits are set in StringFlags, then ASSERT().\r
833\r
834 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
835 @param[in] QuestionId Question ID\r
836 @param[in] VarStoreId Storage ID\r
837 @param[in] VarOffset Offset in Storage\r
838 @param[in] Prompt String ID for Prompt\r
839 @param[in] Help String ID for Help\r
840 @param[in] QuestionFlags Flags in Question Header\r
841 @param[in] StringFlags Flags for string opcode\r
842 @param[in] MinSize String minimum length\r
843 @param[in] MaxSize String maximum length\r
844 @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This\r
845 is an optional parameter that may be NULL.\r
846\r
847 @retval NULL There is not enough space left in Buffer to add the opcode.\r
848 @retval Other A pointer to the created opcode.\r
849\r
850**/\r
851UINT8 *\r
852EFIAPI\r
853HiiCreateStringOpCode (\r
854 IN VOID *OpCodeHandle,\r
855 IN EFI_QUESTION_ID QuestionId,\r
856 IN EFI_VARSTORE_ID VarStoreId,\r
857 IN UINT16 VarOffset,\r
858 IN EFI_STRING_ID Prompt,\r
859 IN EFI_STRING_ID Help,\r
860 IN UINT8 QuestionFlags,\r
861 IN UINT8 StringFlags,\r
862 IN UINT8 MinSize,\r
863 IN UINT8 MaxSize,\r
864 IN VOID *DefaultsOpCodeHandle OPTIONAL\r
865 );\r
866\r
867/**\r
868 Create EFI_IFR_ONE_OF_OP opcode.\r
869\r
870 If OpCodeHandle is NULL, then ASSERT().\r
871 If any reserved bits are set in QuestionFlags, then ASSERT().\r
872 If any reserved bits are set in OneOfFlags, then ASSERT().\r
873\r
874 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
875 @param[in] QuestionId Question ID\r
876 @param[in] VarStoreId Storage ID\r
877 @param[in] VarOffset Offset in Storage\r
878 @param[in] Prompt String ID for Prompt\r
879 @param[in] Help String ID for Help\r
880 @param[in] QuestionFlags Flags in Question Header\r
881 @param[in] OneOfFlags Flags for oneof opcode\r
882 @param[in] OptionsOpCodeHandle Handle for a buffer of ONE_OF_OPTION opcodes.\r
883 @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This\r
884 is an optional parameter that may be NULL.\r
885\r
886 @retval NULL There is not enough space left in Buffer to add the opcode.\r
887 @retval Other A pointer to the created opcode.\r
888\r
889**/\r
890UINT8 *\r
891EFIAPI\r
892HiiCreateOneOfOpCode (\r
893 IN VOID *OpCodeHandle,\r
894 IN EFI_QUESTION_ID QuestionId,\r
895 IN EFI_VARSTORE_ID VarStoreId,\r
896 IN UINT16 VarOffset,\r
897 IN EFI_STRING_ID Prompt,\r
898 IN EFI_STRING_ID Help,\r
899 IN UINT8 QuestionFlags,\r
900 IN UINT8 OneOfFlags,\r
901 IN VOID *OptionsOpCodeHandle,\r
902 IN VOID *DefaultsOpCodeHandle OPTIONAL\r
903 );\r
904\r
905/**\r
906 Create EFI_IFR_ORDERED_LIST_OP opcode.\r
907\r
908 If OpCodeHandle is NULL, then ASSERT().\r
909 If any reserved bits are set in QuestionFlags, then ASSERT().\r
910 If any reserved bits are set in OrderedListFlags, then ASSERT().\r
911\r
912 @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
913 @param[in] QuestionId Question ID\r
914 @param[in] VarStoreId Storage ID\r
915 @param[in] VarOffset Offset in Storage\r
916 @param[in] Prompt String ID for Prompt\r
917 @param[in] Help String ID for Help\r
918 @param[in] QuestionFlags Flags in Question Header\r
919 @param[in] OrderedListFlags Flags for ordered list opcode\r
920 @param[in] DataType Type for option value\r
921 @param[in] MaxContainers Maximum count for options in this ordered list\r
922 @param[in] OptionsOpCodeHandle Handle for a buffer of ONE_OF_OPTION opcodes.\r
923 @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This\r
924 is an optional parameter that may be NULL.\r
925\r
926 @retval NULL There is not enough space left in Buffer to add the opcode.\r
927 @retval Other A pointer to the created opcode.\r
928\r
929**/\r
930UINT8 *\r
931EFIAPI\r
932HiiCreateOrderedListOpCode (\r
933 IN VOID *OpCodeHandle,\r
934 IN EFI_QUESTION_ID QuestionId,\r
935 IN EFI_VARSTORE_ID VarStoreId,\r
936 IN UINT16 VarOffset,\r
937 IN EFI_STRING_ID Prompt,\r
938 IN EFI_STRING_ID Help,\r
939 IN UINT8 QuestionFlags,\r
940 IN UINT8 OrderedListFlags,\r
941 IN UINT8 DataType,\r
942 IN UINT8 MaxContainers,\r
943 IN VOID *OptionsOpCodeHandle,\r
944 IN VOID *DefaultsOpCodeHandle OPTIONAL\r
945 );\r
946\r
947/**\r
948 This function updates a form that has previously been registered with the HII \r
949 Database. This function will perform at most one update operation.\r
950 \r
951 The form to update is specified by Handle, FormSetGuid, and FormId. Binary \r
952 comparisons of IFR opcodes are performed from the beginning of the form being \r
953 updated until an IFR opcode is found that exactly matches the first IFR opcode \r
954 specifed by StartOpCodeHandle. The following rules are used to determine if\r
955 an insert, replace, or delete operation is performed.\r
956 \r
957 1) If no matches are found, then NULL is returned. \r
958 2) If a match is found, and EndOpCodeHandle is NULL, then all of the IFR opcodes\r
959 from StartOpcodeHandle except the first opcode are inserted immediately after \r
960 the matching IFR opcode in the form beng updated.\r
961 3) If a match is found, and EndOpCodeHandle is not NULL, then a search is made \r
962 from the matching IFR opcode until an IFR opcode exatly matches the first \r
963 IFR opcode specified by EndOpCodeHandle. If no match is found for the first\r
964 IFR opcode specified by EndOpCodeHandle, then NULL is returned. If a match\r
965 is found, then all of the IFR opcodes between the start match and the end \r
966 match are deleted from the form being updated and all of the IFR opcodes\r
967 from StartOpcodeHandle except the first opcode are inserted immediately after \r
968 the matching start IFR opcode. If StartOpCcodeHandle only contains one\r
969 IFR instruction, then the result of ths operation will delete all of the IFR\r
970 opcodes between the start end matches.\r
971\r
972 If HiiHandle is NULL, then ASSERT().\r
973 If StartOpCodeHandle is NULL, then ASSERT().\r
974\r
975 @param[in] HiiHandle The HII Handle of the form to update.\r
976 @param[in] FormSetGuid The Formset GUID of the form to update. This\r
977 is an optional parameter that may be NULL.\r
978 If it is NULL, all FormSet will be updated.\r
979 @param[in] FormId The ID of the form to update.\r
980 @param[in] StartOpCodeHandle An OpCode Handle that contains the set of IFR \r
981 opcodes to be inserted or replaced in the form.\r
982 The first IFR instruction in StartOpCodeHandle \r
983 is used to find matching IFR opcode in the \r
984 form. \r
985 @param[in] EndOpCodeHandle An OpCcode Handle that contains the IFR opcode\r
986 that marks the end of a replace operation in\r
987 the form. This is an optional parameter that\r
988 may be NULL. If it is NULL, then an the IFR\r
989 opcodes specified by StartOpCodeHandle are \r
990 inserted into the form.\r
991 \r
992 @retval EFI_OUT_OF_RESOURCES No enough memory resource is allocated.\r
993 @retval EFI_NOT_FOUND The following cases will return EFI_NOT_FOUND.\r
994 1) The form specified by HiiHandle, FormSetGuid, \r
995 and FormId could not be found in the HII Database.\r
996 2) No IFR opcodes in the target form match the first\r
997 IFR opcode in StartOpCodeHandle.\r
998 3) EndOpCOde is not NULL, and no IFR opcodes in the \r
999 target form following a matching start opcode match \r
1000 the first IFR opcode in EndOpCodeHandle.\r
1001 @retval EFI_SUCCESS The matched form is updated by StartOpcode.\r
1002\r
1003**/\r
1004EFI_STATUS\r
1005EFIAPI\r
1006HiiUpdateForm (\r
1007 IN EFI_HII_HANDLE HiiHandle,\r
1008 IN EFI_GUID *FormSetGuid, OPTIONAL\r
1009 IN EFI_FORM_ID FormId,\r
1010 IN VOID *StartOpcodeHandle,\r
1011 IN VOID *EndOpcodeHandle OPTIONAL\r
1012 );\r
1013\r
1014/**\r
1015 Configure the buffer accrording to ConfigBody strings in the format of\r
1016 <Length:4 bytes>, <Offset: 2 bytes>, <Width:2 bytes>, <Data:n bytes>.\r
1017 This ConfigBody strings is generated by EDKII UEFI VfrCompiler for the default\r
1018 values in a Form Set. The name of the ConfigBody strings is VfrMyIfrNVDataDefault0000\r
1019 constructed following this rule: \r
1020 "Vfr" + varstore.name + "Default" + defaultstore.attributes.\r
1021 Check the generated C file in Output for details.\r
1022\r
1023 @param Buffer the start address of buffer.\r
1024 @param BufferSize the size of buffer.\r
1025 @param Number the number of the ConfigBody strings.\r
1026 @param ... the ConfigBody strings\r
1027\r
1028 @retval EFI_BUFFER_TOO_SMALL the BufferSize is too small to operate.\r
1029 @retval EFI_INVALID_PARAMETER Buffer is NULL or BufferSize is 0.\r
1030 @retval EFI_SUCCESS Operation successful.\r
1031\r
1032**/\r
1033EFI_STATUS\r
1034EFIAPI\r
3c7449e4 1035HiiIfrLibExtractDefault(\r
7e3bcccb
LG
1036 IN VOID *Buffer,\r
1037 IN UINTN *BufferSize,\r
1038 UINTN Number,\r
1039 ...\r
1040 );\r
1041\r
4c76e9cc 1042#endif\r