public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* small PCI probe patch for odd 64 bit BARs
@ 2004-11-11  4:48 Tim Hockin
  2004-11-11  5:51 ` Andrew Morton
  2004-11-11 17:22 ` Greg KH
  0 siblings, 2 replies; 8+ messages in thread
From: Tim Hockin @ 2004-11-11  4:48 UTC (permalink / raw)
  To: linux-kernel, greg, akpm

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:

Signed-Off-By: Tim Hockin <thockin@google.com>



--- drivers/pci/probe.c.orig	2004-11-10 20:42:03.000000000 -0800
+++ drivers/pci/probe.c	2004-11-10 20:42: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(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));






^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-11-12 22:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-11  4:48 small PCI probe patch for odd 64 bit BARs Tim Hockin
2004-11-11  5:51 ` Andrew Morton
2004-11-11 17:39   ` Tim Hockin
2004-11-11 17:54     ` Greg KH
2004-11-11 20:58       ` Tim Hockin
2004-11-12 22:02         ` Greg KH
2004-11-11 17:22 ` Greg KH
2004-11-11 17:42   ` Tim Hockin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox