Module Name:    src
Committed By:   martin
Date:           Thu Oct 24 16:03:38 UTC 2019

Modified Files:
        src/sys/dev/pci [netbsd-8]: if_bce.c if_bcereg.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1415):

        sys/dev/pci/if_bce.c: revision 1.55
        sys/dev/pci/if_bce.c: revision 1.56
        sys/dev/pci/if_bcereg.h: revision 1.5

- Add missing splnet()/splx() around mii_tick(). Same as OpenBSD rev. 1.23
- Use device_printf() instead of aprint_error_dev)() in bce_watchdog().
- Remove unnecessary inclusion.

 -

>From OpenBSD:
 - Mark ETHERCAP_VLAN_MTU.
 - Clear the powerdown mode. Fixes PR kern/24911 reported by Werner Backes.
 - Set proper LED modes.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.46.4.1 src/sys/dev/pci/if_bce.c
cvs rdiff -u -r1.4 -r1.4.156.1 src/sys/dev/pci/if_bcereg.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/pci/if_bce.c
diff -u src/sys/dev/pci/if_bce.c:1.46 src/sys/dev/pci/if_bce.c:1.46.4.1
--- src/sys/dev/pci/if_bce.c:1.46	Wed Apr 19 07:35:44 2017
+++ src/sys/dev/pci/if_bce.c	Thu Oct 24 16:03:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bce.c,v 1.46 2017/04/19 07:35:44 msaitoh Exp $	 */
+/* $NetBSD: if_bce.c,v 1.46.4.1 2019/10/24 16:03:38 martin Exp $	 */
 
 /*
  * Copyright (c) 2003 Clifford Wright. All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.46 2017/04/19 07:35:44 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.46.4.1 2019/10/24 16:03:38 martin Exp $");
 
 #include "vlan.h"
 
@@ -63,8 +63,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1
 
 #include <dev/mii/mii.h>
 #include <dev/mii/miivar.h>
-#include <dev/mii/miidevs.h>
-#include <dev/mii/brgphyreg.h>
 
 #include <dev/pci/if_bcereg.h>
 
@@ -419,6 +417,8 @@ bce_attach(device_t parent, device_t sel
 	ifp->if_stop = bce_stop;
 	IFQ_SET_READY(&ifp->if_snd);
 
+	sc->ethercom.ec_capabilities |= ETHERCAP_VLAN_MTU;
+
 	/* Initialize our media structures and probe the MII. */
 
 	sc->bce_mii.mii_ifp = ifp;
@@ -648,7 +648,7 @@ bce_watchdog(struct ifnet *ifp)
 {
 	struct bce_softc *sc = ifp->if_softc;
 
-	aprint_error_dev(sc->bce_dev, "device timeout\n");
+	device_printf(sc->bce_dev, "device timeout\n");
 	ifp->if_oerrors++;
 
 	(void) bce_init(ifp);
@@ -915,10 +915,15 @@ bce_init(struct ifnet *ifp)
 	sc->bce_txsnext = 0;
 	sc->bce_txin = 0;
 
-	/* enable crc32 generation */
+	/* enable crc32 generation and set proper LED modes */
 	bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_MACCTL,
 	    bus_space_read_4(sc->bce_btag, sc->bce_bhandle, BCE_MACCTL) |
-	    BCE_EMC_CG);
+	    BCE_EMC_CRC32_ENAB | BCE_EMC_LED);
+
+	/* reset or clear powerdown control bit  */
+	bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_MACCTL,
+	    bus_space_read_4(sc->bce_btag, sc->bce_bhandle, BCE_MACCTL) &
+	    ~BCE_EMC_PDOWN);
 
 	/* setup DMA interrupt control */
 	bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_DMAI_CTL, 1 << 24);	/* MAGIC */
@@ -1464,9 +1469,11 @@ static void
 bce_tick(void *v)
 {
 	struct bce_softc *sc = v;
+	int s;
 
-	/* Tick the MII. */
+	s = splnet();
 	mii_tick(&sc->bce_mii);
+	splx(s);
 
 	callout_reset(&sc->bce_timeout, hz, bce_tick, sc);
 }

Index: src/sys/dev/pci/if_bcereg.h
diff -u src/sys/dev/pci/if_bcereg.h:1.4 src/sys/dev/pci/if_bcereg.h:1.4.156.1
--- src/sys/dev/pci/if_bcereg.h:1.4	Sun Dec 11 12:22:49 2005
+++ src/sys/dev/pci/if_bcereg.h	Thu Oct 24 16:03:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bcereg.h,v 1.4 2005/12/11 12:22:49 christos Exp $	 */
+/* $NetBSD: if_bcereg.h,v 1.4.156.1 2019/10/24 16:03:38 martin Exp $	 */
 
 /*
  * Copyright (c) 2003 Clifford Wright. All rights reserved.
@@ -71,7 +71,10 @@
 /* Ethernet MAC Control */
 #define BCE_MACCTL			0x00A8	/* ethernet mac control */
 /* mac control bits */
-#define BCE_EMC_CG			0x00000001	/* crc32 generation */
+#define BCE_EMC_CRC32_ENAB		0x00000001	/* crc32 generation */
+#define BCE_EMC_PDOWN			0x00000004	/* PHY powerdown */
+#define BCE_EMC_EDET			0x00000008	/* PHY energy detect */
+#define BCE_EMC_LED			0x000000e0	/* PHY LED control */
 
 /* DMA Interrupt control */
 #define BCE_DMAI_CTL			0x0100

Reply via email to