Пример #1
0
void __init
pcibios_fixup_bus(struct pci_bus *b)
{
	struct list_head *ln;
	struct pci_dev *d;
	struct resource *res;
	int pos, size;
	u32 *base;
	u8 irq;

	printk("PCI: Fixing up bus %d\n", b->number);

	/* Fix up SB */
	if (b->number == 0) {
		for (ln = b->devices.next; ln != &b->devices; ln = ln->next) {
			d = pci_dev_b(ln);
			/* Fix up interrupt lines */
			pci_read_config_byte(d, PCI_INTERRUPT_LINE, &irq);
			d->irq = irq + 2;
			pci_write_config_byte(d, PCI_INTERRUPT_LINE, d->irq);
		}
	}

	/* Fix up external PCI */
	else {
		for (ln = b->devices.next; ln != &b->devices; ln = ln->next) {
			d = pci_dev_b(ln);
			/* Fix up resource bases */
			for (pos = 0; pos < 6; pos++) {
				res = &d->resource[pos];
				base = (res->flags & IORESOURCE_IO) ? &pci_iobase : ((b->number == 2) ? &pcmcia_membase : &pci_membase);
				if (res->end) {
					size = res->end - res->start + 1;
					if (*base & (size - 1))
						*base = (*base + size) & ~(size - 1);
					res->start = *base;
					res->end = res->start + size - 1;
					*base += size;
					pci_write_config_dword(d,
						PCI_BASE_ADDRESS_0 + (pos << 2), res->start);
				}
				/* Fix up PCI bridge BAR0 only */
				if (b->number == 1 && PCI_SLOT(d->devfn) == 0)
					break;
			}
			/* Fix up interrupt lines */
			if (pci_find_device(VENDOR_BROADCOM, SB_PCI, NULL))
				d->irq = (pci_find_device(VENDOR_BROADCOM, SB_PCI, NULL))->irq;
			pci_write_config_byte(d, PCI_INTERRUPT_LINE, d->irq);
		}
	}
}
Пример #2
0
static int pci_visit_bus (struct pci_visit * fn, struct pci_bus_wrapped *wrapped_bus, struct pci_dev_wrapped *wrapped_parent)
{
	struct list_head *ln;
	struct pci_dev *dev;
	struct pci_dev_wrapped wrapped_dev;
	int result = 0;

	DBG("scanning bus %02x\n", wrapped_bus->bus->number);

	if (fn->pre_visit_pci_bus) {
		result = fn->pre_visit_pci_bus(wrapped_bus, wrapped_parent);
		if (result)
			return result;
	}

	ln = wrapped_bus->bus->devices.next; 
	while (ln != &wrapped_bus->bus->devices) {
		dev = pci_dev_b(ln);
		ln = ln->next;

		memset(&wrapped_dev, 0, sizeof(struct pci_dev_wrapped));
		wrapped_dev.dev = dev;

		result = pci_visit_dev(fn, &wrapped_dev, wrapped_bus);
		if (result)
			return result;
	}

	if (fn->post_visit_pci_bus)
		result = fn->post_visit_pci_bus(wrapped_bus, wrapped_parent);

	return result;
}
Пример #3
0
/*
 *  Called after each bus is probed, but before its children are examined.
 */
