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

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Wed Mar 7 11:12:29 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/48831bd7f442
changeset: 421:48831bd7f442
user:      ray at terran.dlink.ua
date:      Wed Mar 07 13:11:34 2012 +0200
description:
Reduce PHY caps to 100base if switch have only 10/100 ports.

diffstat:

 head/sys/dev/switch/bcm5325_switch.c |  25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diffs (56 lines):

diff -r 7b1db4e778c8 -r 48831bd7f442 head/sys/dev/switch/bcm5325_switch.c
--- a/head/sys/dev/switch/bcm5325_switch.c	Mon Mar 05 17:38:38 2012 +0200
+++ b/head/sys/dev/switch/bcm5325_switch.c	Wed Mar 07 13:11:34 2012 +0200
@@ -210,9 +210,10 @@
 bcm5325_switch_attach(device_t dev)
 {
 	struct bcm5325_switch_softc *sc;
+	struct mii_softc	*miisc;
+	struct switch_softc	*ssc;
 	uint64_t reg;
 	uint64_t reg32;
-//	int i;
 
 	sc = device_get_softc(dev);
 	sc->parent = device_get_parent(dev);
@@ -275,11 +276,30 @@
 	case 0x5395:
 		sc->caps->ports = sc->ports = 9;
 		break;
+	case 0x5380:
+		/* 8 - 10/100, 2 - 10/100/1000 */
+		sc->caps->ports = sc->ports = 10;
+		break;
 	default:
 		/* XXX: trick, last digit of id + 1 MII port */
 		sc->caps->ports = sc->ports = (sc->devid % 0xf) + 1;
 		break;
 	}
+
+	switch (sc->devid) {
+	/* XXX Incomplete list of 1000base.* switches */
+	case 0x53118:
+	case 0x53115:
+		break;
+	default:
+		ssc = device_get_softc(device_get_parent(dev));
+		miisc = &ssc->sc_mii;
+		/* Remove 1000base.* capabilities for 10/100 switches */
+#define	BMSR_EXTCAP	0x0001	/* Extended capability */
+		miisc->mii_capabilities &= ~BMSR_EXTCAP;
+		miisc->mii_extcapabilities = 0;
+		break;
+	}
 	sc->sc_dev = dev;
 
 #define S_C(x) SWITCH_CAPS_ ## x
@@ -336,6 +356,9 @@
 	}
 
 	/*
+	 * XXX: We need prefetch existing sc->base_vlan here.
+	 */
+	/*
 	 * XXX: Avoid default configuration, bootloader must set it or we
 	 * must load user defined
 	 */


More information about the Zrouter-src-freebsd mailing list