diff options
-rw-r--r-- | drivers/scsi/libata-core.c | 95 | ||||
-rw-r--r-- | drivers/scsi/libata-eh.c | 5 |
2 files changed, 4 insertions, 96 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 9de48dd4234a..fc3e57f84268 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -4125,101 +4125,6 @@ fsm_start: | |||
4125 | } | 4125 | } |
4126 | 4126 | ||
4127 | /** | 4127 | /** |
4128 | * ata_qc_timeout - Handle timeout of queued command | ||
4129 | * @qc: Command that timed out | ||
4130 | * | ||
4131 | * Some part of the kernel (currently, only the SCSI layer) | ||
4132 | * has noticed that the active command on port @ap has not | ||
4133 | * completed after a specified length of time. Handle this | ||
4134 | * condition by disabling DMA (if necessary) and completing | ||
4135 | * transactions, with error if necessary. | ||
4136 | * | ||
4137 | * This also handles the case of the "lost interrupt", where | ||
4138 | * for some reason (possibly hardware bug, possibly driver bug) | ||
4139 | * an interrupt was not delivered to the driver, even though the | ||
4140 | * transaction completed successfully. | ||
4141 | * | ||
4142 | * LOCKING: | ||
4143 | * Inherited from SCSI layer (none, can sleep) | ||
4144 | */ | ||
4145 | |||
4146 | static void ata_qc_timeout(struct ata_queued_cmd *qc) | ||
4147 | { | ||
4148 | struct ata_port *ap = qc->ap; | ||
4149 | struct ata_host_set *host_set = ap->host_set; | ||
4150 | u8 host_stat = 0, drv_stat; | ||
4151 | unsigned long flags; | ||
4152 | |||
4153 | DPRINTK("ENTER\n"); | ||
4154 | |||
4155 | ap->hsm_task_state = HSM_ST_IDLE; | ||
4156 | |||
4157 | spin_lock_irqsave(&host_set->lock, flags); | ||
4158 | |||
4159 | switch (qc->tf.protocol) { | ||
4160 | |||
4161 | case ATA_PROT_DMA: | ||
4162 | case ATA_PROT_ATAPI_DMA: | ||
4163 | host_stat = ap->ops->bmdma_status(ap); | ||
4164 | |||
4165 | /* before we do anything else, clear DMA-Start bit */ | ||
4166 | ap->ops->bmdma_stop(qc); | ||
4167 | |||
4168 | /* fall through */ | ||
4169 | |||
4170 | default: | ||
4171 | ata_altstatus(ap); | ||
4172 | drv_stat = ata_chk_status(ap); | ||
4173 | |||
4174 | /* ack bmdma irq events */ | ||
4175 | ap->ops->irq_clear(ap); | ||
4176 | |||
4177 | printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x host_stat 0x%x\n", | ||
4178 | ap->id, qc->tf.command, drv_stat, host_stat); | ||
4179 | |||
4180 | ap->hsm_task_state = HSM_ST_IDLE; | ||
4181 | |||
4182 | /* complete taskfile transaction */ | ||
4183 | qc->err_mask |= AC_ERR_TIMEOUT; | ||
4184 | break; | ||
4185 | } | ||
4186 | |||
4187 | spin_unlock_irqrestore(&host_set->lock, flags); | ||
4188 | |||
4189 | ata_eh_qc_complete(qc); | ||
4190 | |||
4191 | DPRINTK("EXIT\n"); | ||
4192 | } | ||
4193 | |||
4194 | /** | ||
4195 | * ata_eng_timeout - Handle timeout of queued command | ||
4196 | * @ap: Port on which timed-out command is active | ||
4197 | * | ||
4198 | * Some part of the kernel (currently, only the SCSI layer) | ||
4199 | * has noticed that the active command on port @ap has not | ||
4200 | * completed after a specified length of time. Handle this | ||
4201 | * condition by disabling DMA (if necessary) and completing | ||
4202 | * transactions, with error if necessary. | ||
4203 | * | ||
4204 | * This also handles the case of the "lost interrupt", where | ||
4205 | * for some reason (possibly hardware bug, possibly driver bug) | ||
4206 | * an interrupt was not delivered to the driver, even though the | ||
4207 | * transaction completed successfully. | ||
4208 | * | ||
4209 | * LOCKING: | ||
4210 | * Inherited from SCSI layer (none, can sleep) | ||
4211 | */ | ||
4212 | |||
4213 | void ata_eng_timeout(struct ata_port *ap) | ||
4214 | { | ||
4215 | DPRINTK("ENTER\n"); | ||
4216 | |||
4217 | ata_qc_timeout(ata_qc_from_tag(ap, ap->active_tag)); | ||
4218 | |||
4219 | DPRINTK("EXIT\n"); | ||
4220 | } | ||
4221 | |||
4222 | /** | ||
4223 | * ata_qc_new - Request an available ATA command, for queueing | 4128 | * ata_qc_new - Request an available ATA command, for queueing |
4224 | * @ap: Port associated with device @dev | 4129 | * @ap: Port associated with device @dev |
4225 | * @dev: Device from whom we request an available command structure | 4130 | * @dev: Device from whom we request an available command structure |
diff --git a/drivers/scsi/libata-eh.c b/drivers/scsi/libata-eh.c index e73f5612aea8..011e083b19e1 100644 --- a/drivers/scsi/libata-eh.c +++ b/drivers/scsi/libata-eh.c | |||
@@ -137,6 +137,7 @@ int ata_scsi_error(struct Scsi_Host *host) | |||
137 | * LOCKING: | 137 | * LOCKING: |
138 | * Inherited from SCSI layer (none, can sleep) | 138 | * Inherited from SCSI layer (none, can sleep) |
139 | */ | 139 | */ |
140 | |||
140 | static void ata_qc_timeout(struct ata_queued_cmd *qc) | 141 | static void ata_qc_timeout(struct ata_queued_cmd *qc) |
141 | { | 142 | { |
142 | struct ata_port *ap = qc->ap; | 143 | struct ata_port *ap = qc->ap; |
@@ -171,8 +172,10 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc) | |||
171 | printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x host_stat 0x%x\n", | 172 | printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x host_stat 0x%x\n", |
172 | ap->id, qc->tf.command, drv_stat, host_stat); | 173 | ap->id, qc->tf.command, drv_stat, host_stat); |
173 | 174 | ||
175 | ap->hsm_task_state = HSM_ST_IDLE; | ||
176 | |||
174 | /* complete taskfile transaction */ | 177 | /* complete taskfile transaction */ |
175 | qc->err_mask |= ac_err_mask(drv_stat); | 178 | qc->err_mask |= AC_ERR_TIMEOUT; |
176 | break; | 179 | break; |
177 | } | 180 | } |
178 | 181 | ||