]>
Commit | Line | Data |
---|---|---|
4c76e9cc | 1 | /** @file\r |
2 | This library contains functions to do IFR opcode creation and utility functions \r | |
3 | to help module to interact with a UEFI Form Browser.\r | |
4 | \r | |
5 | Copyright (c) 2007 - 2008, Intel Corporation\r | |
6 | All rights reserved. This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef _IFR_SUPPORT_LIBRARY_H_\r | |
17 | #define _IFR_SUPPORT_LIBRARY_H_\r | |
18 | \r | |
4c76e9cc | 19 | #pragma pack(1)\r |
20 | typedef struct {\r | |
21 | EFI_STRING_ID StringToken;\r | |
22 | EFI_IFR_TYPE_VALUE Value;\r | |
23 | UINT8 Flags;\r | |
24 | } IFR_OPTION;\r | |
25 | #pragma pack()\r | |
26 | \r | |
27 | typedef struct {\r | |
28 | ///\r | |
29 | /// Buffer size allocated for Data.\r | |
30 | ///\r | |
31 | UINT32 BufferSize;\r | |
32 | \r | |
33 | ///\r | |
34 | /// Offset in Data to append the newly created opcode binary.\r | |
35 | /// It will be adjusted automatically in Create***OpCode(), and should be\r | |
36 | /// initialized to 0 before invocation of a serial of Create***OpCode()\r | |
37 | ///\r | |
38 | UINT32 Offset;\r | |
39 | \r | |
40 | ///\r | |
41 | /// The destination buffer for created op-codes\r | |
42 | ///\r | |
43 | UINT8 *Data;\r | |
44 | } EFI_HII_UPDATE_DATA;\r | |
45 | \r | |
46 | \r | |
47 | /**\r | |
48 | Create EFI_IFR_END_OP opcode.\r | |
49 | \r | |
50 | If Data is NULL or Data->Data is NULL, then ASSERT.\r | |
51 | \r | |
52 | @param Data Destination for the created opcode binary\r | |
53 | \r | |
54 | @retval EFI_SUCCESS Opcode is created successfully.\r | |
55 | @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.\r | |
56 | \r | |
57 | **/\r | |
58 | EFI_STATUS\r | |
59 | EFIAPI\r | |
60 | CreateEndOpCode (\r | |
61 | IN OUT EFI_HII_UPDATE_DATA *Data\r | |
62 | )\r | |
63 | ;\r | |
64 | \r | |
65 | /**\r | |
66 | Create EFI_IFR_DEFAULT_OP opcode.\r | |
67 | \r | |
68 | If Data is NULL or Data->Data is NULL, then ASSERT.\r | |
69 | \r | |
70 | @param Value Value for the default\r | |
71 | @param Type Type for the default\r | |
72 | @param Data Destination for the created opcode binary\r | |
73 | \r | |
74 | @retval EFI_SUCCESS Opcode is created successfully.\r | |
75 | @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.\r | |
76 | @retval EFI_INVALID_PARAMETER The type is not valid.\r | |
77 | \r | |
78 | **/\r | |
79 | EFI_STATUS\r | |
80 | EFIAPI\r | |
81 | CreateDefaultOpCode (\r | |
82 | IN EFI_IFR_TYPE_VALUE *Value,\r | |
83 | IN UINT8 Type,\r | |
84 | IN OUT EFI_HII_UPDATE_DATA *Data\r | |
85 | )\r | |
86 | ;\r | |
87 | \r | |
88 | /**\r | |
89 | Create EFI_IFR_ACTION_OP opcode.\r | |
90 | \r | |
91 | If Data is NULL or Data->Data is NULL, then ASSERT.\r | |
92 | \r | |
93 | @param QuestionId Question ID\r | |
94 | @param Prompt String ID for Prompt\r | |
95 | @param Help String ID for Help\r | |
96 | @param QuestionFlags Flags in Question Header\r | |
97 | @param QuestionConfig String ID for configuration\r | |
98 | @param Data Destination for the created opcode binary\r | |
99 | \r | |
100 | @retval EFI_SUCCESS Opcode is created successfully.\r | |
101 | @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.\r | |
102 | @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.\r | |
103 | \r | |
104 | **/\r | |
105 | EFI_STATUS\r | |
106 | EFIAPI\r | |
107 | CreateActionOpCode (\r | |
108 | IN EFI_QUESTION_ID QuestionId,\r | |
109 | IN EFI_STRING_ID Prompt,\r | |
110 | IN EFI_STRING_ID Help,\r | |
111 | IN UINT8 QuestionFlags,\r | |
112 | IN EFI_STRING_ID QuestionConfig,\r | |
113 | IN OUT EFI_HII_UPDATE_DATA *Data\r | |
114 | )\r | |
115 | ;\r | |
116 | \r | |
117 | /**\r | |
118 | Create EFI_IFR_SUBTITLE_OP opcode.\r | |
119 | \r | |
120 | If Data is NULL or Data->Data is NULL, then ASSERT.\r | |
121 | \r | |
122 | @param Prompt String ID for Prompt\r | |
123 | @param Help String ID for Help\r | |
124 | @param Flags Subtitle opcode flags\r | |
125 | @param Scope Subtitle Scope bit\r | |
126 | @param Data Destination for the created opcode binary\r | |
127 | \r | |
128 | @retval EFI_SUCCESS Opcode is created successfully.\r | |
129 | @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.\r | |
130 | \r | |
131 | **/\r | |
132 | EFI_STATUS\r | |
133 | EFIAPI\r | |
134 | CreateSubTitleOpCode (\r | |
135 | IN EFI_STRING_ID Prompt,\r | |
136 | IN EFI_STRING_ID Help,\r | |
137 | IN UINT8 Flags,\r | |
138 | IN UINT8 Scope,\r | |
139 | IN OUT EFI_HII_UPDATE_DATA *Data\r | |
140 | )\r | |
141 | ;\r | |
142 | \r | |
143 | /**\r | |
144 | Create EFI_IFR_TEXT_OP opcode.\r | |
145 | \r | |
146 | If Data is NULL or Data->Data is NULL, then ASSERT.\r | |
147 | \r | |
148 | @param Prompt String ID for Prompt\r | |
149 | @param Help String ID for Help\r | |
150 | @param TextTwo String ID for text two\r | |
151 | @param Data Destination for the created opcode binary\r | |
152 | \r | |
153 | @retval EFI_SUCCESS Opcode is created successfully.\r | |
154 | @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.\r | |
155 | \r | |
156 | **/\r | |
157 | EFI_STATUS\r | |
158 | EFIAPI\r | |
159 | CreateTextOpCode (\r | |
160 | IN EFI_STRING_ID Prompt,\r | |
161 | IN EFI_STRING_ID Help,\r | |
162 | IN EFI_STRING_ID TextTwo,\r | |
163 | IN OUT EFI_HII_UPDATE_DATA *Data\r | |
164 | )\r | |
165 | ;\r | |
166 | \r | |
167 | /**\r | |
168 | Create EFI_IFR_REF_OP opcode.\r | |
169 | \r | |
170 | If Data is NULL or Data->Data is NULL, then ASSERT.\r | |
171 | \r | |
172 | @param FormId Destination Form ID\r | |
173 | @param Prompt String ID for Prompt\r | |
174 | @param Help String ID for Help\r | |
175 | @param QuestionFlags Flags in Question Header\r | |
176 | @param QuestionId Question ID\r | |
177 | @param Data Destination for the created opcode binary\r | |
178 | \r | |
179 | @retval EFI_SUCCESS Opcode is created successfully.\r | |
180 | @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.\r | |
181 | @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.\r | |
182 | \r | |
183 | **/\r | |
184 | EFI_STATUS\r | |
185 | EFIAPI\r | |
186 | CreateGotoOpCode (\r | |
187 | IN EFI_FORM_ID FormId,\r | |
188 | IN EFI_STRING_ID Prompt,\r | |
189 | IN EFI_STRING_ID Help,\r | |
190 | IN UINT8 QuestionFlags,\r | |
191 | IN EFI_QUESTION_ID QuestionId,\r | |
192 | IN OUT EFI_HII_UPDATE_DATA *Data\r | |
193 | )\r | |
194 | ;\r | |
195 | \r | |
196 | /**\r | |
197 | Create EFI_IFR_ONE_OF_OPTION_OP opcode.\r | |
198 | \r | |
199 | If Data is NULL or Data->Data is NULL, then ASSERT.\r | |
200 | \r | |
201 | @param OptionCount The number of options.\r | |
202 | @param OptionsList The list of Options.\r | |
203 | @param Type The data type.\r | |
204 | @param Data Destination for the created opcode binary\r | |
205 | \r | |
206 | @retval EFI_SUCCESS Opcode is created successfully.\r | |
207 | @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.\r | |
208 | @retval EFI_INVALID_PARAMETER If OptionCount is not zero but OptionsList is NULL.\r | |
209 | \r | |
210 | **/\r | |
211 | EFI_STATUS\r | |
212 | EFIAPI\r | |
213 | CreateOneOfOptionOpCode (\r | |
214 | IN UINTN OptionCount,\r | |
215 | IN IFR_OPTION *OptionsList,\r | |
216 | IN UINT8 Type,\r | |
217 | IN OUT EFI_HII_UPDATE_DATA *Data\r | |
218 | )\r | |
219 | ;\r | |
220 | \r | |
221 | /**\r | |
222 | Create EFI_IFR_ONE_OF_OP opcode.\r | |
223 | \r | |
224 | If Data is NULL or Data->Data is NULL, then ASSERT.\r | |
225 | \r | |
226 | @param QuestionId Question ID\r | |
227 | @param VarStoreId Storage ID\r | |
228 | @param VarOffset Offset in Storage\r | |
229 | @param Prompt String ID for Prompt\r | |
230 | @param Help String ID for Help\r | |
231 | @param QuestionFlags Flags in Question Header\r | |
232 | @param OneOfFlags Flags for oneof opcode\r | |
233 | @param OptionsList List of options\r | |
234 | @param OptionCount Number of options in option list\r | |
235 | @param Data Destination for the created opcode binary\r | |
236 | \r | |
237 | @retval EFI_SUCCESS Opcode is created successfully.\r | |
238 | @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.\r | |
239 | @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.\r | |
240 | \r | |
241 | **/\r | |
242 | EFI_STATUS\r | |
243 | EFIAPI\r | |
244 | CreateOneOfOpCode (\r | |
245 | IN EFI_QUESTION_ID QuestionId,\r | |
246 | IN EFI_VARSTORE_ID VarStoreId,\r | |
247 | IN UINT16 VarOffset,\r | |
248 | IN EFI_STRING_ID Prompt,\r | |
249 | IN EFI_STRING_ID Help,\r | |
250 | IN UINT8 QuestionFlags,\r | |
251 | IN UINT8 OneOfFlags,\r | |
252 | IN IFR_OPTION *OptionsList,\r | |
253 | IN UINTN OptionCount,\r | |
254 | IN OUT EFI_HII_UPDATE_DATA *Data\r | |
255 | )\r | |
256 | ;\r | |
257 | \r | |
258 | /**\r | |
259 | Create EFI_IFR_ORDERED_LIST_OP opcode.\r | |
260 | \r | |
261 | If Data is NULL or Data->Data is NULL, then ASSERT.\r | |
262 | \r | |
263 | @param QuestionId Question ID\r | |
264 | @param VarStoreId Storage ID\r | |
265 | @param VarOffset Offset in Storage\r | |
266 | @param Prompt String ID for Prompt\r | |
267 | @param Help String ID for Help\r | |
268 | @param QuestionFlags Flags in Question Header\r | |
269 | @param OrderedListFlags Flags for ordered list opcode\r | |
270 | @param DataType Type for option value\r | |
271 | @param MaxContainers Maximum count for options in this ordered list\r | |
272 | @param OptionsList List of options\r | |
273 | @param OptionCount Number of options in option list\r | |
274 | @param Data Destination for the created opcode binary\r | |
275 | \r | |
276 | @retval EFI_SUCCESS Opcode is created successfully.\r | |
277 | @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.\r | |
278 | @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.\r | |
279 | \r | |
280 | **/\r | |
281 | EFI_STATUS\r | |
282 | EFIAPI\r | |
283 | CreateOrderedListOpCode (\r | |
284 | IN EFI_QUESTION_ID QuestionId,\r | |
285 | IN EFI_VARSTORE_ID VarStoreId,\r | |
286 | IN UINT16 VarOffset,\r | |
287 | IN EFI_STRING_ID Prompt,\r | |
288 | IN EFI_STRING_ID Help,\r | |
289 | IN UINT8 QuestionFlags,\r | |
290 | IN UINT8 OrderedListFlags,\r | |
291 | IN UINT8 DataType,\r | |
292 | IN UINT8 MaxContainers,\r | |
293 | IN IFR_OPTION *OptionsList,\r | |
294 | IN UINTN OptionCount,\r | |
295 | IN OUT EFI_HII_UPDATE_DATA *Data\r | |
296 | )\r | |
297 | ;\r | |
298 | \r | |
299 | /**\r | |
300 | Create EFI_IFR_CHECKBOX_OP opcode.\r | |
301 | \r | |
302 | If Data is NULL or Data->Data is NULL, then ASSERT.\r | |
303 | \r | |
304 | @param QuestionId Question ID\r | |
305 | @param VarStoreId Storage ID\r | |
306 | @param VarOffset Offset in Storage\r | |
307 | @param Prompt String ID for Prompt\r | |
308 | @param Help String ID for Help\r | |
309 | @param QuestionFlags Flags in Question Header\r | |
310 | @param CheckBoxFlags Flags for checkbox opcode\r | |
311 | @param Data Destination for the created opcode binary\r | |
312 | \r | |
313 | @retval EFI_SUCCESS Opcode is created successfully.\r | |
314 | @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.\r | |
315 | @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.\r | |
316 | \r | |
317 | **/\r | |
318 | EFI_STATUS\r | |
319 | EFIAPI\r | |
320 | CreateCheckBoxOpCode (\r | |
321 | IN EFI_QUESTION_ID QuestionId,\r | |
322 | IN EFI_VARSTORE_ID VarStoreId,\r | |
323 | IN UINT16 VarOffset,\r | |
324 | IN EFI_STRING_ID Prompt,\r | |
325 | IN EFI_STRING_ID Help,\r | |
326 | IN UINT8 QuestionFlags,\r | |
327 | IN UINT8 CheckBoxFlags,\r | |
328 | IN OUT EFI_HII_UPDATE_DATA *Data\r | |
329 | )\r | |
330 | ;\r | |
331 | \r | |
332 | /**\r | |
333 | Create EFI_IFR_NUMERIC_OP opcode.\r | |
334 | \r | |
335 | If Data is NULL or Data->Data is NULL, then ASSERT.\r | |
336 | \r | |
337 | @param QuestionId Question ID\r | |
338 | @param VarStoreId Storage ID\r | |
339 | @param VarOffset Offset in Storage\r | |
340 | @param Prompt String ID for Prompt\r | |
341 | @param Help String ID for Help\r | |
342 | @param QuestionFlags Flags in Question Header\r | |
343 | @param NumericFlags Flags for numeric opcode\r | |
344 | @param Minimum Numeric minimum value\r | |
345 | @param Maximum Numeric maximum value\r | |
346 | @param Step Numeric step for edit\r | |
347 | @param Default Numeric default value\r | |
348 | @param Data Destination for the created opcode binary\r | |
349 | \r | |
350 | @retval EFI_SUCCESS Opcode is created successfully.\r | |
351 | @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.\r | |
352 | @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.\r | |
353 | \r | |
354 | **/\r | |
355 | EFI_STATUS\r | |
356 | EFIAPI\r | |
357 | CreateNumericOpCode (\r | |
358 | IN EFI_QUESTION_ID QuestionId,\r | |
359 | IN EFI_VARSTORE_ID VarStoreId,\r | |
360 | IN UINT16 VarOffset,\r | |
361 | IN EFI_STRING_ID Prompt,\r | |
362 | IN EFI_STRING_ID Help,\r | |
363 | IN UINT8 QuestionFlags,\r | |
364 | IN UINT8 NumericFlags,\r | |
365 | IN UINT64 Minimum,\r | |
366 | IN UINT64 Maximum,\r | |
367 | IN UINT64 Step,\r | |
368 | IN UINT64 Default,\r | |
369 | IN OUT EFI_HII_UPDATE_DATA *Data\r | |
370 | )\r | |
371 | ;\r | |
372 | \r | |
373 | /**\r | |
374 | Create EFI_IFR_STRING_OP opcode.\r | |
375 | \r | |
376 | If Data is NULL or Data->Data is NULL, then ASSERT.\r | |
377 | \r | |
378 | @param QuestionId Question ID\r | |
379 | @param VarStoreId Storage ID\r | |
380 | @param VarOffset Offset in Storage\r | |
381 | @param Prompt String ID for Prompt\r | |
382 | @param Help String ID for Help\r | |
383 | @param QuestionFlags Flags in Question Header\r | |
384 | @param StringFlags Flags for string opcode\r | |
385 | @param MinSize String minimum length\r | |
386 | @param MaxSize String maximum length\r | |
387 | @param Data Destination for the created opcode binary\r | |
388 | \r | |
389 | @retval EFI_SUCCESS Opcode is created successfully.\r | |
390 | @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.\r | |
391 | @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.\r | |
392 | \r | |
393 | **/\r | |
394 | EFI_STATUS\r | |
395 | EFIAPI\r | |
396 | CreateStringOpCode (\r | |
397 | IN EFI_QUESTION_ID QuestionId,\r | |
398 | IN EFI_VARSTORE_ID VarStoreId,\r | |
399 | IN UINT16 VarOffset,\r | |
400 | IN EFI_STRING_ID Prompt,\r | |
401 | IN EFI_STRING_ID Help,\r | |
402 | IN UINT8 QuestionFlags,\r | |
403 | IN UINT8 StringFlags,\r | |
404 | IN UINT8 MinSize,\r | |
405 | IN UINT8 MaxSize,\r | |
406 | IN OUT EFI_HII_UPDATE_DATA *Data\r | |
407 | )\r | |
408 | ;\r | |
409 | /**\r | |
410 | Construct <ConfigAltResp> for a buffer storage.\r | |
411 | \r | |
412 | @param ConfigRequest The Config request string. If set to NULL, all the\r | |
413 | configurable elements will be extracted from BlockNameArray.\r | |
4c76e9cc | 414 | @param Progress On return, points to a character in the Request.\r |
cebc8d48 | 415 | @param ConfigAltResp The returned <ConfigAltResp>.\r |
4c76e9cc | 416 | @param Guid GUID of the buffer storage.\r |
417 | @param Name Name of the buffer storage.\r | |
418 | @param DriverHandle The DriverHandle which is used to invoke HiiDatabase\r | |
419 | protocol interface NewPackageList().\r | |
420 | @param BufferStorage Content of the buffer storage.\r | |
421 | @param BufferStorageSize Length in bytes of the buffer storage.\r | |
422 | @param BlockNameArray Array generated by VFR compiler.\r | |
423 | @param NumberAltCfg Number of Default value array generated by VFR compiler.\r | |
424 | The sequential input parameters will be number of\r | |
425 | AltCfgId and DefaultValueArray pairs. When set to 0,\r | |
426 | there will be no <AltResp>.\r | |
cebc8d48 LG |
427 | @param ... Variable argument list. \r |
428 | \r | |
4c76e9cc | 429 | retval EFI_OUT_OF_RESOURCES Run out of memory resource.\r |
430 | retval EFI_INVALID_PARAMETER ConfigAltResp is NULL.\r | |
431 | retval EFI_SUCCESS Operation successful.\r | |
432 | \r | |
433 | **/\r | |
434 | EFI_STATUS\r | |
435 | ConstructConfigAltResp (\r | |
436 | IN EFI_STRING ConfigRequest, OPTIONAL\r | |
437 | OUT EFI_STRING *Progress,\r | |
438 | OUT EFI_STRING *ConfigAltResp,\r | |
439 | IN EFI_GUID *Guid,\r | |
440 | IN CHAR16 *Name,\r | |
441 | IN EFI_HANDLE *DriverHandle,\r | |
442 | IN VOID *BufferStorage,\r | |
443 | IN UINTN BufferStorageSize,\r | |
444 | IN VOID *BlockNameArray, OPTIONAL\r | |
445 | IN UINTN NumberAltCfg,\r | |
446 | ...\r | |
447 | //IN UINT16 AltCfgId,\r | |
448 | //IN VOID *DefaultValueArray,\r | |
449 | )\r | |
450 | ;\r | |
451 | \r | |
452 | /**\r | |
453 | Converts the unicode character of the string from uppercase to lowercase.\r | |
454 | \r | |
455 | @param Str String to be converted\r | |
456 | \r | |
457 | \r | |
458 | **/\r | |
459 | VOID\r | |
460 | EFIAPI\r | |
461 | ToLower (\r | |
462 | IN OUT CHAR16 *Str\r | |
463 | )\r | |
464 | ;\r | |
465 | \r | |
466 | /**\r | |
467 | Converts binary buffer to a Unicode string. The byte buffer is in a reversed byte order \r | |
468 | compared with the byte order defined in BufToHexString().\r | |
469 | \r | |
470 | @param Str String for output\r | |
471 | @param Buffer Binary buffer.\r | |
472 | @param BufferSize Size of the buffer in bytes.\r | |
473 | \r | |
474 | @retval EFI_SUCCESS The function completed successfully.\r | |
475 | @retval EFI_OUT_OF_RESOURCES There is no enough available memory space.\r | |
476 | \r | |
477 | **/\r | |
478 | EFI_STATUS\r | |
479 | EFIAPI\r | |
480 | BufInReverseOrderToHexString (\r | |
481 | IN OUT CHAR16 *Str,\r | |
482 | IN UINT8 *Buffer,\r | |
483 | IN UINTN BufferSize\r | |
484 | )\r | |
485 | ;\r | |
486 | \r | |
487 | /**\r | |
488 | Converts Hex String to binary buffer in reversed byte order to HexStringToBuf().\r | |
489 | \r | |
490 | @param Buffer Pointer to buffer that receives the data.\r | |
491 | @param BufferSize Length in bytes of the buffer to hold converted\r | |
492 | data. If routine return with EFI_SUCCESS,\r | |
493 | containing length of converted data. If routine\r | |
494 | return with EFI_BUFFER_TOO_SMALL, containg length\r | |
495 | of buffer desired.\r | |
496 | @param Str String to be converted from.\r | |
497 | \r | |
498 | @retval EFI_SUCCESS The function completed successfully.\r | |
499 | @retval RETURN_BUFFER_TOO_SMALL The input BufferSize is too small to hold the output. BufferSize\r | |
500 | will be updated to the size required for the converstion.\r | |
501 | \r | |
502 | **/\r | |
503 | EFI_STATUS\r | |
504 | EFIAPI\r | |
505 | HexStringToBufInReverseOrder (\r | |
506 | IN OUT UINT8 *Buffer,\r | |
507 | IN OUT UINTN *BufferSize,\r | |
508 | IN CHAR16 *Str\r | |
509 | )\r | |
510 | ;\r | |
511 | \r | |
512 | /**\r | |
513 | Convert binary representation Config string (e.g. "0041004200430044") to the\r | |
514 | original string (e.g. "ABCD"). Config string appears in <ConfigHdr> (i.e.\r | |
515 | "&NAME=<string>"), or Name/Value pair in <ConfigBody> (i.e. "label=<string>").\r | |
516 | \r | |
517 | @param UnicodeString Original Unicode string.\r | |
518 | @param StrBufferLen On input: Length in bytes of buffer to hold the Unicode string.\r | |
519 | Includes tailing '\0' character.\r | |
520 | On output:\r | |
521 | containing length of Unicode string buffer when returning EFI_SUCCESS;\r | |
522 | containg length of string buffer desired when returning EFI_BUFFER_TOO_SMALL.\r | |
523 | @param ConfigString Binary representation of Unicode String, <string> := (<HexCh>4)+\r | |
524 | \r | |
525 | @retval EFI_SUCCESS Operation completes successfully.\r | |
526 | @retval EFI_BUFFER_TOO_SMALL The string buffer is too small.\r | |
527 | \r | |
528 | **/\r | |
529 | EFI_STATUS\r | |
530 | EFIAPI\r | |
531 | ConfigStringToUnicode (\r | |
532 | IN OUT CHAR16 *UnicodeString,\r | |
533 | IN OUT UINTN *StrBufferLen,\r | |
534 | IN CHAR16 *ConfigString\r | |
535 | )\r | |
536 | ;\r | |
537 | \r | |
538 | /**\r | |
539 | Convert Unicode string to binary representation Config string, e.g.\r | |
540 | "ABCD" => "0041004200430044". Config string appears in <ConfigHdr> (i.e.\r | |
541 | "&NAME=<string>"), or Name/Value pair in <ConfigBody> (i.e. "label=<string>").\r | |
542 | \r | |
543 | @param ConfigString Binary representation of Unicode String, <string> := (<HexCh>4)+\r | |
544 | @param StrBufferLen On input: Length in bytes of buffer to hold the Unicode string.\r | |
545 | Includes tailing '\0' character.\r | |
546 | On output:\r | |
547 | If return EFI_SUCCESS, containing length of Unicode string buffer.\r | |
548 | If return EFI_BUFFER_TOO_SMALL, containg length of string buffer desired.\r | |
549 | @param UnicodeString Original Unicode string.\r | |
550 | \r | |
551 | @retval EFI_SUCCESS Operation completes successfully.\r | |
552 | @retval EFI_BUFFER_TOO_SMALL The string buffer is too small.\r | |
553 | \r | |
554 | **/\r | |
555 | EFI_STATUS\r | |
556 | EFIAPI\r | |
557 | UnicodeToConfigString (\r | |
558 | IN OUT CHAR16 *ConfigString,\r | |
559 | IN OUT UINTN *StrBufferLen,\r | |
560 | IN CHAR16 *UnicodeString\r | |
561 | )\r | |
562 | ;\r | |
563 | \r | |
564 | /**\r | |
565 | Construct <ConfigHdr> using routing information GUID/NAME/PATH.\r | |
566 | \r | |
567 | @param ConfigHdr Pointer to the ConfigHdr string.\r | |
568 | @param StrBufferLen On input: Length in bytes of buffer to hold the\r | |
569 | ConfigHdr string. Includes tailing '\0' character.\r | |
570 | On output: If return EFI_SUCCESS, containing\r | |
571 | length of ConfigHdr string buffer. If return\r | |
572 | EFI_BUFFER_TOO_SMALL, containg length of string\r | |
573 | buffer desired.\r | |
574 | @param Guid Routing information: GUID.\r | |
575 | @param Name Routing information: NAME.\r | |
576 | @param DriverHandle Driver handle which contains the routing\r | |
577 | information: PATH.\r | |
578 | \r | |
579 | @retval EFI_SUCCESS Operation completes successfully.\r | |
580 | @retval EFI_BUFFER_TOO_SMALL The ConfigHdr string buffer is too small.\r | |
581 | \r | |
582 | **/\r | |
583 | EFI_STATUS\r | |
584 | EFIAPI\r | |
585 | ConstructConfigHdr (\r | |
586 | IN OUT CHAR16 *ConfigHdr,\r | |
587 | IN OUT UINTN *StrBufferLen,\r | |
588 | IN CONST EFI_GUID *Guid,\r | |
589 | IN CHAR16 *Name, OPTIONAL\r | |
590 | IN EFI_HANDLE *DriverHandle\r | |
591 | )\r | |
592 | \r | |
593 | ;\r | |
594 | \r | |
595 | /**\r | |
596 | Determines if the Routing data (Guid and Name) is correct in <ConfigHdr>.\r | |
597 | \r | |
598 | @param ConfigString Either <ConfigRequest> or <ConfigResp>.\r | |
599 | @param StorageGuid GUID of the storage.\r | |
600 | @param StorageName Name of the stoarge.\r | |
601 | \r | |
602 | @retval TRUE Routing information is correct in ConfigString.\r | |
603 | @retval FALSE Routing information is incorrect in ConfigString.\r | |
604 | \r | |
605 | **/\r | |
606 | BOOLEAN\r | |
b9982883 | 607 | EFIAPI\r |
4c76e9cc | 608 | IsConfigHdrMatch (\r |
609 | IN EFI_STRING ConfigString,\r | |
610 | IN EFI_GUID *StorageGuid, OPTIONAL\r | |
611 | IN CHAR16 *StorageName OPTIONAL\r | |
612 | )\r | |
613 | ;\r | |
614 | \r | |
615 | /**\r | |
616 | Search BlockName "&OFFSET=Offset&WIDTH=Width" in a string.\r | |
617 | \r | |
618 | @param String The string to be searched in.\r | |
619 | @param Offset Offset in BlockName.\r | |
620 | @param Width Width in BlockName.\r | |
621 | \r | |
622 | @retval TRUE Block name found.\r | |
623 | @retval FALSE Block name not found.\r | |
624 | \r | |
625 | **/\r | |
626 | BOOLEAN\r | |
627 | EFIAPI\r | |
628 | FindBlockName (\r | |
629 | IN OUT CHAR16 *String,\r | |
630 | IN UINTN Offset,\r | |
631 | IN UINTN Width\r | |
632 | )\r | |
633 | ;\r | |
634 | \r | |
635 | /**\r | |
636 | This routine is invoked by ConfigAccess.Callback() to retrived uncommitted data from Form Browser.\r | |
637 | \r | |
638 | @param VariableGuid An optional field to indicate the target variable\r | |
639 | GUID name to use.\r | |
640 | @param VariableName An optional field to indicate the target\r | |
641 | human-readable variable name.\r | |
642 | @param BufferSize On input: Length in bytes of buffer to hold\r | |
643 | retrived data. On output: If return\r | |
644 | EFI_BUFFER_TOO_SMALL, containg length of buffer\r | |
645 | desired.\r | |
646 | @param Buffer Buffer to hold retrived data.\r | |
647 | \r | |
648 | @retval EFI_SUCCESS Operation completes successfully.\r | |
649 | @retval EFI_BUFFER_TOO_SMALL The intput buffer is too small.\r | |
650 | \r | |
651 | **/\r | |
652 | EFI_STATUS\r | |
653 | EFIAPI\r | |
654 | GetBrowserData (\r | |
655 | IN CONST EFI_GUID *VariableGuid, OPTIONAL\r | |
656 | IN CONST CHAR16 *VariableName, OPTIONAL\r | |
657 | IN OUT UINTN *BufferSize,\r | |
658 | IN OUT UINT8 *Buffer\r | |
659 | )\r | |
660 | ;\r | |
661 | \r | |
662 | /**\r | |
663 | This routine is invoked by ConfigAccess.Callback() to update uncommitted data of Form Browser.\r | |
664 | \r | |
665 | @param VariableGuid An optional field to indicate the target variable\r | |
666 | GUID name to use.\r | |
667 | @param VariableName An optional field to indicate the target\r | |
668 | human-readable variable name.\r | |
669 | @param BufferSize Length in bytes of buffer to hold retrived data.\r | |
670 | @param Buffer Buffer to hold retrived data.\r | |
671 | @param RequestElement An optional field to specify which part of the\r | |
672 | buffer data will be send back to Browser. If NULL,\r | |
673 | the whole buffer of data will be committed to\r | |
674 | Browser. <RequestElement> ::=\r | |
675 | &OFFSET=<Number>&WIDTH=<Number>*\r | |
676 | \r | |
677 | @retval EFI_SUCCESS Operation completes successfully.\r | |
678 | @retval Other Updating Browser uncommitted data failed.\r | |
679 | \r | |
680 | **/\r | |
681 | EFI_STATUS\r | |
682 | EFIAPI\r | |
683 | SetBrowserData (\r | |
684 | IN CONST EFI_GUID *VariableGuid, OPTIONAL\r | |
685 | IN CONST CHAR16 *VariableName, OPTIONAL\r | |
686 | IN UINTN BufferSize,\r | |
687 | IN CONST UINT8 *Buffer,\r | |
688 | IN CONST CHAR16 *RequestElement OPTIONAL\r | |
689 | )\r | |
690 | ;\r | |
691 | \r | |
692 | /**\r | |
693 | Draw a dialog and return the selected key.\r | |
694 | \r | |
695 | @param NumberOfLines The number of lines for the dialog box\r | |
696 | @param KeyValue The EFI_KEY value returned if HotKey is TRUE..\r | |
697 | @param String Pointer to the first string in the list\r | |
698 | @param ... A series of (quantity == NumberOfLines - 1) text\r | |
699 | strings which will be used to construct the dialog\r | |
700 | box\r | |
701 | \r | |
702 | @retval EFI_SUCCESS Displayed dialog and received user interaction\r | |
703 | @retval EFI_INVALID_PARAMETER One of the parameters was invalid.\r | |
704 | \r | |
705 | **/\r | |
706 | EFI_STATUS\r | |
707 | EFIAPI\r | |
708 | IfrLibCreatePopUp (\r | |
709 | IN UINTN NumberOfLines,\r | |
710 | OUT EFI_INPUT_KEY *KeyValue,\r | |
711 | IN CHAR16 *String,\r | |
712 | ...\r | |
713 | )\r | |
714 | ;\r | |
715 | \r | |
716 | /**\r | |
717 | Draw a dialog and return the selected key using Variable Argument List.\r | |
718 | \r | |
719 | @param NumberOfLines The number of lines for the dialog box\r | |
720 | @param KeyValue The EFI_KEY value returned if HotKey is TRUE..\r | |
35d59af3 | 721 | @param String The first String to be displayed in the Pop-Up.\r |
4c76e9cc | 722 | @param Args VA_LIST marker for the variable argument list.\r |
723 | A series of (quantity == NumberOfLines - 1) text\r | |
724 | strings which will be used to construct the dialog\r | |
725 | box\r | |
726 | \r | |
727 | @retval EFI_SUCCESS Displayed dialog and received user interaction\r | |
728 | @retval EFI_INVALID_PARAMETER One of the parameters was invalid.\r | |
729 | \r | |
730 | **/\r | |
731 | EFI_STATUS\r | |
732 | EFIAPI\r | |
733 | IfrLibCreatePopUp2 (\r | |
734 | IN UINTN NumberOfLines,\r | |
735 | OUT EFI_INPUT_KEY *KeyValue,\r | |
35d59af3 | 736 | IN CHAR16 *String,\r |
4c76e9cc | 737 | IN VA_LIST Args\r |
738 | )\r | |
739 | ;\r | |
740 | \r | |
ac7e320c LG |
741 | /**\r |
742 | Test if a Unicode character is a hexadecimal digit. If true, the input\r | |
743 | Unicode character is converted to a byte. \r | |
744 | \r | |
745 | This function tests if a Unicode character is a hexadecimal digit. If true, the input\r | |
746 | Unicode character is converted to a byte. For example, Unicode character\r | |
747 | L'A' will be converted to 0x0A. \r | |
748 | \r | |
749 | If Digit is NULL, then ASSERT.\r | |
750 | \r | |
751 | @param Digit The output hexadecimal digit.\r | |
752 | \r | |
753 | @param Char The input Unicode character.\r | |
754 | \r | |
755 | @retval TRUE Char is in the range of Hexadecimal number. Digit is updated\r | |
756 | to the byte value of the number.\r | |
757 | @retval FALSE Char is not in the range of Hexadecimal number. Digit is keep\r | |
758 | intact.\r | |
759 | \r | |
760 | **/\r | |
761 | BOOLEAN\r | |
762 | EFIAPI\r | |
763 | IsHexDigit (\r | |
764 | OUT UINT8 *Digit,\r | |
765 | IN CHAR16 Char\r | |
766 | )\r | |
767 | ;\r | |
768 | \r | |
769 | \r | |
770 | /** \r | |
771 | Convert binary buffer to a Unicode String in a specified sequence. \r | |
772 | \r | |
773 | This function converts bytes in the memory block pointed by Buffer to a Unicode String Str. \r | |
774 | Each byte will be represented by two Unicode characters. For example, byte 0xA1 will \r | |
775 | be converted into two Unicode character L'A' and L'1'. In the output String, the Unicode Character \r | |
776 | for the Most Significant Nibble will be put before the Unicode Character for the Least Significant\r | |
777 | Nibble. The output string for the buffer containing a single byte 0xA1 will be L"A1". \r | |
778 | For a buffer with multiple bytes, the Unicode character produced by the first byte will be put into the \r | |
779 | the last character in the output string. The one next to first byte will be put into the\r | |
780 | character before the last character. This rules applies to the rest of the bytes. The Unicode\r | |
781 | character by the last byte will be put into the first character in the output string. For example,\r | |
782 | the input buffer for a 64-bits unsigned integer 0x12345678abcdef1234 will be converted to\r | |
783 | a Unicode string equal to L"12345678abcdef1234".\r | |
784 | \r | |
785 | @param String On input, String is pointed to the buffer allocated for the convertion.\r | |
786 | @param StringLen The Length of String buffer to hold the output String. The length must include the tailing '\0' character.\r | |
787 | The StringLen required to convert a N bytes Buffer will be a least equal to or greater \r | |
788 | than 2*N + 1.\r | |
789 | @param Buffer The pointer to a input buffer.\r | |
790 | @param BufferSizeInBytes Length in bytes of the input buffer.\r | |
791 | \r | |
792 | \r | |
793 | @retval EFI_SUCCESS The convertion is successful. All bytes in Buffer has been convert to the corresponding\r | |
794 | Unicode character and placed into the right place in String.\r | |
795 | @retval EFI_BUFFER_TOO_SMALL StringSizeInBytes is smaller than 2 * N + 1the number of bytes required to\r | |
796 | complete the convertion. \r | |
797 | **/\r | |
798 | RETURN_STATUS\r | |
799 | EFIAPI\r | |
800 | BufToHexString (\r | |
801 | IN OUT CHAR16 *String,\r | |
802 | IN OUT UINTN *StringLen,\r | |
803 | IN CONST UINT8 *Buffer,\r | |
804 | IN UINTN BufferSizeInBytes\r | |
805 | )\r | |
806 | ;\r | |
807 | \r | |
808 | \r | |
809 | /**\r | |
810 | Convert a Unicode string consisting of hexadecimal characters to a output byte buffer.\r | |
811 | \r | |
812 | This function converts a Unicode string consisting of characters in the range of Hexadecimal\r | |
813 | character (L'0' to L'9', L'A' to L'F' and L'a' to L'f') to a output byte buffer. The function will stop\r | |
814 | at the first non-hexadecimal character or the NULL character. The convertion process can be\r | |
815 | simply viewed as the reverse operations defined by BufToHexString. Two Unicode characters will be \r | |
816 | converted into one byte. The first Unicode character represents the Most Significant Nibble and the\r | |
817 | second Unicode character represents the Least Significant Nibble in the output byte. \r | |
818 | The first pair of Unicode characters represents the last byte in the output buffer. The second pair of Unicode \r | |
819 | characters represent the the byte preceding the last byte. This rule applies to the rest pairs of bytes. \r | |
820 | The last pair represent the first byte in the output buffer. \r | |
821 | \r | |
822 | For example, a Unciode String L"12345678" will be converted into a buffer wil the following bytes \r | |
823 | (first byte is the byte in the lowest memory address): "0x78, 0x56, 0x34, 0x12".\r | |
824 | \r | |
825 | If String has N valid hexadecimal characters for conversion, the caller must make sure Buffer is at least \r | |
826 | N/2 (if N is even) or (N+1)/2 (if N if odd) bytes. \r | |
827 | \r | |
4a1102c9 | 828 | If either Buffer, BufferSizeInBytes or String is NULL, then ASSERT ().\r |
829 | \r | |
ac7e320c LG |
830 | @param Buffer The output buffer allocated by the caller.\r |
831 | @param BufferSizeInBytes On input, the size in bytes of Buffer. On output, it is updated to \r | |
832 | contain the size of the Buffer which is actually used for the converstion.\r | |
833 | For Unicode string with 2*N hexadecimal characters (not including the \r | |
834 | tailing NULL character), N bytes of Buffer will be used for the output.\r | |
835 | @param String The input hexadecimal string.\r | |
836 | @param ConvertedStrLen The number of hexadecimal characters used to produce content in output\r | |
837 | buffer Buffer.\r | |
838 | \r | |
839 | @retval RETURN_BUFFER_TOO_SMALL The input BufferSizeInBytes is too small to hold the output. BufferSizeInBytes\r | |
840 | will be updated to the size required for the converstion.\r | |
841 | @retval RETURN_SUCCESS The convertion is successful or the first Unicode character from String\r | |
842 | is hexadecimal. If ConvertedStrLen is not NULL, it is updated\r | |
843 | to the number of hexadecimal character used for the converstion.\r | |
844 | **/\r | |
845 | RETURN_STATUS\r | |
846 | EFIAPI\r | |
847 | HexStringToBuf (\r | |
848 | OUT UINT8 *Buffer, \r | |
849 | IN OUT UINTN *BufferSizeInBytes,\r | |
850 | IN CONST CHAR16 *String,\r | |
851 | OUT UINTN *ConvertedStrLen OPTIONAL\r | |
852 | )\r | |
853 | ;\r | |
854 | \r | |
4c76e9cc | 855 | #endif\r |