diff options
Diffstat (limited to 'arch/alpha/kernel/pci.c')
-rw-r--r-- | arch/alpha/kernel/pci.c | 86 |
1 files changed, 11 insertions, 75 deletions
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c index 8c723c1b086a..1a629636cc16 100644 --- a/arch/alpha/kernel/pci.c +++ b/arch/alpha/kernel/pci.c | |||
@@ -43,12 +43,10 @@ const char *const pci_mem_names[] = { | |||
43 | 43 | ||
44 | const char pci_hae0_name[] = "HAE0"; | 44 | const char pci_hae0_name[] = "HAE0"; |
45 | 45 | ||
46 | /* Indicate whether we respect the PCI setup left by console. */ | ||
47 | /* | 46 | /* |
48 | * Make this long-lived so that we know when shutting down | 47 | * If PCI_PROBE_ONLY in pci_flags is set, we don't change any PCI resource |
49 | * whether we probed only or not. | 48 | * assignments. |
50 | */ | 49 | */ |
51 | int pci_probe_only; | ||
52 | 50 | ||
53 | /* | 51 | /* |
54 | * The PCI controller list. | 52 | * The PCI controller list. |
@@ -215,7 +213,7 @@ pdev_save_srm_config(struct pci_dev *dev) | |||
215 | struct pdev_srm_saved_conf *tmp; | 213 | struct pdev_srm_saved_conf *tmp; |
216 | static int printed = 0; | 214 | static int printed = 0; |
217 | 215 | ||
218 | if (!alpha_using_srm || pci_probe_only) | 216 | if (!alpha_using_srm || pci_has_flag(PCI_PROBE_ONLY)) |
219 | return; | 217 | return; |
220 | 218 | ||
221 | if (!printed) { | 219 | if (!printed) { |
@@ -242,7 +240,7 @@ pci_restore_srm_config(void) | |||
242 | struct pdev_srm_saved_conf *tmp; | 240 | struct pdev_srm_saved_conf *tmp; |
243 | 241 | ||
244 | /* No need to restore if probed only. */ | 242 | /* No need to restore if probed only. */ |
245 | if (pci_probe_only) | 243 | if (pci_has_flag(PCI_PROBE_ONLY)) |
246 | return; | 244 | return; |
247 | 245 | ||
248 | /* Restore SRM config. */ | 246 | /* Restore SRM config. */ |
@@ -253,46 +251,17 @@ pci_restore_srm_config(void) | |||
253 | #endif | 251 | #endif |
254 | 252 | ||
255 | void __devinit | 253 | void __devinit |
256 | pcibios_fixup_resource(struct resource *res, struct resource *root) | ||
257 | { | ||
258 | res->start += root->start; | ||
259 | res->end += root->start; | ||
260 | } | ||
261 | |||
262 | void __devinit | ||
263 | pcibios_fixup_device_resources(struct pci_dev *dev, struct pci_bus *bus) | ||
264 | { | ||
265 | /* Update device resources. */ | ||
266 | struct pci_controller *hose = (struct pci_controller *)bus->sysdata; | ||
267 | int i; | ||
268 | |||
269 | for (i = 0; i < PCI_NUM_RESOURCES; i++) { | ||
270 | if (!dev->resource[i].start) | ||
271 | continue; | ||
272 | if (dev->resource[i].flags & IORESOURCE_IO) | ||
273 | pcibios_fixup_resource(&dev->resource[i], | ||
274 | hose->io_space); | ||
275 | else if (dev->resource[i].flags & IORESOURCE_MEM) | ||
276 | pcibios_fixup_resource(&dev->resource[i], | ||
277 | hose->mem_space); | ||
278 | } | ||
279 | } | ||
280 | |||
281 | void __devinit | ||
282 | pcibios_fixup_bus(struct pci_bus *bus) | 254 | pcibios_fixup_bus(struct pci_bus *bus) |
283 | { | 255 | { |
284 | struct pci_dev *dev = bus->self; | 256 | struct pci_dev *dev = bus->self; |
285 | 257 | ||
286 | if (pci_probe_only && dev && | 258 | if (pci_has_flag(PCI_PROBE_ONLY) && dev && |
287 | (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { | 259 | (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { |
288 | pci_read_bridge_bases(bus); | 260 | pci_read_bridge_bases(bus); |
289 | pcibios_fixup_device_resources(dev, bus); | ||
290 | } | 261 | } |
291 | 262 | ||
292 | list_for_each_entry(dev, &bus->devices, bus_list) { | 263 | list_for_each_entry(dev, &bus->devices, bus_list) { |
293 | pdev_save_srm_config(dev); | 264 | pdev_save_srm_config(dev); |
294 | if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI) | ||
295 | pcibios_fixup_device_resources(dev, bus); | ||
296 | } | 265 | } |
297 | } | 266 | } |
298 | 267 | ||
@@ -302,42 +271,6 @@ pcibios_update_irq(struct pci_dev *dev, int irq) | |||
302 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); | 271 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); |
303 | } | 272 | } |
304 | 273 | ||
305 | void | ||
306 | pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
307 | struct resource *res) | ||
308 | { | ||
309 | struct pci_controller *hose = (struct pci_controller *)dev->sysdata; | ||
310 | unsigned long offset = 0; | ||
311 | |||
312 | if (res->flags & IORESOURCE_IO) | ||
313 | offset = hose->io_space->start; | ||
314 | else if (res->flags & IORESOURCE_MEM) | ||
315 | offset = hose->mem_space->start; | ||
316 | |||
317 | region->start = res->start - offset; | ||
318 | region->end = res->end - offset; | ||
319 | } | ||
320 | |||
321 | void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
322 | struct pci_bus_region *region) | ||
323 | { | ||
324 | struct pci_controller *hose = (struct pci_controller *)dev->sysdata; | ||
325 | unsigned long offset = 0; | ||
326 | |||
327 | if (res->flags & IORESOURCE_IO) | ||
328 | offset = hose->io_space->start; | ||
329 | else if (res->flags & IORESOURCE_MEM) | ||
330 | offset = hose->mem_space->start; | ||
331 | |||
332 | res->start = region->start + offset; | ||
333 | res->end = region->end + offset; | ||
334 | } | ||
335 | |||
336 | #ifdef CONFIG_HOTPLUG | ||
337 | EXPORT_SYMBOL(pcibios_resource_to_bus); | ||
338 | EXPORT_SYMBOL(pcibios_bus_to_resource); | ||
339 | #endif | ||
340 | |||
341 | int | 274 | int |
342 | pcibios_enable_device(struct pci_dev *dev, int mask) | 275 | pcibios_enable_device(struct pci_dev *dev, int mask) |
343 | { | 276 | { |
@@ -374,7 +307,8 @@ pcibios_claim_one_bus(struct pci_bus *b) | |||
374 | 307 | ||
375 | if (r->parent || !r->start || !r->flags) | 308 | if (r->parent || !r->start || !r->flags) |
376 | continue; | 309 | continue; |
377 | if (pci_probe_only || (r->flags & IORESOURCE_PCI_FIXED)) | 310 | if (pci_has_flag(PCI_PROBE_ONLY) || |
311 | (r->flags & IORESOURCE_PCI_FIXED)) | ||
378 | pci_claim_resource(dev, i); | 312 | pci_claim_resource(dev, i); |
379 | } | 313 | } |
380 | } | 314 | } |
@@ -416,8 +350,10 @@ common_init_pci(void) | |||
416 | hose->mem_space->end = end; | 350 | hose->mem_space->end = end; |
417 | 351 | ||
418 | INIT_LIST_HEAD(&resources); | 352 | INIT_LIST_HEAD(&resources); |
419 | pci_add_resource(&resources, hose->io_space); | 353 | pci_add_resource_offset(&resources, hose->io_space, |
420 | 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); | ||
421 | 357 | ||
422 | 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, |
423 | hose, &resources); | 359 | hose, &resources); |