Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 29362
b: refs/heads/master
c: a4f1661
h: refs/heads/master
v: v3
  • Loading branch information
Albert Lee authored and Jeff Garzik committed Jan 18, 2006
1 parent dfe170d commit 9645cd3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ea9b395fe20ac74be788f415af2622ac8f0c35c7
refs/heads/master: a4f16610081001640ffe0314024bc31c10f69757
21 changes: 19 additions & 2 deletions trunk/drivers/scsi/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3265,6 +3265,7 @@ static int ata_pio_first_block(struct ata_port *ap)
/* sleep-wait for BSY to clear */
DPRINTK("busy wait\n");
if (ata_busy_sleep(ap, ATA_TMOUT_DATAOUT_QUICK, ATA_TMOUT_DATAOUT)) {
qc->err_mask |= AC_ERR_ATA_BUS;
ap->hsm_task_state = HSM_ST_TMOUT;
goto err_out;
}
Expand All @@ -3273,6 +3274,7 @@ static int ata_pio_first_block(struct ata_port *ap)
status = ata_chk_status(ap);
if ((status & (ATA_BUSY | ATA_DRQ)) != ATA_DRQ) {
/* device status error */
qc->err_mask |= AC_ERR_ATA_BUS;
ap->hsm_task_state = HSM_ST_ERR;
goto err_out;
}
Expand Down Expand Up @@ -4288,6 +4290,12 @@ inline unsigned int ata_host_intr (struct ata_port *ap,

/* before we do anything else, clear DMA-Start bit */
ap->ops->bmdma_stop(qc);

if (unlikely(host_stat & ATA_DMA_ERR)) {
/* error when transfering data to/from memory */
qc->err_mask |= AC_ERR_HOST_BUS;
ap->hsm_task_state = HSM_ST_ERR;
}
}
break;
case HSM_ST:
Expand All @@ -4313,8 +4321,10 @@ inline unsigned int ata_host_intr (struct ata_port *ap,
ap->ops->irq_clear(ap);

/* check error */
if (unlikely((status & ATA_ERR) || (host_stat & ATA_DMA_ERR)))
if (unlikely(status & (ATA_ERR | ATA_DF))) {
qc->err_mask |= AC_ERR_DEV;
ap->hsm_task_state = HSM_ST_ERR;
}

fsm_start:
switch (ap->hsm_task_state) {
Expand All @@ -4326,6 +4336,7 @@ inline unsigned int ata_host_intr (struct ata_port *ap,
/* check device status */
if (unlikely((status & (ATA_BUSY | ATA_DRQ)) != ATA_DRQ)) {
/* Wrong status. Let EH handle this */
qc->err_mask |= AC_ERR_ATA_BUS;
ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}
Expand Down Expand Up @@ -4354,6 +4365,7 @@ inline unsigned int ata_host_intr (struct ata_port *ap,
/* ATA PIO protocol */
if (unlikely((status & ATA_DRQ) == 0)) {
/* handle BSY=0, DRQ=0 as error */
qc->err_mask |= AC_ERR_ATA_BUS;
ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}
Expand All @@ -4375,6 +4387,7 @@ inline unsigned int ata_host_intr (struct ata_port *ap,
case HSM_ST_LAST:
if (unlikely(status & ATA_DRQ)) {
/* handle DRQ=1 as error */
qc->err_mask |= AC_ERR_ATA_BUS;
ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}
Expand All @@ -4394,8 +4407,12 @@ inline unsigned int ata_host_intr (struct ata_port *ap,
printk(KERN_ERR "ata%u: command error, drv_stat 0x%x host_stat 0x%x\n",
ap->id, status, host_stat);

/* make sure qc->err_mask is available to
* know what's wrong and recover
*/
assert(qc->err_mask);

ap->hsm_task_state = HSM_ST_IDLE;
qc->err_mask |= __ac_err_mask(status);
ata_qc_complete(qc);
break;
default:
Expand Down

0 comments on commit 9645cd3

Please sign in to comment.