diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2005-02-05 04:28:24 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2005-02-05 04:28:24 +0000 |
commit | 338edfa9e91330f2f563ff2379dc2de7de8623ff (patch) | |
tree | de20ba60b032e6a315db56a73388f3294a7af313 | |
parent | 3adcee5c60692c5a223a3842a0035f4caab60201 (diff) |
use mii_phy_match()
-rw-r--r-- | sys/dev/mii/acphy.c | 27 | ||||
-rw-r--r-- | sys/dev/mii/sqphy.c | 43 |
2 files changed, 34 insertions, 36 deletions
diff --git a/sys/dev/mii/acphy.c b/sys/dev/mii/acphy.c index a8e61691ea7..cbfeaabf37d 100644 --- a/sys/dev/mii/acphy.c +++ b/sys/dev/mii/acphy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acphy.c,v 1.3 2004/10/17 22:33:02 deraadt Exp $ */ +/* $OpenBSD: acphy.c,v 1.4 2005/02/05 04:28:23 brad Exp $ */ /* $NetBSD: acphy.c,v 1.13 2003/04/29 01:49:33 thorpej Exp $ */ /* @@ -75,19 +75,24 @@ const struct mii_phy_funcs acphy_funcs = { acphy_service, acphy_status, mii_phy_reset, }; +static const struct mii_phydesc acphys[] = { + { MII_OUI_xxALTIMA, MII_MODEL_xxALTIMA_AC101, + MII_STR_xxALTIMA_AC101 }, + { MII_OUI_xxALTIMA, MII_MODEL_xxALTIMA_AC101L, + MII_STR_xxALTIMA_AC101L }, + { MII_OUI_xxALTIMA, MII_MODEL_xxALTIMA_AC_UNKNOWN, + MII_STR_xxALTIMA_AC_UNKNOWN }, + + { 0, 0, + NULL }, +}; + int acphymatch(struct device *parent, void *match, void *aux) { struct mii_attach_args *ma = aux; - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxALTIMA && - MII_MODEL(ma->mii_id2) == MII_MODEL_xxALTIMA_AC101) - return (10); - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxALTIMA && - MII_MODEL(ma->mii_id2) == MII_MODEL_xxALTIMA_AC101L) - return (10); - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxALTIMA && - MII_MODEL(ma->mii_id2) == MII_MODEL_xxALTIMA_AC_UNKNOWN) + if (mii_phy_match(ma, acphys) != NULL) return (10); return (0); @@ -99,8 +104,10 @@ acphyattach(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; + const struct mii_phydesc *mpd; - printf(": %s, rev. %d\n", MII_STR_xxALTIMA_AC101, MII_REV(ma->mii_id2)); + mpd = mii_phy_match(ma, acphys); + 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; diff --git a/sys/dev/mii/sqphy.c b/sys/dev/mii/sqphy.c index 56e52a57d08..4d71513fc74 100644 --- a/sys/dev/mii/sqphy.c +++ b/sys/dev/mii/sqphy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sqphy.c,v 1.13 2005/02/05 00:14:37 jsg Exp $ */ +/* $OpenBSD: sqphy.c,v 1.14 2005/02/05 04:28:23 brad Exp $ */ /* $NetBSD: sqphy.c,v 1.17 2000/02/02 23:34:57 thorpej Exp $ */ /*- @@ -107,21 +107,24 @@ const struct mii_phy_funcs sqphy_funcs = { sqphy_service, sqphy_status, mii_phy_reset, }; +static const struct mii_phydesc sqphys[] = { + { MII_OUI_xxSEEQ, MII_MODEL_xxSEEQ_80220, + MII_STR_xxSEEQ_80220 }, + { MII_OUI_xxSEEQ, MII_MODEL_xxSEEQ_80225, + MII_STR_xxSEEQ_80225 }, + { MII_OUI_xxSEEQ, MII_MODEL_xxSEEQ_84220, + MII_STR_xxSEEQ_84220 }, + + { 0, 0, + NULL }, +}; + int sqphymatch(struct device *parent, void *match, void *aux) { struct mii_attach_args *ma = aux; - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxSEEQ && - MII_MODEL(ma->mii_id2) == MII_MODEL_xxSEEQ_80220) - return (10); - - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxSEEQ && - MII_MODEL(ma->mii_id2) == MII_MODEL_xxSEEQ_80225) - return (10); - - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxSEEQ && - MII_MODEL(ma->mii_id2) == MII_MODEL_xxSEEQ_84220) + if (mii_phy_match(ma, sqphys) != NULL) return (10); return (0); @@ -133,22 +136,10 @@ sqphyattach(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; + const struct mii_phydesc *mpd; - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxSEEQ && - MII_MODEL(ma->mii_id2) == MII_MODEL_xxSEEQ_80220) - printf(": %s, rev. %d\n", MII_STR_xxSEEQ_80220, - MII_REV(ma->mii_id2)); - - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxSEEQ && - MII_MODEL(ma->mii_id2) == MII_MODEL_xxSEEQ_80225) - printf(": %s, rev. %d\n", MII_STR_xxSEEQ_80225, - MII_REV(ma->mii_id2)); - - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxSEEQ && - MII_MODEL(ma->mii_id2) == MII_MODEL_xxSEEQ_84220) - printf(": %s, rev. %d\n", MII_STR_xxSEEQ_84220, - MII_REV(ma->mii_id2)); - + mpd = mii_phy_match(ma, sqphys); + 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; |