CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 13:19:40 UTC 2022

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: if_emac.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/dev/if_emac.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.56 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.57
--- src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.56	Tue Mar 30 02:25:24 2021
+++ src/sys/arch/powerpc/ibm4xx/dev/if_emac.c	Sun Sep 18 13:19:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_emac.c,v 1.56 2021/03/30 02:25:24 rin Exp $	*/
+/*	$NetBSD: if_emac.c,v 1.57 2022/09/18 13:19:40 thorpej Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.56 2021/03/30 02:25:24 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.57 2022/09/18 13:19:40 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_emac.h"
@@ -671,7 +671,7 @@ emac_start(struct ifnet *ifp)
 
 	lasttx = 0;	/* XXX gcc */
 
-	if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
 		return;
 
 	/*
@@ -740,7 +740,6 @@ emac_start(struct ifnet *ifp)
 			 * layer that there are not more slots left.
 			 *
 			 */
-			ifp->if_flags |= IFF_OACTIVE;
 			bus_dmamap_unload(sc->sc_dmat, dmamap);
 			EMAC_EVCNT_INCR(>sc_ev_txdstall);
 			break;
@@ -831,10 +830,6 @@ emac_start(struct ifnet *ifp)
 		bpf_mtap(ifp, m0, BPF_D_OUT);
 	}
 
-	if (sc->sc_txfree == 0)
-		/* No more slots left; notify upper layer. */
-		ifp->if_flags |= IFF_OACTIVE;
-
 	if (sc->sc_txfree != ofree)
 		/* Set a watchdog timer in case the chip flakes out. */
 		ifp->if_timer = 5;
@@ -1050,11 +1045,10 @@ emac_init(struct ifnet *ifp)
 	 * ... all done!
 	 */
 	ifp->if_flags |= IFF_RUNNING;
-	ifp->if_flags &= ~IFF_OACTIVE;
 
  out:
 	if (error) {
-		ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+		ifp->if_flags &= ~IFF_RUNNING;
 		ifp->if_timer = 0;
 		aprint_error_ifnet(ifp, "interface not running\n");
 	}
@@ -1100,7 +1094,7 @@ emac_stop(struct ifnet *ifp, int disable
 	/*
 	 * Mark the interface down and cancel the watchdog timer.
 	 */
-	ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+	ifp->if_flags &= ~IFF_RUNNING;
 	ifp->if_timer = 0;
 }
 
@@ -1268,8 +1262,6 @@ emac_txreap(struct emac_softc *sc)
 	EMAC_EVCNT_INCR(>sc_ev_txreap);
 	handled = 0;
 
-	ifp->if_flags &= ~IFF_OACTIVE;
-
 	count = 0;
 	/*
 	 * Go through our Tx list and free mbufs for those



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 13:19:40 UTC 2022

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: if_emac.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c

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



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2021-03-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Mar 30 02:25:24 UTC 2021

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: emacreg.h if_emac.c

Log Message:
Support OPB running @ 33MHz for 405GP based boards.
No need to modify EMAC_MR1 register this case
(STACR_OPBC fields are reserved for 405GP).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/powerpc/ibm4xx/dev/emacreg.h
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/dev/emacreg.h
diff -u src/sys/arch/powerpc/ibm4xx/dev/emacreg.h:1.4 src/sys/arch/powerpc/ibm4xx/dev/emacreg.h:1.5
--- src/sys/arch/powerpc/ibm4xx/dev/emacreg.h:1.4	Mon Jul  6 09:34:17 2020
+++ src/sys/arch/powerpc/ibm4xx/dev/emacreg.h	Tue Mar 30 02:25:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: emacreg.h,v 1.4 2020/07/06 09:34:17 rin Exp $	*/
+/*	$NetBSD: emacreg.h,v 1.5 2021/03/30 02:25:24 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -215,6 +215,7 @@
 #define	  STACR_PHYE		  0x4000	/* PHY error */
 #define	  STACR_WRITE		  0x2000	/* STA command - write */
 #define	  STACR_READ		  0x1000	/* STA command - read */
