diff options
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r-- | drivers/pci/probe.c | 68 |
1 files changed, 20 insertions, 48 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index cce2f4cb1fbf..dd9161a054e1 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -304,6 +304,9 @@ static int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
304 | } else { | 304 | } else { |
305 | res->start = l64; | 305 | res->start = l64; |
306 | res->end = l64 + sz64; | 306 | res->end = l64 + sz64; |
307 | printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n", | ||
308 | pci_name(dev), pos, (unsigned long long)res->start, | ||
309 | (unsigned long long)res->end); | ||
307 | } | 310 | } |
308 | } else { | 311 | } else { |
309 | sz = pci_size(l, sz, mask); | 312 | sz = pci_size(l, sz, mask); |
@@ -313,6 +316,9 @@ static int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
313 | 316 | ||
314 | res->start = l; | 317 | res->start = l; |
315 | res->end = l + sz; | 318 | res->end = l + sz; |
319 | printk(KERN_DEBUG "PCI: %s reg %x %s: [%llx, %llx]\n", pci_name(dev), | ||
320 | pos, (res->flags & IORESOURCE_IO) ? "io port":"32bit mmio", | ||
321 | (unsigned long long)res->start, (unsigned long long)res->end); | ||
316 | } | 322 | } |
317 | 323 | ||
318 | out: | 324 | out: |
@@ -383,7 +389,9 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) | |||
383 | res->start = base; | 389 | res->start = base; |
384 | if (!res->end) | 390 | if (!res->end) |
385 | res->end = limit + 0xfff; | 391 | res->end = limit + 0xfff; |
386 | printk(KERN_INFO "PCI: bridge %s io port: [%llx, %llx]\n", pci_name(dev), res->start, res->end); | 392 | printk(KERN_DEBUG "PCI: bridge %s io port: [%llx, %llx]\n", |
393 | pci_name(dev), (unsigned long long) res->start, | ||
394 | (unsigned long long) res->end); | ||
387 | } | 395 | } |
388 | 396 | ||
389 | res = child->resource[1]; | 397 | res = child->resource[1]; |
@@ -395,7 +403,9 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) | |||
395 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; | 403 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; |
396 | res->start = base; | 404 | res->start = base; |
397 | res->end = limit + 0xfffff; | 405 | res->end = limit + 0xfffff; |
398 | printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%llx, %llx]\n", pci_name(dev), res->start, res->end); | 406 | printk(KERN_DEBUG "PCI: bridge %s 32bit mmio: [%llx, %llx]\n", |
407 | pci_name(dev), (unsigned long long) res->start, | ||
408 | (unsigned long long) res->end); | ||
399 | } | 409 | } |
400 | 410 | ||
401 | res = child->resource[2]; | 411 | res = child->resource[2]; |
@@ -431,7 +441,9 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) | |||
431 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH; | 441 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH; |
432 | res->start = base; | 442 | res->start = base; |
433 | res->end = limit + 0xfffff; | 443 | res->end = limit + 0xfffff; |
434 | printk(KERN_INFO "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n", pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64)?"64":"32",res->start, res->end); | 444 | printk(KERN_DEBUG "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n", |
445 | pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64) ? "64" : "32", | ||
446 | (unsigned long long) res->start, (unsigned long long) res->end); | ||
435 | } | 447 | } |
436 | } | 448 | } |
437 | 449 | ||
@@ -1225,8 +1237,11 @@ EXPORT_SYMBOL(pci_scan_bridge); | |||
1225 | EXPORT_SYMBOL_GPL(pci_scan_child_bus); | 1237 | EXPORT_SYMBOL_GPL(pci_scan_child_bus); |
1226 | #endif | 1238 | #endif |
1227 | 1239 | ||
1228 | static int __init pci_sort_bf_cmp(const struct pci_dev *a, const struct pci_dev *b) | 1240 | static int __init pci_sort_bf_cmp(const struct device *d_a, const struct device *d_b) |
1229 | { | 1241 | { |
1242 | const struct pci_dev *a = to_pci_dev(d_a); | ||
1243 | const struct pci_dev *b = to_pci_dev(d_b); | ||
1244 | |||
1230 | if (pci_domain_nr(a->bus) < pci_domain_nr(b->bus)) return -1; | 1245 | if (pci_domain_nr(a->bus) < pci_domain_nr(b->bus)) return -1; |
1231 | else if (pci_domain_nr(a->bus) > pci_domain_nr(b->bus)) return 1; | 1246 | else if (pci_domain_nr(a->bus) > pci_domain_nr(b->bus)) return 1; |
1232 | 1247 | ||
@@ -1239,50 +1254,7 @@ static int __init pci_sort_bf_cmp(const struct pci_dev *a, const struct pci_dev | |||
1239 | return 0; | 1254 | return 0; |
1240 | } | 1255 | } |
1241 | 1256 | ||
1242 | /* | ||
1243 | * Yes, this forcably breaks the klist abstraction temporarily. It | ||
1244 | * just wants to sort the klist, not change reference counts and | ||
1245 | * take/drop locks rapidly in the process. It does all this while | ||
1246 | * holding the lock for the list, so objects can't otherwise be | ||
1247 | * added/removed while we're swizzling. | ||
1248 | */ | ||
1249 | static void __init pci_insertion_sort_klist(struct pci_dev *a, struct list_head *list) | ||
1250 | { | ||
1251 | struct list_head *pos; | ||
1252 | struct klist_node *n; | ||
1253 | struct device *dev; | ||
1254 | struct pci_dev *b; | ||
1255 | |||
1256 | list_for_each(pos, list) { | ||
1257 | n = container_of(pos, struct klist_node, n_node); | ||
1258 | dev = container_of(n, struct device, knode_bus); | ||
1259 | b = to_pci_dev(dev); | ||
1260 | if (pci_sort_bf_cmp(a, b) <= 0) { | ||
1261 | list_move_tail(&a->dev.knode_bus.n_node, &b->dev.knode_bus.n_node); | ||
1262 | return; | ||
1263 | } | ||
1264 | } | ||
1265 | list_move_tail(&a->dev.knode_bus.n_node, list); | ||
1266 | } | ||
1267 | |||
1268 | void __init pci_sort_breadthfirst(void) | 1257 | void __init pci_sort_breadthfirst(void) |
1269 | { | 1258 | { |
1270 | LIST_HEAD(sorted_devices); | 1259 | bus_sort_breadthfirst(&pci_bus_type, &pci_sort_bf_cmp); |
1271 | struct list_head *pos, *tmp; | ||
1272 | struct klist_node *n; | ||
1273 | struct device *dev; | ||
1274 | struct pci_dev *pdev; | ||
1275 | struct klist *device_klist; | ||
1276 | |||
1277 | device_klist = bus_get_device_klist(&pci_bus_type); | ||
1278 | |||
1279 | spin_lock(&device_klist->k_lock); | ||
1280 | list_for_each_safe(pos, tmp, &device_klist->k_list) { | ||
1281 | n = container_of(pos, struct klist_node, n_node); | ||
1282 | dev = container_of(n, struct device, knode_bus); | ||
1283 | pdev = to_pci_dev(dev); | ||
1284 | pci_insertion_sort_klist(pdev, &sorted_devices); | ||
1285 | } | ||
1286 | list_splice(&sorted_devices, &device_klist->k_list); | ||
1287 | spin_unlock(&device_klist->k_lock); | ||
1288 | } | 1260 | } |