aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-11-14 08:37:35 -0500
committerJeff Garzik <jeff@garzik.org>2006-12-01 22:45:59 -0500
commit39599a5334decc2669ba794fb0ccd2b112ef1ba4 (patch)
treeff204f613472d673af4614e0bcef6689ea69c15a /drivers/ata/libata-core.c
parent61c0596c5fbef99df5518ae449be4ab49a2c2233 (diff)
[PATCH] libata: sync result_tf.flags w/ command tf.flags
libata didn't initialize result_tf.flags which indicates transfer type (RW/FUA) and address type (CHS/LBA/LBA48). ata_gen_fixed_sense() assumed result_tf.flags equals command tf.flags and failed to report the first failed block to SCSI layer because zero tf flags indicates CHS and bad block reporting for CHS is not implemented. Implement fill_result_tf() which sets result_tf.flags to command tf.flags and use it to fill result_tf. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index a52c0719883..13dcef809e5 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4536,6 +4536,14 @@ void __ata_qc_complete(struct ata_queued_cmd *qc)
4536 qc->complete_fn(qc); 4536 qc->complete_fn(qc);
4537} 4537}
4538 4538
4539static void fill_result_tf(struct ata_queued_cmd *qc)
4540{
4541 struct ata_port *ap = qc->ap;
4542
4543 ap->ops->tf_read(ap, &qc->result_tf);
4544 qc->result_tf.flags = qc->tf.flags;
4545}
4546
4539/** 4547/**
4540 * ata_qc_complete - Complete an active ATA command 4548 * ata_qc_complete - Complete an active ATA command
4541 * @qc: Command to complete 4549 * @qc: Command to complete
@@ -4573,7 +4581,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
4573 if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) { 4581 if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) {
4574 if (!ata_tag_internal(qc->tag)) { 4582 if (!ata_tag_internal(qc->tag)) {
4575 /* always fill result TF for failed qc */ 4583 /* always fill result TF for failed qc */
4576 ap->ops->tf_read(ap, &qc->result_tf); 4584 fill_result_tf(qc);
4577 ata_qc_schedule_eh(qc); 4585 ata_qc_schedule_eh(qc);
4578 return; 4586 return;
4579 } 4587 }
@@ -4581,7 +4589,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
4581 4589
4582 /* read result TF if requested */ 4590 /* read result TF if requested */
4583 if (qc->flags & ATA_QCFLAG_RESULT_TF) 4591 if (qc->flags & ATA_QCFLAG_RESULT_TF)
4584 ap->ops->tf_read(ap, &qc->result_tf); 4592 fill_result_tf(qc);
4585 4593
4586 __ata_qc_complete(qc); 4594 __ata_qc_complete(qc);
4587 } else { 4595 } else {
@@ -4590,7 +4598,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
4590 4598
4591 /* read result TF if failed or requested */ 4599 /* read result TF if failed or requested */
4592 if (qc->err_mask || qc->flags & ATA_QCFLAG_RESULT_TF) 4600 if (qc->err_mask || qc->flags & ATA_QCFLAG_RESULT_TF)
4593 ap->ops->tf_read(ap, &qc->result_tf); 4601 fill_result_tf(qc);
4594 4602
4595 __ata_qc_complete(qc); 4603 __ata_qc_complete(qc);
4596 } 4604 }