summaryrefslogtreecommitdiffstats
path: root/driver
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2016-03-22 14:56:39 +0100
committerSuren A. Chilingaryan <csa@suren.me>2016-03-22 14:56:39 +0100
commit31695b7d43df1537b650f83fde752dadb8943274 (patch)
treed104c593787ce57d6c521af06c46af41d21264cb /driver
parentad9deef451f517f60dea5cc5c4d05b09ba84b464 (diff)
downloadpcitool-31695b7d43df1537b650f83fde752dadb8943274.tar.gz
pcitool-31695b7d43df1537b650f83fde752dadb8943274.tar.bz2
pcitool-31695b7d43df1537b650f83fde752dadb8943274.tar.xz
pcitool-31695b7d43df1537b650f83fde752dadb8943274.zip
Resolve also not page-algined BAR addresses in the driver
Diffstat (limited to 'driver')
-rw-r--r--driver/rdma.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/driver/rdma.c b/driver/rdma.c
index b1d939a..c601188 100644
--- a/driver/rdma.c
+++ b/driver/rdma.c
@@ -42,11 +42,13 @@ static unsigned long pcidriver_follow_pte(struct mm_struct *mm, unsigned long ad
return pfn;
}
-unsigned long pcidriver_resolve_bar(unsigned long address) {
+unsigned long pcidriver_resolve_bar(unsigned long bar_address) {
int dev, bar;
unsigned long pfn;
+ unsigned long address;
- address = (address >> PAGE_SHIFT) << PAGE_SHIFT;
+ address = (bar_address >> PAGE_SHIFT) << PAGE_SHIFT;
+ offset = bar_address - address;
pfn = pcidriver_follow_pte(current->mm, address);
for (dev = 0; dev < MAXDEVICES; dev++)
@@ -59,7 +61,7 @@ unsigned long pcidriver_resolve_bar(unsigned long address) {
unsigned long start = pci_resource_start(privdata->pdev, bar);
unsigned long end = start + pci_resource_len(privdata->pdev, bar);
if ((pfn >= start)&&(pfn < end))
- return pfn;
+ return pfn + offset;
}
pcidriver_put_privdata(privdata);
}