diff options
Diffstat (limited to 'arch/sh/drivers')
-rw-r--r-- | arch/sh/drivers/pci/pci.c | 75 |
1 files changed, 11 insertions, 64 deletions
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c index 1e7b0e2e764d..9d10a3cb8797 100644 --- a/arch/sh/drivers/pci/pci.c +++ b/arch/sh/drivers/pci/pci.c | |||
@@ -37,11 +37,20 @@ static void __devinit pcibios_scanbus(struct pci_channel *hose) | |||
37 | static int next_busno; | 37 | static int next_busno; |
38 | static int need_domain_info; | 38 | static int need_domain_info; |
39 | LIST_HEAD(resources); | 39 | LIST_HEAD(resources); |
40 | struct resource *res; | ||
41 | resource_size_t offset; | ||
40 | int i; | 42 | int i; |
41 | struct pci_bus *bus; | 43 | struct pci_bus *bus; |
42 | 44 | ||
43 | for (i = 0; i < hose->nr_resources; i++) | 45 | for (i = 0; i < hose->nr_resources; i++) { |
44 | pci_add_resource(&resources, hose->resources + i); | 46 | res = hose->resources + i; |
47 | offset = 0; | ||
48 | if (res->flags & IORESOURCE_IO) | ||
49 | offset = hose->io_offset; | ||
50 | else if (res->flags & IORESOURCE_MEM) | ||
51 | offset = hose->mem_offset; | ||
52 | pci_add_resource_offset(&resources, res, offset); | ||
53 | } | ||
45 | 54 | ||
46 | bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose, | 55 | bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose, |
47 | &resources); | 56 | &resources); |
@@ -143,42 +152,12 @@ static int __init pcibios_init(void) | |||
143 | } | 152 | } |
144 | subsys_initcall(pcibios_init); | 153 | subsys_initcall(pcibios_init); |
145 | 154 | ||
146 | static void pcibios_fixup_device_resources(struct pci_dev *dev, | ||
147 | struct pci_bus *bus) | ||
148 | { | ||
149 | /* Update device resources. */ | ||
150 | struct pci_channel *hose = bus->sysdata; | ||
151 | unsigned long offset = 0; | ||
152 | int i; | ||
153 | |||
154 | for (i = 0; i < PCI_NUM_RESOURCES; i++) { | ||
155 | if (!dev->resource[i].start) | ||
156 | continue; | ||
157 | if (dev->resource[i].flags & IORESOURCE_IO) | ||
158 | offset = hose->io_offset; | ||
159 | else if (dev->resource[i].flags & IORESOURCE_MEM) | ||
160 | offset = hose->mem_offset; | ||
161 | |||
162 | dev->resource[i].start += offset; | ||
163 | dev->resource[i].end += offset; | ||
164 | } | ||
165 | } | ||
166 | |||
167 | /* | 155 | /* |
168 | * Called after each bus is probed, but before its children | 156 | * Called after each bus is probed, but before its children |
169 | * are examined. | 157 | * are examined. |
170 | */ | 158 | */ |
171 | void __devinit pcibios_fixup_bus(struct pci_bus *bus) | 159 | void __devinit pcibios_fixup_bus(struct pci_bus *bus) |
172 | { | 160 | { |
173 | struct pci_dev *dev; | ||
174 | struct list_head *ln; | ||
175 | |||
176 | for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) { | ||
177 | dev = pci_dev_b(ln); | ||
178 | |||
179 | if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI) | ||
180 | pcibios_fixup_device_resources(dev, bus); | ||
181 | } | ||
182 | } | 161 | } |
183 | 162 | ||
184 | /* | 163 | /* |
@@ -208,36 +187,6 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res, | |||
208 | return start; | 187 | return start; |
209 | } | 188 | } |
210 | 189 | ||
211 | void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
212 | struct resource *res) | ||
213 | { | ||
214 | struct pci_channel *hose = dev->sysdata; | ||
215 | unsigned long offset = 0; | ||
216 | |||
217 | if (res->flags & IORESOURCE_IO) | ||
218 | offset = hose->io_offset; | ||
219 | else if (res->flags & IORESOURCE_MEM) | ||
220 | offset = hose->mem_offset; | ||
221 | |||
222 | region->start = res->start - offset; | ||
223 | region->end = res->end - offset; | ||
224 | } | ||
225 | |||
226 | void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
227 | struct pci_bus_region *region) | ||
228 | { | ||
229 | struct pci_channel *hose = dev->sysdata; | ||
230 | unsigned long offset = 0; | ||
231 | |||
232 | if (res->flags & IORESOURCE_IO) | ||
233 | offset = hose->io_offset; | ||
234 | else if (res->flags & IORESOURCE_MEM) | ||
235 | offset = hose->mem_offset; | ||
236 | |||
237 | res->start = region->start + offset; | ||
238 | res->end = region->end + offset; | ||
239 | } | ||
240 | |||
241 | int pcibios_enable_device(struct pci_dev *dev, int mask) | 190 | int pcibios_enable_device(struct pci_dev *dev, int mask) |
242 | { | 191 | { |
243 | return pci_enable_resources(dev, mask); | 192 | return pci_enable_resources(dev, mask); |
@@ -381,8 +330,6 @@ EXPORT_SYMBOL(pci_iounmap); | |||
381 | #endif /* CONFIG_GENERIC_IOMAP */ | 330 | #endif /* CONFIG_GENERIC_IOMAP */ |
382 | 331 | ||
383 | #ifdef CONFIG_HOTPLUG | 332 | #ifdef CONFIG_HOTPLUG |
384 | EXPORT_SYMBOL(pcibios_resource_to_bus); | ||
385 | EXPORT_SYMBOL(pcibios_bus_to_resource); | ||
386 | EXPORT_SYMBOL(PCIBIOS_MIN_IO); | 333 | EXPORT_SYMBOL(PCIBIOS_MIN_IO); |
387 | EXPORT_SYMBOL(PCIBIOS_MIN_MEM); | 334 | EXPORT_SYMBOL(PCIBIOS_MIN_MEM); |
388 | #endif | 335 | #endif |