aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2016-06-17 15:43:34 -0400
committerBjorn Helgaas <bhelgaas@google.com>2016-06-17 15:45:03 -0400
commit3b146b24a40096d1a42f288e237e24352c93269e (patch)
tree30d6f0f41d58bcd0270f9d018f549fb2ec94a9df /arch/sparc
parent38301358573be7398e43115170f2d76598c8d43b (diff)
sparc/PCI: Implement pci_resource_to_user() with pcibios_resource_to_bus()
"User" addresses are shown in /sys/devices/pci.../.../resource and /proc/bus/pci/devices and used as mmap offsets for /proc/bus/pci/BB/DD.F files. On sparc, these are PCI bus addresses, i.e., raw BAR values. Previously pci_resource_to_user() computed the user address by subtracting either pbm->io_space.start or pbm->mem_space.start from the resource start. We've already told the PCI core about those offsets here: pci_scan_one_pbm() pci_add_resource_offset(&resources, &pbm->io_space, pbm->io_space.start); pci_add_resource_offset(&resources, &pbm->mem_space, pbm->mem_space.start); pci_add_resource_offset(&resources, &pbm->mem64_space, pbm->mem_space.start); so pcibios_resource_to_bus() knows how to do that translation. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Yinghai Lu <yinghai@kernel.org>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/kernel/pci.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index c2b202d763a1..9c1878f4fa9f 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -986,16 +986,18 @@ void pci_resource_to_user(const struct pci_dev *pdev, int bar,
986 const struct resource *rp, resource_size_t *start, 986 const struct resource *rp, resource_size_t *start,
987 resource_size_t *end) 987 resource_size_t *end)
988{ 988{
989 struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller; 989 struct pci_bus_region region;
990 unsigned long offset;
991
992 if (rp->flags & IORESOURCE_IO)
993 offset = pbm->io_space.start;
994 else
995 offset = pbm->mem_space.start;
996 990
997 *start = rp->start - offset; 991 /*
998 *end = rp->end - offset; 992 * "User" addresses are shown in /sys/devices/pci.../.../resource
993 * and /proc/bus/pci/devices and used as mmap offsets for
994 * /proc/bus/pci/BB/DD.F files (see proc_bus_pci_mmap()).
995 *
996 * On sparc, these are PCI bus addresses, i.e., raw BAR values.
997 */
998 pcibios_resource_to_bus(pdev->bus, &region, (struct resource *) rp);
999 *start = region.start;
1000 *end = region.end;
999} 1001}
1000 1002
1001void pcibios_set_master(struct pci_dev *dev) 1003void pcibios_set_master(struct pci_dev *dev)