]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/UefiLib.h
Code and comments have been checked with spec.
[mirror_edk2.git] / MdePkg / Include / Library / UefiLib.h
index eeffdc052f174d54a4256f74240f32d29b27ea49..84c1375f63e693a7b115e873e1014fee5176f500 100644 (file)
@@ -99,10 +99,15 @@ typedef struct {
 \r
 \r
 /**\r
-  This function searches the list of configuration tables stored in the EFI System \r
-  Table for a table with a GUID that matches TableGuid.  If a match is found, \r
-  then a pointer to the configuration table is returned in Table, and EFI_SUCCESS \r
-  is returned.  If a matching GUID is not found, then EFI_NOT_FOUND is returned.\r
+  Retrieves a pointer to the system configuration table from the EFI System Table\r
+  based on a specified GUID.\r
+  \r
+  This function searches the list of configuration tables stored in the EFI System Table\r
+  for a table with a GUID that matches TableGuid.  If a match is found, then a pointer to\r
+  the configuration table is returned in Table., and EFI_SUCCESS is returned. If a matching GUID\r
+  is not found, then EFI_NOT_FOUND is returned.\r
+  If TableGuid is NULL, then ASSERT().\r
+  If Table is NULL, then ASSERT().\r
 \r
   @param  TableGuid       Pointer to table's GUID type..\r
   @param  Table           Pointer to the table associated with TableGuid in the EFI System Table.\r
@@ -119,18 +124,28 @@ EfiGetSystemConfigurationTable (
   );\r
 \r
 /**\r
-  This function causes the notification function to be executed for every protocol \r
-  of type ProtocolGuid instance that exists in the system when this function is \r
-  invoked.  In addition, every time a protocol of type ProtocolGuid instance is \r
-  installed or reinstalled, the notification function is also executed.\r
+  Creates and returns a notification event and registers that event with all the protocol\r
+  instances specified by ProtocolGuid.\r
+\r
+  This function causes the notification function to be executed for every protocol of type\r
+  ProtocolGuid instance that exists in the system when this function is invoked.\r
+  In addition, every time a protocol of type ProtocolGuid instance is installed or reinstalled,\r
+  the notification function is also executed.  This function returns the notification event\r
+  that was created. \r
+  If ProtocolGuid is NULL, then ASSERT().\r
+  If NotifyTpl is not a legal TPL value, then ASSERT().\r
+  If NotifyFunction is NULL, then ASSERT().\r
+  If Registration is NULL, then ASSERT().\r
 \r
   @param  ProtocolGuid    Supplies GUID of the protocol upon whose installation the event is fired.\r
   @param  NotifyTpl       Supplies the task priority level of the event notifications.\r
   @param  NotifyFunction  Supplies the function to notify when the event is signaled.\r
   @param  NotifyContext   The context parameter to pass to NotifyFunction.\r
   @param  Registration    A pointer to a memory location to receive the registration value.\r
+                          This value is passed to LocateHandle() to obtain new handles that\r
+                          have been added that support the ProtocolGuid-specified protocol. \r
 \r
-  @return The notification event that was created. \r
+  @return The notification event that was created.\r
 \r
 **/\r
 EFI_EVENT\r
@@ -144,9 +159,14 @@ EfiCreateProtocolNotifyEvent(
   );\r
 \r
 /**\r
+  Creates a named event that can be signaled with EfiNamedEventSignal().\r
+\r
   This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.\r
-  This event is signaled with EfiNamedEventSignal().  This provide the ability for \r
-  one or more listeners on the same event named by the GUID specified by Name.\r
+  This event is signaled with EfiNamedEventSignal(). This provides the ability for one or more\r
+  listeners on the same event named by the GUID specified by Name. \r
+  If Name is NULL, then ASSERT().\r
+  If NotifyTpl is not a legal TPL value, then ASSERT().\r
+  If NotifyFunction is NULL, then ASSERT().\r
 \r
   @param  Name                  Supplies GUID name of the event.\r
   @param  NotifyTpl             Supplies the task priority level of the event notifications.\r
@@ -169,8 +189,11 @@ EfiNamedEventListen (
   );\r
 \r
 /**\r
-  This function signals the named event specified by Name.  The named event must \r
-  have been created with EfiNamedEventListen().\r
+  Signals a named event created with EfiNamedEventListen().\r
+\r
+  This function signals the named event specified by Name. The named event must have been\r
+  created with EfiNamedEventListen().\r
+  If Name is NULL, then ASSERT().\r
 \r
   @param  Name                  Supplies GUID name of the event.\r
 \r
@@ -203,10 +226,14 @@ EfiGetCurrentTpl (
   );\r
 \r
 /**\r
+  Initializes a basic mutual exclusion lock.\r
+\r
   This function initializes a basic mutual exclusion lock to the released state \r
   and returns the lock.  Each lock provides mutual exclusion access at its task \r
   priority level.  Since there is no preemption or multiprocessor support in EFI,\r
   acquiring the lock only consists of raising to the locks TPL.\r
+  If Lock is NULL, then ASSERT().\r
+  If Priority is not a valid TPL value, then ASSERT().\r
 \r
   @param  Lock       A pointer to the lock data structure to initialize.\r
   @param  Priority   EFI TPL associated with the lock.\r
@@ -244,7 +271,6 @@ EfiInitializeLock (
   then this macro evaluates the EFI_LOCK structure specified by Lock.  If Lock \r
   is not in the locked state, then DebugAssert() is called passing in the source \r
   filename, source line number, and Lock.\r
-\r
   If Lock is NULL, then ASSERT().\r
 \r
   @param  LockParameter  A pointer to the lock to acquire.\r
@@ -262,9 +288,14 @@ EfiInitializeLock (
 \r
 \r
 /**\r
+  Acquires ownership of a lock.\r
+\r
   This function raises the system's current task priority level to the task \r
   priority level of the mutual exclusion lock.  Then, it places the lock in the \r
   acquired state.\r
+  If Lock is NULL, then ASSERT().\r
+  If Lock is not initialized, then ASSERT().\r
+  If Lock is already in the acquired state, then ASSERT().\r
 \r
   @param  Lock              A pointer to the lock to acquire.\r
 \r
@@ -276,9 +307,13 @@ EfiAcquireLock (
   );\r
 \r
 /**\r
+  Acquires ownership of a lock.  If the lock is already owned , then an error is returned.\r
+\r
   This function raises the system's current task priority level to the task \r
   priority level of the mutual exclusion lock.  Then, it attempts to place the \r
   lock in the acquired state.\r
+  If Lock is NULL, then ASSERT().\r
+  If Lock is not initialized, then ASSERT().\r
 \r
   @param  Lock              A pointer to the lock to acquire.\r
 \r
@@ -293,9 +328,14 @@ EfiAcquireLockOrFail (
   );\r
 \r
 /**\r
+  Releases ownership of a lock.\r
+\r
   This function transitions a mutual exclusion lock from the acquired state to \r
   the released state, and restores the system's task priority level to its \r
   previous level.\r
+  If Lock is NULL, then ASSERT().\r
+  If Lock is not initialized, then ASSERT().\r
+  If Lock is already in the released state, then ASSERT().\r
 \r
   @param  Lock  A pointer to the lock to release.\r
 \r
@@ -365,10 +405,11 @@ EfiTestChildHandle (
   );\r
 \r
 /**\r
-  This function looks up a Unicode string in UnicodeStringTable.  If Language is \r
-  a member of SupportedLanguages and a Unicode string is found in UnicodeStringTable\r
-  that matches the language code specified by Language, then it is returned in \r
-  UnicodeString.\r
+  This function looks up a Unicode string in UnicodeStringTable.\r
+\r
+  If Language is   a member of SupportedLanguages and a Unicode string is found in\r
+  UnicodeStringTable that matches the language code specified by Language, then it\r
+  is returned in UnicodeString.\r
 \r
   @param  Language                A pointer to the ISO 639-2 language code for the \r
                                   Unicode string to look up and return.\r
@@ -412,48 +453,38 @@ LookupUnicodeString (
   @param  Language                A pointer to the ISO 639-2 or\r
                                   RFC 3066 language code for the\r
                                   Unicode string to look up and\r
-                                  return.\r
-  \r
+                                  return.  \r
   @param  SupportedLanguages      A pointer to the set of ISO\r
                                   639-2 or RFC 3066 language\r
                                   codes that the Unicode string\r
                                   table supports. Language must\r
-                                  be a member of this set.\r
-  \r
+                                  be a member of this set.  \r
   @param  UnicodeStringTable      A pointer to the table of\r
-                                  Unicode strings.\r
-  \r
+                                  Unicode strings.  \r
   @param  UnicodeString           A pointer to the Unicode\r
                                   string from UnicodeStringTable\r
                                   that matches the language\r
                                   specified by Language.\r
-\r
   @param  Iso639Language          Specify the language code\r
                                   format supported. If true,\r
                                   then the format follow ISO\r
                                   639-2. If false, then it\r
                                   follows RFC3066.\r
-\r
   @retval  EFI_SUCCESS            The Unicode string that\r
                                   matches the language specified\r
                                   by Language was found in the\r
                                   table of Unicoide strings\r
                                   UnicodeStringTable, and it was\r
-                                  returned in UnicodeString.\r
-  \r
-  @retval  EFI_INVALID_PARAMETER  Language is NULL.\r
-  \r
-  @retval  EFI_INVALID_PARAMETER  UnicodeString is NULL.\r
-  \r
-  @retval  EFI_UNSUPPORTED        SupportedLanguages is NULL.\r
-  \r
-  @retval  EFI_UNSUPPORTED        UnicodeStringTable is NULL.\r
-  \r
+                                  returned in UnicodeString. \r
+\r
+  @retval  EFI_INVALID_PARAMETER  Language is NULL.  \r
+  @retval  EFI_INVALID_PARAMETER  UnicodeString is NULL.  \r
+  @retval  EFI_UNSUPPORTED        SupportedLanguages is NULL.  \r
+  @retval  EFI_UNSUPPORTED        UnicodeStringTable is NULL.  \r
   @retval  EFI_UNSUPPORTED        The language specified by\r
                                   Language is not a member\r
-                                  ofSupportedLanguages.\r
-  \r
-  @retval EFI_UNSUPPORTED         The language specified by\r
+                                  ofSupportedLanguages.  \r
+  @retval  EFI_UNSUPPORTED        The language specified by\r
                                   Language is not supported by\r
                                   UnicodeStringTable.\r
 \r
@@ -470,6 +501,7 @@ LookupUnicodeString2 (
 \r
 /**\r
   This function adds a Unicode string to UnicodeStringTable.\r
+\r
   If Language is a member of SupportedLanguages then UnicodeString is added to \r
   UnicodeStringTable.  New buffers are allocated for both Language and \r
   UnicodeString.  The contents of Language and UnicodeString are copied into \r
@@ -510,8 +542,8 @@ AddUnicodeString (
   );\r
 \r
 /**\r
-  \r
   This function adds a Unicode string to UnicodeStringTable.\r
+\r
   If Language is a member of SupportedLanguages then\r
   UnicodeString is added to UnicodeStringTable.  New buffers are\r
   allocated for both Language and UnicodeString.  The contents\r
@@ -521,26 +553,21 @@ AddUnicodeString (
 \r
   @param  Language                A pointer to the ISO 639-2 or\r
                                   RFC 3066 language code for the\r
-                                  Unicode string to add.\r
-  \r
+                                  Unicode string to add.  \r
   @param  SupportedLanguages      A pointer to the set of ISO\r
                                   639-2 or RFC 3066 language\r
                                   codes that the Unicode string\r
                                   table supports. Language must\r
-                                  be a member of this set.\r
-  \r
+                                  be a member of this set.  \r
   @param  UnicodeStringTable      A pointer to the table of\r
-                                  Unicode strings.\r
-  \r
+                                  Unicode strings.  \r
   @param  UnicodeString           A pointer to the Unicode\r
-                                  string to add.\r
-  \r
+                                  string to add.  \r
   @param  Iso639Language          Specify the language code\r
                                   format supported. If true,\r
                                   then the format follow ISO\r
                                   639-2. If false, then it\r
                                   follows RFC3066.\r
-\r
   @retval EFI_SUCCESS             The Unicode string that\r
                                   matches the language specified\r
                                   by Language was found in the\r
@@ -548,22 +575,16 @@ AddUnicodeString (
                                   UnicodeStringTable, and it was\r
                                   returned in UnicodeString.\r
   \r
-  @retval EFI_INVALID_PARAMETER   Language is NULL.\r
-  \r
-  @retval EFI_INVALID_PARAMETER   UnicodeString is NULL.\r
-  \r
-  @retval EFI_INVALID_PARAMETER   UnicodeString is an empty string.\r
-  \r
-  @retval EFI_UNSUPPORTED         SupportedLanguages is NULL.\r
-  \r
+  @retval EFI_INVALID_PARAMETER   Language is NULL.  \r
+  @retval EFI_INVALID_PARAMETER   UnicodeString is NULL.  \r
+  @retval EFI_INVALID_PARAMETER   UnicodeString is an empty string.  \r
+  @retval EFI_UNSUPPORTED         SupportedLanguages is NULL.  \r
   @retval EFI_ALREADY_STARTED     A Unicode string with language\r
                                   Language is already present in\r
-                                  UnicodeStringTable.\r
-  \r
+                                  UnicodeStringTable.  \r
   @retval EFI_OUT_OF_RESOURCES    There is not enough memory to\r
                                   add another Unicode string to\r
-                                  UnicodeStringTable.\r
-  \r
+                                  UnicodeStringTable.  \r
   @retval EFI_UNSUPPORTED         The language specified by\r
                                   Language is not a member of\r
                                   SupportedLanguages.\r
@@ -581,6 +602,7 @@ AddUnicodeString2 (
 \r
 /**\r
   This function frees the table of Unicode strings in UnicodeStringTable.\r
+\r
   If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.\r
   Otherwise, each language code, and each Unicode string in the Unicode string \r
   table are freed, and EFI_SUCCESS is returned.\r
@@ -614,6 +636,8 @@ GetGlyphWidth (
   );\r
 \r
 /**\r
+  Computes the display length of a Null-terminated Unicode String.\r
+\r
   This function computes and returns the display length of\r
   the Null-terminated Unicode string specified by String.\r
   If String is NULL, then 0 is returned.\r
@@ -635,10 +659,12 @@ UnicodeStringDisplayLength (
 // Functions that abstract early Framework contamination of UEFI.\r
 //\r
 /**\r
-  Signal a Ready to Boot Event.  \r
+  Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot().\r
   \r
-  Create a Ready to Boot Event. Signal it and close it. This causes other \r
-  events of the same event group to be signaled in other modules. \r
+  This function abstracts the signaling of the Ready to Boot Event. The Framework moved\r
+  from a proprietary to UEFI 2.0 based mechanism.  This library abstracts the caller from\r
+  how this event is created to prevent to code form having to change with the version of\r
+  the specification supported.\r
 \r
 **/\r
 VOID\r
@@ -648,10 +674,12 @@ EfiSignalEventReadyToBoot (
   );\r
 \r
 /**\r
-  Signal a Legacy Boot Event.  \r
-  \r
-  Create a legacy Boot Event. Signal it and close it. This causes other \r
-  events of the same event group to be signaled in other modules. \r
+  Create, Signal, and Close the Ready to Boot event using EfiSignalEventLegacyBoot().\r
+\r
+  This function abstracts the signaling of the Legacy Boot Event. The Framework moved from\r
+  a proprietary to UEFI 2.0 based mechanism.  This library abstracts the caller from how\r
+  this event is created to prevent to code form having to change with the version of the\r
+  specification supported.\r
 \r
 **/\r
 VOID\r
@@ -766,13 +794,11 @@ EfiCreateEventReadyToBootEx (
   Initialize a Firmware Volume (FV) Media Device Path node.\r
   \r
   The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.  \r
-  This library function abstracts initializing a device path node.\r
-  \r
+  This library function abstracts initializing a device path node.  \r
   Initialize the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure.  This device \r
   path changed in the DXE CIS version 0.92 in a non back ward compatible way to \r
   not conflict with the UEFI 2.0 specification.  This function abstracts the \r
   differences from the caller.\r
-  \r
   If FvDevicePathNode is NULL, then ASSERT().\r
   If NameGuid is NULL, then ASSERT().\r
   \r
@@ -792,7 +818,6 @@ EfiInitializeFwVolDevicepathNode (
   \r
   The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.  \r
   This library function abstracts validating a device path node.\r
-  \r
   Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid.  \r
   If it is valid, then return the GUID file name from the device path node.  Otherwise, \r
   return NULL.  This device path changed in the DXE CIS version 0.92 in a non back ward \r
@@ -821,12 +846,12 @@ EfiGetNameGuidFromFwVolDevicePathNode (
   characters that printed to ConOut.  If the length of the formatted Unicode \r
   string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
   PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
+  If Format is NULL, then ASSERT().\r
+  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
   @param Format   Null-terminated Unicode format string.\r
   @param ...      Variable argument list whose contents are accessed based \r
                   on the format string specified by Format.\r
-  If Format is NULL, then ASSERT().\r
-  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
   \r
   @return Number of Unicode characters printed to ConOut.\r
 \r
@@ -847,12 +872,12 @@ Print (
   characters that printed to StdErr.  If the length of the formatted Unicode \r
   string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
   PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
+  If Format is NULL, then ASSERT().\r
+  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
   @param Format   Null-terminated Unicode format string.\r
   @param ...      Variable argument list whose contents are accessed based \r
                   on the format string specified by Format.\r
-  If Format is NULL, then ASSERT().\r
-  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
   \r
   @return Number of Unicode characters printed to StdErr.\r
 \r
@@ -873,12 +898,12 @@ ErrorPrint (
   characters that printed to ConOut.  If the length of the formatted ASCII \r
   string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
   PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
+  If Format is NULL, then ASSERT().\r
+  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
   @param Format   Null-terminated ASCII format string.\r
   @param ...      Variable argument list whose contents are accessed based \r
                   on the format string specified by Format.\r
-  If Format is NULL, then ASSERT().\r
-  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
   \r
   @return Number of ASCII characters printed to ConOut.\r
 \r
@@ -899,12 +924,12 @@ AsciiPrint (
   characters that printed to StdErr.  If the length of the formatted ASCII \r
   string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
   PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
+  If Format is NULL, then ASSERT().\r
+  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
   @param Format   Null-terminated ASCII format string.\r
   @param ...      Variable argument list whose contents are accessed based \r
                   on the format string specified by Format.\r
-  If Format is NULL, then ASSERT().\r
-  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
   \r
   @return Number of ASCII characters printed to ConErr.\r
 \r
@@ -1016,7 +1041,9 @@ AsciiPrintXY (
 \r
 /**\r
   Initializes a driver by installing the Driver Binding Protocol onto the driver's\r
-  DriverBindingHandle.  This is typically the same as the driver's ImageHandle, but\r
+  DriverBindingHandle.\r
+\r
+  This is typically the same as the driver's ImageHandle, but\r
   it can be different if the driver produces multiple DriverBinding Protocols. \r
   If the Driver Binding Protocol interface is NULL, then ASSERT (). \r
   If the installation fails, then ASSERT ().\r
@@ -1028,6 +1055,7 @@ AsciiPrintXY (
                                       parameter is NULL, then a new handle is created.\r
 \r
   @retval EFI_SUCCESS                 The protocol installation is completed successfully.\r
+  @retval EFI_OUT_OF_RESOURCES        There was not enough system resources to install the protocol.\r
   @retval Others                      Status from gBS->InstallMultipleProtocolInterfaces().\r
 \r
 **/\r
@@ -1043,8 +1071,9 @@ EfiLibInstallDriverBinding (
 \r
 /**\r
   Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
-  Driver Configure and Driver Diagnostic Protocols onto the driver's DriverBindingHandle.  This is\r
-  typically the same as the driver's ImageHandle, but it can be different if the driver produces multiple\r
+  Driver Configure and Driver Diagnostic Protocols onto the driver's DriverBindingHandle.\r
+\r
+  This is  typically the same as the driver's ImageHandle, but it can be different if the driver produces multiple\r
   DriverBinding Protocols. \r
   If the Driver Binding Protocol interface is NULL, then ASSERT (). \r
   If the installation fails, then ASSERT ().\r
@@ -1110,7 +1139,9 @@ EfiLibInstallDriverBindingComponentName2 (
 /**\r
   Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
   Component Name 2, Driver Configure, Driver Diagnostic and Driver Diagnostic 2 Protocols onto the driver's\r
-  DriverBindingHandle.  This is typically the same as the driver's ImageHandle, but it can be different if\r
+  DriverBindingHandle.\r
+\r
+  This is typically the same as the driver's ImageHandle, but it can be different if\r
   the driver produces multiple DriverBinding Protocols. \r
   If the Drvier Binding Protocol interface is NULL, then ASSERT (). \r
   If the installation fails, then ASSERT ().\r
@@ -1152,10 +1183,9 @@ EfiLibInstallAllDriverProtocols2 (
 \r
   If Lang is NULL, then ASSERT.\r
 \r
-  @param  Lang                   Pointer of system language. Lang will always be filled with \r
-                                         a valid RFC 3066 language string. If "PlatformLang" is not\r
-                                         set in the system, the default language specifed by PcdUefiVariableDefaultPlatformLang\r
-                                         is returned.\r
+  @param  Lang   Pointer of system language. Lang will always be filled with a valid RFC 3066\r
+                 language string. If "PlatformLang" is not set in the system, the default\r
+                 language specifed by PcdUefiVariableDefaultPlatformLang is returned.\r
 \r
   @return  EFI_SUCCESS     If the EFI Variable with "PlatformLang" is set and return in Lang.\r
   @return  EFI_NOT_FOUND If the EFI Variable with "PlatformLang" is not set, but a valid default language is return in Lang.\r