summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal
diff options
context:
space:
mode:
authorhhuan13 <hhuan13@6f19259b-4bc3-4df7-8a09-765794883524>2010-07-30 08:54:45 +0000
committerhhuan13 <hhuan13@6f19259b-4bc3-4df7-8a09-765794883524>2010-07-30 08:54:45 +0000
commitfd627b160d0b5b91ee3e8af1aecea0d23a58332f (patch)
tree37c332191a657bdd1a6a489b1f5e126389935591 /MdeModulePkg/Universal
parent10c9a2e3f658058c7c79b85d3a9f2f76bf4c0fca (diff)
downloadedk2-fd627b160d0b5b91ee3e8af1aecea0d23a58332f.tar.gz
edk2-fd627b160d0b5b91ee3e8af1aecea0d23a58332f.tar.bz2
edk2-fd627b160d0b5b91ee3e8af1aecea0d23a58332f.zip
Fix a bug. iSCSI driver doesn’t follow driver model Start()/Stop() in case no configuration data for login. So when VLAN form Add/Remove items, iScsi form cannot update MAC address.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10740 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r--MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c91
-rw-r--r--MdeModulePkg/Universal/Network/IScsiDxe/IScsiImpl.h4
2 files changed, 74 insertions, 21 deletions
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c
index e673705c45..920cc94556 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 - 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2010, 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
@@ -137,16 +137,61 @@ IScsiDriverBindingStart (
{
EFI_STATUS Status;
ISCSI_DRIVER_DATA *Private;
+ VOID *Interface;
+
+ Private = IScsiCreateDriverData (This->DriverBindingHandle, ControllerHandle);
+ if (Private == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Create a underlayer child instance, but not need to configure it. Just open ChildHandle
+ // via BY_DRIVER. That is, establishing the relationship between ControllerHandle and ChildHandle.
+ // Therefore, when DisconnectController(), especially VLAN virtual controller handle,
+ // IScsiDriverBindingStop() will be called.
+ //
+ Status = NetLibCreateServiceChild (
+ ControllerHandle,
+ This->DriverBindingHandle,
+ &gEfiTcp4ServiceBindingProtocolGuid,
+ &Private->ChildHandle
+ );
+
+ if (EFI_ERROR (Status)) {
+ goto ON_ERROR;
+ }
+
+ Status = gBS->OpenProtocol (
+ Private->ChildHandle,
+ &gEfiTcp4ProtocolGuid,
+ &Interface,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (EFI_ERROR (Status)) {
+ goto ON_ERROR;
+ }
+
+ //
+ // Always install private protocol no matter what happens later. We need to
+ // keep the relationship between ControllerHandle and ChildHandle.
+ //
+ Status = gBS->InstallProtocolInterface (
+ &ControllerHandle,
+ &gIScsiPrivateGuid,
+ EFI_NATIVE_INTERFACE,
+ &Private->IScsiIdentifier
+ );
+ if (EFI_ERROR (Status)) {
+ goto ON_ERROR;
+ }
//
// Try to add a port configuration page for this controller.
//
IScsiConfigUpdateForm (This->DriverBindingHandle, ControllerHandle, TRUE);
- Private = IScsiCreateDriverData (This->DriverBindingHandle, ControllerHandle);
- if (Private == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
//
// Get the iSCSI configuration data of this controller.
//
@@ -190,19 +235,7 @@ IScsiDriverBindingStart (
if (EFI_ERROR (Status)) {
goto ON_ERROR;
}
- //
- // Install the iSCSI private stuff as a flag to indicate this controller
- // is already controlled by iSCSI driver.
- //
- Status = gBS->InstallProtocolInterface (
- &ControllerHandle,
- &gIScsiPrivateGuid,
- EFI_NATIVE_INTERFACE,
- &Private->IScsiIdentifier
- );
- if (EFI_ERROR (Status)) {
- goto ON_ERROR;
- }
+
//
// Update/Publish the iSCSI Boot Firmware Table.
//
@@ -213,7 +246,6 @@ IScsiDriverBindingStart (
ON_ERROR:
IScsiSessionAbort (&Private->Session);
- IScsiCleanDriverData (Private);
return Status;
}
@@ -312,6 +344,27 @@ IScsiDriverBindingStop (
Private = ISCSI_DRIVER_DATA_FROM_IDENTIFIER (IScsiIdentifier);
+ if (Private->ChildHandle != NULL) {
+ Status = gBS->CloseProtocol (
+ Private->ChildHandle,
+ &gEfiTcp4ProtocolGuid,
+ This->DriverBindingHandle,
+ IScsiController
+ );
+
+ ASSERT (!EFI_ERROR (Status));
+
+ Status = NetLibDestroyServiceChild (
+ IScsiController,
+ This->DriverBindingHandle,
+ &gEfiTcp4ServiceBindingProtocolGuid,
+ Private->ChildHandle
+ );
+ ASSERT (!EFI_ERROR (Status));
+ }
+
+ IScsiConfigUpdateForm (This->DriverBindingHandle, IScsiController, FALSE);
+
//
// Uninstall the private protocol.
//
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiImpl.h b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiImpl.h
index b1e804fcdb..8c761f882c 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiImpl.h
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiImpl.h
@@ -1,7 +1,7 @@
/** @file
The header file of IScsiImpl.c.
-Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2010, 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
@@ -153,7 +153,7 @@ struct _ISCSI_DRIVER_DATA {
EFI_HANDLE Image;
EFI_HANDLE Controller;
ISCSI_PRIVATE_PROTOCOL IScsiIdentifier;
-
+ EFI_HANDLE ChildHandle;
EFI_EVENT ExitBootServiceEvent;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL IScsiExtScsiPassThru;