diff options
| author | Bartlomiej Zolnierkiewicz <bzolnier@trik.(none)> | 2004-10-22 22:51:08 +0200 |
|---|---|---|
| committer | Bartlomiej Zolnierkiewicz <bzolnier@trik.(none)> | 2004-10-22 22:51:08 +0200 |
| commit | c5f35b911ed0a1e025ee0b0ce9d75d72f9f39b3f (patch) | |
| tree | 9b9eac8715a2129ca06f9dd372bba1ab7942ef12 | |
| parent | 35ebc8b98a7d8c84ee437aa5f16534990a6c7aaf (diff) | |
[ide] use ide_map_sg()
* make Etrax ide.c, icside.c and ide-dma.c use ide_map_sg()
* use one sg for REQ_DRIVE_TASKFILE requests in ide-dma.c
(no reason for 128 sectors per sg limit)
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
| -rw-r--r-- | arch/cris/arch-v10/drivers/ide.c | 10 | ||||
| -rw-r--r-- | drivers/ide/arm/icside.c | 29 | ||||
| -rw-r--r-- | drivers/ide/ide-dma.c | 28 |
3 files changed, 15 insertions, 52 deletions
diff --git a/arch/cris/arch-v10/drivers/ide.c b/arch/cris/arch-v10/drivers/ide.c index 473e4d133202..cd97e6f9071c 100644 --- a/arch/cris/arch-v10/drivers/ide.c +++ b/arch/cris/arch-v10/drivers/ide.c @@ -656,15 +656,9 @@ static int e100_ide_build_dmatable (ide_drive_t *drive) ata_tot_size = 0; - if (HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) { - sg_init_one(&sg[0], rq->buffer, rq->nr_sectors * SECTOR_SIZE); - hwif->sg_nents = i = 1; - } - else - { - hwif->sg_nents = i = blk_rq_map_sg(drive->queue, rq, hwif->sg_table); - } + ide_map_sg(drive, rq); + i = hwif->sg_nents; while(i) { /* diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index a24120ef0c6b..ec6c9ae29d56 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -212,33 +212,18 @@ static void icside_build_sglist(ide_drive_t *drive, struct request *rq) ide_hwif_t *hwif = drive->hwif; struct icside_state *state = hwif->hwif_data; struct scatterlist *sg = hwif->sg_table; - int nents; - if (rq->flags & REQ_DRIVE_TASKFILE) { - ide_task_t *args = rq->special; + ide_map_sg(drive, rq); - if (args->command_type == IDE_DRIVE_TASK_RAW_WRITE) - hwif->sg_dma_direction = DMA_TO_DEVICE; - else - hwif->sg_dma_direction = DMA_FROM_DEVICE; - - sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE); - nents = 1; - } else { - nents = blk_rq_map_sg(drive->queue, rq, sg); - - if (rq_data_dir(rq) == READ) - hwif->sg_dma_direction = DMA_FROM_DEVICE; - else - hwif->sg_dma_direction = DMA_TO_DEVICE; - } - - nents = dma_map_sg(state->dev, sg, nents, hwif->sg_dma_direction); + if (rq_data_dir(rq) == READ) + hwif->sg_dma_direction = DMA_FROM_DEVICE; + else + hwif->sg_dma_direction = DMA_TO_DEVICE; - hwif->sg_nents = nents; + hwif->sg_nents = dma_map_sg(state->dev, sg, hwif->sg_nents, + hwif->sg_dma_direction); } - /* * Configure the IOMD to give the appropriate timings for the transfer * mode being requested. We take the advice of the ATA standards, and diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 8157fb812d74..56eb77a61deb 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -207,16 +207,15 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq) { ide_hwif_t *hwif = HWIF(drive); struct scatterlist *sg = hwif->sg_table; - int nents; - nents = blk_rq_map_sg(drive->queue, rq, hwif->sg_table); - + ide_map_sg(drive, rq); + if (rq_data_dir(rq) == READ) hwif->sg_dma_direction = PCI_DMA_FROMDEVICE; else hwif->sg_dma_direction = PCI_DMA_TODEVICE; - return pci_map_sg(hwif->pci_dev, sg, nents, hwif->sg_dma_direction); + return pci_map_sg(hwif->pci_dev, sg, hwif->sg_nents, hwif->sg_dma_direction); } EXPORT_SYMBOL_GPL(ide_build_sglist); @@ -236,33 +235,18 @@ int ide_raw_build_sglist(ide_drive_t *drive, struct request *rq) { ide_hwif_t *hwif = HWIF(drive); struct scatterlist *sg = hwif->sg_table; - int nents = 0; ide_task_t *args = rq->special; - u8 *virt_addr = rq->buffer; - int sector_count = rq->nr_sectors; if (args->command_type == IDE_DRIVE_TASK_RAW_WRITE) hwif->sg_dma_direction = PCI_DMA_TODEVICE; else hwif->sg_dma_direction = PCI_DMA_FROMDEVICE; -#if 1 - if (sector_count > 256) - BUG(); + BUG_ON(rq->nr_sectors > 256); - if (sector_count > 128) { -#else - while (sector_count > 128) { -#endif - sg_init_one(&sg[nents], virt_addr, 128 * SECTOR_SIZE); - nents++; - virt_addr = virt_addr + (128 * SECTOR_SIZE); - sector_count -= 128; - } - sg_init_one(&sg[nents], virt_addr, sector_count * SECTOR_SIZE); - nents++; + ide_map_sg(drive, rq); - return pci_map_sg(hwif->pci_dev, sg, nents, hwif->sg_dma_direction); + return pci_map_sg(hwif->pci_dev, sg, hwif->sg_nents, hwif->sg_dma_direction); } EXPORT_SYMBOL_GPL(ide_raw_build_sglist); |
