Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 29448
b: refs/heads/master
c: 3655d1d
h: refs/heads/master
v: v3
  • Loading branch information
Albert Lee authored and Jeff Garzik committed May 20, 2006
1 parent d7ade33 commit 128ef44
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 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: 3d71b3b0b634b1a5ba8632fd9ec998e0e4aedfdb
refs/heads/master: 3655d1d323386e001c786af10f0a3f39f438f03b
31 changes: 24 additions & 7 deletions trunk/drivers/scsi/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -4009,9 +4009,15 @@ static int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
poll_next = (qc->tf.flags & ATA_TFLAG_POLLING);

/* check device status */
if (unlikely((status & (ATA_BUSY | ATA_DRQ)) != ATA_DRQ)) {
/* Wrong status. Let EH handle this */
qc->err_mask |= AC_ERR_HSM;
if (unlikely((status & ATA_DRQ) == 0)) {
/* handle BSY=0, DRQ=0 as error */
if (likely(status & (ATA_ERR | ATA_DF)))
/* device stops HSM for abort/error */
qc->err_mask |= AC_ERR_DEV;
else
/* HSM violation. Let EH handle this */
qc->err_mask |= AC_ERR_HSM;

ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}
Expand All @@ -4025,7 +4031,7 @@ static int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
if (unlikely(status & (ATA_ERR | ATA_DF))) {
printk(KERN_WARNING "ata%d: DRQ=1 with device error, dev_stat 0x%X\n",
ap->id, status);
qc->err_mask |= AC_ERR_DEV;
qc->err_mask |= AC_ERR_HSM;
ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}
Expand Down Expand Up @@ -4067,7 +4073,9 @@ static int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
if (qc->tf.protocol == ATA_PROT_ATAPI) {
/* ATAPI PIO protocol */
if ((status & ATA_DRQ) == 0) {
/* no more data to transfer */
/* No more data to transfer or device error.
* Device error will be tagged in HSM_ST_LAST.
*/
ap->hsm_task_state = HSM_ST_LAST;
goto fsm_start;
}
Expand All @@ -4081,7 +4089,7 @@ static int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
if (unlikely(status & (ATA_ERR | ATA_DF))) {
printk(KERN_WARNING "ata%d: DRQ=1 with device error, dev_stat 0x%X\n",
ap->id, status);
qc->err_mask |= AC_ERR_DEV;
qc->err_mask |= AC_ERR_HSM;
ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}
Expand All @@ -4096,7 +4104,13 @@ static int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
/* ATA PIO protocol */
if (unlikely((status & ATA_DRQ) == 0)) {
/* handle BSY=0, DRQ=0 as error */
qc->err_mask |= AC_ERR_HSM;
if (likely(status & (ATA_ERR | ATA_DF)))
/* device stops HSM for abort/error */
qc->err_mask |= AC_ERR_DEV;
else
/* HSM violation. Let EH handle this */
qc->err_mask |= AC_ERR_HSM;

ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}
Expand All @@ -4121,6 +4135,9 @@ static int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
status = ata_wait_idle(ap);
}

if (status & (ATA_BUSY | ATA_DRQ))
qc->err_mask |= AC_ERR_HSM;

/* ata_pio_sectors() might change the
* state to HSM_ST_LAST. so, the state
* is changed after ata_pio_sectors().
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/libata.h
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ static inline int ata_try_flush_cache(const struct ata_device *dev)

static inline unsigned int ac_err_mask(u8 status)
{
if (status & ATA_BUSY)
if (status & (ATA_BUSY | ATA_DRQ))
return AC_ERR_HSM;
if (status & (ATA_ERR | ATA_DF))
return AC_ERR_DEV;
Expand Down

0 comments on commit 128ef44

Please sign in to comment.