summaryrefslogtreecommitdiffstats
path: root/driver
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2016-03-02 02:26:24 +0100
committerSuren A. Chilingaryan <csa@suren.me>2016-03-02 02:26:24 +0100
commita5da7db50d02878b6d9c844b18d0d3f8ccf6c62b (patch)
tree644c89545b12c269b479010f9ef18f1b8921af78 /driver
parentd85316d3201bfda47efae12ff824ecf68835020e (diff)
downloadpcitool-a5da7db50d02878b6d9c844b18d0d3f8ccf6c62b.tar.gz
pcitool-a5da7db50d02878b6d9c844b18d0d3f8ccf6c62b.tar.bz2
pcitool-a5da7db50d02878b6d9c844b18d0d3f8ccf6c62b.tar.xz
pcitool-a5da7db50d02878b6d9c844b18d0d3f8ccf6c62b.zip
Distinguish between hardware and bus addresses in pcilib
Diffstat (limited to 'driver')
-rw-r--r--driver/kmem.c6
-rw-r--r--driver/pciDriver.h3
2 files changed, 6 insertions, 3 deletions
diff --git a/driver/kmem.c b/driver/kmem.c
index 618b5bf..a2bdfa7 100644
--- a/driver/kmem.c
+++ b/driver/kmem.c
@@ -86,7 +86,8 @@ int pcidriver_kmem_alloc(pcidriver_privdata_t *privdata, kmem_handle_t *kmem_han
kmem_handle->handle_id = kmem_entry->id;
- kmem_handle->pa = (unsigned long)(kmem_entry->dma_handle);
+ kmem_handle->ba = (unsigned long)(kmem_entry->dma_handle);
+ kmem_handle->pa = virt_to_phys((void*)kmem_entry->cpua);
kmem_handle->flags = KMEM_FLAG_REUSED;
if (kmem_entry->refs&KMEM_REF_HW) kmem_handle->flags |= KMEM_FLAG_REUSED_HW;
@@ -191,7 +192,8 @@ int pcidriver_kmem_alloc(pcidriver_privdata_t *privdata, kmem_handle_t *kmem_han
kmem_entry->size = kmem_handle->size;
kmem_entry->cpua = (unsigned long)retptr;
- kmem_handle->pa = (unsigned long)(kmem_entry->dma_handle);
+ kmem_handle->ba = (unsigned long)(kmem_entry->dma_handle);
+ kmem_handle->pa = virt_to_phys(retptr);
kmem_entry->mode = 1;
if (kmem_handle->flags&KMEM_FLAG_REUSE) {
diff --git a/driver/pciDriver.h b/driver/pciDriver.h
index 5d6221e..371bd88 100644
--- a/driver/pciDriver.h
+++ b/driver/pciDriver.h
@@ -58,7 +58,7 @@
#include <linux/ioctl.h>
-#define PCIDRIVER_INTERFACE_VERSION 1 /**< Driver API version, only the pcilib with the same driver interface version is allowed */
+#define PCIDRIVER_INTERFACE_VERSION 2 /**< Driver API version, only the pcilib with the same driver interface version is allowed */
/* Identifies the PCI-E Xilinx ML605 */
#define PCIE_XILINX_VENDOR_ID 0x10ee
@@ -154,6 +154,7 @@ typedef struct {
typedef struct {
unsigned long type;
unsigned long pa;
+ unsigned long ba;
unsigned long size;
unsigned long align;
unsigned long use;