2.3.99-pre3 pcmcia cardbus patch, PCI questions

From: Keith Owens (kaos@ocs.com.au)
Date: Sat Mar 25 2000 - 01:24:44 EST


Finally managed to make 2.3.99-pre3 recognise my Xircom Cardbus
RBEM56G. Turned out the expansion ROM was not being correctly
activated in the PCI code, patch below.

While diagnosing this problem, I spotted a couple of bits of code that
worry me in arch/i386/kernel/pci-i386.c. In pcibios_update_resource,
line 104 we have

        new = res->start | (res->flags & PCI_REGION_FLAG_MASK);

When the region type is I/O, that sets the LSB on the new register
value, e.g. an I/O address of 0x1400 is written to register 0x10 as
0x1401. Is that correct?

pcibios_enable_resources loops from idx = 0 to idx < 6 to work out
which flags to set for PCI_COMMAND. In the unlikely event of a card
which has I/O, no memory but has expansion ROM then PCI_COMMAND will
only be set to PCI_COMMAND_IO, PCI_COMMAND_MEMORY will not be set.
Should enable resources check idx <= 6 instead of id < 6, just in case?

Index: 99-pre3.1/drivers/pcmcia/cardbus.c
--- 99-pre3.1/drivers/pcmcia/cardbus.c Sun, 05 Mar 2000 23:54:54 +1100 keith (linux-2.3/f/c/7_cardbus.c 1.9.1.2 644)
+++ 99-pre3.1(w)/drivers/pcmcia/cardbus.c Sat, 25 Mar 2000 16:48:13 +1100 keith (linux-2.3/f/c/7_cardbus.c 1.9.1.2 644)
@@ -299,12 +299,12 @@
 
                 pci_setup_device(dev);
 
- /* FIXME: Do we need to enable the expansion ROM? */
                 for (r = 0; r < 7; r++) {
                         struct resource *res = dev->resource + r;
                         if (res->flags)
                                 pci_assign_resource(dev, r);
                 }
+ /* This will enable any expansion ROM */
                 pci_enable_device(dev);
 
                 /* Does this function have an interrupt at all? */
Index: 99-pre3.1/arch/i386/kernel/pci-i386.c
--- 99-pre3.1/arch/i386/kernel/pci-i386.c Sun, 19 Mar 2000 13:49:46 +1100 keith (linux-2.3/h/c/14_pci-i386.c 1.7.1.3 644)
+++ 99-pre3.1(w)/arch/i386/kernel/pci-i386.c Sat, 25 Mar 2000 16:51:53 +1100 keith (linux-2.3/h/c/14_pci-i386.c 1.7.1.3 644)
@@ -106,6 +106,7 @@
                 reg = PCI_BASE_ADDRESS_0 + 4*resource;
         } else if (resource == PCI_ROM_RESOURCE) {
                 res->flags |= PCI_ROM_ADDRESS_ENABLE;
+ new |= PCI_ROM_ADDRESS_ENABLE;
                 reg = dev->rom_base_reg;
         } else {
                 /* Somebody might have asked allocation of a non-standard resource */

-
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 : Fri Mar 31 2000 - 21:00:15 EST