aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/mv_xor.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2008-07-04 03:13:40 -0400
committerDan Williams <dan.j.williams@intel.com>2008-07-08 14:59:12 -0400
commite1d181efb14a93cf263d6c588a5395518edf3294 (patch)
tree1792d1faa7e344401789bbcfad8102d0d93036e2 /drivers/dma/mv_xor.c
parent848c536a37b8db4e461f14ca15fe29850151c822 (diff)
dmaengine: add DMA_COMPL_SKIP_{SRC,DEST}_UNMAP flags to control dma unmap
In some cases client code may need the dma-driver to skip the unmap of source and/or destination buffers. Setting these flags indicates to the driver to skip the unmap step. In this regard async_xor is currently broken in that it allows the destination buffer to be unmapped while an operation is still in progress, i.e. when the number of sources exceeds the hardware channel's maximum (fixed in a subsequent patch). Acked-by: Saeed Bishara <saeed@marvell.com> Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com> Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/mv_xor.c')
-rw-r--r--drivers/dma/mv_xor.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 8239cfdbc2e6..a4e4494663bf 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -308,13 +308,23 @@ mv_xor_run_tx_complete_actions(struct mv_xor_desc_slot *desc,
308 struct device *dev = 308 struct device *dev =
309 &mv_chan->device->pdev->dev; 309 &mv_chan->device->pdev->dev;
310 u32 len = unmap->unmap_len; 310 u32 len = unmap->unmap_len;
311 u32 src_cnt = unmap->unmap_src_cnt; 311 enum dma_ctrl_flags flags = desc->async_tx.flags;
312 dma_addr_t addr = mv_desc_get_dest_addr(unmap); 312 u32 src_cnt;
313 dma_addr_t addr;
313 314
314 dma_unmap_page(dev, addr, len, DMA_FROM_DEVICE); 315 if (!(flags & DMA_COMPL_SKIP_DEST_UNMAP)) {
315 while (src_cnt--) { 316 addr = mv_desc_get_dest_addr(unmap);
316 addr = mv_desc_get_src_addr(unmap, src_cnt); 317 dma_unmap_page(dev, addr, len, DMA_FROM_DEVICE);
317 dma_unmap_page(dev, addr, len, DMA_TO_DEVICE); 318 }
319
320 if (!(flags & DMA_COMPL_SKIP_SRC_UNMAP)) {
321 src_cnt = unmap->unmap_src_cnt;
322 while (src_cnt--) {
323 addr = mv_desc_get_src_addr(unmap,
324 src_cnt);
325 dma_unmap_page(dev, addr, len,
326 DMA_TO_DEVICE);
327 }
318 } 328 }
319 desc->group_head = NULL; 329 desc->group_head = NULL;
320 } 330 }