MdePkg/Library/UefiLib/UefiLib.c File Reference


Functions

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, 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, OUT VOID *Registration)
EFI_STATUS EFIAPI EfiNamedEventSignal (IN CONST EFI_GUID *Name)
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 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 EFI_UNICODE_STRING_TABLE **UnicodeStringTable, IN CONST CHAR16 *UnicodeString)
EFI_STATUS EFIAPI AddUnicodeString2 (IN CONST CHAR8 *Language, IN CONST CHAR8 *SupportedLanguages, IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable, IN CONST CHAR16 *UnicodeString, IN BOOLEAN Iso639Language)
EFI_STATUS EFIAPI FreeUnicodeStringTable (IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable)
VOID *EFIAPI GetVariable (IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid)
VOID *EFIAPI GetEfiGlobalVariable (IN CONST CHAR16 *Name)
EFI_STATUS EFIAPI GetVariable2 (IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size)
EFI_STATUS EFIAPI GetEfiGlobalVariable2 (IN CONST CHAR16 *Name, OUT VOID **Value, OUT UINTN *Size)
CHAR8 *EFIAPI GetBestLanguage (IN CONST CHAR8 *SupportedLanguages, IN BOOLEAN Iso639Language,...)

Detailed Description

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 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php.

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.


Function Documentation

EFI_STATUS EFIAPI AddUnicodeString ( IN CONST CHAR8 Language,
IN CONST CHAR8 SupportedLanguages,
IN EFI_UNICODE_STRING_TABLE **  UnicodeStringTable,
IN CONST CHAR16 UnicodeString 
)

This function adds a Unicode string to UnicodeStringTable.

If Language is a member of SupportedLanguages then UnicodeString is added to UnicodeStringTable. New buffers are allocated for both Language and UnicodeString. The contents of Language and UnicodeString are copied into these new buffers. These buffers are automatically freed when FreeUnicodeStringTable() is called.

Parameters:
Language A pointer to the ISO 639-2 language code for the Unicode string to add.
SupportedLanguages A pointer to the set of ISO 639-2 language codes that the Unicode string table supports. Language must be a member of this set.
UnicodeStringTable A pointer to the table of Unicode strings.
UnicodeString A pointer to the Unicode string to add.
Return values:
EFI_SUCCESS The Unicode string that matches the language specified by Language was found in the table of Unicode strings UnicodeStringTable, and it was returned in UnicodeString.
EFI_INVALID_PARAMETER Language is NULL.
EFI_INVALID_PARAMETER UnicodeString is NULL.
EFI_INVALID_PARAMETER UnicodeString is an empty string.
EFI_UNSUPPORTED SupportedLanguages is NULL.
EFI_ALREADY_STARTED A Unicode string with language Language is already present in UnicodeStringTable.
EFI_OUT_OF_RESOURCES There is not enough memory to add another Unicode string to UnicodeStringTable.
EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.

References AllocateCopyPool(), AllocatePool(), CompareIso639LanguageCode(), CopyMem(), EFI_ALREADY_STARTED, EFI_INVALID_PARAMETER, EFI_OUT_OF_RESOURCES, EFI_SUCCESS, EFI_UNSUPPORTED, FreePool(), EFI_UNICODE_STRING_TABLE::Language, NULL, and EFI_UNICODE_STRING_TABLE::UnicodeString.

EFI_STATUS EFIAPI AddUnicodeString2 ( IN CONST CHAR8 Language,
IN CONST CHAR8 SupportedLanguages,
IN EFI_UNICODE_STRING_TABLE **  UnicodeStringTable,
IN CONST CHAR16 UnicodeString,
IN BOOLEAN  Iso639Language 
)

This function adds the Null-terminated Unicode string specified by UnicodeString to UnicodeStringTable.

If Language is a member of SupportedLanguages then UnicodeString is added to UnicodeStringTable. New buffers are allocated for both Language and UnicodeString. The contents of Language and UnicodeString are copied into these new buffers. These buffers are automatically freed when EfiLibFreeUnicodeStringTable() is called.

