diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2012-10-22 21:07:28 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2012-10-22 21:07:28 +0200 |
commit | 761270f64b565f433233455e093a6a0b0ab6c747 (patch) | |
tree | 359b031a89a83fd1557a9727d27380120b63ec78 | |
parent | b4f070ac599d009b32a1bee2b2402aed6a9a6b26 (diff) | |
download | pcitool-761270f64b565f433233455e093a6a0b0ab6c747.tar.gz pcitool-761270f64b565f433233455e093a6a0b0ab6c747.tar.bz2 pcitool-761270f64b565f433233455e093a6a0b0ab6c747.tar.xz pcitool-761270f64b565f433233455e093a6a0b0ab6c747.zip |
Fixes 2 bugs in NWL DMA initalization: DMA engine was not restarted in case of incosistency leading to possibility of data loss on DMA; Persistent mode was not respected after re-initalization (stop/start dma)
-rw-r--r-- | dma/nwl_engine_buffers.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/dma/nwl_engine_buffers.h b/dma/nwl_engine_buffers.h index 191a2a6..826a4d5 100644 --- a/dma/nwl_engine_buffers.h +++ b/dma/nwl_engine_buffers.h @@ -103,8 +103,11 @@ static int dma_nwl_allocate_engine_buffers(nwl_dma_t *ctx, pcilib_nwl_engine_des reuse_ring = pcilib_kmem_is_reused(ctx->pcilib, ring); reuse_pages = pcilib_kmem_is_reused(ctx->pcilib, pages); - - if (!info->preserve) { +// I guess idea here was that we not need to check all that stuff during the second iteration +// which is basicaly true (shall we expect any driver-triggered changes or parallel accesses?) +// but still we need to set preserve flag (and that if we enforcing preservation --start-dma). +// Probably having checks anyway is not harming... +// if (!info->preserve) { if (reuse_ring == reuse_pages) { if (reuse_ring & PCILIB_KMEM_REUSE_PARTIAL) pcilib_warning("Inconsistent DMA buffers are found (only part of required buffers is available), reinitializing..."); else if (reuse_ring & PCILIB_KMEM_REUSE_REUSED) { @@ -118,7 +121,7 @@ static int dma_nwl_allocate_engine_buffers(nwl_dma_t *ctx, pcilib_nwl_engine_des } } } else pcilib_warning("Inconsistent DMA buffers (modes of ring and page buffers does not match), reinitializing...."); - } +// } unsigned char *data = (unsigned char*)pcilib_kmem_get_ua(ctx->pcilib, ring); @@ -135,6 +138,8 @@ static int dma_nwl_allocate_engine_buffers(nwl_dma_t *ctx, pcilib_nwl_engine_des info->reused = 1; buf_sz = pcilib_kmem_get_block_size(ctx->pcilib, pages, 0); } else { + info->reused = 0; + memset(data, 0, PCILIB_NWL_DMA_PAGES * PCILIB_NWL_DMA_DESCRIPTOR_SIZE); for (i = 0; i < PCILIB_NWL_DMA_PAGES; i++, data += PCILIB_NWL_DMA_DESCRIPTOR_SIZE) { |