Module Name:    src
Committed By:   msaitoh
Date:           Tue Mar 19 04:10:13 UTC 2013

Modified Files:
        src/sys/dev/mii: brgphy.c
        src/sys/dev/pci: if_bge.c if_bgereg.h

Log Message:
- Rename PHY related flags for the consistency. It's the same as FreeBSD.
- Remove BGE_10_100_ONLY flag because this was not used.
  For 10/100 devices, when calling mii_attach(), mask BMSR_EXTSTAT flag to
  not to check Gigabit flags. It's the same as FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/mii/brgphy.c
cvs rdiff -u -r1.219 -r1.220 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/pci/if_bgereg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/brgphy.c
diff -u src/sys/dev/mii/brgphy.c:1.61 src/sys/dev/mii/brgphy.c:1.62
--- src/sys/dev/mii/brgphy.c:1.61	Fri Mar 15 06:18:13 2013
+++ src/sys/dev/mii/brgphy.c	Tue Mar 19 04:10:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphy.c,v 1.61 2013/03/15 06:18:13 msaitoh Exp $	*/
+/*	$NetBSD: brgphy.c,v 1.62 2013/03/19 04:10:12 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.61 2013/03/15 06:18:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.62 2013/03/19 04:10:12 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -709,12 +709,12 @@ brgphy_reset(struct mii_softc *sc)
 				PHY_WRITE(sc, BRGPHY_MII_EPHY_PTEST, 0x12);
 
 			/* Enable Ethernet@Wirespeed */
-			if (!(bsc->sc_phyflags & BGE_NO_ETH_WIRE_SPEED))
+			if (!(bsc->sc_phyflags & BGE_PHY_NO_WIRESPEED))
 				brgphy_eth_wirespeed(sc);
 
 #if 0
 			/* Enable Link LED on Dell boxes */
-			if (bsc->sc_phyflags & BGE_NO_3LED) {
+			if (bsc->sc_phyflags & BGE_PHY_NO_3LED) {
 				PHY_WRITE(sc, BRGPHY_MII_PHY_EXTCTL, 
 				PHY_READ(sc, BRGPHY_MII_PHY_EXTCTL)
 					& ~BRGPHY_PHY_EXTCTL_3_LED);

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.219 src/sys/dev/pci/if_bge.c:1.220
--- src/sys/dev/pci/if_bge.c:1.219	Tue Mar 19 03:40:16 2013
+++ src/sys/dev/pci/if_bge.c	Tue Mar 19 04:10:13 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.219 2013/03/19 03:40:16 msaitoh Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.220 2013/03/19 04:10:13 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.219 2013/03/19 03:40:16 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.220 2013/03/19 04:10:13 msaitoh Exp $");
 
 #include "vlan.h"
 
@@ -3164,6 +3164,7 @@ bge_attach(device_t parent, device_t sel
 	bus_size_t		memsize, apesize;
 	uint32_t		pm_ctl;
 	bool			no_seeprom;
+	int			capmask;
 
 	bp = bge_lookup(pa);
 	KASSERT(bp != NULL);
@@ -3368,11 +3369,6 @@ bge_attach(device_t parent, device_t sel
 	if (BGE_IS_5700_FAMILY(sc))
 		sc->bge_flags |= BGE_JUMBO_CAPABLE;
 
-	if ((BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5700 ||
-	    BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5701) &&
-	    PCI_VENDOR(subid) == PCI_VENDOR_DELL)
-		sc->bge_flags |= BGE_NO_3LED;
-
 	misccfg = CSR_READ_4(sc, BGE_MISC_CFG);
 	misccfg &= BGE_MISCCFG_BOARD_ID_MASK;
 
@@ -3403,6 +3399,7 @@ bge_attach(device_t parent, device_t sel
 			sc->bge_flags |= BGE_TSO;
 	}
 
+	capmask = 0xffffffff; /* XXX BMSR_DEFCAPMASK */
 	if ((BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5703 &&
 	     (misccfg == 0x4000 || misccfg == 0x8000)) ||
 	    (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5705 &&
@@ -3417,16 +3414,18 @@ bge_attach(device_t parent, device_t sel
 	    PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57790 ||
 	    PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57791 ||
 	    PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57795 ||
-	    BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906)
-		sc->bge_flags |= BGE_10_100_ONLY;
+	    BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906) {
+		capmask &= ~BMSR_EXTSTAT;
+		sc->bge_flags |= BGE_PHY_NO_WIRESPEED;
+	}
 
 	if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5700 ||
 	    (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5705 &&
 	     (sc->bge_chipid != BGE_CHIPID_BCM5705_A0 &&
-	      sc->bge_chipid != BGE_CHIPID_BCM5705_A1)) ||
-	    BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906)
-		sc->bge_flags |= BGE_NO_ETH_WIRE_SPEED;
+		 sc->bge_chipid != BGE_CHIPID_BCM5705_A1)))
+		sc->bge_flags |= BGE_PHY_NO_WIRESPEED;
 
+	/* Set various PHY bug flags. */
 	if (sc->bge_chipid == BGE_CHIPID_BCM5701_A0 ||
 	    sc->bge_chipid == BGE_CHIPID_BCM5701_B0)
 		sc->bge_flags |= BGE_PHY_CRC_BUG;
@@ -3435,7 +3434,10 @@ bge_attach(device_t parent, device_t sel
 		sc->bge_flags |= BGE_PHY_ADC_BUG;
 	if (sc->bge_chipid == BGE_CHIPID_BCM5704_A0)
 		sc->bge_flags |= BGE_PHY_5704_A0_BUG;
-
+	if ((BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5700 ||
+	    BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5701) &&
+	    PCI_VENDOR(subid) == PCI_VENDOR_DELL)
+		sc->bge_flags |= BGE_PHY_NO_3LED;
 	if (BGE_IS_5705_PLUS(sc) &&
 	    BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5906 &&
 	    BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5785 &&
@@ -3686,7 +3688,7 @@ bge_attach(device_t parent, device_t sel
 
 		ifmedia_init(&sc->bge_mii.mii_media, 0, bge_ifmedia_upd,
 			     bge_ifmedia_sts);
-		mii_attach(sc->bge_dev, &sc->bge_mii, 0xffffffff,
+		mii_attach(sc->bge_dev, &sc->bge_mii, capmask,
 			   sc->bge_phy_addr, MII_OFFSET_ANY,
 			   MIIF_DOPAUSE);
 
@@ -5673,8 +5675,6 @@ bge_debug_info(struct bge_softc *sc)
 		printf(" - PCI-X Bus\n");
 	if (sc->bge_flags & BGE_PCIE)
 		printf(" - PCI Express Bus\n");
-	if (sc->bge_flags & BGE_NO_3LED)
-		printf(" - No 3 LEDs\n");
 	if (sc->bge_flags & BGE_RX_ALIGNBUG)
 		printf(" - RX Alignment Bug\n");
 	if (sc->bge_flags & BGE_APE)
@@ -5683,6 +5683,23 @@ bge_debug_info(struct bge_softc *sc)
 		printf(" - CPMU\n");
 	if (sc->bge_flags & BGE_TSO)
 		printf(" - TSO\n");
+
+	if (sc->bge_flags & BGE_PHY_NO_3LED)
+		printf(" - No 3 LEDs\n");
+	if (sc->bge_flags & BGE_PHY_CRC_BUG)
+		printf(" - CRC bug\n");
+	if (sc->bge_flags & BGE_PHY_ADC_BUG)
+		printf(" - ADC bug\n");
+	if (sc->bge_flags & BGE_PHY_5704_A0_BUG)
+		printf(" - 5704 A0 bug\n");
+	if (sc->bge_flags & BGE_PHY_JITTER_BUG)
+		printf(" - jitter bug\n");
+	if (sc->bge_flags & BGE_PHY_BER_BGU)
+		printf(" - BER bug\n");
+	if (sc->bge_flags & BGE_PHY_ADJUST_TRIM)
+		printf(" - adjust trim\n");
+	if (sc->bge_flags & BGE_PHY_NO_WIRESPEED)
+		printf(" - no wirespeed\n");
 }
 #endif /* BGE_DEBUG */
 

Index: src/sys/dev/pci/if_bgereg.h
diff -u src/sys/dev/pci/if_bgereg.h:1.65 src/sys/dev/pci/if_bgereg.h:1.66
--- src/sys/dev/pci/if_bgereg.h:1.65	Tue Mar 19 03:40:16 2013
+++ src/sys/dev/pci/if_bgereg.h	Tue Mar 19 04:10:13 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bgereg.h,v 1.65 2013/03/19 03:40:16 msaitoh Exp $	*/
+/*	$NetBSD: if_bgereg.h,v 1.66 2013/03/19 04:10:13 msaitoh Exp $	*/
 /*
  * Copyright (c) 2001 Wind River Systems
  * Copyright (c) 1997, 1998, 1999, 2001
@@ -2601,7 +2601,7 @@ struct vpd_key {
 #define BGE_RXRING_VALID	0x00000002
 #define BGE_JUMBO_RXRING_VALID	0x00000004
 #define BGE_RX_ALIGNBUG		0x00000008
-#define BGE_NO_3LED		0x00000010
+#define BGE_PHY_NO_3LED		0x00000010
 #define BGE_PCIX		0x00000020
 #define BGE_PCIE		0x00000040
 #define BGE_NO_EEPROM		0x00000100
@@ -2615,7 +2615,7 @@ struct vpd_key {
 #define BGE_PHY_JITTER_BUG	0x00010000
 #define BGE_PHY_BER_BUG		0x00020000
 #define BGE_PHY_ADJUST_TRIM	0x00040000
-#define BGE_NO_ETH_WIRE_SPEED	0x00080000
+#define BGE_PHY_NO_WIRESPEED	0x00080000
 #define BGE_IS_5788		0x00100000
 #define BGE_5705_PLUS		0x00200000
 #define BGE_575X_PLUS		0x00400000

Reply via email to