diff options
-rw-r--r-- | sys/arch/octeon/dev/if_cnmac.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/sys/arch/octeon/dev/if_cnmac.c b/sys/arch/octeon/dev/if_cnmac.c index e612856b22f..f26c0019d7f 100644 --- a/sys/arch/octeon/dev/if_cnmac.c +++ b/sys/arch/octeon/dev/if_cnmac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cnmac.c,v 1.12 2013/09/16 20:52:14 jmatthew Exp $ */ +/* $OpenBSD: if_cnmac.c,v 1.13 2014/03/10 09:41:27 jasper Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -342,11 +342,6 @@ octeon_eth_attach(struct device *parent, struct device *self, void *aux) octeon_eth_board_mac_addr(enaddr); printf(", address %s\n", ether_sprintf(enaddr)); - /* - * live lock control notifications. - * XXX: use sysctl ??? - */ - octeon_eth_gsc[sc->sc_port] = sc; SIMPLEQ_INIT(&sc->sc_sendq); @@ -573,6 +568,7 @@ static int octeon_eth_mediainit(struct octeon_eth_softc *sc) { struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct mii_softc *child; sc->sc_mii.mii_ifp = ifp; sc->sc_mii.mii_readreg = octeon_eth_mii_readreg; @@ -584,16 +580,14 @@ octeon_eth_mediainit(struct octeon_eth_softc *sc) mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, sc->sc_phy_addr, MII_OFFSET_ANY, MIIF_DOPAUSE); - /* XXX */ - if (LIST_FIRST(&sc->sc_mii.mii_phys) != NULL) { - /* XXX */ - ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER | IFM_AUTO); + child = LIST_FIRST(&sc->sc_mii.mii_phys); + if (child == NULL) { + /* No PHY attached. */ + ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER | IFM_MANUAL, + 0, NULL); + ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER | IFM_MANUAL); } else { - /* XXX */ - ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER | IFM_NONE, - MII_MEDIA_NONE, NULL); - /* XXX */ - ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER | IFM_NONE); + ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER | IFM_AUTO); } return 0; @@ -616,9 +610,10 @@ octeon_eth_mediachange(struct ifnet *ifp) { struct octeon_eth_softc *sc = ifp->if_softc; - mii_mediachg(&sc->sc_mii); + if ((ifp->if_flags & IFF_UP) == 0) + return 0; - return 0; + return mii_mediachg(&sc->sc_mii); } /* ---- send buffer garbage collection */ |