aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libata-scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libata-scsi.c')
-rw-r--r--drivers/scsi/libata-scsi.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index b0c83c28d578..ce90b6352a81 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -537,7 +537,7 @@ void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, u8 *asc,
537void ata_gen_ata_desc_sense(struct ata_queued_cmd *qc) 537void ata_gen_ata_desc_sense(struct ata_queued_cmd *qc)
538{ 538{
539 struct scsi_cmnd *cmd = qc->scsicmd; 539 struct scsi_cmnd *cmd = qc->scsicmd;
540 struct ata_taskfile *tf = &qc->tf; 540 struct ata_taskfile *tf = &qc->result_tf;
541 unsigned char *sb = cmd->sense_buffer; 541 unsigned char *sb = cmd->sense_buffer;
542 unsigned char *desc = sb + 8; 542 unsigned char *desc = sb + 8;
543 543
@@ -608,7 +608,7 @@ void ata_gen_ata_desc_sense(struct ata_queued_cmd *qc)
608void ata_gen_fixed_sense(struct ata_queued_cmd *qc) 608void ata_gen_fixed_sense(struct ata_queued_cmd *qc)
609{ 609{
610 struct scsi_cmnd *cmd = qc->scsicmd; 610 struct scsi_cmnd *cmd = qc->scsicmd;
611 struct ata_taskfile *tf = &qc->tf; 611 struct ata_taskfile *tf = &qc->result_tf;
612 unsigned char *sb = cmd->sense_buffer; 612 unsigned char *sb = cmd->sense_buffer;
613 613
614 memset(sb, 0, SCSI_SENSE_BUFFERSIZE); 614 memset(sb, 0, SCSI_SENSE_BUFFERSIZE);
@@ -1199,14 +1199,11 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1199 */ 1199 */
1200 if (((cdb[0] == ATA_16) || (cdb[0] == ATA_12)) && 1200 if (((cdb[0] == ATA_16) || (cdb[0] == ATA_12)) &&
1201 ((cdb[2] & 0x20) || need_sense)) { 1201 ((cdb[2] & 0x20) || need_sense)) {
1202 qc->ap->ops->tf_read(qc->ap, &qc->tf);
1203 ata_gen_ata_desc_sense(qc); 1202 ata_gen_ata_desc_sense(qc);
1204 } else { 1203 } else {
1205 if (!need_sense) { 1204 if (!need_sense) {
1206 cmd->result = SAM_STAT_GOOD; 1205 cmd->result = SAM_STAT_GOOD;
1207 } else { 1206 } else {
1208 qc->ap->ops->tf_read(qc->ap, &qc->tf);
1209
1210 /* TODO: decide which descriptor format to use 1207 /* TODO: decide which descriptor format to use
1211 * for 48b LBA devices and call that here 1208 * for 48b LBA devices and call that here
1212 * instead of the fixed desc, which is only 1209 * instead of the fixed desc, which is only
@@ -1217,10 +1214,8 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1217 } 1214 }
1218 } 1215 }
1219 1216
1220 if (need_sense) { 1217 if (need_sense)
1221 /* The ata_gen_..._sense routines fill in tf */ 1218 ata_dump_status(qc->ap->id, &qc->result_tf);
1222 ata_dump_status(qc->ap->id, &qc->tf);
1223 }
1224 1219
1225 qc->scsidone(cmd); 1220 qc->scsidone(cmd);
1226 1221
@@ -2004,7 +1999,6 @@ static void atapi_sense_complete(struct ata_queued_cmd *qc)
2004 * a sense descriptors, since that's only 1999 * a sense descriptors, since that's only
2005 * correct for ATA, not ATAPI 2000 * correct for ATA, not ATAPI
2006 */ 2001 */
2007 qc->ap->ops->tf_read(qc->ap, &qc->tf);
2008 ata_gen_ata_desc_sense(qc); 2002 ata_gen_ata_desc_sense(qc);
2009 } 2003 }
2010 2004
@@ -2080,7 +2074,6 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc)
2080 * a sense descriptors, since that's only 2074 * a sense descriptors, since that's only
2081 * correct for ATA, not ATAPI 2075 * correct for ATA, not ATAPI
2082 */ 2076 */
2083 qc->ap->ops->tf_read(qc->ap, &qc->tf);
2084 ata_gen_ata_desc_sense(qc); 2077 ata_gen_ata_desc_sense(qc);
2085 } else { 2078 } else {
2086 u8 *scsicmd = cmd->cmnd; 2079 u8 *scsicmd = cmd->cmnd;
@@ -2361,6 +2354,9 @@ ata_scsi_pass_thru(struct ata_queued_cmd *qc, const u8 *scsicmd)
2361 */ 2354 */
2362 qc->nsect = cmd->bufflen / ATA_SECT_SIZE; 2355 qc->nsect = cmd->bufflen / ATA_SECT_SIZE;
2363 2356
2357 /* request result TF */
2358 qc->flags |= ATA_QCFLAG_RESULT_TF;
2359
2364 return 0; 2360 return 0;
2365 2361
2366 invalid_fld: 2362 invalid_fld: