Subject: kern/11242: cnw causes fatal page fault
To: None <gnats-bugs@gnats.netbsd.org>
From: None <eramore@era-t.ericsson.se>
List: netbsd-bugs
Date: 10/16/2000 03:23:18
>Number:         11242
>Category:       kern
>Synopsis:       cnw causes fatal page fault
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 16 03:23:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Michael Eriksson
>Release:        1.5 ALPHA2 (the bug is in -current too)
>Organization:
Ericsson Radio Systems AB
>Environment:
System: NetBSD kafka 1.5_ALPHA2 NetBSD 1.5_ALPHA2 (KAFKA) #0: Fri Oct 13 13:43:06 CEST 2000 mer@kafka:/usr/src/sys/arch/i386/compile/KAFKA i386

>Description:

The cnw driver allocates less device memory than it actually maps and
uses. This causes a fatal page fault at device initialization when
used with the TI PCI1450 PCI-CardBus Bridge in my IBM Thinkpad 570E.
(For some reason, it works if I use the 1450 in PCIC emulation mode.)

>How-To-Repeat:

Try to use a Xircom Netwave card with a CardBus bridge.

>Fix:

Index: if_cnw.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/pcmcia/if_cnw.c,v
retrieving revision 1.11.2.1
diff -u -r1.11.2.1 if_cnw.c
--- if_cnw.c	2000/07/07 07:31:29	1.11.2.1
+++ if_cnw.c	2000/10/16 10:01:07
@@ -539,15 +539,15 @@
 	sc->sc_ioh = sc->sc_pcioh.ioh;
 	sc->sc_resource |= CNW_RES_IO;
 #endif
-	if (pcmcia_mem_alloc(sc->sc_pf, CNW_MEM_SIZE, &sc->sc_pcmemh) != 0) {
-		printf(": can't allocate memory\n");
-		goto fail;
-	}
 #ifndef MEMORY_MAPPED
 	memsize = CNW_MEM_SIZE;
 #else
 	memsize = CNW_MEM_SIZE + CNW_IOM_SIZE;
 #endif
+	if (pcmcia_mem_alloc(sc->sc_pf, memsize, &sc->sc_pcmemh) != 0) {
+		printf(": can't allocate memory\n");
+		goto fail;
+	}
 	if (pcmcia_mem_map(sc->sc_pf, PCMCIA_WIDTH_MEM8|PCMCIA_MEM_COMMON,
 	    CNW_MEM_ADDR, memsize, &sc->sc_pcmemh, &sc->sc_memoff,
 	    &sc->sc_memwin) != 0) {

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