--- zzzz-none-000/linux-2.4.17/arch/mips/kernel/pci.c 2001-09-09 17:43:01.000000000 +0000 +++ sangam-fb-322/linux-2.4.17/arch/mips/kernel/pci.c 2004-11-24 13:22:35.000000000 +0000 @@ -99,9 +99,44 @@ pcibios_fixup_irqs(); } +/* + * pciauto_assign_resources() will enable all devices found, so + * pcibios_enable_device() appears redundant. However, there + * are platforms that intentionally make pci_auto skip some + * devices that have default power-up resource assignments that + * can't be modified, so we still need to enable those. + */ int pcibios_enable_device(struct pci_dev *dev) { - /* pciauto_assign_resources() will enable all devices found */ + /* fixme: this function should be present for all boards. + * However, it was too late in the release cycle to enable + * it. We'll enable it later ... + */ +#if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR) + u16 cmd, old_cmd; + int fn; + struct resource *r; + + pci_read_config_word(dev, PCI_COMMAND, &cmd); + old_cmd = cmd; + for (fn = 0; fn < 6; fn++) { + r = &dev->resource[fn]; + if (!r->start && r->end) { + printk(KERN_ERR "PCI: Device %s not available because " + "of resource collisions\n", dev->slot_name); + return -EINVAL; + } + if (r->flags & IORESOURCE_IO) + cmd |= PCI_COMMAND_IO; + if (r->flags & IORESOURCE_MEM) + cmd |= PCI_COMMAND_MEMORY; + } + if (cmd != old_cmd) { + printk("PCI: Enabling device %s (%04x -> %04x)\n", + dev->slot_name, old_cmd, cmd); + pci_write_config_word(dev, PCI_COMMAND, cmd); + } +#endif return 0; }