diff options
author | David Miller <davem@davemloft.net> | 2008-01-11 01:28:43 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-08 12:01:28 -0800 |
commit | abf4c0201090bf49a02340d35b4f054a4229ecc9 (patch) | |
tree | df75efbfcc67a65e70f64471a82adee3464e5961 | |
parent | 7a40387d552af1cdc265827e94528149a0725b0d (diff) | |
download | linux-stable-abf4c0201090bf49a02340d35b4f054a4229ecc9.tar.gz linux-stable-abf4c0201090bf49a02340d35b4f054a4229ecc9.tar.bz2 linux-stable-abf4c0201090bf49a02340d35b4f054a4229ecc9.zip |
SPARC64: Implement pci_resource_to_user()
[SPARC64]: Implement pci_resource_to_user()
[ Upstream commit: bcea1db16ba1c45ccebb3bfb8441642d1342c4d5 ]
This makes libpciaccess able to mmap() resources of the
device properly.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | arch/sparc64/kernel/pci.c | 16 | ||||
-rw-r--r-- | include/asm-sparc64/pci.h | 4 |
2 files changed, 20 insertions, 0 deletions
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c index e8dac81d8a0d..9bc05cfbad62 100644 --- a/arch/sparc64/kernel/pci.c +++ b/arch/sparc64/kernel/pci.c @@ -1276,4 +1276,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) */ diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h index 1393e57d50fb..f59f2571295b 100644 --- a/include/asm-sparc64/pci.h +++ b/include/asm-sparc64/pci.h @@ -200,6 +200,10 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) struct device_node; extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev); +#define HAVE_ARCH_PCI_RESOURCE_TO_USER +extern void pci_resource_to_user(const struct pci_dev *dev, int bar, + const struct resource *rsrc, + resource_size_t *start, resource_size_t *end); #endif /* __KERNEL__ */ #endif /* __SPARC64_PCI_H */ |