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