diff options
-rw-r--r-- | drivers/ata/libata-scsi.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index df2e05738f3b..ea53e6a570b4 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -2305,8 +2305,8 @@ static void atapi_request_sense(struct ata_queued_cmd *qc) | |||
2305 | qc->tf.feature |= ATAPI_PKT_DMA; | 2305 | qc->tf.feature |= ATAPI_PKT_DMA; |
2306 | } else { | 2306 | } else { |
2307 | qc->tf.protocol = ATA_PROT_ATAPI; | 2307 | qc->tf.protocol = ATA_PROT_ATAPI; |
2308 | qc->tf.lbam = (8 * 1024) & 0xff; | 2308 | qc->tf.lbam = SCSI_SENSE_BUFFERSIZE; |
2309 | qc->tf.lbah = (8 * 1024) >> 8; | 2309 | qc->tf.lbah = 0; |
2310 | } | 2310 | } |
2311 | qc->nbytes = SCSI_SENSE_BUFFERSIZE; | 2311 | qc->nbytes = SCSI_SENSE_BUFFERSIZE; |
2312 | 2312 | ||
@@ -2415,6 +2415,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) | |||
2415 | struct ata_device *dev = qc->dev; | 2415 | struct ata_device *dev = qc->dev; |
2416 | int using_pio = (dev->flags & ATA_DFLAG_PIO); | 2416 | int using_pio = (dev->flags & ATA_DFLAG_PIO); |
2417 | int nodata = (scmd->sc_data_direction == DMA_NONE); | 2417 | int nodata = (scmd->sc_data_direction == DMA_NONE); |
2418 | unsigned int nbytes; | ||
2418 | 2419 | ||
2419 | memset(qc->cdb, 0, dev->cdb_len); | 2420 | memset(qc->cdb, 0, dev->cdb_len); |
2420 | memcpy(qc->cdb, scmd->cmnd, scmd->cmd_len); | 2421 | memcpy(qc->cdb, scmd->cmnd, scmd->cmd_len); |
@@ -2434,14 +2435,20 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) | |||
2434 | if (!using_pio && ata_check_atapi_dma(qc)) | 2435 | if (!using_pio && ata_check_atapi_dma(qc)) |
2435 | using_pio = 1; | 2436 | using_pio = 1; |
2436 | 2437 | ||
2438 | /* Some controller variants snoop this value for Packet transfers | ||
2439 | to do state machine and FIFO management. Thus we want to set it | ||
2440 | properly, and for DMA where it is effectively meaningless */ | ||
2441 | nbytes = min(qc->nbytes, (unsigned int)63 * 1024); | ||
2442 | |||
2443 | qc->tf.lbam = (nbytes & 0xFF); | ||
2444 | qc->tf.lbah = (nbytes >> 8); | ||
2445 | |||
2437 | if (using_pio || nodata) { | 2446 | if (using_pio || nodata) { |
2438 | /* no data, or PIO data xfer */ | 2447 | /* no data, or PIO data xfer */ |
2439 | if (nodata) | 2448 | if (nodata) |
2440 | qc->tf.protocol = ATA_PROT_ATAPI_NODATA; | 2449 | qc->tf.protocol = ATA_PROT_ATAPI_NODATA; |
2441 | else | 2450 | else |
2442 | qc->tf.protocol = ATA_PROT_ATAPI; | 2451 | qc->tf.protocol = ATA_PROT_ATAPI; |
2443 | qc->tf.lbam = (8 * 1024) & 0xff; | ||
2444 | qc->tf.lbah = (8 * 1024) >> 8; | ||
2445 | } else { | 2452 | } else { |
2446 | /* DMA data xfer */ | 2453 | /* DMA data xfer */ |
2447 | qc->tf.protocol = ATA_PROT_ATAPI_DMA; | 2454 | qc->tf.protocol = ATA_PROT_ATAPI_DMA; |
@@ -2452,6 +2459,9 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) | |||
2452 | qc->tf.feature |= ATAPI_DMADIR; | 2459 | qc->tf.feature |= ATAPI_DMADIR; |
2453 | } | 2460 | } |
2454 | 2461 | ||
2462 | |||
2463 | /* FIXME: We need to translate 0x05 READ_BLOCK_LIMITS to a MODE_SENSE | ||
2464 | as ATAPI tape drives don't get this right otherwise */ | ||
2455 | return 0; | 2465 | return 0; |
2456 | } | 2466 | } |
2457 | 2467 | ||