]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c
IntelFrameworkPkg: Clean up source files
[mirror_edk2.git] / IntelFrameworkPkg / Library / FrameworkUefiLib / UefiLib.c
index a32b524ff893fd04b873eeceb2fe85ed81970c8a..0aa4506b8f4d3bd11456f13846c9762411e8e851 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
-  The UEFI Library provides functions and macros that simplify the development of \r
-  UEFI Drivers and UEFI Applications.  These functions and macros help manage EFI \r
-  events, build simple locks utilizing EFI Task Priority Levels (TPLs), install \r
-  EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers, \r
+  The UEFI Library provides functions and macros that simplify the development of\r
+  UEFI Drivers and UEFI Applications.  These functions and macros help manage EFI\r
+  events, build simple locks utilizing EFI Task Priority Levels (TPLs), install\r
+  EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers,\r
   and print messages on the console output and standard error devices.\r
 \r
   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
@@ -47,7 +47,7 @@ CompareIso639LanguageCode (
 /**\r
   Retrieves a pointer to the system configuration table from the EFI System Table\r
   based on a specified GUID.\r
-  \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
@@ -96,7 +96,7 @@ EfiGetSystemConfigurationTable (
   no instances of ProtocolGuid in the handle database at the time this function is invoked,\r
   then the notification function is still executed one time. In addition, every time a protocol\r
   of type ProtocolGuid instance is installed or reinstalled, the notification function is also\r
-  executed. This function returns the notification event that was created. \r
+  executed. This function returns the notification event 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
@@ -109,7 +109,7 @@ EfiGetSystemConfigurationTable (
   @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
+                          have been added that support the ProtocolGuid-specified protocol.\r
 \r
   @return The notification event that was created.\r
 \r
@@ -170,7 +170,7 @@ EfiCreateProtocolNotifyEvent(
 \r
   This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.\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
+  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
@@ -178,7 +178,7 @@ EfiCreateProtocolNotifyEvent(
   @param  Name                  Supplies GUID name of the event.\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  NotifyContext         The context parameter to pass to NotifyFunction.\r
   @param  Registration          A pointer to a memory location to receive the registration value.\r
 \r
   @retval EFI_SUCCESS           A named event was created.\r
@@ -202,7 +202,7 @@ EfiNamedEventListen (
   ASSERT (Name != NULL);\r
   ASSERT (NotifyFunction != NULL);\r
   ASSERT (NotifyTpl <= TPL_HIGH_LEVEL);\r
-  \r
+\r
   //\r
   // Create event\r
   //\r
@@ -343,13 +343,13 @@ EfiEventEmptyFunction (
 {\r
 }\r
 \r
-/** \r
+/**\r
   Returns the current TPL.\r
 \r
-  This function returns the current TPL.  There is no EFI service to directly \r
-  retrieve the current TPL. Instead, the RaiseTPL() function is used to raise \r
-  the TPL to TPL_HIGH_LEVEL.  This will return the current TPL.  The TPL level \r
-  can then immediately be restored back to the current TPL level with a call \r
+  This function returns the current TPL.  There is no EFI service to directly\r
+  retrieve the current TPL. Instead, the RaiseTPL() function is used to raise\r
+  the TPL to TPL_HIGH_LEVEL.  This will return the current TPL.  The TPL level\r
+  can then immediately be restored back to the current TPL level with a call\r
   to RestoreTPL().\r
 \r
   @return The current TPL.\r
@@ -373,8 +373,8 @@ EfiGetCurrentTpl (
 /**\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
+  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
@@ -405,8 +405,8 @@ EfiInitializeLock (
 /**\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
+  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
@@ -471,8 +471,8 @@ EfiAcquireLockOrFail (
 /**\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
+  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
@@ -506,7 +506,7 @@ EfiReleaseLock (
   currently managing the controller specified by ControllerHandle.  This test\r
   is performed by evaluating if the the protocol specified by ProtocolGuid is\r
   present on ControllerHandle and is was opened by DriverBindingHandle with an\r
-  attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. \r
+  attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.\r
   If ProtocolGuid is NULL, then ASSERT().\r
 \r
   @param  ControllerHandle     A handle for a controller to test.\r
@@ -569,10 +569,10 @@ EfiTestManagedDevice (
   ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
   If ProtocolGuid is NULL, then ASSERT().\r
 \r
-  @param  ControllerHandle     A handle for a (parent) controller to test. \r
+  @param  ControllerHandle     A handle for a (parent) controller to test.\r
   @param  ChildHandle          A child handle to test.\r
   @param  ProtocolGuid         Supplies the protocol that the child controller\r
-                               opens on its parent controller. \r
+                               opens on its parent controller.\r
 \r
   @retval EFI_SUCCESS          ChildHandle is a child of the ControllerHandle.\r
   @retval EFI_UNSUPPORTED      ChildHandle is not a child of the\r
@@ -631,26 +631,26 @@ EfiTestChildHandle (
   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
+  @param  Language                A pointer to the ISO 639-2 language code for the\r
                                   Unicode string to look up and return.\r
-  @param  SupportedLanguages      A pointer to the set of ISO 639-2 language codes \r
-                                  that the Unicode string table supports.  Language \r
+  @param  SupportedLanguages      A pointer to the set of ISO 639-2 language codes\r
+                                  that the Unicode string table supports.  Language\r
                                   must be a member of this set.\r
   @param  UnicodeStringTable      A pointer to the table of Unicode strings.\r
   @param  UnicodeString           A pointer to the Unicode string from UnicodeStringTable\r
                                   that matches the language specified by Language.\r
 \r
-  @retval EFI_SUCCESS             The Unicode string that matches the language \r
+  @retval EFI_SUCCESS             The Unicode string that matches the language\r
                                   specified by Language was found\r
-                                  in the table of Unicode strings UnicodeStringTable, \r
+                                  in the table of Unicode strings UnicodeStringTable,\r
                                   and it was returned in UnicodeString.\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 Language is not a \r
+  @retval EFI_UNSUPPORTED         The language specified by Language is not a\r
                                   member of SupportedLanguages.\r
-  @retval EFI_UNSUPPORTED         The language specified by Language is not \r
+  @retval EFI_UNSUPPORTED         The language specified by Language is not\r
                                   supported by UnicodeStringTable.\r
 \r
 **/\r
@@ -723,7 +723,7 @@ LookupUnicodeString (
                                return. If Iso639Language is TRUE, then this ASCII string is\r
                                not assumed to be Null-terminated, and only the first three\r
                                characters are used. If Iso639Language is FALSE, then this ASCII\r
-                               string must be Null-terminated. \r
+                               string must be Null-terminated.\r
   @param  SupportedLanguages   A pointer to a Null-terminated ASCII string that contains a\r
                                set of ISO 639-2 or RFC 4646 language codes that the Unicode\r
                                string table supports.  Language must be a member of this set.\r
@@ -743,11 +743,11 @@ LookupUnicodeString (
   @retval  EFI_SUCCESS            The Unicode string that matches the language specified by Language\r
                                   was found in the table of Unicode strings UnicodeStringTable, and\r
                                   it was returned in UnicodeString.\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 Language is not a member of SupportedLanguages.  \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 Language is not a member of SupportedLanguages.\r
   @retval  EFI_UNSUPPORTED        The language specified by Language is not supported by UnicodeStringTable.\r
 \r
 **/\r
@@ -833,13 +833,13 @@ LookupUnicodeString2 (
 /**\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
-  these new buffers.  These buffers are automatically freed when \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
+  these new buffers.  These buffers are automatically freed when\r
   FreeUnicodeStringTable() is called.\r
 \r
-  @param  Language                A pointer to the ISO 639-2 language code for the Unicode \r
+  @param  Language                A pointer to the ISO 639-2 language code for the Unicode\r
                                   string to add.\r
   @param  SupportedLanguages      A pointer to the set of ISO 639-2 language codes\r
                                   that the Unicode string table supports.\r
@@ -847,19 +847,19 @@ LookupUnicodeString2 (
   @param  UnicodeStringTable      A pointer to the table of Unicode strings.\r
   @param  UnicodeString           A pointer to the Unicode string to add.\r
 \r
-  @retval EFI_SUCCESS             The Unicode string that matches the language \r
-                                  specified by Language was found in the table of \r
-                                  Unicode strings UnicodeStringTable, and it was \r
+  @retval EFI_SUCCESS             The Unicode string that matches the language\r
+                                  specified by Language was found in the table of\r
+                                  Unicode strings UnicodeStringTable, and it was\r
                                   returned in UnicodeString.\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 Language is \r
+  @retval EFI_ALREADY_STARTED     A Unicode string with language Language is\r
                                   already present in UnicodeStringTable.\r
-  @retval EFI_OUT_OF_RESOURCES    There is not enough memory to add another \r
+  @retval EFI_OUT_OF_RESOURCES    There is not enough memory to add another\r
                                   Unicode string to UnicodeStringTable.\r
-  @retval EFI_UNSUPPORTED         The language specified by Language is not a \r
+  @retval EFI_UNSUPPORTED         The language specified by Language is not a\r
                                   member of SupportedLanguages.\r
 \r
 **/\r
@@ -1022,21 +1022,21 @@ AddUnicodeString (
                               RFC 4646 language codes separated by ';'.\r
   @param  UnicodeStringTable  A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE\r
                               is defined in "Related Definitions".\r
-  @param  UnicodeString       A pointer to the Unicode string to add.  \r
+  @param  UnicodeString       A pointer to the Unicode string to add.\r
   @param  Iso639Language      Specifies the supported language code format. If it is TRUE,\r
                               then Language and SupportedLanguages follow ISO 639-2 language code format.\r
                               Otherwise, they follow RFC 4646 language code format.\r
 \r
   @retval EFI_SUCCESS            The Unicode string that matches the language specified by\r
                                  Language was found in the table of Unicode strings UnicodeStringTable,\r
-                                 and it was returned in UnicodeString.  \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
+                                 and it was returned in UnicodeString.\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 Language is already present in\r
-                                 UnicodeStringTable.  \r
-  @retval EFI_OUT_OF_RESOURCES   There is not enough memory to add another Unicode string UnicodeStringTable.  \r
+                                 UnicodeStringTable.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory to add another Unicode string UnicodeStringTable.\r
   @retval EFI_UNSUPPORTED        The language specified by Language is not a member of SupportedLanguages.\r
 \r
 **/\r
@@ -1120,7 +1120,7 @@ AddUnicodeString2 (
       while (*LanguageString != 0) {\r
         for (Index = 0; LanguageString[Index] != 0 && LanguageString[Index] != ';'; Index++);\r
 \r
-        if (AsciiStrnCmp (Language, LanguageString, Index) == 0) { \r
+        if (AsciiStrnCmp (Language, LanguageString, Index) == 0) {\r
           return EFI_ALREADY_STARTED;\r
         }\r
         LanguageString += Index;\r
@@ -1202,7 +1202,7 @@ AddUnicodeString2 (
   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
+  Otherwise, each language code, and each Unicode string in the Unicode string\r
   table are freed, and EFI_SUCCESS is returned.\r
 \r
   @param  UnicodeStringTable  A pointer to the table of Unicode strings.\r
@@ -1252,8 +1252,8 @@ FreeUnicodeStringTable (
 }\r
 \r
 /**\r
-  Returns a pointer to an allocated buffer that contains the contents of a \r
-  variable retrieved through the UEFI Runtime Service GetVariable().  The \r
+  Returns a pointer to an allocated buffer that contains the contents of a\r
+  variable retrieved through the UEFI Runtime Service GetVariable().  The\r
   returned buffer is allocated using AllocatePool().  The caller is responsible\r
   for freeing this buffer with FreePool().\r
 \r
@@ -1314,10 +1314,10 @@ GetVariable (
 \r
 \r
 /**\r
-  Returns a pointer to an allocated buffer that contains the contents of a \r
-  variable retrieved through the UEFI Runtime Service GetVariable().  This \r
+  Returns a pointer to an allocated buffer that contains the contents of a\r
+  variable retrieved through the UEFI Runtime Service GetVariable().  This\r
   function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables.\r
-  The returned buffer is allocated using AllocatePool().  The caller is \r
+  The returned buffer is allocated using AllocatePool().  The caller is\r
   responsible for freeing this buffer with FreePool().\r
 \r
   If Name is NULL, then ASSERT().\r
@@ -1442,50 +1442,50 @@ GetEfiGlobalVariable2 (
 }\r
 \r
 /**\r
-  Returns a pointer to an allocated buffer that contains the best matching language \r
-  from a set of supported languages.  \r
-  \r
-  This function supports both ISO 639-2 and RFC 4646 language codes, but language \r
-  code types may not be mixed in a single call to this function.  The language \r
-  code returned is allocated using AllocatePool().  The caller is responsible for \r
+  Returns a pointer to an allocated buffer that contains the best matching language\r
+  from a set of supported languages.\r
+\r
+  This function supports both ISO 639-2 and RFC 4646 language codes, but language\r
+  code types may not be mixed in a single call to this function.  The language\r
+  code returned is allocated using AllocatePool().  The caller is responsible for\r
   freeing the allocated buffer using FreePool().  This function supports a variable\r
-  argument list that allows the caller to pass in a prioritized list of language \r
-  codes to test against all the language codes in SupportedLanguages. \r
+  argument list that allows the caller to pass in a prioritized list of language\r
+  codes to test against all the language codes in SupportedLanguages.\r
 \r
   If SupportedLanguages is NULL, then ASSERT().\r
 \r
   @param[in]  SupportedLanguages  A pointer to a Null-terminated ASCII string that\r
-                                  contains a set of language codes in the format \r
+                                  contains a set of language codes in the format\r
                                   specified by Iso639Language.\r
   @param[in]  Iso639Language      If not zero, then all language codes are assumed to be\r
                                   in ISO 639-2 format.  If zero, then all language\r
                                   codes are assumed to be in RFC 4646 language format\r
-  @param[in]  ...                 A variable argument list that contains pointers to \r
+  @param[in]  ...                 A variable argument list that contains pointers to\r
                                   Null-terminated ASCII strings that contain one or more\r
                                   language codes in the format specified by Iso639Language.\r
                                   The first language code from each of these language\r
                                   code lists is used to determine if it is an exact or\r
-                                  close match to any of the language codes in \r
+                                  close match to any of the language codes in\r
                                   SupportedLanguages.  Close matches only apply to RFC 4646\r
                                   language codes, and the matching algorithm from RFC 4647\r
-                                  is used to determine if a close match is present.  If \r
+                                  is used to determine if a close match is present.  If\r
                                   an exact or close match is found, then the matching\r
                                   language code from SupportedLanguages is returned.  If\r
                                   no matches are found, then the next variable argument\r
-                                  parameter is evaluated.  The variable argument list \r
+                                  parameter is evaluated.  The variable argument list\r
                                   is terminated by a NULL.\r
 \r
   @retval NULL   The best matching language could not be found in SupportedLanguages.\r
-  @retval NULL   There are not enough resources available to return the best matching \r
+  @retval NULL   There are not enough resources available to return the best matching\r
                  language.\r
-  @retval Other  A pointer to a Null-terminated ASCII string that is the best matching \r
+  @retval Other  A pointer to a Null-terminated ASCII string that is the best matching\r
                  language in SupportedLanguages.\r
 \r
 **/\r
 CHAR8 *\r
 EFIAPI\r
 GetBestLanguage (\r
-  IN CONST CHAR8  *SupportedLanguages, \r
+  IN CONST CHAR8  *SupportedLanguages,\r
   IN UINTN        Iso639Language,\r
   ...\r
   )\r
@@ -1564,7 +1564,7 @@ GetBestLanguage (
         LanguageLength = 0;\r
       } else {\r
         //\r
-        // If RFC 4646 mode, then trim Language from the right to the next '-' character \r
+        // If RFC 4646 mode, then trim Language from the right to the next '-' character\r
         //\r
         for (LanguageLength--; LanguageLength > 0 && Language[LanguageLength] != '-'; LanguageLength--);\r
       }\r
@@ -1573,7 +1573,7 @@ GetBestLanguage (
   VA_END (Args);\r
 \r
   //\r
-  // No matches were found \r
+  // No matches were found\r
   //\r
   return NULL;\r
 }\r