Parameters:
Language A pointer to an ASCII string containing the ISO 639-2 or the RFC 4646 language code for the Unicode string to add. If Iso639Language is TRUE, then this ASCII string is not assumed to be Null-terminated, and only the first three chacters are used. If Iso639Language is FALSE, then this ASCII string must be Null-terminated.
SupportedLanguages A pointer to a Null-terminated ASCII string that contains a set of ISO 639-2 or RFC 4646 language codes that the Unicode string table supports. Language must be a member of this set. If Iso639Language is TRUE, then this string contains one or more ISO 639-2 language codes with no separator characters. If Iso639Language is FALSE, then is string contains one or more RFC 4646 language codes separated by ';'.
UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE is defined in "Related Definitions".
UnicodeString A pointer to the Unicode string to add.
Iso639Language Specifies the supported language code format. If it is TRUE, then Language and SupportedLanguages follow ISO 639-2 language code format. Otherwise, they follow RFC 4646 language code format.
Return values:
EFI_SUCCESS The Unicode string that matches the language specified by Language was found in the table of Unicode strings UnicodeStringTable, and it was returned in UnicodeString.
EFI_INVALID_PARAMETER Language is NULL.
EFI_INVALID_PARAMETER UnicodeString is NULL.
EFI_INVALID_PARAMETER UnicodeString is an empty string.
EFI_UNSUPPORTED SupportedLanguages is NULL.
EFI_ALREADY_STARTED A Unicode string with language Language is already present in UnicodeStringTable.
EFI_OUT_OF_RESOURCES There is not enough memory to add another Unicode string UnicodeStringTable.
EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.

References AllocateCopyPool(), AllocatePool(), AsciiStrnCmp(), AsciiStrSize(), CompareIso639LanguageCode(), CopyMem(), EFI_ALREADY_STARTED, EFI_INVALID_PARAMETER, EFI_OUT_OF_RESOURCES, EFI_SUCCESS, EFI_UNSUPPORTED, FALSE, FreePool(), EFI_UNICODE_STRING_TABLE::Language, NULL, StrSize(), TRUE, and EFI_UNICODE_STRING_TABLE::UnicodeString.

BOOLEAN CompareIso639LanguageCode ( IN CONST CHAR8 Language1,
IN CONST CHAR8 Language2 
)

Compare whether two names of languages are identical.

Parameters:
Language1 Name of language 1.
Language2 Name of language 2.
Return values:
TRUE Language 1 and language 2 are the same.
FALSE Language 1 and language 2 are not the same.

References CONST, and ReadUnaligned24().

Referenced by AddUnicodeString(), AddUnicodeString2(), LookupUnicodeString(), and LookupUnicodeString2().

VOID EFIAPI EfiAcquireLock ( IN EFI_LOCK Lock  ) 

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.

References ASSERT, EfiLockAcquired, EfiLockReleased, gBS, NULL, and EFI_BOOT_SERVICES::RaiseTPL.

EFI_STATUS EFIAPI EfiAcquireLockOrFail ( IN EFI_LOCK Lock  ) 

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.

References ASSERT, EFI_ACCESS_DENIED, EFI_SUCCESS, EfiLockAcquired, EfiLockUninitialized, gBS, NULL, and EFI_BOOT_SERVICES::RaiseTPL.

EFI_EVENT EFIAPI EfiCreateProtocolNotifyEvent ( IN EFI_GUID ProtocolGuid,
IN EFI_TPL  NotifyTpl,
IN EFI_EVENT_NOTIFY  NotifyFunction,
IN VOID *  NotifyContext,
OUT VOID **  Registration 
)

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.

References ASSERT, ASSERT_EFI_ERROR, EFI_BOOT_SERVICES::CreateEvent, EVT_NOTIFY_SIGNAL, gBS, NULL, EFI_BOOT_SERVICES::RegisterProtocolNotify, and EFI_BOOT_SERVICES::SignalEvent.

EFI_TPL EFIAPI EfiGetCurrentTpl ( VOID   ) 

Returns the current TPL.

