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
This commit is contained in:
lpleahy 2012-06-01 20:01:30 +00:00
parent 75ccc2b211
commit 441f48f5b0
2 changed files with 20 additions and 28 deletions

View File

@ -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;
}

View File

@ -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;
}
//