+#define	  STACR_OPBC_33MHZ	  0x0		/*   -  33MHz */
 #define	  STACR_OPBC_50MHZ	  0x0		/*   -  50MHz */
 #define	  STACR_OPBC_66MHZ	  0x1		/*   -  66MHz */
 #define	  STACR_OPBC_83MHZ	  0x2		/*   -  83MHz */

Index: src/sys/arch/powerpc/ibm4xx/dev/if_emac.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.55 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.56
--- src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.55	Sat Feb 27 20:43:58 2021
+++ src/sys/arch/powerpc/ibm4xx/dev/if_emac.c	Tue Mar 30 02:25:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_emac.c,v 1.55 2021/02/27 20:43:58 rin Exp $	*/
+/*	$NetBSD: if_emac.c,v 1.56 2021/03/30 02:25:24 rin Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.55 2021/02/27 20:43:58 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.56 2021/03/30 02:25:24 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_emac.h"
@@ -456,6 +456,7 @@ emac_attach(device_t parent, device_t se
 
 	opb_freq = opb_get_frequency();
 	switch (opb_freq) {
+	case  : opbc =  STACR_OPBC_33MHZ; break;
 	case  5000: opbc =  STACR_OPBC_50MHZ; break;
 	case  : opbc =  STACR_OPBC_66MHZ; break;
 	case  8333: opbc =  STACR_OPBC_83MHZ; break;



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2021-03-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Mar 30 02:25:24 UTC 2021

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: emacreg.h if_emac.c

Log Message:
Support OPB running @ 33MHz for 405GP based boards.
No need to modify EMAC_MR1 register this case
(STACR_OPBC fields are reserved for 405GP).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/powerpc/ibm4xx/dev/emacreg.h
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c

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



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2021-01-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Jan 24 05:22:22 UTC 2021

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: if_emac.c

Log Message:
Add rnd(9) support.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/dev/if_emac.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.53 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.54
--- src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.53	Mon Jul  6 09:34:17 2020
+++ src/sys/arch/powerpc/ibm4xx/dev/if_emac.c	Sun Jan 24 05:22:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_emac.c,v 1.53 2020/07/06 09:34:17 rin Exp $	*/
+/*	$NetBSD: if_emac.c,v 1.54 2021/01/24 05:22:21 rin Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.53 2020/07/06 09:34:17 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.54 2021/01/24 05:22:21 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_emac.h"
@@ -67,6 +67,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 
 #include 
 #include 
 
+#include 
+
 #include 		/* for PAGE_SIZE */
 
 #include 
