[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Sat Mar 10 19:53:49 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/5624b06c8184
changeset: 425:5624b06c8184
user:      ray at terran.dlink.ua
date:      Sat Mar 10 21:54:25 2012 +0200
description:
Fix early link state. Those will allow BOOTP/NFS boot.

diffstat:

 head/sys/dev/switch/switch_mii.c |  18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diffs (56 lines):

diff -r 817be45db283 -r 5624b06c8184 head/sys/dev/switch/switch_mii.c
--- a/head/sys/dev/switch/switch_mii.c	Thu Mar 08 14:40:47 2012 +0200
+++ b/head/sys/dev/switch/switch_mii.c	Sat Mar 10 21:54:25 2012 +0200
@@ -56,6 +56,8 @@
 static int 	switch_mii_attach(device_t);
 static uint32_t	switch_mii_read4(device_t, uint32_t);
 static void	switch_mii_write4(device_t, uint32_t, uint32_t);
+static int	switch_mii_service(struct mii_softc *, struct mii_data *, int);
+static void	switch_mii_status(struct mii_softc *);
 
 static device_method_t switch_mii_methods[] = {
 	/* device interface */
@@ -86,9 +88,6 @@
 DRIVER_MODULE(switch, miibus, switch_mii_driver, switch_mii_devclass, 0, 0);
 DRIVER_MODULE(switch, mii, switch_mii_driver, switch_mii_devclass, 0, 0);
 
-static int	switch_mii_service(struct mii_softc *, struct mii_data *, int);
-static void	switch_mii_status(struct mii_softc *);
-
 static const struct mii_phy_funcs switch_mii_funcs = {
 	switch_mii_service,
 	switch_mii_status,
@@ -143,7 +142,8 @@
 	ma = device_get_ivars(dev);
 
 	/* XXX: better to ask attached switch driver about supported media */
-	sc->mii_capabilities = BMSR_100TXFDX | BMSR_100TXHDX | BMSR_EXTCAP;
+	sc->mii_capabilities = BMSR_ANEG | BMSR_100TXFDX | BMSR_100TXHDX;
+	sc->mii_capabilities |= BMSR_EXTCAP;
 	sc->mii_extcapabilities = EXTSR_1000TFDX | EXTSR_1000THDX |
 	    EXTSR_1000XFDX | EXTSR_1000XHDX;
 
@@ -187,8 +187,13 @@
 		switch (IFM_SUBTYPE(ife->ifm_media)) {
 		case IFM_AUTO:
 			mii->mii_media_status = IFM_AVALID | IFM_ACTIVE;
-			mii->mii_media_active = IFM_ETHER | IFM_1000_T |
-			    IFM_FDX;
+			if ((sc->mii_capabilities & BMSR_EXTCAP) &&
+			    (sc->mii_extcapabilities & EXTSR_1000TFDX))
+				mii->mii_media_active = IFM_ETHER |
+				    IFM_1000_T | IFM_FDX;
+			else
+				mii->mii_media_active = IFM_ETHER |
+				    IFM_100_TX | IFM_FDX;
 			break;
 		case IFM_1000_T:
 			mii->mii_media_status = IFM_AVALID | IFM_ACTIVE;
@@ -215,6 +220,7 @@
 			return (EINVAL);
 		}
 		break;
+		mii_phy_setmedia(sc);
 
 	case MII_TICK:
 		/* Call switch to do periodic work */


More information about the Zrouter-src-freebsd mailing list