diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2006-01-27 02:39:25 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-27 02:39:25 -0500 |
commit | 7103c7bc863c10dd2a26c19c8cf4d7d2846da947 (patch) | |
tree | 73a9d674670c37e4f160c0d4553f3d14664900be | |
parent | b4d28889f7ebfe498dedaceb773b4c785b97d195 (diff) | |
parent | a72ec4ce6d3ae92e76baf5b2c65cc26e5e775e83 (diff) |
Merge branch 'tmp'
-rw-r--r-- | drivers/scsi/ahci.c | 12 | ||||
-rw-r--r-- | drivers/scsi/libata-core.c | 14 | ||||
-rw-r--r-- | drivers/scsi/libata-scsi.c | 59 | ||||
-rw-r--r-- | drivers/scsi/sata_mv.c | 12 | ||||
-rw-r--r-- | drivers/scsi/sata_promise.c | 12 | ||||
-rw-r--r-- | drivers/scsi/sata_sil24.c | 10 | ||||
-rw-r--r-- | drivers/scsi/sata_sx4.c | 12 | ||||
-rw-r--r-- | include/linux/libata.h | 3 |
8 files changed, 70 insertions, 64 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 0f6e4dd22901..5a6b23009897 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -672,19 +672,13 @@ static void ahci_eng_timeout(struct ata_port *ap) | |||
672 | ap->id); | 672 | ap->id); |
673 | } else { | 673 | } else { |
674 | ahci_restart_port(ap, readl(port_mmio + PORT_IRQ_STAT)); | 674 | ahci_restart_port(ap, readl(port_mmio + PORT_IRQ_STAT)); |
675 | |||
676 | /* hack alert! We cannot use the supplied completion | ||
677 | * function from inside the ->eh_strategy_handler() thread. | ||
678 | * libata is the only user of ->eh_strategy_handler() in | ||
679 | * any kernel, so the default scsi_done() assumes it is | ||
680 | * not being called from the SCSI EH. | ||
681 | */ | ||
682 | qc->scsidone = scsi_finish_command; | ||
683 | qc->err_mask |= AC_ERR_TIMEOUT; | 675 | qc->err_mask |= AC_ERR_TIMEOUT; |
684 | ata_qc_complete(qc); | ||
685 | } | 676 | } |
686 | 677 | ||
687 | spin_unlock_irqrestore(&host_set->lock, flags); | 678 | spin_unlock_irqrestore(&host_set->lock, flags); |
679 | |||
680 | if (qc) | ||
681 | ata_eh_qc_complete(qc); | ||
688 | } | 682 | } |
689 | 683 | ||
690 | static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | 684 | static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc) |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 50fb7cea94eb..c67c7a49c8ba 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -3633,14 +3633,6 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc) | |||
3633 | 3633 | ||
3634 | spin_lock_irqsave(&host_set->lock, flags); | 3634 | spin_lock_irqsave(&host_set->lock, flags); |
3635 | 3635 | ||
3636 | /* hack alert! We cannot use the supplied completion | ||
3637 | * function from inside the ->eh_strategy_handler() thread. | ||
3638 | * libata is the only user of ->eh_strategy_handler() in | ||
3639 | * any kernel, so the default scsi_done() assumes it is | ||
3640 | * not being called from the SCSI EH. | ||
3641 | */ | ||
3642 | qc->scsidone = scsi_finish_command; | ||
3643 | |||
3644 | switch (qc->tf.protocol) { | 3636 | switch (qc->tf.protocol) { |
3645 | 3637 | ||
3646 | case ATA_PROT_DMA: | 3638 | case ATA_PROT_DMA: |
@@ -3666,12 +3658,13 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc) | |||
3666 | 3658 | ||
3667 | /* complete taskfile transaction */ | 3659 | /* complete taskfile transaction */ |
3668 | qc->err_mask |= ac_err_mask(drv_stat); | 3660 | qc->err_mask |= ac_err_mask(drv_stat); |
3669 | ata_qc_complete(qc); | ||
3670 | break; | 3661 | break; |
3671 | } | 3662 | } |
3672 | 3663 | ||
3673 | spin_unlock_irqrestore(&host_set->lock, flags); | 3664 | spin_unlock_irqrestore(&host_set->lock, flags); |
3674 | 3665 | ||
3666 | ata_eh_qc_complete(qc); | ||
3667 | |||
3675 | DPRINTK("EXIT\n"); | 3668 | DPRINTK("EXIT\n"); |
3676 | } | 3669 | } |
3677 | 3670 | ||
@@ -4706,6 +4699,7 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, | |||
4706 | ap->last_ctl = 0xFF; | 4699 | ap->last_ctl = 0xFF; |
4707 | 4700 | ||
4708 | INIT_WORK(&ap->pio_task, ata_pio_task, ap); | 4701 | INIT_WORK(&ap->pio_task, ata_pio_task, ap); |
4702 | INIT_LIST_HEAD(&ap->eh_done_q); | ||
4709 | 4703 | ||
4710 | for (i = 0; i < ATA_MAX_DEVICES; i++) | 4704 | for (i = 0; i < ATA_MAX_DEVICES; i++) |
4711 | ap->device[i].devno = i; | 4705 | ap->device[i].devno = i; |
@@ -5449,6 +5443,8 @@ EXPORT_SYMBOL_GPL(ata_dev_classify); | |||
5449 | EXPORT_SYMBOL_GPL(ata_dev_id_string); | 5443 | EXPORT_SYMBOL_GPL(ata_dev_id_string); |
5450 | EXPORT_SYMBOL_GPL(ata_dev_config); | 5444 | EXPORT_SYMBOL_GPL(ata_dev_config); |
5451 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); | 5445 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); |
5446 | EXPORT_SYMBOL_GPL(ata_eh_qc_complete); | ||
5447 | EXPORT_SYMBOL_GPL(ata_eh_qc_retry); | ||
5452 | 5448 | ||
5453 | EXPORT_SYMBOL_GPL(ata_pio_need_iordy); | 5449 | EXPORT_SYMBOL_GPL(ata_pio_need_iordy); |
5454 | EXPORT_SYMBOL_GPL(ata_timing_compute); | 5450 | EXPORT_SYMBOL_GPL(ata_timing_compute); |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 95e3c278dd43..ab6b53349d6f 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -738,17 +738,64 @@ int ata_scsi_error(struct Scsi_Host *host) | |||
738 | ap = (struct ata_port *) &host->hostdata[0]; | 738 | ap = (struct ata_port *) &host->hostdata[0]; |
739 | ap->ops->eng_timeout(ap); | 739 | ap->ops->eng_timeout(ap); |
740 | 740 | ||
741 | /* TODO: this is per-command; when queueing is supported | 741 | assert(host->host_failed == 0 && list_empty(&host->eh_cmd_q)); |
742 | * this code will either change or move to a more | 742 | |
743 | * appropriate place | 743 | scsi_eh_flush_done_q(&ap->eh_done_q); |
744 | */ | ||
745 | host->host_failed--; | ||
746 | INIT_LIST_HEAD(&host->eh_cmd_q); | ||
747 | 744 | ||
748 | DPRINTK("EXIT\n"); | 745 | DPRINTK("EXIT\n"); |
749 | return 0; | 746 | return 0; |
750 | } | 747 | } |
751 | 748 | ||
749 | static void ata_eh_scsidone(struct scsi_cmnd *scmd) | ||
750 | { | ||
751 | /* nada */ | ||
752 | } | ||
753 | |||
754 | static void __ata_eh_qc_complete(struct ata_queued_cmd *qc) | ||
755 | { | ||
756 | struct ata_port *ap = qc->ap; | ||
757 | struct scsi_cmnd *scmd = qc->scsicmd; | ||
758 | unsigned long flags; | ||
759 | |||
760 | spin_lock_irqsave(&ap->host_set->lock, flags); | ||
761 | qc->scsidone = ata_eh_scsidone; | ||
762 | ata_qc_complete(qc); | ||
763 | assert(!ata_tag_valid(qc->tag)); | ||
764 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
765 | |||
766 | scsi_eh_finish_cmd(scmd, &ap->eh_done_q); | ||
767 | } | ||
768 | |||
769 | /** | ||
770 | * ata_eh_qc_complete - Complete an active ATA command from EH | ||
771 | * @qc: Command to complete | ||
772 | * | ||
773 | * Indicate to the mid and upper layers that an ATA command has | ||
774 | * completed. To be used from EH. | ||
775 | */ | ||
776 | void ata_eh_qc_complete(struct ata_queued_cmd *qc) | ||
777 | { | ||
778 | struct scsi_cmnd *scmd = qc->scsicmd; | ||
779 | scmd->retries = scmd->allowed; | ||
780 | __ata_eh_qc_complete(qc); | ||
781 | } | ||
782 | |||
783 | /** | ||
784 | * ata_eh_qc_retry - Tell midlayer to retry an ATA command after EH | ||
785 | * @qc: Command to retry | ||
786 | * | ||
787 | * Indicate to the mid and upper layers that an ATA command | ||
788 | * should be retried. To be used from EH. | ||
789 | * | ||
790 | * SCSI midlayer limits the number of retries to scmd->allowed. | ||
791 | * This function might need to adjust scmd->retries for commands | ||
792 | * which get retried due to unrelated NCQ failures. | ||
793 | */ | ||
794 | void ata_eh_qc_retry(struct ata_queued_cmd *qc) | ||
795 | { | ||
796 | __ata_eh_qc_complete(qc); | ||
797 | } | ||
798 | |||
752 | /** | 799 | /** |
753 | * ata_scsi_start_stop_xlat - Translate SCSI START STOP UNIT command | 800 | * ata_scsi_start_stop_xlat - Translate SCSI START STOP UNIT command |
754 | * @qc: Storage for translated ATA taskfile | 801 | * @qc: Storage for translated ATA taskfile |
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 498d6284a2f7..0042c7840d80 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -1838,7 +1838,6 @@ static void mv_phy_reset(struct ata_port *ap) | |||
1838 | static void mv_eng_timeout(struct ata_port *ap) | 1838 | static void mv_eng_timeout(struct ata_port *ap) |
1839 | { | 1839 | { |
1840 | struct ata_queued_cmd *qc; | 1840 | struct ata_queued_cmd *qc; |
1841 | unsigned long flags; | ||
1842 | 1841 | ||
1843 | printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); | 1842 | printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); |
1844 | DPRINTK("All regs @ start of eng_timeout\n"); | 1843 | DPRINTK("All regs @ start of eng_timeout\n"); |
@@ -1857,17 +1856,8 @@ static void mv_eng_timeout(struct ata_port *ap) | |||
1857 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", | 1856 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", |
1858 | ap->id); | 1857 | ap->id); |
1859 | } else { | 1858 | } else { |
1860 | /* hack alert! We cannot use the supplied completion | ||
1861 | * function from inside the ->eh_strategy_handler() thread. | ||
1862 | * libata is the only user of ->eh_strategy_handler() in | ||
1863 | * any kernel, so the default scsi_done() assumes it is | ||
1864 | * not being called from the SCSI EH. | ||
1865 | */ | ||
1866 | spin_lock_irqsave(&ap->host_set->lock, flags); | ||
1867 | qc->scsidone = scsi_finish_command; | ||
1868 | qc->err_mask |= AC_ERR_TIMEOUT; | 1859 | qc->err_mask |= AC_ERR_TIMEOUT; |
1869 | ata_qc_complete(qc); | 1860 | ata_eh_qc_complete(qc); |
1870 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
1871 | } | 1861 | } |
1872 | } | 1862 | } |
1873 | 1863 | ||
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index 010e08819886..760c56f71632 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -401,21 +401,12 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
401 | goto out; | 401 | goto out; |
402 | } | 402 | } |
403 | 403 | ||
404 | /* hack alert! We cannot use the supplied completion | ||
405 | * function from inside the ->eh_strategy_handler() thread. | ||
406 | * libata is the only user of ->eh_strategy_handler() in | ||
407 | * any kernel, so the default scsi_done() assumes it is | ||
408 | * not being called from the SCSI EH. | ||
409 | */ | ||
410 | qc->scsidone = scsi_finish_command; | ||
411 | |||
412 | switch (qc->tf.protocol) { | 404 | switch (qc->tf.protocol) { |
413 | case ATA_PROT_DMA: | 405 | case ATA_PROT_DMA: |
414 | case ATA_PROT_NODATA: | 406 | case ATA_PROT_NODATA: |
415 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); | 407 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); |
416 | drv_stat = ata_wait_idle(ap); | 408 | drv_stat = ata_wait_idle(ap); |
417 | qc->err_mask |= __ac_err_mask(drv_stat); | 409 | qc->err_mask |= __ac_err_mask(drv_stat); |
418 | ata_qc_complete(qc); | ||
419 | break; | 410 | break; |
420 | 411 | ||
421 | default: | 412 | default: |
@@ -425,12 +416,13 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
425 | ap->id, qc->tf.command, drv_stat); | 416 | ap->id, qc->tf.command, drv_stat); |
426 | 417 | ||
427 | qc->err_mask |= ac_err_mask(drv_stat); | 418 | qc->err_mask |= ac_err_mask(drv_stat); |
428 | ata_qc_complete(qc); | ||
429 | break; | 419 | break; |
430 | } | 420 | } |
431 | 421 | ||
432 | out: | 422 | out: |
433 | spin_unlock_irqrestore(&host_set->lock, flags); | 423 | spin_unlock_irqrestore(&host_set->lock, flags); |
424 | if (qc) | ||
425 | ata_eh_qc_complete(qc); | ||
434 | DPRINTK("EXIT\n"); | 426 | DPRINTK("EXIT\n"); |
435 | } | 427 | } |
436 | 428 | ||
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index 5a7a7b1d4add..7222fc7ff3fc 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -644,17 +644,9 @@ static void sil24_eng_timeout(struct ata_port *ap) | |||
644 | return; | 644 | return; |
645 | } | 645 | } |
646 | 646 | ||
647 | /* | ||
648 | * hack alert! We cannot use the supplied completion | ||
649 | * function from inside the ->eh_strategy_handler() thread. | ||
650 | * libata is the only user of ->eh_strategy_handler() in | ||
651 | * any kernel, so the default scsi_done() assumes it is | ||
652 | * not being called from the SCSI EH. | ||
653 | */ | ||
654 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); | 647 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); |
655 | qc->scsidone = scsi_finish_command; | ||
656 | qc->err_mask |= AC_ERR_TIMEOUT; | 648 | qc->err_mask |= AC_ERR_TIMEOUT; |
657 | ata_qc_complete(qc); | 649 | ata_eh_qc_complete(qc); |
658 | 650 | ||
659 | sil24_reset_controller(ap); | 651 | sil24_reset_controller(ap); |
660 | } | 652 | } |
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index db08a8ba9ea7..c3975fada63f 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c | |||
@@ -872,20 +872,11 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
872 | goto out; | 872 | goto out; |
873 | } | 873 | } |
874 | 874 | ||
875 | /* hack alert! We cannot use the supplied completion | ||
876 | * function from inside the ->eh_strategy_handler() thread. | ||
877 | * libata is the only user of ->eh_strategy_handler() in | ||
878 | * any kernel, so the default scsi_done() assumes it is | ||
879 | * not being called from the SCSI EH. | ||
880 | */ | ||
881 | qc->scsidone = scsi_finish_command; | ||
882 | |||
883 | switch (qc->tf.protocol) { | 875 | switch (qc->tf.protocol) { |
884 | case ATA_PROT_DMA: | 876 | case ATA_PROT_DMA: |
885 | case ATA_PROT_NODATA: | 877 | case ATA_PROT_NODATA: |
886 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); | 878 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); |
887 | qc->err_mask |= __ac_err_mask(ata_wait_idle(ap)); | 879 | qc->err_mask |= __ac_err_mask(ata_wait_idle(ap)); |
888 | ata_qc_complete(qc); | ||
889 | break; | 880 | break; |
890 | 881 | ||
891 | default: | 882 | default: |
@@ -895,12 +886,13 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
895 | ap->id, qc->tf.command, drv_stat); | 886 | ap->id, qc->tf.command, drv_stat); |
896 | 887 | ||
897 | qc->err_mask |= ac_err_mask(drv_stat); | 888 | qc->err_mask |= ac_err_mask(drv_stat); |
898 | ata_qc_complete(qc); | ||
899 | break; | 889 | break; |
900 | } | 890 | } |
901 | 891 | ||
902 | out: | 892 | out: |
903 | spin_unlock_irqrestore(&host_set->lock, flags); | 893 | spin_unlock_irqrestore(&host_set->lock, flags); |
894 | if (qc) | ||
895 | ata_eh_qc_complete(qc); | ||
904 | DPRINTK("EXIT\n"); | 896 | DPRINTK("EXIT\n"); |
905 | } | 897 | } |
906 | 898 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index 5915f763b722..88f0a27cc7c3 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -401,6 +401,7 @@ struct ata_port { | |||
401 | unsigned long pio_task_timeout; | 401 | unsigned long pio_task_timeout; |
402 | 402 | ||
403 | u32 msg_enable; | 403 | u32 msg_enable; |
404 | struct list_head eh_done_q; | ||
404 | 405 | ||
405 | void *private_data; | 406 | void *private_data; |
406 | }; | 407 | }; |
@@ -493,6 +494,8 @@ extern int ata_scsi_detect(struct scsi_host_template *sht); | |||
493 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); | 494 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); |
494 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); | 495 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); |
495 | extern int ata_scsi_error(struct Scsi_Host *host); | 496 | extern int ata_scsi_error(struct Scsi_Host *host); |
497 | extern void ata_eh_qc_complete(struct ata_queued_cmd *qc); | ||
498 | extern void ata_eh_qc_retry(struct ata_queued_cmd *qc); | ||
496 | extern int ata_scsi_release(struct Scsi_Host *host); | 499 | extern int ata_scsi_release(struct Scsi_Host *host); |
497 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); | 500 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); |
498 | extern int ata_scsi_device_resume(struct scsi_device *); | 501 | extern int ata_scsi_device_resume(struct scsi_device *); |