CVS commit: src/sys/dev

2024-09-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 15 08:30:01 UTC 2024

Modified Files:
src/sys/dev/acpi: genet_acpi.c
src/sys/dev/fdt: genet_fdt.c

Log Message:
genet(4): Remove the non-MP-safe scaffolding...

I forgot two files in the previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/genet_acpi.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/genet_fdt.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/dev/acpi/genet_acpi.c
diff -u src/sys/dev/acpi/genet_acpi.c:1.5 src/sys/dev/acpi/genet_acpi.c:1.6
--- src/sys/dev/acpi/genet_acpi.c:1.5	Mon May  3 10:28:26 2021
+++ src/sys/dev/acpi/genet_acpi.c	Sun Sep 15 08:30:01 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: genet_acpi.c,v 1.5 2021/05/03 10:28:26 rin Exp $ */
+/* $NetBSD: genet_acpi.c,v 1.6 2024/09/15 08:30:01 skrll Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -26,10 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include "opt_net_mpsafe.h"
-
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genet_acpi.c,v 1.5 2021/05/03 10:28:26 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genet_acpi.c,v 1.6 2024/09/15 08:30:01 skrll Exp $");
 
 #include 
 #include 
@@ -51,12 +49,6 @@ __KERNEL_RCSID(0, "$NetBSD: genet_acpi.c
 #include 
 #include 
 
-#ifdef NET_MPSAFE
-#define	GENET_INTR_MPSAFE	true
-#else
-#define	GENET_INTR_MPSAFE	false
-#endif
-
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "BCM6E4E" },	/* Broadcom GENET v5 */
 	DEVICE_COMPAT_EOL
