]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/UefiLib.h
Add 2 functions to UefiLib library class: CatSPrint and CatVSPrint.
[mirror_edk2.git] / MdePkg / Include / Library / UefiLib.h
1 /** @file
2 Provides library functions for common UEFI operations. Only available to DXE
3 and UEFI module types.
4
5 The UEFI Library provides functions and macros that simplify the development of
6 UEFI Drivers and UEFI Applications. These functions and macros help manage EFI
7 events, build simple locks utilizing EFI Task Priority Levels (TPLs), install
8 EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers,
9 and print messages on the console output and standard error devices.
10
11 Note that a reserved macro named MDEPKG_NDEBUG is introduced for the intention
12 of size reduction when compiler optimization is disabled. If MDEPKG_NDEBUG is
13 defined, then debug and assert related macros wrapped by it are the NULL implementations.
14
15 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
16 This program and the accompanying materials are licensed and made available under
17 the terms and conditions of the BSD License that accompanies this distribution.
18 The full text of the license may be found at
19 http://opensource.org/licenses/bsd-license.php.
20
21 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
22 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23
24 **/
25
26 #ifndef __UEFI_LIB_H__
27 #define __UEFI_LIB_H__
28
29 #include <Protocol/DriverBinding.h>
30 #include <Protocol/DriverConfiguration.h>
31 #include <Protocol/ComponentName.h>
32 #include <Protocol/ComponentName2.h>
33 #include <Protocol/DriverDiagnostics.h>
34 #include <Protocol/DriverDiagnostics2.h>
35 #include <Protocol/GraphicsOutput.h>
36
37 #include <Library/BaseLib.h>
38
39 ///
40 /// Unicode String Table
41 ///
42 typedef struct {
43 CHAR8 *Language;
44 CHAR16 *UnicodeString;
45 } EFI_UNICODE_STRING_TABLE;
46
47 ///
48 /// EFI Lock Status
49 ///
50 typedef enum {
51 EfiLockUninitialized = 0,
52 EfiLockReleased = 1,
53 EfiLockAcquired = 2
54 } EFI_LOCK_STATE;
55
56 ///
57 /// EFI Lock
58 ///
59 typedef struct {
60 EFI_TPL Tpl;
61 EFI_TPL OwnerTpl;
62 EFI_LOCK_STATE Lock;
63 } EFI_LOCK;
64
65 /**
66 Macro that returns the number of 100 ns units for a specified number of microseconds.
67 This is useful for managing EFI timer events.
68
69 @param Microseconds The number of microseconds.
70
71 @return The number of 100 ns units equivalent to the number of microseconds specified
72 by Microseconds.
73
74 **/
75 #define EFI_TIMER_PERIOD_MICROSECONDS(Microseconds) MultU64x32((UINT64)(Microseconds), 10)
76
77 /**
78 Macro that returns the number of 100 ns units for a specified number of milliseconds.
79 This is useful for managing EFI timer events.
80
81 @param Milliseconds The number of milliseconds.
82
83 @return The number of 100 ns units equivalent to the number of milliseconds specified
84 by Milliseconds.
85
86 **/
87 #define EFI_TIMER_PERIOD_MILLISECONDS(Milliseconds) MultU64x32((UINT64)(Milliseconds), 10000)
88
89 /**
90 Macro that returns the number of 100 ns units for a specified number of seconds.
91 This is useful for managing EFI timer events.
92
93 @param Seconds The number of seconds.
94
95 @return The number of 100 ns units equivalent to the number of seconds specified
96 by Seconds.
97
98 **/
99 #define EFI_TIMER_PERIOD_SECONDS(Seconds) MultU64x32((UINT64)(Seconds), 10000000)
100
101 /**
102 Macro that returns the a pointer to the next EFI_MEMORY_DESCRIPTOR in an array
103 returned from GetMemoryMap().
104
105 @param MemoryDescriptor A pointer to an EFI_MEMORY_DESCRIPTOR.
106
107 @param Size The size, in bytes, of the current EFI_MEMORY_DESCRIPTOR.
108
109 @return A pointer to the next EFI_MEMORY_DESCRIPTOR.
110
111 **/
112 #define NEXT_MEMORY_DESCRIPTOR(MemoryDescriptor, Size) \
113 ((EFI_MEMORY_DESCRIPTOR *)((UINT8 *)(MemoryDescriptor) + (Size)))
114
115 /**
116 Retrieves a pointer to the system configuration table from the EFI System Table
117 based on a specified GUID.
118
119 This function searches the list of configuration tables stored in the EFI System Table
120 for a table with a GUID that matches TableGuid. If a match is found, then a pointer to
121 the configuration table is returned in Table, and EFI_SUCCESS is returned. If a matching GUID
122 is not found, then EFI_NOT_FOUND is returned.
123 If TableGuid is NULL, then ASSERT().
124 If Table is NULL, then ASSERT().
125
126 @param TableGuid The pointer to table's GUID type..
127 @param Table The pointer to the table associated with TableGuid in the EFI System Table.
128
129 @retval EFI_SUCCESS A configuration table matching TableGuid was found.
130 @retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found.
131
132 **/
133 EFI_STATUS
134 EFIAPI
135 EfiGetSystemConfigurationTable (
136 IN EFI_GUID *TableGuid,
137 OUT VOID **Table
138 );
139
140 /**
141 Creates and returns a notification event and registers that event with all the protocol
142 instances specified by ProtocolGuid.
143
144 This function causes the notification function to be executed for every protocol of type
145 ProtocolGuid instance that exists in the system when this function is invoked. If there are
146 no instances of ProtocolGuid in the handle database at the time this function is invoked,
147 then the notification function is still executed one time. In addition, every time a protocol
148 of type ProtocolGuid instance is installed or reinstalled, the notification function is also
149 executed. This function returns the notification event that was created.
150 If ProtocolGuid is NULL, then ASSERT().
151 If NotifyTpl is not a legal TPL value, then ASSERT().
152 If NotifyFunction is NULL, then ASSERT().
153 If Registration is NULL, then ASSERT().
154
155
156 @param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired.
157 @param NotifyTpl Supplies the task priority level of the event notifications.
158 @param NotifyFunction Supplies the function to notify when the event is signaled.
159 @param NotifyContext The context parameter to pass to NotifyFunction.
160 @param Registration A pointer to a memory location to receive the registration value.
161 This value is passed to LocateHandle() to obtain new handles that
162 have been added that support the ProtocolGuid-specified protocol.
163
164 @return The notification event that was created.
165
166 **/
167 EFI_EVENT
168 EFIAPI
169 EfiCreateProtocolNotifyEvent(
170 IN EFI_GUID *ProtocolGuid,
171 IN EFI_TPL NotifyTpl,
172 IN EFI_EVENT_NOTIFY NotifyFunction,
173 IN VOID *NotifyContext, OPTIONAL
174 OUT VOID **Registration
175 );
176
177 /**
178 Creates a named event that can be signaled with EfiNamedEventSignal().
179
180 This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.
181 This event is signaled with EfiNamedEventSignal(). This provides the ability for one or more
182 listeners on the same event named by the GUID specified by Name.
183 If Name is NULL, then ASSERT().
184 If NotifyTpl is not a legal TPL value, then ASSERT().
185 If NotifyFunction is NULL, then ASSERT().
186
187 @param Name Supplies GUID name of the event.
188 @param NotifyTpl Supplies the task priority level of the event notifications.
189 @param NotifyFunction Supplies the function to notify when the event is signaled.
190 @param NotifyContext The context parameter to pass to NotifyFunction.
191 @param Registration A pointer to a memory location to receive the registration value.
192
193 @retval EFI_SUCCESS A named event was created.
194 @retval EFI_OUT_OF_RESOURCES There are not enough resources to create the named event.
195
196 **/
197 EFI_STATUS
198 EFIAPI
199 EfiNamedEventListen (
200 IN CONST EFI_GUID *Name,
201 IN EFI_TPL NotifyTpl,
202 IN EFI_EVENT_NOTIFY NotifyFunction,
203 IN CONST VOID *NotifyContext, OPTIONAL
204 OUT VOID *Registration OPTIONAL
205 );
206
207 /**
208 Signals a named event created with EfiNamedEventListen().
209
210 This function signals the named event specified by Name. The named event must have been
211 created with EfiNamedEventListen().
212 If Name is NULL, then ASSERT().
213
214 @param Name Supplies the GUID name of the event.
215
216 @retval EFI_SUCCESS A named event was signaled.
217 @retval EFI_OUT_OF_RESOURCES There are not enough resources to signal the named event.
218
219 **/
220 EFI_STATUS
221 EFIAPI
222 EfiNamedEventSignal (
223 IN CONST EFI_GUID *Name
224 );
225
226 /**
227 Returns the current TPL.
228
229 This function returns the current TPL. There is no EFI service to directly
230 retrieve the current TPL. Instead, the RaiseTPL() function is used to raise
231 the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level
232 can then immediately be restored back to the current TPL level with a call
233 to RestoreTPL().
234
235 @return The current TPL.
236
237 **/
238 EFI_TPL
239 EFIAPI
240 EfiGetCurrentTpl (
241 VOID
242 );
243
244 /**
245 Initializes a basic mutual exclusion lock.
246
247 This function initializes a basic mutual exclusion lock to the released state
248 and returns the lock. Each lock provides mutual exclusion access at its task
249 priority level. Since there is no preemption or multiprocessor support in EFI,
250 acquiring the lock only consists of raising to the locks TPL.
251 If Lock is NULL, then ASSERT().
252 If Priority is not a valid TPL value, then ASSERT().
253
254 @param Lock A pointer to the lock data structure to initialize.
255 @param Priority The EFI TPL associated with the lock.
256
257 @return The lock.
258
259 **/
260 EFI_LOCK *
261 EFIAPI
262 EfiInitializeLock (
263 IN OUT EFI_LOCK *Lock,
264 IN EFI_TPL Priority
265 );
266
267 /**
268 Initializes a basic mutual exclusion lock.
269
270 This macro initializes the contents of a basic mutual exclusion lock to the
271 released state. Each lock provides mutual exclusion access at its task
272 priority level. Since there is no preemption or multiprocessor support in EFI,
273 acquiring the lock only consists of raising to the locks TPL.
274
275 @param Priority The task priority level of the lock.
276
277 @return The lock.
278
279 **/
280 #define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \
281 {Priority, TPL_APPLICATION, EfiLockReleased }
282
283
284 /**
285 Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.
286
287 If MDEPKG_NDEBUG is not defined and the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED
288 bit of PcdDebugProperyMask is set, then this macro evaluates the EFI_LOCK
289 structure specified by Lock. If Lock is not in the locked state, then
290 DebugAssert() is called passing in the source filename, source line number,
291 and Lock.
292
293 If Lock is NULL, then ASSERT().
294
295 @param LockParameter A pointer to the lock to acquire.
296
297 **/
298 #if !defined(MDEPKG_NDEBUG)
299 #define ASSERT_LOCKED(LockParameter) \
300 do { \
301 if (DebugAssertEnabled ()) { \
302 ASSERT (LockParameter != NULL); \
303 if ((LockParameter)->Lock != EfiLockAcquired) { \
304 _ASSERT (LockParameter not locked); \
305 } \
306 } \
307 } while (FALSE)
308 #else
309 #define ASSERT_LOCKED(LockParameter)
310 #endif
311
312
313 /**
314 Acquires ownership of a lock.
315
316 This function raises the system's current task priority level to the task
317 priority level of the mutual exclusion lock. Then, it places the lock in the
318 acquired state.
319 If Lock is NULL, then ASSERT().
320 If Lock is not initialized, then ASSERT().
321 If Lock is already in the acquired state, then ASSERT().
322
323 @param Lock A pointer to the lock to acquire.
324
325 **/
326 VOID
327 EFIAPI
328 EfiAcquireLock (
329 IN EFI_LOCK *Lock
330 );
331
332 /**
333 Acquires ownership of a lock.
334
335 This function raises the system's current task priority level to the task priority
336 level of the mutual exclusion lock. Then, it attempts to place the lock in the acquired state.
337 If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned.
338 Otherwise, EFI_SUCCESS is returned.
339 If Lock is NULL, then ASSERT().
340 If Lock is not initialized, then ASSERT().
341
342 @param Lock A pointer to the lock to acquire.
343
344 @retval EFI_SUCCESS The lock was acquired.
345 @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.
346
347 **/
348 EFI_STATUS
349 EFIAPI
350 EfiAcquireLockOrFail (
351 IN EFI_LOCK *Lock
352 );
353
354 /**
355 Releases ownership of a lock.
356
357 This function transitions a mutual exclusion lock from the acquired state to
358 the released state, and restores the system's task priority level to its
359 previous level.
360 If Lock is NULL, then ASSERT().
361 If Lock is not initialized, then ASSERT().
362 If Lock is already in the released state, then ASSERT().
363
364 @param Lock A pointer to the lock to release.
365
366 **/
367 VOID
368 EFIAPI
369 EfiReleaseLock (
370 IN EFI_LOCK *Lock
371 );
372
373 /**
374 Tests whether a controller handle is being managed by a specific driver.
375
376 This function tests whether the driver specified by DriverBindingHandle is
377 currently managing the controller specified by ControllerHandle. This test
378 is performed by evaluating if the the protocol specified by ProtocolGuid is
379 present on ControllerHandle and is was opened by DriverBindingHandle with an
380 attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.
381 If ProtocolGuid is NULL, then ASSERT().
382
383 @param ControllerHandle A handle for a controller to test.
384 @param DriverBindingHandle Specifies the driver binding handle for the
385 driver.
386 @param ProtocolGuid Specifies the protocol that the driver specified
387 by DriverBindingHandle opens in its Start()
388 function.
389
390 @retval EFI_SUCCESS ControllerHandle is managed by the driver
391 specified by DriverBindingHandle.
392 @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
393 specified by DriverBindingHandle.
394
395 **/
396 EFI_STATUS
397 EFIAPI
398 EfiTestManagedDevice (
399 IN CONST EFI_HANDLE ControllerHandle,
400 IN CONST EFI_HANDLE DriverBindingHandle,
401 IN CONST EFI_GUID *ProtocolGuid
402 );
403
404 /**
405 Tests whether a child handle is a child device of the controller.
406
407 This function tests whether ChildHandle is one of the children of
408 ControllerHandle. This test is performed by checking to see if the protocol
409 specified by ProtocolGuid is present on ControllerHandle and opened by
410 ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
411 If ProtocolGuid is NULL, then ASSERT().
412
413 @param ControllerHandle A handle for a (parent) controller to test.
414 @param ChildHandle A child handle to test.
415 @param ProtocolGuid Supplies the protocol that the child controller
416 opens on its parent controller.
417
418 @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.
419 @retval EFI_UNSUPPORTED ChildHandle is not a child of the
420 ControllerHandle.
421
422 **/
423 EFI_STATUS
424 EFIAPI
425 EfiTestChildHandle (
426 IN CONST EFI_HANDLE ControllerHandle,
427 IN CONST EFI_HANDLE ChildHandle,
428 IN CONST EFI_GUID *ProtocolGuid
429 );
430
431 /**
432 This function looks up a Unicode string in UnicodeStringTable.
433
434 If Language is a member of SupportedLanguages and a Unicode string is found in
435 UnicodeStringTable that matches the language code specified by Language, then it
436 is returned in UnicodeString.
437
438 @param Language A pointer to the ISO 639-2 language code for the
439 Unicode string to look up and return.
440 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
441 that the Unicode string table supports. Language
442 must be a member of this set.
443 @param UnicodeStringTable A pointer to the table of Unicode strings.
444 @param UnicodeString A pointer to the Unicode string from UnicodeStringTable
445 that matches the language specified by Language.
446
447 @retval EFI_SUCCESS The Unicode string that matches the language
448 specified by Language was found
449 in the table of Unicode strings UnicodeStringTable,
450 and it was returned in UnicodeString.
451 @retval EFI_INVALID_PARAMETER Language is NULL.
452 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
453 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
454 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
455 @retval EFI_UNSUPPORTED The language specified by Language is not a
456 member of SupportedLanguages.
457 @retval EFI_UNSUPPORTED The language specified by Language is not
458 supported by UnicodeStringTable.
459
460 **/
461 EFI_STATUS
462 EFIAPI
463 LookupUnicodeString (
464 IN CONST CHAR8 *Language,
465 IN CONST CHAR8 *SupportedLanguages,
466 IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,
467 OUT CHAR16 **UnicodeString
468 );
469
470 /**
471 This function looks up a Unicode string in UnicodeStringTable.
472
473 If Language is a member of SupportedLanguages and a Unicode string is found in
474 UnicodeStringTable that matches the language code specified by Language, then
475 it is returned in UnicodeString.
476
477 @param Language A pointer to an ASCII string containing the ISO 639-2 or the
478 RFC 4646 language code for the Unicode string to look up and
479 return. If Iso639Language is TRUE, then this ASCII string is
480 not assumed to be Null-terminated, and only the first three
481 characters are used. If Iso639Language is FALSE, then this ASCII
482 string must be Null-terminated.
483 @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains a
484 set of ISO 639-2 or RFC 4646 language codes that the Unicode
485 string table supports. Language must be a member of this set.
486 If Iso639Language is TRUE, then this string contains one or more
487 ISO 639-2 language codes with no separator characters. If Iso639Language
488 is FALSE, then is string contains one or more RFC 4646 language
489 codes separated by ';'.
490 @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE
491 is defined in "Related Definitions".
492 @param UnicodeString A pointer to the Null-terminated Unicode string from UnicodeStringTable
493 that matches the language specified by Language.
494 @param Iso639Language Specifies the supported language code format. If it is TRUE, then
495 Language and SupportedLanguages follow ISO 639-2 language code format.
496 Otherwise, they follow the RFC 4646 language code format.
497
498
499 @retval EFI_SUCCESS The Unicode string that matches the language specified by Language
500 was found in the table of Unicode strings UnicodeStringTable, and
501 it was returned in UnicodeString.
502 @retval EFI_INVALID_PARAMETER Language is NULL.
503 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
504 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
505 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
506 @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.
507 @retval EFI_UNSUPPORTED The language specified by Language is not supported by UnicodeStringTable.
508
509 **/
510 EFI_STATUS
511 EFIAPI
512 LookupUnicodeString2 (
513 IN CONST CHAR8 *Language,
514 IN CONST CHAR8 *SupportedLanguages,
515 IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,
516 OUT CHAR16 **UnicodeString,
517 IN BOOLEAN Iso639Language
518 );
519
520 /**
521 This function adds a Unicode string to UnicodeStringTable.
522
523 If Language is a member of SupportedLanguages then UnicodeString is added to
524 UnicodeStringTable. New buffers are allocated for both Language and
525 UnicodeString. The contents of Language and UnicodeString are copied into
526 these new buffers. These buffers are automatically freed when
527 FreeUnicodeStringTable() is called.
528
529 @param Language A pointer to the ISO 639-2 language code for the Unicode
530 string to add.
531 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
532 that the Unicode string table supports.
533 Language must be a member of this set.
534 @param UnicodeStringTable A pointer to the table of Unicode strings.
535 @param UnicodeString A pointer to the Unicode string to add.
536
537 @retval EFI_SUCCESS The Unicode string that matches the language
538 specified by Language was found in the table of
539 Unicode strings UnicodeStringTable, and it was
540 returned in UnicodeString.
541 @retval EFI_INVALID_PARAMETER Language is NULL.
542 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
543 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
544 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
545 @retval EFI_ALREADY_STARTED A Unicode string with language Language is
546 already present in UnicodeStringTable.
547 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another
548 Unicode string to UnicodeStringTable.
549 @retval EFI_UNSUPPORTED The language specified by Language is not a
550 member of SupportedLanguages.
551
552 **/
553 EFI_STATUS
554 EFIAPI
555 AddUnicodeString (
556 IN CONST CHAR8 *Language,
557 IN CONST CHAR8 *SupportedLanguages,
558 IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,
559 IN CONST CHAR16 *UnicodeString
560 );
561
562 /**
563 This function adds the Null-terminated Unicode string specified by UnicodeString
564 to UnicodeStringTable.
565
566 If Language is a member of SupportedLanguages then UnicodeString is added to
567 UnicodeStringTable. New buffers are allocated for both Language and UnicodeString.
568 The contents of Language and UnicodeString are copied into these new buffers.
569 These buffers are automatically freed when EfiLibFreeUnicodeStringTable() is called.
570
571 @param Language A pointer to an ASCII string containing the ISO 639-2 or
572 the RFC 4646 language code for the Unicode string to add.
573 If Iso639Language is TRUE, then this ASCII string is not
574 assumed to be Null-terminated, and only the first three
575 chacters are used. If Iso639Language is FALSE, then this
576 ASCII string must be Null-terminated.
577 @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains
578 a set of ISO 639-2 or RFC 4646 language codes that the Unicode
579 string table supports. Language must be a member of this set.
580 If Iso639Language is TRUE, then this string contains one or more
581 ISO 639-2 language codes with no separator characters.
582 If Iso639Language is FALSE, then is string contains one or more
583 RFC 4646 language codes separated by ';'.
584 @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE
585 is defined in "Related Definitions".
586 @param UnicodeString A pointer to the Unicode string to add.
587 @param Iso639Language Specifies the supported language code format. If it is TRUE,
588 then Language and SupportedLanguages follow ISO 639-2 language code format.
589 Otherwise, they follow RFC 4646 language code format.
590
591 @retval EFI_SUCCESS The Unicode string that matches the language specified by
592 Language was found in the table of Unicode strings UnicodeStringTable,
593 and it was returned in UnicodeString.
594 @retval EFI_INVALID_PARAMETER Language is NULL.
595 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
596 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
597 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
598 @retval EFI_ALREADY_STARTED A Unicode string with language Language is already present in
599 UnicodeStringTable.
600 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another Unicode string UnicodeStringTable.
601 @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.
602
603 **/
604 EFI_STATUS
605 EFIAPI
606 AddUnicodeString2 (
607 IN CONST CHAR8 *Language,
608 IN CONST CHAR8 *SupportedLanguages,
609 IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,
610 IN CONST CHAR16 *UnicodeString,
611 IN BOOLEAN Iso639Language
612 );
613
614 /**
615 This function frees the table of Unicode strings in UnicodeStringTable.
616
617 If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.
618 Otherwise, each language code, and each Unicode string in the Unicode string
619 table are freed, and EFI_SUCCESS is returned.
620
621 @param UnicodeStringTable A pointer to the table of Unicode strings.
622
623 @retval EFI_SUCCESS The Unicode string table was freed.
624
625 **/
626 EFI_STATUS
627 EFIAPI
628 FreeUnicodeStringTable (
629 IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable
630 );
631
632
633 /**
634 Returns a pointer to an allocated buffer that contains the contents of a
635 variable retrieved through the UEFI Runtime Service GetVariable(). The
636 returned buffer is allocated using AllocatePool(). The caller is responsible
637 for freeing this buffer with FreePool().
638
639 If Name is NULL, then ASSERT().
640 If Guid is NULL, then ASSERT().
641
642 @param[in] Name The pointer to a Null-terminated Unicode string.
643 @param[in] Guid The pointer to an EFI_GUID structure.
644
645 @retval NULL The variable could not be retrieved.
646 @retval NULL There are not enough resources available for the variable contents.
647 @retval Other A pointer to allocated buffer containing the variable contents.
648
649 **/
650 VOID *
651 EFIAPI
652 GetVariable (
653 IN CONST CHAR16 *Name,
654 IN CONST EFI_GUID *Guid
655 );
656
657 /**
658 Returns a pointer to an allocated buffer that contains the contents of a
659 variable retrieved through the UEFI Runtime Service GetVariable(). This
660 function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables.
661 The returned buffer is allocated using AllocatePool(). The caller is
662 responsible for freeing this buffer with FreePool().
663
664 If Name is NULL, then ASSERT().
665
666 @param[in] Name The pointer to a Null-terminated Unicode string.
667
668 @retval NULL The variable could not be retrieved.
669 @retval NULL There are not enough resources available for the variable contents.
670 @retval Other A pointer to allocated buffer containing the variable contents.
671
672 **/
673 VOID *
674 EFIAPI
675 GetEfiGlobalVariable (
676 IN CONST CHAR16 *Name
677 );
678
679
680 /**
681 Returns a pointer to an allocated buffer that contains the best matching language
682 from a set of supported languages.
683
684 This function supports both ISO 639-2 and RFC 4646 language codes, but language
685 code types may not be mixed in a single call to this function. The language
686 code returned is allocated using AllocatePool(). The caller is responsible for
687 freeing the allocated buffer using FreePool(). This function supports a variable
688 argument list that allows the caller to pass in a prioritized list of language
689 codes to test against all the language codes in SupportedLanguages.
690
691 If SupportedLanguages is NULL, then ASSERT().
692
693 @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that
694 contains a set of language codes in the format
695 specified by Iso639Language.
696 @param[in] Iso639Language If TRUE, then all language codes are assumed to be
697 in ISO 639-2 format. If FALSE, then all language
698 codes are assumed to be in RFC 4646 language format
699 @param[in] ... A variable argument list that contains pointers to
700 Null-terminated ASCII strings that contain one or more
701 language codes in the format specified by Iso639Language.
702 The first language code from each of these language
703 code lists is used to determine if it is an exact or
704 close match to any of the language codes in
705 SupportedLanguages. Close matches only apply to RFC 4646
706 language codes, and the matching algorithm from RFC 4647
707 is used to determine if a close match is present. If
708 an exact or close match is found, then the matching
709 language code from SupportedLanguages is returned. If
710 no matches are found, then the next variable argument
711 parameter is evaluated. The variable argument list
712 is terminated by a NULL.
713
714 @retval NULL The best matching language could not be found in SupportedLanguages.
715 @retval NULL There are not enough resources available to return the best matching
716 language.
717 @retval Other A pointer to a Null-terminated ASCII string that is the best matching
718 language in SupportedLanguages.
719
720 **/
721 CHAR8 *
722 EFIAPI
723 GetBestLanguage (
724 IN CONST CHAR8 *SupportedLanguages,
725 IN BOOLEAN Iso639Language,
726 ...
727 );
728
729 /**
730 Draws a dialog box to the console output device specified by
731 ConOut defined in the EFI_SYSTEM_TABLE and waits for a keystroke
732 from the console input device specified by ConIn defined in the
733 EFI_SYSTEM_TABLE.
734
735 If there are no strings in the variable argument list, then ASSERT().
736 If all the strings in the variable argument list are empty, then ASSERT().
737
738 @param[in] Attribute Specifies the foreground and background color of the popup.
739 @param[out] Key A pointer to the EFI_KEY value of the key that was
740 pressed. This is an optional parameter that may be NULL.
741 If it is NULL then no wait for a keypress will be performed.
742 @param[in] ... The variable argument list that contains pointers to Null-
743 terminated Unicode strings to display in the dialog box.
744 The variable argument list is terminated by a NULL.
745
746 **/
747 VOID
748 EFIAPI
749 CreatePopUp (
750 IN UINTN Attribute,
751 OUT EFI_INPUT_KEY *Key, OPTIONAL
752 ...
753 );
754
755 /**
756 Retrieves the width of a Unicode character.
757
758 This function computes and returns the width of the Unicode character specified
759 by UnicodeChar.
760
761 @param UnicodeChar A Unicode character.
762
763 @retval 0 The width if UnicodeChar could not be determined.
764 @retval 1 UnicodeChar is a narrow glyph.
765 @retval 2 UnicodeChar is a wide glyph.
766
767 **/
768 UINTN
769 EFIAPI
770 GetGlyphWidth (
771 IN CHAR16 UnicodeChar
772 );
773
774 /**
775 Computes the display length of a Null-terminated Unicode String.
776
777 This function computes and returns the display length of the Null-terminated Unicode
778 string specified by String. If String is NULL then 0 is returned. If any of the widths
779 of the Unicode characters in String can not be determined, then 0 is returned. The display
780 width of String can be computed by summing the display widths of each Unicode character
781 in String. Unicode characters that are narrow glyphs have a width of 1, and Unicode
782 characters that are width glyphs have a width of 2.
783 If String is not aligned on a 16-bit boundary, then ASSERT().
784
785 @param String A pointer to a Null-terminated Unicode string.
786
787 @return The display length of the Null-terminated Unicode string specified by String.
788
789 **/
790 UINTN
791 EFIAPI
792 UnicodeStringDisplayLength (
793 IN CONST CHAR16 *String
794 );
795
796 //
797 // Functions that abstract early Framework contamination of UEFI.
798 //
799 /**
800 Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot().
801
802 This function abstracts the signaling of the Ready to Boot Event. The Framework moved
803 from a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller
804 from how this event is created to prevent to code form having to change with the
805 version of the specification supported.
806
807 **/
808 VOID
809 EFIAPI
810 EfiSignalEventReadyToBoot (
811 VOID
812 );
813
814 /**
815 Create, Signal, and Close the Ready to Boot event using EfiSignalEventLegacyBoot().
816
817 This function abstracts the signaling of the Legacy Boot Event. The Framework moved from
818 a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller from how
819 this event is created to prevent to code form having to change with the version of the
820 specification supported.
821
822 **/
823 VOID
824 EFIAPI
825 EfiSignalEventLegacyBoot (
826 VOID
827 );
828
829 /**
830 Creates an EFI event in the Legacy Boot Event Group.
831
832 Prior to UEFI 2.0 this was done via a non blessed UEFI extensions and this library
833 abstracts the implementation mechanism of this event from the caller. This function
834 abstracts the creation of the Legacy Boot Event. The Framework moved from a proprietary
835 to UEFI 2.0 based mechanism. This library abstracts the caller from how this event
836 is created to prevent to code form having to change with the version of the
837 specification supported.
838 If LegacyBootEvent is NULL, then ASSERT().
839
840 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
841
842 @retval EFI_SUCCESS The event was created.
843 @retval Other The event was not created.
844
845 **/
846 EFI_STATUS
847 EFIAPI
848 EfiCreateEventLegacyBoot (
849 OUT EFI_EVENT *LegacyBootEvent
850 );
851
852 /**
853 Create an EFI event in the Legacy Boot Event Group and allows
854 the caller to specify a notification function.
855
856 This function abstracts the creation of the Legacy Boot Event.
857 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
858 This library abstracts the caller from how this event is created to prevent
859 to code form having to change with the version of the specification supported.
860 If LegacyBootEvent is NULL, then ASSERT().
861
862 @param NotifyTpl The task priority level of the event.
863 @param NotifyFunction The notification function to call when the event is signaled.
864 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
865 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
866
867 @retval EFI_SUCCESS The event was created.
868 @retval Other The event was not created.
869
870 **/
871 EFI_STATUS
872 EFIAPI
873 EfiCreateEventLegacyBootEx (
874 IN EFI_TPL NotifyTpl,
875 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
876 IN VOID *NotifyContext, OPTIONAL
877 OUT EFI_EVENT *LegacyBootEvent
878 );
879
880 /**
881 Create an EFI event in the Ready To Boot Event Group.
882
883 Prior to UEFI 2.0 this was done via a non-standard UEFI extension, and this library
884 abstracts the implementation mechanism of this event from the caller.
885 This function abstracts the creation of the Ready to Boot Event. The Framework
886 moved from a proprietary to UEFI 2.0-based mechanism. This library abstracts
887 the caller from how this event is created to prevent the code form having to
888 change with the version of the specification supported.
889 If ReadyToBootEvent is NULL, then ASSERT().
890
891 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
892
893 @retval EFI_SUCCESS The event was created.
894 @retval Other The event was not created.
895
896 **/
897 EFI_STATUS
898 EFIAPI
899 EfiCreateEventReadyToBoot (
900 OUT EFI_EVENT *ReadyToBootEvent
901 );
902
903 /**
904 Create an EFI event in the Ready To Boot Event Group and allows
905 the caller to specify a notification function.
906
907 This function abstracts the creation of the Ready to Boot Event.
908 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
909 This library abstracts the caller from how this event is created to prevent
910 to code form having to change with the version of the specification supported.
911 If ReadyToBootEvent is NULL, then ASSERT().
912
913 @param NotifyTpl The task priority level of the event.
914 @param NotifyFunction The notification function to call when the event is signaled.
915 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
916 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
917
918 @retval EFI_SUCCESS The event was created.
919 @retval Other The event was not created.
920
921 **/
922 EFI_STATUS
923 EFIAPI
924 EfiCreateEventReadyToBootEx (
925 IN EFI_TPL NotifyTpl,
926 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
927 IN VOID *NotifyContext, OPTIONAL
928 OUT EFI_EVENT *ReadyToBootEvent
929 );
930
931 /**
932 Initialize a Firmware Volume (FV) Media Device Path node.
933
934 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.
935 This library function abstracts initializing a device path node.
936 Initialize the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure. This device
937 path changed in the DXE CIS version 0.92 in a non back ward compatible way to
938 not conflict with the UEFI 2.0 specification. This function abstracts the
939 differences from the caller.
940 If FvDevicePathNode is NULL, then ASSERT().
941 If NameGuid is NULL, then ASSERT().
942
943 @param FvDevicePathNode The pointer to a FV device path node to initialize
944 @param NameGuid FV file name to use in FvDevicePathNode
945
946 **/
947 VOID
948 EFIAPI
949 EfiInitializeFwVolDevicepathNode (
950 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,
951 IN CONST EFI_GUID *NameGuid
952 );
953
954 /**
955 Check to see if the Firmware Volume (FV) Media Device Path is valid
956
957 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.
958 This library function abstracts validating a device path node.
959 Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid.
960 If it is valid, then return the GUID file name from the device path node. Otherwise,
961 return NULL. This device path changed in the DXE CIS version 0.92 in a non backward
962 compatible way to not conflict with the UEFI 2.0 specification. This function abstracts
963 the differences from the caller.
964 If FvDevicePathNode is NULL, then ASSERT().
965
966 @param FvDevicePathNode The pointer to FV device path to check.
967
968 @retval NULL FvDevicePathNode is not valid.
969 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.
970
971 **/
972 EFI_GUID *
973 EFIAPI
974 EfiGetNameGuidFromFwVolDevicePathNode (
975 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode
976 );
977
978 /**
979 Prints a formatted Unicode string to the console output device specified by
980 ConOut defined in the EFI_SYSTEM_TABLE.
981
982 This function prints a formatted Unicode string to the console output device
983 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
984 characters that printed to ConOut. If the length of the formatted Unicode
985 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
986 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
987 If Format is NULL, then ASSERT().
988 If Format is not aligned on a 16-bit boundary, then ASSERT().
989 If gST->ConOut is NULL, then ASSERT().
990
991 @param Format A null-terminated Unicode format string.
992 @param ... The variable argument list whose contents are accessed based
993 on the format string specified by Format.
994
995 @return Number of Unicode characters printed to ConOut.
996
997 **/
998 UINTN
999 EFIAPI
1000 Print (
1001 IN CONST CHAR16 *Format,
1002 ...
1003 );
1004
1005 /**
1006 Prints a formatted Unicode string to the console output device specified by
1007 StdErr defined in the EFI_SYSTEM_TABLE.
1008
1009 This function prints a formatted Unicode string to the console output device
1010 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
1011 characters that printed to StdErr. If the length of the formatted Unicode
1012 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
1013 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
1014 If Format is NULL, then ASSERT().
1015 If Format is not aligned on a 16-bit boundary, then ASSERT().
1016 If gST->StdErr is NULL, then ASSERT().
1017
1018 @param Format A null-terminated Unicode format string.
1019 @param ... The variable argument list whose contents are accessed based
1020 on the format string specified by Format.
1021
1022 @return Number of Unicode characters printed to StdErr.
1023
1024 **/
1025 UINTN
1026 EFIAPI
1027 ErrorPrint (
1028 IN CONST CHAR16 *Format,
1029 ...
1030 );
1031
1032 /**
1033 Prints a formatted ASCII string to the console output device specified by
1034 ConOut defined in the EFI_SYSTEM_TABLE.
1035
1036 This function prints a formatted ASCII string to the console output device
1037 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
1038 characters that printed to ConOut. If the length of the formatted ASCII
1039 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
1040 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
1041 If Format is NULL, then ASSERT().
1042 If gST->ConOut is NULL, then ASSERT().
1043
1044 @param Format A null-terminated ASCII format string.
1045 @param ... The variable argument list whose contents are accessed based
1046 on the format string specified by Format.
1047
1048 @return Number of ASCII characters printed to ConOut.
1049
1050 **/
1051 UINTN
1052 EFIAPI
1053 AsciiPrint (
1054 IN CONST CHAR8 *Format,
1055 ...
1056 );
1057
1058 /**
1059 Prints a formatted ASCII string to the console output device specified by
1060 StdErr defined in the EFI_SYSTEM_TABLE.
1061
1062 This function prints a formatted ASCII string to the console output device
1063 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
1064 characters that printed to StdErr. If the length of the formatted ASCII
1065 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
1066 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
1067 If Format is NULL, then ASSERT().
1068 If gST->StdErr is NULL, then ASSERT().
1069
1070 @param Format A null-terminated ASCII format string.
1071 @param ... The variable argument list whose contents are accessed based
1072 on the format string specified by Format.
1073
1074 @return Number of ASCII characters printed to ConErr.
1075
1076 **/
1077 UINTN
1078 EFIAPI
1079 AsciiErrorPrint (
1080 IN CONST CHAR8 *Format,
1081 ...
1082 );
1083
1084
1085 /**
1086 Prints a formatted Unicode string to a graphics console device specified by
1087 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
1088
1089 This function prints a formatted Unicode string to the graphics console device
1090 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
1091 Unicode characters displayed, not including partial characters that may be clipped
1092 by the right edge of the display. If the length of the formatted Unicode string is
1093 greater than PcdUefiLibMaxPrintBufferSize, then at most the first
1094 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
1095 is used to convert the string to a bitmap using the glyphs registered with the
1096 HII database. No wrapping is performed, so any portions of the string the fall
1097 outside the active display region will not be displayed.
1098
1099 If a graphics console device is not associated with the ConsoleOutputHandle
1100 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
1101 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
1102 string is printed, and 0 is returned.
1103 If Format is NULL, then ASSERT().
1104 If Format is not aligned on a 16-bit boundary, then ASSERT().
1105 If gST->ConsoleOutputHandle is NULL, then ASSERT().
1106
1107 @param PointX X coordinate to print the string.
1108 @param PointY Y coordinate to print the string.
1109 @param ForeGround The foreground color of the string being printed. This is
1110 an optional parameter that may be NULL. If it is NULL,
1111 then the foreground color of the current ConOut device
1112 in the EFI_SYSTEM_TABLE is used.
1113 @param BackGround The background color of the string being printed. This is
1114 an optional parameter that may be NULL. If it is NULL,
1115 then the background color of the current ConOut device
1116 in the EFI_SYSTEM_TABLE is used.
1117 @param Format A null-terminated Unicode format string. See Print Library
1118 for the supported format string syntax.
1119 @param ... Variable argument list whose contents are accessed based on
1120 the format string specified by Format.
1121
1122 @return The number of Unicode characters printed.
1123
1124 **/
1125 UINTN
1126 EFIAPI
1127 PrintXY (
1128 IN UINTN PointX,
1129 IN UINTN PointY,
1130 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
1131 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
1132 IN CONST CHAR16 *Format,
1133 ...
1134 );
1135
1136 /**
1137 Prints a formatted ASCII string to a graphics console device specified by
1138 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
1139
1140 This function prints a formatted ASCII string to the graphics console device
1141 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
1142 ASCII characters displayed, not including partial characters that may be clipped
1143 by the right edge of the display. If the length of the formatted ASCII string is
1144 greater than PcdUefiLibMaxPrintBufferSize, then at most the first
1145 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
1146 is used to convert the string to a bitmap using the glyphs registered with the
1147 HII database. No wrapping is performed, so any portions of the string the fall
1148 outside the active display region will not be displayed.
1149
1150 If a graphics console device is not associated with the ConsoleOutputHandle
1151 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
1152 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
1153 string is printed, and 0 is returned.
1154 If Format is NULL, then ASSERT().
1155 If gST->ConsoleOutputHandle is NULL, then ASSERT().
1156
1157 @param PointX X coordinate to print the string.
1158 @param PointY Y coordinate to print the string.
1159 @param ForeGround The foreground color of the string being printed. This is
1160 an optional parameter that may be NULL. If it is NULL,
1161 then the foreground color of the current ConOut device
1162 in the EFI_SYSTEM_TABLE is used.
1163 @param BackGround The background color of the string being printed. This is
1164 an optional parameter that may be NULL. If it is NULL,
1165 then the background color of the current ConOut device
1166 in the EFI_SYSTEM_TABLE is used.
1167 @param Format A null-terminated ASCII format string. See Print Library
1168 for the supported format string syntax.
1169 @param ... The variable argument list whose contents are accessed based on
1170 the format string specified by Format.
1171
1172 @return The number of ASCII characters printed.
1173
1174 **/
1175 UINTN
1176 EFIAPI
1177 AsciiPrintXY (
1178 IN UINTN PointX,
1179 IN UINTN PointY,
1180 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
1181 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
1182 IN CONST CHAR8 *Format,
1183 ...
1184 );
1185
1186 /**
1187 Installs and completes the initialization of a Driver Binding Protocol instance.
1188
1189 Installs the Driver Binding Protocol specified by DriverBinding onto the handle
1190 specified by DriverBindingHandle. If DriverBindingHandle is NULL, then DriverBinding
1191 is installed onto a newly created handle. DriverBindingHandle is typically the same
1192 as the driver's ImageHandle, but it can be different if the driver produces multiple
1193 Driver Binding Protocols.
1194 If DriverBinding is NULL, then ASSERT().
1195 If DriverBinding can not be installed onto a handle, then ASSERT().
1196
1197 @param ImageHandle The image handle of the driver.
1198 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1199 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1200 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1201 parameter is NULL, then a new handle is created.
1202
1203 @retval EFI_SUCCESS The protocol installation completed successfully.
1204 @retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol.
1205 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
1206
1207 **/
1208 EFI_STATUS
1209 EFIAPI
1210 EfiLibInstallDriverBinding (
1211 IN CONST EFI_HANDLE ImageHandle,
1212 IN CONST EFI_SYSTEM_TABLE *SystemTable,
1213 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
1214 IN EFI_HANDLE DriverBindingHandle
1215 );
1216
1217
1218 /**
1219 Installs and completes the initialization of a Driver Binding Protocol instance and
1220 optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.
1221
1222 Initializes a driver by installing the Driver Binding Protocol together with the
1223 optional Component Name, optional Driver Configure and optional Driver Diagnostic
1224 Protocols onto the driver's DriverBindingHandle. If DriverBindingHandle is NULL,
1225 then the protocols are installed onto a newly created handle. DriverBindingHandle
1226 is typically the same as the driver's ImageHandle, but it can be different if the
1227 driver produces multiple Driver Binding Protocols.
1228 If DriverBinding is NULL, then ASSERT().
1229 If the installation fails, then ASSERT().
1230
1231 @param ImageHandle The image handle of the driver.
1232 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1233 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1234 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1235 parameter is NULL, then a new handle is created.
1236 @param ComponentName A Component Name Protocol instance that this driver is producing.
1237 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
1238 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
1239
1240 @retval EFI_SUCCESS The protocol installation completed successfully.
1241 @retval EFI_OUT_OF_RESOURCES There was not enough memory in the pool to install all the protocols.
1242
1243 **/
1244 EFI_STATUS
1245 EFIAPI
1246 EfiLibInstallAllDriverProtocols (
1247 IN CONST EFI_HANDLE ImageHandle,
1248 IN CONST EFI_SYSTEM_TABLE *SystemTable,
1249 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
1250 IN EFI_HANDLE DriverBindingHandle,
1251 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
1252 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
1253 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL
1254 );
1255
1256
1257
1258 /**
1259 Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.
1260
1261 Initializes a driver by installing the Driver Binding Protocol together with the
1262 optional Component Name and optional Component Name 2 protocols onto the driver's
1263 DriverBindingHandle. If DriverBindingHandle is NULL, then the protocols are installed
1264 onto a newly created handle. DriverBindingHandle is typically the same as the driver's
1265 ImageHandle, but it can be different if the driver produces multiple Driver Binding Protocols.
1266 If DriverBinding is NULL, then ASSERT().
1267 If the installation fails, then ASSERT().
1268
1269 @param ImageHandle The image handle of the driver.
1270 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1271 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1272 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1273 parameter is NULL, then a new handle is created.
1274 @param ComponentName A Component Name Protocol instance that this driver is producing.
1275 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
1276
1277 @retval EFI_SUCCESS The protocol installation completed successfully.
1278 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
1279
1280 **/
1281 EFI_STATUS
1282 EFIAPI
1283 EfiLibInstallDriverBindingComponentName2 (
1284 IN CONST EFI_HANDLE ImageHandle,
1285 IN CONST EFI_SYSTEM_TABLE *SystemTable,
1286 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
1287 IN EFI_HANDLE DriverBindingHandle,
1288 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
1289 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL
1290 );
1291
1292
1293 /**
1294 Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver
1295 Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.
1296
1297 Initializes a driver by installing the Driver Binding Protocol together with the optional
1298 Component Name, optional Component Name 2, optional Driver Configuration, optional Driver Configuration 2,
1299 optional Driver Diagnostic, and optional Driver Diagnostic 2 Protocols onto the driver's DriverBindingHandle.
1300 DriverBindingHandle is typically the same as the driver's ImageHandle, but it can be different if the driver
1301 produces multiple Driver Binding Protocols.
1302 If DriverBinding is NULL, then ASSERT().
1303 If the installation fails, then ASSERT().
1304
1305
1306 @param ImageHandle The image handle of the driver.
1307 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1308 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1309 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1310 parameter is NULL, then a new handle is created.
1311 @param ComponentName A Component Name Protocol instance that this driver is producing.
1312 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
1313 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
1314 @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver is producing.
1315 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
1316 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.
1317
1318 @retval EFI_SUCCESS The protocol installation completed successfully.
1319 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
1320
1321 **/
1322 EFI_STATUS
1323 EFIAPI
1324 EfiLibInstallAllDriverProtocols2 (
1325 IN CONST EFI_HANDLE ImageHandle,
1326 IN CONST EFI_SYSTEM_TABLE *SystemTable,
1327 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
1328 IN EFI_HANDLE DriverBindingHandle,
1329 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
1330 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL
1331 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
1332 IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL
1333 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL
1334 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL
1335 );
1336
1337 /**
1338 Appends a formatted Unicode string to a Null-terminated Unicode string
1339
1340 This function appends a formatted Unicode string to the Null-terminated
1341 Unicode string specified by String. String is optional and may be NULL.
1342 Storage for the formatted Unicode string returned is allocated using
1343 AllocatePool(). The pointer to the appended string is returned. The caller
1344 is responsible for freeing the returned string.
1345
1346 If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().
1347 If FormatString is NULL, then ASSERT().
1348 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
1349
1350 @param[in] String A Null-terminated Unicode string.
1351 @param[in] FormatString A Null-terminated Unicode format string.
1352 @param[in] Marker VA_LIST marker for the variable argument list.
1353
1354 @retval NULL There was not enough available memory.
1355 @return Null-terminated Unicode string is that is the formatted
1356 string appended to String.
1357 **/
1358 CHAR16*
1359 EFIAPI
1360 CatVSPrint (
1361 IN CHAR16 *String, OPTIONAL
1362 IN CONST CHAR16 *FormatString,
1363 IN VA_LIST Marker
1364 );
1365
1366 /**
1367 Appends a formatted Unicode string to a Null-terminated Unicode string
1368
1369 This function appends a formatted Unicode string to the Null-terminated
1370 Unicode string specified by String. String is optional and may be NULL.
1371 Storage for the formatted Unicode string returned is allocated using
1372 AllocatePool(). The pointer to the appended string is returned. The caller
1373 is responsible for freeing the returned string.
1374
1375 If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().
1376 If FormatString is NULL, then ASSERT().
1377 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
1378
1379 @param[in] String A Null-terminated Unicode string.
1380 @param[in] FormatString A Null-terminated Unicode format string.
1381 @param[in] ... The variable argument list whose contents are
1382 accessed based on the format string specified by
1383 FormatString.
1384
1385 @retval NULL There was not enough available memory.
1386 @return Null-terminated Unicode string is that is the formatted
1387 string appended to String.
1388 **/
1389 CHAR16 *
1390 EFIAPI
1391 CatSPrint (
1392 IN CHAR16 *String, OPTIONAL
1393 IN CONST CHAR16 *FormatString,
1394 ...
1395 );
1396
1397 #endif