Commit cfdc6fa2 authored by Yaacov Akiba Slama's avatar Yaacov Akiba Slama Committed by Dave Jones

[PATCH] fix cardbus/hotplugging

The pci_enable_device() function will fail at least on i386 (see
arch/i386/pci/i386.c: pcibios_enable_resource (line 260)) if the
resources have not been assigned previously.  Hence the ostensible
resource collisions.

I added a small comment (and modified another) so future janitors won't
move pci_enable above pci_assign_resource again.
parent 3d69b1eb
......@@ -285,25 +285,29 @@ int cb_alloc(socket_info_t * s)
dev->dev.dma_mask = &dev->dma_mask;
pci_setup_device(dev);
if (pci_enable_device(dev))
continue;
strcpy(dev->dev.bus_id, dev->slot_name);
/* FIXME: Do we need to enable the expansion ROM? */
/* We need to assign resources for expansion ROM. */
for (r = 0; r < 7; r++) {
struct resource *res = dev->resource + r;
if (res->flags)
if (!res->start && res->end)
pci_assign_resource(dev, r);
}
/* Does this function have an interrupt at all? */
pci_readb(dev, PCI_INTERRUPT_PIN, &irq_pin);
if (irq_pin) {
if (irq_pin)
dev->irq = irq;
pci_writeb(dev, PCI_INTERRUPT_LINE, irq);
}
/* pci_enable_device needs to be called after pci_assign_resource */
/* because it returns an error if (!res->start && res->end). */
if (pci_enable_device(dev))
continue;
if (irq_pin)
pci_writeb(dev, PCI_INTERRUPT_LINE, irq);
device_register(&dev->dev);
pci_insert_device(dev, bus);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment