aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-scsi.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2008-03-18 04:47:43 -0400
committerJeff Garzik <jeff@garzik.org>2008-03-24 22:09:12 -0400
commitaacda37538e7f9cf2148eedf3766239829e51ba4 (patch)
tree0206d2db8ce636aadabf8e3effd1ee3114ccff2a /drivers/ata/libata-scsi.c
parentcc7feea39bed2951cc29af3ad642f39a99dfe8d3 (diff)
libata: implement ata_qc_raw_nbytes()
Implement ata_qc_raw_nbytes() which determines the raw user-requested size of a PC command. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r--drivers/ata/libata-scsi.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 8f0e8f2bc628..15795394b0a8 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -527,6 +527,14 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
527 return qc; 527 return qc;
528} 528}
529 529
530static void ata_qc_set_pc_nbytes(struct ata_queued_cmd *qc)
531{
532 struct scsi_cmnd *scmd = qc->scsicmd;
533
534 qc->extrabytes = scmd->request->extra_len;
535 qc->nbytes = scsi_bufflen(scmd) + qc->extrabytes;
536}
537
530/** 538/**
531 * ata_dump_status - user friendly display of error info 539 * ata_dump_status - user friendly display of error info
532 * @id: id of the port in question 540 * @id: id of the port in question
@@ -2539,7 +2547,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2539 } 2547 }
2540 2548
2541 qc->tf.command = ATA_CMD_PACKET; 2549 qc->tf.command = ATA_CMD_PACKET;
2542 qc->nbytes = scsi_bufflen(scmd) + scmd->request->extra_len; 2550 ata_qc_set_pc_nbytes(qc);
2543 2551
2544 /* check whether ATAPI DMA is safe */ 2552 /* check whether ATAPI DMA is safe */
2545 if (!using_pio && ata_check_atapi_dma(qc)) 2553 if (!using_pio && ata_check_atapi_dma(qc))
@@ -2550,7 +2558,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2550 * want to set it properly, and for DMA where it is 2558 * want to set it properly, and for DMA where it is
2551 * effectively meaningless. 2559 * effectively meaningless.
2552 */ 2560 */
2553 nbytes = min(scmd->request->data_len, (unsigned int)63 * 1024); 2561 nbytes = min(ata_qc_raw_nbytes(qc), (unsigned int)63 * 1024);
2554 2562
2555 /* Most ATAPI devices which honor transfer chunk size don't 2563 /* Most ATAPI devices which honor transfer chunk size don't
2556 * behave according to the spec when odd chunk size which 2564 * behave according to the spec when odd chunk size which
@@ -2876,7 +2884,7 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
2876 * TODO: find out if we need to do more here to 2884 * TODO: find out if we need to do more here to
2877 * cover scatter/gather case. 2885 * cover scatter/gather case.
2878 */ 2886 */
2879 qc->nbytes = scsi_bufflen(scmd) + scmd->request->extra_len; 2887 ata_qc_set_pc_nbytes(qc);
2880 2888
2881 /* request result TF and be quiet about device error */ 2889 /* request result TF and be quiet about device error */
2882 qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET; 2890 qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET;