Index: head/sys/dev/etherswitch/arswitch/arswitch.c =================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch.c +++ head/sys/dev/etherswitch/arswitch/arswitch.c @@ -845,6 +845,7 @@ arswitch_setled(struct arswitch_softc *sc, int phy, int led, int style) { int shift; + int err; if (phy < 0 || phy > sc->numphys) return EINVAL; @@ -852,10 +853,15 @@ if (style < 0 || style > ETHERSWITCH_PORT_LED_MAX) return (EINVAL); + ARSWITCH_LOCK(sc); + shift = ar8327_led_mapping[phy][led].shift; - return (arswitch_modifyreg(sc->sc_dev, + err = (arswitch_modifyreg(sc->sc_dev, ar8327_led_mapping[phy][led].reg, 0x03 << shift, led_pattern_table[style] << shift)); + ARSWITCH_UNLOCK(sc); + + return (err); } static void Index: head/sys/dev/etherswitch/arswitch/arswitch_7240.c =================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_7240.c +++ head/sys/dev/etherswitch/arswitch/arswitch_7240.c @@ -81,6 +81,8 @@ ar7240_hw_global_setup(struct arswitch_softc *sc) { + ARSWITCH_LOCK(sc); + /* Enable CPU port; disable mirror port */ arswitch_writereg(sc->sc_dev, AR8X16_REG_CPU_PORT, AR8X16_CPU_PORT_EN | AR8X16_CPU_MIRROR_DIS); @@ -103,6 +105,8 @@ arswitch_modifyreg(sc->sc_dev, AR8X16_REG_SERVICE_TAG, AR8X16_SERVICE_TAG_MASK, 0); + ARSWITCH_UNLOCK(sc); + return (0); } Index: head/sys/dev/etherswitch/arswitch/arswitch_8316.c =================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_8316.c +++ head/sys/dev/etherswitch/arswitch/arswitch_8316.c @@ -127,6 +127,8 @@ ar8316_hw_global_setup(struct arswitch_softc *sc) { + ARSWITCH_LOCK(sc); + arswitch_writereg(sc->sc_dev, 0x38, AR8X16_MAGIC); /* Enable CPU port and disable mirror port. */ @@ -156,6 +158,7 @@ arswitch_modifyreg(sc->sc_dev, AR8X16_REG_SERVICE_TAG, AR8X16_SERVICE_TAG_MASK, 0); + ARSWITCH_UNLOCK(sc); return (0); } Index: head/sys/dev/etherswitch/arswitch/arswitch_8327.c =================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_8327.c +++ head/sys/dev/etherswitch/arswitch/arswitch_8327.c @@ -708,6 +708,8 @@ { uint32_t t; + ARSWITCH_LOCK(sc); + /* enable CPU port and disable mirror port */ t = AR8327_FWD_CTRL0_CPU_PORT_EN | AR8327_FWD_CTRL0_MIRROR_PORT; @@ -741,6 +743,7 @@ /* GMAC0 (CPU), GMAC1..5 (PHYs), GMAC6 (CPU) */ sc->info.es_nports = 7; + ARSWITCH_UNLOCK(sc); return (0); } Index: head/sys/dev/etherswitch/arswitch/arswitch_9340.c =================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_9340.c +++ head/sys/dev/etherswitch/arswitch/arswitch_9340.c @@ -81,6 +81,8 @@ ar9340_hw_global_setup(struct arswitch_softc *sc) { + ARSWITCH_LOCK(sc); + /* Enable CPU port; disable mirror port */ arswitch_writereg(sc->sc_dev, AR8X16_REG_CPU_PORT, AR8X16_CPU_PORT_EN | AR8X16_CPU_MIRROR_DIS); @@ -142,6 +144,7 @@ } else { device_printf(sc->sc_dev, "%s: need is_gmii or is_mii set\n", __func__); + ARSWITCH_UNLOCK(sc); return (ENXIO); } @@ -163,6 +166,7 @@ /* Settle time */ DELAY(1000); + ARSWITCH_UNLOCK(sc); return (0); }