summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2015-08-20 14:54:23 +1000
committerBen Skeggs <bskeggs@redhat.com>2015-08-28 12:37:44 +1000
commiteeeb40c6398c7a9d2b194038193d98e3d6068a2f (patch)
tree77336796ea85c47522c6c660878413f6095d59a5 /bin
parent3429f5fd3a2e989f7c93e86ab7c6d8381162c011 (diff)
downloadnouveau-eeeb40c6398c7a9d2b194038193d98e3d6068a2f.tar.gz
device: cleaner abstraction for device resource functions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'bin')
-rw-r--r--bin/nv_rffunc.h4
-rw-r--r--bin/nv_rifunc.h8
-rw-r--r--bin/nv_wffunc.h4
-rw-r--r--bin/nv_wifunc.h8
4 files changed, 12 insertions, 12 deletions
diff --git a/bin/nv_rffunc.h b/bin/nv_rffunc.h
index 4bc0e4a41..fe1d616a0 100644
--- a/bin/nv_rffunc.h
+++ b/bin/nv_rffunc.h
@@ -8,6 +8,7 @@ static u64 map_page = ~0ULL;
static CAST
nv_rfb(struct nvif_device *device, u64 offset)
{
+ struct nvkm_device *nv = nvxx_device(device);
u64 page = (offset & ~(PAGE_SIZE - 1));
u64 addr = (offset & (PAGE_SIZE - 1));
@@ -21,8 +22,7 @@ nv_rfb(struct nvif_device *device, u64 offset)
if (map)
iounmap(map);
- map = ioremap(pci_resource_start(nvxx_device(device)->pdev, 1) +
- page, PAGE_SIZE);
+ map = ioremap(nv->func->resource_addr(nv, 1) + page, PAGE_SIZE);
if (!map) {
printk("map failed\n");
exit(1);
diff --git a/bin/nv_rifunc.h b/bin/nv_rifunc.h
index 245a4833d..8da8898ed 100644
--- a/bin/nv_rifunc.h
+++ b/bin/nv_rifunc.h
@@ -8,7 +8,7 @@ static u64 map_page = ~0ULL;
static CAST
nv_rfb(struct nvif_device *device, u64 offset)
{
- struct pci_dev *pdev = nvxx_device(device)->pdev;
+ struct nvkm_device *nv = nvxx_device(device);
u64 page = (offset & ~(PAGE_SIZE - 1));
u64 addr = (offset & (PAGE_SIZE - 1));
@@ -22,11 +22,11 @@ nv_rfb(struct nvif_device *device, u64 offset)
if (map)
iounmap(map);
- if (pci_resource_len(pdev, 2)) {
- map = ioremap(pci_resource_start(pdev, 2) +
+ if (nv->func->resource_size(nv, 2)) {
+ map = ioremap(nv->func->resource_addr(nv, 2) +
page, PAGE_SIZE);
} else {
- map = ioremap(pci_resource_start(pdev, 3) +
+ map = ioremap(nv->func->resource_addr(nv, 3) +
page, PAGE_SIZE);
}
diff --git a/bin/nv_wffunc.h b/bin/nv_wffunc.h
index 6efa67e2f..94f54146f 100644
--- a/bin/nv_wffunc.h
+++ b/bin/nv_wffunc.h
@@ -8,6 +8,7 @@ static u64 map_page = ~0ULL;
static void
nv_wfb(struct nvif_device *device, u64 offset, CAST data)
{
+ struct nvkm_device *nv = nvxx_device(device);
u64 page = (offset & ~(PAGE_SIZE - 1));
u64 addr = (offset & (PAGE_SIZE - 1));
@@ -21,8 +22,7 @@ nv_wfb(struct nvif_device *device, u64 offset, CAST data)
if (map)
iounmap(map);
- map = ioremap(pci_resource_start(nvxx_device(device)->pdev, 1) +
- page, PAGE_SIZE);
+ map = ioremap(nv->func->resource_addr(nv, 1) + page, PAGE_SIZE);
if (!map) {
printk("map failed\n");
exit(1);
diff --git a/bin/nv_wifunc.h b/bin/nv_wifunc.h
index 0525b8423..aaa597c2d 100644
--- a/bin/nv_wifunc.h
+++ b/bin/nv_wifunc.h
@@ -8,7 +8,7 @@ static u64 map_page = ~0ULL;
static void
nv_wfb(struct nvif_device *device, u64 offset, CAST data)
{
- struct pci_dev *pdev = nvxx_device(device)->pdev;
+ struct nvkm_device *nv = nvxx_device(device);
u64 page = (offset & ~(PAGE_SIZE - 1));
u64 addr = (offset & (PAGE_SIZE - 1));
@@ -22,11 +22,11 @@ nv_wfb(struct nvif_device *device, u64 offset, CAST data)
if (map)
iounmap(map);
- if (pci_resource_len(pdev, 2)) {
- map = ioremap(pci_resource_start(pdev, 2) +
+ if (nv->func->resource_size(nv, 2)) {
+ map = ioremap(nv->func->resource_addr(nv, 2) +
page, PAGE_SIZE);
} else {
- map = ioremap(pci_resource_start(pdev, 3) +
+ map = ioremap(nv->func->resource_addr(nv, 3) +
page, PAGE_SIZE);
}