@@ -144,7 +136,7 @@ genet_acpi_attach(device_t parent, devic
 		goto done;
 
 ih = acpi_intr_establish(self, (uint64_t)(uintptr_t)handle, IPL_NET,
-	GENET_INTR_MPSAFE, genet_intr, sc, device_xname(self));
+	true, genet_intr, sc, device_xname(self));
 	if (ih == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt\n");
 		goto done;

Index: src/sys/dev/fdt/genet_fdt.c
diff -u src/sys/dev/fdt/genet_fdt.c:1.6 src/sys/dev/fdt/genet_fdt.c:1.7
--- src/sys/dev/fdt/genet_fdt.c:1.6	Mon May  3 10:28:26 2021
+++ src/sys/dev/fdt/genet_fdt.c	Sun Sep 15 08:30:01 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: genet_fdt.c,v 1.6 2021/05/03 10:28:26 rin Exp $ */
+/* $NetBSD: genet_fdt.c,v 1.7 2024/09/15 08:30:01 skrll Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -26,10 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include "opt_net_mpsafe.h"
-
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genet_fdt.c,v 1.6 2021/05/03 10:28:26 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genet_fdt.c,v 1.7 2024/09/15 08:30:01 skrll Exp $");
 
 #include 
 #include 
@@ -51,12 +49,6 @@ __KERNEL_RCSID(0, "$NetBSD: genet_fdt.c,
 
 #include 
 
-#ifdef NET_MPSAFE
-#define	FDT_INTR_FLAGS	FDT_INTR_MPSAFE
-#else
-#define	FDT_INTR_FLAGS	0
-#endif
-
 static int	genet_fdt_match(device_t, cfdata_t, void *);
 static void	genet_fdt_attach(device_t, device_t, void *);
 



CVS commit: src/sys/dev

2024-09-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 15 08:30:01 UTC 2024

Modified Files:
src/sys/dev/acpi: genet_acpi.c
src/sys/dev/fdt: genet_fdt.c

Log Message:
genet(4): Remove the non-MP-safe scaffolding...

I forgot two files in the previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/genet_acpi.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/genet_fdt.c

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



CVS commit: src/sys/dev/ic

2024-09-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 15 07:38:08 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c bcmgenetvar.h

Log Message:
genet(4): Remove the non-MP-safe scaffolding.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/bcmgenet.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/bcmgenetvar.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/ic/bcmgenet.c
diff -u src/sys/dev/ic/bcmgenet.c:1.19 src/sys/dev/ic/bcmgenet.c:1.20
--- src/sys/dev/ic/bcmgenet.c:1.19	Sun Aug 25 12:38:20 2024
+++ src/sys/dev/ic/bcmgenet.c	Sun Sep 15 07:38:08 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenet.c,v 1.19 2024/08/25 12:38:20 mlelstv Exp $ */
+/* $NetBSD: bcmgenet.c,v 1.20 2024/09/15 07:38:08 skrll Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -30,11 +30,10 @@
  * Broadcom GENETv5
  */
 
-#include "opt_net_mpsafe.h"
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.19 2024/08/25 12:38:20 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.20 2024/09/15 07:38:08 skrll Exp $");
 
 #include 
 #include 
@@ -67,13 +66,6 @@ CTASSERT(MCLBYTES == 2048);
 #define	DPRINTF(...)	((void)0)
 #endif
 
-#ifdef NET_MPSAFE
-#define	GENET_MPSAFE		1
-#define	CALLOUT_FLAGS		CALLOUT_MPSAFE
-#else
-#define	CALLOUT_FLAGS		0
-#endif
-
 #define	TX_MAX_SEGS		128
 #define	TX_DESC_COUNT		256 /* GENET_DMA_DESC_COUNT */
 #define	RX_DESC_COUNT		256 /* GENET_DMA_DESC_COUNT */
@@ -84,9 +76,9 @@ CTASSERT(MCLBYTES == 2048);
 #define	TX_NEXT(n)		TX_SKIP(n, 1)
 #define	RX_NEXT(n)		(((n) + 1) % RX_DESC_COUNT)
 
-#define	GENET_LOCK(sc)		mutex_enter(&(sc)->sc_lock)
-#define	GENET_UNLOCK(sc)	mutex_exit(&(sc)->sc_lock)
-#define	GENET_ASSERT_LOCKED(sc)	KASSERT(mutex_owned(&(sc)->sc_lock))
+#define	GENET_LOCK(sc)			mutex_enter(&(sc)->sc_lock)
+#define	GENET_UNLOCK(sc)		mutex_exit(&(sc)->sc_lock)
+#define	GENET_ASSERT_LOCKED(sc)		KASSERT(mutex_owned(&(sc)->sc_lock))
 
 #define	GENET_TXLOCK(sc)		mutex_enter(&(sc)->sc_txlock)
 #define	GENET_TXUNLOCK(sc)		mutex_exit(&(sc)->sc_txlock)
@@ -324,18 +316,12 @@ genet_tick(void *softc)
 {
 	struct genet_softc *sc = softc;
 	struct mii_data *mii = &sc->sc_mii;
-#ifndef GENET_MPSAFE
-	int s = splnet();
-#endif
 
 	GENET_LOCK(sc);
 	mii_tick(mii);
-	callout_schedule(&sc->sc_stat_ch, hz);
+	if (sc->sc_running)
+		callout_schedule(&sc->sc_stat_ch, hz);
 	GENET_UNLOCK(sc);
-
-#ifndef GENET_MPSAFE
-	splx(s);
-#endif
 }
 
 static void
@@ -584,6 +570,7 @@ genet_init_locked(struct genet_softc *sc
 	WR4(sc, GENET_UMAC_MAC1, val);
 
 	/* Setup RX filter */
+	sc->sc_promisc = ifp->if_flags & IFF_PROMISC;
 	genet_setup_rxfilter(sc);
 
 	/* Setup TX/RX rings */
@@ -598,6 +585,10 @@ genet_init_locked(struct genet_softc *sc
 	/* Enable interrupts */
 	genet_enable_intr(sc);
 
+	GENET_ASSERT_TXLOCKED(sc);
+	sc->sc_txrunning = true;
+
+	sc->sc_running = true;
 	ifp->if_flags |= IFF_RUNNING;
 
 	mii_mediachg(mii);
@@ -651,7 +642,12 @@ genet_stop_locked(struct genet_softc *sc
 
 	GENET_ASSERT_LOCKED(sc);
 
-	callout_stop(&sc->sc_stat_ch);
+	GENET_TXLOCK(sc);
+	sc->sc_txrunning = false;
+	GENET_TXUNLOCK(sc);
+
+	sc->sc_running = false;
+	callout_halt(&sc->sc_stat_ch, &sc->sc_lock);
 
 	mii_down(&sc->sc_mii);
 
@@ -824,7 +820,7 @@ genet_start_locked(struct genet_softc *s
 
 	GENET_ASSERT_TXLOCKED(sc);
 
-	if ((ifp->if_flags & IFF_RUNNING) == 0)
+	if (!sc->sc_txrunning)
 		return;
 
 	const int qid = GENET_DMA_DEFAULT_QUEUE;
@@ -904,42 +900,26 @@ static int
 genet_ioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
 	struct genet_softc *sc = ifp->if_softc;
-	int error, s;
+	int error;
 
-#ifndef GENET_MPSAFE
-	s = splnet();
-#endif
+	const int s = splnet();
+	error = ether_ioctl(ifp, cmd, data);
+	splx(s);
 
-	switch (cmd) {
-	default:
-#ifdef GENET_MPSAFE
-		s = splnet();
-#endif
-		error = ether_ioctl(ifp, cmd, data);
-#ifdef GENET_MPSAFE
-		splx(s);
-#endif
-		if (error != ENETRESET)
-			break;
+	if (error != ENETRESET)
+		return error;
 
-		error = 0;
+	error = 0;
 
-		if (cmd == SIOCSIFCAP)
-			error = if_init(ifp);
-		else if (cmd != SIOCADDMULTI && cmd != SIOCDELMULTI)
-			;
-		else if ((ifp->if_flags & IFF_RUNNING) != 0) {
-			GENET_LOCK(sc);
+	if (cmd == SIOCSIFCAP)
+		error = if_init(ifp);
+	else if (cmd == SIOCADDMULTI || cmd == SIOCDELMULTI) {
+		GENET_LOCK(sc);
+		sc->sc_promisc = ifp->if_flags & IFF_PROMISC;
+		if (sc->sc_running)
 			genet_setup_rxfilter(sc);
-			GENET_UNLOCK(sc);
-		}
-		break;
+		GENET_UNLOCK(sc);
 	}
-
-#ifndef GENET_MPSAFE
-	splx(s);
-#endif
-
 	return error;
 }
 
@@ -1082,7 +1062,7 @@ genet_attach(struct genet_softc *sc)
 
 	mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NET);
 	mutex_init(&sc->sc_txlock, MUTEX_DEFAULT, IPL_NET);
-	callout_init(&sc->sc_stat_ch, CALLOUT_FLAGS);
+	callout_init(&sc->sc_stat_ch, CALLOUT_MPSAFE);
 	callout_setfunc(&sc->sc_stat_ch, genet_tick, sc);
 
 	genet_get_eaddr(sc, eaddr);
@@ -1101,9

CVS commit: src/sys/dev/ic

2024-09-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 15 07:38:08 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c bcmgenetvar.h

Log Message:
genet(4): Remove the non-MP-safe scaffolding.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/bcmgenet.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/bcmgenetvar.h

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



CVS commit: src/sys/dev/ic

2024-09-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 15 07:33:33 UTC 2024

Modified Files:
src/sys/dev/ic: dwc_eqos_var.h

Log Message:
Remove unused struct eqos_softc member


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/dwc_eqos_var.h

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



CVS commit: src/sys/dev/ic

2024-09-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 15 07:33:33 UTC 2024

Modified Files:
src/sys/dev/ic: dwc_eqos_var.h

Log Message:
Remove unused struct eqos_softc member


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/dwc_eqos_var.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/ic/dwc_eqos_var.h
diff -u src/sys/dev/ic/dwc_eqos_var.h:1.9 src/sys/dev/ic/dwc_eqos_var.h:1.10
--- src/sys/dev/ic/dwc_eqos_var.h:1.9	Thu Nov  2 13:50:02 2023
+++ src/sys/dev/ic/dwc_eqos_var.h	Sun Sep 15 07:33:33 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos_var.h,v 1.9 2023/11/02 13:50:02 riastradh Exp $ */
+/* $NetBSD: dwc_eqos_var.h,v 1.10 2024/09/15 07:33:33 skrll Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -73,7 +73,6 @@ struct eqos_softc {
 	bool			sc_running;
 	bool			sc_txrunning;
 	bool			sc_promisc;
-	bool			sc_allmulti;
 
 	struct eqos_ring	sc_tx;
 	struct eqos_ring	sc_rx;



CVS commit: src/sys/dev

2024-09-14 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Sep 14 21:22:38 UTC 2024

Modified Files:
src/sys/dev/ic: hd64570.c i82365var.h
src/sys/dev/pci: cs4281.c
src/sys/dev/sun: kbdsun.c

Log Message:
s/intterupt/interrupt/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/ic/hd64570.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/i82365var.h
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/pci/cs4281.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/sun/kbdsun.c

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



CVS commit: src/sys/dev

2024-09-14 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Sep 14 21:22:38 UTC 2024

Modified Files:
src/sys/dev/ic: hd64570.c i82365var.h
src/sys/dev/pci: cs4281.c
src/sys/dev/sun: kbdsun.c

Log Message:
s/intterupt/interrupt/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/ic/hd64570.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/i82365var.h
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/pci/cs4281.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/sun/kbdsun.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/dev/ic/hd64570.c
diff -u src/sys/dev/ic/hd64570.c:1.61 src/sys/dev/ic/hd64570.c:1.62
--- src/sys/dev/ic/hd64570.c:1.61	Sat Sep 14 21:12:10 2024
+++ src/sys/dev/ic/hd64570.c	Sat Sep 14 21:22:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hd64570.c,v 1.61 2024/09/14 21:12:10 andvar Exp $	*/
+/*	$NetBSD: hd64570.c,v 1.62 2024/09/14 21:22:37 andvar Exp $	*/
 
 /*
  * Copyright (c) 1999 Christian E. Hopps
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hd64570.c,v 1.61 2024/09/14 21:12:10 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hd64570.c,v 1.62 2024/09/14 21:22:37 andvar Exp $");
 
 #include "opt_inet.h"
 
@@ -1205,7 +1205,7 @@ sca_hardintr(struct sca_softc *sc)
 			 (isr1 & 0xf0) >> 4);
 
 		/*
-		 * mcsi intterupts
+		 * msci interrupts
 		 */
 		if (isr0 & 0x0f)
 			ret += sca_msci_intr(&sc->sc_ports[0], isr0 & 0x0f);

Index: src/sys/dev/ic/i82365var.h
diff -u src/sys/dev/ic/i82365var.h:1.32 src/sys/dev/ic/i82365var.h:1.33
--- src/sys/dev/ic/i82365var.h:1.32	Sat Oct 27 17:18:20 2012
+++ src/sys/dev/ic/i82365var.h	Sat Sep 14 21:22:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: i82365var.h,v 1.32 2012/10/27 17:18:20 chs Exp $	*/
+/*	$NetBSD: i82365var.h,v 1.33 2024/09/14 21:22:37 andvar Exp $	*/
 
 /*
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
@@ -155,7 +155,7 @@ struct pcic_softc {
 
 	/* for use by underlying chip code for discovering irqs */
 	int intr_detect, intr_false;
-	int intr_mask[PCIC_NSLOTS / 2];	/* probed intterupts if possible */
+	int intr_mask[PCIC_NSLOTS / 2];	/* probed interrupts if possible */
 };
 
 

Index: src/sys/dev/pci/cs4281.c
diff -u src/sys/dev/pci/cs4281.c:1.59 src/sys/dev/pci/cs4281.c:1.60
--- src/sys/dev/pci/cs4281.c:1.59	Wed Dec 20 05:08:34 2023
+++ src/sys/dev/pci/cs4281.c	Sat Sep 14 21:22:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cs4281.c,v 1.59 2023/12/20 05:08:34 thorpej Exp $	*/
+/*	$NetBSD: cs4281.c,v 1.60 2024/09/14 21:22:37 andvar Exp $	*/
 
 /*
  * Copyright (c) 2000 Tatoku Ogaito.  All rights reserved.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cs4281.c,v 1.59 2023/12/20 05:08:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs4281.c,v 1.60 2024/09/14 21:22:37 andvar Exp $");
 
 #include 
 #include 
@@ -670,7 +670,7 @@ cs4281_resume(device_t dv, const pmf_qua
 		BA0WRITE4(sc, CS4281_DMR1, sc->sc_suspend_state.cs4281.dmr1);
 		BA0WRITE4(sc, CS4281_DCR1, sc->sc_suspend_state.cs4281.dcr1);
 	}
-	/* enable intterupts */
+	/* enable interrupts */
 	if (sc->sc_prun || sc->sc_rrun)
 		BA0WRITE4(sc, CS4281_HICR, HICR_IEV | HICR_CHGM);
 

Index: src/sys/dev/sun/kbdsun.c
diff -u src/sys/dev/sun/kbdsun.c:1.11 src/sys/dev/sun/kbdsun.c:1.12
--- src/sys/dev/sun/kbdsun.c:1.11	Sat Mar 29 19:15:36 2008
+++ src/sys/dev/sun/kbdsun.c	Sat Sep 14 21:22:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: kbdsun.c,v 1.11 2008/03/29 19:15:36 tsutsui Exp $	*/
+/*	$NetBSD: kbdsun.c,v 1.12 2024/09/14 21:22:37 andvar Exp $	*/
 /*	NetBSD: kbd.c,v 1.29 2001/11/13 06:54:32 lukem Exp	*/
 
 /*
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kbdsun.c,v 1.11 2008/03/29 19:15:36 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kbdsun.c,v 1.12 2024/09/14 21:22:37 andvar Exp $");
 
 #include 
 #include 
@@ -273,7 +273,7 @@ kbd_sun_set_leds(struct kbd_softc *kbd, 
 
 
 /*
- * Safe to call from intterupt handler.  Called at spltty()
+ * Safe to call from interrupt handler.  Called at spltty()
  * by kbd_sun_iocsled and kbd_sun_input (via kbd_update_leds).
  */
 static void



CVS commit: src/sys/dev/ic

2024-09-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep 14 07:30:41 UTC 2024

Modified Files:
src/sys/dev/ic: dwc_eqos.c

Log Message:
Update sc_promisc in eqos_ioctl before calling eqos_setup_rxfilter so the
new value is used.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/ic/dwc_eqos.c

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



CVS commit: src/sys/dev/ic

2024-09-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep 14 07:30:41 UTC 2024

Modified Files:
src/sys/dev/ic: dwc_eqos.c

Log Message:
Update sc_promisc in eqos_ioctl before calling eqos_setup_rxfilter so the
new value is used.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/ic/dwc_eqos.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/dev/ic/dwc_eqos.c
diff -u src/sys/dev/ic/dwc_eqos.c:1.38 src/sys/dev/ic/dwc_eqos.c:1.39
--- src/sys/dev/ic/dwc_eqos.c:1.38	Mon Aug 26 18:25:29 2024
+++ src/sys/dev/ic/dwc_eqos.c	Sat Sep 14 07:30:41 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.38 2024/08/26 18:25:29 bsiegert Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.39 2024/09/14 07:30:41 skrll Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.38 2024/08/26 18:25:29 bsiegert Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.39 2024/09/14 07:30:41 skrll Exp $");
 
 #include 
 #include 
@@ -1234,6 +1234,7 @@ eqos_ioctl(struct ifnet *ifp, u_long cmd
 			error = (*ifp->if_init)(ifp);
 		else if (cmd == SIOCADDMULTI || cmd == SIOCDELMULTI) {
 			EQOS_LOCK(sc);
+			sc->sc_promisc = ifp->if_flags & IFF_PROMISC;
 			if (sc->sc_running)
 eqos_setup_rxfilter(sc);
 			EQOS_UNLOCK(sc);



CVS commit: src/sys/dev/pci

2024-09-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep 14 07:01:33 UTC 2024

Modified Files:
src/sys/dev/pci: if_bge.c

Log Message:
Update bge_if_flags in bge_ifflags_cb before calling bge_setmulti so the
new setting of IFF_PROMISC is used by bge_setmulti


To generate a diff of this commit:
cvs rdiff -u -r1.395 -r1.396 src/sys/dev/pci/if_bge.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/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.395 src/sys/dev/pci/if_bge.c:1.396
--- src/sys/dev/pci/if_bge.c:1.395	Sat Sep  7 06:25:27 2024
+++ src/sys/dev/pci/if_bge.c	Sat Sep 14 07:01:33 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.395 2024/09/07 06:25:27 skrll Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.396 2024/09/14 07:01:33 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.395 2024/09/07 06:25:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.396 2024/09/14 07:01:33 skrll Exp $");
 
 #include 
 #include 
@@ -5934,6 +5934,7 @@ bge_ifflags_cb(struct ethercom *ec)
 	mutex_enter(sc->sc_mcast_lock);
 
 	u_short change = ifp->if_flags ^ sc->bge_if_flags;
+	sc->bge_if_flags = ifp->if_flags;
 
 	if ((change & ~(IFF_CANTCHANGE | IFF_DEBUG)) != 0) {
 		ret = ENETRESET;
@@ -5946,7 +5947,6 @@ bge_ifflags_cb(struct ethercom *ec)
 		bge_setmulti(sc);
 	}
 
-	sc->bge_if_flags = ifp->if_flags;
 	mutex_exit(sc->sc_mcast_lock);
 
 	return ret;



CVS commit: src/sys/dev/pci

2024-09-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep 14 07:01:33 UTC 2024

Modified Files:
src/sys/dev/pci: if_bge.c

Log Message:
Update bge_if_flags in bge_ifflags_cb before calling bge_setmulti so the
new setting of IFF_PROMISC is used by bge_setmulti


To generate a diff of this commit:
cvs rdiff -u -r1.395 -r1.396 src/sys/dev/pci/if_bge.c

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



CVS commit: src/sys/dev/marvell

2024-09-10 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Sep 10 17:56:35 UTC 2024

Modified Files:
src/sys/dev/marvell: gtmpsc.c

Log Message:
Fix wrong KGDB condition and remove unused gtmpsc_kgdb_addr variable.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/marvell/gtmpsc.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/dev/marvell/gtmpsc.c
diff -u src/sys/dev/marvell/gtmpsc.c:1.49 src/sys/dev/marvell/gtmpsc.c:1.50
--- src/sys/dev/marvell/gtmpsc.c:1.49	Wed Jun 12 09:51:27 2024
+++ src/sys/dev/marvell/gtmpsc.c	Tue Sep 10 17:56:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtmpsc.c,v 1.49 2024/06/12 09:51:27 andvar Exp $	*/
+/*	$NetBSD: gtmpsc.c,v 1.50 2024/09/10 17:56:35 andvar Exp $	*/
 /*
  * Copyright (c) 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmpsc.c,v 1.49 2024/06/12 09:51:27 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmpsc.c,v 1.50 2024/09/10 17:56:35 andvar Exp $");
 
 #include "opt_kgdb.h"
 
@@ -177,7 +177,6 @@ STATIC uint32_t sdma_imask;		/* soft cop
 STATIC struct cnm_state gtmpsc_cnm_state;
 
 #ifdef KGDB
-static int gtmpsc_kgdb_addr;
 static int gtmpsc_kgdb_attached;
 
 STATIC int  gtmpsc_kgdb_getc(void *);
@@ -1220,7 +1219,7 @@ gtmpscshutdown(struct gtmpsc_softc *sc)
 	struct tty *tp;
 
 #ifdef KGDB
-	if (sc->sc_flags & GTMPSCF_KGDB != 0)
+	if (sc->sc_flags & GTMPSC_KGDB)
 		return;
 #endif
 	tp = sc->sc_tty;



CVS commit: src/sys/dev/marvell

2024-09-10 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Sep 10 17:56:35 UTC 2024

Modified Files:
src/sys/dev/marvell: gtmpsc.c

Log Message:
Fix wrong KGDB condition and remove unused gtmpsc_kgdb_addr variable.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/marvell/gtmpsc.c

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



CVS commit: src/sys/dev/scsipi

2024-09-07 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Sep  8 04:42:49 UTC 2024

Modified Files:
src/sys/dev/scsipi: if_dse.c

Log Message:
Only input needs to be polled.

Tested with PDMA on mac68k (on emulated hw).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/scsipi/if_dse.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/dev/scsipi/if_dse.c
diff -u src/sys/dev/scsipi/if_dse.c:1.7 src/sys/dev/scsipi/if_dse.c:1.8
--- src/sys/dev/scsipi/if_dse.c:1.7	Sun Sep  8 04:40:34 2024
+++ src/sys/dev/scsipi/if_dse.c	Sun Sep  8 04:42:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_dse.c,v 1.7 2024/09/08 04:40:34 nat Exp $ */
+/*	$NetBSD: if_dse.c,v 1.8 2024/09/08 04:42:49 nat Exp $ */
 
 /*
  * Driver for DaynaPORT SCSI/Link SCSI-Ethernet
@@ -578,8 +578,7 @@ dse_send_worker(struct work *wk, void *c
 		error = dse_scsipi_cmd(sc->sc_periph,
 		(void *)&cmd_send, sizeof(cmd_send),
 		sc->sc_tbuf, len, DSE_RETRIES,
-		DSE_TIMEOUT, NULL, XS_CTL_NOSLEEP | XS_CTL_POLL |
-		XS_CTL_DATA_OUT);
+		DSE_TIMEOUT, NULL, XS_CTL_NOSLEEP | XS_CTL_DATA_OUT);
 		if (error) {
 			aprint_error_dev(sc->sc_dev,
 			"not queued, error %d\n", error);
@@ -1080,7 +1079,7 @@ dse_set_multi(struct dse_softc *sc)
 
 	error = dse_scsipi_cmd(sc->sc_periph,
 	(struct scsipi_generic*)&cmd_set_multi, sizeof(cmd_set_multi),
-	mybuf, len, DSE_RETRIES, DSE_TIMEOUT, NULL, XS_CTL_POLL | XS_CTL_DATA_OUT);
+	mybuf, len, DSE_RETRIES, DSE_TIMEOUT, NULL, XS_CTL_DATA_OUT);
 
 	free(mybuf, M_DEVBUF);
 



CVS commit: src/sys/dev/scsipi

2024-09-07 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Sep  8 04:42:49 UTC 2024

Modified Files:
src/sys/dev/scsipi: if_dse.c

Log Message:
Only input needs to be polled.

Tested with PDMA on mac68k (on emulated hw).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/scsipi/if_dse.c

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



CVS commit: src/sys/dev/scsipi

2024-09-07 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Sep  8 04:40:34 UTC 2024

Modified Files:
src/sys/dev/scsipi: if_dse.c

Log Message:
Use aprint_normal_dev for ethernet address.

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/scsipi/if_dse.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/dev/scsipi/if_dse.c
diff -u src/sys/dev/scsipi/if_dse.c:1.6 src/sys/dev/scsipi/if_dse.c:1.7
--- src/sys/dev/scsipi/if_dse.c:1.6	Sat Jul  6 10:37:33 2024
+++ src/sys/dev/scsipi/if_dse.c	Sun Sep  8 04:40:34 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_dse.c,v 1.6 2024/07/06 10:37:33 andvar Exp $ */
+/*	$NetBSD: if_dse.c,v 1.7 2024/09/08 04:40:34 nat Exp $ */
 
 /*
  * Driver for DaynaPORT SCSI/Link SCSI-Ethernet
@@ -983,7 +983,7 @@ dse_get_addr(struct dse_softc *sc, uint8
 	if (error == 0) {
 		memcpy(myaddr, &(tmpbuf[0]), ETHER_ADDR_LEN);
 
-		aprint_error_dev(sc->sc_dev, "ethernet address %s\n",
+		aprint_normal_dev(sc->sc_dev, "ethernet address %s\n",
 			   ether_sprintf(myaddr));
 	}
 



CVS commit: src/sys/dev/scsipi

2024-09-07 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Sep  8 04:40:34 UTC 2024

Modified Files:
src/sys/dev/scsipi: if_dse.c

Log Message:
Use aprint_normal_dev for ethernet address.

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/scsipi/if_dse.c

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



CVS commit: src/sys/dev/pci

2024-09-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep  7 06:25:27 UTC 2024

Modified Files:
src/sys/dev/pci: if_bge.c

Log Message:
Conditionally call mutex_obj_free for the mutexes in bge_release_resources
as there are code path where they might not have been allocated (yat).


To generate a diff of this commit:
cvs rdiff -u -r1.394 -r1.395 src/sys/dev/pci/if_bge.c

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



CVS commit: src/sys/dev/pci

2024-09-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep  7 06:25:27 UTC 2024

Modified Files:
src/sys/dev/pci: if_bge.c

Log Message:
Conditionally call mutex_obj_free for the mutexes in bge_release_resources
as there are code path where they might not have been allocated (yat).


To generate a diff of this commit:
cvs rdiff -u -r1.394 -r1.395 src/sys/dev/pci/if_bge.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/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.394 src/sys/dev/pci/if_bge.c:1.395
--- src/sys/dev/pci/if_bge.c:1.394	Wed Aug 28 05:58:11 2024
+++ src/sys/dev/pci/if_bge.c	Sat Sep  7 06:25:27 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.394 2024/08/28 05:58:11 skrll Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.395 2024/09/07 06:25:27 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.394 2024/08/28 05:58:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.395 2024/09/07 06:25:27 skrll Exp $");
 
 #include 
 #include 
@@ -4150,9 +4150,6 @@ bge_release_resources(struct bge_softc *
 	evcnt_detach(&sc->bge_ev_xoffentered);
 #endif /* BGE_EVENT_COUNTERS */
 
-	mutex_obj_free(sc->sc_intr_lock);
-	mutex_obj_free(sc->sc_mcast_lock);
-
 	/* Disestablish the interrupt handler */
 	if (sc->bge_intrhand != NULL) {
 		pci_intr_disestablish(sc->sc_pc, sc->bge_intrhand);
@@ -4184,6 +4181,14 @@ bge_release_resources(struct bge_softc *
 		sc->bge_apesize);
 		sc->bge_apesize = 0;
 	}
+	if (sc->sc_intr_lock) {
+		mutex_obj_free(sc->sc_intr_lock);
+		sc->sc_intr_lock = NULL;
+	}
+	if (sc->sc_mcast_lock) {
+		mutex_obj_free(sc->sc_mcast_lock);
+		sc->sc_mcast_lock = NULL;
+	}
 }
 
 static int



CVS commit: src/sys/dev/pci

2024-09-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Sep  5 17:54:02 UTC 2024

Modified Files:
src/sys/dev/pci: if_vte.c

Log Message:
s/vte_rxoef/vte_rxeof/ in debug message.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pci/if_vte.c

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



CVS commit: src/sys/dev/pci

2024-09-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Sep  5 17:54:02 UTC 2024

Modified Files:
src/sys/dev/pci: if_vte.c

Log Message:
s/vte_rxoef/vte_rxeof/ in debug message.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pci/if_vte.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/dev/pci/if_vte.c
diff -u src/sys/dev/pci/if_vte.c:1.37 src/sys/dev/pci/if_vte.c:1.38
--- src/sys/dev/pci/if_vte.c:1.37	Fri Jul  5 04:31:51 2024
+++ src/sys/dev/pci/if_vte.c	Thu Sep  5 17:54:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vte.c,v 1.37 2024/07/05 04:31:51 rin Exp $	*/
+/*	$NetBSD: if_vte.c,v 1.38 2024/09/05 17:54:02 andvar Exp $	*/
 
 /*
  * Copyright (c) 2011 Manuel Bouyer.  All rights reserved.
@@ -55,7 +55,7 @@
 /* Driver for DM&P Electronics, Inc, Vortex86 RDC R6040 FastEthernet. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.37 2024/07/05 04:31:51 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.38 2024/09/05 17:54:02 andvar Exp $");
 
 #include 
 #include 
@@ -1114,7 +1114,7 @@ vte_rxeof(struct vte_softc *sc)
 	VTE_DESC_INC(cons, VTE_RX_RING_CNT)) {
 		rxd = &sc->vte_cdata.vte_rxdesc[cons];
 		status = le16toh(rxd->rx_desc->drst);
-		DPRINTF(("vte_rxoef rxd %d/%p mbuf %p status 0x%x len %d\n",
+		DPRINTF(("vte_rxeof rxd %d/%p mbuf %p status 0x%x len %d\n",
 			cons, rxd, rxd->rx_m, status,
 			VTE_RX_LEN(le16toh(rxd->rx_desc->drlen;
 		if ((status & VTE_DRST_RX_OWN) != 0)



CVS commit: src/sys/dev/ic

2024-09-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep  4 10:45:50 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
more annotations:
- 'transfer data' is actually a pixel mask
- transparency
- bg colour register confirmed
all found by experiment


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/stireg.h

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



CVS commit: src/sys/dev/ic

2024-09-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep  4 10:45:50 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
more annotations:
- 'transfer data' is actually a pixel mask
- transparency
- bg colour register confirmed
all found by experiment


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/stireg.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/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.13 src/sys/dev/ic/stireg.h:1.14
--- src/sys/dev/ic/stireg.h:1.13	Mon Aug 19 10:57:32 2024
+++ src/sys/dev/ic/stireg.h	Wed Sep  4 10:45:50 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.13 2024/08/19 10:57:32 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.14 2024/09/04 10:45:50 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -650,6 +650,8 @@ STI_DEP(util);
 	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
 	/* LSSD       ??BF */
 
+/* B = 1 -> background transparency for masked fills */
+
 #define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
 #define	FractDcd	1	/* Pixel data is Fractional 8-8-8 */
 #define	Otc04	2	/* Pixels in each longword transfer (4) */
@@ -687,7 +689,8 @@ STI_DEP(util);
 #define	NGLE_REG_6		0x000800	/* rectfill XY */
 #define	NGLE_REG_7		0x000804	/* bitblt size WH */
 #define	NGLE_REG_24		0x000808	/* bitblt src XY */
-#define	NGLE_REG_8		0x000820	/* transfer data */
+#define	NGLE_REG_8		0x000820	/* 'transfer data' - this is */
+		/* a pixel mask on fills */
 #define	NGLE_REG_37		0x000944	/* HCRX fast rect fill, size */
 #define	NGLE_REG_9		0x000a04	/* rect fill size, start */
 #define	NGLE_REG_25		0x000b00	/* bitblt dst XY, start */
@@ -695,8 +698,8 @@ STI_DEP(util);
 #define	NGLE_REG_10		0x018000	/* buffer ctl */
 #define	NGLE_REG_11		0x018004	/* dest bitmap access */
 #define	NGLE_REG_12		0x01800c	/* control plane register */
-#define	NGLE_REG_35		0x018010	/* fg color */
-#define	NGLE_REG_36		0x018014	/* bg colour? */
+#define	NGLE_REG_35		0x018010	/* fg colour */
+#define	NGLE_REG_36		0x018014	/* bg colour */
 #define	NGLE_REG_13		0x018018	/* image planemask */
 #define	NGLE_REG_14		0x01801c	/* raster op */
 #define	NGLE_REG_15		0x20	/* 'busy dodger' idle */



CVS commit: src/sys/dev/hpc

2024-09-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep  1 20:11:09 UTC 2024

Modified Files:
src/sys/dev/hpc: files.hpcio

Log Message:
s/trriger/trigger/ and s/sepecify/specify/.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/hpc/files.hpcio

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



CVS commit: src/sys/dev/hpc

2024-09-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep  1 20:11:09 UTC 2024

Modified Files:
src/sys/dev/hpc: files.hpcio

Log Message:
s/trriger/trigger/ and s/sepecify/specify/.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/hpc/files.hpcio

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/hpc/files.hpcio
diff -u src/sys/dev/hpc/files.hpcio:1.7 src/sys/dev/hpc/files.hpcio:1.8
--- src/sys/dev/hpc/files.hpcio:1.7	Sat Jul 24 21:31:37 2021
+++ src/sys/dev/hpc/files.hpcio	Sun Sep  1 20:11:09 2024
@@ -1,8 +1,8 @@
-#	$NetBSD: files.hpcio,v 1.7 2021/07/24 21:31:37 andvar Exp $
+#	$NetBSD: files.hpcio,v 1.8 2024/09/01 20:11:09 andvar Exp $
 #	H/PC GPIO interface
 
 #  platform:
-#iochip: sepecify GPIO chip
+#iochip: specify GPIO chip
 #evtype: event type of config_hook
 #id: event id of config_hook
 #  port: port number on GPIO
@@ -15,7 +15,7 @@
 #		0: low
 #		1: high
 #		default: edge
-#  edge: edge trriger interrupt
+#  edge: edge trigger interrupt
 #		1: positive edge
 #		2: negative edge
 #		other: both



CVS commit: src/sys/dev/pci

2024-08-29 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Aug 29 20:41:49 UTC 2024

Modified Files:
src/sys/dev/pci: ppb.c

Log Message:
improve grammar in the comment.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/pci/ppb.c

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



CVS commit: src/sys/dev/pci

2024-08-29 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Aug 29 20:41:49 UTC 2024

Modified Files:
src/sys/dev/pci: ppb.c

Log Message:
improve grammar in the comment.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/pci/ppb.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/dev/pci/ppb.c
diff -u src/sys/dev/pci/ppb.c:1.75 src/sys/dev/pci/ppb.c:1.76
--- src/sys/dev/pci/ppb.c:1.75	Sun Nov 26 06:38:28 2023
+++ src/sys/dev/pci/ppb.c	Thu Aug 29 20:41:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppb.c,v 1.75 2023/11/26 06:38:28 rin Exp $	*/
+/*	$NetBSD: ppb.c,v 1.76 2024/08/29 20:41:49 andvar Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.75 2023/11/26 06:38:28 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.76 2024/08/29 20:41:49 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ppb.h"
@@ -533,7 +533,7 @@ ppb_intr(void *arg)
 
 	/*
 	 * Not me. This check is only required for INTx.
-	 * ppb_intr() would be spilted int ppb_intr_legacy() and ppb_intr_msi()
+	 * ppb_intr() would be split into ppb_intr_legacy() and ppb_intr_msi()
 	 */
 	if ((reg & PCIE_SLCSR_STATCHG_MASK) == 0)
 		return 0;



CVS commit: src/sys/dev/cadence

2024-08-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Aug 29 07:22:36 UTC 2024

Modified Files:
src/sys/dev/cadence: cemacreg.h

Log Message:
Use more BITS(3)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/cadence/cemacreg.h

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



CVS commit: src/sys/dev/cadence

2024-08-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Aug 29 07:22:36 UTC 2024

Modified Files:
src/sys/dev/cadence: cemacreg.h

Log Message:
Use more BITS(3)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/cadence/cemacreg.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/cadence/cemacreg.h
diff -u src/sys/dev/cadence/cemacreg.h:1.6 src/sys/dev/cadence/cemacreg.h:1.7
--- src/sys/dev/cadence/cemacreg.h:1.6	Wed Aug 28 06:50:17 2024
+++ src/sys/dev/cadence/cemacreg.h	Thu Aug 29 07:22:36 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: cemacreg.h,v 1.6 2024/08/28 06:50:17 skrll Exp $	*/
+/*  $NetBSD: cemacreg.h,v 1.7 2024/08/29 07:22:36 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -137,32 +137,30 @@
 
 /* Configuration Register bits: */
 #define	ETH_CFG_RMII	__BIT(13)  /* 1 = enable RMII (Reduce MII) (AT91RM9200 only) */
-#define	ETH_CFG_RTY	__BIT(12)	/* 1 = retry test enabled		*/
-
-#define	ETH_CFG_CLK	0x0C00U	/* clock*/
-#define	ETH_CFG_CLK_8	0xU
-#define	ETH_CFG_CLK_16	0x0400U
-#define	ETH_CFG_CLK_32	0x0800U
-#define	ETH_CFG_CLK_64	0x0C00U
-
-#define	ETH_CFG_EAE	__BIT(9)	/* 1 = external address match enable	*/
-#define	ETH_CFG_BIG	__BIT(8)	/* 1 = receive up to 1522 bytes	(VLAN)	*/
-#define	ETH_CFG_UNI	__BIT(7)	/* 1 = enable unicast hash		*/
-#define	ETH_CFG_MTI	__BIT(6)	/* 1 = enable multicast hash		*/
-#define	ETH_CFG_NBC	__BIT(5)	/* 1 = ignore received broadcasts	*/
-#define	ETH_CFG_CAF	__BIT(4)	/* 1 = receive all valid frames		*/
+#define	ETH_CFG_RTY	__BIT(12)  /* 1 = retry test enabled		*/
+#define	ETH_CFG_CLK	__BITS(11, 10)	/* clock*/
+#define	 ETH_CFG_CLK_8	__SHIFTIN(0, ETH_CFG_CLK)
+#define	 ETH_CFG_CLK_16	__SHIFTIN(1, ETH_CFG_CLK)
+#define	 ETH_CFG_CLK_32	__SHIFTIN(2, ETH_CFG_CLK)
+#define	 ETH_CFG_CLK_64	__SHIFTIN(3, ETH_CFG_CLK)
+#define	ETH_CFG_EAE	__BIT(9)  /* 1 = external address match enable	*/
+#define	ETH_CFG_BIG	__BIT(8)  /* 1 = receive up to 1522 bytes	(VLAN)	*/
+#define	ETH_CFG_UNI	__BIT(7)  /* 1 = enable unicast hash		*/
+#define	ETH_CFG_MTI	__BIT(6)  /* 1 = enable multicast hash		*/
+#define	ETH_CFG_NBC	__BIT(5)  /* 1 = ignore received broadcasts	*/
+#define	ETH_CFG_CAF	__BIT(4)  /* 1 = receive all valid frames		*/
 #define	ETH_CFG_BR	__BIT(2)
-#define	ETH_CFG_FD	__BIT(1)	/* 1 = force full duplex		*/
-#define	ETH_CFG_SPD	__BIT(0)	/* 1 = 100 Mbps*/
+#define	ETH_CFG_FD	__BIT(1)  /* 1 = force full duplex		*/
+#define	ETH_CFG_SPD	__BIT(0)  /* 1 = 100 Mbps*/
 
 #define GEM_CFG_GEN	__BIT(10)
 #define GEM_CFG_CLK	__BITS(20, 18)
-#define GEM_CFG_CLK_8	__SHIFTIN(0, GEM_CFG_CLK)
-#define GEM_CFG_CLK_16	__SHIFTIN(1, GEM_CFG_CLK)
-#define GEM_CFG_CLK_32	__SHIFTIN(2, GEM_CFG_CLK)
-#define GEM_CFG_CLK_48	__SHIFTIN(3, GEM_CFG_CLK)
-#define GEM_CFG_CLK_64	__SHIFTIN(4, GEM_CFG_CLK)
-#define GEM_CFG_CLK_96	__SHIFTIN(5, GEM_CFG_CLK)
+#define  GEM_CFG_CLK_8	__SHIFTIN(0, GEM_CFG_CLK)
+#define  GEM_CFG_CLK_16	__SHIFTIN(1, GEM_CFG_CLK)
+#define  GEM_CFG_CLK_32	__SHIFTIN(2, GEM_CFG_CLK)
+#define  GEM_CFG_CLK_48	__SHIFTIN(3, GEM_CFG_CLK)
+#define  GEM_CFG_CLK_64	__SHIFTIN(4, GEM_CFG_CLK)
+#define  GEM_CFG_CLK_96	__SHIFTIN(5, GEM_CFG_CLK)
 #define GEM_CFG_DBW	__BITS(22, 21)
 #define	GEM_CFG_RXCOEN	__BIT(24)
 
@@ -178,35 +176,35 @@
 
 
 /* Transmit Status Register bits: */
-#define	ETH_TSR_UND	__BIT(6)	/* 1 = transmit underrun detected	*/
-#define	ETH_TSR_COMP	__BIT(5)	/* 1 = transmit complete		*/
-#define	ETH_TSR_BNQ	__BIT(4)	/* 1 = transmit buffer not queued (at91rm9200 only)	*/
-#define	ETH_TSR_IDLE	__BIT(3)	/* 1 = transmitter idle			*/
-#define	ETH_TSR_RLE	__BIT(2)	/* 1 = retry limit exceeded		*/
-#define	ETH_TSR_COL	__BIT(1)	/* 1 = collision occurred		*/
-#define	ETH_TSR_OVR	__BIT(0)	/* 1 = transmit buffer overrun		*/
+#define	ETH_TSR_UND	__BIT(6)  /* 1 = transmit underrun detected	*/
+#define	ETH_TSR_COMP	__BIT(5)  /* 1 = transmit complete		*/
+#define	ETH_TSR_BNQ	__BIT(4)  /* 1 = transmit buffer not queued (at91rm9200 only)	*/
+#define	ETH_TSR_IDLE	__BIT(3)  /* 1 = transmitter idle			*/
+#define	ETH_TSR_RLE	__BIT(2)  /* 1 = retry limit exceeded		*/
+#define	ETH_TSR_COL	__BIT(1)  /* 1 = collision occurred		*/
+#define	ETH_TSR_OVR	__BIT(0)  /* 1 = transmit buffer overrun		*/
 
 #define	GEM_TSR_TXGO	__BIT(3)
 
 /* Receive Status Register bits: */
-#define	ETH_RSR_OVR	__BIT(2)	/* 1 = RX overrun			*/
-#define	ETH_RSR_REC	__BIT(1)	/* 1 = frame received			*/
-#define	ETH_RSR_BNA	__BIT(0)	/* 1 = buffer not available		*/
+#define	ETH_RSR_OVR	__BIT(2)  /* 1 = RX overrun			*/
+#define	ETH_RSR_REC	__BIT(1)  /* 1 = frame received			*/
+#define	ETH_RSR_BNA	__BIT(0)  /* 1 = buffer not available		*/
 
 
 /* Interrupt bits: */
-#define	ETH_ISR_ABT	__BIT(11)	/* 1 = abort during DMA transfer	*/
-#define	ETH_ISR_ROVR	__BIT(10)	/* 1 = RX overrun			*/
-#define	ETH_ISR_LINK	__BIT(9)	/* 1 = link pin changed			*/
-#define	ETH_ISR

CVS commit: src/sys/dev/pci/cxgb

2024-08-28 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Aug 29 04:55:33 UTC 2024

Modified Files:
src/sys/dev/pci/cxgb: cxgb_t3_hw.c

Log Message:
s/Perfoms/Performs/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/cxgb/cxgb_t3_hw.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/dev/pci/cxgb/cxgb_t3_hw.c
diff -u src/sys/dev/pci/cxgb/cxgb_t3_hw.c:1.8 src/sys/dev/pci/cxgb/cxgb_t3_hw.c:1.9
--- src/sys/dev/pci/cxgb/cxgb_t3_hw.c:1.8	Thu May 23 08:52:06 2024
+++ src/sys/dev/pci/cxgb/cxgb_t3_hw.c	Thu Aug 29 04:55:33 2024
@@ -28,7 +28,7 @@ POSSIBILITY OF SUCH DAMAGE.
 ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cxgb_t3_hw.c,v 1.8 2024/05/23 08:52:06 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cxgb_t3_hw.c,v 1.9 2024/08/29 04:55:33 andvar Exp $");
 
 
 #ifdef CONFIG_DEFINED
@@ -3618,7 +3618,7 @@ void mac_prep(struct cmac *mac, adapter_
  *  @adapter: the adapter
  *  @ai: contains information about the adapter type and properties
  *
- *  Perfoms the part of HW initialization that is done early on when the
+ *  Performs the part of HW initialization that is done early on when the
  *  driver first detecs the card.  Most of the HW state is initialized
  *  lazily later on when a port or an offload function are first used.
  */



CVS commit: src/sys/dev/pci/cxgb

2024-08-28 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Aug 29 04:55:33 UTC 2024

Modified Files:
src/sys/dev/pci/cxgb: cxgb_t3_hw.c

Log Message:
s/Perfoms/Performs/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/cxgb/cxgb_t3_hw.c

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



CVS commit: src/sys/dev/cadence

2024-08-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug 28 06:50:18 UTC 2024

Modified Files:
src/sys/dev/cadence: cemacreg.h if_cemac.c

Log Message:
Shorten a bit definition name.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/cadence/cemacreg.h
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/cadence/if_cemac.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/dev/cadence/cemacreg.h
diff -u src/sys/dev/cadence/cemacreg.h:1.5 src/sys/dev/cadence/cemacreg.h:1.6
--- src/sys/dev/cadence/cemacreg.h:1.5	Sun Aug 25 21:15:46 2024
+++ src/sys/dev/cadence/cemacreg.h	Wed Aug 28 06:50:17 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: cemacreg.h,v 1.5 2024/08/25 21:15:46 skrll Exp $	*/
+/*  $NetBSD: cemacreg.h,v 1.6 2024/08/28 06:50:17 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -164,7 +164,7 @@
 #define GEM_CFG_CLK_64	__SHIFTIN(4, GEM_CFG_CLK)
 #define GEM_CFG_CLK_96	__SHIFTIN(5, GEM_CFG_CLK)
 #define GEM_CFG_DBW	__BITS(22, 21)
-#define	GEM_CFG_RX_CHKSUM_OFFLD_EN	__BIT(24)
+#define	GEM_CFG_RXCOEN	__BIT(24)
 
 /* Status Register bits: */
 #define	ETH_SR_IDLE	__BIT(2)	/* 1 = PHY logic is running		*/

Index: src/sys/dev/cadence/if_cemac.c
diff -u src/sys/dev/cadence/if_cemac.c:1.39 src/sys/dev/cadence/if_cemac.c:1.40
--- src/sys/dev/cadence/if_cemac.c:1.39	Tue Aug 27 07:53:20 2024
+++ src/sys/dev/cadence/if_cemac.c	Wed Aug 28 06:50:17 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cemac.c,v 1.39 2024/08/27 07:53:20 skrll Exp $	*/
+/*	$NetBSD: if_cemac.c,v 1.40 2024/08/28 06:50:17 skrll Exp $	*/
 
 /*
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.39 2024/08/27 07:53:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.40 2024/08/28 06:50:17 skrll Exp $");
 
 #include 
 #include 
@@ -855,7 +855,7 @@ cemac_ifinit(struct ifnet *ifp)
 			IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_UDPv4_Rx |
 			IFCAP_CSUM_TCPv6_Rx | IFCAP_CSUM_UDPv6_Rx)) {
 			cfg = CEMAC_READ(ETH_CFG);
-			cfg |= GEM_CFG_RX_CHKSUM_OFFLD_EN;
+			cfg |= GEM_CFG_RXCOEN;
 			CEMAC_WRITE(ETH_CFG, cfg);
 		}
 	}



CVS commit: src/sys/dev/cadence

2024-08-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug 28 06:50:18 UTC 2024

Modified Files:
src/sys/dev/cadence: cemacreg.h if_cemac.c

Log Message:
Shorten a bit definition name.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/cadence/cemacreg.h
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/cadence/if_cemac.c

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



CVS commit: src/sys/dev/pci

2024-08-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug 28 05:58:11 UTC 2024

Modified Files:
src/sys/dev/pci: if_bge.c if_bgevar.h

Log Message:
Apply changes from PR/58584 after testing (and fixing).

Tested on an Apple M1.


To generate a diff of this commit:
cvs rdiff -u -r1.393 -r1.394 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/if_bgevar.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_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.393 src/sys/dev/pci/if_bge.c:1.394
--- src/sys/dev/pci/if_bge.c:1.393	Fri Jul  5 04:31:51 2024
+++ src/sys/dev/pci/if_bge.c	Wed Aug 28 05:58:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.393 2024/07/05 04:31:51 rin Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.394 2024/08/28 05:58:11 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.393 2024/07/05 04:31:51 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.394 2024/08/28 05:58:11 skrll Exp $");
 
 #include 
 #include 
@@ -203,9 +203,7 @@ static void bge_start_locked(struct ifne
 static int bge_ifflags_cb(struct ethercom *);
 static int bge_ioctl(struct ifnet *, u_long, void *);
 static int bge_init(struct ifnet *);
-static int bge_init_locked(struct ifnet *);
 static void bge_stop(struct ifnet *, int);
-static void bge_stop_locked(struct ifnet *, bool);
 static bool bge_watchdog_tick(struct ifnet *);
 static int bge_ifmedia_upd(struct ifnet *);
 static void bge_ifmedia_sts(struct ifnet *, struct ifmediareq *);
@@ -1091,6 +1089,8 @@ bge_miibus_readreg(device_t dev, int phy
 	int rv = 0;
 	int i;
 
+	KASSERT(mutex_owned(sc->sc_intr_lock));
+
 	if (bge_ape_lock(sc, sc->bge_phy_ape_lock) != 0)
 		return -1;
 
@@ -1144,6 +1144,8 @@ bge_miibus_writereg(device_t dev, int ph
 	int rv = 0;
 	int i;
 
+	KASSERT(mutex_owned(sc->sc_intr_lock));
+
 	if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906 &&
 	(reg == MII_GTCR || reg == BRGPHY_MII_AUXCTL))
 		return 0;
@@ -1198,6 +1200,8 @@ bge_miibus_statchg(struct ifnet *ifp)
 	struct mii_data *mii = &sc->bge_mii;
 	uint32_t mac_mode, rx_mode, tx_mode;
 
+	KASSERT(mutex_owned(sc->sc_intr_lock));
+
 	/*
 	 * Get flow control negotiation result.
 	 */
@@ -1838,7 +1842,7 @@ bge_setmulti(struct bge_softc *sc)
 	uint32_t		h;
 	int			i;
 
-	KASSERT(mutex_owned(sc->sc_core_lock));
+	KASSERT(mutex_owned(sc->sc_mcast_lock));
 	if (sc->bge_if_flags & IFF_PROMISC)
 		goto allmulti;
 
@@ -2766,10 +2770,16 @@ bge_blockinit(struct bge_softc *sc)
 
 	/* 5718 step 35, 36, 37 */
 	/* Set up host coalescing defaults */
-	CSR_WRITE_4(sc, BGE_HCC_RX_COAL_TICKS, sc->bge_rx_coal_ticks);
-	CSR_WRITE_4(sc, BGE_HCC_TX_COAL_TICKS, sc->bge_tx_coal_ticks);
-	CSR_WRITE_4(sc, BGE_HCC_RX_MAX_COAL_BDS, sc->bge_rx_max_coal_bds);
-	CSR_WRITE_4(sc, BGE_HCC_TX_MAX_COAL_BDS, sc->bge_tx_max_coal_bds);
+	mutex_enter(sc->sc_intr_lock);
+	const uint32_t rx_coal_ticks = sc->bge_rx_coal_ticks;
+	const uint32_t tx_coal_ticks = sc->bge_tx_coal_ticks;
+	const uint32_t rx_max_coal_bds = sc->bge_rx_max_coal_bds;
+	const uint32_t tx_max_coal_bds = sc->bge_tx_max_coal_bds;
+	mutex_exit(sc->sc_intr_lock);
+	CSR_WRITE_4(sc, BGE_HCC_RX_COAL_TICKS, rx_coal_ticks);
+	CSR_WRITE_4(sc, BGE_HCC_TX_COAL_TICKS, tx_coal_ticks);
+	CSR_WRITE_4(sc, BGE_HCC_RX_MAX_COAL_BDS, rx_max_coal_bds);
+	CSR_WRITE_4(sc, BGE_HCC_TX_MAX_COAL_BDS, tx_max_coal_bds);
 	if (!(BGE_IS_5705_PLUS(sc))) {
 		CSR_WRITE_4(sc, BGE_HCC_RX_COAL_TICKS_INT, 0);
 		CSR_WRITE_4(sc, BGE_HCC_TX_COAL_TICKS_INT, 0);
@@ -3295,7 +3305,6 @@ bge_attach(device_t parent, device_t sel
 		return;
 	}
 
-	sc->bge_stopping = false;
 	sc->bge_txrx_stopping = false;
 
 	/* Save various chip information. */
@@ -3869,7 +3878,7 @@ bge_attach(device_t parent, device_t sel
 	else
 		sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT;
 
-	sc->sc_core_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
+	sc->sc_mcast_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_SOFTNET);
 	sc->sc_intr_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NET);
 
 	/* Set up ifnet structure */
@@ -3988,6 +3997,7 @@ bge_attach(device_t parent, device_t sel
 			mii_flags |= MIIF_HAVEFIBER;
 again:
 		bge_asf_driver_up(sc);
+		mutex_enter(sc->sc_intr_lock);
 		rv = bge_miibus_readreg(sc->bge_dev, sc->bge_phy_addr,
 		MII_BMCR, &phyreg);
 		if ((rv != 0) || ((phyreg & BMCR_PDOWN) != 0)) {
@@ -4004,6 +4014,7 @@ again:
 DELAY(1000);
 			}
 		}
+		mutex_exit(sc->sc_intr_lock);
 
 		mii_attach(sc->bge_dev, mii, capmask, sc->bge_phy_addr,
 		MII_OFFSET_ANY, mii_flags);
@@ -4078,6 +4089,8 @@ again:
 #ifdef BGE_DEBUG
 	bge_debug_info(sc);
 #endif
+
+	sc->bge_attached = true;
 }
 
 /*
@@ -4090,6 +4103,9 @@ bge_detach(device_t self, int flags __un
 	struct bge_softc * const sc = device_private(self);
 	struct ifnet * const ifp = &sc->ethercom.ec_if;
 
+	if (!sc->bge_attached)
+		return 0;
+
 	IFNET_LOCK(ifp);
 

CVS commit: src/sys/dev/pci

2024-08-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug 28 05:58:11 UTC 2024

Modified Files:
src/sys/dev/pci: if_bge.c if_bgevar.h

Log Message:
Apply changes from PR/58584 after testing (and fixing).

Tested on an Apple M1.


To generate a diff of this commit:
cvs rdiff -u -r1.393 -r1.394 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/if_bgevar.h

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



CVS commit: src/sys/dev/cadence

2024-08-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Aug 27 07:53:20 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
Wrap long lines


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/cadence/if_cemac.c

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



CVS commit: src/sys/dev/cadence

2024-08-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Aug 27 07:53:20 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
Wrap long lines


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/cadence/if_cemac.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/dev/cadence/if_cemac.c
diff -u src/sys/dev/cadence/if_cemac.c:1.38 src/sys/dev/cadence/if_cemac.c:1.39
--- src/sys/dev/cadence/if_cemac.c:1.38	Tue Aug 27 07:28:59 2024
+++ src/sys/dev/cadence/if_cemac.c	Tue Aug 27 07:53:20 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cemac.c,v 1.38 2024/08/27 07:28:59 skrll Exp $	*/
+/*	$NetBSD: if_cemac.c,v 1.39 2024/08/27 07:53:20 skrll Exp $	*/
 
 /*
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.38 2024/08/27 07:28:59 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.39 2024/08/27 07:53:20 skrll Exp $");
 
 #include 
 #include 
@@ -80,12 +80,12 @@ __KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v
 #define CEMAC_WRITE(x, y) \
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh, (x), (y))
 #define CEMAC_GEM_WRITE(x, y)		  \
-	do {  \
-		if (ISSET(sc->cemac_flags, CEMAC_FLAG_GEM))		  \
-			bus_space_write_4(sc->sc_iot, sc->sc_ioh, (GEM_##x), (y)); \
-		else			  \
-			bus_space_write_4(sc->sc_iot, sc->sc_ioh, (ETH_##x), (y)); \
-	} while(0)
+do {  \
+	if (ISSET(sc->cemac_flags, CEMAC_FLAG_GEM))			  \
+		bus_space_write_4(sc->sc_iot, sc->sc_ioh, (GEM_##x), (y));\
+	else  \
+		bus_space_write_4(sc->sc_iot, sc->sc_ioh, (ETH_##x), (y));\
+} while(0)
 
 static void	cemac_init(struct cemac_softc *);
 static int	cemac_gctx(struct cemac_softc *);
@@ -230,29 +230,40 @@ cemac_intr(void *arg)
 #ifdef	CEMAC_DEBUG
 	rsr = CEMAC_READ(ETH_RSR);		// get receive status register
 #endif
-	DPRINTFN(2, ("%s: isr=0x%08X rsr=0x%08X imr=0x%08X\n", __FUNCTION__, isr, rsr, imr));
+	DPRINTFN(2, ("%s: isr=0x%08X rsr=0x%08X imr=0x%08X\n", __FUNCTION__,
+	isr, rsr, imr));
 
 	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
-	if (isr & ETH_ISR_RBNA) {		// out of receive buffers
-		CEMAC_WRITE(ETH_RSR, ETH_RSR_BNA);	// clear interrupt
-		ctl = CEMAC_READ(ETH_CTL);		// get current control register value
-		CEMAC_WRITE(ETH_CTL, ctl & ~ETH_CTL_RE);	// disable receiver
-		CEMAC_WRITE(ETH_RSR, ETH_RSR_BNA);	// clear BNA bit
-		CEMAC_WRITE(ETH_CTL, ctl |  ETH_CTL_RE);	// re-enable receiver
+	// out of receive buffers
+	if (isr & ETH_ISR_RBNA) {
+		// clear interrupt
+		CEMAC_WRITE(ETH_RSR, ETH_RSR_BNA);
+
+		ctl = CEMAC_READ(ETH_CTL);
+		// disable receiver
+		CEMAC_WRITE(ETH_CTL, ctl & ~ETH_CTL_RE);
+		// clear BNA bit
+		CEMAC_WRITE(ETH_RSR, ETH_RSR_BNA);
+		// re-enable receiver
+		CEMAC_WRITE(ETH_CTL, ctl |  ETH_CTL_RE);
+
 		if_statinc_ref(ifp, nsr, if_ierrors);
 		if_statinc_ref(ifp, nsr, if_ipackets);
 		DPRINTFN(1,("%s: out of receive buffers\n", __FUNCTION__));
 	}
 	if (isr & ETH_ISR_ROVR) {
-		CEMAC_WRITE(ETH_RSR, ETH_RSR_OVR);	// clear interrupt
+		// clear interrupt
+		CEMAC_WRITE(ETH_RSR, ETH_RSR_OVR);
 		if_statinc_ref(ifp, nsr, if_ierrors);
 		if_statinc_ref(ifp, nsr, if_ipackets);
 		DPRINTFN(1,("%s: receive overrun\n", __FUNCTION__));
 	}
 
-	if (isr & ETH_ISR_RCOM) {			// packet has been received!
+	// packet has been received!
+	if (isr & ETH_ISR_RCOM) {
 		uint32_t nfo;
-		DPRINTFN(2,("#2 RDSC[%i].INFO=0x%08X\n", sc->rxqi % RX_QLEN, sc->RDSC[sc->rxqi % RX_QLEN].Info));
+		DPRINTFN(2,("#2 RDSC[%i].INFO=0x%08X\n", sc->rxqi % RX_QLEN,
+		sc->RDSC[sc->rxqi % RX_QLEN].Info));
 		while (sc->RDSC[(bi = sc->rxqi % RX_QLEN)].Addr & ETH_RDSC_F_USED) {
 			int fl, csum;
 			struct mbuf *m;
@@ -265,8 +276,9 @@ cemac_intr(void *arg)
 			if (m != NULL)
 MCLGET(m, M_DONTWAIT);
 			if (m != NULL && (m->m_flags & M_EXT)) {
-bus_dmamap_sync(sc->sc_dmat, sc->rxq[bi].m_dmamap, 0,
-		MCLBYTES, BUS_DMASYNC_POSTREAD);
+bus_dmamap_sync(sc->sc_dmat,
+sc->rxq[bi].m_dmamap, 0, MCLBYTES,
+BUS_DMASYNC_POSTREAD);
 bus_dmamap_unload(sc->sc_dmat,
 	sc->rxq[bi].m_dmamap);
 m_set_rcvif(sc->rxq[bi].m, ifp);
@@ -296,15 +308,15 @@ cemac_intr(void *arg)
 	m_adj(m, mtod(m, intptr_t) & 3);
 sc->rxq[bi].m = m;
 bus_dmamap_load(sc->sc_dmat,
-	sc->rxq[bi].m_dmamap,
-	m->m_ext.ext_buf, MCLBYTES,
-	NULL, BUS_DMA_NOWAIT);
-bus_dmamap_sync(sc->sc_dmat, sc->rxq[bi].m_dmamap, 0,
-		MCLBYTES, BUS_DMASYNC_PREREAD);
+sc->rxq[bi].m_dmamap, m->m_ext.ext_buf,
+	MCLBYTES, NULL, BUS_DMA_NOWAIT);
+bus_dmamap_sync(sc->sc_dmat,
+sc->rxq[bi].m_dmamap, 0, MCLBYTES,
+BUS_DMASYNC_PREREAD);
 sc->RDSC[bi].Info = 0;
 sc->RDSC[bi].Addr =
-	sc->rxq[bi].m_dmamap->dm_segs[0].ds_addr
-	| (bi == (RX_QLEN-1) ? ETH_RDSC_F_WRAP : 0);
+sc->rxq[bi].m_dmamap->dm_segs[0].ds

CVS commit: src/sys/dev/cadence

2024-08-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Aug 27 07:29:00 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/cadence/if_cemac.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/dev/cadence/if_cemac.c
diff -u src/sys/dev/cadence/if_cemac.c:1.37 src/sys/dev/cadence/if_cemac.c:1.38
--- src/sys/dev/cadence/if_cemac.c:1.37	Sun Aug 25 16:27:33 2024
+++ src/sys/dev/cadence/if_cemac.c	Tue Aug 27 07:28:59 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cemac.c,v 1.37 2024/08/25 16:27:33 skrll Exp $	*/
+/*	$NetBSD: if_cemac.c,v 1.38 2024/08/27 07:28:59 skrll Exp $	*/
 
 /*
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.37 2024/08/25 16:27:33 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.38 2024/08/27 07:28:59 skrll Exp $");
 
 #include 
 #include 
@@ -263,7 +263,7 @@ cemac_intr(void *arg)
 
 			MGETHDR(m, M_DONTWAIT, MT_DATA);
 			if (m != NULL)
- MCLGET(m, M_DONTWAIT);
+MCLGET(m, M_DONTWAIT);
 			if (m != NULL && (m->m_flags & M_EXT)) {
 bus_dmamap_sync(sc->sc_dmat, sc->rxq[bi].m_dmamap, 0,
 		MCLBYTES, BUS_DMASYNC_POSTREAD);
@@ -739,7 +739,7 @@ start:
 
 		MGETHDR(mn, M_DONTWAIT, MT_DATA);
 		if (mn == NULL)
-			 goto stop;
+			goto stop;
 		if (m->m_pkthdr.len > MHLEN) {
 			MCLGET(mn, M_DONTWAIT);
 			if ((mn->m_flags & M_EXT) == 0) {



CVS commit: src/sys/dev/cadence

2024-08-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Aug 27 07:29:00 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/cadence/if_cemac.c

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



CVS commit: src/sys/dev/ic

2024-08-26 Thread Benny Siegert
Module Name:src
Committed By:   bsiegert
Date:   Mon Aug 26 18:25:29 UTC 2024

Modified Files:
src/sys/dev/ic: dwc_eqos.c

Log Message:
dwc_eqos: grammar fix

If the MAC address has the multicast bit set, the driver outputs
"Clearing the multicast bit" instead of "Clear the multicast bit".


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/dwc_eqos.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/dev/ic/dwc_eqos.c
diff -u src/sys/dev/ic/dwc_eqos.c:1.37 src/sys/dev/ic/dwc_eqos.c:1.38
--- src/sys/dev/ic/dwc_eqos.c:1.37	Fri Jul  5 04:31:51 2024
+++ src/sys/dev/ic/dwc_eqos.c	Mon Aug 26 18:25:29 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.37 2024/07/05 04:31:51 rin Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.38 2024/08/26 18:25:29 bsiegert Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.37 2024/07/05 04:31:51 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.38 2024/08/26 18:25:29 bsiegert Exp $");
 
 #include 
 #include 
@@ -1265,7 +1265,7 @@ eqos_get_eaddr(struct eqos_softc *sc, ui
 	machi = RD4(sc, GMAC_MAC_ADDRESS0_HIGH) & 0x;
 	if ((maclo & 0x0001) != 0) {
 		aprint_error_dev(sc->sc_dev,
-		"Wrong MAC address. Clear the multicast bit.\n");
+		"Wrong MAC address. Clearing the multicast bit.\n");
 		maclo &= ~0x0001;
 	}
 



CVS commit: src/sys/dev/ic

2024-08-26 Thread Benny Siegert
Module Name:src
Committed By:   bsiegert
Date:   Mon Aug 26 18:25:29 UTC 2024

Modified Files:
src/sys/dev/ic: dwc_eqos.c

Log Message:
dwc_eqos: grammar fix

If the MAC address has the multicast bit set, the driver outputs
"Clearing the multicast bit" instead of "Clear the multicast bit".


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/dwc_eqos.c

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



CVS commit: src/sys/dev/acpi

2024-08-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug 26 13:53:22 UTC 2024

Modified Files:
src/sys/dev/acpi: acpi_vmgenid.c

Log Message:
acpivmgenid(4): Reset and gather entropy on VM clone notification.

PR kern/58632: getentropy(2) and arc4random(3) do not reseed on VM
fork


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/acpi_vmgenid.c

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



CVS commit: src/sys/dev/acpi

2024-08-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug 26 13:53:22 UTC 2024

Modified Files:
src/sys/dev/acpi: acpi_vmgenid.c

Log Message:
acpivmgenid(4): Reset and gather entropy on VM clone notification.

PR kern/58632: getentropy(2) and arc4random(3) do not reseed on VM
fork


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/acpi_vmgenid.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/dev/acpi/acpi_vmgenid.c
diff -u src/sys/dev/acpi/acpi_vmgenid.c:1.1 src/sys/dev/acpi/acpi_vmgenid.c:1.2
--- src/sys/dev/acpi/acpi_vmgenid.c:1.1	Mon Aug 26 13:38:28 2024
+++ src/sys/dev/acpi/acpi_vmgenid.c	Mon Aug 26 13:53:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_vmgenid.c,v 1.1 2024/08/26 13:38:28 riastradh Exp $	*/
+/*	$NetBSD: acpi_vmgenid.c,v 1.2 2024/08/26 13:53:22 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_vmgenid.c,v 1.1 2024/08/26 13:38:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_vmgenid.c,v 1.2 2024/08/26 13:53:22 riastradh Exp $");
 
 #include 
 #include 
@@ -293,13 +293,19 @@ acpivmgenid_reset(void *cookie)
 	struct acpivmgenid_softc *const sc = cookie;
 
 	/*
+	 * Reset the system entropy pool's measure of entropy (not the
+	 * data, just the system's assessment of whether it has
+	 * entropy), and gather more entropy from any synchronous
+	 * sources we have available like CPU RNG instructions.  We
+	 * can't be interrupted by a signal so ignore return value.
+	 */
+	entropy_reset();
+	(void)entropy_gather();
+
+	/*
 	 * Grab the current VM generation ID to put it into the entropy
 	 * pool; then force consolidation so it affects all subsequent
 	 * draws from the entropy pool and the entropy epoch advances.
-	 *
-	 * XXX This should also reset the entropy count and request new
-	 * samples from all sources, but there currently isn't a good
-	 * way to do that after boot.
 	 */
 	acpivmgenid_set(sc, "cloned");
 	entropy_consolidate();



CVS commit: src/sys/dev

2024-08-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug 26 13:46:51 UTC 2024

Modified Files:
src/sys/dev: random.c

Log Message:
/dev/random: Fix two signal bugs.

1. If a long write to /dev/random is interrupted by a signal, it may
   proceed to sleep on the entropy source lock instead of returning
   promptly.

   => Don't try to consolidate entropy if we've already been
  interrupted by a signal.

2. If a write to /dev/random is interrupted by a signal while
   sleeping on the entropy source lock, it may fail to report EINTR.

   => Pass through EINTR from entropy consolidation via new
  entropy_consolidate_sig function.

PR kern/58646: /dev/random, kern.entropy.*: signal bugs


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/random.c

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



CVS commit: src/sys/dev

2024-08-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug 26 13:46:51 UTC 2024

Modified Files:
src/sys/dev: random.c

Log Message:
/dev/random: Fix two signal bugs.

1. If a long write to /dev/random is interrupted by a signal, it may
   proceed to sleep on the entropy source lock instead of returning
   promptly.

   => Don't try to consolidate entropy if we've already been
  interrupted by a signal.

2. If a write to /dev/random is interrupted by a signal while
   sleeping on the entropy source lock, it may fail to report EINTR.

   => Pass through EINTR from entropy consolidation via new
  entropy_consolidate_sig function.

PR kern/58646: /dev/random, kern.entropy.*: signal bugs


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/random.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/dev/random.c
diff -u src/sys/dev/random.c:1.10 src/sys/dev/random.c:1.11
--- src/sys/dev/random.c:1.10	Tue Dec 28 13:22:43 2021
+++ src/sys/dev/random.c	Mon Aug 26 13:46:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: random.c,v 1.10 2021/12/28 13:22:43 riastradh Exp $	*/
+/*	$NetBSD: random.c,v 1.11 2024/08/26 13:46:51 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: random.c,v 1.10 2021/12/28 13:22:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: random.c,v 1.11 2024/08/26 13:46:51 riastradh Exp $");
 
 #include 
 #include 
@@ -298,8 +298,8 @@ random_write(dev_t dev, struct uio *uio,
 	kmem_free(buf, RANDOM_BUFSIZE);
 
 	/* If we added anything, consolidate entropy now.  */
-	if (any)
-		entropy_consolidate();
+	if (any && error == 0)
+		error = entropy_consolidate_sig();
 
 	return error;
 }



CVS commit: src/sys/dev/cadence

2024-08-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 25 21:15:46 UTC 2024

Modified Files:
src/sys/dev/cadence: cemacreg.h

Log Message:
Use __BIT{,S}


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/cadence/cemacreg.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/cadence/cemacreg.h
diff -u src/sys/dev/cadence/cemacreg.h:1.4 src/sys/dev/cadence/cemacreg.h:1.5
--- src/sys/dev/cadence/cemacreg.h:1.4	Sun Aug 25 16:32:59 2024
+++ src/sys/dev/cadence/cemacreg.h	Sun Aug 25 21:15:46 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: cemacreg.h,v 1.4 2024/08/25 16:32:59 skrll Exp $	*/
+/*  $NetBSD: cemacreg.h,v 1.5 2024/08/25 21:15:46 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -124,20 +124,20 @@
 #define GEM_CTL_HALTTX		__BIT(10)
 #define GEM_CTL_STARTTX		__BIT(9)
 
-#define	ETH_CTL_BP	0x100U	/* 1 = back pressure enabled		*/
-#define	ETH_CTL_WES	0x080U	/* 1 = statistics registers writeable	*/
-#define	ETH_CTL_ISR	0x040U	/* 1 = increment statistics registers	*/
-#define	ETH_CTL_CSR	0x020U	/* 1 = clear statistics registers	*/
-#define	ETH_CTL_MPE	0x010U	/* 1 = management port enabled		*/
-#define	ETH_CTL_TE	0x008U	/* 1 = transmit enable			*/
-#define	ETH_CTL_RE	0x004U	/* 1 = receive enable			*/
-#define	ETH_CTL_LBL	0x002U	/* 1 = local loopback enabled		*/
-#define	ETH_CTL_LB	0x001U	/* 1 = loopback signal is at high level	*/
+#define	ETH_CTL_BP	__BIT(8)  /* 1 = back pressure enabled		  */
+#define	ETH_CTL_WES	__BIT(7)  /* 1 = statistics registers writeable	  */
+#define	ETH_CTL_ISR	__BIT(6)  /* 1 = increment statistics registers	  */
+#define	ETH_CTL_CSR	__BIT(5)  /* 1 = clear statistics registers	  */
+#define	ETH_CTL_MPE	__BIT(4)  /* 1 = management port enabled	  */
+#define	ETH_CTL_TE	__BIT(3)  /* 1 = transmit enable		  */
+#define	ETH_CTL_RE	__BIT(2)  /* 1 = receive enable			  */
+#define	ETH_CTL_LBL	__BIT(1)  /* 1 = local loopback enabled		  */
+#define	ETH_CTL_LB	__BIT(0)  /* 1 = loopback signal is at high level */
 
 
 /* Configuration Register bits: */
-#define	ETH_CFG_RMII	0x2000U	/* 1 = enable RMII (Reduce MII)	(AT91RM9200 only) */
-#define	ETH_CFG_RTY	0x1000U	/* 1 = retry test enabled		*/
+#define	ETH_CFG_RMII	__BIT(13)  /* 1 = enable RMII (Reduce MII) (AT91RM9200 only) */
+#define	ETH_CFG_RTY	__BIT(12)	/* 1 = retry test enabled		*/
 
 #define	ETH_CFG_CLK	0x0C00U	/* clock*/
 #define	ETH_CFG_CLK_8	0xU
@@ -145,15 +145,15 @@
 #define	ETH_CFG_CLK_32	0x0800U
 #define	ETH_CFG_CLK_64	0x0C00U
 
-#define	ETH_CFG_EAE	0x0200U	/* 1 = external address match enable	*/
-#define	ETH_CFG_BIG	0x0100U	/* 1 = receive up to 1522 bytes	(VLAN)	*/
-#define	ETH_CFG_UNI	0x0080U	/* 1 = enable unicast hash		*/
-#define	ETH_CFG_MTI	0x0040U	/* 1 = enable multicast hash		*/
-#define	ETH_CFG_NBC	0x0020U	/* 1 = ignore received broadcasts	*/
-#define	ETH_CFG_CAF	0x0010U	/* 1 = receive all valid frames		*/
-#define	ETH_CFG_BR	0x0004U
-#define	ETH_CFG_FD	0x0002U	/* 1 = force full duplex		*/
-#define	ETH_CFG_SPD	0x0001U	/* 1 = 100 Mbps*/
+#define	ETH_CFG_EAE	__BIT(9)	/* 1 = external address match enable	*/
+#define	ETH_CFG_BIG	__BIT(8)	/* 1 = receive up to 1522 bytes	(VLAN)	*/
+#define	ETH_CFG_UNI	__BIT(7)	/* 1 = enable unicast hash		*/
+#define	ETH_CFG_MTI	__BIT(6)	/* 1 = enable multicast hash		*/
+#define	ETH_CFG_NBC	__BIT(5)	/* 1 = ignore received broadcasts	*/
+#define	ETH_CFG_CAF	__BIT(4)	/* 1 = receive all valid frames		*/
+#define	ETH_CFG_BR	__BIT(2)
+#define	ETH_CFG_FD	__BIT(1)	/* 1 = force full duplex		*/
+#define	ETH_CFG_SPD	__BIT(0)	/* 1 = 100 Mbps*/
 
 #define GEM_CFG_GEN	__BIT(10)
 #define GEM_CFG_CLK	__BITS(20, 18)
@@ -167,9 +167,9 @@
 #define	GEM_CFG_RX_CHKSUM_OFFLD_EN	__BIT(24)
 
 /* Status Register bits: */
-#define	ETH_SR_IDLE	0x0004U	/* 1 = PHY logic is running		*/
-#define	ETH_SR_MDIO	0x0002U	/* 1 = MDIO pin set			*/
-#define	ETH_SR_LINK	0x0001U
+#define	ETH_SR_IDLE	__BIT(2)	/* 1 = PHY logic is running		*/
+#define	ETH_SR_MDIO	__BIT(1)	/* 1 = MDIO pin set			*/
+#define	ETH_SR_LINK	__BIT(0)
 
 
 /* Transmit Control Register bits: */
@@ -178,44 +178,44 @@
 
 
 /* Transmit Status Register bits: */
-#define	ETH_TSR_UND	0x40U	/* 1 = transmit underrun detected	*/
-#define	ETH_TSR_COMP	0x20U	/* 1 = transmit complete		*/
-#define	ETH_TSR_BNQ	0x10U	/* 1 = transmit buffer not queued (at91rm9200 only)	*/
-#define	ETH_TSR_IDLE	0x08U	/* 1 = transmitter idle			*/
-#define	ETH_TSR_RLE	0x04U	/* 1 = retry limit exceeded		*/
-#define	ETH_TSR_COL	0x02U	/* 1 = collision occurred		*/
-#define	ETH_TSR_OVR	0x01U	/* 1 = transmit buffer overrun		*/
+#define	ETH_TSR_UND	__BIT(6)	/* 1 = transmit underrun detected	*/
+#define	ETH_TSR_COMP	__BIT(5)	/* 1 = transmit complete		*/
+#define	ETH_TSR_BNQ	__BIT(4)	/* 1 = transmit buffer not queued (at91rm9200 only)	*/
+#define	ETH_TSR_IDLE	__BIT(3)	/* 1 = transmitter idle

CVS commit: src/sys/dev/cadence

2024-08-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 25 21:15:46 UTC 2024

Modified Files:
src/sys/dev/cadence: cemacreg.h

Log Message:
Use __BIT{,S}


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/cadence/cemacreg.h

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



CVS commit: src/sys/dev/cadence

2024-08-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 25 16:32:59 UTC 2024

Modified Files:
src/sys/dev/cadence: cemacreg.h

Log Message:
Remove redundant register offsets in the comments.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/cadence/cemacreg.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/cadence/cemacreg.h
diff -u src/sys/dev/cadence/cemacreg.h:1.3 src/sys/dev/cadence/cemacreg.h:1.4
--- src/sys/dev/cadence/cemacreg.h:1.3	Mon Aug 24 18:51:37 2015
+++ src/sys/dev/cadence/cemacreg.h	Sun Aug 25 16:32:59 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: cemacreg.h,v 1.3 2015/08/24 18:51:37 rjs Exp $	*/
+/*  $NetBSD: cemacreg.h,v 1.4 2024/08/25 16:32:59 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -36,53 +36,53 @@
 /* Ethernet MAC (EMAC),
  * at91rm9200.pdf, page 573 */
 
-#define	ETH_CTL		0x00U	/* 0x00: Control Register		*/
-#define	ETH_CFG		0x04U	/* 0x04: Configuration Register		*/
-#define	ETH_SR		0x08U	/* 0x08: Status Register		*/
-#define	ETH_TAR		0x0CU	/* 0x0C: Transmit Address Register (at91rm9200 only)	*/
-#define	ETH_TCR		0x10U	/* 0x10: Transmit Control Register (at91rm9200 only)	*/
-#define	ETH_TSR		0x14U	/* 0x14: Transmit Status Register	*/
-#define	ETH_RBQP	0x18U	/* 0x18: Receive Buffer Queue Pointer	*/
-#define ETH_TBQP	0x1CU	/* 0x1C: Transmit Buffer Queue Pointer	*/
-#define	ETH_RSR		0x20U	/* 0x20: Receive Status Register	*/
-#define	ETH_ISR		0x24U	/* 0x24: Interrupt Status Register	*/
-#define	ETH_IER		0x28U	/* 0x28: Interrupt Enable Register	*/
-#define	ETH_IDR		0x2CU	/* 0x2C: Interrupt Disable Register	*/
-#define	ETH_IMR		0x30U	/* 0x30: Interrupt Mask Register	*/
-#define	ETH_MAN		0x34U	/* 0x34: PHY Maintenance Register	*/
-
-#define	ETH_FRA		0x40U	/* 0x40: Frames Transmitted OK		*/
-#define	ETH_SCOL	0x44U	/* 0x44: Single Collision Frames	*/
-#define	ETH_MCOL	0x48U	/* 0x48: Multiple Collision Frames	*/
-#define	ETH_OK		0x4CU	/* 0x4C: Frames Received OK		*/
-#define	ETH_SEQE	0x50U	/* 0x50: Frame Check Sequence Errors	*/
-#define	ETH_ALE		0x54U	/* 0x54: Alignment Errors		*/
-#define	ETH_DTE		0x58U	/* 0x58: Deferred Transmission Frame	*/
-#define	ETH_LCOL	0x5CU	/* 0x5C: Late Collisions		*/
-#define	ETH_ECOL	0x60U	/* 0x60: Excessive Collisions		*/
-#define	ETH_CSE		0x64U	/* 0x64: Carrier Sense Errors		*/
-#define	ETH_TUE		0x68U	/* 0x68: Transmit Underrun Errors	*/
-#define	ETH_CDE		0x6CU	/* 0x6C: Code Errors			*/
-#define	ETH_ELR		0x70U	/* 0x70: Excessive Length Errors	*/
-#define	ETH_RJB		0x74U	/* 0x74: Receive Jabbers		*/
-#define	ETH_USF		0x78U	/* 0x78: Undersize Frames		*/
-#define	ETH_SQEE	0x7CU	/* 0x7C: SQE Test Errors		*/
-#define	ETH_DRFC	0x80U	/* 0x80: Discarded RX Frames		*/
-
-#define	ETH_HSH		0x90U	/* 0x90: Hash Address High		*/
-#define	ETH_HSL		0x94U	/* 0x94: Hash Address Low		*/
-
-#define	ETH_SA1L	0x98U	/* 0x98: Specific Address 1 Low		*/
-#define	ETH_SA1H	0x9CU	/* 0x9C: Specific Address 1 High	*/
+#define	ETH_CTL		0x00U	/* Control Register			*/
+#define	ETH_CFG		0x04U	/* Configuration Register		*/
+#define	ETH_SR		0x08U	/* Status Register			*/
+#define	ETH_TAR		0x0CU	/* Transmit Address Register (at91rm9200 only)	*/
+#define	ETH_TCR		0x10U	/* Transmit Control Register (at91rm9200 only)	*/
+#define	ETH_TSR		0x14U	/* Transmit Status Register		*/
+#define	ETH_RBQP	0x18U	/* Receive Buffer Queue Pointer		*/
+#define	ETH_TBQP	0x1CU	/* Transmit Buffer Queue Pointer	*/
+#define	ETH_RSR		0x20U	/* Receive Status Register		*/
+#define	ETH_ISR		0x24U	/* Interrupt Status Register		*/
+#define	ETH_IER		0x28U	/* Interrupt Enable Register		*/
+#define	ETH_IDR		0x2CU	/* Interrupt Disable Register		*/
+#define	ETH_IMR		0x30U	/* Interrupt Mask Register		*/
+#define	ETH_MAN		0x34U	/* PHY Maintenance Register		*/
+
+#define	ETH_FRA		0x40U	/* Frames Transmitted OK		*/
+#define	ETH_SCOL	0x44U	/* Single Collision Frames		*/
+#define	ETH_MCOL	0x48U	/* Multiple Collision Frames		*/
+#define	ETH_OK		0x4CU	/* Frames Received OK			*/
+#define	ETH_SEQE	0x50U	/* Frame Check Sequence Errors		*/
+#define	ETH_ALE		0x54U	/* Alignment Errors			*/
+#define	ETH_DTE		0x58U	/* Deferred Transmission Frame		*/
+#define	ETH_LCOL	0x5CU	/* Late Collisions			*/
+#define	ETH_ECOL	0x60U	/* Excessive Collisions			*/
+#define	ETH_CSE		0x64U	/* Carrier Sense Errors			*/
+#define	ETH_TUE		0x68U	/* Transmit Underrun Errors		*/
+#define	ETH_CDE		0x6CU	/* Code Errors*/
+#define	ETH_ELR		0x70U	/* Excessive Length Errors		*/
+#define	ETH_RJB		0x74U	/* Receive Jabbers			*/
+#define	ETH_USF		0x78U	/* Undersize Frames			*/
+#define	ETH_SQEE	0x7CU	/* SQE Test Errors			*/
+#define	ETH_DRFC	0x80U	/* Discarded RX Frames			*/
+
+#define	ETH_HSH		0x90U	/* Hash Address High			*/
+#define	ETH_HSL		0x94U	/* Hash Address Low			*/
+
+#define	ETH_SA1L	0x98U	/* Specific Address 1 Low		*/
+#define	ETH_SA1H	0x9CU	/* Specific Address 1 High		*/
 
-#defin

CVS commit: src/sys/dev/cadence

2024-08-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 25 16:32:59 UTC 2024

Modified Files:
src/sys/dev/cadence: cemacreg.h

Log Message:
Remove redundant register offsets in the comments.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/cadence/cemacreg.h

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



CVS commit: src/sys/dev/cadence

2024-08-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 25 16:27:33 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
Comment fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/cadence/if_cemac.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/dev/cadence/if_cemac.c
diff -u src/sys/dev/cadence/if_cemac.c:1.36 src/sys/dev/cadence/if_cemac.c:1.37
--- src/sys/dev/cadence/if_cemac.c:1.36	Sun Aug 25 16:25:29 2024
+++ src/sys/dev/cadence/if_cemac.c	Sun Aug 25 16:27:33 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cemac.c,v 1.36 2024/08/25 16:25:29 skrll Exp $	*/
+/*	$NetBSD: if_cemac.c,v 1.37 2024/08/25 16:27:33 skrll Exp $	*/
 
 /*
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.36 2024/08/25 16:25:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.37 2024/08/25 16:27:33 skrll Exp $");
 
 #include 
 #include 
@@ -389,7 +389,7 @@ cemac_init(struct cemac_softc *sc)
 	CEMAC_GEM_WRITE(SA4L, 0);
 	CEMAC_GEM_WRITE(SA4H, 0);
 
-	/* Allocate a page of memory for receive queue descriptors */
+	/* Allocate memory for receive queue descriptors */
 	sc->rbqlen = roundup(ETH_DSC_SIZE * (RX_QLEN + 1) * 2, PAGE_SIZE);
 	DPRINTFN(1,("%s: rbqlen=%i\n", __FUNCTION__, sc->rbqlen));
 
@@ -418,7 +418,7 @@ cemac_init(struct cemac_softc *sc)
 	sc->rbqpage_dsaddr = sc->rbqpage_dmamap->dm_segs[0].ds_addr;
 	memset(sc->rbqpage, 0, sc->rbqlen);
 
-	/* Allocate a page of memory for transmit queue descriptors */
+	/* Allocate memory for transmit queue descriptors */
 	sc->tbqlen = roundup(ETH_DSC_SIZE * (TX_QLEN + 1) * 2, PAGE_SIZE);
 	DPRINTFN(1,("%s: tbqlen=%i\n", __FUNCTION__, sc->tbqlen));
 



CVS commit: src/sys/dev/cadence

2024-08-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 25 16:27:33 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
Comment fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/cadence/if_cemac.c

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



CVS commit: src/sys/dev/cadence

2024-08-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 25 16:25:29 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
Use roundup - same code before and after.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/cadence/if_cemac.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/dev/cadence/if_cemac.c
diff -u src/sys/dev/cadence/if_cemac.c:1.35 src/sys/dev/cadence/if_cemac.c:1.36
--- src/sys/dev/cadence/if_cemac.c:1.35	Sun Aug 25 16:06:46 2024
+++ src/sys/dev/cadence/if_cemac.c	Sun Aug 25 16:25:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cemac.c,v 1.35 2024/08/25 16:06:46 skrll Exp $	*/
+/*	$NetBSD: if_cemac.c,v 1.36 2024/08/25 16:25:29 skrll Exp $	*/
 
 /*
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.35 2024/08/25 16:06:46 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.36 2024/08/25 16:25:29 skrll Exp $");
 
 #include 
 #include 
@@ -390,8 +390,7 @@ cemac_init(struct cemac_softc *sc)
 	CEMAC_GEM_WRITE(SA4H, 0);
 
 	/* Allocate a page of memory for receive queue descriptors */
-	sc->rbqlen = (ETH_DSC_SIZE * (RX_QLEN + 1) * 2 + PAGE_SIZE - 1) / PAGE_SIZE;
-	sc->rbqlen *= PAGE_SIZE;
+	sc->rbqlen = roundup(ETH_DSC_SIZE * (RX_QLEN + 1) * 2, PAGE_SIZE);
 	DPRINTFN(1,("%s: rbqlen=%i\n", __FUNCTION__, sc->rbqlen));
 
 	err = bus_dmamem_alloc(sc->sc_dmat, sc->rbqlen, 0,
@@ -420,8 +419,7 @@ cemac_init(struct cemac_softc *sc)
 	memset(sc->rbqpage, 0, sc->rbqlen);
 
 	/* Allocate a page of memory for transmit queue descriptors */
-	sc->tbqlen = (ETH_DSC_SIZE * (TX_QLEN + 1) * 2 + PAGE_SIZE - 1) / PAGE_SIZE;
-	sc->tbqlen *= PAGE_SIZE;
+	sc->tbqlen = roundup(ETH_DSC_SIZE * (TX_QLEN + 1) * 2, PAGE_SIZE);
 	DPRINTFN(1,("%s: tbqlen=%i\n", __FUNCTION__, sc->tbqlen));
 
 	err = bus_dmamem_alloc(sc->sc_dmat, sc->tbqlen, 0,



CVS commit: src/sys/dev/cadence

2024-08-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 25 16:25:29 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
Use roundup - same code before and after.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/cadence/if_cemac.c

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



CVS commit: src/sys/dev/cadence

2024-08-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 25 16:06:46 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
Sprinkle const and remove unnecessary casts.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/cadence/if_cemac.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/dev/cadence/if_cemac.c
diff -u src/sys/dev/cadence/if_cemac.c:1.34 src/sys/dev/cadence/if_cemac.c:1.35
--- src/sys/dev/cadence/if_cemac.c:1.34	Sun Aug 25 15:49:36 2024
+++ src/sys/dev/cadence/if_cemac.c	Sun Aug 25 16:06:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cemac.c,v 1.34 2024/08/25 15:49:36 skrll Exp $	*/
+/*	$NetBSD: if_cemac.c,v 1.35 2024/08/25 16:06:46 skrll Exp $	*/
 
 /*
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.34 2024/08/25 15:49:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.35 2024/08/25 16:06:46 skrll Exp $");
 
 #include 
 #include 
@@ -209,7 +209,7 @@ cemac_gctx(struct cemac_softc *sc)
 int
 cemac_intr(void *arg)
 {
-	struct cemac_softc *sc = (struct cemac_softc *)arg;
+	struct cemac_softc * const sc = arg;
 	struct ifnet * ifp = &sc->sc_ethercom.ec_if;
 	uint32_t imr, isr, ctl;
 #ifdef	CEMAC_DEBUG
@@ -570,7 +570,7 @@ cemac_mediachange(struct ifnet *ifp)
 static void
 cemac_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
 {
-	struct cemac_softc *sc = ifp->if_softc;
+	struct cemac_softc * const sc = ifp->if_softc;
 
 	mii_pollstat(&sc->sc_mii);
 	ifmr->ifm_active = sc->sc_mii.mii_media_active;
@@ -581,9 +581,7 @@ cemac_mediastatus(struct ifnet *ifp, str
 static int
 cemac_mii_readreg(device_t self, int phy, int reg, uint16_t *val)
 {
-	struct cemac_softc *sc;
-
-	sc = device_private(self);
+	struct cemac_softc * const sc = device_private(self);
 
 	CEMAC_WRITE(ETH_MAN, (ETH_MAN_HIGH | ETH_MAN_RW_RD
 			 | ((phy << ETH_MAN_PHYA_SHIFT) & ETH_MAN_PHYA)
@@ -599,9 +597,7 @@ cemac_mii_readreg(device_t self, int phy
 static int
 cemac_mii_writereg(device_t self, int phy, int reg, uint16_t val)
 {
-	struct cemac_softc *sc;
-
-	sc = device_private(self);
+	struct cemac_softc * const sc = device_private(self);
 
 	CEMAC_WRITE(ETH_MAN, (ETH_MAN_HIGH | ETH_MAN_RW_WR
 			 | ((phy << ETH_MAN_PHYA_SHIFT) & ETH_MAN_PHYA)
@@ -618,7 +614,7 @@ cemac_mii_writereg(device_t self, int ph
 static void
 cemac_statchg(struct ifnet *ifp)
 {
-	struct cemac_softc *sc = ifp->if_softc;
+	struct cemac_softc * const sc = ifp->if_softc;
 	struct mii_data *mii = &sc->sc_mii;
 	uint32_t reg;
 
@@ -652,7 +648,7 @@ cemac_statchg(struct ifnet *ifp)
 static void
 cemac_tick(void *arg)
 {
-	struct cemac_softc *sc = (struct cemac_softc *)arg;
+	struct cemac_softc * const sc = arg;
 	struct ifnet * ifp = &sc->sc_ethercom.ec_if;
 	int s;
 
@@ -708,7 +704,7 @@ cemac_ifioctl(struct ifnet *ifp, u_long 
 static void
 cemac_ifstart(struct ifnet *ifp)
 {
-	struct cemac_softc *sc = (struct cemac_softc *)ifp->if_softc;
+	struct cemac_softc * const sc = ifp->if_softc;
 	struct mbuf *m;
 	bus_dma_segment_t *segs;
 	int s, bi, err, nsegs;
@@ -814,7 +810,7 @@ stop:
 static void
 cemac_ifwatchdog(struct ifnet *ifp)
 {
-	struct cemac_softc *sc = (struct cemac_softc *)ifp->if_softc;
+	struct cemac_softc * const sc = ifp->if_softc;
 
 	if ((ifp->if_flags & IFF_RUNNING) == 0)
 		return;
@@ -825,7 +821,7 @@ cemac_ifwatchdog(struct ifnet *ifp)
 static int
 cemac_ifinit(struct ifnet *ifp)
 {
-	struct cemac_softc *sc = ifp->if_softc;
+	struct cemac_softc * const sc = ifp->if_softc;
 	uint32_t dma, cfg;
 	int s = splnet();
 
@@ -871,7 +867,7 @@ static void
 cemac_ifstop(struct ifnet *ifp, int disable)
 {
 //	uint32_t u;
-	struct cemac_softc *sc = ifp->if_softc;
+	struct cemac_softc * const sc = ifp->if_softc;
 
 #if 0
 	CEMAC_WRITE(ETH_CTL, ETH_CTL_MPE);	// disable everything
@@ -906,7 +902,7 @@ cemac_ifstop(struct ifnet *ifp, int disa
 static void
 cemac_setaddr(struct ifnet *ifp)
 {
-	struct cemac_softc *sc = ifp->if_softc;
+	struct cemac_softc * const sc = ifp->if_softc;
 	struct ethercom *ec = &sc->sc_ethercom;
 	struct ether_multi *enm;
 	struct ether_multistep step;



CVS commit: src/sys/dev/cadence

2024-08-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 25 16:06:46 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
Sprinkle const and remove unnecessary casts.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/cadence/if_cemac.c

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



CVS commit: src/sys/dev/cadence

2024-08-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 25 15:49:36 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/cadence/if_cemac.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/dev/cadence/if_cemac.c
diff -u src/sys/dev/cadence/if_cemac.c:1.33 src/sys/dev/cadence/if_cemac.c:1.34
--- src/sys/dev/cadence/if_cemac.c:1.33	Sun Aug 25 07:25:00 2024
+++ src/sys/dev/cadence/if_cemac.c	Sun Aug 25 15:49:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cemac.c,v 1.33 2024/08/25 07:25:00 skrll Exp $	*/
+/*	$NetBSD: if_cemac.c,v 1.34 2024/08/25 15:49:36 skrll Exp $	*/
 
 /*
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.33 2024/08/25 07:25:00 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.34 2024/08/25 15:49:36 skrll Exp $");
 
 #include 
 #include 
@@ -262,7 +262,8 @@ cemac_intr(void *arg)
 			DPRINTFN(2,("## nfo=0x%08X\n", nfo));
 
 			MGETHDR(m, M_DONTWAIT, MT_DATA);
-			if (m != NULL) MCLGET(m, M_DONTWAIT);
+			if (m != NULL)
+ MCLGET(m, M_DONTWAIT);
 			if (m != NULL && (m->m_flags & M_EXT)) {
 bus_dmamap_sync(sc->sc_dmat, sc->rxq[bi].m_dmamap, 0,
 		MCLBYTES, BUS_DMASYNC_POSTREAD);
@@ -743,7 +744,8 @@ start:
 			bus_dmamap_unload(sc->sc_dmat, sc->txq[bi].m_dmamap);
 
 		MGETHDR(mn, M_DONTWAIT, MT_DATA);
-		if (mn == NULL) goto stop;
+		if (mn == NULL)
+			 goto stop;
 		if (m->m_pkthdr.len > MHLEN) {
 			MCLGET(mn, M_DONTWAIT);
 			if ((mn->m_flags & M_EXT) == 0) {



CVS commit: src/sys/dev/cadence

2024-08-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 25 15:49:36 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/cadence/if_cemac.c

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



CVS commit: src/sys/dev/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 12:38:21 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Fix off-by-one.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/bcmgenet.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/dev/ic/bcmgenet.c
diff -u src/sys/dev/ic/bcmgenet.c:1.18 src/sys/dev/ic/bcmgenet.c:1.19
--- src/sys/dev/ic/bcmgenet.c:1.18	Sun Aug 25 08:31:07 2024
+++ src/sys/dev/ic/bcmgenet.c	Sun Aug 25 12:38:20 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenet.c,v 1.18 2024/08/25 08:31:07 mlelstv Exp $ */
+/* $NetBSD: bcmgenet.c,v 1.19 2024/08/25 12:38:20 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -34,7 +34,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.18 2024/08/25 08:31:07 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.19 2024/08/25 12:38:20 mlelstv Exp $");
 
 #include 
 #include 
@@ -684,7 +684,7 @@ genet_stop_locked(struct genet_softc *sc
 	genet_disable_intr(sc);
 
 	/* Free TX buffers */
-	for (i=0; i<=TX_DESC_COUNT; ++i)
+	for (i=0; iif_flags &= ~IFF_RUNNING;



CVS commit: src/sys/dev/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 12:38:21 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Fix off-by-one.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/bcmgenet.c

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



CVS commit: src/sys/dev

2024-08-25 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Aug 25 11:29:38 UTC 2024

Modified Files:
src/sys/dev: mm.c

Log Message:
mm.c: g/c duplicate mm_ioctl declaration


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/mm.c

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



CVS commit: src/sys/dev

2024-08-25 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Aug 25 11:29:38 UTC 2024

Modified Files:
src/sys/dev: mm.c

Log Message:
mm.c: g/c duplicate mm_ioctl declaration


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/mm.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/dev/mm.c
diff -u src/sys/dev/mm.c:1.24 src/sys/dev/mm.c:1.25
--- src/sys/dev/mm.c:1.24	Tue Feb  5 11:33:13 2019
+++ src/sys/dev/mm.c	Sun Aug 25 11:29:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mm.c,v 1.24 2019/02/05 11:33:13 mrg Exp $	*/
+/*	$NetBSD: mm.c,v 1.25 2024/08/25 11:29:38 uwe Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2008, 2010 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mm.c,v 1.24 2019/02/05 11:33:13 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mm.c,v 1.25 2024/08/25 11:29:38 uwe Exp $");
 
 #include "opt_compat_netbsd.h"
 
@@ -55,7 +55,6 @@ static vaddr_t		dev_mem_addr	__read_most
 
 static dev_type_open(mm_open);
 static dev_type_read(mm_readwrite);
-static dev_type_ioctl(mm_ioctl);
 static dev_type_mmap(mm_mmap);
 static dev_type_ioctl(mm_ioctl);
 



CVS commit: src/sys/dev/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 08:31:07 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Fix mbuf leak.
Minor optimizations for send queue.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/bcmgenet.c

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



CVS commit: src/sys/dev/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 08:31:07 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Fix mbuf leak.
Minor optimizations for send queue.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/bcmgenet.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/dev/ic/bcmgenet.c
diff -u src/sys/dev/ic/bcmgenet.c:1.17 src/sys/dev/ic/bcmgenet.c:1.18
--- src/sys/dev/ic/bcmgenet.c:1.17	Sun Aug 25 08:27:06 2024
+++ src/sys/dev/ic/bcmgenet.c	Sun Aug 25 08:31:07 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenet.c,v 1.17 2024/08/25 08:27:06 mlelstv Exp $ */
+/* $NetBSD: bcmgenet.c,v 1.18 2024/08/25 08:31:07 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -34,7 +34,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.17 2024/08/25 08:27:06 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.18 2024/08/25 08:31:07 mlelstv Exp $");
 
 #include 
 #include 
@@ -621,11 +621,33 @@ genet_init(struct ifnet *ifp)
 	return error;
 }
 
+static int
+genet_free_txbuf(struct genet_softc *sc, int index)
+{
+	struct genet_bufmap *bmap;
+
+	bmap = &sc->sc_tx.buf_map[index];
+	if (bmap->mbuf == NULL)
+		return 0;
+
+	if (bmap->map->dm_mapsize > 0) {
+		bus_dmamap_sync(sc->sc_tx.buf_tag, bmap->map,
+		0, bmap->map->dm_mapsize,
+		BUS_DMASYNC_POSTWRITE);
+	}
+	bus_dmamap_unload(sc->sc_tx.buf_tag, bmap->map);
+	m_freem(bmap->mbuf);
+	bmap->mbuf = NULL;
+
+	return 1;
+}
+
 static void
 genet_stop_locked(struct genet_softc *sc, int disable)
 {
 	struct ifnet *ifp = &sc->sc_ec.ec_if;
 	uint32_t val;
+	int i;
 
 	GENET_ASSERT_LOCKED(sc);
 
@@ -661,6 +683,10 @@ genet_stop_locked(struct genet_softc *sc
 	/* Disable interrupts */
 	genet_disable_intr(sc);
 
+	/* Free TX buffers */
+	for (i=0; i<=TX_DESC_COUNT; ++i)
+		genet_free_txbuf(sc, i);
+
 	ifp->if_flags &= ~IFF_RUNNING;
 }
 
@@ -771,34 +797,22 @@ static void
 genet_txintr(struct genet_softc *sc, int qid)
 {
 	struct ifnet *ifp = &sc->sc_ec.ec_if;
-	struct genet_bufmap *bmap;
 	int cidx, i, pkts = 0;
 
 	cidx = RD4(sc, GENET_TX_DMA_CONS_INDEX(qid)) & 0x;
 	i = sc->sc_tx.cidx % TX_DESC_COUNT;
 	while (sc->sc_tx.cidx != cidx) {
-		bmap = &sc->sc_tx.buf_map[i];
-		if (bmap->mbuf != NULL) {
-			/* XXX first segment already unloads */
-			if (bmap->map->dm_mapsize > 0) {
-bus_dmamap_sync(sc->sc_tx.buf_tag, bmap->map,
-0, bmap->map->dm_mapsize,
-BUS_DMASYNC_POSTWRITE);
-			}
-			bus_dmamap_unload(sc->sc_tx.buf_tag, bmap->map);
-			m_freem(bmap->mbuf);
-			bmap->mbuf = NULL;
-			++pkts;
-		}
-
+		pkts += genet_free_txbuf(sc, i);
 		i = TX_NEXT(i);
 		sc->sc_tx.cidx = (sc->sc_tx.cidx + 1) & 0x;
 	}
 
-	if_statadd(ifp, if_opackets, pkts);
-
-	if (pkts != 0)
+	if (pkts != 0) {
+		if_statadd(ifp, if_opackets, pkts);
 		rnd_add_uint32(&sc->sc_rndsource, pkts);
+	}
+
+	if_schedule_deferred_start(ifp);
 }
 
 static void
@@ -819,7 +833,11 @@ genet_start_locked(struct genet_softc *s
 	cnt = 0;
 
 	sc->sc_tx.queued = (RD4(sc, GENET_TX_DMA_PROD_INDEX(qid))
-	  - RD4(sc, GENET_TX_DMA_CONS_INDEX(qid))) & 0x;
+	  - sc->sc_tx.cidx) & 0x;
+
+	/* At least one descriptor free ? */
+	if (sc->sc_tx.queued >= TX_DESC_COUNT - 1)
+		return;
 
 	for (;;) {
 		IFQ_POLL(&ifp->if_snd, m);
@@ -863,9 +881,7 @@ int
 genet_intr(void *arg)
 {
 	struct genet_softc *sc = arg;
-	struct ifnet *ifp = &sc->sc_ec.ec_if;
 	uint32_t val;
-	bool dotx = false;
 
 	val = RD4(sc, GENET_INTRL2_CPU_STAT);
 	val &= ~RD4(sc, GENET_INTRL2_CPU_STAT_MASK);
@@ -879,12 +895,8 @@ genet_intr(void *arg)
 
 	if (val & GENET_IRQ_TXDMA_DONE) {
 		genet_txintr(sc, GENET_DMA_DEFAULT_QUEUE);
-		dotx = true;
 	}
 
-	if (dotx)
-		if_schedule_deferred_start(ifp);
-
 	return 1;
 }
 



CVS commit: src/sys/dev/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 08:27:06 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Fix MBUFTRACE


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/bcmgenet.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/dev/ic/bcmgenet.c
diff -u src/sys/dev/ic/bcmgenet.c:1.16 src/sys/dev/ic/bcmgenet.c:1.17
--- src/sys/dev/ic/bcmgenet.c:1.16	Sun Aug 25 08:24:42 2024
+++ src/sys/dev/ic/bcmgenet.c	Sun Aug 25 08:27:06 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenet.c,v 1.16 2024/08/25 08:24:42 mlelstv Exp $ */
+/* $NetBSD: bcmgenet.c,v 1.17 2024/08/25 08:27:06 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -34,7 +34,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.16 2024/08/25 08:24:42 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.17 2024/08/25 08:27:06 mlelstv Exp $");
 
 #include 
 #include 
@@ -722,10 +722,12 @@ genet_rxintr(struct genet_softc *sc, int
 			if_statinc(ifp, if_ierrors);
 			goto next;
 		}
+		MCLAIM(m0, &sc->sc_ec.ec_rx_mowner);
 
 		/* unload map before it gets loaded in setup_rxbuf */
 		if (sc->sc_rx.buf_map[index].map->dm_mapsize > 0) {
-			bus_dmamap_sync(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map,
+			bus_dmamap_sync(sc->sc_rx.buf_tag,
+			sc->sc_rx.buf_map[index].map,
 			0, sc->sc_rx.buf_map[index].map->dm_mapsize,
 			BUS_DMASYNC_POSTREAD);
 		}
@@ -1011,6 +1013,21 @@ genet_setup_dma(struct genet_softc *sc, 
 	return 0;
 }
 
+static void
+genet_claim_rxring(struct genet_softc *sc, int qid)
+{
+	struct mbuf *m;
+	int i;
+
+	/* Claim mbufs from RX ring */
+	for (i = 0; i < RX_DESC_COUNT; i++) {
+		m = sc->sc_rx.buf_map[i].mbuf;
+		if (m != NULL) {
+			MCLAIM(m, &sc->sc_ec.ec_rx_mowner);
+		}
+	}
+}
+
 int
 genet_attach(struct genet_softc *sc)
 {
@@ -1110,6 +1127,9 @@ genet_attach(struct genet_softc *sc)
 	/* Attach ethernet interface */
 	ether_ifattach(ifp, eaddr);
 
+	/* MBUFTRACE */
+	genet_claim_rxring(sc, GENET_DMA_DEFAULT_QUEUE);
+
 	rnd_attach_source(&sc->sc_rndsource, ifp->if_xname, RND_TYPE_NET,
 	RND_FLAG_DEFAULT);
 



CVS commit: src/sys/dev/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 08:27:06 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Fix MBUFTRACE


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/bcmgenet.c

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



CVS commit: src/sys/dev/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 08:24:42 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Don't mix endianess and MAC address layout.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/bcmgenet.c

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



CVS commit: src/sys/dev/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 08:24:42 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Don't mix endianess and MAC address layout.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/bcmgenet.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/dev/ic/bcmgenet.c
diff -u src/sys/dev/ic/bcmgenet.c:1.15 src/sys/dev/ic/bcmgenet.c:1.16
--- src/sys/dev/ic/bcmgenet.c:1.15	Sun Aug 25 07:02:27 2024
+++ src/sys/dev/ic/bcmgenet.c	Sun Aug 25 08:24:42 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenet.c,v 1.15 2024/08/25 07:02:27 skrll Exp $ */
+/* $NetBSD: bcmgenet.c,v 1.16 2024/08/25 08:24:42 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -34,7 +34,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.15 2024/08/25 07:02:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.16 2024/08/25 08:24:42 mlelstv Exp $");
 
 #include 
 #include 
@@ -949,8 +949,8 @@ genet_get_eaddr(struct genet_softc *sc, 
 
 	val = RD4(sc, GENET_SYS_RBUF_FLUSH_CTRL);
 	if ((val & GENET_SYS_RBUF_FLUSH_RESET) == 0) {
-		maclo = htobe32(RD4(sc, GENET_UMAC_MAC0));
-		machi = htobe16(RD4(sc, GENET_UMAC_MAC1) & 0x);
+		maclo = RD4(sc, GENET_UMAC_MAC0);
+		machi = RD4(sc, GENET_UMAC_MAC1) & 0x;
 	}
 
 	if (maclo == 0 && machi == 0) {
@@ -959,12 +959,12 @@ genet_get_eaddr(struct genet_softc *sc, 
 		machi = cprng_strong32() & 0x;
 	}
 
-	eaddr[0] = maclo & 0xff;
-	eaddr[1] = (maclo >> 8) & 0xff;
-	eaddr[2] = (maclo >> 16) & 0xff;
-	eaddr[3] = (maclo >> 24) & 0xff;
-	eaddr[4] = machi & 0xff;
-	eaddr[5] = (machi >> 8) & 0xff;
+	eaddr[0] = (maclo >> 24) & 0xff;
+	eaddr[1] = (maclo >> 16) & 0xff;
+	eaddr[2] = (maclo >>  8) & 0xff;
+	eaddr[3] = (maclo >>  0) & 0xff;
+	eaddr[4] = (machi >>  8) & 0xff;
+	eaddr[5] = (machi >>  0) & 0xff;
 }
 
 static int



CVS commit: src/sys/dev/ic

2024-08-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 25 07:02:27 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/bcmgenet.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/dev/ic/bcmgenet.c
diff -u src/sys/dev/ic/bcmgenet.c:1.14 src/sys/dev/ic/bcmgenet.c:1.15
--- src/sys/dev/ic/bcmgenet.c:1.14	Sun Sep 18 17:18:19 2022
+++ src/sys/dev/ic/bcmgenet.c	Sun Aug 25 07:02:27 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenet.c,v 1.14 2022/09/18 17:18:19 thorpej Exp $ */
+/* $NetBSD: bcmgenet.c,v 1.15 2024/08/25 07:02:27 skrll Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -34,7 +34,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.14 2022/09/18 17:18:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.15 2024/08/25 07:02:27 skrll Exp $");
 
 #include 
 #include 
@@ -115,7 +115,6 @@ genet_mii_readreg(device_t dev, int phy,
 		delay(10);
 	}
 
-
 	if (retry == 0) {
 		device_printf(dev, "phy read timeout, phy=%d reg=%d\n",
 		phy, reg);



CVS commit: src/sys/dev/ic

2024-08-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 25 07:02:27 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/bcmgenet.c

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



CVS commit: src/sys/dev/cadence

2024-08-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 24 11:55:45 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
Header inclusion maintenance and KNF


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/cadence/if_cemac.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/dev/cadence/if_cemac.c
diff -u src/sys/dev/cadence/if_cemac.c:1.31 src/sys/dev/cadence/if_cemac.c:1.32
--- src/sys/dev/cadence/if_cemac.c:1.31	Sat Aug 24 10:11:40 2024
+++ src/sys/dev/cadence/if_cemac.c	Sat Aug 24 11:55:45 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cemac.c,v 1.31 2024/08/24 10:11:40 skrll Exp $	*/
+/*	$NetBSD: if_cemac.c,v 1.32 2024/08/24 11:55:45 skrll Exp $	*/
 
 /*
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -40,23 +40,17 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.31 2024/08/24 10:11:40 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.32 2024/08/24 11:55:45 skrll Exp $");
 
-#include 
 #include 
-#include 
-#include 
+#include 
+
+#include 
+#include 
 #include 
 #include 
-#include 
+#include 
 #include 
-#include 
-#include 
-
-#include 
-#include 
-
-#include 
 
 #include 
 #include 



CVS commit: src/sys/dev/cadence

2024-08-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 24 11:55:45 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
Header inclusion maintenance and KNF


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/cadence/if_cemac.c

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



CVS commit: src/sys/dev/cadence

2024-08-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 24 10:13:19 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemacvar.h

Log Message:
G/C


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/cadence/if_cemacvar.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/cadence/if_cemacvar.h
diff -u src/sys/dev/cadence/if_cemacvar.h:1.2 src/sys/dev/cadence/if_cemacvar.h:1.3
--- src/sys/dev/cadence/if_cemacvar.h:1.2	Sat Aug 24 10:02:55 2024
+++ src/sys/dev/cadence/if_cemacvar.h	Sat Aug 24 10:13:19 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_cemacvar.h,v 1.2 2024/08/24 10:02:55 skrll Exp $	*/
+/*  $NetBSD: if_cemacvar.h,v 1.3 2024/08/24 10:13:19 skrll Exp $	*/
 /*-
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -32,7 +32,6 @@ int cemac_match(device_t, cfdata_t, void
 void cemac_attach(device_t, device_t, void *);
 int cemac_intr(void *);
 
-int cemac_match_common(device_t, cfdata_t, void *);
 void cemac_attach_common(device_t, bus_space_tag_t, bus_space_handle_t,
 bus_dma_tag_t, int);
 



CVS commit: src/sys/dev/cadence

2024-08-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 24 10:13:19 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemacvar.h

Log Message:
G/C


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/cadence/if_cemacvar.h

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



CVS commit: src/sys/dev/cadence

2024-08-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 24 10:11:40 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/cadence/if_cemac.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/dev/cadence/if_cemac.c
diff -u src/sys/dev/cadence/if_cemac.c:1.30 src/sys/dev/cadence/if_cemac.c:1.31
--- src/sys/dev/cadence/if_cemac.c:1.30	Sat Aug 24 10:09:02 2024
+++ src/sys/dev/cadence/if_cemac.c	Sat Aug 24 10:11:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cemac.c,v 1.30 2024/08/24 10:09:02 skrll Exp $	*/
+/*	$NetBSD: if_cemac.c,v 1.31 2024/08/24 10:11:40 skrll Exp $	*/
 
 /*
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.30 2024/08/24 10:09:02 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.31 2024/08/24 10:11:40 skrll Exp $");
 
 #include 
 #include 
@@ -708,7 +708,7 @@ cemac_statchg(struct ifnet *ifp)
 static void
 cemac_tick(void *arg)
 {
-	struct cemac_softc* sc = (struct cemac_softc *)arg;
+	struct cemac_softc *sc = (struct cemac_softc *)arg;
 	struct ifnet * ifp = &sc->sc_ethercom.ec_if;
 	int s;
 
@@ -830,7 +830,7 @@ start:
 	sc->txqc++;
 
 	DPRINTFN(2,("%s: start sending idx #%i mbuf %p (txqc=%i, phys %p), len=%u\n",
-		__FUNCTION__, bi, sc->txq[bi].m, sc->txqc, (void*)segs->ds_addr,
+		__FUNCTION__, bi, sc->txq[bi].m, sc->txqc, (void *)segs->ds_addr,
 		(unsigned)m->m_pkthdr.len));
 #ifdef	DIAGNOSTIC
 	if (sc->txqc > TX_QLEN)



CVS commit: src/sys/dev/cadence

2024-08-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 24 10:11:40 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/cadence/if_cemac.c

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



CVS commit: src/sys/dev/cadence

2024-08-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 24 10:09:03 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
G/C


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/cadence/if_cemac.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/dev/cadence/if_cemac.c
diff -u src/sys/dev/cadence/if_cemac.c:1.29 src/sys/dev/cadence/if_cemac.c:1.30
--- src/sys/dev/cadence/if_cemac.c:1.29	Sat Aug 24 07:24:34 2024
+++ src/sys/dev/cadence/if_cemac.c	Sat Aug 24 10:09:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cemac.c,v 1.29 2024/08/24 07:24:34 skrll Exp $	*/
+/*	$NetBSD: if_cemac.c,v 1.30 2024/08/24 10:09:02 skrll Exp $	*/
 
 /*
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.29 2024/08/24 07:24:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.30 2024/08/24 10:09:02 skrll Exp $");
 
 #include 
 #include 
@@ -156,13 +156,6 @@ int cemac_debug = CEMAC_DEBUG;
 CFATTACH_DECL_NEW(cemac, sizeof(struct cemac_softc),
 cemac_match, cemac_attach, NULL, NULL);
 
-int
-cemac_match_common(device_t parent, cfdata_t match, void *aux)
-{
-	if (strcmp(match->cf_name, "cemac") == 0)
-		return 1;
-	return 0;
-}
 
 void
 cemac_attach_common(device_t self, bus_space_tag_t iot,



CVS commit: src/sys/dev/cadence

2024-08-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 24 10:09:03 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
G/C


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/cadence/if_cemac.c

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



CVS commit: src/sys/dev/cadence

2024-08-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 24 10:02:55 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemacvar.h

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/cadence/if_cemacvar.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/cadence/if_cemacvar.h
diff -u src/sys/dev/cadence/if_cemacvar.h:1.1 src/sys/dev/cadence/if_cemacvar.h:1.2
--- src/sys/dev/cadence/if_cemacvar.h:1.1	Fri Jan 23 12:34:09 2015
+++ src/sys/dev/cadence/if_cemacvar.h	Sat Aug 24 10:02:55 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_cemacvar.h,v 1.1 2015/01/23 12:34:09 hkenken Exp $	*/
+/*  $NetBSD: if_cemacvar.h,v 1.2 2024/08/24 10:02:55 skrll Exp $	*/
 /*-
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -30,7 +30,7 @@
 
 int cemac_match(device_t, cfdata_t, void *);
 void cemac_attach(device_t, device_t, void *);
-int cemac_intr(void*);
+int cemac_intr(void *);
 
 int cemac_match_common(device_t, cfdata_t, void *);
 void cemac_attach_common(device_t, bus_space_tag_t, bus_space_handle_t,



CVS commit: src/sys/dev/cadence

2024-08-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 24 10:02:55 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemacvar.h

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/cadence/if_cemacvar.h

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



CVS commit: src/sys/dev/iscsi

2024-08-24 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug 24 09:39:44 UTC 2024

Modified Files:
src/sys/dev/iscsi: iscsi_ioctl.c iscsi_send.c

Log Message:
Avoid race in timeout handling.
Don't try to wake up CCB without connection (which led to a NULL pointer deref).


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/iscsi/iscsi_ioctl.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/iscsi/iscsi_send.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/dev/iscsi/iscsi_ioctl.c
diff -u src/sys/dev/iscsi/iscsi_ioctl.c:1.34 src/sys/dev/iscsi/iscsi_ioctl.c:1.35
--- src/sys/dev/iscsi/iscsi_ioctl.c:1.34	Sat Nov 25 10:08:27 2023
+++ src/sys/dev/iscsi/iscsi_ioctl.c	Sat Aug 24 09:39:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_ioctl.c,v 1.34 2023/11/25 10:08:27 mlelstv Exp $	*/
+/*	$NetBSD: iscsi_ioctl.c,v 1.35 2024/08/24 09:39:44 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -1635,9 +1635,11 @@ connection_timeout_co(void *par)
 	connection_t *conn = par;
 
 	mutex_enter(&iscsi_cleanup_mtx);
-	conn->c_timedout = TOUT_QUEUED;
-	TAILQ_INSERT_TAIL(&iscsi_timeout_conn_list, conn, c_tchain);
-	iscsi_notify_cleanup();
+	if (conn->c_timedout == TOUT_ARMED) {
+		conn->c_timedout = TOUT_QUEUED;
+		TAILQ_INSERT_TAIL(&iscsi_timeout_conn_list, conn, c_tchain);
+		iscsi_notify_cleanup();
+	}
 	mutex_exit(&iscsi_cleanup_mtx);
 }
 
@@ -1657,14 +1659,13 @@ connection_timeout_stop(connection_t *co
 {
 	callout_stop(&conn->c_timeout);
 	mutex_enter(&iscsi_cleanup_mtx);
-	if (conn->c_timedout == TOUT_QUEUED) {
+	if (conn->c_timedout == TOUT_QUEUED)
 		TAILQ_REMOVE(&iscsi_timeout_conn_list, conn, c_tchain);
-		conn->c_timedout = TOUT_NONE;
-	}   
 	if (curlwp != iscsi_cleanproc) {
 		while (conn->c_timedout == TOUT_BUSY)
 			kpause("connbusy", false, 1, &iscsi_cleanup_mtx);
 	}
+	conn->c_timedout = TOUT_NONE;
 	mutex_exit(&iscsi_cleanup_mtx);
 }
 
@@ -1674,9 +1675,11 @@ ccb_timeout_co(void *par)
 	ccb_t *ccb = par;
 
 	mutex_enter(&iscsi_cleanup_mtx);
-	ccb->ccb_timedout = TOUT_QUEUED;
-	TAILQ_INSERT_TAIL(&iscsi_timeout_ccb_list, ccb, ccb_tchain);
-	iscsi_notify_cleanup();
+	if (ccb->ccb_timedout == TOUT_ARMED) {
+		ccb->ccb_timedout = TOUT_QUEUED;
+		TAILQ_INSERT_TAIL(&iscsi_timeout_ccb_list, ccb, ccb_tchain);
+		iscsi_notify_cleanup();
+	}
 	mutex_exit(&iscsi_cleanup_mtx);
 }
 
@@ -1696,14 +1699,13 @@ ccb_timeout_stop(ccb_t *ccb)
 {
 	callout_stop(&ccb->ccb_timeout);
 	mutex_enter(&iscsi_cleanup_mtx);
-	if (ccb->ccb_timedout == TOUT_QUEUED) {
+	if (ccb->ccb_timedout == TOUT_QUEUED)
 		TAILQ_REMOVE(&iscsi_timeout_ccb_list, ccb, ccb_tchain);
-		ccb->ccb_timedout = TOUT_NONE;
-	} 
 	if (curlwp != iscsi_cleanproc) {
 		while (ccb->ccb_timedout == TOUT_BUSY)
 			kpause("ccbbusy", false, 1, &iscsi_cleanup_mtx);
 	}
+	ccb->ccb_timedout = TOUT_NONE;
 	mutex_exit(&iscsi_cleanup_mtx);
 }
 

Index: src/sys/dev/iscsi/iscsi_send.c
diff -u src/sys/dev/iscsi/iscsi_send.c:1.40 src/sys/dev/iscsi/iscsi_send.c:1.41
--- src/sys/dev/iscsi/iscsi_send.c:1.40	Sat Nov 25 10:08:27 2023
+++ src/sys/dev/iscsi/iscsi_send.c	Sat Aug 24 09:39:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_send.c,v 1.40 2023/11/25 10:08:27 mlelstv Exp $	*/
+/*	$NetBSD: iscsi_send.c,v 1.41 2024/08/24 09:39:44 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -1723,19 +1723,19 @@ ccb_timeout(ccb_t *ccb)
 {
 	connection_t *conn = ccb->ccb_connection;
 
+	if (conn == NULL) {
+		/* XXX Should never happen */
+		printf("ccb_timeout: num=%d total=%d disp=%d invalid ccb=%p\n",
+			ccb->ccb_num_timeouts+1, ccb->ccb_total_tries,
+			ccb->ccb_disp, ccb);
+		return;
+	}
+
 	ccb->ccb_total_tries++;
 
 	DEBC(conn, 0, ("ccb_timeout: num=%d total=%d disp=%d\n",
 		ccb->ccb_num_timeouts+1, ccb->ccb_total_tries, ccb->ccb_disp));
 
-	/*
-	 * XXX can we time out after connection is closed ?
-	 */
-	if (conn == NULL) {
-		wake_ccb(ccb, ISCSI_STATUS_TIMEOUT);
-		return;
-	}
-
 	if (++ccb->ccb_num_timeouts > MAX_CCB_TIMEOUTS ||
 		ccb->ccb_total_tries > MAX_CCB_TRIES ||
 		ccb->ccb_disp <= CCBDISP_FREE ||



CVS commit: src/sys/dev/iscsi

2024-08-24 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug 24 09:39:44 UTC 2024

Modified Files:
src/sys/dev/iscsi: iscsi_ioctl.c iscsi_send.c

Log Message:
Avoid race in timeout handling.
Don't try to wake up CCB without connection (which led to a NULL pointer deref).


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/iscsi/iscsi_ioctl.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/iscsi/iscsi_send.c

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



CVS commit: src/sys/dev/cadence

2024-08-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 24 07:24:35 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/cadence/if_cemac.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/dev/cadence/if_cemac.c
diff -u src/sys/dev/cadence/if_cemac.c:1.28 src/sys/dev/cadence/if_cemac.c:1.29
--- src/sys/dev/cadence/if_cemac.c:1.28	Fri Jul  5 04:31:50 2024
+++ src/sys/dev/cadence/if_cemac.c	Sat Aug 24 07:24:34 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cemac.c,v 1.28 2024/07/05 04:31:50 rin Exp $	*/
+/*	$NetBSD: if_cemac.c,v 1.29 2024/08/24 07:24:34 skrll Exp $	*/
 
 /*
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.28 2024/07/05 04:31:50 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.29 2024/08/24 07:24:34 skrll Exp $");
 
 #include 
 #include 
@@ -389,7 +389,7 @@ cemac_intr(void *arg)
 		goto begin;
 #endif
 
-	return (1);
+	return 1;
 }
 
 
@@ -627,7 +627,7 @@ cemac_mediachange(struct ifnet *ifp)
 {
 	if (ifp->if_flags & IFF_UP)
 		cemac_ifinit(ifp);
-	return (0);
+	return 0;
 }
 
 static void



CVS commit: src/sys/dev/cadence

2024-08-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 24 07:24:35 UTC 2024

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/cadence/if_cemac.c

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



CVS commit: src/sys/dev/pci/igc

2024-08-22 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Aug 22 20:18:10 UTC 2024

Modified Files:
src/sys/dev/pci/igc: igc_defines.h

Log Message:
s/Shfit/Shift/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/igc/igc_defines.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/igc/igc_defines.h
diff -u src/sys/dev/pci/igc/igc_defines.h:1.3 src/sys/dev/pci/igc/igc_defines.h:1.4
--- src/sys/dev/pci/igc/igc_defines.h:1.3	Wed Feb 21 12:39:39 2024
+++ src/sys/dev/pci/igc/igc_defines.h	Thu Aug 22 20:18:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: igc_defines.h,v 1.3 2024/02/21 12:39:39 msaitoh Exp $	*/
+/*	$NetBSD: igc_defines.h,v 1.4 2024/08/22 20:18:10 andvar Exp $	*/
 /*	$OpenBSD: igc_defines.h,v 1.1 2021/10/31 14:52:57 patrick Exp $	*/
 
 /*-
@@ -750,7 +750,7 @@
 /* TTQF SCTP Bit, shift with IGC_TTQF_PROTOCOL_SHIFT */
 #define IGC_TTQF_PROTOCOL_SCTP		0x2
 #define IGC_TTQF_PROTOCOL_SHIFT		5   /* TTQF Protocol Shift */
-#define IGC_TTQF_QUEUE_SHIFT		16  /* TTQF Queue Shfit */
+#define IGC_TTQF_QUEUE_SHIFT		16  /* TTQF Queue Shift */
 #define IGC_TTQF_RX_QUEUE_MASK		0x7 /* TTQF Queue Mask */
 #define IGC_TTQF_MASK_ENABLE		0x1000 /* TTQF Mask Enable Bit */
 #define IGC_IMIR_CLEAR_MASK		0xF001 /* IMIR Reg Clear Mask */



CVS commit: src/sys/dev/pci/igc

2024-08-22 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Aug 22 20:18:10 UTC 2024

Modified Files:
src/sys/dev/pci/igc: igc_defines.h

Log Message:
s/Shfit/Shift/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/igc/igc_defines.h

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



Re: CVS commit: src/sys/dev/pci

2024-08-21 Thread T K Spindler (moof)
On Wed, Aug 21, 2024 at 01:42:28AM -0700, John Nemeth wrote:
> } Log Message:
> } Add Areca ARC-1224
> 
>  I noticed that you mentioned newer Areca devices on icb.  Is
> there a particular device that you're interested in.  I have an
> updated version of arcmsr(4) that I've been meaning to clean up
> and commit.  It has been tested with at least one device newer than
> what the in-tree code has.  It was mostly done with code that Areca
> provided with some cleanup by myself (especially the error paths).

I was interested in perhaps importing or integrating at least some of
the Areca-provided driver sources - but actual work on that on my part
has been limited to eyeballing the diffs and wondering whether there
were a cleaner way to integrate the five different variants that it
supports (and the accompanying 2x size increase in both the header and
.c files). It sounds like you're way, way further along than I am - if
you were willing and able to commit, I'd heartily encourage you to do
so.

(I do *not* have any of the newer devices in question, FWIW. I'd
also note that the FreeBSD driver for the non-SAS cards looks radically
different from arcmsr and also requires linking in a binary blob, alas.)



Re: CVS commit: src/sys/dev/pci

2024-08-21 Thread John Nemeth
On Aug 20, 22:44, "Tom Spindler" wrote:
} 
} Module Name:  src
} Committed By: dogcow
} Date: Tue Aug 20 22:44:04 UTC 2024
} 
} Modified Files:
}   src/sys/dev/pci: pcidevs
} 
} Log Message:
} Add Areca ARC-1224