void __devinit
pcibios_fixup_bus (struct pci_bus *b)
{
	struct list_head *ln;

	for (ln = b->devices.next; ln != &b->devices; ln = ln->next)
		pcibios_fixup_device_resources(pci_dev_b(ln), b);
}
Пример #4
0
static void bcm947xx_fixup(struct pci_dev *d)
{
	struct pci_bus *b;
	struct list_head *ln;
	struct resource *res;
	int pos, size;
	u32 *base;

	b = d->bus;

	/* Fix up external PCI */
	if (b->number != 0) {
		for (ln = b->devices.next; ln != &b->devices;
		     ln = ln->next) {
			d = pci_dev_b(ln);
			/* Fix up resource bases */
			for (pos = 0; pos < 4; pos++) {
				res = &d->resource[pos];
				base =
				    (res->
				     flags & IORESOURCE_IO) ? &pci_iobase :
				    &pci_membase;
				if (res->end) {
					size = res->end - res->start + 1;
					if (*base & (size - 1))
						*base =
						    (*base +
						     size) & ~(size - 1);
					res->start = *base;
					res->end = res->start + size - 1;
					*base += size;
					pci_write_config_dword(d,
							       PCI_BASE_ADDRESS_0
							       +
							       (pos << 2),
							       res->start);
				}
				/* Fix up PCI bridge BAR0 only */
				if (b->number == 1
				    && PCI_SLOT(d->devfn) == 0)
					break;
			}
			/* Fix up interrupt lines */
			if (pci_find_device(VENDOR_BROADCOM, SB_PCI, NULL))
				d->irq =
				    (pci_find_device
				     (VENDOR_BROADCOM, SB_PCI, NULL))->irq;
			pci_write_config_byte(d, PCI_INTERRUPT_LINE,
					      d->irq);
		}
	}
}
Пример #5
0
void __init pcibios_fixup_bus(struct pci_bus *bus)
{
	struct list_head *ln;
	struct pci_dev *dev;

	for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {
		dev = pci_dev_b(ln);
		if (!BBA_SELECTED(bus, dev->devfn)) continue;

		printk("PCI: MMIO fixup to %s\n", dev->dev.name);
		dev->resource[1].start=0x01001700;
		dev->resource[1].end=0x010017ff;
	}
}
Пример #6
0
#include <linux/kernel.h>
#include <linux/init.h>
#include <asm/pci.h>

/*
 * HT Bus fixup for the Titan
 * XXX IRQ values need to change based on the board layout
 */
void __init titan_ht_pcibios_fixup_bus(struct pci_bus *bus)
{
<<<<<<< HEAD
=======
<<<<<<< HEAD
=======
	struct pci_bus *current_bus = bus;
	struct pci_dev *devices;
	struct list_head *devices_link;

	list_for_each(devices_link, &(current_bus->devices)) {
		devices = pci_dev_b(devices_link);
		if (devices == NULL)
			continue;
	}

>>>>>>> 58a75b6a81be54a8b491263ca1af243e9d8617b9
>>>>>>> ae1773bb70f3d7cf73324ce8fba787e01d8fa9f2
	/*
	 * PLX and SPKT related changes go here
	 */
}
Пример #7
0
static int get_device_info(int i, bind_info_t *bind_info, int first)
{
    socket_info_t *s = &socket_table[i];
    socket_bind_t *b;
    dev_node_t *node;

#ifdef CONFIG_CARDBUS
    /*
     * Some unbelievably ugly code to associate the PCI cardbus
     * device and its driver with the PCMCIA "bind" information.
     */
    {
	struct pci_bus *bus;

	bus = pcmcia_lookup_bus(s->handle);
	if (bus) {
	    	struct list_head *list;
		struct pci_dev *dev = NULL;
		
		list = bus->devices.next;
		while (list != &bus->devices) {
			struct pci_dev *pdev = pci_dev_b(list);
			list = list->next;

			if (first) {
				dev = pdev;
				break;
			}

			/* Try to handle "next" here some way? */
		}
		if (dev && dev->driver) {
			strncpy(bind_info->name, dev->driver->name, DEV_NAME_LEN);
			bind_info->name[DEV_NAME_LEN-1] = '\0';
			bind_info->major = 0;
			bind_info->minor = 0;
			bind_info->next = NULL;
			return 0;
		}
	}
    }
#endif

    for (b = s->bind; b; b = b->next)
	if ((strcmp((char *)b->driver->dev_info,
		    (char *)bind_info->dev_info) == 0) &&
	    (b->function == bind_info->function))
	    break;
    if (b == NULL) return -ENODEV;
    if ((b->instance == NULL) ||
	(b->instance->state & DEV_CONFIG_PENDING))
	return -EAGAIN;
    if (first)
	node = b->instance->dev;
    else
	for (node = b->instance->dev; node; node = node->next)
	    if (node == bind_info->next) break;
    if (node == NULL) return -ENODEV;

    strncpy(bind_info->name, node->dev_name, DEV_NAME_LEN);
    bind_info->name[DEV_NAME_LEN-1] = '\0';
    bind_info->major = node->major;
    bind_info->minor = node->minor;
    bind_info->next = node->next;
    
    return 0;
} /* get_device_info */