setup-bus.c (a2220d804bf09aae4da45dfd6cc6692e0e422926) setup-bus.c (d04d0111c7701cb7c696216b0af707f4e327ad11)
1/*
2 * drivers/pci/setup-bus.c
3 *
4 * Extruded from code written by
5 * Dave Rusling (david.rusling@reo.mts.dec.com)
6 * David Mosberger (davidm@cs.arizona.edu)
7 * David Miller (davem@redhat.com)
8 *

--- 1327 unchanged lines hidden (view full) ---

1336}
1337
1338void pci_bus_size_bridges(struct pci_bus *bus)
1339{
1340 __pci_bus_size_bridges(bus, NULL);
1341}
1342EXPORT_SYMBOL(pci_bus_size_bridges);
1343
1/*
2 * drivers/pci/setup-bus.c
3 *
4 * Extruded from code written by
5 * Dave Rusling (david.rusling@reo.mts.dec.com)
6 * David Mosberger (davidm@cs.arizona.edu)
7 * David Miller (davem@redhat.com)
8 *

--- 1327 unchanged lines hidden (view full) ---

1336}
1337
1338void pci_bus_size_bridges(struct pci_bus *bus)
1339{
1340 __pci_bus_size_bridges(bus, NULL);
1341}
1342EXPORT_SYMBOL(pci_bus_size_bridges);
1343
1344static void assign_fixed_resource_on_bus(struct pci_bus *b, struct resource *r)
1345{
1346 int i;
1347 struct resource *parent_r;
1348 unsigned long mask = IORESOURCE_IO | IORESOURCE_MEM |
1349 IORESOURCE_PREFETCH;
1350
1351 pci_bus_for_each_resource(b, parent_r, i) {
1352 if (!parent_r)
1353 continue;
1354
1355 if ((r->flags & mask) == (parent_r->flags & mask) &&
1356 resource_contains(parent_r, r))
1357 request_resource(parent_r, r);
1358 }
1359}
1360
1361/*
1362 * Try to assign any resources marked as IORESOURCE_PCI_FIXED, as they
1363 * are skipped by pbus_assign_resources_sorted().
1364 */
1365static void pdev_assign_fixed_resources(struct pci_dev *dev)
1366{
1367 int i;
1368
1369 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
1370 struct pci_bus *b;
1371 struct resource *r = &dev->resource[i];
1372
1373 if (r->parent || !(r->flags & IORESOURCE_PCI_FIXED) ||
1374 !(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
1375 continue;
1376
1377 b = dev->bus;
1378 while (b && !r->parent) {
1379 assign_fixed_resource_on_bus(b, r);
1380 b = b->parent;
1381 }
1382 }
1383}
1384
1344void __pci_bus_assign_resources(const struct pci_bus *bus,
1345 struct list_head *realloc_head,
1346 struct list_head *fail_head)
1347{
1348 struct pci_bus *b;
1349 struct pci_dev *dev;
1350
1351 pbus_assign_resources_sorted(bus, realloc_head, fail_head);
1352
1353 list_for_each_entry(dev, &bus->devices, bus_list) {
1385void __pci_bus_assign_resources(const struct pci_bus *bus,
1386 struct list_head *realloc_head,
1387 struct list_head *fail_head)
1388{
1389 struct pci_bus *b;
1390 struct pci_dev *dev;
1391
1392 pbus_assign_resources_sorted(bus, realloc_head, fail_head);
1393
1394 list_for_each_entry(dev, &bus->devices, bus_list) {
1395 pdev_assign_fixed_resources(dev);
1396
1354 b = dev->subordinate;
1355 if (!b)
1356 continue;
1357
1358 __pci_bus_assign_resources(b, realloc_head, fail_head);
1359
1360 switch (dev->class >> 8) {
1361 case PCI_CLASS_BRIDGE_PCI:

--- 459 unchanged lines hidden ---
1397 b = dev->subordinate;
1398 if (!b)
1399 continue;
1400
1401 __pci_bus_assign_resources(b, realloc_head, fail_head);
1402
1403 switch (dev->class >> 8) {
1404 case PCI_CLASS_BRIDGE_PCI:

--- 459 unchanged lines hidden ---