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