NetBSD-Bugs archive

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

kern/40475: pxaip abnormal match



>Number:         40475
>Category:       kern
>Synopsis:       pxaip abnormal match
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 25 14:25:00 +0000 2009
>Originator:     KIYOHARA Takashi
>Release:        -current
>Organization:
>Environment:
NetBSD greed.sins.soum.co.jp 5.99.7 NetBSD 5.99.7 (GREED) #0: EZ  1 24 20:18:53 
JST 2009  
lance%greed.sins.soum.co.jp@localhost:/usr/src/sys/arch/amd64/compile/GREED 
amd64

>Description:
Perhaps, the pxaip's peripherals matched abnormal possibility.

Present arch/evbarm/conf/GUMSTIX and arch/zaurus/conf/GENERIC are
matched by chance correctly. However, these are customizing or this dangerous 
match will be done in the future.
>How-To-Repeat:

>Fix:
Index: sys/arch/arm/sa11x0/sa11x0_ost.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/sa11x0/sa11x0_ost.c,v
retrieving revision 1.25
diff -u -r1.25 sa11x0_ost.c
--- sys/arch/arm/sa11x0/sa11x0_ost.c    10 May 2008 15:31:04 -0000      1.25
+++ sys/arch/arm/sa11x0/sa11x0_ost.c    25 Jan 2009 14:07:18 -0000
@@ -97,7 +99,15 @@
 static int
 saost_match(struct device *parent, struct cfdata *match, void *aux)
 {
+       struct sa11x0_attach_args *sa = aux;
+#if defined(CPU_XSCALE_PXA270) || defined(CPU_XSCALE_PXA250)
+       const uint32_t ost_base = PXA2X0_OST_BASE;
+#else
+       const uint32_t ost_base = SAOST_BASE;
+#endif

+       if (sa->sa_addr != ost_base)
+               return 0;
        return 1;
 }

Index: sys/arch/arm/xscale/pxa2x0_ohci.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/xscale/pxa2x0_ohci.c,v
retrieving revision 1.3
diff -u -r1.3 pxa2x0_ohci.c
--- sys/arch/arm/xscale/pxa2x0_ohci.c   4 Apr 2008 17:44:43 -0000       1.3
+++ sys/arch/arm/xscale/pxa2x0_ohci.c   25 Jan 2009 14:07:18 -0000
@@ -56,9 +56,12 @@
 static int
 pxaohci_match(device_t parent, struct cfdata *cf, void *aux)
 {
+       struct pxaip_attach_args *pxa = aux;

-       if (CPU_IS_PXA270)
+       if (CPU_IS_PXA270 && pxa->pxa_addr == PXA2X0_USBHC_BASE) {
+               pxa->pxa_size = PXA2X0_USBHC_SIZE;
                return 1;
+       }
        return 0;
 }

@@ -85,12 +92,12 @@
        sc->sc.sc_bus.hci_private = sc;

        /* Map I/O space */
