2 MDE UEFI library functions and macros
4 Copyright (c) 2006 - 2007, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef __UEFI_LIB_H__
16 #define __UEFI_LIB_H__
18 #include <Protocol/DriverBinding.h>
19 #include <Protocol/DriverConfiguration.h>
20 #include <Protocol/ComponentName.h>
21 #include <Protocol/ComponentName2.h>
22 #include <Protocol/DriverDiagnostics.h>
23 #include <Protocol/DriverDiagnostics2.h>
26 /// Limited buffer size recommended by RFC3066
27 /// (42 characters plus a NULL terminator)
29 #define RFC_3066_ENTRY_SIZE (42 + 1)
32 /// Unicode String Table
36 CHAR16
*UnicodeString
;
37 } EFI_UNICODE_STRING_TABLE
;
43 EfiLockUninitialized
= 0,
59 This function searches the list of configuration tables stored in the EFI System
60 Table for a table with a GUID that matches TableGuid. If a match is found,
61 then a pointer to the configuration table is returned in Table, and EFI_SUCCESS
62 is returned. If a matching GUID is not found, then EFI_NOT_FOUND is returned.
64 @param TableGuid Pointer to table's GUID type..
65 @param Table Pointer to the table associated with TableGuid in the EFI System Table.
67 @retval EFI_SUCCESS A configuration table matching TableGuid was found.
68 @retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found.
73 EfiGetSystemConfigurationTable (
74 IN EFI_GUID
*TableGuid
,
79 This function causes the notification function to be executed for every protocol
80 of type ProtocolGuid instance that exists in the system when this function is
81 invoked. In addition, every time a protocol of type ProtocolGuid instance is
82 installed or reinstalled, the notification function is also executed.
84 @param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired.
85 @param NotifyTpl Supplies the task priority level of the event notifications.
86 @param NotifyFunction Supplies the function to notify when the event is signaled.
87 @param NotifyContext The context parameter to pass to NotifyFunction.
88 @param Registration A pointer to a memory location to receive the registration value.
90 @return The notification event that was created.
95 EfiCreateProtocolNotifyEvent(
96 IN EFI_GUID
*ProtocolGuid
,
98 IN EFI_EVENT_NOTIFY NotifyFunction
,
99 IN VOID
*NotifyContext
, OPTIONAL
100 OUT VOID
**Registration
104 This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.
105 This event is signaled with EfiNamedEventSignal(). This provide the ability for
106 one or more listeners on the same event named by the GUID specified by Name.
108 @param Name Supplies GUID name of the event.
109 @param NotifyTpl Supplies the task priority level of the event notifications.
110 @param NotifyFunction Supplies the function to notify when the event is signaled.
111 @param NotifyContext The context parameter to pass to NotifyFunction.
112 @param Registration A pointer to a memory location to receive the registration value.
114 @retval EFI_SUCCESS A named event was created.
115 @retval EFI_OUT_OF_RESOURCES There are not enough resource to create the named event.
120 EfiNamedEventListen (
121 IN CONST EFI_GUID
*Name
,
122 IN EFI_TPL NotifyTpl
,
123 IN EFI_EVENT_NOTIFY NotifyFunction
,
124 IN CONST VOID
*NotifyContext
, OPTIONAL
125 OUT VOID
*Registration OPTIONAL
129 This function signals the named event specified by Name. The named event must
130 have been created with EfiNamedEventListen().
132 @param Name Supplies GUID name of the event.
134 @retval EFI_SUCCESS A named event was signaled.
135 @retval EFI_OUT_OF_RESOURCES There are not enough resource to signal the named event.
140 EfiNamedEventSignal (
141 IN CONST EFI_GUID
*Name
145 Returns the current TPL.
147 This function returns the current TPL. There is no EFI service to directly
148 retrieve the current TPL. Instead, the RaiseTPL() function is used to raise
149 the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level
150 can then immediately be restored back to the current TPL level with a call
153 @return The current TPL.
163 This function initializes a basic mutual exclusion lock to the released state
164 and returns the lock. Each lock provides mutual exclusion access at its task
165 priority level. Since there is no preemption or multiprocessor support in EFI,
166 acquiring the lock only consists of raising to the locks TPL.
168 @param Lock A pointer to the lock data structure to initialize.
169 @param Priority EFI TPL associated with the lock.
177 IN OUT EFI_LOCK
*Lock
,
182 This macro initializes the contents of a basic mutual exclusion lock to the
183 released state. Each lock provides mutual exclusion access at its task
184 priority level. Since there is no preemption or multiprocessor support in EFI,
185 acquiring the lock only consists of raising to the locks TPL.
187 @param Priority The task priority level of the lock.
192 #define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \
193 {Priority, TPL_APPLICATION, EfiLockReleased }
198 Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.
200 If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
201 then this macro evaluates the EFI_LOCK structure specified by Lock. If Lock
202 is not in the locked state, then DebugAssert() is called passing in the source
203 filename, source line number, and Lock.
205 If Lock is NULL, then ASSERT().
207 @param LockParameter A pointer to the lock to acquire.
210 #define ASSERT_LOCKED(LockParameter) \
212 if (DebugAssertEnabled ()) { \
213 ASSERT (LockParameter != NULL); \
214 if ((LockParameter)->Lock != EfiLockAcquired) { \
215 _ASSERT (LockParameter not locked); \
222 This function raises the system's current task priority level to the task
223 priority level of the mutual exclusion lock. Then, it places the lock in the
226 @param Lock A pointer to the lock to acquire.
236 This function raises the system's current task priority level to the task
237 priority level of the mutual exclusion lock. Then, it attempts to place the
238 lock in the acquired state.
240 @param Lock A pointer to the lock to acquire.
242 @retval EFI_SUCCESS The lock was acquired.
243 @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.
248 EfiAcquireLockOrFail (
253 This function transitions a mutual exclusion lock from the acquired state to
254 the released state, and restores the system's task priority level to its
257 @param Lock A pointer to the lock to release.
267 Tests whether a controller handle is being managed by a specific driver.
269 This function tests whether the driver specified by DriverBindingHandle is
270 currently managing the controller specified by ControllerHandle. This test
271 is performed by evaluating if the the protocol specified by ProtocolGuid is
272 present on ControllerHandle and is was opened by DriverBindingHandle with an
273 attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.
274 If ProtocolGuid is NULL, then ASSERT().
276 @param ControllerHandle A handle for a controller to test.
277 @param DriverBindingHandle Specifies the driver binding handle for the
279 @param ProtocolGuid Specifies the protocol that the driver specified
280 by DriverBindingHandle opens in its Start()
283 @retval EFI_SUCCESS ControllerHandle is managed by the driver
284 specifed by DriverBindingHandle.
285 @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
286 specifed by DriverBindingHandle.
291 EfiTestManagedDevice (
292 IN CONST EFI_HANDLE ControllerHandle
,
293 IN CONST EFI_HANDLE DriverBindingHandle
,
294 IN CONST EFI_GUID
*ProtocolGuid
298 Tests whether a child handle is a child device of the controller.
300 This function tests whether ChildHandle is one of the children of
301 ControllerHandle. This test is performed by checking to see if the protocol
302 specified by ProtocolGuid is present on ControllerHandle and opened by
303 ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
304 If ProtocolGuid is NULL, then ASSERT().
306 @param ControllerHandle A handle for a (parent) controller to test.
307 @param ChildHandle A child handle to test.
308 @param ProtocolGuid Supplies the protocol that the child controller
309 opens on its parent controller.
311 @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.
312 @retval EFI_UNSUPPORTED ChildHandle is not a child of the
319 IN CONST EFI_HANDLE ControllerHandle
,
320 IN CONST EFI_HANDLE ChildHandle
,
321 IN CONST EFI_GUID
*ProtocolGuid
325 This function looks up a Unicode string in UnicodeStringTable. If Language is
326 a member of SupportedLanguages and a Unicode string is found in UnicodeStringTable
327 that matches the language code specified by Language, then it is returned in
330 @param Language A pointer to the ISO 639-2 language code for the
331 Unicode string to look up and return.
332 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
333 that the Unicode string table supports. Language
334 must be a member of this set.
335 @param UnicodeStringTable A pointer to the table of Unicode strings.
336 @param UnicodeString A pointer to the Unicode string from UnicodeStringTable
337 that matches the language specified by Language.
339 @retval EFI_SUCCESS The Unicode string that matches the language
340 specified by Language was found
341 in the table of Unicoide strings UnicodeStringTable,
342 and it was returned in UnicodeString.
343 @retval EFI_INVALID_PARAMETER Language is NULL.
344 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
345 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
346 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
347 @retval EFI_UNSUPPORTED The language specified by Language is not a
348 member of SupportedLanguages.
349 @retval EFI_UNSUPPORTED The language specified by Language is not
350 supported by UnicodeStringTable.
355 LookupUnicodeString (
356 IN CONST CHAR8
*Language
,
357 IN CONST CHAR8
*SupportedLanguages
,
358 IN CONST EFI_UNICODE_STRING_TABLE
*UnicodeStringTable
,
359 OUT CHAR16
**UnicodeString
363 This function looks up a Unicode string in UnicodeStringTable.
364 If Language is a member of SupportedLanguages and a Unicode
365 string is found in UnicodeStringTable that matches the
366 language code specified by Language, then it is returned in
369 @param Language A pointer to the ISO 639-2 or
370 RFC 3066 language code for the
371 Unicode string to look up and
374 @param SupportedLanguages A pointer to the set of ISO
375 639-2 or RFC 3066 language
376 codes that the Unicode string
377 table supports. Language must
378 be a member of this set.
380 @param UnicodeStringTable A pointer to the table of
383 @param UnicodeString A pointer to the Unicode
384 string from UnicodeStringTable
385 that matches the language
386 specified by Language.
388 @param Iso639Language Specify the language code
389 format supported. If true,
390 then the format follow ISO
391 639-2. If false, then it
394 @retval EFI_SUCCESS The Unicode string that
395 matches the language specified
396 by Language was found in the
397 table of Unicoide strings
398 UnicodeStringTable, and it was
399 returned in UnicodeString.
401 @retval EFI_INVALID_PARAMETER Language is NULL.
403 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
405 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
407 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
409 @retval EFI_UNSUPPORTED The language specified by
410 Language is not a member
411 ofSupportedLanguages.
413 @retval EFI_UNSUPPORTED The language specified by
414 Language is not supported by
420 LookupUnicodeString2 (
421 IN CONST CHAR8
*Language
,
422 IN CONST CHAR8
*SupportedLanguages
,
423 IN CONST EFI_UNICODE_STRING_TABLE
*UnicodeStringTable
,
424 OUT CHAR16
**UnicodeString
,
425 IN BOOLEAN Iso639Language
429 This function adds a Unicode string to UnicodeStringTable.
430 If Language is a member of SupportedLanguages then UnicodeString is added to
431 UnicodeStringTable. New buffers are allocated for both Language and
432 UnicodeString. The contents of Language and UnicodeString are copied into
433 these new buffers. These buffers are automatically freed when
434 FreeUnicodeStringTable() is called.
436 @param Language A pointer to the ISO 639-2 language code for the Unicode
438 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
439 that the Unicode string table supports.
440 Language must be a member of this set.
441 @param UnicodeStringTable A pointer to the table of Unicode strings.
442 @param UnicodeString A pointer to the Unicode string to add.
444 @retval EFI_SUCCESS The Unicode string that matches the language
445 specified by Language was found in the table of
446 Unicode strings UnicodeStringTable, and it was
447 returned in UnicodeString.
448 @retval EFI_INVALID_PARAMETER Language is NULL.
449 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
450 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
451 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
452 @retval EFI_ALREADY_STARTED A Unicode string with language Language is
453 already present in UnicodeStringTable.
454 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another
455 Unicode string to UnicodeStringTable.
456 @retval EFI_UNSUPPORTED The language specified by Language is not a
457 member of SupportedLanguages.
463 IN CONST CHAR8
*Language
,
464 IN CONST CHAR8
*SupportedLanguages
,
465 IN EFI_UNICODE_STRING_TABLE
**UnicodeStringTable
,
466 IN CONST CHAR16
*UnicodeString
471 This function adds a Unicode string to UnicodeStringTable.
472 If Language is a member of SupportedLanguages then
473 UnicodeString is added to UnicodeStringTable. New buffers are
474 allocated for both Language and UnicodeString. The contents
475 of Language and UnicodeString are copied into these new
476 buffers. These buffers are automatically freed when
477 FreeUnicodeStringTable() is called.
479 @param Language A pointer to the ISO 639-2 or
480 RFC 3066 language code for the
481 Unicode string to add.
483 @param SupportedLanguages A pointer to the set of ISO
484 639-2 or RFC 3066 language
485 codes that the Unicode string
486 table supports. Language must
487 be a member of this set.
489 @param UnicodeStringTable A pointer to the table of
492 @param UnicodeString A pointer to the Unicode
495 @param Iso639Language Specify the language code
496 format supported. If true,
497 then the format follow ISO
498 639-2. If false, then it
501 @retval EFI_SUCCESS The Unicode string that
502 matches the language specified
503 by Language was found in the
504 table of Unicode strings
505 UnicodeStringTable, and it was
506 returned in UnicodeString.
508 @retval EFI_INVALID_PARAMETER Language is NULL.
510 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
512 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
514 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
516 @retval EFI_ALREADY_STARTED A Unicode string with language
517 Language is already present in
520 @retval EFI_OUT_OF_RESOURCES There is not enough memory to
521 add another Unicode string to
524 @retval EFI_UNSUPPORTED The language specified by
525 Language is not a member of
532 IN CONST CHAR8
*Language
,
533 IN CONST CHAR8
*SupportedLanguages
,
534 IN EFI_UNICODE_STRING_TABLE
**UnicodeStringTable
,
535 IN CONST CHAR16
*UnicodeString
,
536 IN BOOLEAN Iso639Language
540 This function frees the table of Unicode strings in UnicodeStringTable.
541 If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.
542 Otherwise, each language code, and each Unicode string in the Unicode string
543 table are freed, and EFI_SUCCESS is returned.
545 @param UnicodeStringTable A pointer to the table of Unicode strings.
547 @retval EFI_SUCCESS The Unicode string table was freed.
552 FreeUnicodeStringTable (
553 IN EFI_UNICODE_STRING_TABLE
*UnicodeStringTable
557 This function computes and returns the width of the Unicode character
558 specified by UnicodeChar.
560 @param UnicodeChar A Unicode character.
562 @retval 0 The width if UnicodeChar could not be determined.
563 @retval 1 UnicodeChar is a narrow glyph.
564 @retval 2 UnicodeChar is a wide glyph.
570 IN CHAR16 UnicodeChar
574 This function computes and returns the display length of
575 the Null-terminated Unicode string specified by String.
576 If String is NULL, then 0 is returned.
577 If any of the widths of the Unicode characters in String
578 can not be determined, then 0 is returned.
580 @param String A pointer to a Null-terminated Unicode string.
582 @return The display length of the Null-terminated Unicode string specified by String.
587 UnicodeStringDisplayLength (
588 IN CONST CHAR16
*String
592 // Functions that abstract early Framework contamination of UEFI.
595 Signal a Ready to Boot Event.
597 Create a Ready to Boot Event. Signal it and close it. This causes other
598 events of the same event group to be signaled in other modules.
603 EfiSignalEventReadyToBoot (
608 Signal a Legacy Boot Event.
610 Create a legacy Boot Event. Signal it and close it. This causes other
611 events of the same event group to be signaled in other modules.
616 EfiSignalEventLegacyBoot (
621 Creates an EFI event in the Legacy Boot Event Group. Prior to UEFI 2.0 this
622 was done via a non blessed UEFI extensions and this library abstracts the
623 implementation mechanism of this event from the caller.
625 This function abstracts the creation of the Legacy Boot Event. The Framework
626 moved from a proprietary to UEFI 2.0 based mechanism. This library abstracts
627 the caller from how this event is created to prevent to code form having to
628 change with the version of the specification supported.
629 If LegacyBootEvent is NULL, then ASSERT().
631 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
633 @retval EFI_SUCCESS Event was created.
634 @retval Other Event was not created.
639 EfiCreateEventLegacyBoot (
640 OUT EFI_EVENT
*LegacyBootEvent
644 Create an EFI event in the Legacy Boot Event Group and allows
645 the caller to specify a notification function.
647 This function abstracts the creation of the Legacy Boot Event.
648 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
649 This library abstracts the caller from how this event is created to prevent
650 to code form having to change with the version of the specification supported.
651 If LegacyBootEvent is NULL, then ASSERT().
653 @param NotifyTpl The task priority level of the event.
654 @param NotifyFunction The notification function to call when the event is signaled.
655 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
656 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
658 @retval EFI_SUCCESS Event was created.
659 @retval Other Event was not created.
664 EfiCreateEventLegacyBootEx (
665 IN EFI_TPL NotifyTpl
,
666 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
667 IN VOID
*NotifyContext
, OPTIONAL
668 OUT EFI_EVENT
*LegacyBootEvent
672 Create an EFI event in the Ready To Boot Event Group. Prior to UEFI 2.0 this
673 was done via a non-standard UEFI extension, and this library abstracts the
674 implementation mechanism of this event from the caller.
676 This function abstracts the creation of the Ready to Boot Event. The Framework
677 moved from a proprietary to UEFI 2.0-based mechanism. This library abstracts
678 the caller from how this event is created to prevent the code form having to
679 change with the version of the specification supported.
680 If ReadyToBootEvent is NULL, then ASSERT().
682 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
684 @retval EFI_SUCCESS Event was created.
685 @retval Other Event was not created.
690 EfiCreateEventReadyToBoot (
691 OUT EFI_EVENT
*ReadyToBootEvent
695 Create an EFI event in the Ready To Boot Event Group and allows
696 the caller to specify a notification function.
698 This function abstracts the creation of the Ready to Boot Event.
699 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
700 This library abstracts the caller from how this event is created to prevent
701 to code form having to change with the version of the specification supported.
702 If ReadyToBootEvent is NULL, then ASSERT().
704 @param NotifyTpl The task priority level of the event.
705 @param NotifyFunction The notification function to call when the event is signaled.
706 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
707 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
709 @retval EFI_SUCCESS Event was created.
710 @retval Other Event was not created.
715 EfiCreateEventReadyToBootEx (
716 IN EFI_TPL NotifyTpl
,
717 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
718 IN VOID
*NotifyContext
, OPTIONAL
719 OUT EFI_EVENT
*ReadyToBootEvent
723 Initialize a Firmware Volume (FV) Media Device Path node.
725 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.
726 This library function abstracts initializing a device path node.
728 Initialize the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure. This device
729 path changed in the DXE CIS version 0.92 in a non back ward compatible way to
730 not conflict with the UEFI 2.0 specification. This function abstracts the
731 differences from the caller.
733 If FvDevicePathNode is NULL, then ASSERT().
734 If NameGuid is NULL, then ASSERT().
736 @param FvDevicePathNode Pointer to a FV device path node to initialize
737 @param NameGuid FV file name to use in FvDevicePathNode
742 EfiInitializeFwVolDevicepathNode (
743 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvDevicePathNode
,
744 IN CONST EFI_GUID
*NameGuid
748 Check to see if the Firmware Volume (FV) Media Device Path is valid
750 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.
751 This library function abstracts validating a device path node.
753 Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid.
754 If it is valid, then return the GUID file name from the device path node. Otherwise,
755 return NULL. This device path changed in the DXE CIS version 0.92 in a non back ward
756 compatible way to not conflict with the UEFI 2.0 specification. This function abstracts
757 the differences from the caller.
758 If FvDevicePathNode is NULL, then ASSERT().
760 @param FvDevicePathNode Pointer to FV device path to check.
762 @retval NULL FvDevicePathNode is not valid.
763 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.
768 EfiGetNameGuidFromFwVolDevicePathNode (
769 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvDevicePathNode
773 Prints a formatted Unicode string to the console output device specified by
774 ConOut defined in the EFI_SYSTEM_TABLE.
776 This function prints a formatted Unicode string to the console output device
777 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
778 characters that printed to ConOut. If the length of the formatted Unicode
779 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
780 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
782 @param Format Null-terminated Unicode format string.
783 @param ... VARARG list consumed to process Format.
784 If Format is NULL, then ASSERT().
785 If Format is not aligned on a 16-bit boundary, then ASSERT().
787 @return Number of Unicode characters printed to ConOut.
793 IN CONST CHAR16
*Format
,
798 Prints a formatted Unicode string to the console output device specified by
799 StdErr defined in the EFI_SYSTEM_TABLE.
801 This function prints a formatted Unicode string to the console output device
802 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
803 characters that printed to StdErr. If the length of the formatted Unicode
804 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
805 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
807 @param Format Null-terminated Unicode format string.
808 @param ... VARARG list consumed to process Format.
809 If Format is NULL, then ASSERT().
810 If Format is not aligned on a 16-bit boundary, then ASSERT().
812 @return Number of Unicode characters printed to StdErr.
818 IN CONST CHAR16
*Format
,
823 Prints a formatted ASCII string to the console output device specified by
824 ConOut defined in the EFI_SYSTEM_TABLE.
826 This function prints a formatted ASCII string to the console output device
827 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
828 characters that printed to ConOut. If the length of the formatted ASCII
829 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
830 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
832 @param Format Null-terminated ASCII format string.
833 @param ... VARARG list consumed to process Format.
834 If Format is NULL, then ASSERT().
835 If Format is not aligned on a 16-bit boundary, then ASSERT().
837 @return Number of ASCII characters printed to ConOut.
843 IN CONST CHAR8
*Format
,
848 Prints a formatted ASCII string to the console output device specified by
849 StdErr defined in the EFI_SYSTEM_TABLE.
851 This function prints a formatted ASCII string to the console output device
852 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
853 characters that printed to StdErr. If the length of the formatted ASCII
854 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
855 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
857 @param Format Null-terminated ASCII format string.
858 @param ... VARARG list consumed to process Format.
859 If Format is NULL, then ASSERT().
860 If Format is not aligned on a 16-bit boundary, then ASSERT().
862 @return Number of ASCII characters printed to ConErr.
868 IN CONST CHAR8
*Format
,
873 Initializes a driver by installing the Driver Binding Protocol onto the driver's
874 DriverBindingHandle. This is typically the same as the driver's ImageHandle, but
875 it can be different if the driver produces multiple DriverBinding Protocols.
876 If the Driver Binding Protocol interface is NULL, then ASSERT ().
877 If the installation fails, then ASSERT ().
879 @param ImageHandle The image handle of the driver.
880 @param SystemTable The EFI System Table that was passed to the driver's entry point.
881 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
882 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
883 parameter is NULL, then a new handle is created.
885 @retval EFI_SUCCESS The protocol installation is completed successfully.
886 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
891 EfiLibInstallDriverBinding (
892 IN CONST EFI_HANDLE ImageHandle
,
893 IN CONST EFI_SYSTEM_TABLE
*SystemTable
,
894 IN EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
,
895 IN EFI_HANDLE DriverBindingHandle
900 Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,
901 Driver Configure and Driver Diagnostic Protocols onto the driver's DriverBindingHandle. This is
902 typically the same as the driver's ImageHandle, but it can be different if the driver produces multiple
903 DriverBinding Protocols.
904 If the Driver Binding Protocol interface is NULL, then ASSERT ().
905 If the installation fails, then ASSERT ().
907 @param ImageHandle The image handle of the driver.
908 @param SystemTable The EFI System Table that was passed to the driver's entry point.
909 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
910 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
911 parameter is NULL, then a new handle is created.
912 @param ComponentName A Component Name Protocol instance that this driver is producing.
913 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
914 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
916 @retval EFI_SUCCESS The protocol installation is completed successfully.
917 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
922 EfiLibInstallAllDriverProtocols (
923 IN CONST EFI_HANDLE ImageHandle
,
924 IN CONST EFI_SYSTEM_TABLE
*SystemTable
,
925 IN EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
,
926 IN EFI_HANDLE DriverBindingHandle
,
927 IN CONST EFI_COMPONENT_NAME_PROTOCOL
*ComponentName
, OPTIONAL
928 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL
*DriverConfiguration
, OPTIONAL
929 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL
*DriverDiagnostics OPTIONAL
935 Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,
936 Component Name 2 onto the driver's DriverBindingHandle. This is typically the same as the driver's
937 ImageHandle, but it can be different if the driver produces multiple DriverBinding Protocols.
938 If the Driver Binding Protocol interface is NULL, then ASSERT ().
939 If the installation fails, then ASSERT ().
941 @param ImageHandle The image handle of the driver.
942 @param SystemTable The EFI System Table that was passed to the driver's entry point.
943 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
944 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
945 parameter is NULL, then a new handle is created.
946 @param ComponentName A Component Name Protocol instance that this driver is producing.
947 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
949 @retval EFI_SUCCESS The protocol installation is completed successfully.
950 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
955 EfiLibInstallDriverBindingComponentName2 (
956 IN CONST EFI_HANDLE ImageHandle
,
957 IN CONST EFI_SYSTEM_TABLE
*SystemTable
,
958 IN EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
,
959 IN EFI_HANDLE DriverBindingHandle
,
960 IN CONST EFI_COMPONENT_NAME_PROTOCOL
*ComponentName
, OPTIONAL
961 IN CONST EFI_COMPONENT_NAME2_PROTOCOL
*ComponentName2 OPTIONAL
966 Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,
967 Component Name 2, Driver Configure, Driver Diagnostic and Driver Diagnostic 2 Protocols onto the driver's
968 DriverBindingHandle. This is typically the same as the driver's ImageHandle, but it can be different if
969 the driver produces multiple DriverBinding Protocols.
970 If the Driver Binding Protocol interface is NULL, then ASSERT ().
971 If the installation fails, then ASSERT ().
973 @param ImageHandle The image handle of the driver.
974 @param SystemTable The EFI System Table that was passed to the driver's entry point.
975 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
976 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
977 parameter is NULL, then a new handle is created.
978 @param ComponentName A Component Name Protocol instance that this driver is producing.
979 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
980 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
981 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
982 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.
984 @retval EFI_SUCCESS The protocol installation is completed successfully.
985 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
990 EfiLibInstallAllDriverProtocols2 (
991 IN CONST EFI_HANDLE ImageHandle
,
992 IN CONST EFI_SYSTEM_TABLE
*SystemTable
,
993 IN EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
,
994 IN EFI_HANDLE DriverBindingHandle
,
995 IN CONST EFI_COMPONENT_NAME_PROTOCOL
*ComponentName
, OPTIONAL
996 IN CONST EFI_COMPONENT_NAME2_PROTOCOL
*ComponentName2
, OPTIONAL
997 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL
*DriverConfiguration
, 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 (