CVS commit: src/sys/dev/ic

2024-06-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jun 16 17:11:12 UTC 2024

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

Log Message:
Misc whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/dev/ic/dwc_gmac.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-06-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jun 16 17:11:12 UTC 2024

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

Log Message:
Misc whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/dev/ic/dwc_gmac.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_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.86 src/sys/dev/ic/dwc_gmac.c:1.87
--- src/sys/dev/ic/dwc_gmac.c:1.86	Thu Mar 14 16:43:00 2024
+++ src/sys/dev/ic/dwc_gmac.c	Sun Jun 16 17:11:11 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.86 2024/03/14 16:43:00 jakllsch Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.87 2024/06/16 17:11:11 skrll Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.86 2024/03/14 16:43:00 jakllsch Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.87 2024/06/16 17:11:11 skrll Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -655,7 +655,6 @@ dwc_gmac_free_rx_ring(struct dwc_gmac_so
 	if (ring->r_desc == NULL)
 		return;
 
-
 	for (i = 0; i < AWGE_RX_RING_COUNT; i++) {
 		data = >r_data[i];
 
@@ -700,7 +699,7 @@ dwc_gmac_alloc_tx_ring(struct dwc_gmac_s
 		}
 		ring->t_desc[i].ddesc_next = htole32(
 		ring->t_physaddr + sizeof(struct dwc_gmac_dev_dmadesc)
-		*TX_NEXT(i));
+		* TX_NEXT(i));
 	}
 
 	return 0;
@@ -1674,9 +1673,9 @@ static void
 dwc_dump_status(struct dwc_gmac_softc *sc)
 {
 	uint32_t status = bus_space_read_4(sc->sc_bst, sc->sc_bsh,
-	 AWIN_GMAC_MAC_INTR);
+	AWIN_GMAC_MAC_INTR);
 	uint32_t dma_status = bus_space_read_4(sc->sc_bst, sc->sc_bsh,
-	 AWIN_GMAC_DMA_STATUS);
+	AWIN_GMAC_DMA_STATUS);
 	char buf[200];
 
 	/* print interrupt state */



CVS commit: src/sys/dev/ic

2024-05-21 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue May 21 08:04:20 UTC 2024

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

Log Message:
nix extra whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/ic/ne2000.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/ne2000.c
diff -u src/sys/dev/ic/ne2000.c:1.78 src/sys/dev/ic/ne2000.c:1.79
--- src/sys/dev/ic/ne2000.c:1.78	Tue May 21 07:29:40 2024
+++ src/sys/dev/ic/ne2000.c	Tue May 21 08:04:20 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ne2000.c,v 1.78 2024/05/21 07:29:40 andvar Exp $	*/
+/*	$NetBSD: ne2000.c,v 1.79 2024/05/21 08:04:20 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ne2000.c,v 1.78 2024/05/21 07:29:40 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ne2000.c,v 1.79 2024/05/21 08:04:20 andvar Exp $");
 
 #include "rtl80x9.h"
 
@@ -373,7 +373,7 @@ ne2000_detect(bus_space_tag_t nict, bus_
 
 	/*
 	 * Generic probe routine for testing for the existence of a DS8390.
-	 * Must be performed  after the NIC has just been reset.  This
+	 * Must be performed after the NIC has just been reset.  This
 	 * works by looking at certain register values that are guaranteed
 	 * to be initialized a certain way after power-up or reset.
 	 *



CVS commit: src/sys/dev/ic

2024-05-21 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue May 21 08:04:20 UTC 2024

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

Log Message:
nix extra whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/ic/ne2000.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-05-21 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue May 21 07:29:40 UTC 2024

Modified Files:
src/sys/dev/ic: mx98905.c ne2000.c

Log Message:
s/amout/amount/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/mx98905.c
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/ic/ne2000.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/mx98905.c
diff -u src/sys/dev/ic/mx98905.c:1.17 src/sys/dev/ic/mx98905.c:1.18
--- src/sys/dev/ic/mx98905.c:1.17	Tue Aug  1 20:52:43 2023
+++ src/sys/dev/ic/mx98905.c	Tue May 21 07:29:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mx98905.c,v 1.17 2023/08/01 20:52:43 andvar Exp $	*/
+/*	$NetBSD: mx98905.c,v 1.18 2024/05/21 07:29:40 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: mx98905.c,v 1.17 2023/08/01 20:52:43 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mx98905.c,v 1.18 2024/05/21 07:29:40 andvar Exp $");
 
 #include 
 #include 
@@ -282,7 +282,7 @@ mx98905_write_mbuf(struct dp8390_softc *
 }
 
 /*
- * Given a source and destination address, copy 'amout' of a packet from
+ * Given a source and destination address, copy 'amount' of a packet from
  * the ring buffer into a linear destination buffer.  Takes into account
  * ring-wrap.
  */

Index: src/sys/dev/ic/ne2000.c
diff -u src/sys/dev/ic/ne2000.c:1.77 src/sys/dev/ic/ne2000.c:1.78
--- src/sys/dev/ic/ne2000.c:1.77	Fri Aug 20 20:25:28 2021
+++ src/sys/dev/ic/ne2000.c	Tue May 21 07:29:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ne2000.c,v 1.77 2021/08/20 20:25:28 andvar Exp $	*/
+/*	$NetBSD: ne2000.c,v 1.78 2024/05/21 07:29:40 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ne2000.c,v 1.77 2021/08/20 20:25:28 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ne2000.c,v 1.78 2024/05/21 07:29:40 andvar Exp $");
 
 #include "rtl80x9.h"
 
@@ -716,7 +716,7 @@ ne2000_write_mbuf(struct dp8390_softc *s
 }
 
 /*
- * Given a source and destination address, copy 'amout' of a packet from
+ * Given a source and destination address, copy 'amount' of a packet from
  * the ring buffer into a linear destination buffer.  Takes into account
  * ring-wrap.
  */



CVS commit: src/sys/dev/ic

2024-05-21 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue May 21 07:29:40 UTC 2024

Modified Files:
src/sys/dev/ic: mx98905.c ne2000.c

Log Message:
s/amout/amount/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/mx98905.c
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/ic/ne2000.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-05-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue May 14 13:41:15 UTC 2024

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

Log Message:
tpm(4): device_printf needs \n.

Observed in PR 58255.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ic/tpm.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/tpm.c
diff -u src/sys/dev/ic/tpm.c:1.28 src/sys/dev/ic/tpm.c:1.29
--- src/sys/dev/ic/tpm.c:1.28	Tue Jul  4 01:02:26 2023
+++ src/sys/dev/ic/tpm.c	Tue May 14 13:41:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: tpm.c,v 1.28 2023/07/04 01:02:26 riastradh Exp $	*/
+/*	$NetBSD: tpm.c,v 1.29 2024/05/14 13:41:15 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.28 2023/07/04 01:02:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.29 2024/05/14 13:41:15 riastradh Exp $");
 
 #include 
 #include 
@@ -150,7 +150,7 @@ tpm12_suspend(struct tpm_softc *sc)
 	 */
 	error = (*sc->sc_intf->start)(sc, UIO_WRITE);
 	if (error) {
-		device_printf(sc->sc_dev, "start write failed: %d", error);
+		device_printf(sc->sc_dev, "start write failed: %d\n", error);
 		goto out;
 	}
 
@@ -158,8 +158,8 @@ tpm12_suspend(struct tpm_softc *sc)
 
 	error = (*sc->sc_intf->write)(sc, , sizeof(command));
 	if (error) {
-		device_printf(sc->sc_dev, "write TPM_ORD_SaveState failed: %d",
-		error);
+		device_printf(sc->sc_dev, "write TPM_ORD_SaveState failed:"
+		" %d\n", error);
 		goto out;
 	}
 
@@ -167,7 +167,7 @@ tpm12_suspend(struct tpm_softc *sc)
 
 	error = (*sc->sc_intf->end)(sc, UIO_WRITE, 0);
 	if (error) {
-		device_printf(sc->sc_dev, "end write failed: %d", error);
+		device_printf(sc->sc_dev, "end write failed: %d\n", error);
 		goto out;
 	}
 
@@ -177,7 +177,7 @@ tpm12_suspend(struct tpm_softc *sc)
 	 */
 	error = (*sc->sc_intf->start)(sc, UIO_READ);
 	if (error) {
-		device_printf(sc->sc_dev, "start read failed: %d", error);
+		device_printf(sc->sc_dev, "start read failed: %d\n", error);
 		goto out;
 	}
 
@@ -186,11 +186,11 @@ tpm12_suspend(struct tpm_softc *sc)
 	error = (*sc->sc_intf->read)(sc, , sizeof(response), ,
 	0);
 	if (error) {
-		device_printf(sc->sc_dev, "read failed: %d", error);
+		device_printf(sc->sc_dev, "read failed: %d\n", error);
 		goto out;
 	}
 	if (nread != sizeof(response)) {
-		device_printf(sc->sc_dev, "short header read: %zu", nread);
+		device_printf(sc->sc_dev, "short header read: %zu\n", nread);
 		goto out;
 	}
 
@@ -198,7 +198,7 @@ tpm12_suspend(struct tpm_softc *sc)
 
 	error = (*sc->sc_intf->end)(sc, UIO_READ, 0);
 	if (error) {
-		device_printf(sc->sc_dev, "end read failed: %d", error);
+		device_printf(sc->sc_dev, "end read failed: %d\n", error);
 		goto out;
 	}
 
@@ -209,7 +209,8 @@ tpm12_suspend(struct tpm_softc *sc)
 	be32toh(response.length) != sizeof(response) ||
 	be32toh(response.code) != 0) {
 		device_printf(sc->sc_dev,
-		"TPM_ORD_SaveState failed: tag=0x%x length=0x%x code=0x%x",
+		"TPM_ORD_SaveState failed:"
+		" tag=0x%x length=0x%x code=0x%x\n",
 		be16toh(response.tag),
 		be32toh(response.length),
 		be32toh(response.code));
@@ -248,7 +249,7 @@ tpm20_suspend(struct tpm_softc *sc)
 	 */
 	error = (*sc->sc_intf->start)(sc, UIO_WRITE);
 	if (error) {
-		device_printf(sc->sc_dev, "start write failed: %d", error);
+		device_printf(sc->sc_dev, "start write failed: %d\n", error);
 		goto out;
 	}
 
@@ -256,8 +257,8 @@ tpm20_suspend(struct tpm_softc *sc)
 
 	error = (*sc->sc_intf->write)(sc, , sizeof(command));
 	if (error) {
-		device_printf(sc->sc_dev, "write TPM_ORD_SaveState failed: %d",
-		error);
+		device_printf(sc->sc_dev, "write TPM_ORD_SaveState failed:"
+		" %d\n", error);
 		goto out;
 	}
 
@@ -265,7 +266,7 @@ tpm20_suspend(struct tpm_softc *sc)
 
 	error = (*sc->sc_intf->end)(sc, UIO_WRITE, 0);
 	if (error) {
-		device_printf(sc->sc_dev, "end write failed: %d", error);
+		device_printf(sc->sc_dev, "end write failed: %d\n", error);
 		goto out;
 	}
 
@@ -275,7 +276,7 @@ tpm20_suspend(struct tpm_softc *sc)
 	 */
 	error = (*sc->sc_intf->start)(sc, UIO_READ);
 	if (error) {
-		device_printf(sc->sc_dev, "start read failed: %d", error);
+		device_printf(sc->sc_dev, "start read failed: %d\n", error);
 		goto out;
 	}
 
@@ -284,11 +285,11 @@ tpm20_suspend(struct tpm_softc *sc)
 	error = (*sc->sc_intf->read)(sc, , sizeof(response), ,
 	0);
 	if (error) {
-		device_printf(sc->sc_dev, "read failed: %d", error);
+		device_printf(sc->sc_dev, "read failed: %d\n", error);
 		goto out;
 	}
 	if (nread != sizeof(response)) {
-		device_printf(sc->sc_dev, "short header read: %zu", nread);
+		device_printf(sc->sc_dev, "short header read: %zu\n", nread);
 		goto out;
 	}
 
@@ -296,7 +297,7 @@ tpm20_suspend(struct tpm_softc *sc)
 
 	error = (*sc->sc_intf->end)(sc, UIO_READ, 0);
 	if (error) {
-		

CVS commit: src/sys/dev/ic

2024-05-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue May 14 13:41:15 UTC 2024

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

Log Message:
tpm(4): device_printf needs \n.

Observed in PR 58255.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ic/tpm.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-04-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr  6 13:42:18 UTC 2024

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

Log Message:
Add RISC-V support


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/qemufwcfg.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/qemufwcfg.c
diff -u src/sys/dev/ic/qemufwcfg.c:1.2 src/sys/dev/ic/qemufwcfg.c:1.3
--- src/sys/dev/ic/qemufwcfg.c:1.2	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/ic/qemufwcfg.c	Sat Apr  6 13:42:18 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: qemufwcfg.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $ */
+/* $NetBSD: qemufwcfg.c,v 1.3 2024/04/06 13:42:18 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: qemufwcfg.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: qemufwcfg.c,v 1.3 2024/04/06 13:42:18 skrll Exp $");
 
 #include 
 #include 
@@ -52,6 +52,11 @@ __KERNEL_RCSID(0, "$NetBSD: qemufwcfg.c,
 #define	FWCFG_SEL_SWAP		htobe16
 #define	FWCFG_DATA_REG		0x00
 #define	FWCFG_DMA_ADDR		0x10
+#elif defined(__riscv)
+#define	FWCFG_SEL_REG		0x08
+#define	FWCFG_SEL_SWAP		htobe16
+#define	FWCFG_DATA_REG		0x00
+#define	FWCFG_DMA_ADDR		0x10
 #else
 #error driver does not support this architecture
 #endif



CVS commit: src/sys/dev/ic

2024-04-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr  6 13:42:18 UTC 2024

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

Log Message:
Add RISC-V support


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/qemufwcfg.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-03-16 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Mar 16 18:17:39 UTC 2024

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

Log Message:
s/Broardcast/Broadcast/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/lan9118reg.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-03-16 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Mar 16 18:17:39 UTC 2024

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

Log Message:
s/Broardcast/Broadcast/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/lan9118reg.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/lan9118reg.h
diff -u src/sys/dev/ic/lan9118reg.h:1.3 src/sys/dev/ic/lan9118reg.h:1.4
--- src/sys/dev/ic/lan9118reg.h:1.3	Mon Sep 27 12:29:03 2010
+++ src/sys/dev/ic/lan9118reg.h	Sat Mar 16 18:17:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: lan9118reg.h,v 1.3 2010/09/27 12:29:03 kiyohara Exp $	*/
+/*	$NetBSD: lan9118reg.h,v 1.4 2024/03/16 18:17:39 andvar Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -206,7 +206,7 @@
 #define LAN9118_MAC_CR_HO		(1 << 15) /* Hash Only Filtering mode */
 #define LAN9118_MAC_CR_HPFILT		(1 << 13) /* Hash/Perfect Flt Mode */
 #define LAN9118_MAC_CR_LCOLL		(1 << 12) /* Late Collision Control */
-#define LAN9118_MAC_CR_BCAST		(1 << 11) /* Disable Broardcast Frms */
+#define LAN9118_MAC_CR_BCAST		(1 << 11) /* Disable Broadcast Frms */
 #define LAN9118_MAC_CR_DISRTY		(1 << 10) /* Disable Retry */
 #define LAN9118_MAC_CR_PADSTR		(1 << 8)  /* Automatic Pad String */
 #define LAN9118_MAC_CR_BOLMT		(1 << 7)  /* BackOff Limit */



CVS commit: src/sys/dev/ic

2024-03-14 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Mar 14 16:43:00 UTC 2024

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

Log Message:
Use ether_crc32_be() instead of having a local bitrev32() function to
munge ether_crc32_le() output when programming multicast filter.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/dev/ic/dwc_gmac.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-03-14 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Mar 14 16:43:00 UTC 2024

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

Log Message:
Use ether_crc32_be() instead of having a local bitrev32() function to
munge ether_crc32_le() output when programming multicast filter.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/dev/ic/dwc_gmac.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_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.85 src/sys/dev/ic/dwc_gmac.c:1.86
--- src/sys/dev/ic/dwc_gmac.c:1.85	Sun Mar  3 10:09:42 2024
+++ src/sys/dev/ic/dwc_gmac.c	Thu Mar 14 16:43:00 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.85 2024/03/03 10:09:42 skrll Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.86 2024/03/14 16:43:00 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.85 2024/03/03 10:09:42 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.86 2024/03/14 16:43:00 jakllsch Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -98,7 +98,6 @@ static void dwc_gmac_tx_intr(struct dwc_
 static void dwc_gmac_rx_intr(struct dwc_gmac_softc *);
 static void dwc_gmac_setmulti(struct dwc_gmac_softc *);
 static int dwc_gmac_ifflags_cb(struct ethercom *);
-static uint32_t	bitrev32(uint32_t);
 static void dwc_gmac_desc_set_owned_by_dev(struct dwc_gmac_dev_dmadesc *);
 static int  dwc_gmac_desc_is_owned_by_dev(struct dwc_gmac_dev_dmadesc *);
 static void dwc_gmac_desc_std_set_len(struct dwc_gmac_dev_dmadesc *, int);
@@ -1346,20 +1345,6 @@ skip:
 	mutex_exit(>sc_rxq.r_mtx);
 }
 
-/*
- * Reverse order of bits - http://aggregate.org/MAGIC/#Bit%20Reversal
- */
-static uint32_t
-bitrev32(uint32_t x)
-{
-	x = (((x & 0x) >> 1) | ((x & 0x) << 1));
-	x = (((x & 0x) >> 2) | ((x & 0x) << 2));
-	x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4));
-	x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8));
-
-	return (x >> 16) | (x << 16);
-}
-
 static void
 dwc_gmac_setmulti(struct dwc_gmac_softc *sc)
 {
@@ -1398,9 +1383,7 @@ dwc_gmac_setmulti(struct dwc_gmac_softc 
 			goto special_filter;
 		}
 
-		h = bitrev32(
-			~ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN)
-		) >> 26;
+		h = ~ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN) >> 26;
 		hashes[h >> 5] |= (1 << (h & 0x1f));
 
 		mcnt++;



CVS commit: src/sys/dev/ic

2024-03-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Mar 11 21:10:46 UTC 2024

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

Log Message:
nvme(4): Disestablish admin q interrupt while suspended.

And re-establish on resume.  Fixes nvmectl(8) after a suspend/resume
cycle on some systems.

Adapted from a patch by mrg@.

PR kern/58025


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/ic/nvme.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/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.68 src/sys/dev/ic/nvme.c:1.69
--- src/sys/dev/ic/nvme.c:1.68	Sun Mar 10 04:49:22 2024
+++ src/sys/dev/ic/nvme.c	Mon Mar 11 21:10:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.68 2024/03/10 04:49:22 mrg Exp $	*/
+/*	$NetBSD: nvme.c,v 1.69 2024/03/11 21:10:46 riastradh Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.68 2024/03/10 04:49:22 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.69 2024/03/11 21:10:46 riastradh Exp $");
 
 #include 
 #include 
@@ -575,7 +575,6 @@ nvme_detach(struct nvme_softc *sc, int f
 		return error;
 
 	/* from now on we are committed to detach, following will never fail */
-	sc->sc_intr_disestablish(sc, NVME_ADMIN_Q);
 	for (i = 0; i < sc->sc_nq; i++)
 		nvme_q_free(sc, sc->sc_q[i]);
 	kmem_free(sc->sc_q, sizeof(*sc->sc_q) * sc->sc_nq);
@@ -603,6 +602,11 @@ nvme_resume(struct nvme_softc *sc)
 	}
 
 	nvme_q_reset(sc, sc->sc_admin_q);
+	if (sc->sc_intr_establish(sc, NVME_ADMIN_Q, sc->sc_admin_q)) {
+		error = EIO;
+		device_printf(sc->sc_dev, "unable to establish admin q\n");
+		goto disable;
+	}
 
 	error = nvme_enable(sc, ffs(sc->sc_mps) - 1);
 	if (error) {
@@ -651,6 +655,8 @@ nvme_shutdown(struct nvme_softc *sc)
 	if (disabled)
 		goto disable;
 
+	sc->sc_intr_disestablish(sc, NVME_ADMIN_Q);
+
 	cc = nvme_read4(sc, NVME_CC);
 	CLR(cc, NVME_CC_SHN_MASK);
 	SET(cc, NVME_CC_SHN(NVME_CC_SHN_NORMAL));



CVS commit: src/sys/dev/ic

2024-03-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Mar 11 21:10:46 UTC 2024

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

Log Message:
nvme(4): Disestablish admin q interrupt while suspended.

And re-establish on resume.  Fixes nvmectl(8) after a suspend/resume
cycle on some systems.

Adapted from a patch by mrg@.

PR kern/58025


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/ic/nvme.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-03-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 10 17:16:26 UTC 2024

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

Log Message:
lsi64854reg: fix snprintb formats DDMACSR_BITS and PDMACSR_BITS


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/lsi64854reg.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/lsi64854reg.h
diff -u src/sys/dev/ic/lsi64854reg.h:1.6 src/sys/dev/ic/lsi64854reg.h:1.7
--- src/sys/dev/ic/lsi64854reg.h:1.6	Mon Apr 28 20:23:50 2008
+++ src/sys/dev/ic/lsi64854reg.h	Sun Mar 10 17:16:26 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: lsi64854reg.h,v 1.6 2008/04/28 20:23:50 martin Exp $ */
+/*	$NetBSD: lsi64854reg.h,v 1.7 2024/03/10 17:16:26 rillig Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@
 #define DDMACSR_BITS	"\177\020"\
 	"b\00INT\0b\01ERR\0f\02\02DRAINING\0b\04IEN\0"		\
 	"b\06SLVERR\0b\07RST\0b\10WRITE\0b\11ENDMA\0"		\
-	"b\15ENCNT\0b\16TC\0\b\20DSBL_CSR_DRN\0"		\
+	"b\15ENCNT\0b\16TC\0b\20DSBL_CSR_DRN\0"			\
 	"b\21DSBL_SCSI_DRN\0f\22\2BURST\0b\25TWOCYCLE\0"	\
 	"b\26FASTER\0b\27TCIDIS\0b\30ENNXT\0b\031DMAON\0"	\
 	"b\32ALOADED\0b\33NALOADED\0"
@@ -192,5 +192,5 @@
 #define PDMACSR_BITS	"\177\020"\
 	"b\00INT\0b\01ERR\0f\02\02DRAINING\0b\04IEN\0"		\
 	"b\06SLVERR\0b\07RST\0b\10WRITE\0b\11ENDMA\0"		\
-	"b\15ENCNT\0b\16TC\0\b\24DIAG\0b\27TCIDIS\0"		\
+	"b\15ENCNT\0b\16TC\0b\24DIAG\0b\27TCIDIS\0"		\
 	"b\30ENNXT\0b\031DMAON\0b\32ALOADED\0b\33NALOADED\0"



CVS commit: src/sys/dev/ic

2024-03-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 10 17:16:26 UTC 2024

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

Log Message:
lsi64854reg: fix snprintb formats DDMACSR_BITS and PDMACSR_BITS


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/lsi64854reg.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-03-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar 10 04:49:22 UTC 2024

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

Log Message:
nvme(4): don't write to INTMC register if in intx mode

this matches the handling of INTMS, both of which have the same
restrictions on access in MSI-X mode.

ideally, this register should be written to with a full set of
values for MSI (upto 32 bits), but trying to force MSI mode for
my test machine makes the system unstable.

tested with samsung SM981 256GB, samsung 980 PRO 1TB, and intel
760p 250G.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/ic/nvme.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/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.67 src/sys/dev/ic/nvme.c:1.68
--- src/sys/dev/ic/nvme.c:1.67	Tue Sep 13 10:14:20 2022
+++ src/sys/dev/ic/nvme.c	Sun Mar 10 04:49:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.67 2022/09/13 10:14:20 riastradh Exp $	*/
+/*	$NetBSD: nvme.c,v 1.68 2024/03/10 04:49:22 mrg Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.67 2022/09/13 10:14:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.68 2024/03/10 04:49:22 mrg Exp $");
 
 #include 
 #include 
@@ -620,7 +620,8 @@ nvme_resume(struct nvme_softc *sc)
 		}
 	}
 
-	nvme_write4(sc, NVME_INTMC, 1);
+	if (!sc->sc_use_mq)
+		nvme_write4(sc, NVME_INTMC, 1);
 
 	return 0;
 
@@ -2023,6 +2024,8 @@ nvme_intr(void *xsc)
 {
 	struct nvme_softc *sc = xsc;
 
+	KASSERT(!sc->sc_use_mq);
+
 	/*
 	 * INTx is level triggered, controller deasserts the interrupt only
 	 * when we advance command queue head via write to the doorbell.
@@ -2043,6 +2046,8 @@ nvme_softintr_intx(void *xq)
 	struct nvme_queue *q = xq;
 	struct nvme_softc *sc = q->q_sc;
 
+	KASSERT(!sc->sc_use_mq);
+
 	nvme_q_complete(sc, sc->sc_admin_q);
 	if (sc->sc_q != NULL)
 	nvme_q_complete(sc, sc->sc_q[0]);



CVS commit: src/sys/dev/ic

2024-03-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar 10 04:49:22 UTC 2024

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

Log Message:
nvme(4): don't write to INTMC register if in intx mode

this matches the handling of INTMS, both of which have the same
restrictions on access in MSI-X mode.

ideally, this register should be written to with a full set of
values for MSI (upto 32 bits), but trying to force MSI mode for
my test machine makes the system unstable.

tested with samsung SM981 256GB, samsung 980 PRO 1TB, and intel
760p 250G.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/ic/nvme.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-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 02:31:44 UTC 2024

Modified Files:
src/sys/dev/ic: mc146818.c mc146818var.h

Log Message:
Expose mc146818_{get,set}time_ymdhms() and allow a front-end to override
these function pointers in the TODR handle, allowing the front-end to
wrap mc146818_{get,set}time_ymdhms() with special handling, if needed.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/mc146818.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/mc146818var.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/mc146818.c
diff -u src/sys/dev/ic/mc146818.c:1.20 src/sys/dev/ic/mc146818.c:1.21
--- src/sys/dev/ic/mc146818.c:1.20	Wed Jan  1 19:24:03 2020
+++ src/sys/dev/ic/mc146818.c	Wed Mar  6 02:31:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mc146818.c,v 1.20 2020/01/01 19:24:03 thorpej Exp $	*/
+/*	$NetBSD: mc146818.c,v 1.21 2024/03/06 02:31:44 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2003 Izumi Tsutsui.  All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mc146818.c,v 1.20 2020/01/01 19:24:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mc146818.c,v 1.21 2024/03/06 02:31:44 thorpej Exp $");
 
 #include 
 #include 
@@ -43,9 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: mc146818.c,v
 #include 
 #include 
 
-int mc146818_gettime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
-int mc146818_settime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
-
 void
 mc146818_attach(struct mc146818_softc *sc)
 {
@@ -61,11 +58,14 @@ mc146818_attach(struct mc146818_softc *s
 
 	handle = >sc_handle;
 	handle->cookie = sc;
-	handle->todr_gettime = NULL;
-	handle->todr_settime = NULL;
-	handle->todr_gettime_ymdhms = mc146818_gettime_ymdhms;
-	handle->todr_settime_ymdhms = mc146818_settime_ymdhms;
-	handle->todr_setwen  = NULL;
+	KASSERT(handle->todr_gettime == NULL);
+	KASSERT(handle->todr_settime == NULL);
+	if (handle->todr_gettime_ymdhms == NULL) {
+		handle->todr_gettime_ymdhms = mc146818_gettime_ymdhms;
+	}
+	if (handle->todr_settime_ymdhms == NULL) {
+		handle->todr_settime_ymdhms = mc146818_settime_ymdhms;
+	}
 
 	todr_attach(handle);
 }
@@ -103,7 +103,7 @@ mc146818_gettime_ymdhms(todr_chip_handle
 	dt->dt_wday = FROMREG((*sc->sc_mcread)(sc, MC_DOW));
 	dt->dt_day  = FROMREG((*sc->sc_mcread)(sc, MC_DOM));
 	dt->dt_mon  = FROMREG((*sc->sc_mcread)(sc, MC_MONTH));
-	year   = FROMREG((*sc->sc_mcread)(sc, MC_YEAR));
+	year= FROMREG((*sc->sc_mcread)(sc, MC_YEAR));
 	if (sc->sc_getcent) {
 		cent = (*sc->sc_getcent)(sc);
 		year += cent * 100;

Index: src/sys/dev/ic/mc146818var.h
diff -u src/sys/dev/ic/mc146818var.h:1.7 src/sys/dev/ic/mc146818var.h:1.8
--- src/sys/dev/ic/mc146818var.h:1.7	Wed May 14 13:29:29 2008
+++ src/sys/dev/ic/mc146818var.h	Wed Mar  6 02:31:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mc146818var.h,v 1.7 2008/05/14 13:29:29 tsutsui Exp $	*/
+/*	$NetBSD: mc146818var.h,v 1.8 2024/03/06 02:31:44 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2003 Izumi Tsutsui.  All rights reserved.
@@ -24,6 +24,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef _DEV_IC_MC146818VAR_H_
+#define	_DEV_IC_MC146818VAR_H_
+
 struct mc146818_softc {
 	device_t sc_dev;
 
@@ -45,4 +48,8 @@ struct mc146818_softc {
 	void (*sc_setcent)(struct mc146818_softc *, u_int);
 };
 
-void mc146818_attach(struct mc146818_softc *);
+void	mc146818_attach(struct mc146818_softc *);
+int	mc146818_gettime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
+int	mc146818_settime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
+
+#endif /* _DEV_IC_MC146818VAR_H_ */



CVS commit: src/sys/dev/ic

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 02:31:44 UTC 2024

Modified Files:
src/sys/dev/ic: mc146818.c mc146818var.h

Log Message:
Expose mc146818_{get,set}time_ymdhms() and allow a front-end to override
these function pointers in the TODR handle, allowing the front-end to
wrap mc146818_{get,set}time_ymdhms() with special handling, if needed.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/mc146818.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/mc146818var.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-03-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Mar  3 10:09:42 UTC 2024

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

Log Message:
Reorder the bus_dmamap_sync sync operations

 BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD to
 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE

for consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/ic/dwc_gmac.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_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.84 src/sys/dev/ic/dwc_gmac.c:1.85
--- src/sys/dev/ic/dwc_gmac.c:1.84	Sun Mar  3 10:02:11 2024
+++ src/sys/dev/ic/dwc_gmac.c	Sun Mar  3 10:09:42 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.84 2024/03/03 10:02:11 skrll Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.85 2024/03/03 10:09:42 skrll Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.84 2024/03/03 10:02:11 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.85 2024/03/03 10:09:42 skrll Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -540,7 +540,7 @@ dwc_gmac_alloc_rx_ring(struct dwc_gmac_s
 
 	bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, 0,
 	AWGE_RX_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc),
-	BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
+	BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 	bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_RX_ADDR,
 	ring->r_physaddr);
 



CVS commit: src/sys/dev/ic

2024-03-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Mar  3 10:09:42 UTC 2024

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

Log Message:
Reorder the bus_dmamap_sync sync operations

 BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD to
 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE

for consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/ic/dwc_gmac.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-03-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Mar  3 10:02:11 UTC 2024

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

Log Message:
More KNF (whitespace around binary operators)


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/ic/dwc_gmac.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_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.83 src/sys/dev/ic/dwc_gmac.c:1.84
--- src/sys/dev/ic/dwc_gmac.c:1.83	Tue Feb 27 08:28:56 2024
+++ src/sys/dev/ic/dwc_gmac.c	Sun Mar  3 10:02:11 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.83 2024/02/27 08:28:56 skrll Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.84 2024/03/03 10:02:11 skrll Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.83 2024/02/27 08:28:56 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.84 2024/03/03 10:02:11 skrll Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -718,20 +718,20 @@ dwc_gmac_txdesc_sync(struct dwc_gmac_sof
 	if (end > start) {
 		bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map,
 		TX_DESC_OFFSET(start),
-		TX_DESC_OFFSET(end)-TX_DESC_OFFSET(start),
+		TX_DESC_OFFSET(end) - TX_DESC_OFFSET(start),
 		ops);
 		return;
 	}
 	/* sync from 'start' to end of ring */
 	bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map,
 	TX_DESC_OFFSET(start),
