|
EFI_STATUS EFIAPI | UefiLibConstructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) |
|
BOOLEAN | CompareIso639LanguageCode (IN CONST CHAR8 *Language1, IN CONST CHAR8 *Language2) |
|
EFI_STATUS EFIAPI | EfiGetSystemConfigurationTable (IN EFI_GUID *TableGuid, OUT VOID **Table) |
|
EFI_EVENT EFIAPI | EfiCreateProtocolNotifyEvent (IN EFI_GUID *ProtocolGuid, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN VOID *NotifyContext OPTIONAL, OUT VOID **Registration) |
|
EFI_STATUS EFIAPI | EfiNamedEventListen (IN CONST EFI_GUID *Name, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN CONST VOID *NotifyContext OPTIONAL, OUT VOID *Registration OPTIONAL) |
|
EFI_STATUS EFIAPI | EfiNamedEventSignal (IN CONST EFI_GUID *Name) |
|
EFI_STATUS EFIAPI | EfiEventGroupSignal (IN CONST EFI_GUID *EventGroup) |
|
VOID EFIAPI | EfiEventEmptyFunction (IN EFI_EVENT Event, IN VOID *Context) |
|
EFI_TPL EFIAPI | EfiGetCurrentTpl (VOID) |
|
EFI_LOCK *EFIAPI | EfiInitializeLock (IN OUT EFI_LOCK *Lock, IN EFI_TPL Priority) |
|
VOID EFIAPI | EfiAcquireLock (IN EFI_LOCK *Lock) |
|
EFI_STATUS EFIAPI | EfiAcquireLockOrFail (IN EFI_LOCK *Lock) |
|
VOID EFIAPI | EfiReleaseLock (IN EFI_LOCK *Lock) |
|
EFI_STATUS EFIAPI | EfiTestManagedDevice (IN CONST EFI_HANDLE ControllerHandle, IN CONST EFI_HANDLE DriverBindingHandle, IN CONST EFI_GUID *ProtocolGuid) |
|
EFI_STATUS EFIAPI | EfiTestChildHandle (IN CONST EFI_HANDLE ControllerHandle, IN CONST EFI_HANDLE ChildHandle, IN CONST EFI_GUID *ProtocolGuid) |
|
EFI_STATUS EFIAPI | IsLanguageSupported (IN CONST CHAR8 *SupportedLanguages, IN CONST CHAR8 *TargetLanguage) |
|
EFI_STATUS EFIAPI | LookupUnicodeString (IN CONST CHAR8 *Language, IN CONST CHAR8 *SupportedLanguages, IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable, OUT CHAR16 **UnicodeString) |
|
EFI_STATUS EFIAPI | LookupUnicodeString2 (IN CONST CHAR8 *Language, IN CONST CHAR8 *SupportedLanguages, IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable, OUT CHAR16 **UnicodeString, IN BOOLEAN Iso639Language) |
|
EFI_STATUS EFIAPI | AddUnicodeString (IN CONST CHAR8 *Language, IN CONST CHAR8 *SupportedLanguages, IN OUT EFI_UNICODE_STRING_TABLE **UnicodeStringTable, IN CONST CHAR16 *UnicodeString) |
|
EFI_STATUS EFIAPI | AddUnicodeString2 (IN CONST CHAR8 *Language, IN CONST CHAR8 *SupportedLanguages, IN OUT EFI_UNICODE_STRING_TABLE **UnicodeStringTable, IN CONST CHAR16 *UnicodeString, IN BOOLEAN Iso639Language) |
|
EFI_STATUS EFIAPI | FreeUnicodeStringTable (IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable) |
|
EFI_STATUS EFIAPI | GetVariable2 (IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size OPTIONAL) |
|
EFI_STATUS EFIAPI | GetVariable3 (IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size OPTIONAL, OUT UINT32 *Attr OPTIONAL) |
|
EFI_STATUS EFIAPI | GetEfiGlobalVariable2 (IN CONST CHAR16 *Name, OUT VOID **Value, OUT UINTN *Size OPTIONAL) |
|
CHAR8 *EFIAPI | GetBestLanguage (IN CONST CHAR8 *SupportedLanguages, IN UINTN Iso639Language,...) |
|
EFI_STATUS EFIAPI | EfiLocateProtocolBuffer (IN EFI_GUID *Protocol, OUT UINTN *NoProtocols, OUT VOID ***Buffer) |
|
EFI_STATUS EFIAPI | EfiOpenFileByDevicePath (IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath, OUT EFI_FILE_PROTOCOL **File, IN UINT64 OpenMode, IN UINT64 Attributes) |
|
The UEFI Library provides functions and macros that simplify the development of UEFI Drivers and UEFI Applications. These functions and macros help manage EFI events, build simple locks utilizing EFI Task Priority Levels (TPLs), install EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers, and print messages on the console output and standard error devices.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file UefiLib.c.
Acquires ownership of a lock.
This function raises the system's current task priority level to the task priority level of the mutual exclusion lock. Then, it places the lock in the acquired state. If Lock is NULL, then ASSERT(). If Lock is not initialized, then ASSERT(). If Lock is already in the acquired state, then ASSERT().
- Parameters
-
Lock | A pointer to the lock to acquire. |
Definition at line 434 of file UefiLib.c.
Acquires ownership of a lock.
This function raises the system's current task priority level to the task priority level of the mutual exclusion lock. Then, it attempts to place the lock in the acquired state. If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned. Otherwise, EFI_SUCCESS is returned. If Lock is NULL, then ASSERT(). If Lock is not initialized, then ASSERT().
- Parameters
-
Lock | A pointer to the lock to acquire. |
- Return values
-
EFI_SUCCESS | The lock was acquired. |
EFI_ACCESS_DENIED | The lock could not be acquired because it is already owned. |
Definition at line 463 of file UefiLib.c.
Creates and returns a notification event and registers that event with all the protocol instances specified by ProtocolGuid.
This function causes the notification function to be executed for every protocol of type ProtocolGuid instance that exists in the system when this function is invoked. If there are no instances of ProtocolGuid in the handle database at the time this function is invoked, then the notification function is still executed one time. In addition, every time a protocol of type ProtocolGuid instance is installed or reinstalled, the notification function is also executed. This function returns the notification event that was created. If ProtocolGuid is NULL, then ASSERT(). If NotifyTpl is not a legal TPL value, then ASSERT(). If NotifyFunction is NULL, then ASSERT(). If Registration is NULL, then ASSERT().
- Parameters
-
ProtocolGuid | Supplies GUID of the protocol upon whose installation the event is fired. |
NotifyTpl | Supplies the task priority level of the event notifications. |
NotifyFunction | Supplies the function to notify when the event is signaled. |
NotifyContext | The context parameter to pass to NotifyFunction. |
Registration | A pointer to a memory location to receive the registration value. This value is passed to LocateHandle() to obtain new handles that have been added that support the ProtocolGuid-specified protocol. |
- Returns
- The notification event that was created.
Definition at line 134 of file UefiLib.c.
Retrieves a pointer to the system configuration table from the EFI System Table based on a specified GUID.
This function searches the list of configuration tables stored in the EFI System Table for a table with a GUID that matches TableGuid. If a match is found, then a pointer to the configuration table is returned in Table., and EFI_SUCCESS is returned. If a matching GUID is not found, then EFI_NOT_FOUND is returned. If TableGuid is NULL, then ASSERT(). If Table is NULL, then ASSERT().
- Parameters
-
TableGuid | The pointer to table's GUID type. |
Table | The pointer to the table associated with TableGuid in the EFI System Table. |
- Return values
-
EFI_SUCCESS | A configuration table matching TableGuid was found. |
EFI_NOT_FOUND | A configuration table matching TableGuid could not be found. |
Definition at line 82 of file UefiLib.c.
Initializes a basic mutual exclusion lock.
This function initializes a basic mutual exclusion lock to the released state and returns the lock. Each lock provides mutual exclusion access at its task priority level. Since there is no preemption or multiprocessor support in EFI, acquiring the lock only consists of raising to the locks TPL. If Lock is NULL, then ASSERT(). If Priority is not a valid TPL value, then ASSERT().
- Parameters
-
Lock | A pointer to the lock data structure to initialize. |
Priority | EFI TPL is associated with the lock. |
- Returns
- The lock.
Definition at line 405 of file UefiLib.c.
Creates a named event that can be signaled with EfiNamedEventSignal().
This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext. This event is signaled with EfiNamedEventSignal(). This provides the ability for one or more listeners on the same event named by the GUID specified by Name. If Name is NULL, then ASSERT(). If NotifyTpl is not a legal TPL value, then ASSERT(). If NotifyFunction is NULL, then ASSERT().
- Parameters
-
Name | Supplies the GUID name of the event. |
NotifyTpl | Supplies the task priority level of the event notifications. |
NotifyFunction | Supplies the function to notify when the event is signaled. |
NotifyContext | The context parameter to pass to NotifyFunction. |
Registration | A pointer to a memory location to receive the registration value. |
- Return values
-
EFI_SUCCESS | A named event was created. |
EFI_OUT_OF_RESOURCES | There are not enough resource to create the named event. |
Definition at line 205 of file UefiLib.c.
Open or create a file or directory, possibly creating the chain of directories leading up to the directory.
EfiOpenFileByDevicePath() first locates EFI_SIMPLE_FILE_SYSTEM_PROTOCOL on FilePath, and opens the root directory of that filesystem with EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.OpenVolume().
On the remaining device path, the longest initial sequence of FILEPATH_DEVICE_PATH nodes is node-wise traversed with EFI_FILE_PROTOCOL.Open().
(As a consequence, if OpenMode includes EFI_FILE_MODE_CREATE, and Attributes includes EFI_FILE_DIRECTORY, and each FILEPATH_DEVICE_PATH specifies a single pathname component, then EfiOpenFileByDevicePath() ensures that the specified series of subdirectories exist on return.)
The EFI_FILE_PROTOCOL identified by the last FILEPATH_DEVICE_PATH node is output to the caller; intermediate EFI_FILE_PROTOCOL instances are closed. If there are no FILEPATH_DEVICE_PATH nodes past the node that identifies the filesystem, then the EFI_FILE_PROTOCOL of the root directory of the filesystem is output to the caller. If a device path node that is different from FILEPATH_DEVICE_PATH is encountered relative to the filesystem, the traversal is stopped with an error, and a NULL EFI_FILE_PROTOCOL is output.
- Parameters
-
[in,out] | FilePath | On input, the device path to the file or directory to open or create. The caller is responsible for ensuring that the device path pointed-to by FilePath is well-formed. On output, FilePath points one past the last node in the original device path that has been successfully processed. FilePath is set on output even if EfiOpenFileByDevicePath() returns an error. |
[out] | File | On error, File is set to NULL. On success, File is set to the EFI_FILE_PROTOCOL of the root directory of the filesystem, if there are no FILEPATH_DEVICE_PATH nodes in FilePath; otherwise, File is set to the EFI_FILE_PROTOCOL identified by the last node in FilePath. |
[in] | OpenMode | The OpenMode parameter to pass to EFI_FILE_PROTOCOL.Open(). |
[in] | Attributes | The Attributes parameter to pass to EFI_FILE_PROTOCOL.Open(). |
- Return values
-
EFI_SUCCESS | The file or directory has been opened or created. |
EFI_INVALID_PARAMETER | FilePath is NULL; or File is NULL; or FilePath contains a device path node, past the node that identifies EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, that is not a FILEPATH_DEVICE_PATH node. |
EFI_OUT_OF_RESOURCES | Memory allocation failed. |
- Returns
- Error codes propagated from the LocateDevicePath() and OpenProtocol() boot services, and from the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.OpenVolume() and EFI_FILE_PROTOCOL.Open() member functions.
Definition at line 1806 of file UefiLib.c.
Releases ownership of a lock.
This function transitions a mutual exclusion lock from the acquired state to the released state, and restores the system's task priority level to its previous level. If Lock is NULL, then ASSERT(). If Lock is not initialized, then ASSERT(). If Lock is already in the released state, then ASSERT().
- Parameters
-
Lock | A pointer to the lock to release. |
Definition at line 499 of file UefiLib.c.
This function frees the table of Unicode strings in UnicodeStringTable.
If UnicodeStringTable is NULL, then EFI_SUCCESS is returned. Otherwise, each language code, and each Unicode string in the Unicode string table are freed, and EFI_SUCCESS is returned.
- Parameters
-
UnicodeStringTable | A pointer to the table of Unicode strings. |
- Return values
-
EFI_SUCCESS | The Unicode string table was freed. |
Definition at line 1257 of file UefiLib.c.
CHAR8 *EFIAPI GetBestLanguage |
( |
IN CONST CHAR8 * |
SupportedLanguages, |
|
|
IN UINTN |
Iso639Language, |
|
|
|
... |
|
) |
| |
Returns a pointer to an allocated buffer that contains the best matching language from a set of supported languages.
This function supports both ISO 639-2 and RFC 4646 language codes, but language code types may not be mixed in a single call to this function. The language code returned is allocated using AllocatePool(). The caller is responsible for freeing the allocated buffer using FreePool(). This function supports a variable argument list that allows the caller to pass in a prioritized list of language codes to test against all the language codes in SupportedLanguages.
If SupportedLanguages is NULL, then ASSERT().
- Parameters
-
[in] | SupportedLanguages | A pointer to a Null-terminated ASCII string that contains a set of language codes in the format specified by Iso639Language. |
[in] | Iso639Language | If not zero, then all language codes are assumed to be in ISO 639-2 format. If zero, then all language codes are assumed to be in RFC 4646 language format |
[in] | ... | A variable argument list that contains pointers to Null-terminated ASCII strings that contain one or more language codes in the format specified by Iso639Language. The first language code from each of these language code lists is used to determine if it is an exact or close match to any of the language codes in SupportedLanguages. Close matches only apply to RFC 4646 language codes, and the matching algorithm from RFC 4647 is used to determine if a close match is present. If an exact or close match is found, then the matching language code from SupportedLanguages is returned. If no matches are found, then the next variable argument parameter is evaluated. The variable argument list is terminated by a NULL. |
- Return values
-
NULL | The best matching language could not be found in SupportedLanguages. |
NULL | There are not enough resources available to return the best matching language. |
Other | A pointer to a Null-terminated ASCII string that is the best matching language in SupportedLanguages. |
Definition at line 1522 of file UefiLib.c.
Returns a pointer to an allocated buffer that contains the contents of a variable retrieved through the UEFI Runtime Service GetVariable(). This function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables. The returned buffer is allocated using AllocatePool(). The caller is responsible for freeing this buffer with FreePool().
If Name is NULL, then ASSERT(). If Value is NULL, then ASSERT().
- Parameters
-
[in] | Name | The pointer to a Null-terminated Unicode string. |
[out] | Value | The buffer point saved the variable info. |
[out] | Size | The buffer size of the variable. |
- Returns
- EFI_OUT_OF_RESOURCES Allocate buffer failed.
-
EFI_SUCCESS Find the specified variable.
-
Others Errors Return errors from call to gRT->GetVariable.
Definition at line 1470 of file UefiLib.c.
Returns the status whether get the variable success. The function retrieves variable through the UEFI Runtime Service GetVariable(). The returned buffer is allocated using AllocatePool(). The caller is responsible for freeing this buffer with FreePool().
If Name is NULL, then ASSERT(). If Guid is NULL, then ASSERT(). If Value is NULL, then ASSERT().
- Parameters
-
[in] | Name | The pointer to a Null-terminated Unicode string. |
[in] | Guid | The pointer to an EFI_GUID structure |
[out] | Value | The buffer point saved the variable info. |
[out] | Size | The buffer size of the variable. |
- Returns
- EFI_OUT_OF_RESOURCES Allocate buffer failed.
-
EFI_SUCCESS Find the specified variable.
-
Others Errors Return errors from call to gRT->GetVariable.
Definition at line 1317 of file UefiLib.c.
Return the attributes of the variable.
Returns the status whether get the variable success. The function retrieves variable through the UEFI Runtime Service GetVariable(). The returned buffer is allocated using AllocatePool(). The caller is responsible for freeing this buffer with FreePool(). The attributes are returned if the caller provides a valid Attribute parameter.
If Name is NULL, then ASSERT(). If Guid is NULL, then ASSERT(). If Value is NULL, then ASSERT().
- Parameters
-
[in] | Name | The pointer to a Null-terminated Unicode string. |
[in] | Guid | The pointer to an EFI_GUID structure |
[out] | Value | The buffer point saved the variable info. |
[out] | Size | The buffer size of the variable. |
[out] | Attr | The pointer to the variable attributes as found in var store |
- Return values
-
EFI_OUT_OF_RESOURCES | Allocate buffer failed. |
EFI_SUCCESS | Find the specified variable. |
Others | Errors Return errors from call to gRT->GetVariable. |
Definition at line 1393 of file UefiLib.c.