CVS commit: src/sys/dev/isa

2023-11-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Nov 20 04:26:34 UTC 2023

Modified Files:
src/sys/dev/isa: cy_isa.c

Log Message:
cy_isa_probe(): No need to put a ~3KB cy_softc on the stack.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/isa/cy_isa.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/isa/cy_isa.c
diff -u src/sys/dev/isa/cy_isa.c:1.23 src/sys/dev/isa/cy_isa.c:1.24
--- src/sys/dev/isa/cy_isa.c:1.23	Wed Mar 26 17:50:32 2008
+++ src/sys/dev/isa/cy_isa.c	Mon Nov 20 04:26:34 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cy_isa.c,v 1.23 2008/03/26 17:50:32 matt Exp $	*/
+/*	$NetBSD: cy_isa.c,v 1.24 2023/11/20 04:26:34 thorpej Exp $	*/
 
 /*
  * cy.c
@@ -10,11 +10,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cy_isa.c,v 1.23 2008/03/26 17:50:32 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cy_isa.c,v 1.24 2023/11/20 04:26:34 thorpej Exp $");
 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -36,30 +37,32 @@ int
 cy_isa_probe(device_t parent, cfdata_t match, void *aux)
 {
 	struct isa_attach_args *ia = aux;
-	struct cy_softc sc;
-	int found;
+	struct cy_softc *sc;
+	int found = 0;
 
 	if (ia->ia_niomem < 1)
 		return (0);
 	if (ia->ia_nirq < 1)
 		return (0);
 
-	sc.sc_memt = ia->ia_memt;
-	sc.sc_bustype = CY_BUSTYPE_ISA;
-
 	/* Disallow wildcarded memory address. */
 	if (ia->ia_iomem[0].ir_addr == ISA_UNKNOWN_IOMEM)
 		return 0;
 	if (ia->ia_irq[0].ir_irq == ISA_UNKNOWN_IRQ)
 		return 0;
 
+	sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
+
+	sc->sc_memt = ia->ia_memt;
+	sc->sc_bustype = CY_BUSTYPE_ISA;
+
 	if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, CY_MEMSIZE, 0,
-	&sc.sc_bsh) != 0)
-		return 0;
+	&sc->sc_bsh) != 0)
+		goto out;
 
-	found = cy_find(&sc);
+	found = cy_find(sc);
 
-	bus_space_unmap(ia->ia_memt, sc.sc_bsh, CY_MEMSIZE);
+	bus_space_unmap(ia->ia_memt, sc->sc_bsh, CY_MEMSIZE);
 
 	if (found) {
 		ia->ia_niomem = 1;
@@ -70,6 +73,8 @@ cy_isa_probe(device_t parent, cfdata_t m
 		ia->ia_nio = 0;
 		ia->ia_ndrq = 0;
 	}
+ out:
+	kmem_free(sc, sizeof(*sc));
 	return (found);
 }
 



CVS commit: src/sys/dev/isa

2023-11-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Nov 20 04:26:34 UTC 2023

Modified Files:
src/sys/dev/isa: cy_isa.c

Log Message:
cy_isa_probe(): No need to put a ~3KB cy_softc on the stack.


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

2022-09-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 25 17:11:49 UTC 2022

Modified Files:
src/sys/dev/isa: elink.c fd.c pckbc_isa.c seagate.c wt.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/isa/elink.c
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/isa/fd.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/isa/pckbc_isa.c
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/isa/seagate.c
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/isa/wt.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/isa

2022-09-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 25 17:11:49 UTC 2022

Modified Files:
src/sys/dev/isa: elink.c fd.c pckbc_isa.c seagate.c wt.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/isa/elink.c
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/isa/fd.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/isa/pckbc_isa.c
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/isa/seagate.c
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/isa/wt.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/isa/elink.c
diff -u src/sys/dev/isa/elink.c:1.18 src/sys/dev/isa/elink.c:1.19
--- src/sys/dev/isa/elink.c:1.18	Sun Nov 10 21:16:35 2019
+++ src/sys/dev/isa/elink.c	Sun Sep 25 17:11:48 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: elink.c,v 1.18 2019/11/10 21:16:35 chs Exp $	*/
+/*	$NetBSD: elink.c,v 1.19 2022/09/25 17:11:48 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,13 +34,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: elink.c,v 1.18 2019/11/10 21:16:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elink.c,v 1.19 2022/09/25 17:11:48 thorpej Exp $");
 
 #include 
 #include 
-#include 
-#include 
 
+#include 
+#include 
 #include 
 
 #include 
@@ -84,8 +84,7 @@ elink_reset(bus_space_tag_t iot, bus_spa
 			goto out;
 
 	/* Mark this bus so we don't do it again. */
-	er = (struct elink_done_reset *)malloc(sizeof(struct elink_done_reset),
-	M_DEVBUF, M_WAITOK);
+	er = kmem_alloc(sizeof(*er), KM_SLEEP);
 	er->er_bus = bus;
 	LIST_INSERT_HEAD(&elink_all_resets, er, er_link);
 

Index: src/sys/dev/isa/fd.c
diff -u src/sys/dev/isa/fd.c:1.116 src/sys/dev/isa/fd.c:1.117
--- src/sys/dev/isa/fd.c:1.116	Sat Aug  7 16:19:12 2021
+++ src/sys/dev/isa/fd.c	Sun Sep 25 17:11:48 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.116 2021/08/07 16:19:12 thorpej Exp $	*/
+/*	$NetBSD: fd.c,v 1.117 2022/09/25 17:11:48 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003, 2008 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.116 2021/08/07 16:19:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.117 2022/09/25 17:11:48 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -107,7 +107,7 @@ __KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.116
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -1553,8 +1553,7 @@ fdioctl(dev_t dev, u_long cmd, void *add
 			return EINVAL;
 		}
 
-		fd_formb = malloc(sizeof(struct ne7_fd_formb),
-		M_TEMP, M_WAITOK);
+		fd_formb = kmem_alloc(sizeof(*fd_formb), KM_SLEEP);
 		fd_formb->head = form_cmd->head;
 		fd_formb->cyl = form_cmd->cylinder;
 		fd_formb->transfer_rate = fd->sc_type->rate;
@@ -1578,7 +1577,7 @@ fdioctl(dev_t dev, u_long cmd, void *add
 		}
 
 		error = fdformat(dev, fd_formb, l);
-		free(fd_formb, M_TEMP);
+		kmem_free(fd_formb, sizeof(*fd_formb));
 		return error;
 
 	case FDIOCGETOPTS:		/* get drive options */

