1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

Add a more generic version of the mii_phy_match routine (mii_phy_match_gen)

which can be used for phy that want to piggy back other data with their
table.
This commit is contained in:
Warner Losh 2005-09-30 14:51:44 +00:00
parent a1039f82ae
commit 08576af02f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=150756
2 changed files with 14 additions and 3 deletions

View File

@ -530,13 +530,21 @@ mii_phy_detach(device_t dev)
}
const struct mii_phydesc *
mii_phy_match(const struct mii_attach_args *ma, const struct mii_phydesc *mpd)
mii_phy_match_gen(const struct mii_attach_args *ma,
const struct mii_phydesc *mpd, size_t len)
{
for (; mpd->mpd_name != NULL; mpd++) {
for (; mpd->mpd_name != NULL;
mpd = (const struct mii_phydesc *) ((const char *) mpd + len)) {
if (MII_OUI(ma->mii_id1, ma->mii_id2) == mpd->mpd_oui &&
MII_MODEL(ma->mii_id2) == mpd->mpd_model)
return (mpd);
}
return (NULL);
}
const struct mii_phydesc *
mii_phy_match(const struct mii_attach_args *ma, const struct mii_phydesc *mpd)
{
return (mii_phy_match_gen(ma, mpd, sizeof(struct mii_phydesc)));
}

View File

@ -220,7 +220,10 @@ void mii_phy_setmedia(struct mii_softc *sc);
void mii_phy_update(struct mii_softc *, int);
int mii_phy_tick(struct mii_softc *);
const struct mii_phydesc * mii_phy_match(const struct mii_attach_args *ma, const struct mii_phydesc *mpd);
const struct mii_phydesc * mii_phy_match(const struct mii_attach_args *ma,
const struct mii_phydesc *mpd);
const struct mii_phydesc * mii_phy_match_gen(const struct mii_attach_args *ma,
const struct mii_phydesc *mpd, size_t endlen);
void ukphy_status(struct mii_softc *);
#endif /* _KERNEL */