@@ -210,6 +212,8 @@ struct emac_softc {
 
 	int sc_rxptr;			/* next ready RX descriptor/descsoft */
 
+	krndsource_t rnd_source;	/* random source */
+
 	void (*sc_rmii_enable)(device_t, int);		/* reduced MII enable */
 	void (*sc_rmii_disable)(device_t, int);		/* reduced MII disable*/
 	void (*sc_rmii_speed)(device_t, int, int);	/* reduced MII speed */
@@ -555,6 +559,9 @@ emac_attach(device_t parent, device_t se
 	if_deferred_start_init(ifp, NULL);
 	ether_ifattach(ifp, enaddr);
 
+	rnd_attach_source(>rnd_source, xname, RND_TYPE_NET,
+	RND_FLAG_DEFAULT);
+
 #ifdef EMAC_EVENT_COUNTERS
 	/*
 	 * Attach the event counters.
@@ -1254,13 +1261,14 @@ emac_txreap(struct emac_softc *sc)
 	struct ifnet *ifp = >sc_ethercom.ec_if;
 	struct emac_txsoft *txs;
 	int handled, i;
-	uint32_t txstat;
+	uint32_t txstat, count;
 
 	EMAC_EVCNT_INCR(>sc_ev_txreap);
 	handled = 0;
 
 	ifp->if_flags &= ~IFF_OACTIVE;
 
+	count = 0;
 	/*
 	 * Go through our Tx list and free mbufs for those
 	 * frames that have been transmitted.
@@ -1317,6 +1325,8 @@ emac_txreap(struct emac_softc *sc)
 		bus_dmamap_unload(sc->sc_dmat, txs->txs_dmamap);
 		m_freem(txs->txs_mbuf);
 		txs->txs_mbuf = NULL;
+
+		count++;
 	}
 
 	/* Update the dirty transmit buffer pointer. */
@@ -1329,6 +1339,9 @@ emac_txreap(struct emac_softc *sc)
 	if (sc->sc_txsfree == EMAC_TXQUEUELEN)
 		ifp->if_timer = 0;
 
+	if (count != 0)
+		rnd_add_uint32(>rnd_source, count);
+
 	return handled;
 }
 
@@ -1582,11 +1595,12 @@ emac_rxeob_intr(void *arg)
 	struct ifnet *ifp = >sc_ethercom.ec_if;
 	struct emac_rxsoft *rxs;
 	struct mbuf *m;
-	uint32_t rxstat;
+	uint32_t rxstat, count;
 	int i, len;
 
 	EMAC_EVCNT_INCR(>sc_ev_rxintr);
 
+	count = 0;
 	for (i = sc->sc_rxptr; ; i = EMAC_NEXTRX(i)) {
 		rxs = >sc_rxsoft[i];
 
@@ -1681,11 +1695,16 @@ emac_rxeob_intr(void *arg)
 
 		/* Pass it on. */
 		if_percpuq_enqueue(ifp->if_percpuq, m);
+
+		count++;
 	}
 
 	/* Update the receive pointer. */
 	sc->sc_rxptr = i;
 
+	if (count != 0)
+		rnd_add_uint32(>rnd_source, count);
+
 	return 1;
 }
 



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2021-01-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Jan 24 05:22:22 UTC 2021

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: if_emac.c

Log Message:
Add rnd(9) support.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c

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



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2019-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Dec 15 09:38:40 UTC 2019

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: com_opb.c

Log Message:
Belatedly catch up with MI com(4) change in com.c rev. 1.351:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/ic/com.c#rev1.351

XXX
pullup to netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/powerpc/ibm4xx/dev/com_opb.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/dev/com_opb.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/com_opb.c:1.22 src/sys/arch/powerpc/ibm4xx/dev/com_opb.c:1.23
--- src/sys/arch/powerpc/ibm4xx/dev/com_opb.c:1.22	Sat Dec  8 17:46:12 2018
+++ src/sys/arch/powerpc/ibm4xx/dev/com_opb.c	Sun Dec 15 09:38:40 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: com_opb.c,v 1.22 2018/12/08 17:46:12 thorpej Exp $ */
+/* $NetBSD: com_opb.c,v 1.23 2019/12/15 09:38:40 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com_opb.c,v 1.22 2018/12/08 17:46:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_opb.c,v 1.23 2019/12/15 09:38:40 rin Exp $");
 
 #include 
 #include 
@@ -143,9 +143,6 @@ void
 com_opb_cnattach(int com_freq, int conaddr, int conspeed, int conmode)
 {
 	static int attached = 0;
-#if (NCOM > 0)
-	struct com_regs	regs;
-#endif
 
 	if (attached)
 		return;
@@ -153,12 +150,8 @@ com_opb_cnattach(int com_freq, int conad
 
 #if (NCOM > 0)
 	/* We *know* the com-console attaches to opb */
-	regs.cr_iot = opb_get_bus_space_tag();
-	regs.cr_iobase = conaddr;
-	regs.cr_nports = COM_NPORTS;
-	/* regs.ioh is initialized by comcnattach */
-
-	if (comcnattach1(, conspeed, com_freq, COM_TYPE_NORMAL, conmode))
+	if (comcnattach(opb_get_bus_space_tag(), conaddr, conspeed, com_freq,
+	COM_TYPE_NORMAL, conmode))
 		panic("can't init serial console @%x", conaddr);
 	else
 		return;



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2019-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Dec 15 09:38:40 UTC 2019

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: com_opb.c

Log Message:
Belatedly catch up with MI com(4) change in com.c rev. 1.351:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/ic/com.c#rev1.351

