summaryrefslogtreecommitdiffstats
path: root/dma
diff options
context:
space:
mode:
Diffstat (limited to 'dma')
-rw-r--r--dma/nwl_engine.c4
-rw-r--r--dma/nwl_engine_buffers.h8
2 files changed, 8 insertions, 4 deletions
diff --git a/dma/nwl_engine.c b/dma/nwl_engine.c
index 277ad23..0b5924d 100644
--- a/dma/nwl_engine.c
+++ b/dma/nwl_engine.c
@@ -289,10 +289,12 @@ int dma_nwl_stream_read(pcilib_dma_context_t *vctx, pcilib_dma_engine_t dma, uin
}
#endif /* NWL_FIX_EOP_FOR_BIG_PACKETS */
- //sync
+ pcilib_sync_kernel_memory(ctx->pcilib, info->pages, PCILIB_KMEM_SYNC_FROMDEVICE);
void *buf = pcilib_kmem_get_block_ua(ctx->pcilib, info->pages, bufnum);
ret = cb(cbattr, eop?PCILIB_DMA_FLAG_EOP:0, bufsize, buf);
+ pcilib_sync_kernel_memory(ctx->pcilib, info->pages, PCILIB_KMEM_SYNC_TODEVICE);
dma_nwl_return_buffer(ctx, info);
+
res += bufsize;
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);