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