Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Nov 2002 03:00:32 -0500 (EST)
From:      Matt Emmerton <matt@gsicomp.on.ca>
To:        FreeBSD-gnats-submit@FreeBSD.org, chris@unixpages.org, imp@bsdimp.com
Subject:   kern/45637: wi0 device_probe_and_attach returns 6
Message-ID:  <200211230800.gAN80Wig000699@dhcp2.gsicomp.on.ca>

next in thread | raw e-mail | index | archive | help

>Number:         45637
>Category:       kern
>Synopsis:       wi0 device_probe_and_attach returns 6
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 23 00:10:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Matt Emmerton
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD laptop.gsicomp.on.ca 5.0-CURRENT FreeBSD 5.0-CURRENT #42: Sat Nov 23 02:12:36 EST 2002 root@laptop.gsicomp.on.ca:/usr/obj/usr/src/sys/LAPTOP.20020914.01 i386

>Description:

> In message: <20021123004026.GE1766@unixpages.org>
>             Christian Brueffer <chris@unixpages.org> writes:
> : Hi,
> :
> : just installed DP2 on my IBM Thinkpad R32 and updated to the latest
> : -CURRENT.
> : My wlan device (Prism 2.5, internal, no pccard) fails at bootup:
> :
> : wi0: <Intersil Prism2.5> mem 0xf8000000-0xf8000fff irq 11 at device 7.0
on pci2
> : wi0: No Mem space on prism2.5?
> : device_probe_and_attach: wi0 attach returned 6
> :
> : Used to work fine with 4.7-STABLE.
> :
> : Any ideas?
>
> Nope.  More details?

The same wlan device has been broken for me on -CURRENT for a couple of
months now on a ThinkPad T23.  I never paid it much attention since I have a
PCMCIA wireless NIC which works fine.

Here's some useful output from boot -v:

pcib2: <PCIBIOS PCI-PCI bridge> at device 30.0 on pci0
pcib2:   secondary bus     2
pcib2:   subordinate bus   8
pcib2:   I/O decode     0x3000-0x7fff
pcib2:   memory decode 0xc02000000-0xcfffffff
pcib2:   prefetched decode 0xec000000-0xf7fffffff
pci2: <PCI bus> on pcib2
...
wi0:  <Intersil Prism2.5> mem 0xec000000-0xec000fff irq 11 at device 2.0 on
pci2
pcib2: device wi0 requesting range 0xec000000-0xec000fff (**)
pcib2: device wi0 requested unsupported memory range 0x0-0xcfffffff
(decoding 0xc0200000-0xcfffffff, 0xec000000-0xf7ffffff)
wi0: No Mem space on prism2.5?
device_probe_and_attach: wi0 attach returned 6

The line marked with (**) is from my own debug code in
sys/dev/pci/pci_pci.c, positioned upon entry to the pcib_alloc_resource()
function.

The code inside of #ifndef PCI_ALLOW_UNSUPPORTED_IO_RANGE (shouldn't that be
MEM_RANGE?) looks suspect since it doesn't check the start/end parameters
against the prefetched decode memory range.  The attached patch checks fixes
this, as well as cleans up the #ifdefs.

--
Matt Emmerton

>How-To-Repeat:

Boot a ThinkPad R32 or T23 with an integrated wlan card.

>Fix:

--- sys/dev/pci/pci_pci.c.orig	Sat Nov 23 01:34:54 2002
+++ sys/dev/pci/pci_pci.c	Sat Nov 23 02:16:15 2002
@@ -310,7 +310,9 @@
 			      " (decoding 0x%x-0x%x)\n",
 			      device_get_name(child), device_get_unit(child), start, end,
 			      sc->iobase, sc->iolimit);
+#ifndef PCI_ALLOW_UNSUPPORTED_IO_RANGE
 		return (NULL);
+#endif
 	    }
 	    if (bootverbose)
 		device_printf(sc->dev, "device %s%d requested decoded I/O range 0x%lx-0x%lx\n",
@@ -325,18 +327,34 @@
 	     */
 	case SYS_RES_MEMORY:
 	    if (!pcib_is_isa_mem(start)) {
-#ifndef PCI_ALLOW_UNSUPPORTED_IO_RANGE
-		if (start < sc->membase && end >= sc->membase)
-		    start = sc->membase;
-		if (end > sc->memlimit)
-		    end = sc->memlimit;
-		if (end < start)
-		    start = 0;
+#ifndef PCI_ALLOW_UNSUPPORTED_MEM_RANGE
+		if (((start < sc->membase)  || (end > sc->memlimit)) &&
+                    ((start < sc->pmembase) || (end > sc->pmemlimit))) {
+
+		    /* We've been given a request that falls outside   */
+		    /* of both the memory decode and prefetched decode */
+		    /* ranges. Force it to the memory decode range,    */
+		    /* but for no reason in particular.                */
+
+		    if (start < sc->membase && end >= sc->membase) {
+			start = sc->membase;
+                    }
+		    if (end > sc->memlimit) {
+			end = sc->memlimit;
+                    }
+		    if (end < start) {
+			start = 0;
+                    }
+		}
 #else
 		if (start < sc->membase && end > sc->membase)
 		    printf("start (%lx) < sc->membase (%x)\n", start, sc->membase);
+		if (start < sc->pmembase && end > sc->pmembase)
+		    printf("start (%lx) < sc->pmembase (%x)\n", start, sc->pmembase);
 		if (end > sc->memlimit)
 		    printf("end (%lx) > sc->memlimit (%x)\n", end, sc->memlimit);
+		if (end > sc->pmemlimit)
+		    printf("end (%lx) > sc->pmemlimit (%x)\n", end, sc->pmemlimit);
 		if (end < start) 
 		    printf("end (%lx) < start (%lx)\n", end, start);
 #endif
@@ -351,7 +369,7 @@
 			device_get_name(child), device_get_unit(child), start,
 			end, sc->membase, sc->memlimit, sc->pmembase,
 			sc->pmemlimit);
-#ifndef PCI_ALLOW_UNSUPPORTED_IO_RANGE
+#ifndef PCI_ALLOW_UNSUPPORTED_MEM_RANGE
 		return(NULL);
 #endif
 	    }

>Release-Note:
>Audit-Trail:
>Unformatted:

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




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