NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-evbarm/52209: Gumstix: KDASSERT in pxa2x0_gpio if no PCMCIA bushead given but present



>Number:         52209
>Category:       port-evbarm
>Synopsis:       Gumstix: KDASSERT in pxa2x0_gpio if no PCMCIA  bushead given but present
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-evbarm-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 02 18:20:00 +0000 2017
>Originator:     Stephan Meisinger
>Release:        NetBSD 7.99.71
>Organization:
>Environment:
NetBSD 7.99.71 (GUMSTIX) #68: Tue May  2 19:47:52 CEST 2017
        root@netbsd:/usr/obj/sys/arch/evbarm/compile/GUMSTIX

>Description:
Gumstix Connex/Verdex is started

If no boot parameter `busheader` for a GPIO extension board is given but a extenstion board with a PCMCIA adapter is connected a kernel debugging assertion is triggered for the default GUMSTIX kernel.

pxapcic0 at pxaip0 addr 0x20000000: 1 slot
[...]
panic: kernel debugging assertion "gpio < GPIO_NPINS" failed: file "/usr/src/sys/arch/arm/xscale/pxa2x0_gpio.c", line 446

The kernel probes a pcmcia slot but doesn't setup the IRQ-pins. Later card s in the slot are read by using invalid PIN "-1" aka 0xFFFFFFF.



>How-To-Repeat:
boot a GUMSTIX Connex/Verdex board with PCMCIA extension board present but without busheader parameter.
Assertion occure. Expected no assertion occure and no pcmcia slot is available.

pxapcic0 at pxaip0 addr 0x20000000: 0 slot
[...]
boot device: <unknown>
root device: 

See below for suggested patch. The gxpcic now configures only valid slots and always uses the sc_irqcfpin & sc_irqpin array instead of its own copy.

Tested with an NetCF (@connex) and NetCF-Pro (@verdex) with and without the correct busheader parameter.
>Fix:
Index: gxpcic.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/gumstix/gxpcic.c,v
retrieving revision 1.13
diff -u -r1.13 gxpcic.c
--- gxpcic.c	2 Feb 2013 20:06:48 -0000	1.13
+++ gxpcic.c	2 May 2017 17:58:00 -0000
@@ -158,20 +158,22 @@
 {
 	struct pxapcic_softc *sc = device_private(self);
 	struct pxaip_attach_args *pxa = aux;
-	int nslot, i;
+	int nslot, i, j;
 
 	sc->sc_dev = self;
 	sc->sc_iot = pxa->pxa_iot;
 
 	nslot = gxpcic_count_slot(sc);
 
-	for (i = 0; i < nslot; i++) {
-		if (!gxpcic_slot_irqs[i].valid) 
+	for (i = 0, j = 0; i < nslot; i++) {
+		if (!gxpcic_slot_irqs[i].valid) {
+			j++;
 			continue;
-		sc->sc_irqpin[i] = gxpcic_slot_irqs[i].prdy;
-		sc->sc_irqcfpin[i] = gxpcic_slot_irqs[i].cd;
+		}
+		sc->sc_irqpin[i-j] = gxpcic_slot_irqs[i].prdy;
+		sc->sc_irqcfpin[i-j] = gxpcic_slot_irqs[i].cd;
 	}
-	sc->sc_nslots = nslot;
+	sc->sc_nslots = i-j;
 
 	pxapcic_attach_common(sc, &gxpcic_socket_setup);
 }
@@ -205,13 +207,12 @@
 
 	switch (which) {
 	case PXAPCIC_CARD_STATUS:
-		reg = pxa2x0_gpio_get_function(gxpcic_slot_irqs[so->socket].cd);
+		reg = pxa2x0_gpio_get_function(so->sc->sc_irqcfpin[so->socket]);
 		return (HAVE_CARD(reg) ?
 		    PXAPCIC_CARD_VALID : PXAPCIC_CARD_INVALID);
 
 	case PXAPCIC_CARD_READY:
-		reg = pxa2x0_gpio_get_function(
-		    gxpcic_slot_irqs[so->socket].prdy);
+		reg = pxa2x0_gpio_get_function(so->sc->sc_irqpin[so->socket]);
 		return (reg & GPIO_SET ? 1 : 0);
 
 	default:



Home | Main Index | Thread Index | Old Index