-	TX_DESC_OFFSET(AWGE_TX_RING_COUNT)-TX_DESC_OFFSET(start),
+	TX_DESC_OFFSET(AWGE_TX_RING_COUNT) - TX_DESC_OFFSET(start),
 	ops);
 	if (TX_DESC_OFFSET(end) - TX_DESC_OFFSET(0) > 0) {
 		/* sync from start of ring to 'end' */
 		bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map,
 		TX_DESC_OFFSET(0),
-		TX_DESC_OFFSET(end)-TX_DESC_OFFSET(0),
+		TX_DESC_OFFSET(end) - TX_DESC_OFFSET(0),
 		ops);
 	}
 }



CVS commit: src/sys/dev/ic

2024-03-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Mar  3 10:02:11 UTC 2024

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

Log Message:
More KNF (whitespace around binary operators)


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/ic/dwc_gmac.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-02-29 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Feb 29 22:02:41 UTC 2024

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

Log Message:
Fix couple typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/mpc106reg.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/mpc106reg.h
diff -u src/sys/dev/ic/mpc106reg.h:1.4 src/sys/dev/ic/mpc106reg.h:1.5
--- src/sys/dev/ic/mpc106reg.h:1.4	Mon Apr 28 20:23:50 2008
+++ src/sys/dev/ic/mpc106reg.h	Thu Feb 29 22:02:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpc106reg.h,v 1.4 2008/04/28 20:23:50 martin Exp $	*/
+/*	$NetBSD: mpc106reg.h,v 1.5 2024/02/29 22:02:41 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2001,2007 The NetBSD Foundation, Inc.
@@ -86,7 +86,7 @@
 	/* must be read with MPC106_PICR1_EXT_L2_EN :
 	 * L2_EN	L2_MP	Meaning
 	 * 0		00	Uniprocessor/none
-	 * 0		01	internal conrol/write-through
+	 * 0		01	internal control/write-through
 	 * 0		10	internal control/write-back
 	 * 0		11	Multiproc/none
 	 * 1		00	Uniprocessor/external L2
@@ -185,7 +185,7 @@
 #define  MPC106_MCRR2_EXT_ECM_ECC_EN	__BIT(18) /* ext. ECM ECC enable */
 #define  MPC106_MCRR2_ECC_EN	__BIT(17)	/* ECC enable */
 #define  MPC106_MCRR2_EDO	__BIT(16)	/* EDO enable */
-#define  MPC106_MCRR2_REFINT	__BITS(15,2)	/* refreash interval */
+#define  MPC106_MCRR2_REFINT	__BITS(15,2)	/* refresh interval */
 #define  MPC106_MCRR2_BUFMODE	__BIT(1)	/* buffer mode */
 #define  MPC106_MCRR2_RMW_PAR	__BIT(0)	/* RMW parity enable */
 #define	MPC106_MCCR3		0xf8	/* Memory control configuration 3 */



CVS commit: src/sys/dev/ic

2024-02-29 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Feb 29 22:02:41 UTC 2024

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

Log Message:
Fix couple typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/mpc106reg.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-02-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 27 08:33:07 UTC 2024

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

Log Message:
Use __BIT.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/dwc_gmac_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_gmac_var.h
diff -u src/sys/dev/ic/dwc_gmac_var.h:1.18 src/sys/dev/ic/dwc_gmac_var.h:1.19
--- src/sys/dev/ic/dwc_gmac_var.h:1.18	Sun Feb 11 12:25:20 2024
+++ src/sys/dev/ic/dwc_gmac_var.h	Tue Feb 27 08:33:06 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac_var.h,v 1.18 2024/02/11 12:25:20 skrll Exp $ */
+/* $NetBSD: dwc_gmac_var.h,v 1.19 2024/02/27 08:33:06 skrll Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -108,7 +108,7 @@ struct dwc_gmac_softc {
 	bus_space_handle_t sc_bsh;
 	bus_dma_tag_t sc_dmat;
 	uint32_t sc_flags;
-#define	DWC_GMAC_FORCE_THRESH_DMA_MODE	0x01	/* force DMA to use threshold mode */
+#define	DWC_GMAC_FORCE_THRESH_DMA_MODE	__BIT(0)/* force DMA to use threshold mode */
 	struct ethercom sc_ec;
 	struct mii_data sc_mii;
 	kmutex_t sc_mdio_lock;



CVS commit: src/sys/dev/ic

2024-02-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 27 08:33:07 UTC 2024

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

Log Message:
Use __BIT.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/dwc_gmac_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-02-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 27 08:28:56 UTC 2024

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

Log Message:
Enforce the device 32 bit DMA limitation via bus_dmatag_subregion if bus
can address more than 4GB.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/ic/dwc_gmac.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_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.82 src/sys/dev/ic/dwc_gmac.c:1.83
--- src/sys/dev/ic/dwc_gmac.c:1.82	Tue Feb 27 08:25:38 2024
+++ src/sys/dev/ic/dwc_gmac.c	Tue Feb 27 08:28:56 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.82 2024/02/27 08:25:38 skrll Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.83 2024/02/27 08:28:56 skrll Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.82 2024/02/27 08:25:38 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.83 2024/02/27 08:28:56 skrll Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -245,6 +245,17 @@ dwc_gmac_attach(struct dwc_gmac_softc *s
 		aprint_normal_dev(sc->sc_dev,
 		"HW feature mask: %x\n", hwft);
 	}
+
+	if (sizeof(bus_addr_t) > 4) {
+		int error = bus_dmatag_subregion(sc->sc_dmat, 0, __MASK(32),
+		>sc_dmat, BUS_DMA_WAITOK);
+		if (error != 0) {
+			aprint_error_dev(sc->sc_dev,
+			"failed to create DMA subregion\n");
+			return ENOMEM;
+		}
+	}
+
 	if (hwft & GMAC_DMA_FEAT_ENHANCED_DESC) {
 		aprint_normal_dev(sc->sc_dev,
 		"Using enhanced descriptor format\n");



CVS commit: src/sys/dev/ic

2024-02-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 27 08:28:56 UTC 2024

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

Log Message:
Enforce the device 32 bit DMA limitation via bus_dmatag_subregion if bus
can address more than 4GB.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/ic/dwc_gmac.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-02-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 27 08:25:38 UTC 2024

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

Log Message:
KNF - spaces around binary operators.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/ic/dwc_gmac.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_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.81 src/sys/dev/ic/dwc_gmac.c:1.82
--- src/sys/dev/ic/dwc_gmac.c:1.81	Sun Feb 11 12:28:20 2024
+++ src/sys/dev/ic/dwc_gmac.c	Tue Feb 27 08:25:38 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.81 2024/02/11 12:28:20 skrll Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.82 2024/02/27 08:25:38 skrll Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.81 2024/02/11 12:28:20 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.82 2024/02/27 08:25:38 skrll Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -147,12 +147,12 @@ static const struct dwc_gmac_desc_method
 };
 
 
-#define	TX_DESC_OFFSET(N)	((AWGE_RX_RING_COUNT+(N)) \
-*sizeof(struct dwc_gmac_dev_dmadesc))
-#define	TX_NEXT(N)		(((N)+1) & (AWGE_TX_RING_COUNT-1))
+#define	TX_DESC_OFFSET(N)	((AWGE_RX_RING_COUNT + (N)) \
+* sizeof(struct dwc_gmac_dev_dmadesc))
+#define	TX_NEXT(N)		(((N) + 1) & (AWGE_TX_RING_COUNT - 1))
 
-#define RX_DESC_OFFSET(N)	((N)*sizeof(struct dwc_gmac_dev_dmadesc))
-#define	RX_NEXT(N)		(((N)+1) & (AWGE_RX_RING_COUNT-1))
+#define RX_DESC_OFFSET(N)	((N) * sizeof(struct dwc_gmac_dev_dmadesc))
+#define	RX_NEXT(N)		(((N) + 1) & (AWGE_RX_RING_COUNT - 1))
 
 
 
@@ -528,7 +528,7 @@ dwc_gmac_alloc_rx_ring(struct dwc_gmac_s
 	}
 
 	bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, 0,
-	AWGE_RX_RING_COUNT*sizeof(struct dwc_gmac_dev_dmadesc),
+	AWGE_RX_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc),
 	BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
 	bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_RX_ADDR,
 	ring->r_physaddr);
@@ -558,7 +558,7 @@ dwc_gmac_reset_rx_ring(struct dwc_gmac_s
 	}
 
 	bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, 0,
-	AWGE_RX_RING_COUNT*sizeof(struct dwc_gmac_dev_dmadesc),
+	AWGE_RX_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc),
 	BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
 	ring->r_cur = ring->r_next = 0;
@@ -616,7 +616,7 @@ dwc_gmac_alloc_dma_rings(struct dwc_gmac
 	/* and next rings to the TX side */
 	sc->sc_txq.t_desc = sc->sc_rxq.r_desc + AWGE_RX_RING_COUNT;
 	sc->sc_txq.t_physaddr = sc->sc_rxq.r_physaddr +
-	AWGE_RX_RING_COUNT*sizeof(struct dwc_gmac_dev_dmadesc);
+	AWGE_RX_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc);
 
 	return 0;
 