XXX
pullup to netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/powerpc/ibm4xx/dev/com_opb.c

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



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2014-10-16 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Oct 16 19:11:38 UTC 2014

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: if_emac.c

Log Message:
fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/dev/if_emac.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.42 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.43
--- src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.42	Thu Jun 26 07:50:29 2014
+++ src/sys/arch/powerpc/ibm4xx/dev/if_emac.c	Thu Oct 16 19:11:38 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_emac.c,v 1.42 2014/06/26 07:50:29 msaitoh Exp $	*/
+/*	$NetBSD: if_emac.c,v 1.43 2014/10/16 19:11:38 snj Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_emac.c,v 1.42 2014/06/26 07:50:29 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_emac.c,v 1.43 2014/10/16 19:11:38 snj Exp $);
 
 #include opt_emac.h
 
@@ -1671,7 +1671,7 @@ emac_rxeob_intr(void *arg)
 
 		/*
 		 * Pass this up to any BPF listeners, but only
-		 * pass if up the stack if it's for us.
+		 * pass it up the stack if it's for us.
 		 */
 		bpf_mtap(ifp, m);
 



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2014-10-16 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Oct 16 19:11:38 UTC 2014

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: if_emac.c

Log Message:
fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c

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



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2014-06-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 26 07:50:29 UTC 2014

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: if_emac.c

Log Message:
 Pass MIIF_DOPAUSE mask to mii_attach() in if_emac.c. emac(4) change a
register from IFM_FLOW flag, so this change is required to control the
setting via ifconfig. PR#48950. OK'd by matt@.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/dev/if_emac.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.41 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.42
--- src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.41	Sun Jul 22 14:32:52 2012
+++ src/sys/arch/powerpc/ibm4xx/dev/if_emac.c	Thu Jun 26 07:50:29 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_emac.c,v 1.41 2012/07/22 14:32:52 matt Exp $	*/
+/*	$NetBSD: if_emac.c,v 1.42 2014/06/26 07:50:29 msaitoh Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_emac.c,v 1.41 2012/07/22 14:32:52 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_emac.c,v 1.42 2014/06/26 07:50:29 msaitoh Exp $);
 
 #include opt_emac.h
 
@@ -522,7 +522,8 @@ emac_attach(device_t parent, device_t se
 
 	sc-sc_ethercom.ec_mii = mii;
 	ifmedia_init(mii-mii_media, 0, ether_mediachange, ether_mediastatus);
-	mii_attach(self, mii, 0x, mii_phy, MII_OFFSET_ANY, 0);
+	mii_attach(self, mii, 0x, mii_phy, MII_OFFSET_ANY,
+	MIIF_DOPAUSE);
 	if (LIST_FIRST(mii-mii_phys) == NULL) {
 		ifmedia_add(mii-mii_media, IFM_ETHER|IFM_NONE, 0, NULL);
 		ifmedia_set(mii-mii_media, IFM_ETHER|IFM_NONE);



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2014-06-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 26 07:50:29 UTC 2014

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: if_emac.c

Log Message:
 Pass MIIF_DOPAUSE mask to mii_attach() in if_emac.c. emac(4) change a
register from IFM_FLOW flag, so this change is required to control the
setting via ifconfig. PR#48950. OK'd by matt@.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c

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



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2014-02-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 25 14:09:13 UTC 2014

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: ecc_plb.c

Log Message:
Remove unused variable


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c:1.14 src/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c:1.15
--- src/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c:1.14	Sat Jun 18 06:41:42 2011
+++ src/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c	Tue Feb 25 14:09:13 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ecc_plb.c,v 1.14 2011/06/18 06:41:42 matt Exp $	*/
+/*	$NetBSD: ecc_plb.c,v 1.15 2014/02/25 14:09:13 martin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ecc_plb.c,v 1.14 2011/06/18 06:41:42 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: ecc_plb.c,v 1.15 2014/02/25 14:09:13 martin Exp $);
 
 #include locators.h
 
@@ -138,7 +138,7 @@ ecc_plb_intr(void *arg)
 {
 	struct ecc_plb_softc *sc = arg;
 	u_int32_t		esr, ear;
-	int			ce, ue;
+	int			ue;
 	u_quad_t		tb;
 	u_long			tmp, msr, dat;
 
@@ -174,7 +174,6 @@ ecc_plb_intr(void *arg)
 	if ((tb - sc-sc_ecc_tb)  sc-sc_ecc_iv)
 		return(1);
 
-	ce = (esr  SDRAM0_ECCESR_CE) != 0x00;
 	ue = (esr  SDRAM0_ECCESR_UE) != 0x00;
 
 	printf(ECC: Error CNT=%d ESR=%x EAR=%x %s BKNE=%d%d%d%d 



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2014-02-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 25 14:09:13 UTC 2014

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: ecc_plb.c

Log Message:
Remove unused variable


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c

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



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2012-06-24 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Jun 24 08:39:39 UTC 2012

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: if_emac.c

Log Message:
Flush current empty descriptor in emac_rxeob_intr().


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/dev/if_emac.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.39 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.40
--- src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.39	Sat Jun 18 06:41:42 2011
+++ src/sys/arch/powerpc/ibm4xx/dev/if_emac.c	Sun Jun 24 08:39:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_emac.c,v 1.39 2011/06/18 06:41:42 matt Exp $	*/
+/*	$NetBSD: if_emac.c,v 1.40 2012/06/24 08:39:39 kiyohara Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_emac.c,v 1.39 2011/06/18 06:41:42 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_emac.c,v 1.40 2012/06/24 08:39:39 kiyohara Exp $);
 
 #include opt_emac.h
 
@@ -1584,11 +1584,15 @@ emac_rxeob_intr(void *arg)
 
 		rxstat = sc-sc_rxdescs[i].md_stat_ctrl;
 
-		if (rxstat  MAL_RX_EMPTY)
+		if (rxstat  MAL_RX_EMPTY) {
 			/*
 			 * We have processed all of the receive buffers.
 			 */
+			/* Flush current empty descriptor */
+			EMAC_CDRXSYNC(sc, i,
+			BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
 			break;
+		}
 
 		/*
 		 * If an error occurred, update stats, clear the status



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2012-06-24 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Jun 24 08:39:39 UTC 2012

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: if_emac.c

Log Message:
Flush current empty descriptor in emac_rxeob_intr().


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c

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



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2011-06-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jun 18 08:17:58 UTC 2011

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: mal.c

Log Message:
Use __builtin_clz instead of our own cntlzw


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/powerpc/ibm4xx/dev/mal.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/dev/mal.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/mal.c:1.2 src/sys/arch/powerpc/ibm4xx/dev/mal.c:1.3
--- src/sys/arch/powerpc/ibm4xx/dev/mal.c:1.2	Sat Jun 18 06:41:42 2011
+++ src/sys/arch/powerpc/ibm4xx/dev/mal.c	Sat Jun 18 08:17:58 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mal.c,v 1.2 2011/06/18 06:41:42 matt Exp $ */
+/* $NetBSD: mal.c,v 1.3 2011/06/18 08:17:58 matt Exp $ */
 /*
  * Copyright (c) 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mal.c,v 1.2 2011/06/18 06:41:42 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: mal.c,v 1.3 2011/06/18 08:17:58 matt Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -39,7 +39,7 @@
 #include powerpc/ibm4xx/dev/malvar.h
 #include powerpc/ibm4xx/spr.h
 
-#define STAT_TO_CHAN(stat)	cntlzw(stat)
+#define STAT_TO_CHAN(stat)	__builtin_clz(stat)
 
 
 static int mal_txeob_intr(void *);



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2011-06-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jun 18 02:02:50 UTC 2011

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: wdog.c

Log Message:
Use aprint_normal   include sys/cpu.h


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/ibm4xx/dev/wdog.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/dev/wdog.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/wdog.c:1.11 src/sys/arch/powerpc/ibm4xx/dev/wdog.c:1.12
--- src/sys/arch/powerpc/ibm4xx/dev/wdog.c:1.11	Fri Jun 17 19:03:02 2011
+++ src/sys/arch/powerpc/ibm4xx/dev/wdog.c	Sat Jun 18 02:02:50 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: wdog.c,v 1.11 2011/06/17 19:03:02 matt Exp $ */
+/* $NetBSD: wdog.c,v 1.12 2011/06/18 02:02:50 matt Exp $ */
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -40,17 +40,19 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wdog.c,v 1.11 2011/06/17 19:03:02 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: wdog.c,v 1.12 2011/06/18 02:02:50 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/device.h
+#include sys/cpu.h
 #include sys/wdog.h
 
 #include prop/proplib.h
 
 #include powerpc/spr.h
 #include powerpc/ibm4xx/spr.h
+#include powerpc/ibm4xx/cpu.h
 #include powerpc/ibm4xx/dev/opbvar.h
 
 #include dev/sysmon/sysmonvar.h
@@ -94,7 +96,7 @@
 	processor_freq = (unsigned int) prop_number_integer_value(freq);
 
 	sc-sc_wdog_period = (2LL  29) / processor_freq;
-	printf(: %d second period\n, sc-sc_wdog_period);
+	aprint_normal(: %d second period\n, sc-sc_wdog_period);
 
 	sc-sc_dev = self;
 	sc-sc_smw.smw_name = device_xname(self);



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2011-06-12 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Jun 12 07:19:49 UTC 2011

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: gpiic_opb.c

Log Message:
Initialize i2cbus_attach_args before call config_found().  It has other member.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/powerpc/ibm4xx/dev/gpiic_opb.c

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



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2010-12-12 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon Dec 13 07:29:14 UTC 2010

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: plb.c

Log Message:
Fix PR#43911.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/powerpc/ibm4xx/dev/plb.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/dev/plb.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/plb.c:1.17 src/sys/arch/powerpc/ibm4xx/dev/plb.c:1.18
--- src/sys/arch/powerpc/ibm4xx/dev/plb.c:1.17	Tue Nov  9 06:48:19 2010
+++ src/sys/arch/powerpc/ibm4xx/dev/plb.c	Mon Dec 13 07:29:12 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: plb.c,v 1.17 2010/11/09 06:48:19 uebayasi Exp $ */
+/* $NetBSD: plb.c,v 1.18 2010/12/13 07:29:12 kiyohara Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: plb.c,v 1.17 2010/11/09 06:48:19 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: plb.c,v 1.18 2010/12/13 07:29:12 kiyohara Exp $);
 
 #include locators.h
 #include emac.h
@@ -180,7 +180,7 @@
 	}
 
 	while (local_plb_devs  local_plb_devs-plb_name != NULL) {
-		if (plb_devs[i].plb_pvr != pvr)
+		if (local_plb_devs-plb_pvr != pvr)
 			continue;
 
 		paa.plb_name = local_plb_devs-plb_name;



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2010-11-08 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Nov  9 06:48:19 UTC 2010

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: plb.c

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/powerpc/ibm4xx/dev/plb.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/dev/plb.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/plb.c:1.16 src/sys/arch/powerpc/ibm4xx/dev/plb.c:1.17
--- src/sys/arch/powerpc/ibm4xx/dev/plb.c:1.16	Sat Nov  6 16:30:15 2010
+++ src/sys/arch/powerpc/ibm4xx/dev/plb.c	Tue Nov  9 06:48:19 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: plb.c,v 1.16 2010/11/06 16:30:15 uebayasi Exp $ */
+/* $NetBSD: plb.c,v 1.17 2010/11/09 06:48:19 uebayasi Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: plb.c,v 1.16 2010/11/06 16:30:15 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: plb.c,v 1.17 2010/11/09 06:48:19 uebayasi Exp $);
 
 #include locators.h
 #include emac.h
@@ -100,7 +100,7 @@
 	{ IBM405GPR,	ecc, },
 	{ IBM405GPR,	opb, },
 	{ IBM405GPR,	pchb, },
-	{ IBM405GPR,exb, },
+	{ IBM405GPR,	exb, },
 
 	/* AMCC 405EX / EXR */
 	{ AMCC405EX,	cpu, },



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2010-11-08 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Nov  9 06:48:19 UTC 2010

