2 Provides library functions for common UEFI operations. Only available to DXE
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.
11 Copyright (c) 2006 - 2008, Intel Corporation<BR>
12 All rights reserved. This program and the accompanying materials
13 are licensed and made available under the terms and conditions of the BSD License
14 which accompanies this distribution. The full text of the license may be found at
15 http://opensource.org/licenses/bsd-license.php
17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
18 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
22 #ifndef __UEFI_LIB_H__
23 #define __UEFI_LIB_H__
25 #include <Protocol/DriverBinding.h>
26 #include <Protocol/DriverConfiguration.h>
27 #include <Protocol/ComponentName.h>
28 #include <Protocol/ComponentName2.h>
29 #include <Protocol/DriverDiagnostics.h>
30 #include <Protocol/DriverDiagnostics2.h>
31 #include <Protocol/GraphicsOutput.h>
33 #include <Library/BaseLib.h>
36 /// Unicode String Table
40 CHAR16
*UnicodeString
;
41 } EFI_UNICODE_STRING_TABLE
;
47 EfiLockUninitialized
= 0,
63 Macro that returns the number of 100 ns units for a specified number of microseconds.
64 Useful for managing EFI timer events.
66 @param Microseconds Number of microseonds.
68 @return The number of 100 ns units equivalent to the number of microseconds specified
72 #define EFI_TIMER_PERIOD_MICROSECONDS(Microseconds) MultU64x32((UINT64)(Microseconds), 10)
76 Macro that returns the number of 100 ns units for a specified number of milliseoconds.
77 Useful for managing EFI timer events.
79 @param Milliseconds Number of milliseconds.
81 @return The number of 100 ns units equivalent to the number of milliseconds specified
85 #define EFI_TIMER_PERIOD_MILLISECONDS(Milliseconds) MultU64x32((UINT64)(Milliseconds), 10000)
89 Macro that returns the number of 100 ns units for a specified number of seoconds.
90 Useful for managing EFI timer events.
92 @param Seconds Number of seconds.
94 @return The number of 100 ns units equivalent to the number of seconds specified
98 #define EFI_TIMER_PERIOD_SECONDS(Seconds) MultU64x32((UINT64)(Seconds), 10000000)
102 Retrieves a pointer to the system configuration table from the EFI System Table
103 based on a specified GUID.
105 This function searches the list of configuration tables stored in the EFI System Table
106 for a table with a GUID that matches TableGuid. If a match is found, then a pointer to
107 the configuration table is returned in Table., and EFI_SUCCESS is returned. If a matching GUID
108 is not found, then EFI_NOT_FOUND is returned.
109 If TableGuid is NULL, then ASSERT().
110 If Table is NULL, then ASSERT().
112 @param TableGuid Pointer to table's GUID type..
113 @param Table Pointer to the table associated with TableGuid in the EFI System Table.
115 @retval EFI_SUCCESS A configuration table matching TableGuid was found.
116 @retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found.
121 EfiGetSystemConfigurationTable (
122 IN EFI_GUID
*TableGuid
,
127 Creates and returns a notification event and registers that event with all the protocol
128 instances specified by ProtocolGuid.
130 This function causes the notification function to be executed for every protocol of type
131 ProtocolGuid instance that exists in the system when this function is invoked.
132 In addition, every time a protocol of type ProtocolGuid instance is installed or reinstalled,
133 the notification function is also executed. This function returns the notification event
135 If ProtocolGuid is NULL, then ASSERT().
136 If NotifyTpl is not a legal TPL value, then ASSERT().
137 If NotifyFunction is NULL, then ASSERT().
138 If Registration is NULL, then ASSERT().
140 @param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired.
141 @param NotifyTpl Supplies the task priority level of the event notifications.
142 @param NotifyFunction Supplies the function to notify when the event is signaled.
143 @param NotifyContext The context parameter to pass to NotifyFunction.
144 @param Registration A pointer to a memory location to receive the registration value.
145 This value is passed to LocateHandle() to obtain new handles that
146 have been added that support the ProtocolGuid-specified protocol.
148 @return The notification event that was created.
153 EfiCreateProtocolNotifyEvent(
154 IN EFI_GUID
*ProtocolGuid
,
155 IN EFI_TPL NotifyTpl
,
156 IN EFI_EVENT_NOTIFY NotifyFunction
,
157 IN VOID
*NotifyContext
, OPTIONAL
158 OUT VOID
**Registration
162 Creates a named event that can be signaled with EfiNamedEventSignal().
164 This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.
165 This event is signaled with EfiNamedEventSignal(). This provides the ability for one or more
166 listeners on the same event named by the GUID specified by Name.
167 If Name is NULL, then ASSERT().
168 If NotifyTpl is not a legal TPL value, then ASSERT().
169 If NotifyFunction is NULL, then ASSERT().
171 @param Name Supplies GUID name of the event.
172 @param NotifyTpl Supplies the task priority level of the event notifications.
173 @param NotifyFunction Supplies the function to notify when the event is signaled.
174 @param NotifyContext The context parameter to pass to NotifyFunction.
175 @param Registration A pointer to a memory location to receive the registration value.
177 @retval EFI_SUCCESS A named event was created.
178 @retval EFI_OUT_OF_RESOURCES There are not enough resource to create the named event.
183 EfiNamedEventListen (
184 IN CONST EFI_GUID
*Name
,
185 IN EFI_TPL NotifyTpl
,
186 IN EFI_EVENT_NOTIFY NotifyFunction
,
187 IN CONST VOID
*NotifyContext
, OPTIONAL
188 OUT VOID
*Registration OPTIONAL
192 Signals a named event created with EfiNamedEventListen().
194 This function signals the named event specified by Name. The named event must have been
195 created with EfiNamedEventListen().
196 If Name is NULL, then ASSERT().
198 @param Name Supplies GUID name of the event.
200 @retval EFI_SUCCESS A named event was signaled.
201 @retval EFI_OUT_OF_RESOURCES There are not enough resource to signal the named event.
206 EfiNamedEventSignal (
207 IN CONST EFI_GUID
*Name
211 Returns the current TPL.
213 This function returns the current TPL. There is no EFI service to directly
214 retrieve the current TPL. Instead, the RaiseTPL() function is used to raise
215 the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level
216 can then immediately be restored back to the current TPL level with a call
219 @return The current TPL.
229 Initializes a basic mutual exclusion lock.
231 This function initializes a basic mutual exclusion lock to the released state
232 and returns the lock. Each lock provides mutual exclusion access at its task
233 priority level. Since there is no preemption or multiprocessor support in EFI,
234 acquiring the lock only consists of raising to the locks TPL.
235 If Lock is NULL, then ASSERT().
236 If Priority is not a valid TPL value, then ASSERT().
238 @param Lock A pointer to the lock data structure to initialize.
239 @param Priority EFI TPL associated with the lock.
247 IN OUT EFI_LOCK
*Lock
,
252 Initializes a basic mutual exclusion lock.
254 This macro initializes the contents of a basic mutual exclusion lock to the
255 released state. Each lock provides mutual exclusion access at its task
256 priority level. Since there is no preemption or multiprocessor support in EFI,
257 acquiring the lock only consists of raising to the locks TPL.
259 @param Priority The task priority level of the lock.
264 #define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \
265 {Priority, TPL_APPLICATION, EfiLockReleased }
269 Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.
271 If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
272 then this macro evaluates the EFI_LOCK structure specified by Lock. If Lock
273 is not in the locked state, then DebugAssert() is called passing in the source
274 filename, source line number, and Lock.
275 If Lock is NULL, then ASSERT().
277 @param LockParameter A pointer to the lock to acquire.
280 #define ASSERT_LOCKED(LockParameter) \
282 if (DebugAssertEnabled ()) { \
283 ASSERT (LockParameter != NULL); \
284 if ((LockParameter)->Lock != EfiLockAcquired) { \
285 _ASSERT (LockParameter not locked); \
292 Acquires ownership of a lock.
294 This function raises the system's current task priority level to the task
295 priority level of the mutual exclusion lock. Then, it places the lock in the
297 If Lock is NULL, then ASSERT().
298 If Lock is not initialized, then ASSERT().
299 If Lock is already in the acquired state, then ASSERT().
301 @param Lock A pointer to the lock to acquire.
311 Acquires ownership of a lock.
313 This function raises the system's current task priority level to the task priority
314 level of the mutual exclusion lock. Then, it attempts to place the lock in the acquired state.
315 If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned.
316 Otherwise, EFI_SUCCESS is returned.
317 If Lock is NULL, then ASSERT().
318 If Lock is not initialized, then ASSERT().
320 @param Lock A pointer to the lock to acquire.
322 @retval EFI_SUCCESS The lock was acquired.
323 @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.
328 EfiAcquireLockOrFail (
333 Releases ownership of a lock.
335 This function transitions a mutual exclusion lock from the acquired state to
336 the released state, and restores the system's task priority level to its
338 If Lock is NULL, then ASSERT().
339 If Lock is not initialized, then ASSERT().
340 If Lock is already in the released state, then ASSERT().
342 @param Lock A pointer to the lock to release.
352 Tests whether a controller handle is being managed by a specific driver.
354 This function tests whether the driver specified by DriverBindingHandle is
355 currently managing the controller specified by ControllerHandle. This test
356 is performed by evaluating if the the protocol specified by ProtocolGuid is
357 present on ControllerHandle and is was opened by DriverBindingHandle with an
358 attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.
359 If ProtocolGuid is NULL, then ASSERT().
361 @param ControllerHandle A handle for a controller to test.
362 @param DriverBindingHandle Specifies the driver binding handle for the
364 @param ProtocolGuid Specifies the protocol that the driver specified
365 by DriverBindingHandle opens in its Start()
368 @retval EFI_SUCCESS ControllerHandle is managed by the driver
369 specifed by DriverBindingHandle.
370 @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
371 specifed by DriverBindingHandle.
376 EfiTestManagedDevice (
377 IN CONST EFI_HANDLE ControllerHandle
,
378 IN CONST EFI_HANDLE DriverBindingHandle
,
379 IN CONST EFI_GUID
*ProtocolGuid
383 Tests whether a child handle is a child device of the controller.
385 This function tests whether ChildHandle is one of the children of
386 ControllerHandle. This test is performed by checking to see if the protocol
387 specified by ProtocolGuid is present on ControllerHandle and opened by
388 ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
389 If ProtocolGuid is NULL, then ASSERT().
391 @param ControllerHandle A handle for a (parent) controller to test.
392 @param ChildHandle A child handle to test.
393 @param ProtocolGuid Supplies the protocol that the child controller
394 opens on its parent controller.
396 @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.
397 @retval EFI_UNSUPPORTED ChildHandle is not a child of the
404 IN CONST EFI_HANDLE ControllerHandle
,
405 IN CONST EFI_HANDLE ChildHandle
,
406 IN CONST EFI_GUID
*ProtocolGuid
410 This function looks up a Unicode string in UnicodeStringTable.
412 If Language is a member of SupportedLanguages and a Unicode string is found in
413 UnicodeStringTable that matches the language code specified by Language, then it
414 is returned in UnicodeString.
416 @param Language A pointer to the ISO 639-2 language code for the
417 Unicode string to look up and return.
418 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
419 that the Unicode string table supports. Language
420 must be a member of this set.
421 @param UnicodeStringTable A pointer to the table of Unicode strings.
422 @param UnicodeString A pointer to the Unicode string from UnicodeStringTable
423 that matches the language specified by Language.
425 @retval EFI_SUCCESS The Unicode string that matches the language
426 specified by Language was found
427 in the table of Unicoide strings UnicodeStringTable,
428 and it was returned in UnicodeString.
429 @retval EFI_INVALID_PARAMETER Language is NULL.
430 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
431 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
432 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
433 @retval EFI_UNSUPPORTED The language specified by Language is not a
434 member of SupportedLanguages.
435 @retval EFI_UNSUPPORTED The language specified by Language is not
436 supported by UnicodeStringTable.
441 LookupUnicodeString (
442 IN CONST CHAR8
*Language
,
443 IN CONST CHAR8
*SupportedLanguages
,
444 IN CONST EFI_UNICODE_STRING_TABLE
*UnicodeStringTable
,
445 OUT CHAR16
**UnicodeString
449 This function looks up a Unicode string in UnicodeStringTable.
451 If Language is a member of SupportedLanguages and a Unicode string is found in
452 UnicodeStringTable that matches the language code specified by Language, then
453 it is returned in UnicodeString.
455 @param Language A pointer to an ASCII string containing the ISO 639-2 or the
456 RFC 4646 language code for the Unicode string to look up and
457 return. If Iso639Language is TRUE, then this ASCII string is
458 not assumed to be Null-terminated, and only the first three
459 chacters are used. If Iso639Language is FALSE, then this ASCII
460 string must be Null-terminated.
461 @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains a
462 set of ISO 639-2 or RFC 4646 language codes that the Unicode
463 string table supports. Language must be a member of this set.
464 If Iso639Language is TRUE, then this string contains one or more
465 ISO 639-2 language codes with no separator characters. If Iso639Language
466 is FALSE, then is string contains one or more RFC 4646 language
467 codes separated by ';'.
468 @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE
469 is defined in "Related Definitions".
470 @param UnicodeString A pointer to the Null-terminated Unicode string from UnicodeStringTable
471 that matches the language specified by Language.
472 @param Iso639Language Specifies the supported language code format. If it is TRUE, then
473 Language and SupportedLanguages follow ISO 639-2 language code format.
474 Otherwise, they follow RFC 4646 language code format.
477 @retval EFI_SUCCESS The Unicode string that matches the language specified by Language
478 was found in the table of Unicode strings UnicodeStringTable, and
479 it was returned in UnicodeString.
480 @retval EFI_INVALID_PARAMETER Language is NULL.
481 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
482 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
483 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
484 @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.
485 @retval EFI_UNSUPPORTED The language specified by Language is not supported by UnicodeStringTable.
490 LookupUnicodeString2 (
491 IN CONST CHAR8
*Language
,
492 IN CONST CHAR8
*SupportedLanguages
,
493 IN CONST EFI_UNICODE_STRING_TABLE
*UnicodeStringTable
,
494 OUT CHAR16
**UnicodeString
,
495 IN BOOLEAN Iso639Language
499 This function adds a Unicode string to UnicodeStringTable.
501 If Language is a member of SupportedLanguages then UnicodeString is added to
502 UnicodeStringTable. New buffers are allocated for both Language and
503 UnicodeString. The contents of Language and UnicodeString are copied into
504 these new buffers. These buffers are automatically freed when
505 FreeUnicodeStringTable() is called.
507 @param Language A pointer to the ISO 639-2 language code for the Unicode
509 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
510 that the Unicode string table supports.
511 Language must be a member of this set.
512 @param UnicodeStringTable A pointer to the table of Unicode strings.
513 @param UnicodeString A pointer to the Unicode string to add.
515 @retval EFI_SUCCESS The Unicode string that matches the language
516 specified by Language was found in the table of
517 Unicode strings UnicodeStringTable, and it was
518 returned in UnicodeString.
519 @retval EFI_INVALID_PARAMETER Language is NULL.
520 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
521 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
522 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
523 @retval EFI_ALREADY_STARTED A Unicode string with language Language is
524 already present in UnicodeStringTable.
525 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another
526 Unicode string to UnicodeStringTable.
527 @retval EFI_UNSUPPORTED The language specified by Language is not a
528 member of SupportedLanguages.
534 IN CONST CHAR8
*Language
,
535 IN CONST CHAR8
*SupportedLanguages
,
536 IN EFI_UNICODE_STRING_TABLE
**UnicodeStringTable
,
537 IN CONST CHAR16
*UnicodeString
541 This function adds the Null-terminated Unicode string specified by UnicodeString
542 to UnicodeStringTable.
544 If Language is a member of SupportedLanguages then UnicodeString is added to
545 UnicodeStringTable. New buffers are allocated for both Language and UnicodeString.
546 The contents of Language and UnicodeString are copied into these new buffers.
547 These buffers are automatically freed when EfiLibFreeUnicodeStringTable() is called.
549 @param Language A pointer to an ASCII string containing the ISO 639-2 or
550 the RFC 4646 language code for the Unicode string to add.
551 If Iso639Language is TRUE, then this ASCII string is not
552 assumed to be Null-terminated, and only the first three
553 chacters are used. If Iso639Language is FALSE, then this
554 ASCII string must be Null-terminated.
555 @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains
556 a set of ISO 639-2 or RFC 4646 language codes that the Unicode
557 string table supports. Language must be a member of this set.
558 If Iso639Language is TRUE, then this string contains one or more
559 ISO 639-2 language codes with no separator characters.
560 If Iso639Language is FALSE, then is string contains one or more
561 RFC 4646 language codes separated by ';'.
562 @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE
563 is defined in "Related Definitions".
564 @param UnicodeString A pointer to the Unicode string to add.
565 @param Iso639Language Specifies the supported language code format. If it is TRUE,
566 then Language and SupportedLanguages follow ISO 639-2 language code format.
567 Otherwise, they follow RFC 4646 language code format.
569 @retval EFI_SUCCESS The Unicode string that matches the language specified by
570 Language was found in the table of Unicode strings UnicodeStringTable,
571 and it was returned in UnicodeString.
572 @retval EFI_INVALID_PARAMETER Language is NULL.
573 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
574 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
575 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
576 @retval EFI_ALREADY_STARTED A Unicode string with language Language is already present in
578 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another Unicode string UnicodeStringTable.
579 @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.
585 IN CONST CHAR8
*Language
,
586 IN CONST CHAR8
*SupportedLanguages
,
587 IN EFI_UNICODE_STRING_TABLE
**UnicodeStringTable
,
588 IN CONST CHAR16
*UnicodeString
,
589 IN BOOLEAN Iso639Language
593 This function frees the table of Unicode strings in UnicodeStringTable.
595 If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.
596 Otherwise, each language code, and each Unicode string in the Unicode string
597 table are freed, and EFI_SUCCESS is returned.
599 @param UnicodeStringTable A pointer to the table of Unicode strings.
601 @retval EFI_SUCCESS The Unicode string table was freed.
606 FreeUnicodeStringTable (
607 IN EFI_UNICODE_STRING_TABLE
*UnicodeStringTable
611 Retrieves the width of a Unicode character.
613 This function computes and returns the width of the Unicode character specified
616 @param UnicodeChar A Unicode character.
618 @retval 0 The width if UnicodeChar could not be determined.
619 @retval 1 UnicodeChar is a narrow glyph.
620 @retval 2 UnicodeChar is a wide glyph.
626 IN CHAR16 UnicodeChar
630 Computes the display length of a Null-terminated Unicode String.
632 This function computes and returns the display length of the Null-terminated Unicode
633 string specified by String. If String is NULL then 0 is returned. If any of the widths
634 of the Unicode characters in String can not be determined, then 0 is returned. The display
635 width of String can be computed by summing the display widths of each Unicode character
636 in String. Unicode characters that are narrow glyphs have a width of 1, and Unicode
637 characters that are width glyphs have a width of 2.
638 If String is not aligned on a 16-bit boundary, then ASSERT().
640 @param String A pointer to a Null-terminated Unicode string.
642 @return The display length of the Null-terminated Unicode string specified by String.
647 UnicodeStringDisplayLength (
648 IN CONST CHAR16
*String
652 // Functions that abstract early Framework contamination of UEFI.
655 Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot().
657 This function abstracts the signaling of the Ready to Boot Event. The Framework moved
658 from a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller
659 from how this event is created to prevent to code form having to change with the
660 version of the specification supported.
665 EfiSignalEventReadyToBoot (
670 Create, Signal, and Close the Ready to Boot event using EfiSignalEventLegacyBoot().
672 This function abstracts the signaling of the Legacy Boot Event. The Framework moved from
673 a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller from how
674 this event is created to prevent to code form having to change with the version of the
675 specification supported.
680 EfiSignalEventLegacyBoot (
685 Creates an EFI event in the Legacy Boot Event Group.
687 Prior to UEFI 2.0 this was done via a non blessed UEFI extensions and this library
688 abstracts the implementation mechanism of this event from the caller. This function
689 abstracts the creation of the Legacy Boot Event. The Framework moved from a proprietary
690 to UEFI 2.0 based mechanism. This library abstracts the caller from how this event
691 is created to prevent to code form having to change with the version of the
692 specification supported.
693 If LegacyBootEvent is NULL, then ASSERT().
695 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
697 @retval EFI_SUCCESS Event was created.
698 @retval Other Event was not created.
703 EfiCreateEventLegacyBoot (
704 OUT EFI_EVENT
*LegacyBootEvent
708 Create an EFI event in the Legacy Boot Event Group and allows
709 the caller to specify a notification function.
711 This function abstracts the creation of the Legacy Boot Event.
712 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
713 This library abstracts the caller from how this event is created to prevent
714 to code form having to change with the version of the specification supported.
715 If LegacyBootEvent is NULL, then ASSERT().
717 @param NotifyTpl The task priority level of the event.
718 @param NotifyFunction The notification function to call when the event is signaled.
719 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
720 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
722 @retval EFI_SUCCESS Event was created.
723 @retval Other Event was not created.
728 EfiCreateEventLegacyBootEx (
729 IN EFI_TPL NotifyTpl
,
730 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
731 IN VOID
*NotifyContext
, OPTIONAL
732 OUT EFI_EVENT
*LegacyBootEvent
736 Create an EFI event in the Ready To Boot Event Group.
738 Prior to UEFI 2.0 this was done via a non-standard UEFI extension, and this library
739 abstracts the implementation mechanism of this event from the caller.
740 This function abstracts the creation of the Ready to Boot Event. The Framework
741 moved from a proprietary to UEFI 2.0-based mechanism. This library abstracts
742 the caller from how this event is created to prevent the code form having to
743 change with the version of the specification supported.
744 If ReadyToBootEvent is NULL, then ASSERT().
746 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
748 @retval EFI_SUCCESS Event was created.
749 @retval Other Event was not created.
754 EfiCreateEventReadyToBoot (
755 OUT EFI_EVENT
*ReadyToBootEvent
759 Create an EFI event in the Ready To Boot Event Group and allows
760 the caller to specify a notification function.
762 This function abstracts the creation of the Ready to Boot Event.
763 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
764 This library abstracts the caller from how this event is created to prevent
765 to code form having to change with the version of the specification supported.
766 If ReadyToBootEvent is NULL, then ASSERT().
768 @param NotifyTpl The task priority level of the event.
769 @param NotifyFunction The notification function to call when the event is signaled.
770 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
771 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
773 @retval EFI_SUCCESS Event was created.
774 @retval Other Event was not created.
779 EfiCreateEventReadyToBootEx (
780 IN EFI_TPL NotifyTpl
,
781 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
782 IN VOID
*NotifyContext
, OPTIONAL
783 OUT EFI_EVENT
*ReadyToBootEvent
787 Initialize a Firmware Volume (FV) Media Device Path node.
789 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.
790 This library function abstracts initializing a device path node.
791 Initialize the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure. This device
792 path changed in the DXE CIS version 0.92 in a non back ward compatible way to
793 not conflict with the UEFI 2.0 specification. This function abstracts the
794 differences from the caller.
795 If FvDevicePathNode is NULL, then ASSERT().
796 If NameGuid is NULL, then ASSERT().
798 @param FvDevicePathNode Pointer to a FV device path node to initialize
799 @param NameGuid FV file name to use in FvDevicePathNode
804 EfiInitializeFwVolDevicepathNode (
805 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvDevicePathNode
,
806 IN CONST EFI_GUID
*NameGuid
810 Check to see if the Firmware Volume (FV) Media Device Path is valid
812 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.
813 This library function abstracts validating a device path node.
814 Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid.
815 If it is valid, then return the GUID file name from the device path node. Otherwise,
816 return NULL. This device path changed in the DXE CIS version 0.92 in a non back ward
817 compatible way to not conflict with the UEFI 2.0 specification. This function abstracts
818 the differences from the caller.
819 If FvDevicePathNode is NULL, then ASSERT().
821 @param FvDevicePathNode Pointer to FV device path to check.
823 @retval NULL FvDevicePathNode is not valid.
824 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.
829 EfiGetNameGuidFromFwVolDevicePathNode (
830 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvDevicePathNode
834 Prints a formatted Unicode string to the console output device specified by
835 ConOut defined in the EFI_SYSTEM_TABLE.
837 This function prints a formatted Unicode string to the console output device
838 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
839 characters that printed to ConOut. If the length of the formatted Unicode
840 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
841 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
842 If Format is NULL, then ASSERT().
843 If Format is not aligned on a 16-bit boundary, then ASSERT().
845 @param Format Null-terminated Unicode format string.
846 @param ... Variable argument list whose contents are accessed based
847 on the format string specified by Format.
849 @return Number of Unicode characters printed to ConOut.
855 IN CONST CHAR16
*Format
,
860 Prints a formatted Unicode string to the console output device specified by
861 StdErr defined in the EFI_SYSTEM_TABLE.
863 This function prints a formatted Unicode string to the console output device
864 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
865 characters that printed to StdErr. If the length of the formatted Unicode
866 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
867 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
868 If Format is NULL, then ASSERT().
869 If Format is not aligned on a 16-bit boundary, then ASSERT().
871 @param Format Null-terminated Unicode format string.
872 @param ... Variable argument list whose contents are accessed based
873 on the format string specified by Format.
875 @return Number of Unicode characters printed to StdErr.
881 IN CONST CHAR16
*Format
,
886 Prints a formatted ASCII string to the console output device specified by
887 ConOut defined in the EFI_SYSTEM_TABLE.
889 This function prints a formatted ASCII string to the console output device
890 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
891 characters that printed to ConOut. If the length of the formatted ASCII
892 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
893 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
894 If Format is NULL, then ASSERT().
896 @param Format Null-terminated ASCII format string.
897 @param ... Variable argument list whose contents are accessed based
898 on the format string specified by Format.
900 @return Number of ASCII characters printed to ConOut.
906 IN CONST CHAR8
*Format
,
911 Prints a formatted ASCII string to the console output device specified by
912 StdErr defined in the EFI_SYSTEM_TABLE.
914 This function prints a formatted ASCII string to the console output device
915 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
916 characters that printed to StdErr. If the length of the formatted ASCII
917 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
918 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
919 If Format is NULL, then ASSERT().
921 @param Format Null-terminated ASCII format string.
922 @param ... Variable argument list whose contents are accessed based
923 on the format string specified by Format.
925 @return Number of ASCII characters printed to ConErr.
931 IN CONST CHAR8
*Format
,
936 Prints a formatted Unicode string to a graphics console device specified by
937 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
939 This function prints a formatted Unicode string to the graphics console device
940 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
941 Unicode characters printed. If the length of the formatted Unicode string is
942 greater than PcdUefiLibMaxPrintBufferSize, then only the first
943 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
944 is used to convert the string to a bitmap using the glyphs registered with the
945 HII database. No wrapping is performed, so any portions of the string the fall
946 outside the active display region will not be displayed.
948 If a graphics console device is not associated with the ConsoleOutputHandle
949 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
950 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
951 string is printed, and 0 is returned.
952 If Format is NULL, then ASSERT().
953 If Format is not aligned on a 16-bit boundary, then ASSERT().
955 @param X X coordinate to print the string.
956 @param Y Y coordinate to print the string.
957 @param ForeGround The forground color of the string being printed. This is
958 an optional parameter that may be NULL. If it is NULL,
959 then the foreground color of the current ConOut device
960 in the EFI_SYSTEM_TABLE is used.
961 @param BackGround The background color of the string being printed. This is
962 an optional parameter that may be NULL. If it is NULL,
963 then the background color of the current ConOut device
964 in the EFI_SYSTEM_TABLE is used.
965 @param Format Null-terminated Unicode format string. See Print Library
966 for the supported format string syntax.
967 @param ... Variable argument list whose contents are accessed based on
968 the format string specified by Format.
970 @return The number of Unicode characters printed.
978 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*ForeGround
, OPTIONAL
979 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*BackGround
, OPTIONAL
980 IN CONST CHAR16
*Format
,
985 Prints a formatted ASCII string to a graphics console device specified by
986 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
988 This function prints a formatted ASCII string to the graphics console device
989 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
990 ASCII characters printed. If the length of the formatted ASCII string is
991 greater than PcdUefiLibMaxPrintBufferSize, then only the first
992 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
993 is used to convert the string to a bitmap using the glyphs registered with the
994 HII database. No wrapping is performed, so any portions of the string the fall
995 outside the active display region will not be displayed.
997 If a graphics console device is not associated with the ConsoleOutputHandle
998 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
999 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
1000 string is printed, and 0 is returned.
1001 If Format is NULL, then ASSERT().
1003 @param X X coordinate to print the string.
1004 @param Y Y coordinate to print the string.
1005 @param ForeGround The forground color of the string being printed. This is
1006 an optional parameter that may be NULL. If it is NULL,
1007 then the foreground color of the current ConOut device
1008 in the EFI_SYSTEM_TABLE is used.
1009 @param BackGround The background color of the string being printed. This is
1010 an optional parameter that may be NULL. If it is NULL,
1011 then the background color of the current ConOut device
1012 in the EFI_SYSTEM_TABLE is used.
1013 @param Format Null-terminated ASCII format string. See Print Library
1014 for the supported format string syntax.
1015 @param ... Variable argument list whose contents are accessed based on
1016 the format string specified by Format.
1018 @return The number of ASCII characters printed.
1026 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*ForeGround
, OPTIONAL
1027 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*BackGround
, OPTIONAL
1028 IN CONST CHAR8
*Format
,
1033 Installs and completes the initialization of a Driver Binding Protocol instance.
1035 Installs the Driver Binding Protocol specified by DriverBinding onto the handle
1036 specified by DriverBindingHandle. If DriverBindingHandle is NULL, then DriverBinding
1037 is installed onto a newly created handle. DriverBindingHandle is typically the same
1038 as the driver's ImageHandle, but it can be different if the driver produces multiple
1039 Driver Binding Protocols.
1040 If DriverBinding is NULL, then ASSERT().
1041 If DriverBinding can not be installed onto a handle, then ASSERT().
1043 @param ImageHandle The image handle of the driver.
1044 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1045 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1046 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1047 parameter is NULL, then a new handle is created.
1049 @retval EFI_SUCCESS The protocol installation is completed successfully.
1050 @retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol.
1051 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
1056 EfiLibInstallDriverBinding (
1057 IN CONST EFI_HANDLE ImageHandle
,
1058 IN CONST EFI_SYSTEM_TABLE
*SystemTable
,
1059 IN EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
,
1060 IN EFI_HANDLE DriverBindingHandle
1065 Installs and completes the initialization of a Driver Binding Protocol instance and
1066 optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.
1068 Initializes a driver by installing the Driver Binding Protocol together with the
1069 optional Component Name, optional Driver Configure and optional Driver Diagnostic
1070 Protocols onto the driver's DriverBindingHandle. If DriverBindingHandle is NULL,
1071 then the protocols are installed onto a newly created handle. DriverBindingHandle
1072 is typically the same as the driver's ImageHandle, but it can be different if the
1073 driver produces multiple Driver Binding Protocols.
1074 If DriverBinding is NULL, then ASSERT().
1075 If the installation fails, then ASSERT().
1077 @param ImageHandle The image handle of the driver.
1078 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1079 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1080 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1081 parameter is NULL, then a new handle is created.
1082 @param ComponentName A Component Name Protocol instance that this driver is producing.
1083 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
1084 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
1086 @retval EFI_SUCCESS The protocol installation is completed successfully.
1087 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
1092 EfiLibInstallAllDriverProtocols (
1093 IN CONST EFI_HANDLE ImageHandle
,
1094 IN CONST EFI_SYSTEM_TABLE
*SystemTable
,
1095 IN EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
,
1096 IN EFI_HANDLE DriverBindingHandle
,
1097 IN CONST EFI_COMPONENT_NAME_PROTOCOL
*ComponentName
, OPTIONAL
1098 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL
*DriverConfiguration
, OPTIONAL
1099 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL
*DriverDiagnostics OPTIONAL
1105 Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.
1107 Initializes a driver by installing the Driver Binding Protocol together with the
1108 optional Component Name and optional Component Name 2 protocols onto the driver's
1109 DriverBindingHandle. If DriverBindingHandle is NULL, then the protocols are installed
1110 onto a newly created handle. DriverBindingHandle is typically the same as the driver's
1111 ImageHandle, but it can be different if the driver produces multiple Driver Binding Protocols.
1112 If DriverBinding is NULL, then ASSERT().
1113 If the installation fails, then ASSERT().
1115 @param ImageHandle The image handle of the driver.
1116 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1117 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1118 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1119 parameter is NULL, then a new handle is created.
1120 @param ComponentName A Component Name Protocol instance that this driver is producing.
1121 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
1123 @retval EFI_SUCCESS The protocol installation is completed successfully.
1124 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
1129 EfiLibInstallDriverBindingComponentName2 (
1130 IN CONST EFI_HANDLE ImageHandle
,
1131 IN CONST EFI_SYSTEM_TABLE
*SystemTable
,
1132 IN EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
,
1133 IN EFI_HANDLE DriverBindingHandle
,
1134 IN CONST EFI_COMPONENT_NAME_PROTOCOL
*ComponentName
, OPTIONAL
1135 IN CONST EFI_COMPONENT_NAME2_PROTOCOL
*ComponentName2 OPTIONAL
1140 Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver
1141 Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.
1143 Initializes a driver by installing the Driver Binding Protocol together with the optional
1144 Component Name, optional Component Name 2, optional Driver Configuration, optional Driver
1145 Configuration 2, optional Driver Diagnostic, and optional Driver Diagnostic 2 Protocols
1146 onto the driver's DriverBindingHandle. DriverBindingHandle is typically the same as the
1147 driver's ImageHandle, but it can be different if the driver produces multiple Driver Binding Protocols.
1148 If DriverBinding is NULL, then ASSERT().
1149 If the installation fails, then ASSERT().
1151 @param ImageHandle The image handle of the driver.
1152 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1153 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1154 @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this
1155 parameter is NULL, then a new handle is created.
1156 @param ComponentName A Component Name Protocol instance that this driver is producing.
1157 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
1158 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
1159 @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver is producing.
1160 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
1161 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.
1163 @retval EFI_SUCCESS The protocol installation is completed successfully.
1164 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
1169 EfiLibInstallAllDriverProtocols2 (
1170 IN CONST EFI_HANDLE ImageHandle
,
1171 IN CONST EFI_SYSTEM_TABLE
*SystemTable
,
1172 IN EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
,
1173 IN EFI_HANDLE DriverBindingHandle
,
1174 IN CONST EFI_COMPONENT_NAME_PROTOCOL
*ComponentName
, OPTIONAL
1175 IN CONST EFI_COMPONENT_NAME2_PROTOCOL
*ComponentName2
, OPTIONAL
1176 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL
*DriverConfiguration
, OPTIONAL
1177 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL
*DriverConfiguration2
, OPTIONAL
1178 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL
*DriverDiagnostics
, OPTIONAL
1179 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL
*DriverDiagnostics2 OPTIONAL