This function returns the current TPL. There is no EFI service to directly retrieve the current TPL. Instead, the RaiseTPL() function is used to raise the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level can then immediately be restored back to the current TPL level with a call to RestoreTPL().

Returns:
The current TPL.

References gBS, EFI_BOOT_SERVICES::RaiseTPL, EFI_BOOT_SERVICES::RestoreTPL, and TPL_HIGH_LEVEL.

EFI_STATUS EFIAPI EfiGetSystemConfigurationTable ( IN EFI_GUID TableGuid,
OUT VOID **  Table 
)

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.

References ASSERT, CompareGuid(), EFI_SYSTEM_TABLE::ConfigurationTable, EFI_NOT_FOUND, EFI_SUCCESS, gST, NULL, EFI_SYSTEM_TABLE::NumberOfTableEntries, EFI_CONFIGURATION_TABLE::VendorGuid, and EFI_CONFIGURATION_TABLE::VendorTable.

Referenced by DxeServicesTableLibConstructor(), HobLibConstructor(), UefiPalLibConstructor(), and UefiSalLibConstructor().

EFI_LOCK* EFIAPI EfiInitializeLock ( IN OUT EFI_LOCK Lock,
IN EFI_TPL  Priority 
)

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.

References ASSERT, EfiLockReleased, NULL, TPL_APPLICATION, and TPL_HIGH_LEVEL.

EFI_STATUS EFIAPI EfiNamedEventListen ( IN CONST EFI_GUID Name,
IN EFI_TPL  NotifyTpl,
IN EFI_EVENT_NOTIFY  NotifyFunction,
IN CONST VOID *  NotifyContext,
OUT VOID *  Registration 
)

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.

References ASSERT, ASSERT_EFI_ERROR, EFI_BOOT_SERVICES::CreateEvent, EVT_NOTIFY_SIGNAL, gBS, NULL, EFI_BOOT_SERVICES::RegisterProtocolNotify, TPL_HIGH_LEVEL, and VOID.

EFI_STATUS EFIAPI EfiNamedEventSignal ( IN CONST EFI_GUID Name  ) 

Signals a named event created with EfiNamedEventListen().

This function signals the named event specified by Name. The named event must have been created with EfiNamedEventListen(). If Name is NULL, then ASSERT().

Parameters:
Name Supplies the GUID name of the event.
Return values:
EFI_SUCCESS A named event was signaled.
EFI_OUT_OF_RESOURCES There are not enough resource to signal the named event.

References ASSERT, ASSERT_EFI_ERROR, EFI_NATIVE_INTERFACE, gBS, EFI_BOOT_SERVICES::InstallProtocolInterface, NULL, and EFI_BOOT_SERVICES::UninstallProtocolInterface.

VOID EFIAPI EfiReleaseLock ( IN EFI_LOCK Lock  ) 

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.

References ASSERT, EfiLockAcquired, EfiLockReleased, gBS, NULL, and EFI_BOOT_SERVICES::RestoreTPL.

EFI_STATUS EFIAPI EfiTestChildHandle ( IN CONST EFI_HANDLE  ControllerHandle,
IN CONST EFI_HANDLE  ChildHandle,
IN CONST EFI_GUID ProtocolGuid 
)

Tests whether a child handle is a child device of the controller.

This function tests whether ChildHandle is one of the children of ControllerHandle. This test is performed by checking to see if the protocol specified by ProtocolGuid is present on ControllerHandle and opened by ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. If ProtocolGuid is NULL, then ASSERT().

Parameters:
ControllerHandle A handle for a (parent) controller to test.
ChildHandle A child handle to test.
ProtocolGuid Supplies the protocol that the child controller opens on its parent controller.
Return values:
EFI_SUCCESS ChildHandle is a child of the ControllerHandle.
EFI_UNSUPPORTED ChildHandle is not a child of the ControllerHandle.

References ASSERT, EFI_ERROR, EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER, EFI_SUCCESS, EFI_UNSUPPORTED, FreePool(), gBS, NULL, and EFI_BOOT_SERVICES::OpenProtocolInformation.

