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