diff options
38 files changed, 177 insertions, 44 deletions
diff --git a/Documentation/scsi/scsi_mid_low_api.txt b/Documentation/scsi/scsi_mid_low_api.txt index 5a066afcc672..da176c95d0fb 100644 --- a/Documentation/scsi/scsi_mid_low_api.txt +++ b/Documentation/scsi/scsi_mid_low_api.txt | |||
@@ -990,8 +990,7 @@ Details: | |||
990 | * | 990 | * |
991 | * Returns SUCCESS if command aborted else FAILED | 991 | * Returns SUCCESS if command aborted else FAILED |
992 | * | 992 | * |
993 | * Locks: struct Scsi_Host::host_lock held (with irqsave) on entry | 993 | * Locks: None held |
994 | * and assumed to be held on return. | ||
995 | * | 994 | * |
996 | * Calling context: kernel thread | 995 | * Calling context: kernel thread |
997 | * | 996 | * |
diff --git a/drivers/fc4/fc.c b/drivers/fc4/fc.c index cdea598d0c1b..fbd9ff79b7b8 100644 --- a/drivers/fc4/fc.c +++ b/drivers/fc4/fc.c | |||
@@ -1005,13 +1005,7 @@ int fcp_scsi_dev_reset(Scsi_Cmnd *SCpnt) | |||
1005 | return SUCCESS; | 1005 | return SUCCESS; |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | int fcp_scsi_bus_reset(Scsi_Cmnd *SCpnt) | 1008 | static int __fcp_scsi_host_reset(Scsi_Cmnd *SCpnt) |
1009 | { | ||
1010 | printk ("FC: bus reset!\n"); | ||
1011 | return FAILED; | ||
1012 | } | ||
1013 | |||
1014 | int fcp_scsi_host_reset(Scsi_Cmnd *SCpnt) | ||
1015 | { | 1009 | { |
1016 | fc_channel *fc = FC_SCMND(SCpnt); | 1010 | fc_channel *fc = FC_SCMND(SCpnt); |
1017 | fcp_cmnd *fcmd = FCP_CMND(SCpnt); | 1011 | fcp_cmnd *fcmd = FCP_CMND(SCpnt); |
@@ -1032,6 +1026,17 @@ int fcp_scsi_host_reset(Scsi_Cmnd *SCpnt) | |||
1032 | else return FAILED; | 1026 | else return FAILED; |
1033 | } | 1027 | } |
1034 | 1028 | ||
1029 | int fcp_scsi_host_reset(Scsi_Cmnd *SCpnt) | ||
1030 | { | ||
1031 | int rc; | ||
1032 | |||
1033 | spin_lock_irqsave(SCpnt->device->host->host_lock, flags); | ||
1034 | rc = __fcp_scsi_host_reset(SCpnt); | ||
1035 | spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags); | ||
1036 | |||
1037 | return rc; | ||
1038 | } | ||
1039 | |||
1035 | static int fcp_els_queue_it(fc_channel *fc, fcp_cmnd *fcmd) | 1040 | static int fcp_els_queue_it(fc_channel *fc, fcp_cmnd *fcmd) |
1036 | { | 1041 | { |
1037 | long i; | 1042 | long i; |
diff --git a/drivers/fc4/fc_syms.c b/drivers/fc4/fc_syms.c index 8bac2c453027..ed85dfcef69a 100644 --- a/drivers/fc4/fc_syms.c +++ b/drivers/fc4/fc_syms.c | |||
@@ -27,7 +27,6 @@ EXPORT_SYMBOL(fc_do_prli); | |||
27 | EXPORT_SYMBOL(fcp_scsi_queuecommand); | 27 | EXPORT_SYMBOL(fcp_scsi_queuecommand); |
28 | EXPORT_SYMBOL(fcp_scsi_abort); | 28 | EXPORT_SYMBOL(fcp_scsi_abort); |
29 | EXPORT_SYMBOL(fcp_scsi_dev_reset); | 29 | EXPORT_SYMBOL(fcp_scsi_dev_reset); |
30 | EXPORT_SYMBOL(fcp_scsi_bus_reset); | ||
31 | EXPORT_SYMBOL(fcp_scsi_host_reset); | 30 | EXPORT_SYMBOL(fcp_scsi_host_reset); |
32 | 31 | ||
33 | #endif /* CONFIG_MODULES */ | 32 | #endif /* CONFIG_MODULES */ |
diff --git a/drivers/fc4/fcp_impl.h b/drivers/fc4/fcp_impl.h index e44d652a83dc..c397c84bef63 100644 --- a/drivers/fc4/fcp_impl.h +++ b/drivers/fc4/fcp_impl.h | |||
@@ -158,7 +158,6 @@ int fc_do_prli(fc_channel *, unsigned char); | |||
158 | int fcp_scsi_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *)); | 158 | int fcp_scsi_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *)); |
159 | int fcp_scsi_abort(Scsi_Cmnd *); | 159 | int fcp_scsi_abort(Scsi_Cmnd *); |
160 | int fcp_scsi_dev_reset(Scsi_Cmnd *); | 160 | int fcp_scsi_dev_reset(Scsi_Cmnd *); |
161 | int fcp_scsi_bus_reset(Scsi_Cmnd *); | ||
162 | int fcp_scsi_host_reset(Scsi_Cmnd *); | 161 | int fcp_scsi_host_reset(Scsi_Cmnd *); |
163 | 162 | ||
164 | #endif /* !(_FCP_SCSI_H) */ | 163 | #endif /* !(_FCP_SCSI_H) */ |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index efae9be45370..48ff314cdfbf 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -1899,7 +1899,6 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt) | |||
1899 | { | 1899 | { |
1900 | MPT_SCSI_HOST * hd; | 1900 | MPT_SCSI_HOST * hd; |
1901 | int status = SUCCESS; | 1901 | int status = SUCCESS; |
1902 | spinlock_t *host_lock = SCpnt->device->host->host_lock; | ||
1903 | 1902 | ||
1904 | /* If we can't locate the host to reset, then we failed. */ | 1903 | /* If we can't locate the host to reset, then we failed. */ |
1905 | if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ | 1904 | if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ |
@@ -1915,7 +1914,6 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt) | |||
1915 | /* If our attempts to reset the host failed, then return a failed | 1914 | /* If our attempts to reset the host failed, then return a failed |
1916 | * status. The host will be taken off line by the SCSI mid-layer. | 1915 | * status. The host will be taken off line by the SCSI mid-layer. |
1917 | */ | 1916 | */ |
1918 | spin_unlock_irq(host_lock); | ||
1919 | if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0){ | 1917 | if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0){ |
1920 | status = FAILED; | 1918 | status = FAILED; |
1921 | } else { | 1919 | } else { |
@@ -1925,8 +1923,6 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt) | |||
1925 | hd->tmPending = 0; | 1923 | hd->tmPending = 0; |
1926 | hd->tmState = TM_STATE_NONE; | 1924 | hd->tmState = TM_STATE_NONE; |
1927 | } | 1925 | } |
1928 | spin_lock_irq(host_lock); | ||
1929 | |||
1930 | 1926 | ||
1931 | dtmprintk( ( KERN_WARNING MYNAM ": mptscsih_host_reset: " | 1927 | dtmprintk( ( KERN_WARNING MYNAM ": mptscsih_host_reset: " |
1932 | "Status = %s\n", | 1928 | "Status = %s\n", |
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index ac5a5da434b3..6965992ddbbf 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
@@ -755,8 +755,6 @@ zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt) | |||
755 | struct zfcp_unit *unit; | 755 | struct zfcp_unit *unit; |
756 | struct Scsi_Host *scsi_host = scpnt->device->host; | 756 | struct Scsi_Host *scsi_host = scpnt->device->host; |
757 | 757 | ||
758 | spin_unlock_irq(scsi_host->host_lock); | ||
759 | |||
760 | unit = (struct zfcp_unit *) scpnt->device->hostdata; | 758 | unit = (struct zfcp_unit *) scpnt->device->hostdata; |
761 | ZFCP_LOG_NORMAL("host reset because of problems with " | 759 | ZFCP_LOG_NORMAL("host reset because of problems with " |
762 | "unit 0x%016Lx\n", unit->fcp_lun); | 760 | "unit 0x%016Lx\n", unit->fcp_lun); |
@@ -764,7 +762,6 @@ zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt) | |||
764 | zfcp_erp_wait(unit->port->adapter); | 762 | zfcp_erp_wait(unit->port->adapter); |
765 | retval = SUCCESS; | 763 | retval = SUCCESS; |
766 | 764 | ||
767 | spin_lock_irq(scsi_host->host_lock); | ||
768 | return retval; | 765 | return retval; |
769 | } | 766 | } |
770 | 767 | ||
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index a2b18f5a4f93..34dbc37a79d4 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -1695,8 +1695,6 @@ static int twa_scsi_eh_reset(struct scsi_cmnd *SCpnt) | |||
1695 | 1695 | ||
1696 | tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; | 1696 | tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; |
1697 | 1697 | ||
1698 | spin_unlock_irq(tw_dev->host->host_lock); | ||
1699 | |||
1700 | tw_dev->num_resets++; | 1698 | tw_dev->num_resets++; |
1701 | 1699 | ||
1702 | printk(KERN_WARNING "3w-9xxx: scsi%d: WARNING: (0x%02X:0x%04X): Unit #%d: Command (0x%x) timed out, resetting card.\n", tw_dev->host->host_no, TW_DRIVER, 0x2c, SCpnt->device->id, SCpnt->cmnd[0]); | 1700 | printk(KERN_WARNING "3w-9xxx: scsi%d: WARNING: (0x%02X:0x%04X): Unit #%d: Command (0x%x) timed out, resetting card.\n", tw_dev->host->host_no, TW_DRIVER, 0x2c, SCpnt->device->id, SCpnt->cmnd[0]); |
@@ -1709,7 +1707,6 @@ static int twa_scsi_eh_reset(struct scsi_cmnd *SCpnt) | |||
1709 | 1707 | ||
1710 | retval = SUCCESS; | 1708 | retval = SUCCESS; |
1711 | out: | 1709 | out: |
1712 | spin_lock_irq(tw_dev->host->host_lock); | ||
1713 | return retval; | 1710 | return retval; |
1714 | } /* End twa_scsi_eh_reset() */ | 1711 | } /* End twa_scsi_eh_reset() */ |
1715 | 1712 | ||
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index 48f9ece1cbd0..b6dc576da430 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c | |||
@@ -1430,8 +1430,6 @@ static int tw_scsi_eh_reset(struct scsi_cmnd *SCpnt) | |||
1430 | 1430 | ||
1431 | tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; | 1431 | tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; |
1432 | 1432 | ||
1433 | spin_unlock_irq(tw_dev->host->host_lock); | ||
1434 | |||
1435 | tw_dev->num_resets++; | 1433 | tw_dev->num_resets++; |
1436 | 1434 | ||
1437 | printk(KERN_WARNING "3w-xxxx: scsi%d: WARNING: Unit #%d: Command (0x%x) timed out, resetting card.\n", tw_dev->host->host_no, SCpnt->device->id, SCpnt->cmnd[0]); | 1435 | printk(KERN_WARNING "3w-xxxx: scsi%d: WARNING: Unit #%d: Command (0x%x) timed out, resetting card.\n", tw_dev->host->host_no, SCpnt->device->id, SCpnt->cmnd[0]); |
@@ -1444,7 +1442,6 @@ static int tw_scsi_eh_reset(struct scsi_cmnd *SCpnt) | |||
1444 | 1442 | ||
1445 | retval = SUCCESS; | 1443 | retval = SUCCESS; |
1446 | out: | 1444 | out: |
1447 | spin_lock_irq(tw_dev->host->host_lock); | ||
1448 | return retval; | 1445 | return retval; |
1449 | } /* End tw_scsi_eh_reset() */ | 1446 | } /* End tw_scsi_eh_reset() */ |
1450 | 1447 | ||
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index 47cf9bd55d90..d151af9a6f15 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c | |||
@@ -1991,8 +1991,13 @@ NCR_700_host_reset(struct scsi_cmnd * SCp) | |||
1991 | SCp->device->host->host_no, SCp->device->id, SCp->device->lun); | 1991 | SCp->device->host->host_no, SCp->device->id, SCp->device->lun); |
1992 | scsi_print_command(SCp); | 1992 | scsi_print_command(SCp); |
1993 | 1993 | ||
1994 | spin_lock_irq(SCp->device->host->host_lock); | ||
1995 | |||
1994 | NCR_700_internal_bus_reset(SCp->device->host); | 1996 | NCR_700_internal_bus_reset(SCp->device->host); |
1995 | NCR_700_chip_reset(SCp->device->host); | 1997 | NCR_700_chip_reset(SCp->device->host); |
1998 | |||
1999 | spin_unlock_irq(SCp->device->host->host_lock); | ||
2000 | |||
1996 | return SUCCESS; | 2001 | return SUCCESS; |
1997 | } | 2002 | } |
1998 | 2003 | ||
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c index 15e4b122d56e..9d6040bfa064 100644 --- a/drivers/scsi/BusLogic.c +++ b/drivers/scsi/BusLogic.c | |||
@@ -2746,9 +2746,15 @@ static int BusLogic_host_reset(struct scsi_cmnd * SCpnt) | |||
2746 | 2746 | ||
2747 | unsigned int id = SCpnt->device->id; | 2747 | unsigned int id = SCpnt->device->id; |
2748 | struct BusLogic_TargetStatistics *stats = &HostAdapter->TargetStatistics[id]; | 2748 | struct BusLogic_TargetStatistics *stats = &HostAdapter->TargetStatistics[id]; |
2749 | int rc; | ||
2750 | |||
2751 | spin_lock_irq(SCpnt->device->host->host_lock); | ||
2752 | |||
2749 | BusLogic_IncrementErrorCounter(&stats->HostAdapterResetsRequested); | 2753 | BusLogic_IncrementErrorCounter(&stats->HostAdapterResetsRequested); |
2750 | 2754 | ||
2751 | return BusLogic_ResetHostAdapter(HostAdapter, false); | 2755 | rc = BusLogic_ResetHostAdapter(HostAdapter, false); |
2756 | spin_unlock_irq(SCpnt->device->host->host_lock); | ||
2757 | return rc; | ||
2752 | } | 2758 | } |
2753 | 2759 | ||
2754 | /* | 2760 | /* |
diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c index 7c025b6cdd7c..b2002ba6e2aa 100644 --- a/drivers/scsi/NCR53c406a.c +++ b/drivers/scsi/NCR53c406a.c | |||
@@ -725,6 +725,9 @@ static int NCR53c406a_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) | |||
725 | static int NCR53c406a_host_reset(Scsi_Cmnd * SCpnt) | 725 | static int NCR53c406a_host_reset(Scsi_Cmnd * SCpnt) |
726 | { | 726 | { |
727 | DEB(printk("NCR53c406a_reset called\n")); | 727 | DEB(printk("NCR53c406a_reset called\n")); |
728 | |||
729 | spin_lock_irq(SCpnt->device->host->host_lock); | ||
730 | |||
728 | outb(C4_IMG, CONFIG4); /* Select reg set 0 */ | 731 | outb(C4_IMG, CONFIG4); /* Select reg set 0 */ |
729 | outb(CHIP_RESET, CMD_REG); | 732 | outb(CHIP_RESET, CMD_REG); |
730 | outb(SCSI_NOP, CMD_REG); /* required after reset */ | 733 | outb(SCSI_NOP, CMD_REG); /* required after reset */ |
@@ -732,6 +735,9 @@ static int NCR53c406a_host_reset(Scsi_Cmnd * SCpnt) | |||
732 | chip_init(); | 735 | chip_init(); |
733 | 736 | ||
734 | rtrc(2); | 737 | rtrc(2); |
738 | |||
739 | spin_unlock_irq(SCpnt->device->host->host_lock); | ||
740 | |||
735 | return SUCCESS; | 741 | return SUCCESS; |
736 | } | 742 | } |
737 | 743 | ||
diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c index ce3c37610c5c..f7a1751e892d 100644 --- a/drivers/scsi/a2091.c +++ b/drivers/scsi/a2091.c | |||
@@ -222,6 +222,9 @@ static int a2091_bus_reset(Scsi_Cmnd *cmd) | |||
222 | { | 222 | { |
223 | /* FIXME perform bus-specific reset */ | 223 | /* FIXME perform bus-specific reset */ |
224 | 224 | ||
225 | /* FIXME 2: kill this function, and let midlayer fall back | ||
226 | to the same action, calling wd33c93_host_reset() */ | ||
227 | |||
225 | spin_lock_irq(cmd->device->host->host_lock); | 228 | spin_lock_irq(cmd->device->host->host_lock); |
226 | wd33c93_host_reset(cmd); | 229 | wd33c93_host_reset(cmd); |
227 | spin_unlock_irq(cmd->device->host->host_lock); | 230 | spin_unlock_irq(cmd->device->host->host_lock); |
diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c index 92698f335591..306caf56f3d9 100644 --- a/drivers/scsi/a3000.c +++ b/drivers/scsi/a3000.c | |||
@@ -208,6 +208,9 @@ fail_register: | |||
208 | static int a3000_bus_reset(Scsi_Cmnd *cmd) | 208 | static int a3000_bus_reset(Scsi_Cmnd *cmd) |
209 | { | 209 | { |
210 | /* FIXME perform bus-specific reset */ | 210 | /* FIXME perform bus-specific reset */ |
211 | |||
212 | /* FIXME 2: kill this entire function, which should | ||
213 | cause mid-layer to call wd33c93_host_reset anyway? */ | ||
211 | 214 | ||
212 | spin_lock_irq(cmd->device->host->host_lock); | 215 | spin_lock_irq(cmd->device->host->host_lock); |
213 | wd33c93_host_reset(cmd); | 216 | wd33c93_host_reset(cmd); |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index b48843402cf4..f7e9c89c4915 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -384,10 +384,13 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) | |||
384 | AAC_DRIVERNAME); | 384 | AAC_DRIVERNAME); |
385 | 385 | ||
386 | 386 | ||
387 | spin_lock_irq(host->host_lock); | ||
388 | |||
387 | aac = (struct aac_dev *)host->hostdata; | 389 | aac = (struct aac_dev *)host->hostdata; |
388 | if (aac_adapter_check_health(aac)) { | 390 | if (aac_adapter_check_health(aac)) { |
389 | printk(KERN_ERR "%s: Host adapter appears dead\n", | 391 | printk(KERN_ERR "%s: Host adapter appears dead\n", |
390 | AAC_DRIVERNAME); | 392 | AAC_DRIVERNAME); |
393 | spin_unlock_irq(host->host_lock); | ||
391 | return -ENODEV; | 394 | return -ENODEV; |
392 | } | 395 | } |
393 | /* | 396 | /* |
@@ -418,6 +421,7 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) | |||
418 | ssleep(1); | 421 | ssleep(1); |
419 | spin_lock_irq(host->host_lock); | 422 | spin_lock_irq(host->host_lock); |
420 | } | 423 | } |
424 | spin_unlock_irq(host->host_lock); | ||
421 | printk(KERN_ERR "%s: SCSI bus appears hung\n", AAC_DRIVERNAME); | 425 | printk(KERN_ERR "%s: SCSI bus appears hung\n", AAC_DRIVERNAME); |
422 | return -ETIMEDOUT; | 426 | return -ETIMEDOUT; |
423 | } | 427 | } |
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c index f911b51e3042..9ec4641a6348 100644 --- a/drivers/scsi/aha1542.c +++ b/drivers/scsi/aha1542.c | |||
@@ -1530,7 +1530,6 @@ static int aha1542_host_reset(Scsi_Cmnd * SCpnt) | |||
1530 | * check for timeout, and if we are doing something like this | 1530 | * check for timeout, and if we are doing something like this |
1531 | * we are pretty desperate anyways. | 1531 | * we are pretty desperate anyways. |
1532 | */ | 1532 | */ |
1533 | spin_unlock_irq(SCpnt->device->host->host_lock); | ||
1534 | ssleep(4); | 1533 | ssleep(4); |
1535 | spin_lock_irq(SCpnt->device->host->host_lock); | 1534 | spin_lock_irq(SCpnt->device->host->host_lock); |
1536 | 1535 | ||
@@ -1574,9 +1573,11 @@ static int aha1542_host_reset(Scsi_Cmnd * SCpnt) | |||
1574 | } | 1573 | } |
1575 | } | 1574 | } |
1576 | 1575 | ||
1576 | spin_unlock_irq(SCpnt->device->host->host_lock); | ||
1577 | return SUCCESS; | 1577 | return SUCCESS; |
1578 | 1578 | ||
1579 | fail: | 1579 | fail: |
1580 | spin_unlock_irq(SCpnt->device->host->host_lock); | ||
1580 | return FAILED; | 1581 | return FAILED; |
1581 | } | 1582 | } |
1582 | 1583 | ||
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c index 1e83096bb911..fac091e7093c 100644 --- a/drivers/scsi/aic7xxx_old.c +++ b/drivers/scsi/aic7xxx_old.c | |||
@@ -10845,6 +10845,8 @@ aic7xxx_reset(Scsi_Cmnd *cmd) | |||
10845 | struct aic_dev_data *aic_dev; | 10845 | struct aic_dev_data *aic_dev; |
10846 | 10846 | ||
10847 | p = (struct aic7xxx_host *) cmd->device->host->hostdata; | 10847 | p = (struct aic7xxx_host *) cmd->device->host->hostdata; |
10848 | spin_lock_irq(p->host->host_lock); | ||
10849 | |||
10848 | aic_dev = AIC_DEV(cmd); | 10850 | aic_dev = AIC_DEV(cmd); |
10849 | if(aic7xxx_position(cmd) < p->scb_data->numscbs) | 10851 | if(aic7xxx_position(cmd) < p->scb_data->numscbs) |
10850 | { | 10852 | { |
@@ -10884,6 +10886,7 @@ aic7xxx_reset(Scsi_Cmnd *cmd) | |||
10884 | * longer have it. | 10886 | * longer have it. |
10885 | */ | 10887 | */ |
10886 | unpause_sequencer(p, FALSE); | 10888 | unpause_sequencer(p, FALSE); |
10889 | spin_unlock_irq(p->host->host_lock); | ||
10887 | return SUCCESS; | 10890 | return SUCCESS; |
10888 | } | 10891 | } |
10889 | 10892 | ||
@@ -10907,7 +10910,6 @@ aic7xxx_reset(Scsi_Cmnd *cmd) | |||
10907 | unpause_sequencer(p, FALSE); | 10910 | unpause_sequencer(p, FALSE); |
10908 | spin_unlock_irq(p->host->host_lock); | 10911 | spin_unlock_irq(p->host->host_lock); |
10909 | ssleep(2); | 10912 | ssleep(2); |
10910 | spin_lock_irq(p->host->host_lock); | ||
10911 | return SUCCESS; | 10913 | return SUCCESS; |
10912 | } | 10914 | } |
10913 | 10915 | ||
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index 3838f88e1fe0..4772fb317f3e 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c | |||
@@ -2659,6 +2659,8 @@ int fas216_eh_host_reset(Scsi_Cmnd *SCpnt) | |||
2659 | { | 2659 | { |
2660 | FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; | 2660 | FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; |
2661 | 2661 | ||
2662 | spin_lock_irq(info->host->host_lock); | ||
2663 | |||
2662 | fas216_checkmagic(info); | 2664 | fas216_checkmagic(info); |
2663 | 2665 | ||
2664 | printk("scsi%d.%c: %s: resetting host\n", | 2666 | printk("scsi%d.%c: %s: resetting host\n", |
@@ -2686,6 +2688,7 @@ int fas216_eh_host_reset(Scsi_Cmnd *SCpnt) | |||
2686 | 2688 | ||
2687 | fas216_init_chip(info); | 2689 | fas216_init_chip(info); |
2688 | 2690 | ||
2691 | spin_unlock_irq(info->host->host_lock); | ||
2689 | return SUCCESS; | 2692 | return SUCCESS; |
2690 | } | 2693 | } |
2691 | 2694 | ||
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 2fd728731d5e..9cc0015b717d 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -746,7 +746,7 @@ static int adpt_bus_reset(struct scsi_cmnd* cmd) | |||
746 | } | 746 | } |
747 | 747 | ||
748 | // This version of reset is called by the eh_error_handler | 748 | // This version of reset is called by the eh_error_handler |
749 | static int adpt_reset(struct scsi_cmnd* cmd) | 749 | static int __adpt_reset(struct scsi_cmnd* cmd) |
750 | { | 750 | { |
751 | adpt_hba* pHba; | 751 | adpt_hba* pHba; |
752 | int rcode; | 752 | int rcode; |
@@ -762,6 +762,17 @@ static int adpt_reset(struct scsi_cmnd* cmd) | |||
762 | } | 762 | } |
763 | } | 763 | } |
764 | 764 | ||
765 | static int adpt_reset(struct scsi_cmnd* cmd) | ||
766 | { | ||
767 | int rc; | ||
768 | |||
769 | spin_lock_irq(cmd->device->host->host_lock); | ||
770 | rc = __adpt_reset(cmd); | ||
771 | spin_unlock_irq(cmd->device->host->host_lock); | ||
772 | |||
773 | return rc; | ||
774 | } | ||
775 | |||
765 | // This version of reset is called by the ioctls and indirectly from eh_error_handler via adpt_reset | 776 | // This version of reset is called by the ioctls and indirectly from eh_error_handler via adpt_reset |
766 | static int adpt_hba_reset(adpt_hba* pHba) | 777 | static int adpt_hba_reset(adpt_hba* pHba) |
767 | { | 778 | { |
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c index 8394529ba552..1bb8727eea3e 100644 --- a/drivers/scsi/eata.c +++ b/drivers/scsi/eata.c | |||
@@ -1948,16 +1948,20 @@ static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg) | |||
1948 | ha->board_name, SCarg->device->channel, SCarg->device->id, | 1948 | ha->board_name, SCarg->device->channel, SCarg->device->id, |
1949 | SCarg->device->lun, SCarg->pid); | 1949 | SCarg->device->lun, SCarg->pid); |
1950 | 1950 | ||
1951 | spin_lock_irq(shost->host_lock); | ||
1952 | |||
1951 | if (SCarg->host_scribble == NULL) | 1953 | if (SCarg->host_scribble == NULL) |
1952 | printk("%s: reset, pid %ld inactive.\n", ha->board_name, SCarg->pid); | 1954 | printk("%s: reset, pid %ld inactive.\n", ha->board_name, SCarg->pid); |
1953 | 1955 | ||
1954 | if (ha->in_reset) { | 1956 | if (ha->in_reset) { |
1955 | printk("%s: reset, exit, already in reset.\n", ha->board_name); | 1957 | printk("%s: reset, exit, already in reset.\n", ha->board_name); |
1958 | spin_unlock_irq(shost->host_lock); | ||
1956 | return FAILED; | 1959 | return FAILED; |
1957 | } | 1960 | } |
1958 | 1961 | ||
1959 | if (wait_on_busy(shost->io_port, MAXLOOP)) { | 1962 | if (wait_on_busy(shost->io_port, MAXLOOP)) { |
1960 | printk("%s: reset, exit, timeout error.\n", ha->board_name); | 1963 | printk("%s: reset, exit, timeout error.\n", ha->board_name); |
1964 | spin_unlock_irq(shost->host_lock); | ||
1961 | return FAILED; | 1965 | return FAILED; |
1962 | } | 1966 | } |
1963 | 1967 | ||
@@ -2012,6 +2016,7 @@ static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg) | |||
2012 | 2016 | ||
2013 | if (do_dma(shost->io_port, 0, RESET_PIO)) { | 2017 | if (do_dma(shost->io_port, 0, RESET_PIO)) { |
2014 | printk("%s: reset, cannot reset, timeout error.\n", ha->board_name); | 2018 | printk("%s: reset, cannot reset, timeout error.\n", ha->board_name); |
2019 | spin_unlock_irq(shost->host_lock); | ||
2015 | return FAILED; | 2020 | return FAILED; |
2016 | } | 2021 | } |
2017 | 2022 | ||
@@ -2024,9 +2029,12 @@ static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg) | |||
2024 | ha->in_reset = 1; | 2029 | ha->in_reset = 1; |
2025 | 2030 | ||
2026 | spin_unlock_irq(shost->host_lock); | 2031 | spin_unlock_irq(shost->host_lock); |
2032 | |||
2033 | /* FIXME: use a sleep instead */ | ||
2027 | time = jiffies; | 2034 | time = jiffies; |
2028 | while ((jiffies - time) < (10 * HZ) && limit++ < 200000) | 2035 | while ((jiffies - time) < (10 * HZ) && limit++ < 200000) |
2029 | udelay(100L); | 2036 | udelay(100L); |
2037 | |||
2030 | spin_lock_irq(shost->host_lock); | 2038 | spin_lock_irq(shost->host_lock); |
2031 | 2039 | ||
2032 | printk("%s: reset, interrupts disabled, loops %d.\n", ha->board_name, limit); | 2040 | printk("%s: reset, interrupts disabled, loops %d.\n", ha->board_name, limit); |
@@ -2076,6 +2084,7 @@ static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg) | |||
2076 | else | 2084 | else |
2077 | printk("%s: reset, exit.\n", ha->board_name); | 2085 | printk("%s: reset, exit.\n", ha->board_name); |
2078 | 2086 | ||
2087 | spin_unlock_irq(shost->host_lock); | ||
2079 | return SUCCESS; | 2088 | return SUCCESS; |
2080 | } | 2089 | } |
2081 | 2090 | ||
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c index 0ee49dc50b85..04a06b71a5e2 100644 --- a/drivers/scsi/eata_pio.c +++ b/drivers/scsi/eata_pio.c | |||
@@ -486,8 +486,11 @@ static int eata_pio_host_reset(struct scsi_cmnd *cmd) | |||
486 | 486 | ||
487 | DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset called pid:%ld target:" " %x lun: %x reason %x\n", cmd->pid, cmd->device->id, cmd->device->lun, cmd->abort_reason)); | 487 | DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset called pid:%ld target:" " %x lun: %x reason %x\n", cmd->pid, cmd->device->id, cmd->device->lun, cmd->abort_reason)); |
488 | 488 | ||
489 | spin_lock_irq(host->host_lock); | ||
490 | |||
489 | if (HD(cmd)->state == RESET) { | 491 | if (HD(cmd)->state == RESET) { |
490 | printk(KERN_WARNING "eata_pio_reset: exit, already in reset.\n"); | 492 | printk(KERN_WARNING "eata_pio_reset: exit, already in reset.\n"); |
493 | spin_unlock_irq(host->host_lock); | ||
491 | return FAILED; | 494 | return FAILED; |
492 | } | 495 | } |
493 | 496 | ||
@@ -536,6 +539,8 @@ static int eata_pio_host_reset(struct scsi_cmnd *cmd) | |||
536 | 539 | ||
537 | HD(cmd)->state = 0; | 540 | HD(cmd)->state = 0; |
538 | 541 | ||
542 | spin_unlock_irq(host->host_lock); | ||
543 | |||
539 | if (success) { /* hmmm... */ | 544 | if (success) { /* hmmm... */ |
540 | DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: exit, success.\n")); | 545 | DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: exit, success.\n")); |
541 | return SUCCESS; | 546 | return SUCCESS; |
diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c index 66990af1dc9c..d12342fa8199 100644 --- a/drivers/scsi/gvp11.c +++ b/drivers/scsi/gvp11.c | |||
@@ -346,6 +346,10 @@ static int gvp11_bus_reset(Scsi_Cmnd *cmd) | |||
346 | { | 346 | { |
347 | /* FIXME perform bus-specific reset */ | 347 | /* FIXME perform bus-specific reset */ |
348 | 348 | ||
349 | /* FIXME 2: shouldn't we no-op this function (return | ||
350 | FAILED), and fall back to host reset function, | ||
351 | wd33c93_host_reset ? */ | ||
352 | |||
349 | spin_lock_irq(cmd->device->host->host_lock); | 353 | spin_lock_irq(cmd->device->host->host_lock); |
350 | wd33c93_host_reset(cmd); | 354 | wd33c93_host_reset(cmd); |
351 | spin_unlock_irq(cmd->device->host->host_lock); | 355 | spin_unlock_irq(cmd->device->host->host_lock); |
diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c index 0018fb5c09a9..b5dc35355570 100644 --- a/drivers/scsi/ibmmca.c +++ b/drivers/scsi/ibmmca.c | |||
@@ -2237,7 +2237,7 @@ static int ibmmca_abort(Scsi_Cmnd * cmd) | |||
2237 | return rc; | 2237 | return rc; |
2238 | } | 2238 | } |
2239 | 2239 | ||
2240 | static int ibmmca_host_reset(Scsi_Cmnd * cmd) | 2240 | static int __ibmmca_host_reset(Scsi_Cmnd * cmd) |
2241 | { | 2241 | { |
2242 | struct Scsi_Host *shpnt; | 2242 | struct Scsi_Host *shpnt; |
2243 | Scsi_Cmnd *cmd_aid; | 2243 | Scsi_Cmnd *cmd_aid; |
@@ -2324,6 +2324,18 @@ static int ibmmca_host_reset(Scsi_Cmnd * cmd) | |||
2324 | return SUCCESS; | 2324 | return SUCCESS; |
2325 | } | 2325 | } |
2326 | 2326 | ||
2327 | static int ibmmca_host_reset(Scsi_Cmnd * cmd) | ||
2328 | { | ||
2329 | struct Scsi_Host *shpnt = cmd->device->host; | ||
2330 | int rc; | ||
2331 | |||
2332 | spin_lock_irq(shpnt->host_lock); | ||
2333 | rc = __ibmmca_host_reset(cmd); | ||
2334 | spin_unlock_irq(shpnt->host_lock); | ||
2335 | |||
2336 | return rc; | ||
2337 | } | ||
2338 | |||
2327 | static int ibmmca_biosparam(struct scsi_device *sdev, struct block_device *bdev, sector_t capacity, int *info) | 2339 | static int ibmmca_biosparam(struct scsi_device *sdev, struct block_device *bdev, sector_t capacity, int *info) |
2328 | { | 2340 | { |
2329 | int size = capacity; | 2341 | int size = capacity; |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 83f062ed9082..3d62c9bcbff7 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
47 | #include <linux/ide.h> | 47 | #include <linux/ide.h> |
48 | #include <linux/scatterlist.h> | 48 | #include <linux/scatterlist.h> |
49 | #include <linux/delay.h> | ||
49 | 50 | ||
50 | #include <asm/io.h> | 51 | #include <asm/io.h> |
51 | #include <asm/bitops.h> | 52 | #include <asm/bitops.h> |
@@ -1026,11 +1027,13 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd) | |||
1026 | return FAILED; | 1027 | return FAILED; |
1027 | } | 1028 | } |
1028 | 1029 | ||
1029 | spin_lock_irq(&ide_lock); | 1030 | spin_lock_irq(cmd->device->host->host_lock); |
1031 | spin_lock(&ide_lock); | ||
1030 | 1032 | ||
1031 | if (!scsi->pc || (req = scsi->pc->rq) != HWGROUP(drive)->rq || !HWGROUP(drive)->handler) { | 1033 | if (!scsi->pc || (req = scsi->pc->rq) != HWGROUP(drive)->rq || !HWGROUP(drive)->handler) { |
1032 | printk (KERN_WARNING "ide-scsi: No active request in idescsi_eh_reset\n"); | 1034 | printk (KERN_WARNING "ide-scsi: No active request in idescsi_eh_reset\n"); |
1033 | spin_unlock(&ide_lock); | 1035 | spin_unlock(&ide_lock); |
1036 | spin_unlock_irq(cmd->device->host->host_lock); | ||
1034 | return FAILED; | 1037 | return FAILED; |
1035 | } | 1038 | } |
1036 | 1039 | ||
@@ -1052,16 +1055,15 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd) | |||
1052 | HWGROUP(drive)->rq = NULL; | 1055 | HWGROUP(drive)->rq = NULL; |
1053 | HWGROUP(drive)->handler = NULL; | 1056 | HWGROUP(drive)->handler = NULL; |
1054 | HWGROUP(drive)->busy = 1; /* will set this to zero when ide reset finished */ | 1057 | HWGROUP(drive)->busy = 1; /* will set this to zero when ide reset finished */ |
1055 | spin_unlock_irq(&ide_lock); | 1058 | spin_unlock(&ide_lock); |
1056 | 1059 | ||
1057 | ide_do_reset(drive); | 1060 | ide_do_reset(drive); |
1058 | 1061 | ||
1059 | /* ide_do_reset starts a polling handler which restarts itself every 50ms until the reset finishes */ | 1062 | /* ide_do_reset starts a polling handler which restarts itself every 50ms until the reset finishes */ |
1060 | 1063 | ||
1061 | do { | 1064 | do { |
1062 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
1063 | spin_unlock_irq(cmd->device->host->host_lock); | 1065 | spin_unlock_irq(cmd->device->host->host_lock); |
1064 | schedule_timeout(HZ/20); | 1066 | msleep(50); |
1065 | spin_lock_irq(cmd->device->host->host_lock); | 1067 | spin_lock_irq(cmd->device->host->host_lock); |
1066 | } while ( HWGROUP(drive)->handler ); | 1068 | } while ( HWGROUP(drive)->handler ); |
1067 | 1069 | ||
@@ -1072,6 +1074,7 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd) | |||
1072 | ret = FAILED; | 1074 | ret = FAILED; |
1073 | } | 1075 | } |
1074 | 1076 | ||
1077 | spin_unlock_irq(cmd->device->host->host_lock); | ||
1075 | return ret; | 1078 | return ret; |
1076 | } | 1079 | } |
1077 | 1080 | ||
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index fd8af643feac..17b106b79f72 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -2885,7 +2885,7 @@ static int ipr_slave_alloc(struct scsi_device *sdev) | |||
2885 | * Return value: | 2885 | * Return value: |
2886 | * SUCCESS / FAILED | 2886 | * SUCCESS / FAILED |
2887 | **/ | 2887 | **/ |
2888 | static int ipr_eh_host_reset(struct scsi_cmnd * scsi_cmd) | 2888 | static int __ipr_eh_host_reset(struct scsi_cmnd * scsi_cmd) |
2889 | { | 2889 | { |
2890 | struct ipr_ioa_cfg *ioa_cfg; | 2890 | struct ipr_ioa_cfg *ioa_cfg; |
2891 | int rc; | 2891 | int rc; |
@@ -2905,6 +2905,17 @@ static int ipr_eh_host_reset(struct scsi_cmnd * scsi_cmd) | |||
2905 | return rc; | 2905 | return rc; |
2906 | } | 2906 | } |
2907 | 2907 | ||
2908 | static int ipr_eh_host_reset(struct scsi_cmnd * cmd) | ||
2909 | { | ||
2910 | int rc; | ||
2911 | |||
2912 | spin_lock_irq(cmd->device->host->host_lock); | ||
2913 | rc = __ipr_eh_host_reset(cmd); | ||
2914 | spin_unlock_irq(cmd->device->host->host_lock); | ||
2915 | |||
2916 | return rc; | ||
2917 | } | ||
2918 | |||
2908 | /** | 2919 | /** |
2909 | * ipr_eh_dev_reset - Reset the device | 2920 | * ipr_eh_dev_reset - Reset the device |
2910 | * @scsi_cmd: scsi command struct | 2921 | * @scsi_cmd: scsi command struct |
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 6572e100f7b2..6dfcb4fbccdd 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c | |||
@@ -873,7 +873,7 @@ ips_eh_abort(Scsi_Cmnd * SC) | |||
873 | /* */ | 873 | /* */ |
874 | /****************************************************************************/ | 874 | /****************************************************************************/ |
875 | static int | 875 | static int |
876 | ips_eh_reset(Scsi_Cmnd * SC) | 876 | __ips_eh_reset(Scsi_Cmnd * SC) |
877 | { | 877 | { |
878 | int ret; | 878 | int ret; |
879 | int i; | 879 | int i; |
@@ -1060,6 +1060,18 @@ ips_eh_reset(Scsi_Cmnd * SC) | |||
1060 | 1060 | ||
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | static int | ||
1064 | ips_eh_reset(Scsi_Cmnd * SC) | ||
1065 | { | ||
1066 | int rc; | ||
1067 | |||
1068 | spin_lock_irq(SC->device->host->host_lock); | ||
1069 | rc = __ips_eh_reset(SC); | ||
1070 | spin_unlock_irq(SC->device->host->host_lock); | ||
1071 | |||
1072 | return rc; | ||
1073 | } | ||
1074 | |||
1063 | /****************************************************************************/ | 1075 | /****************************************************************************/ |
1064 | /* */ | 1076 | /* */ |
1065 | /* Routine Name: ips_queue */ | 1077 | /* Routine Name: ips_queue */ |
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c index 9a792a5494b5..edd47d1f0b17 100644 --- a/drivers/scsi/mac53c94.c +++ b/drivers/scsi/mac53c94.c | |||
@@ -103,6 +103,9 @@ static int mac53c94_host_reset(struct scsi_cmnd *cmd) | |||
103 | struct fsc_state *state = (struct fsc_state *) cmd->device->host->hostdata; | 103 | struct fsc_state *state = (struct fsc_state *) cmd->device->host->hostdata; |
104 | struct mac53c94_regs __iomem *regs = state->regs; | 104 | struct mac53c94_regs __iomem *regs = state->regs; |
105 | struct dbdma_regs __iomem *dma = state->dma; | 105 | struct dbdma_regs __iomem *dma = state->dma; |
106 | unsigned long flags; | ||
107 | |||
108 | spin_lock_irqsave(cmd->device->host->host_lock, flags); | ||
106 | 109 | ||
107 | writel((RUN|PAUSE|FLUSH|WAKE) << 16, &dma->control); | 110 | writel((RUN|PAUSE|FLUSH|WAKE) << 16, &dma->control); |
108 | writeb(CMD_SCSI_RESET, ®s->command); /* assert RST */ | 111 | writeb(CMD_SCSI_RESET, ®s->command); /* assert RST */ |
@@ -111,6 +114,8 @@ static int mac53c94_host_reset(struct scsi_cmnd *cmd) | |||
111 | udelay(20); | 114 | udelay(20); |
112 | mac53c94_init(state); | 115 | mac53c94_init(state); |
113 | writeb(CMD_NOP, ®s->command); | 116 | writeb(CMD_NOP, ®s->command); |
117 | |||
118 | spin_unlock_irqrestore(cmd->device->host->host_lock, flags); | ||
114 | return SUCCESS; | 119 | return SUCCESS; |
115 | } | 120 | } |
116 | 121 | ||
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index f6da46d672f1..b05737ae5eff 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c | |||
@@ -1715,9 +1715,12 @@ static int mesh_host_reset(struct scsi_cmnd *cmd) | |||
1715 | struct mesh_state *ms = (struct mesh_state *) cmd->device->host->hostdata; | 1715 | struct mesh_state *ms = (struct mesh_state *) cmd->device->host->hostdata; |
1716 | volatile struct mesh_regs __iomem *mr = ms->mesh; | 1716 | volatile struct mesh_regs __iomem *mr = ms->mesh; |
1717 | volatile struct dbdma_regs __iomem *md = ms->dma; | 1717 | volatile struct dbdma_regs __iomem *md = ms->dma; |
1718 | unsigned long flags; | ||
1718 | 1719 | ||
1719 | printk(KERN_DEBUG "mesh_host_reset\n"); | 1720 | printk(KERN_DEBUG "mesh_host_reset\n"); |
1720 | 1721 | ||
1722 | spin_lock_irqsave(ms->host->host_lock, flags); | ||
1723 | |||
1721 | /* Reset the controller & dbdma channel */ | 1724 | /* Reset the controller & dbdma channel */ |
1722 | out_le32(&md->control, (RUN|PAUSE|FLUSH|WAKE) << 16); /* stop dma */ | 1725 | out_le32(&md->control, (RUN|PAUSE|FLUSH|WAKE) << 16); /* stop dma */ |
1723 | out_8(&mr->exception, 0xff); /* clear all exception bits */ | 1726 | out_8(&mr->exception, 0xff); /* clear all exception bits */ |
@@ -1739,6 +1742,7 @@ static int mesh_host_reset(struct scsi_cmnd *cmd) | |||
1739 | /* Complete pending commands */ | 1742 | /* Complete pending commands */ |
1740 | handle_reset(ms); | 1743 | handle_reset(ms); |
1741 | 1744 | ||
1745 | spin_unlock_irqrestore(ms->host->host_lock, flags); | ||
1742 | return SUCCESS; | 1746 | return SUCCESS; |
1743 | } | 1747 | } |
1744 | 1748 | ||
diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c index 5c42021189eb..2fb31ee6d9f5 100644 --- a/drivers/scsi/mvme147.c +++ b/drivers/scsi/mvme147.c | |||
@@ -117,6 +117,9 @@ static int mvme147_bus_reset(Scsi_Cmnd *cmd) | |||
117 | { | 117 | { |
118 | /* FIXME perform bus-specific reset */ | 118 | /* FIXME perform bus-specific reset */ |
119 | 119 | ||
120 | /* FIXME 2: kill this function, and let midlayer fallback to | ||
121 | the same result, calling wd33c93_host_reset() */ | ||
122 | |||
120 | spin_lock_irq(cmd->device->host->host_lock); | 123 | spin_lock_irq(cmd->device->host->host_lock); |
121 | wd33c93_host_reset(cmd); | 124 | wd33c93_host_reset(cmd); |
122 | spin_unlock_irq(cmd->device->host->host_lock); | 125 | spin_unlock_irq(cmd->device->host->host_lock); |
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c index 6f15e7adbc65..5159ceea319e 100644 --- a/drivers/scsi/nsp32.c +++ b/drivers/scsi/nsp32.c | |||
@@ -3051,11 +3051,14 @@ static int nsp32_eh_host_reset(struct scsi_cmnd *SCpnt) | |||
3051 | nsp32_msg(KERN_INFO, "Host Reset"); | 3051 | nsp32_msg(KERN_INFO, "Host Reset"); |
3052 | nsp32_dbg(NSP32_DEBUG_BUSRESET, "SCpnt=0x%x", SCpnt); | 3052 | nsp32_dbg(NSP32_DEBUG_BUSRESET, "SCpnt=0x%x", SCpnt); |
3053 | 3053 | ||
3054 | spin_lock_irq(SCpnt->device->host->host_lock); | ||
3055 | |||
3054 | nsp32hw_init(data); | 3056 | nsp32hw_init(data); |
3055 | nsp32_write2(base, IRQ_CONTROL, IRQ_CONTROL_ALL_IRQ_MASK); | 3057 | nsp32_write2(base, IRQ_CONTROL, IRQ_CONTROL_ALL_IRQ_MASK); |
3056 | nsp32_do_bus_reset(data); | 3058 | nsp32_do_bus_reset(data); |
3057 | nsp32_write2(base, IRQ_CONTROL, 0); | 3059 | nsp32_write2(base, IRQ_CONTROL, 0); |
3058 | 3060 | ||
3061 | spin_unlock_irq(SCpnt->device->host->host_lock); | ||
3059 | return SUCCESS; /* Host reset is succeeded at any time. */ | 3062 | return SUCCESS; /* Host reset is succeeded at any time. */ |
3060 | } | 3063 | } |
3061 | 3064 | ||
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 8457d0d7748a..1667da9508b4 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c | |||
@@ -627,7 +627,9 @@ SYM53C500_host_reset(struct scsi_cmnd *SCpnt) | |||
627 | int port_base = SCpnt->device->host->io_port; | 627 | int port_base = SCpnt->device->host->io_port; |
628 | 628 | ||
629 | DEB(printk("SYM53C500_host_reset called\n")); | 629 | DEB(printk("SYM53C500_host_reset called\n")); |
630 | spin_lock_irq(SCpnt->device->host->host_lock); | ||
630 | SYM53C500_int_host_reset(port_base); | 631 | SYM53C500_int_host_reset(port_base); |
632 | spin_unlock_irq(SCpnt->device->host->host_lock); | ||
631 | 633 | ||
632 | return SUCCESS; | 634 | return SUCCESS; |
633 | } | 635 | } |
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index d26dbe2a33fe..1a4ce1c39478 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c | |||
@@ -1146,7 +1146,13 @@ qla1280_eh_bus_reset(struct scsi_cmnd *cmd) | |||
1146 | static int | 1146 | static int |
1147 | qla1280_eh_adapter_reset(struct scsi_cmnd *cmd) | 1147 | qla1280_eh_adapter_reset(struct scsi_cmnd *cmd) |
1148 | { | 1148 | { |
1149 | return qla1280_error_action(cmd, ADAPTER_RESET); | 1149 | int rc; |
1150 | |||
1151 | spin_lock_irq(cmd->device->host->host_lock); | ||
1152 | rc = qla1280_error_action(cmd, ADAPTER_RESET); | ||
1153 | spin_unlock_irq(cmd->device->host->host_lock); | ||
1154 | |||
1155 | return rc; | ||
1150 | } | 1156 | } |
1151 | 1157 | ||
1152 | static int | 1158 | static int |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index e9091f9fbf25..f12a2b6fa7a0 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -815,8 +815,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | |||
815 | qla_printk(KERN_INFO, ha, | 815 | qla_printk(KERN_INFO, ha, |
816 | "scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", ha->host_no, id, lun); | 816 | "scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", ha->host_no, id, lun); |
817 | 817 | ||
818 | spin_unlock_irq(ha->host->host_lock); | ||
819 | |||
820 | if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) | 818 | if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) |
821 | goto eh_host_reset_lock; | 819 | goto eh_host_reset_lock; |
822 | 820 | ||
@@ -845,8 +843,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | |||
845 | ret = SUCCESS; | 843 | ret = SUCCESS; |
846 | 844 | ||
847 | eh_host_reset_lock: | 845 | eh_host_reset_lock: |
848 | spin_lock_irq(ha->host->host_lock); | ||
849 | |||
850 | qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__, | 846 | qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__, |
851 | (ret == FAILED) ? "failed" : "succeded"); | 847 | (ret == FAILED) ? "failed" : "succeded"); |
852 | 848 | ||
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index be56ee67b7fe..ceb4e0c99b37 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -1082,9 +1082,7 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd) | |||
1082 | if (!scmd->device->host->hostt->eh_host_reset_handler) | 1082 | if (!scmd->device->host->hostt->eh_host_reset_handler) |
1083 | return FAILED; | 1083 | return FAILED; |
1084 | 1084 | ||
1085 | spin_lock_irqsave(scmd->device->host->host_lock, flags); | ||
1086 | rtn = scmd->device->host->hostt->eh_host_reset_handler(scmd); | 1085 | rtn = scmd->device->host->hostt->eh_host_reset_handler(scmd); |
1087 | spin_unlock_irqrestore(scmd->device->host->host_lock, flags); | ||
1088 | 1086 | ||
1089 | if (rtn == SUCCESS) { | 1087 | if (rtn == SUCCESS) { |
1090 | if (!scmd->device->host->hostt->skip_settle_delay) | 1088 | if (!scmd->device->host->hostt->skip_settle_delay) |
diff --git a/drivers/scsi/sgiwd93.c b/drivers/scsi/sgiwd93.c index ed66828705e1..a5ba2c692752 100644 --- a/drivers/scsi/sgiwd93.c +++ b/drivers/scsi/sgiwd93.c | |||
@@ -311,6 +311,9 @@ static int sgiwd93_bus_reset(Scsi_Cmnd *cmd) | |||
311 | { | 311 | { |
312 | /* FIXME perform bus-specific reset */ | 312 | /* FIXME perform bus-specific reset */ |
313 | 313 | ||
314 | /* FIXME 2: kill this function, and let midlayer fallback | ||
315 | to the same result, calling wd33c93_host_reset() */ | ||
316 | |||
314 | spin_lock_irq(cmd->device->host->host_lock); | 317 | spin_lock_irq(cmd->device->host->host_lock); |
315 | wd33c93_host_reset(cmd); | 318 | wd33c93_host_reset(cmd); |
316 | spin_unlock_irq(cmd->device->host->host_lock); | 319 | spin_unlock_irq(cmd->device->host->host_lock); |
diff --git a/drivers/scsi/sym53c416.c b/drivers/scsi/sym53c416.c index ca9a04cf4d3f..ef19adc67eff 100644 --- a/drivers/scsi/sym53c416.c +++ b/drivers/scsi/sym53c416.c | |||
@@ -790,6 +790,9 @@ static int sym53c416_host_reset(Scsi_Cmnd *SCpnt) | |||
790 | int base; | 790 | int base; |
791 | int scsi_id = -1; | 791 | int scsi_id = -1; |
792 | int i; | 792 | int i; |
793 | unsigned long flags; | ||
794 | |||
795 | spin_lock_irqsave(&sym53c416_lock, flags); | ||
793 | 796 | ||
794 | /* printk("sym53c416_reset\n"); */ | 797 | /* printk("sym53c416_reset\n"); */ |
795 | base = SCpnt->device->host->io_port; | 798 | base = SCpnt->device->host->io_port; |
@@ -801,6 +804,8 @@ static int sym53c416_host_reset(Scsi_Cmnd *SCpnt) | |||
801 | outb(NOOP | PIO_MODE, base + COMMAND_REG); | 804 | outb(NOOP | PIO_MODE, base + COMMAND_REG); |
802 | outb(RESET_SCSI_BUS, base + COMMAND_REG); | 805 | outb(RESET_SCSI_BUS, base + COMMAND_REG); |
803 | sym53c416_init(base, scsi_id); | 806 | sym53c416_init(base, scsi_id); |
807 | |||
808 | spin_unlock_irqrestore(&sym53c416_lock, flags); | ||
804 | return SUCCESS; | 809 | return SUCCESS; |
805 | } | 810 | } |
806 | 811 | ||
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index 6af9c18b3f97..d76766c3ce16 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c | |||
@@ -889,7 +889,13 @@ static int sym53c8xx_eh_bus_reset_handler(struct scsi_cmnd *cmd) | |||
889 | 889 | ||
890 | static int sym53c8xx_eh_host_reset_handler(struct scsi_cmnd *cmd) | 890 | static int sym53c8xx_eh_host_reset_handler(struct scsi_cmnd *cmd) |
891 | { | 891 | { |
892 | return sym_eh_handler(SYM_EH_HOST_RESET, "HOST RESET", cmd); | 892 | int rc; |
893 | |||
894 | spin_lock_irq(cmd->device->host->host_lock); | ||
895 | rc = sym_eh_handler(SYM_EH_HOST_RESET, "HOST RESET", cmd); | ||
896 | spin_unlock_irq(cmd->device->host->host_lock); | ||
897 | |||
898 | return rc; | ||
893 | } | 899 | } |
894 | 900 | ||
895 | /* | 901 | /* |
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c index a6a441937acb..98369ce09283 100644 --- a/drivers/scsi/u14-34f.c +++ b/drivers/scsi/u14-34f.c | |||
@@ -1417,16 +1417,20 @@ static int u14_34f_eh_host_reset(struct scsi_cmnd *SCarg) { | |||
1417 | printk("%s: reset, enter, target %d.%d:%d, pid %ld.\n", | 1417 | printk("%s: reset, enter, target %d.%d:%d, pid %ld.\n", |
1418 | BN(j), SCarg->device->channel, SCarg->device->id, SCarg->device->lun, SCarg->pid); | 1418 | BN(j), SCarg->device->channel, SCarg->device->id, SCarg->device->lun, SCarg->pid); |
1419 | 1419 | ||
1420 | spin_lock_irq(sh[j]->host_lock); | ||
1421 | |||
1420 | if (SCarg->host_scribble == NULL) | 1422 | if (SCarg->host_scribble == NULL) |
1421 | printk("%s: reset, pid %ld inactive.\n", BN(j), SCarg->pid); | 1423 | printk("%s: reset, pid %ld inactive.\n", BN(j), SCarg->pid); |
1422 | 1424 | ||
1423 | if (HD(j)->in_reset) { | 1425 | if (HD(j)->in_reset) { |
1424 | printk("%s: reset, exit, already in reset.\n", BN(j)); | 1426 | printk("%s: reset, exit, already in reset.\n", BN(j)); |
1427 | spin_unlock_irq(sh[j]->host_lock); | ||
1425 | return FAILED; | 1428 | return FAILED; |
1426 | } | 1429 | } |
1427 | 1430 | ||
1428 | if (wait_on_busy(sh[j]->io_port, MAXLOOP)) { | 1431 | if (wait_on_busy(sh[j]->io_port, MAXLOOP)) { |
1429 | printk("%s: reset, exit, timeout error.\n", BN(j)); | 1432 | printk("%s: reset, exit, timeout error.\n", BN(j)); |
1433 | spin_unlock_irq(sh[j]->host_lock); | ||
1430 | return FAILED; | 1434 | return FAILED; |
1431 | } | 1435 | } |
1432 | 1436 | ||
@@ -1477,6 +1481,7 @@ static int u14_34f_eh_host_reset(struct scsi_cmnd *SCarg) { | |||
1477 | 1481 | ||
1478 | if (wait_on_busy(sh[j]->io_port, MAXLOOP)) { | 1482 | if (wait_on_busy(sh[j]->io_port, MAXLOOP)) { |
1479 | printk("%s: reset, cannot reset, timeout error.\n", BN(j)); | 1483 | printk("%s: reset, cannot reset, timeout error.\n", BN(j)); |
1484 | spin_unlock_irq(sh[j]->host_lock); | ||
1480 | return FAILED; | 1485 | return FAILED; |
1481 | } | 1486 | } |
1482 | 1487 | ||
@@ -1538,6 +1543,7 @@ static int u14_34f_eh_host_reset(struct scsi_cmnd *SCarg) { | |||
1538 | if (arg_done) printk("%s: reset, exit, pid %ld done.\n", BN(j), SCarg->pid); | 1543 | if (arg_done) printk("%s: reset, exit, pid %ld done.\n", BN(j), SCarg->pid); |
1539 | else printk("%s: reset, exit.\n", BN(j)); | 1544 | else printk("%s: reset, exit.\n", BN(j)); |
1540 | 1545 | ||
1546 | spin_unlock_irq(sh[j]->host_lock); | ||
1541 | return SUCCESS; | 1547 | return SUCCESS; |
1542 | } | 1548 | } |
1543 | 1549 | ||
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c index bf4a758e2801..fb54a87a80a3 100644 --- a/drivers/scsi/wd7000.c +++ b/drivers/scsi/wd7000.c | |||
@@ -1586,9 +1586,16 @@ static int wd7000_host_reset(struct scsi_cmnd *SCpnt) | |||
1586 | { | 1586 | { |
1587 | Adapter *host = (Adapter *) SCpnt->device->host->hostdata; | 1587 | Adapter *host = (Adapter *) SCpnt->device->host->hostdata; |
1588 | 1588 | ||
1589 | if (wd7000_adapter_reset(host) < 0) | 1589 | spin_unlock_irq(SCpnt->device->host->host_lock); |
1590 | |||
1591 | if (wd7000_adapter_reset(host) < 0) { | ||
1592 | spin_unlock_irq(SCpnt->device->host->host_lock); | ||
1590 | return FAILED; | 1593 | return FAILED; |
1594 | } | ||
1595 | |||
1591 | wd7000_enable_intr(host); | 1596 | wd7000_enable_intr(host); |
1597 | |||
1598 | spin_unlock_irq(SCpnt->device->host->host_lock); | ||
1592 | return SUCCESS; | 1599 | return SUCCESS; |
1593 | } | 1600 | } |
1594 | 1601 | ||