diff options
Diffstat (limited to 'arch/mips/pci/pci.c')
-rw-r--r-- | arch/mips/pci/pci.c | 70 |
1 files changed, 3 insertions, 67 deletions
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c index 19f6d194a568..0514866fa925 100644 --- a/arch/mips/pci/pci.c +++ b/arch/mips/pci/pci.c | |||
@@ -88,8 +88,9 @@ static void __devinit pcibios_scanbus(struct pci_controller *hose) | |||
88 | if (hose->get_busno && pci_has_flag(PCI_PROBE_ONLY)) | 88 | if (hose->get_busno && pci_has_flag(PCI_PROBE_ONLY)) |
89 | next_busno = (*hose->get_busno)(); | 89 | next_busno = (*hose->get_busno)(); |
90 | 90 | ||
91 | pci_add_resource(&resources, hose->mem_resource); | 91 | pci_add_resource_offset(&resources, |
92 | pci_add_resource(&resources, hose->io_resource); | 92 | hose->mem_resource, hose->mem_offset); |
93 | pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset); | ||
93 | bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose, | 94 | bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose, |
94 | &resources); | 95 | &resources); |
95 | if (!bus) | 96 | if (!bus) |
@@ -247,45 +248,13 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) | |||
247 | return pcibios_plat_dev_init(dev); | 248 | return pcibios_plat_dev_init(dev); |
248 | } | 249 | } |
249 | 250 | ||
250 | static void pcibios_fixup_device_resources(struct pci_dev *dev, | ||
251 | struct pci_bus *bus) | ||
252 | { | ||
253 | /* Update device resources. */ | ||
254 | struct pci_controller *hose = (struct pci_controller *)bus->sysdata; | ||
255 | unsigned long offset = 0; | ||
256 | int i; | ||
257 | |||
258 | for (i = 0; i < PCI_NUM_RESOURCES; i++) { | ||
259 | if (!dev->resource[i].start) | ||
260 | continue; | ||
261 | if (dev->resource[i].flags & IORESOURCE_IO) | ||
262 | offset = hose->io_offset; | ||
263 | else if (dev->resource[i].flags & IORESOURCE_MEM) | ||
264 | offset = hose->mem_offset; | ||
265 | |||
266 | dev->resource[i].start += offset; | ||
267 | dev->resource[i].end += offset; | ||
268 | } | ||
269 | } | ||
270 | |||
271 | void __devinit pcibios_fixup_bus(struct pci_bus *bus) | 251 | void __devinit pcibios_fixup_bus(struct pci_bus *bus) |
272 | { | 252 | { |
273 | /* Propagate hose info into the subordinate devices. */ | ||
274 | |||
275 | struct list_head *ln; | ||
276 | struct pci_dev *dev = bus->self; | 253 | struct pci_dev *dev = bus->self; |
277 | 254 | ||
278 | if (pci_has_flag(PCI_PROBE_ONLY) && dev && | 255 | if (pci_has_flag(PCI_PROBE_ONLY) && dev && |
279 | (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { | 256 | (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { |
280 | pci_read_bridge_bases(bus); | 257 | pci_read_bridge_bases(bus); |
281 | pcibios_fixup_device_resources(dev, bus); | ||
282 | } | ||
283 | |||
284 | for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) { | ||
285 | dev = pci_dev_b(ln); | ||
286 | |||
287 | if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI) | ||
288 | pcibios_fixup_device_resources(dev, bus); | ||
289 | } | 258 | } |
290 | } | 259 | } |
291 | 260 | ||
@@ -295,40 +264,7 @@ pcibios_update_irq(struct pci_dev *dev, int irq) | |||
295 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); | 264 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); |
296 | } | 265 | } |
297 | 266 | ||
298 | void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
299 | struct resource *res) | ||
300 | { | ||
301 | struct pci_controller *hose = (struct pci_controller *)dev->sysdata; | ||
302 | unsigned long offset = 0; | ||
303 | |||
304 | if (res->flags & IORESOURCE_IO) | ||
305 | offset = hose->io_offset; | ||
306 | else if (res->flags & IORESOURCE_MEM) | ||
307 | offset = hose->mem_offset; | ||
308 | |||
309 | region->start = res->start - offset; | ||
310 | region->end = res->end - offset; | ||
311 | } | ||
312 | |||
313 | void __devinit | ||
314 | pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
315 | struct pci_bus_region *region) | ||
316 | { | ||
317 | struct pci_controller *hose = (struct pci_controller *)dev->sysdata; | ||
318 | unsigned long offset = 0; | ||
319 | |||
320 | if (res->flags & IORESOURCE_IO) | ||
321 | offset = hose->io_offset; | ||
322 | else if (res->flags & IORESOURCE_MEM) | ||
323 | offset = hose->mem_offset; | ||
324 | |||
325 | res->start = region->start + offset; | ||
326 | res->end = region->end + offset; | ||
327 | } | ||
328 | |||
329 | #ifdef CONFIG_HOTPLUG | 267 | #ifdef CONFIG_HOTPLUG |
330 | EXPORT_SYMBOL(pcibios_resource_to_bus); | ||
331 | EXPORT_SYMBOL(pcibios_bus_to_resource); | ||
332 | EXPORT_SYMBOL(PCIBIOS_MIN_IO); | 268 | EXPORT_SYMBOL(PCIBIOS_MIN_IO); |
333 | EXPORT_SYMBOL(PCIBIOS_MIN_MEM); | 269 | EXPORT_SYMBOL(PCIBIOS_MIN_MEM); |
334 | #endif | 270 | #endif |