Index: src/sys/dev/isa/pckbc_isa.c
diff -u src/sys/dev/isa/pckbc_isa.c:1.26 src/sys/dev/isa/pckbc_isa.c:1.27
--- src/sys/dev/isa/pckbc_isa.c:1.26	Thu Apr  3 23:49:47 2014
+++ src/sys/dev/isa/pckbc_isa.c	Sun Sep 25 17:11:48 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: pckbc_isa.c,v 1.26 2014/04/03 23:49:47 mrg Exp $ */
+/* $NetBSD: pckbc_isa.c,v 1.27 2022/09/25 17:11:48 thorpej Exp $ */
 
 /*
  * Copyright (c) 1998
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pckbc_isa.c,v 1.26 2014/04/03 23:49:47 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc_isa.c,v 1.27 2022/09/25 17:11:48 thorpej Exp $");
 
 #include "opt_pckbc.h"
 
@@ -35,7 +35,7 @@ __KERNEL_RCSID(0, "$NetBSD: pckbc_isa.c,
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -190,8 +190,7 @@ pckbc_isa_attach(device_t parent, device
 		bus_space_map(iot, IO_KBD + KBCMDP, 1, 0, &ioh_c))
 			panic("pckbc_attach: couldn't map");
 
-		t = malloc(sizeof(struct pckbc_internal), M_DEVBUF,
-		M_WAITOK|M_ZERO);
+		t = kmem_zalloc(sizeof(*t), KM_SLEEP);
 		t->t_iot = iot;
 		t->t_ioh_d = ioh_d;
 		t->t_ioh_c = ioh_c;

Index: src/sys/dev/isa/seagate.c
diff -u src/sys/dev/isa/seagate.c:1.76 src/sys/dev/isa/seagate.c:1.77
--- src/sys/dev/isa/seagate.c:1.76	Sat Aug  7 16:19:12 2021
+++ src/sys/dev/isa/seagate.c	Sun Sep 25 17:11:48 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: seagate.c,v 1.76 2021/08/07 16:19:12 thorpej Exp $	*/
+/*	$NetBSD: seagate.c,v 1.77 2022/09/25 17:11:48 thorpej Exp $	*/
 
 /*
  * ST01/02, Future Domain TMC-885, TMC-950 SCSI driver
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: seagate.c,v 1.76 2021/08/07 16:19:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: seagate.c,v 1.77 2022/09/25 17:11:48 thorpej Exp $");
 
 #include 
 #include 
@@ -76,7 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: seagate.c,v 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -808,7 +808,7 @@ sea_grow_scb(struct sea_sof

CVS commit: src/sys/dev/isa

2022-09-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 25 17:09:37 UTC 2022

Modified Files:
src/sys/dev/isa: atppc_isa.c atppc_isadma.c i82365_isa.c
i82365_isasubr.c isa_stub.c spkr_pcppi.c tcic2_isa.c ug_isa.c
vga_isa.c wdc_isa.c wds.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/isa/atppc_isa.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/isa/atppc_isadma.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/isa/i82365_isa.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/isa/i82365_isasubr.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/isa/isa_stub.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/isa/spkr_pcppi.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/isa/tcic2_isa.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/isa/ug_isa.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/isa/vga_isa.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/isa/wdc_isa.c
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/isa/wds.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/isa/atppc_isa.c
diff -u src/sys/dev/isa/atppc_isa.c:1.16 src/sys/dev/isa/atppc_isa.c:1.17
--- src/sys/dev/isa/atppc_isa.c:1.16	Fri Dec  3 13:27:38 2021
+++ src/sys/dev/isa/atppc_isa.c	Sun Sep 25 17:09:36 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: atppc_isa.c,v 1.16 2021/12/03 13:27:38 andvar Exp $ */
+/* $NetBSD: atppc_isa.c,v 1.17 2022/09/25 17:09:36 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2001 Alcove - Nicolas Souchu
@@ -30,14 +30,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atppc_isa.c,v 1.16 2021/12/03 13:27:38 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atppc_isa.c,v 1.17 2022/09/25 17:09:36 thorpej Exp $");
 
 #include "opt_atppc.h"
 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 

Index: src/sys/dev/isa/atppc_isadma.c
diff -u src/sys/dev/isa/atppc_isadma.c:1.7 src/sys/dev/isa/atppc_isadma.c:1.8
--- src/sys/dev/isa/atppc_isadma.c:1.7	Tue Apr 15 15:02:28 2008
+++ src/sys/dev/isa/atppc_isadma.c	Sun Sep 25 17:09:36 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: atppc_isadma.c,v 1.7 2008/04/15 15:02:28 cegger Exp $ */
+/* $NetBSD: atppc_isadma.c,v 1.8 2022/09/25 17:09:36 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2001 Alcove - Nicolas Souchu
@@ -30,14 +30,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atppc_isadma.c,v 1.7 2008/04/15 15:02:28 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atppc_isadma.c,v 1.8 2022/09/25 17:09:36 thorpej Exp $");
 
 #include "opt_atppc.h"
 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 

Index: src/sys/dev/isa/i82365_isa.c
diff -u src/sys/dev/isa/i82365_isa.c:1.35 src/sys/dev/isa/i82365_isa.c:1.36
--- src/sys/dev/isa/i82365_isa.c:1.35	Thu Jul 14 10:19:06 2016
+++ src/sys/dev/isa/i82365_isa.c	Sun Sep 25 17:09:36 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: i82365_isa.c,v 1.35 2016/07/14 10:19:06 msaitoh Exp $	*/
+/*	$NetBSD: i82365_isa.c,v 1.36 2022/09/25 17:09:36 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i82365_isa.c,v 1.35 2016/07/14 10:19:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82365_isa.c,v 1.36 2022/09/25 17:09:36 thorpej Exp $");
 
 #define	PCICISADEBUG
 
@@ -38,7 +38,6 @@ __KERNEL_RCSID(0, "$NetBSD: i82365_isa.c
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 

Index: src/sys/dev/isa/i82365_isasubr.c
diff -u src/sys/dev/isa/i82365_isasubr.c:1.48 src/sys/dev/isa/i82365_isasubr.c:1.49
--- src/sys/dev/isa/i82365_isasubr.c:1.48	Sat Oct 27 17:18:24 2012
+++ src/sys/dev/isa/i82365_isasubr.c	Sun Sep 25 17:09:36 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: i82365_isasubr.c,v 1.48 2012/10/27 17:18:24 chs Exp $	*/
+/*	$NetBSD: i82365_isasubr.c,v 1.49 2022/09/25 17:09:36 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2000 Christian E. Hopps.  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i82365_isasubr.c,v 1.48 2012/10/27 17:18:24 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82365_isasubr.c,v 1.49 2022/09/25 17:09:36 thorpej Exp $");
 
 #define	PCICISADEBUG
 
@@ -40,7 +40,6 @@ __KERNEL_RCSID(0, "$NetBSD: i82365_isasu
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 

Index: src/sys/dev/isa/isa_stub.c
diff -u src/sys/dev/isa/isa_stub.c:1.3 src/sys/dev/isa/isa_stub.c:1.4
--- src/sys/dev/isa/isa_stub.c:1.3	Tue Oct 18 22:04:34 2016
+++ src/sys/dev/isa/isa_stub.c	Sun Sep 25 17:09:36 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_stub.c,v 1.3 2016/10/18 22:04:34 jdolecek Exp $	*/
+/*	$NetBSD: isa_stub.c,v 1.4 2022/09/25 17:09:36 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -30,12 +30,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isa_stub.c,v 1.3 2016/10/18 22:04:34 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_stub.c,v 1.4 2022/09/25 17:09:36 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 

Index: src/sys/dev/isa/spkr_pcppi.c
d

CVS commit: src/sys/dev/isa

2022-09-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 25 17:09:37 UTC 2022

Modified Files:
src/sys/dev/isa: atppc_isa.c atppc_isadma.c i82365_isa.c
i82365_isasubr.c isa_stub.c spkr_pcppi.c tcic2_isa.c ug_isa.c
vga_isa.c wdc_isa.c wds.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/isa/atppc_isa.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/isa/atppc_isadma.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/isa/i82365_isa.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/isa/i82365_isasubr.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/isa/isa_stub.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/isa/spkr_pcppi.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/isa/tcic2_isa.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/isa/ug_isa.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/isa/vga_isa.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/isa/wdc_isa.c
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/isa/wds.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/isa

2022-09-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 24 23:21:59 UTC 2022

Modified Files:
src/sys/dev/isa: opl_ess.c opl_isa.c opl_sb.c opl_wss.c opl_ym.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/isa/opl_ess.c src/sys/dev/isa/opl_ym.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/isa/opl_isa.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/isa/opl_sb.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/isa/opl_wss.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/isa

2022-09-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 24 23:21:59 UTC 2022

Modified Files:
src/sys/dev/isa: opl_ess.c opl_isa.c opl_sb.c opl_wss.c opl_ym.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/isa/opl_ess.c src/sys/dev/isa/opl_ym.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/isa/opl_isa.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/isa/opl_sb.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/isa/opl_wss.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/isa/opl_ess.c
diff -u src/sys/dev/isa/opl_ess.c:1.19 src/sys/dev/isa/opl_ess.c:1.20
--- src/sys/dev/isa/opl_ess.c:1.19	Wed May  8 13:40:18 2019
+++ src/sys/dev/isa/opl_ess.c	Sat Sep 24 23:21:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: opl_ess.c,v 1.19 2019/05/08 13:40:18 isaki Exp $	*/
+/*	$NetBSD: opl_ess.c,v 1.20 2022/09/24 23:21:59 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc.
@@ -30,14 +30,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: opl_ess.c,v 1.19 2019/05/08 13:40:18 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: opl_ess.c,v 1.20 2022/09/24 23:21:59 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
Index: src/sys/dev/isa/opl_ym.c
diff -u src/sys/dev/isa/opl_ym.c:1.19 src/sys/dev/isa/opl_ym.c:1.20
--- src/sys/dev/isa/opl_ym.c:1.19	Wed May  8 13:40:18 2019
+++ src/sys/dev/isa/opl_ym.c	Sat Sep 24 23:21:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: opl_ym.c,v 1.19 2019/05/08 13:40:18 isaki Exp $	*/
+/*	$NetBSD: opl_ym.c,v 1.20 2022/09/24 23:21:59 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: opl_ym.c,v 1.19 2019/05/08 13:40:18 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: opl_ym.c,v 1.20 2022/09/24 23:21:59 thorpej Exp $");
 
 #include "mpu_ym.h"
 
@@ -38,7 +38,6 @@ __KERNEL_RCSID(0, "$NetBSD: opl_ym.c,v 1
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Index: src/sys/dev/isa/opl_isa.c
diff -u src/sys/dev/isa/opl_isa.c:1.22 src/sys/dev/isa/opl_isa.c:1.23
--- src/sys/dev/isa/opl_isa.c:1.22	Wed May  8 13:40:18 2019
+++ src/sys/dev/isa/opl_isa.c	Sat Sep 24 23:21:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: opl_isa.c,v 1.22 2019/05/08 13:40:18 isaki Exp $	*/
+/*	$NetBSD: opl_isa.c,v 1.23 2022/09/24 23:21:59 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc.
@@ -30,14 +30,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: opl_isa.c,v 1.22 2019/05/08 13:40:18 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: opl_isa.c,v 1.23 2022/09/24 23:21:59 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Index: src/sys/dev/isa/opl_sb.c
diff -u src/sys/dev/isa/opl_sb.c:1.21 src/sys/dev/isa/opl_sb.c:1.22
--- src/sys/dev/isa/opl_sb.c:1.21	Wed May  8 13:40:18 2019
+++ src/sys/dev/isa/opl_sb.c	Sat Sep 24 23:21:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: opl_sb.c,v 1.21 2019/05/08 13:40:18 isaki Exp $	*/
+/*	$NetBSD: opl_sb.c,v 1.22 2022/09/24 23:21:59 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -30,14 +30,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: opl_sb.c,v 1.21 2019/05/08 13:40:18 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: opl_sb.c,v 1.22 2022/09/24 23:21:59 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Index: src/sys/dev/isa/opl_wss.c
diff -u src/sys/dev/isa/opl_wss.c:1.16 src/sys/dev/isa/opl_wss.c:1.17
--- src/sys/dev/isa/opl_wss.c:1.16	Wed May  8 13:40:18 2019
+++ src/sys/dev/isa/opl_wss.c	Sat Sep 24 23:21:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: opl_wss.c,v 1.16 2019/05/08 13:40:18 isaki Exp $	*/
+/*	$NetBSD: opl_wss.c,v 1.17 2022/09/24 23:21:59 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -29,14 +29,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: opl_wss.c,v 1.16 2019/05/08 13:40:18 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: opl_wss.c,v 1.17 2022/09/24 23:21:59 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 



CVS commit: src/sys/dev/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 17:21:52 UTC 2022

Modified Files:
src/sys/dev/isa: if_iy.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/isa/if_iy.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/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 17:21:52 UTC 2022

Modified Files:
src/sys/dev/isa: if_iy.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/isa/if_iy.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/isa/if_iy.c
diff -u src/sys/dev/isa/if_iy.c:1.113 src/sys/dev/isa/if_iy.c:1.114
--- src/sys/dev/isa/if_iy.c:1.113	Wed Jan 29 06:21:40 2020
+++ src/sys/dev/isa/if_iy.c	Sat Sep 17 17:21:52 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iy.c,v 1.113 2020/01/29 06:21:40 thorpej Exp $	*/
+/*	$NetBSD: if_iy.c,v 1.114 2022/09/17 17:21:52 thorpej Exp $	*/
 /* #define IYDEBUG */
 /* #define IYMEMDEBUG */
 
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.113 2020/01/29 06:21:40 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.114 2022/09/17 17:21:52 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -112,6 +112,8 @@ struct iy_softc {
 	int sram, tx_size, rx_size;
 
 	int tx_start, tx_end, tx_last;
+	bool tx_busy;
+
 	int rx_start;
 
 	int doing_mc_setup;
@@ -416,7 +418,8 @@ iystop(struct iy_softc *sc)
 #endif
 	sc->tx_start = sc->tx_end = sc->rx_size;
 	sc->tx_last = 0;
-	sc->sc_ethercom.ec_if.if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+	sc->sc_ethercom.ec_if.if_flags &= ~IFF_RUNNING;
+	sc->tx_busy = false;
 }
 
 void
@@ -615,7 +618,7 @@ iyinit(struct iy_softc *sc)
 	bus_space_write_1(iot, ioh, 0, RCV_ENABLE_CMD);
 
 	ifp->if_flags |= IFF_RUNNING;
-	ifp->if_flags &= ~IFF_OACTIVE;
+	sc->tx_busy = false;
 }
 
 void
@@ -639,7 +642,10 @@ iystart(struct ifnet *ifp)
 #endif
 	sc = ifp->if_softc;
 
-	if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
+		return;
+
+	if (sc->tx_busy)
 		return;
 
 	iy_intr_tx(sc);
