Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Nov 2010 17:38:54 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r214925 - in stable/7/sys: arm/at91 dev/bce dev/ed dev/et dev/lge dev/nfe dev/nge dev/nve dev/sf dev/sge dev/sis dev/tx dev/usb pci
Message-ID:  <201011071738.oA7Hcsw3065580@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Sun Nov  7 17:38:54 2010
New Revision: 214925
URL: http://svn.freebsd.org/changeset/base/214925

Log:
  MFC: r213894, r213896, r214913
  
  Converted the remainder of the NIC drivers to use the mii_attach()
  introduced in r213878 (MFC'ed to stable/7 in r214685) instead of
  mii_phy_probe(). Unlike r213893 (MFC'ed to stable/7 in r214910)
  these are mostly straight forward conversions though.

Modified:
  stable/7/sys/arm/at91/if_ate.c
  stable/7/sys/dev/bce/if_bce.c
  stable/7/sys/dev/ed/if_ed_pccard.c
  stable/7/sys/dev/et/if_et.c
  stable/7/sys/dev/lge/if_lge.c
  stable/7/sys/dev/nfe/if_nfe.c
  stable/7/sys/dev/nge/if_nge.c
  stable/7/sys/dev/nve/if_nve.c
  stable/7/sys/dev/sf/if_sf.c
  stable/7/sys/dev/sge/if_sge.c
  stable/7/sys/dev/sis/if_sis.c
  stable/7/sys/dev/tx/if_tx.c
  stable/7/sys/dev/usb/if_aue.c
  stable/7/sys/dev/usb/if_axe.c
  stable/7/sys/dev/usb/if_rue.c
  stable/7/sys/dev/usb/if_udav.c
  stable/7/sys/pci/if_tl.c
  stable/7/sys/pci/if_wb.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/arm/at91/if_ate.c
==============================================================================
--- stable/7/sys/arm/at91/if_ate.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/arm/at91/if_ate.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -215,9 +215,10 @@ ate_attach(device_t dev)
 	ate_set_mac(sc, eaddr);
 
 	sc->ifp = ifp = if_alloc(IFT_ETHER);
-	if (mii_phy_probe(dev, &sc->miibus, ate_ifmedia_upd, ate_ifmedia_sts)) {
-		device_printf(dev, "Cannot find my PHY.\n");
-		err = ENXIO;
+	err = mii_attach(dev, &sc->miibus, ifp, ate_ifmedia_upd,
+	    ate_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+	if (err != 0) {
+		device_printf(dev, "attaching PHYs failed\n");
 		goto out;
 	}
 

Modified: stable/7/sys/dev/bce/if_bce.c
==============================================================================
--- stable/7/sys/dev/bce/if_bce.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/dev/bce/if_bce.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -1134,12 +1134,13 @@ bce_attach(device_t dev)
 	/* Handle any special PHY initialization for SerDes PHYs. */
 	bce_init_media(sc);
 
-	/* MII child bus by probing the PHY. */
-	if (mii_phy_probe(dev, &sc->bce_miibus, bce_ifmedia_upd,
-		bce_ifmedia_sts)) {
-		BCE_PRINTF("%s(%d): No PHY found on child MII bus!\n",
-		    __FILE__, __LINE__);
-		rc = ENXIO;
+	/* MII child bus by attaching the PHY. */
+	rc = mii_attach(dev, &sc->bce_miibus, ifp, bce_ifmedia_upd,
+	    bce_ifmedia_sts, BMSR_DEFCAPMASK, sc->bce_phy_addr,
+	    MII_OFFSET_ANY, 0);
+	if (rc != 0) {
+		BCE_PRINTF("%s(%d): attaching PHYs failed\n", __FILE__,
+		    __LINE__);
 		goto bce_attach_fail;
 	}
 

Modified: stable/7/sys/dev/ed/if_ed_pccard.c
==============================================================================
--- stable/7/sys/dev/ed/if_ed_pccard.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/dev/ed/if_ed_pccard.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -540,23 +540,27 @@ ed_pccard_attach(device_t dev)
 		goto bad;
  	if (sc->chip_type == ED_CHIP_TYPE_DL10019 ||
 	    sc->chip_type == ED_CHIP_TYPE_DL10022) {
-		/* Probe for an MII bus, but ignore errors. */
+		/* Try to attach an MII bus, but ignore errors. */
 		ed_pccard_dl100xx_mii_reset(sc);
-		(void)mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd,
-		    ed_ifmedia_sts);
+		(void)mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd,
+		    ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY,
+		    MII_OFFSET_ANY, 0);
 	} else if (sc->chip_type == ED_CHIP_TYPE_AX88190) {
 		ed_pccard_ax88x90_mii_reset(sc);
-		if ((error = mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd,
-		     ed_ifmedia_sts)) != 0) {
-			device_printf(dev, "Missing mii!\n");
+		error = mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd,
+		    ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY,
+		    MII_OFFSET_ANY, 0);
+		if (error != 0) {
+			device_printf(dev, "attaching PHYs failed\n");
 			goto bad;
 		}
-		    
 	} else if (sc->chip_type == ED_CHIP_TYPE_TC5299J) {
 		ed_pccard_tc5299j_mii_reset(sc);
-		if ((error = mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd,
-		     ed_ifmedia_sts)) != 0) {
-			device_printf(dev, "Missing mii!\n");
+		error = mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd,
+		    ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY,
+		    MII_OFFSET_ANY, 0);
+		if (error != 0) {
+			device_printf(dev, "attaching PHYs failed\n");
 			goto bad;
 		}
 		    

Modified: stable/7/sys/dev/et/if_et.c
==============================================================================
--- stable/7/sys/dev/et/if_et.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/dev/et/if_et.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -63,8 +63,8 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/bus.h>
 
+#include <dev/mii/mii.h>
 #include <dev/mii/miivar.h>
-#include <dev/mii/truephyreg.h>
 
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
@@ -343,10 +343,10 @@ et_attach(device_t dev)
 
 	et_chip_attach(sc);
 
-	error = mii_phy_probe(dev, &sc->sc_miibus,
-			      et_ifmedia_upd, et_ifmedia_sts);
+	error = mii_attach(dev, &sc->sc_miibus, ifp, et_ifmedia_upd,
+	    et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
 	if (error) {
-		device_printf(dev, "can't probe any PHY\n");
+		device_printf(dev, "attaching PHYs failed\n");
 		goto fail;
 	}
 

Modified: stable/7/sys/dev/lge/if_lge.c
==============================================================================
--- stable/7/sys/dev/lge/if_lge.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/dev/lge/if_lge.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -558,10 +558,10 @@ lge_attach(dev)
 	/*
 	 * Do MII setup.
 	 */
-	if (mii_phy_probe(dev, &sc->lge_miibus,
-	    lge_ifmedia_upd, lge_ifmedia_sts)) {
-		device_printf(dev, "MII without any PHY!\n");
-		error = ENXIO;
+	error = mii_attach(dev, &sc->lge_miibus, ifp, lge_ifmedia_upd,
+	    lge_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+	if (error != 0) {
+		device_printf(dev, "attaching PHYs failed\n");
 		goto fail;
 	}
 

Modified: stable/7/sys/dev/nfe/if_nfe.c
==============================================================================
--- stable/7/sys/dev/nfe/if_nfe.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/dev/nfe/if_nfe.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -601,10 +601,10 @@ nfe_attach(device_t dev)
 #endif
 
 	/* Do MII setup */
-	if (mii_phy_probe(dev, &sc->nfe_miibus, nfe_ifmedia_upd,
-	    nfe_ifmedia_sts)) {
-		device_printf(dev, "MII without any phy!\n");
-		error = ENXIO;
+	error = mii_attach(dev, &sc->nfe_miibus, ifp, nfe_ifmedia_upd,
+	    nfe_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+	if (error != 0) {
+		device_printf(dev, "attaching PHYs failed\n");
 		goto fail;
 	}
 	ether_ifattach(ifp, sc->eaddr);

Modified: stable/7/sys/dev/nge/if_nge.c
==============================================================================
--- stable/7/sys/dev/nge/if_nge.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/dev/nge/if_nge.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -1079,10 +1079,10 @@ nge_attach(device_t dev)
 	/*
 	 * Do MII setup.
 	 */
-	error = mii_phy_probe(dev, &sc->nge_miibus, nge_mediachange,
-	    nge_mediastatus);
+	error = mii_attach(dev, &sc->nge_miibus, ifp, nge_mediachange,
+	    nge_mediastatus, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
 	if (error != 0) {
-		device_printf(dev, "no PHY found!\n");
+		device_printf(dev, "attaching PHYs failed\n");
 		goto fail;
 	}
 

Modified: stable/7/sys/dev/nve/if_nve.c
==============================================================================
--- stable/7/sys/dev/nve/if_nve.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/dev/nve/if_nve.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -544,11 +544,12 @@ nve_attach(device_t dev)
 	ifp->if_capabilities |= IFCAP_VLAN_MTU;
 	ifp->if_capenable |= IFCAP_VLAN_MTU;
 
-	/* Probe device for MII interface to PHY */
-	DEBUGOUT(NVE_DEBUG_INIT, "nve: do mii_phy_probe\n");
-	if (mii_phy_probe(dev, &sc->miibus, nve_ifmedia_upd, nve_ifmedia_sts)) {
-		device_printf(dev, "MII without any phy!\n");
-		error = ENXIO;
+	/* Attach device for MII interface to PHY */
+	DEBUGOUT(NVE_DEBUG_INIT, "nve: do mii_attach\n");
+	error = mii_attach(dev, &sc->miibus, ifp, nve_ifmedia_upd,
+	    nve_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+	if (error != 0) {
+		device_printf(dev, "attaching PHYs failed\n");
 		goto fail;
 	}
 
@@ -556,10 +557,10 @@ nve_attach(device_t dev)
 	ether_ifattach(ifp, eaddr);
 
 	/* Activate our interrupt handler. - attach last to avoid lock */
-	error = bus_setup_intr(sc->dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE,
+	error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE,
 	    NULL, nve_intr, sc, &sc->sc_ih);
 	if (error) {
-		device_printf(sc->dev, "couldn't set up interrupt handler\n");
+		device_printf(dev, "couldn't set up interrupt handler\n");
 		goto fail;
 	}
 	DEBUGOUT(NVE_DEBUG_INIT, "nve: nve_attach - exit\n");

Modified: stable/7/sys/dev/sf/if_sf.c
==============================================================================
--- stable/7/sys/dev/sf/if_sf.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/dev/sf/if_sf.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -866,10 +866,10 @@ sf_attach(device_t dev)
 	}
 
 	/* Do MII setup. */
-	if (mii_phy_probe(dev, &sc->sf_miibus, sf_ifmedia_upd,
-	    sf_ifmedia_sts)) {
-		device_printf(dev, "MII without any phy!\n");
-		error = ENXIO;
+	error = mii_attach(dev, &sc->sf_miibus, ifp, sf_ifmedia_upd,
+	    sf_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+	if (error != 0) {
+		device_printf(dev, "attaching PHYs failed\n");
 		goto fail;
 	}
 

Modified: stable/7/sys/dev/sge/if_sge.c
==============================================================================
--- stable/7/sys/dev/sge/if_sge.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/dev/sge/if_sge.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -627,10 +627,10 @@ sge_attach(device_t dev)
 	/*
 	 * Do MII setup.
 	 */
-	if (mii_phy_probe(dev, &sc->sge_miibus, sge_ifmedia_upd,
-	    sge_ifmedia_sts)) {
-		device_printf(dev, "no PHY found!\n");
-		error = ENXIO;
+	error = mii_attach(dev, &sc->sge_miibus, ifp, sge_ifmedia_upd,
+	    sge_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+	if (error != 0) {
+		device_printf(dev, "attaching PHYs failed\n");
 		goto fail;
 	}
 

Modified: stable/7/sys/dev/sis/if_sis.c
==============================================================================
--- stable/7/sys/dev/sis/if_sis.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/dev/sis/if_sis.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -1164,10 +1164,10 @@ sis_attach(device_t dev)
 	/*
 	 * Do MII setup.
 	 */
-	if (mii_phy_probe(dev, &sc->sis_miibus,
-	    sis_ifmedia_upd, sis_ifmedia_sts)) {
-		device_printf(dev, "MII without any PHY!\n");
-		error = ENXIO;
+	error = mii_attach(dev, &sc->sis_miibus, ifp, sis_ifmedia_upd,
+	    sis_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+	if (error != 0) {
+		device_printf(dev, "attaching PHYs failed\n");
 		goto fail;
 	}
 

Modified: stable/7/sys/dev/tx/if_tx.c
==============================================================================
--- stable/7/sys/dev/tx/if_tx.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/dev/tx/if_tx.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -383,10 +383,10 @@ epic_attach(device_t dev)
 		device_printf(dev, "unknown card vendor %04xh\n", sc->cardvend);
 
 	/* Do ifmedia setup. */
-	if (mii_phy_probe(dev, &sc->miibus,
-	    epic_ifmedia_upd, epic_ifmedia_sts)) {
-		device_printf(dev, "ERROR! MII without any PHY!?\n");
-		error = ENXIO;
+	error = mii_attach(dev, &sc->miibus, ifp, epic_ifmedia_upd,
+	    epic_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+	if (error != 0) {
+		device_printf(dev, "attaching PHYs failed\n");
 		goto fail;
 	}
 

Modified: stable/7/sys/dev/usb/if_aue.c
==============================================================================
--- stable/7/sys/dev/usb/if_aue.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/dev/usb/if_aue.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -649,7 +649,7 @@ aue_attach(device_t self)
 	usbd_status		err;
 	usb_interface_descriptor_t	*id;
 	usb_endpoint_descriptor_t	*ed;
-	int			i;
+	int			error, i;
 
 	sc->aue_dev = self;
 	sc->aue_udev = uaa->device;
@@ -741,15 +741,16 @@ aue_attach(device_t self)
 	 * end up getting the children deleted twice, which will crash
 	 * the system.
 	 */
-	if (mii_phy_probe(self, &sc->aue_miibus,
-	    aue_ifmedia_upd, aue_ifmedia_sts)) {
-		device_printf(self, "MII without any PHY!\n");
+	error = mii_attach(self, &sc->aue_miibus, ifp, aue_ifmedia_upd,
+	    aue_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+	if (error != 0) {
+		device_printf(self, "attaching PHYs failed\n");
 		if_free(ifp);
 		AUE_SXUNLOCK(sc);
 		mtx_destroy(&sc->aue_mtx);
 		sx_destroy(&sc->aue_sx);
 		usb_ether_task_destroy(&sc->aue_taskqueue);
-		return ENXIO;
+		return error;
 	}
 
 	sc->aue_qdat.ifp = ifp;

Modified: stable/7/sys/dev/usb/if_axe.c
==============================================================================
--- stable/7/sys/dev/usb/if_axe.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/dev/usb/if_axe.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -544,7 +544,7 @@ axe_attach(device_t self)
 	struct ifnet		*ifp;
 	usb_interface_descriptor_t	*id;
 	usb_endpoint_descriptor_t	*ed;
-	int			i;
+	int			error, i;
 
 	sc->axe_udev = uaa->device;
 	sc->axe_dev = self;
@@ -657,15 +657,16 @@ device_printf(sc->axe_dev, "%s, bufsz %d
 	ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
 	IFQ_SET_READY(&ifp->if_snd);
 
-	if (mii_phy_probe(self, &sc->axe_miibus,
-	    axe_ifmedia_upd, axe_ifmedia_sts)) {
-		device_printf(sc->axe_dev, "MII without any PHY!\n");
+	error = mii_attach(self, &sc->axe_miibus, ifp, axe_ifmedia_upd,
+	    axe_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+	if (error != 0) {
+		device_printf(sc->axe_dev, "attaching PHYs failed\n");
 		if_free(ifp);
 		AXE_UNLOCK(sc);
 		AXE_SLEEPUNLOCK(sc);
 		sx_destroy(&sc->axe_sleeplock);
 		mtx_destroy(&sc->axe_mtx);
-		return ENXIO;
+		return error;
 	}
 
 	/*

Modified: stable/7/sys/dev/usb/if_rue.c
==============================================================================
--- stable/7/sys/dev/usb/if_rue.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/dev/usb/if_rue.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -349,9 +349,6 @@ rue_miibus_readreg(device_t dev, int phy
 	int			rval;
 	int			ruereg;
 
-	if (phy != 0)		/* RTL8150 supports PHY == 0, only */
-		return (0);
-
 	switch (reg) {
 	case MII_BMCR:
 		ruereg = RUE_BMCR;
@@ -392,9 +389,6 @@ rue_miibus_writereg(device_t dev, int ph
 	struct rue_softc	*sc = device_get_softc(dev);
 	int			ruereg;
 
-	if (phy != 0)		/* RTL8150 supports PHY == 0, only */
-		return (0);
-
 	switch (reg) {
 	case MII_BMCR:
 		ruereg = RUE_BMCR;
@@ -584,13 +578,14 @@ rue_attach(device_t self)
 	usbd_status			err;
 	usb_interface_descriptor_t	*id;
 	usb_endpoint_descriptor_t	*ed;
-	int				i;
+	int				error, i;
 	struct rue_type			*t;
 
 	sc->rue_dev = self;
 	sc->rue_udev = uaa->device;
 
 	if (usbd_set_config_no(sc->rue_udev, RUE_CONFIG_NO, 0)) {
+		error = ENXIO;
 		device_printf(sc->rue_dev, "getting interface handle failed\n");
 		goto error;
 	}
@@ -599,6 +594,7 @@ rue_attach(device_t self)
 
 	err = usbd_device2interface_handle(uaa->device, RUE_IFACE_IDX, &iface);
 	if (err) {
+		error = ENXIO;
 		device_printf(sc->rue_dev, "getting interface handle failed\n");
 		goto error;
 	}
@@ -621,6 +617,7 @@ rue_attach(device_t self)
 	for (i = 0; i < id->bNumEndpoints; i++) {
 		ed = usbd_interface2endpoint_descriptor(iface, i);
 		if (ed == NULL) {
+			error = ENXIO;
 			device_printf(sc->rue_dev, "couldn't get ep %d\n", i);
 			goto error;
 		}
@@ -647,12 +644,14 @@ rue_attach(device_t self)
 	err = rue_read_mem(sc, RUE_EEPROM_IDR0,
 			   (caddr_t)&eaddr, ETHER_ADDR_LEN);
 	if (err) {
+		error = ENXIO;
 		device_printf(sc->rue_dev, "couldn't get station address\n");
 		goto error1;
 	}
 
 	ifp = sc->rue_ifp = if_alloc(IFT_ETHER);
 	if (ifp == NULL) {
+		error = ENXIO;
 		device_printf(sc->rue_dev, "can not if_alloc()\n");
 		goto error1;
 	}
@@ -667,10 +666,14 @@ rue_attach(device_t self)
 	ifp->if_init = rue_init;
 	ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
 
-	/* MII setup */
-	if (mii_phy_probe(self, &sc->rue_miibus,
-			  rue_ifmedia_upd, rue_ifmedia_sts)) {
-		device_printf(sc->rue_dev, "MII without any PHY!\n");
+	/*
+	 * MII setup
+	 * RTL8150 supports PHY == 0 only
+	 */
+	error = mii_attach(self, &sc->rue_miibus, ifp, rue_ifmedia_upd,
+	    rue_ifmedia_sts, BMSR_DEFCAPMASK, 0, MII_OFFSET_ANY, 0);
+	if (error != 0) {
+		device_printf(sc->rue_dev, "attaching PHYs failed\n");
 		goto error2;
 	}
 
@@ -692,7 +695,7 @@ rue_attach(device_t self)
 	RUE_UNLOCK(sc);
 	mtx_destroy(&sc->rue_mtx);
     error:
-	return ENXIO;
+	return error;
 }
 
 static int

Modified: stable/7/sys/dev/usb/if_udav.c
==============================================================================
--- stable/7/sys/dev/usb/if_udav.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/dev/usb/if_udav.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -298,6 +298,9 @@ udav_attach(device_t self)
 	struct mii_data *mii;
 #endif
 	u_char eaddr[ETHER_ADDR_LEN];
+#if defined(__FreeBSD__)
+	int error;
+#endif
 	int i;
 #if defined(__NetBSD__)
 	int s;
@@ -444,13 +447,16 @@ udav_attach(device_t self)
 	if_attach(ifp);
 	Ether_ifattach(ifp, eaddr);
 #elif defined(__FreeBSD__)
-	if (mii_phy_probe(self, &sc->sc_miibus,
-	    udav_ifmedia_change, udav_ifmedia_status)) {
-		printf("%s: MII without any PHY!\n", device_get_nameunit(sc->sc_dev));
+	/* one internal PHY only */
+	error = mii_attach(self, &sc->sc_miibus, ifp, udav_ifmedia_change,
+	    udav_ifmedia_status, BMSR_DEFCAPMASK, 0, MII_OFFSET_ANY, 0);
+	if (error != 0) {
+		printf("%s: attaching PHYs failed\\n",
+		    device_get_nameunit(sc->sc_dev));
 		if_free(ifp);
 		UDAV_UNLOCK(sc);
 		mtx_destroy(&sc->sc_mtx);
-		return ENXIO;
+		return error;
 	}
 
 	sc->sc_qdat.ifp = ifp;
@@ -1822,13 +1828,6 @@ udav_miibus_readreg(device_t dev, int ph
 		return (0);
 	}
 
-	/* XXX: one PHY only for the internal PHY */
-	if (phy != 0) {
-		DPRINTFN(0xff, ("%s: %s: phy=%d is not supported\n",
-			 device_get_nameunit(sc->sc_dev), __func__, phy));
-		return (0);
-	}
-
 	udav_lock_mii(sc);
 
 	/* select internal PHY and set PHY register address */
@@ -1878,13 +1877,6 @@ udav_miibus_writereg(device_t dev, int p
 		return (0);	/* XXX real error? */
 	}
 
-	/* XXX: one PHY only for the internal PHY */
-	if (phy != 0) {
-		DPRINTFN(0xff, ("%s: %s: phy=%d is not supported\n",
-			 device_get_nameunit(sc->sc_dev), __func__, phy));
-		return (0);	/* XXX real error? */
-	}
-
 	udav_lock_mii(sc);
 
 	/* select internal PHY and set PHY register address */

Modified: stable/7/sys/pci/if_tl.c
==============================================================================
--- stable/7/sys/pci/if_tl.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/pci/if_tl.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -1280,9 +1280,11 @@ tl_attach(dev)
 	 * Do MII setup. If no PHYs are found, then this is a
 	 * bitrate ThunderLAN chip that only supports 10baseT
 	 * and AUI/BNC.
+	 * XXX mii_attach() can fail for reason different than
+	 * no PHYs found!
 	 */
-	if (mii_phy_probe(dev, &sc->tl_miibus,
-	    tl_ifmedia_upd, tl_ifmedia_sts)) {
+	if (mii_attach(dev, &sc->tl_miibus, ifp, tl_ifmedia_upd,
+	    tl_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0)) {
 		struct ifmedia		*ifm;
 		sc->tl_bitrate = 1;
 		ifmedia_init(&sc->ifmedia, 0, tl_ifmedia_upd, tl_ifmedia_sts);

Modified: stable/7/sys/pci/if_wb.c
==============================================================================
--- stable/7/sys/pci/if_wb.c	Sun Nov  7 17:35:42 2010	(r214924)
+++ stable/7/sys/pci/if_wb.c	Sun Nov  7 17:38:54 2010	(r214925)
@@ -859,9 +859,10 @@ wb_attach(dev)
 	/*
 	 * Do MII setup.
 	 */
-	if (mii_phy_probe(dev, &sc->wb_miibus,
-	    wb_ifmedia_upd, wb_ifmedia_sts)) {
-		error = ENXIO;
+	error = mii_attach(dev, &sc->wb_miibus, ifp, wb_ifmedia_upd,
+	    wb_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+	if (error != 0) {
+		device_printf(dev, "attaching PHYs failed\n");
 		goto fail;
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011071738.oA7Hcsw3065580>