Modified Files:
src/sys/arch/powerpc/ibm4xx/dev: plb.c

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/powerpc/ibm4xx/dev/plb.c

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



CVS commit: src/sys/arch/powerpc/ibm4xx/dev

2010-03-20 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Mar 20 15:22:27 UTC 2010

Added Files:
src/sys/arch/powerpc/ibm4xx/dev: zmiireg.h

Log Message:
Fix build failed.
  Add forgot zmiireg.h since support 405EX.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/powerpc/ibm4xx/dev/zmiireg.h

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

Added files:

Index: src/sys/arch/powerpc/ibm4xx/dev/zmiireg.h
diff -u /dev/null src/sys/arch/powerpc/ibm4xx/dev/zmiireg.h:1.1
--- /dev/null	Sat Mar 20 15:22:27 2010
+++ src/sys/arch/powerpc/ibm4xx/dev/zmiireg.h	Sat Mar 20 15:22:27 2010
@@ -0,0 +1,66 @@
+/*	$NetBSD: zmiireg.h,v 1.1 2010/03/20 15:22:27 kiyohara Exp $	*/
+/*
+ * Copyright (c) 2010 KIYOHARA Takashi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _IBM4XX_ZMIIREG_H_
+#define	_IBM4XX_ZMIIREG_H_
+
+/* ZMII Bridge (440EP/440GP/440GX) */
+
+#define ZMII0_SIZE		0x10
+
+#define ZMII0_FER		0x0	/* Function Enable Register */
+#define   FER_MDI_MASK		  0x	/* MDI enable */
+#define   FER_MDI(emac)		  (1  (31 - ((emac)  2)))
+#define   FER__MII_MASK		  0x7
+#define   FER__MII_MII		  0x1		/* MII Enable */
+#define   FER__MII_RMII		  0x2		/* ZMII (or RMII) Enable */
+#define   FER__MII_SMII		  0x4		/* SMII Enable */
+#define   FER__MII(emac, mii)	  ((mii)  (28 - ((emac)  2)))
+#define ZMII0_SSR		0x4	/* Speed Selection Register */
+#define   SSR_SCI(emac)		  (0x4  (28 - ((emac)  2))) /* Suppress Collision Indication */
+#define   SSR_FSS(emac)		  (0x2  (28 - ((emac)  2))) /* Force Speed Selection */
+#define   SSR_SP_10MBPS		  0x0
+#define   SSR_SP_100MBPS	  0x2
+#define   SSR_ZSP(emac, sp)	  ((sp)  (27 - ((emac)  2))) /* Speed Selection */
+#define ZMII0_SMIISR		0x8	/* SMII Status Register */
+#define   SMIISR_SHIFT(emac)	  (24 - ((emac)  3))
+#define   SMIISR_MASK		  0xff
+#define   SMIISR_E1		  0x01		/* RxD Set to 1 */
+#define   SMIISR_EC		  0x02		/* RxD False Carrier Detected */
+#define   SMIISR_EN_INVALID	  0x00		/* RxD Nibble  Invalid */
+#define   SMIISR_EN_VALID	  0x04		/* RxD Nibble  Valid */
+#define   SMIISR_EJ_OK		  0x00		/* RxD Jabber  OK */
+#define   SMIISR_EJ_ERROR	  0x08		/* RxD Jabber  Error */
+#define   SMIISR_EL_DOWN	  0x00		/* RxD Link  Down */
+#define   SMIISR_EL_UP		  0x10		/* RxD Link  Up */
+#define   SMIISR_ED_HALF	  0x00		/* RxD Duplex  Half */
+#define   SMIISR_ED_FULL	  0x20		/* RxD Duplex  Full */
+#define   SMIISR_ES_10		  0x00		/* RxD Speed  10MBit */
+#define   SMIISR_ES_100		  0x40		/* RxD Speed  100MBit */
+#define   SMIISR_EF		  0x80		/* RxD from Previous Frame */
+
+#endif	/* _IBM4XX_ZMIIREG_H_ */