@@ -696,11 +702,11 @@ iystart(struct ifnet *ifp)
 
 		if ((len+pad+2*I595_XMT_HDRLEN) > avail) {
 #ifdef IYDEBUG
-			printf("%s: len = %d, avail = %d, setting OACTIVE\n",
+			printf("%s: len = %d, avail = %d, setting tx_busy\n",
 			device_xname(sc->sc_dev), len, avail);
 #endif
 			/* mark interface as full ... */
-			ifp->if_flags |= IFF_OACTIVE;
+			sc->tx_busy = true;
 
 			/* and wait for any transmission result */
 			bus_space_write_1(iot, ioh, 0, BANK_SEL(2));
@@ -970,7 +976,7 @@ iyintr(void *arg)
 	}
 	if (status & TX_INT) {
 		/* Tell feeders we may be able to accept more data... */
-		ifp->if_flags &= ~IFF_OACTIVE;
+		sc->tx_busy = false;
 		/* and get more data. */
 		iystart(ifp);
 		bus_space_write_1(iot, ioh, STATUS_REG, TX_INT);
@@ -1147,7 +1153,7 @@ iy_intr_tx(struct iy_softc *sc)
 			sc->tx_start = txnext;
 		else
 			sc->tx_start = sc->tx_end;
-		ifp->if_flags &= ~IFF_OACTIVE;
+		sc->tx_busy = false;
 
 		if (txstat2 & 0x0020)
 			if_statadd(ifp, if_collisions, 16);
@@ -1371,8 +1377,7 @@ iy_mc_setup(struct iy_softc *sc)
 		break;
 	}
 	sc->tx_start = sc->tx_end;
-	ifp->if_flags &= ~IFF_OACTIVE;
-
+	sc->tx_busy = false;
 }
 
 static void
@@ -1412,9 +1417,9 @@ iy_mc_reset(struct iy_softc *sc)
 		ETHER_UNLOCK(ecp);
 		/* OK, we really need to do it now: */
 #if 0
-		if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE))
-		!= IFF_RUNNING) {
-			ifp->if_flags |= IFF_OACTIVE;
+		if ((ifp->if_flags & IFF_RUNNING) == 0 || sc->tx_busy) {
+			/* XXX This logic is b0rk3n. */
+			sc->tx_busy = true;
 			sc->want_mc_setup = 1;
 			return;
 		}



CVS commit: src/sys/dev/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 17:15:02 UTC 2022

Modified Files:
src/sys/dev/isa: if_el.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/isa/if_el.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/isa/if_el.c
diff -u src/sys/dev/isa/if_el.c:1.101 src/sys/dev/isa/if_el.c:1.102
--- src/sys/dev/isa/if_el.c:1.101	Sat Sep 17 17:08:43 2022
+++ src/sys/dev/isa/if_el.c	Sat Sep 17 17:15:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_el.c,v 1.101 2022/09/17 17:08:43 thorpej Exp $	*/
+/*	$NetBSD: if_el.c,v 1.102 2022/09/17 17:15:02 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1994, Matthew E. Kimmel.  Permission is hereby granted
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.101 2022/09/17 17:08:43 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.102 2022/09/17 17:15:02 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -72,6 +72,7 @@ struct el_softc {
 	struct ethercom sc_ethercom;	/* ethernet common */
 	bus_space_tag_t sc_iot;		/* bus space identifier */
 	bus_space_handle_t sc_ioh;	/* i/o handle */
+	bool sc_txbusy;			/* transmitter is busy */
 
 	krndsource_t rnd_source;
 };
@@ -337,7 +338,7 @@ elinit(struct el_softc *sc)
 
 	/* Set flags appropriately. */
 	ifp->if_flags |= IFF_RUNNING;
-	ifp->if_flags &= ~IFF_OACTIVE;
+	sc->sc_txbusy = false;
 
 	/* And start output. */
 	elstart(ifp);
@@ -361,12 +362,12 @@ elstart(struct ifnet *ifp)
 	s = splnet();
 
 	/* Don't do anything if output is active. */
-	if ((ifp->if_flags & IFF_OACTIVE) != 0) {
+	if (sc->sc_txbusy) {
 		splx(s);
 		return;
 	}
 
-	ifp->if_flags |= IFF_OACTIVE;
+	sc->sc_txbusy = true;
 
 	/*
 	 * The main loop.  They warned me against endless loops, but would I
@@ -448,13 +449,13 @@ elstart(struct ifnet *ifp)
 		(void)bus_space_read_1(iot, ioh, EL_AS);
 		bus_space_write_1(iot, ioh, EL_AC, EL_AC_IRQE | EL_AC_RX);
 		splx(s);
-		/* Interrupt here. */
+		/* (Maybe) interrupt here. */
 		s = splnet();
 	}
 
 	(void)bus_space_read_1(iot, ioh, EL_AS);
 	bus_space_write_1(iot, ioh, EL_AC, EL_AC_IRQE | EL_AC_RX);
-	ifp->if_flags &= ~IFF_OACTIVE;
+	sc->sc_txbusy = false;
 	splx(s);
 }
 



CVS commit: src/sys/dev/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 17:15:02 UTC 2022

Modified Files:
src/sys/dev/isa: if_el.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/isa/if_el.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/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 17:08:43 UTC 2022

Modified Files:
src/sys/dev/isa: if_el.c

Log Message:
u_int*_t -> uint*_t


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/isa/if_el.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/isa/if_el.c
diff -u src/sys/dev/isa/if_el.c:1.100 src/sys/dev/isa/if_el.c:1.101
--- src/sys/dev/isa/if_el.c:1.100	Sat Sep 17 17:05:12 2022
+++ src/sys/dev/isa/if_el.c	Sat Sep 17 17:08:43 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_el.c,v 1.100 2022/09/17 17:05:12 thorpej Exp $	*/
+/*	$NetBSD: if_el.c,v 1.101 2022/09/17 17:08:43 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1994, Matthew E. Kimmel.  Permission is hereby granted
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.100 2022/09/17 17:05:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.101 2022/09/17 17:08:43 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -110,8 +110,8 @@ elprobe(device_t parent, cfdata_t match,
 	bus_space_tag_t iot = ia->ia_iot;
 	bus_space_handle_t ioh;
 	int iobase;
-	u_int8_t station_addr[ETHER_ADDR_LEN];
-	u_int8_t i;
+	uint8_t station_addr[ETHER_ADDR_LEN];
+	uint8_t i;
 	int rval;
 
 	rval = 0;
@@ -198,8 +198,8 @@ elattach(device_t parent, device_t self,
 	bus_space_tag_t iot = ia->ia_iot;
 	bus_space_handle_t ioh;
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
-	u_int8_t myaddr[ETHER_ADDR_LEN];
-	u_int8_t i;
+	uint8_t myaddr[ETHER_ADDR_LEN];
+	uint8_t i;
 
 	sc->sc_dev = self;
 
@@ -402,7 +402,7 @@ elstart(struct ifnet *ifp)
 		/* Copy the datagram to the buffer. */
 		for (m = m0; m != 0; m = m->m_next)
 			bus_space_write_multi_1(iot, ioh, EL_BUF,
-			mtod(m, u_int8_t *), m->m_len);
+			mtod(m, uint8_t *), m->m_len);
 		for (i = 0;
 		i < ETHER_MIN_LEN - ETHER_CRC_LEN - m0->m_pkthdr.len; i++)
 			bus_space_write_1(iot, ioh, EL_BUF, 0);
@@ -498,7 +498,7 @@ elintr(void *arg)
 	struct el_softc *sc = arg;
 	bus_space_tag_t iot = sc->sc_iot;
 	bus_space_handle_t ioh = sc->sc_ioh;
-	u_int8_t rxstat;
+	uint8_t rxstat;
 	int len;
 
 	DPRINTF(("elintr: "));
@@ -617,7 +617,7 @@ elget(struct el_softc *sc, int totlen)
 		}
 
 		m->m_len = len = uimin(totlen, len);
