Пример #1
0
/*
 * Discover remaining PCI buses in case there are peer host bridges.
 * We use the number of last PCI bus provided by the PCI BIOS.
 */
static void __devinit pcibios_fixup_peer_bridges(void)
{
    int n, devfn;
    long node;

    if (pcibios_last_bus <= 0 || pcibios_last_bus >= 0xff)
        return;
    DBG("PCI: Peer bridge fixup\n");

    for (n=0; n <= pcibios_last_bus; n++) {
        u32 l;
        if (pci_find_bus(0, n))
            continue;
        node = get_mp_bus_to_node(n);
        for (devfn = 0; devfn < 256; devfn += 8) {
            if (!raw_pci_read(0, n, devfn, PCI_VENDOR_ID, 2, &l) &&
                l != 0x0000 && l != 0xffff) {
                DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l);
                printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n);
                pci_scan_bus_on_node(n, &pci_root_ops, node);
                break;
            }
        }
    }
}
Пример #2
0
static void __init pirq_peer_trick(void)
{
	struct irq_routing_table *rt = pirq_table;
	u8 busmap[256];
	int i;
	struct irq_info *e;

	memset(busmap, 0, sizeof(busmap));
	for (i = 0; i < (rt->size - sizeof(struct irq_routing_table)) / sizeof(struct irq_info); i++) {
		e = &rt->slots[i];
#ifdef DEBUG
		{
			int j;
			DBG(KERN_DEBUG "%02x:%02x slot=%02x", e->bus, e->devfn/8, e->slot);
			for (j = 0; j < 4; j++)
				DBG(" %d:%02x/%04x", j, e->irq[j].link, e->irq[j].bitmap);
			DBG("\n");
		}
#endif
		busmap[e->bus] = 1;
	}
	for (i = 1; i < 256; i++) {
		int node;
		if (!busmap[i] || pci_find_bus(0, i))
			continue;
		node = get_mp_bus_to_node(i);
		if (pci_scan_bus_on_node(i, &pci_root_ops, node))
			printk(KERN_INFO "PCI: Discovered primary peer "
			       "bus %02x [IRQ]\n", i);
	}
	pcibios_last_bus = -1;
}
Пример #3
0
struct pci_bus * __devinit pcibios_scan_root(int busnum)
{
	struct pci_bus *bus = NULL;

	while ((bus = pci_find_next_bus(bus)) != NULL) {
		if (bus->number == busnum) {
			/* Already scanned */
			return bus;
		}
	}

	return pci_scan_bus_on_node(busnum, &pci_root_ops,
					get_mp_bus_to_node(busnum));
}
Пример #4
0
void __devinit pcibios_scan_specific_bus(int busn)
{
	int devfn;
	long node;
	u32 l;

	if (pci_find_bus(0, busn))
		return;

	node = get_mp_bus_to_node(busn);
	for (devfn = 0; devfn < 256; devfn += 8) {
		if (!raw_pci_read(0, busn, devfn, PCI_VENDOR_ID, 2, &l) &&
		    l != 0x0000 && l != 0xffff) {
			DBG("Found device at %02x:%02x [%04x]\n", busn, devfn, l);
			printk(KERN_INFO "PCI: Discovered peer bus %02x\n", busn);
			pci_scan_bus_on_node(busn, &pci_root_ops, node);
			return;
		}
	}
}