EFI_STATUS EFIAPI EfiTestManagedDevice ( IN CONST EFI_HANDLE  ControllerHandle,
IN CONST EFI_HANDLE  DriverBindingHandle,
IN CONST EFI_GUID ProtocolGuid 
)

Tests whether a controller handle is being managed by a specific driver.

This function tests whether the driver specified by DriverBindingHandle is currently managing the controller specified by ControllerHandle. This test is performed by evaluating if the the protocol specified by ProtocolGuid is present on ControllerHandle and is was opened by DriverBindingHandle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. If ProtocolGuid is NULL, then ASSERT().

Parameters:
ControllerHandle A handle for a controller to test.
DriverBindingHandle Specifies the driver binding handle for the driver.
ProtocolGuid Specifies the protocol that the driver specified by DriverBindingHandle opens in its Start() function.
Return values:
EFI_SUCCESS ControllerHandle is managed by the driver specified by DriverBindingHandle.
EFI_UNSUPPORTED ControllerHandle is not managed by the driver specified by DriverBindingHandle.

References ASSERT, EFI_BOOT_SERVICES::CloseProtocol, EFI_ALREADY_STARTED, EFI_ERROR, EFI_OPEN_PROTOCOL_BY_DRIVER, EFI_SUCCESS, EFI_UNSUPPORTED, gBS, NULL, EFI_BOOT_SERVICES::OpenProtocol, and VOID.

EFI_STATUS EFIAPI FreeUnicodeStringTable ( IN EFI_UNICODE_STRING_TABLE UnicodeStringTable  ) 

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.

References EFI_SUCCESS, FreePool(), and NULL.

CHAR8* EFIAPI GetBestLanguage ( IN CONST CHAR8 SupportedLanguages,
IN BOOLEAN  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 TRUE, then all language codes are assumed to be in ISO 639-2 format. If FALSE, 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.

References AllocateZeroPool(), AsciiStrLen(), AsciiStrnCmp(), ASSERT, CONST, CopyMem(), MIN, NULL, VA_ARG, VA_END, and VA_START.

VOID* EFIAPI GetEfiGlobalVariable ( IN CONST CHAR16 Name  ) 

[ATTENTION] This function will be deprecated for security reason.

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().

Parameters:
[in] Name The pointer to a Null-terminated Unicode string.
Return values:
NULL The variable could not be retrieved.
NULL There are not enough resources available for the variable contents.
Other A pointer to allocated buffer containing the variable contents.

References gEfiGlobalVariableGuid, and GetVariable().

EFI_STATUS EFIAPI GetEfiGlobalVariable2 ( IN CONST CHAR16 Name,
OUT VOID **  Value,
OUT UINTN *  Size 
)

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.

References gEfiGlobalVariableGuid, and GetVariable2().

VOID* EFIAPI GetVariable ( IN CONST CHAR16 Name,
IN CONST EFI_GUID Guid 
)

[ATTENTION] This function will be deprecated for security reason.

Returns a pointer to an allocated buffer that contains the contents of a variable retrieved 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().

Parameters:
[in] Name The pointer to a Null-terminated Unicode string.
[in] Guid The pointer to an EFI_GUID structure
Return values:
NULL The variable could not be retrieved.
NULL There are not enough resources available for the variable contents.
Other A pointer to allocated buffer containing the variable contents.

References AllocatePool(), ASSERT, EFI_BUFFER_TOO_SMALL, EFI_ERROR, FreePool(), EFI_RUNTIME_SERVICES::GetVariable, gRT, NULL, and VOID.

Referenced by GetEfiGlobalVariable().

EFI_STATUS EFIAPI GetVariable2 ( IN CONST CHAR16 Name,
IN CONST EFI_GUID Guid,
OUT VOID **  Value,
OUT UINTN *  Size 
)

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.

References AllocatePool(), ASSERT, EFI_BUFFER_TOO_SMALL, EFI_ERROR, EFI_OUT_OF_RESOURCES, FreePool(), EFI_RUNTIME_SERVICES::GetVariable, gRT, and NULL.

Referenced by GetEfiGlobalVariable2().

EFI_STATUS EFIAPI LookupUnicodeString ( IN CONST CHAR8 Language,
IN CONST CHAR8 SupportedLanguages,
IN CONST EFI_UNICODE_STRING_TABLE UnicodeStringTable,
OUT CHAR16 **  UnicodeString 
)

This function looks up a Unicode string in UnicodeStringTable.

If Language is a member of SupportedLanguages and a Unicode string is found in UnicodeStringTable that matches the language code specified by Language, then it is returned in UnicodeString.

Parameters:
Language A pointer to the ISO 639-2 language code for the Unicode string to look up and return.
SupportedLanguages A pointer to the set of ISO 639-2 language codes that the Unicode string table supports. Language must be a member of this set.
UnicodeStringTable A pointer to the table of Unicode strings.
UnicodeString A pointer to the Unicode string from UnicodeStringTable that matches the language specified by Language.
Return values:
EFI_SUCCESS The Unicode string that matches the language specified by Language was found in the table of Unicode strings UnicodeStringTable, and it was returned in UnicodeString.
EFI_INVALID_PARAMETER Language is NULL.
EFI_INVALID_PARAMETER UnicodeString is NULL.
EFI_UNSUPPORTED SupportedLanguages is NULL.
EFI_UNSUPPORTED UnicodeStringTable is NULL.
EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.
EFI_UNSUPPORTED The language specified by Language is not supported by UnicodeStringTable.

References CompareIso639LanguageCode(), EFI_INVALID_PARAMETER, EFI_SUCCESS, EFI_UNSUPPORTED, and NULL.

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 
)

