diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:46 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:46 -0400 |
commit | 2298169418f43ba5e0919762a4bab95a1227872a (patch) | |
tree | 67cf3133c7bae747ad957c68a650534105a7d8e7 /drivers/ide/ide-dma.c | |
parent | 130e886708d6e11f3d54e5d27c266578de56f343 (diff) |
ide: pass command to ide_map_sg()
* Set IDE_TFLAG_WRITE flag and ->rq also for ATA_CMD_PACKET
commands.
* Pass command to ->dma_setup method and update all its
implementations accordingly.
* Pass command instead of request to ide_build_sglist(),
*_build_dmatable() and ide_map_sg().
While at it:
* Fix scc_dma_setup() documentation + use ATA_DMA_WR define.
* Rename sgiioc4_build_dma_table() to sgiioc4_build_dmatable(),
change return value type to 'int' and drop unused 'ddir'
argument.
* Do some minor cleanups in [tx4939]ide_dma_setup().
There should be no functional changes caused by this patch.
Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-dma.c')
-rw-r--r-- | drivers/ide/ide-dma.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 8f5e32e692f0..ad4edab9b0a9 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -120,7 +120,7 @@ int ide_dma_good_drive(ide_drive_t *drive) | |||
120 | /** | 120 | /** |
121 | * ide_build_sglist - map IDE scatter gather for DMA I/O | 121 | * ide_build_sglist - map IDE scatter gather for DMA I/O |
122 | * @drive: the drive to build the DMA table for | 122 | * @drive: the drive to build the DMA table for |
123 | * @rq: the request holding the sg list | 123 | * @cmd: command |
124 | * | 124 | * |
125 | * Perform the DMA mapping magic necessary to access the source or | 125 | * Perform the DMA mapping magic necessary to access the source or |
126 | * target buffers of a request via DMA. The lower layers of the | 126 | * target buffers of a request via DMA. The lower layers of the |
@@ -128,23 +128,22 @@ int ide_dma_good_drive(ide_drive_t *drive) | |||
128 | * operate in a portable fashion. | 128 | * operate in a portable fashion. |
129 | */ | 129 | */ |
130 | 130 | ||
131 | int ide_build_sglist(ide_drive_t *drive, struct request *rq) | 131 | int ide_build_sglist(ide_drive_t *drive, struct ide_cmd *cmd) |
132 | { | 132 | { |
133 | ide_hwif_t *hwif = drive->hwif; | 133 | ide_hwif_t *hwif = drive->hwif; |
134 | struct scatterlist *sg = hwif->sg_table; | 134 | struct scatterlist *sg = hwif->sg_table; |
135 | struct ide_cmd *cmd = &hwif->cmd; | ||
136 | int i; | 135 | int i; |
137 | 136 | ||
138 | ide_map_sg(drive, rq); | 137 | ide_map_sg(drive, cmd); |
139 | 138 | ||
140 | if (rq_data_dir(rq) == READ) | 139 | if (cmd->tf_flags & IDE_TFLAG_WRITE) |
141 | cmd->sg_dma_direction = DMA_FROM_DEVICE; | ||
142 | else | ||
143 | cmd->sg_dma_direction = DMA_TO_DEVICE; | 140 | cmd->sg_dma_direction = DMA_TO_DEVICE; |
141 | else | ||
142 | cmd->sg_dma_direction = DMA_FROM_DEVICE; | ||
144 | 143 | ||
145 | i = dma_map_sg(hwif->dev, sg, cmd->sg_nents, cmd->sg_dma_direction); | 144 | i = dma_map_sg(hwif->dev, sg, cmd->sg_nents, cmd->sg_dma_direction); |
146 | if (i == 0) | 145 | if (i == 0) |
147 | ide_map_sg(drive, rq); | 146 | ide_map_sg(drive, cmd); |
148 | else { | 147 | else { |
149 | cmd->orig_sg_nents = cmd->sg_nents; | 148 | cmd->orig_sg_nents = cmd->sg_nents; |
150 | cmd->sg_nents = i; | 149 | cmd->sg_nents = i; |