setup-bus.c (d366d28cd1325f11d582ec6d4a14b8329d3e1a20) setup-bus.c (765bf9b739731b925ca26a8f05765b87f2bd9724)
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 *

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

690 pci_setup_bridge_mmio(bridge);
691
692 if (type & IORESOURCE_PREFETCH)
693 pci_setup_bridge_mmio_pref(bridge);
694
695 pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, bus->bridge_ctl);
696}
697
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 *

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

690 pci_setup_bridge_mmio(bridge);
691
692 if (type & IORESOURCE_PREFETCH)
693 pci_setup_bridge_mmio_pref(bridge);
694
695 pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, bus->bridge_ctl);
696}
697
698void __weak pcibios_setup_bridge(struct pci_bus *bus, unsigned long type)
699{
700}
701
702void pci_setup_bridge(struct pci_bus *bus)
703{
704 unsigned long type = IORESOURCE_IO | IORESOURCE_MEM |
705 IORESOURCE_PREFETCH;
706
698void pci_setup_bridge(struct pci_bus *bus)
699{
700 unsigned long type = IORESOURCE_IO | IORESOURCE_MEM |
701 IORESOURCE_PREFETCH;
702
707 pcibios_setup_bridge(bus, type);
708 __pci_setup_bridge(bus, type);
709}
710
711
712int pci_claim_bridge_resource(struct pci_dev *bridge, int i)
713{
714 if (i < PCI_BRIDGE_RESOURCES || i > PCI_BRIDGE_RESOURCE_END)
715 return 0;

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

1423}
1424
1425void pci_bus_assign_resources(const struct pci_bus *bus)
1426{
1427 __pci_bus_assign_resources(bus, NULL, NULL);
1428}
1429EXPORT_SYMBOL(pci_bus_assign_resources);
1430
703 __pci_setup_bridge(bus, type);
704}
705
706
707int pci_claim_bridge_resource(struct pci_dev *bridge, int i)
708{
709 if (i < PCI_BRIDGE_RESOURCES || i > PCI_BRIDGE_RESOURCE_END)
710 return 0;

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

1418}
1419
1420void pci_bus_assign_resources(const struct pci_bus *bus)
1421{
1422 __pci_bus_assign_resources(bus, NULL, NULL);
1423}
1424EXPORT_SYMBOL(pci_bus_assign_resources);
1425
1426static void pci_claim_device_resources(struct pci_dev *dev)
1427{
1428 int i;
1429
1430 for (i = 0; i < PCI_BRIDGE_RESOURCES; i++) {
1431 struct resource *r = &dev->resource[i];
1432
1433 if (!r->flags || r->parent)
1434 continue;
1435
1436 pci_claim_resource(dev, i);
1437 }
1438}
1439
1440static void pci_claim_bridge_resources(struct pci_dev *dev)
1441{
1442 int i;
1443
1444 for (i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) {
1445 struct resource *r = &dev->resource[i];
1446
1447 if (!r->flags || r->parent)
1448 continue;
1449
1450 pci_claim_bridge_resource(dev, i);
1451 }
1452}
1453
1454static void pci_bus_allocate_dev_resources(struct pci_bus *b)
1455{
1456 struct pci_dev *dev;
1457 struct pci_bus *child;
1458
1459 list_for_each_entry(dev, &b->devices, bus_list) {
1460 pci_claim_device_resources(dev);
1461
1462 child = dev->subordinate;
1463 if (child)
1464 pci_bus_allocate_dev_resources(child);
1465 }
1466}
1467
1468static void pci_bus_allocate_resources(struct pci_bus *b)
1469{
1470 struct pci_bus *child;
1471
1472 /*
1473 * Carry out a depth-first search on the PCI bus
1474 * tree to allocate bridge apertures. Read the
1475 * programmed bridge bases and recursively claim
1476 * the respective bridge resources.
1477 */
1478 if (b->self) {
1479 pci_read_bridge_bases(b);
1480 pci_claim_bridge_resources(b->self);
1481 }
1482
1483 list_for_each_entry(child, &b->children, node)
1484 pci_bus_allocate_resources(child);
1485}
1486
1487void pci_bus_claim_resources(struct pci_bus *b)
1488{
1489 pci_bus_allocate_resources(b);
1490 pci_bus_allocate_dev_resources(b);
1491}
1492EXPORT_SYMBOL(pci_bus_claim_resources);
1493
1431static void __pci_bridge_assign_resources(const struct pci_dev *bridge,
1432 struct list_head *add_head,
1433 struct list_head *fail_head)
1434{
1435 struct pci_bus *b;
1436
1437 pdev_assign_resources_sorted((struct pci_dev *)bridge,
1438 add_head, fail_head);

--- 429 unchanged lines hidden ---
1494static void __pci_bridge_assign_resources(const struct pci_dev *bridge,
1495 struct list_head *add_head,
1496 struct list_head *fail_head)
1497{
1498 struct pci_bus *b;
1499
1500 pdev_assign_resources_sorted((struct pci_dev *)bridge,
1501 add_head, fail_head);

--- 429 unchanged lines hidden ---