]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Library/UefiLib.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Library / UefiLib.h
... / ...
CommitLineData
1/** @file\r
2 Provides library functions for common UEFI operations. Only available to DXE\r
3 and UEFI module types.\r
4\r
5 The UEFI Library provides functions and macros that simplify the development of\r
6 UEFI Drivers and UEFI Applications. These functions and macros help manage EFI\r
7 events, build simple locks utilizing EFI Task Priority Levels (TPLs), install\r
8 EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers,\r
9 and print messages on the console output and standard error devices.\r
10\r
11 Note that a reserved macro named MDEPKG_NDEBUG is introduced for the intention\r
12 of size reduction when compiler optimization is disabled. If MDEPKG_NDEBUG is\r
13 defined, then debug and assert related macros wrapped by it are the NULL implementations.\r
14\r
15Copyright (c) 2019, NVIDIA Corporation. All rights reserved.\r
16Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
17SPDX-License-Identifier: BSD-2-Clause-Patent\r
18\r
19**/\r
20\r
21#ifndef __UEFI_LIB_H__\r
22#define __UEFI_LIB_H__\r
23\r
24#include <IndustryStandard/Acpi.h>\r
25\r
26#include <Protocol/DriverBinding.h>\r
27#include <Protocol/DriverConfiguration.h>\r
28#include <Protocol/ComponentName.h>\r
29#include <Protocol/ComponentName2.h>\r
30#include <Protocol/DriverDiagnostics.h>\r
31#include <Protocol/DriverDiagnostics2.h>\r
32#include <Protocol/GraphicsOutput.h>\r
33#include <Protocol/DevicePath.h>\r
34#include <Protocol/SimpleFileSystem.h>\r
35\r
36#include <Library/BaseLib.h>\r
37\r
38///\r
39/// Unicode String Table\r
40///\r
41typedef struct {\r
42 CHAR8 *Language;\r
43 CHAR16 *UnicodeString;\r
44} EFI_UNICODE_STRING_TABLE;\r
45\r
46///\r
47/// EFI Lock Status\r
48///\r
49typedef enum {\r
50 EfiLockUninitialized = 0,\r
51 EfiLockReleased = 1,\r
52 EfiLockAcquired = 2\r
53} EFI_LOCK_STATE;\r
54\r
55///\r
56/// EFI Lock\r
57///\r
58typedef struct {\r
59 EFI_TPL Tpl;\r
60 EFI_TPL OwnerTpl;\r
61 EFI_LOCK_STATE Lock;\r
62} EFI_LOCK;\r
63\r
64/**\r
65 Macro that returns the number of 100 ns units for a specified number of microseconds.\r
66 This is useful for managing EFI timer events.\r
67\r
68 @param Microseconds The number of microseconds.\r
69\r
70 @return The number of 100 ns units equivalent to the number of microseconds specified\r
71 by Microseconds.\r
72\r
73**/\r
74#define EFI_TIMER_PERIOD_MICROSECONDS(Microseconds) MultU64x32((UINT64)(Microseconds), 10)\r
75\r
76/**\r
77 Macro that returns the number of 100 ns units for a specified number of milliseconds.\r
78 This is useful for managing EFI timer events.\r
79\r
80 @param Milliseconds The number of milliseconds.\r
81\r
82 @return The number of 100 ns units equivalent to the number of milliseconds specified\r
83 by Milliseconds.\r
84\r
85**/\r
86#define EFI_TIMER_PERIOD_MILLISECONDS(Milliseconds) MultU64x32((UINT64)(Milliseconds), 10000)\r
87\r
88/**\r
89 Macro that returns the number of 100 ns units for a specified number of seconds.\r
90 This is useful for managing EFI timer events.\r
91\r
92 @param Seconds The number of seconds.\r
93\r
94 @return The number of 100 ns units equivalent to the number of seconds specified\r
95 by Seconds.\r
96\r
97**/\r
98#define EFI_TIMER_PERIOD_SECONDS(Seconds) MultU64x32((UINT64)(Seconds), 10000000)\r
99\r
100/**\r
101 Macro that returns the a pointer to the next EFI_MEMORY_DESCRIPTOR in an array\r
102 returned from GetMemoryMap().\r
103\r
104 @param MemoryDescriptor A pointer to an EFI_MEMORY_DESCRIPTOR.\r
105\r
106 @param Size The size, in bytes, of the current EFI_MEMORY_DESCRIPTOR.\r
107\r
108 @return A pointer to the next EFI_MEMORY_DESCRIPTOR.\r
109\r
110**/\r
111#define NEXT_MEMORY_DESCRIPTOR(MemoryDescriptor, Size) \\r
112 ((EFI_MEMORY_DESCRIPTOR *)((UINT8 *)(MemoryDescriptor) + (Size)))\r
113\r
114/**\r
115 Retrieves a pointer to the system configuration table from the EFI System Table\r
116 based on a specified GUID.\r
117\r
118 This function searches the list of configuration tables stored in the EFI System Table\r
119 for a table with a GUID that matches TableGuid. If a match is found, then a pointer to\r
120 the configuration table is returned in Table, and EFI_SUCCESS is returned. If a matching GUID\r
121 is not found, then EFI_NOT_FOUND is returned.\r
122 If TableGuid is NULL, then ASSERT().\r
123 If Table is NULL, then ASSERT().\r
124\r
125 @param TableGuid The pointer to table's GUID type..\r
126 @param Table The pointer to the table associated with TableGuid in the EFI System Table.\r
127\r
128 @retval EFI_SUCCESS A configuration table matching TableGuid was found.\r
129 @retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found.\r
130\r
131**/\r
132EFI_STATUS\r
133EFIAPI\r
134EfiGetSystemConfigurationTable (\r
135 IN EFI_GUID *TableGuid,\r
136 OUT VOID **Table\r
137 );\r
138\r
139/**\r
140 Creates and returns a notification event and registers that event with all the protocol\r
141 instances specified by ProtocolGuid.\r
142\r
143 This function causes the notification function to be executed for every protocol of type\r
144 ProtocolGuid instance that exists in the system when this function is invoked. If there are\r
145 no instances of ProtocolGuid in the handle database at the time this function is invoked,\r
146 then the notification function is still executed one time. In addition, every time a protocol\r
147 of type ProtocolGuid instance is installed or reinstalled, the notification function is also\r
148 executed. This function returns the notification event that was created.\r
149 If ProtocolGuid is NULL, then ASSERT().\r
150 If NotifyTpl is not a legal TPL value, then ASSERT().\r
151 If NotifyFunction is NULL, then ASSERT().\r
152 If Registration is NULL, then ASSERT().\r
153\r
154\r
155 @param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired.\r
156 @param NotifyTpl Supplies the task priority level of the event notifications.\r
157 @param NotifyFunction Supplies the function to notify when the event is signaled.\r
158 @param NotifyContext The context parameter to pass to NotifyFunction.\r
159 @param Registration A pointer to a memory location to receive the registration value.\r
160 This value is passed to LocateHandle() to obtain new handles that\r
161 have been added that support the ProtocolGuid-specified protocol.\r
162\r
163 @return The notification event that was created.\r
164\r
165**/\r
166EFI_EVENT\r
167EFIAPI\r
168EfiCreateProtocolNotifyEvent(\r
169 IN EFI_GUID *ProtocolGuid,\r
170 IN EFI_TPL NotifyTpl,\r
171 IN EFI_EVENT_NOTIFY NotifyFunction,\r
172 IN VOID *NotifyContext, OPTIONAL\r
173 OUT VOID **Registration\r
174 );\r
175\r
176/**\r
177 Creates a named event that can be signaled with EfiNamedEventSignal().\r
178\r
179 This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.\r
180 This event is signaled with EfiNamedEventSignal(). This provides the ability for one or more\r
181 listeners on the same event named by the GUID specified by Name.\r
182 If Name is NULL, then ASSERT().\r
183 If NotifyTpl is not a legal TPL value, then ASSERT().\r
184 If NotifyFunction is NULL, then ASSERT().\r
185\r
186 @param Name Supplies GUID name of the event.\r
187 @param NotifyTpl Supplies the task priority level of the event notifications.\r
188 @param NotifyFunction Supplies the function to notify when the event is signaled.\r
189 @param NotifyContext The context parameter to pass to NotifyFunction.\r
190 @param Registration A pointer to a memory location to receive the registration value.\r
191\r
192 @retval EFI_SUCCESS A named event was created.\r
193 @retval EFI_OUT_OF_RESOURCES There are not enough resources to create the named event.\r
194\r
195**/\r
196EFI_STATUS\r
197EFIAPI\r
198EfiNamedEventListen (\r
199 IN CONST EFI_GUID *Name,\r
200 IN EFI_TPL NotifyTpl,\r
201 IN EFI_EVENT_NOTIFY NotifyFunction,\r
202 IN CONST VOID *NotifyContext, OPTIONAL\r
203 OUT VOID *Registration OPTIONAL\r
204 );\r
205\r
206/**\r
207 Signals a named event created with EfiNamedEventListen().\r
208\r
209 This function signals the named event specified by Name. The named event must have been\r
210 created with EfiNamedEventListen().\r
211 If Name is NULL, then ASSERT().\r
212\r
213 @param Name Supplies the GUID name of the event.\r
214\r
215 @retval EFI_SUCCESS A named event was signaled.\r
216 @retval EFI_OUT_OF_RESOURCES There are not enough resources to signal the named event.\r
217\r
218**/\r
219EFI_STATUS\r
220EFIAPI\r
221EfiNamedEventSignal (\r
222 IN CONST EFI_GUID *Name\r
223 );\r
224\r
225/**\r
226 Signals an event group by placing a new event in the group temporarily and\r
227 signaling it.\r
228\r
229 @param[in] EventGroup Supplies the unique identifier of the event\r
230 group to signal.\r
231\r
232 @retval EFI_SUCCESS The event group was signaled successfully.\r
233 @retval EFI_INVALID_PARAMETER EventGroup is NULL.\r
234 @return Error codes that report problems about event\r
235 creation or signaling.\r
236**/\r
237EFI_STATUS\r
238EFIAPI\r
239EfiEventGroupSignal (\r
240 IN CONST EFI_GUID *EventGroup\r
241 );\r
242\r
243/**\r
244 An empty function that can be used as NotifyFunction parameter of\r
245 CreateEvent() or CreateEventEx().\r
246\r
247 @param Event Event whose notification function is being invoked.\r
248 @param Context The pointer to the notification function's context,\r
249 which is implementation-dependent.\r
250\r
251**/\r
252VOID\r
253EFIAPI\r
254EfiEventEmptyFunction (\r
255 IN EFI_EVENT Event,\r
256 IN VOID *Context\r
257 );\r
258\r
259/**\r
260 Returns the current TPL.\r
261\r
262 This function returns the current TPL. There is no EFI service to directly\r
263 retrieve the current TPL. Instead, the RaiseTPL() function is used to raise\r
264 the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level\r
265 can then immediately be restored back to the current TPL level with a call\r
266 to RestoreTPL().\r
267\r
268 @return The current TPL.\r
269\r
270**/\r
271EFI_TPL\r
272EFIAPI\r
273EfiGetCurrentTpl (\r
274 VOID\r
275 );\r
276\r
277/**\r
278 Initializes a basic mutual exclusion lock.\r
279\r
280 This function initializes a basic mutual exclusion lock to the released state\r
281 and returns the lock. Each lock provides mutual exclusion access at its task\r
282 priority level. Since there is no preemption or multiprocessor support in EFI,\r
283 acquiring the lock only consists of raising to the locks TPL.\r
284 If Lock is NULL, then ASSERT().\r
285 If Priority is not a valid TPL value, then ASSERT().\r
286\r
287 @param Lock A pointer to the lock data structure to initialize.\r
288 @param Priority The EFI TPL associated with the lock.\r
289\r
290 @return The lock.\r
291\r
292**/\r
293EFI_LOCK *\r
294EFIAPI\r
295EfiInitializeLock (\r
296 IN OUT EFI_LOCK *Lock,\r
297 IN EFI_TPL Priority\r
298 );\r
299\r
300/**\r
301 Initializes a basic mutual exclusion lock.\r
302\r
303 This macro initializes the contents of a basic mutual exclusion lock to the\r
304 released state. Each lock provides mutual exclusion access at its task\r
305 priority level. Since there is no preemption or multiprocessor support in EFI,\r
306 acquiring the lock only consists of raising to the locks TPL.\r
307\r
308 @param Priority The task priority level of the lock.\r
309\r
310 @return The lock.\r
311\r
312**/\r
313#define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \\r
314 {Priority, TPL_APPLICATION, EfiLockReleased }\r
315\r
316\r
317/**\r
318 Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.\r
319\r
320 If MDEPKG_NDEBUG is not defined and the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED\r
321 bit of PcdDebugProperyMask is set, then this macro evaluates the EFI_LOCK\r
322 structure specified by Lock. If Lock is not in the locked state, then\r
323 DebugAssert() is called passing in the source filename, source line number,\r
324 and Lock.\r
325\r
326 If Lock is NULL, then ASSERT().\r
327\r
328 @param LockParameter A pointer to the lock to acquire.\r
329\r
330**/\r
331#if !defined(MDEPKG_NDEBUG)\r
332 #define ASSERT_LOCKED(LockParameter) \\r
333 do { \\r
334 if (DebugAssertEnabled ()) { \\r
335 ASSERT (LockParameter != NULL); \\r
336 if ((LockParameter)->Lock != EfiLockAcquired) { \\r
337 _ASSERT (LockParameter not locked); \\r
338 } \\r
339 } \\r
340 } while (FALSE)\r
341#else\r
342 #define ASSERT_LOCKED(LockParameter)\r
343#endif\r
344\r
345\r
346/**\r
347 Acquires ownership of a lock.\r
348\r
349 This function raises the system's current task priority level to the task\r
350 priority level of the mutual exclusion lock. Then, it places the lock in the\r
351 acquired state.\r
352 If Lock is NULL, then ASSERT().\r
353 If Lock is not initialized, then ASSERT().\r
354 If Lock is already in the acquired state, then ASSERT().\r
355\r
356 @param Lock A pointer to the lock to acquire.\r
357\r
358**/\r
359VOID\r
360EFIAPI\r
361EfiAcquireLock (\r
362 IN EFI_LOCK *Lock\r
363 );\r
364\r
365/**\r
366 Acquires ownership of a lock.\r
367\r
368 This function raises the system's current task priority level to the task priority\r
369 level of the mutual exclusion lock. Then, it attempts to place the lock in the acquired state.\r
370 If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned.\r
371 Otherwise, EFI_SUCCESS is returned.\r
372 If Lock is NULL, then ASSERT().\r
373 If Lock is not initialized, then ASSERT().\r
374\r
375 @param Lock A pointer to the lock to acquire.\r
376\r
377 @retval EFI_SUCCESS The lock was acquired.\r
378 @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.\r
379\r
380**/\r
381EFI_STATUS\r
382EFIAPI\r
383EfiAcquireLockOrFail (\r
384 IN EFI_LOCK *Lock\r
385 );\r
386\r
387/**\r
388 Releases ownership of a lock.\r
389\r
390 This function transitions a mutual exclusion lock from the acquired state to\r
391 the released state, and restores the system's task priority level to its\r
392 previous level.\r
393 If Lock is NULL, then ASSERT().\r
394 If Lock is not initialized, then ASSERT().\r
395 If Lock is already in the released state, then ASSERT().\r
396\r
397 @param Lock A pointer to the lock to release.\r
398\r
399**/\r
400VOID\r
401EFIAPI\r
402EfiReleaseLock (\r
403 IN EFI_LOCK *Lock\r
404 );\r
405\r
406/**\r
407 Tests whether a controller handle is being managed by a specific driver.\r
408\r
409 This function tests whether the driver specified by DriverBindingHandle is\r
410 currently managing the controller specified by ControllerHandle. This test\r
411 is performed by evaluating if the the protocol specified by ProtocolGuid is\r
412 present on ControllerHandle and is was opened by DriverBindingHandle with an\r
413 attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.\r
414 If ProtocolGuid is NULL, then ASSERT().\r
415\r
416 @param ControllerHandle A handle for a controller to test.\r
417 @param DriverBindingHandle Specifies the driver binding handle for the\r
418 driver.\r
419 @param ProtocolGuid Specifies the protocol that the driver specified\r
420 by DriverBindingHandle opens in its Start()\r
421 function.\r
422\r
423 @retval EFI_SUCCESS ControllerHandle is managed by the driver\r
424 specified by DriverBindingHandle.\r
425 @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver\r
426 specified by DriverBindingHandle.\r
427\r
428**/\r
429EFI_STATUS\r
430EFIAPI\r
431EfiTestManagedDevice (\r
432 IN CONST EFI_HANDLE ControllerHandle,\r
433 IN CONST EFI_HANDLE DriverBindingHandle,\r
434 IN CONST EFI_GUID *ProtocolGuid\r
435 );\r
436\r
437/**\r
438 Tests whether a child handle is a child device of the controller.\r
439\r
440 This function tests whether ChildHandle is one of the children of\r
441 ControllerHandle. This test is performed by checking to see if the protocol\r
442 specified by ProtocolGuid is present on ControllerHandle and opened by\r
443 ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
444 If ProtocolGuid is NULL, then ASSERT().\r
445\r
446 @param ControllerHandle A handle for a (parent) controller to test.\r
447 @param ChildHandle A child handle to test.\r
448 @param ProtocolGuid Supplies the protocol that the child controller\r
449 opens on its parent controller.\r
450\r
451 @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.\r
452 @retval EFI_UNSUPPORTED ChildHandle is not a child of the\r
453 ControllerHandle.\r
454\r
455**/\r
456EFI_STATUS\r
457EFIAPI\r
458EfiTestChildHandle (\r
459 IN CONST EFI_HANDLE ControllerHandle,\r
460 IN CONST EFI_HANDLE ChildHandle,\r
461 IN CONST EFI_GUID *ProtocolGuid\r
462 );\r
463\r
464/**\r
465 This function looks up a Unicode string in UnicodeStringTable.\r
466\r
467 If Language is a member of SupportedLanguages and a Unicode string is found in\r
468 UnicodeStringTable that matches the language code specified by Language, then it\r
469 is returned in UnicodeString.\r
470\r
471 @param Language A pointer to the ISO 639-2 language code for the\r
472 Unicode string to look up and return.\r
473 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes\r
474 that the Unicode string table supports. Language\r
475 must be a member of this set.\r
476 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
477 @param UnicodeString A pointer to the Unicode string from UnicodeStringTable\r
478 that matches the language specified by Language.\r
479\r
480 @retval EFI_SUCCESS The Unicode string that matches the language\r
481 specified by Language was found\r
482 in the table of Unicode strings UnicodeStringTable,\r
483 and it was returned in UnicodeString.\r
484 @retval EFI_INVALID_PARAMETER Language is NULL.\r
485 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r
486 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r
487 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.\r
488 @retval EFI_UNSUPPORTED The language specified by Language is not a\r
489 member of SupportedLanguages.\r
490 @retval EFI_UNSUPPORTED The language specified by Language is not\r
491 supported by UnicodeStringTable.\r
492\r
493**/\r
494EFI_STATUS\r
495EFIAPI\r
496LookupUnicodeString (\r
497 IN CONST CHAR8 *Language,\r
498 IN CONST CHAR8 *SupportedLanguages,\r
499 IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,\r
500 OUT CHAR16 **UnicodeString\r
501 );\r
502\r
503/**\r
504 This function looks up a Unicode string in UnicodeStringTable.\r
505\r
506 If Language is a member of SupportedLanguages and a Unicode string is found in\r
507 UnicodeStringTable that matches the language code specified by Language, then\r
508 it is returned in UnicodeString.\r
509\r
510 @param Language A pointer to an ASCII string containing the ISO 639-2 or the\r
511 RFC 4646 language code for the Unicode string to look up and\r
512 return. If Iso639Language is TRUE, then this ASCII string is\r
513 not assumed to be Null-terminated, and only the first three\r
514 characters are used. If Iso639Language is FALSE, then this ASCII\r
515 string must be Null-terminated.\r
516 @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains a\r
517 set of ISO 639-2 or RFC 4646 language codes that the Unicode\r
518 string table supports. Language must be a member of this set.\r
519 If Iso639Language is TRUE, then this string contains one or more\r
520 ISO 639-2 language codes with no separator characters. If Iso639Language\r
521 is FALSE, then is string contains one or more RFC 4646 language\r
522 codes separated by ';'.\r
523 @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE\r
524 is defined in "Related Definitions".\r
525 @param UnicodeString A pointer to the Null-terminated Unicode string from UnicodeStringTable\r
526 that matches the language specified by Language.\r
527 @param Iso639Language Specifies the supported language code format. If it is TRUE, then\r
528 Language and SupportedLanguages follow ISO 639-2 language code format.\r
529 Otherwise, they follow the RFC 4646 language code format.\r
530\r
531\r
532 @retval EFI_SUCCESS The Unicode string that matches the language specified by Language\r
533 was found in the table of Unicode strings UnicodeStringTable, and\r
534 it was returned in UnicodeString.\r
535 @retval EFI_INVALID_PARAMETER Language is NULL.\r
536 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r
537 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r
538 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.\r
539 @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.\r
540 @retval EFI_UNSUPPORTED The language specified by Language is not supported by UnicodeStringTable.\r
541\r
542**/\r
543EFI_STATUS\r
544EFIAPI\r
545LookupUnicodeString2 (\r
546 IN CONST CHAR8 *Language,\r
547 IN CONST CHAR8 *SupportedLanguages,\r
548 IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,\r
549 OUT CHAR16 **UnicodeString,\r
550 IN BOOLEAN Iso639Language\r
551 );\r
552\r
553/**\r
554 This function adds a Unicode string to UnicodeStringTable.\r
555\r
556 If Language is a member of SupportedLanguages then UnicodeString is added to\r
557 UnicodeStringTable. New buffers are allocated for both Language and\r
558 UnicodeString. The contents of Language and UnicodeString are copied into\r
559 these new buffers. These buffers are automatically freed when\r
560 FreeUnicodeStringTable() is called.\r
561\r
562 @param Language A pointer to the ISO 639-2 language code for the Unicode\r
563 string to add.\r
564 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes\r
565 that the Unicode string table supports.\r
566 Language must be a member of this set.\r
567 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
568 @param UnicodeString A pointer to the Unicode string to add.\r
569\r
570 @retval EFI_SUCCESS The Unicode string that matches the language\r
571 specified by Language was found in the table of\r
572 Unicode strings UnicodeStringTable, and it was\r
573 returned in UnicodeString.\r
574 @retval EFI_INVALID_PARAMETER Language is NULL.\r
575 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r
576 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.\r
577 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r
578 @retval EFI_ALREADY_STARTED A Unicode string with language Language is\r
579 already present in UnicodeStringTable.\r
580 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another\r
581 Unicode string to UnicodeStringTable.\r
582 @retval EFI_UNSUPPORTED The language specified by Language is not a\r
583 member of SupportedLanguages.\r
584\r
585**/\r
586EFI_STATUS\r
587EFIAPI\r
588AddUnicodeString (\r
589 IN CONST CHAR8 *Language,\r
590 IN CONST CHAR8 *SupportedLanguages,\r
591 IN OUT EFI_UNICODE_STRING_TABLE **UnicodeStringTable,\r
592 IN CONST CHAR16 *UnicodeString\r
593 );\r
594\r
595/**\r
596 This function adds the Null-terminated Unicode string specified by UnicodeString\r
597 to UnicodeStringTable.\r
598\r
599 If Language is a member of SupportedLanguages then UnicodeString is added to\r
600 UnicodeStringTable. New buffers are allocated for both Language and UnicodeString.\r
601 The contents of Language and UnicodeString are copied into these new buffers.\r
602 These buffers are automatically freed when EfiLibFreeUnicodeStringTable() is called.\r
603\r
604 @param Language A pointer to an ASCII string containing the ISO 639-2 or\r
605 the RFC 4646 language code for the Unicode string to add.\r
606 If Iso639Language is TRUE, then this ASCII string is not\r
607 assumed to be Null-terminated, and only the first three\r
608 chacters are used. If Iso639Language is FALSE, then this\r
609 ASCII string must be Null-terminated.\r
610 @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains\r
611 a set of ISO 639-2 or RFC 4646 language codes that the Unicode\r
612 string table supports. Language must be a member of this set.\r
613 If Iso639Language is TRUE, then this string contains one or more\r
614 ISO 639-2 language codes with no separator characters.\r
615 If Iso639Language is FALSE, then is string contains one or more\r
616 RFC 4646 language codes separated by ';'.\r
617 @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE\r
618 is defined in "Related Definitions".\r
619 @param UnicodeString A pointer to the Unicode string to add.\r
620 @param Iso639Language Specifies the supported language code format. If it is TRUE,\r
621 then Language and SupportedLanguages follow ISO 639-2 language code format.\r
622 Otherwise, they follow RFC 4646 language code format.\r
623\r
624 @retval EFI_SUCCESS The Unicode string that matches the language specified by\r
625 Language was found in the table of Unicode strings UnicodeStringTable,\r
626 and it was returned in UnicodeString.\r
627 @retval EFI_INVALID_PARAMETER Language is NULL.\r
628 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r
629 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.\r
630 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r
631 @retval EFI_ALREADY_STARTED A Unicode string with language Language is already present in\r
632 UnicodeStringTable.\r
633 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another Unicode string UnicodeStringTable.\r
634 @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.\r
635\r
636**/\r
637EFI_STATUS\r
638EFIAPI\r
639AddUnicodeString2 (\r
640 IN CONST CHAR8 *Language,\r
641 IN CONST CHAR8 *SupportedLanguages,\r
642 IN OUT EFI_UNICODE_STRING_TABLE **UnicodeStringTable,\r
643 IN CONST CHAR16 *UnicodeString,\r
644 IN BOOLEAN Iso639Language\r
645 );\r
646\r
647/**\r
648 This function frees the table of Unicode strings in UnicodeStringTable.\r
649\r
650 If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.\r
651 Otherwise, each language code, and each Unicode string in the Unicode string\r
652 table are freed, and EFI_SUCCESS is returned.\r
653\r
654 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
655\r
656 @retval EFI_SUCCESS The Unicode string table was freed.\r
657\r
658**/\r
659EFI_STATUS\r
660EFIAPI\r
661FreeUnicodeStringTable (\r
662 IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable\r
663 );\r
664\r
665#ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r
666\r
667/**\r
668 [ATTENTION] This function will be deprecated for security reason.\r
669\r
670 Returns a pointer to an allocated buffer that contains the contents of a\r
671 variable retrieved through the UEFI Runtime Service GetVariable(). The\r
672 returned buffer is allocated using AllocatePool(). The caller is responsible\r
673 for freeing this buffer with FreePool().\r
674\r
675 If Name is NULL, then ASSERT().\r
676 If Guid is NULL, then ASSERT().\r
677\r
678 @param[in] Name The pointer to a Null-terminated Unicode string.\r
679 @param[in] Guid The pointer to an EFI_GUID structure.\r
680\r
681 @retval NULL The variable could not be retrieved.\r
682 @retval NULL There are not enough resources available for the variable contents.\r
683 @retval Other A pointer to allocated buffer containing the variable contents.\r
684\r
685**/\r
686VOID *\r
687EFIAPI\r
688GetVariable (\r
689 IN CONST CHAR16 *Name,\r
690 IN CONST EFI_GUID *Guid\r
691 );\r
692\r
693/**\r
694 [ATTENTION] This function will be deprecated for security reason.\r
695\r
696 Returns a pointer to an allocated buffer that contains the contents of a\r
697 variable retrieved through the UEFI Runtime Service GetVariable(). This\r
698 function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables.\r
699 The returned buffer is allocated using AllocatePool(). The caller is\r
700 responsible for freeing this buffer with FreePool().\r
701\r
702 If Name is NULL, then ASSERT().\r
703\r
704 @param[in] Name The pointer to a Null-terminated Unicode string.\r
705\r
706 @retval NULL The variable could not be retrieved.\r
707 @retval NULL There are not enough resources available for the variable contents.\r
708 @retval Other A pointer to allocated buffer containing the variable contents.\r
709\r
710**/\r
711VOID *\r
712EFIAPI\r
713GetEfiGlobalVariable (\r
714 IN CONST CHAR16 *Name\r
715 );\r
716#endif\r
717\r
718\r
719/**\r
720 Returns the status whether get the variable success. The function retrieves\r
721 variable through the UEFI Runtime Service GetVariable(). The\r
722 returned buffer is allocated using AllocatePool(). The caller is responsible\r
723 for freeing this buffer with FreePool().\r
724\r
725 If Name is NULL, then ASSERT().\r
726 If Guid is NULL, then ASSERT().\r
727 If Value is NULL, then ASSERT().\r
728\r
729 @param[in] Name The pointer to a Null-terminated Unicode string.\r
730 @param[in] Guid The pointer to an EFI_GUID structure\r
731 @param[out] Value The buffer point saved the variable info.\r
732 @param[out] Size The buffer size of the variable.\r
733\r
734 @retval EFI_OUT_OF_RESOURCES Allocate buffer failed.\r
735 @retval EFI_SUCCESS Find the specified variable.\r
736 @retval Others Errors Return errors from call to gRT->GetVariable.\r
737\r
738**/\r
739EFI_STATUS\r
740EFIAPI\r
741GetVariable2 (\r
742 IN CONST CHAR16 *Name,\r
743 IN CONST EFI_GUID *Guid,\r
744 OUT VOID **Value,\r
745 OUT UINTN *Size OPTIONAL\r
746 );\r
747\r
748/**\r
749 Returns a pointer to an allocated buffer that contains the contents of a\r
750 variable retrieved through the UEFI Runtime Service GetVariable(). This\r
751 function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables.\r
752 The returned buffer is allocated using AllocatePool(). The caller is\r
753 responsible for freeing this buffer with FreePool().\r
754\r
755 If Name is NULL, then ASSERT().\r
756 If Value is NULL, then ASSERT().\r
757\r
758 @param[in] Name The pointer to a Null-terminated Unicode string.\r
759 @param[out] Value The buffer point saved the variable info.\r
760 @param[out] Size The buffer size of the variable.\r
761\r
762 @retval EFI_OUT_OF_RESOURCES Allocate buffer failed.\r
763 @retval EFI_SUCCESS Find the specified variable.\r
764 @retval Others Errors Return errors from call to gRT->GetVariable.\r
765\r
766**/\r
767EFI_STATUS\r
768EFIAPI\r
769GetEfiGlobalVariable2 (\r
770 IN CONST CHAR16 *Name,\r
771 OUT VOID **Value,\r
772 OUT UINTN *Size OPTIONAL\r
773 );\r
774\r
775/** Return the attributes of the variable.\r
776\r
777 Returns the status whether get the variable success. The function retrieves\r
778 variable through the UEFI Runtime Service GetVariable(). The\r
779 returned buffer is allocated using AllocatePool(). The caller is responsible\r
780 for freeing this buffer with FreePool(). The attributes are returned if\r
781 the caller provides a valid Attribute parameter.\r
782\r
783 If Name is NULL, then ASSERT().\r
784 If Guid is NULL, then ASSERT().\r
785 If Value is NULL, then ASSERT().\r
786\r
787 @param[in] Name The pointer to a Null-terminated Unicode string.\r
788 @param[in] Guid The pointer to an EFI_GUID structure\r
789 @param[out] Value The buffer point saved the variable info.\r
790 @param[out] Size The buffer size of the variable.\r
791 @param[out] Attr The pointer to the variable attributes as found in var store\r
792\r
793 @retval EFI_OUT_OF_RESOURCES Allocate buffer failed.\r
794 @retval EFI_SUCCESS Find the specified variable.\r
795 @retval Others Errors Return errors from call to gRT->GetVariable.\r
796\r
797**/\r
798EFI_STATUS\r
799EFIAPI\r
800GetVariable3(\r
801 IN CONST CHAR16 *Name,\r
802 IN CONST EFI_GUID *Guid,\r
803 OUT VOID **Value,\r
804 OUT UINTN *Size OPTIONAL,\r
805 OUT UINT32 *Attr OPTIONAL\r
806 );\r
807\r
808/**\r
809 Returns a pointer to an allocated buffer that contains the best matching language\r
810 from a set of supported languages.\r
811\r
812 This function supports both ISO 639-2 and RFC 4646 language codes, but language\r
813 code types may not be mixed in a single call to this function. The language\r
814 code returned is allocated using AllocatePool(). The caller is responsible for\r
815 freeing the allocated buffer using FreePool(). This function supports a variable\r
816 argument list that allows the caller to pass in a prioritized list of language\r
817 codes to test against all the language codes in SupportedLanguages.\r
818\r
819 If SupportedLanguages is NULL, then ASSERT().\r
820\r
821 @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that\r
822 contains a set of language codes in the format\r
823 specified by Iso639Language.\r
824 @param[in] Iso639Language If not zero, then all language codes are assumed to be\r
825 in ISO 639-2 format. If zero, then all language\r
826 codes are assumed to be in RFC 4646 language format\r
827 @param[in] ... A variable argument list that contains pointers to\r
828 Null-terminated ASCII strings that contain one or more\r
829 language codes in the format specified by Iso639Language.\r
830 The first language code from each of these language\r
831 code lists is used to determine if it is an exact or\r
832 close match to any of the language codes in\r
833 SupportedLanguages. Close matches only apply to RFC 4646\r
834 language codes, and the matching algorithm from RFC 4647\r
835 is used to determine if a close match is present. If\r
836 an exact or close match is found, then the matching\r
837 language code from SupportedLanguages is returned. If\r
838 no matches are found, then the next variable argument\r
839 parameter is evaluated. The variable argument list\r
840 is terminated by a NULL.\r
841\r
842 @retval NULL The best matching language could not be found in SupportedLanguages.\r
843 @retval NULL There are not enough resources available to return the best matching\r
844 language.\r
845 @retval Other A pointer to a Null-terminated ASCII string that is the best matching\r
846 language in SupportedLanguages.\r
847\r
848**/\r
849CHAR8 *\r
850EFIAPI\r
851GetBestLanguage (\r
852 IN CONST CHAR8 *SupportedLanguages,\r
853 IN UINTN Iso639Language,\r
854 ...\r
855 );\r
856\r
857/**\r
858 Draws a dialog box to the console output device specified by\r
859 ConOut defined in the EFI_SYSTEM_TABLE and waits for a keystroke\r
860 from the console input device specified by ConIn defined in the\r
861 EFI_SYSTEM_TABLE.\r
862\r
863 If there are no strings in the variable argument list, then ASSERT().\r
864 If all the strings in the variable argument list are empty, then ASSERT().\r
865\r
866 @param[in] Attribute Specifies the foreground and background color of the popup.\r
867 @param[out] Key A pointer to the EFI_KEY value of the key that was\r
868 pressed. This is an optional parameter that may be NULL.\r
869 If it is NULL then no wait for a keypress will be performed.\r
870 @param[in] ... The variable argument list that contains pointers to Null-\r
871 terminated Unicode strings to display in the dialog box.\r
872 The variable argument list is terminated by a NULL.\r
873\r
874**/\r
875VOID\r
876EFIAPI\r
877CreatePopUp (\r
878 IN UINTN Attribute,\r
879 OUT EFI_INPUT_KEY *Key, OPTIONAL\r
880 ...\r
881 );\r
882\r
883/**\r
884 Retrieves the width of a Unicode character.\r
885\r
886 This function computes and returns the width of the Unicode character specified\r
887 by UnicodeChar.\r
888\r
889 @param UnicodeChar A Unicode character.\r
890\r
891 @retval 0 The width if UnicodeChar could not be determined.\r
892 @retval 1 UnicodeChar is a narrow glyph.\r
893 @retval 2 UnicodeChar is a wide glyph.\r
894\r
895**/\r
896UINTN\r
897EFIAPI\r
898GetGlyphWidth (\r
899 IN CHAR16 UnicodeChar\r
900 );\r
901\r
902/**\r
903 Computes the display length of a Null-terminated Unicode String.\r
904\r
905 This function computes and returns the display length of the Null-terminated Unicode\r
906 string specified by String. If String is NULL then 0 is returned. If any of the widths\r
907 of the Unicode characters in String can not be determined, then 0 is returned. The display\r
908 width of String can be computed by summing the display widths of each Unicode character\r
909 in String. Unicode characters that are narrow glyphs have a width of 1, and Unicode\r
910 characters that are width glyphs have a width of 2.\r
911 If String is not aligned on a 16-bit boundary, then ASSERT().\r
912\r
913 @param String A pointer to a Null-terminated Unicode string.\r
914\r
915 @return The display length of the Null-terminated Unicode string specified by String.\r
916\r
917**/\r
918UINTN\r
919EFIAPI\r
920UnicodeStringDisplayLength (\r
921 IN CONST CHAR16 *String\r
922 );\r
923\r
924//\r
925// Functions that abstract early Framework contamination of UEFI.\r
926//\r
927/**\r
928 Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot().\r
929\r
930 This function abstracts the signaling of the Ready to Boot Event. The Framework moved\r
931 from a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller\r
932 from how this event is created to prevent to code form having to change with the\r
933 version of the specification supported.\r
934\r
935**/\r
936VOID\r
937EFIAPI\r
938EfiSignalEventReadyToBoot (\r
939 VOID\r
940 );\r
941\r
942/**\r
943 Create, Signal, and Close the Ready to Boot event using EfiSignalEventLegacyBoot().\r
944\r
945 This function abstracts the signaling of the Legacy Boot Event. The Framework moved from\r
946 a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller from how\r
947 this event is created to prevent to code form having to change with the version of the\r
948 specification supported.\r
949\r
950**/\r
951VOID\r
952EFIAPI\r
953EfiSignalEventLegacyBoot (\r
954 VOID\r
955 );\r
956\r
957/**\r
958 Creates an EFI event in the Legacy Boot Event Group.\r
959\r
960 Prior to UEFI 2.0 this was done via a non blessed UEFI extensions and this library\r
961 abstracts the implementation mechanism of this event from the caller. This function\r
962 abstracts the creation of the Legacy Boot Event. The Framework moved from a proprietary\r
963 to UEFI 2.0 based mechanism. This library abstracts the caller from how this event\r
964 is created to prevent to code form having to change with the version of the\r
965 specification supported.\r
966 If LegacyBootEvent is NULL, then ASSERT().\r
967\r
968 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
969\r
970 @retval EFI_SUCCESS The event was created.\r
971 @retval Other The event was not created.\r
972\r
973**/\r
974EFI_STATUS\r
975EFIAPI\r
976EfiCreateEventLegacyBoot (\r
977 OUT EFI_EVENT *LegacyBootEvent\r
978 );\r
979\r
980/**\r
981 Create an EFI event in the Legacy Boot Event Group and allows\r
982 the caller to specify a notification function.\r
983\r
984 This function abstracts the creation of the Legacy Boot Event.\r
985 The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r
986 This library abstracts the caller from how this event is created to prevent\r
987 to code form having to change with the version of the specification supported.\r
988 If LegacyBootEvent is NULL, then ASSERT().\r
989\r
990 @param NotifyTpl The task priority level of the event.\r
991 @param NotifyFunction The notification function to call when the event is signaled.\r
992 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r
993 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
994\r
995 @retval EFI_SUCCESS The event was created.\r
996 @retval Other The event was not created.\r
997\r
998**/\r
999EFI_STATUS\r
1000EFIAPI\r
1001EfiCreateEventLegacyBootEx (\r
1002 IN EFI_TPL NotifyTpl,\r
1003 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
1004 IN VOID *NotifyContext, OPTIONAL\r
1005 OUT EFI_EVENT *LegacyBootEvent\r
1006 );\r
1007\r
1008/**\r
1009 Create an EFI event in the Ready To Boot Event Group.\r
1010\r
1011 Prior to UEFI 2.0 this was done via a non-standard UEFI extension, and this library\r
1012 abstracts the implementation mechanism of this event from the caller.\r
1013 This function abstracts the creation of the Ready to Boot Event. The Framework\r
1014 moved from a proprietary to UEFI 2.0-based mechanism. This library abstracts\r
1015 the caller from how this event is created to prevent the code form having to\r
1016 change with the version of the specification supported.\r
1017 If ReadyToBootEvent is NULL, then ASSERT().\r
1018\r
1019 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
1020\r
1021 @retval EFI_SUCCESS The event was created.\r
1022 @retval Other The event was not created.\r
1023\r
1024**/\r
1025EFI_STATUS\r
1026EFIAPI\r
1027EfiCreateEventReadyToBoot (\r
1028 OUT EFI_EVENT *ReadyToBootEvent\r
1029 );\r
1030\r
1031/**\r
1032 Create an EFI event in the Ready To Boot Event Group and allows\r
1033 the caller to specify a notification function.\r
1034\r
1035 This function abstracts the creation of the Ready to Boot Event.\r
1036 The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r
1037 This library abstracts the caller from how this event is created to prevent\r
1038 to code form having to change with the version of the specification supported.\r
1039 If ReadyToBootEvent is NULL, then ASSERT().\r
1040\r
1041 @param NotifyTpl The task priority level of the event.\r
1042 @param NotifyFunction The notification function to call when the event is signaled.\r
1043 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r
1044 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
1045\r
1046 @retval EFI_SUCCESS The event was created.\r
1047 @retval Other The event was not created.\r
1048\r
1049**/\r
1050EFI_STATUS\r
1051EFIAPI\r
1052EfiCreateEventReadyToBootEx (\r
1053 IN EFI_TPL NotifyTpl,\r
1054 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
1055 IN VOID *NotifyContext, OPTIONAL\r
1056 OUT EFI_EVENT *ReadyToBootEvent\r
1057 );\r
1058\r
1059/**\r
1060 Initialize a Firmware Volume (FV) Media Device Path node.\r
1061\r
1062 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.\r
1063 This library function abstracts initializing a device path node.\r
1064 Initialize the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure. This device\r
1065 path changed in the DXE CIS version 0.92 in a non back ward compatible way to\r
1066 not conflict with the UEFI 2.0 specification. This function abstracts the\r
1067 differences from the caller.\r
1068 If FvDevicePathNode is NULL, then ASSERT().\r
1069 If NameGuid is NULL, then ASSERT().\r
1070\r
1071 @param FvDevicePathNode The pointer to a FV device path node to initialize\r
1072 @param NameGuid FV file name to use in FvDevicePathNode\r
1073\r
1074**/\r
1075VOID\r
1076EFIAPI\r
1077EfiInitializeFwVolDevicepathNode (\r
1078 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,\r
1079 IN CONST EFI_GUID *NameGuid\r
1080 );\r
1081\r
1082/**\r
1083 Check to see if the Firmware Volume (FV) Media Device Path is valid\r
1084\r
1085 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.\r
1086 This library function abstracts validating a device path node.\r
1087 Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid.\r
1088 If it is valid, then return the GUID file name from the device path node. Otherwise,\r
1089 return NULL. This device path changed in the DXE CIS version 0.92 in a non backward\r
1090 compatible way to not conflict with the UEFI 2.0 specification. This function abstracts\r
1091 the differences from the caller.\r
1092 If FvDevicePathNode is NULL, then ASSERT().\r
1093\r
1094 @param FvDevicePathNode The pointer to FV device path to check.\r
1095\r
1096 @retval NULL FvDevicePathNode is not valid.\r
1097 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.\r
1098\r
1099**/\r
1100EFI_GUID *\r
1101EFIAPI\r
1102EfiGetNameGuidFromFwVolDevicePathNode (\r
1103 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode\r
1104 );\r
1105\r
1106/**\r
1107 Prints a formatted Unicode string to the console output device specified by\r
1108 ConOut defined in the EFI_SYSTEM_TABLE.\r
1109\r
1110 This function prints a formatted Unicode string to the console output device\r
1111 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode\r
1112 characters that printed to ConOut. If the length of the formatted Unicode\r
1113 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first\r
1114 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
1115 If Format is NULL, then ASSERT().\r
1116 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
1117 If gST->ConOut is NULL, then ASSERT().\r
1118\r
1119 @param Format A null-terminated Unicode format string.\r
1120 @param ... The variable argument list whose contents are accessed based\r
1121 on the format string specified by Format.\r
1122\r
1123 @return Number of Unicode characters printed to ConOut.\r
1124\r
1125**/\r
1126UINTN\r
1127EFIAPI\r
1128Print (\r
1129 IN CONST CHAR16 *Format,\r
1130 ...\r
1131 );\r
1132\r
1133/**\r
1134 Prints a formatted Unicode string to the console output device specified by\r
1135 StdErr defined in the EFI_SYSTEM_TABLE.\r
1136\r
1137 This function prints a formatted Unicode string to the console output device\r
1138 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode\r
1139 characters that printed to StdErr. If the length of the formatted Unicode\r
1140 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first\r
1141 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
1142 If Format is NULL, then ASSERT().\r
1143 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
1144 If gST->StdErr is NULL, then ASSERT().\r
1145\r
1146 @param Format A null-terminated Unicode format string.\r
1147 @param ... The variable argument list whose contents are accessed based\r
1148 on the format string specified by Format.\r
1149\r
1150 @return Number of Unicode characters printed to StdErr.\r
1151\r
1152**/\r
1153UINTN\r
1154EFIAPI\r
1155ErrorPrint (\r
1156 IN CONST CHAR16 *Format,\r
1157 ...\r
1158 );\r
1159\r
1160/**\r
1161 Prints a formatted ASCII string to the console output device specified by\r
1162 ConOut defined in the EFI_SYSTEM_TABLE.\r
1163\r
1164 This function prints a formatted ASCII string to the console output device\r
1165 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII\r
1166 characters that printed to ConOut. If the length of the formatted ASCII\r
1167 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first\r
1168 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
1169 If Format is NULL, then ASSERT().\r
1170 If gST->ConOut is NULL, then ASSERT().\r
1171\r
1172 @param Format A null-terminated ASCII format string.\r
1173 @param ... The variable argument list whose contents are accessed based\r
1174 on the format string specified by Format.\r
1175\r
1176 @return Number of ASCII characters printed to ConOut.\r
1177\r
1178**/\r
1179UINTN\r
1180EFIAPI\r
1181AsciiPrint (\r
1182 IN CONST CHAR8 *Format,\r
1183 ...\r
1184 );\r
1185\r
1186/**\r
1187 Prints a formatted ASCII string to the console output device specified by\r
1188 StdErr defined in the EFI_SYSTEM_TABLE.\r
1189\r
1190 This function prints a formatted ASCII string to the console output device\r
1191 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII\r
1192 characters that printed to StdErr. If the length of the formatted ASCII\r
1193 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first\r
1194 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
1195 If Format is NULL, then ASSERT().\r
1196 If gST->StdErr is NULL, then ASSERT().\r
1197\r
1198 @param Format A null-terminated ASCII format string.\r
1199 @param ... The variable argument list whose contents are accessed based\r
1200 on the format string specified by Format.\r
1201\r
1202 @return Number of ASCII characters printed to ConErr.\r
1203\r
1204**/\r
1205UINTN\r
1206EFIAPI\r
1207AsciiErrorPrint (\r
1208 IN CONST CHAR8 *Format,\r
1209 ...\r
1210 );\r
1211\r
1212\r
1213/**\r
1214 Prints a formatted Unicode string to a graphics console device specified by\r
1215 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.\r
1216\r
1217 This function prints a formatted Unicode string to the graphics console device\r
1218 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of\r
1219 Unicode characters displayed, not including partial characters that may be clipped\r
1220 by the right edge of the display. If the length of the formatted Unicode string is\r
1221 greater than PcdUefiLibMaxPrintBufferSize, then at most the first\r
1222 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL\r
1223 is used to convert the string to a bitmap using the glyphs registered with the\r
1224 HII database. No wrapping is performed, so any portions of the string the fall\r
1225 outside the active display region will not be displayed.\r
1226\r
1227 If a graphics console device is not associated with the ConsoleOutputHandle\r
1228 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.\r
1229 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no\r
1230 string is printed, and 0 is returned.\r
1231 If Format is NULL, then ASSERT().\r
1232 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
1233 If gST->ConsoleOutputHandle is NULL, then ASSERT().\r
1234\r
1235 @param PointX X coordinate to print the string.\r
1236 @param PointY Y coordinate to print the string.\r
1237 @param ForeGround The foreground color of the string being printed. This is\r
1238 an optional parameter that may be NULL. If it is NULL,\r
1239 then the foreground color of the current ConOut device\r
1240 in the EFI_SYSTEM_TABLE is used.\r
1241 @param BackGround The background color of the string being printed. This is\r
1242 an optional parameter that may be NULL. If it is NULL,\r
1243 then the background color of the current ConOut device\r
1244 in the EFI_SYSTEM_TABLE is used.\r
1245 @param Format A null-terminated Unicode format string. See Print Library\r
1246 for the supported format string syntax.\r
1247 @param ... Variable argument list whose contents are accessed based on\r
1248 the format string specified by Format.\r
1249\r
1250 @return The number of Unicode characters printed.\r
1251\r
1252**/\r
1253UINTN\r
1254EFIAPI\r
1255PrintXY (\r
1256 IN UINTN PointX,\r
1257 IN UINTN PointY,\r
1258 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL\r
1259 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL\r
1260 IN CONST CHAR16 *Format,\r
1261 ...\r
1262 );\r
1263\r
1264/**\r
1265 Prints a formatted ASCII string to a graphics console device specified by\r
1266 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.\r
1267\r
1268 This function prints a formatted ASCII string to the graphics console device\r
1269 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of\r
1270 ASCII characters displayed, not including partial characters that may be clipped\r
1271 by the right edge of the display. If the length of the formatted ASCII string is\r
1272 greater than PcdUefiLibMaxPrintBufferSize, then at most the first\r
1273 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL\r
1274 is used to convert the string to a bitmap using the glyphs registered with the\r
1275 HII database. No wrapping is performed, so any portions of the string the fall\r
1276 outside the active display region will not be displayed.\r
1277\r
1278 If a graphics console device is not associated with the ConsoleOutputHandle\r
1279 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.\r
1280 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no\r
1281 string is printed, and 0 is returned.\r
1282 If Format is NULL, then ASSERT().\r
1283 If gST->ConsoleOutputHandle is NULL, then ASSERT().\r
1284\r
1285 @param PointX X coordinate to print the string.\r
1286 @param PointY Y coordinate to print the string.\r
1287 @param ForeGround The foreground color of the string being printed. This is\r
1288 an optional parameter that may be NULL. If it is NULL,\r
1289 then the foreground color of the current ConOut device\r
1290 in the EFI_SYSTEM_TABLE is used.\r
1291 @param BackGround The background color of the string being printed. This is\r
1292 an optional parameter that may be NULL. If it is NULL,\r
1293 then the background color of the current ConOut device\r
1294 in the EFI_SYSTEM_TABLE is used.\r
1295 @param Format A null-terminated ASCII format string. See Print Library\r
1296 for the supported format string syntax.\r
1297 @param ... The variable argument list whose contents are accessed based on\r
1298 the format string specified by Format.\r
1299\r
1300 @return The number of ASCII characters printed.\r
1301\r
1302**/\r
1303UINTN\r
1304EFIAPI\r
1305AsciiPrintXY (\r
1306 IN UINTN PointX,\r
1307 IN UINTN PointY,\r
1308 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL\r
1309 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL\r
1310 IN CONST CHAR8 *Format,\r
1311 ...\r
1312 );\r
1313\r
1314\r
1315/**\r
1316 Installs and completes the initialization of a Driver Binding Protocol instance.\r
1317\r
1318 Installs the Driver Binding Protocol specified by DriverBinding onto the handle\r
1319 specified by DriverBindingHandle. If DriverBindingHandle is NULL, then DriverBinding\r
1320 is installed onto a newly created handle. DriverBindingHandle is typically the same\r
1321 as the driver's ImageHandle, but it can be different if the driver produces multiple\r
1322 Driver Binding Protocols.\r
1323 If DriverBinding is NULL, then ASSERT().\r
1324 If DriverBinding can not be installed onto a handle, then ASSERT().\r
1325\r
1326 @param ImageHandle The image handle of the driver.\r
1327 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
1328 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
1329 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
1330 parameter is NULL, then a new handle is created.\r
1331\r
1332 @retval EFI_SUCCESS The protocol installation completed successfully.\r
1333 @retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol.\r
1334 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
1335\r
1336**/\r
1337EFI_STATUS\r
1338EFIAPI\r
1339EfiLibInstallDriverBinding (\r
1340 IN CONST EFI_HANDLE ImageHandle,\r
1341 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1342 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1343 IN EFI_HANDLE DriverBindingHandle\r
1344 );\r
1345\r
1346\r
1347/**\r
1348 Uninstalls a Driver Binding Protocol instance.\r
1349\r
1350 If DriverBinding is NULL, then ASSERT().\r
1351 If DriverBinding can not be uninstalled, then ASSERT().\r
1352\r
1353 @param DriverBinding A Driver Binding Protocol instance that this driver produced.\r
1354\r
1355 @retval EFI_SUCCESS The protocol uninstallation successfully completed.\r
1356 @retval Others Status from gBS->UninstallMultipleProtocolInterfaces().\r
1357\r
1358**/\r
1359EFI_STATUS\r
1360EFIAPI\r
1361EfiLibUninstallDriverBinding (\r
1362 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding\r
1363 );\r
1364\r
1365\r
1366/**\r
1367 Installs and completes the initialization of a Driver Binding Protocol instance and\r
1368 optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.\r
1369\r
1370 Initializes a driver by installing the Driver Binding Protocol together with the\r
1371 optional Component Name, optional Driver Configure and optional Driver Diagnostic\r
1372 Protocols onto the driver's DriverBindingHandle. If DriverBindingHandle is NULL,\r
1373 then the protocols are installed onto a newly created handle. DriverBindingHandle\r
1374 is typically the same as the driver's ImageHandle, but it can be different if the\r
1375 driver produces multiple Driver Binding Protocols.\r
1376 If DriverBinding is NULL, then ASSERT().\r
1377 If the installation fails, then ASSERT().\r
1378\r
1379 @param ImageHandle The image handle of the driver.\r
1380 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
1381 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
1382 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
1383 parameter is NULL, then a new handle is created.\r
1384 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
1385 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r
1386 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r
1387\r
1388 @retval EFI_SUCCESS The protocol installation completed successfully.\r
1389 @retval EFI_OUT_OF_RESOURCES There was not enough memory in the pool to install all the protocols.\r
1390\r
1391**/\r
1392EFI_STATUS\r
1393EFIAPI\r
1394EfiLibInstallAllDriverProtocols (\r
1395 IN CONST EFI_HANDLE ImageHandle,\r
1396 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1397 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1398 IN EFI_HANDLE DriverBindingHandle,\r
1399 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1400 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
1401 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL\r
1402 );\r
1403\r
1404\r
1405/**\r
1406 Uninstalls a Driver Binding Protocol instance and optionally uninstalls the\r
1407 Component Name, Driver Configuration and Driver Diagnostics Protocols.\r
1408\r
1409 If DriverBinding is NULL, then ASSERT().\r
1410 If the uninstallation fails, then ASSERT().\r
1411\r
1412 @param DriverBinding A Driver Binding Protocol instance that this driver produced.\r
1413 @param ComponentName A Component Name Protocol instance that this driver produced.\r
1414 @param DriverConfiguration A Driver Configuration Protocol instance that this driver produced.\r
1415 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver produced.\r
1416\r
1417 @retval EFI_SUCCESS The protocol uninstallation successfully completed.\r
1418 @retval Others Status from gBS->UninstallMultipleProtocolInterfaces().\r
1419\r
1420**/\r
1421EFI_STATUS\r
1422EFIAPI\r
1423EfiLibUninstallAllDriverProtocols (\r
1424 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1425 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1426 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
1427 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL\r
1428 );\r
1429\r
1430\r
1431/**\r
1432 Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.\r
1433\r
1434 Initializes a driver by installing the Driver Binding Protocol together with the\r
1435 optional Component Name and optional Component Name 2 protocols onto the driver's\r
1436 DriverBindingHandle. If DriverBindingHandle is NULL, then the protocols are installed\r
1437 onto a newly created handle. DriverBindingHandle is typically the same as the driver's\r
1438 ImageHandle, but it can be different if the driver produces multiple Driver Binding Protocols.\r
1439 If DriverBinding is NULL, then ASSERT().\r
1440 If the installation fails, then ASSERT().\r
1441\r
1442 @param ImageHandle The image handle of the driver.\r
1443 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
1444 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
1445 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
1446 parameter is NULL, then a new handle is created.\r
1447 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
1448 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r
1449\r
1450 @retval EFI_SUCCESS The protocol installation completed successfully.\r
1451 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r
1452\r
1453**/\r
1454EFI_STATUS\r
1455EFIAPI\r
1456EfiLibInstallDriverBindingComponentName2 (\r
1457 IN CONST EFI_HANDLE ImageHandle,\r
1458 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1459 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1460 IN EFI_HANDLE DriverBindingHandle,\r
1461 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1462 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL\r
1463 );\r
1464\r
1465\r
1466/**\r
1467 Uninstalls Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.\r
1468\r
1469 If DriverBinding is NULL, then ASSERT().\r
1470 If the uninstallation fails, then ASSERT().\r
1471\r
1472 @param DriverBinding A Driver Binding Protocol instance that this driver produced.\r
1473 @param ComponentName A Component Name Protocol instance that this driver produced.\r
1474 @param ComponentName2 A Component Name 2 Protocol instance that this driver produced.\r
1475\r
1476 @retval EFI_SUCCESS The protocol installation successfully completed.\r
1477 @retval Others Status from gBS->UninstallMultipleProtocolInterfaces().\r
1478\r
1479**/\r
1480EFI_STATUS\r
1481EFIAPI\r
1482EfiLibUninstallDriverBindingComponentName2 (\r
1483 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1484 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1485 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL\r
1486 );\r
1487\r
1488\r
1489/**\r
1490 Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver\r
1491 Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.\r
1492\r
1493 Initializes a driver by installing the Driver Binding Protocol together with the optional\r
1494 Component Name, optional Component Name 2, optional Driver Configuration, optional Driver Configuration 2,\r
1495 optional Driver Diagnostic, and optional Driver Diagnostic 2 Protocols onto the driver's DriverBindingHandle.\r
1496 DriverBindingHandle is typically the same as the driver's ImageHandle, but it can be different if the driver\r
1497 produces multiple Driver Binding Protocols.\r
1498 If DriverBinding is NULL, then ASSERT().\r
1499 If the installation fails, then ASSERT().\r
1500\r
1501\r
1502 @param ImageHandle The image handle of the driver.\r
1503 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
1504 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
1505 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
1506 parameter is NULL, then a new handle is created.\r
1507 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
1508 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r
1509 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r
1510 @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver is producing.\r
1511 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r
1512 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.\r
1513\r
1514 @retval EFI_SUCCESS The protocol installation completed successfully.\r
1515 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r
1516\r
1517**/\r
1518EFI_STATUS\r
1519EFIAPI\r
1520EfiLibInstallAllDriverProtocols2 (\r
1521 IN CONST EFI_HANDLE ImageHandle,\r
1522 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1523 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1524 IN EFI_HANDLE DriverBindingHandle,\r
1525 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1526 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL\r
1527 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
1528 IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL\r
1529 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL\r
1530 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL\r
1531 );\r
1532\r
1533\r
1534/**\r
1535 Uninstalls Driver Binding Protocol with optional Component Name, Component Name 2, Driver\r
1536 Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.\r
1537\r
1538 If DriverBinding is NULL, then ASSERT().\r
1539 If the installation fails, then ASSERT().\r
1540\r
1541\r
1542 @param DriverBinding A Driver Binding Protocol instance that this driver produced.\r
1543 @param ComponentName A Component Name Protocol instance that this driver produced.\r
1544 @param ComponentName2 A Component Name 2 Protocol instance that this driver produced.\r
1545 @param DriverConfiguration A Driver Configuration Protocol instance that this driver produced.\r
1546 @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver produced.\r
1547 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver produced.\r
1548 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver produced.\r
1549\r
1550 @retval EFI_SUCCESS The protocol uninstallation successfully completed.\r
1551 @retval Others Status from gBS->UninstallMultipleProtocolInterfaces().\r
1552\r
1553**/\r
1554EFI_STATUS\r
1555EFIAPI\r
1556EfiLibUninstallAllDriverProtocols2 (\r
1557 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1558 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1559 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL\r
1560 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
1561 IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL\r
1562 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL\r
1563 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL\r
1564 );\r
1565\r
1566\r
1567/**\r
1568 Appends a formatted Unicode string to a Null-terminated Unicode string\r
1569\r
1570 This function appends a formatted Unicode string to the Null-terminated\r
1571 Unicode string specified by String. String is optional and may be NULL.\r
1572 Storage for the formatted Unicode string returned is allocated using\r
1573 AllocatePool(). The pointer to the appended string is returned. The caller\r
1574 is responsible for freeing the returned string.\r
1575\r
1576 If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().\r
1577 If FormatString is NULL, then ASSERT().\r
1578 If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
1579\r
1580 @param[in] String A Null-terminated Unicode string.\r
1581 @param[in] FormatString A Null-terminated Unicode format string.\r
1582 @param[in] Marker VA_LIST marker for the variable argument list.\r
1583\r
1584 @retval NULL There was not enough available memory.\r
1585 @return Null-terminated Unicode string is that is the formatted\r
1586 string appended to String.\r
1587**/\r
1588CHAR16*\r
1589EFIAPI\r
1590CatVSPrint (\r
1591 IN CHAR16 *String, OPTIONAL\r
1592 IN CONST CHAR16 *FormatString,\r
1593 IN VA_LIST Marker\r
1594 );\r
1595\r
1596/**\r
1597 Appends a formatted Unicode string to a Null-terminated Unicode string\r
1598\r
1599 This function appends a formatted Unicode string to the Null-terminated\r
1600 Unicode string specified by String. String is optional and may be NULL.\r
1601 Storage for the formatted Unicode string returned is allocated using\r
1602 AllocatePool(). The pointer to the appended string is returned. The caller\r
1603 is responsible for freeing the returned string.\r
1604\r
1605 If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().\r
1606 If FormatString is NULL, then ASSERT().\r
1607 If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
1608\r
1609 @param[in] String A Null-terminated Unicode string.\r
1610 @param[in] FormatString A Null-terminated Unicode format string.\r
1611 @param[in] ... The variable argument list whose contents are\r
1612 accessed based on the format string specified by\r
1613 FormatString.\r
1614\r
1615 @retval NULL There was not enough available memory.\r
1616 @return Null-terminated Unicode string is that is the formatted\r
1617 string appended to String.\r
1618**/\r
1619CHAR16 *\r
1620EFIAPI\r
1621CatSPrint (\r
1622 IN CHAR16 *String, OPTIONAL\r
1623 IN CONST CHAR16 *FormatString,\r
1624 ...\r
1625 );\r
1626\r
1627/**\r
1628 Returns an array of protocol instance that matches the given protocol.\r
1629\r
1630 @param[in] Protocol Provides the protocol to search for.\r
1631 @param[out] NoProtocols The number of protocols returned in Buffer.\r
1632 @param[out] Buffer A pointer to the buffer to return the requested\r
1633 array of protocol instances that match Protocol.\r
1634 The returned buffer is allocated using\r
1635 EFI_BOOT_SERVICES.AllocatePool(). The caller is\r
1636 responsible for freeing this buffer with\r
1637 EFI_BOOT_SERVICES.FreePool().\r
1638\r
1639 @retval EFI_SUCCESS The array of protocols was returned in Buffer,\r
1640 and the number of protocols in Buffer was\r
1641 returned in NoProtocols.\r
1642 @retval EFI_NOT_FOUND No protocols found.\r
1643 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the\r
1644 matching results.\r
1645 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
1646 @retval EFI_INVALID_PARAMETER NoProtocols is NULL.\r
1647 @retval EFI_INVALID_PARAMETER Buffer is NULL.\r
1648\r
1649**/\r
1650EFI_STATUS\r
1651EFIAPI\r
1652EfiLocateProtocolBuffer (\r
1653 IN EFI_GUID *Protocol,\r
1654 OUT UINTN *NoProtocols,\r
1655 OUT VOID ***Buffer\r
1656 );\r
1657\r
1658/**\r
1659 Open or create a file or directory, possibly creating the chain of\r
1660 directories leading up to the directory.\r
1661\r
1662 EfiOpenFileByDevicePath() first locates EFI_SIMPLE_FILE_SYSTEM_PROTOCOL on\r
1663 FilePath, and opens the root directory of that filesystem with\r
1664 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.OpenVolume().\r
1665\r
1666 On the remaining device path, the longest initial sequence of\r
1667 FILEPATH_DEVICE_PATH nodes is node-wise traversed with\r
1668 EFI_FILE_PROTOCOL.Open().\r
1669\r
1670 (As a consequence, if OpenMode includes EFI_FILE_MODE_CREATE, and Attributes\r
1671 includes EFI_FILE_DIRECTORY, and each FILEPATH_DEVICE_PATH specifies a single\r
1672 pathname component, then EfiOpenFileByDevicePath() ensures that the specified\r
1673 series of subdirectories exist on return.)\r
1674\r
1675 The EFI_FILE_PROTOCOL identified by the last FILEPATH_DEVICE_PATH node is\r
1676 output to the caller; intermediate EFI_FILE_PROTOCOL instances are closed. If\r
1677 there are no FILEPATH_DEVICE_PATH nodes past the node that identifies the\r
1678 filesystem, then the EFI_FILE_PROTOCOL of the root directory of the\r
1679 filesystem is output to the caller. If a device path node that is different\r
1680 from FILEPATH_DEVICE_PATH is encountered relative to the filesystem, the\r
1681 traversal is stopped with an error, and a NULL EFI_FILE_PROTOCOL is output.\r
1682\r
1683 @param[in,out] FilePath On input, the device path to the file or directory\r
1684 to open or create. The caller is responsible for\r
1685 ensuring that the device path pointed-to by FilePath\r
1686 is well-formed. On output, FilePath points one past\r
1687 the last node in the original device path that has\r
1688 been successfully processed. FilePath is set on\r
1689 output even if EfiOpenFileByDevicePath() returns an\r
1690 error.\r
1691\r
1692 @param[out] File On error, File is set to NULL. On success, File is\r
1693 set to the EFI_FILE_PROTOCOL of the root directory\r
1694 of the filesystem, if there are no\r
1695 FILEPATH_DEVICE_PATH nodes in FilePath; otherwise,\r
1696 File is set to the EFI_FILE_PROTOCOL identified by\r
1697 the last node in FilePath.\r
1698\r
1699 @param[in] OpenMode The OpenMode parameter to pass to\r
1700 EFI_FILE_PROTOCOL.Open().\r
1701\r
1702 @param[in] Attributes The Attributes parameter to pass to\r
1703 EFI_FILE_PROTOCOL.Open().\r
1704\r
1705 @retval EFI_SUCCESS The file or directory has been opened or\r
1706 created.\r
1707\r
1708 @retval EFI_INVALID_PARAMETER FilePath is NULL; or File is NULL; or FilePath\r
1709 contains a device path node, past the node\r
1710 that identifies\r
1711 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, that is not a\r
1712 FILEPATH_DEVICE_PATH node.\r
1713\r
1714 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r
1715\r
1716 @return Error codes propagated from the\r
1717 LocateDevicePath() and OpenProtocol() boot\r
1718 services, and from the\r
1719 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.OpenVolume()\r
1720 and EFI_FILE_PROTOCOL.Open() member functions.\r
1721**/\r
1722EFI_STATUS\r
1723EFIAPI\r
1724EfiOpenFileByDevicePath (\r
1725 IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,\r
1726 OUT EFI_FILE_PROTOCOL **File,\r
1727 IN UINT64 OpenMode,\r
1728 IN UINT64 Attributes\r
1729 );\r
1730\r
1731/**\r
1732 This function locates next ACPI table in XSDT/RSDT based on Signature and\r
1733 previous returned Table.\r
1734\r
1735 If PreviousTable is NULL:\r
1736 This function will locate the first ACPI table in XSDT/RSDT based on\r
1737 Signature in gEfiAcpi20TableGuid system configuration table first, and then\r
1738 gEfiAcpi10TableGuid system configuration table.\r
1739 This function will locate in XSDT first, and then RSDT.\r
1740 For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in\r
1741 FADT.\r
1742 For FACS, this function will locate XFirmwareCtrl in FADT first, and then\r
1743 FirmwareCtrl in FADT.\r
1744\r
1745 If PreviousTable is not NULL:\r
1746 1. If it could be located in XSDT in gEfiAcpi20TableGuid system configuration\r
1747 table, then this function will just locate next table in XSDT in\r
1748 gEfiAcpi20TableGuid system configuration table.\r
1749 2. If it could be located in RSDT in gEfiAcpi20TableGuid system configuration\r
1750 table, then this function will just locate next table in RSDT in\r
1751 gEfiAcpi20TableGuid system configuration table.\r
1752 3. If it could be located in RSDT in gEfiAcpi10TableGuid system configuration\r
1753 table, then this function will just locate next table in RSDT in\r
1754 gEfiAcpi10TableGuid system configuration table.\r
1755\r
1756 It's not supported that PreviousTable is not NULL but PreviousTable->Signature\r
1757 is not same with Signature, NULL will be returned.\r
1758\r
1759 @param Signature ACPI table signature.\r
1760 @param PreviousTable Pointer to previous returned table to locate next\r
1761 table, or NULL to locate first table.\r
1762\r
1763 @return Next ACPI table or NULL if not found.\r
1764\r
1765**/\r
1766EFI_ACPI_COMMON_HEADER *\r
1767EFIAPI\r
1768EfiLocateNextAcpiTable (\r
1769 IN UINT32 Signature,\r
1770 IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL\r
1771 );\r
1772\r
1773/**\r
1774 This function locates first ACPI table in XSDT/RSDT based on Signature.\r
1775\r
1776 This function will locate the first ACPI table in XSDT/RSDT based on\r
1777 Signature in gEfiAcpi20TableGuid system configuration table first, and then\r
1778 gEfiAcpi10TableGuid system configuration table.\r
1779 This function will locate in XSDT first, and then RSDT.\r
1780 For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in\r
1781 FADT.\r
1782 For FACS, this function will locate XFirmwareCtrl in FADT first, and then\r
1783 FirmwareCtrl in FADT.\r
1784\r
1785 @param Signature ACPI table signature.\r
1786\r
1787 @return First ACPI table or NULL if not found.\r
1788\r
1789**/\r
1790EFI_ACPI_COMMON_HEADER *\r
1791EFIAPI\r
1792EfiLocateFirstAcpiTable (\r
1793 IN UINT32 Signature\r
1794 );\r
1795\r
1796#endif\r