From 923629baa0e29adb56de97ed5d8fd54e71cd3b49 Mon Sep 17 00:00:00 2001 From: marius Date: Sat, 2 Dec 2006 15:32:34 +0000 Subject: Add a helper function mii_phy_dev_probe(), which wraps around the mii_phy_match() API and takes care of the PHY device probe based on the struct mii_phydesc array and the match return value provided. Convert PHY drivers to take advantage of mii_phy_dev_probe(), converting drivers to provide a mii_phydesc table in the first place where necessary. Reviewed by: yongari MFC after: 2 weeks --- sys/dev/mii/xmphy.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'sys/dev/mii/xmphy.c') diff --git a/sys/dev/mii/xmphy.c b/sys/dev/mii/xmphy.c index c071b1f..b7f5ae9 100644 --- a/sys/dev/mii/xmphy.c +++ b/sys/dev/mii/xmphy.c @@ -83,26 +83,17 @@ static int xmphy_service(struct mii_softc *, struct mii_data *, int); static void xmphy_status(struct mii_softc *); static int xmphy_mii_phy_auto(struct mii_softc *); +static const struct mii_phydesc xmphys[] = { + { MII_OUI_xxXAQTI, MII_MODEL_XAQTI_XMACII, MII_STR_XAQTI_XMACII }, + MII_PHY_DESC(JATO, BASEX), + MII_PHY_END +}; + static int xmphy_probe(device_t dev) { - struct mii_attach_args *ma; - - ma = device_get_ivars(dev); - - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxXAQTI && - MII_MODEL(ma->mii_id2) == MII_MODEL_XAQTI_XMACII) { - device_set_desc(dev, MII_STR_XAQTI_XMACII); - return(BUS_PROBE_DEFAULT); - } - - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_JATO && - MII_MODEL(ma->mii_id2) == MII_MODEL_JATO_BASEX) { - device_set_desc(dev, MII_STR_JATO_BASEX); - return(BUS_PROBE_DEFAULT); - } - return(ENXIO); + return (mii_phy_dev_probe(dev, xmphys, BUS_PROBE_DEFAULT)); } static int -- cgit v1.1