]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
[SPARC64]: Implement pci_resource_to_user()
authorDavid S. Miller <davem@davemloft.net>
Tue, 25 Dec 2007 10:20:33 +0000 (02:20 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 27 Dec 2007 03:33:46 +0000 (19:33 -0800)
This makes libpciaccess able to mmap() resources of the
device properly.

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc64/kernel/pci.c
include/asm-sparc64/pci.h

index 63b3ebc0c3c209fef14c8d8cc9f6e6d8bf276e82..a61c38fe75ead3db51c7b0ae0eb4a01ef7b912ee 100644 (file)
@@ -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) */
index 1393e57d50fb0c2bbee86edc1fb814d1bca90b39..f59f2571295b69e8304ba406d54d17d7e6260b49 100644 (file)
@@ -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 */