]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/Hand/Locate.c
Code Scrub for Dxe Core.
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Hand / Locate.c
index 373bf9f2d208e0d27cd9f6f94daca7e55d193b58..55211e2637e819f51d5479d3702c34264b60d7c9 100644 (file)
@@ -30,7 +30,7 @@ typedef struct {
   PROTOCOL_ENTRY  *ProtEntry;\r
 } LOCATE_POSITION;\r
 \r
-typedef \r
+typedef\r
 IHANDLE *\r
 (* CORE_GET_NEXT) (\r
   IN OUT LOCATE_POSITION    *Position,\r
@@ -40,13 +40,12 @@ IHANDLE *
 /**\r
   Routine to get the next Handle, when you are searching for all handles.\r
 \r
-  @param  Position               Information about which Handle to seach for. \r
-  @param  Interface              Return the interface structure for the matching \r
-                                 protocol. \r
+  @param  Position               Information about which Handle to seach for.\r
+  @param  Interface              Return the interface structure for the matching\r
+                                 protocol.\r
 \r
-  @retval IHANDLE                An IHANDLE is returned if the next Position is \r
-                                 not the end of the list. A NULL_HANDLE is \r
-                                 returned if it's the end of the list.\r
+  @return An pointer to IHANDLE if the next Position is not the end of the list.\r
+          Otherwise,NULL_HANDLE is returned.\r
 \r
 **/\r
 IHANDLE *\r
@@ -59,13 +58,12 @@ CoreGetNextLocateAllHandles (
   Routine to get the next Handle, when you are searching for register protocol\r
   notifies.\r
 \r
-  @param  Position               Information about which Handle to seach for. \r
-  @param  Interface              Return the interface structure for the matching \r
-                                 protocol. \r
+  @param  Position               Information about which Handle to seach for.\r
+  @param  Interface              Return the interface structure for the matching\r
+                                 protocol.\r
 \r
-  @retval IHANDLE                An IHANDLE is returned if the next Position is \r
-                                 not the end of the list. A NULL_HANDLE is \r
-                                 returned if it's the end of the list.\r
+  @return An pointer to IHANDLE if the next Position is not the end of the list.\r
+          Otherwise,NULL_HANDLE is returned.\r
 \r
 **/\r
 IHANDLE *\r
@@ -77,13 +75,12 @@ CoreGetNextLocateByRegisterNotify (
 /**\r
   Routine to get the next Handle, when you are searching for a given protocol.\r
 \r
-  @param  Position               Information about which Handle to seach for. \r
-  @param  Interface              Return the interface structure for the matching \r
-                                 protocol. \r
+  @param  Position               Information about which Handle to seach for.\r
+  @param  Interface              Return the interface structure for the matching\r
+                                 protocol.\r
 \r
-  @retval IHANDLE                An IHANDLE is returned if the next Position is \r
-                                 not the end of the list. A NULL_HANDLE is \r
-                                 returned if it's the end of the list.\r
+  @return An pointer to IHANDLE if the next Position is not the end of the list.\r
+          Otherwise,NULL_HANDLE is returned.\r
 \r
 **/\r
 IHANDLE *\r
@@ -96,18 +93,18 @@ CoreGetNextLocateByProtocol (
 /**\r
   Locates the requested handle(s) and returns them in Buffer.\r
 \r
-  @param  SearchType             The type of search to perform to locate the \r
-                                 handles \r
-  @param  Protocol               The protocol to search for \r
-  @param  SearchKey              Dependant on SearchType \r
-  @param  BufferSize             On input the size of Buffer.  On output the  \r
-                                 size of data returned. \r
-  @param  Buffer                 The buffer to return the results in \r
-\r
-  @retval EFI_BUFFER_TOO_SMALL   Buffer too small, required buffer size is \r
-                                 returned in BufferSize. \r
-  @retval EFI_INVALID_PARAMETER  Invalid parameter \r
-  @retval EFI_SUCCESS            Successfully found the requested handle(s) and \r
+  @param  SearchType             The type of search to perform to locate the\r
+                                 handles\r
+  @param  Protocol               The protocol to search for\r
+  @param  SearchKey              Dependant on SearchType\r
+  @param  BufferSize             On input the size of Buffer.  On output the\r
+                                 size of data returned.\r
+  @param  Buffer                 The buffer to return the results in\r
+\r
+  @retval EFI_BUFFER_TOO_SMALL   Buffer too small, required buffer size is\r
+                                 returned in BufferSize.\r
+  @retval EFI_INVALID_PARAMETER  Invalid parameter\r
+  @retval EFI_SUCCESS            Successfully found the requested handle(s) and\r
                                  returns them in Buffer.\r
 \r
 **/\r
@@ -129,15 +126,15 @@ CoreLocateHandle (
   IHANDLE             *Handle;\r
   IHANDLE             **ResultBuffer;\r
   VOID                *Interface;\r
\r
+\r
   if (BufferSize == NULL) {\r
     Status = EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   if ((*BufferSize > 0) && (Buffer == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   GetNext = NULL;\r
 \r
   //\r
@@ -160,11 +157,11 @@ CoreLocateHandle (
   // Get the search function based on type\r
   //\r
   switch (SearchType) {\r
-  case AllHandles:      \r
-    GetNext = CoreGetNextLocateAllHandles;       \r
+  case AllHandles:\r
+    GetNext = CoreGetNextLocateAllHandles;\r
     break;\r
 \r
-  case ByRegisterNotify:    \r
+  case ByRegisterNotify:\r
     //\r
     // Must have SearchKey for locate ByRegisterNotify\r
     //\r
@@ -172,10 +169,10 @@ CoreLocateHandle (
       Status = EFI_INVALID_PARAMETER;\r
       break;\r
     }\r
-    GetNext = CoreGetNextLocateByRegisterNotify;   \r
+    GetNext = CoreGetNextLocateByRegisterNotify;\r
     break;\r
 \r
-  case ByProtocol:      \r
+  case ByProtocol:\r
     GetNext = CoreGetNextLocateByProtocol;\r
     if (Protocol == NULL) {\r
       Status = EFI_INVALID_PARAMETER;\r
@@ -239,15 +236,15 @@ CoreLocateHandle (
     //\r
     if (ResultSize > *BufferSize) {\r
       Status = EFI_BUFFER_TOO_SMALL;\r
-    } \r
-    \r
+    }\r
+\r
     *BufferSize = ResultSize;\r
 \r
     if (SearchType == ByRegisterNotify && !EFI_ERROR(Status)) {\r
       //\r
       // If this is a search by register notify and a handle was\r
       // returned, update the register notification position\r
-      // \r
+      //\r
       ProtNotify = SearchKey;\r
       ProtNotify->Position = ProtNotify->Position->ForwardLink;\r
     }\r
@@ -262,9 +259,9 @@ CoreLocateHandle (
 /**\r
   Routine to get the next Handle, when you are searching for all handles.\r
 \r
-  @param  Position               Information about which Handle to seach for. \r
-  @param  Interface              Return the interface structure for the matching \r
-                                 protocol. \r
+  @param  Position               Information about which Handle to seach for.\r
+  @param  Interface              Return the interface structure for the matching\r
+                                 protocol.\r
 \r
   @return An pointer to IHANDLE if the next Position is not the end of the list.\r
           Otherwise,NULL_HANDLE is returned.\r
@@ -301,9 +298,9 @@ CoreGetNextLocateAllHandles (
   Routine to get the next Handle, when you are searching for register protocol\r
   notifies.\r
 \r
-  @param  Position               Information about which Handle to seach for. \r
-  @param  Interface              Return the interface structure for the matching \r
-                                 protocol. \r
+  @param  Position               Information about which Handle to seach for.\r
+  @param  Interface              Return the interface structure for the matching\r
+                                 protocol.\r
 \r
   @return An pointer to IHANDLE if the next Position is not the end of the list.\r
           Otherwise,NULL_HANDLE is returned.\r
@@ -318,7 +315,7 @@ CoreGetNextLocateByRegisterNotify (
   IHANDLE             *Handle;\r
   PROTOCOL_NOTIFY     *ProtNotify;\r
   PROTOCOL_INTERFACE  *Prot;\r
-  LIST_ENTRY          *Link;    \r
+  LIST_ENTRY          *Link;\r
 \r
   Handle      = NULL_HANDLE;\r
   *Interface  = NULL;\r
@@ -339,7 +336,7 @@ CoreGetNextLocateByRegisterNotify (
       Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);\r
       Handle = (IHANDLE *) Prot->Handle;\r
       *Interface = Prot->Interface;\r
-    }  \r
+    }\r
   }\r
 \r
   return Handle;\r
@@ -349,9 +346,9 @@ CoreGetNextLocateByRegisterNotify (
 /**\r
   Routine to get the next Handle, when you are searching for a given protocol.\r
 \r
-  @param  Position               Information about which Handle to seach for. \r
-  @param  Interface              Return the interface structure for the matching \r
-                                 protocol. \r
+  @param  Position               Information about which Handle to seach for.\r
+  @param  Interface              Return the interface structure for the matching\r
+                                 protocol.\r
 \r
   @return An pointer to IHANDLE if the next Position is not the end of the list.\r
           Otherwise,NULL_HANDLE is returned.\r
@@ -366,7 +363,7 @@ CoreGetNextLocateByProtocol (
   IHANDLE             *Handle;\r
   LIST_ENTRY          *Link;\r
   PROTOCOL_INTERFACE  *Prot;\r
\r
+\r
   Handle      = NULL_HANDLE;\r
   *Interface  = NULL;\r
   for (; ;) {\r
@@ -392,7 +389,7 @@ CoreGetNextLocateByProtocol (
     *Interface = Prot->Interface;\r
 \r
     //\r
-    // If this handle has not been returned this request, then \r
+    // If this handle has not been returned this request, then\r
     // return it now\r
     //\r
     if (Handle->LocateRequest != mEfiLocateHandleRequest) {\r
@@ -408,15 +405,15 @@ CoreGetNextLocateByProtocol (
 /**\r
   Locates the handle to a device on the device path that best matches the specified protocol.\r
 \r
-  @param  Protocol               The protocol to search for. \r
-  @param  DevicePath             On input, a pointer to a pointer to the device \r
-                                 path. On output, the device path pointer is \r
-                                 modified to point to the remaining part of the \r
-                                 devicepath. \r
-  @param  Device                 A pointer to the returned device handle. \r
+  @param  Protocol               The protocol to search for.\r
+  @param  DevicePath             On input, a pointer to a pointer to the device\r
+                                 path. On output, the device path pointer is\r
+                                 modified to point to the remaining part of the\r
+                                 devicepath.\r
+  @param  Device                 A pointer to the returned device handle.\r
 \r
-  @retval EFI_SUCCESS            The resulting handle was returned. \r
-  @retval EFI_NOT_FOUND          No handles matched the search. \r
+  @retval EFI_SUCCESS            The resulting handle was returned.\r
+  @retval EFI_NOT_FOUND          No handles matched the search.\r
   @retval EFI_INVALID_PARAMETER  One of the parameters has an invalid value.\r
 \r
 **/\r
@@ -438,23 +435,23 @@ CoreLocateDevicePath (
   EFI_HANDLE                  Handle;\r
   EFI_DEVICE_PATH_PROTOCOL    *SourcePath;\r
   EFI_DEVICE_PATH_PROTOCOL    *TmpDevicePath;\r
-  \r
+\r
   if (Protocol == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   if ((DevicePath == NULL) || (*DevicePath == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   if (Device == NULL) {\r
     return  EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   *Device = NULL_HANDLE;\r
   SourcePath = *DevicePath;\r
   SourceSize = CoreDevicePathSize (SourcePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);\r
-  \r
+\r
   //\r
   // The source path can only have 1 instance\r
   //\r
@@ -493,7 +490,7 @@ CoreLocateDevicePath (
       // handles\r
       //\r
       ASSERT (Size != BestMatch);\r
-      \r
+\r
       //\r
       // We've got a match, see if it's the best match so far\r
       //\r
@@ -505,9 +502,9 @@ CoreLocateDevicePath (
   }\r
 \r
   CoreFreePool (Handles);\r
-   \r
+\r
   //\r
-  // If there wasn't any match, then no parts of the device path was found.  \r
+  // If there wasn't any match, then no parts of the device path was found.\r
   // Which is strange since there is likely a "root level" device path in the system.\r
   //\r
   if (BestMatch == -1) {\r
@@ -528,13 +525,13 @@ CoreLocateDevicePath (
   to the system. If Retistration is NULL return the first Protocol Interface\r
   you find.\r
 \r
-  @param  Protocol               The protocol to search for \r
-  @param  Registration           Optional Registration Key returned from \r
-                                 RegisterProtocolNotify() \r
-  @param  Interface              Return the Protocol interface (instance). \r
+  @param  Protocol               The protocol to search for\r
+  @param  Registration           Optional Registration Key returned from\r
+                                 RegisterProtocolNotify()\r
+  @param  Interface              Return the Protocol interface (instance).\r
 \r
-  @retval EFI_SUCCESS            If a valid Interface is returned \r
-  @retval EFI_INVALID_PARAMETER  Invalid parameter \r
+  @retval EFI_SUCCESS            If a valid Interface is returned\r
+  @retval EFI_INVALID_PARAMETER  Invalid parameter\r
   @retval EFI_NOT_FOUND          Protocol interface not found\r
 \r
 **/\r
@@ -554,11 +551,11 @@ CoreLocateProtocol (
   if (Interface == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   if (Protocol == NULL) {\r
     return EFI_NOT_FOUND;\r
   }\r
-  \r
+\r
   *Interface = NULL;\r
   Status = EFI_SUCCESS;\r
 \r
@@ -568,7 +565,7 @@ CoreLocateProtocol (
   Position.Protocol  = Protocol;\r
   Position.SearchKey = Registration;\r
   Position.Position  = &gHandleList;\r
-  \r
+\r
   //\r
   // Lock the protocol database\r
   //\r
@@ -589,7 +586,7 @@ CoreLocateProtocol (
 \r
     Handle = CoreGetNextLocateByProtocol (&Position, Interface);\r
   } else {\r
-    Handle = CoreGetNextLocateByRegisterNotify (&Position, Interface);   \r
+    Handle = CoreGetNextLocateByRegisterNotify (&Position, Interface);\r
   }\r
 \r
   if (Handle == NULL) {\r
@@ -598,7 +595,7 @@ CoreLocateProtocol (
     //\r
     // If this is a search by register notify and a handle was\r
     // returned, update the register notification position\r
-    // \r
+    //\r
     ProtNotify = Registration;\r
     ProtNotify->Position = ProtNotify->Position->ForwardLink;\r
   }\r
@@ -614,20 +611,20 @@ Done:
   in a buffer allocated from pool. This is a version of CoreLocateHandle()\r
   that allocates a buffer for the caller.\r
 \r
-  @param  SearchType             Specifies which handle(s) are to be returned. \r
-  @param  Protocol               Provides the protocol to search by.    This \r
-                                 parameter is only valid for SearchType \r
-                                 ByProtocol. \r
-  @param  SearchKey              Supplies the search key depending on the \r
-                                 SearchType. \r
-  @param  NumberHandles          The number of handles returned in Buffer. \r
-  @param  Buffer                 A pointer to the buffer to return the requested \r
-                                 array of  handles that support Protocol. \r
-\r
-  @retval EFI_SUCCESS            The result array of handles was returned. \r
-  @retval EFI_NOT_FOUND          No handles match the search. \r
-  @retval EFI_OUT_OF_RESOURCES   There is not enough pool memory to store the \r
-                                 matching results. \r
+  @param  SearchType             Specifies which handle(s) are to be returned.\r
+  @param  Protocol               Provides the protocol to search by.    This\r
+                                 parameter is only valid for SearchType\r
+                                 ByProtocol.\r
+  @param  SearchKey              Supplies the search key depending on the\r
+                                 SearchType.\r
+  @param  NumberHandles          The number of handles returned in Buffer.\r
+  @param  Buffer                 A pointer to the buffer to return the requested\r
+                                 array of  handles that support Protocol.\r
+\r
+  @retval EFI_SUCCESS            The result array of handles was returned.\r
+  @retval EFI_NOT_FOUND          No handles match the search.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enough pool memory to store the\r
+                                 matching results.\r
   @retval EFI_INVALID_PARAMETER  One or more paramters are not valid.\r
 \r
 **/\r