summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
diff options
context:
space:
mode:
authorLeif Lindholm <leif.lindholm@linaro.org>2014-01-24 17:18:26 +0000
committerLeif Lindholm <leif.lindholm@linaro.org>2014-01-24 17:18:26 +0000
commite1e57aa891deef00276b26a4569802a5cd13ce92 (patch)
tree9061825c6c9f5c8bed33d5b2087101ce38f23fdf /MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
parent18110e987bb049e24ade0fb63b5577def8f99114 (diff)
parent04d965c0713468e055ef328f9f49903bc5944e54 (diff)
Merging uefi-next/linaro-release into masterHEADlinaro-uefi-2014.01master
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c')
-rw-r--r--MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c95
1 files changed, 73 insertions, 22 deletions
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
index f4663d9f5..b38961047 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
@@ -1,7 +1,7 @@
/** @file
The entry point of IScsi driver.
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -439,10 +439,12 @@ EfiIScsiUnload (
IN EFI_HANDLE ImageHandle
)
{
- EFI_STATUS Status;
- UINTN DeviceHandleCount;
- EFI_HANDLE *DeviceHandleBuffer;
- UINTN Index;
+ EFI_STATUS Status;
+ UINTN DeviceHandleCount;
+ EFI_HANDLE *DeviceHandleBuffer;
+ UINTN Index;
+ EFI_COMPONENT_NAME_PROTOCOL *ComponentName;
+ EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;
//
// Try to disonnect the driver from the devices it's controlling.
@@ -454,40 +456,89 @@ EfiIScsiUnload (
&DeviceHandleCount,
&DeviceHandleBuffer
);
- if (!EFI_ERROR (Status)) {
- for (Index = 0; Index < DeviceHandleCount; Index++) {
- Status = gBS->DisconnectController (
- DeviceHandleBuffer[Index],
- ImageHandle,
- NULL
- );
- }
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
- if (DeviceHandleBuffer != NULL) {
- FreePool (DeviceHandleBuffer);
+ for (Index = 0; Index < DeviceHandleCount; Index++) {
+ Status = IScsiTestManagedDevice (
+ DeviceHandleBuffer[Index],
+ gIScsiDriverBinding.DriverBindingHandle,
+ &gEfiTcp4ProtocolGuid
+ );
+ if (EFI_ERROR (Status)) {
+ continue;
}
- }
+ Status = gBS->DisconnectController (
+ DeviceHandleBuffer[Index],
+ gIScsiDriverBinding.DriverBindingHandle,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ goto ON_EXIT;
+ }
+ }
+
//
// Unload the iSCSI configuration form.
//
- IScsiConfigFormUnload (gIScsiDriverBinding.DriverBindingHandle);
+ Status = IScsiConfigFormUnload (gIScsiDriverBinding.DriverBindingHandle);
+ if (EFI_ERROR (Status)) {
+ goto ON_EXIT;
+ }
//
- // Uninstall the protocols installed by iSCSI driver.
+ // Uninstall the ComponentName and ComponentName2 protocol from iSCSI4 driver binding handle
+ // if it has been installed.
//
+ Status = gBS->HandleProtocol (
+ gIScsiDriverBinding.DriverBindingHandle,
+ &gEfiComponentNameProtocolGuid,
+ (VOID **) &ComponentName
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->UninstallMultipleProtocolInterfaces (
+ gIScsiDriverBinding.DriverBindingHandle,
+ &gEfiComponentNameProtocolGuid,
+ ComponentName,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ goto ON_EXIT;
+ }
+ }
+
+ Status = gBS->HandleProtocol (
+ gIScsiDriverBinding.DriverBindingHandle,
+ &gEfiComponentName2ProtocolGuid,
+ (VOID **) &ComponentName2
+ );
+ if (!EFI_ERROR (Status)) {
+ gBS->UninstallMultipleProtocolInterfaces (
+ gIScsiDriverBinding.DriverBindingHandle,
+ &gEfiComponentName2ProtocolGuid,
+ ComponentName2,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ goto ON_EXIT;
+ }
+ }
+
Status = gBS->UninstallMultipleProtocolInterfaces (
ImageHandle,
&gEfiDriverBindingProtocolGuid,
&gIScsiDriverBinding,
- &gEfiComponentName2ProtocolGuid,
- &gIScsiComponentName2,
- &gEfiComponentNameProtocolGuid,
- &gIScsiComponentName,
&gEfiIScsiInitiatorNameProtocolGuid,
&gIScsiInitiatorName,
NULL
);
+ON_EXIT:
+ if (DeviceHandleBuffer != NULL) {
+ FreePool (DeviceHandleBuffer);
+ }
+
return Status;
}