diff options
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/probe.c | 54 |
1 files changed, 39 insertions, 15 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index d3009430eab6..4b47b4bfb066 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -281,26 +281,12 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) | |||
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | void __devinit pci_read_bridge_bases(struct pci_bus *child) | 284 | static void __devinit pci_read_bridge_io(struct pci_bus *child) |
285 | { | 285 | { |
286 | struct pci_dev *dev = child->self; | 286 | struct pci_dev *dev = child->self; |
287 | u8 io_base_lo, io_limit_lo; | 287 | u8 io_base_lo, io_limit_lo; |
288 | u16 mem_base_lo, mem_limit_lo; | ||
289 | unsigned long base, limit; | 288 | unsigned long base, limit; |
290 | struct resource *res; | 289 | struct resource *res; |
291 | int i; | ||
292 | |||
293 | if (pci_is_root_bus(child)) /* It's a host bus, nothing to read */ | ||
294 | return; | ||
295 | |||
296 | dev_info(&dev->dev, "PCI bridge to [bus %02x-%02x]%s\n", | ||
297 | child->secondary, child->subordinate, | ||
298 | dev->transparent ? " (subtractive decode)": ""); | ||
299 | |||
300 | if (dev->transparent) { | ||
301 | for(i = 3; i < PCI_BUS_NUM_RESOURCES; i++) | ||
302 | child->resource[i] = child->parent->resource[i - 3]; | ||
303 | } | ||
304 | 290 | ||
305 | res = child->resource[0]; | 291 | res = child->resource[0]; |
306 | pci_read_config_byte(dev, PCI_IO_BASE, &io_base_lo); | 292 | pci_read_config_byte(dev, PCI_IO_BASE, &io_base_lo); |
@@ -328,6 +314,14 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) | |||
328 | " bridge window [io %04lx - %04lx] reg reading\n", | 314 | " bridge window [io %04lx - %04lx] reg reading\n", |
329 | base, limit); | 315 | base, limit); |
330 | } | 316 | } |
317 | } | ||
318 | |||
319 | static void __devinit pci_read_bridge_mmio(struct pci_bus *child) | ||
320 | { | ||
321 | struct pci_dev *dev = child->self; | ||
322 | u16 mem_base_lo, mem_limit_lo; | ||
323 | unsigned long base, limit; | ||
324 | struct resource *res; | ||
331 | 325 | ||
332 | res = child->resource[1]; | 326 | res = child->resource[1]; |
333 | pci_read_config_word(dev, PCI_MEMORY_BASE, &mem_base_lo); | 327 | pci_read_config_word(dev, PCI_MEMORY_BASE, &mem_base_lo); |
@@ -344,6 +338,14 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) | |||
344 | " bridge window [mem 0x%08lx - 0x%08lx] reg reading\n", | 338 | " bridge window [mem 0x%08lx - 0x%08lx] reg reading\n", |
345 | base, limit + 0xfffff); | 339 | base, limit + 0xfffff); |
346 | } | 340 | } |
341 | } | ||
342 | |||
343 | static void __devinit pci_read_bridge_mmio_pref(struct pci_bus *child) | ||
344 | { | ||
345 | struct pci_dev *dev = child->self; | ||
346 | u16 mem_base_lo, mem_limit_lo; | ||
347 | unsigned long base, limit; | ||
348 | struct resource *res; | ||
347 | 349 | ||
348 | res = child->resource[2]; | 350 | res = child->resource[2]; |
349 | pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); | 351 | pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); |
@@ -389,6 +391,28 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) | |||
389 | } | 391 | } |
390 | } | 392 | } |
391 | 393 | ||
394 | void __devinit pci_read_bridge_bases(struct pci_bus *child) | ||
395 | { | ||
396 | struct pci_dev *dev = child->self; | ||
397 | int i; | ||
398 | |||
399 | if (pci_is_root_bus(child)) /* It's a host bus, nothing to read */ | ||
400 | return; | ||
401 | |||
402 | dev_info(&dev->dev, "PCI bridge to [bus %02x-%02x]%s\n", | ||
403 | child->secondary, child->subordinate, | ||
404 | dev->transparent ? " (subtractive decode)" : ""); | ||
405 | |||
406 | if (dev->transparent) { | ||
407 | for (i = 3; i < PCI_BUS_NUM_RESOURCES; i++) | ||
408 | child->resource[i] = child->parent->resource[i - 3]; | ||
409 | } | ||
410 | |||
411 | pci_read_bridge_io(child); | ||
412 | pci_read_bridge_mmio(child); | ||
413 | pci_read_bridge_mmio_pref(child); | ||
414 | } | ||
415 | |||
392 | static struct pci_bus * pci_alloc_bus(void) | 416 | static struct pci_bus * pci_alloc_bus(void) |
393 | { | 417 | { |
394 | struct pci_bus *b; | 418 | struct pci_bus *b; |