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
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 This macro initializes the contents of a basic mutual exclusion lock to the
253 released state. Each lock provides mutual exclusion access at its task
254 priority level. Since there is no preemption or multiprocessor support in EFI,
255 acquiring the lock only consists of raising to the locks TPL.
257 @param Priority The task priority level of the lock.
262 #define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \
263 {Priority, TPL_APPLICATION, EfiLockReleased }
268 Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.
270 If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
271 then this macro evaluates the EFI_LOCK structure specified by Lock. If Lock
272 is not in the locked state, then DebugAssert() is called passing in the source
273 filename, source line number, and Lock.
274 If Lock is NULL, then ASSERT().
276 @param LockParameter A pointer to the lock to acquire.
279 #define ASSERT_LOCKED(LockParameter) \
281 if (DebugAssertEnabled ()) { \
282 ASSERT (LockParameter != NULL); \
283 if ((LockParameter)->Lock != EfiLockAcquired) { \
284 _ASSERT (LockParameter not locked); \
291 Acquires ownership of a lock.
293 This function raises the system's current task priority level to the task
294 priority level of the mutual exclusion lock. Then, it places the lock in the
296 If Lock is NULL, then ASSERT().
297 If Lock is not initialized, then ASSERT().
298 If Lock is already in the acquired state, then ASSERT().
300 @param Lock A pointer to the lock to acquire.
310 Acquires ownership of a lock. If the lock is already owned , then an error is returned.
312 This function raises the system's current task priority level to the task
313 priority level of the mutual exclusion lock. Then, it attempts to place the
314 lock in the acquired state.
315 If Lock is NULL, then ASSERT().
316 If Lock is not initialized, then ASSERT().
318 @param Lock A pointer to the lock to acquire.
320 @retval EFI_SUCCESS The lock was acquired.
321 @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.
326 EfiAcquireLockOrFail (
331 Releases ownership of a lock.
333 This function transitions a mutual exclusion lock from the acquired state to
334 the released state, and restores the system's task priority level to its
336 If Lock is NULL, then ASSERT().
337 If Lock is not initialized, then ASSERT().
338 If Lock is already in the released state, then ASSERT().
340 @param Lock A pointer to the lock to release.
350 Tests whether a controller handle is being managed by a specific driver.
352 This function tests whether the driver specified by DriverBindingHandle is
353 currently managing the controller specified by ControllerHandle. This test
354 is performed by evaluating if the the protocol specified by ProtocolGuid is
355 present on ControllerHandle and is was opened by DriverBindingHandle with an
356 attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.
357 If ProtocolGuid is NULL, then ASSERT().
359 @param ControllerHandle A handle for a controller to test.
360 @param DriverBindingHandle Specifies the driver binding handle for the
362 @param ProtocolGuid Specifies the protocol that the driver specified
363 by DriverBindingHandle opens in its Start()
366 @retval EFI_SUCCESS ControllerHandle is managed by the driver
367 specifed by DriverBindingHandle.
368 @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
369 specifed by DriverBindingHandle.
374 EfiTestManagedDevice (
375 IN CONST EFI_HANDLE ControllerHandle
,
376 IN CONST EFI_HANDLE DriverBindingHandle
,
377 IN CONST EFI_GUID
*ProtocolGuid
381 Tests whether a child handle is a child device of the controller.
383 This function tests whether ChildHandle is one of the children of
384 ControllerHandle. This test is performed by checking to see if the protocol
385 specified by ProtocolGuid is present on ControllerHandle and opened by
386 ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
387 If ProtocolGuid is NULL, then ASSERT().
389 @param ControllerHandle A handle for a (parent) controller to test.
390 @param ChildHandle A child handle to test.
391 @param ProtocolGuid Supplies the protocol that the child controller
392 opens on its parent controller.
394 @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.
395 @retval EFI_UNSUPPORTED ChildHandle is not a child of the
402 IN CONST EFI_HANDLE ControllerHandle
,
403 IN CONST EFI_HANDLE ChildHandle
,
404 IN CONST EFI_GUID
*ProtocolGuid
408 This function looks up a Unicode string in UnicodeStringTable.
410 If Language is a member of SupportedLanguages and a Unicode string is found in
411 UnicodeStringTable that matches the language code specified by Language, then it
412 is returned in UnicodeString.
414 @param Language A pointer to the ISO 639-2 language code for the
415 Unicode string to look up and return.
416 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
417 that the Unicode string table supports. Language
418 must be a member of this set.
419 @param UnicodeStringTable A pointer to the table of Unicode strings.
420 @param UnicodeString A pointer to the Unicode string from UnicodeStringTable
421 that matches the language specified by Language.
423 @retval EFI_SUCCESS The Unicode string that matches the language
424 specified by Language was found
425 in the table of Unicoide strings UnicodeStringTable,
426 and it was returned in UnicodeString.
427 @retval EFI_INVALID_PARAMETER Language is NULL.
428 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
429 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
430 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
431 @retval EFI_UNSUPPORTED The language specified by Language is not a
432 member of SupportedLanguages.
433 @retval EFI_UNSUPPORTED The language specified by Language is not
434 supported by UnicodeStringTable.
439 LookupUnicodeString (
440 IN CONST CHAR8
*Language
,
441 IN CONST CHAR8
*SupportedLanguages
,
442 IN CONST EFI_UNICODE_STRING_TABLE
*UnicodeStringTable
,
443 OUT CHAR16
**UnicodeString
447 This function looks up a Unicode string in UnicodeStringTable.
448 If Language is a member of SupportedLanguages and a Unicode
449 string is found in UnicodeStringTable that matches the
450 language code specified by Language, then it is returned in
453 @param Language A pointer to the ISO 639-2 or
454 RFC 3066 language code for the
455 Unicode string to look up and
457 @param SupportedLanguages A pointer to the set of ISO
458 639-2 or RFC 3066 language
459 codes that the Unicode string
460 table supports. Language must
461 be a member of this set.
462 @param UnicodeStringTable A pointer to the table of
464 @param UnicodeString A pointer to the Unicode
465 string from UnicodeStringTable
466 that matches the language
467 specified by Language.
468 @param Iso639Language Specify the language code
469 format supported. If true,
470 then the format follow ISO
471 639-2. If false, then it
473 @retval EFI_SUCCESS The Unicode string that
474 matches the language specified
475 by Language was found in the
476 table of Unicoide strings
477 UnicodeStringTable, and it was
478 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
485 Language is not a member
486 ofSupportedLanguages.
487 @retval EFI_UNSUPPORTED The language specified by
488 Language is not supported by
494 LookupUnicodeString2 (
495 IN CONST CHAR8
*Language
,
496 IN CONST CHAR8
*SupportedLanguages
,
497 IN CONST EFI_UNICODE_STRING_TABLE
*UnicodeStringTable
,
498 OUT CHAR16
**UnicodeString
,
499 IN BOOLEAN Iso639Language
503 This function adds a Unicode string to UnicodeStringTable.
505 If Language is a member of SupportedLanguages then UnicodeString is added to
506 UnicodeStringTable. New buffers are allocated for both Language and
507 UnicodeString. The contents of Language and UnicodeString are copied into
508 these new buffers. These buffers are automatically freed when
509 FreeUnicodeStringTable() is called.
511 @param Language A pointer to the ISO 639-2 language code for the Unicode
513 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
514 that the Unicode string table supports.
515 Language must be a member of this set.
516 @param UnicodeStringTable A pointer to the table of Unicode strings.
517 @param UnicodeString A pointer to the Unicode string to add.
519 @retval EFI_SUCCESS The Unicode string that matches the language
520 specified by Language was found in the table of
521 Unicode strings UnicodeStringTable, and it was
522 returned in UnicodeString.
523 @retval EFI_INVALID_PARAMETER Language is NULL.
524 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
525 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
526 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
527 @retval EFI_ALREADY_STARTED A Unicode string with language Language is
528 already present in UnicodeStringTable.
529 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another
530 Unicode string to UnicodeStringTable.
531 @retval EFI_UNSUPPORTED The language specified by Language is not a
532 member of SupportedLanguages.
538 IN CONST CHAR8
*Language
,
539 IN CONST CHAR8
*SupportedLanguages
,
540 IN EFI_UNICODE_STRING_TABLE
**UnicodeStringTable
,
541 IN CONST CHAR16
*UnicodeString
545 This function adds a Unicode string to UnicodeStringTable.
547 If Language is a member of SupportedLanguages then
548 UnicodeString is added to UnicodeStringTable. New buffers are
549 allocated for both Language and UnicodeString. The contents
550 of Language and UnicodeString are copied into these new
551 buffers. These buffers are automatically freed when
552 FreeUnicodeStringTable() is called.
554 @param Language A pointer to the ISO 639-2 or
555 RFC 3066 language code for the
556 Unicode string to add.
557 @param SupportedLanguages A pointer to the set of ISO
558 639-2 or RFC 3066 language
559 codes that the Unicode string
560 table supports. Language must
561 be a member of this set.
562 @param UnicodeStringTable A pointer to the table of
564 @param UnicodeString A pointer to the Unicode
566 @param Iso639Language Specify the language code
567 format supported. If true,
568 then the format follow ISO
569 639-2. If false, then it
571 @retval EFI_SUCCESS The Unicode string that
572 matches the language specified
573 by Language was found in the
574 table of Unicode strings
575 UnicodeStringTable, and it was
576 returned in UnicodeString.
578 @retval EFI_INVALID_PARAMETER Language is NULL.
579 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
580 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
581 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
582 @retval EFI_ALREADY_STARTED A Unicode string with language
583 Language is already present in
585 @retval EFI_OUT_OF_RESOURCES There is not enough memory to
586 add another Unicode string to
588 @retval EFI_UNSUPPORTED The language specified by
589 Language is not a member of
596 IN CONST CHAR8
*Language
,
597 IN CONST CHAR8
*SupportedLanguages
,
598 IN EFI_UNICODE_STRING_TABLE
**UnicodeStringTable
,
599 IN CONST CHAR16
*UnicodeString
,
600 IN BOOLEAN Iso639Language
604 This function frees the table of Unicode strings in UnicodeStringTable.
606 If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.
607 Otherwise, each language code, and each Unicode string in the Unicode string
608 table are freed, and EFI_SUCCESS is returned.
610 @param UnicodeStringTable A pointer to the table of Unicode strings.
612 @retval EFI_SUCCESS The Unicode string table was freed.
617 FreeUnicodeStringTable (
618 IN EFI_UNICODE_STRING_TABLE
*UnicodeStringTable
622 This function computes and returns the width of the Unicode character
623 specified by UnicodeChar.
625 @param UnicodeChar A Unicode character.
627 @retval 0 The width if UnicodeChar could not be determined.
628 @retval 1 UnicodeChar is a narrow glyph.
629 @retval 2 UnicodeChar is a wide glyph.
635 IN CHAR16 UnicodeChar
639 Computes the display length of a Null-terminated Unicode String.
641 This function computes and returns the display length of
642 the Null-terminated Unicode string specified by String.
643 If String is NULL, then 0 is returned.
644 If any of the widths of the Unicode characters in String
645 can not be determined, then 0 is returned.
647 @param String A pointer to a Null-terminated Unicode string.
649 @return The display length of the Null-terminated Unicode string specified by String.
654 UnicodeStringDisplayLength (
655 IN CONST CHAR16
*String
659 // Functions that abstract early Framework contamination of UEFI.
662 Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot().
664 This function abstracts the signaling of the Ready to Boot Event. The Framework moved
665 from a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller from
666 how this event is created to prevent to code form having to change with the version of
667 the specification supported.
672 EfiSignalEventReadyToBoot (
677 Create, Signal, and Close the Ready to Boot event using EfiSignalEventLegacyBoot().
679 This function abstracts the signaling of the Legacy Boot Event. The Framework moved from
680 a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller from how
681 this event is created to prevent to code form having to change with the version of the
682 specification supported.
687 EfiSignalEventLegacyBoot (
692 Creates an EFI event in the Legacy Boot Event Group. Prior to UEFI 2.0 this
693 was done via a non blessed UEFI extensions and this library abstracts the
694 implementation mechanism of this event from the caller.
696 This function abstracts the creation of the Legacy Boot Event. The Framework
697 moved from a proprietary to UEFI 2.0 based mechanism. This library abstracts
698 the caller from how this event is created to prevent to code form having to
699 change with the version of the specification supported.
700 If LegacyBootEvent is NULL, then ASSERT().
702 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
704 @retval EFI_SUCCESS Event was created.
705 @retval Other Event was not created.
710 EfiCreateEventLegacyBoot (
711 OUT EFI_EVENT
*LegacyBootEvent
715 Create an EFI event in the Legacy Boot Event Group and allows
716 the caller to specify a notification function.
718 This function abstracts the creation of the Legacy Boot Event.
719 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
720 This library abstracts the caller from how this event is created to prevent
721 to code form having to change with the version of the specification supported.
722 If LegacyBootEvent is NULL, then ASSERT().
724 @param NotifyTpl The task priority level of the event.
725 @param NotifyFunction The notification function to call when the event is signaled.
726 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
727 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
729 @retval EFI_SUCCESS Event was created.
730 @retval Other Event was not created.
735 EfiCreateEventLegacyBootEx (
736 IN EFI_TPL NotifyTpl
,
737 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
738 IN VOID
*NotifyContext
, OPTIONAL
739 OUT EFI_EVENT
*LegacyBootEvent
743 Create an EFI event in the Ready To Boot Event Group. Prior to UEFI 2.0 this
744 was done via a non-standard UEFI extension, and this library abstracts the
745 implementation mechanism of this event from the caller.
747 This function abstracts the creation of the Ready to Boot Event. The Framework
748 moved from a proprietary to UEFI 2.0-based mechanism. This library abstracts
749 the caller from how this event is created to prevent the code form having to
750 change with the version of the specification supported.
751 If ReadyToBootEvent is NULL, then ASSERT().
753 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
755 @retval EFI_SUCCESS Event was created.
756 @retval Other Event was not created.
761 EfiCreateEventReadyToBoot (
762 OUT EFI_EVENT
*ReadyToBootEvent
766 Create an EFI event in the Ready To Boot Event Group and allows
767 the caller to specify a notification function.
769 This function abstracts the creation of the Ready to Boot Event.
770 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
771 This library abstracts the caller from how this event is created to prevent
772 to code form having to change with the version of the specification supported.
773 If ReadyToBootEvent is NULL, then ASSERT().
775 @param NotifyTpl The task priority level of the event.
776 @param NotifyFunction The notification function to call when the event is signaled.
777 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
778 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
780 @retval EFI_SUCCESS Event was created.
781 @retval Other Event was not created.
786 EfiCreateEventReadyToBootEx (
787 IN EFI_TPL NotifyTpl
,
788 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
789 IN VOID
*NotifyContext
, OPTIONAL
790 OUT EFI_EVENT
*ReadyToBootEvent
794 Initialize a Firmware Volume (FV) Media Device Path node.
796 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.
797 This library function abstracts initializing a device path node.
798 Initialize the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure. This device
799 path changed in the DXE CIS version 0.92 in a non back ward compatible way to
800 not conflict with the UEFI 2.0 specification. This function abstracts the
801 differences from the caller.
802 If FvDevicePathNode is NULL, then ASSERT().
803 If NameGuid is NULL, then ASSERT().
805 @param FvDevicePathNode Pointer to a FV device path node to initialize
806 @param NameGuid FV file name to use in FvDevicePathNode
811 EfiInitializeFwVolDevicepathNode (
812 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvDevicePathNode
,
813 IN CONST EFI_GUID
*NameGuid
817 Check to see if the Firmware Volume (FV) Media Device Path is valid
819 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.
820 This library function abstracts validating a device path node.
821 Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid.
822 If it is valid, then return the GUID file name from the device path node. Otherwise,
823 return NULL. This device path changed in the DXE CIS version 0.92 in a non back ward
824 compatible way to not conflict with the UEFI 2.0 specification. This function abstracts
825 the differences from the caller.
826 If FvDevicePathNode is NULL, then ASSERT().
828 @param FvDevicePathNode Pointer to FV device path to check.
830 @retval NULL FvDevicePathNode is not valid.
831 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.
836 EfiGetNameGuidFromFwVolDevicePathNode (
837 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvDevicePathNode
841 Prints a formatted Unicode string to the console output device specified by
842 ConOut defined in the EFI_SYSTEM_TABLE.
844 This function prints a formatted Unicode string to the console output device
845 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
846 characters that printed to ConOut. If the length of the formatted Unicode
847 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
848 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
849 If Format is NULL, then ASSERT().
850 If Format is not aligned on a 16-bit boundary, then ASSERT().
852 @param Format Null-terminated Unicode format string.
853 @param ... Variable argument list whose contents are accessed based
854 on the format string specified by Format.
856 @return Number of Unicode characters printed to ConOut.
862 IN CONST CHAR16
*Format
,
867 Prints a formatted Unicode string to the console output device specified by
868 StdErr defined in the EFI_SYSTEM_TABLE.
870 This function prints a formatted Unicode string to the console output device
871 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
872 characters that printed to StdErr. If the length of the formatted Unicode
873 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
874 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
875 If Format is NULL, then ASSERT().
876 If Format is not aligned on a 16-bit boundary, then ASSERT().
878 @param Format Null-terminated Unicode format string.
879 @param ... Variable argument list whose contents are accessed based
880 on the format string specified by Format.
882 @return Number of Unicode characters printed to StdErr.
888 IN CONST CHAR16
*Format
,
893 Prints a formatted ASCII string to the console output device specified by
894 ConOut defined in the EFI_SYSTEM_TABLE.
896 This function prints a formatted ASCII string to the console output device
897 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
898 characters that printed to ConOut. If the length of the formatted ASCII
899 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
900 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
901 If Format is NULL, then ASSERT().
902 If Format is not aligned on a 16-bit boundary, then ASSERT().
904 @param Format Null-terminated ASCII format string.
905 @param ... Variable argument list whose contents are accessed based
906 on the format string specified by Format.
908 @return Number of ASCII characters printed to ConOut.
914 IN CONST CHAR8
*Format
,
919 Prints a formatted ASCII string to the console output device specified by
920 StdErr defined in the EFI_SYSTEM_TABLE.
922 This function prints a formatted ASCII string to the console output device
923 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
924 characters that printed to StdErr. If the length of the formatted ASCII
925 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
926 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
927 If Format is NULL, then ASSERT().
928 If Format is not aligned on a 16-bit boundary, then ASSERT().
930 @param Format Null-terminated ASCII format string.
931 @param ... Variable argument list whose contents are accessed based
932 on the format string specified by Format.
934 @return Number of ASCII characters printed to ConErr.
940 IN CONST CHAR8
*Format
,
945 Prints a formatted Unicode string to a graphics console device specified by
946 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
948 This function prints a formatted Unicode string to the graphics console device
949 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
950 Unicode characters printed. If the length of the formatted Unicode string is
951 greater than PcdUefiLibMaxPrintBufferSize, then only the first
952 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
953 is used to convert the string to a bitmap using the glyphs registered with the
954 HII database. No wrapping is performed, so any portions of the string the fall
955 outside the active display region will not be displayed.
957 If a graphics console device is not associated with the ConsoleOutputHandle
958 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
959 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
960 string is printed, and 0 is returned.
961 If Format is NULL, then ASSERT().
962 If Format is not aligned on a 16-bit boundary, then ASSERT().
964 @param X X coordinate to print the string.
965 @param Y Y coordinate to print the string.
966 @param ForeGround The forground color of the string being printed. This is
967 an optional parameter that may be NULL. If it is NULL,
968 then the foreground color of the current ConOut device
969 in the EFI_SYSTEM_TABLE is used.
970 @param BackGround The background color of the string being printed. This is
971 an optional parameter that may be NULL. If it is NULL,
972 then the background color of the current ConOut device
973 in the EFI_SYSTEM_TABLE is used.
974 @param Format Null-terminated Unicode format string. See Print Library
975 for the supported format string syntax.
976 @param ... Variable argument list whose contents are accessed based on
977 the format string specified by Format.
979 @return The number of Unicode characters printed.
987 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*ForeGround
, OPTIONAL
988 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*BackGround
, OPTIONAL
989 IN CONST CHAR16
*Format
,
994 Prints a formatted ASCII string to a graphics console device specified by
995 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
997 This function prints a formatted ASCII string to the graphics console device
998 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
999 ASCII characters printed. If the length of the formatted ASCII string is
1000 greater than PcdUefiLibMaxPrintBufferSize, then only the first
1001 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
1002 is used to convert the string to a bitmap using the glyphs registered with the
1003 HII database. No wrapping is performed, so any portions of the string the fall
1004 outside the active display region will not be displayed.
1006 If a graphics console device is not associated with the ConsoleOutputHandle
1007 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
1008 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
1009 string is printed, and 0 is returned.
1010 If Format is NULL, then ASSERT().
1011 If Format is not aligned on a 16-bit boundary, then ASSERT().
1013 @param X X coordinate to print the string.
1014 @param Y Y coordinate to print the string.
1015 @param ForeGround The forground color of the string being printed. This is
1016 an optional parameter that may be NULL. If it is NULL,
1017 then the foreground color of the current ConOut device
1018 in the EFI_SYSTEM_TABLE is used.
1019 @param BackGround The background color of the string being printed. This is
1020 an optional parameter that may be NULL. If it is NULL,
1021 then the background color of the current ConOut device
1022 in the EFI_SYSTEM_TABLE is used.
1023 @param Format Null-terminated ASCII format string. See Print Library
1024 for the supported format string syntax.
1025 @param ... Variable argument list whose contents are accessed based on
1026 the format string specified by Format.
1028 @return The number of ASCII characters printed.
1036 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*ForeGround
, OPTIONAL
1037 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*BackGround
, OPTIONAL
1038 IN CONST CHAR8
*Format
,
1043 Initializes a driver by installing the Driver Binding Protocol onto the driver's
1044 DriverBindingHandle.
1046 This is typically the same as the driver's ImageHandle, but
1047 it can be different if the driver produces multiple DriverBinding Protocols.
1048 If the Driver Binding Protocol interface is NULL, then ASSERT ().
1049 If the installation fails, then ASSERT ().
1051 @param ImageHandle The image handle of the driver.
1052 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1053 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1054 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1055 parameter is NULL, then a new handle is created.
1057 @retval EFI_SUCCESS The protocol installation is completed successfully.
1058 @retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol.
1059 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
1064 EfiLibInstallDriverBinding (
1065 IN CONST EFI_HANDLE ImageHandle
,
1066 IN CONST EFI_SYSTEM_TABLE
*SystemTable
,
1067 IN EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
,
1068 IN EFI_HANDLE DriverBindingHandle
1073 Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,
1074 Driver Configure and Driver Diagnostic Protocols onto the driver's DriverBindingHandle.
1076 This is typically the same as the driver's ImageHandle, but it can be different if the driver produces multiple
1077 DriverBinding Protocols.
1078 If the Driver Binding Protocol interface is NULL, then ASSERT ().
1079 If the installation fails, then ASSERT ().
1081 @param ImageHandle The image handle of the driver.
1082 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1083 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1084 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1085 parameter is NULL, then a new handle is created.
1086 @param ComponentName A Component Name Protocol instance that this driver is producing.
1087 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
1088 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
1090 @retval EFI_SUCCESS The protocol installation is completed successfully.
1091 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
1096 EfiLibInstallAllDriverProtocols (
1097 IN CONST EFI_HANDLE ImageHandle
,
1098 IN CONST EFI_SYSTEM_TABLE
*SystemTable
,
1099 IN EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
,
1100 IN EFI_HANDLE DriverBindingHandle
,
1101 IN CONST EFI_COMPONENT_NAME_PROTOCOL
*ComponentName
, OPTIONAL
1102 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL
*DriverConfiguration
, OPTIONAL
1103 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL
*DriverDiagnostics OPTIONAL
1109 Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,
1110 Component Name 2 onto the driver's DriverBindingHandle. This is typically the same as the driver's
1111 ImageHandle, but it can be different if the driver produces multiple DriverBinding Protocols.
1112 If the Driver Binding Protocol interface 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 Others Status from gBS->InstallMultipleProtocolInterfaces().
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 Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name,
1141 Component Name 2, Driver Configure, Driver Diagnostic and Driver Diagnostic 2 Protocols onto the driver's
1142 DriverBindingHandle.
1144 This is typically the same as the driver's ImageHandle, but it can be different if
1145 the driver produces multiple DriverBinding Protocols.
1146 If the Drvier Binding Protocol interface is NULL, then ASSERT ().
1147 If the installation fails, then ASSERT ().
1149 @param ImageHandle The image handle of the driver.
1150 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1151 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1152 @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this
1153 parameter is NULL, then a new handle is created.
1154 @param ComponentName A Component Name Protocol instance that this driver is producing.
1155 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
1156 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
1157 @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver is producing.
1158 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
1159 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.
1161 @retval EFI_SUCCESS The protocol installation is completed successfully.
1162 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
1167 EfiLibInstallAllDriverProtocols2 (
1168 IN CONST EFI_HANDLE ImageHandle
,
1169 IN CONST EFI_SYSTEM_TABLE
*SystemTable
,
1170 IN EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
,
1171 IN EFI_HANDLE DriverBindingHandle
,
1172 IN CONST EFI_COMPONENT_NAME_PROTOCOL
*ComponentName
, OPTIONAL
1173 IN CONST EFI_COMPONENT_NAME2_PROTOCOL
*ComponentName2
, OPTIONAL
1174 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL
*DriverConfiguration
, OPTIONAL
1175 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL
*DriverConfiguration2
, OPTIONAL
1176 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL
*DriverDiagnostics
, OPTIONAL
1177 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL
*DriverDiagnostics2 OPTIONAL
1181 Determine what is the current language setting. The space reserved for Lang
1182 must be at least RFC_3066_ENTRY_SIZE bytes;
1184 If Lang is NULL, then ASSERT.
1186 @param Lang Pointer of system language. Lang will always be filled with a valid RFC 3066
1187 language string. If "PlatformLang" is not set in the system, the default
1188 language specifed by PcdUefiVariableDefaultPlatformLang is returned.
1190 @return EFI_SUCCESS If the EFI Variable with "PlatformLang" is set and return in Lang.
1191 @return EFI_NOT_FOUND If the EFI Variable with "PlatformLang" is not set, but a valid default language is return in Lang.
1196 GetCurrentLanguage (