]> git.proxmox.com Git - mirror_edk2.git/commitdiff
R8 tracker sync:
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 19 Mar 2009 07:03:01 +0000 (07:03 +0000)
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 19 Mar 2009 07:03:01 +0000 (07:03 +0000)
Our UEFI Driver supports both SCSI Passthru (SPT) and Ext SCSI Passthru (That is our driver installs both SCSI Passthru and Ext SCSI Passthru). When we unload our driver SCSI Bus driver closes only ESPT and keeps SPT open. Due to this when I load my driver second time the SPT installation will fail and now attempting to unload will either crash the system or hang the system.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7906 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c

index a311d0cd2c0cbe553f0e82a182d79ccc63287d37..4d8eff6eee88231a5be9d5010caef1d5c5c7e549 100644 (file)
@@ -531,12 +531,26 @@ SCSIBusDriverBindingStop (
     // Close the bus driver\r
     //\r
     if (ScsiBusDev->ExtScsiSupport) {\r
+      //\r
+      // Close ExtPassThru Protocol from this controller handle\r
+      //\r
       gBS->CloseProtocol (\r
              Controller,\r
              &gEfiExtScsiPassThruProtocolGuid,\r
              This->DriverBindingHandle,\r
              Controller\r
              );\r
+      //\r
+      // When Start() succeeds to open ExtPassThru, it always tries to open PassThru BY_DRIVER.\r
+      // Its intent is to prevent another SCSI Bus Driver from woking on the same host handle. \r
+      // So Stop() needs to try to close PassThru if present here.\r
+      //\r
+      gBS->CloseProtocol (\r
+             Controller,\r
+             &gEfiScsiPassThruProtocolGuid,\r
+             This->DriverBindingHandle,\r
+             Controller\r
+             );\r
     } else {\r
       gBS->CloseProtocol (\r
              Controller,\r