RFC: ncr53c8xx fix for 2.3

Russell Kroll (rkroll@exploits.org)
Tue, 12 Oct 1999 12:13:22 -0600


The ncr53c8xx driver quit finding my adapter around 2.3.15. It turns out
that the driver was just fine, and the kernel wasn't building the list of
PCI devices properly. In the 2.3.15 patch, a bunch of code got swapped
around in arch/i386/bios/kernel/bios32.c, like this:

The old way before 2.3.15:

if (device_fn & 0x80)
return PCIBIOS_DEVICE_NOT_FOUND;
outb (FUNC(device_fn), 0xCF8);
outb (bus, 0xCFA);

The new way after 2.3.15:

#define SET(dev) if (dev->devfn) return PCIBIOS_DEVICE_NOT_FOUND; \
outb(FUNC(dev->devfn), 0xCF8); \
outb(dev->bus->number, 0xCFA);

Basically those 4 lines up in the "old way" were all replaced by SET(dev)
macro calls in about 6 functions.

Maybe it's just me, but (dev->devfn) != (dev->devfn & 0x80)... Miss that
& and you hit that return for every device other than the first one (#0)!

So, here's the patch that works for me (tm) and makes the SCSI adapter
(among others) show up again. The "RFC" is to get some input from those
in the know... am I breaking something fundamental by "fixing" it this
way, or was the 2.3.15 patch which introduced SET() just broken?

This is against 2.3.20.

--- linux/arch/i386/kernel/pci-pc.c.stock Tue Oct 12 10:50:47 1999
+++ linux/arch/i386/kernel/pci-pc.c Tue Oct 12 11:00:20 1999
@@ -120,7 +120,7 @@

#define IOADDR(devfn, where) ((0xC000 | ((devfn & 0x78) << 5)) + where)
#define FUNC(devfn) (((devfn & 7) << 1) | 0xf0)
-#define SET(dev) if (dev->devfn) return PCIBIOS_DEVICE_NOT_FOUND; \
+#define SET(dev) if (dev->devfn & 0x80) return PCIBIOS_DEVICE_NOT_FOUND; \
outb(FUNC(dev->devfn), 0xCF8); \
outb(dev->bus->number, 0xCFA);

-
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/