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