2 The UEFI Library provides functions and macros that simplify the development of
3 UEFI Drivers and UEFI Applications. These functions and macros help manage EFI
4 events, build simple locks utilizing EFI Task Priority Levels (TPLs), install
5 EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers,
6 and print messages on the console output and standard error devices.
8 Copyright (c) 2006 - 2007, Intel Corporation
9 All rights reserved. This program and the accompanying materials
10 are licensed and made available under the terms and conditions of the BSD License
11 which accompanies this distribution. The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #ifndef __UEFI_LIB_H__
20 #define __UEFI_LIB_H__
22 #include <Protocol/DriverBinding.h>
23 #include <Protocol/DriverConfiguration.h>
24 #include <Protocol/ComponentName.h>
25 #include <Protocol/ComponentName2.h>
26 #include <Protocol/DriverDiagnostics.h>
27 #include <Protocol/DriverDiagnostics2.h>
30 /// Unicode String Table
34 CHAR16
*UnicodeString
;
35 } EFI_UNICODE_STRING_TABLE
;
41 EfiLockUninitialized
= 0,
57 This function searches the list of configuration tables stored in the EFI System
58 Table for a table with a GUID that matches TableGuid. If a match is found,
59 then a pointer to the configuration table is returned in Table, and EFI_SUCCESS
60 is returned. If a matching GUID is not found, then EFI_NOT_FOUND is returned.
62 @param TableGuid Pointer to table's GUID type..
63 @param Table Pointer to the table associated with TableGuid in the EFI System Table.
65 @retval EFI_SUCCESS A configuration table matching TableGuid was found.
66 @retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found.
71 EfiGetSystemConfigurationTable (
72 IN EFI_GUID
*TableGuid
,
77 This function causes the notification function to be executed for every protocol
78 of type ProtocolGuid instance that exists in the system when this function is
79 invoked. In addition, every time a protocol of type ProtocolGuid instance is
80 installed or reinstalled, the notification function is also executed.
82 @param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired.
83 @param NotifyTpl Supplies the task priority level of the event notifications.
84 @param NotifyFunction Supplies the function to notify when the event is signaled.
85 @param NotifyContext The context parameter to pass to NotifyFunction.
86 @param Registration A pointer to a memory location to receive the registration value.
88 @return The notification event that was created.
93 EfiCreateProtocolNotifyEvent(
94 IN EFI_GUID
*ProtocolGuid
,
96 IN EFI_EVENT_NOTIFY NotifyFunction
,
97 IN VOID
*NotifyContext
, OPTIONAL
98 OUT VOID
**Registration
102 This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.
103 This event is signaled with EfiNamedEventSignal(). This provide the ability for
104 one or more listeners on the same event named by the GUID specified by Name.
106 @param Name Supplies GUID name of the event.
107 @param NotifyTpl Supplies the task priority level of the event notifications.
108 @param NotifyFunction Supplies the function to notify when the event is signaled.
109 @param NotifyContext The context parameter to pass to NotifyFunction.
110 @param Registration A pointer to a memory location to receive the registration value.
112 @retval EFI_SUCCESS A named event was created.
113 @retval EFI_OUT_OF_RESOURCES There are not enough resource to create the named event.
118 EfiNamedEventListen (
119 IN CONST EFI_GUID
*Name
,
120 IN EFI_TPL NotifyTpl
,
121 IN EFI_EVENT_NOTIFY NotifyFunction
,
122 IN CONST VOID
*NotifyContext
, OPTIONAL
123 OUT VOID
*Registration OPTIONAL
127 This function signals the named event specified by Name. The named event must
128 have been created with EfiNamedEventListen().
130 @param Name Supplies GUID name of the event.
132 @retval EFI_SUCCESS A named event was signaled.
133 @retval EFI_OUT_OF_RESOURCES There are not enough resource to signal the named event.
138 EfiNamedEventSignal (
139 IN CONST EFI_GUID
*Name
143 Returns the current TPL.
145 This function returns the current TPL. There is no EFI service to directly
146 retrieve the current TPL. Instead, the RaiseTPL() function is used to raise
147 the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level
148 can then immediately be restored back to the current TPL level with a call
151 @return The current TPL.
161 This function initializes a basic mutual exclusion lock to the released state
162 and returns the lock. Each lock provides mutual exclusion access at its task
163 priority level. Since there is no preemption or multiprocessor support in EFI,
164 acquiring the lock only consists of raising to the locks TPL.
166 @param Lock A pointer to the lock data structure to initialize.
167 @param Priority EFI TPL associated with the lock.
175 IN OUT EFI_LOCK
*Lock
,
180 This macro initializes the contents of a basic mutual exclusion lock to the
181 released state. Each lock provides mutual exclusion access at its task
182 priority level. Since there is no preemption or multiprocessor support in EFI,
183 acquiring the lock only consists of raising to the locks TPL.
185 @param Priority The task priority level of the lock.
190 #define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \
191 {Priority, TPL_APPLICATION, EfiLockReleased }
196 Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.
198 If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
199 then this macro evaluates the EFI_LOCK structure specified by Lock. If Lock
200 is not in the locked state, then DebugAssert() is called passing in the source
201 filename, source line number, and Lock.
203 If Lock is NULL, then ASSERT().
205 @param LockParameter A pointer to the lock to acquire.
208 #define ASSERT_LOCKED(LockParameter) \
210 if (DebugAssertEnabled ()) { \
211 ASSERT (LockParameter != NULL); \
212 if ((LockParameter)->Lock != EfiLockAcquired) { \
213 _ASSERT (LockParameter not locked); \
220 This function raises the system's current task priority level to the task
221 priority level of the mutual exclusion lock. Then, it places the lock in the
224 @param Lock A pointer to the lock to acquire.
234 This function raises the system's current task priority level to the task
235 priority level of the mutual exclusion lock. Then, it attempts to place the
236 lock in the acquired state.
238 @param Lock A pointer to the lock to acquire.
240 @retval EFI_SUCCESS The lock was acquired.
241 @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.
246 EfiAcquireLockOrFail (
251 This function transitions a mutual exclusion lock from the acquired state to
252 the released state, and restores the system's task priority level to its
255 @param Lock A pointer to the lock to release.
265 Tests whether a controller handle is being managed by a specific driver.
267 This function tests whether the driver specified by DriverBindingHandle is
268 currently managing the controller specified by ControllerHandle. This test
269 is performed by evaluating if the the protocol specified by ProtocolGuid is
270 present on ControllerHandle and is was opened by DriverBindingHandle with an
271 attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.
272 If ProtocolGuid is NULL, then ASSERT().
274 @param ControllerHandle A handle for a controller to test.
275 @param DriverBindingHandle Specifies the driver binding handle for the
277 @param ProtocolGuid Specifies the protocol that the driver specified
278 by DriverBindingHandle opens in its Start()
281 @retval EFI_SUCCESS ControllerHandle is managed by the driver
282 specifed by DriverBindingHandle.
283 @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
284 specifed by DriverBindingHandle.
289 EfiTestManagedDevice (
290 IN CONST EFI_HANDLE ControllerHandle
,
291 IN CONST EFI_HANDLE DriverBindingHandle
,
292 IN CONST EFI_GUID
*ProtocolGuid
296 Tests whether a child handle is a child device of the controller.
298 This function tests whether ChildHandle is one of the children of
299 ControllerHandle. This test is performed by checking to see if the protocol
300 specified by ProtocolGuid is present on ControllerHandle and opened by
301 ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
302 If ProtocolGuid is NULL, then ASSERT().
304 @param ControllerHandle A handle for a (parent) controller to test.
305 @param ChildHandle A child handle to test.
306 @param ProtocolGuid Supplies the protocol that the child controller
307 opens on its parent controller.
309 @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.
310 @retval EFI_UNSUPPORTED ChildHandle is not a child of the
317 IN CONST EFI_HANDLE ControllerHandle
,
318 IN CONST EFI_HANDLE ChildHandle
,
319 IN CONST EFI_GUID
*ProtocolGuid
323 This function looks up a Unicode string in UnicodeStringTable. If Language is
324 a member of SupportedLanguages and a Unicode string is found in UnicodeStringTable
325 that matches the language code specified by Language, then it is returned in
328 @param Language A pointer to the ISO 639-2 language code for the
329 Unicode string to look up and return.
330 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
331 that the Unicode string table supports. Language
332 must be a member of this set.
333 @param UnicodeStringTable A pointer to the table of Unicode strings.
334 @param UnicodeString A pointer to the Unicode string from UnicodeStringTable
335 that matches the language specified by Language.
337 @retval EFI_SUCCESS The Unicode string that matches the language
338 specified by Language was found
339 in the table of Unicoide strings UnicodeStringTable,
340 and it was returned in UnicodeString.
341 @retval EFI_INVALID_PARAMETER Language is NULL.
342 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
343 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
344 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
345 @retval EFI_UNSUPPORTED The language specified by Language is not a
346 member of SupportedLanguages.
347 @retval EFI_UNSUPPORTED The language specified by Language is not
348 supported by UnicodeStringTable.
353 LookupUnicodeString (
354 IN CONST CHAR8
*Language
,
355 IN CONST CHAR8
*SupportedLanguages
,
356 IN CONST EFI_UNICODE_STRING_TABLE
*UnicodeStringTable
,
357 OUT CHAR16
**UnicodeString
361 This function looks up a Unicode string in UnicodeStringTable.
362 If Language is a member of SupportedLanguages and a Unicode
363 string is found in UnicodeStringTable that matches the
364 language code specified by Language, then it is returned in
367 @param Language A pointer to the ISO 639-2 or
368 RFC 3066 language code for the
369 Unicode string to look up and
372 @param SupportedLanguages A pointer to the set of ISO
373 639-2 or RFC 3066 language
374 codes that the Unicode string
375 table supports. Language must
376 be a member of this set.
378 @param UnicodeStringTable A pointer to the table of
381 @param UnicodeString A pointer to the Unicode
382 string from UnicodeStringTable
383 that matches the language
384 specified by Language.
386 @param Iso639Language Specify the language code
387 format supported. If true,
388 then the format follow ISO
389 639-2. If false, then it
392 @retval EFI_SUCCESS The Unicode string that
393 matches the language specified
394 by Language was found in the
395 table of Unicoide strings
396 UnicodeStringTable, and it was
397 returned in UnicodeString.
399 @retval EFI_INVALID_PARAMETER Language is NULL.
401 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
403 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
405 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
407 @retval EFI_UNSUPPORTED The language specified by
408 Language is not a member
409 ofSupportedLanguages.
411 @retval EFI_UNSUPPORTED The language specified by
412 Language is not supported by
418 LookupUnicodeString2 (
419 IN CONST CHAR8
*Language
,
420 IN CONST CHAR8
*SupportedLanguages
,
421 IN CONST EFI_UNICODE_STRING_TABLE
*UnicodeStringTable
,
422 OUT CHAR16
**UnicodeString
,
423 IN BOOLEAN Iso639Language
427 This function adds a Unicode string to UnicodeStringTable.
428 If Language is a member of SupportedLanguages then UnicodeString is added to
429 UnicodeStringTable. New buffers are allocated for both Language and
430 UnicodeString. The contents of Language and UnicodeString are copied into
431 these new buffers. These buffers are automatically freed when
432 FreeUnicodeStringTable() is called.
434 @param Language A pointer to the ISO 639-2 language code for the Unicode
436 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
437 that the Unicode string table supports.
438 Language must be a member of this set.
439 @param UnicodeStringTable A pointer to the table of Unicode strings.
440 @param UnicodeString A pointer to the Unicode string to add.
442 @retval EFI_SUCCESS The Unicode string that matches the language
443 specified by Language was found in the table of
444 Unicode strings UnicodeStringTable, and it was
445 returned in UnicodeString.
446 @retval EFI_INVALID_PARAMETER Language is NULL.
447 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
448 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
449 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
450 @retval EFI_ALREADY_STARTED A Unicode string with language Language is
451 already present in UnicodeStringTable.
452 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another
453 Unicode string to UnicodeStringTable.
454 @retval EFI_UNSUPPORTED The language specified by Language is not a
455 member of SupportedLanguages.
461 IN CONST CHAR8
*Language
,
462 IN CONST CHAR8
*SupportedLanguages
,
463 IN EFI_UNICODE_STRING_TABLE
**UnicodeStringTable
,
464 IN CONST CHAR16
*UnicodeString
469 This function adds a Unicode string to UnicodeStringTable.
470 If Language is a member of SupportedLanguages then
471 UnicodeString is added to UnicodeStringTable. New buffers are
472 allocated for both Language and UnicodeString. The contents
473 of Language and UnicodeString are copied into these new
474 buffers. These buffers are automatically freed when
475 FreeUnicodeStringTable() is called.
477 @param Language A pointer to the ISO 639-2 or
478 RFC 3066 language code for the
479 Unicode string to add.
481 @param SupportedLanguages A pointer to the set of ISO
482 639-2 or RFC 3066 language
483 codes that the Unicode string
484 table supports. Language must
485 be a member of this set.
487 @param UnicodeStringTable A pointer to the table of
490 @param UnicodeString A pointer to the Unicode
493 @param Iso639Language Specify the language code
494 format supported. If true,
495 then the format follow ISO
496 639-2. If false, then it
499 @retval EFI_SUCCESS The Unicode string that
500 matches the language specified
501 by Language was found in the
502 table of Unicode strings
503 UnicodeStringTable, and it was
504 returned in UnicodeString.
506 @retval EFI_INVALID_PARAMETER Language is NULL.
508 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
510 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
512 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
514 @retval EFI_ALREADY_STARTED A Unicode string with language
515 Language is already present in
518 @retval EFI_OUT_OF_RESOURCES There is not enough memory to
519 add another Unicode string to
522 @retval EFI_UNSUPPORTED The language specified by
523 Language is not a member of
530 IN CONST CHAR8
*Language
,
531 IN CONST CHAR8
*SupportedLanguages
,
532 IN EFI_UNICODE_STRING_TABLE
**UnicodeStringTable
,
533 IN CONST CHAR16
*UnicodeString
,
534 IN BOOLEAN Iso639Language
538 This function frees the table of Unicode strings in UnicodeStringTable.
539 If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.
540 Otherwise, each language code, and each Unicode string in the Unicode string
541 table are freed, and EFI_SUCCESS is returned.
543 @param UnicodeStringTable A pointer to the table of Unicode strings.
545 @retval EFI_SUCCESS The Unicode string table was freed.
550 FreeUnicodeStringTable (
551 IN EFI_UNICODE_STRING_TABLE
*UnicodeStringTable
555 This function computes and returns the width of the Unicode character
556 specified by UnicodeChar.
558 @param UnicodeChar A Unicode character.
560 @retval 0 The width if UnicodeChar could not be determined.
561 @retval 1 UnicodeChar is a narrow glyph.
562 @retval 2 UnicodeChar is a wide glyph.
568 IN CHAR16 UnicodeChar
572 This function computes and returns the display length of
573 the Null-terminated Unicode string specified by String.
574 If String is NULL, then 0 is returned.
575 If any of the widths of the Unicode characters in String
576 can not be determined, then 0 is returned.
578 @param String A pointer to a Null-terminated Unicode string.
580 @return The display length of the Null-terminated Unicode string specified by String.
585 UnicodeStringDisplayLength (
586 IN CONST CHAR16
*String
590 // Functions that abstract early Framework contamination of UEFI.
593 Signal a Ready to Boot Event.
595 Create a Ready to Boot Event. Signal it and close it. This causes other
596 events of the same event group to be signaled in other modules.
601 EfiSignalEventReadyToBoot (
606 Signal a Legacy Boot Event.
608 Create a legacy Boot Event. Signal it and close it. This causes other
609 events of the same event group to be signaled in other modules.
614 EfiSignalEventLegacyBoot (
619 Creates an EFI event in the Legacy Boot Event Group. Prior to UEFI 2.0 this
620 was done via a non blessed UEFI extensions and this library abstracts the
621 implementation mechanism of this event from the caller.
623 This function abstracts the creation of the Legacy Boot Event. The Framework
624 moved from a proprietary to UEFI 2.0 based mechanism. This library abstracts
625 the caller from how this event is created to prevent to code form having to
626 change with the version of the specification supported.
627 If LegacyBootEvent is NULL, then ASSERT().
629 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
631 @retval EFI_SUCCESS Event was created.
632 @retval Other Event was not created.
637 EfiCreateEventLegacyBoot (
638 OUT EFI_EVENT
*LegacyBootEvent
642 Create an EFI event in the Legacy Boot Event Group and allows
643 the caller to specify a notification function.
645 This function abstracts the creation of the Legacy Boot Event.
646 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
647 This library abstracts the caller from how this event is created to prevent
648 to code form having to change with the version of the specification supported.
649 If LegacyBootEvent is NULL, then ASSERT().
651 @param NotifyTpl The task priority level of the event.
652 @param NotifyFunction The notification function to call when the event is signaled.
653 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
654 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
656 @retval EFI_SUCCESS Event was created.
657 @retval Other Event was not created.
662 EfiCreateEventLegacyBootEx (
663 IN EFI_TPL NotifyTpl
,
664 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
665 IN VOID
*NotifyContext
, OPTIONAL
666 OUT EFI_EVENT
*LegacyBootEvent
670 Create an EFI event in the Ready To Boot Event Group. Prior to UEFI 2.0 this
671 was done via a non-standard UEFI extension, and this library abstracts the
672 implementation mechanism of this event from the caller.
674 This function abstracts the creation of the Ready to Boot Event. The Framework
675 moved from a proprietary to UEFI 2.0-based mechanism. This library abstracts
676 the caller from how this event is created to prevent the code form having to
677 change with the version of the specification supported.
678 If ReadyToBootEvent is NULL, then ASSERT().
680 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
682 @retval EFI_SUCCESS Event was created.
683 @retval Other Event was not created.
688 EfiCreateEventReadyToBoot (
689 OUT EFI_EVENT
*ReadyToBootEvent
693 Create an EFI event in the Ready To Boot Event Group and allows
694 the caller to specify a notification function.
696 This function abstracts the creation of the Ready to Boot Event.
697 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
698 This library abstracts the caller from how this event is created to prevent
699 to code form having to change with the version of the specification supported.
700 If ReadyToBootEvent is NULL, then ASSERT().
702 @param NotifyTpl The task priority level of the event.
703 @param NotifyFunction The notification function to call when the event is signaled.
704 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
705 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
707 @retval EFI_SUCCESS Event was created.
708 @retval Other Event was not created.
713 EfiCreateEventReadyToBootEx (
714 IN EFI_TPL NotifyTpl
,
715 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
716 IN VOID
*NotifyContext
, OPTIONAL
717 OUT EFI_EVENT
*ReadyToBootEvent
721 Initialize a Firmware Volume (FV) Media Device Path node.
723 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.
724 This library function abstracts initializing a device path node.
726 Initialize the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure. This device
727 path changed in the DXE CIS version 0.92 in a non back ward compatible way to
728 not conflict with the UEFI 2.0 specification. This function abstracts the
729 differences from the caller.
731 If FvDevicePathNode is NULL, then ASSERT().
732 If NameGuid is NULL, then ASSERT().
734 @param FvDevicePathNode Pointer to a FV device path node to initialize
735 @param NameGuid FV file name to use in FvDevicePathNode
740 EfiInitializeFwVolDevicepathNode (
741 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvDevicePathNode
,
742 IN CONST EFI_GUID
*NameGuid
746 Check to see if the Firmware Volume (FV) Media Device Path is valid
748 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.
749 This library function abstracts validating a device path node.
751 Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid.
752 If it is valid, then return the GUID file name from the device path node. Otherwise,
753 return NULL. This device path changed in the DXE CIS version 0.92 in a non back ward
754 compatible way to not conflict with the UEFI 2.0 specification. This function abstracts
755 the differences from the caller.
756 If FvDevicePathNode is NULL, then ASSERT().
758 @param FvDevicePathNode Pointer to FV device path to check.
760 @retval NULL FvDevicePathNode is not valid.
761 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.
766 EfiGetNameGuidFromFwVolDevicePathNode (
767 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvDevicePathNode
771 Prints a formatted Unicode string to the console output device specified by
772 ConOut defined in the EFI_SYSTEM_TABLE.
774 This function prints a formatted Unicode string to the console output device
775 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
776 characters that printed to ConOut. If the length of the formatted Unicode
777 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
778 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
780 @param Format Null-terminated Unicode format string.
781 @param ... VARARG list consumed to process Format.
782 If Format is NULL, then ASSERT().
783 If Format is not aligned on a 16-bit boundary, then ASSERT().
785 @return Number of Unicode characters printed to ConOut.
791 IN CONST CHAR16
*Format
,
796 Prints a formatted Unicode string to the console output device specified by
797 StdErr defined in the EFI_SYSTEM_TABLE.
799 This function prints a formatted Unicode string to the console output device
800 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
801 characters that printed to StdErr. If the length of the formatted Unicode
802 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
803 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
805 @param Format Null-terminated Unicode format string.
806 @param ... VARARG list consumed to process Format.
807 If Format is NULL, then ASSERT().
808 If Format is not aligned on a 16-bit boundary, then ASSERT().
810 @return Number of Unicode characters printed to StdErr.
816 IN CONST CHAR16
*Format
,
821 Prints a formatted ASCII string to the console output device specified by
822 ConOut defined in the EFI_SYSTEM_TABLE.
824 This function prints a formatted ASCII string to the console output device
825 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
826 characters that printed to ConOut. If the length of the formatted ASCII
827 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
828 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
830 @param Format Null-terminated ASCII format string.
831 @param ... VARARG list consumed to process Format.
832 If Format is NULL, then ASSERT().
833 If Format is not aligned on a 16-bit boundary, then ASSERT().
835 @return Number of ASCII characters printed to ConOut.
841 IN CONST CHAR8
*Format
,
846 Prints a formatted ASCII string to the console output device specified by
847 StdErr defined in the EFI_SYSTEM_TABLE.
849 This function prints a formatted ASCII string to the console output device
850 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
851 characters that printed to StdErr. If the length of the formatted ASCII
852 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
853 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
855 @param Format Null-terminated ASCII format string.
856 @param ... VARARG list consumed to process Format.
857 If Format is NULL, then ASSERT().
858 If Format is not aligned on a 16-bit boundary, then ASSERT().
860 @return Number of ASCII characters printed to ConErr.
866 IN CONST CHAR8
*Format
,
871 Initializes a driver by installing the Driver Binding Protocol onto the driver's
872 DriverBindingHandle. This is typically the same as the driver's ImageHandle, but
873 it can be different if the driver produces multiple DriverBinding Protocols.
874 If the Driver Binding Protocol interface is NULL, then ASSERT ().
875 If the installation fails, then ASSERT ().
877 @param ImageHandle The image handle of the driver.
878 @param SystemTable The EFI System Table that was passed to the driver's entry point.
879 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
880 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
881 parameter is NULL, then a new handle is created.
883 @retval EFI_SUCCESS The protocol installation is completed successfully.
884 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
889 EfiLibInstallDriverBinding (
890 IN CONST EFI_HANDLE ImageHandle
,
891 IN CONST EFI_SYSTEM_TABLE
*SystemTable
,
892 IN EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
,
893 IN EFI_HANDLE DriverBindingHandle
898 Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,
899 Driver Configure and Driver Diagnostic Protocols onto the driver's DriverBindingHandle. This is
900 typically the same as the driver's ImageHandle, but it can be different if the driver produces multiple
901 DriverBinding Protocols.
902 If the Driver Binding Protocol interface is NULL, then ASSERT ().
903 If the installation fails, then ASSERT ().
905 @param ImageHandle The image handle of the driver.
906 @param SystemTable The EFI System Table that was passed to the driver's entry point.
907 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
908 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
909 parameter is NULL, then a new handle is created.
910 @param ComponentName A Component Name Protocol instance that this driver is producing.
911 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
912 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
914 @retval EFI_SUCCESS The protocol installation is completed successfully.
915 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
920 EfiLibInstallAllDriverProtocols (
921 IN CONST EFI_HANDLE ImageHandle
,
922 IN CONST EFI_SYSTEM_TABLE
*SystemTable
,
923 IN EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
,
924 IN EFI_HANDLE DriverBindingHandle
,
925 IN CONST EFI_COMPONENT_NAME_PROTOCOL
*ComponentName
, OPTIONAL
926 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL
*DriverConfiguration
, OPTIONAL
927 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL
*DriverDiagnostics OPTIONAL
933 Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,
934 Component Name 2 onto the driver's DriverBindingHandle. This is typically the same as the driver's
935 ImageHandle, but it can be different if the driver produces multiple DriverBinding Protocols.
936 If the Driver Binding Protocol interface is NULL, then ASSERT ().
937 If the installation fails, then ASSERT ().
939 @param ImageHandle The image handle of the driver.
940 @param SystemTable The EFI System Table that was passed to the driver's entry point.
941 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
942 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
943 parameter is NULL, then a new handle is created.
944 @param ComponentName A Component Name Protocol instance that this driver is producing.
945 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
947 @retval EFI_SUCCESS The protocol installation is completed successfully.
948 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
953 EfiLibInstallDriverBindingComponentName2 (
954 IN CONST EFI_HANDLE ImageHandle
,
955 IN CONST EFI_SYSTEM_TABLE
*SystemTable
,
956 IN EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
,
957 IN EFI_HANDLE DriverBindingHandle
,
958 IN CONST EFI_COMPONENT_NAME_PROTOCOL
*ComponentName
, OPTIONAL
959 IN CONST EFI_COMPONENT_NAME2_PROTOCOL
*ComponentName2 OPTIONAL
964 Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name,
965 Component Name 2, Driver Configure, Driver Diagnostic and Driver Diagnostic 2 Protocols onto the driver's
966 DriverBindingHandle. This is typically the same as the driver's ImageHandle, but it can be different if
967 the driver produces multiple DriverBinding Protocols.
968 If the Drvier Binding Protocol interface is NULL, then ASSERT ().
969 If the installation fails, then ASSERT ().
971 @param ImageHandle The image handle of the driver.
972 @param SystemTable The EFI System Table that was passed to the driver's entry point.
973 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
974 @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this
975 parameter is NULL, then a new handle is created.
976 @param ComponentName A Component Name Protocol instance that this driver is producing.
977 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
978 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
979 @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver is producing.
980 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
981 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.
983 @retval EFI_SUCCESS The protocol installation is completed successfully.
984 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
989 EfiLibInstallAllDriverProtocols2 (
990 IN CONST EFI_HANDLE ImageHandle
,
991 IN CONST EFI_SYSTEM_TABLE
*SystemTable
,
992 IN EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
,
993 IN EFI_HANDLE DriverBindingHandle
,
994 IN CONST EFI_COMPONENT_NAME_PROTOCOL
*ComponentName
, OPTIONAL
995 IN CONST EFI_COMPONENT_NAME2_PROTOCOL
*ComponentName2
, OPTIONAL
996 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL
*DriverConfiguration
, OPTIONAL
997 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL
*DriverConfiguration2
, OPTIONAL
998 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL
*DriverDiagnostics
, OPTIONAL
999 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL
*DriverDiagnostics2 OPTIONAL
1003 Determine what is the current language setting. The space reserved for Lang
1004 must be at least RFC_3066_ENTRY_SIZE bytes;
1006 If Lang is NULL, then ASSERT.
1008 @param Lang Pointer of system language. Lang will always be filled with
1009 a valid RFC 3066 language string. If "PlatformLang" is not
1010 set in the system, the default language specifed by PcdUefiVariableDefaultPlatformLang
1013 @return EFI_SUCCESS If the EFI Variable with "PlatformLang" is set and return in Lang.
1014 @return EFI_NOT_FOUND If the EFI Variable with "PlatformLang" is not set, but a valid default language is return in Lang.
1019 GetCurrentLanguage (