diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2003-05-17 01:55:30 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2003-05-17 01:55:30 +0000 |
commit | 2d52b6b50fa2a5525cfdad256b5cc1f4bb540913 (patch) | |
tree | a4be44665d125897d16eb982671fa17e5aff8a7c | |
parent | 41d5210de8d58fd2e2543c0769bc23140568cd0d (diff) |
fix up the media handling for the intel based MACs. Also hack around a
bug in the Momenco firmware on the Leopard-V, which now has one port
working.
-rw-r--r-- | sys/dev/ic/dc.c | 35 | ||||
-rw-r--r-- | sys/dev/ic/dcreg.h | 3 | ||||
-rw-r--r-- | sys/dev/pci/if_dc_pci.c | 6 |
3 files changed, 22 insertions, 22 deletions
diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c index 9722bec8d8d..f0ae55edda8 100644 --- a/sys/dev/ic/dc.c +++ b/sys/dev/ic/dc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dc.c,v 1.58 2003/04/29 21:44:06 jason Exp $ */ +/* $OpenBSD: dc.c,v 1.59 2003/05/17 01:55:28 jason Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1597,7 +1597,7 @@ dc_attach(sc) struct dc_softc *sc; { struct ifnet *ifp; - int error = 0, mac_offset, tmp, i; + int mac_offset, tmp, i; /* * Get station address from the EEPROM. @@ -1739,38 +1739,33 @@ hasmac: mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY, MII_OFFSET_ANY, 0); - if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) { - error = ENXIO; - ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE, 0, NULL); - ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE); - } else if (sc->dc_type == DC_TYPE_21145) { - ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_10_T); - } else - ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO); - - if (DC_IS_DAVICOM(sc) && sc->dc_revision >= DC_REVISION_DM9102A) - ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_HPNA_1,0,NULL); - if (DC_IS_INTEL(sc)) { - if (error) { + if (LIST_EMPTY(&sc->sc_mii.mii_phys)) { sc->dc_pmode = tmp; if (sc->dc_pmode != DC_PMODE_SIA) sc->dc_pmode = DC_PMODE_SYM; sc->dc_flags |= DC_21143_NWAY; + if (sc->dc_flags & DC_MOMENCO_BOTCH) + sc->dc_pmode = DC_PMODE_MII; mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY, MII_OFFSET_ANY, 0); - error = 0; } else { /* we have a PHY, so we must clear this bit */ sc->dc_flags &= ~DC_TULIP_LEDS; } } - if (error) { + if (LIST_EMPTY(&sc->sc_mii.mii_phys)) { + ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE, 0, NULL); + ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE); printf("%s: MII without any PHY!\n", sc->sc_dev.dv_xname); - error = ENXIO; - goto fail; - } + } else if (sc->dc_type == DC_TYPE_21145) { + ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_10_T); + } else + ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO); + + if (DC_IS_DAVICOM(sc) && sc->dc_revision >= DC_REVISION_DM9102A) + ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_HPNA_1,0,NULL); if (DC_IS_XIRCOM(sc)) { /* diff --git a/sys/dev/ic/dcreg.h b/sys/dev/ic/dcreg.h index 2cd64b9c21a..2beb82df925 100644 --- a/sys/dev/ic/dcreg.h +++ b/sys/dev/ic/dcreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dcreg.h,v 1.28 2003/04/29 21:39:34 jason Exp $ */ +/* $OpenBSD: dcreg.h,v 1.29 2003/05/17 01:55:28 jason Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -752,6 +752,7 @@ struct dc_softc { #define DC_64BIT_HASH 0x00002000 #define DC_TULIP_LEDS 0x00004000 #define DC_TX_ONE 0x00008000 +#define DC_MOMENCO_BOTCH 0x00010000 /* * register space access macros diff --git a/sys/dev/pci/if_dc_pci.c b/sys/dev/pci/if_dc_pci.c index 31138c643c2..dcff20c543f 100644 --- a/sys/dev/pci/if_dc_pci.c +++ b/sys/dev/pci/if_dc_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_dc_pci.c,v 1.36 2003/04/29 21:39:34 jason Exp $ */ +/* $OpenBSD: if_dc_pci.c,v 1.37 2003/05/17 01:55:29 jason Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -502,6 +502,10 @@ void dc_pci_attach(parent, self, aux) if (OF_getprop(PCITAG_NODE(pa->pa_tag), "local-mac-address", sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN) <= 0) myetheraddr(sc->sc_arpcom.ac_enaddr); + if (sc->sc_arpcom.ac_enaddr[0] == 0x00 && + sc->sc_arpcom.ac_enaddr[1] == 0x03 && + sc->sc_arpcom.ac_enaddr[2] == 0xcc) + sc->dc_flags |= DC_MOMENCO_BOTCH; sc->sc_hasmac = 1; } #endif |