Hi Tom,

 I noticed that you mentioned newer Areca devices on icb.  Is
there a particular device that you're interested in.  I have an
updated version of arcmsr(4) that I've been meaning to clean up
and commit.  It has been tested with at least one device newer than
what the in-tree code has.  It was mostly done with code that Areca
provided with some cleanup by myself (especially the error paths).

}-- End of excerpt from "Tom Spindler"


CVS commit: src/sys/dev/pci

2024-08-20 Thread Tom Spindler
Module Name:src
Committed By:   dogcow
Date:   Tue Aug 20 22:45:31 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1488 -r1.1489 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1487 -r1.1488 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


CVS commit: src/sys/dev/pci

2024-08-20 Thread Tom Spindler
Module Name:src
Committed By:   dogcow
Date:   Tue Aug 20 22:45:31 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1488 -r1.1489 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1487 -r1.1488 src/sys/dev/pci/pcidevs_data.h

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



CVS commit: src/sys/dev/pci

2024-08-20 Thread Tom Spindler
Module Name:src
Committed By:   dogcow
Date:   Tue Aug 20 22:44:04 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Areca ARC-1224


To generate a diff of this commit:
cvs rdiff -u -r1.1509 -r1.1510 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1509 src/sys/dev/pci/pcidevs:1.1510
--- src/sys/dev/pci/pcidevs:1.1509	Wed Jul 17 03:13:12 2024
+++ src/sys/dev/pci/pcidevs	Tue Aug 20 22:44:04 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1509 2024/07/17 03:13:12 mrg Exp $
+$NetBSD: pcidevs,v 1.1510 2024/08/20 22:44:04 dogcow Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1494,6 +1494,7 @@ product ARECA ARC1203		0x1203	ARC-1203
 product ARECA ARC1210		0x1210	ARC-1210
 product ARECA ARC1214 		0x1214	ARC-1214
 product ARECA ARC1220		0x1220	ARC-1220
