aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r--drivers/ata/libata-scsi.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 0562b0a49f3b..8f0e8f2bc628 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -862,9 +862,10 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
862 struct request_queue *q = sdev->request_queue; 862 struct request_queue *q = sdev->request_queue;
863 void *buf; 863 void *buf;
864 864
865 /* set the min alignment */ 865 /* set the min alignment and padding */
866 blk_queue_update_dma_alignment(sdev->request_queue, 866 blk_queue_update_dma_alignment(sdev->request_queue,
867 ATA_DMA_PAD_SZ - 1); 867 ATA_DMA_PAD_SZ - 1);
868 blk_queue_dma_pad(sdev->request_queue, ATA_DMA_PAD_SZ - 1);
868 869
869 /* configure draining */ 870 /* configure draining */
870 buf = kmalloc(ATAPI_MAX_DRAIN, q->bounce_gfp | GFP_KERNEL); 871 buf = kmalloc(ATAPI_MAX_DRAIN, q->bounce_gfp | GFP_KERNEL);
@@ -1694,12 +1695,17 @@ void ata_scsi_rbuf_fill(struct ata_scsi_args *args,
1694 u8 *rbuf; 1695 u8 *rbuf;
1695 unsigned int buflen, rc; 1696 unsigned int buflen, rc;
1696 struct scsi_cmnd *cmd = args->cmd; 1697 struct scsi_cmnd *cmd = args->cmd;
1698 unsigned long flags;
1699
1700 local_irq_save(flags);
1697 1701
1698 buflen = ata_scsi_rbuf_get(cmd, &rbuf); 1702 buflen = ata_scsi_rbuf_get(cmd, &rbuf);
1699 memset(rbuf, 0, buflen); 1703 memset(rbuf, 0, buflen);
1700 rc = actor(args, rbuf, buflen); 1704 rc = actor(args, rbuf, buflen);
1701 ata_scsi_rbuf_put(cmd, rbuf); 1705 ata_scsi_rbuf_put(cmd, rbuf);
1702 1706
1707 local_irq_restore(flags);
1708
1703 if (rc == 0) 1709 if (rc == 0)
1704 cmd->result = SAM_STAT_GOOD; 1710 cmd->result = SAM_STAT_GOOD;
1705 args->done(cmd); 1711 args->done(cmd);
@@ -2473,6 +2479,9 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc)
2473 if ((scsicmd[0] == INQUIRY) && ((scsicmd[1] & 0x03) == 0)) { 2479 if ((scsicmd[0] == INQUIRY) && ((scsicmd[1] & 0x03) == 0)) {
2474 u8 *buf = NULL; 2480 u8 *buf = NULL;
2475 unsigned int buflen; 2481 unsigned int buflen;
2482 unsigned long flags;
2483
2484 local_irq_save(flags);
2476 2485
2477 buflen = ata_scsi_rbuf_get(cmd, &buf); 2486 buflen = ata_scsi_rbuf_get(cmd, &buf);
2478 2487
@@ -2490,6 +2499,8 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc)
2490 } 2499 }
2491 2500
2492 ata_scsi_rbuf_put(cmd, buf); 2501 ata_scsi_rbuf_put(cmd, buf);
2502
2503 local_irq_restore(flags);
2493 } 2504 }
2494 2505
2495 cmd->result = SAM_STAT_GOOD; 2506 cmd->result = SAM_STAT_GOOD;
@@ -2528,7 +2539,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2528 } 2539 }
2529 2540
2530 qc->tf.command = ATA_CMD_PACKET; 2541 qc->tf.command = ATA_CMD_PACKET;
2531 qc->nbytes = scsi_bufflen(scmd); 2542 qc->nbytes = scsi_bufflen(scmd) + scmd->request->extra_len;
2532 2543
2533 /* check whether ATAPI DMA is safe */ 2544 /* check whether ATAPI DMA is safe */
2534 if (!using_pio && ata_check_atapi_dma(qc)) 2545 if (!using_pio && ata_check_atapi_dma(qc))
@@ -2539,7 +2550,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2539 * want to set it properly, and for DMA where it is 2550 * want to set it properly, and for DMA where it is
2540 * effectively meaningless. 2551 * effectively meaningless.
2541 */ 2552 */
2542 nbytes = min(scmd->request->raw_data_len, (unsigned int)63 * 1024); 2553 nbytes = min(scmd->request->data_len, (unsigned int)63 * 1024);
2543 2554
2544 /* Most ATAPI devices which honor transfer chunk size don't 2555 /* Most ATAPI devices which honor transfer chunk size don't
2545 * behave according to the spec when odd chunk size which 2556 * behave according to the spec when odd chunk size which
@@ -2865,7 +2876,7 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
2865 * TODO: find out if we need to do more here to 2876 * TODO: find out if we need to do more here to
2866 * cover scatter/gather case. 2877 * cover scatter/gather case.
2867 */ 2878 */
2868 qc->nbytes = scsi_bufflen(scmd); 2879 qc->nbytes = scsi_bufflen(scmd) + scmd->request->extra_len;
2869 2880
2870 /* request result TF and be quiet about device error */ 2881 /* request result TF and be quiet about device error */
2871 qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET; 2882 qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET;