diff options
Diffstat (limited to 'sys/dev/mii/icsphy.c')
-rw-r--r-- | sys/dev/mii/icsphy.c | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/sys/dev/mii/icsphy.c b/sys/dev/mii/icsphy.c index be6f994e3d7..96c554914f2 100644 --- a/sys/dev/mii/icsphy.c +++ b/sys/dev/mii/icsphy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icsphy.c,v 1.15 2005/01/28 18:27:55 brad Exp $ */ +/* $OpenBSD: icsphy.c,v 1.16 2005/02/05 22:20:42 brad Exp $ */ /* $NetBSD: icsphy.c,v 1.17 2000/02/02 23:34:56 thorpej Exp $ */ /*- @@ -108,21 +108,25 @@ const struct mii_phy_funcs icsphy_funcs = { icsphy_service, icsphy_status, icsphy_reset, }; +static const struct mii_phydesc icsphys[] = { + { MII_OUI_xxICS, MII_MODEL_xxICS_1890, + MII_STR_xxICS_1890 }, + { MII_OUI_xxICS, MII_MODEL_xxICS_1892, + MII_STR_xxICS_1892 }, + { MII_OUI_xxICS, MII_MODEL_xxICS_1893, + MII_STR_xxICS_1893 }, + + { 0, 0, + NULL }, + +}; + int icsphymatch(struct device *parent, void *match, void *aux) { struct mii_attach_args *ma = aux; - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxICS && - MII_MODEL(ma->mii_id2) == MII_MODEL_xxICS_1890) - return (10); - - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxICS && - MII_MODEL(ma->mii_id2) == MII_MODEL_xxICS_1892) - return (10); - - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxICS && - MII_MODEL(ma->mii_id2) == MII_MODEL_xxICS_1893) + if (mii_phy_match(ma, icsphys) != NULL) return (10); return (0); @@ -134,22 +138,10 @@ icsphyattach(struct device *parent, struct device *self, void *aux) struct mii_softc *sc = (struct mii_softc *)self; struct mii_attach_args *ma = aux; struct mii_data *mii = ma->mii_data; - char *model = "?"; - - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxICS) - switch (MII_MODEL(ma->mii_id2)) { - case MII_MODEL_xxICS_1890: - model = MII_STR_xxICS_1890; - break; - case MII_MODEL_xxICS_1892: - model = MII_STR_xxICS_1892; - break; - case MII_MODEL_xxICS_1893: - model = MII_STR_xxICS_1893; - break; - } + const struct mii_phydesc *mpd; - printf(": %s, rev. %d\n", model, MII_REV(ma->mii_id2)); + mpd = mii_phy_match(ma, icsphys); + printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; |