diff options
author | root <root@iss-tomyspiel-1> | 2011-10-21 02:37:19 +0200 |
---|---|---|
committer | root <root@iss-tomyspiel-1> | 2011-10-21 02:37:19 +0200 |
commit | 33fb2003ef2e359f472dc153a7c2e700cdff2922 (patch) | |
tree | 102b48849f6b3a1486ac5ec5bbb305a8c8d274a1 /kmem.c | |
parent | 64e0f2948b71d37e8cdb99693a00b3f440565953 (diff) | |
download | pcitool-33fb2003ef2e359f472dc153a7c2e700cdff2922.tar.gz pcitool-33fb2003ef2e359f472dc153a7c2e700cdff2922.tar.bz2 pcitool-33fb2003ef2e359f472dc153a7c2e700cdff2922.tar.xz pcitool-33fb2003ef2e359f472dc153a7c2e700cdff2922.zip |
Support exporting data from kernel buffers
Diffstat (limited to 'kmem.c')
-rw-r--r-- | kmem.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -144,9 +144,9 @@ pcilib_kmem_handle_t *pcilib_alloc_kernel_memory(pcilib_t *ctx, pcilib_kmem_type break; } - if ((alignment)&&(type != PCILIB_KMEM_TYPE_PAGE)) { - if (kh.pa % alignment) kbuf->buf.blocks[i].alignment_offset = alignment - kh.pa % alignment; - kbuf->buf.blocks[i].size -= alignment; + if ((kh.align)&&(type != PCILIB_KMEM_TYPE_PAGE)) { + if (kh.pa % kh.align) kbuf->buf.blocks[i].alignment_offset = kh.align - kh.pa % kh.align; + kbuf->buf.blocks[i].size -= kh.align; } addr = mmap( 0, kbuf->buf.blocks[i].size + kbuf->buf.blocks[i].alignment_offset, PROT_WRITE | PROT_READ, MAP_SHARED, ctx->handle, 0 ); @@ -157,6 +157,9 @@ pcilib_kmem_handle_t *pcilib_alloc_kernel_memory(pcilib_t *ctx, pcilib_kmem_type } kbuf->buf.blocks[i].ua = addr; +// if (use == PCILIB_KMEM_USE_DMA_PAGES) { +// memset(addr, 10, kbuf->buf.blocks[i].size + kbuf->buf.blocks[i].alignment_offset); +// } kbuf->buf.blocks[i].mmap_offset = kh.pa & ctx->page_mask; } |