diff options
author | Tejun Heo <htejun@gmail.com> | 2006-04-02 05:51:53 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-04-02 10:09:20 -0400 |
commit | 74e6c8c394ca2126a60e97bc1142ec2d91761e9a (patch) | |
tree | 4f9422284300b495590501d9fb919c062d60069f /drivers | |
parent | 058e55e120ca59d37392f9aa753da2d9ead24505 (diff) |
[PATCH] libata: don't read TF directly from sense generation functions
TF register might not be directly accessible depending on errors.
e.g. TF of failed NCQ command is in log page 10h. Make reading TF
responsibility of error handlers. For the current EH, simply push TF
reading into qc completion functions as they are practically part of
EH. New EH will fill qc->tf with status registers before complting
qcs.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/libata-scsi.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index ec628cea386e..28706521773c 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -546,12 +546,6 @@ void ata_gen_ata_desc_sense(struct ata_queued_cmd *qc) | |||
546 | cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; | 546 | cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; |
547 | 547 | ||
548 | /* | 548 | /* |
549 | * Read the controller registers. | ||
550 | */ | ||
551 | WARN_ON(qc->ap->ops->tf_read == NULL); | ||
552 | qc->ap->ops->tf_read(qc->ap, tf); | ||
553 | |||
554 | /* | ||
555 | * Use ata_to_sense_error() to map status register bits | 549 | * Use ata_to_sense_error() to map status register bits |
556 | * onto sense key, asc & ascq. | 550 | * onto sense key, asc & ascq. |
557 | */ | 551 | */ |
@@ -622,12 +616,6 @@ void ata_gen_fixed_sense(struct ata_queued_cmd *qc) | |||
622 | cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; | 616 | cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; |
623 | 617 | ||
624 | /* | 618 | /* |
625 | * Read the controller registers. | ||
626 | */ | ||
627 | WARN_ON(qc->ap->ops->tf_read == NULL); | ||
628 | qc->ap->ops->tf_read(qc->ap, tf); | ||
629 | |||
630 | /* | ||
631 | * Use ata_to_sense_error() to map status register bits | 619 | * Use ata_to_sense_error() to map status register bits |
632 | * onto sense key, asc & ascq. | 620 | * onto sense key, asc & ascq. |
633 | */ | 621 | */ |
@@ -1337,11 +1325,14 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) | |||
1337 | */ | 1325 | */ |
1338 | if (((cdb[0] == ATA_16) || (cdb[0] == ATA_12)) && | 1326 | if (((cdb[0] == ATA_16) || (cdb[0] == ATA_12)) && |
1339 | ((cdb[2] & 0x20) || need_sense)) { | 1327 | ((cdb[2] & 0x20) || need_sense)) { |
1328 | qc->ap->ops->tf_read(qc->ap, &qc->tf); | ||
1340 | ata_gen_ata_desc_sense(qc); | 1329 | ata_gen_ata_desc_sense(qc); |
1341 | } else { | 1330 | } else { |
1342 | if (!need_sense) { | 1331 | if (!need_sense) { |
1343 | cmd->result = SAM_STAT_GOOD; | 1332 | cmd->result = SAM_STAT_GOOD; |
1344 | } else { | 1333 | } else { |
1334 | qc->ap->ops->tf_read(qc->ap, &qc->tf); | ||
1335 | |||
1345 | /* TODO: decide which descriptor format to use | 1336 | /* TODO: decide which descriptor format to use |
1346 | * for 48b LBA devices and call that here | 1337 | * for 48b LBA devices and call that here |
1347 | * instead of the fixed desc, which is only | 1338 | * instead of the fixed desc, which is only |
@@ -2133,13 +2124,15 @@ void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8 | |||
2133 | 2124 | ||
2134 | static void atapi_sense_complete(struct ata_queued_cmd *qc) | 2125 | static void atapi_sense_complete(struct ata_queued_cmd *qc) |
2135 | { | 2126 | { |
2136 | if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0)) | 2127 | if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0)) { |
2137 | /* FIXME: not quite right; we don't want the | 2128 | /* FIXME: not quite right; we don't want the |
2138 | * translation of taskfile registers into | 2129 | * translation of taskfile registers into |
2139 | * a sense descriptors, since that's only | 2130 | * a sense descriptors, since that's only |
2140 | * correct for ATA, not ATAPI | 2131 | * correct for ATA, not ATAPI |
2141 | */ | 2132 | */ |
2133 | qc->ap->ops->tf_read(qc->ap, &qc->tf); | ||
2142 | ata_gen_ata_desc_sense(qc); | 2134 | ata_gen_ata_desc_sense(qc); |
2135 | } | ||
2143 | 2136 | ||
2144 | qc->scsidone(qc->scsicmd); | 2137 | qc->scsidone(qc->scsicmd); |
2145 | ata_qc_free(qc); | 2138 | ata_qc_free(qc); |
@@ -2207,17 +2200,15 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) | |||
2207 | cmd->result = SAM_STAT_CHECK_CONDITION; | 2200 | cmd->result = SAM_STAT_CHECK_CONDITION; |
2208 | atapi_request_sense(qc); | 2201 | atapi_request_sense(qc); |
2209 | return; | 2202 | return; |
2210 | } | 2203 | } else if (unlikely(err_mask)) { |
2211 | |||
2212 | else if (unlikely(err_mask)) | ||
2213 | /* FIXME: not quite right; we don't want the | 2204 | /* FIXME: not quite right; we don't want the |
2214 | * translation of taskfile registers into | 2205 | * translation of taskfile registers into |
2215 | * a sense descriptors, since that's only | 2206 | * a sense descriptors, since that's only |
2216 | * correct for ATA, not ATAPI | 2207 | * correct for ATA, not ATAPI |
2217 | */ | 2208 | */ |
2209 | qc->ap->ops->tf_read(qc->ap, &qc->tf); | ||
2218 | ata_gen_ata_desc_sense(qc); | 2210 | ata_gen_ata_desc_sense(qc); |
2219 | 2211 | } else { | |
2220 | else { | ||
2221 | u8 *scsicmd = cmd->cmnd; | 2212 | u8 *scsicmd = cmd->cmnd; |
2222 | 2213 | ||
2223 | if ((scsicmd[0] == INQUIRY) && ((scsicmd[1] & 0x03) == 0)) { | 2214 | if ((scsicmd[0] == INQUIRY) && ((scsicmd[1] & 0x03) == 0)) { |