]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UseEfiSocketLib.c - Only exit for out of resources, otherwise use all network adapters.
authorlpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 1 Jun 2012 20:01:30 +0000 (20:01 +0000)
committerlpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 1 Jun 2012 20:01:30 +0000 (20:01 +0000)
Service.c - Return EFI_SUCCESS if any of the protocols are present.  Return failure only when no protocols are available or no more memory available.

Signed-off-by: lpleahy
Reviewed-by: vzimmer
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13426 6f19259b-4bc3-4df7-8a09-765794883524

StdLib/EfiSocketLib/Service.c
StdLib/EfiSocketLib/UseEfiSocketLib.c

index 927f0e45b4977176ef98b7a2fbffbfa7313b20cc..414cace00b5dfaefc6df3c42285924a05f56748c 100644 (file)
@@ -29,7 +29,8 @@
   @param [in] Controller       Handle of device to work with.\r
 \r
   @retval EFI_SUCCESS          This driver is added to Controller.\r
-  @retval other                This driver does not support this device.\r
+  @retval EFI_OUT_OF_RESOURCES No more memory available.\r
+  @retval EFI_UNSUPPORTED      This driver does not support this device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -40,6 +41,7 @@ EslServiceConnect (
   )\r
 {\r
   BOOLEAN bInUse;\r
+  EFI_STATUS ExitStatus;\r
   UINTN LengthInBytes;\r
   UINT8 * pBuffer;\r
   CONST ESL_SOCKET_BINDING * pEnd;\r
@@ -56,7 +58,7 @@ EslServiceConnect (
   //\r
   //  Assume the list is empty\r
   //\r
-  Status = EFI_UNSUPPORTED;\r
+  ExitStatus = EFI_UNSUPPORTED;\r
   bInUse = FALSE;\r
 \r
   //\r
@@ -171,28 +173,9 @@ EslServiceConnect (
               RESTORE_TPL ( TplPrevious );\r
 \r
               //\r
-              //  Determine if the initialization was successful\r
+              //  At least one service was made available\r
               //\r
-              if ( EFI_ERROR ( Status )) {\r
-                DEBUG (( DEBUG_ERROR | DEBUG_POOL | DEBUG_INIT,\r
-                          "ERROR - Failed to initialize service %s on 0x%08x, Status: %r\r\n",\r
-                          pSocketBinding->pName,\r
-                          Controller,\r
-                          Status ));\r
-\r
-                //\r
-                //  Free the network service binding if necessary\r
-                //\r
-                gBS->UninstallMultipleProtocolInterfaces (\r
-                          Controller,\r
-                          pSocketBinding->pTagGuid,\r
-                          pService,\r
-                          NULL );\r
-                DEBUG (( DEBUG_POOL | DEBUG_INIT | DEBUG_INFO,\r
-                            "Removed:   %s TagGuid from 0x%08x\r\n",\r
-                            pSocketBinding->pName,\r
-                            Controller ));\r
-              }\r
+              ExitStatus = EFI_SUCCESS;\r
             }\r
             else {\r
               DEBUG (( DEBUG_ERROR | DEBUG_POOL | DEBUG_INIT,\r
@@ -241,6 +224,8 @@ EslServiceConnect (
           DEBUG (( DEBUG_ERROR | DEBUG_INIT,\r
                     "ERROR - Failed service allocation, Status: %r\r\n",\r
                     Status ));\r
+          ExitStatus = EFI_OUT_OF_RESOURCES;\r
+          break;\r
         }\r
       }\r
     }\r
@@ -254,8 +239,8 @@ EslServiceConnect (
   //\r
   //  Display the driver start status\r
   //\r
-  DBG_EXIT_STATUS ( Status );\r
-  return Status;\r
+  DBG_EXIT_STATUS ( ExitStatus );\r
+  return ExitStatus;\r
 }\r
 \r
 \r
index ed72e8e76368893c4f80fd55773cffb3b7d6a4ea..6f4248b3d2c51ac0f38d22a6317271675089b9d3 100644 (file)
@@ -196,10 +196,17 @@ EslServiceNetworkConnect (
         for ( Index = 0; HandleCount > Index; Index++ ) {\r
           Status = EslServiceConnect ( gImageHandle,\r
                                        pHandles[ Index ]);\r
-          if ( EFI_ERROR ( Status )) {\r
-            break;\r
+          if ( !EFI_ERROR ( Status )) {\r
+            bSomethingFound = TRUE;\r
+          }\r
+          else {\r
+            if ( EFI_OUT_OF_RESOURCES == Status ) {\r
+              //\r
+              //  Pointless to continue without memory\r
+              //\r
+              break;\r
+            }\r
           }\r
-          bSomethingFound = TRUE;\r
         }\r
 \r
         //\r