diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2006-10-26 00:05:08 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2006-10-26 00:05:08 +0000 |
commit | b4feea26f4e7d3b2d32b6ab6a94c92402b0e40d4 (patch) | |
tree | c8950b0284bd7d4f6bd450d9fbee0ae4bef3080f /sys | |
parent | 50a7169d7eaae6c96dab0c36e4866a70b233919d (diff) |
do the minimal initialization of the firmware so that ASF always
works.
From ambrisko@FreeBSD
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/if_bnx.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c index 3d822795dea..7f654397dca 100644 --- a/sys/dev/pci/if_bnx.c +++ b/sys/dev/pci/if_bnx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bnx.c,v 1.31 2006/10/25 02:37:50 brad Exp $ */ +/* $OpenBSD: if_bnx.c,v 1.32 2006/10/26 00:05:07 brad Exp $ */ /*- * Copyright (c) 2006 Broadcom Corporation @@ -378,6 +378,7 @@ void bnx_watchdog(struct ifnet *); int bnx_ifmedia_upd(struct ifnet *); void bnx_ifmedia_sts(struct ifnet *, struct ifmediareq *); void bnx_init(void *); +void bnx_mgmt_init(struct bnx_softc *sc); void bnx_init_context(struct bnx_softc *); void bnx_get_mac_addr(struct bnx_softc *); @@ -891,6 +892,9 @@ bnx_attachhook(void *xsc) /* Print some important debugging info. */ DBRUN(BNX_INFO, bnx_dump_driver_state(sc)); + /* Get the firmware running so ASF still works. */ + bnx_mgmt_init(sc); + goto bnx_attach_exit; bnx_attach_fail: @@ -2926,6 +2930,7 @@ bnx_stop(struct bnx_softc *sc) DBPRINT(sc, BNX_VERBOSE_RESET, "Exiting %s()\n", __FUNCTION__); + bnx_mgmt_init(sc); } int @@ -4245,6 +4250,36 @@ bnx_init_exit: return; } +void +bnx_mgmt_init(struct bnx_softc *sc) +{ + struct ifnet *ifp = &sc->arpcom.ac_if; + u_int32_t val; + + /* Check if the driver is still running and bail out if it is. */ + if (ifp->if_flags & IFF_RUNNING) + goto bnx_mgmt_init_exit; + + /* Initialize the on-boards CPUs */ + bnx_init_cpus(sc); + + val = (BCM_PAGE_BITS - 8) << 24; + REG_WR(sc, BNX_RV2P_CONFIG, val); + + /* Enable all critical blocks in the MAC. */ + REG_WR(sc, BNX_MISC_ENABLE_SET_BITS, + BNX_MISC_ENABLE_SET_BITS_RX_V2P_ENABLE | + BNX_MISC_ENABLE_SET_BITS_RX_DMA_ENABLE | + BNX_MISC_ENABLE_SET_BITS_COMPLETION_ENABLE); + REG_RD(sc, BNX_MISC_ENABLE_SET_BITS); + DELAY(20); + + bnx_ifmedia_upd(ifp); + +bnx_mgmt_init_exit: + DBPRINT(sc, BNX_VERBOSE_RESET, "Exiting %s()\n", __FUNCTION__); +} + /****************************************************************************/ /* Encapsultes an mbuf cluster into the tx_bd chain structure and makes the */ /* memory visible to the controller. */ |