summaryrefslogtreecommitdiffstats
path: root/arch/sh/drivers/pci/pci-lib.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-04-20 18:47:21 +0900
committerPaul Mundt <lethal@linux-sh.org>2009-04-20 18:47:21 +0900
commit5160d3f782a5e0cdb3bdaa8a891a1fb9d9ab83ec (patch)
tree6db575d4980c598ec19f16a3454aacef151237e9 /arch/sh/drivers/pci/pci-lib.c
parent09cfeb133e3cac39b8b9a2cb1d8ab4f77e396248 (diff)
downloadtalos-obmc-linux-5160d3f782a5e0cdb3bdaa8a891a1fb9d9ab83ec.tar.gz
talos-obmc-linux-5160d3f782a5e0cdb3bdaa8a891a1fb9d9ab83ec.zip
sh: pci: Consolidate bus<->resource mapping in pci-lib.
Now that the io and mem offsets are tracked accordingly, the pci-new version of the bus<->resource mappers can be used generically. This moves them in to pci-lib. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/drivers/pci/pci-lib.c')
-rw-r--r--arch/sh/drivers/pci/pci-lib.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/sh/drivers/pci/pci-lib.c b/arch/sh/drivers/pci/pci-lib.c
index 654ffcc67d0a..9fd3af9db462 100644
--- a/arch/sh/drivers/pci/pci-lib.c
+++ b/arch/sh/drivers/pci/pci-lib.c
@@ -39,6 +39,37 @@ void pcibios_align_resource(void *data, struct resource *res,
res->start = start;
}
+void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
+ struct resource *res)
+{
+ struct pci_channel *hose = dev->sysdata;
+ unsigned long offset = 0;
+
+ if (res->flags & IORESOURCE_IO)
+ offset = hose->io_offset;
+ else if (res->flags & IORESOURCE_MEM)
+ offset = hose->mem_offset;
+
+ region->start = res->start - offset;
+ region->end = res->end - offset;
+}
+
+void __devinit
+pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+ struct pci_bus_region *region)
+{
+ struct pci_channel *hose = dev->sysdata;
+ unsigned long offset = 0;
+
+ if (res->flags & IORESOURCE_IO)
+ offset = hose->io_offset;
+ else if (res->flags & IORESOURCE_MEM)
+ offset = hose->mem_offset;
+
+ res->start = region->start + offset;
+ res->end = region->end + offset;
+}
+
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
enum pci_mmap_state mmap_state, int write_combine)
{
OpenPOWER on IntegriCloud