summaryrefslogtreecommitdiffstats
path: root/dma/nwl_buffers.h
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2011-07-16 06:18:05 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2011-07-16 06:18:05 +0200
commit7ac0539951ff0eba200e64b850b5181a82915c86 (patch)
tree6d41563807fcadcbf03eb756d8d7d191d3d4446c /dma/nwl_buffers.h
parentb3e8d49f41b18d17b40bd8f6926d7db54981e89e (diff)
downloadpcitool-7ac0539951ff0eba200e64b850b5181a82915c86.tar.gz
pcitool-7ac0539951ff0eba200e64b850b5181a82915c86.tar.bz2
pcitool-7ac0539951ff0eba200e64b850b5181a82915c86.tar.xz
pcitool-7ac0539951ff0eba200e64b850b5181a82915c86.zip
Implement DMA access synchronization in the driver
Diffstat (limited to 'dma/nwl_buffers.h')
-rw-r--r--dma/nwl_buffers.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/dma/nwl_buffers.h b/dma/nwl_buffers.h
index e0df2d0..a38af8c 100644
--- a/dma/nwl_buffers.h
+++ b/dma/nwl_buffers.h
@@ -22,6 +22,7 @@ int dma_nwl_allocate_engine_buffers(nwl_dma_t *ctx, pcilib_nwl_engine_descriptio
uint32_t buf_sz;
uint64_t buf_pa;
pcilib_kmem_reuse_t reuse_ring, reuse_pages;
+ pcilib_kmem_flags_t flags;
char *base = info->base_addr;
@@ -29,8 +30,9 @@ int dma_nwl_allocate_engine_buffers(nwl_dma_t *ctx, pcilib_nwl_engine_descriptio
// Or bidirectional specified by 0x0|addr, or read 0x0|addr and write 0x80|addr
sub_use = info->desc.addr|(info->desc.direction == PCILIB_DMA_TO_DEVICE)?0x80:0x00;
- pcilib_kmem_handle_t *ring = pcilib_alloc_kernel_memory(ctx->pcilib, PCILIB_KMEM_TYPE_CONSISTENT, 1, PCILIB_NWL_DMA_PAGES * PCILIB_NWL_DMA_DESCRIPTOR_SIZE, PCILIB_NWL_ALIGNMENT, PCILIB_KMEM_USE(PCILIB_KMEM_USE_DMA_RING, sub_use), PCILIB_KMEM_FLAG_REUSE);
- pcilib_kmem_handle_t *pages = pcilib_alloc_kernel_memory(ctx->pcilib, PCILIB_KMEM_TYPE_PAGE, PCILIB_NWL_DMA_PAGES, 0, 0, PCILIB_KMEM_USE(PCILIB_KMEM_USE_DMA_PAGES, sub_use), PCILIB_KMEM_FLAG_REUSE);
+ flags = PCILIB_KMEM_FLAG_REUSE|PCILIB_KMEM_FLAG_EXCLUSIVE|PCILIB_KMEM_FLAG_HARDWARE|info->preserve?PCILIB_KMEM_FLAG_PRESERVE:0;
+ pcilib_kmem_handle_t *ring = pcilib_alloc_kernel_memory(ctx->pcilib, PCILIB_KMEM_TYPE_CONSISTENT, 1, PCILIB_NWL_DMA_PAGES * PCILIB_NWL_DMA_DESCRIPTOR_SIZE, PCILIB_NWL_ALIGNMENT, PCILIB_KMEM_USE(PCILIB_KMEM_USE_DMA_RING, sub_use), flags);
+ pcilib_kmem_handle_t *pages = pcilib_alloc_kernel_memory(ctx->pcilib, PCILIB_KMEM_TYPE_PAGE, PCILIB_NWL_DMA_PAGES, 0, 0, PCILIB_KMEM_USE(PCILIB_KMEM_USE_DMA_PAGES, sub_use), flags);
if ((ring)&&(pages)) err = dma_nwl_sync_buffers(ctx, info, pages);
else err = PCILIB_ERROR_FAILED;
@@ -41,6 +43,7 @@ int dma_nwl_allocate_engine_buffers(nwl_dma_t *ctx, pcilib_nwl_engine_descriptio
return err;
}
+
/*
reuse_ring = pcilib_kmem_is_reused(ctx->pcilib, ring);
reuse_pages = pcilib_kmem_is_reused(ctx->pcilib, pages);