diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-05 15:02:14 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-05 15:02:14 -0400 |
commit | a15dbeb4772626a015337dea06da67095aec3862 (patch) | |
tree | 2834c0f61b396c2eba008c176b49460c02a564f5 /drivers/scsi/libata-scsi.c | |
parent | 67846b30171cc4d706125f630193a76a26bb334a (diff) |
libata: ATAPI command completion tweaks and notes
1) note urgent bug, that completes command twice
2) only fix up INQUIRY data if the SCSI version is zero (typically
indicates ATAPI MMC-ish device)
3) if there is a problem on the ATA bus, don't bother with REQUEST
SENSE, just directly handle the error based on Status/Error registers.
Diffstat (limited to 'drivers/scsi/libata-scsi.c')
-rw-r--r-- | drivers/scsi/libata-scsi.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 45ebe9fd52ea..1a1ef3429e55 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -1483,9 +1483,18 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | |||
1483 | { | 1483 | { |
1484 | struct scsi_cmnd *cmd = qc->scsicmd; | 1484 | struct scsi_cmnd *cmd = qc->scsicmd; |
1485 | 1485 | ||
1486 | if (unlikely(drv_stat & (ATA_ERR | ATA_BUSY | ATA_DRQ))) { | 1486 | if (unlikely(drv_stat & (ATA_BUSY | ATA_DRQ))) |
1487 | ata_to_sense_error(qc, drv_stat); | ||
1488 | else if (unlikely(drv_stat & ATA_ERR)) { | ||
1487 | DPRINTK("request check condition\n"); | 1489 | DPRINTK("request check condition\n"); |
1488 | 1490 | ||
1491 | /* FIXME: command completion with check condition | ||
1492 | * but no sense causes the error handler to run, | ||
1493 | * which then issues REQUEST SENSE, fills in the sense | ||
1494 | * buffer, and completes the command (for the second | ||
1495 | * time). We need to issue REQUEST SENSE some other | ||
1496 | * way, to avoid completing the command twice. | ||
1497 | */ | ||
1489 | cmd->result = SAM_STAT_CHECK_CONDITION; | 1498 | cmd->result = SAM_STAT_CHECK_CONDITION; |
1490 | 1499 | ||
1491 | qc->scsidone(cmd); | 1500 | qc->scsidone(cmd); |
@@ -1499,10 +1508,26 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | |||
1499 | unsigned int buflen; | 1508 | unsigned int buflen; |
1500 | 1509 | ||
1501 | buflen = ata_scsi_rbuf_get(cmd, &buf); | 1510 | buflen = ata_scsi_rbuf_get(cmd, &buf); |
1502 | buf[2] = 0x5; | 1511 | |
1503 | buf[3] = (buf[3] & 0xf0) | 2; | 1512 | /* ATAPI devices typically report zero for their SCSI version, |
1513 | * and sometimes deviate from the spec WRT response data | ||
1514 | * format. If SCSI version is reported as zero like normal, | ||
1515 | * then we make the following fixups: 1) Fake MMC-5 version, | ||
1516 | * to indicate to the Linux scsi midlayer this is a modern | ||
1517 | * device. 2) Ensure response data format / ATAPI information | ||
1518 | * are always correct. | ||
1519 | */ | ||
1520 | /* FIXME: do we ever override EVPD pages and the like, with | ||
1521 | * this code? | ||
1522 | */ | ||
1523 | if (buf[2] == 0) { | ||
1524 | buf[2] = 0x5; | ||
1525 | buf[3] = 0x32; | ||
1526 | } | ||
1527 | |||
1504 | ata_scsi_rbuf_put(cmd, buf); | 1528 | ata_scsi_rbuf_put(cmd, buf); |
1505 | } | 1529 | } |
1530 | |||
1506 | cmd->result = SAM_STAT_GOOD; | 1531 | cmd->result = SAM_STAT_GOOD; |
1507 | } | 1532 | } |
1508 | 1533 | ||