aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/pci-common.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-12-19 22:54:50 -0500
committerPaul Mackerras <paulus@samba.org>2007-12-20 00:18:08 -0500
commitfe2d338cdcc628e0abdb4f70570a7fa864c617db (patch)
treefbcaeabc2cd7f0a8d564b2e32c54254a71116de9 /arch/powerpc/kernel/pci-common.c
parentfa462f2d75e2437b5757069d3d7d27b1e50285cb (diff)
[POWERPC] Merge pcibios_resource_to_bus/bus_to_resource
This merges the PowerPC 32 and 64 bits version of pcibios_resource_to_bus and pcibios_bus_to_resource(). Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/pci-common.c')
-rw-r--r--arch/powerpc/kernel/pci-common.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 68102ce7e438..0245c989d30a 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -655,3 +655,39 @@ int pci_proc_domain(struct pci_bus *bus)
655#endif 655#endif
656} 656}
657 657
658void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
659 struct resource *res)
660{
661 resource_size_t offset = 0, mask = (resource_size_t)-1;
662 struct pci_controller *hose = pci_bus_to_host(dev->bus);
663
664 if (!hose)
665 return;
666 if (res->flags & IORESOURCE_IO) {
667 offset = (unsigned long)hose->io_base_virt - _IO_BASE;
668 mask = 0xffffffffu;
669 } else if (res->flags & IORESOURCE_MEM)
670 offset = hose->pci_mem_offset;
671
672 region->start = (res->start - offset) & mask;
673 region->end = (res->end - offset) & mask;
674}
675EXPORT_SYMBOL(pcibios_resource_to_bus);
676
677void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
678 struct pci_bus_region *region)
679{
680 resource_size_t offset = 0, mask = (resource_size_t)-1;
681 struct pci_controller *hose = pci_bus_to_host(dev->bus);
682
683 if (!hose)
684 return;
685 if (res->flags & IORESOURCE_IO) {
686 offset = (unsigned long)hose->io_base_virt - _IO_BASE;
687 mask = 0xffffffffu;
688 } else if (res->flags & IORESOURCE_MEM)
689 offset = hose->pci_mem_offset;
690 res->start = (region->start + offset) & mask;
691 res->end = (region->end + offset) & mask;
692}
693EXPORT_SYMBOL(pcibios_bus_to_resource);