From 7d2c1a5c284fb9788b26240535c2a92062ef2f56 Mon Sep 17 00:00:00 2001 From: Marcus Glocker Date: Sun, 4 Mar 2007 14:27:28 +0000 Subject: Fix panic caused by bcw_leds_switch_all() because reading from wrong register. Noted while testing on sparc64. --- sys/dev/ic/bcw.c | 13 ++++++++++--- sys/dev/ic/bcwreg.h | 4 +++- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'sys/dev/ic') diff --git a/sys/dev/ic/bcw.c b/sys/dev/ic/bcw.c index a50b0cada85..2282d051be0 100644 --- a/sys/dev/ic/bcw.c +++ b/sys/dev/ic/bcw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcw.c,v 1.64 2007/03/04 00:43:26 mglocker Exp $ */ +/* $OpenBSD: bcw.c,v 1.65 2007/03/04 14:27:27 mglocker Exp $ */ /* * Copyright (c) 2006 Jon Simola @@ -3051,7 +3051,7 @@ bcw_leds_switch_all(struct bcw_softc *sc, int on) uint16_t ledctl; int i, bit_on; - ledctl = BCW_READ16(sc, BCW_GPIO_CTRL); + ledctl = BCW_READ16(sc, BCW_MMIO_GPIO_CONTROL); for (i = 0; i < BCW_NR_LEDS; i++) { led = &(sc->leds[i]); @@ -3067,7 +3067,7 @@ bcw_leds_switch_all(struct bcw_softc *sc, int on) ledctl &= ~(1 << i); } - BCW_WRITE16(sc, BCW_GPIO_CTRL, ledctl); + BCW_WRITE16(sc, BCW_MMIO_GPIO_CONTROL, ledctl); } int @@ -3103,6 +3103,13 @@ bcw_gpio_init(struct bcw_softc *sc) if (sc->sc_chip_rev >= 2) mask |= 0x0010; /* FIXME this is redundant */ + /* + * TODO + * We need to switch to common or pci core before we can write + * to BCW_GPIO_CTR. + */ + return (0); + BCW_WRITE(sc, BCW_GPIO_CTRL, (BCW_READ(sc, BCW_GPIO_CTRL) & mask) | set); diff --git a/sys/dev/ic/bcwreg.h b/sys/dev/ic/bcwreg.h index 22f34594a12..2e8182ce6fb 100644 --- a/sys/dev/ic/bcwreg.h +++ b/sys/dev/ic/bcwreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bcwreg.h,v 1.15 2007/02/23 10:40:54 mglocker Exp $ */ +/* $OpenBSD: bcwreg.h,v 1.16 2007/03/04 14:27:27 mglocker Exp $ */ /* * Copyright (c) 2006 Jon Simola @@ -344,6 +344,8 @@ #define BCW_MMIO_CHANNEL 0x3f0 #define BCW_MMIO_CHANNEL_EXT 0x3f4 +#define BCW_MMIO_GPIO_CONTROL 0x49c + /* LEDS */ #define BCW_NR_LEDS 4 -- cgit v1.2.3