From 0574df71dc22363670c1b2f52fdda412bdbc8eb2 Mon Sep 17 00:00:00 2001 From: Marius Strobl Date: Thu, 26 Jan 2006 19:04:18 +0000 Subject: [PATCH] - 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 --- sys/dev/auxio/auxio.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/dev/auxio/auxio.c b/sys/dev/auxio/auxio.c index e98f9b6322e..9943a0afd60 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);