Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/broadcom When writing intmask from a softint/wo...



details:   https://anonhg.NetBSD.org/src/rev/e5fb6d5ccb48
branches:  trunk
changeset: 782285:e5fb6d5ccb48
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Oct 26 05:28:41 2012 +0000

description:
When writing intmask from a softint/workqueue thread, make sure to do so
only with the hwlock locked.

diffstat:

 sys/arch/arm/broadcom/bcm53xx_eth.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (41 lines):

diff -r decf7faa543e -r e5fb6d5ccb48 sys/arch/arm/broadcom/bcm53xx_eth.c
--- a/sys/arch/arm/broadcom/bcm53xx_eth.c       Fri Oct 26 05:11:34 2012 +0000
+++ b/sys/arch/arm/broadcom/bcm53xx_eth.c       Fri Oct 26 05:28:41 2012 +0000
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.13 2012/10/26 05:11:34 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.14 2012/10/26 05:28:41 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -138,7 +138,7 @@
 
        uint32_t sc_maxfrm;
        uint32_t sc_cmdcfg;
-       uint32_t sc_intmask;
+       volatile uint32_t sc_intmask;
        uint32_t sc_rcvlazy;
        volatile uint32_t sc_soft_flags;
 #define        SOFT_RXINTR             0x01
@@ -1708,7 +1708,9 @@
 
        if (ifp->if_flags & IFF_RUNNING) {
                bcmeth_rxq_produce(sc, &sc->sc_rxq);
+               mutex_spin_enter(sc->sc_hwlock);
                bcmeth_write_4(sc, GMAC_INTMASK, sc->sc_intmask);
+               mutex_spin_exit(sc->sc_hwlock);
        }
 
        mutex_exit(sc->sc_lock);
@@ -1757,7 +1759,9 @@
 
        if (ifp->if_flags & IFF_RUNNING) {
                bcmeth_rxq_produce(sc, &sc->sc_rxq);
+               mutex_spin_enter(sc->sc_hwlock);
                bcmeth_write_4(sc, GMAC_INTMASK, sc->sc_intmask);
+               mutex_spin_exit(sc->sc_hwlock);
        }
 
        mutex_exit(sc->sc_lock);



Home | Main Index | Thread Index | Old Index