This function looks up a Unicode string in UnicodeStringTable.

If Language is a member of SupportedLanguages and a Unicode string is found in UnicodeStringTable that matches the language code specified by Language, then it is returned in UnicodeString.

Parameters:
Language A pointer to an ASCII string containing the ISO 639-2 or the RFC 4646 language code for the Unicode string to look up and return. If Iso639Language is TRUE, then this ASCII string is not assumed to be Null-terminated, and only the first three characters are used. If Iso639Language is FALSE, then this ASCII string must be Null-terminated.
SupportedLanguages A pointer to a Null-terminated ASCII string that contains a set of ISO 639-2 or RFC 4646 language codes that the Unicode string table supports. Language must be a member of this set. If Iso639Language is TRUE, then this string contains one or more ISO 639-2 language codes with no separator characters. If Iso639Language is FALSE, then is string contains one or more RFC 4646 language codes separated by ';'.
UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE is defined in "Related Definitions".
UnicodeString A pointer to the Null-terminated Unicode string from UnicodeStringTable that matches the language specified by Language.
Iso639Language Specifies the supported language code format. If it is TRUE, then Language and SupportedLanguages follow ISO 639-2 language code format. Otherwise, they follow RFC 4646 language code format.
Return values:
EFI_SUCCESS The Unicode string that matches the language specified by Language was found in the table of Unicode strings UnicodeStringTable, and it was returned in UnicodeString.
EFI_INVALID_PARAMETER Language is NULL.
EFI_INVALID_PARAMETER UnicodeString is NULL.
EFI_UNSUPPORTED SupportedLanguages is NULL.
EFI_UNSUPPORTED UnicodeStringTable is NULL.
EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.
EFI_UNSUPPORTED The language specified by Language is not supported by UnicodeStringTable.

References AsciiStrnCmp(), CompareIso639LanguageCode(), EFI_INVALID_PARAMETER, EFI_SUCCESS, EFI_UNSUPPORTED, FALSE, NULL, and TRUE.

EFI_STATUS EFIAPI UefiLibConstructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Empty constructor function that is required to resolve dependencies between libraries.

DO NOT REMOVE **

Parameters:
ImageHandle The firmware allocated handle for the EFI image.
SystemTable A pointer to the EFI System Table.
Return values:
EFI_SUCCESS The constructor executed correctly.

References EFI_SUCCESS.


Generated on Thu Sep 24 23:14:24 2015 for MdePkg[ALL] by  doxygen 1.5.7.1