diff options
-rw-r--r-- | drivers/ide/ide-cd.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index d6667c36568c..e12d60278210 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -1191,12 +1191,17 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | |||
1191 | info->dma = 0; | 1191 | info->dma = 0; |
1192 | 1192 | ||
1193 | /* sg request */ | 1193 | /* sg request */ |
1194 | if (rq->bio) { | 1194 | if (rq->bio || ((rq->cmd_type == REQ_TYPE_ATA_PC) && rq->data_len)) { |
1195 | int mask = drive->queue->dma_alignment; | 1195 | struct request_queue *q = drive->queue; |
1196 | unsigned long addr = | 1196 | unsigned int alignment; |
1197 | (unsigned long)page_address(bio_page(rq->bio)); | 1197 | unsigned long addr; |
1198 | unsigned long stack_mask = ~(THREAD_SIZE - 1); | 1198 | unsigned long stack_mask = ~(THREAD_SIZE - 1); |
1199 | 1199 | ||
1200 | if (rq->bio) | ||
1201 | addr = (unsigned long)bio_data(rq->bio); | ||
1202 | else | ||
1203 | addr = (unsigned long)rq->data; | ||
1204 | |||
1200 | info->dma = drive->using_dma; | 1205 | info->dma = drive->using_dma; |
1201 | 1206 | ||
1202 | /* | 1207 | /* |
@@ -1205,7 +1210,8 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | |||
1205 | * NOTE! The "len" and "addr" checks should possibly have | 1210 | * NOTE! The "len" and "addr" checks should possibly have |
1206 | * separate masks. | 1211 | * separate masks. |
1207 | */ | 1212 | */ |
1208 | if ((rq->data_len & 15) || (addr & mask)) | 1213 | alignment = queue_dma_alignment(q) | q->dma_pad_mask; |
1214 | if (addr & alignment || rq->data_len & alignment) | ||
1209 | info->dma = 0; | 1215 | info->dma = 0; |
1210 | 1216 | ||
1211 | if (!((addr & stack_mask) ^ | 1217 | if (!((addr & stack_mask) ^ |
@@ -1877,6 +1883,7 @@ static int ide_cdrom_setup(ide_drive_t *drive) | |||
1877 | 1883 | ||
1878 | blk_queue_prep_rq(drive->queue, ide_cdrom_prep_fn); | 1884 | blk_queue_prep_rq(drive->queue, ide_cdrom_prep_fn); |
1879 | blk_queue_dma_alignment(drive->queue, 31); | 1885 | blk_queue_dma_alignment(drive->queue, 31); |
1886 | blk_queue_update_dma_pad(drive->queue, 15); | ||
1880 | drive->queue->unplug_delay = (1 * HZ) / 1000; | 1887 | drive->queue->unplug_delay = (1 * HZ) / 1000; |
1881 | if (!drive->queue->unplug_delay) | 1888 | if (!drive->queue->unplug_delay) |
1882 | drive->queue->unplug_delay = 1; | 1889 | drive->queue->unplug_delay = 1; |