summaryrefslogtreecommitdiff
path: root/StdLib
diff options
context:
space:
mode:
authorlpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524>2012-06-01 20:01:30 +0000
committerlpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524>2012-06-01 20:01:30 +0000
commit441f48f5b0847d35937534d6052f704f19019d2d (patch)
tree2687bfd5614999018edf90de491b6399501e8092 /StdLib
parent75ccc2b2111a318d25aae6df9d17590f0c04e814 (diff)
UseEfiSocketLib.c - Only exit for out of resources, otherwise use all network adapters.
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
Diffstat (limited to 'StdLib')
-rw-r--r--StdLib/EfiSocketLib/Service.c35
-rw-r--r--StdLib/EfiSocketLib/UseEfiSocketLib.c13
2 files changed, 20 insertions, 28 deletions
diff --git a/StdLib/EfiSocketLib/Service.c b/StdLib/EfiSocketLib/Service.c
index 927f0e45b..414cace00 100644
--- a/StdLib/EfiSocketLib/Service.c
+++ b/StdLib/EfiSocketLib/Service.c
@@ -29,7 +29,8 @@
@param [in] Controller Handle of device to work with.
@retval EFI_SUCCESS This driver is added to Controller.
- @retval other This driver does not support this device.
+ @retval EFI_OUT_OF_RESOURCES No more memory available.
+ @retval EFI_UNSUPPORTED This driver does not support this device.
**/
EFI_STATUS
@@ -40,6 +41,7 @@ EslServiceConnect (
)
{
BOOLEAN bInUse;
+ EFI_STATUS ExitStatus;
UINTN LengthInBytes;
UINT8 * pBuffer;
CONST ESL_SOCKET_BINDING * pEnd;
@@ -56,7 +58,7 @@ EslServiceConnect (
//
// Assume the list is empty
//
- Status = EFI_UNSUPPORTED;
+ ExitStatus = EFI_UNSUPPORTED;
bInUse = FALSE;
//
@@ -171,28 +173,9 @@ EslServiceConnect (
RESTORE_TPL ( TplPrevious );
//
- // Determine if the initialization was successful
+ // At least one service was made available
//
- if ( EFI_ERROR ( Status )) {
- DEBUG (( DEBUG_ERROR | DEBUG_POOL | DEBUG_INIT,
- "ERROR - Failed to initialize service %s on 0x%08x, Status: %r\r\n",
- pSocketBinding->pName,
- Controller,
- Status ));
-
- //
- // Free the network service binding if necessary
- //
- gBS->UninstallMultipleProtocolInterfaces (
- Controller,
- pSocketBinding->pTagGuid,
- pService,
- NULL );
- DEBUG (( DEBUG_POOL | DEBUG_INIT | DEBUG_INFO,
- "Removed: %s TagGuid from 0x%08x\r\n",
- pSocketBinding->pName,
- Controller ));
- }
+ ExitStatus = EFI_SUCCESS;
}
else {
DEBUG (( DEBUG_ERROR | DEBUG_POOL | DEBUG_INIT,
@@ -241,6 +224,8 @@ EslServiceConnect (
DEBUG (( DEBUG_ERROR | DEBUG_INIT,
"ERROR - Failed service allocation, Status: %r\r\n",
Status ));
+ ExitStatus = EFI_OUT_OF_RESOURCES;
+ break;
}
}
}
@@ -254,8 +239,8 @@ EslServiceConnect (
//
// Display the driver start status
//
- DBG_EXIT_STATUS ( Status );
- return Status;
+ DBG_EXIT_STATUS ( ExitStatus );
+ return ExitStatus;
}
diff --git a/StdLib/EfiSocketLib/UseEfiSocketLib.c b/StdLib/EfiSocketLib/UseEfiSocketLib.c
index ed72e8e76..6f4248b3d 100644
--- a/StdLib/EfiSocketLib/UseEfiSocketLib.c
+++ b/StdLib/EfiSocketLib/UseEfiSocketLib.c
@@ -196,10 +196,17 @@ EslServiceNetworkConnect (
for ( Index = 0; HandleCount > Index; Index++ ) {
Status = EslServiceConnect ( gImageHandle,
pHandles[ Index ]);
- if ( EFI_ERROR ( Status )) {
- break;
+ if ( !EFI_ERROR ( Status )) {
+ bSomethingFound = TRUE;
+ }
+ else {
+ if ( EFI_OUT_OF_RESOURCES == Status ) {
+ //
+ // Pointless to continue without memory
+ //
+ break;
+ }
}
- bSomethingFound = TRUE;
}
//