summaryrefslogtreecommitdiffstats
path: root/kmem.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2011-10-23 03:17:19 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2011-10-23 03:17:19 +0200
commit122da21966aa8beb2f1cfb739ae6e76bcdba2d4c (patch)
tree75b2912daa0eb0e2da110a867fa487b38bb82f00 /kmem.c
parent8af9de82916ff76129d01ede66fc4406818c525c (diff)
downloadpcitool-122da21966aa8beb2f1cfb739ae6e76bcdba2d4c.tar.gz
pcitool-122da21966aa8beb2f1cfb739ae6e76bcdba2d4c.tar.bz2
pcitool-122da21966aa8beb2f1cfb739ae6e76bcdba2d4c.tar.xz
pcitool-122da21966aa8beb2f1cfb739ae6e76bcdba2d4c.zip
Sync only required buffers
Diffstat (limited to 'kmem.c')
-rw-r--r--kmem.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/kmem.c b/kmem.c
index b94b628..aecccde 100644
--- a/kmem.c
+++ b/kmem.c
@@ -225,6 +225,7 @@ void pcilib_free_kernel_memory(pcilib_t *ctx, pcilib_kmem_handle_t *k, pcilib_km
}
}
+/*
int pcilib_sync_kernel_memory(pcilib_t *ctx, pcilib_kmem_handle_t *k, pcilib_kmem_sync_direction_t dir) {
int i;
int ret;
@@ -232,7 +233,7 @@ int pcilib_sync_kernel_memory(pcilib_t *ctx, pcilib_kmem_handle_t *k, pcilib_kme
pcilib_kmem_list_t *kbuf = (pcilib_kmem_list_t*)k;
ks.dir = dir;
-
+
for (i = 0; i < kbuf->buf.n_blocks; i++) {
ks.handle.handle_id = kbuf->buf.blocks[i].handle_id;
ks.handle.pa = kbuf->buf.blocks[i].pa;
@@ -241,15 +242,29 @@ int pcilib_sync_kernel_memory(pcilib_t *ctx, pcilib_kmem_handle_t *k, pcilib_kme
pcilib_error("PCIDRIVER_IOC_KMEM_SYNC ioctl have failed");
return PCILIB_ERROR_FAILED;
}
-
- if (!kbuf->buf.blocks[i].pa) {
- kbuf->buf.blocks[i].pa = ks.handle.pa;
- }
}
return 0;
}
+*/
+
+int pcilib_kmem_sync_block(pcilib_t *ctx, pcilib_kmem_handle_t *k, pcilib_kmem_sync_direction_t dir, size_t block) {
+ int ret;
+ kmem_sync_t ks;
+ pcilib_kmem_list_t *kbuf = (pcilib_kmem_list_t*)k;
+
+ ks.dir = dir;
+ ks.handle.handle_id = kbuf->buf.blocks[block].handle_id;
+ ks.handle.pa = kbuf->buf.blocks[block].pa;
+ ret = ioctl(ctx->handle, PCIDRIVER_IOC_KMEM_SYNC, &ks);
+ if (ret) {
+ pcilib_error("PCIDRIVER_IOC_KMEM_SYNC ioctl have failed");
+ return PCILIB_ERROR_FAILED;
+ }
+
+ return 0;
+}
void *pcilib_kmem_get_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k) {
pcilib_kmem_list_t *kbuf = (pcilib_kmem_list_t*)k;
@@ -280,4 +295,3 @@ pcilib_kmem_reuse_state_t pcilib_kmem_is_reused(pcilib_t *ctx, pcilib_kmem_hand
pcilib_kmem_list_t *kbuf = (pcilib_kmem_list_t*)k;
return kbuf->buf.reused;
}
-