Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 29413
b: refs/heads/master
c: eee6c32
h: refs/heads/master
i:
  29411: cf0c43a
v: v3
  • Loading branch information
Albert Lee authored and Jeff Garzik committed Apr 1, 2006
1 parent 90f644c commit df65f78
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 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: 6e07e16404deafadf45895a7d2aeb5feba53b479
refs/heads/master: eee6c32f5f114f9b9f2d94862f0dc0d3ff523864
46 changes: 32 additions & 14 deletions trunk/drivers/scsi/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3640,13 +3640,16 @@ static int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,

/* Device should not ask for data transfer (DRQ=1)
* when it finds something wrong.
* Anyway, we respect DRQ here and let HSM go on
* without changing hsm_task_state to HSM_ST_ERR.
* We ignore DRQ here and stop the HSM by
* changing hsm_task_state to HSM_ST_ERR and
* let the EH abort the command or reset the device.
*/
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;
ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}

/* Send the CDB (atapi) or the first data block (ata pio out).
Expand Down Expand Up @@ -3693,13 +3696,16 @@ static int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,

/* Device should not ask for data transfer (DRQ=1)
* when it finds something wrong.
* Anyway, we respect DRQ here and let HSM go on
* without changing hsm_task_state to HSM_ST_ERR.
* We ignore DRQ here and stop the HSM by
* changing hsm_task_state to HSM_ST_ERR and
* let the EH abort the command or reset the device.
*/
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;
ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}

atapi_pio_bytes(qc);
Expand All @@ -3717,20 +3723,32 @@ static int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
goto fsm_start;
}

/* Some devices may ask for data transfer (DRQ=1)
* alone with ERR=1 for PIO reads.
* We respect DRQ here and let HSM go on without
* changing hsm_task_state to HSM_ST_ERR.
/* For PIO reads, some devices may ask for
* data transfer (DRQ=1) alone with ERR=1.
* We respect DRQ here and transfer one
* block of junk data before changing the
* hsm_task_state to HSM_ST_ERR.
*
* For PIO writes, ERR=1 DRQ=1 doesn't make
* sense since the data block has been
* transferred to the device.
*/
if (unlikely(status & (ATA_ERR | ATA_DF))) {
/* For writes, ERR=1 DRQ=1 doesn't make
* sense since the data block has been
* transferred to the device.
*/
WARN_ON(qc->tf.flags & ATA_TFLAG_WRITE);

/* data might be corrputed */
qc->err_mask |= AC_ERR_DEV;

if (!(qc->tf.flags & ATA_TFLAG_WRITE)) {
ata_pio_sectors(qc);
ata_altstatus(ap);
status = ata_wait_idle(ap);
}

/* ata_pio_sectors() might change the
* state to HSM_ST_LAST. so, the state
* is changed after ata_pio_sectors().
*/
ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}

ata_pio_sectors(qc);
Expand Down

0 comments on commit df65f78

Please sign in to comment.