diff options
| -rw-r--r-- | drivers/scsi/libata-bmdma.c | 1 | ||||
| -rw-r--r-- | drivers/scsi/libata-core.c | 98 |
2 files changed, 52 insertions, 47 deletions
diff --git a/drivers/scsi/libata-bmdma.c b/drivers/scsi/libata-bmdma.c index 49eff18a67e3..6d30d2c52960 100644 --- a/drivers/scsi/libata-bmdma.c +++ b/drivers/scsi/libata-bmdma.c | |||
| @@ -726,7 +726,6 @@ void ata_bmdma_drive_eh(struct ata_port *ap, ata_reset_fn_t softreset, | |||
| 726 | /* reset PIO HSM and stop DMA engine */ | 726 | /* reset PIO HSM and stop DMA engine */ |
| 727 | spin_lock_irqsave(&host_set->lock, flags); | 727 | spin_lock_irqsave(&host_set->lock, flags); |
| 728 | 728 | ||
| 729 | ap->flags &= ~ATA_FLAG_NOINTR; | ||
| 730 | ap->hsm_task_state = HSM_ST_IDLE; | 729 | ap->hsm_task_state = HSM_ST_IDLE; |
| 731 | 730 | ||
| 732 | if (qc && (qc->tf.protocol == ATA_PROT_DMA || | 731 | if (qc && (qc->tf.protocol == ATA_PROT_DMA || |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index c859b96b891a..487b8f22981f 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
| @@ -3462,40 +3462,6 @@ skip_map: | |||
| 3462 | } | 3462 | } |
| 3463 | 3463 | ||
| 3464 | /** | 3464 | /** |
| 3465 | * ata_poll_qc_complete - turn irq back on and finish qc | ||
| 3466 | * @qc: Command to complete | ||
| 3467 | * @err_mask: ATA status register content | ||
| 3468 | * | ||
| 3469 | * LOCKING: | ||
| 3470 | * None. (grabs host lock) | ||
| 3471 | */ | ||
| 3472 | void ata_poll_qc_complete(struct ata_queued_cmd *qc) | ||
| 3473 | { | ||
| 3474 | struct ata_port *ap = qc->ap; | ||
| 3475 | unsigned long flags; | ||
| 3476 | |||
| 3477 | spin_lock_irqsave(&ap->host_set->lock, flags); | ||
| 3478 | |||
| 3479 | if (ap->ops->error_handler) { | ||
| 3480 | /* EH might have kicked in while host_set lock is released */ | ||
| 3481 | qc = ata_qc_from_tag(ap, qc->tag); | ||
| 3482 | if (qc) { | ||
| 3483 | if (!(qc->err_mask & AC_ERR_HSM)) { | ||
| 3484 | ata_irq_on(ap); | ||
| 3485 | ata_qc_complete(qc); | ||
| 3486 | } else | ||
| 3487 | ata_port_freeze(ap); | ||
| 3488 | } | ||
| 3489 | } else { | ||
| 3490 | /* old EH */ | ||
| 3491 | ata_irq_on(ap); | ||
| 3492 | ata_qc_complete(qc); | ||
| 3493 | } | ||
| 3494 | |||
| 3495 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
| 3496 | } | ||
| 3497 | |||
| 3498 | /** | ||
| 3499 | * swap_buf_le16 - swap halves of 16-bit words in place | 3465 | * swap_buf_le16 - swap halves of 16-bit words in place |
| 3500 | * @buf: Buffer to swap | 3466 | * @buf: Buffer to swap |
| 3501 | * @buf_words: Number of 16-bit words in buffer. | 3467 | * @buf_words: Number of 16-bit words in buffer. |
| @@ -3918,6 +3884,56 @@ static inline int ata_hsm_ok_in_wq(struct ata_port *ap, struct ata_queued_cmd *q | |||
| 3918 | } | 3884 | } |
| 3919 | 3885 | ||
| 3920 | /** | 3886 | /** |
| 3887 | * ata_hsm_qc_complete - finish a qc running on standard HSM | ||
| 3888 | * @qc: Command to complete | ||
| 3889 | * @in_wq: 1 if called from workqueue, 0 otherwise | ||
| 3890 | * | ||
| 3891 | * Finish @qc which is running on standard HSM. | ||
| 3892 | * | ||
| 3893 | * LOCKING: | ||
| 3894 | * If @in_wq is zero, spin_lock_irqsave(host_set lock). | ||
| 3895 | * Otherwise, none on entry and grabs host lock. | ||
| 3896 | */ | ||
| 3897 | static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq) | ||
| 3898 | { | ||
| 3899 | struct ata_port *ap = qc->ap; | ||
| 3900 | unsigned long flags; | ||
| 3901 | |||
| 3902 | if (ap->ops->error_handler) { | ||
| 3903 | if (in_wq) { | ||
| 3904 | spin_lock_irqsave(&ap->host_set->lock, flags); | ||
| 3905 | |||
| 3906 | /* EH might have kicked in while host_set lock | ||
| 3907 | * is released. | ||
| 3908 | */ | ||
| 3909 | qc = ata_qc_from_tag(ap, qc->tag); | ||
| 3910 | if (qc) { | ||
| 3911 | if (likely(!(qc->err_mask & AC_ERR_HSM))) { | ||
| 3912 | ata_irq_on(ap); | ||
| 3913 | ata_qc_complete(qc); | ||
| 3914 | } else | ||
| 3915 | ata_port_freeze(ap); | ||
| 3916 | } | ||
| 3917 | |||
| 3918 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
| 3919 | } else { | ||
| 3920 | if (likely(!(qc->err_mask & AC_ERR_HSM))) | ||
| 3921 | ata_qc_complete(qc); | ||
| 3922 | else | ||
| 3923 | ata_port_freeze(ap); | ||
| 3924 | } | ||
| 3925 | } else { | ||
| 3926 | if (in_wq) { | ||
| 3927 | spin_lock_irqsave(&ap->host_set->lock, flags); | ||
| 3928 | ata_irq_on(ap); | ||
| 3929 | ata_qc_complete(qc); | ||
| 3930 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
| 3931 | } else | ||
| 3932 | ata_qc_complete(qc); | ||
| 3933 | } | ||
| 3934 | } | ||
| 3935 | |||
| 3936 | /** | ||
| 3921 | * ata_hsm_move - move the HSM to the next state. | 3937 | * ata_hsm_move - move the HSM to the next state. |
| 3922 | * @ap: the target ata_port | 3938 | * @ap: the target ata_port |
| 3923 | * @qc: qc on going | 3939 | * @qc: qc on going |
| @@ -4108,19 +4124,12 @@ fsm_start: | |||
| 4108 | ap->hsm_task_state = HSM_ST_IDLE; | 4124 | ap->hsm_task_state = HSM_ST_IDLE; |
| 4109 | 4125 | ||
| 4110 | /* complete taskfile transaction */ | 4126 | /* complete taskfile transaction */ |
| 4111 | if (in_wq) | 4127 | ata_hsm_qc_complete(qc, in_wq); |
| 4112 | ata_poll_qc_complete(qc); | ||
| 4113 | else | ||
| 4114 | ata_qc_complete(qc); | ||
| 4115 | 4128 | ||
| 4116 | poll_next = 0; | 4129 | poll_next = 0; |
| 4117 | break; | 4130 | break; |
| 4118 | 4131 | ||
| 4119 | case HSM_ST_ERR: | 4132 | case HSM_ST_ERR: |
| 4120 | if (qc->tf.command != ATA_CMD_PACKET) | ||
| 4121 | printk(KERN_ERR "ata%u: dev %u command error, drv_stat 0x%x\n", | ||
| 4122 | ap->id, qc->dev->devno, status); | ||
| 4123 | |||
| 4124 | /* make sure qc->err_mask is available to | 4133 | /* make sure qc->err_mask is available to |
| 4125 | * know what's wrong and recover | 4134 | * know what's wrong and recover |
| 4126 | */ | 4135 | */ |
| @@ -4129,10 +4138,7 @@ fsm_start: | |||
| 4129 | ap->hsm_task_state = HSM_ST_IDLE; | 4138 | ap->hsm_task_state = HSM_ST_IDLE; |
| 4130 | 4139 | ||
| 4131 | /* complete taskfile transaction */ | 4140 | /* complete taskfile transaction */ |
| 4132 | if (in_wq) | 4141 | ata_hsm_qc_complete(qc, in_wq); |
| 4133 | ata_poll_qc_complete(qc); | ||
| 4134 | else | ||
| 4135 | ata_qc_complete(qc); | ||
| 4136 | 4142 | ||
| 4137 | poll_next = 0; | 4143 | poll_next = 0; |
| 4138 | break; | 4144 | break; |
