Re: small PCI probe patch for odd 64 bit BARs

From: Tim Hockin
Date: Thu Nov 11 2004 - 12:58:19 EST


On Thu, Nov 11, 2004 at 09:22:21AM -0800, Greg KH wrote:
> On Wed, Nov 10, 2004 at 08:48:09PM -0800, Tim Hockin wrote:
> > The current PCI probe code breaks for 64 bit BARs that do not decode a
> > full 64 bits. Example:
> >
> > We have a device that uses a 64 bit BAR. When you write all Fs to the
> > BARs, you get:
> >
> > 000000ff ffff0000
> >
> > It wants 64k, in the first TB of RAM. The current code totally borks on
> > this.
> >
> > Simple patch against 2.6.9:
>
> As Andrew pointed out, you didn't even compile test this patch, not nice.

Yeah, I sent the 2.4 patch and called it 2.6, bny mistake. The one that
actually came out of the 2.6.9 tree here was sent a few minutes ago, and
here again.

I was in a rush, I screwed up. This version has been compile tested,
and run tested under 2.4.

Sorry, again.



--- linux-2.6.9/drivers/pci/probe.c.orig 2004-11-10 20:42:03.000000000 -0800
+++ linux-2.6.9/drivers/pci/probe.c 2004-11-11 09:30:07.000000000 -0800
@@ -144,9 +144,11 @@
pci_write_config_dword(dev, reg+4, ~0);
pci_read_config_dword(dev, reg+4, &sz);
pci_write_config_dword(dev, reg+4, l);
- if (~sz)
- res->end = res->start + 0xffffffff +
- (((unsigned long) ~sz) << 32);
+ sz = pci_size(l, sz, 0xffffffff);
+ if (sz) {
+ /* This BAR needs > 4GB? Wow. */
+ res->end |= (unsigned long)sz<<32;
+ }
#else
if (l) {
printk(KERN_ERR "PCI: Unable to handle 64-bit address for device %s\n", pci_name(dev));
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/