aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc64/kernel/pci.c')
-rw-r--r--arch/ppc64/kernel/pci.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c
index 580676f87d23..ae6f579d3fa0 100644
--- a/arch/ppc64/kernel/pci.c
+++ b/arch/ppc64/kernel/pci.c
@@ -351,7 +351,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev,
351 *offset += hose->pci_mem_offset; 351 *offset += hose->pci_mem_offset;
352 res_bit = IORESOURCE_MEM; 352 res_bit = IORESOURCE_MEM;
353 } else { 353 } else {
354 io_offset = (unsigned long)hose->io_base_virt; 354 io_offset = (unsigned long)hose->io_base_virt - pci_io_base;
355 *offset += io_offset; 355 *offset += io_offset;
356 res_bit = IORESOURCE_IO; 356 res_bit = IORESOURCE_IO;
357 } 357 }
@@ -378,7 +378,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev,
378 378
379 /* found it! construct the final physical address */ 379 /* found it! construct the final physical address */
380 if (mmap_state == pci_mmap_io) 380 if (mmap_state == pci_mmap_io)
381 *offset += hose->io_base_phys - io_offset; 381 *offset += hose->io_base_phys - io_offset;
382 return rp; 382 return rp;
383 } 383 }
384 384
@@ -944,4 +944,22 @@ int pci_read_irq_line(struct pci_dev *pci_dev)
944} 944}
945EXPORT_SYMBOL(pci_read_irq_line); 945EXPORT_SYMBOL(pci_read_irq_line);
946 946
947void pci_resource_to_user(const struct pci_dev *dev, int bar,
948 const struct resource *rsrc,
949 u64 *start, u64 *end)
950{
951 struct pci_controller *hose = pci_bus_to_host(dev->bus);
952 unsigned long offset = 0;
953
954 if (hose == NULL)
955 return;
956
957 if (rsrc->flags & IORESOURCE_IO)
958 offset = pci_io_base - (unsigned long)hose->io_base_virt +
959 hose->io_base_phys;
960
961 *start = rsrc->start + offset;
962 *end = rsrc->end + offset;
963}
964
947#endif /* CONFIG_PPC_MULTIPLATFORM */ 965#endif /* CONFIG_PPC_MULTIPLATFORM */