Re: 2.4.0-test6 -- Problem with PCI -- Error while updating region 01:00.0/1 (10800000 != 00000000)

From: Linus Torvalds (torvalds@transmeta.com)
Date: Fri Aug 11 2000 - 12:34:03 EST


In article <3993A520.70D8B62D@speakeasy.org> you write:
>I am including the dmesg output and "lspci -vv" output.
>
>PCI: Enabling device 00:04.0 (0000 -> 0002)
>PCI: Assigned IRQ 11 for device 00:04.0
>PCI: Enabling device 00:04.1 (0000 -> 0002)
>PCI: Assigned IRQ 11 for device 00:04.1
>Yenta IRQ list 0298, PCI irq11
>Socket status: 30000020
>Yenta IRQ list 0298, PCI irq11
>Socket status: 30000059
>usb.c: registered new driver hid
>mice: PS/2 mouse device common for all mice
>usb.c: registered new driver usb-storage
>USB Mass Storage support registered.
>cs: cb_alloc(bus 1): vendor 0x1045, device 0xc861
>PCI: Error while updating region 01:00.0/1 (10800000 != 00000000)

There's a silly thinko in the pre6 pci-area allocation: it will use the
_bus_ resource number instead of the _device_ resource number to update
the device resource region setting. Which is wrong. Really wrong.

This simple patch should fix it.

                Linus

-----
diff -u --recursive --new-file v2.4.0-test6/linux/drivers/pci/setup-res.c linux/drivers/pci/setup-res.c
--- v2.4.0-test6/linux/drivers/pci/setup-res.c Wed Aug 9 19:19:50 2000
+++ linux/drivers/pci/setup-res.c Thu Aug 10 15:19:40 2000
@@ -60,7 +60,8 @@
         struct resource *res,
         unsigned long size,
         unsigned long min,
- unsigned int type_mask)
+ unsigned int type_mask,
+ int resno)
 {
         int i;
 
@@ -83,7 +84,7 @@
                         continue;
 
                 /* Update PCI config space. */
- pcibios_update_resource(dev, r, res, i);
+ pcibios_update_resource(dev, r, res, resno);
                 return 0;
         }
         return -EBUSY;
@@ -100,14 +101,14 @@
         min = (res->flags & IORESOURCE_IO) ? PCIBIOS_MIN_IO : PCIBIOS_MIN_MEM;
 
         /* First, try exact prefetching match.. */
- if (pci_assign_bus_resource(bus, dev, res, size, min, IORESOURCE_PREFETCH) < 0) {
+ if (pci_assign_bus_resource(bus, dev, res, size, min, IORESOURCE_PREFETCH, i) < 0) {
                 /*
                  * That failed.
                  *
                  * But a prefetching area can handle a non-prefetching
                  * window (it will just not perform as well).
                  */
- if (!(res->flags & IORESOURCE_PREFETCH) || pci_assign_bus_resource(bus, dev, res, size, min, 0) < 0) {
+ if (!(res->flags & IORESOURCE_PREFETCH) || pci_assign_bus_resource(bus, dev, res, size, min, 0, i) < 0) {
                         printk(KERN_ERR "PCI: Failed to allocate resource %d for %s\n", i, dev->name);
                         return -EBUSY;
                 }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:24 EST