-		bus_space_read_multi_1(iot, ioh, EL_BUF, mtod(m, u_int8_t *), len);
+		bus_space_read_multi_1(iot, ioh, EL_BUF, mtod(m, uint8_t *), len);
 
 		totlen -= len;
 		if (totlen > 0) {



CVS commit: src/sys/dev/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 17:08:43 UTC 2022

Modified Files:
src/sys/dev/isa: if_el.c

Log Message:
u_int*_t -> uint*_t


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/isa/if_el.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/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 17:05:12 UTC 2022

Modified Files:
src/sys/dev/isa: if_el.c

Log Message:
Liberally apply static.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/isa/if_el.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/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 17:05:12 UTC 2022

Modified Files:
src/sys/dev/isa: if_el.c

Log Message:
Liberally apply static.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/isa/if_el.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/isa/if_el.c
diff -u src/sys/dev/isa/if_el.c:1.99 src/sys/dev/isa/if_el.c:1.100
--- src/sys/dev/isa/if_el.c:1.99	Wed Jan 29 06:21:40 2020
+++ src/sys/dev/isa/if_el.c	Sat Sep 17 17:05:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_el.c,v 1.99 2020/01/29 06:21:40 thorpej Exp $	*/
+/*	$NetBSD: if_el.c,v 1.100 2022/09/17 17:05:12 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1994, Matthew E. Kimmel.  Permission is hereby granted
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.99 2020/01/29 06:21:40 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.100 2022/09/17 17:05:12 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -79,20 +79,20 @@ struct el_softc {
 /*
  * prototypes
  */
-int elintr(void *);
-void elinit(struct el_softc *);
-int elioctl(struct ifnet *, u_long, void *);
-void elstart(struct ifnet *);
-void elwatchdog(struct ifnet *);
-void elreset(struct el_softc *);
-void elstop(struct el_softc *);
-static int el_xmit(struct el_softc *);
-void elread(struct el_softc *, int);
-struct mbuf *elget(struct el_softc *sc, int);
+static int	elintr(void *);
+static void	elinit(struct el_softc *);
+static int	elioctl(struct ifnet *, u_long, void *);
+static void	elstart(struct ifnet *);
+static void	elwatchdog(struct ifnet *);
+static void	elreset(struct el_softc *);
+static void	elstop(struct el_softc *);
+static int	el_xmit(struct el_softc *);
+static void	elread(struct el_softc *, int);
+static struct mbuf *elget(struct el_softc *sc, int);
 static inline void el_hardreset(struct el_softc *);
 
-int elprobe(device_t, cfdata_t, void *);
-void elattach(device_t, device_t, void *);
+static int	elprobe(device_t, cfdata_t, void *);
+static void	elattach(device_t, device_t, void *);
 
 CFATTACH_DECL_NEW(el, sizeof(struct el_softc),
 elprobe, elattach, NULL, NULL);
@@ -103,7 +103,7 @@ CFATTACH_DECL_NEW(el, sizeof(struct el_s
  * See if the card is there and at the right place.
  * (XXX - cgd -- needs help)
  */
-int
+static int
 elprobe(device_t parent, cfdata_t match, void *aux)
 {
 	struct isa_attach_args *ia = aux;
@@ -190,7 +190,7 @@ elprobe(device_t parent, cfdata_t match,
  * called, we know that the card exists at the given I/O address.  We still
  * assume that the IRQ given is correct.
  */
-void
+static void
 elattach(device_t parent, device_t self, void *aux)
 {
 	struct el_softc *sc = device_private(self);
@@ -260,7 +260,7 @@ elattach(device_t parent, device_t self,
 /*
  * Reset interface.
  */
-void
+static void
 elreset(struct el_softc *sc)
 {
 	int s;
@@ -275,7 +275,7 @@ elreset(struct el_softc *sc)
 /*
  * Stop interface.
  */
-void
+static void
 elstop(struct el_softc *sc)
 {
 
@@ -305,7 +305,7 @@ el_hardreset(struct el_softc *sc)
 /*
  * Initialize interface.
  */
-void
+static void
 elinit(struct el_softc *sc)
 {
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
@@ -348,7 +348,7 @@ elinit(struct el_softc *sc)
  * giving the receiver a chance between datagrams.  Call only from splnet or
  * interrupt level!
  */
-void
+static void
 elstart(struct ifnet *ifp)
 {
 	struct el_softc *sc = ifp->if_softc;
@@ -492,7 +492,7 @@ el_xmit(struct el_softc *sc)
 /*
  * Controller interrupt.
  */
-int
+static int
 elintr(void *arg)
 {
 	struct el_softc *sc = arg;
@@ -559,7 +559,7 @@ elintr(void *arg)
 /*
  * Pass a packet to the higher levels.
  */
-void
+static void
 elread(struct el_softc *sc, int len)
 {
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
@@ -588,7 +588,7 @@ elread(struct el_softc *sc, int len)
  * header stripped.  We copy the data into mbufs.  When full cluster sized
  * units are present we copy into clusters.
  */
-struct mbuf *
+static struct mbuf *
 elget(struct el_softc *sc, int totlen)
 {
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
@@ -642,7 +642,7 @@ bad:
 /*
  * Process an ioctl request. This code needs some work - it looks pretty ugly.
  */
-int
+static int
 elioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
 	struct el_softc *sc = ifp->if_softc;
@@ -710,7 +710,7 @@ elioctl(struct ifnet *ifp, u_long cmd, v
 /*
  * Device timeout routine.
  */
-void
+static void
 elwatchdog(struct ifnet *ifp)
 {
 	struct el_softc *sc = ifp->if_softc;



CVS commit: src/sys/dev/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 17:00:02 UTC 2022

Modified Files:
src/sys/dev/isa: if_eg.c

Log Message:
egstart(): Use m_copydata() rather than open-coding it.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/isa/if_eg.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/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 17:00:02 UTC 2022

Modified Files:
src/sys/dev/isa: if_eg.c

Log Message:
egstart(): Use m_copydata() rather than open-coding it.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/isa/if_eg.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/isa/if_eg.c
diff -u src/sys/dev/isa/if_eg.c:1.102 src/sys/dev/isa/if_eg.c:1.103
--- src/sys/dev/isa/if_eg.c:1.102	Sat Sep 17 16:54:01 2022
+++ src/sys/dev/isa/if_eg.c	Sat Sep 17 17:00:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_eg.c,v 1.102 2022/09/17 16:54:01 thorpej Exp $	*/
+/*	$NetBSD: if_eg.c,v 1.103 2022/09/17 17:00:02 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1993 Dean Huxley 
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.102 2022/09/17 16:54:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.103 2022/09/17 17:00:02 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -554,8 +554,7 @@ egstart(struct ifnet *ifp)
 	struct eg_softc *sc = ifp->if_softc;
 	bus_space_tag_t iot = sc->sc_iot;
 	bus_space_handle_t ioh = sc->sc_ioh;
-	struct mbuf *m0, *m;
-	char *buffer;
+	struct mbuf *m0;
 	int len;
 	uint16_t *ptr;
 
@@ -597,13 +596,11 @@ loop:
 		goto loop;
 	}
 
-	buffer = sc->eg_outbuf;
-	for (m = m0; m != 0; m = m->m_next) {
-		memcpy(buffer, mtod(m, void *), m->m_len);
-		buffer += m->m_len;
+	m_copydata(m0, 0, m0->m_pkthdr.len, sc->eg_outbuf);
+	if (len > m0->m_pkthdr.len) {
+		memset((uint8_t *)sc->eg_outbuf + m0->m_pkthdr.len, 0,
+		len - m0->m_pkthdr.len);
 	}
-	if (len > m0->m_pkthdr.len)
-		memset(buffer, 0, len - m0->m_pkthdr.len);
 
 	/* set direction bit: host -> adapter */
 	bus_space_write_1(iot, ioh, EG_CONTROL,



CVS commit: src/sys/dev/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 16:54:01 UTC 2022

Modified Files:
src/sys/dev/isa: if_eg.c

Log Message:
Convert an open-coded check for M_PKTHDR + panic into a KASSERT().


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/isa/if_eg.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/isa/if_eg.c
diff -u src/sys/dev/isa/if_eg.c:1.101 src/sys/dev/isa/if_eg.c:1.102
--- src/sys/dev/isa/if_eg.c:1.101	Sat Sep 17 16:52:26 2022
+++ src/sys/dev/isa/if_eg.c	Sat Sep 17 16:54:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_eg.c,v 1.101 2022/09/17 16:52:26 thorpej Exp $	*/
+/*	$NetBSD: if_eg.c,v 1.102 2022/09/17 16:54:01 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1993 Dean Huxley 
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.101 2022/09/17 16:52:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.102 2022/09/17 16:54:01 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -575,10 +575,7 @@ loop:
 	sc->eg_txbusy = true;
 
 	/* We need to use m->m_pkthdr.len, so require the header */
-	if ((m0->m_flags & M_PKTHDR) == 0) {
-		aprint_error_dev(sc->sc_dev, "no header mbuf\n");
-		panic("egstart");
-	}
+	KASSERT(m0->m_flags & M_PKTHDR);
 	len = uimax(m0->m_pkthdr.len, ETHER_MIN_LEN - ETHER_CRC_LEN);
 
 	bpf_mtap(ifp, m0, BPF_D_OUT);



CVS commit: src/sys/dev/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 16:54:01 UTC 2022

Modified Files:
src/sys/dev/isa: if_eg.c

Log Message:
Convert an open-coded check for M_PKTHDR + panic into a KASSERT().


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/isa/if_eg.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/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 16:52:26 UTC 2022

Modified Files:
src/sys/dev/isa: if_eg.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/isa/if_eg.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/isa/if_eg.c
diff -u src/sys/dev/isa/if_eg.c:1.100 src/sys/dev/isa/if_eg.c:1.101
--- src/sys/dev/isa/if_eg.c:1.100	Sat Sep 17 16:48:33 2022
+++ src/sys/dev/isa/if_eg.c	Sat Sep 17 16:52:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_eg.c,v 1.100 2022/09/17 16:48:33 thorpej Exp $	*/
+/*	$NetBSD: if_eg.c,v 1.101 2022/09/17 16:52:26 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1993 Dean Huxley 
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.100 2022/09/17 16:48:33 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.101 2022/09/17 16:52:26 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -105,6 +105,7 @@ struct eg_softc {
 	short	 eg_ram;		/* Amount of RAM on the card */
 	uint8_t eg_pcb[EG_PCBLEN];	/* Primary Command Block buffer */
 	uint8_t eg_incount;		/* Number of buffers currently used */
+	bool	eg_txbusy;		/* transmitter is busy */
 	void *	eg_inbuf;		/* Incoming packet buffer */
 	void *	eg_outbuf;		/* Outgoing packet buffer */
 
@@ -520,7 +521,7 @@ eginit(struct eg_softc *sc)
 
 	/* Interface is now `running', with no output active. */
 	ifp->if_flags |= IFF_RUNNING;
-	ifp->if_flags &= ~IFF_OACTIVE;
+	sc->eg_txbusy = false;
 
 	/* Attempt to start output, if any. */
 	egstart(ifp);
@@ -559,7 +560,10 @@ egstart(struct ifnet *ifp)
 	uint16_t *ptr;
 
 	/* Don't transmit if interface is busy or not running */
-	if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
+		return;
+
+	if (sc->eg_txbusy)
 		return;
 
 loop:
@@ -568,7 +572,7 @@ loop:
 	if (m0 == 0)
 		return;
 
-	ifp->if_flags |= IFF_OACTIVE;
+	sc->eg_txbusy = true;
 
 	/* We need to use m->m_pkthdr.len, so require the header */
 	if ((m0->m_flags & M_PKTHDR) == 0) {
@@ -591,7 +595,7 @@ loop:
 		aprint_error_dev(sc->sc_dev,
 		"can't send Send Packet command\n");
 		if_statinc(ifp, if_oerrors);
-		ifp->if_flags &= ~IFF_OACTIVE;
+		sc->eg_txbusy = false;
 		m_freem(m0);
 		goto loop;
 	}
@@ -665,7 +669,7 @@ egintr(void *arg)
 			if (sc->eg_pcb[8] & 0xf)
 if_statadd(ifp, if_collisions,
 sc->eg_pcb[8] & 0xf);
-			sc->sc_ethercom.ec_if.if_flags &= ~IFF_OACTIVE;
+			sc->eg_txbusy = false;
 			egstart(&sc->sc_ethercom.ec_if);
 			serviced = 1;
 			break;



CVS commit: src/sys/dev/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 16:52:26 UTC 2022

Modified Files:
src/sys/dev/isa: if_eg.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/isa/if_eg.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/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 16:48:33 UTC 2022

Modified Files:
src/sys/dev/isa: if_eg.c

Log Message:
u_int*_t -> uint*_t


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/isa/if_eg.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/isa/if_eg.c
diff -u src/sys/dev/isa/if_eg.c:1.99 src/sys/dev/isa/if_eg.c:1.100
--- src/sys/dev/isa/if_eg.c:1.99	Sat Sep 17 16:46:18 2022
+++ src/sys/dev/isa/if_eg.c	Sat Sep 17 16:48:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_eg.c,v 1.99 2022/09/17 16:46:18 thorpej Exp $	*/
+/*	$NetBSD: if_eg.c,v 1.100 2022/09/17 16:48:33 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1993 Dean Huxley 
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.99 2022/09/17 16:46:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.100 2022/09/17 16:48:33 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -100,11 +100,11 @@ struct eg_softc {
 	struct ethercom sc_ethercom;	/* Ethernet common part */
 	bus_space_tag_t sc_iot;		/* bus space identifier */
 	bus_space_handle_t sc_ioh;	/* i/o handle */
-	u_int8_t eg_rom_major;		/* Cards ROM version (major number) */
-	u_int8_t eg_rom_minor;		/* Cards ROM version (minor number) */
+	uint8_t eg_rom_major;		/* Cards ROM version (major number) */
+	uint8_t eg_rom_minor;		/* Cards ROM version (minor number) */
 	short	 eg_ram;		/* Amount of RAM on the card */
-	u_int8_t eg_pcb[EG_PCBLEN];	/* Primary Command Block buffer */
-	u_int8_t eg_incount;		/* Number of buffers currently used */
+	uint8_t eg_pcb[EG_PCBLEN];	/* Primary Command Block buffer */
+	uint8_t eg_incount;		/* Number of buffers currently used */
 	void *	eg_inbuf;		/* Incoming packet buffer */
 	void *	eg_outbuf;		/* Outgoing packet buffer */
 
@@ -128,19 +128,19 @@ static void	egread(struct eg_softc *, vo
 static struct mbuf *egget(struct eg_softc *, void *, int);
 static void	egstop(struct eg_softc *);
 
-static inline void egprintpcb(u_int8_t *);
-static int egoutPCB(bus_space_tag_t, bus_space_handle_t, u_int8_t);
-static int egreadPCBstat(bus_space_tag_t, bus_space_handle_t, u_int8_t);
+static inline void egprintpcb(uint8_t *);
+static int egoutPCB(bus_space_tag_t, bus_space_handle_t, uint8_t);
+static int egreadPCBstat(bus_space_tag_t, bus_space_handle_t, uint8_t);
 static int egreadPCBready(bus_space_tag_t, bus_space_handle_t);
-static int egwritePCB(bus_space_tag_t, bus_space_handle_t, u_int8_t *);
-static int egreadPCB(bus_space_tag_t, bus_space_handle_t, u_int8_t *);
+static int egwritePCB(bus_space_tag_t, bus_space_handle_t, uint8_t *);
+static int egreadPCB(bus_space_tag_t, bus_space_handle_t, uint8_t *);
 
 /*
  * Support stuff
  */
 
 static inline void
-egprintpcb(u_int8_t *pcb)
+egprintpcb(uint8_t *pcb)
 {
 	int i;
 
@@ -149,7 +149,7 @@ egprintpcb(u_int8_t *pcb)
 }
 
 static int
-egoutPCB(bus_space_tag_t iot, bus_space_handle_t ioh, u_int8_t b)
+egoutPCB(bus_space_tag_t iot, bus_space_handle_t ioh, uint8_t b)
 {
 	int i;
 
@@ -165,7 +165,7 @@ egoutPCB(bus_space_tag_t iot, bus_space_
 }
 
 static int
-egreadPCBstat(bus_space_tag_t iot, bus_space_handle_t ioh, u_int8_t statb)
+egreadPCBstat(bus_space_tag_t iot, bus_space_handle_t ioh, uint8_t statb)
 {
 	int i;
 
@@ -195,10 +195,10 @@ egreadPCBready(bus_space_tag_t iot, bus_
 }
 
 static int
-egwritePCB(bus_space_tag_t iot, bus_space_handle_t ioh, u_int8_t *pcb)
+egwritePCB(bus_space_tag_t iot, bus_space_handle_t ioh, uint8_t *pcb)
 {
 	int i;
-	u_int8_t len;
+	uint8_t len;
 
 	bus_space_write_1(iot, ioh, EG_CONTROL,
 	(bus_space_read_1(iot, ioh, EG_CONTROL) & ~EG_PCB_STAT) | EG_PCB_NULL);
@@ -224,7 +224,7 @@ egwritePCB(bus_space_tag_t iot, bus_spac
 }
 
 static int
-egreadPCB(bus_space_tag_t iot, bus_space_handle_t ioh, u_int8_t *pcb)
+egreadPCB(bus_space_tag_t iot, bus_space_handle_t ioh, uint8_t *pcb)
 {
 	int i;
 
@@ -279,7 +279,7 @@ egprobe(device_t parent, cfdata_t match,
 	bus_space_tag_t iot = ia->ia_iot;
 	bus_space_handle_t ioh;
 	int i, rval;
-	static u_int8_t pcb[EG_PCBLEN];
+	static uint8_t pcb[EG_PCBLEN];
 
 	rval = 0;
 
@@ -365,7 +365,7 @@ egattach(device_t parent, device_t self,
 	bus_space_tag_t iot = ia->ia_iot;
 	bus_space_handle_t ioh;
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
-	u_int8_t myaddr[ETHER_ADDR_LEN];
+	uint8_t myaddr[ETHER_ADDR_LEN];
 
 	sc->sc_dev = self;
 
@@ -556,7 +556,7 @@ egstart(struct ifnet *ifp)
 	struct mbuf *m0, *m;
 	char *buffer;
 	int len;
-	u_int16_t *ptr;
+	uint16_t *ptr;
 
 	/* Don't transmit if interface is busy or not running */
 	if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
@@ -608,7 +608,7 @@ loop:
 	bus_space_write_1(iot, ioh, EG_CONTROL,
 	bus_space_read_1(iot, ioh, EG_CONTROL) & ~EG_CTL_DIR);
 
-	for (ptr = (u_int16_t *) sc->eg_outbuf; len > 0; len -= 2) {
+	for (ptr = (uint16_t *) sc->eg_outbuf; len > 0; len -= 2) {
 		bus_space_write_2(iot, ioh, EG_DATA, *p

CVS commit: src/sys/dev/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 16:48:33 UTC 2022

Modified Files:
src/sys/dev/isa: if_eg.c

Log Message:
u_int*_t -> uint*_t


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/isa/if_eg.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/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 16:46:18 UTC 2022

Modified Files:
src/sys/dev/isa: if_eg.c

Log Message:
Liberally apply "static".


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/isa/if_eg.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/isa/if_eg.c
diff -u src/sys/dev/isa/if_eg.c:1.98 src/sys/dev/isa/if_eg.c:1.99
--- src/sys/dev/isa/if_eg.c:1.98	Sat Sep 17 16:42:38 2022
+++ src/sys/dev/isa/if_eg.c	Sat Sep 17 16:46:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_eg.c,v 1.98 2022/09/17 16:42:38 thorpej Exp $	*/
+/*	$NetBSD: if_eg.c,v 1.99 2022/09/17 16:46:18 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1993 Dean Huxley 
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.98 2022/09/17 16:42:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.99 2022/09/17 16:46:18 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -111,22 +111,22 @@ struct eg_softc {
 	krndsource_t rnd_source;
 };
 
-int egprobe(device_t, cfdata_t, void *);
-void egattach(device_t, device_t, void *);
+static int	egprobe(device_t, cfdata_t, void *);
+static void	egattach(device_t, device_t, void *);
 
 CFATTACH_DECL_NEW(eg, sizeof(struct eg_softc),
 egprobe, egattach, NULL, NULL);
 
-int egintr(void *);
-void eginit(struct eg_softc *);
-int egioctl(struct ifnet *, u_long, void *);
-void egrecv(struct eg_softc *);
-void egstart(struct ifnet *);
-void egwatchdog(struct ifnet *);
-void egreset(struct eg_softc *);
-void egread(struct eg_softc *, void *, int);
-struct mbuf *egget(struct eg_softc *, void *, int);
-void egstop(struct eg_softc *);
+static int	egintr(void *);
+static void	eginit(struct eg_softc *);
+static int	egioctl(struct ifnet *, u_long, void *);
+static void	egrecv(struct eg_softc *);
+static void	egstart(struct ifnet *);
+static void	egwatchdog(struct ifnet *);
+static void	egreset(struct eg_softc *);
+static void	egread(struct eg_softc *, void *, int);
+static struct mbuf *egget(struct eg_softc *, void *, int);
+static void	egstop(struct eg_softc *);
 
 static inline void egprintpcb(u_int8_t *);
 static int egoutPCB(bus_space_tag_t, bus_space_handle_t, u_int8_t);
@@ -272,7 +272,7 @@ egreadPCB(bus_space_tag_t iot, bus_space
  * Real stuff
  */
 
-int
+static int
 egprobe(device_t parent, cfdata_t match, void *aux)
 {
 	struct isa_attach_args *ia = aux;
@@ -357,7 +357,7 @@ egprobe(device_t parent, cfdata_t match,
 	return rval;
 }
 
-void
+static void
 egattach(device_t parent, device_t self, void *aux)
 {
 	struct eg_softc *sc = device_private(self);
@@ -467,7 +467,7 @@ egattach(device_t parent, device_t self,
 			  RND_TYPE_NET, RND_FLAG_DEFAULT);
 }
 
-void
+static void
 eginit(struct eg_softc *sc)
 {
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
@@ -526,7 +526,7 @@ eginit(struct eg_softc *sc)
 	egstart(ifp);
 }
 
-void
+static void
 egrecv(struct eg_softc *sc)
 {
 
@@ -547,7 +547,7 @@ egrecv(struct eg_softc *sc)
 	}
 }
 
-void
+static void
 egstart(struct ifnet *ifp)
 {
 	struct eg_softc *sc = ifp->if_softc;
@@ -617,7 +617,7 @@ loop:
 	m_freem(m0);
 }
 
-int
+static int
 egintr(void *arg)
 {
 	struct eg_softc *sc = arg;
@@ -705,7 +705,7 @@ egintr(void *arg)
 /*
  * Pass a packet up to the higher levels.
  */
-void
+static void
 egread(struct eg_softc *sc, void *buf, int len)
 {
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
@@ -732,7 +732,7 @@ egread(struct eg_softc *sc, void *buf, i
 /*
  * convert buf into mbufs
  */
-struct mbuf *
+static struct mbuf *
 egget(struct eg_softc *sc, void *buf, int totlen)
 {
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
@@ -776,7 +776,7 @@ bad:
 	return (0);
 }
 
-int
+static int
 egioctl(struct ifnet *ifp, unsigned long cmd, void *data)
 {
 	struct eg_softc *sc = ifp->if_softc;
@@ -846,7 +846,7 @@ egioctl(struct ifnet *ifp, unsigned long
 	return error;
 }
 
-void
+static void
 egreset(struct eg_softc *sc)
 {
 	int s;
@@ -858,7 +858,7 @@ egreset(struct eg_softc *sc)
 	splx(s);
 }
 
-void
+static void
 egwatchdog(struct ifnet *ifp)
 {
 	struct eg_softc *sc = ifp->if_softc;
@@ -869,7 +869,7 @@ egwatchdog(struct ifnet *ifp)
 	egreset(sc);
 }
 
-void
+static void
 egstop(struct eg_softc *sc)
 {
 



CVS commit: src/sys/dev/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 16:46:18 UTC 2022

Modified Files:
src/sys/dev/isa: if_eg.c

Log Message:
Liberally apply "static".


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/isa/if_eg.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/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 16:42:38 UTC 2022

Modified Files:
src/sys/dev/isa: if_eg.c

Log Message:
malloc() -> kmem_alloc()


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/isa/if_eg.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/isa

2022-09-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 17 16:42:38 UTC 2022

Modified Files:
src/sys/dev/isa: if_eg.c

Log Message:
malloc() -> kmem_alloc()


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/isa/if_eg.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/isa/if_eg.c
diff -u src/sys/dev/isa/if_eg.c:1.97 src/sys/dev/isa/if_eg.c:1.98
--- src/sys/dev/isa/if_eg.c:1.97	Wed Jan 29 06:21:40 2020
+++ src/sys/dev/isa/if_eg.c	Sat Sep 17 16:42:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_eg.c,v 1.97 2020/01/29 06:21:40 thorpej Exp $	*/
+/*	$NetBSD: if_eg.c,v 1.98 2022/09/17 16:42:38 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1993 Dean Huxley 
@@ -40,12 +40,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.97 2020/01/29 06:21:40 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.98 2022/09/17 16:42:38 thorpej Exp $");
 
 #include "opt_inet.h"
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -496,7 +497,7 @@ eginit(struct eg_softc *sc)
 		aprint_error_dev(sc->sc_dev,"configure card command failed\n");
 
 	if (sc->eg_inbuf == NULL) {
-		sc->eg_inbuf = malloc(EG_BUFLEN, M_TEMP, M_NOWAIT);
+		sc->eg_inbuf = kmem_alloc(EG_BUFLEN, KM_NOSLEEP);
 		if (sc->eg_inbuf == NULL) {
 			aprint_error_dev(sc->sc_dev, "can't allocate inbuf\n");
 			panic("eginit");
@@ -505,7 +506,7 @@ eginit(struct eg_softc *sc)
 	sc->eg_incount = 0;
 
 	if (sc->eg_outbuf == NULL) {
-		sc->eg_outbuf = malloc(EG_BUFLEN, M_TEMP, M_NOWAIT);
+		sc->eg_outbuf = kmem_alloc(EG_BUFLEN, KM_NOSLEEP);
 		if (sc->eg_outbuf == NULL) {
 			aprint_error_dev(sc->sc_dev,"can't allocate outbuf\n");
 			panic("eginit");



CVS commit: src/sys/dev/isa

2022-07-11 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jul 12 02:03:57 UTC 2022

Modified Files:
src/sys/dev/isa: if_ai.c if_ef.c if_ix.c

Log Message:
Remove unneeded bus_space_barrier() calls.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/isa/if_ai.c src/sys/dev/isa/if_ef.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/isa/if_ix.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/isa

2022-07-11 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jul 12 02:03:57 UTC 2022

Modified Files:
src/sys/dev/isa: if_ai.c if_ef.c if_ix.c

Log Message:
Remove unneeded bus_space_barrier() calls.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/isa/if_ai.c src/sys/dev/isa/if_ef.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/isa/if_ix.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/isa/if_ai.c
diff -u src/sys/dev/isa/if_ai.c:1.35 src/sys/dev/isa/if_ai.c:1.36
--- src/sys/dev/isa/if_ai.c:1.35	Tue Apr  9 05:25:14 2019
+++ src/sys/dev/isa/if_ai.c	Tue Jul 12 02:03:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ai.c,v 1.35 2019/04/09 05:25:14 msaitoh Exp $	*/
+/*	$NetBSD: if_ai.c,v 1.36 2022/07/12 02:03:57 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ai.c,v 1.35 2019/04/09 05:25:14 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ai.c,v 1.36 2022/07/12 02:03:57 thorpej Exp $");
 
 #include 
 #include 
@@ -139,9 +139,6 @@ ai_copyin(struct ie_softc *sc, void *dst
 	int dribble;
 	uint8_t *bptr = dst;
 
-	bus_space_barrier(sc->bt, sc->bh, offset, size,
-	BUS_SPACE_BARRIER_READ);
-
 	if (offset % 2) {
 		*bptr = bus_space_read_1(sc->bt, sc->bh, offset);
 		offset++; bptr++; size--;
@@ -162,8 +159,6 @@ static void
 ai_copyout(struct ie_softc *sc, const void *src, int offset, size_t size)
 {
 	int dribble;
-	int osize = size;
-	int ooffset = offset;
 	const uint8_t *bptr = src;
 
 	if (offset % 2) {
@@ -179,16 +174,12 @@ ai_copyout(struct ie_softc *sc, const vo
 		offset += size - 1;
 		bus_space_write_1(sc->bt, sc->bh, offset, *bptr);
 	}
-
-	bus_space_barrier(sc->bt, sc->bh, ooffset, osize,
-	BUS_SPACE_BARRIER_WRITE);
 }
 
 static uint16_t
 ai_read_16(struct ie_softc *sc, int offset)
 {
 
-	bus_space_barrier(sc->bt, sc->bh, offset, 2, BUS_SPACE_BARRIER_READ);
 return bus_space_read_2(sc->bt, sc->bh, offset);
 }
 
@@ -197,7 +188,6 @@ ai_write_16(struct ie_softc *sc, int off
 {
 
 bus_space_write_2(sc->bt, sc->bh, offset, value);
-	bus_space_barrier(sc->bt, sc->bh, offset, 2, BUS_SPACE_BARRIER_WRITE);
 }
 
 static void
@@ -206,7 +196,6 @@ ai_write_24(struct ie_softc *sc, int off
 
 bus_space_write_4(sc->bt, sc->bh, offset, addr +
 	(u_long)sc->sc_maddr - (u_long)sc->sc_iobase);
-	bus_space_barrier(sc->bt, sc->bh, offset, 4, BUS_SPACE_BARRIER_WRITE);
 }
 
 int
@@ -387,8 +376,6 @@ ai_attach(device_t parent, device_t self
 	ai_write_24(sc, IE_ISCP_BASE((u_long)sc->iscp), (u_long)sc->iscp);
 
 	/* Flush setup of pointers, check if chip answers */
-	bus_space_barrier(sc->bt, sc->bh, 0, sc->sc_msize,
-	BUS_SPACE_BARRIER_WRITE);
 	if (!i82586_proberam(sc)) {
 		DPRINTF(("\n%s: can't talk to i82586!\n",
 			device_xname(self)));
@@ -473,9 +460,6 @@ check_ie_present(struct ie_softc* sc, bu
 	ai_write_24(sc, IE_ISCP_BASE((u_long)sc->iscp), (u_long)sc->iscp);
 
 	/* Flush setup of pointers, check if chip answers */
-	bus_space_barrier(sc->bt, sc->bh, 0, sc->sc_msize,
-	BUS_SPACE_BARRIER_WRITE);
-
 	if (!i82586_proberam(sc))
 		return 0;
 
Index: src/sys/dev/isa/if_ef.c
diff -u src/sys/dev/isa/if_ef.c:1.35 src/sys/dev/isa/if_ef.c:1.36
--- src/sys/dev/isa/if_ef.c:1.35	Sun Nov 10 21:16:35 2019
+++ src/sys/dev/isa/if_ef.c	Tue Jul 12 02:03:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ef.c,v 1.35 2019/11/10 21:16:35 chs Exp $	*/
+/*	$NetBSD: if_ef.c,v 1.36 2022/07/12 02:03:57 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.35 2019/11/10 21:16:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.36 2022/07/12 02:03:57 thorpej Exp $");
 
 #include 
 #include 
@@ -237,7 +237,6 @@ static uint16_t
 ef_read_16(struct ie_softc *sc, int offset)
 {
 
-	bus_space_barrier(sc->bt, sc->bh, offset, 2, BUS_SPACE_BARRIER_READ);
 	return bus_space_read_2(sc->bt, sc->bh, offset);
 }
 
@@ -247,9 +246,6 @@ ef_copyin(struct ie_softc *sc, void *dst
 	int dribble;
 	uint8_t *bptr = dst;
 
-	bus_space_barrier(sc->bt, sc->bh, offset, size,
-	BUS_SPACE_BARRIER_READ);
-
 	if (offset % 2) {
 		*bptr = bus_space_read_1(sc->bt, sc->bh, offset);
 		offset++; bptr++; size--;
@@ -270,8 +266,6 @@ static void
 ef_copyout(struct ie_softc *sc, const void *src, int offset, size_t size)
 {
 	int dribble;
-	int osize = size;
-	int ooffset = offset;
 	const uint8_t *bptr = src;
 
 	if (offset % 2) {
@@ -287,9 +281,6 @@ ef_copyout(struct ie_softc *sc, const vo
 		offset += size - 1;
 		bus_space_write_1(sc->bt, sc->bh, offset, *bptr);
 	}
-
-	bus_space_barrier(sc->bt, sc->bh, ooffset, osize,
-	BUS_SPACE_BARRIER_WRITE);
 }
 
 static void
@@ -297,7 +288,6 @@ ef_write_16(struct ie_softc *sc, int off
 {
 
 	bus_space_write_2(sc->bt, sc->bh, offset, value);
-	bus_space_barrier(sc->bt, sc->bh, offset, 2,

CVS commit: src/sys/dev/isa

2022-06-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Jun 29 15:56:58 UTC 2022

Modified Files:
src/sys/dev/isa: aps.c finsio_isa.c itesio_isa.c smsc.c ug_isa.c

Log Message:
unregister sensors only when registered.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/isa/aps.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/isa/finsio_isa.c \
src/sys/dev/isa/ug_isa.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/isa/itesio_isa.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/isa/smsc.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/isa/aps.c
diff -u src/sys/dev/isa/aps.c:1.17 src/sys/dev/isa/aps.c:1.18
--- src/sys/dev/isa/aps.c:1.17	Thu Apr 23 23:23:00 2015
+++ src/sys/dev/isa/aps.c	Wed Jun 29 15:56:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: aps.c,v 1.17 2015/04/23 23:23:00 pgoyette Exp $	*/
+/*	$NetBSD: aps.c,v 1.18 2022/06/29 15:56:58 mlelstv Exp $	*/
 /*	$OpenBSD: aps.c,v 1.15 2007/05/19 19:14:11 tedu Exp $	*/
 /*	$OpenBSD: aps.c,v 1.17 2008/06/27 06:08:43 canacar Exp $	*/
 /*
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aps.c,v 1.17 2015/04/23 23:23:00 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aps.c,v 1.18 2022/06/29 15:56:58 mlelstv Exp $");
 
 #include 
 #include 
@@ -348,6 +348,7 @@ aps_attach(device_t parent, device_t sel
 		if (sysmon_envsys_sensor_attach(sc->sc_sme,
 			&sc->sc_sensor[i])) {
 			sysmon_envsys_destroy(sc->sc_sme);
+			sc->sc_sme = NULL;
 			goto out;
 		}
 	}
@@ -361,6 +362,7 @@ aps_attach(device_t parent, device_t sel
 		aprint_error_dev(self,
 		"unable to register with sysmon (%d)\n", i);
 		sysmon_envsys_destroy(sc->sc_sme);
+		sc->sc_sme = NULL;
 		goto out;
 	}
 

Index: src/sys/dev/isa/finsio_isa.c
diff -u src/sys/dev/isa/finsio_isa.c:1.8 src/sys/dev/isa/finsio_isa.c:1.9
--- src/sys/dev/isa/finsio_isa.c:1.8	Thu Apr 23 23:23:00 2015
+++ src/sys/dev/isa/finsio_isa.c	Wed Jun 29 15:56:58 2022
@@ -1,5 +1,5 @@
 /*	$OpenBSD: fins.c,v 1.1 2008/03/19 19:33:09 deraadt Exp $	*/
-/*	$NetBSD: finsio_isa.c,v 1.8 2015/04/23 23:23:00 pgoyette Exp $	*/
+/*	$NetBSD: finsio_isa.c,v 1.9 2022/06/29 15:56:58 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2008 Juan Romero Pardines
@@ -19,7 +19,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: finsio_isa.c,v 1.8 2015/04/23 23:23:00 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: finsio_isa.c,v 1.9 2022/06/29 15:56:58 mlelstv Exp $");
 
 #include 
 #include 
@@ -573,6 +573,7 @@ finsio_isa_attach(device_t parent, devic
 
 fail:
 	sysmon_envsys_destroy(sc->sc_sme);
+	sc->sc_sme = NULL;
 	bus_space_unmap(sc->sc_iot, sc->sc_ioh, FINSIO_DECODE_SIZE);
 }
 
@@ -581,7 +582,8 @@ finsio_isa_detach(device_t self, int fla
 {
 	struct finsio_softc *sc = device_private(self);
 
-	sysmon_envsys_unregister(sc->sc_sme);
+	if (sc->sc_sme != NULL)
+		sysmon_envsys_unregister(sc->sc_sme);
 	bus_space_unmap(sc->sc_iot, sc->sc_ioh, FINSIO_DECODE_SIZE);
 	return 0;
 }
Index: src/sys/dev/isa/ug_isa.c
diff -u src/sys/dev/isa/ug_isa.c:1.8 src/sys/dev/isa/ug_isa.c:1.9
--- src/sys/dev/isa/ug_isa.c:1.8	Wed Jun 24 19:24:44 2020
+++ src/sys/dev/isa/ug_isa.c	Wed Jun 29 15:56:58 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ug_isa.c,v 1.8 2020/06/24 19:24:44 jdolecek Exp $ */
+/* $NetBSD: ug_isa.c,v 1.9 2022/06/29 15:56:58 mlelstv Exp $ */
 
 /*
  * Copyright (c) 2007 Mihai Chelaru 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ug_isa.c,v 1.8 2020/06/24 19:24:44 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ug_isa.c,v 1.9 2022/06/29 15:56:58 mlelstv Exp $");
 
 #include 
 #include 
@@ -148,6 +148,7 @@ ug_isa_attach(device_t parent, device_t 
 		if (sysmon_envsys_sensor_attach(sc->sc_sme,
 		&sc->sc_sensor[i])) {
 			sysmon_envsys_destroy(sc->sc_sme);
+			sc->sc_sme = NULL;
 			goto out;
 		}
 	}
@@ -158,6 +159,7 @@ ug_isa_attach(device_t parent, device_t 
 	if (sysmon_envsys_register(sc->sc_sme)) {
 		aprint_error_dev(self, "unable to register with sysmon\n");
 		sysmon_envsys_destroy(sc->sc_sme);
+		sc->sc_sme = NULL;
 		goto out;
 	}
 
@@ -173,7 +175,8 @@ ug_isa_detach(device_t self, int flags)
 {
 	struct ug_softc *sc = device_private(self);
 
-	sysmon_envsys_unregister(sc->sc_sme);
+	if (sc->sc_sme != NULL)
+		sysmon_envsys_unregister(sc->sc_sme);
 	bus_space_unmap(sc->sc_iot, sc->sc_ioh, 8);
 	return 0;
 }

Index: src/sys/dev/isa/itesio_isa.c
diff -u src/sys/dev/isa/itesio_isa.c:1.29 src/sys/dev/isa/itesio_isa.c:1.30
--- src/sys/dev/isa/itesio_isa.c:1.29	Sat Jul  3 04:44:16 2021
+++ src/sys/dev/isa/itesio_isa.c	Wed Jun 29 15:56:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: itesio_isa.c,v 1.29 2021/07/03 04:44:16 nonaka Exp $ */
+/*	$NetBSD: itesio_isa.c,v 1.30 2022/06/29 15:56:58 mlelstv Exp $ */
 /*	Derived from $OpenBSD: it.c,v 1.19 2006/04/10 00:57:54 deraadt Exp $	*/
 
 /*
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: itesio_isa.c,v 1.29 2021/07/03 

CVS commit: src/sys/dev/isa

2022-06-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Jun 29 15:56:58 UTC 2022

Modified Files:
src/sys/dev/isa: aps.c finsio_isa.c itesio_isa.c smsc.c ug_isa.c

Log Message:
unregister sensors only when registered.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/isa/aps.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/isa/finsio_isa.c \
src/sys/dev/isa/ug_isa.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/isa/itesio_isa.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/isa/smsc.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/isa

2022-04-18 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Apr 18 10:09:07 UTC 2022

Modified Files:
src/sys/dev/isa: fdc_isa.c

Log Message:
Do not attach if the parent bus failed to provide an ISA chipset tag.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/isa/fdc_isa.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/isa/fdc_isa.c
diff -u src/sys/dev/isa/fdc_isa.c:1.20 src/sys/dev/isa/fdc_isa.c:1.21
--- src/sys/dev/isa/fdc_isa.c:1.20	Mon Apr 13 16:33:24 2015
+++ src/sys/dev/isa/fdc_isa.c	Mon Apr 18 10:09:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdc_isa.c,v 1.20 2015/04/13 16:33:24 riastradh Exp $	*/
+/*	$NetBSD: fdc_isa.c,v 1.21 2022/04/18 10:09:07 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdc_isa.c,v 1.20 2015/04/13 16:33:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdc_isa.c,v 1.21 2022/04/18 10:09:07 jmcneill Exp $");
 
 #include 
 #include 
@@ -131,6 +131,10 @@ fdc_isa_probe(device_t parent, cfdata_t 
 	if (ia->ia_drq[0].ir_drq == ISA_UNKNOWN_DRQ)
 		return (0);
 
+	/* ISA chipset tag is required for DMA support. */
+	if (ia->ia_ic == NULL)
+		return (0);
+
 	/* Map the I/O space. */
 	iobase = ia->ia_io[0].ir_addr;
 	if (bus_space_map(iot, iobase, 6 /* FDC_NPORT */, 0, &base_ioh))



CVS commit: src/sys/dev/isa

2022-04-18 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Apr 18 10:09:07 UTC 2022

Modified Files:
src/sys/dev/isa: fdc_isa.c

Log Message:
Do not attach if the parent bus failed to provide an ISA chipset tag.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/isa/fdc_isa.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/isa

2019-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 15:38:43 UTC 2019

Modified Files:
src/sys/dev/isa: nct.c

Log Message:
PR port-i386/54701: deal with missing pmf platform keys.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/isa/nct.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/isa/nct.c
diff -u src/sys/dev/isa/nct.c:1.1 src/sys/dev/isa/nct.c:1.2
--- src/sys/dev/isa/nct.c:1.1	Fri Oct 25 17:39:57 2019
+++ src/sys/dev/isa/nct.c	Sat Nov 16 15:38:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nct.c,v 1.1 2019/10/25 17:39:57 martin Exp $	*/
+/*	$NetBSD: nct.c,v 1.2 2019/11/16 15:38:43 martin Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nct.c,v 1.1 2019/10/25 17:39:57 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nct.c,v 1.2 2019/11/16 15:38:43 martin Exp $");
 
 #include 
 #include 
@@ -241,6 +241,7 @@ nct_match(device_t parent, cfdata_t matc
 	int nioaddr, i;
 	u_int8_t low, high;
 	u_int16_t id;
+	const char *vendor, *product;
 
 	/*
 	 * Allow override of I/O base address.  If no I/O base address is
@@ -249,11 +250,15 @@ nct_match(device_t parent, cfdata_t matc
 	if (ia->ia_nio > 0 && ia->ia_io[0].ir_addr != ISA_UNKNOWN_PORT) {
 		ioaddrs[0] = ia->ia_io[0].ir_addr;
 		nioaddr = 1;
-	} else if ((strcmp(pmf_get_platform("system-vendor"), "PC Engines") |
-	strcmp(pmf_get_platform("system-product"), "APU")) == 0) {
-		nioaddr = __arraycount(ioaddrs);
 	} else {
-		nioaddr = 0;
+		vendor = pmf_get_platform("system-vendor");
+		product = pmf_get_platform("system-product");
+		if (vendor != NULL && strcmp(vendor, "PC Engines") == 0 &&
+		product != NULL && strcmp(product, "APU") == 0) {
+			nioaddr = __arraycount(ioaddrs);
+		} else {
+			nioaddr = 0;
+		}
 	}
 
 	/*



CVS commit: src/sys/dev/isa

2019-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 15:38:43 UTC 2019

Modified Files:
src/sys/dev/isa: nct.c

Log Message:
PR port-i386/54701: deal with missing pmf platform keys.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/isa/nct.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/isa

2019-11-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Nov 12 13:10:51 UTC 2019

Modified Files:
src/sys/dev/isa: uha_isa.c

Log Message:
 Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/isa/uha_isa.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/isa/uha_isa.c
diff -u src/sys/dev/isa/uha_isa.c:1.41 src/sys/dev/isa/uha_isa.c:1.42
--- src/sys/dev/isa/uha_isa.c:1.41	Sat Oct 18 08:33:28 2014
+++ src/sys/dev/isa/uha_isa.c	Tue Nov 12 13:10:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uha_isa.c,v 1.41 2014/10/18 08:33:28 snj Exp $	*/
+/*	$NetBSD: uha_isa.c,v 1.42 2019/11/12 13:10:51 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uha_isa.c,v 1.41 2014/10/18 08:33:28 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uha_isa.c,v 1.42 2019/11/12 13:10:51 msaitoh Exp $");
 
 #include "opt_ddb.h"
 
@@ -143,6 +143,7 @@ uha_isa_attach(device_t parent, device_t
 	isa_chipset_tag_t ic = ia->ia_ic;
 	int error;
 
+	sc->sc_dev = self;
 	printf("\n");
 
 	if (bus_space_map(iot, ia->ia_io[0].ir_addr, UHA_ISA_IOSIZE, 0, &ioh)) {
@@ -150,7 +151,6 @@ uha_isa_attach(device_t parent, device_t
 		return;
 	}
 
-	sc->sc_dev = self;
 	sc->sc_iot = iot;
 	sc->sc_ioh = ioh;
 	sc->sc_dmat = dmat;



CVS commit: src/sys/dev/isa

2019-11-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Nov 12 13:10:51 UTC 2019

Modified Files:
src/sys/dev/isa: uha_isa.c

Log Message:
 Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/isa/uha_isa.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/isa

2019-07-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jul 23 09:38:53 UTC 2019

Modified Files:
src/sys/dev/isa: itesio_isa.c itesio_isavar.h

Log Message:
 Add IT8655 support.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/isa/itesio_isa.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/isa/itesio_isavar.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/isa

2019-07-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jul 23 09:38:53 UTC 2019

Modified Files:
src/sys/dev/isa: itesio_isa.c itesio_isavar.h

Log Message:
 Add IT8655 support.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/isa/itesio_isa.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/isa/itesio_isavar.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/isa/itesio_isa.c
diff -u src/sys/dev/isa/itesio_isa.c:1.27 src/sys/dev/isa/itesio_isa.c:1.28
--- src/sys/dev/isa/itesio_isa.c:1.27	Tue Sep 12 09:54:45 2017
+++ src/sys/dev/isa/itesio_isa.c	Tue Jul 23 09:38:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: itesio_isa.c,v 1.27 2017/09/12 09:54:45 msaitoh Exp $ */
+/*	$NetBSD: itesio_isa.c,v 1.28 2019/07/23 09:38:53 msaitoh Exp $ */
 /*	Derived from $OpenBSD: it.c,v 1.19 2006/04/10 00:57:54 deraadt Exp $	*/
 
 /*
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: itesio_isa.c,v 1.27 2017/09/12 09:54:45 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: itesio_isa.c,v 1.28 2019/07/23 09:38:53 msaitoh Exp $");
 
 #include 
 #include 
@@ -137,6 +137,7 @@ itesio_isa_match(device_t parent, cfdata
 
 	switch (cr) {
 	case ITESIO_ID8628:
+	case ITESIO_ID8655:
 	case ITESIO_ID8705:
 	case ITESIO_ID8712:
 	case ITESIO_ID8716:

Index: src/sys/dev/isa/itesio_isavar.h
diff -u src/sys/dev/isa/itesio_isavar.h:1.11 src/sys/dev/isa/itesio_isavar.h:1.12
--- src/sys/dev/isa/itesio_isavar.h:1.11	Tue Sep 12 09:54:45 2017
+++ src/sys/dev/isa/itesio_isavar.h	Tue Jul 23 09:38:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: itesio_isavar.h,v 1.11 2017/09/12 09:54:45 msaitoh Exp $	*/
+/*	$NetBSD: itesio_isavar.h,v 1.12 2019/07/23 09:38:53 msaitoh Exp $	*/
 /*	$OpenBSD: itvar.h,v 1.2 2003/11/05 20:57:10 grange Exp $	*/
 
 /*
@@ -58,6 +58,7 @@
 #define ITESIO_DEVREV	0x22	/* Device Revision */
 
 #define ITESIO_ID8628	0x8628
+#define ITESIO_ID8655	0x8655
 #define ITESIO_ID8705	0x8705
 #define ITESIO_ID8712	0x8712
 #define ITESIO_ID8716	0x8716



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

2018-01-01 Thread Paul Goyette

On Tue, 2 Jan 2018, Paul Goyette wrote:


On Mon, 1 Jan 2018, Christos Zoulas wrote:


Module Name:src
Committed By:   christos
Date:   Tue Jan  2 00:25:35 UTC 2018

Modified Files:
src/sys/dev/isa: files.isa

Log Message:
PR/52887: HITOSHI Osada: wbsio needs sysmon_wdog.


Please also check to see if the modular version of this driver needs to 
"require" the sysmon_wdog module.


:)


Never mind.  I checked the code, and the sysmon_wdog module is needed, 
so I've made the appropriate update.




+--+--++
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:  |
| (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+--+--++


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

2018-01-01 Thread Paul Goyette

On Mon, 1 Jan 2018, Christos Zoulas wrote:


Module Name:src
Committed By:   christos
Date:   Tue Jan  2 00:25:35 UTC 2018

Modified Files:
src/sys/dev/isa: files.isa

Log Message:
PR/52887: HITOSHI Osada: wbsio needs sysmon_wdog.


Please also check to see if the modular version of this driver needs to 
"require" the sysmon_wdog module.


:)



+--+--++
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:  |
| (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+--+--++


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

2010-03-23 Thread Matthias Drochner

dyo...@pobox.com said:
> Let us add a bus_space_is_equal(bus_space_tag_t t1, bus_space_tag_t
> t2) for implementation in MD code

That's generally OK. (We have this in pthread_equal().)

>return memcpy(&t1, &t2, sizeof(t1)) == 0;
> That will work even if bus_space_tag_t is a struct.

I hope you don't really consider to pass structs as arguments to
functions. Int-alikes and pointers make sense, but I doubt anything
else does. But then, a bus_space_is_equal() doesn't buy us much,
it only adds bloat.

best regards
Matthias






Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt




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

2010-03-23 Thread David Young
On Tue, Mar 23, 2010 at 11:39:54AM +0100, Matthias Drochner wrote:
> dyo...@pobox.com said:
> > Can the two tags that pcdisplay_is_console() compared ever come from
> > different spaces?
> 
> Yes, if there are independant ISA buses they are distinguished
> by their tags.

Good to know.  I did not know that this ever occurred.

I would not expect for comparing tags with == to work reliably, now,
based on my reading of bus_space(9).  I do not expect for it to work for
very much longer.

Let us add a bus_space_is_equal(bus_space_tag_t t1, bus_space_tag_t
t2) for implementation in MD code.  kern_stub.c can provide a default
implementation that will work for now:

return memcpy(&t1, &t2, sizeof(t1)) == 0;

That will work even if bus_space_tag_t is a struct.

(BTW, it was only by making bus_space_tag_t a struct that I got the
compiler to stop on some cases of bus_space_tag_t misuse.)

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


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

2010-03-23 Thread Matthias Drochner

dyo...@pobox.com said:
> How many pcdisplay at isa can there be one machine?

Iirc, this code is originating from alpha where you can have
multiple independant PCI/ISA/EISA hierarchies and thus
multiple pcdisplay/ega/vga devices.

> Can the two tags that pcdisplay_is_console() compared ever come from
> different spaces?

Yes, if there are independant ISA buses they are distinguished
by their tags.

> pcdisplay_is_console does not compare tag-handle tuples, it compares
> only tags.  Can it tell two instances of pcdisplay apart in that way?

I think this is just a simplification -- since you can have only one
pcdisplay per bus hierarchy you can have only one per tag.

> > MI code needs to be able to check for equality at least.
> I don't see the need.
This is done at other places as well, eg in com.c, which is used
by many (also embedded) architectures. (In this case, tag _and_
handle are compared -- one can have multiple com devices in any
of multiple address spaces.)
Not understanding some code is no excuse for breaking it.

best regards
Matthias





Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt




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

2010-03-23 Thread Matthias Drochner

dyo...@pobox.com said:
> How many pcdisplay at isa can there be one machine?

Iirc, this code is originating from alpha where you can have
multiple independant PCI/ISA/EISA hierarchies and thus
multiple pcdisplay/ega/vga devices.

> Can the two tags that pcdisplay_is_console() compared ever come from
> different spaces?

Yes, if there are independant ISA buses they are distinguished
by their tags.

> pcdisplay_is_console does not compare tag-handle tuples, it compares
> only tags.  Can it tell two instances of pcdisplay apart in that way?

I think this is just a simplification -- since you can have only one
pcdisplay per bus hierarchy you can have only one per tag.

> > MI code needs to be able to check for equality at least.
> I don't see the need.

This is done at other places as well, eg in com.c, which is used
by many (also embedded) architectures. (In this case, tag _and_
handle are compared -- one can have multiple com devices in any
of multiple address spaces.)

best regards
Matthias





Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt




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

2010-03-23 Thread Matthias Drochner

[reposting, was sent to s-c first]

> Module Name:src
> Committed By:   dyoung
> Date:   Mon Mar 22 22:30:58 UTC 2010
> Modified Files:
> src/sys/dev/isa: isadma.c pcdisplay.c
> Log Message:
> [...]
> pcdisplay.c: #if 0 some code that compares two bus_space_tag_t's
> in order to see if pcdisplay0 is console.  It does not seem to
> be helpful to compare the tags; maybe the author intended to
> compare some other bus property?

What you are doing is rather destructive.
This is not about bus properties but to find out whether a specific
device is the same (which means it is located at the same base address)
as the console device which was established before all the device tree.
A base address is defined by a tag-handle tuple. MI code needs to be
able to check for equality at least.
This has been fine all the time -- what are you trying to accomplish?
Even if you turn the tag into a pointer, it should be fine for MI
code to compare this to other tags.

best regards
Matthias





Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt




CVS commit: src/sys/dev/isa

2010-01-23 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Sat Jan 23 17:22:05 UTC 2010

Modified Files:
src/sys/dev/isa: ess.c

Log Message:
essattach: printf -> aprint_*


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/isa/ess.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/isa

2010-01-19 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Jan 19 12:41:41 UTC 2010

Modified Files:
src/sys/dev/isa: files.isa
Removed Files:
src/sys/dev/isa: if_hp.c

Log Message:
h...@isa was marked non-compiling and broken 14 years ago.  I'm sure
the tens of well-tested changes since then have been necessary,
but now i'll just spoil the fun for everyone by sending the driver
to the attic.


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/sys/dev/isa/files.isa
cvs rdiff -u -r1.48 -r0 src/sys/dev/isa/if_hp.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/isa

2010-01-08 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Jan  8 20:00:03 UTC 2010

Modified Files:
src/sys/dev/isa: aps.c com_isa.c fd.c sbdsp.c ym.c

Log Message:
Expand PMF_FN_* macros.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/isa/aps.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/isa/com_isa.c src/sys/dev/isa/ym.c
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/isa/fd.c
cvs rdiff -u -r1.132 -r1.133 src/sys/dev/isa/sbdsp.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/isa

2010-01-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan  2 02:37:09 UTC 2010

Modified Files:
src/sys/dev/isa: ym.c

Log Message:
make rhis compile.


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

2010-01-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan  2 01:42:49 UTC 2010

Modified Files:
src/sys/dev/isa: ym.c

Log Message:
convert to pmf


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

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



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

2009-04-09 Thread YAMAMOTO Takashi
hi,

this change seems broken.  please check.
(the function you changed is an _attach_ function.)

YAMAMOTO Takashi

> Module Name:  src
> Committed By: dyoung
> Date: Wed Apr  8 00:12:27 UTC 2009
> 
> Modified Files:
>   src/sys/dev/isa: midi_pcppi.c
> 
> Log Message:
> Decrease midi_pcppi_attached when midi at pcppi detaches.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.21 -r1.22 src/sys/dev/isa/midi_pcppi.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.