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. @param [in] Controller Handle of device to work with.
@retval EFI_SUCCESS This driver is added to Controller. @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 EFI_STATUS
@ -40,6 +41,7 @@ EslServiceConnect (
) )
{ {
BOOLEAN bInUse; BOOLEAN bInUse;
EFI_STATUS ExitStatus;
UINTN LengthInBytes; UINTN LengthInBytes;
UINT8 * pBuffer; UINT8 * pBuffer;
CONST ESL_SOCKET_BINDING * pEnd; CONST ESL_SOCKET_BINDING * pEnd;
@ -56,7 +58,7 @@ EslServiceConnect (
// //
// Assume the list is empty // Assume the list is empty
// //
Status = EFI_UNSUPPORTED; ExitStatus = EFI_UNSUPPORTED;
bInUse = FALSE; bInUse = FALSE;
// //
@ -171,28 +173,9 @@ EslServiceConnect (
RESTORE_TPL ( TplPrevious ); RESTORE_TPL ( TplPrevious );
// //
// Determine if the initialization was successful // At least one service was made available
// //
if ( EFI_ERROR ( Status )) { ExitStatus = EFI_SUCCESS;
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 ));
}
} }
else { else {
DEBUG (( DEBUG_ERROR | DEBUG_POOL | DEBUG_INIT, DEBUG (( DEBUG_ERROR | DEBUG_POOL | DEBUG_INIT,
@ -241,6 +224,8 @@ EslServiceConnect (
DEBUG (( DEBUG_ERROR | DEBUG_INIT, DEBUG (( DEBUG_ERROR | DEBUG_INIT,
"ERROR - Failed service allocation, Status: %r\r\n", "ERROR - Failed service allocation, Status: %r\r\n",
Status )); Status ));
ExitStatus = EFI_OUT_OF_RESOURCES;
break;
} }
} }
} }
@ -254,8 +239,8 @@ EslServiceConnect (
// //
// Display the driver start status // Display the driver start status
// //
DBG_EXIT_STATUS ( Status ); DBG_EXIT_STATUS ( ExitStatus );
return Status; return ExitStatus;
} }

View File

@ -196,10 +196,17 @@ EslServiceNetworkConnect (
for ( Index = 0; HandleCount > Index; Index++ ) { for ( Index = 0; HandleCount > Index; Index++ ) {
Status = EslServiceConnect ( gImageHandle, Status = EslServiceConnect ( gImageHandle,
pHandles[ Index ]); pHandles[ Index ]);
if ( EFI_ERROR ( Status )) { if ( !EFI_ERROR ( Status )) {
break; bSomethingFound = TRUE;
}
else {
if ( EFI_OUT_OF_RESOURCES == Status ) {
//
// Pointless to continue without memory
//
break;
}
} }
bSomethingFound = TRUE;
} }
// //