summaryrefslogtreecommitdiffstats
path: root/pcilib
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2016-03-04 16:43:14 +0100
committerSuren A. Chilingaryan <csa@suren.me>2016-03-04 16:43:14 +0100
commit4c17aa5a10ffc232e7e4de45d8ab0b52cfc3010b (patch)
treedce4520f69b3124da7afa76c2bbe5fc1f08313f7 /pcilib
parent195c28f3074486165b6e0935362810f8a1fb9531 (diff)
downloadpcitool-4c17aa5a10ffc232e7e4de45d8ab0b52cfc3010b.tar.gz
pcitool-4c17aa5a10ffc232e7e4de45d8ab0b52cfc3010b.tar.bz2
pcitool-4c17aa5a10ffc232e7e4de45d8ab0b52cfc3010b.tar.xz
pcitool-4c17aa5a10ffc232e7e4de45d8ab0b52cfc3010b.zip
RPM generation
Diffstat (limited to 'pcilib')
-rw-r--r--pcilib/kmem.c6
-rw-r--r--pcilib/kmem.h6
-rw-r--r--pcilib/locking.c6
3 files changed, 9 insertions, 9 deletions
diff --git a/pcilib/kmem.c b/pcilib/kmem.c
index b103126..e1d60c5 100644
--- a/pcilib/kmem.c
+++ b/pcilib/kmem.c
@@ -29,7 +29,7 @@ int pcilib_clean_kernel_memory(pcilib_t *ctx, pcilib_kmem_use_t use, pcilib_kmem
static int pcilib_free_kernel_buffer(pcilib_t *ctx, pcilib_kmem_list_t *kbuf, size_t i, pcilib_kmem_flags_t flags) {
kmem_handle_t kh = {0};
- if (kbuf->buf.blocks[i].ua) munmap(kbuf->buf.blocks[i].ua, kbuf->buf.blocks[i].size + kbuf->buf.blocks[i].alignment_offset);
+ if (kbuf->buf.blocks[i].ua) munmap((void*)kbuf->buf.blocks[i].ua, kbuf->buf.blocks[i].size + kbuf->buf.blocks[i].alignment_offset);
kh.handle_id = kbuf->buf.blocks[i].handle_id;
kh.pa = kbuf->buf.blocks[i].pa;
kh.flags = flags;
@@ -361,7 +361,7 @@ int pcilib_kmem_sync_block(pcilib_t *ctx, pcilib_kmem_handle_t *k, pcilib_kmem_s
return 0;
}
-void* volatile pcilib_kmem_get_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k) {
+volatile void *pcilib_kmem_get_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k) {
pcilib_kmem_list_t *kbuf = (pcilib_kmem_list_t*)k;
return kbuf->buf.addr.ua + kbuf->buf.addr.alignment_offset + kbuf->buf.addr.mmap_offset;
}
@@ -380,7 +380,7 @@ uintptr_t pcilib_kmem_get_ba(pcilib_t *ctx, pcilib_kmem_handle_t *k) {
return 0;
}
-void* volatile pcilib_kmem_get_block_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k, size_t block) {
+volatile void *pcilib_kmem_get_block_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k, size_t block) {
pcilib_kmem_list_t *kbuf = (pcilib_kmem_list_t*)k;
return kbuf->buf.blocks[block].ua + kbuf->buf.blocks[block].alignment_offset + kbuf->buf.blocks[block].mmap_offset;
}
diff --git a/pcilib/kmem.h b/pcilib/kmem.h
index 1d63e3b..e8d2827 100644
--- a/pcilib/kmem.h
+++ b/pcilib/kmem.h
@@ -68,7 +68,7 @@ typedef struct {
uintptr_t pa; /**< physical address of buffer */
uintptr_t ba; /**< bus address of buffer (if it is mapped for DMA operations) */
- void* volatile ua; /**< pointer to buffer in the process address space */
+ volatile void *ua; /**< pointer to buffer in the process address space */
size_t size; /**< size of the buffer in bytes */
size_t alignment_offset; /**< we may request alignment of allocated buffers. To enusre proper alignment the larger buffer will be allocated and the offset will specify the first position in the buffer fullfilling alignment request */
@@ -205,7 +205,7 @@ int pcilib_kmem_sync_block(pcilib_t *ctx, pcilib_kmem_handle_t *k, pcilib_kmem_s
* @param[in] k - kernel memory handle returned from pcilib_alloc_kernel_memory() call
* @return - user-space pointer
*/
-void* volatile pcilib_kmem_get_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k);
+volatile void *pcilib_kmem_get_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k);
/**
* Get a physical address of a single-buffer kernel memory
@@ -233,7 +233,7 @@ uintptr_t pcilib_kmem_get_ba(pcilib_t *ctx, pcilib_kmem_handle_t *k);
* @param[in] block - specifies the buffer within the kernel memory (buffers are numbered from 0)
* @return - user-space pointer
*/
-void* volatile pcilib_kmem_get_block_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k, size_t block);
+volatile void *pcilib_kmem_get_block_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k, size_t block);
/**
* Get a physical address of the specified kernel memory buffer
diff --git a/pcilib/locking.c b/pcilib/locking.c
index 71f204e..6ae4365 100644
--- a/pcilib/locking.c
+++ b/pcilib/locking.c
@@ -43,7 +43,7 @@ int pcilib_init_locking(pcilib_t* ctx) {
if ((reused & PCILIB_KMEM_REUSE_REUSED) == 0) {
for (i = 0; i < PCILIB_LOCK_PAGES; i++) {
- void *addr = pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, i);
+ void *addr = (void*)pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, i);
memset(addr, 0, PCILIB_KMEM_PAGE_SIZE);
}
}
@@ -95,7 +95,7 @@ void pcilib_unlock_global(pcilib_t *ctx) {
pcilib_lock_t *pcilib_get_lock_by_id(pcilib_t *ctx, pcilib_lock_id_t id) {
int page = id / PCILIB_LOCKS_PER_PAGE;
int offset = id - page * PCILIB_LOCKS_PER_PAGE;
- void *addr = pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, page);
+ volatile void *addr = pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, page);
pcilib_lock_t *lock = (pcilib_lock_t*)(addr + offset * PCILIB_LOCK_SIZE);
return lock;
@@ -308,7 +308,7 @@ int pcilib_destroy_all_locks(pcilib_t *ctx, int force) {
}
for (i = 0; i < PCILIB_LOCK_PAGES; i++) {
- void *addr = pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, i);
+ void *addr = (void*)pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, i);
memset(addr, 0, PCILIB_KMEM_PAGE_SIZE);
}