aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-06-26 13:47:35 -0400
committerJeff Garzik <jeff@garzik.org>2007-06-27 02:50:08 -0400
commite00f1ff3c8977eff07d0214d2f3478ac947bda0f (patch)
tree1209cd341d4be66b319d2779ffb91d0b5988e42f /drivers/ata
parent914616a3c2a54504f3b0eda0b67fcd32226b3e83 (diff)
libata: call ata_check_atapi_dma() with qc better prepared
In atapi_xlat(), prepare qc better before calling ata_check_atapi_dma() such that ata_check_atapi_dma() can use info from qc. While at it, reformat weird looking if/else block in the function. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-scsi.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index c228df298bd8..4ddf00c8c5f5 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2384,11 +2384,6 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2384 int using_pio = (dev->flags & ATA_DFLAG_PIO); 2384 int using_pio = (dev->flags & ATA_DFLAG_PIO);
2385 int nodata = (scmd->sc_data_direction == DMA_NONE); 2385 int nodata = (scmd->sc_data_direction == DMA_NONE);
2386 2386
2387 if (!using_pio)
2388 /* Check whether ATAPI DMA is safe */
2389 if (ata_check_atapi_dma(qc))
2390 using_pio = 1;
2391
2392 memset(qc->cdb, 0, dev->cdb_len); 2387 memset(qc->cdb, 0, dev->cdb_len);
2393 memcpy(qc->cdb, scmd->cmnd, scmd->cmd_len); 2388 memcpy(qc->cdb, scmd->cmnd, scmd->cmd_len);
2394 2389
@@ -2401,19 +2396,22 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2401 } 2396 }
2402 2397
2403 qc->tf.command = ATA_CMD_PACKET; 2398 qc->tf.command = ATA_CMD_PACKET;
2399 qc->nbytes = scmd->request_bufflen;
2400
2401 /* check whether ATAPI DMA is safe */
2402 if (!using_pio && ata_check_atapi_dma(qc))
2403 using_pio = 1;
2404 2404
2405 /* no data, or PIO data xfer */
2406 if (using_pio || nodata) { 2405 if (using_pio || nodata) {
2406 /* no data, or PIO data xfer */
2407 if (nodata) 2407 if (nodata)
2408 qc->tf.protocol = ATA_PROT_ATAPI_NODATA; 2408 qc->tf.protocol = ATA_PROT_ATAPI_NODATA;
2409 else 2409 else
2410 qc->tf.protocol = ATA_PROT_ATAPI; 2410 qc->tf.protocol = ATA_PROT_ATAPI;
2411 qc->tf.lbam = (8 * 1024) & 0xff; 2411 qc->tf.lbam = (8 * 1024) & 0xff;
2412 qc->tf.lbah = (8 * 1024) >> 8; 2412 qc->tf.lbah = (8 * 1024) >> 8;
2413 } 2413 } else {
2414 2414 /* DMA data xfer */
2415 /* DMA data xfer */
2416 else {
2417 qc->tf.protocol = ATA_PROT_ATAPI_DMA; 2415 qc->tf.protocol = ATA_PROT_ATAPI_DMA;
2418 qc->tf.feature |= ATAPI_PKT_DMA; 2416 qc->tf.feature |= ATAPI_PKT_DMA;
2419 2417
@@ -2422,8 +2420,6 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2422 qc->tf.feature |= ATAPI_DMADIR; 2420 qc->tf.feature |= ATAPI_DMADIR;
2423 } 2421 }
2424 2422
2425 qc->nbytes = scmd->request_bufflen;
2426
2427 return 0; 2423 return 0;
2428} 2424}
2429 2425