diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-10-23 02:43:20 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-10-23 02:43:20 +0200 |
commit | 8af9de82916ff76129d01ede66fc4406818c525c (patch) | |
tree | 3327adb667efa9426b630ba841a16a598c0f9e0c /dma/nwl_engine_buffers.h | |
parent | 24f29cbd62e9b2f30aba8f2357084baf6b70fa17 (diff) | |
download | pcitool-8af9de82916ff76129d01ede66fc4406818c525c.tar.gz pcitool-8af9de82916ff76129d01ede66fc4406818c525c.tar.bz2 pcitool-8af9de82916ff76129d01ede66fc4406818c525c.tar.xz pcitool-8af9de82916ff76129d01ede66fc4406818c525c.zip |
Properly perform synchronization of DMA buffers
Diffstat (limited to 'dma/nwl_engine_buffers.h')
-rw-r--r-- | dma/nwl_engine_buffers.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/dma/nwl_engine_buffers.h b/dma/nwl_engine_buffers.h index dbf5aff..517e690 100644 --- a/dma/nwl_engine_buffers.h +++ b/dma/nwl_engine_buffers.h @@ -95,20 +95,22 @@ static int dma_nwl_allocate_engine_buffers(nwl_dma_t *ctx, pcilib_nwl_engine_des uint64_t buf_pa; pcilib_kmem_reuse_state_t reuse_ring, reuse_pages; pcilib_kmem_flags_t flags; + pcilib_kmem_type_t type; char *base = info->base_addr; if (info->pages) return 0; // Or bidirectional specified by 0x0|addr, or read 0x0|addr and write 0x80|addr + type = (info->desc.direction == PCILIB_DMA_TO_DEVICE)?PCILIB_KMEM_TYPE_DMA_S2C_PAGE:PCILIB_KMEM_TYPE_DMA_C2S_PAGE; sub_use = info->desc.addr|((info->desc.direction == PCILIB_DMA_TO_DEVICE)?0x80:0x00); flags = PCILIB_KMEM_FLAG_REUSE|PCILIB_KMEM_FLAG_EXCLUSIVE|PCILIB_KMEM_FLAG_HARDWARE|(info->preserve?PCILIB_KMEM_FLAG_PERSISTENT: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); + pcilib_kmem_handle_t *pages = pcilib_alloc_kernel_memory(ctx->pcilib, type, 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; +// if ((ring)&&(pages)) err = dma_nwl_sync_buffers(ctx, info, pages); +// else err = PCILIB_ERROR_FAILED; if (err) { if (pages) pcilib_free_kernel_memory(ctx->pcilib, pages, 0); |