diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2016-03-02 02:49:28 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2016-03-02 02:49:28 +0100 |
commit | 3c58980b3ca558096340e51c215897e8614ba00a (patch) | |
tree | 54d5f8cf48c7331586ed110a548b33b161f8093e /dma | |
parent | adc657ebcd01ecc2cc5f110453ef00dffde2d5c0 (diff) | |
parent | a5da7db50d02878b6d9c844b18d0d3f8ccf6c62b (diff) | |
download | pcitool-3c58980b3ca558096340e51c215897e8614ba00a.tar.gz pcitool-3c58980b3ca558096340e51c215897e8614ba00a.tar.bz2 pcitool-3c58980b3ca558096340e51c215897e8614ba00a.tar.xz pcitool-3c58980b3ca558096340e51c215897e8614ba00a.zip |
Distinguish between hardware and bus addresses in pcilib and fix cli reading from DMA when very low DMA timeout is set
Diffstat (limited to 'dma')
-rw-r--r-- | dma/ipe.c | 13 | ||||
-rw-r--r-- | dma/nwl_engine.c | 4 | ||||
-rw-r--r-- | dma/nwl_engine_buffers.h | 6 |
3 files changed, 12 insertions, 11 deletions
@@ -566,7 +566,8 @@ int dma_ipe_stream_read(pcilib_dma_context_t *vctx, pcilib_dma_engine_t dma, uin if (ctx->version < 3) { if (ctx->mode64) last_written_addr_ptr = desc_va + 3 * sizeof(uint32_t); else last_written_addr_ptr = desc_va + 4 * sizeof(uint32_t); - empty_detected_ptr = last_written_addr_ptr - 2; + empty_detected_ptr = NULL; // Not properly supported +// empty_detected_ptr = last_written_addr_ptr - 2; } else { last_written_addr_ptr = desc_va + 2 * sizeof(uint32_t); empty_detected_ptr = desc_va + sizeof(uint32_t); @@ -589,10 +590,10 @@ int dma_ipe_stream_read(pcilib_dma_context_t *vctx, pcilib_dma_engine_t dma, uin do { switch (ret&PCILIB_STREAMING_TIMEOUT_MASK) { - case PCILIB_STREAMING_CONTINUE: + case PCILIB_STREAMING_CONTINUE: // Hardware indicates that there is no more data pending and we can safely stop if there is no data in the kernel buffers already #ifdef IPEDMA_SUPPORT_EMPTY_DETECTED - if (*empty_detected_ptr) + if ((empty_detected_ptr)&&(*empty_detected_ptr)) wait = 0; else #endif /* IPEDMA_SUPPORT_EMPTY_DETECTED */ @@ -618,7 +619,7 @@ int dma_ipe_stream_read(pcilib_dma_context_t *vctx, pcilib_dma_engine_t dma, uin } #ifdef IPEDMA_SUPPORT_EMPTY_DETECTED - if ((ret != PCILIB_STREAMING_REQ_PACKET)&&(*empty_detected_ptr)) break; + if ((ret != PCILIB_STREAMING_REQ_PACKET)&&(empty_detected_ptr)&&(*empty_detected_ptr)) break; #endif /* IPEDMA_SUPPORT_EMPTY_DETECTED */ gettimeofday(&cur, NULL); } @@ -627,7 +628,7 @@ int dma_ipe_stream_read(pcilib_dma_context_t *vctx, pcilib_dma_engine_t dma, uin if ((ctx->last_read_addr == DEREF(last_written_addr_ptr))||(DEREF(last_written_addr_ptr) == 0)) { #ifdef IPEDMA_SUPPORT_EMPTY_DETECTED # ifdef PCILIB_DEBUG_DMA - if ((wait)&&(DEREF(last_written_addr_ptr))&&(!*empty_detected_ptr)) + if ((wait)&&(empty_detected_ptr)&&(DEREF(last_written_addr_ptr))&&(!*empty_detected_ptr)) pcilib_debug(DMA, "The empty_detected flag is not set, but no data arrived within %lu us", wait); # endif /* PCILIB_DEBUG_DMA */ #endif /* IPEDMA_SUPPORT_EMPTY_DETECTED */ @@ -644,7 +645,7 @@ int dma_ipe_stream_read(pcilib_dma_context_t *vctx, pcilib_dma_engine_t dma, uin ); #ifdef IPEDMA_DETECT_PACKETS - if ((*empty_detected_ptr)&&(pcilib_kmem_get_block_ba(ctx->dmactx.pcilib, ctx->pages, cur_read) == DEREF(last_written_addr_ptr))) packet_flags = PCILIB_DMA_FLAG_EOP; + if ((empty_detected_ptr)&&(*empty_detected_ptr)&&(pcilib_kmem_get_block_ba(ctx->dmactx.pcilib, ctx->pages, cur_read) == DEREF(last_written_addr_ptr))) packet_flags = PCILIB_DMA_FLAG_EOP; else packet_flags = 0; #endif /* IPEDMA_DETECT_PACKETS */ diff --git a/dma/nwl_engine.c b/dma/nwl_engine.c index c3dea49..b098943 100644 --- a/dma/nwl_engine.c +++ b/dma/nwl_engine.c @@ -124,7 +124,7 @@ int dma_nwl_start_engine(nwl_dma_t *ctx, pcilib_dma_engine_t dma) { dma_nwl_acknowledge_irq((pcilib_dma_context_t*)ctx, PCILIB_DMA_IRQ, dma); - ring_pa = pcilib_kmem_get_pa(ctx->dmactx.pcilib, ectx->ring); + ring_pa = pcilib_kmem_get_ba(ctx->dmactx.pcilib, ectx->ring); nwl_write_register(ring_pa, ctx, ectx->base_addr, REG_DMA_ENG_NEXT_BD); nwl_write_register(ring_pa, ctx, ectx->base_addr, REG_SW_NEXT_BD); @@ -188,7 +188,7 @@ int dma_nwl_stop_engine(nwl_dma_t *ctx, pcilib_dma_engine_t dma) { } while ((val & (DMA_ENG_RUNNING))&&(((cur.tv_sec - start.tv_sec)*1000000 + (cur.tv_usec - start.tv_usec)) < PCILIB_NWL_REGISTER_TIMEOUT)); if (ectx->ring) { - ring_pa = pcilib_kmem_get_pa(ctx->dmactx.pcilib, ectx->ring); + ring_pa = pcilib_kmem_get_ba(ctx->dmactx.pcilib, ectx->ring); nwl_write_register(ring_pa, ctx, ectx->base_addr, REG_DMA_ENG_NEXT_BD); nwl_write_register(ring_pa, ctx, ectx->base_addr, REG_SW_NEXT_BD); } diff --git a/dma/nwl_engine_buffers.h b/dma/nwl_engine_buffers.h index ef1c74f..0cc5343 100644 --- a/dma/nwl_engine_buffers.h +++ b/dma/nwl_engine_buffers.h @@ -121,7 +121,7 @@ static int dma_nwl_allocate_engine_buffers(nwl_dma_t *ctx, pcilib_nwl_engine_con unsigned char *data = (unsigned char*)pcilib_kmem_get_ua(ctx->dmactx.pcilib, ring); - uint32_t ring_pa = pcilib_kmem_get_pa(ctx->dmactx.pcilib, ring); + uint32_t ring_pa = pcilib_kmem_get_ba(ctx->dmactx.pcilib, ring); if (preserve) { if (ectx->desc->direction == PCILIB_DMA_FROM_DEVICE) err = dma_nwl_compute_read_c2s_pointers(ctx, ectx, data, ring_pa); @@ -251,7 +251,7 @@ static int dma_nwl_push_buffer(nwl_dma_t *ctx, pcilib_nwl_engine_context_t *ectx uint32_t val; unsigned char *ring = pcilib_kmem_get_ua(ctx->dmactx.pcilib, ectx->ring); - uint32_t ring_pa = pcilib_kmem_get_pa(ctx->dmactx.pcilib, ectx->ring); + uint32_t ring_pa = pcilib_kmem_get_ba(ctx->dmactx.pcilib, ectx->ring); ring += ectx->head * PCILIB_NWL_DMA_DESCRIPTOR_SIZE; @@ -338,7 +338,7 @@ static int dma_nwl_return_buffer(nwl_dma_t *ctx, pcilib_nwl_engine_context_t *ec uint32_t val; unsigned char *ring = pcilib_kmem_get_ua(ctx->dmactx.pcilib, ectx->ring); - uint32_t ring_pa = pcilib_kmem_get_pa(ctx->dmactx.pcilib, ectx->ring); + uint32_t ring_pa = pcilib_kmem_get_ba(ctx->dmactx.pcilib, ectx->ring); size_t bufsz = pcilib_kmem_get_block_size(ctx->dmactx.pcilib, ectx->pages, ectx->tail); ring += ectx->tail * PCILIB_NWL_DMA_DESCRIPTOR_SIZE; |