diff options
author | David S. Miller <davem@davemloft.net> | 2007-12-25 13:20:33 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-12-27 06:33:46 +0300 |
commit | bcea1db16ba1c45ccebb3bfb8441642d1342c4d5 (patch) | |
tree | 6930a11e79193d56e2c0f344c04ac5c37a56f7eb /arch/sparc64 | |
parent | 11ee29577cc1637f94d903a6ea322cf1ed8ce1b3 (diff) | |
download | linux-bcea1db16ba1c45ccebb3bfb8441642d1342c4d5.tar.xz |
[SPARC64]: Implement pci_resource_to_user()
This makes libpciaccess able to mmap() resources of the
device properly.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r-- | arch/sparc64/kernel/pci.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c index 63b3ebc0c3c2..a61c38fe75ea 100644 --- a/arch/sparc64/kernel/pci.c +++ b/arch/sparc64/kernel/pci.c @@ -1275,4 +1275,20 @@ int pci_dma_supported(struct pci_dev *pdev, u64 device_mask) return (device_mask & dma_addr_mask) == dma_addr_mask; } +void pci_resource_to_user(const struct pci_dev *pdev, int bar, + const struct resource *rp, resource_size_t *start, + resource_size_t *end) +{ + struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller; + unsigned long offset; + + if (rp->flags & IORESOURCE_IO) + offset = pbm->io_space.start; + else + offset = pbm->mem_space.start; + + *start = rp->start - offset; + *end = rp->end - offset; +} + #endif /* !(CONFIG_PCI) */ |