From bba9c619c79175b58359116b52a889e30a632d07 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Fri, 20 Nov 2015 18:26:29 +0100 Subject: 64-bit access to BAR memory --- pcilib/bar.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'pcilib/bar.c') diff --git a/pcilib/bar.c b/pcilib/bar.c index 6d6cd6d..85c0e12 100644 --- a/pcilib/bar.c +++ b/pcilib/bar.c @@ -119,6 +119,7 @@ void *pcilib_map_bar(pcilib_t *ctx, pcilib_bar_t bar) { return NULL; } + ctx->bar_space[bar] = res; return res; } @@ -323,26 +324,26 @@ const pcilib_bar_info_t *pcilib_get_bar_info(pcilib_t *ctx, pcilib_bar_t bar) { return NULL; } -int pcilib_read(pcilib_t *ctx, pcilib_bar_t bar, uintptr_t addr, size_t size, void *buf) { +int pcilib_read(pcilib_t *ctx, pcilib_bar_t bar, uintptr_t addr, uint8_t access, size_t n, void *buf) { void *data; - pcilib_detect_address(ctx, &bar, &addr, size); + pcilib_detect_address(ctx, &bar, &addr, access * n); data = pcilib_map_bar(ctx, bar); - pcilib_memcpy(buf, data + addr, size); + pcilib_memcpy(buf, data + addr, access, n); pcilib_unmap_bar(ctx, bar, data); return 0; } -int pcilib_write(pcilib_t *ctx, pcilib_bar_t bar, uintptr_t addr, size_t size, void *buf) { +int pcilib_write(pcilib_t *ctx, pcilib_bar_t bar, uintptr_t addr, uint8_t access, size_t n, void *buf) { void *data; - pcilib_detect_address(ctx, &bar, &addr, size); + pcilib_detect_address(ctx, &bar, &addr, access * n); data = pcilib_map_bar(ctx, bar); - pcilib_memcpy(data + addr, buf, size); + pcilib_memcpy(data + addr, buf, access, n); pcilib_unmap_bar(ctx, bar, data); -- cgit v1.2.3