diff options
author | Chris Cappuccio <chris@cvs.openbsd.org> | 2000-02-06 17:51:42 +0000 |
---|---|---|
committer | Chris Cappuccio <chris@cvs.openbsd.org> | 2000-02-06 17:51:42 +0000 |
commit | 4314206c16c7626f0f959ae7d884793e2abb90b6 (patch) | |
tree | 915c37b01b33e7a7de49cda06b7bc0601ce1493d /sys/dev/pci | |
parent | 08dd59ce011c2f3ee9b65714c3883aaa7497106f (diff) |
Make LEDs (mostly) accurate for all models instead of just LMC1000
Actually call media-specific watchdog section that was added in last commit
Play with tulip bits in lmc_watchdog
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_lmc.c | 81 |
1 files changed, 73 insertions, 8 deletions
diff --git a/sys/dev/pci/if_lmc.c b/sys/dev/pci/if_lmc.c index ce7e1886ae5..3b2688be76c 100644 --- a/sys/dev/pci/if_lmc.c +++ b/sys/dev/pci/if_lmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lmc.c,v 1.3 2000/02/01 18:01:40 chris Exp $ */ +/* $OpenBSD: if_lmc.c,v 1.4 2000/02/06 17:51:41 chris Exp $ */ /* $NetBSD: if_lmc.c,v 1.1 1999/03/25 03:32:43 explorer Exp $ */ /*- @@ -63,6 +63,23 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * LMC1200 (DS1) & LMC5245 (DS3) LED definitions + * led0 yellow = far-end link is in Red alarm condition + * led1 blue = received an Alarm Indication signal (upstream failure) + * led2 Green = power to adapter, Gate Array loaded & driver attached + * led3 red = Loss of Signal (LOS) or out of frame (OOF) conditions + * detected on T3 receive signal + * + * LMC1000 (SSI) & LMC5200 (HSSI) LED definitions + * led0 Green = power to adapter, Gate Array loaded & driver attached + * led1 Green = DSR and DTR and RTS and CTS are set (CA, TA for LMC5200) + * led2 Green = Cable detected (Green indicates non-loopback mode for LMC5200) + * led3 red = No timing is available from the cable or the on-board + * frequency generator. (ST not available for LMC5200) + */ + + #include <sys/param.h> #include <sys/systm.h> #include <sys/mbuf.h> @@ -413,6 +430,14 @@ lmc_watchdog(int unit) state = 0; + /* + * Make sure the tx jabber and rx watchdog are off, + * and the transmit and recieve processes are running. + */ + LMC_CSR_WRITE (sc, csr_15, 0x00000011); + sc->lmc_cmdmode |= TULIP_CMD_TXRUN | TULIP_CMD_RXRUN; + LMC_CSR_WRITE (sc, csr_command, sc->lmc_cmdmode); + link_status = sc->lmc_media->get_link_status(sc); ostatus = ((sc->lmc_flags & LMC_MODEMOK) == LMC_MODEMOK); @@ -420,11 +445,21 @@ lmc_watchdog(int unit) * hardware level link lost, but the interface is marked as up. * Mark it as down. */ - if (link_status == 0 && ostatus) { + if (link_status == LMC_LINK_DOWN && ostatus) { printf(LMC_PRINTF_FMT ": physical link down\n", LMC_PRINTF_ARGS); sc->lmc_flags &= ~LMC_MODEMOK; - lmc_led_off(sc, LMC_MII16_LED1); + if (sc->lmc_cardtype == LMC_CARDTYPE_DS3 || + sc->lmc_cardtype == LMC_CARDTYPE_T1) + lmc_led_on (sc, LMC_DS3_LED3 | LMC_DS3_LED2); + /* turn on red LED */ + else { + lmc_led_off (sc, LMC_MII16_LED1); + lmc_led_on (sc, LMC_MII16_LED0); + if (sc->lmc_timing == LMC_CTL_CLOCK_SOURCE_EXT) + lmc_led_on (sc, LMC_MII16_LED3); + } + } /* @@ -437,10 +472,26 @@ lmc_watchdog(int unit) if (sc->lmc_flags & LMC_IFUP) lmc_ifup(sc); sc->lmc_flags |= LMC_MODEMOK; - lmc_led_on(sc, LMC_MII16_LED1); + if (sc->lmc_cardtype == LMC_CARDTYPE_DS3 || + sc->lmc_cardtype == LMC_CARDTYPE_T1) + { + sc->lmc_miireg16 |= LMC_DS3_LED3; + lmc_led_off (sc, LMC_DS3_LED3); + /* turn off red LED */ + lmc_led_on (sc, LMC_DS3_LED2); + } else { + lmc_led_on (sc, LMC_MII16_LED0 | LMC_MII16_LED1 \ + | LMC_MII16_LED2); + if (sc->lmc_timing != LMC_CTL_CLOCK_SOURCE_EXT) + lmc_led_off (sc, LMC_MII16_LED3); + } + return; } + /* Call media specific watchdog functions */ + sc->lmc_media->watchdog(sc); + /* * remember the timer value */ @@ -468,7 +519,14 @@ lmc_ifup(lmc_softc_t * const sc) sc->lmc_flags |= LMC_IFUP; - lmc_led_on(sc, LMC_MII16_LED1); + /* + * for DS3 & DS1 adapters light the green light, led2 + */ + if (sc->lmc_cardtype == LMC_CARDTYPE_DS3 || + sc->lmc_cardtype == LMC_CARDTYPE_T1) + lmc_led_on (sc, LMC_MII16_LED2); + else + lmc_led_on (sc, LMC_MII16_LED0 | LMC_MII16_LED2); /* * select what interrupts we want to get @@ -501,8 +559,8 @@ lmc_ifdown(lmc_softc_t * const sc) sc->lmc_if.if_timer = 0; sc->lmc_flags &= ~LMC_IFUP; - sc->lmc_media->set_link_status(sc, 0); - lmc_led_off(sc, LMC_MII16_LED1); + sc->lmc_media->set_link_status(sc, LMC_LINK_DOWN); + lmc_led_off(sc, LMC_MII16_LED_ALL); lmc_dec_reset(sc); lmc_reset(sc); @@ -1380,7 +1438,14 @@ lmc_attach(lmc_softc_t * const sc) * turn off those LEDs... */ sc->lmc_miireg16 |= LMC_MII16_LED_ALL; - lmc_led_on(sc, LMC_MII16_LED0); + /* + * for DS3 & DS1 adapters light the green light, led2 + */ + if (sc->lmc_cardtype == LMC_CARDTYPE_DS3 || + sc->lmc_cardtype == LMC_CARDTYPE_T1) + lmc_led_on (sc, LMC_MII16_LED2); + else + lmc_led_on (sc, LMC_MII16_LED0 | LMC_MII16_LED2); } void |