diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-30 04:50:22 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-30 04:50:22 -0500 |
commit | 054ee8fd39f1b5d50e803f126b63f400d631eea4 (patch) | |
tree | 2819e388f853de88e09635de8e38017b563069bc /drivers/scsi/libata-scsi.c | |
parent | f0612bbc41f65f5a684f69d714a1a17a6f0f40c5 (diff) | |
parent | a7dac447bb9cef27d4d29cdf63e2d7809c50b1f4 (diff) |
Merge branch 'upstream'
Diffstat (limited to 'drivers/scsi/libata-scsi.c')
-rw-r--r-- | drivers/scsi/libata-scsi.c | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 69058510f43a..5574520bf1c2 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -560,7 +560,7 @@ void ata_gen_ata_desc_sense(struct ata_queued_cmd *qc) | |||
560 | * Use ata_to_sense_error() to map status register bits | 560 | * Use ata_to_sense_error() to map status register bits |
561 | * onto sense key, asc & ascq. | 561 | * onto sense key, asc & ascq. |
562 | */ | 562 | */ |
563 | if (unlikely(tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ))) { | 563 | if (tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) { |
564 | ata_to_sense_error(qc->ap->id, tf->command, tf->feature, | 564 | ata_to_sense_error(qc->ap->id, tf->command, tf->feature, |
565 | &sb[1], &sb[2], &sb[3]); | 565 | &sb[1], &sb[2], &sb[3]); |
566 | sb[1] &= 0x0f; | 566 | sb[1] &= 0x0f; |
@@ -635,7 +635,7 @@ void ata_gen_fixed_sense(struct ata_queued_cmd *qc) | |||
635 | * Use ata_to_sense_error() to map status register bits | 635 | * Use ata_to_sense_error() to map status register bits |
636 | * onto sense key, asc & ascq. | 636 | * onto sense key, asc & ascq. |
637 | */ | 637 | */ |
638 | if (unlikely(tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ))) { | 638 | if (tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) { |
639 | ata_to_sense_error(qc->ap->id, tf->command, tf->feature, | 639 | ata_to_sense_error(qc->ap->id, tf->command, tf->feature, |
640 | &sb[2], &sb[12], &sb[13]); | 640 | &sb[2], &sb[12], &sb[13]); |
641 | sb[2] &= 0x0f; | 641 | sb[2] &= 0x0f; |
@@ -644,7 +644,11 @@ void ata_gen_fixed_sense(struct ata_queued_cmd *qc) | |||
644 | sb[0] = 0x70; | 644 | sb[0] = 0x70; |
645 | sb[7] = 0x0a; | 645 | sb[7] = 0x0a; |
646 | 646 | ||
647 | if (tf->flags & ATA_TFLAG_LBA && !(tf->flags & ATA_TFLAG_LBA48)) { | 647 | if (tf->flags & ATA_TFLAG_LBA48) { |
648 | /* TODO: find solution for LBA48 descriptors */ | ||
649 | } | ||
650 | |||
651 | else if (tf->flags & ATA_TFLAG_LBA) { | ||
648 | /* A small (28b) LBA will fit in the 32b info field */ | 652 | /* A small (28b) LBA will fit in the 32b info field */ |
649 | sb[0] |= 0x80; /* set valid bit */ | 653 | sb[0] |= 0x80; /* set valid bit */ |
650 | sb[3] = tf->device & 0x0f; | 654 | sb[3] = tf->device & 0x0f; |
@@ -652,6 +656,10 @@ void ata_gen_fixed_sense(struct ata_queued_cmd *qc) | |||
652 | sb[5] = tf->lbam; | 656 | sb[5] = tf->lbam; |
653 | sb[6] = tf->lbal; | 657 | sb[6] = tf->lbal; |
654 | } | 658 | } |
659 | |||
660 | else { | ||
661 | /* TODO: C/H/S */ | ||
662 | } | ||
655 | } | 663 | } |
656 | 664 | ||
657 | /** | 665 | /** |
@@ -1209,10 +1217,12 @@ nothing_to_do: | |||
1209 | return 1; | 1217 | return 1; |
1210 | } | 1218 | } |
1211 | 1219 | ||
1212 | static int ata_scsi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | 1220 | static int ata_scsi_qc_complete(struct ata_queued_cmd *qc, |
1221 | unsigned int err_mask) | ||
1213 | { | 1222 | { |
1214 | struct scsi_cmnd *cmd = qc->scsicmd; | 1223 | struct scsi_cmnd *cmd = qc->scsicmd; |
1215 | int need_sense = drv_stat & (ATA_ERR | ATA_BUSY | ATA_DRQ); | 1224 | u8 *cdb = cmd->cmnd; |
1225 | int need_sense = (err_mask != 0); | ||
1216 | 1226 | ||
1217 | /* For ATA pass thru (SAT) commands, generate a sense block if | 1227 | /* For ATA pass thru (SAT) commands, generate a sense block if |
1218 | * user mandated it or if there's an error. Note that if we | 1228 | * user mandated it or if there's an error. Note that if we |
@@ -1221,8 +1231,8 @@ static int ata_scsi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | |||
1221 | * whether the command completed successfully or not. If there | 1231 | * whether the command completed successfully or not. If there |
1222 | * was no error, SK, ASC and ASCQ will all be zero. | 1232 | * was no error, SK, ASC and ASCQ will all be zero. |
1223 | */ | 1233 | */ |
1224 | if (((cmd->cmnd[0] == ATA_16) || (cmd->cmnd[0] == ATA_12)) && | 1234 | if (((cdb[0] == ATA_16) || (cdb[0] == ATA_12)) && |
1225 | ((cmd->cmnd[2] & 0x20) || need_sense)) { | 1235 | ((cdb[2] & 0x20) || need_sense)) { |
1226 | ata_gen_ata_desc_sense(qc); | 1236 | ata_gen_ata_desc_sense(qc); |
1227 | } else { | 1237 | } else { |
1228 | if (!need_sense) { | 1238 | if (!need_sense) { |
@@ -2005,21 +2015,13 @@ void atapi_request_sense(struct ata_port *ap, struct ata_device *dev, | |||
2005 | DPRINTK("EXIT\n"); | 2015 | DPRINTK("EXIT\n"); |
2006 | } | 2016 | } |
2007 | 2017 | ||
2008 | static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | 2018 | static int atapi_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) |
2009 | { | 2019 | { |
2010 | struct scsi_cmnd *cmd = qc->scsicmd; | 2020 | struct scsi_cmnd *cmd = qc->scsicmd; |
2011 | 2021 | ||
2012 | VPRINTK("ENTER, drv_stat == 0x%x\n", drv_stat); | 2022 | VPRINTK("ENTER, err_mask 0x%X\n", err_mask); |
2013 | |||
2014 | if (unlikely(drv_stat & (ATA_BUSY | ATA_DRQ))) | ||
2015 | /* FIXME: not quite right; we don't want the | ||
2016 | * translation of taskfile registers into | ||
2017 | * a sense descriptors, since that's only | ||
2018 | * correct for ATA, not ATAPI | ||
2019 | */ | ||
2020 | ata_gen_ata_desc_sense(qc); | ||
2021 | 2023 | ||
2022 | else if (unlikely(drv_stat & ATA_ERR)) { | 2024 | if (unlikely(err_mask & AC_ERR_DEV)) { |
2023 | DPRINTK("request check condition\n"); | 2025 | DPRINTK("request check condition\n"); |
2024 | 2026 | ||
2025 | /* FIXME: command completion with check condition | 2027 | /* FIXME: command completion with check condition |
@@ -2036,6 +2038,14 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | |||
2036 | return 1; | 2038 | return 1; |
2037 | } | 2039 | } |
2038 | 2040 | ||
2041 | else if (unlikely(err_mask)) | ||
2042 | /* FIXME: not quite right; we don't want the | ||
2043 | * translation of taskfile registers into | ||
2044 | * a sense descriptors, since that's only | ||
2045 | * correct for ATA, not ATAPI | ||
2046 | */ | ||
2047 | ata_gen_ata_desc_sense(qc); | ||
2048 | |||
2039 | else { | 2049 | else { |
2040 | u8 *scsicmd = cmd->cmnd; | 2050 | u8 *scsicmd = cmd->cmnd; |
2041 | 2051 | ||