CVS commit: src/sys/arch/newsmips/apbus

2023-12-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 20 04:30:27 UTC 2023

Modified Files:
src/sys/arch/newsmips/apbus: if_tlp_ap.c

Log Message:
Remove unnecessary .


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/newsmips/apbus/if_tlp_ap.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/newsmips/apbus/if_tlp_ap.c
diff -u src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.15 src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.16
--- src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.15	Wed May 29 06:17:28 2019
+++ src/sys/arch/newsmips/apbus/if_tlp_ap.c	Wed Dec 20 04:30:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tlp_ap.c,v 1.15 2019/05/29 06:17:28 msaitoh Exp $	*/
+/*	$NetBSD: if_tlp_ap.c,v 1.16 2023/12/20 04:30:27 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,13 +30,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.15 2019/05/29 06:17:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.16 2023/12/20 04:30:27 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 



CVS commit: src/sys/arch/newsmips/apbus

2023-12-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 20 04:30:27 UTC 2023

Modified Files:
src/sys/arch/newsmips/apbus: if_tlp_ap.c

Log Message:
Remove unnecessary .


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/newsmips/apbus/if_tlp_ap.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/newsmips/apbus

2023-08-22 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug 22 08:33:50 UTC 2023

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
remove global sndebug definition. looks like historical leftover replaced
by SNDEBUG definition.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.53 src/sys/arch/newsmips/apbus/if_sn.c:1.54
--- src/sys/arch/newsmips/apbus/if_sn.c:1.53	Tue Aug 22 07:13:33 2023
+++ src/sys/arch/newsmips/apbus/if_sn.c	Tue Aug 22 08:33:50 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.53 2023/08/22 07:13:33 andvar Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.54 2023/08/22 08:33:50 andvar Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.53 2023/08/22 07:13:33 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.54 2023/08/22 08:33:50 andvar Exp $");
 
 #include "opt_inet.h"
 
@@ -84,8 +84,6 @@ static inline u_int	sonicput(struct sn_s
 static inline int	sonic_read(struct sn_softc *, void *, int);
 static inline struct mbuf *sonic_get(struct sn_softc *, void *, int);
 
-int sndebug = 0;
-
 /*
  * SONIC buffers need to be aligned 16 or 32 bit aligned.
  * These macros calculate and verify alignment.



CVS commit: src/sys/arch/newsmips/apbus

2023-08-22 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug 22 08:33:50 UTC 2023

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
remove global sndebug definition. looks like historical leftover replaced
by SNDEBUG definition.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus

2023-08-22 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug 22 07:13:33 UTC 2023

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
newsmips: fix build with SNDEBUG option enabled.

It was broken since rev 1.21 24 years ago, and got more broken code later on:
remove leftover device_xname(sc->sc_dev) param from aprint_debug_dev in one 
block.
fix wrong method name devoce_xname to device_xname in second block.
rename et to eh for consistency, and define it (definition was removed in the 
past).
while here, improve the code with riastradh help to make it safer.

pullup to at least netbsd-10 is needed.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus

2023-08-22 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug 22 07:13:33 UTC 2023

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
newsmips: fix build with SNDEBUG option enabled.

It was broken since rev 1.21 24 years ago, and got more broken code later on:
remove leftover device_xname(sc->sc_dev) param from aprint_debug_dev in one 
block.
fix wrong method name devoce_xname to device_xname in second block.
rename et to eh for consistency, and define it (definition was removed in the 
past).
while here, improve the code with riastradh help to make it safer.

pullup to at least netbsd-10 is needed.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.52 src/sys/arch/newsmips/apbus/if_sn.c:1.53
--- src/sys/arch/newsmips/apbus/if_sn.c:1.52	Sun Sep 18 12:49:34 2022
+++ src/sys/arch/newsmips/apbus/if_sn.c	Tue Aug 22 07:13:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.52 2022/09/18 12:49:34 thorpej Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.53 2023/08/22 07:13:33 andvar Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.52 2022/09/18 12:49:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.53 2023/08/22 07:13:33 andvar Exp $");
 
 #include "opt_inet.h"
 
@@ -202,7 +202,7 @@ snsetup(struct sn_softc	*sc, uint8_t *ll
 
 #ifdef SNDEBUG
 	aprint_debug_dev(sc->sc_dev, "buffers: rra=%p cda=%p rda=%p tda=%p\n",
-	device_xname(sc->sc_dev), sc->p_rra[0], sc->p_cda,
+	sc->p_rra[0], sc->p_cda,
 	sc->p_rda, sc->mtda[0].mtd_txp);
 #endif
 
@@ -1033,15 +1033,6 @@ sonic_read(struct sn_softc *sc, void *pk
 	struct ifnet *ifp = >sc_if;
 	struct mbuf *m;
 
-#ifdef SNDEBUG
-	{
-		printf("%s: rcvd %p len=%d type=0x%x from %s",
-		devoce_xname(sc->sc_dev), et, len, htons(et->ether_type),
-		ether_sprintf(et->ether_shost));
-		printf(" (to %s)\n", ether_sprintf(et->ether_dhost));
-	}
-#endif /* SNDEBUG */
-
 	if (len < (ETHER_MIN_LEN - ETHER_CRC_LEN) ||
 	len > (ETHER_MAX_LEN - ETHER_CRC_LEN)) {
 		printf("%s: invalid packet length %d bytes\n",
@@ -1049,6 +1040,18 @@ sonic_read(struct sn_softc *sc, void *pk
 		return 0;
 	}
 
+#ifdef SNDEBUG
+	{   
+		struct ether_header eh_s, *eh = _s;
+		memcpy(eh, pkt, sizeof(*eh));
+		CTASSERT(sizeof(*eh) <= ETHER_MIN_LEN);
+		printf("%s: rcvd %p len=%d type=0x%x from %s",
+		device_xname(sc->sc_dev), eh, len, htons(eh->ether_type),
+		ether_sprintf(eh->ether_shost));
+		printf(" (to %s)\n", ether_sprintf(eh->ether_dhost));
+	}   
+#endif /* SNDEBUG */
+
 	m = sonic_get(sc, pkt, len);
 	if (m == NULL)
 		return 0;



CVS commit: src/sys/arch/newsmips/apbus

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 12:49:34 UTC 2022

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Eliminate use of IFF_OACTIVE, take 2.  (Not sure what happened there.)


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.51 src/sys/arch/newsmips/apbus/if_sn.c:1.52
--- src/sys/arch/newsmips/apbus/if_sn.c:1.51	Sun Sep 18 12:48:03 2022
+++ src/sys/arch/newsmips/apbus/if_sn.c	Sun Sep 18 12:49:34 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.51 2022/09/18 12:48:03 thorpej Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.52 2022/09/18 12:49:34 thorpej Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.51 2022/09/18 12:48:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.52 2022/09/18 12:49:34 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -430,7 +430,6 @@ sninit(struct sn_softc *sc)
 
 	/* flag interface as "running" */
 	sc->sc_if.if_flags |= IFF_RUNNING;
-	sc->sc_if.if_flags &= ~IFF_OACTIVE;
 
 	splx(s);
 	return 0;
@@ -904,8 +903,6 @@ sonictxint(struct sn_softc *sc)
 		}
 #endif /* SNDEBUG */
 
-		ifp->if_flags &= ~IFF_OACTIVE;
-
 		if (mtd->mtd_mbuf != 0) {
 			m_freem(mtd->mtd_mbuf);
 			mtd->mtd_mbuf = 0;



CVS commit: src/sys/arch/newsmips/apbus

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 12:49:34 UTC 2022

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Eliminate use of IFF_OACTIVE, take 2.  (Not sure what happened there.)


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 12:48:03 UTC 2022

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.50 src/sys/arch/newsmips/apbus/if_sn.c:1.51
--- src/sys/arch/newsmips/apbus/if_sn.c:1.50	Sat Aug 20 18:42:03 2022
+++ src/sys/arch/newsmips/apbus/if_sn.c	Sun Sep 18 12:48:03 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.50 2022/08/20 18:42:03 thorpej Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.51 2022/09/18 12:48:03 thorpej Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.50 2022/08/20 18:42:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.51 2022/09/18 12:48:03 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -307,7 +307,7 @@ snstart(struct ifnet *ifp)
 	struct mbuf	*m;
 	int		mtd_next;
 
-	if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
 		return;
 
 outloop:
@@ -316,7 +316,6 @@ outloop:
 		mtd_next = 0;
 
 	if (mtd_next == sc->mtd_hw) {
-		ifp->if_flags |= IFF_OACTIVE;
 		return;
 	}
 
@@ -325,8 +324,7 @@ outloop:
 		return;
 
 	/* We need the header for m_pkthdr.len. */
-	if ((m->m_flags & M_PKTHDR) == 0)
-		panic("%s: snstart: no header mbuf", device_xname(sc->sc_dev));
+	KASSERT(m->m_flags & M_PKTHDR);
 
 	/*
 	 * If bpf is listening on this interface, let it



CVS commit: src/sys/arch/newsmips/apbus

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 12:48:03 UTC 2022

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus

2022-08-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug 20 18:42:03 UTC 2022

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
snstart(): Replace "IF_DEQUEUE() -> IF_PREPEND() on failure" with
"IF_POLL() -> IF_DEQUEUE() on success".


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.49 src/sys/arch/newsmips/apbus/if_sn.c:1.50
--- src/sys/arch/newsmips/apbus/if_sn.c:1.49	Wed Feb  5 13:08:19 2020
+++ src/sys/arch/newsmips/apbus/if_sn.c	Sat Aug 20 18:42:03 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.49 2020/02/05 13:08:19 martin Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.50 2022/08/20 18:42:03 thorpej Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.49 2020/02/05 13:08:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.50 2022/08/20 18:42:03 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -320,7 +320,7 @@ outloop:
 		return;
 	}
 
-	IF_DEQUEUE(>if_snd, m);
+	IF_POLL(>if_snd, m);
 	if (m == 0)
 		return;
 
@@ -336,13 +336,13 @@ outloop:
 
 	/*
 	 * If there is nothing in the o/p queue, and there is room in
-	 * the Tx ring, then send the packet directly.  Otherwise append
-	 * it to the o/p queue.
+	 * the Tx ring, then send the packet directly.  Otherwise it
+	 * stays on the queue.
 	 */
 	if ((sonicput(sc, m, mtd_next)) == 0) {
-		IF_PREPEND(>if_snd, m);
 		return;
 	}
+	IF_DEQUEUE(>if_snd, m);
 
 	sc->mtd_prev = sc->mtd_free;
 	sc->mtd_free = mtd_next;



CVS commit: src/sys/arch/newsmips/apbus

2022-08-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug 20 18:42:03 UTC 2022

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
snstart(): Replace "IF_DEQUEUE() -> IF_PREPEND() on failure" with
"IF_POLL() -> IF_DEQUEUE() on success".


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus

2020-02-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  5 13:08:19 UTC 2020

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Fix if_stats access.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.48 src/sys/arch/newsmips/apbus/if_sn.c:1.49
--- src/sys/arch/newsmips/apbus/if_sn.c:1.48	Tue Feb  4 07:41:01 2020
+++ src/sys/arch/newsmips/apbus/if_sn.c	Wed Feb  5 13:08:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.48 2020/02/04 07:41:01 skrll Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.49 2020/02/05 13:08:19 martin Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.48 2020/02/04 07:41:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.49 2020/02/05 13:08:19 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -966,9 +966,9 @@ sonicrxint(struct sn_softc *sc)
 			(char *)sc->rbuf[orra & RBAMASK] +
  (rxpkt_ptr & PGOFSET);
 			if (sonic_read(sc, pkt, len) == 0)
-sc->sc_if.if_ierrors++;
+if_statinc(>sc_if, if_ierrors);
 		} else
-			sc->sc_if.if_ierrors++;
+			if_statinc(>sc_if, if_ierrors);
 
 		/*
 		 * give receive buffer area back to chip.



CVS commit: src/sys/arch/newsmips/apbus

2020-02-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  5 13:08:19 UTC 2020

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Fix if_stats access.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus

2020-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb  4 07:41:01 UTC 2020

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus

2020-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb  4 07:41:01 UTC 2020

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.47 src/sys/arch/newsmips/apbus/if_sn.c:1.48
--- src/sys/arch/newsmips/apbus/if_sn.c:1.47	Tue Feb  4 07:36:42 2020
+++ src/sys/arch/newsmips/apbus/if_sn.c	Tue Feb  4 07:41:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.47 2020/02/04 07:36:42 skrll Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.48 2020/02/04 07:41:01 skrll Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.47 2020/02/04 07:36:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.48 2020/02/04 07:41:01 skrll Exp $");
 
 #include "opt_inet.h"
 
@@ -365,7 +365,7 @@ snreset(struct sn_softc *sc)
 	sninit(sc);
 }
 
-static int 
+static int
 sninit(struct sn_softc *sc)
 {
 	u_long	s_rcr;
@@ -443,7 +443,7 @@ sninit(struct sn_softc *sc)
  * Called on final close of device, or if sninit() fails
  * part way through.
  */
-static int 
+static int
 snstop(struct sn_softc *sc)
 {
 	struct mtd *mtd;
@@ -589,7 +589,7 @@ sonicput(struct sn_softc *sc, struct mbu
 /*
  * CAM support
  */
-static void 
+static void
 caminitialise(struct sn_softc *sc)
 {
 	void	*p_cda = sc->p_cda;
@@ -606,7 +606,7 @@ caminitialise(struct sn_softc *sc)
 	SWO(bitmode, p_cda, CDA_ENABLE, 0);
 }
 
-static void 
+static void
 camentry(struct sn_softc *sc, int entry, const u_char *ea)
 {
 	void	*p_cda = sc->p_cda;
@@ -616,11 +616,11 @@ camentry(struct sn_softc *sc, int entry,
 	SWO(bitmode, p_cda, camoffset + CDA_CAMAP2, (ea[5] << 8) | ea[4]);
 	SWO(bitmode, p_cda, camoffset + CDA_CAMAP1, (ea[3] << 8) | ea[2]);
 	SWO(bitmode, p_cda, camoffset + CDA_CAMAP0, (ea[1] << 8) | ea[0]);
-	SWO(bitmode, p_cda, CDA_ENABLE, 
+	SWO(bitmode, p_cda, CDA_ENABLE,
 	(SRO(bitmode, p_cda, CDA_ENABLE) | (1 << entry)));
 }
 
-static void 
+static void
 camprogram(struct sn_softc *sc)
 {
 	struct ethercom *ec = >sc_ethercom;
@@ -696,7 +696,7 @@ camprogram(struct sn_softc *sc)
 }
 
 #ifdef SNDEBUG
-static void 
+static void
 camdump(struct sn_softc *sc)
 {
 	int	i;
@@ -721,7 +721,7 @@ camdump(struct sn_softc *sc)
 }
 #endif
 
-static void 
+static void
 initialise_tda(struct sn_softc *sc)
 {
 	struct mtd *mtd;
@@ -868,7 +868,7 @@ snintr(void *arg)
 /*
  * Transmit interrupt routine
  */
-static void 
+static void
 sonictxint(struct sn_softc *sc)
 {
 	struct mtd	*mtd;
@@ -943,7 +943,7 @@ sonictxint(struct sn_softc *sc)
 /*
  * Receive interrupt routine
  */
-static void 
+static void
 sonicrxint(struct sn_softc *sc)
 {
 	void *	rda;
@@ -1032,7 +1032,7 @@ sonicrxint(struct sn_softc *sc)
  * sonic_read -- pull packet off interface and forward to
  * appropriate protocol handler
  */
-static inline int 
+static inline int
 sonic_read(struct sn_softc *sc, void *pkt, int len)
 {
 	struct ifnet *ifp = >sc_if;
@@ -1102,10 +1102,10 @@ sonic_get(struct sn_softc *sc, void *pkt
 
 		if (mp == ) {
 			char *newdata = (char *)
-			ALIGN((char *)m->m_data + 
+			ALIGN((char *)m->m_data +
 sizeof(struct ether_header)) -
 			sizeof(struct ether_header);
-			len -= newdata - m->m_data; 
+			len -= newdata - m->m_data;
 			m->m_data = newdata;
 		}
 



CVS commit: src/sys/arch/newsmips/apbus

2020-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb  4 07:36:42 UTC 2020

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.46 src/sys/arch/newsmips/apbus/if_sn.c:1.47
--- src/sys/arch/newsmips/apbus/if_sn.c:1.46	Fri Sep 13 07:55:06 2019
+++ src/sys/arch/newsmips/apbus/if_sn.c	Tue Feb  4 07:36:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.46 2019/09/13 07:55:06 msaitoh Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.47 2020/02/04 07:36:42 skrll Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.46 2019/09/13 07:55:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.47 2020/02/04 07:36:42 skrll Exp $");
 
 #include "opt_inet.h"
 
@@ -347,7 +347,7 @@ outloop:
 	sc->mtd_prev = sc->mtd_free;
 	sc->mtd_free = mtd_next;
 
-	ifp->if_opackets++;		/* # of pkts */
+	if_statinc(ifp, if_opackets);		/* # of pkts */
 
 	/* Jump back for possibly more punishment. */
 	goto outloop;
@@ -916,11 +916,11 @@ sonictxint(struct sn_softc *sc)
 
 		txp_status = SRO(sc->bitmode, txp, TXP_STATUS);
 
-		ifp->if_collisions += (txp_status & TCR_EXC) ? 16 :
-			((txp_status & TCR_NC) >> 12);
+		if_statadd(ifp, if_collisions, (txp_status & TCR_EXC) ? 16 :
+			((txp_status & TCR_NC) >> 12));
 
 		if ((txp_status & TCR_PTX) == 0) {
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			printf("%s: Tx packet status=0x%x\n",
 			device_xname(sc->sc_dev), txp_status);
 



CVS commit: src/sys/arch/newsmips/apbus

2020-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb  4 07:36:42 UTC 2020

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus

2018-09-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 30 14:23:24 UTC 2018

Modified Files:
src/sys/arch/newsmips/apbus: if_sn_ap.c if_tlp_ap.c kb_ap.c ms_ap.c
spifi.c zs_ap.c

Log Message:
Avoid reference of APbus workarea that can't be read via kvm(3).


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/newsmips/apbus/if_sn_ap.c \
src/sys/arch/newsmips/apbus/ms_ap.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/newsmips/apbus/if_tlp_ap.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/newsmips/apbus/kb_ap.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/newsmips/apbus/spifi.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/newsmips/apbus/zs_ap.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/newsmips/apbus

2018-09-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 30 14:23:24 UTC 2018

Modified Files:
src/sys/arch/newsmips/apbus: if_sn_ap.c if_tlp_ap.c kb_ap.c ms_ap.c
spifi.c zs_ap.c

Log Message:
Avoid reference of APbus workarea that can't be read via kvm(3).


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/newsmips/apbus/if_sn_ap.c \
src/sys/arch/newsmips/apbus/ms_ap.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/newsmips/apbus/if_tlp_ap.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/newsmips/apbus/kb_ap.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/newsmips/apbus/spifi.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/newsmips/apbus/zs_ap.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/newsmips/apbus/if_sn_ap.c
diff -u src/sys/arch/newsmips/apbus/if_sn_ap.c:1.11 src/sys/arch/newsmips/apbus/if_sn_ap.c:1.12
--- src/sys/arch/newsmips/apbus/if_sn_ap.c:1.11	Wed Apr  9 15:40:30 2008
+++ src/sys/arch/newsmips/apbus/if_sn_ap.c	Sun Sep 30 14:23:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn_ap.c,v 1.11 2008/04/09 15:40:30 tsutsui Exp $	*/
+/*	$NetBSD: if_sn_ap.c,v 1.12 2018/09/30 14:23:24 tsutsui Exp $	*/
 
 /*
  * Copyright (C) 1997 Allen Briggs
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn_ap.c,v 1.11 2008/04/09 15:40:30 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn_ap.c,v 1.12 2018/09/30 14:23:24 tsutsui Exp $");
 
 #include "opt_inet.h"
 
@@ -117,7 +117,7 @@ sn_ap_attach(device_t parent, device_t s
 	apbus_intr_establish(0, /* interrupt level (0 or 1) */
 	intrmask,
 	0, /* priority */
-	snintr, sc, apa->apa_name, apa->apa_ctlnum);
+	snintr, sc, device_xname(self), apa->apa_ctlnum);
 }
 
 int
Index: src/sys/arch/newsmips/apbus/ms_ap.c
diff -u src/sys/arch/newsmips/apbus/ms_ap.c:1.11 src/sys/arch/newsmips/apbus/ms_ap.c:1.12
--- src/sys/arch/newsmips/apbus/ms_ap.c:1.11	Sat Oct 13 06:25:20 2012
+++ src/sys/arch/newsmips/apbus/ms_ap.c	Sun Sep 30 14:23:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ms_ap.c,v 1.11 2012/10/13 06:25:20 tsutsui Exp $	*/
+/*	$NetBSD: ms_ap.c,v 1.12 2018/09/30 14:23:24 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ms_ap.c,v 1.11 2012/10/13 06:25:20 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ms_ap.c,v 1.12 2018/09/30 14:23:24 tsutsui Exp $");
 
 #include 
 #include 
@@ -101,7 +101,7 @@ ms_ap_attach(device_t parent, device_t s
 	reg->ms_intr_en = 0;
 
 	apbus_intr_establish(1, NEWS5000_INT1_KBD, 0, ms_ap_intr, sc,
-	"", apa->apa_ctlnum);
+	device_xname(self), apa->apa_ctlnum);
 
 	aa.accessops = _ap_accessops;
 	aa.accesscookie = sc;

Index: src/sys/arch/newsmips/apbus/if_tlp_ap.c
diff -u src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.13 src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.14
--- src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.13	Fri Jul 15 07:49:20 2011
+++ src/sys/arch/newsmips/apbus/if_tlp_ap.c	Sun Sep 30 14:23:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tlp_ap.c,v 1.13 2011/07/15 07:49:20 he Exp $	*/
+/*	$NetBSD: if_tlp_ap.c,v 1.14 2018/09/30 14:23:24 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.13 2011/07/15 07:49:20 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.14 2018/09/30 14:23:24 tsutsui Exp $");
 
 #include 
 #include 
@@ -222,7 +222,7 @@ tlp_ap_attach(device_t parent, device_t 
 	apbus_intr_establish(0, /* interrupt level (0 or 1) */
 	intrmask,
 	0, /* priority */
-	tlp_intr, sc, apa->apa_name, apa->apa_ctlnum);
+	tlp_intr, sc, device_xname(self), apa->apa_ctlnum);
 }
 
 static void

Index: src/sys/arch/newsmips/apbus/kb_ap.c
diff -u src/sys/arch/newsmips/apbus/kb_ap.c:1.10 src/sys/arch/newsmips/apbus/kb_ap.c:1.11
--- src/sys/arch/newsmips/apbus/kb_ap.c:1.10	Sat Oct 13 06:25:20 2012
+++ src/sys/arch/newsmips/apbus/kb_ap.c	Sun Sep 30 14:23:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kb_ap.c,v 1.10 2012/10/13 06:25:20 tsutsui Exp $	*/
+/*	$NetBSD: kb_ap.c,v 1.11 2018/09/30 14:23:24 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kb_ap.c,v 1.10 2012/10/13 06:25:20 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kb_ap.c,v 1.11 2018/09/30 14:23:24 tsutsui Exp $");
 
 #include 
 #include 
@@ -144,7 +144,7 @@ kb_ap_attach(device_t parent, device_t s
 	reg->kb_tx_intr_en = 0;
 
 	apbus_intr_establish(1, NEWS5000_INT1_KBD, 0, kb_ap_intr, sc,
-	"", apa->apa_ctlnum);
+	device_xname(self), apa->apa_ctlnum);
 
 	waa.console = cons;
 	waa.keymap = _ap_keymapdata;

Index: src/sys/arch/newsmips/apbus/spifi.c
diff -u src/sys/arch/newsmips/apbus/spifi.c:1.18 src/sys/arch/newsmips/apbus/spifi.c:1.19
--- src/sys/arch/newsmips/apbus/spifi.c:1.18	Fri Mar 31 08:38:13 2017
+++ 

CVS commit: src/sys/arch/newsmips/apbus

2018-09-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 30 14:09:35 UTC 2018

Modified Files:
src/sys/arch/newsmips/apbus: apbus.c

Log Message:
Account APbus interrupts by evcnt(9).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/newsmips/apbus/apbus.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/newsmips/apbus

2018-09-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 30 14:09:35 UTC 2018

Modified Files:
src/sys/arch/newsmips/apbus: apbus.c

Log Message:
Account APbus interrupts by evcnt(9).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/newsmips/apbus/apbus.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/newsmips/apbus/apbus.c
diff -u src/sys/arch/newsmips/apbus/apbus.c:1.23 src/sys/arch/newsmips/apbus/apbus.c:1.24
--- src/sys/arch/newsmips/apbus/apbus.c:1.23	Sun Sep 30 06:14:23 2018
+++ src/sys/arch/newsmips/apbus/apbus.c	Sun Sep 30 14:09:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: apbus.c,v 1.23 2018/09/30 06:14:23 tsutsui Exp $	*/
+/*	$NetBSD: apbus.c,v 1.24 2018/09/30 14:09:35 tsutsui Exp $	*/
 
 /*-
  * Copyright (C) 1999 SHIMIZU Ryo.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.23 2018/09/30 06:14:23 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.24 2018/09/30 14:09:35 tsutsui Exp $");
 
 #define __INTR_PRIVATE
 
@@ -201,8 +201,10 @@ apbus_intr_dispatch(int level, int stat)
 
 	nintr = 0;
 	LIST_FOREACH(ih, >intr_q, ih_q) {
-		if (ih->ih_mask & stat)
+		if (ih->ih_mask & stat) {
 			nintr += (*ih->ih_func)(ih->ih_arg);
+			ih->intr_count.ev_count++;
+		}
 	}
 	return nintr;
 }
@@ -227,6 +229,8 @@ apbus_intr_establish(int level, int mask
 	ih->ih_priority = priority;
 	ih->ih_func = func;
 	ih->ih_arg = arg;
+	evcnt_attach_dynamic(>intr_count, EVCNT_TYPE_INTR,
+	NULL, "apbus", name);
 
 	if (LIST_EMPTY(>intr_q)) {
 		LIST_INSERT_HEAD(>intr_q, ih, ih_q);



CVS commit: src/sys/arch/newsmips/apbus

2017-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 29 02:21:30 UTC 2017

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Avoid memory leak in sonic_get.

If this is the first time around, top is null and nothing else will
free m.

>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.38 src/sys/arch/newsmips/apbus/if_sn.c:1.39
--- src/sys/arch/newsmips/apbus/if_sn.c:1.38	Wed Feb 22 09:45:16 2017
+++ src/sys/arch/newsmips/apbus/if_sn.c	Sat Jul 29 02:21:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.38 2017/02/22 09:45:16 nonaka Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.39 2017/07/29 02:21:30 riastradh Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.38 2017/02/22 09:45:16 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.39 2017/07/29 02:21:30 riastradh Exp $");
 
 #include "opt_inet.h"
 
@@ -1090,7 +1090,10 @@ sonic_get(struct sn_softc *sc, void *pkt
 		if (datalen >= MINCLSIZE) {
 			MCLGET(m, M_DONTWAIT);
 			if ((m->m_flags & M_EXT) == 0) {
-if (top) m_freem(top);
+if (top)
+	m_freem(top);
+else
+	m_freem(m);
 return 0;
 			}
 			len = MCLBYTES;



CVS commit: src/sys/arch/newsmips/apbus

2017-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 29 02:21:30 UTC 2017

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Avoid memory leak in sonic_get.

If this is the first time around, top is null and nothing else will
free m.

>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus

2012-10-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct 13 06:24:15 UTC 2012

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Fix botch on device_t/softc split inside #ifdef SNDEBUG part. from chs@


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.33 src/sys/arch/newsmips/apbus/if_sn.c:1.34
--- src/sys/arch/newsmips/apbus/if_sn.c:1.33	Mon Apr  5 07:19:31 2010
+++ src/sys/arch/newsmips/apbus/if_sn.c	Sat Oct 13 06:24:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.33 2010/04/05 07:19:31 joerg Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.34 2012/10/13 06:24:15 tsutsui Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_sn.c,v 1.33 2010/04/05 07:19:31 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_sn.c,v 1.34 2012/10/13 06:24:15 tsutsui Exp $);
 
 #include opt_inet.h
 
@@ -204,7 +204,7 @@ snsetup(struct sn_softc	*sc, uint8_t *ll
 
 #ifdef SNDEBUG
 	aprint_debug_dev(sc-sc_dev, buffers: rra=%p cda=%p rda=%p tda=%p\n,
-	sc-sc_dev.dv_xname, sc-p_rra[0], sc-p_cda,
+	device_xname(sc-sc_dev), sc-p_rra[0], sc-p_cda,
 	sc-p_rda, sc-mtda[0].mtd_txp);
 #endif
 



CVS commit: src/sys/arch/newsmips/apbus

2012-10-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct 13 06:24:15 UTC 2012

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Fix botch on device_t/softc split inside #ifdef SNDEBUG part. from chs@


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus

2011-07-15 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Fri Jul 15 07:49:20 UTC 2011

Modified Files:
src/sys/arch/newsmips/apbus: if_tlp_ap.c

Log Message:
Track the changes to tulipvar.h -- use the recently introduced
tlp_chip_name() to get the chip name for aprint output.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/newsmips/apbus/if_tlp_ap.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/newsmips/apbus/if_tlp_ap.c
diff -u src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.12 src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.13
--- src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.12	Sun Feb 20 07:56:31 2011
+++ src/sys/arch/newsmips/apbus/if_tlp_ap.c	Fri Jul 15 07:49:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tlp_ap.c,v 1.12 2011/02/20 07:56:31 matt Exp $	*/
+/*	$NetBSD: if_tlp_ap.c,v 1.13 2011/07/15 07:49:20 he Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_tlp_ap.c,v 1.12 2011/02/20 07:56:31 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_tlp_ap.c,v 1.13 2011/07/15 07:49:20 he Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -140,7 +140,7 @@
 	}
 
 	aprint_normal(: %s Ethernet, pass %d.%d\n,
-	tlp_chip_names[sc-sc_chip],
+	tlp_chip_name(sc-sc_chip),
 	(sc-sc_rev  4)  0xf, sc-sc_rev  0xf);
 
 	/* CSR */



CVS commit: src/sys/arch/newsmips/apbus

2011-07-15 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Fri Jul 15 07:49:20 UTC 2011

Modified Files:
src/sys/arch/newsmips/apbus: if_tlp_ap.c

Log Message:
Track the changes to tulipvar.h -- use the recently introduced
tlp_chip_name() to get the chip name for aprint output.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/newsmips/apbus/if_tlp_ap.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/newsmips/apbus

2009-04-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr 17 14:48:17 UTC 2009

Modified Files:
src/sys/arch/newsmips/apbus: if_tlp_ap.c

Log Message:
Split device_t/softc, use aprint_*().


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/newsmips/apbus/if_tlp_ap.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/newsmips/apbus/if_tlp_ap.c
diff -u src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.10 src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.11
--- src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.10	Mon Apr 28 20:23:30 2008
+++ src/sys/arch/newsmips/apbus/if_tlp_ap.c	Fri Apr 17 14:48:17 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tlp_ap.c,v 1.10 2008/04/28 20:23:30 martin Exp $	*/
+/*	$NetBSD: if_tlp_ap.c,v 1.11 2009/04/17 14:48:17 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_tlp_ap.c,v 1.10 2008/04/28 20:23:30 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_tlp_ap.c,v 1.11 2009/04/17 14:48:17 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -78,10 +78,10 @@
 	bus_space_handle_t sc_cfsh;
 };
 
-static int	tlp_ap_match(struct device *, struct cfdata *, void *);
-static void	tlp_ap_attach(struct device *, struct device *, void *);
+static int	tlp_ap_match(device_t, cfdata_t, void *);
+static void	tlp_ap_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(tlp_ap, sizeof(struct tulip_ap_softc),
+CFATTACH_DECL_NEW(tlp_ap, sizeof(struct tulip_ap_softc),
 tlp_ap_match, tlp_ap_attach, NULL, NULL);
 
 static void tlp_ap_preinit(struct tulip_softc *);
@@ -94,7 +94,7 @@
 };
 
 static int
-tlp_ap_match(struct device *parent, struct cfdata *cf, void *aux)
+tlp_ap_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct apbus_attach_args *apa = aux;
 
@@ -108,16 +108,18 @@
  * Install interface into kernel networking data structures
  */
 static void
-tlp_ap_attach(struct device *parent, struct device *self, void *aux)
+tlp_ap_attach(device_t parent, device_t self, void *aux)
 {
-	struct tulip_ap_softc *psc = (void *) self;
+	struct tulip_ap_softc *psc = device_private(self);
 	struct tulip_softc *sc = psc-sc_tulip;
 	struct apbus_attach_args *apa = aux;
 	uint8_t enaddr[ETHER_ADDR_LEN];
 	u_int intrmask;
 	int i;
 
-	printf( slot%d addr 0x%lx, apa-apa_slotno, apa-apa_hwbase);
+	sc-sc_dev = self;
+
+	aprint_normal( slot%d addr 0x%lx, apa-apa_slotno, apa-apa_hwbase);
 
 	/* PCI configuration register */
 	psc-sc_cfst = 0;
@@ -133,11 +135,11 @@
 			sc-sc_chip = TULIP_CHIP_21140;
 		break;
 	default:
-		printf(: unable to handle your board\n);
+		aprint_error(: unable to handle your board\n);
 		return;
 	}
 
-	printf(: %s Ethernet, pass %d.%d\n,
+	aprint_normal(: %s Ethernet, pass %d.%d\n,
 	tlp_chip_names[sc-sc_chip],
 	(sc-sc_rev  4)  0xf, sc-sc_rev  0xf);
 
@@ -146,7 +148,7 @@
 	sc-sc_sh = apa-apa_hwbase + TLP_AP_CSR;
 	sc-sc_dmat = apbus_dmatag_init(apa);
 	if (sc-sc_dmat == NULL) {
-		printf(%s: cannot allocate memory\n, sc-sc_dev.dv_xname);
+		aprint_error_dev(self, cannot allocate memory\n);
 		return;
 	}
 
@@ -202,7 +204,7 @@
 	TULIP_WRITE(sc, CSR_GPP, 0xcf);			/* mask abort/DMA err */
 
 	if (tlp_read_srom(sc) == 0) {
-		printf(%s: srom read failed\n, sc-sc_dev.dv_xname);
+		aprint_error_dev(self, srom read failed\n);
 		free(sc-sc_dmat, M_DEVBUF);
 		return;
 	}