summaryrefslogtreecommitdiffstats
path: root/kmem.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2014-04-03 00:37:21 +0200
committerSuren A. Chilingaryan <csa@suren.me>2014-04-03 00:37:21 +0200
commita1925232b26bc0d9801d7c1dcd58301841877af1 (patch)
tree8da70a5e091d5400fd063c385ec473d17b708583 /kmem.c
parentd8c13eb6ff5a1c9cc28617d83dbde454c7222be4 (diff)
parentc57db04f528e671040256d322bb8f21a8d8e9ac1 (diff)
downloadpcitool-a1925232b26bc0d9801d7c1dcd58301841877af1.tar.gz
pcitool-a1925232b26bc0d9801d7c1dcd58301841877af1.tar.bz2
pcitool-a1925232b26bc0d9801d7c1dcd58301841877af1.tar.xz
pcitool-a1925232b26bc0d9801d7c1dcd58301841877af1.zip
Merge changes from xilinx_dma branch providing support of multipage kmem allocations and mapping memory regions reserved with memmap boot option
Diffstat (limited to 'kmem.c')
-rw-r--r--kmem.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/kmem.c b/kmem.c
index d693b60..64f593a 100644
--- a/kmem.c
+++ b/kmem.c
@@ -91,13 +91,19 @@ pcilib_kmem_handle_t *pcilib_alloc_kernel_memory(pcilib_t *ctx, pcilib_kmem_type
kh.align = alignment;
kh.use = use;
- if ((type&PCILIB_KMEM_TYPE_MASK) != PCILIB_KMEM_TYPE_PAGE) {
+ if ((type&PCILIB_KMEM_TYPE_MASK) == PCILIB_KMEM_TYPE_REGION) {
+ kh.align = 0;
+ } else if ((type&PCILIB_KMEM_TYPE_MASK) != PCILIB_KMEM_TYPE_PAGE) {
kh.size += alignment;
}
-
+
for ( i = 0; i < nmemb; i++) {
kh.item = i;
kh.flags = flags;
+
+ if ((type&PCILIB_KMEM_TYPE_MASK) == PCILIB_KMEM_TYPE_REGION) {
+ kh.pa = alignment + i * size;
+ }
ret = ioctl(ctx->handle, PCIDRIVER_IOC_KMEM_ALLOC, &kh);
if (ret) {