+product ARECA ARC1224		0x1224	ARC-1224
 product ARECA ARC1230		0x1230	ARC-1230
 product ARECA ARC1260		0x1260	ARC-1260
 product ARECA ARC1270		0x1270	ARC-1270



CVS commit: src/sys/dev/pci

2024-08-20 Thread Tom Spindler
Module Name:src
Committed By:   dogcow
Date:   Tue Aug 20 22:44:04 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Areca ARC-1224


To generate a diff of this commit:
cvs rdiff -u -r1.1509 -r1.1510 src/sys/dev/pci/pcidevs

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



CVS commit: src/sys/dev/ic

2024-08-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Aug 19 16:09:42 UTC 2024

Modified Files:
src/sys/dev/ic: sti.c

Log Message:
Whitespace fixes


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/ic/sti.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/dev/ic/sti.c
diff -u src/sys/dev/ic/sti.c:1.38 src/sys/dev/ic/sti.c:1.39
--- src/sys/dev/ic/sti.c:1.38	Mon Aug 19 10:57:32 2024
+++ src/sys/dev/ic/sti.c	Mon Aug 19 16:09:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.38 2024/08/19 10:57:32 macallan Exp $	*/
+/*	$NetBSD: sti.c,v 1.39 2024/08/19 16:09:42 skrll Exp $	*/
 
 /*	$OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.38 2024/08/19 10:57:32 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.39 2024/08/19 16:09:42 skrll Exp $");
 
 #include "wsdisplay.h"
 
@@ -1082,7 +1082,7 @@ sti_ioctl(void *v, void *vs, u_long cmd,
 	ret = 0;
 	switch (cmd) {
 	case GCID:
-		*(u_int *) data = rom->rom_dd.dd_grid[0];
+		*(u_int *)data = rom->rom_dd.dd_grid[0];
 		break;
 
 	case WSDISPLAYIO_GMODE:
@@ -1122,7 +1122,6 @@ sti_ioctl(void *v, void *vs, u_long cmd,
 		*(u_int *)data = WSDISPLAY_TYPE_STI;
 		break;
 
-
 	case WSDISPLAYIO_GINFO:
 		wdf = (struct wsdisplay_fbinfo *)data;
 		wdf->height = scr->scr_cfg.scr_height;



CVS commit: src/sys/dev/ic

2024-08-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Aug 19 16:09:42 UTC 2024

Modified Files:
src/sys/dev/ic: sti.c

Log Message:
Whitespace fixes


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/ic/sti.c

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



CVS commit: src/sys/dev/ic

2024-08-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug 19 10:57:32 UTC 2024

Modified Files:
src/sys/dev/ic: sti.c stireg.h

Log Message:
add an ioctl() to read a device's graphics ID, mimic HP/UX's GCID
that way an xorg driver can identify which WSDISPLAY_TYPE_STI it's talking to
without having to setup its own STI


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/sti.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/stireg.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/ic/sti.c
diff -u src/sys/dev/ic/sti.c:1.37 src/sys/dev/ic/sti.c:1.38
--- src/sys/dev/ic/sti.c:1.37	Wed Jul  3 13:08:36 2024
+++ src/sys/dev/ic/sti.c	Mon Aug 19 10:57:32 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.37 2024/07/03 13:08:36 macallan Exp $	*/
+/*	$NetBSD: sti.c,v 1.38 2024/08/19 10:57:32 macallan Exp $	*/
 
 /*	$OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.37 2024/07/03 13:08:36 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.38 2024/08/19 10:57:32 macallan Exp $");
 
 #include "wsdisplay.h"
 
@@ -1073,6 +1073,7 @@ int
 sti_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l)
 {
 	struct sti_screen *scr = (struct sti_screen *)v;
+	struct sti_rom *rom = scr->scr_rom;
 	struct wsdisplay_fbinfo *wdf;
 	struct wsdisplay_cmap *cmapp;
 	u_int mode, idx, count;
@@ -1080,6 +1081,10 @@ sti_ioctl(void *v, void *vs, u_long cmd,
 
 	ret = 0;
 	switch (cmd) {
+	case GCID:
+		*(u_int *) data = rom->rom_dd.dd_grid[0];
+		break;
+
 	case WSDISPLAYIO_GMODE:
 		*(u_int *)data = scr->scr_wsmode;
 		break;
@@ -1117,6 +1122,7 @@ sti_ioctl(void *v, void *vs, u_long cmd,
 		*(u_int *)data = WSDISPLAY_TYPE_STI;
 		break;
 
+
 	case WSDISPLAYIO_GINFO:
 		wdf = (struct wsdisplay_fbinfo *)data;
 		wdf->height = scr->scr_cfg.scr_height;

Index: src/sys/dev/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.12 src/sys/dev/ic/stireg.h:1.13
--- src/sys/dev/ic/stireg.h:1.12	Tue Aug  6 07:26:56 2024
+++ src/sys/dev/ic/stireg.h	Mon Aug 19 10:57:32 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.12 2024/08/06 07:26:56 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.13 2024/08/19 10:57:32 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -747,4 +747,7 @@ STI_DEP(util);
 #define	NGLE_BUFF1_CMAP3	0x0c001e02
 #define	NGLE_ARTIST_CMAP0	0x0102
 
+/* mimic HP/UX, this will return the device's graphics ID */
+#define	GCID	_IOR('G', 40, u_int)
+
 #endif /* _IC_STIREG_H_ */