-       if (bus_space_map(sc->sc.iot, PXA2X0_USBHC_BASE, PXA2X0_USBHC_SIZE, 0,
+       if (bus_space_map(sc->sc.iot, pxa->pxa_addr, pxa->pxa_size, 0,
            &sc->sc.ioh)) {
                aprint_error(": couldn't map memory space\n");
                return;
        }
-       sc->sc.sc_size = PXA2X0_USBHC_SIZE;
+       sc->sc.sc_size = pxa->pxa_size;

        /* XXX copied from ohci_pci.c. needed? */
        bus_space_barrier(sc->sc.iot, sc->sc.ioh, 0, sc->sc.sc_size,
Index: sys/arch/arm/xscale/pxa2x0_udc.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/xscale/pxa2x0_udc.c,v
retrieving revision 1.1
diff -u -r1.1 pxa2x0_udc.c
--- sys/arch/arm/xscale/pxa2x0_udc.c    17 Dec 2006 16:03:33 -0000      1.1
+++ sys/arch/arm/xscale/pxa2x0_udc.c    25 Jan 2009 14:07:18 -0000
@@ -52,9 +52,13 @@
 static int
 pxaudc_match(struct device *parent, struct cfdata *cf, void *aux)
 {
+       struct pxaip_attach_args *pxa = aux;

-       if (CPU_IS_PXA270)
+       if (pxa->pxa_addr == PXA2X0_USBDC_BASE) {
+               pxa->pxa_size =
+                   CPU_IS_PXA270 ? PXA270_USBDC_SIZE : PXA250_USBDC_SIZE;
                return 1;
+       }
        return 0;
 }

@@ -68,12 +72,12 @@
        sc->sc_size = 0;
        sc->sc_powerhook = NULL;

-       if (bus_space_map(sc->sc_iot, PXA2X0_USBDC_BASE, PXA2X0_USBDC_SIZE, 0,
+       if (bus_space_map(sc->sc_iot, pxa->pxa_addr, pxa->pxa_size, 0,
            &sc->sc_ioh)) {
                aprint_error(": couldn't map memory space\n");
                return;
        }
-       sc->sc_size = PXA2X0_USBDC_SIZE;
+       sc->sc_size = pxa->pxa_size;

        printf(": PXA2x0 USB Device Controller\n");

Index: sys/arch/evbarm/conf/GUMSTIX
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/conf/GUMSTIX,v
retrieving revision 1.31
diff -u -r1.31 GUMSTIX
--- sys/arch/evbarm/conf/GUMSTIX        24 Nov 2008 11:41:09 -0000      1.31
+++ sys/arch/evbarm/conf/GUMSTIX        25 Jan 2009 14:07:19 -0000
@@ -203,8 +205,11 @@
 #lcd0  at pxaip?
 #wsdisplay* at lcd? console ?

-# USB Controller and Devices
-pxaudc0        at pxaip?                               # USB Device Controller
+# USB Host/Device Controller
+ohci0  at pxaip? addr 0x4c000000 intr 3        # consoleLCD-vx,consoleLCD16-vx
+                                               # ALSO NEEDS pxaudc
+pxaudc0        at pxaip? addr 0x40600000

 # integrated MMC/SD contoller
 #pxamci0       at pxaip? addr 0x41100000 size 0x48
Index: sys/arch/zaurus/conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/zaurus/conf/GENERIC,v
retrieving revision 1.15
diff -u -r1.15 GENERIC
--- sys/arch/zaurus/conf/GENERIC        24 Nov 2008 11:41:15 -0000      1.15
+++ sys/arch/zaurus/conf/GENERIC        25 Jan 2009 14:07:26 -0000
@@ -229,8 +229,8 @@


 # USB Controller and Devices
-pxaudc0 at pxaip?      # USB Device Controller
-#ohci0 at pxaip?       # USB Host Controller
+pxaudc0 at pxaip? addr 0x40600000      # USB Device Controller
+#ohci0 at pxaip? addr 0x4c000000 intr 3        # USB Host Controller

 # PCMCIA USB controllers
 #slhci* at pcmcia? function ?  # ScanLogic SL811HS
Index: sys/arch/zaurus/conf/GENERIC.HOSTUSB
===================================================================
RCS file: /cvsroot/src/sys/arch/zaurus/conf/GENERIC.HOSTUSB,v
retrieving revision 1.4
diff -u -r1.4 GENERIC.HOSTUSB
--- sys/arch/zaurus/conf/GENERIC.HOSTUSB        24 Nov 2008 11:41:15 -0000
1.4
+++ sys/arch/zaurus/conf/GENERIC.HOSTUSB        25 Jan 2009 14:07:26 -0000
@@ -230,8 +230,8 @@

 # USB Controller and Devices
 zusb* at pxaip?
-#pxaudc0 at pxaip?     # USB Device Controller
-ohci0 at pxaip?        # USB Host Controller
+#pxaudc0 at pxaip? addr 0x40600000     # USB Device Controller
+ohci0 at pxaip?        addr 0x4c000000 intr 3  # USB Host Controller

 # PCMCIA USB controllers
 #slhci* at pcmcia? function ?  # ScanLogic SL811HS



Home | Main Index | Thread Index | Old Index