]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OldMdePkg/Library/UefiLib/UefiLib.c
Add some definitions for efi event in Uefi/UefiSpec.h to follow spec.
[mirror_edk2.git] / OldMdePkg / Library / UefiLib / UefiLib.c
index f03b881d35289c90bbaa83e3a21abeeb5592a5cf..72a2eb89d0cb10f0177bfe67be6c60694a7dd7c2 100644 (file)
@@ -2,13 +2,13 @@
   Mde UEFI library functions.\r
 \r
   Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
-  All rights reserved. This program and the accompanying materials                          \r
-  are licensed and made available under the terms and conditions of the BSD License         \r
-  which accompanies this distribution.  The full text of the license may be found at        \r
-  http://opensource.org/licenses/bsd-license.php                                            \r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
 \r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
   Module Name:  UefiLib.c\r
 \r
@@ -41,9 +41,9 @@ CompareIso639LanguageCode (
 }\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
+  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
 \r
   @param  TableGuid       Pointer to table's GUID type..\r
@@ -55,7 +55,7 @@ CompareIso639LanguageCode (
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-EfiGetSystemConfigurationTable (  \r
+EfiGetSystemConfigurationTable (\r
   IN  EFI_GUID  *TableGuid,\r
   OUT VOID      **Table\r
   )\r
@@ -79,9 +79,9 @@ 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
+  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
 \r
   @param  ProtocolGuid    Supplies GUID of the protocol upon whose installation the event is fired.\r
@@ -90,7 +90,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
 \r
-  @return The notification event that was created. \r
+  @return The notification event that was created.\r
 \r
 **/\r
 EFI_EVENT\r
@@ -111,7 +111,7 @@ EfiCreateProtocolNotifyEvent(
   //\r
 \r
   Status = gBS->CreateEvent (\r
-                  EFI_EVENT_NOTIFY_SIGNAL,\r
+                  EVT_NOTIFY_SIGNAL,\r
                   NotifyTpl,\r
                   NotifyFunction,\r
                   NotifyContext,\r
@@ -142,13 +142,13 @@ EfiCreateProtocolNotifyEvent(
 \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
+  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
 \r
   @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
@@ -173,7 +173,7 @@ EfiNamedEventListen (
   // Create event\r
   //\r
   Status = gBS->CreateEvent (\r
-                  EFI_EVENT_NOTIFY_SIGNAL,\r
+                  EVT_NOTIFY_SIGNAL,\r
                   NotifyTpl,\r
                   NotifyFunction,\r
                   (VOID *) NotifyContext,\r
@@ -206,7 +206,7 @@ EfiNamedEventListen (
 }\r
 \r
 /**\r
-  This function signals the named event specified by Name.  The named event must \r
+  This function signals the named event specified by Name.  The named event must\r
   have been created with EfiNamedEventListen().\r
 \r
   @param  Name                  Supplies GUID name of the event.\r
@@ -243,13 +243,13 @@ EfiNamedEventSignal (
   return EFI_SUCCESS;\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
   @param  VOID\r
@@ -265,7 +265,7 @@ EfiGetCurrentTpl (
 {\r
   EFI_TPL Tpl;\r
 \r
-  Tpl = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL); \r
+  Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
   gBS->RestoreTPL (Tpl);\r
 \r
   return Tpl;\r
@@ -273,8 +273,8 @@ EfiGetCurrentTpl (
 \r
 \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
 \r
@@ -292,17 +292,17 @@ EfiInitializeLock (
   )\r
 {\r
   ASSERT (Lock != NULL);\r
-  ASSERT (Priority <= EFI_TPL_HIGH_LEVEL);\r
+  ASSERT (Priority <= TPL_HIGH_LEVEL);\r
 \r
   Lock->Tpl       = Priority;\r
-  Lock->OwnerTpl  = EFI_TPL_APPLICATION;\r
+  Lock->OwnerTpl  = TPL_APPLICATION;\r
   Lock->Lock      = EfiLockReleased ;\r
   return Lock;\r
 }\r
 \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
 \r
   @param  Priority  The task priority level of the lock.\r
@@ -322,8 +322,8 @@ EfiAcquireLock (
 }\r
 \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
+  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
 \r
   @param  Lock              A pointer to the lock to acquire.\r
@@ -357,8 +357,8 @@ EfiAcquireLockOrFail (
 }\r
 \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
 \r
   @param  Lock  A pointer to the lock to release.\r
@@ -376,7 +376,7 @@ EfiReleaseLock (
   ASSERT (Lock->Lock == EfiLockAcquired);\r
 \r
   Tpl = Lock->OwnerTpl;\r
-  \r
+\r
   Lock->Lock = EfiLockReleased;\r
 \r
   gBS->RestoreTPL (Tpl);\r
@@ -389,7 +389,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
 
   @param  ControllerHandle     A handle for a controller to test.
@@ -452,10 +452,10 @@ EfiTestManagedDevice (
   ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
   If ProtocolGuid is NULL, then ASSERT().\r
 
-  @param  ControllerHandle     A handle for a (parent) controller to test. 
+  @param  ControllerHandle     A handle for a (parent) controller to test.
   @param  ChildHandle          A child handle to test.
   @param  ConsumsedGuid        Supplies the protocol that the child controller
-                               opens on its parent controller. 
+                               opens on its parent controller.
 
   @retval EFI_SUCCESS          ChildHandle is a child of the ControllerHandle.
   @retval EFI_UNSUPPORTED      ChildHandle is not a child of the
@@ -502,37 +502,37 @@ EfiTestChildHandle (
       break;\r
     }\r
   }\r
-  \r
+\r
   FreePool (OpenInfoBuffer);\r
   return Status;\r
 }\r
 \r
 /**\r
-  This function looks up a Unicode string in UnicodeStringTable.  If Language is \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
+  that matches the language code specified by Language, then it is returned in\r
   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 Unicoide strings UnicodeStringTable, \r
+                                  in the table of Unicoide 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
@@ -593,13 +593,13 @@ LookupUnicodeString (
 \r
 /**\r
   This function adds a Unicode string to UnicodeStringTable.\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
@@ -607,19 +607,19 @@ LookupUnicodeString (
   @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
@@ -760,7 +760,7 @@ AddUnicodeString (
 /**\r
   This function frees the table of Unicode strings in UnicodeStringTable.\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