CVS commit: src/sys/dev/ic

2024-08-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug 19 10:57:32 UTC 2024

Modified Files:
src/sys/dev/ic: sti.c stireg.h

Log Message:
add an ioctl() to read a device's graphics ID, mimic HP/UX's GCID
that way an xorg driver can identify which WSDISPLAY_TYPE_STI it's talking to
without having to setup its own STI


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/sti.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/stireg.h

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



CVS commit: src/sys/dev/fdt

2024-08-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Aug 19 07:35:16 UTC 2024

Modified Files:
src/sys/dev/fdt: dwcmmc_fdt.c

Log Message:
Match "starfive,jh7110-mmc"


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/fdt/dwcmmc_fdt.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/dev/fdt/dwcmmc_fdt.c
diff -u src/sys/dev/fdt/dwcmmc_fdt.c:1.23 src/sys/dev/fdt/dwcmmc_fdt.c:1.24
--- src/sys/dev/fdt/dwcmmc_fdt.c:1.23	Fri Feb  9 17:16:42 2024
+++ src/sys/dev/fdt/dwcmmc_fdt.c	Mon Aug 19 07:35:16 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwcmmc_fdt.c,v 1.23 2024/02/09 17:16:42 skrll Exp $ */
+/* $NetBSD: dwcmmc_fdt.c,v 1.24 2024/08/19 07:35:16 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.23 2024/02/09 17:16:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.24 2024/08/19 07:35:16 skrll Exp $");
 
 #include 
 #include 
@@ -74,6 +74,7 @@ static const struct dwcmmc_fdt_config dw
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "rockchip,rk3288-dw-mshc",	.data = &dwcmmc_rk3288_config },
 	{ .compat = "snps,dw-mshc",		.data = &dwmmc_default_config },
+	{ .compat = "starfive,jh7110-mmc",	.data = &dwmmc_default_config },
 	DEVICE_COMPAT_EOL
 };
 



CVS commit: src/sys/dev/fdt

2024-08-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Aug 19 07:35:16 UTC 2024

Modified Files:
src/sys/dev/fdt: dwcmmc_fdt.c

Log Message:
Match "starfive,jh7110-mmc"


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/fdt/dwcmmc_fdt.c

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



CVS commit: src/sys/dev/acpi

2024-08-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 18 00:43:07 UTC 2024

Modified Files:
src/sys/dev/acpi: acpi_display.c

Log Message:
acpi_display.c: Nix trailing whitespace.

No functional change intended.

Followup to fix for:

PR kern/57825: Malfunctioning screen brightness keys and sysctl


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/acpi/acpi_display.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/dev/acpi/acpi_display.c
diff -u src/sys/dev/acpi/acpi_display.c:1.24 src/sys/dev/acpi/acpi_display.c:1.25
--- src/sys/dev/acpi/acpi_display.c:1.24	Fri May 10 19:29:46 2024
+++ src/sys/dev/acpi/acpi_display.c	Sun Aug 18 00:43:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_display.c,v 1.24 2024/05/10 19:29:46 maya Exp $	*/
+/*	$NetBSD: acpi_display.c,v 1.25 2024/08/18 00:43:07 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_display.c,v 1.24 2024/05/10 19:29:46 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_display.c,v 1.25 2024/08/18 00:43:07 riastradh Exp $");
 
 #include 
 #include 
@@ -271,9 +271,9 @@ struct acpidisp_brctl {
 	uint16_t	 bc_level_count;	/* Number of levels */
 	uint8_t		 bc_current;		/* Current level */
 
-	/* 
+	/*
 	 * Quirk if firmware returns wrong values for _BQC
-	 * (acpidisp_get_brightness) 
+	 * (acpidisp_get_brightness)
 	 */
 	bool		bc_bqc_broken;
 };
@@ -2003,7 +2003,7 @@ acpidisp_print_odinfo(device_t self, con
 static void
 ranger(uint8_t *a, size_t l, void (*pr)(const char *, ...) __printflike(1, 2))
 {
-	uint8_t b, e; 
+	uint8_t b, e;
 
 	if (l > 1)
 		(*pr)("[");



CVS commit: src/sys/dev/acpi

2024-08-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 18 00:43:07 UTC 2024

Modified Files:
src/sys/dev/acpi: acpi_display.c

Log Message:
acpi_display.c: Nix trailing whitespace.

No functional change intended.

Followup to fix for:

PR kern/57825: Malfunctioning screen brightness keys and sysctl


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/acpi/acpi_display.c

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



  1   2   3   4   5   6   7   8   9   10   >