summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2006-01-26 19:04:18 +0000
committermarius <marius@FreeBSD.org>2006-01-26 19:04:18 +0000
commite6d8f031efa191c7ac8db48b9e2c22e7bc328459 (patch)
treee60afa831352d42dd0953b0115c2fa74b50725c3
parenteb197438b104db98e74a2fb75de7cf71b6d51f4e (diff)
downloadFreeBSD-src-e6d8f031efa191c7ac8db48b9e2c22e7bc328459.zip
FreeBSD-src-e6d8f031efa191c7ac8db48b9e2c22e7bc328459.tar.gz
- Only touch the LED bit of the (LED) AUXIO register when turning the
system LED on or off. Unlike the EBus LED AUXIO register where the remaining bits are unused the upper bits of the SBus AUXIO register are used to control other things like the link test enable pin of the on-board NIC which we don't want to change as a side-effect. - Remove the superfluous bzero()'ing of the softc obtained from device_get_softc(). Reviewed by: yongari MFC after: 3 days
-rw-r--r--sys/dev/auxio/auxio.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/dev/auxio/auxio.c b/sys/dev/auxio/auxio.c
index e98f9b6..9943a0af 100644
--- a/sys/dev/auxio/auxio.c
+++ b/sys/dev/auxio/auxio.c
@@ -200,8 +200,15 @@ auxio_led_func(void *arg, int onoff)
sc = (struct auxio_softc *)arg;
- led = onoff ? AUXIO_LED_LED : 0;
AUXIO_LOCK(sc);
+ /*
+ * NB: We must not touch the other bits of the SBus AUXIO reg.
+ */
+ led = auxio_led_read(sc);
+ if (onoff)
+ led |= AUXIO_LED_LED;
+ else
+ led &= ~AUXIO_LED_LED;
auxio_led_write(sc, led);
AUXIO_UNLOCK(sc);
}
@@ -226,7 +233,6 @@ auxio_ebus_attach(device_t dev)
struct auxio_softc *sc;
sc = device_get_softc(dev);
- bzero(sc, sizeof(*sc));
sc->sc_dev = dev;
AUXIO_LOCK_INIT(sc);
@@ -256,7 +262,7 @@ auxio_attach_common(struct auxio_softc *sc)
sc->sc_regh[i] = rman_get_bushandle(res);
}
- sc->sc_led_stat = auxio_led_read(sc);
+ sc->sc_led_stat = auxio_led_read(sc) & AUXIO_LED_LED;
sc->sc_led_dev = led_create(auxio_led_func, sc, "auxioled");
/* turn on the LED */
auxio_led_func(sc, 1);
@@ -300,7 +306,6 @@ auxio_sbus_attach(device_t dev)
struct auxio_softc *sc;
sc = device_get_softc(dev);
- bzero(sc, sizeof(*sc));
sc->sc_dev = dev;
AUXIO_LOCK_INIT(sc);
OpenPOWER on IntegriCloud