@@ -652,7 +652,7 @@ dwc_gmac_free_rx_ring(struct dwc_gmac_so
 		if (data->rd_map != NULL) {
 			bus_dmamap_sync(sc->sc_dmat, data->rd_map, 0,
 			AWGE_RX_RING_COUNT
-*sizeof(struct dwc_gmac_dev_dmadesc),
+* sizeof(struct dwc_gmac_dev_dmadesc),
 			BUS_DMASYNC_POSTREAD);
 			bus_dmamap_unload(sc->sc_dmat, data->rd_map);
 			bus_dmamap_destroy(sc->sc_dmat, data->rd_map);
@@ -671,10 +671,10 @@ dwc_gmac_alloc_tx_ring(struct dwc_gmac_s
 	ring->t_queued = 0;
 	ring->t_cur = ring->t_next = 0;
 
-	memset(ring->t_desc, 0, AWGE_TX_RING_COUNT*sizeof(*ring->t_desc));
+	memset(ring->t_desc, 0, AWGE_TX_RING_COUNT * sizeof(*ring->t_desc));
 	bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map,
 	TX_DESC_OFFSET(0),
-	AWGE_TX_RING_COUNT*sizeof(struct dwc_gmac_dev_dmadesc),
+	AWGE_TX_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc),
 	BUS_DMASYNC_POSTWRITE);
 
 	for (i = 0; i < AWGE_TX_RING_COUNT; i++) {
@@ -747,7 +747,7 @@ dwc_gmac_reset_tx_ring(struct dwc_gmac_s
 
 	bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map,
 	TX_DESC_OFFSET(0),
-	AWGE_TX_RING_COUNT*sizeof(struct dwc_gmac_dev_dmadesc),
+	AWGE_TX_RING_COUNT * sizeof(struct dwc_gmac_dev_dmadesc),
 	BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 	bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_TX_ADDR,
 	sc->sc_txq.t_physaddr);
@@ -1179,11 +1179,11 @@ dwc_gmac_tx_intr(struct dwc_gmac_softc *
 #endif
 
 		/*
-		 * i+1 does not need to be a valid descriptor,
+		 * i + 1 does not need to be a valid descriptor,
 		 * this is just a special notion to just sync
 		 * a single tx descriptor (i)
 		 */
-		dwc_gmac_txdesc_sync(sc, i, i+1,
+		dwc_gmac_txdesc_sync(sc, i, i + 1,
 		BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 
 		desc = >sc_txq.t_desc[i];
@@ -1651,7 +1651,7 @@ dwc_gmac_dump_tx_desc(struct dwc_gmac_so
 		aprint_normal("#%d (%08lx): status: %08x cntl: %08x "
 		"data: %08x next: %08x\n",
 		i, sc->sc_txq.t_physaddr +
-			i*sizeof(struct dwc_gmac_dev_dmadesc),
+			i * sizeof(struct dwc_gmac_dev_dmadesc),
 		le32toh(desc->ddesc_status0), le32toh(desc->ddesc_cntl1),
 		le32toh(desc->ddesc_data), le32toh(desc->ddesc_next));
 	}
@@ 

CVS commit: src/sys/dev/ic

2024-02-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 27 08:25:38 UTC 2024

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

Log Message:
KNF - spaces around binary operators.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/ic/dwc_gmac.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-02-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 27 08:21:24 UTC 2024

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

Log Message:
Remove unused "SHIFT" defines. The "MASK" versions exist.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ic/dwc_gmac_reg.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_gmac_reg.h
diff -u src/sys/dev/ic/dwc_gmac_reg.h:1.21 src/sys/dev/ic/dwc_gmac_reg.h:1.22
--- src/sys/dev/ic/dwc_gmac_reg.h:1.21	Wed May 11 14:58:01 2022
+++ src/sys/dev/ic/dwc_gmac_reg.h	Tue Feb 27 08:21:24 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac_reg.h,v 1.21 2022/05/11 14:58:01 andvar Exp $ */
+/* $NetBSD: dwc_gmac_reg.h,v 1.22 2024/02/27 08:21:24 skrll Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -133,9 +133,7 @@
 #define	AWIN_GMAC_DMA_CUR_RX_BUFADDR	0x1054
 #define	AWIN_GMAC_DMA_HWFEATURES	0x1058	/* not always implemented? */
 
-#define	GMAC_MII_PHY_SHIFT		11
 #define	GMAC_MII_PHY_MASK		__BITS(15,11)
-#define	GMAC_MII_REG_SHIFT		6
 #define	GMAC_MII_REG_MASK		__BITS(10,6)
 
 #define	GMAC_MII_BUSY			__BIT(0)
@@ -221,7 +219,6 @@ struct dwc_gmac_dev_dmadesc {
 /* for RX descriptors */
 #define	DDESC_STATUS_DAFILTERFAIL	__BIT(30)
 #define	DDESC_STATUS_FRMLENMSK		__BITS(29,16)
-#define	DDESC_STATUS_FRMLENSHIFT	16
 #define	DDESC_STATUS_RXERROR		__BIT(15)
 #define	DDESC_STATUS_RXTRUNCATED	__BIT(14)
 #define	DDESC_STATUS_SAFILTERFAIL	__BIT(13)



CVS commit: src/sys/dev/ic

2024-02-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 27 08:21:24 UTC 2024

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

Log Message:
Remove unused "SHIFT" defines. The "MASK" versions exist.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ic/dwc_gmac_reg.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-02-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Feb 19 14:54:04 UTC 2024

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

Log Message:
ciss(4): Fix panic when the number of logical drive is zero.

 Currently, this drives requires at least one logical drive.
If there is no any logical volume, don't attach the driver.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/ic/ciss.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/ciss.c
diff -u src/sys/dev/ic/ciss.c:1.55 src/sys/dev/ic/ciss.c:1.56
--- src/sys/dev/ic/ciss.c:1.55	Thu Aug 17 14:19:50 2023
+++ src/sys/dev/ic/ciss.c	Mon Feb 19 14:54:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ciss.c,v 1.55 2023/08/17 14:19:50 andvar Exp $	*/
+/*	$NetBSD: ciss.c,v 1.56 2024/02/19 14:54:04 msaitoh Exp $	*/
 /*	$OpenBSD: ciss.c,v 1.68 2013/05/30 16:15:02 deraadt Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.55 2023/08/17 14:19:50 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.56 2024/02/19 14:54:04 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -427,6 +427,14 @@ ciss_attach(struct ciss_softc *sc)
 
 	mutex_exit(>sc_mutex_scratch);
 
+	if (sc->maxunits == 0) {
+		bus_dmamem_free(sc->sc_dmat, sc->cmdseg, 1);
+		bus_dmamap_destroy(sc->sc_dmat, sc->cmdmap);
+		aprint_error_dev(sc->sc_dev,
+		"No any LD. This driver can't attach.\n");
+		return -1;
+	}
+
 	callout_init(>sc_hb, 0);
 	callout_setfunc(>sc_hb, ciss_heartbeat, sc);
 	callout_schedule(>sc_hb, hz * 3);



CVS commit: src/sys/dev/ic

2024-02-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Feb 19 14:54:04 UTC 2024

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

Log Message:
ciss(4): Fix panic when the number of logical drive is zero.

 Currently, this drives requires at least one logical drive.
If there is no any logical volume, don't attach the driver.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/ic/ciss.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-02-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 13 13:17:51 UTC 2024

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

Log Message:
in sti_screen_setup() don't bother looking for fonts if STI_FBMODE is requested


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 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.34 src/sys/dev/ic/sti.c:1.35
--- src/sys/dev/ic/sti.c:1.34	Thu Feb  1 06:50:36 2024
+++ src/sys/dev/ic/sti.c	Tue Feb 13 13:17:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.34 2024/02/01 06:50:36 skrll Exp $	*/
+/*	$NetBSD: sti.c,v 1.35 2024/02/13 13:17:51 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.34 2024/02/01 06:50:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.35 2024/02/13 13:17:51 macallan Exp $");
 
 #include "wsdisplay.h"
 
@@ -556,6 +556,12 @@ sti_screen_setup(struct sti_screen *scr,
 	scr->owidth = cfg.owidth;
 	memcpy(scr->name, cfg.name, sizeof(scr->name));
 
+	if (flags & STI_FBMODE) {
+		/* we're done here */
+		sti_init(scr, STI_FBMODE);
+		return 0;
+	}
+
 	if ((error = sti_init(scr, STI_TEXTMODE | flags))) {
 		aprint_error(": cannot initialize (%d)\n", error);
 		goto fail;



CVS commit: src/sys/dev/ic

2024-02-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 13 13:17:51 UTC 2024

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

Log Message:
in sti_screen_setup() don't bother looking for fonts if STI_FBMODE is requested


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 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-02-11 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb 11 12:28:20 UTC 2024

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

Log Message:
Fix spello in debug output


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/ic/dwc_gmac.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_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.80 src/sys/dev/ic/dwc_gmac.c:1.81
--- src/sys/dev/ic/dwc_gmac.c:1.80	Wed Dec 20 18:09:19 2023
+++ src/sys/dev/ic/dwc_gmac.c	Sun Feb 11 12:28:20 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.80 2023/12/20 18:09:19 skrll Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.81 2024/02/11 12:28:20 skrll Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.80 2023/12/20 18:09:19 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.81 2024/02/11 12:28:20 skrll Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -1052,7 +1052,7 @@ dwc_gmac_queue(struct dwc_gmac_softc *sc
 		desc->ddesc_data = htole32(map->dm_segs[i].ds_addr);
 
 #ifdef DWC_GMAC_DEBUG
-		aprint_normal_dev(sc->sc_dev, "enqueing desc #%d data %08lx "
+		aprint_normal_dev(sc->sc_dev, "enqueuing desc #%d data %08lx "
 		"len %lu\n", sc->sc_txq.t_cur,
 		(unsigned long)map->dm_segs[i].ds_addr,
 		(unsigned long)map->dm_segs[i].ds_len);



CVS commit: src/sys/dev/ic

2024-02-11 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb 11 12:28:20 UTC 2024

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

Log Message:
Fix spello in debug output


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/ic/dwc_gmac.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-02-11 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb 11 12:25:20 UTC 2024

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

Log Message:
Fix a comment. arm32 stopped using 8K pages a long time ago.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/dwc_gmac_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_gmac_var.h
diff -u src/sys/dev/ic/dwc_gmac_var.h:1.17 src/sys/dev/ic/dwc_gmac_var.h:1.18
--- src/sys/dev/ic/dwc_gmac_var.h:1.17	Sun Sep 18 18:26:53 2022
+++ src/sys/dev/ic/dwc_gmac_var.h	Sun Feb 11 12:25:20 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac_var.h,v 1.17 2022/09/18 18:26:53 thorpej Exp $ */
+/* $NetBSD: dwc_gmac_var.h,v 1.18 2024/02/11 12:25:20 skrll Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -45,12 +45,9 @@
 #endif
 
 /*
- * We could use 1024 DMA descriptors to fill up an 8k page (each is 16 byte).
- * However, on TX we probably will not need that many, and on RX we allocate
- * a full mbuf cluster for each, so secondary memory consumption will grow
- * rapidly.
- * So currently we waste half a page of dma memory and consume 512k Byte of
- * RAM for mbuf clusters.
+ * Rx and Tx Ring counts that map into single 4K page with 16byte descriptor
+ * size. For Rx a full mbuf cluster is allocated for each which consumes
+ * around 512k Byte of RAM for mbuf clusters.
  * XXX Maybe fine-tune later, or reconsider unsharing of RX/TX dmamap.
  */
 #define		AWGE_RX_RING_COUNT	256



CVS commit: src/sys/dev/ic

2024-02-11 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb 11 12:25:20 UTC 2024

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

Log Message:
Fix a comment. arm32 stopped using 8K pages a long time ago.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/dwc_gmac_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-02-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Feb 10 15:55:00 UTC 2024

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

Log Message:
Fix an error message by removing an extra 'x'


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 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.35 src/sys/dev/ic/dwc_eqos.c:1.36
--- src/sys/dev/ic/dwc_eqos.c:1.35	Sun Dec 24 16:12:55 2023
+++ src/sys/dev/ic/dwc_eqos.c	Sat Feb 10 15:55:00 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.35 2023/12/24 16:12:55 skrll Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.36 2024/02/10 15:55:00 skrll Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.35 2023/12/24 16:12:55 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.36 2024/02/10 15:55:00 skrll Exp $");
 
 #include 
 #include 
@@ -1467,7 +1467,7 @@ eqos_attach(struct eqos_softc *sc)
 	snpsver = ver & GMAC_MAC_VERSION_SNPSVER_MASK;
 
 	if ((snpsver < 0x51) || (snpsver > 0x52)) {
-		aprint_error(": EQOS version 0x%02xx not supported\n",
+		aprint_error(": EQOS version 0x%02x not supported\n",
 		snpsver);
 		return ENXIO;
 	}



CVS commit: src/sys/dev/ic

2024-02-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Feb 10 15:55:00 UTC 2024

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

Log Message:
Fix an error message by removing an extra 'x'


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 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-02-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  9 16:57:11 UTC 2024

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

Log Message:
Fix a typo in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ic/dwc_mmc.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-02-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  9 16:57:11 UTC 2024

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

Log Message:
Fix a typo in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ic/dwc_mmc.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_mmc.c
diff -u src/sys/dev/ic/dwc_mmc.c:1.29 src/sys/dev/ic/dwc_mmc.c:1.30
--- src/sys/dev/ic/dwc_mmc.c:1.29	Sun Jan  9 15:03:43 2022
+++ src/sys/dev/ic/dwc_mmc.c	Fri Feb  9 16:57:11 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc.c,v 1.29 2022/01/09 15:03:43 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc.c,v 1.30 2024/02/09 16:57:11 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.29 2022/01/09 15:03:43 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.30 2024/02/09 16:57:11 skrll Exp $");
 
 #include 
 #include 
@@ -477,7 +477,7 @@ dwc_mmc_dma_prepare(struct dwc_mmc_softc
 	uint32_t val;
 
 	/*
-	 * If the command includs a dma map use it, otherwise we need to
+	 * If the command includes a dma map use it, otherwise we need to
 	 * bounce. This can happen for SDIO IO_RW_EXTENDED (CMD53) commands.
 	 */
 	if (cmd->c_dmamap) {



CVS commit: src/sys/dev/ic

2024-02-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  9 16:56:23 UTC 2024

Modified Files:
src/sys/dev/ic: dw_hdmi.c dwiic.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/dw_hdmi.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/dwiic.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/dw_hdmi.c
diff -u src/sys/dev/ic/dw_hdmi.c:1.11 src/sys/dev/ic/dw_hdmi.c:1.12
--- src/sys/dev/ic/dw_hdmi.c:1.11	Mon Dec 11 13:29:03 2023
+++ src/sys/dev/ic/dw_hdmi.c	Fri Feb  9 16:56:23 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dw_hdmi.c,v 1.11 2023/12/11 13:29:03 mlelstv Exp $ */
+/* $NetBSD: dw_hdmi.c,v 1.12 2024/02/09 16:56:23 skrll Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.11 2023/12/11 13:29:03 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.12 2024/02/09 16:56:23 skrll Exp $");
 
 #include 
 #include 
@@ -531,7 +531,7 @@ dwhdmi_audio_init(struct dwhdmi_softc *s
 	val &= ~HDMI_AUD_CONF0_I2S_IN_EN;
 	val |= __SHIFTIN(1, HDMI_AUD_CONF0_I2S_IN_EN);	/* XXX 2ch */
 	dwhdmi_write(sc, HDMI_AUD_CONF0, val);
-	
+
 	val = __SHIFTIN(16, HDMI_AUD_CONF1_I2S_WIDTH);
 	dwhdmi_write(sc, HDMI_AUD_CONF1, val);
 

Index: src/sys/dev/ic/dwiic.c
diff -u src/sys/dev/ic/dwiic.c:1.9 src/sys/dev/ic/dwiic.c:1.10
--- src/sys/dev/ic/dwiic.c:1.9	Wed Oct 19 22:34:10 2022
+++ src/sys/dev/ic/dwiic.c	Fri Feb  9 16:56:23 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dwiic.c,v 1.9 2022/10/19 22:34:10 riastradh Exp $ */
+/* $NetBSD: dwiic.c,v 1.10 2024/02/09 16:56:23 skrll Exp $ */
 
 /* $OpenBSD: dwiic.c,v 1.4 2018/05/23 22:08:00 kettenis Exp $ */
 
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwiic.c,v 1.9 2022/10/19 22:34:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwiic.c,v 1.10 2024/02/09 16:56:23 skrll Exp $");
 
 #include 
 
@@ -163,7 +163,7 @@ dwiic_attach(struct dwiic_softc *sc)
 	}
 
 	/* fetch timing parameters */
-	if (sc->ss_hcnt == 0) 
+	if (sc->ss_hcnt == 0)
 		sc->ss_hcnt = dwiic_read(sc, DW_IC_SS_SCL_HCNT);
 	if (sc->ss_lcnt == 0)
 		sc->ss_lcnt = dwiic_read(sc, DW_IC_SS_SCL_LCNT);



CVS commit: src/sys/dev/ic

2024-02-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  9 16:56:23 UTC 2024

Modified Files:
src/sys/dev/ic: dw_hdmi.c dwiic.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/dw_hdmi.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/dwiic.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-02-02 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Feb  2 22:43:12 UTC 2024

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

Log Message:
s/maintenace/maintenance/ in command status code description.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/aac_tables.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/aac_tables.h
diff -u src/sys/dev/ic/aac_tables.h:1.5 src/sys/dev/ic/aac_tables.h:1.6
--- src/sys/dev/ic/aac_tables.h:1.5	Tue Jun  5 04:04:14 2007
+++ src/sys/dev/ic/aac_tables.h	Fri Feb  2 22:43:12 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: aac_tables.h,v 1.5 2007/06/05 04:04:14 briggs Exp $	*/
+/*	$NetBSD: aac_tables.h,v 1.6 2024/02/02 22:43:12 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2000 Michael Smith
@@ -73,7 +73,7 @@ const struct aac_code_lookup aac_command
 	{ "bad type",10007 },
 	{ "jukebox",10008 },
 	{ "not mounted",			10009 },
-	{ "in maintenace mode",			10010 },
+	{ "in maintenance mode",		10010 },
 	{ "stale ACL",10011 },
 	{ NULL, 0 },
 	{ "unknown command status",		0 }



CVS commit: src/sys/dev/ic

2024-02-02 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Feb  2 22:43:12 UTC 2024

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

Log Message:
s/maintenace/maintenance/ in command status code description.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/aac_tables.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-02-02 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Feb  2 22:23:54 UTC 2024

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

Log Message:
s/tranceiver/transceiver/ in comment and definition.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/dp8390var.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-02-02 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Feb  2 22:23:54 UTC 2024

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

Log Message:
s/tranceiver/transceiver/ in comment and definition.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/dp8390var.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/dp8390var.h
diff -u src/sys/dev/ic/dp8390var.h:1.36 src/sys/dev/ic/dp8390var.h:1.37
--- src/sys/dev/ic/dp8390var.h:1.36	Mon Aug  9 20:49:10 2021
+++ src/sys/dev/ic/dp8390var.h	Fri Feb  2 22:23:53 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: dp8390var.h,v 1.36 2021/08/09 20:49:10 andvar Exp $	*/
+/*	$NetBSD: dp8390var.h,v 1.37 2024/02/02 22:23:53 andvar Exp $	*/
 
 /*
  * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@@ -110,9 +110,9 @@ struct dp8390_softc {
  * Compile-time config flags
  */
 /*
- * This sets the default for enabling/disabling the tranceiver.
+ * This sets the default for enabling/disabling the transceiver.
  */
-#define DP8390_DISABLE_TRANCEIVER	0x0001
+#define DP8390_DISABLE_TRANSCEIVER	0x0001
 
 /*
  * This forces the board to be used in 8/16-bit mode even if it autoconfigs



CVS commit: src/sys/dev/ic

2024-01-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  1 06:50:36 UTC 2024

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 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.33 src/sys/dev/ic/sti.c:1.34
--- src/sys/dev/ic/sti.c:1.33	Thu Feb  1 02:41:56 2024
+++ src/sys/dev/ic/sti.c	Thu Feb  1 06:50:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.33 2024/02/01 02:41:56 gutteridge Exp $	*/
+/*	$NetBSD: sti.c,v 1.34 2024/02/01 06:50:36 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.33 2024/02/01 02:41:56 gutteridge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.34 2024/02/01 06:50:36 skrll Exp $");
 
 #include "wsdisplay.h"
 
@@ -933,8 +933,8 @@ sti_init(struct sti_screen *scr, int mod
 		a.in.text_planes = 1;
 	} else {
 		a.flags.flags |= STI_INITF_TEXT | STI_INITF_NTEXT;
-		/* 
-		 * Request as many text planes as STI will allow. 
+		/*
+		 * Request as many text planes as STI will allow.
 		 * The reason to do this - when switching to framebuffer mode
 		 * for X we need access to all planes. In theory STI should do
 		 * just that when we request access to both text and non-text



CVS commit: src/sys/dev/ic

2024-01-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  1 06:50:36 UTC 2024

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 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-01-31 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Thu Feb  1 02:41:56 UTC 2024

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

Log Message:
sti.c: fix a typo in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 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.32 src/sys/dev/ic/sti.c:1.33
--- src/sys/dev/ic/sti.c:1.32	Wed Jan 31 08:15:00 2024
+++ src/sys/dev/ic/sti.c	Thu Feb  1 02:41:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.32 2024/01/31 08:15:00 macallan Exp $	*/
+/*	$NetBSD: sti.c,v 1.33 2024/02/01 02:41:56 gutteridge 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.32 2024/01/31 08:15:00 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.33 2024/02/01 02:41:56 gutteridge Exp $");
 
 #include "wsdisplay.h"
 
@@ -934,7 +934,7 @@ sti_init(struct sti_screen *scr, int mod
 	} else {
 		a.flags.flags |= STI_INITF_TEXT | STI_INITF_NTEXT;
 		/* 
-		 * Request as many text palnes as STI will allow. 
+		 * Request as many text planes as STI will allow. 
 		 * The reason to do this - when switching to framebuffer mode
 		 * for X we need access to all planes. In theory STI should do
 		 * just that when we request access to both text and non-text



CVS commit: src/sys/dev/ic

2024-01-31 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Thu Feb  1 02:41:56 UTC 2024

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

Log Message:
sti.c: fix a typo in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 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-01-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 31 08:15:00 UTC 2024

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

Log Message:
Make this work properly on PCI Visualize EG:
- use bus_space_*_stream() for all register accesses in order to avoid
  byte order conversion on PCI devices
- when switching to framebuffer mode, request as many text planes as STI allows
- request access to both text and non-text planes in fb mode
With this and the bus_space commit a few days ago I have usable X on my C360
and a PCI Visualize EG.
This needs testing on quite literally everything else.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 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-01-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 31 08:15:00 UTC 2024

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

Log Message:
Make this work properly on PCI Visualize EG:
- use bus_space_*_stream() for all register accesses in order to avoid
  byte order conversion on PCI devices
- when switching to framebuffer mode, request as many text planes as STI allows
- request access to both text and non-text planes in fb mode
With this and the bus_space commit a few days ago I have usable X on my C360
and a PCI Visualize EG.
This needs testing on quite literally everything else.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 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.31 src/sys/dev/ic/sti.c:1.32
--- src/sys/dev/ic/sti.c:1.31	Sat Aug  7 16:19:12 2021
+++ src/sys/dev/ic/sti.c	Wed Jan 31 08:15:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.31 2021/08/07 16:19:12 thorpej Exp $	*/
+/*	$NetBSD: sti.c,v 1.32 2024/01/31 08:15:00 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.31 2021/08/07 16:19:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.32 2024/01/31 08:15:00 macallan Exp $");
 
 #include "wsdisplay.h"
 
@@ -926,17 +926,30 @@ sti_init(struct sti_screen *scr, int mod
 	KASSERT(rom != NULL);
 	memset(, 0, sizeof(a));
 
-	a.flags.flags = STI_INITF_WAIT | STI_INITF_EBET;
+	a.flags.flags = STI_INITF_WAIT | STI_INITF_PBET | STI_INITF_PBETI;
 	if ((mode & STI_TEXTMODE) != 0) {
 		a.flags.flags |= STI_INITF_TEXT | STI_INITF_CMB |
 		STI_INITF_PBET | STI_INITF_PBETI | STI_INITF_ICMT;
+		a.in.text_planes = 1;
 	} else {
-		a.flags.flags |= STI_INITF_NTEXT;
+		a.flags.flags |= STI_INITF_TEXT | STI_INITF_NTEXT;
+		/* 
+		 * Request as many text palnes as STI will allow. 
+		 * The reason to do this - when switching to framebuffer mode
+		 * for X we need access to all planes. In theory STI should do
+		 * just that when we request access to both text and non-text
+		 * planes as above.
+		 * In reality though, at least on my PCI Visualize EG, some
+		 * planes and/or colour registers remain inaccessible if we
+		 * request only one text plane.
+		 * Clearly we're missing a register write or two here, but so
+		 * far I haven't found it.
+		 */
+		a.in.text_planes = 3;
 	}
 	if ((mode & STI_CLEARSCR) != 0)
 		a.flags.flags |= STI_INITF_CLEAR;
 
-	a.in.text_planes = 1;
 	a.in.ext_in = 
 
 	DPRINTF(("%s: init,%p(%x, %p, %p, %p)\n",
@@ -1060,7 +1073,7 @@ sti_ioctl(void *v, void *vs, u_long cmd,
 			break;
 		case WSDISPLAYIO_MODE_DUMBFB:
 			if (scr->scr_wsmode != WSDISPLAYIO_MODE_DUMBFB) {
-sti_init(scr, 0);
+ret = sti_init(scr, 0);
 if (scr->setupfb != NULL)
 	scr->setupfb(scr);
 else
@@ -1487,7 +1500,7 @@ void	ngle_setup_attr_planes(struct sti_s
 void	ngle_setup_bt458(struct sti_screen *scr);
 
 #define	ngle_bt458_write(memt, memh, r, v) \
-	bus_space_write_4(memt, memh, NGLE_REG_RAMDAC + ((r) << 2), (v) << 24)
+	bus_space_write_stream_4(memt, memh, NGLE_REG_RAMDAC + ((r) << 2), (v) << 24)
 
 void
 ngle_artist_setupfb(struct sti_screen *scr)
@@ -1504,10 +1517,10 @@ ngle_artist_setupfb(struct sti_screen *s
 	ngle_setup_attr_planes(scr);
 
 	ngle_setup_hw(memt, memh);
-	bus_space_write_4(memt, memh, NGLE_REG_21,
-	bus_space_read_4(memt, memh, NGLE_REG_21) | 0x0a00);
-	bus_space_write_4(memt, memh, NGLE_REG_27,
-	bus_space_read_4(memt, memh, NGLE_REG_27) | 0x0080);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_21,
+	bus_space_read_stream_4(memt, memh, NGLE_REG_21) | 0x0a00);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_27,
+	bus_space_read_stream_4(memt, memh, NGLE_REG_27) | 0x0080);
 }
 
 void
@@ -1566,19 +1579,19 @@ ngle_setup_attr_planes(struct sti_screen
 	bus_space_handle_t memh = rom->regh[2];
 
 	ngle_setup_hw(memt, memh);
-	bus_space_write_4(memt, memh, NGLE_REG_11, 0x2ea0d000);
-	bus_space_write_4(memt, memh, NGLE_REG_14, 0x23000302);
-	bus_space_write_4(memt, memh, NGLE_REG_12, scr->reg12_value);
-	bus_space_write_4(memt, memh, NGLE_REG_8, 0x);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_11, 0x2ea0d000);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_14, 0x23000302);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_12, scr->reg12_value);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_8, 0x);
 
-	bus_space_write_4(memt, memh, NGLE_REG_6, 0x);
-	bus_space_write_4(memt, memh, NGLE_REG_9,
+	bus_space_write_stream_4(memt, memh, NGLE_REG_6, 0x);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_9,
 	(scr->scr_cfg.scr_width << 16) | scr->scr_cfg.scr_height);
-	bus_space_write_4(memt, memh, NGLE_REG_6, 0x0500);
-	bus_space_write_4(memt, memh, NGLE_REG_9, 0x00040001);
+	bus_space_write_stream_4(memt, 

CVS commit: src/sys/dev/ic

2023-12-31 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Dec 31 21:32:43 UTC 2023

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

Log Message:
bwfm.c: KNF a comment (spaces->tabs)


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/bwfm.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/bwfm.c
diff -u src/sys/dev/ic/bwfm.c:1.35 src/sys/dev/ic/bwfm.c:1.36
--- src/sys/dev/ic/bwfm.c:1.35	Tue Aug  1 07:04:15 2023
+++ src/sys/dev/ic/bwfm.c	Sun Dec 31 21:32:43 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfm.c,v 1.35 2023/08/01 07:04:15 mrg Exp $ */
+/* $NetBSD: bwfm.c,v 1.36 2023/12/31 21:32:43 gutteridge Exp $ */
 /* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -632,11 +632,10 @@ bwfm_init(struct ifnet *ifp)
 		return EIO;
 	}
 
-/*
- * Use CAM (constantly awake) when we are running as AP
- * otherwise use fast power saving.
- */
-
+	/*
+	 * Use CAM (constantly awake) when we are running as AP
+	 * otherwise use fast power saving.
+	 */
 	if (ic->ic_flags & IEEE80211_F_PMGTON) {
 		sc->sc_pm = BWFM_PM_FAST_PS;
 #ifndef IEEE80211_STA_ONLY



CVS commit: src/sys/dev/ic

2023-12-31 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Dec 31 21:32:43 UTC 2023

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

Log Message:
bwfm.c: KNF a comment (spaces->tabs)


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/bwfm.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

2023-12-30 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Dec 31 03:19:22 UTC 2023

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

Log Message:
ne(4): Write CR0 properly.
Writing 0b000 to RD2-0 in CR0 appears harmless, but it is "not allowed"
by the RTL8019AS (and several NE2000 derived) datasheets.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/rtl80x9.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/rtl80x9.c
diff -u src/sys/dev/ic/rtl80x9.c:1.18 src/sys/dev/ic/rtl80x9.c:1.19
--- src/sys/dev/ic/rtl80x9.c:1.18	Thu Apr 25 10:44:52 2019
+++ src/sys/dev/ic/rtl80x9.c	Sun Dec 31 03:19:22 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtl80x9.c,v 1.18 2019/04/25 10:44:52 msaitoh Exp $	*/
+/*	$NetBSD: rtl80x9.c,v 1.19 2023/12/31 03:19:22 isaki Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtl80x9.c,v 1.18 2019/04/25 10:44:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl80x9.c,v 1.19 2023/12/31 03:19:22 isaki Exp $");
 
 #include 
 #include 
@@ -170,7 +170,8 @@ rtl80x9_media_init(struct dp8390_softc *
 	aprint_normal_dev(sc->sc_dev,
 	"10base2, 10baseT, 10baseT-FDX, auto, default ");
 
-	bus_space_write_1(sc->sc_regt, sc->sc_regh, ED_P0_CR, ED_CR_PAGE_3);
+	bus_space_write_1(sc->sc_regt, sc->sc_regh, ED_P0_CR,
+	sc->cr_proto | ED_CR_PAGE_3);
 
 	conf2 = bus_space_read_1(sc->sc_regt, sc->sc_regh, NERTL_RTL3_CONFIG2);
 	conf3 = bus_space_read_1(sc->sc_regt, sc->sc_regh, NERTL_RTL3_CONFIG3);
@@ -201,7 +202,8 @@ rtl80x9_media_init(struct dp8390_softc *
 		break;
 	}
 
-	bus_space_write_1(sc->sc_regt, sc->sc_regh, ED_P0_CR, ED_CR_PAGE_0);
+	bus_space_write_1(sc->sc_regt, sc->sc_regh, ED_P0_CR,
+	sc->cr_proto | ED_CR_PAGE_0);
 
 	ifmedia_init(>sc_media, 0, dp8390_mediachange, dp8390_mediastatus);
 	for (i = 0; i < rtl80x9_nmedia; i++)



CVS commit: src/sys/dev/ic

2023-12-30 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Dec 31 03:19:22 UTC 2023

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

Log Message:
ne(4): Write CR0 properly.
Writing 0b000 to RD2-0 in CR0 appears harmless, but it is "not allowed"
by the RTL8019AS (and several NE2000 derived) datasheets.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/rtl80x9.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

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:29:03 UTC 2023

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

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/dw_hdmi.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/dw_hdmi.c
diff -u src/sys/dev/ic/dw_hdmi.c:1.10 src/sys/dev/ic/dw_hdmi.c:1.11
--- src/sys/dev/ic/dw_hdmi.c:1.10	Fri Mar 25 23:16:04 2022
+++ src/sys/dev/ic/dw_hdmi.c	Mon Dec 11 13:29:03 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dw_hdmi.c,v 1.10 2022/03/25 23:16:04 tnn Exp $ */
+/* $NetBSD: dw_hdmi.c,v 1.11 2023/12/11 13:29:03 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.10 2022/03/25 23:16:04 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.11 2023/12/11 13:29:03 mlelstv Exp $");
 
 #include 
 #include 
@@ -729,7 +729,7 @@ dwhdmi_audio_swvol_codec(audio_filter_ar
 {
 	struct dwhdmi_softc * const sc = arg->context;
 	const aint_t *src;
-	aint_t *dst;
+	int16_t *dst;
 	u_int sample_count;
 	u_int i;
 



CVS commit: src/sys/dev/ic

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:29:03 UTC 2023

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

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/dw_hdmi.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

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:28:15 UTC 2023

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

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/anx_dp.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/anx_dp.c
diff -u src/sys/dev/ic/anx_dp.c:1.5 src/sys/dev/ic/anx_dp.c:1.6
--- src/sys/dev/ic/anx_dp.c:1.5	Sun Dec 19 12:43:37 2021
+++ src/sys/dev/ic/anx_dp.c	Mon Dec 11 13:28:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: anx_dp.c,v 1.5 2021/12/19 12:43:37 riastradh Exp $ */
+/* $NetBSD: anx_dp.c,v 1.6 2023/12/11 13:28:15 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2019 Jonathan A. Kollasch 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: anx_dp.c,v 1.5 2021/12/19 12:43:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: anx_dp.c,v 1.6 2023/12/11 13:28:15 mlelstv Exp $");
 
 #include 
 #include 
@@ -791,7 +791,7 @@ anxdp_audio_swvol_codec(audio_filter_arg
 {
 	struct anxdp_softc * const sc = arg->context;
 	const aint_t *src;
-	aint_t *dst;
+	int16_t *dst;
 	u_int sample_count;
 	u_int i;
 



CVS commit: src/sys/dev/ic

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:28:15 UTC 2023

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

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/anx_dp.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

2023-11-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Nov 13 15:08:06 UTC 2023

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

Log Message:
eqos(4): Extend bitwidth of SYSBUS_MODE_{RD,WR}_OSR_LMT to 4bits.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/dwc_eqos_reg.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_reg.h
diff -u src/sys/dev/ic/dwc_eqos_reg.h:1.9 src/sys/dev/ic/dwc_eqos_reg.h:1.10
--- src/sys/dev/ic/dwc_eqos_reg.h:1.9	Mon Nov 13 15:07:19 2023
+++ src/sys/dev/ic/dwc_eqos_reg.h	Mon Nov 13 15:08:06 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos_reg.h,v 1.9 2023/11/13 15:07:19 msaitoh Exp $ */
+/* $NetBSD: dwc_eqos_reg.h,v 1.10 2023/11/13 15:08:06 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -229,9 +229,9 @@
 #define	 GMAC_DMA_MODE_SWR			(1U << 0)
 #define	GMAC_DMA_SYSBUS_MODE			0x1004
 #define	 GMAC_DMA_SYSBUS_MODE_WR_OSR_LMT_SHIFT	24
-#define	 GMAC_DMA_SYSBUS_MODE_WR_OSR_LMT_MASK	(0x3U << GMAC_DMA_SYSBUS_MODE_WR_OSR_LMT_SHIFT)
+#define	 GMAC_DMA_SYSBUS_MODE_WR_OSR_LMT_MASK	(0xfU << GMAC_DMA_SYSBUS_MODE_WR_OSR_LMT_SHIFT)
 #define	 GMAC_DMA_SYSBUS_MODE_RD_OSR_LMT_SHIFT	16
-#define	 GMAC_DMA_SYSBUS_MODE_RD_OSR_LMT_MASK	(0x7U << GMAC_DMA_SYSBUS_MODE_RD_OSR_LMT_SHIFT)
+#define	 GMAC_DMA_SYSBUS_MODE_RD_OSR_LMT_MASK	(0xfU << GMAC_DMA_SYSBUS_MODE_RD_OSR_LMT_SHIFT)
 #define	 GMAC_DMA_SYSBUS_MODE_MB		(1U << 14)
 #define	 GMAC_DMA_SYSBUS_MODE_EAME		(1U << 11)
 #define	 GMAC_DMA_SYSBUS_MODE_BLEN16		(1U << 3)



CVS commit: src/sys/dev/ic

2023-11-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Nov 13 15:08:06 UTC 2023

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

Log Message:
eqos(4): Extend bitwidth of SYSBUS_MODE_{RD,WR}_OSR_LMT to 4bits.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/dwc_eqos_reg.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

2023-11-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Nov 13 15:07:19 UTC 2023

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

Log Message:
eqos(4): Set bit 31 when writing MAC_ADDRESS0_HIGH register.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/ic/dwc_eqos.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/dwc_eqos_reg.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.c
diff -u src/sys/dev/ic/dwc_eqos.c:1.33 src/sys/dev/ic/dwc_eqos.c:1.34
--- src/sys/dev/ic/dwc_eqos.c:1.33	Thu Nov  2 13:50:14 2023
+++ src/sys/dev/ic/dwc_eqos.c	Mon Nov 13 15:07:19 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.33 2023/11/02 13:50:14 riastradh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.34 2023/11/13 15:07:19 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -38,7 +38,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.33 2023/11/02 13:50:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.34 2023/11/13 15:07:19 msaitoh Exp $");
 
 #include 
 #include 
@@ -545,7 +545,7 @@ eqos_setup_rxfilter(struct eqos_softc *s
 
 	/* Write our unicast address */
 	eaddr = CLLADDR(ifp->if_sadl);
-	val = eaddr[4] | (eaddr[5] << 8);
+	val = eaddr[4] | (eaddr[5] << 8) | GMAC_MAC_ADDRESS0_HIGH_AE;
 	WR4(sc, GMAC_MAC_ADDRESS0_HIGH, val);
 	val = eaddr[0] | (eaddr[1] << 8) | (eaddr[2] << 16) |
 	(eaddr[3] << 24);

Index: src/sys/dev/ic/dwc_eqos_reg.h
diff -u src/sys/dev/ic/dwc_eqos_reg.h:1.8 src/sys/dev/ic/dwc_eqos_reg.h:1.9
--- src/sys/dev/ic/dwc_eqos_reg.h:1.8	Thu Oct 26 18:02:50 2023
+++ src/sys/dev/ic/dwc_eqos_reg.h	Mon Nov 13 15:07:19 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos_reg.h,v 1.8 2023/10/26 18:02:50 msaitoh Exp $ */
+/* $NetBSD: dwc_eqos_reg.h,v 1.9 2023/11/13 15:07:19 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -120,6 +120,7 @@
 #define	GMAC_MAC_MDIO_DATA			0x0204
 #define	GMAC_MAC_CSR_SW_CTRL			0x0230
 #define	GMAC_MAC_ADDRESS0_HIGH			0x0300
+#define	 GMAC_MAC_ADDRESS0_HIGH_AE		(1U << 31)
 #define	GMAC_MAC_ADDRESS0_LOW			0x0304
 #define	GMAC_MMC_CONTROL			0x0700
 #define	 GMAC_MMC_CONTROL_UCDBC			(1U << 8)



CVS commit: src/sys/dev/ic

2023-11-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Nov 13 15:07:19 UTC 2023

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

Log Message:
eqos(4): Set bit 31 when writing MAC_ADDRESS0_HIGH register.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/ic/dwc_eqos.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/dwc_eqos_reg.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

2023-11-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov  2 13:50:14 UTC 2023

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

Log Message:
eqos(4): Fix multicast filter updates.

1. Don't touch the obsolete IFF_ALLMULTI.
2. Set ETHER_F_ALLMULTI if we're accepting all multicast addresses.
3. If any multicast entry range is not a single address, accept all
   multicast addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 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.32 src/sys/dev/ic/dwc_eqos.c:1.33
--- src/sys/dev/ic/dwc_eqos.c:1.32	Thu Nov  2 13:50:02 2023
+++ src/sys/dev/ic/dwc_eqos.c	Thu Nov  2 13:50:14 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.32 2023/11/02 13:50:02 riastradh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.33 2023/11/02 13:50:14 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -38,7 +38,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.32 2023/11/02 13:50:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.33 2023/11/02 13:50:14 riastradh Exp $");
 
 #include 
 #include 
@@ -509,17 +509,29 @@ eqos_setup_rxfilter(struct eqos_softc *s
 		  GMAC_MAC_PACKET_FILTER_PCF_MASK);
 	hash[0] = hash[1] = ~0U;
 
+	ETHER_LOCK(ec);
 	if (sc->sc_promisc) {
+		ec->ec_flags |= ETHER_F_ALLMULTI;
 		pfil |= GMAC_MAC_PACKET_FILTER_PR |
 			GMAC_MAC_PACKET_FILTER_PCF_ALL;
-	} else if (sc->sc_allmulti) {
-		pfil |= GMAC_MAC_PACKET_FILTER_PM;
 	} else {
-		hash[0] = hash[1] = 0;
 		pfil |= GMAC_MAC_PACKET_FILTER_HMC;
-		ETHER_LOCK(ec);
+		hash[0] = hash[1] = 0;
+		ec->ec_flags &= ~ETHER_F_ALLMULTI;
 		ETHER_FIRST_MULTI(step, ec, enm);
 		while (enm != NULL) {
+			if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
+ETHER_ADDR_LEN) != 0) {
+ec->ec_flags |= ETHER_F_ALLMULTI;
+pfil &= ~GMAC_MAC_PACKET_FILTER_HMC;
+pfil |= GMAC_MAC_PACKET_FILTER_PM;
+/*
+ * Shouldn't matter if we clear HMC but
+ * let's avoid using different values.
+ */
+hash[0] = hash[1] = 0x;
+break;
+			}
 			crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN);
 			crc &= 0x7f;
 			crc = eqos_bitrev32(~crc) >> 26;
@@ -528,8 +540,8 @@ eqos_setup_rxfilter(struct eqos_softc *s
 			hash[hashreg] |= (1 << hashbit);
 			ETHER_NEXT_MULTI(step, enm);
 		}
-		ETHER_UNLOCK(ec);
 	}
+	ETHER_UNLOCK(ec);
 
 	/* Write our unicast address */
 	eaddr = CLLADDR(ifp->if_sadl);
@@ -618,7 +630,6 @@ eqos_init_locked(struct eqos_softc *sc)
 
 	/* Setup RX filter */
 	sc->sc_promisc = ifp->if_flags & IFF_PROMISC;
-	sc->sc_allmulti = ifp->if_flags & IFF_ALLMULTI; /* XXX */
 	eqos_setup_rxfilter(sc);
 
 	WR4(sc, GMAC_MAC_1US_TIC_COUNTER, (sc->sc_csr_clock / 100) - 1);



CVS commit: src/sys/dev/ic

2023-11-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov  2 13:50:14 UTC 2023

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

Log Message:
eqos(4): Fix multicast filter updates.

1. Don't touch the obsolete IFF_ALLMULTI.
2. Set ETHER_F_ALLMULTI if we're accepting all multicast addresses.
3. If any multicast entry range is not a single address, accept all
   multicast addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 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

2023-11-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov  2 13:50:02 UTC 2023

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

Log Message:
eqos(4): Fix locking around multicast filter updates.

- Can't touch if_flags without IFNET_LOCK.
- Can't take IFNET_LOCK in SIOCADDMULTI/SIOCDELMULTI path.

Instead, cache IFF_PROMISC and IFF_ALLMULTI on if_init under a lock we
can take in this path.

XXX Is IFF_ALLMULTI relevant any more?  Hasn't it been moved to
ethercom flags?

XXX Should not take sc_lock around if_init/stop -- IFNET_LOCK is
enough.  Should narrow scope of sc_lock to be just tick/mii/multi
stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ic/dwc_eqos.c
cvs rdiff -u -r1.8 -r1.9 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.c
diff -u src/sys/dev/ic/dwc_eqos.c:1.31 src/sys/dev/ic/dwc_eqos.c:1.32
--- src/sys/dev/ic/dwc_eqos.c:1.31	Thu Nov  2 13:49:49 2023
+++ src/sys/dev/ic/dwc_eqos.c	Thu Nov  2 13:50:02 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.31 2023/11/02 13:49:49 riastradh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.32 2023/11/02 13:50:02 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -38,7 +38,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.31 2023/11/02 13:49:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.32 2023/11/02 13:50:02 riastradh Exp $");
 
 #include 
 #include 
@@ -509,10 +509,10 @@ eqos_setup_rxfilter(struct eqos_softc *s
 		  GMAC_MAC_PACKET_FILTER_PCF_MASK);
 	hash[0] = hash[1] = ~0U;
 
-	if ((ifp->if_flags & IFF_PROMISC) != 0) {
+	if (sc->sc_promisc) {
 		pfil |= GMAC_MAC_PACKET_FILTER_PR |
 			GMAC_MAC_PACKET_FILTER_PCF_ALL;
-	} else if ((ifp->if_flags & IFF_ALLMULTI) != 0) {
+	} else if (sc->sc_allmulti) {
 		pfil |= GMAC_MAC_PACKET_FILTER_PM;
 	} else {
 		hash[0] = hash[1] = 0;
@@ -617,6 +617,8 @@ eqos_init_locked(struct eqos_softc *sc)
 	eqos_init_rings(sc, 0);
 
 	/* Setup RX filter */
+	sc->sc_promisc = ifp->if_flags & IFF_PROMISC;
+	sc->sc_allmulti = ifp->if_flags & IFF_ALLMULTI; /* XXX */
 	eqos_setup_rxfilter(sc);
 
 	WR4(sc, GMAC_MAC_1US_TIC_COUNTER, (sc->sc_csr_clock / 100) - 1);
@@ -1232,9 +1234,10 @@ eqos_ioctl(struct ifnet *ifp, u_long cmd
 			error = (*ifp->if_init)(ifp);
 		else if (cmd != SIOCADDMULTI && cmd != SIOCDELMULTI)
 			;
-		else if ((ifp->if_flags & IFF_RUNNING) != 0) {
+		else {
 			EQOS_LOCK(sc);
-			eqos_setup_rxfilter(sc);
+			if (sc->sc_running)
+eqos_setup_rxfilter(sc);
 			EQOS_UNLOCK(sc);
 		}
 		break;

Index: src/sys/dev/ic/dwc_eqos_var.h
diff -u src/sys/dev/ic/dwc_eqos_var.h:1.8 src/sys/dev/ic/dwc_eqos_var.h:1.9
--- src/sys/dev/ic/dwc_eqos_var.h:1.8	Thu Nov  2 13:49:49 2023
+++ src/sys/dev/ic/dwc_eqos_var.h	Thu Nov  2 13:50:02 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos_var.h,v 1.8 2023/11/02 13:49:49 riastradh Exp $ */
+/* $NetBSD: dwc_eqos_var.h,v 1.9 2023/11/02 13:50:02 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -72,6 +72,8 @@ struct eqos_softc {
 	kmutex_t		sc_txlock;
 	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/ic

2023-11-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov  2 13:50:02 UTC 2023

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

Log Message:
eqos(4): Fix locking around multicast filter updates.

- Can't touch if_flags without IFNET_LOCK.
- Can't take IFNET_LOCK in SIOCADDMULTI/SIOCDELMULTI path.

Instead, cache IFF_PROMISC and IFF_ALLMULTI on if_init under a lock we
can take in this path.

XXX Is IFF_ALLMULTI relevant any more?  Hasn't it been moved to
ethercom flags?

XXX Should not take sc_lock around if_init/stop -- IFNET_LOCK is
enough.  Should narrow scope of sc_lock to be just tick/mii/multi
stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ic/dwc_eqos.c
cvs rdiff -u -r1.8 -r1.9 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

2023-11-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov  2 13:49:49 UTC 2023

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

Log Message:
eqos(4): Don't touch if_flags in tx path.

Can't touch this without IFNET_LOCK.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ic/dwc_eqos.c
cvs rdiff -u -r1.7 -r1.8 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

2023-11-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov  2 13:49:49 UTC 2023

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

Log Message:
eqos(4): Don't touch if_flags in tx path.

Can't touch this without IFNET_LOCK.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ic/dwc_eqos.c
cvs rdiff -u -r1.7 -r1.8 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.c
diff -u src/sys/dev/ic/dwc_eqos.c:1.30 src/sys/dev/ic/dwc_eqos.c:1.31
--- src/sys/dev/ic/dwc_eqos.c:1.30	Thu Nov  2 13:49:37 2023
+++ src/sys/dev/ic/dwc_eqos.c	Thu Nov  2 13:49:49 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.30 2023/11/02 13:49:37 riastradh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.31 2023/11/02 13:49:49 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -38,7 +38,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.30 2023/11/02 13:49:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.31 2023/11/02 13:49:49 riastradh Exp $");
 
 #include 
 #include 
@@ -698,6 +698,9 @@ eqos_init_locked(struct eqos_softc *sc)
 	/* Enable interrupts */
 	eqos_enable_intr(sc);
 
+	EQOS_ASSERT_TXLOCKED(sc);
+	sc->sc_txrunning = true;
+
 	sc->sc_running = true;
 	ifp->if_flags |= IFF_RUNNING;
 
@@ -731,6 +734,10 @@ eqos_stop_locked(struct eqos_softc *sc, 
 
 	EQOS_ASSERT_LOCKED(sc);
 
+	EQOS_TXLOCK(sc);
+	sc->sc_txrunning = false;
+	EQOS_TXUNLOCK(sc);
+
 	sc->sc_running = false;
 	callout_halt(>sc_stat_ch, >sc_lock);
 
@@ -1010,7 +1017,7 @@ eqos_start_locked(struct eqos_softc *sc)
 
 	EQOS_ASSERT_TXLOCKED(sc);
 
-	if ((ifp->if_flags & IFF_RUNNING) == 0)
+	if (!sc->sc_txrunning)
 		return;
 
 	for (cnt = 0, start = sc->sc_tx.cur; ; cnt++) {

Index: src/sys/dev/ic/dwc_eqos_var.h
diff -u src/sys/dev/ic/dwc_eqos_var.h:1.7 src/sys/dev/ic/dwc_eqos_var.h:1.8
--- src/sys/dev/ic/dwc_eqos_var.h:1.7	Thu Nov  2 13:49:37 2023
+++ src/sys/dev/ic/dwc_eqos_var.h	Thu Nov  2 13:49:49 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos_var.h,v 1.7 2023/11/02 13:49:37 riastradh Exp $ */
+/* $NetBSD: dwc_eqos_var.h,v 1.8 2023/11/02 13:49:49 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -71,6 +71,7 @@ struct eqos_softc {
 	kmutex_t		sc_lock;
 	kmutex_t		sc_txlock;
 	bool			sc_running;
+	bool			sc_txrunning;
 
 	struct eqos_ring	sc_tx;
 	struct eqos_ring	sc_rx;



CVS commit: src/sys/dev/ic

2023-11-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov  2 13:49:37 UTC 2023

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

Log Message:
eqos(4): Wait for callout to halt and make sure it stays halted.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ic/dwc_eqos.c
cvs rdiff -u -r1.6 -r1.7 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.c
diff -u src/sys/dev/ic/dwc_eqos.c:1.29 src/sys/dev/ic/dwc_eqos.c:1.30
--- src/sys/dev/ic/dwc_eqos.c:1.29	Thu Nov  2 02:32:41 2023
+++ src/sys/dev/ic/dwc_eqos.c	Thu Nov  2 13:49:37 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.29 2023/11/02 02:32:41 msaitoh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.30 2023/11/02 13:49:37 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -38,7 +38,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.29 2023/11/02 02:32:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.30 2023/11/02 13:49:37 riastradh Exp $");
 
 #include 
 #include 
@@ -468,7 +468,8 @@ eqos_tick(void *softc)
 
 	EQOS_LOCK(sc);
 	mii_tick(mii);
-	callout_schedule(>sc_stat_ch, hz);
+	if (sc->sc_running)
+		callout_schedule(>sc_stat_ch, hz);
 	EQOS_UNLOCK(sc);
 
 #ifndef EQOS_MPSAFE
@@ -697,6 +698,7 @@ eqos_init_locked(struct eqos_softc *sc)
 	/* Enable interrupts */
 	eqos_enable_intr(sc);
 
+	sc->sc_running = true;
 	ifp->if_flags |= IFF_RUNNING;
 
 	mii_mediachg(mii);
@@ -729,7 +731,8 @@ eqos_stop_locked(struct eqos_softc *sc, 
 
 	EQOS_ASSERT_LOCKED(sc);
 
-	callout_stop(>sc_stat_ch);
+	sc->sc_running = false;
+	callout_halt(>sc_stat_ch, >sc_lock);
 
 	mii_down(>sc_mii);
 

Index: src/sys/dev/ic/dwc_eqos_var.h
diff -u src/sys/dev/ic/dwc_eqos_var.h:1.6 src/sys/dev/ic/dwc_eqos_var.h:1.7
--- src/sys/dev/ic/dwc_eqos_var.h:1.6	Thu Oct 26 18:02:50 2023
+++ src/sys/dev/ic/dwc_eqos_var.h	Thu Nov  2 13:49:37 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos_var.h,v 1.6 2023/10/26 18:02:50 msaitoh Exp $ */
+/* $NetBSD: dwc_eqos_var.h,v 1.7 2023/11/02 13:49:37 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -70,6 +70,7 @@ struct eqos_softc {
 	callout_t		sc_stat_ch;
 	kmutex_t		sc_lock;
 	kmutex_t		sc_txlock;
+	bool			sc_running;
 
 	struct eqos_ring	sc_tx;
 	struct eqos_ring	sc_rx;



CVS commit: src/sys/dev/ic

2023-11-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov  2 13:49:37 UTC 2023

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

Log Message:
eqos(4): Wait for callout to halt and make sure it stays halted.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ic/dwc_eqos.c
cvs rdiff -u -r1.6 -r1.7 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

2023-11-01 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov  2 02:32:41 UTC 2023

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

Log Message:
eqos(4): Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 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.28 src/sys/dev/ic/dwc_eqos.c:1.29
--- src/sys/dev/ic/dwc_eqos.c:1.28	Sun Oct 29 14:55:16 2023
+++ src/sys/dev/ic/dwc_eqos.c	Thu Nov  2 02:32:41 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.28 2023/10/29 14:55:16 msaitoh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.29 2023/11/02 02:32:41 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -38,7 +38,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.28 2023/10/29 14:55:16 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.29 2023/11/02 02:32:41 msaitoh Exp $");
 
 #include 
 #include 
@@ -75,7 +75,7 @@ CTASSERT(MCLBYTES >= EQOS_RXDMA_SIZE);
 #define	EDEB_INTR		(1U << 1)
 #define	EDEB_RXRING		(1U << 2)
 #define	EDEB_TXRING		(1U << 3)
-unsigned int eqos_debug;	/* Default vaule */
+unsigned int eqos_debug;	/* Default value */
 #define	DPRINTF(FLAG, FORMAT, ...)			 \
 	if (sc->sc_debug & FLAG)			 \
 		device_printf(sc->sc_dev, "%s: " FORMAT, \



CVS commit: src/sys/dev/ic

2023-11-01 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov  2 02:32:41 UTC 2023

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

Log Message:
eqos(4): Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 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

2023-10-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Oct 29 14:55:16 UTC 2023

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

Log Message:
eqos(4): Set flow control correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 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.27 src/sys/dev/ic/dwc_eqos.c:1.28
--- src/sys/dev/ic/dwc_eqos.c:1.27	Thu Oct 26 18:02:50 2023
+++ src/sys/dev/ic/dwc_eqos.c	Sun Oct 29 14:55:16 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.27 2023/10/26 18:02:50 msaitoh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.28 2023/10/29 14:55:16 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -38,7 +38,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.27 2023/10/26 18:02:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.28 2023/10/29 14:55:16 msaitoh Exp $");
 
 #include 
 #include 
@@ -203,7 +203,7 @@ eqos_update_link(struct eqos_softc *sc)
 {
 	struct mii_data * const mii = >sc_mii;
 	uint64_t baudrate;
-	uint32_t conf;
+	uint32_t conf, flow;
 
 	baudrate = ifmedia_baudrate(mii->mii_media_active);
 
@@ -227,13 +227,28 @@ eqos_update_link(struct eqos_softc *sc)
 		break;
 	}
 
+	/* Set duplex. */
 	if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) {
 		conf |= GMAC_MAC_CONFIGURATION_DM;
 	} else {
 		conf &= ~GMAC_MAC_CONFIGURATION_DM;
 	}
-
 	WR4(sc, GMAC_MAC_CONFIGURATION, conf);
+
+	/* Set TX flow control. */
+	if (mii->mii_media_active & IFM_ETH_TXPAUSE) {
+		flow = GMAC_MAC_Q0_TX_FLOW_CTRL_TFE;
+		flow |= 0xU << GMAC_MAC_Q0_TX_FLOW_CTRL_PT_SHIFT;
+	} else
+		flow = 0;
+	WR4(sc, GMAC_MAC_Q0_TX_FLOW_CTRL, flow);
+
+	/* Set RX flow control. */
+	if (mii->mii_media_active & IFM_ETH_RXPAUSE)
+		flow = GMAC_MAC_RX_FLOW_CTRL_RFE;
+	else
+		flow = 0;
+	WR4(sc, GMAC_MAC_RX_FLOW_CTRL, flow);
 }
 
 static void
@@ -658,14 +673,12 @@ eqos_init_locked(struct eqos_softc *sc)
 	val |= __SHIFTIN(rqs, GMAC_MTL_RXQ0_OPERATION_MODE_RQS);
 	WR4(sc, GMAC_MTL_RXQ0_OPERATION_MODE, val);
 
-	/* Enable flow control */
-	val = RD4(sc, GMAC_MAC_Q0_TX_FLOW_CTRL);
-	val |= 0xU << GMAC_MAC_Q0_TX_FLOW_CTRL_PT_SHIFT;
-	val |= GMAC_MAC_Q0_TX_FLOW_CTRL_TFE;
-	WR4(sc, GMAC_MAC_Q0_TX_FLOW_CTRL, val);
-	val = RD4(sc, GMAC_MAC_RX_FLOW_CTRL);
-	val |= GMAC_MAC_RX_FLOW_CTRL_RFE;
-	WR4(sc, GMAC_MAC_RX_FLOW_CTRL, val);
+	/*
+	 * Disable flow control.
+	 * It'll be configured later from the negotiated result.
+	 */
+	WR4(sc, GMAC_MAC_Q0_TX_FLOW_CTRL, 0);
+	WR4(sc, GMAC_MAC_RX_FLOW_CTRL, 0);
 
 	/* set RX queue mode. must be in DCB mode. */
 	val = __SHIFTIN(GMAC_RXQ_CTRL0_EN_DCB, GMAC_RXQ_CTRL0_EN_MASK);
@@ -1431,7 +1444,6 @@ eqos_attach(struct eqos_softc *sc)
 	struct ifnet * const ifp = >sc_ec.ec_if;
 	uint8_t eaddr[ETHER_ADDR_LEN];
 	u_int userver, snpsver;
-	int mii_flags = 0;
 	int error;
 	int n;
 
@@ -1556,7 +1568,7 @@ eqos_attach(struct eqos_softc *sc)
 	mii->mii_writereg = eqos_mii_writereg;
 	mii->mii_statchg = eqos_mii_statchg;
 	mii_attach(sc->sc_dev, mii, 0x, sc->sc_phy_id, MII_OFFSET_ANY,
-	mii_flags);
+	MIIF_DOPAUSE);
 
 	if (LIST_EMPTY(>mii_phys)) {
 		aprint_error_dev(sc->sc_dev, "no PHY found!\n");



CVS commit: src/sys/dev/ic

2023-10-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Oct 29 14:55:16 UTC 2023

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

Log Message:
eqos(4): Set flow control correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 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

2023-10-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct 26 13:00:13 UTC 2023

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

Log Message:
eqos(4): Use EQOS_TXLOCK() more to be stable.

 Fix a bug that sc_tx.{cur,next,queued} become inconsitent.
Use txlock when accessing TX data.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 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

2023-10-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct 26 13:00:13 UTC 2023

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

Log Message:
eqos(4): Use EQOS_TXLOCK() more to be stable.

 Fix a bug that sc_tx.{cur,next,queued} become inconsitent.
Use txlock when accessing TX data.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 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.25 src/sys/dev/ic/dwc_eqos.c:1.26
--- src/sys/dev/ic/dwc_eqos.c:1.25	Mon Oct 23 15:29:38 2023
+++ src/sys/dev/ic/dwc_eqos.c	Thu Oct 26 13:00:13 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.25 2023/10/23 15:29:38 msaitoh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.26 2023/10/26 13:00:13 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -38,7 +38,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.25 2023/10/23 15:29:38 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.26 2023/10/26 13:00:13 msaitoh Exp $");
 
 #include 
 #include 
@@ -269,6 +269,8 @@ eqos_setup_txdesc(struct eqos_softc *sc,
 
 	DPRINTF(EDEB_TXRING, "preparing desc %u\n", index);
 
+	EQOS_ASSERT_TXLOCKED(sc);
+
 	if (paddr == 0 || len == 0) {
 		DPRINTF(EDEB_TXRING,
 		"tx for desc %u done!\n", index);
@@ -924,6 +926,7 @@ eqos_txintr(struct eqos_softc *sc, int q
 	DPRINTF(EDEB_INTR, "qid: %u\n", qid);
 
 	EQOS_ASSERT_LOCKED(sc);
+	EQOS_ASSERT_TXLOCKED(sc);
 
 	for (i = sc->sc_tx.next; sc->sc_tx.queued > 0; i = TX_NEXT(i)) {
 		KASSERT(sc->sc_tx.queued > 0);
@@ -1128,7 +1131,9 @@ eqos_intr(void *arg)
 	}
 
 	if ((dma_status & GMAC_DMA_CHAN0_STATUS_TI) != 0) {
+		EQOS_TXLOCK(sc);
 		eqos_txintr(sc, 0);
+		EQOS_TXUNLOCK(sc);
 		if_schedule_deferred_start(ifp);
 		sc->sc_ev_txintr.ev_count++;
 	}
@@ -1336,7 +1341,9 @@ eqos_setup_dma(struct eqos_softc *sc, in
 			"cannot create TX buffer map\n");
 			return error;
 		}
+		EQOS_TXLOCK(sc);
 		eqos_setup_txdesc(sc, i, 0, 0, 0, 0);
+		EQOS_TXUNLOCK(sc);
 	}
 
 	/* Setup RX ring */



CVS commit: src/sys/dev/ic

2023-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 15:29:38 UTC 2023

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

Log Message:
eqos(4): Add sysctls for debugging.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/ic/dwc_eqos.c
cvs rdiff -u -r1.4 -r1.5 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.c
diff -u src/sys/dev/ic/dwc_eqos.c:1.24 src/sys/dev/ic/dwc_eqos.c:1.25
--- src/sys/dev/ic/dwc_eqos.c:1.24	Mon Oct 23 15:11:47 2023
+++ src/sys/dev/ic/dwc_eqos.c	Mon Oct 23 15:29:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.24 2023/10/23 15:11:47 msaitoh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.25 2023/10/23 15:29:38 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -38,7 +38,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.24 2023/10/23 15:11:47 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.25 2023/10/23 15:29:38 msaitoh Exp $");
 
 #include 
 #include 
@@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -70,18 +71,18 @@ __KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v
 CTASSERT(MCLBYTES >= EQOS_RXDMA_SIZE);
 
 #ifdef EQOS_DEBUG
-unsigned int eqos_debug;
-#define	DPRINTF(FLAG, FORMAT, ...)	\
-	if (eqos_debug & FLAG)		\
+#define	EDEB_NOTE		(1U << 0)
+#define	EDEB_INTR		(1U << 1)
+#define	EDEB_RXRING		(1U << 2)
+#define	EDEB_TXRING		(1U << 3)
+unsigned int eqos_debug;	/* Default vaule */
+#define	DPRINTF(FLAG, FORMAT, ...)			 \
+	if (sc->sc_debug & FLAG)			 \
 		device_printf(sc->sc_dev, "%s: " FORMAT, \
 		__func__, ##__VA_ARGS__)
 #else
 #define	DPRINTF(FLAG, FORMAT, ...)	((void)0)
 #endif
-#define	EDEB_NOTE		1U<<0
-#define	EDEB_INTR		1U<<1
-#define	EDEB_RXRING		1U<<2
-#define	EDEB_TXRING		1U<<3
 
 #ifdef NET_MPSAFE
 #define	EQOS_MPSAFE		1
@@ -123,6 +124,15 @@ unsigned int eqos_debug;
 #define	WR4(sc, reg, val)		\
 	bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
 
+static void	eqos_init_sysctls(struct eqos_softc *);
+static int	eqos_sysctl_tx_cur_handler(SYSCTLFN_PROTO);
+static int	eqos_sysctl_tx_end_handler(SYSCTLFN_PROTO);
+static int	eqos_sysctl_rx_cur_handler(SYSCTLFN_PROTO);
+static int	eqos_sysctl_rx_end_handler(SYSCTLFN_PROTO);
+#ifdef EQOS_DEBUG
+static int	eqos_sysctl_debug_handler(SYSCTLFN_PROTO);
+#endif
+
 static int
 eqos_mii_readreg(device_t dev, int phy, int reg, uint16_t *val)
 {
@@ -1285,6 +1295,10 @@ eqos_setup_dma(struct eqos_softc *sc, in
 	struct mbuf *m;
 	int error, nsegs, i;
 
+	/* Set back pointer */
+	sc->sc_tx.sc = sc;
+	sc->sc_rx.sc = sc;
+
 	/* Setup TX ring */
 	error = bus_dmamap_create(sc->sc_dmat, TX_DESC_SIZE, 1, TX_DESC_SIZE,
 	DESC_BOUNDARY, BUS_DMA_WAITOK, >sc_tx.desc_map);
@@ -1392,6 +1406,11 @@ eqos_attach(struct eqos_softc *sc)
 	int error;
 	int n;
 
+#ifdef EQOS_DEBUG
+	/* Load the default debug flags. */
+	sc->sc_debug = eqos_debug;
+#endif
+
 	const uint32_t ver = RD4(sc, GMAC_MAC_VERSION);
 	userver = (ver & GMAC_MAC_VERSION_USERVER_MASK) >>
 	GMAC_MAC_VERSION_USERVER_SHIFT;
@@ -1560,8 +1579,229 @@ eqos_attach(struct eqos_softc *sc)
 	/* Attach ethernet interface */
 	ether_ifattach(ifp, eaddr);
 
+	eqos_init_sysctls(sc);
+
 	rnd_attach_source(>sc_rndsource, ifp->if_xname, RND_TYPE_NET,
 	RND_FLAG_DEFAULT);
 
 	return 0;
 }
+
+static void
+eqos_init_sysctls(struct eqos_softc *sc)
+{
+	struct sysctllog **log;
+	const struct sysctlnode *rnode, *qnode, *cnode;
+	const char *dvname;
+	int i, rv;
+
+	log = >sc_sysctllog;
+	dvname = device_xname(sc->sc_dev);
+
+	rv = sysctl_createv(log, 0, NULL, ,
+	0, CTLTYPE_NODE, dvname,
+	SYSCTL_DESCR("eqos information and settings"),
+	NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL);
+	if (rv != 0)
+		goto err;
+
+	for (i = 0; i < 1; i++) {
+		struct eqos_ring *txr = >sc_tx;
+		struct eqos_ring *rxr = >sc_rx;
+		const unsigned char *name = "q0";
+
+		if (sysctl_createv(log, 0, , ,
+		0, CTLTYPE_NODE,
+		name, SYSCTL_DESCR("Queue Name"),
+		NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL) != 0)
+			break;
+
+		if (sysctl_createv(log, 0, , ,
+		CTLFLAG_READONLY, CTLTYPE_INT,
+		"txs_cur", SYSCTL_DESCR("TX cur"),
+		NULL, 0, >cur,
+		0, CTL_CREATE, CTL_EOL) != 0)
+			break;
+		if (sysctl_createv(log, 0, , ,
+		CTLFLAG_READONLY, CTLTYPE_INT,
+		"txs_next", SYSCTL_DESCR("TX next"),
+		NULL, 0, >next,
+		0, CTL_CREATE, CTL_EOL) != 0)
+			break;
+		if (sysctl_createv(log, 0, , ,
+		CTLFLAG_READONLY, CTLTYPE_INT,
+		"txs_queued", SYSCTL_DESCR("TX queued"),
+		NULL, 0, >queued,
+		0, CTL_CREATE, CTL_EOL) != 0)
+			break;
+		if (sysctl_createv(log, 0, , ,
+		CTLFLAG_READONLY, CTLTYPE_INT,
+		"txr_cur", SYSCTL_DESCR("TX descriptor cur"),
+		eqos_sysctl_tx_cur_handler, 0, (void *)txr,
+		0, 

CVS commit: src/sys/dev/ic

2023-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 15:29:38 UTC 2023

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

Log Message:
eqos(4): Add sysctls for debugging.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/ic/dwc_eqos.c
cvs rdiff -u -r1.4 -r1.5 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

2023-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 15:11:48 UTC 2023

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

Log Message:
eqos(4): Add and modify some DPRINTF()s.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 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

2023-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 15:11:48 UTC 2023

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

Log Message:
eqos(4): Add and modify some DPRINTF()s.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 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.23 src/sys/dev/ic/dwc_eqos.c:1.24
--- src/sys/dev/ic/dwc_eqos.c:1.23	Mon Oct 23 14:54:53 2023
+++ src/sys/dev/ic/dwc_eqos.c	Mon Oct 23 15:11:47 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.23 2023/10/23 14:54:53 msaitoh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.24 2023/10/23 15:11:47 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -38,7 +38,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.23 2023/10/23 14:54:53 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.24 2023/10/23 15:11:47 msaitoh Exp $");
 
 #include 
 #include 
@@ -257,6 +257,8 @@ eqos_setup_txdesc(struct eqos_softc *sc,
 {
 	uint32_t tdes2, tdes3;
 
+	DPRINTF(EDEB_TXRING, "preparing desc %u\n", index);
+
 	if (paddr == 0 || len == 0) {
 		DPRINTF(EDEB_TXRING,
 		"tx for desc %u done!\n", index);
@@ -278,7 +280,6 @@ eqos_setup_txdesc(struct eqos_softc *sc,
 	= htole32((uint32_t)((uint64_t)paddr >> 32));
 	sc->sc_tx.desc_ring[index].tdes2 = htole32(tdes2 | len);
 	sc->sc_tx.desc_ring[index].tdes3 = htole32(tdes3 | total_len);
-	DPRINTF(EDEB_TXRING, "preparing desc %u\n", index);
 }
 
 static int
@@ -289,6 +290,8 @@ eqos_setup_txbuf(struct eqos_softc *sc, 
 	uint32_t flags;
 	bool nospace;
 
+	DPRINTF(EDEB_TXRING, "preparing desc %u\n", index);
+
 	/* at least one descriptor free ? */
 	if (sc->sc_tx.queued >= TX_DESC_COUNT - 1)
 		return -1;
@@ -358,6 +361,8 @@ static void
 eqos_setup_rxdesc(struct eqos_softc *sc, int index, bus_addr_t paddr)
 {
 
+	DPRINTF(EDEB_RXRING, "preparing desc %u\n", index);
+
 	sc->sc_rx.desc_ring[index].tdes0 = htole32((uint32_t)paddr);
 	sc->sc_rx.desc_ring[index].tdes1 =
 	htole32((uint32_t)((uint64_t)paddr >> 32));
@@ -374,6 +379,8 @@ eqos_setup_rxbuf(struct eqos_softc *sc, 
 {
 	int error;
 
+	DPRINTF(EDEB_RXRING, "preparing desc %u\n", index);
+
 #if MCLBYTES >= (EQOS_RXDMA_SIZE + ETHER_ALIGN)
 	m_adj(m, ETHER_ALIGN);
 #endif
@@ -886,6 +893,8 @@ eqos_rxintr(struct eqos_softc *sc, int q
 	sc->sc_rx_receiving_m = m0;
 	sc->sc_rx_receiving_m_last = mprev;
 
+	DPRINTF(EDEB_RXRING, "sc_rx.cur %u -> %u\n",
+	sc->sc_rx.cur, index);
 	sc->sc_rx.cur = index;
 
 	if (pkts != 0) {



CVS commit: src/sys/dev/ic

2023-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 14:54:53 UTC 2023

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

Log Message:
eqos(4): KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 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.22 src/sys/dev/ic/dwc_eqos.c:1.23
--- src/sys/dev/ic/dwc_eqos.c:1.22	Sat Oct 21 14:49:12 2023
+++ src/sys/dev/ic/dwc_eqos.c	Mon Oct 23 14:54:53 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.22 2023/10/21 14:49:12 skrll Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.23 2023/10/23 14:54:53 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -38,7 +38,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.22 2023/10/21 14:49:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.23 2023/10/23 14:54:53 msaitoh Exp $");
 
 #include 
 #include 
@@ -72,7 +72,7 @@ CTASSERT(MCLBYTES >= EQOS_RXDMA_SIZE);
 #ifdef EQOS_DEBUG
 unsigned int eqos_debug;
 #define	DPRINTF(FLAG, FORMAT, ...)	\
-	if (eqos_debug & FLAG) 		\
+	if (eqos_debug & FLAG)		\
 		device_printf(sc->sc_dev, "%s: " FORMAT, \
 		__func__, ##__VA_ARGS__)
 #else
@@ -133,8 +133,7 @@ eqos_mii_readreg(device_t dev, int phy, 
 	addr = sc->sc_clock_range |
 	(phy << GMAC_MAC_MDIO_ADDRESS_PA_SHIFT) |
 	(reg << GMAC_MAC_MDIO_ADDRESS_RDA_SHIFT) |
-	GMAC_MAC_MDIO_ADDRESS_GOC_READ |
-	GMAC_MAC_MDIO_ADDRESS_GB;
+	GMAC_MAC_MDIO_ADDRESS_GOC_READ | GMAC_MAC_MDIO_ADDRESS_GB;
 	WR4(sc, GMAC_MAC_MDIO_ADDRESS, addr);
 
 	delay(1);
@@ -168,8 +167,7 @@ eqos_mii_writereg(device_t dev, int phy,
 	addr = sc->sc_clock_range |
 	(phy << GMAC_MAC_MDIO_ADDRESS_PA_SHIFT) |
 	(reg << GMAC_MAC_MDIO_ADDRESS_RDA_SHIFT) |
-	GMAC_MAC_MDIO_ADDRESS_GOC_WRITE |
-	GMAC_MAC_MDIO_ADDRESS_GB;
+	GMAC_MAC_MDIO_ADDRESS_GOC_WRITE | GMAC_MAC_MDIO_ADDRESS_GB;
 	WR4(sc, GMAC_MAC_MDIO_ADDRESS, addr);
 
 	delay(1);
@@ -409,6 +407,7 @@ eqos_alloc_mbufcl(struct eqos_softc *sc)
 static void
 eqos_enable_intr(struct eqos_softc *sc)
 {
+
 	WR4(sc, GMAC_DMA_CHAN0_INTR_ENABLE,
 	GMAC_DMA_CHAN0_INTR_ENABLE_NIE |
 	GMAC_DMA_CHAN0_INTR_ENABLE_AIE |
@@ -420,6 +419,7 @@ eqos_enable_intr(struct eqos_softc *sc)
 static void
 eqos_disable_intr(struct eqos_softc *sc)
 {
+
 	WR4(sc, GMAC_DMA_CHAN0_INTR_ENABLE, 0);
 }
 
@@ -445,6 +445,7 @@ eqos_tick(void *softc)
 static uint32_t
 eqos_bitrev32(uint32_t x)
 {
+
 	x = (((x & 0x) >> 1) | ((x & 0x) << 1));
 	x = (((x & 0x) >> 2) | ((x & 0x) << 2));
 	x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4));
@@ -799,7 +800,8 @@ eqos_rxintr(struct eqos_softc *sc, int q
 			"b\x13" "DE\0"	/* 19 */
 			"b\x0f" "ES\0"	/* 15 */
 			"\0", tdes3);
-			DPRINTF(EDEB_NOTE, "rxdesc[%d].tdes3=%s\n", index, buf);
+			DPRINTF(EDEB_NOTE,
+			"rxdesc[%d].tdes3=%s\n", index, buf);
 #endif
 			if_statinc(ifp, if_ierrors);
 			if (m0 != NULL) {
@@ -1061,7 +1063,7 @@ eqos_intr_mtl(struct eqos_softc *sc, uin
 		}
 		if (new_status) {
 			new_status |= (ictrl &
-			(GMAC_MTL_Q0_INTERRUPT_CTRL_STATUS_RXOIE|
+			(GMAC_MTL_Q0_INTERRUPT_CTRL_STATUS_RXOIE |
 			 GMAC_MTL_Q0_INTERRUPT_CTRL_STATUS_TXUIE));
 			WR4(sc, GMAC_MTL_Q0_INTERRUPT_CTRL_STATUS, new_status);
 		}
@@ -1387,10 +1389,10 @@ eqos_attach(struct eqos_softc *sc)
 	snpsver = ver & GMAC_MAC_VERSION_SNPSVER_MASK;
 
 	if ((snpsver < 0x51) || (snpsver > 0x52)) {
-	   aprint_error(": EQOS version 0x%02xx not supported\n",
-		   snpsver);
-	   return ENXIO;
-   }
+		aprint_error(": EQOS version 0x%02xx not supported\n",
+		snpsver);
+		return ENXIO;
+	}
 
 	if (sc->sc_csr_clock < 2000) {
 		aprint_error(": CSR clock too low\n");
@@ -1447,7 +1449,8 @@ eqos_attach(struct eqos_softc *sc)
 	callout_setfunc(>sc_stat_ch, eqos_tick, sc);
 
 	eqos_get_eaddr(sc, eaddr);
-	aprint_normal_dev(sc->sc_dev, "Ethernet address %s\n", ether_sprintf(eaddr));
+	aprint_normal_dev(sc->sc_dev,
+	"Ethernet address %s\n", ether_sprintf(eaddr));
 
 	/* Soft reset EMAC core */
 	error = eqos_reset(sc);
@@ -1460,7 +1463,8 @@ eqos_attach(struct eqos_softc *sc)
 
 	/* Setup DMA descriptors */
 	if (eqos_setup_dma(sc, 0) != 0) {
-		aprint_error_dev(sc->sc_dev, "failed to setup DMA descriptors\n");
+		aprint_error_dev(sc->sc_dev,
+		"failed to setup DMA descriptors\n");
 		return EINVAL;
 	}
 



CVS commit: src/sys/dev/ic

2023-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 14:54:53 UTC 2023

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

Log Message:
eqos(4): KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 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

2023-10-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Oct 21 14:49:12 UTC 2023

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 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

2023-10-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Oct 21 14:49:12 UTC 2023

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 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.21 src/sys/dev/ic/dwc_eqos.c:1.22
--- src/sys/dev/ic/dwc_eqos.c:1.21	Fri Oct 20 13:29:51 2023
+++ src/sys/dev/ic/dwc_eqos.c	Sat Oct 21 14:49:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.21 2023/10/20 13:29:51 msaitoh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.22 2023/10/21 14:49:12 skrll Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -38,7 +38,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.21 2023/10/20 13:29:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.22 2023/10/21 14:49:12 skrll Exp $");
 
 #include 
 #include 
@@ -1390,7 +1390,7 @@ eqos_attach(struct eqos_softc *sc)
 	   aprint_error(": EQOS version 0x%02xx not supported\n",
 		   snpsver);
 	   return ENXIO;
-   }	
+   }
 
 	if (sc->sc_csr_clock < 2000) {
 		aprint_error(": CSR clock too low\n");



CVS commit: src/sys/dev/ic

2023-10-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct 20 13:29:51 UTC 2023

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

Log Message:
eqos(4): Fix compile error for arch that sizeof(bus_size_t) == 4 (i386).


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 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.20 src/sys/dev/ic/dwc_eqos.c:1.21
--- src/sys/dev/ic/dwc_eqos.c:1.20	Fri Oct 20 09:58:11 2023
+++ src/sys/dev/ic/dwc_eqos.c	Fri Oct 20 13:29:51 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.20 2023/10/20 09:58:11 msaitoh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.21 2023/10/20 13:29:51 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -38,7 +38,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.20 2023/10/20 09:58:11 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.21 2023/10/20 13:29:51 msaitoh Exp $");
 
 #include 
 #include 
@@ -90,7 +90,7 @@ unsigned int eqos_debug;
 #define	CALLOUT_FLAGS		0
 #endif
 
-#define	DESC_BOUNDARY		(1ULL << 32)
+#define	DESC_BOUNDARY		((sizeof(bus_size_t) > 4) ? (1ULL << 32) : 0)
 #define	DESC_ALIGN		sizeof(struct eqos_dma_desc)
 #define	TX_DESC_COUNT		EQOS_DMA_DESC_COUNT
 #define	TX_DESC_SIZE		(TX_DESC_COUNT * DESC_ALIGN)
@@ -272,10 +272,12 @@ eqos_setup_txdesc(struct eqos_softc *sc,
 		++sc->sc_tx.queued;
 	}
 
-	KASSERT(!EQOS_HW_FEATURE_ADDR64_32BIT(sc) || (paddr >> 32) == 0);
+	KASSERT(!EQOS_HW_FEATURE_ADDR64_32BIT(sc) ||
+	((uint64_t)paddr >> 32) == 0);
 
 	sc->sc_tx.desc_ring[index].tdes0 = htole32((uint32_t)paddr);
-	sc->sc_tx.desc_ring[index].tdes1 = htole32((uint32_t)(paddr >> 32));
+	sc->sc_tx.desc_ring[index].tdes1
+	= htole32((uint32_t)((uint64_t)paddr >> 32));
 	sc->sc_tx.desc_ring[index].tdes2 = htole32(tdes2 | len);
 	sc->sc_tx.desc_ring[index].tdes3 = htole32(tdes3 | total_len);
 	DPRINTF(EDEB_TXRING, "preparing desc %u\n", index);
@@ -359,7 +361,8 @@ eqos_setup_rxdesc(struct eqos_softc *sc,
 {
 
 	sc->sc_rx.desc_ring[index].tdes0 = htole32((uint32_t)paddr);
-	sc->sc_rx.desc_ring[index].tdes1 = htole32((uint32_t)(paddr >> 32));
+	sc->sc_rx.desc_ring[index].tdes1 =
+	htole32((uint32_t)((uint64_t)paddr >> 32));
 	sc->sc_rx.desc_ring[index].tdes2 = htole32(0);
 	bus_dmamap_sync(sc->sc_dmat, sc->sc_rx.desc_map,
 	DESC_OFF(index), offsetof(struct eqos_dma_desc, tdes3),
@@ -541,7 +544,7 @@ eqos_init_rings(struct eqos_softc *sc, i
 	sc->sc_rx_receiving_m_last = NULL;
 
 	WR4(sc, GMAC_DMA_CHAN0_TX_BASE_ADDR_HI,
-	(uint32_t)(sc->sc_tx.desc_ring_paddr >> 32));
+	(uint32_t)((uint64_t)sc->sc_tx.desc_ring_paddr >> 32));
 	WR4(sc, GMAC_DMA_CHAN0_TX_BASE_ADDR,
 	(uint32_t)sc->sc_tx.desc_ring_paddr);
 	WR4(sc, GMAC_DMA_CHAN0_TX_RING_LEN, TX_DESC_COUNT - 1);
@@ -550,7 +553,7 @@ eqos_init_rings(struct eqos_softc *sc, i
 
 	sc->sc_rx.cur = sc->sc_rx.next = sc->sc_rx.queued = 0;
 	WR4(sc, GMAC_DMA_CHAN0_RX_BASE_ADDR_HI,
-	(uint32_t)(sc->sc_rx.desc_ring_paddr >> 32));
+	(uint32_t)((uint64_t)sc->sc_rx.desc_ring_paddr >> 32));
 	WR4(sc, GMAC_DMA_CHAN0_RX_BASE_ADDR,
 	(uint32_t)sc->sc_rx.desc_ring_paddr);
 	WR4(sc, GMAC_DMA_CHAN0_RX_RING_LEN, RX_DESC_COUNT - 1);



CVS commit: src/sys/dev/ic

2023-10-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct 20 13:29:51 UTC 2023

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

Log Message:
eqos(4): Fix compile error for arch that sizeof(bus_size_t) == 4 (i386).


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 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

2023-10-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct 20 09:58:11 UTC 2023

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

Log Message:
eqos(4): Accept if snpsver == 0x52. Tested with Intel Elkhart Lake.

 TODO:
Multiqueue support.
Add watchdog timer.
Add detach function.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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

2023-10-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct 20 09:58:11 UTC 2023

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

Log Message:
eqos(4): Accept if snpsver == 0x52. Tested with Intel Elkhart Lake.

 TODO:
Multiqueue support.
Add watchdog timer.
Add detach function.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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.19 src/sys/dev/ic/dwc_eqos.c:1.20
--- src/sys/dev/ic/dwc_eqos.c:1.19	Fri Oct 20 09:53:27 2023
+++ src/sys/dev/ic/dwc_eqos.c	Fri Oct 20 09:58:11 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.19 2023/10/20 09:53:27 msaitoh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.20 2023/10/20 09:58:11 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -28,12 +28,17 @@
 
 /*
  * DesignWare Ethernet Quality-of-Service controller
+ *
+ * TODO:
+ *	Multiqueue support.
+ *	Add watchdog timer.
+ *	Add detach function.
  */
 
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.19 2023/10/20 09:53:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.20 2023/10/20 09:58:11 msaitoh Exp $");
 
 #include 
 #include 
@@ -1378,11 +1383,11 @@ eqos_attach(struct eqos_softc *sc)
 	GMAC_MAC_VERSION_USERVER_SHIFT;
 	snpsver = ver & GMAC_MAC_VERSION_SNPSVER_MASK;
 
-	if (snpsver != 0x51) {
-		aprint_error(": EQOS version 0x%02xx not supported\n",
-		snpsver);
-		return ENXIO;
-	}
+	if ((snpsver < 0x51) || (snpsver > 0x52)) {
+	   aprint_error(": EQOS version 0x%02xx not supported\n",
+		   snpsver);
+	   return ENXIO;
+   }	
 
 	if (sc->sc_csr_clock < 2000) {
 		aprint_error(": CSR clock too low\n");



CVS commit: src/sys/dev/ic

2023-10-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct 20 09:53:27 UTC 2023

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

Log Message:
eqos(4): Add missing clock range.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 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

2023-10-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct 20 09:53:27 UTC 2023

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

Log Message:
eqos(4): Add missing clock range.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 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.18 src/sys/dev/ic/dwc_eqos.c:1.19
--- src/sys/dev/ic/dwc_eqos.c:1.18	Fri Oct 20 09:51:49 2023
+++ src/sys/dev/ic/dwc_eqos.c	Fri Oct 20 09:53:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.18 2023/10/20 09:51:49 msaitoh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.19 2023/10/20 09:53:27 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.18 2023/10/20 09:51:49 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.19 2023/10/20 09:53:27 msaitoh Exp $");
 
 #include 
 #include 
@@ -1398,6 +1398,8 @@ eqos_attach(struct eqos_softc *sc)
 	} else if (sc->sc_csr_clock < 25000) {
 		sc->sc_clock_range = GMAC_MAC_MDIO_ADDRESS_CR_150_250;
 	} else if (sc->sc_csr_clock < 3) {
+		sc->sc_clock_range = GMAC_MAC_MDIO_ADDRESS_CR_250_300;
+	} else if (sc->sc_csr_clock < 5) {
 		sc->sc_clock_range = GMAC_MAC_MDIO_ADDRESS_CR_300_500;
 	} else if (sc->sc_csr_clock < 8) {
 		sc->sc_clock_range = GMAC_MAC_MDIO_ADDRESS_CR_500_800;



  1   2   3   4   5   6   7   >