Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Aug 1998 18:46:04 +0200
From:      Stefan Esser <se@FreeBSD.ORG>
To:        Chris Csanady <cc@tarsier.ca.sandia.gov>, Terry Lambert <tlambert@primenet.com>
Cc:        hackers@FreeBSD.ORG, Stefan Esser <se@FreeBSD.ORG>
Subject:   Re: pci_map_mem() failing..
Message-ID:  <19980803184604.A290@mi.uni-koeln.de>
In-Reply-To: <199807290045.RAA14001@tarsier.ca.sandia.gov>; from Chris Csanady on Tue, Jul 28, 1998 at 05:45:44PM -0700
References:  <199807282224.PAA20070@usr04.primenet.com> <199807290045.RAA14001@tarsier.ca.sandia.gov>

next in thread | previous in thread | raw e-mail | index | archive | help
On 1998-07-28 17:45 -0700, Chris Csanady <cc@tarsier.ca.sandia.gov> wrote:
> Actually, I had a typo and once the above check was fixed, it now works.
> A diff for the 2.2 branch follows.  This is not entirely correct, but
> should work.

I understand this to mean, that you got the attach to work
when that consistency check is removed ?

>         if (!((data & PCI_MAP_MEMORY_TYPE_MASK) == PCI_MAP_MEMORY_TYPE_32BIT_1M
>               && (paddr & ~0xfffff) == 0)
> !           && (data & PCI_MAP_MEMORY_TYPE_MASK) != PCI_MAP_MEMORY_TYPE_32BIT
> !           && (data & PCI_MAP_MEMORY_TYPE_MASK) != PCI_MAP_MEMORY_TYPE_64BIT){
>                 printf ("pci_map_mem failed: bad memory type=0x%x\n",
>                         (unsigned) data);
>                 return (0);

Could you please try the following patch, which will just 
make sure that the high 32 bit of the map register are 0.

This is trivially true, today (or the BIOS was very broken,
but with x86 systems supporting 64 bit PCI address spaces
becoming available, a system might map some card to an 
address beyond 4GB, and the -stable PCI code (and all the
PCI device drivers ;-) won't be able to deal with a card
whose address doesn't fit into 32 bit ...

If this patch works for you (sorry, I can't build a 2.2.x
kernel myself), then I'll commit that patch to -stable.

Regards, STefan



Index: /sys_22/pci/pci.c
===================================================================
RCS file: /usr/cvs/src/sys/pci/pci.c,v
retrieving revision 1.57.2.9
diff -u -2 -r1.57.2.9 pci.c
--- pci.c	1998/07/07 05:24:23	1.57.2.9
+++ pci.c	1998/08/03 16:43:38
@@ -1086,5 +1086,12 @@
 	*/
 
-	if (!((data & PCI_MAP_MEMORY_TYPE_MASK) == PCI_MAP_MEMORY_TYPE_32BIT_1M
+	if ((data & PCI_MAP_MEMORY_TYPE_MASK) == PCI_MAP_MEMORY_TYPE_64BIT) {
+		unsigned upperhalf = pci_conf_read (tag, reg + 4);
+		if (upperhalf != 0) {
+			printf ("pci_map_mem failed: 0x%08x%08x > 4GB\n",
+				upperhalf, paddr);
+			return (0);
+		}
+	} else if (!((data & PCI_MAP_MEMORY_TYPE_MASK) == PCI_MAP_MEMORY_TYPE_32BIT_1M
 	      && (paddr & ~0xfffff) == 0)
 	    && (data & PCI_MAP_MEMORY_TYPE_MASK) != PCI_MAP_MEMORY_TYPE_32BIT){

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980803184604.A290>