aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-04-20 05:47:21 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-04-20 05:47:21 -0400
commit5160d3f782a5e0cdb3bdaa8a891a1fb9d9ab83ec (patch)
tree6db575d4980c598ec19f16a3454aacef151237e9
parent09cfeb133e3cac39b8b9a2cb1d8ab4f77e396248 (diff)
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>
-rw-r--r--arch/sh/drivers/pci/pci-lib.c31
-rw-r--r--arch/sh/drivers/pci/pci-new.c31
-rw-r--r--arch/sh/drivers/pci/pci.c14
3 files changed, 31 insertions, 45 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,
39 res->start = start; 39 res->start = start;
40} 40}
41 41
42void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
43 struct resource *res)
44{
45 struct pci_channel *hose = dev->sysdata;
46 unsigned long offset = 0;
47
48 if (res->flags & IORESOURCE_IO)
49 offset = hose->io_offset;
50 else if (res->flags & IORESOURCE_MEM)
51 offset = hose->mem_offset;
52
53 region->start = res->start - offset;
54 region->end = res->end - offset;
55}
56
57void __devinit
58pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
59 struct pci_bus_region *region)
60{
61 struct pci_channel *hose = dev->sysdata;
62 unsigned long offset = 0;
63
64 if (res->flags & IORESOURCE_IO)
65 offset = hose->io_offset;
66 else if (res->flags & IORESOURCE_MEM)
67 offset = hose->mem_offset;
68
69 res->start = region->start + offset;
70 res->end = region->end + offset;
71}
72
42int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 73int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
43 enum pci_mmap_state mmap_state, int write_combine) 74 enum pci_mmap_state mmap_state, int write_combine)
44{ 75{
diff --git a/arch/sh/drivers/pci/pci-new.c b/arch/sh/drivers/pci/pci-new.c
index e8ac8daafc33..9d426147802b 100644
--- a/arch/sh/drivers/pci/pci-new.c
+++ b/arch/sh/drivers/pci/pci-new.c
@@ -147,37 +147,6 @@ void __devinit __weak pcibios_fixup_bus(struct pci_bus *bus)
147 } 147 }
148} 148}
149 149
150void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
151 struct resource *res)
152{
153 struct pci_channel *hose = dev->sysdata;
154 unsigned long offset = 0;
155
156 if (res->flags & IORESOURCE_IO)
157 offset = hose->io_offset;
158 else if (res->flags & IORESOURCE_MEM)
159 offset = hose->mem_offset;
160
161 region->start = res->start - offset;
162 region->end = res->end - offset;
163}
164
165void __devinit
166pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
167 struct pci_bus_region *region)
168{
169 struct pci_channel *hose = dev->sysdata;
170 unsigned long offset = 0;
171
172 if (res->flags & IORESOURCE_IO)
173 offset = hose->io_offset;
174 else if (res->flags & IORESOURCE_MEM)
175 offset = hose->mem_offset;
176
177 res->start = region->start + offset;
178 res->end = region->end + offset;
179}
180
181int pcibios_enable_device(struct pci_dev *dev, int mask) 150int pcibios_enable_device(struct pci_dev *dev, int mask)
182{ 151{
183 u16 cmd, old_cmd; 152 u16 cmd, old_cmd;
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index d39f24091ade..c15a6f0ad500 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -72,20 +72,6 @@ void __devinit __weak pcibios_fixup_bus(struct pci_bus *bus)
72 pci_read_bridge_bases(bus); 72 pci_read_bridge_bases(bus);
73} 73}
74 74
75void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
76 struct resource *res)
77{
78 region->start = res->start;
79 region->end = res->end;
80}
81
82void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
83 struct pci_bus_region *region)
84{
85 res->start = region->start;
86 res->end = region->end;
87}
88
89int pcibios_enable_device(struct pci_dev *dev, int mask) 75int pcibios_enable_device(struct pci_dev *dev, int mask)
90{ 76{
91 u16 cmd, old_cmd; 77 u16 cmd, old_cmd;