diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2008-07-16 14:33:35 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-16 14:33:35 -0400 |
commit | e5318b531b008c79d2a0c0df06a7b8628da38e2f (patch) | |
tree | deaeb64e1962a35abef76a0e5e93fff8cba93fe5 /drivers/ide/ide-cd.c | |
parent | 0b6abc17700a7843b165c677da0ac94522f83083 (diff) |
ide: use the dma safe check for REQ_TYPE_ATA_PC
This uses the dma safe check for REQ_TYPE_ATA_PC. The dma safe check
is used for only sg requests but it should be used for other non fs
commands.
This uses blk_queue_update_dma_pad to make the intention clear though
ide don't use the blk APIs so it doesn't change anything.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Borislav Petkov <petkovbb@gmail.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Tejun Heo <htejun@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-cd.c')
-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; |