static void ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
u8 status)
{
+ WARN_ON((qc->flags & ATA_QCFLAG_ACTIVE) == 0);
+
/* check error */
if (unlikely(status & (ATA_ERR | ATA_DF))) {
qc->err_mask |= AC_ERR_DEV;
fsm_start:
switch (ap->hsm_task_state) {
case HSM_ST_FIRST:
- /* Some pre-ATAPI-4 devices assert INTRQ
- * at this state when ready to receive CDB.
- */
-
/* check device status */
if (unlikely((status & (ATA_BUSY | ATA_DRQ)) != ATA_DRQ)) {
/* Wrong status. Let EH handle this */
break;
case HSM_ST_LAST:
- if (unlikely(status & ATA_DRQ)) {
- /* handle DRQ=1 as error */
- qc->err_mask |= AC_ERR_HSM;
+ if (unlikely(!ata_ok(status))) {
+ qc->err_mask |= __ac_err_mask(status);
ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}
DPRINTK("ata%u: command complete, drv_stat 0x%x\n",
ap->id, status);
+ WARN_ON(qc->err_mask);
+
ap->hsm_task_state = HSM_ST_IDLE;
/* complete taskfile transaction */
- qc->err_mask |= ac_err_mask(status);
ata_qc_complete(qc);
break;
case HSM_ST_ERR:
if (qc->tf.command != ATA_CMD_PACKET)
- printk(KERN_ERR "ata%u: command error, drv_stat 0x%x host_stat 0x%x\n",
- ap->id, status, host_stat);
+ printk(KERN_ERR "ata%u: command error, drv_stat 0x%x\n",
+ ap->id, status);
/* make sure qc->err_mask is available to
* know what's wrong and recover
ata_qc_complete(qc);
break;
default:
- goto idle_irq;
+ BUG();
}
}
/* Check whether we are expecting interrupt in this state */
switch (ap->hsm_task_state) {
case HSM_ST_FIRST:
+ /* Some pre-ATAPI-4 devices assert INTRQ
+ * at this state when ready to receive CDB.
+ */
+
/* Check the ATA_DFLAG_CDB_INTR flag is enough here.
* The flag was turned on only for atapi devices.
* No need to check is_atapi_taskfile(&qc->tf) again.