Fix bug in unload function: Check if component name protocol exist, only uninstall it when it really exists.
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Tian, Feng <feng.tian@intel.com> Reviewed-by: Jin, Eric <eric.jin@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15092 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
9325f68430
commit
18b24f924f
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
The entry point of IScsi driver.
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -439,10 +439,12 @@ EfiIScsiUnload (
|
|||||||
IN EFI_HANDLE ImageHandle
|
IN EFI_HANDLE ImageHandle
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN DeviceHandleCount;
|
UINTN DeviceHandleCount;
|
||||||
EFI_HANDLE *DeviceHandleBuffer;
|
EFI_HANDLE *DeviceHandleBuffer;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
EFI_COMPONENT_NAME_PROTOCOL *ComponentName;
|
||||||
|
EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Try to disonnect the driver from the devices it's controlling.
|
// Try to disonnect the driver from the devices it's controlling.
|
||||||
@ -454,40 +456,89 @@ EfiIScsiUnload (
|
|||||||
&DeviceHandleCount,
|
&DeviceHandleCount,
|
||||||
&DeviceHandleBuffer
|
&DeviceHandleBuffer
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
for (Index = 0; Index < DeviceHandleCount; Index++) {
|
return Status;
|
||||||
Status = gBS->DisconnectController (
|
|
||||||
DeviceHandleBuffer[Index],
|
|
||||||
ImageHandle,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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.
|
// 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 (
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
ImageHandle,
|
ImageHandle,
|
||||||
&gEfiDriverBindingProtocolGuid,
|
&gEfiDriverBindingProtocolGuid,
|
||||||
&gIScsiDriverBinding,
|
&gIScsiDriverBinding,
|
||||||
&gEfiComponentName2ProtocolGuid,
|
|
||||||
&gIScsiComponentName2,
|
|
||||||
&gEfiComponentNameProtocolGuid,
|
|
||||||
&gIScsiComponentName,
|
|
||||||
&gEfiIScsiInitiatorNameProtocolGuid,
|
&gEfiIScsiInitiatorNameProtocolGuid,
|
||||||
&gIScsiInitiatorName,
|
&gIScsiInitiatorName,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
ON_EXIT:
|
||||||
|
|
||||||
|
if (DeviceHandleBuffer != NULL) {
|
||||||
|
FreePool (DeviceHandleBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Miscellaneous routines for iSCSI driver.
|
Miscellaneous routines for 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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -852,3 +852,70 @@ IScsiOnExitBootService (
|
|||||||
|
|
||||||
IScsiSessionAbort (&Private->Session);
|
IScsiSessionAbort (&Private->Session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Tests whether a controller handle is being managed by IScsi driver.
|
||||||
|
|
||||||
|
This function tests whether the driver specified by DriverBindingHandle is
|
||||||
|
currently managing the controller specified by ControllerHandle. This test
|
||||||
|
is performed by evaluating if the the protocol specified by ProtocolGuid is
|
||||||
|
present on ControllerHandle and is was opened by DriverBindingHandle and Nic
|
||||||
|
Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.
|
||||||
|
If ProtocolGuid is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param ControllerHandle A handle for a controller to test.
|
||||||
|
@param DriverBindingHandle Specifies the driver binding handle for the
|
||||||
|
driver.
|
||||||
|
@param ProtocolGuid Specifies the protocol that the driver specified
|
||||||
|
by DriverBindingHandle opens in its Start()
|
||||||
|
function.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS ControllerHandle is managed by the driver
|
||||||
|
specified by DriverBindingHandle.
|
||||||
|
@retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
|
||||||
|
specified by DriverBindingHandle.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
IScsiTestManagedDevice (
|
||||||
|
IN EFI_HANDLE ControllerHandle,
|
||||||
|
IN EFI_HANDLE DriverBindingHandle,
|
||||||
|
IN EFI_GUID *ProtocolGuid
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
VOID *ManagedInterface;
|
||||||
|
EFI_HANDLE NicControllerHandle;
|
||||||
|
|
||||||
|
ASSERT (ProtocolGuid != NULL);
|
||||||
|
|
||||||
|
NicControllerHandle = NetLibGetNicHandle (ControllerHandle, ProtocolGuid);
|
||||||
|
if (NicControllerHandle == NULL) {
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = gBS->OpenProtocol (
|
||||||
|
ControllerHandle,
|
||||||
|
(EFI_GUID *) ProtocolGuid,
|
||||||
|
&ManagedInterface,
|
||||||
|
DriverBindingHandle,
|
||||||
|
NicControllerHandle,
|
||||||
|
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||||
|
);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
gBS->CloseProtocol (
|
||||||
|
ControllerHandle,
|
||||||
|
(EFI_GUID *) ProtocolGuid,
|
||||||
|
DriverBindingHandle,
|
||||||
|
NicControllerHandle
|
||||||
|
);
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Status != EFI_ALREADY_STARTED) {
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Miscellaneous definitions for iSCSI driver.
|
Miscellaneous definitions for 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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -275,6 +275,35 @@ IScsiOnExitBootService (
|
|||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Tests whether a controller handle is being managed by IScsi driver.
|
||||||
|
|
||||||
|
This function tests whether the driver specified by DriverBindingHandle is
|
||||||
|
currently managing the controller specified by ControllerHandle. This test
|
||||||
|
is performed by evaluating if the the protocol specified by ProtocolGuid is
|
||||||
|
present on ControllerHandle and is was opened by DriverBindingHandle and Nic
|
||||||
|
Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.
|
||||||
|
If ProtocolGuid is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param ControllerHandle A handle for a controller to test.
|
||||||
|
@param DriverBindingHandle Specifies the driver binding handle for the
|
||||||
|
driver.
|
||||||
|
@param ProtocolGuid Specifies the protocol that the driver specified
|
||||||
|
by DriverBindingHandle opens in its Start()
|
||||||
|
function.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS ControllerHandle is managed by the driver
|
||||||
|
specified by DriverBindingHandle.
|
||||||
|
@retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
|
||||||
|
specified by DriverBindingHandle.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
IScsiTestManagedDevice (
|
||||||
|
IN EFI_HANDLE ControllerHandle,
|
||||||
|
IN EFI_HANDLE DriverBindingHandle,
|
||||||
|
IN EFI_GUID *ProtocolGuid
|
||||||
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
The entry point of IScsi driver.
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -1245,10 +1245,12 @@ IScsiUnload (
|
|||||||
IN EFI_HANDLE ImageHandle
|
IN EFI_HANDLE ImageHandle
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN DeviceHandleCount;
|
UINTN DeviceHandleCount;
|
||||||
EFI_HANDLE *DeviceHandleBuffer;
|
EFI_HANDLE *DeviceHandleBuffer;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
EFI_COMPONENT_NAME_PROTOCOL *ComponentName;
|
||||||
|
EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Try to disonnect the driver from the devices it's controlling.
|
// Try to disonnect the driver from the devices it's controlling.
|
||||||
@ -1264,64 +1266,184 @@ IScsiUnload (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Disconnect the iSCSI4 driver from the controlled device.
|
||||||
|
//
|
||||||
for (Index = 0; Index < DeviceHandleCount; Index++) {
|
for (Index = 0; Index < DeviceHandleCount; Index++) {
|
||||||
gBS->DisconnectController (
|
Status = IScsiTestManagedDevice (
|
||||||
DeviceHandleBuffer[Index],
|
DeviceHandleBuffer[Index],
|
||||||
gIScsiIp4DriverBinding.DriverBindingHandle,
|
gIScsiIp4DriverBinding.DriverBindingHandle,
|
||||||
NULL
|
&gEfiTcp4ProtocolGuid)
|
||||||
);
|
;
|
||||||
gBS->DisconnectController (
|
if (EFI_ERROR (Status)) {
|
||||||
DeviceHandleBuffer[Index],
|
continue;
|
||||||
gIScsiIp6DriverBinding.DriverBindingHandle,
|
}
|
||||||
NULL
|
Status = gBS->DisconnectController (
|
||||||
);
|
DeviceHandleBuffer[Index],
|
||||||
|
gIScsiIp4DriverBinding.DriverBindingHandle,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
goto ON_EXIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Disconnect the iSCSI6 driver from the controlled device.
|
||||||
|
//
|
||||||
|
for (Index = 0; Index < DeviceHandleCount; Index++) {
|
||||||
|
Status = IScsiTestManagedDevice (
|
||||||
|
DeviceHandleBuffer[Index],
|
||||||
|
gIScsiIp6DriverBinding.DriverBindingHandle,
|
||||||
|
&gEfiTcp6ProtocolGuid
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Status = gBS->DisconnectController (
|
||||||
|
DeviceHandleBuffer[Index],
|
||||||
|
gIScsiIp6DriverBinding.DriverBindingHandle,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
goto ON_EXIT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Unload the iSCSI configuration form.
|
// Unload the iSCSI configuration form.
|
||||||
//
|
//
|
||||||
IScsiConfigFormUnload (gIScsiIp4DriverBinding.DriverBindingHandle);
|
Status = IScsiConfigFormUnload (gIScsiIp4DriverBinding.DriverBindingHandle);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
goto ON_EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Uninstall the protocols installed by iSCSI driver.
|
// Uninstall the protocols installed by iSCSI driver.
|
||||||
//
|
//
|
||||||
gBS->UninstallMultipleProtocolInterfaces (
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
ImageHandle,
|
ImageHandle,
|
||||||
&gEfiAuthenticationInfoProtocolGuid,
|
&gEfiAuthenticationInfoProtocolGuid,
|
||||||
&gIScsiAuthenticationInfo,
|
&gIScsiAuthenticationInfo,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
if (gIScsiControllerNameTable!= NULL) {
|
goto ON_EXIT;
|
||||||
FreeUnicodeStringTable (gIScsiControllerNameTable);
|
|
||||||
gIScsiControllerNameTable = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->UninstallMultipleProtocolInterfaces (
|
if (gIScsiControllerNameTable!= NULL) {
|
||||||
gIScsiIp4DriverBinding.DriverBindingHandle,
|
Status = FreeUnicodeStringTable (gIScsiControllerNameTable);
|
||||||
&gEfiDriverBindingProtocolGuid,
|
if (EFI_ERROR (Status)) {
|
||||||
&gIScsiIp4DriverBinding,
|
goto ON_EXIT;
|
||||||
&gEfiComponentName2ProtocolGuid,
|
}
|
||||||
&gIScsiComponentName2,
|
gIScsiControllerNameTable = NULL;
|
||||||
&gEfiComponentNameProtocolGuid,
|
}
|
||||||
&gIScsiComponentName,
|
|
||||||
&gEfiIScsiInitiatorNameProtocolGuid,
|
|
||||||
&gIScsiInitiatorName,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
gBS->UninstallMultipleProtocolInterfaces (
|
//
|
||||||
gIScsiIp6DriverBinding.DriverBindingHandle,
|
// Uninstall the ComponentName and ComponentName2 protocol from iSCSI4 driver binding handle
|
||||||
&gEfiDriverBindingProtocolGuid,
|
// if it has been installed.
|
||||||
&gIScsiIp6DriverBinding,
|
//
|
||||||
&gEfiComponentName2ProtocolGuid,
|
Status = gBS->HandleProtocol (
|
||||||
&gIScsiComponentName2,
|
gIScsiIp4DriverBinding.DriverBindingHandle,
|
||||||
&gEfiComponentNameProtocolGuid,
|
&gEfiComponentNameProtocolGuid,
|
||||||
&gIScsiComponentName,
|
(VOID **) &ComponentName
|
||||||
NULL
|
);
|
||||||
);
|
if (!EFI_ERROR (Status)) {
|
||||||
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
|
gIScsiIp4DriverBinding.DriverBindingHandle,
|
||||||
|
&gEfiComponentNameProtocolGuid,
|
||||||
|
ComponentName,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
goto ON_EXIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = gBS->HandleProtocol (
|
||||||
|
gIScsiIp4DriverBinding.DriverBindingHandle,
|
||||||
|
&gEfiComponentName2ProtocolGuid,
|
||||||
|
(VOID **) &ComponentName2
|
||||||
|
);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
gBS->UninstallMultipleProtocolInterfaces (
|
||||||
|
gIScsiIp4DriverBinding.DriverBindingHandle,
|
||||||
|
&gEfiComponentName2ProtocolGuid,
|
||||||
|
ComponentName2,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
goto ON_EXIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
//
|
||||||
|
// Uninstall the ComponentName and ComponentName2 protocol from iSCSI6 driver binding handle
|
||||||
|
// if it has been installed.
|
||||||
|
//
|
||||||
|
Status = gBS->HandleProtocol (
|
||||||
|
gIScsiIp6DriverBinding.DriverBindingHandle,
|
||||||
|
&gEfiComponentNameProtocolGuid,
|
||||||
|
(VOID **) &ComponentName
|
||||||
|
);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
|
gIScsiIp6DriverBinding.DriverBindingHandle,
|
||||||
|
&gEfiComponentNameProtocolGuid,
|
||||||
|
ComponentName,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
goto ON_EXIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = gBS->HandleProtocol (
|
||||||
|
gIScsiIp6DriverBinding.DriverBindingHandle,
|
||||||
|
&gEfiComponentName2ProtocolGuid,
|
||||||
|
(VOID **) &ComponentName2
|
||||||
|
);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
gBS->UninstallMultipleProtocolInterfaces (
|
||||||
|
gIScsiIp6DriverBinding.DriverBindingHandle,
|
||||||
|
&gEfiComponentName2ProtocolGuid,
|
||||||
|
ComponentName2,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
goto ON_EXIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Uninstall the IScsiInitiatorNameProtocol and all the driver binding protocols.
|
||||||
|
//
|
||||||
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
|
gIScsiIp4DriverBinding.DriverBindingHandle,
|
||||||
|
&gEfiDriverBindingProtocolGuid,
|
||||||
|
&gIScsiIp4DriverBinding,
|
||||||
|
&gEfiIScsiInitiatorNameProtocolGuid,
|
||||||
|
&gIScsiInitiatorName,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
goto ON_EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
|
gIScsiIp6DriverBinding.DriverBindingHandle,
|
||||||
|
&gEfiDriverBindingProtocolGuid,
|
||||||
|
&gIScsiIp6DriverBinding,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
ON_EXIT:
|
||||||
|
|
||||||
|
if (DeviceHandleBuffer != NULL) {
|
||||||
|
FreePool (DeviceHandleBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Miscellaneous routines for iSCSI driver.
|
Miscellaneous routines for 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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -1436,3 +1436,70 @@ IScsiOnExitBootService (
|
|||||||
IScsiSessionAbort (Private->Session);
|
IScsiSessionAbort (Private->Session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Tests whether a controller handle is being managed by IScsi driver.
|
||||||
|
|
||||||
|
This function tests whether the driver specified by DriverBindingHandle is
|
||||||
|
currently managing the controller specified by ControllerHandle. This test
|
||||||
|
is performed by evaluating if the the protocol specified by ProtocolGuid is
|
||||||
|
present on ControllerHandle and is was opened by DriverBindingHandle and Nic
|
||||||
|
Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.
|
||||||
|
If ProtocolGuid is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param ControllerHandle A handle for a controller to test.
|
||||||
|
@param DriverBindingHandle Specifies the driver binding handle for the
|
||||||
|
driver.
|
||||||
|
@param ProtocolGuid Specifies the protocol that the driver specified
|
||||||
|
by DriverBindingHandle opens in its Start()
|
||||||
|
function.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS ControllerHandle is managed by the driver
|
||||||
|
specified by DriverBindingHandle.
|
||||||
|
@retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
|
||||||
|
specified by DriverBindingHandle.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
IScsiTestManagedDevice (
|
||||||
|
IN EFI_HANDLE ControllerHandle,
|
||||||
|
IN EFI_HANDLE DriverBindingHandle,
|
||||||
|
IN EFI_GUID *ProtocolGuid
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
VOID *ManagedInterface;
|
||||||
|
EFI_HANDLE NicControllerHandle;
|
||||||
|
|
||||||
|
ASSERT (ProtocolGuid != NULL);
|
||||||
|
|
||||||
|
NicControllerHandle = NetLibGetNicHandle (ControllerHandle, ProtocolGuid);
|
||||||
|
if (NicControllerHandle == NULL) {
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = gBS->OpenProtocol (
|
||||||
|
ControllerHandle,
|
||||||
|
(EFI_GUID *) ProtocolGuid,
|
||||||
|
&ManagedInterface,
|
||||||
|
DriverBindingHandle,
|
||||||
|
NicControllerHandle,
|
||||||
|
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||||
|
);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
gBS->CloseProtocol (
|
||||||
|
ControllerHandle,
|
||||||
|
(EFI_GUID *) ProtocolGuid,
|
||||||
|
DriverBindingHandle,
|
||||||
|
NicControllerHandle
|
||||||
|
);
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Status != EFI_ALREADY_STARTED) {
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Miscellaneous definitions for iSCSI driver.
|
Miscellaneous definitions for 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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -357,4 +357,34 @@ IScsiOnExitBootService (
|
|||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Tests whether a controller handle is being managed by IScsi driver.
|
||||||
|
|
||||||
|
This function tests whether the driver specified by DriverBindingHandle is
|
||||||
|
currently managing the controller specified by ControllerHandle. This test
|
||||||
|
is performed by evaluating if the the protocol specified by ProtocolGuid is
|
||||||
|
present on ControllerHandle and is was opened by DriverBindingHandle and Nic
|
||||||
|
Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.
|
||||||
|
If ProtocolGuid is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param ControllerHandle A handle for a controller to test.
|
||||||
|
@param DriverBindingHandle Specifies the driver binding handle for the
|
||||||
|
driver.
|
||||||
|
@param ProtocolGuid Specifies the protocol that the driver specified
|
||||||
|
by DriverBindingHandle opens in its Start()
|
||||||
|
function.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS ControllerHandle is managed by the driver
|
||||||
|
specified by DriverBindingHandle.
|
||||||
|
@retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
|
||||||
|
specified by DriverBindingHandle.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
IScsiTestManagedDevice (
|
||||||
|
IN EFI_HANDLE ControllerHandle,
|
||||||
|
IN EFI_HANDLE DriverBindingHandle,
|
||||||
|
IN EFI_GUID *ProtocolGuid
|
||||||
|
);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user