aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/include/asm/pci.h6
-rw-r--r--arch/alpha/kernel/pci.c71
2 files changed, 5 insertions, 72 deletions
diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index 6a3fe0704620..121c797eb14f 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -100,11 +100,7 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
100 return channel ? 15 : 14; 100 return channel ? 15 : 14;
101} 101}
102 102
103extern void pcibios_resource_to_bus(struct pci_dev *, struct pci_bus_region *, 103#define ARCH_HAS_GENERIC_PCI_OFFSETS
104 struct resource *);
105
106extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
107 struct pci_bus_region *region);
108 104
109#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index 105#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
110 106
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 3a5cdf2a8fd0..1a629636cc16 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -251,32 +251,6 @@ pci_restore_srm_config(void)
251#endif 251#endif
252 252
253void __devinit 253void __devinit
254pcibios_fixup_resource(struct resource *res, struct resource *root)
255{
256 res->start += root->start;
257 res->end += root->start;
258}
259
260void __devinit
261pcibios_fixup_device_resources(struct pci_dev *dev, struct pci_bus *bus)
262{
263 /* Update device resources. */
264 struct pci_controller *hose = (struct pci_controller *)bus->sysdata;
265 int i;
266
267 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
268 if (!dev->resource[i].start)
269 continue;
270 if (dev->resource[i].flags & IORESOURCE_IO)
271 pcibios_fixup_resource(&dev->resource[i],
272 hose->io_space);
273 else if (dev->resource[i].flags & IORESOURCE_MEM)
274 pcibios_fixup_resource(&dev->resource[i],
275 hose->mem_space);
276 }
277}
278
279void __devinit
280pcibios_fixup_bus(struct pci_bus *bus) 254pcibios_fixup_bus(struct pci_bus *bus)
281{ 255{
282 struct pci_dev *dev = bus->self; 256 struct pci_dev *dev = bus->self;
@@ -284,13 +258,10 @@ pcibios_fixup_bus(struct pci_bus *bus)
284 if (pci_has_flag(PCI_PROBE_ONLY) && dev && 258 if (pci_has_flag(PCI_PROBE_ONLY) && dev &&
285 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { 259 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
286 pci_read_bridge_bases(bus); 260 pci_read_bridge_bases(bus);
287 pcibios_fixup_device_resources(dev, bus);
288 } 261 }
289 262
290 list_for_each_entry(dev, &bus->devices, bus_list) { 263 list_for_each_entry(dev, &bus->devices, bus_list) {
291 pdev_save_srm_config(dev); 264 pdev_save_srm_config(dev);
292 if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
293 pcibios_fixup_device_resources(dev, bus);
294 } 265 }
295} 266}
296 267
@@ -300,42 +271,6 @@ pcibios_update_irq(struct pci_dev *dev, int irq)
300 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); 271 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
301} 272}
302 273
303void
304pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
305 struct resource *res)
306{
307 struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
308 unsigned long offset = 0;
309
310 if (res->flags & IORESOURCE_IO)
311 offset = hose->io_space->start;
312 else if (res->flags & IORESOURCE_MEM)
313 offset = hose->mem_space->start;
314
315 region->start = res->start - offset;
316 region->end = res->end - offset;
317}
318
319void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
320 struct pci_bus_region *region)
321{
322 struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
323 unsigned long offset = 0;
324
325 if (res->flags & IORESOURCE_IO)
326 offset = hose->io_space->start;
327 else if (res->flags & IORESOURCE_MEM)
328 offset = hose->mem_space->start;
329
330 res->start = region->start + offset;
331 res->end = region->end + offset;
332}
333
334#ifdef CONFIG_HOTPLUG
335EXPORT_SYMBOL(pcibios_resource_to_bus);
336EXPORT_SYMBOL(pcibios_bus_to_resource);
337#endif
338
339int 274int
340pcibios_enable_device(struct pci_dev *dev, int mask) 275pcibios_enable_device(struct pci_dev *dev, int mask)
341{ 276{
@@ -415,8 +350,10 @@ common_init_pci(void)
415 hose->mem_space->end = end; 350 hose->mem_space->end = end;
416 351
417 INIT_LIST_HEAD(&resources); 352 INIT_LIST_HEAD(&resources);
418 pci_add_resource(&resources, hose->io_space); 353 pci_add_resource_offset(&resources, hose->io_space,
419 pci_add_resource(&resources, hose->mem_space); 354 hose->io_space->start);
355 pci_add_resource_offset(&resources, hose->mem_space,
356 hose->mem_space->start);
420 357
421 bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops, 358 bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
422 hose, &resources); 359 hose, &resources);