summaryrefslogtreecommitdiffstats
path: root/dma
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-11-18 06:28:28 +0100
committerSuren A. Chilingaryan <csa@suren.me>2015-11-18 06:28:28 +0100
commite30eddc0aeb368814d2bbe0031e6b6ed768bdfcf (patch)
treedf52925dedd955f40b7f861fc223a9766ae3fe15 /dma
parent815924bac97aed5e4b662d5aafeed9634b82af4a (diff)
downloadpcitool-e30eddc0aeb368814d2bbe0031e6b6ed768bdfcf.tar.gz
pcitool-e30eddc0aeb368814d2bbe0031e6b6ed768bdfcf.tar.bz2
pcitool-e30eddc0aeb368814d2bbe0031e6b6ed768bdfcf.tar.xz
pcitool-e30eddc0aeb368814d2bbe0031e6b6ed768bdfcf.zip
Enforce 64-bit dma mask from IPEDMA if supported
Diffstat (limited to 'dma')
-rw-r--r--dma/ipe.c12
-rw-r--r--dma/ipe_private.h3
2 files changed, 14 insertions, 1 deletions
diff --git a/dma/ipe.c b/dma/ipe.c
index 56c65ca..460d2a0 100644
--- a/dma/ipe.c
+++ b/dma/ipe.c
@@ -111,6 +111,8 @@ void dma_ipe_free(pcilib_dma_context_t *vctx) {
int dma_ipe_start(pcilib_dma_context_t *vctx, pcilib_dma_engine_t dma, pcilib_dma_flags_t flags) {
+ int err;
+ int mask = 32;
size_t i, num_pages;
ipe_dma_t *ctx = (ipe_dma_t*)vctx;
@@ -160,6 +162,16 @@ int dma_ipe_start(pcilib_dma_context_t *vctx, pcilib_dma_engine_t dma, pcilib_dm
else
ctx->dma_flags = 0;
+#ifdef IPEDMA_CONFIGURE_DMA_MASK
+ if (ctx->version >= 3) mask = 64;
+
+ err = pcilib_set_dma_mask(ctx->dmactx.pcilib, mask);
+ if (err) {
+ pcilib_error("Error (%i) configuring dma mask (%i)", err, mask);
+ return err;
+ }
+#endif /* IPEDMA_CONFIGURE_DMA_MASK */
+
kflags = PCILIB_KMEM_FLAG_REUSE|PCILIB_KMEM_FLAG_EXCLUSIVE|PCILIB_KMEM_FLAG_HARDWARE|(ctx->preserve?PCILIB_KMEM_FLAG_PERSISTENT:0);
pcilib_kmem_handle_t *desc = pcilib_alloc_kernel_memory(ctx->dmactx.pcilib, PCILIB_KMEM_TYPE_CONSISTENT, 1, IPEDMA_DESCRIPTOR_SIZE, IPEDMA_DESCRIPTOR_ALIGNMENT, PCILIB_KMEM_USE(PCILIB_KMEM_USE_DMA_RING, 0x00), kflags);
pcilib_kmem_handle_t *pages = pcilib_alloc_kernel_memory(ctx->dmactx.pcilib, PCILIB_KMEM_TYPE_DMA_C2S_PAGE, IPEDMA_DMA_PAGES, 0, 0, PCILIB_KMEM_USE(PCILIB_KMEM_USE_DMA_PAGES, 0x00), kflags);
diff --git a/dma/ipe_private.h b/dma/ipe_private.h
index 640b6a0..655a485 100644
--- a/dma/ipe_private.h
+++ b/dma/ipe_private.h
@@ -17,7 +17,8 @@
//#define IPEDMA_BUG_LAST_READ /**< We should forbid writting the second last available DMA buffer (the last is forbidden by design) */
//#define IPEDMA_DETECT_PACKETS /**< Using empty_deceted flag */
-#define IPEDMA_SUPPORT_EMPTY_DETECTED /**< Avoid waiting for data when empty_detected flag is set in hardware */
+#define IPEDMA_SUPPORT_EMPTY_DETECTED /**< Avoid waiting for data when empty_detected flag is set in hardware */
+#define IPEDMA_CONFIGURE_DMA_MASK /**< Enforce maximal DMA mask (to avoid bounce-buffers) */
#define IPEDMA_REG_ADDR_MASK 0xFFF
#define IPEDMA_REG_BANK_MASK 0xF000