CVS commit: src/sys/dev/isa

2021-07-02 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Jul  3 04:44:16 UTC 2021

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

Log Message:
itesio(4): Added IT8625E support.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/isa/itesio_isa.c
cvs rdiff -u -r1.13 -r1.14 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.28 src/sys/dev/isa/itesio_isa.c:1.29
--- src/sys/dev/isa/itesio_isa.c:1.28	Tue Jul 23 09:38:53 2019
+++ src/sys/dev/isa/itesio_isa.c	Sat Jul  3 04:44:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: itesio_isa.c,v 1.28 2019/07/23 09:38:53 msaitoh Exp $ */
+/*	$NetBSD: itesio_isa.c,v 1.29 2021/07/03 04:44:16 nonaka Exp $ */
 /*	Derived from $OpenBSD: it.c,v 1.19 2006/04/10 00:57:54 deraadt Exp $	*/
 
 /*
@@ -34,13 +34,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: itesio_isa.c,v 1.28 2019/07/23 09:38:53 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: itesio_isa.c,v 1.29 2021/07/03 04:44:16 nonaka Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -52,6 +53,11 @@ __KERNEL_RCSID(0, "$NetBSD: itesio_isa.c
 #define IT_VOLTSTART_IDX 	3 	/* voltage start index */
 #define IT_FANSTART_IDX 	12 	/* fan start index */
 
+/* IT8625: 3 temps, 10 volts, 6 fans */
+#define IT8625_NUM_SENSORS	19
+#define IT8625_VOLTSTART_IDX 	3	/* voltage start index */
+#define IT8625_FANSTART_IDX 	13	/* fan start index */
+
 #if defined(ITESIO_DEBUG)
 #define DPRINTF(x)		do { printf x; } while (0)
 #else
@@ -90,6 +96,13 @@ static void	itesio_refresh_temp(struct i
 static void	itesio_refresh_volts(struct itesio_softc *, envsys_data_t *);
 static void	itesio_refresh_fans(struct itesio_softc *, envsys_data_t *);
 static void	itesio_refresh(struct sysmon_envsys *, envsys_data_t *);
+static void	itesio_refresh_it8705_fans(struct itesio_softc *,
+		envsys_data_t *);
+static void	itesio_setup_it8625_sensors(struct itesio_softc *);
+static void	itesio_refresh_it8625_volts(struct itesio_softc *,
+		envsys_data_t *);
+static void	itesio_refresh_it8625_fans(struct itesio_softc *,
+		envsys_data_t *);
 
 /* sysmon_wdog glue */
 static bool	itesio_wdt_suspend(device_t, const pmf_qual_t *);
@@ -109,11 +122,58 @@ static const int itesio_vrfact[] = {
 	RFACT_NONE	/* VBAT		*/
 };
 
+static const struct itesio_config itesio_config[] = {
+	{
+		.chipid = ITESIO_ID8625,
+		.no_wdt = true,
+		.num_sensors = IT8625_NUM_SENSORS,
+		.voltstart_idx = IT8625_VOLTSTART_IDX,
+		.fanstart_idx = IT8625_FANSTART_IDX,
+		.setup_sensors = itesio_setup_it8625_sensors,
+		.refresh_volts = itesio_refresh_it8625_volts,
+		.refresh_fans = itesio_refresh_it8625_fans,
+	},
+	{	.chipid = ITESIO_ID8628, },
+	{	.chipid = ITESIO_ID8655, },
+	{
+		.chipid = ITESIO_ID8705,
+		.no_wdt = true,
+		.refresh_fans = itesio_refresh_it8705_fans,
+	},
+	{
+		.chipid = ITESIO_ID8712,
+		.refresh_fans = itesio_refresh_it8705_fans,
+	},
+	{	.chipid = ITESIO_ID8716, },
+	{	.chipid = ITESIO_ID8718, },
+	{	.chipid = ITESIO_ID8720, },
+	{	.chipid = ITESIO_ID8721, },
+	{	.chipid = ITESIO_ID8726, },
+	{	.chipid = ITESIO_ID8728, },
+	{	.chipid = ITESIO_ID8771, },
+	{	.chipid = ITESIO_ID8772, },
+};
+
+static const struct itesio_config *
+itesio_isa_find_config(uint16_t chipid)
+{
+	const struct itesio_config *ic;
+	size_t i;
+
+	for (i = 0; i < __arraycount(itesio_config); i++) {
+		ic = _config[i];
+		if (chipid == ic->chipid)
+			return ic;
+	}
+	return NULL;
+}
+
 static int
 itesio_isa_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct isa_attach_args *ia = aux;
 	bus_space_handle_t ioh;
+	const struct itesio_config *ic;
 	uint16_t cr;
 
 	/* Must supply an address */
@@ -135,28 +195,16 @@ itesio_isa_match(device_t parent, cfdata
 	itesio_exit(ia->ia_iot, ioh);
 	bus_space_unmap(ia->ia_iot, ioh, 2);
 
-	switch (cr) {
-	case ITESIO_ID8628:
-	case ITESIO_ID8655:
-	case ITESIO_ID8705:
-	case ITESIO_ID8712:
-	case ITESIO_ID8716:
-	case ITESIO_ID8718:
-	case ITESIO_ID8720:
-	case ITESIO_ID8721:
-	case ITESIO_ID8726:
-	case ITESIO_ID8728:
-	case ITESIO_ID8771:
-	case ITESIO_ID8772:
-		ia->ia_nio = 1;
-		ia->ia_io[0].ir_size = 2;
-		ia->ia_niomem = 0;
-		ia->ia_nirq = 0;
-		ia->ia_ndrq = 0;
-		return 1;
-	default:
+	ic = itesio_isa_find_config(cr);
+	if (ic == NULL)
 		return 0;
-	}
+
+	ia->ia_nio = 1;
+	ia->ia_io[0].ir_size = 2;
+	ia->ia_niomem = 0;
+	ia->ia_nirq = 0;
+	ia->ia_ndrq = 0;
+	return 1;
 }
 
 static void
@@ -164,7 +212,9 @@ itesio_isa_attach(device_t parent, devic
 {
 	struct itesio_softc *sc = device_private(self);
 	struct isa_attach_args *ia = aux;
-	int i;
+	const struct itesio_config *ic;
+	uint32_t i;
+	int error;
 	uint8_t cr;
 
 	sc->sc_iot = ia->ia_iot;
@@ -205,6 +255,27 @@ itesio_isa_attach(device_t parent, devic
 	 */
 	itesio_exit(sc->sc_iot, 

CVS commit: src/sys/dev/isa

2021-06-04 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Jun  5 01:40:53 UTC 2021

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

Log Message:
Add IT8625 chip id.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 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_isavar.h
diff -u src/sys/dev/isa/itesio_isavar.h:1.12 src/sys/dev/isa/itesio_isavar.h:1.13
--- src/sys/dev/isa/itesio_isavar.h:1.12	Tue Jul 23 09:38:53 2019
+++ src/sys/dev/isa/itesio_isavar.h	Sat Jun  5 01:40:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: itesio_isavar.h,v 1.12 2019/07/23 09:38:53 msaitoh Exp $	*/
+/*	$NetBSD: itesio_isavar.h,v 1.13 2021/06/05 01:40:53 nonaka Exp $	*/
 /*	$OpenBSD: itvar.h,v 1.2 2003/11/05 20:57:10 grange Exp $	*/
 
 /*
@@ -57,6 +57,7 @@
 #define ITESIO_CHIPID2	0x21	/* Chip ID 2 */
 #define ITESIO_DEVREV	0x22	/* Device Revision */
 
+#define ITESIO_ID8625	0x8625
 #define ITESIO_ID8628	0x8628
 #define ITESIO_ID8655	0x8655
 #define ITESIO_ID8705	0x8705



CVS commit: src/sys/dev/isa

2021-04-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Apr 26 19:22:14 UTC 2021

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

Log Message:
Be explicit about using the "ym" interface attribute when attaching
the "opl" and "mpu" instances.


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

Modified files:

Index: src/sys/dev/isa/ym.c
diff -u src/sys/dev/isa/ym.c:1.48 src/sys/dev/isa/ym.c:1.49
--- src/sys/dev/isa/ym.c:1.48	Sat Apr 24 23:36:55 2021
+++ src/sys/dev/isa/ym.c	Mon Apr 26 19:22:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ym.c,v 1.48 2021/04/24 23:36:55 thorpej Exp $	*/
+/*	$NetBSD: ym.c,v 1.49 2021/04/26 19:22:14 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999-2002, 2008 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ym.c,v 1.48 2021/04/24 23:36:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ym.c,v 1.49 2021/04/26 19:22:14 thorpej Exp $");
 
 #include "mpu_ym.h"
 #include "opt_ym.h"
@@ -258,7 +258,9 @@ ym_attach(struct ym_softc *sc)
 		arg.type = AUDIODEV_TYPE_OPL;
 		arg.hwif = 0;
 		arg.hdl = 0;
-		(void)config_found(ac->sc_dev, , audioprint, CFARG_EOL);
+		(void)config_found(ac->sc_dev, , audioprint,
+		CFARG_IATTR, "ym",
+		CFARG_EOL);
 	}
 
 #if NMPU_YM > 0
@@ -268,6 +270,7 @@ ym_attach(struct ym_softc *sc)
 		arg.hwif = 0;
 		arg.hdl = 0;
 		sc->sc_mpudev = config_found(ac->sc_dev, , audioprint,
+		CFARG_IATTR, "ym",
 		CFARG_EOL);
 	}
 #endif



CVS commit: src/sys/dev/isa

2021-04-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Apr 26 19:21:55 UTC 2021

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

Log Message:
Be explicit about using the "wss" interface attribute when attaching
the "opl" instance.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/isa/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/wss.c
diff -u src/sys/dev/isa/wss.c:1.75 src/sys/dev/isa/wss.c:1.76
--- src/sys/dev/isa/wss.c:1.75	Sat Apr 24 23:36:55 2021
+++ src/sys/dev/isa/wss.c	Mon Apr 26 19:21:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: wss.c,v 1.75 2021/04/24 23:36:55 thorpej Exp $	*/
+/*	$NetBSD: wss.c,v 1.76 2021/04/26 19:21:55 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1994 John Brezak
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wss.c,v 1.75 2021/04/24 23:36:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wss.c,v 1.76 2021/04/26 19:21:55 thorpej Exp $");
 
 #include 
 #include 
@@ -161,7 +161,9 @@ wssattach(struct wss_softc *sc)
 		arg.type = AUDIODEV_TYPE_OPL;
 		arg.hwif = 0;
 		arg.hdl = 0;
-		(void)config_found(ac->sc_dev, , audioprint, CFARG_EOL);
+		(void)config_found(ac->sc_dev, , audioprint,
+		CFARG_IATTR, "wss",
+		CFARG_EOL);
 	}
 }
 



CVS commit: src/sys/dev/isa

2021-04-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Apr 26 19:10:38 UTC 2021

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

Log Message:
- The "ess" device does not need a "midibus" interface attribute; it
  attaches an "opl" instance which itself attaches the "midi".
- Be explicit about using the "ess" interface attribute when attaching
  the "joy" and "opl" instances.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/isa/ess.c
cvs rdiff -u -r1.176 -r1.177 src/sys/dev/isa/files.isa

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/ess.c
diff -u src/sys/dev/isa/ess.c:1.87 src/sys/dev/isa/ess.c:1.88
--- src/sys/dev/isa/ess.c:1.87	Sat Apr 24 23:36:55 2021
+++ src/sys/dev/isa/ess.c	Mon Apr 26 19:10:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ess.c,v 1.87 2021/04/24 23:36:55 thorpej Exp $	*/
+/*	$NetBSD: ess.c,v 1.88 2021/04/26 19:10:38 thorpej Exp $	*/
 
 /*
  * Copyright 1997
@@ -66,7 +66,7 @@
 */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ess.c,v 1.87 2021/04/24 23:36:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ess.c,v 1.88 2021/04/26 19:10:38 thorpej Exp $");
 
 #include 
 #include 
@@ -1045,7 +1045,9 @@ skip:
 	arg.type = AUDIODEV_TYPE_OPL;
 	arg.hwif = 0;
 	arg.hdl = 0;
-	(void)config_found(sc->sc_dev, , audioprint, CFARG_EOL);
+	(void)config_found(sc->sc_dev, , audioprint,
+	CFARG_IATTR, "ess",
+	CFARG_EOL);
 
 #if NJOY_ESS > 0
 	if (sc->sc_model == ESS_1888 && enablejoy) {
@@ -1056,7 +1058,9 @@ skip:
 		ess_write_mix_reg(sc, 0x40, m40);
 
 		arg.type = AUDIODEV_TYPE_AUX;
-		(void)config_found(sc->sc_dev, , audioprint, CFARG_EOL);
+		(void)config_found(sc->sc_dev, , audioprint,
+		CFARG_IATTR, "ess",
+		CFARG_EOL);
 	}
 #endif
 

Index: src/sys/dev/isa/files.isa
diff -u src/sys/dev/isa/files.isa:1.176 src/sys/dev/isa/files.isa:1.177
--- src/sys/dev/isa/files.isa:1.176	Sat May 23 13:48:08 2020
+++ src/sys/dev/isa/files.isa	Mon Apr 26 19:10:38 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.isa,v 1.176 2020/05/23 13:48:08 jmcneill Exp $
+#	$NetBSD: files.isa,v 1.177 2021/04/26 19:10:38 thorpej Exp $
 #
 # Config file and device description for machine-independent ISA code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -318,7 +318,7 @@ attach	opl at wss with opl_wss
 file	dev/isa/opl_wss.c		opl_wss
 
 # ESS Technology ES1887/ES888/ES1888
-device	ess { } : audiobus, isadma, midibus
+device	ess { }: audiobus, isadma
 file	dev/isa/ess.c			ess			needs-flag
 
 attach	ess at isa with ess_isa



CVS commit: src/sys/dev/isa

2021-02-05 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 07:16:18 UTC 2021

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

Log Message:
Calling halt_{input,output} is done by the MI audio layer if necessary.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/dev/isa/gus.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/gus.c
diff -u src/sys/dev/isa/gus.c:1.118 src/sys/dev/isa/gus.c:1.119
--- src/sys/dev/isa/gus.c:1.118	Sat Feb 29 05:51:11 2020
+++ src/sys/dev/isa/gus.c	Sat Feb  6 07:16:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gus.c,v 1.118 2020/02/29 05:51:11 isaki Exp $	*/
+/*	$NetBSD: gus.c,v 1.119 2021/02/06 07:16:18 isaki Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1999, 2008 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.118 2020/02/29 05:51:11 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.119 2021/02/06 07:16:18 isaki Exp $");
 
 #include 
 #include 
@@ -1359,14 +1359,10 @@ gusclose(void *addr)
 	sc = addr;
 	DPRINTF(("gus_close: sc=%p\n", sc));
 
+	KASSERT((sc->sc_flags & (GUS_DMAOUT_ACTIVE | GUS_LOCKED)) == 0);
+	KASSERT((sc->sc_flags & GUS_DMAIN_ACTIVE) == 0);
 
-/*	if (sc->sc_flags & GUS_DMAOUT_ACTIVE) */ {
-		gus_halt_out_dma(sc);
-	}
-/*	if (sc->sc_flags & GUS_DMAIN_ACTIVE) */ {
-		gus_halt_in_dma(sc);
-	}
-	sc->sc_flags &= ~(GUS_OPEN|GUS_LOCKED|GUS_DMAOUT_ACTIVE|GUS_DMAIN_ACTIVE);
+	sc->sc_flags &= ~GUS_OPEN;
 
 	/* turn off speaker, etc. */
 



CVS commit: src/sys/dev/isa

2021-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 16 00:43:04 UTC 2021

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

Log Message:
Add missing printing-of-newlines in the attach routine.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/isa/tpm_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/tpm_isa.c
diff -u src/sys/dev/isa/tpm_isa.c:1.7 src/sys/dev/isa/tpm_isa.c:1.8
--- src/sys/dev/isa/tpm_isa.c:1.7	Wed Oct  9 14:03:58 2019
+++ src/sys/dev/isa/tpm_isa.c	Sat Jan 16 00:43:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tpm_isa.c,v 1.7 2019/10/09 14:03:58 maxv Exp $	*/
+/*	$NetBSD: tpm_isa.c,v 1.8 2021/01/16 00:43:03 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tpm_isa.c,v 1.7 2019/10/09 14:03:58 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tpm_isa.c,v 1.8 2021/01/16 00:43:03 thorpej Exp $");
 
 #include 
 #include 
@@ -113,6 +113,9 @@ tpm_isa_attach(device_t parent, device_t
 	base = (unsigned int)ia->ia_iomem[0].ir_addr;
 	size = TPM_SPACE_SIZE;
 
+	aprint_normal("\n");
+	aprint_naive("\n");
+
 	sc->sc_dev = self;
 	sc->sc_ver = TPM_1_2;
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);



CVS commit: src/sys/dev/isa

2020-05-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May 23 13:48:08 UTC 2020

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

Log Message:
GC toaster drivers


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/sys/dev/isa/files.isa
cvs rdiff -u -r1.13 -r0 src/sys/dev/isa/toaster.c
cvs rdiff -u -r1.11 -r0 src/sys/dev/isa/toasterlcd.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/files.isa
diff -u src/sys/dev/isa/files.isa:1.175 src/sys/dev/isa/files.isa:1.176
--- src/sys/dev/isa/files.isa:1.175	Sun Jan 19 20:00:35 2020
+++ src/sys/dev/isa/files.isa	Sat May 23 13:48:08 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.isa,v 1.175 2020/01/19 20:00:35 thorpej Exp $
+#	$NetBSD: files.isa,v 1.176 2020/05/23 13:48:08 jmcneill Exp $
 #
 # Config file and device description for machine-independent ISA code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -487,14 +487,6 @@ device	tsdio {}
 attach	tsdio at isa
 file	dev/isa/tsdio.c			tsdio
 
-device	toasterlcd: hd44780, wsemuldisplaydev
-attach	toasterlcd at tsdio
-file	dev/isa/toasterlcd.c		toasterlcd
-
-device toaster
-attach toaster at tsdio
-file	dev/isa/toaster.c		toaster
-
 # Trusted Platform Module
 attach tpm at isa with tpm_isa
 file   dev/isa/tpm_isa.c		tpm_isa	needs-flag



CVS commit: src/sys/dev/isa

2020-04-01 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Apr  1 18:34:22 UTC 2020

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

Log Message:
Newer PC Engines BIOS versions don't set up the Super I/O for GPIO the
way we want so ignore most of the existing settings and enable banks 0
and 1.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.2 src/sys/dev/isa/nct.c:1.3
--- src/sys/dev/isa/nct.c:1.2	Sat Nov 16 15:38:43 2019
+++ src/sys/dev/isa/nct.c	Wed Apr  1 18:34:22 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: nct.c,v 1.2 2019/11/16 15:38:43 martin Exp $	*/
+/*	$NetBSD: nct.c,v 1.3 2020/04/01 18:34:22 ad Exp $	*/
 
 /*-
- * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -37,14 +37,14 @@
  * - UARTS: handled by com driver.  3rd & 4th UARTs use GPIO pins.
  *
  * If asked to probe with a wildcard address, we'll only do so if known to
- * be running on a PC Engines APU board.  Probe is invasive.
+ * be running on a PC Engines system.  Probe is invasive.
  *
  * Register access on Super I/O chips typically involves one or two levels
  * of indirection, so we try hard to avoid needless register access.
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nct.c,v 1.2 2019/11/16 15:38:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nct.c,v 1.3 2020/04/01 18:34:22 ad Exp $");
 
 #include 
 #include 
@@ -69,7 +69,7 @@ __KERNEL_RCSID(0, "$NetBSD: nct.c,v 1.2 
 #define	NCT_IOBASE_B		0x4e
 #define	NCT_IOSIZE		2
 #define	NCT_CHIP_ID_1		0x1061
-#define	NCT_CHIP_ID_2		0xc452	/* PC Engines APU1 */
+#define	NCT_CHIP_ID_2		0xc452	/* PC Engines APU */
 #define	NCT_NUM_PINS		17
 
 /* Enable/disable keys */
@@ -241,20 +241,18 @@ nct_match(device_t parent, cfdata_t matc
 	int nioaddr, i;
 	u_int8_t low, high;
 	u_int16_t id;
-	const char *vendor, *product;
+	const char *vendor;
 
 	/*
 	 * Allow override of I/O base address.  If no I/O base address is
-	 * provided, proceed to probe if running on a PC Engines APU.
+	 * provided, proceed to probe if running on a PC Engines system.
 	 */
 	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 {
 		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) {
+		if (vendor != NULL && strstr(vendor, "PC Engines") != NULL) {
 			nioaddr = __arraycount(ioaddrs);
 		} else {
 			nioaddr = 0;
@@ -305,7 +303,6 @@ nct_attach(device_t parent, device_t sel
 	struct gpiobus_attach_args gba;
 	struct nct_bank *nb;
 	u_int8_t multifun, enable;
-	bool apu;
 	int i, j;
 
 	/*
@@ -321,8 +318,6 @@ nct_attach(device_t parent, device_t sel
 	sc->sc_iot = ia->ia_iot;
 	sc->sc_curdev = -1;
 	sc->sc_curreg = -1;
-	apu = ((strcmp(pmf_get_platform("system-vendor"), "PC Engines") |
-	strcmp(pmf_get_platform("system-product"), "APU")) == 0);
 
 /*
  * All pin access is funneled through a common, indirect register
@@ -342,45 +337,38 @@ nct_attach(device_t parent, device_t sel
 nct_wr(sc, LD8_DEVCFG, 0);
 
 	/*
-	 * Fill out descriptions of GPIO0, GPIO1 and GPIO67.
-	 * Determine which banks and pins are enabled.
+	 * The BIOS doesn't set things up the way we want.  Pfft.
+	 * Enable all GPIO0/GPIO1 pins.
 	 */
 	multifun = nct_rd(sc, GD_MULTIFUN);
-	enable = nct_rd(sc, LD7_ENABLE);
+	nct_wr(sc, GD_MULTIFUN,
+	multifun & ~(GD_MULTIFUN_GPIO0 | GD_MULTIFUN_GPIO1));
+	nct_wr(sc, LDA_UARTC_ENABLE, 0);
+	nct_wr(sc, LD8_GPIO0_MULTIFUNC, 0);
+	nct_wr(sc, LDB_UARTD_ENABLE, 0);
+	nct_wr(sc, LD8_GPIO1_MULTIFUNC, 0);
+	multifun = nct_rd(sc, GD_MULTIFUN);
+	enable = nct_rd(sc, LD7_ENABLE) | LD7_ENABLE_GPIO0 | LD7_ENABLE_GPIO1;
 
 	nb = >sc_bank[0];
 	nb->nb_firstpin = 0;
 	nb->nb_numpins = 8;
+	nb->nb_enabled = 0xff;
 	nb->nb_reg_dir = LD7_GPIO0_DIRECTION;
 	nb->nb_reg_data = LD7_GPIO0_DATA;
 	nb->nb_reg_inv = LD7_GPIO0_INVERSION;
 	nb->nb_reg_stat = LD7_GPIO0_STATUS;
 	nb->nb_reg_mode = LDF_GPIO0_OUTMODE;
-	if ((multifun & GD_MULTIFUN_GPIO0) == 0 &&
-	((nct_rd(sc, LDA_UARTC_ENABLE) & 1) == 0 || apu)) {
-		nct_wr(sc, LD8_GPIO0_MULTIFUNC, 0);
-		nb->nb_enabled = 0xff;
-		enable |= LD7_ENABLE_GPIO0;
-	} else {
-		sc->sc_bank[0].nb_enabled = 0;
-	}
-		
+
 	nb = >sc_bank[1];
 	nb->nb_firstpin = 8;
 	nb->nb_numpins = 8;
+	nb->nb_enabled = 0xff;
 	nb->nb_reg_dir = LD7_GPIO1_DIRECTION;
 	nb->nb_reg_data = LD7_GPIO1_DATA;
 	nb->nb_reg_inv = LD7_GPIO1_INVERSION;
 	nb->nb_reg_stat = LD7_GPIO1_STATUS;
 	nb->nb_reg_mode = LDF_GPIO1_OUTMODE;
-	if ((multifun & GD_MULTIFUN_GPIO1) == 0 &&
-	(nct_rd(sc, 

CVS commit: src/sys/dev/isa

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:21:40 UTC 2020

Modified Files:
src/sys/dev/isa: cs89x0isa.c if_eg.c if_el.c if_iy.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/isa/cs89x0isa.c
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/isa/if_eg.c
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/isa/if_el.c
cvs rdiff -u -r1.112 -r1.113 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/cs89x0isa.c
diff -u src/sys/dev/isa/cs89x0isa.c:1.18 src/sys/dev/isa/cs89x0isa.c:1.19
--- src/sys/dev/isa/cs89x0isa.c:1.18	Fri Jun 10 13:27:14 2016
+++ src/sys/dev/isa/cs89x0isa.c	Wed Jan 29 06:21:40 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cs89x0isa.c,v 1.18 2016/06/10 13:27:14 ozaki-r Exp $ */
+/* $NetBSD: cs89x0isa.c,v 1.19 2020/01/29 06:21:40 thorpej Exp $ */
 
 /*
  * Copyright 1997
@@ -36,7 +36,7 @@
 /* isa DMA routines for cs89x0 */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cs89x0isa.c,v 1.18 2016/06/10 13:27:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs89x0isa.c,v 1.19 2020/01/29 06:21:40 thorpej Exp $");
 
 #include 
 #include 
@@ -226,7 +226,7 @@ void cs_process_rx_dma(struct cs_softc *
 printf("%s: cs_process_rx_dma: "
 "DMA buffer out of sync about to reset\n",
 device_xname(sc->sc_dev));
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 
 /* skip the rest of the DMA buffer */
 isa_dmaabort(isc->sc_ic, isc->sc_drq);
@@ -243,7 +243,7 @@ void cs_process_rx_dma(struct cs_softc *
 	printf("%s: cs_process_rx_dma: "
 	"unable to allocate mbuf\n",
 	device_xname(sc->sc_dev));
-	ifp->if_ierrors++;
+	if_statinc(ifp, if_ierrors);
 	/*
 	 * couldn't allocate an mbuf so
 	 * things are not good, may as well
@@ -352,7 +352,7 @@ void cs_process_rx_dma(struct cs_softc *
 			else {
 /* the frame was not received OK */
 /* Increment the input error count */
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 
 /*
  * If debugging is enabled then log error

Index: src/sys/dev/isa/if_eg.c
diff -u src/sys/dev/isa/if_eg.c:1.96 src/sys/dev/isa/if_eg.c:1.97
--- src/sys/dev/isa/if_eg.c:1.96	Tue Feb  5 06:17:02 2019
+++ src/sys/dev/isa/if_eg.c	Wed Jan 29 06:21:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_eg.c,v 1.96 2019/02/05 06:17:02 msaitoh Exp $	*/
+/*	$NetBSD: if_eg.c,v 1.97 2020/01/29 06:21:40 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1993 Dean Huxley 
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.96 2019/02/05 06:17:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.97 2020/01/29 06:21:40 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -589,7 +589,7 @@ loop:
 	if (egwritePCB(iot, ioh, sc->eg_pcb) != 0) {
 		aprint_error_dev(sc->sc_dev,
 		"can't send Send Packet command\n");
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		ifp->if_flags &= ~IFF_OACTIVE;
 		m_freem(m0);
 		goto loop;
@@ -620,6 +620,7 @@ int
 egintr(void *arg)
 {
 	struct eg_softc *sc = arg;
+	struct ifnet *ifp = >sc_ethercom.ec_if;
 	bus_space_tag_t iot = sc->sc_iot;
 	bus_space_handle_t ioh = sc->sc_ioh;
 	int i, len, serviced;
@@ -657,11 +658,12 @@ egintr(void *arg)
 			if (sc->eg_pcb[6] || sc->eg_pcb[7]) {
 DPRINTF(("%s: packet dropped\n",
 device_xname(sc->sc_dev)));
-sc->sc_ethercom.ec_if.if_oerrors++;
+if_statinc(ifp, if_oerrors);
 			} else
-sc->sc_ethercom.ec_if.if_opackets++;
-			sc->sc_ethercom.ec_if.if_collisions +=
-			sc->eg_pcb[8] & 0xf;
+if_statinc(ifp, if_opackets);
+			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;
 			egstart(>sc_ethercom.ec_if);
 			serviced = 1;
@@ -712,14 +714,14 @@ egread(struct eg_softc *sc, void *buf, i
 	len > ETHER_MAX_LEN) {
 		aprint_error_dev(sc->sc_dev,
 		"invalid packet size %d; dropping\n", len);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
 	/* Pull packet off interface. */
 	m = egget(sc, buf, len);
 	if (m == 0) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -861,7 +863,7 @@ egwatchdog(struct ifnet *ifp)
 	struct eg_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	sc->sc_ethercom.ec_if.if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	egreset(sc);
 }

Index: src/sys/dev/isa/if_el.c
diff -u src/sys/dev/isa/if_el.c:1.98 src/sys/dev/isa/if_el.c:1.99
--- src/sys/dev/isa/if_el.c:1.98	Tue Feb  5 06:17:02 2019
+++ src/sys/dev/isa/if_el.c	Wed Jan 29 06:21:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_el.c,v 1.98 2019/02/05 06:17:02 msaitoh Exp $	*/
+/*	$NetBSD: if_el.c,v 1.99 2020/01/29 06:21:40 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1994, Matthew E. Kimmel.  Permission is hereby granted
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: 

CVS commit: src/sys/dev/isa

2019-12-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Dec 27 09:50:27 UTC 2019

Modified Files:
src/sys/dev/isa: isareg.h

Log Message:
s/reister/register/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/isa/isareg.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/isareg.h
diff -u src/sys/dev/isa/isareg.h:1.10 src/sys/dev/isa/isareg.h:1.11
--- src/sys/dev/isa/isareg.h:1.10	Tue May 29 06:14:33 2018
+++ src/sys/dev/isa/isareg.h	Fri Dec 27 09:50:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: isareg.h,v 1.10 2018/05/29 06:14:33 jdolecek Exp $	*/
+/*	$NetBSD: isareg.h,v 1.11 2019/12/27 09:50:27 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -133,7 +133,7 @@
 #define	IO_COMSIZE	8	/* 8250, 16X50 com controllers */
 #define	IO_CGASIZE	16	/* CGA controllers */
 #define	IO_DMASIZE	16	/* 8237 DMA controllers */
-#define	IO_DPGSIZE	32	/* 74LS612 DMA page reisters */
+#define	IO_DPGSIZE	32	/* 74LS612 DMA page registers */
 #define	IO_FDCSIZE	8	/* Nec765 floppy controllers */
 #define	IO_WDCSIZE	8	/* WD compatible disk controller */
 #define	IO_GAMSIZE	16	/* AT compatible game controller */



CVS commit: src/sys/dev/isa

2019-12-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Dec 27 04:50:41 UTC 2019

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

Log Message:
s/like like/like/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/isa/if_ep_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/if_ep_isa.c
diff -u src/sys/dev/isa/if_ep_isa.c:1.46 src/sys/dev/isa/if_ep_isa.c:1.47
--- src/sys/dev/isa/if_ep_isa.c:1.46	Sun Nov 10 21:16:35 2019
+++ src/sys/dev/isa/if_ep_isa.c	Fri Dec 27 04:50:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ep_isa.c,v 1.46 2019/11/10 21:16:35 chs Exp $	*/
+/*	$NetBSD: if_ep_isa.c,v 1.47 2019/12/27 04:50:41 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ep_isa.c,v 1.46 2019/11/10 21:16:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ep_isa.c,v 1.47 2019/12/27 04:50:41 msaitoh Exp $");
 
 #include 
 #include 
@@ -143,7 +143,7 @@ epaddcard(int bus, int iobase, int irq, 
 /*
  * 3c509 cards on the ISA bus are probed in ethernet address order.
  * The probe sequence requires careful orchestration, and we'd like
- * like to allow the irq and base address to be wildcarded. So, we
+ * to allow the irq and base address to be wildcarded. So, we
  * probe all the cards the first time epprobe() is called. On subsequent
  * calls we look for matching cards.
  */



CVS commit: src/sys/dev/isa

2019-04-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr 24 09:35:54 UTC 2019

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

Log Message:
 Remove extra test for SIOCSIFMEDIA.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 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.104 src/sys/dev/isa/if_iy.c:1.105
--- src/sys/dev/isa/if_iy.c:1.104	Tue Feb  5 06:17:02 2019
+++ src/sys/dev/isa/if_iy.c	Wed Apr 24 09:35:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iy.c,v 1.104 2019/02/05 06:17:02 msaitoh Exp $	*/
+/*	$NetBSD: if_iy.c,v 1.105 2019/04/24 09:35:54 msaitoh Exp $	*/
 /* #define IYDEBUG */
 /* #define IYMEMDEBUG */
 
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.104 2019/02/05 06:17:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.105 2019/04/24 09:35:54 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -60,8 +60,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.
 #include 
 #include 
 #include 
-
 #include 
+#include 
 
 #ifdef INET
 #include 
@@ -72,10 +72,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.
 #endif
 
 
-#if defined(SIOCSIFMEDIA)
-#include 
-#endif
-
 #include 
 #include 
 #include 



CVS commit: src/sys/dev/isa

2019-04-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 06:19:34 UTC 2019

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

Log Message:
 Make it compilable with IX_DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 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_ix.c
diff -u src/sys/dev/isa/if_ix.c:1.36 src/sys/dev/isa/if_ix.c:1.37
--- src/sys/dev/isa/if_ix.c:1.36	Tue Apr  9 06:15:21 2019
+++ src/sys/dev/isa/if_ix.c	Tue Apr  9 06:19:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ix.c,v 1.36 2019/04/09 06:15:21 msaitoh Exp $	*/
+/*	$NetBSD: if_ix.c,v 1.37 2019/04/09 06:19:34 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ix.c,v 1.36 2019/04/09 06:15:21 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ix.c,v 1.37 2019/04/09 06:19:34 msaitoh Exp $");
 
 #include 
 #include 
@@ -497,8 +497,9 @@ ix_match(device_t parent, cfdata_t cf, v
 		return 0;
 
 	if (bus_space_map(iot, ia->ia_io[0].ir_addr,
-			  IX_IOSIZE, 0, ) != 0) {
-		DPRINTF(("Can't map io space at 0x%x\n", ia->ia_iobase));
+	IX_IOSIZE, 0, ) != 0) {
+		DPRINTF(("Can't map io space at 0x%x\n",
+			ia->ia_io[0].ir_addr));
 		return 0;
 	}
 
@@ -578,7 +579,7 @@ ix_match(device_t parent, cfdata_t cf, v
 	ia->ia_iomem[0].ir_addr != maddr) {
 		DPRINTF((
 		  "ix_match: memaddr of board @ 0x%x doesn't match config\n",
-		  ia->ia_iobase));
+		  ia->ia_iomem[0].ir_addr));
 		goto out;
 	}
 
@@ -586,7 +587,7 @@ ix_match(device_t parent, cfdata_t cf, v
 	ia->ia_iomem[0].ir_size != msiz) {
 		DPRINTF((
 		   "ix_match: memsize of board @ 0x%x doesn't match config\n",
-		   ia->ia_iobase));
+		   ia->ia_iomem[0].ir_addr));
 		goto out;
 	}
 
@@ -662,7 +663,7 @@ ix_match(device_t parent, cfdata_t cf, v
 	ia->ia_nirq = 1;
 	ia->ia_irq[0].ir_irq = irq;
 
-	DPRINTF(("ix_match: found board @ 0x%x\n", ia->ia_iobase));
+	DPRINTF(("ix_match: found board @ 0x%x\n", ia->ia_iomem[0].ir_addr));
 
 out:
 	bus_space_unmap(iot, ioh, IX_IOSIZE);
@@ -700,7 +701,7 @@ ix_attach(device_t parent, device_t self
 	ia->ia_io[0].ir_size, 0, ) != 0) {
 
 		DPRINTF(("\n%s: can't map i/o space 0x%x-0x%x\n",
-			  device_xname(self), ia->ia_[0].ir_addr,
+			  device_xname(self), ia->ia_io[0].ir_addr,
 			  ia->ia_io[0].ir_addr + ia->ia_io[0].ir_size - 1));
 		return;
 	}



CVS commit: src/sys/dev/isa

2019-04-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 06:15:21 UTC 2019

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

Log Message:
 KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 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_ix.c
diff -u src/sys/dev/isa/if_ix.c:1.35 src/sys/dev/isa/if_ix.c:1.36
--- src/sys/dev/isa/if_ix.c:1.35	Thu Jul 14 04:19:27 2016
+++ src/sys/dev/isa/if_ix.c	Tue Apr  9 06:15:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ix.c,v 1.35 2016/07/14 04:19:27 msaitoh Exp $	*/
+/*	$NetBSD: if_ix.c,v 1.36 2019/04/09 06:15:21 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ix.c,v 1.35 2016/07/14 04:19:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ix.c,v 1.36 2019/04/09 06:15:21 msaitoh Exp $");
 
 #include 
 #include 
@@ -63,7 +63,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_ix.c,v 1.
 #define DPRINTF(x)
 #endif
 
-int ix_media[] = {
+static int ix_media[] = {
 	IFM_ETHER | IFM_10_5,
 	IFM_ETHER | IFM_10_2,
 	IFM_ETHER | IFM_10_T,
@@ -76,8 +76,8 @@ struct ix_softc {
 	bus_space_tag_t sc_regt;	/* space tag for registers */
 	bus_space_handle_t sc_regh;	/* space handle for registers */
 
-	u_int8_t	use_pio;	/* use PIO rather than shared mem */
-	u_int16_t	irq_encoded;	/* encoded IRQ */
+	uint8_t		use_pio;	/* use PIO rather than shared mem */
+	uint16_t	irq_encoded;	/* encoded IRQ */
 	void		*sc_ih;		/* interrupt handle */
 };
 
@@ -90,21 +90,21 @@ static void ix_copyout(struct ie_sof
 
 static void	ix_bus_barrier(struct ie_softc *, int, int, int);
 
-static u_int16_t ix_read_16(struct ie_softc *, int);
-static void	ix_write_16(struct ie_softc *, int, u_int16_t);
+static uint16_t ix_read_16(struct ie_softc *, int);
+static void	ix_write_16(struct ie_softc *, int, uint16_t);
 static void	ix_write_24(struct ie_softc *, int, int);
-static void	ix_zeromem (struct ie_softc *, int, int);
+static void	ix_zeromem(struct ie_softc *, int, int);
 
 static void	ix_mediastatus(struct ie_softc *, struct ifmediareq *);
 
-static u_int16_t ix_read_eeprom(bus_space_tag_t, bus_space_handle_t, int);
+static uint16_t ix_read_eeprom(bus_space_tag_t, bus_space_handle_t, int);
 static void	ix_eeprom_outbits(bus_space_tag_t, bus_space_handle_t, int,
 int);
-static int	ix_eeprom_inbits (bus_space_tag_t, bus_space_handle_t);
-static void	ix_eeprom_clock  (bus_space_tag_t, bus_space_handle_t, int);
+static int	ix_eeprom_inbits(bus_space_tag_t, bus_space_handle_t);
+static void	ix_eeprom_clock(bus_space_tag_t, bus_space_handle_t, int);
 
-int ix_match(device_t, cfdata_t, void *);
-void ix_attach(device_t, device_t, void *);
+static int	ix_match(device_t, cfdata_t, void *);
+static void	ix_attach(device_t, device_t, void *);
 
 /*
  * EtherExpress/16 support routines
@@ -112,12 +112,12 @@ void ix_attach(device_t, device_t, void 
 static void
 ix_reset(struct ie_softc *sc, int why)
 {
-	struct ix_softc* isc = (struct ix_softc *) sc;
+	struct ix_softc *isc = (struct ix_softc *)sc;
 
 	switch (why) {
 	case CHIP_PROBE:
 		bus_space_write_1(isc->sc_regt, isc->sc_regh, IX_ECTRL,
-  IX_RESET_586);
+		IX_RESET_586);
 		delay(100);
 		bus_space_write_1(isc->sc_regt, isc->sc_regh, IX_ECTRL, 0);
 		delay(100);
@@ -125,17 +125,18 @@ ix_reset(struct ie_softc *sc, int why)
 
 	case CARD_RESET:
 		break;
-}
+	}
 }
 
 static void
 ix_atten(struct ie_softc *sc, int why)
 {
-	struct ix_softc* isc = (struct ix_softc *) sc;
+	struct ix_softc *isc = (struct ix_softc *)sc;
+
 	bus_space_write_1(isc->sc_regt, isc->sc_regh, IX_ATTN, 0);
 }
 
-static u_int16_t
+static uint16_t
 ix_read_eeprom(bus_space_tag_t iot, bus_space_handle_t ioh, int location)
 {
 	int ectrl, edata;
@@ -153,7 +154,7 @@ ix_read_eeprom(bus_space_tag_t iot, bus_
 	bus_space_write_1(iot, ioh, IX_ECTRL, ectrl);
 	ix_eeprom_clock(iot, ioh, 1);
 	ix_eeprom_clock(iot, ioh, 0);
-	return (edata);
+	return edata;
 }
 
 static void
@@ -195,7 +196,7 @@ ix_eeprom_inbits(bus_space_tag_t iot, bu
 		}
 		ix_eeprom_clock(iot, ioh, 0);
 	}
-	return (edata);
+	return edata;
 }
 
 static void
@@ -215,7 +216,7 @@ ix_eeprom_clock(bus_space_tag_t iot, bus
 static int
 ix_intrhook(struct ie_softc *sc, int where)
 {
-	struct ix_softc* isc = (struct ix_softc *) sc;
+	struct ix_softc *isc = (struct ix_softc *)sc;
 
 	switch (where) {
 	case INTR_ENTER:
@@ -239,21 +240,20 @@ static void
 ix_copyin(struct ie_softc *sc, void *dst, int offset, size_t size)
 {
 	int i, dribble;
-	u_int8_t* bptr = dst;
-	u_int16_t* wptr = dst;
-	struct ix_softc* isc = (struct ix_softc *) sc;
+	uint8_t *bptr = dst;
+	uint16_t *wptr = dst;
+	struct ix_softc *isc = (struct ix_softc *)sc;
 
 	if (isc->use_pio) {
 		/* Reset read pointer to the specified offset */
 		bus_space_barrier(sc->bt, sc->bh, IX_DATAPORT, 2,
-		  

CVS commit: src/sys/dev/isa

2019-04-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 06:00:08 UTC 2019

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

Log Message:
 Make it compilable with EF_DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/isa/if_ef.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_ef.c
diff -u src/sys/dev/isa/if_ef.c:1.32 src/sys/dev/isa/if_ef.c:1.33
--- src/sys/dev/isa/if_ef.c:1.32	Tue Apr  9 05:59:14 2019
+++ src/sys/dev/isa/if_ef.c	Tue Apr  9 06:00:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ef.c,v 1.32 2019/04/09 05:59:14 msaitoh Exp $	*/
+/*	$NetBSD: if_ef.c,v 1.33 2019/04/09 06:00:08 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.32 2019/04/09 05:59:14 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.33 2019/04/09 06:00:08 msaitoh Exp $");
 
 #include 
 #include 
@@ -143,7 +143,7 @@ ef_card_add(struct ef_isabus *bus, bus_a
 {
 	int idx;
 
-	DPRINTF(("Adding 3c507 at 0x%x, IRQ %d, Mem 0x%lx/%ld\n",
+	DPRINTF(("Adding 3c507 at 0x%x, IRQ %d, Mem 0x%lx/%zu\n",
 		 (u_int) iobase, irq, (u_long) maddr, msiz));
 
 	for (idx = 0; idx < MAXCARDS_PER_ISABUS; idx++) {
@@ -546,8 +546,9 @@ ef_attach(device_t parent, device_t self
 	ia->ia_iomem[0].ir_size, 0, ) != 0) {
 
 		DPRINTF(("\n%s: can't map iomem space 0x%x-0x%x\n",
-			device_xname(self), ia->ia_maddr,
-			ia->ia_maddr + ia->ia_msize - 1));
+			device_xname(self), ia->ia_iomem[0].ir_addr,
+			ia->ia_iomem[0].ir_addr + ia->ia_iomem[0].ir_size
+			- 1));
 		bus_space_unmap(ia->ia_iot, ioh, ia->ia_io[0].ir_size);
 		return;
 	}



CVS commit: src/sys/dev/isa

2019-04-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 05:59:15 UTC 2019

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

Log Message:
- Use the correct function name for the panic message.
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/isa/if_ef.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_ef.c
diff -u src/sys/dev/isa/if_ef.c:1.31 src/sys/dev/isa/if_ef.c:1.32
--- src/sys/dev/isa/if_ef.c:1.31	Fri Jun  3 16:28:40 2011
+++ src/sys/dev/isa/if_ef.c	Tue Apr  9 05:59:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ef.c,v 1.31 2011/06/03 16:28:40 tsutsui Exp $	*/
+/*	$NetBSD: if_ef.c,v 1.32 2019/04/09 05:59:14 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.31 2011/06/03 16:28:40 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.32 2019/04/09 05:59:14 msaitoh Exp $");
 
 #include 
 #include 
@@ -72,17 +72,17 @@ struct ef_softc {
 
 	void* sc_ih;			/* interrupt handle */
 
-	u_int8_t card_rev;		/* hardware revision */
-	u_int8_t card_type;		/* card model -- AUI/BNC or TP */
+	uint8_t card_rev;		/* hardware revision */
+	uint8_t card_type;		/* card model -- AUI/BNC or TP */
 };
 
-int ef_media[] = {
+static int ef_media[] = {
 	IFM_ETHER | IFM_10_5,
 	IFM_ETHER | IFM_10_2,
 };
 #define NEF_MEDIA   (sizeof(ef_media) / sizeof(ef_media[0]))
 
-int eftp_media[] = {
+static int eftp_media[] = {
 	IFM_ETHER | IFM_10_T,
 };
 #define NEFTP_MEDIA   (sizeof(eftp_media) / sizeof(eftp_media[0]))
@@ -96,8 +96,8 @@ static int 	ef_intrhook(struct ie_softc 
 static void	ef_copyin(struct ie_softc *, void *, int, size_t);
 static void	ef_copyout(struct ie_softc *, const void *, int, size_t);
 
-static u_int16_t ef_read_16(struct ie_softc *, int);
-static void	ef_write_16(struct ie_softc *, int, u_int16_t);
+static uint16_t ef_read_16(struct ie_softc *, int);
+static void	ef_write_16(struct ie_softc *, int, uint16_t);
 static void	ef_write_24(struct ie_softc *, int, int);
 
 static void	ef_mediastatus(struct ie_softc *, struct ifmediareq *);
@@ -105,8 +105,8 @@ static void	ef_mediastatus(struct ie_sof
 /* Local routines */
 static int 	ef_port_check(bus_space_tag_t, bus_space_handle_t);
 
-int ef_match(device_t, cfdata_t, void *);
-void ef_attach(device_t, device_t, void *);
+static int	ef_match(device_t, cfdata_t, void *);
+static void	ef_attach(device_t, device_t, void *);
 
 /*
  * This keeps track of which ISAs have been through an ie probe sequence.
@@ -117,7 +117,7 @@ void ef_attach(device_t, device_t, void 
  * which will unique per ISA bus.
  */
 
-#define MAXCARDS_PER_ISABUS 8   /* if you have more than 8, you lose */
+#define MAXCARDS_PER_ISABUS 8   /* If you have more than 8, you lose */
 
 struct ef_isabus {
 	LIST_ENTRY(ef_isabus) isa_link;
@@ -138,12 +138,8 @@ static LIST_HEAD(, ef_isabus) ef_isa_bus
 static int ef_isa_buses_inited;
 
 static void
-ef_card_add(
-struct ef_isabus *bus,
-bus_addr_t iobase,
-bus_addr_t maddr,
-bus_size_t msiz,
-int irq)
+ef_card_add(struct ef_isabus *bus, bus_addr_t iobase, bus_addr_t maddr,
+bus_size_t msiz, int irq)
 {
 	int idx;
 
@@ -168,11 +164,11 @@ ef_card_add(
 static void
 ef_reset(struct ie_softc *sc, int why)
 {
-	struct ef_softc* esc = (struct ef_softc *) sc;
+	struct ef_softc *esc = (struct ef_softc *)sc;
 
 	switch (why) {
 	case CHIP_PROBE:
-		/* reset to chip to see if it responds */
+		/* Reset to chip to see if it responds */
 		bus_space_write_1(esc->sc_regt, esc->sc_regh,
   EF_CTRL, EF_CTRL_RESET);
 		DELAY(100);
@@ -183,7 +179,7 @@ ef_reset(struct ie_softc *sc, int why)
 
 	case CARD_RESET:
 		/*
-		 * this takes around 10sec, and we can get
+		 * This takes around 10sec, and we can get
 		 * by quite well w/out it...
 		 */
 		break;
@@ -193,14 +189,16 @@ ef_reset(struct ie_softc *sc, int why)
 static void
 ef_atten(struct ie_softc *sc, int why)
 {
-	struct ef_softc* esc = (struct ef_softc *) sc;
+	struct ef_softc *esc = (struct ef_softc *)sc;
+
 	bus_space_write_1(esc->sc_regt, esc->sc_regh, EF_ATTN, 1);
 }
 
 static void
 ef_hwinit(struct ie_softc *sc)
 {
-	struct ef_softc* esc = (struct ef_softc *) sc;
+	struct ef_softc *esc = (struct ef_softc *)sc;
+
 	bus_space_write_1(esc->sc_regt, esc->sc_regh, EF_ICTRL, 1);
 }
 
@@ -208,26 +206,26 @@ static int
 ef_intrhook(struct ie_softc *sc, int where)
 {
 	unsigned char cr;
-	struct ef_softc* esc = (struct ef_softc *) sc;
+	struct ef_softc *esc = (struct ef_softc *)sc;
 
 	switch (where) {
 	case INTR_ENTER:
-		/* entering ISR: disable, ack card interrupts */
+		/* Entering ISR: disable, ack card interrupts */
 		cr = bus_space_read_1(esc->sc_regt, esc->sc_regh, EF_CTRL);
 		bus_space_write_1(esc->sc_regt, esc->sc_regh, EF_CTRL,
-  cr & ~EF_CTRL_IEN);
+		cr & ~EF_CTRL_IEN);
 		

CVS commit: src/sys/dev/isa

2019-04-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 05:25:14 UTC 2019

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

Log Message:
 Make it compilable with AI_DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/isa/if_ai.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.34 src/sys/dev/isa/if_ai.c:1.35
--- src/sys/dev/isa/if_ai.c:1.34	Tue Apr  9 05:24:07 2019
+++ src/sys/dev/isa/if_ai.c	Tue Apr  9 05:25:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ai.c,v 1.34 2019/04/09 05:24:07 msaitoh Exp $	*/
+/*	$NetBSD: if_ai.c,v 1.35 2019/04/09 05:25:14 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ai.c,v 1.34 2019/04/09 05:24:07 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ai.c,v 1.35 2019/04/09 05:25:14 msaitoh Exp $");
 
 #include 
 #include 
@@ -249,7 +249,7 @@ ai_match(device_t parent, cfdata_t cf, v
 			  AI_IOSIZE, 0, ) != 0) {
 
 		DPRINTF(("ai_match: cannot map %d IO ports @ 0x%x\n",
-			 AI_IOSIZE, ia->ia_iobase));
+			 AI_IOSIZE, ia->ia_io[0].ir_addr));
 		return 0;
 	}
 
@@ -259,7 +259,7 @@ ai_match(device_t parent, cfdata_t cf, v
 	if (type != SL10_BOARD && type != EN100_BOARD &&
 	type != SLFIBER_BOARD) {
 		DPRINTF(("ai_match: unknown board code 0x%02x @ 0x%x\n",
-			 type, ia->ia_iobase));
+			 type, ia->ia_io[0].ir_addr));
 		goto out;
 	}
 
@@ -282,7 +282,7 @@ ai_match(device_t parent, cfdata_t cf, v
 	ia->ia_iomem[0].ir_size != memsize) {
 		DPRINTF((
 		   "ai_match: memsize of board @ 0x%x doesn't match config\n",
-		   ia->ia_iobase));
+		   ia->ia_io[0].ir_addr));
 		goto out;
 	}
 
@@ -298,7 +298,7 @@ ai_match(device_t parent, cfdata_t cf, v
 
 	ia->ia_ndrq = 0;
 
-	DPRINTF(("ai_match: found board @ 0x%x\n", ia->ia_iobase));
+	DPRINTF(("ai_match: found board @ 0x%x\n", ia->ia_io[0].ir_addr));
 
 out:
 	bus_space_unmap(iot, ioh, AI_IOSIZE);



CVS commit: src/sys/dev/isa

2019-04-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 05:24:07 UTC 2019

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

Log Message:
 KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/isa/if_ai.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.33 src/sys/dev/isa/if_ai.c:1.34
--- src/sys/dev/isa/if_ai.c:1.33	Fri Jun  3 16:28:40 2011
+++ src/sys/dev/isa/if_ai.c	Tue Apr  9 05:24:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ai.c,v 1.33 2011/06/03 16:28:40 tsutsui Exp $	*/
+/*	$NetBSD: if_ai.c,v 1.34 2019/04/09 05:24:07 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ai.c,v 1.33 2011/06/03 16:28:40 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ai.c,v 1.34 2019/04/09 05:24:07 msaitoh Exp $");
 
 #include 
 #include 
@@ -69,13 +69,13 @@ struct ai_softc {
 	bus_space_tag_t sc_regt;	/* space tag for registers */
 	bus_space_handle_t sc_regh;	/* space handle for registers */
 
-	u_int8_t	card_rev;
-	u_int8_t	card_type;
+	uint8_t	card_rev;
+	uint8_t	card_type;
 
 	void		*sc_ih;		/* interrupt handle */
 };
 
-const char *ai_names[] = {
+static const char *ai_names[] = {
 "StarLAN 10",
 "EN100",
 "StarLAN Fiber",
@@ -88,8 +88,8 @@ static void 	ai_atten(struct ie_softc *,
 static void	ai_copyin(struct ie_softc *, void *, int, size_t);
 static void	ai_copyout(struct ie_softc *, const void *, int, size_t);
 
-static u_int16_t ai_read_16(struct ie_softc *, int);
-static void	ai_write_16(struct ie_softc *, int, u_int16_t);
+static uint16_t ai_read_16(struct ie_softc *, int);
+static void	ai_write_16(struct ie_softc *, int, uint16_t);
 static void	ai_write_24(struct ie_softc *, int, int);
 
 /* Local support functions */
@@ -98,8 +98,8 @@ static int 	check_ie_present(struct ie_s
 static int	ai_find_mem_size(struct ai_softc*, bus_space_tag_t,
 	bus_size_t);
 
-int ai_match(device_t, cfdata_t, void *);
-void ai_attach(device_t, device_t, void *);
+static int	ai_match(device_t, cfdata_t, void *);
+static void	ai_attach(device_t, device_t, void *);
 
 /*
  * AT StarLan support routines
@@ -107,18 +107,18 @@ void ai_attach(device_t, device_t, void 
 static void
 ai_reset(struct ie_softc *sc, int why)
 {
-	struct ai_softc* asc = (struct ai_softc *) sc;
+	struct ai_softc *asc = (struct ai_softc *)sc;
 
 	switch (why) {
 	case CHIP_PROBE:
-		/* reset to chip to see if it responds */
+		/* Reset to chip to see if it responds */
 		bus_space_write_1(asc->sc_regt, asc->sc_regh, AI_RESET, 0);
 		DELAY(100);
 		break;
 
 	case CARD_RESET:
 		/*
-		 * this takes around 10sec, and we can get
+		 * This takes around 10sec, and we can get
 		 * by quite well w/out it...
 		 */
 		break;
@@ -128,18 +128,19 @@ ai_reset(struct ie_softc *sc, int why)
 static void
 ai_atten(struct ie_softc *sc, int why)
 {
-struct ai_softc* asc = (struct ai_softc *) sc;
-bus_space_write_1(asc->sc_regt, asc->sc_regh, AI_ATTN, 0);
+	struct ai_softc *asc = (struct ai_softc *)sc;
+
+	bus_space_write_1(asc->sc_regt, asc->sc_regh, AI_ATTN, 0);
 }
 
 static void
-ai_copyin (struct ie_softc *sc, void *dst, int offset, size_t size)
+ai_copyin(struct ie_softc *sc, void *dst, int offset, size_t size)
 {
 	int dribble;
-	u_int8_t* bptr = dst;
+	uint8_t *bptr = dst;
 
 	bus_space_barrier(sc->bt, sc->bh, offset, size,
-			  BUS_SPACE_BARRIER_READ);
+	BUS_SPACE_BARRIER_READ);
 
 	if (offset % 2) {
 		*bptr = bus_space_read_1(sc->bt, sc->bh, offset);
@@ -147,8 +148,8 @@ ai_copyin (struct ie_softc *sc, void *ds
 	}
 
 	dribble = size % 2;
-	bus_space_read_region_2(sc->bt, sc->bh, offset, (u_int16_t *) bptr,
-size >> 1);
+	bus_space_read_region_2(sc->bt, sc->bh, offset, (uint16_t *)bptr,
+	size >> 1);
 
 	if (dribble) {
 		bptr += size - 1;
@@ -158,12 +159,12 @@ ai_copyin (struct ie_softc *sc, void *ds
 }
 
 static void
-ai_copyout (struct ie_softc *sc, const void *src, int offset, size_t size)
+ai_copyout(struct ie_softc *sc, const void *src, int offset, size_t size)
 {
 	int dribble;
 	int osize = size;
 	int ooffset = offset;
-	const u_int8_t* bptr = src;
+	const uint8_t *bptr = src;
 
 	if (offset % 2) {
 		bus_space_write_1(sc->bt, sc->bh, offset, *bptr);
@@ -172,7 +173,7 @@ ai_copyout (struct ie_softc *sc, const v
 
 	dribble = size % 2;
 	bus_space_write_region_2(sc->bt, sc->bh, offset,
-	(const u_int16_t *)bptr, size >> 1);
+	(const uint16_t *)bptr, size >> 1);
 	if (dribble) {
 		bptr += size - 1;
 		offset += size - 1;
@@ -180,28 +181,31 @@ ai_copyout (struct ie_softc *sc, const v
 	}
 
 	bus_space_barrier(sc->bt, sc->bh, ooffset, osize,
-			  BUS_SPACE_BARRIER_WRITE);
+	BUS_SPACE_BARRIER_WRITE);
 }
 
-static u_int16_t
-ai_read_16 (struct ie_softc *sc, int offset)
+static uint16_t
+ai_read_16(struct 

CVS commit: src/sys/dev/isa

2019-03-15 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Mar 16 04:36:19 UTC 2019

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

Log Message:
Swap wrong ordered halt_input and halt_output (since rev1.1).
But I guess that it didn't lead a big impact.  Because hw_if->close
is called immediately after that in most cases.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/isa/aria.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/aria.c
diff -u src/sys/dev/isa/aria.c:1.37 src/sys/dev/isa/aria.c:1.38
--- src/sys/dev/isa/aria.c:1.37	Sat Oct 27 17:18:23 2012
+++ src/sys/dev/isa/aria.c	Sat Mar 16 04:36:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: aria.c,v 1.37 2012/10/27 17:18:23 chs Exp $	*/
+/*	$NetBSD: aria.c,v 1.38 2019/03/16 04:36:19 isaki Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1996, 1998 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aria.c,v 1.37 2012/10/27 17:18:23 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aria.c,v 1.38 2019/03/16 04:36:19 isaki Exp $");
 
 #include 
 #include 
@@ -212,8 +212,8 @@ const struct audio_hw_if aria_hw_if = {
 	NULL,
 	aria_start_output,
 	aria_start_input,
-	aria_halt_input,
 	aria_halt_output,
+	aria_halt_input,
 	NULL,
 	aria_getdev,
 	NULL,



CVS commit: src/sys/dev/isa

2019-02-24 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Feb 24 20:50:03 UTC 2019

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

Log Message:
Add missing FALLTHROUGH in isa/mcd.c

Requested by GCC in NetBSD/i386 kUBSan KCOV build.

Reviewed by 


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/dev/isa/mcd.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/mcd.c
diff -u src/sys/dev/isa/mcd.c:1.117 src/sys/dev/isa/mcd.c:1.118
--- src/sys/dev/isa/mcd.c:1.117	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/isa/mcd.c	Sun Feb 24 20:50:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcd.c,v 1.117 2018/09/03 16:29:31 riastradh Exp $	*/
+/*	$NetBSD: mcd.c,v 1.118 2019/02/24 20:50:03 kamil Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994, 1995 Charles M. Hannum.  All rights reserved.
@@ -56,7 +56,7 @@
 /*static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.117 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.118 2019/02/24 20:50:03 kamil Exp $");
 
 #include 
 #include 
@@ -1192,6 +1192,7 @@ mcdintr(void *arg)
 		mbx->count = RDELAY_WAITMODE;
 		mbx->state = MCD_S_WAITMODE;
 
+		/* FALLTHROUGH */
 	case MCD_S_WAITMODE:
 		callout_stop(>sc_pintr_ch);
 		for (i = 20; i; i--) {
@@ -1230,6 +1231,7 @@ mcdintr(void *arg)
 		mbx->count = RDELAY_WAITREAD;
 		mbx->state = MCD_S_WAITREAD;
 
+		/* FALLTHROUGH */
 	case MCD_S_WAITREAD:
 		callout_stop(>sc_pintr_ch);
 	nextblock:



CVS commit: src/sys/dev/isa

2018-05-29 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue May 29 06:14:34 UTC 2018

Modified Files:
src/sys/dev/isa: isadma.c isadmareg.h isareg.h

Log Message:
fix off-by-one in the mapping of the ISA DMA page registers, they actually
start at 0x81; the code used bus_space_map() starting from 0x80 but
used +1 offset for actual I/O, now it maps starting 0x81 and does I/O
without offset

the reads and writes work exactly the same as before, but this frees
0x80 for being mapped independantly

patch provided in PR kern/52468 by Jonathan Chapman; checked against the spec
and also FreeBSD sys/x86/isa/isa_dma.c


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/isa/isadma.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/isa/isadmareg.h
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/isa/isareg.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/isadma.c
diff -u src/sys/dev/isa/isadma.c:1.66 src/sys/dev/isa/isadma.c:1.67
--- src/sys/dev/isa/isadma.c:1.66	Sat Nov 13 13:52:03 2010
+++ src/sys/dev/isa/isadma.c	Tue May 29 06:14:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: isadma.c,v 1.66 2010/11/13 13:52:03 uebayasi Exp $	*/
+/*	$NetBSD: isadma.c,v 1.67 2018/05/29 06:14:33 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isadma.c,v 1.66 2010/11/13 13:52:03 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isadma.c,v 1.67 2018/05/29 06:14:33 jdolecek Exp $");
 
 #include 
 #include 
@@ -53,15 +53,19 @@ __KERNEL_RCSID(0, "$NetBSD: isadma.c,v 1
 struct isa_mem *isa_mem_head;
 
 /*
- * High byte of DMA address is stored in this DMAPG register for
- * the Nth DMA channel.
+ * DMA Channel to Address Page Register offset mapping
+ *
+ * Offset from IO_DMAPG is stored in this 2D array -- first dimension is
+ * the DMA controller, second dimension is the DMA channel.
+ *
+ * e.g. dmapageport[0][1] gives us the offset for DMA ch 1 on DMA1
  */
-static int dmapageport[2][4] = {
-	{0x7, 0x3, 0x1, 0x2},
-	{0xf, 0xb, 0x9, 0xa}
+static const int dmapageport[2][4] = {
+	{0x6, 0x2, 0x0, 0x1},
+	{0xe, 0xa, 0x8, 0x9}
 };
 
-static u_int8_t dmamode[] = {
+static const u_int8_t dmamode[] = {
 	/* write to device/read from device */
 	DMA37MD_READ | DMA37MD_SINGLE,
 	DMA37MD_WRITE | DMA37MD_SINGLE,
@@ -169,7 +173,7 @@ _isa_dmainit(struct isa_dma_state *ids, 
 		if (bus_space_map(ids->ids_bst, IO_DMA2, DMA2_IOSIZE, 0,
 		>ids_dma2h))
 			panic("_isa_dmainit: unable to map DMA controller #2");
-		if (bus_space_map(ids->ids_bst, IO_DMAPG, 0xf, 0,
+		if (bus_space_map(ids->ids_bst, IO_DMAPG, DMAPG_IOSIZE, 0,
 		>ids_dmapgh))
 			panic("_isa_dmainit: unable to map DMA page registers");
 
@@ -211,7 +215,7 @@ _isa_dmadestroy(struct isa_dma_state *id
 	/*
 	 * Unmap the registers used by the ISA DMA controller.
 	 */
-	bus_space_unmap(ids->ids_bst, ids->ids_dmapgh, 0xf);
+	bus_space_unmap(ids->ids_bst, ids->ids_dmapgh, DMAPG_IOSIZE);
 	bus_space_unmap(ids->ids_bst, ids->ids_dma2h, DMA2_IOSIZE);
 	bus_space_unmap(ids->ids_bst, ids->ids_dma1h, DMA1_IOSIZE);
 

Index: src/sys/dev/isa/isadmareg.h
diff -u src/sys/dev/isa/isadmareg.h:1.8 src/sys/dev/isa/isadmareg.h:1.9
--- src/sys/dev/isa/isadmareg.h:1.8	Mon Apr 28 20:23:52 2008
+++ src/sys/dev/isa/isadmareg.h	Tue May 29 06:14:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: isadmareg.h,v 1.8 2008/04/28 20:23:52 martin Exp $	*/
+/*	$NetBSD: isadmareg.h,v 1.9 2018/05/29 06:14:33 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -47,6 +47,9 @@
 #define	ISA_DMA_MAXSIZE_DEFAULT(chan)	\
 	(((chan) & 4) ? ISA_DMA_MAXSIZE_16BIT : ISA_DMA_MAXSIZE_8BIT)
 
+/* DMA Page Address Registers size */
+#define	DMAPG_IOSIZE	(1*15)
+
 /*
  * Register definitions for DMA controller 1 (channels 0..3):
  */

Index: src/sys/dev/isa/isareg.h
diff -u src/sys/dev/isa/isareg.h:1.9 src/sys/dev/isa/isareg.h:1.10
--- src/sys/dev/isa/isareg.h:1.9	Sun Dec 11 12:22:02 2005
+++ src/sys/dev/isa/isareg.h	Tue May 29 06:14:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: isareg.h,v 1.9 2005/12/11 12:22:02 christos Exp $	*/
+/*	$NetBSD: isareg.h,v 1.10 2018/05/29 06:14:33 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -55,7 +55,7 @@
 #define	IO_PPI		0x061		/* Programmable Peripheral Interface */
 #define	IO_RTC		0x070		/* RTC */
 #define	IO_NMI		IO_RTC		/* NMI Control */
-#define	IO_DMAPG	0x080		/* DMA Page Registers */
+#define	IO_DMAPG	0x081		/* DMA Page Registers */
 #define	IO_ICU2		0x0A0		/* 8259A Interrupt Controller #2 */
 #define	IO_DMA2		0x0C0		/* 8237A DMA Controller #2 */
 #define	IO_NPX		0x0F0		/* Numeric Coprocessor */



CVS commit: src/sys/dev/isa

2018-04-25 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed Apr 25 08:29:45 UTC 2018

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

Log Message:
Use spin mutex to fix a panic

The GPIO part of wbsio(4) has a lock to keep the register access
order. In addition to the lock, gpio(4) has a look to prevent
multiple control through gpio_pin_ctl(). Those locks hold at
once when gpio_pin_ctl() is called, and the lock of gpio(4) hold
before that of wbsio(4).

Therefore, the wbsio(4) has to use spin lock if gpio(4) uses
spin lock.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/isa/wbsio.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/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.23 src/sys/dev/isa/wbsio.c:1.24
--- src/sys/dev/isa/wbsio.c:1.23	Wed Mar  7 09:25:56 2018
+++ src/sys/dev/isa/wbsio.c	Wed Apr 25 08:29:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.23 2018/03/07 09:25:56 msaitoh Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.24 2018/04/25 08:29:45 yamaguchi Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis 
@@ -547,7 +547,7 @@ wbsio_gpio_rt_init(struct wbsio_softc *s
 	aprint_normal_dev(sc->sc_dev, "GPIO: port 0x%x-0x%x\n",
 	iobase, iobase + WBSIO_GPIO_IOSIZE);
 
-	mutex_init(>sc_gpio_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(>sc_gpio_lock, MUTEX_DEFAULT, IPL_VM);
 
 	return 0;
 }



CVS commit: src/sys/dev/isa

2018-04-21 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Apr 21 15:10:28 UTC 2018

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

Log Message:
Fix an ancient typo, instead of setting the base address, the size
value is written leaving the autoconf setting (-1) as the address.
The value is only used for printing an attach message, the actual
pcdisplay_init code uses hard coded base addresses again.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/isa/pcdisplay.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/pcdisplay.c
diff -u src/sys/dev/isa/pcdisplay.c:1.42 src/sys/dev/isa/pcdisplay.c:1.43
--- src/sys/dev/isa/pcdisplay.c:1.42	Thu Jul 14 04:19:27 2016
+++ src/sys/dev/isa/pcdisplay.c	Sat Apr 21 15:10:28 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: pcdisplay.c,v 1.42 2016/07/14 04:19:27 msaitoh Exp $ */
+/* $NetBSD: pcdisplay.c,v 1.43 2018/04/21 15:10:28 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1998
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcdisplay.c,v 1.42 2016/07/14 04:19:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcdisplay.c,v 1.43 2018/04/21 15:10:28 mlelstv Exp $");
 
 #include 
 #include 
@@ -269,7 +269,7 @@ pcdisplay_match(device_t parent, cfdata_
 	ia->ia_io[0].ir_size = 0x10;
 
 	ia->ia_niomem = 1;
-	ia->ia_iomem[0].ir_size = mono ? 0xb : 0xb8000;
+	ia->ia_iomem[0].ir_addr = mono ? 0xb : 0xb8000;
 	ia->ia_iomem[0].ir_size = 0x8000;
 
 	ia->ia_nirq = 0;



CVS commit: src/sys/dev/isa

2018-03-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Mar 24 18:34:43 UTC 2018

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

Log Message:
use isa_intr_establish_xname()


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/isa/lpt_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/lpt_isa.c
diff -u src/sys/dev/isa/lpt_isa.c:1.68 src/sys/dev/isa/lpt_isa.c:1.69
--- src/sys/dev/isa/lpt_isa.c:1.68	Mon Nov 23 02:13:47 2009
+++ src/sys/dev/isa/lpt_isa.c	Sat Mar 24 18:34:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: lpt_isa.c,v 1.68 2009/11/23 02:13:47 rmind Exp $	*/
+/*	$NetBSD: lpt_isa.c,v 1.69 2018/03/24 18:34:43 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994 Charles M. Hannum.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lpt_isa.c,v 1.68 2009/11/23 02:13:47 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lpt_isa.c,v 1.69 2018/03/24 18:34:43 jdolecek Exp $");
 
 #include 
 #include 
@@ -247,8 +247,8 @@ lpt_isa_attach(device_t parent, device_t
 
 	sc->sc_ic = ia->ia_ic;
 	if (sc->sc_irq != -1)
-		lsc->sc_ih = isa_intr_establish(sc->sc_ic, sc->sc_irq,
-		IST_EDGE, IPL_TTY, lptintr, lsc);
+		lsc->sc_ih = isa_intr_establish_xname(sc->sc_ic, sc->sc_irq,
+		IST_EDGE, IPL_TTY, lptintr, lsc, device_xname(lsc->sc_dev));
 }
 
 static int



CVS commit: src/sys/dev/isa

2018-02-19 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Feb 20 01:53:39 UTC 2018

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

Log Message:
Handle watchdog attachment in the wbsio_rescan() function, where we
take care of other children.

ok knakahara@ and yamaguchi@


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/isa/wbsio.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/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.21 src/sys/dev/isa/wbsio.c:1.22
--- src/sys/dev/isa/wbsio.c:1.21	Tue Jan  2 00:47:14 2018
+++ src/sys/dev/isa/wbsio.c	Tue Feb 20 01:53:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.21 2018/01/02 00:47:14 pgoyette Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.22 2018/02/20 01:53:39 pgoyette Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis 
@@ -284,8 +284,7 @@ wbsio_attach(device_t parent, device_t s
 	if (!pmf_device_register(self, wbsio_suspend, NULL))
 		aprint_error_dev(self, "couldn't establish power handler\n");
 
-	wbsio_wdog_attach(self);
-
+	sc->sc_smw_valid = false;
 	wbsio_rescan(self, "wbsio", NULL);
 
 #if NGPIO > 0
@@ -336,6 +335,8 @@ wbsio_rescan(device_t self, const char *
 #endif
 	config_search_loc(wbsio_search, self, ifattr, locators, NULL);
 
+	wbsio_wdog_attach(self);
+
 	return 0;
 }
 
@@ -799,7 +800,8 @@ wbsio_wdog_attach(device_t self)
 	uint16_t devid;
 	uint8_t rev;
 
-	sc->sc_smw_valid = false;
+	if (sc->sc_smw_valid)
+		return;		/* watchdog already attached */
 
 	wbsio_conf_enable(>sc_conf_lock, sc->sc_iot, sc->sc_ioh);
 	devid = wbsio_conf_read(sc->sc_iot, sc->sc_ioh, WBSIO_ID);



CVS commit: src/sys/dev/isa

2018-01-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 20 18:18:02 UTC 2018

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

Log Message:
Handle yet another atari specific quirk in the MI ISA fdc(4)/fd(4) driver.

This makes fd(4) drive(s) (which is necessary for installation)
properly attached on Milan.

atari uses "fdcisa" and "fdisa" for ISA fdc to co-exist other fd(4)
drivers, on-board (atari/dev/fd.c) one and Hades (atari/dev/hdfd.c) one.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/isa/fd.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/fd.c
diff -u src/sys/dev/isa/fd.c:1.110 src/sys/dev/isa/fd.c:1.111
--- src/sys/dev/isa/fd.c:1.110	Tue Dec  8 20:36:15 2015
+++ src/sys/dev/isa/fd.c	Sat Jan 20 18:18:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.110 2015/12/08 20:36:15 christos Exp $	*/
+/*	$NetBSD: fd.c,v 1.111 2018/01/20 18:18:02 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003, 2008 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.110 2015/12/08 20:36:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.111 2018/01/20 18:18:02 tsutsui Exp $");
 
 #include "opt_ddb.h"
 
@@ -460,14 +460,16 @@ fdcfinishattach(device_t self)
 			 * Atari has a different ordening, defaults to 1.44
 			 */
 			fa.fa_deftype = _types[2];
+			 /* Atari also configures ISA fdc(4) as "fdcisa" */
+			(void)config_found_ia(fdc->sc_dev, "fdcisa", (void *), fdprint);
 #else
 			/*
 			 * Default to 1.44MB on Alpha and BeBox.  How do we tell
 			 * on these platforms?
 			 */
 			fa.fa_deftype = _types[0];
-#endif
 			(void)config_found_ia(fdc->sc_dev, "fdc", (void *), fdprint);
+#endif
 		}
 	}
 	fdc->sc_state = DEVIDLE;



CVS commit: src/sys/dev/isa

2018-01-01 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan  2 00:47:15 UTC 2018

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

Log Message:
Now that watchdog support has been added, make sure that a modular driver
requires the sysmon_wdog module.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/isa/wbsio.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/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.20 src/sys/dev/isa/wbsio.c:1.21
--- src/sys/dev/isa/wbsio.c:1.20	Wed Dec 13 00:31:46 2017
+++ src/sys/dev/isa/wbsio.c	Tue Jan  2 00:47:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.20 2017/12/13 00:31:46 knakahara Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.21 2018/01/02 00:47:14 pgoyette Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis 
@@ -937,7 +937,7 @@ wbsio_wdog_tickle(struct sysmon_wdog *sm
 }
 
 
-MODULE(MODULE_CLASS_DRIVER, wbsio, NULL);
+MODULE(MODULE_CLASS_DRIVER, wbsio, "sysmon_wdog");
 
 #ifdef _MODULE
 #include "ioconf.c"



CVS commit: src/sys/dev/isa

2018-01-01 Thread Christos Zoulas
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.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/dev/isa/files.isa

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/files.isa
diff -u src/sys/dev/isa/files.isa:1.168 src/sys/dev/isa/files.isa:1.169
--- src/sys/dev/isa/files.isa:1.168	Tue Dec 12 19:26:06 2017
+++ src/sys/dev/isa/files.isa	Mon Jan  1 19:25:35 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.isa,v 1.168 2017/12/13 00:26:06 knakahara Exp $
+#	$NetBSD: files.isa,v 1.169 2018/01/02 00:25:35 christos Exp $
 #
 # Config file and device description for machine-independent ISA code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -454,7 +454,7 @@ attach	smsc at isa with smsc
 file	dev/isa/smsc.c			smsc			needs-flag
 
 # Winbond LPC Super I/O
-device	wbsio { }: gpiobus
+device	wbsio { }: gpiobus, sysmon_wdog
 attach	wbsio at isa
 file	dev/isa/wbsio.c			wbsio
 



CVS commit: src/sys/dev/isa

2017-12-12 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Dec 13 00:31:46 UTC 2017

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

Log Message:
Improve the error log message to use product name. Implemeted by 
s-yamaguchi@IIJ, reviewed by msaitoh@n.o.

I just commit by proxy.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/isa/wbsio.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/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.19 src/sys/dev/isa/wbsio.c:1.20
--- src/sys/dev/isa/wbsio.c:1.19	Wed Dec 13 00:29:02 2017
+++ src/sys/dev/isa/wbsio.c	Wed Dec 13 00:31:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.19 2017/12/13 00:29:02 knakahara Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.20 2017/12/13 00:31:46 knakahara Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis 
@@ -470,7 +470,8 @@ wbsio_gpio_search(device_t parent, cfdat
 		sc->sc_gpio_rt = true;
 		break;
 	default:
-		aprint_error_dev(parent, "GPIO is not supported\n");
+		aprint_error_dev(parent, "%s's GPIO is not supported yet\n",
+		product->str);
 		return -1;
 	}
 



CVS commit: src/sys/dev/isa

2017-12-12 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Dec 13 00:29:02 UTC 2017

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

Log Message:
Add an option to enable GPIO function of wbsio. Implemeted by s-yamaguchi@IIJ, 
reviewed by msaitoh@n.o.

I just commit by proxy.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/isa/wbsio.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/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.18 src/sys/dev/isa/wbsio.c:1.19
--- src/sys/dev/isa/wbsio.c:1.18	Wed Dec 13 00:27:53 2017
+++ src/sys/dev/isa/wbsio.c	Wed Dec 13 00:29:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.18 2017/12/13 00:27:53 knakahara Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.19 2017/12/13 00:29:02 knakahara Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis 
@@ -37,9 +37,10 @@
 #include 
 
 /* Don't use gpio for now in the module */
-#ifndef _MODULE
+#if !defined(_MODULE) && defined(WBSIO_GPIO)
 #include "gpio.h"
 #endif
+
 #if NGPIO > 0
 #include 
 #endif



CVS commit: src/sys/dev/isa

2017-12-12 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Dec 13 00:27:53 UTC 2017

Modified Files:
src/sys/dev/isa: wbsio.c wbsioreg.h

Log Message:
Add Watchdog timer implementation to wbsio(4). Implemeted by s-yamaguchi@IIJ, 
reviewed by msaitoh@n.o.

I just commit by proxy.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/isa/wbsio.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/isa/wbsioreg.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/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.17 src/sys/dev/isa/wbsio.c:1.18
--- src/sys/dev/isa/wbsio.c:1.17	Wed Dec 13 00:27:01 2017
+++ src/sys/dev/isa/wbsio.c	Wed Dec 13 00:27:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.17 2017/12/13 00:27:01 knakahara Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.18 2017/12/13 00:27:53 knakahara Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis 
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Don't use gpio for now in the module */
 #ifndef _MODULE
@@ -52,6 +53,7 @@ struct wbsio_softc {
 
 	bus_space_tag_t		sc_iot;
 	bus_space_handle_t	sc_ioh;
+	kmutex_t		sc_conf_lock;
 
 	struct isa_attach_args	sc_ia;
 	struct isa_io		sc_io;
@@ -63,6 +65,9 @@ struct wbsio_softc {
 	struct gpio_pin		sc_gpio_pins[WBSIO_GPIO_NPINS];
 	bool			sc_gpio_rt;
 #endif
+
+	struct sysmon_wdog	sc_smw;
+	bool			sc_smw_valid;
 };
 
 static const struct wbsio_product {
@@ -101,6 +106,7 @@ static int	wbsio_rescan(device_t, const 
 static void	wbsio_childdet(device_t, device_t);
 static int	wbsio_print(void *, const char *);
 static int	wbsio_search(device_t, cfdata_t, const int *, void *);
+static bool	wbsio_suspend(device_t, const pmf_qual_t *);
 #if NGPIO > 0
 static int	wbsio_gpio_search(device_t, cfdata_t, const int *, void *);
 static int	wbsio_gpio_rt_init(struct wbsio_softc *);
@@ -112,22 +118,35 @@ static void	wbsio_gpio_rt_pin_ctl(void *
 static void	wbsio_gpio_enable_nct6779d(device_t);
 static void	wbsio_gpio_pinconfig_nct6779d(device_t);
 #endif
+static void	wbsio_wdog_attach(device_t);
+static int	wbsio_wdog_detach(device_t);
+static int	wbsio_wdog_setmode(struct sysmon_wdog *);
+static int	wbsio_wdog_tickle(struct sysmon_wdog *);
+static void	wbsio_wdog_setcounter(struct wbsio_softc *, uint8_t);
+static void	wbsio_wdog_clear_timeout(struct wbsio_softc *);
 
 CFATTACH_DECL2_NEW(wbsio, sizeof(struct wbsio_softc),
 wbsio_match, wbsio_attach, wbsio_detach, NULL,
 wbsio_rescan, wbsio_childdet);
 
 static __inline void
-wbsio_conf_enable(bus_space_tag_t iot, bus_space_handle_t ioh)
+wbsio_conf_enable(kmutex_t *lock, bus_space_tag_t iot, bus_space_handle_t ioh)
 {
+	if (lock)
+		mutex_enter(lock);
+
 	bus_space_write_1(iot, ioh, WBSIO_INDEX, WBSIO_CONF_EN_MAGIC);
 	bus_space_write_1(iot, ioh, WBSIO_INDEX, WBSIO_CONF_EN_MAGIC);
 }
 
 static __inline void
-wbsio_conf_disable(bus_space_tag_t iot, bus_space_handle_t ioh)
+wbsio_conf_disable(kmutex_t *lock, bus_space_tag_t iot, bus_space_handle_t ioh)
 {
+
 	bus_space_write_1(iot, ioh, WBSIO_INDEX, WBSIO_CONF_DS_MAGIC);
+
+	if (lock)
+		mutex_exit(lock);
 }
 
 static __inline uint8_t
@@ -188,11 +207,11 @@ wbsio_match(device_t parent, cfdata_t ma
 	iot = ia->ia_iot;
 	if (bus_space_map(iot, ia->ia_io[0].ir_addr, WBSIO_IOSIZE, 0, ))
 		return 0;
-	wbsio_conf_enable(iot, ioh);
+	wbsio_conf_enable(NULL, iot, ioh);
 	id = wbsio_conf_read(iot, ioh, WBSIO_ID);
 	rev = wbsio_conf_read(iot, ioh, WBSIO_REV);
 	aprint_debug("wbsio_probe: id 0x%02x, rev 0x%02x\n", id, rev);
-	wbsio_conf_disable(iot, ioh);
+	wbsio_conf_disable(NULL, iot, ioh);
 	bus_space_unmap(iot, ioh, WBSIO_IOSIZE);
 
 	if ((product = wbsio_lookup(id, rev)) == NULL)
@@ -228,8 +247,10 @@ wbsio_attach(device_t parent, device_t s
 		return;
 	}
 
+	mutex_init(>sc_conf_lock, MUTEX_DEFAULT, IPL_NONE);
+
 	/* Enter configuration mode */
-	wbsio_conf_enable(sc->sc_iot, sc->sc_ioh);
+	wbsio_conf_enable(>sc_conf_lock, sc->sc_iot, sc->sc_ioh);
 
 	/* Read device ID */
 	id = wbsio_conf_read(sc->sc_iot, sc->sc_ioh, WBSIO_ID);
@@ -237,7 +258,7 @@ wbsio_attach(device_t parent, device_t s
 	rev = wbsio_conf_read(sc->sc_iot, sc->sc_ioh, WBSIO_REV);
 
 	/* Escape from configuration mode */
-	wbsio_conf_disable(sc->sc_iot, sc->sc_ioh);
+	wbsio_conf_disable(>sc_conf_lock, sc->sc_iot, sc->sc_ioh);
 
 	if ((product = wbsio_lookup(id, rev)) == NULL) {
 		aprint_error_dev(self, "Unknown device. Failed to attach\n");
@@ -259,8 +280,11 @@ wbsio_attach(device_t parent, device_t s
 	} else
 		aprint_normal("0x%02x\n", rev);
 
-	if (!pmf_device_register(self, NULL, NULL))
+	if (!pmf_device_register(self, wbsio_suspend, NULL))
 		aprint_error_dev(self, "couldn't establish power handler\n");
+
+	wbsio_wdog_attach(self);
+
 	wbsio_rescan(self, "wbsio", NULL);
 
 #if NGPIO > 0
@@ -275,6 +299,9 @@ wbsio_detach(device_t self, int flags)
 	struct 

CVS commit: src/sys/dev/isa

2017-12-12 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Dec 13 00:27:01 UTC 2017

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

Log Message:
Fix NCT6779 gpio pin configuration. Implemeted by s-yamaguchi@IIJ, reviewed by 
msaitoh@n.o.

I just commit by proxy.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/isa/wbsio.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/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.16 src/sys/dev/isa/wbsio.c:1.17
--- src/sys/dev/isa/wbsio.c:1.16	Wed Dec 13 00:26:06 2017
+++ src/sys/dev/isa/wbsio.c	Wed Dec 13 00:27:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.16 2017/12/13 00:26:06 knakahara Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.17 2017/12/13 00:27:01 knakahara Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis 
@@ -668,7 +668,7 @@ wbsio_gpio_pinconfig_nct6779d(device_t p
 	mfs2 |= WBSIO_NCT6779D_MFS2_GP04;
 	mfs2 |= WBSIO_NCT6779D_MFS2_GP05;
 	mfs2 |= WBSIO_NCT6779D_MFS2_GP06;
-	mfs3 |= WBSIO_NCT6779D_MFS3_GP07_MASK;
+	mfs3 &= ~WBSIO_NCT6779D_MFS3_GP07_MASK;
 
 	/* GPIO1 pin configs */
 	mfs4 |= WBSIO_NCT6779D_MFS4_GP10_GP17;
@@ -703,7 +703,7 @@ wbsio_gpio_pinconfig_nct6779d(device_t p
 	mfs1 |= WBSIO_NCT6779D_MFS1_GP42;
 	mfs1 |= WBSIO_NCT6779D_MFS1_GP42;
 	gopt2 |= WBSIO_NCT6779D_GOPT2_GP43;
-	mfs1 |= WBSIO_NCT6779D_MFS1_GP44_GP45_MASK;
+	mfs1 &= ~WBSIO_NCT6779D_MFS1_GP44_GP45_MASK;
 	gopt2 &= ~WBSIO_NCT6779D_GOPT2_GP46_MASK;
 	mfs1 |= WBSIO_NCT6779D_MFS1_GP47;
 



CVS commit: src/sys/dev/isa

2017-12-12 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Dec 13 00:26:06 UTC 2017

Modified Files:
src/sys/dev/isa: files.isa wbsio.c wbsioreg.h

Log Message:
Add wbsio(4) GPIO driver. Implemeted by s-yamaguchi@IIJ, reviewed by 
msaitoh@n.o.

I just commit by proxy.


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/dev/isa/files.isa
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/isa/wbsio.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/isa/wbsioreg.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/files.isa
diff -u src/sys/dev/isa/files.isa:1.167 src/sys/dev/isa/files.isa:1.168
--- src/sys/dev/isa/files.isa:1.167	Fri Dec  9 04:32:39 2016
+++ src/sys/dev/isa/files.isa	Wed Dec 13 00:26:06 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.isa,v 1.167 2016/12/09 04:32:39 christos Exp $
+#	$NetBSD: files.isa,v 1.168 2017/12/13 00:26:06 knakahara Exp $
 #
 # Config file and device description for machine-independent ISA code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -454,7 +454,7 @@ attach	smsc at isa with smsc
 file	dev/isa/smsc.c			smsc			needs-flag
 
 # Winbond LPC Super I/O
-device	wbsio {}
+device	wbsio { }: gpiobus
 attach	wbsio at isa
 file	dev/isa/wbsio.c			wbsio
 

Index: src/sys/dev/isa/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.15 src/sys/dev/isa/wbsio.c:1.16
--- src/sys/dev/isa/wbsio.c:1.15	Fri Aug 18 04:07:51 2017
+++ src/sys/dev/isa/wbsio.c	Wed Dec 13 00:26:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.15 2017/08/18 04:07:51 msaitoh Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.16 2017/12/13 00:26:06 knakahara Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis 
@@ -20,11 +20,14 @@
  * Winbond LPC Super I/O driver.
  */
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -32,15 +35,34 @@
 #include 
 #include 
 
+/* Don't use gpio for now in the module */
+#ifndef _MODULE
+#include "gpio.h"
+#endif
+#if NGPIO > 0
+#include 
+#endif
+
 struct wbsio_softc {
 	device_t	sc_dev;
 	device_t	sc_lm_dev;
+#if NGPIO > 0
+	device_t	sc_gpio_dev;
+#endif
 
 	bus_space_tag_t		sc_iot;
 	bus_space_handle_t	sc_ioh;
 
 	struct isa_attach_args	sc_ia;
 	struct isa_io		sc_io;
+
+#if NGPIO > 0
+	bus_space_handle_t	sc_gpio_ioh;
+	kmutex_t		sc_gpio_lock;
+	struct gpio_chipset_tag	sc_gpio_gc;
+	struct gpio_pin		sc_gpio_pins[WBSIO_GPIO_NPINS];
+	bool			sc_gpio_rt;
+#endif
 };
 
 static const struct wbsio_product {
@@ -79,6 +101,17 @@ static int	wbsio_rescan(device_t, const 
 static void	wbsio_childdet(device_t, device_t);
 static int	wbsio_print(void *, const char *);
 static int	wbsio_search(device_t, cfdata_t, const int *, void *);
+#if NGPIO > 0
+static int	wbsio_gpio_search(device_t, cfdata_t, const int *, void *);
+static int	wbsio_gpio_rt_init(struct wbsio_softc *);
+static int	wbsio_gpio_rt_read(struct wbsio_softc *, int, int);
+static void	wbsio_gpio_rt_write(struct wbsio_softc *, int, int, int);
+static int	wbsio_gpio_rt_pin_read(void *, int);
+static void	wbsio_gpio_rt_pin_write(void *, int, int);
+static void	wbsio_gpio_rt_pin_ctl(void *, int, int);
+static void	wbsio_gpio_enable_nct6779d(device_t);
+static void	wbsio_gpio_pinconfig_nct6779d(device_t);
+#endif
 
 CFATTACH_DECL2_NEW(wbsio, sizeof(struct wbsio_softc),
 wbsio_match, wbsio_attach, wbsio_detach, NULL,
@@ -229,6 +262,11 @@ wbsio_attach(device_t parent, device_t s
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, "couldn't establish power handler\n");
 	wbsio_rescan(self, "wbsio", NULL);
+
+#if NGPIO > 0
+
+	wbsio_rescan(self, "gpiobus", NULL);
+#endif
 }
 
 int
@@ -241,6 +279,17 @@ wbsio_detach(device_t self, int flags)
 		return rc;
 	bus_space_unmap(sc->sc_iot, sc->sc_ioh, WBSIO_IOSIZE);
 	pmf_device_deregister(self);
+
+#if NGPIO > 0
+	if (sc->sc_gpio_dev) {
+		bus_space_unmap(sc->sc_iot, sc->sc_gpio_ioh,
+		WBSIO_GPIO_IOSIZE);
+	}
+
+	if (sc->sc_gpio_rt) {
+		mutex_destroy(>sc_gpio_lock);
+	}
+#endif
 	return 0;
 }
 
@@ -248,6 +297,13 @@ int
 wbsio_rescan(device_t self, const char *ifattr, const int *locators)
 {
 
+#if NGPIO > 0
+	if (ifattr_match(ifattr, "gpiobus")) {
+		config_search_loc(wbsio_gpio_search, self,
+		ifattr, locators, NULL);
+		return 0;
+	}
+#endif
 	config_search_loc(wbsio_search, self, ifattr, locators, NULL);
 
 	return 0;
@@ -338,6 +394,357 @@ wbsio_print(void *aux, const char *pnp)
 	return (UNCONF);
 }
 
+#if NGPIO > 0
+static int
+wbsio_gpio_search(device_t parent, cfdata_t cf, const int *slocs, void *aux)
+{
+	struct wbsio_softc *sc = device_private(parent);
+	const struct wbsio_product *product;
+	struct gpiobus_attach_args gba;
+	uint16_t devid;
+	uint8_t rev;
+	int i;
+
+	/* Enter configuration mode */
+	wbsio_conf_enable(sc->sc_iot, sc->sc_ioh);
+	/* Read device ID and revision */
+	devid = 

CVS commit: src/sys/dev/isa

2017-11-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 15 10:13:11 UTC 2017

Modified Files:
src/sys/dev/isa: wbsioreg.h

Log Message:
 s/Id/NetBSD/. Pointed out by wiz!


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/isa/wbsioreg.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/wbsioreg.h
diff -u src/sys/dev/isa/wbsioreg.h:1.4 src/sys/dev/isa/wbsioreg.h:1.5
--- src/sys/dev/isa/wbsioreg.h:1.4	Wed Nov 15 09:13:26 2017
+++ src/sys/dev/isa/wbsioreg.h	Wed Nov 15 10:13:11 2017
@@ -1,4 +1,4 @@
-/* $Id: wbsioreg.h,v 1.4 2017/11/15 09:13:26 msaitoh Exp $ */
+/* $NetBSD: wbsioreg.h,v 1.5 2017/11/15 10:13:11 msaitoh Exp $ */
 
 /* $OpenBSD: wbsioreg.h,v 1.4 2015/01/02 23:02:54 chris Exp $ */
 /*



CVS commit: src/sys/dev/isa

2017-11-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 15 09:13:26 UTC 2017

Modified Files:
src/sys/dev/isa: wbsioreg.h

Log Message:
 Restore NetBSD RCS Id which was accidentally removed in rev. 1.2.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/isa/wbsioreg.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/wbsioreg.h
diff -u src/sys/dev/isa/wbsioreg.h:1.3 src/sys/dev/isa/wbsioreg.h:1.4
--- src/sys/dev/isa/wbsioreg.h:1.3	Fri Aug 18 04:07:51 2017
+++ src/sys/dev/isa/wbsioreg.h	Wed Nov 15 09:13:26 2017
@@ -1,3 +1,5 @@
+/* $Id: wbsioreg.h,v 1.4 2017/11/15 09:13:26 msaitoh Exp $ */
+
 /* $OpenBSD: wbsioreg.h,v 1.4 2015/01/02 23:02:54 chris Exp $ */
 /*
  * Copyright (c) 2008 Mark Kettenis 



CVS commit: src/sys/dev/isa

2017-11-03 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Nov  4 01:46:56 UTC 2017

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

Log Message:
Add AUDIO_ENCODING_SLINEAR to supported encodings.  This allows sb, sbpro
& sb16 to configure with 8-bit precision.

Tested in games/mame with a 486DX emulation.


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

Modified files:

Index: src/sys/dev/isa/sbdsp.c
diff -u src/sys/dev/isa/sbdsp.c:1.136 src/sys/dev/isa/sbdsp.c:1.137
--- src/sys/dev/isa/sbdsp.c:1.136	Mon Jul 11 11:31:50 2016
+++ src/sys/dev/isa/sbdsp.c	Sat Nov  4 01:46:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbdsp.c,v 1.136 2016/07/11 11:31:50 msaitoh Exp $	*/
+/*	$NetBSD: sbdsp.c,v 1.137 2017/11/04 01:46:56 nat Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.136 2016/07/11 11:31:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.137 2017/11/04 01:46:56 nat Exp $");
 
 #include "midi.h"
 #include "mpu.h"
@@ -640,6 +640,7 @@ sbdsp_set_params(
 	swcode = swap_bytes;
 }
 /* fall into */
+			case AUDIO_ENCODING_SLINEAR:
 			case AUDIO_ENCODING_SLINEAR_LE:
 bmode = SB_BMODE_SIGNED;
 break;
@@ -682,6 +683,7 @@ sbdsp_set_params(
 bmode |= SB_BMODE_STEREO;
 		} else if (m->model == SB_JAZZ && m->precision == 16) {
 			switch (p->encoding) {
+			case AUDIO_ENCODING_SLINEAR:
 			case AUDIO_ENCODING_SLINEAR_LE:
 break;
 			case AUDIO_ENCODING_ULINEAR_LE:
@@ -716,6 +718,7 @@ sbdsp_set_params(
 			switch (p->encoding) {
 			case AUDIO_ENCODING_SLINEAR_BE:
 			case AUDIO_ENCODING_SLINEAR_LE:
+			case AUDIO_ENCODING_SLINEAR:
 hw.encoding = AUDIO_ENCODING_ULINEAR_LE;
 swcode = change_sign8;
 break;



CVS commit: src/sys/dev/isa

2017-10-31 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Oct 31 21:53:48 UTC 2017

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

Log Message:
Add padding to gus.c so fields match up when it ts cast to a ad1848_isa
softc for the allocation of hw ring buffers.

Locking fixes as gus KASSERTS / uses the codec locks.

Ok christos@.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/isa/gus.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/gus.c
diff -u src/sys/dev/isa/gus.c:1.111 src/sys/dev/isa/gus.c:1.112
--- src/sys/dev/isa/gus.c:1.111	Wed Feb  1 19:10:33 2017
+++ src/sys/dev/isa/gus.c	Tue Oct 31 21:53:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gus.c,v 1.111 2017/02/01 19:10:33 jakllsch Exp $	*/
+/*	$NetBSD: gus.c,v 1.112 2017/10/31 21:53:48 nat Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1999, 2008 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.111 2017/02/01 19:10:33 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.112 2017/10/31 21:53:48 nat Exp $");
 
 #include 
 #include 
@@ -175,15 +175,16 @@ struct gus_softc {
 	kmutex_t sc_intr_lock;
 	void *sc_ih;			/* interrupt vector */
 	bus_space_tag_t sc_iot;		/* tag */
-	isa_chipset_tag_t sc_ic;	/* ISA chipset info */
 	bus_space_handle_t sc_ioh1;	/* handle */
 	bus_space_handle_t sc_ioh2;	/* handle */
 	bus_space_handle_t sc_ioh3;	/* ICS2101 handle */
 	bus_space_handle_t sc_ioh4;	/* MIDI handle */
+	char padding[20];
 
 	callout_t sc_dmaout_ch;
 
-	int sc_iobase;			/* I/O base address */
+	isa_chipset_tag_t sc_ic;	/* ISA chipset info */
+	char padding1[4];
 	int sc_irq;			/* IRQ used */
 	int sc_playdrq;			/* DMA channel for play */
 	bus_size_t sc_play_maxsize;	/* DMA size for play */
@@ -257,6 +258,7 @@ struct gus_softc {
 		struct ics2101_softc sc_mixer_u;
 		struct ad1848_isa_softc sc_codec_u;
 	} u;
+	int sc_iobase;			/* I/O base address */
 #define sc_mixer u.sc_mixer_u
 #define sc_codec u.sc_codec_u
 };
@@ -818,9 +820,12 @@ gusattach(device_t parent, device_t self
 	const struct audio_hw_if *hwif;
 
 	sc = device_private(self);
+	sc->sc_dev = self;
 	ia = aux;
 	callout_init(>sc_dmaout_ch, CALLOUT_MPSAFE);
 	ad1848_init_locks(>sc_codec.sc_ad1848, IPL_AUDIO);
+	sc->sc_lock = sc->sc_codec.sc_ad1848.sc_lock;
+	sc->sc_intr_lock = sc->sc_codec.sc_ad1848.sc_intr_lock;
 
 	sc->sc_iot = iot = ia->ia_iot;
 	sc->sc_ic = ia->ia_ic;
@@ -859,7 +864,7 @@ gusattach(device_t parent, device_t self
 
 	delay(500);
 
-	mutex_spin_enter(>sc_intr_lock);
+	mutex_spin_enter(>sc_codec.sc_ad1848.sc_intr_lock);
 
 	c = bus_space_read_1(iot, ioh3, GUS_BOARD_REV);
 	if (c != 0xff)
@@ -872,7 +877,7 @@ gusattach(device_t parent, device_t self
 
 	gusreset(sc, GUS_MAX_VOICES); /* initialize all voices */
 	gusreset(sc, GUS_MIN_VOICES); /* then set to just the ones we use */
-	mutex_spin_exit(>sc_intr_lock);
+	mutex_spin_exit(>sc_codec.sc_ad1848.sc_intr_lock);
 
 	/*
 	 * Setup the IRQ and DRQ lines in software, using values from
@@ -2311,7 +2316,7 @@ gus_set_params(void *addr,int setmode, i
 		return EINVAL;
 	}
 
-	mutex_spin_enter(>sc_intr_lock);
+	mutex_spin_enter(>sc_codec.sc_ad1848.sc_intr_lock);
 
 	if (p->precision == 8) {
 		sc->sc_voc[GUS_VOICE_LEFT].voccntl &= ~GUSMASK_DATA_SIZE16;
@@ -2332,7 +2337,7 @@ gus_set_params(void *addr,int setmode, i
 	if (setmode & AUMODE_PLAY)
 		sc->sc_orate = p->sample_rate;
 
-	mutex_spin_exit(>sc_intr_lock);
+	mutex_spin_exit(>sc_codec.sc_ad1848.sc_intr_lock);
 
 	hw = *p;
 	/* clear req_size before setting a filter to avoid confliction



CVS commit: src/sys/dev/isa

2017-09-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Sep 12 09:54:45 UTC 2017

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

Log Message:
 Add IT8728F and IT877[12]E.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/isa/itesio_isa.c
cvs rdiff -u -r1.10 -r1.11 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.26 src/sys/dev/isa/itesio_isa.c:1.27
--- src/sys/dev/isa/itesio_isa.c:1.26	Mon Aug 14 11:49:30 2017
+++ src/sys/dev/isa/itesio_isa.c	Tue Sep 12 09:54:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: itesio_isa.c,v 1.26 2017/08/14 11:49:30 hauke Exp $ */
+/*	$NetBSD: itesio_isa.c,v 1.27 2017/09/12 09:54:45 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.26 2017/08/14 11:49:30 hauke Exp $");
+__KERNEL_RCSID(0, "$NetBSD: itesio_isa.c,v 1.27 2017/09/12 09:54:45 msaitoh Exp $");
 
 #include 
 #include 
@@ -144,6 +144,9 @@ itesio_isa_match(device_t parent, cfdata
 	case ITESIO_ID8720:
 	case ITESIO_ID8721:
 	case ITESIO_ID8726:
+	case ITESIO_ID8728:
+	case ITESIO_ID8771:
+	case ITESIO_ID8772:
 		ia->ia_nio = 1;
 		ia->ia_io[0].ir_size = 2;
 		ia->ia_niomem = 0;

Index: src/sys/dev/isa/itesio_isavar.h
diff -u src/sys/dev/isa/itesio_isavar.h:1.10 src/sys/dev/isa/itesio_isavar.h:1.11
--- src/sys/dev/isa/itesio_isavar.h:1.10	Mon Aug 14 11:49:30 2017
+++ src/sys/dev/isa/itesio_isavar.h	Tue Sep 12 09:54:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: itesio_isavar.h,v 1.10 2017/08/14 11:49:30 hauke Exp $	*/
+/*	$NetBSD: itesio_isavar.h,v 1.11 2017/09/12 09:54:45 msaitoh Exp $	*/
 /*	$OpenBSD: itvar.h,v 1.2 2003/11/05 20:57:10 grange Exp $	*/
 
 /*
@@ -65,6 +65,9 @@
 #define ITESIO_ID8720	0x8720
 #define ITESIO_ID8721	0x8721
 #define ITESIO_ID8726	0x8726
+#define ITESIO_ID8728	0x8728
+#define ITESIO_ID8771	0x8771
+#define ITESIO_ID8772	0x8772
 
 /* 
  * Control registers for the Environmental Controller, relative



CVS commit: src/sys/dev/isa

2017-08-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Aug 17 05:32:05 UTC 2017

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

Log Message:
 Print chip name correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/isa/wbsio.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/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.13 src/sys/dev/isa/wbsio.c:1.14
--- src/sys/dev/isa/wbsio.c:1.13	Wed Aug  9 04:45:38 2017
+++ src/sys/dev/isa/wbsio.c	Thu Aug 17 05:32:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.13 2017/08/09 04:45:38 msaitoh Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.14 2017/08/17 05:32:04 msaitoh Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis 
@@ -175,7 +175,7 @@ wbsio_attach(device_t parent, device_t s
 		desc = "W83627DHG";
 		break;
 	case WBSIO_ID_W83627DHGP:
-		printf("W83627DHG-P");
+		desc = "W83627DHG-P";
 		break;
 	case WBSIO_ID_W83627EHF:
 		desc = "W83627EHF";
@@ -187,7 +187,7 @@ wbsio_attach(device_t parent, device_t s
 		desc = "W83627THF";
 		break;
 	case WBSIO_ID_W83627UHG:
-		printf("W83627UHG");
+		desc = "W83627UHG";
 		break;
 	case WBSIO_ID_W83637HF:
 		desc = "W83637HF";
@@ -209,7 +209,7 @@ wbsio_attach(device_t parent, device_t s
 		break;
 	case WBSIO_ID_NCT5104D:
 		vendor = "Nuvoton";
-		printf("NCT5104D");
+		desc = "NCT5104D";
 		break;
 	case WBSIO_ID_NCT6775F:
 		vendor = "Nuvoton";



CVS commit: src/sys/dev/isa

2017-08-14 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Mon Aug 14 11:49:30 UTC 2017

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

Log Message:
Enable the IT8628E shipped with my gigabyte GA-N3150N-D3V board.

XXX These IT suoer IO chips appear to be all fairly alike. Maybe add a
comprehensive list of IDs to recognize them, then deal with the
fallout?


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/isa/itesio_isa.c
cvs rdiff -u -r1.9 -r1.10 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.25 src/sys/dev/isa/itesio_isa.c:1.26
--- src/sys/dev/isa/itesio_isa.c:1.25	Thu Apr 23 23:23:00 2015
+++ src/sys/dev/isa/itesio_isa.c	Mon Aug 14 11:49:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: itesio_isa.c,v 1.25 2015/04/23 23:23:00 pgoyette Exp $ */
+/*	$NetBSD: itesio_isa.c,v 1.26 2017/08/14 11:49:30 hauke 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.25 2015/04/23 23:23:00 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: itesio_isa.c,v 1.26 2017/08/14 11:49:30 hauke Exp $");
 
 #include 
 #include 
@@ -136,6 +136,7 @@ itesio_isa_match(device_t parent, cfdata
 	bus_space_unmap(ia->ia_iot, ioh, 2);
 
 	switch (cr) {
+	case ITESIO_ID8628:
 	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.9 src/sys/dev/isa/itesio_isavar.h:1.10
--- src/sys/dev/isa/itesio_isavar.h:1.9	Thu Nov 15 04:45:01 2012
+++ src/sys/dev/isa/itesio_isavar.h	Mon Aug 14 11:49:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: itesio_isavar.h,v 1.9 2012/11/15 04:45:01 msaitoh Exp $	*/
+/*	$NetBSD: itesio_isavar.h,v 1.10 2017/08/14 11:49:30 hauke Exp $	*/
 /*	$OpenBSD: itvar.h,v 1.2 2003/11/05 20:57:10 grange Exp $	*/
 
 /*
@@ -57,6 +57,7 @@
 #define ITESIO_CHIPID2	0x21	/* Chip ID 2 */
 #define ITESIO_DEVREV	0x22	/* Device Revision */
 
+#define ITESIO_ID8628	0x8628
 #define ITESIO_ID8705	0x8705
 #define ITESIO_ID8712	0x8712
 #define ITESIO_ID8716	0x8716



CVS commit: src/sys/dev/isa

2017-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jul  7 08:42:16 UTC 2017

Modified Files:
src/sys/dev/isa: wbsio.c
Added Files:
src/sys/dev/isa: wbsioreg.h

Log Message:
 Add Winbond W83627DHG-P, W83627SF, W83627UHG, W83667HGB, W83687THF, W83697UG,
Nuvoton NCT5104D, NCT6775, NCT6779, NCT6791, NCT6792 and NCT6793.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/isa/wbsio.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/isa/wbsioreg.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/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.10 src/sys/dev/isa/wbsio.c:1.11
--- src/sys/dev/isa/wbsio.c:1.10	Wed Jun  1 02:37:47 2016
+++ src/sys/dev/isa/wbsio.c	Fri Jul  7 08:42:15 2017
@@ -1,5 +1,5 @@
-/*	$NetBSD: wbsio.c,v 1.10 2016/06/01 02:37:47 pgoyette Exp $	*/
-/*	$OpenBSD: wbsio.c,v 1.5 2009/03/29 21:53:52 sthen Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.11 2017/07/07 08:42:15 msaitoh Exp $	*/
+/*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis 
  *
@@ -30,37 +30,7 @@
 
 #include 
 #include 
-
-/* ISA bus registers */
-#define WBSIO_INDEX		0x00	/* Configuration Index Register */
-#define WBSIO_DATA		0x01	/* Configuration Data Register */
-
-#define WBSIO_IOSIZE		0x02	/* ISA I/O space size */
-
-#define WBSIO_CONF_EN_MAGIC	0x87	/* enable configuration mode */
-#define WBSIO_CONF_DS_MAGIC	0xaa	/* disable configuration mode */
-
-/* Configuration Space Registers */
-#define WBSIO_LDN		0x07	/* Logical Device Number */
-#define WBSIO_ID		0x20	/* Device ID */
-#define WBSIO_REV		0x21	/* Device Revision */
-
-#define WBSIO_ID_W83627HF	0x52
-#define WBSIO_ID_W83627THF	0x82
-#define WBSIO_ID_W83627EHF	0x88
-#define WBSIO_ID_W83627DHG	0xa0
-#define WBSIO_ID_W83627SF	0x59
-#define WBSIO_ID_W83637HF	0x70
-#define WBSIO_ID_W83667HG	0xa5
-#define WBSIO_ID_W83697HF	0x60
-#define WBSIO_ID_NCT6776F	0xc3
-
-/* Logical Device Number (LDN) Assignments */
-#define WBSIO_LDN_HM		0x0b
-
-/* Hardware Monitor Control Registers (LDN B) */
-#define WBSIO_HM_ADDR_MSB	0x60	/* Address [15:8] */
-#define WBSIO_HM_ADDR_LSB	0x61	/* Address [7:0] */
+#include 
 
 struct wbsio_softc {
 	device_t	sc_dev;
@@ -143,12 +113,24 @@ wbsio_probe(device_t parent, cfdata_t ma
 	bus_space_unmap(iot, ioh, WBSIO_IOSIZE);
 	switch (reg) {
 	case WBSIO_ID_W83627HF:
-	case WBSIO_ID_W83627THF:
-	case WBSIO_ID_W83627EHF:
 	case WBSIO_ID_W83627DHG:
+	case WBSIO_ID_W83627DHGP:
+	case WBSIO_ID_W83627EHF:
+	case WBSIO_ID_W83627SF:
+	case WBSIO_ID_W83627THF:
+	case WBSIO_ID_W83627UHG:
 	case WBSIO_ID_W83637HF:
+	case WBSIO_ID_W83667HG:
+	case WBSIO_ID_W83667HGB:
+	case WBSIO_ID_W83687THF:
 	case WBSIO_ID_W83697HF:
+	case WBSIO_ID_W83697UG:
+	case WBSIO_ID_NCT5104D:
+	case WBSIO_ID_NCT6775:
 	case WBSIO_ID_NCT6776F:
+	case WBSIO_ID_NCT6779:
+	case WBSIO_ID_NCT6791:
+	case WBSIO_ID_NCT6792:
 		ia->ia_nio = 1;
 		ia->ia_io[0].ir_size = WBSIO_IOSIZE;
 		ia->ia_niomem = 0;
@@ -190,14 +172,23 @@ wbsio_attach(device_t parent, device_t s
 	case WBSIO_ID_W83627HF:
 		desc = "W83627HF";
 		break;
-	case WBSIO_ID_W83627THF:
-		desc = "W83627THF";
+	case WBSIO_ID_W83627DHG:
+		desc = "W83627DHG";
+		break;
+	case WBSIO_ID_W83627DHGP:
+		printf("W83627DHG-P");
 		break;
 	case WBSIO_ID_W83627EHF:
 		desc = "W83627EHF";
 		break;
-	case WBSIO_ID_W83627DHG:
-		desc = "W83627DHG";
+	case WBSIO_ID_W83627SF:
+		desc = "W83627SF";
+		break;
+	case WBSIO_ID_W83627THF:
+		desc = "W83627THF";
+		break;
+	case WBSIO_ID_W83627UHG:
+		printf("W83627UHG");
 		break;
 	case WBSIO_ID_W83637HF:
 		desc = "W83637HF";
@@ -205,13 +196,46 @@ wbsio_attach(device_t parent, device_t s
 	case WBSIO_ID_W83667HG:
 		desc = "W83667HG";
 		break;
+	case WBSIO_ID_W83667HGB:
+		desc = "W83667HGB";
+		break;
+	case WBSIO_ID_W83687THF:
+		desc = "W83687THF";
+		break;
 	case WBSIO_ID_W83697HF:
 		desc = "W83697HF";
 		break;
+	case WBSIO_ID_W83697UG:
+		desc = "W83697UG";
+		break;
+	case WBSIO_ID_NCT5104D:
+		vendor = "Nuvoton";
+		printf("NCT5104D");
+		break;
+	case WBSIO_ID_NCT6775:
+		vendor = "Nuvoton";
+		desc = "NCT6775";
+		break;
 	case WBSIO_ID_NCT6776F:
 		vendor = "Nuvoton";
 		desc = "NCT6776F";
 		break;
+	case WBSIO_ID_NCT6779:
+		vendor = "Nuvoton";
+		desc = "NCT6779";
+		break;
+	case WBSIO_ID_NCT6791:
+		vendor = "Nuvoton";
+		desc = "NCT6791";
+		break;
+	case WBSIO_ID_NCT6792:
+		vendor = "Nuvoton";
+		desc = "NCT6792";
+		break;
+	case WBSIO_ID_NCT6793:
+		vendor = "Nuvoton";
+		desc = "NCT6793";
+		break;
 	}
 	/* Read device revision */
 	reg = wbsio_conf_read(sc->sc_iot, sc->sc_ioh, WBSIO_REV);

Added files:

Index: src/sys/dev/isa/wbsioreg.h
diff -u /dev/null src/sys/dev/isa/wbsioreg.h:1.1
--- /dev/null	Fri Jul  7 08:42:16 2017
+++ src/sys/dev/isa/wbsioreg.h	Fri Jul  7 08:42:15 2017
@@ -0,0 +1,64 @@
+/* $Id */
+/* $OpenBSD: wbsioreg.h,v 1.4 2015/01/02 23:02:54 chris Exp $ */
+/*
+ * 

CVS commit: src/sys/dev/isa

2017-06-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jun 14 05:01:35 UTC 2017

Modified Files:
src/sys/dev/isa: pcppi.c pcppivar.h spkr_pcppi.c

Log Message:
Instead of directly referencing a parent device's code (ie, pcppi_bell()
routine), let the parent device pass a pointer to the code (in the aux
config data).  This allows us to load the spkr module without requiring
the pcppi parent device to exist.  (The spkr device can also have an
audio as parent.)


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/isa/pcppi.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/isa/pcppivar.h
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/isa/spkr_pcppi.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/pcppi.c
diff -u src/sys/dev/isa/pcppi.c:1.44 src/sys/dev/isa/pcppi.c:1.45
--- src/sys/dev/isa/pcppi.c:1.44	Sun May 17 05:20:37 2015
+++ src/sys/dev/isa/pcppi.c	Wed Jun 14 05:01:35 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pcppi.c,v 1.44 2015/05/17 05:20:37 pgoyette Exp $ */
+/* $NetBSD: pcppi.c,v 1.45 2017/06/14 05:01:35 pgoyette Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcppi.c,v 1.44 2015/05/17 05:20:37 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcppi.c,v 1.45 2017/06/14 05:01:35 pgoyette Exp $");
 
 #include "attimer.h"
 
@@ -246,6 +246,7 @@ pcppi_rescan(device_t self, const char *
 		return 0;
 
 	pa.pa_cookie = sc;
+	pa.pa_bell_func = pcppi_bell;
 	config_search_loc(pcppisearch, sc->sc_dv, "pcppi", NULL, );
 
 	return 0;

Index: src/sys/dev/isa/pcppivar.h
diff -u src/sys/dev/isa/pcppivar.h:1.11 src/sys/dev/isa/pcppivar.h:1.12
--- src/sys/dev/isa/pcppivar.h:1.11	Wed Nov 23 23:07:32 2011
+++ src/sys/dev/isa/pcppivar.h	Wed Jun 14 05:01:35 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pcppivar.h,v 1.11 2011/11/23 23:07:32 jmcneill Exp $ */
+/* $NetBSD: pcppivar.h,v 1.12 2017/06/14 05:01:35 pgoyette Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -34,6 +34,7 @@ typedef void *pcppi_tag_t;
 
 struct pcppi_attach_args {
 	pcppi_tag_t pa_cookie;
+	void (*pa_bell_func)(pcppi_tag_t, int, int, int);
 };
 
 struct pcppi_softc {

Index: src/sys/dev/isa/spkr_pcppi.c
diff -u src/sys/dev/isa/spkr_pcppi.c:1.10 src/sys/dev/isa/spkr_pcppi.c:1.11
--- src/sys/dev/isa/spkr_pcppi.c:1.10	Sun Jun 11 21:54:22 2017
+++ src/sys/dev/isa/spkr_pcppi.c	Wed Jun 14 05:01:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: spkr_pcppi.c,v 1.10 2017/06/11 21:54:22 pgoyette Exp $	*/
+/*	$NetBSD: spkr_pcppi.c,v 1.11 2017/06/14 05:01:35 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1990 Eric S. Raymond (e...@snark.thyrsus.com)
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spkr_pcppi.c,v 1.10 2017/06/11 21:54:22 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr_pcppi.c,v 1.11 2017/06/14 05:01:35 pgoyette Exp $");
 
 #include 
 #include 
@@ -66,6 +66,7 @@ __KERNEL_RCSID(0, "$NetBSD: spkr_pcppi.c
 struct spkr_pcppi_softc {
 	struct spkr_softc sc_spkr;
 	pcppi_tag_t sc_pcppicookie;
+	void (*sc_bell_func)(pcppi_tag_t, int, int, int);
 };
 
 static int spkr_pcppi_probe(device_t, cfdata_t, void *);
@@ -88,7 +89,7 @@ spkr_pcppi_tone(device_t self, u_int xhz
 	aprint_debug_dev(self, "%s: %u %u\n", __func__, xhz, ticks);
 #endif /* SPKRDEBUG */
 	struct spkr_pcppi_softc *sc = device_private(self);
-	pcppi_bell(sc->sc_pcppicookie, xhz, ticks, PCPPI_BELL_SLEEP);
+	(*sc->sc_bell_func)(sc->sc_pcppicookie, xhz, ticks, PCPPI_BELL_SLEEP);
 }
 
 /* rest for given number of ticks */
@@ -123,6 +124,7 @@ spkr_pcppi_attach(device_t parent, devic
 	aprint_normal(": PC Speaker\n");
 
 	sc->sc_pcppicookie = pa->pa_cookie;
+	sc->sc_bell_func = pa->pa_bell_func;
 	spkr_attach(self, spkr_pcppi_tone, spkr_pcppi_rest);
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, "couldn't establish power handler\n");



CVS commit: src/sys/dev/isa

2017-02-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Feb  1 19:10:33 UTC 2017

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

Log Message:
Use boolean logical and operation on booleans, rather than bitwise and.

>From David Binderman in PR kern/51936.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/isa/gus.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/gus.c
diff -u src/sys/dev/isa/gus.c:1.110 src/sys/dev/isa/gus.c:1.111
--- src/sys/dev/isa/gus.c:1.110	Mon Jul 11 11:31:50 2016
+++ src/sys/dev/isa/gus.c	Wed Feb  1 19:10:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gus.c,v 1.110 2016/07/11 11:31:50 msaitoh Exp $	*/
+/*	$NetBSD: gus.c,v 1.111 2017/02/01 19:10:33 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1999, 2008 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.110 2016/07/11 11:31:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.111 2017/02/01 19:10:33 jakllsch Exp $");
 
 #include 
 #include 
@@ -1027,7 +1027,7 @@ gusattach(device_t parent, device_t self
 	printf(", %dKB memory\n", sc->sc_dsize);
 
 	/* A GUS MAX should always have a CODEC installed */
-	if ((sc->sc_revision >= 10) & !(HAS_CODEC(sc)))
+	if ((sc->sc_revision >= 10) && !(HAS_CODEC(sc)))
 		printf("%s: WARNING: did not attach CODEC on MAX\n",
 		device_xname(sc->sc_dev));
 



CVS commit: src/sys/dev/isa

2016-12-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 14 21:52:43 UTC 2016

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

Log Message:
correct spkr softc.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/isa/spkr_pcppi.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/spkr_pcppi.c
diff -u src/sys/dev/isa/spkr_pcppi.c:1.5 src/sys/dev/isa/spkr_pcppi.c:1.6
--- src/sys/dev/isa/spkr_pcppi.c:1.5	Tue Dec 13 15:20:34 2016
+++ src/sys/dev/isa/spkr_pcppi.c	Wed Dec 14 16:52:43 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: spkr_pcppi.c,v 1.5 2016/12/13 20:20:34 christos Exp $	*/
+/*	$NetBSD: spkr_pcppi.c,v 1.6 2016/12/14 21:52:43 christos Exp $	*/
 
 /*
  * Copyright (c) 1990 Eric S. Raymond (e...@snark.thyrsus.com)
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spkr_pcppi.c,v 1.5 2016/12/13 20:20:34 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr_pcppi.c,v 1.6 2016/12/14 21:52:43 christos Exp $");
 
 #include 
 #include 
@@ -65,8 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: spkr_pcppi.c
 #include 
 
 struct spkr_pcppi_softc {
-	device_t sc_dev;
-	device_t sc_spkr_dev;
+	struct spkr_softc sc_spkr;
 	pcppi_tag_t sc_pcppicookie;
 };
 



CVS commit: src/sys/dev/isa

2016-12-10 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sat Dec 10 17:41:44 UTC 2016

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

Log Message:
Be explicit about precedence of operators
Appeases clang when building an ALL kernel


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/isa/cms.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/cms.c
diff -u src/sys/dev/isa/cms.c:1.21 src/sys/dev/isa/cms.c:1.22
--- src/sys/dev/isa/cms.c:1.21	Mon Apr  9 10:18:16 2012
+++ src/sys/dev/isa/cms.c	Sat Dec 10 17:41:44 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cms.c,v 1.21 2012/04/09 10:18:16 plunky Exp $ */
+/* $NetBSD: cms.c,v 1.22 2016/12/10 17:41:44 maya Exp $ */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cms.c,v 1.21 2012/04/09 10:18:16 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cms.c,v 1.22 2016/12/10 17:41:44 maya Exp $");
 
 #include 
 #include 
@@ -261,7 +261,7 @@ cms_on(midisyn *ms, uint_fast16_t vidx, 
 
 	/* set the volume */
 	/* this may be the wrong curve but will do something. no docs! */
-	vol = 15 + (level_cB > -75) ? level_cB/5 : -15;
+	vol = 15 + ((level_cB > -75) ? level_cB/5 : -15);
 	CMS_WRITE(sc, chip, CMS_IREG_VOL0 + voice, ((vol<<4)|vol));
 
 	/* enable the voice */



CVS commit: src/sys/dev/isa

2016-12-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec  9 06:04:06 UTC 2016

Modified Files:
src/sys/dev/isa: Makefile
Added Files:
src/sys/dev/isa: spkrio.h

Log Message:
put back spkrio.h for compat


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/isa/Makefile
cvs rdiff -u -r0 -r1.5 src/sys/dev/isa/spkrio.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/Makefile
diff -u src/sys/dev/isa/Makefile:1.9 src/sys/dev/isa/Makefile:1.10
--- src/sys/dev/isa/Makefile:1.9	Thu Dec  8 23:46:39 2016
+++ src/sys/dev/isa/Makefile	Fri Dec  9 01:04:06 2016
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.9 2016/12/09 04:46:39 christos Exp $
+#	$NetBSD: Makefile,v 1.10 2016/12/09 06:04:06 christos Exp $
 
 INCSDIR= /usr/include/dev/isa
 
 # Only install includes which are used by userland
-INCS=	isvio.h satlinkio.h wtreg.h
+INCS=	isvio.h satlinkio.h spkrio.h wtreg.h
 
 .include 

Added files:

Index: src/sys/dev/isa/spkrio.h
diff -u /dev/null src/sys/dev/isa/spkrio.h:1.5
--- /dev/null	Fri Dec  9 01:04:06 2016
+++ src/sys/dev/isa/spkrio.h	Fri Dec  9 01:04:06 2016
@@ -0,0 +1,2 @@
+/*	$NetBSD: spkrio.h,v 1.5 2016/12/09 06:04:06 christos Exp $	*/
+#include 



CVS commit: src/sys/dev/isa

2016-12-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec  9 02:22:34 UTC 2016

Modified Files:
src/sys/dev/isa: files.isa spkr.c spkrio.h
Added Files:
src/sys/dev/isa: spkr_pcppi.c

Log Message:
split out the pcppi attachment of the speaker
XXX: needs more work


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/dev/isa/files.isa
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/isa/spkr.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/isa/spkr_pcppi.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/isa/spkrio.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/files.isa
diff -u src/sys/dev/isa/files.isa:1.165 src/sys/dev/isa/files.isa:1.166
--- src/sys/dev/isa/files.isa:1.165	Thu Dec  8 06:31:08 2016
+++ src/sys/dev/isa/files.isa	Thu Dec  8 21:22:34 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: files.isa,v 1.165 2016/12/08 11:31:08 nat Exp $
+#	$NetBSD: files.isa,v 1.166 2016/12/09 02:22:34 christos Exp $
 #
 # Config file and device description for machine-independent ISA code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -434,8 +434,9 @@ device	pcppi {}
 attach	pcppi at isa
 file	dev/isa/pcppi.c			pcppi			needs-flag
 
-attach	spkr at pcppi
-file	dev/isa/spkr.c			spkr & pcppispeaker	needs-flag
+attach	spkr at pcppi with spkr_pcppi
+file	dev/isa/spkr.c			spkr			needs-flag
+file	dev/isa/spkr_pcppi.c		spkr_pcppi
 
 attach	midi at pcppi with midi_pcppi: midisyn
 file	dev/isa/midi_pcppi.c		midi_pcppi

Index: src/sys/dev/isa/spkr.c
diff -u src/sys/dev/isa/spkr.c:1.38 src/sys/dev/isa/spkr.c:1.39
--- src/sys/dev/isa/spkr.c:1.38	Thu Dec  8 06:31:08 2016
+++ src/sys/dev/isa/spkr.c	Thu Dec  8 21:22:34 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: spkr.c,v 1.38 2016/12/08 11:31:08 nat Exp $	*/
+/*	$NetBSD: spkr.c,v 1.39 2016/12/09 02:22:34 christos Exp $	*/
 
 /*
  * Copyright (c) 1990 Eric S. Raymond (e...@snark.thyrsus.com)
@@ -42,9 +42,8 @@
  *  use hz value from param.c
  */
 
-#ifdef PCPPISPEAKER
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.38 2016/12/08 11:31:08 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.39 2016/12/09 02:22:34 christos Exp $");
 
 #include 
 #include 
@@ -60,30 +59,8 @@ __KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.3
 
 #include 
 
-#include 
-
 #include 
 
-void spkrattach(device_t, device_t, void *);
-int spkrdetach(device_t, int);
-
-#include "ioconf.h"
-
-MODULE(MODULE_CLASS_DRIVER, spkr, NULL /* "pcppi" */);
-
-#ifdef _MODULE
-#include "ioconf.c"
-#endif
-
-#endif /* PCPPISPEAKER */
-
-int spkrprobe(device_t, cfdata_t, void *);
-
-#ifdef PCPPISPEAKER
-CFATTACH_DECL_NEW(spkr, 0,
-spkrprobe, spkrattach, spkrdetach, NULL);
-#endif
-
 dev_type_open(spkropen);
 dev_type_close(spkrclose);
 dev_type_write(spkrwrite);
@@ -104,48 +81,15 @@ const struct cdevsw spkr_cdevsw = {
 	.d_flag = D_OTHER
 };
 
-#ifdef PCPPISPEAKER
-static pcppi_tag_t ppicookie;
-#endif
-
-#define SPKRPRI (PZERO - 1)
-
-static void tone(u_int, u_int);
-static void rest(int);
 static void playinit(void);
 static void playtone(int, int, int);
 static void playstring(char *, int);
 
-#ifdef PCPPISPEAKER
-static void
-tone(u_int xhz, u_int ticks)
-/* emit tone of frequency hz for given number of ticks */
-{
-	pcppi_bell(ppicookie, xhz, ticks, PCPPI_BELL_SLEEP);
-}
-
-static void
-rest(int ticks)
-/* rest for given number of ticks */
-{
-/*
- * Set timeout to endrest function, then give up the timeslice.
- * This is so other processes can execute while the rest is being
- * waited out.
- */
-#ifdef SPKRDEBUG
-printf("rest: %d\n", ticks);
-#endif /* SPKRDEBUG */
-if (ticks > 0)
-	tsleep(rest, SPKRPRI | PCATCH, "rest", ticks);
-}
-#endif
-
 / PLAY STRING INTERPRETER BEGINS HERE **
  *
  * Play string interpretation is modelled on IBM BASIC 2.0's PLAY statement;
  * M[LNS] are missing and the ~ synonym and octave-tracking facility is added.
- * Requires tone(), rest(), and endtone(). String play is not interruptible
+ * Requires spkr_tone(), spkr_rest(). String play is not interruptible
  * except possibly at physical block boundaries.
  */
 
@@ -223,7 +167,7 @@ playtone(int pitch, int val, int sustain
 }
 
 if (pitch == -1)
-	rest(whole * snum / (val * sdenom));
+	spkr_rest(whole * snum / (val * sdenom));
 else
 {
 	sound = (whole * snum) / (val * sdenom)
@@ -235,9 +179,9 @@ playtone(int pitch, int val, int sustain
 	pitch, sound, silence);
 #endif /* SPKRDEBUG */
 
-	tone(pitchtab[pitch], sound);
+	spkr_tone(pitchtab[pitch], sound);
 	if (fill != LEGATO)
-	rest(silence);
+	spkr_rest(silence);
 }
 }
 
@@ -418,45 +362,14 @@ playstring(char *cp, int slen)
 
 /*** UNIX DRIVER HOOKS BEGIN HERE **
  *
- * This section implements driver hooks to run playstring() and the tone(),
- * endtone(), and rest() functions defined above.
+ * This section implements driver 

CVS commit: src/sys/dev/isa

2016-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 18 03:38:50 UTC 2016

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

Log Message:
Make this compile again.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/isa/isa_stub.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/isa_stub.c
diff -u src/sys/dev/isa/isa_stub.c:1.1 src/sys/dev/isa/isa_stub.c:1.2
--- src/sys/dev/isa/isa_stub.c:1.1	Mon Oct 17 18:23:49 2016
+++ src/sys/dev/isa/isa_stub.c	Tue Oct 18 03:38:50 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_stub.c,v 1.1 2016/10/17 18:23:49 jdolecek Exp $	*/
+/*	$NetBSD: isa_stub.c,v 1.2 2016/10/18 03:38:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isa_stub.c,v 1.1 2016/10/17 18:23:49 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_stub.c,v 1.2 2016/10/18 03:38:50 martin Exp $");
 
 #include 
 #include 
@@ -47,6 +47,9 @@ __KERNEL_RCSID(0, "$NetBSD: isa_stub.c,v
 void	*default_isa_intr_establish_xname(isa_chipset_tag_t ic, int irq,
 	int type,
 	int level, int (*ih_fun)(void *), void *ih_arg, const char *xname);
+void	*isa_intr_establish_xname(isa_chipset_tag_t ic, int irq,
+	int type,
+	int level, int (*ih_fun)(void *), void *ih_arg, const char *xname);
 __strict_weak_alias(isa_intr_establish_xname, default_isa_intr_establish_xname);
 
 void *



CVS commit: src/sys/dev/isa

2016-07-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul 11 07:11:08 UTC 2016

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

Log Message:
- Use aprint*() instead of printf() in the attach function.
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 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.90 src/sys/dev/isa/if_eg.c:1.91
--- src/sys/dev/isa/if_eg.c:1.90	Fri Jun 10 13:27:14 2016
+++ src/sys/dev/isa/if_eg.c	Mon Jul 11 07:11:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_eg.c,v 1.90 2016/06/10 13:27:14 ozaki-r Exp $	*/
+/*	$NetBSD: if_eg.c,v 1.91 2016/07/11 07:11:08 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1993 Dean Huxley 
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.90 2016/06/10 13:27:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.91 2016/07/11 07:11:08 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -427,17 +427,18 @@ egattach(device_t parent, device_t self,
 	}
 	memcpy(myaddr, >eg_pcb[2], ETHER_ADDR_LEN);
 
-	printf("%s: ROM v%d.%02d %dk address %s\n", device_xname(self),
+	aprint_normal_dev(self, "ROM v%d.%02d %dk address %s\n",
 	sc->eg_rom_major, sc->eg_rom_minor, sc->eg_ram,
 	ether_sprintf(myaddr));
 
 	sc->eg_pcb[0] = EG_CMD_SETEADDR; /* Set station address */
 	if (egwritePCB(iot, ioh, sc->eg_pcb) != 0) {
-		printf("%s: can't send Set Station Address\n", device_xname(self));
+		aprint_error_dev(self, "can't send Set Station Address\n");
 		return;
 	}
 	if (egreadPCB(iot, ioh, sc->eg_pcb) != 0) {
-		aprint_error_dev(self, "can't read Set Station Address status\n");
+		aprint_error_dev(self,
+		"can't read Set Station Address status\n");
 		egprintpcb(sc->eg_pcb);
 		return;
 	}
@@ -491,10 +492,11 @@ eginit(struct eg_softc *sc)
 		aprint_error_dev(sc->sc_dev, "can't send Configure 82586\n");
 
 	if (egreadPCB(iot, ioh, sc->eg_pcb) != 0) {
-		aprint_error_dev(sc->sc_dev, "can't read Configure 82586 status\n");
+		aprint_error_dev(sc->sc_dev,
+		"can't read Configure 82586 status\n");
 		egprintpcb(sc->eg_pcb);
 	} else if (sc->eg_pcb[2] != 0 || sc->eg_pcb[3] != 0)
-		aprint_error_dev(sc->sc_dev, "configure card command failed\n");
+		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);
@@ -508,7 +510,7 @@ eginit(struct eg_softc *sc)
 	if (sc->eg_outbuf == NULL) {
 		sc->eg_outbuf = malloc(EG_BUFLEN, M_TEMP, M_NOWAIT);
 		if (sc->eg_outbuf == NULL) {
-			aprint_error_dev(sc->sc_dev, "can't allocate outbuf\n");
+			aprint_error_dev(sc->sc_dev,"can't allocate outbuf\n");
 			panic("eginit");
 		}
 	}
@@ -588,7 +590,8 @@ loop:
 	sc->eg_pcb[6] = len; /* length of packet */
 	sc->eg_pcb[7] = len >> 8;
 	if (egwritePCB(iot, ioh, sc->eg_pcb) != 0) {
-		aprint_error_dev(sc->sc_dev, "can't send Send Packet command\n");
+		aprint_error_dev(sc->sc_dev,
+		"can't send Send Packet command\n");
 		ifp->if_oerrors++;
 		ifp->if_flags &= ~IFF_OACTIVE;
 		m_freem(m0);
@@ -710,7 +713,8 @@ egread(struct eg_softc *sc, void *buf, i
 
 	if (len <= sizeof(struct ether_header) ||
 	len > ETHER_MAX_LEN) {
-		aprint_error_dev(sc->sc_dev, "invalid packet size %d; dropping\n", len);
+		aprint_error_dev(sc->sc_dev,
+		"invalid packet size %d; dropping\n", len);
 		ifp->if_ierrors++;
 		return;
 	}



CVS commit: src/sys/dev/isa

2016-06-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Jun 30 20:39:54 UTC 2016

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

Log Message:
Provide some defaults.  From Felix Deichmann.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/isa/slhci_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/slhci_isa.c
diff -u src/sys/dev/isa/slhci_isa.c:1.13 src/sys/dev/isa/slhci_isa.c:1.14
--- src/sys/dev/isa/slhci_isa.c:1.13	Sat Apr 23 10:15:31 2016
+++ src/sys/dev/isa/slhci_isa.c	Thu Jun 30 20:39:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: slhci_isa.c,v 1.13 2016/04/23 10:15:31 skrll Exp $	*/
+/*	$NetBSD: slhci_isa.c,v 1.14 2016/06/30 20:39:54 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Kiyoshi Ikehara. All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: slhci_isa.c,v 1.13 2016/04/23 10:15:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: slhci_isa.c,v 1.14 2016/06/30 20:39:54 skrll Exp $");
 
 #include 
 #include 
@@ -74,6 +74,22 @@ slhci_isa_match(device_t parent, cfdata_
 	int result = 0;
 	uint8_t sltype;
 
+	if (ia->ia_nio < 1)
+		goto out;
+	if (ia->ia_nirq < 1)
+		goto out;
+
+	if (ISA_DIRECT_CONFIG(ia))
+		goto out;
+
+	/* Disallow wildcarded i/o address. */
+	if (ia->ia_io[0].ir_addr == ISA_UNKNOWN_PORT)
+		goto out;
+
+	/* Don't allow wildcarded IRQ. */
+	if (ia->ia_irq[0].ir_irq == ISA_UNKNOWN_IRQ)
+		goto out;
+
 	if (bus_space_map(iot, ia->ia_io[0].ir_addr, SL11_PORTSIZE, 0, ))
 		goto out;
 
@@ -85,6 +101,15 @@ slhci_isa_match(device_t parent, cfdata_
 	bus_space_unmap(iot, ioh, SL11_PORTSIZE);
 
  out:
+	if (result) {
+		ia->ia_nio = 1;
+		ia->ia_io[0].ir_size = SL11_PORTSIZE;
+
+		ia->ia_nirq = 1;
+
+		ia->ia_niomem = 0;
+		ia->ia_ndrq = 0;
+	}
 	return (result);
 }
 
@@ -109,11 +134,11 @@ slhci_isa_attach(device_t parent, device
 	}
 
 	/* Initialize sc XXX power value unconfirmed */
-	slhci_preinit(sc, NULL, iot, ioh, 30, SL11_IDX_DATA);
+	slhci_preinit(sc, NULL, iot, ioh, 500, SL11_IDX_DATA);
 
 	/* Establish the interrupt handler */
 	isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq,
-	IST_EDGE, IPL_USB, slhci_intr, sc);
+	IST_EDGE, IPL_USB, slhci_intr, sc);
 	if (isc->sc_ih == NULL) {
 		printf("%s: can't establish interrupt\n", SC_NAME(sc));
 		return;



CVS commit: src/sys/dev/isa

2015-09-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 12 19:31:41 UTC 2015

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

Log Message:
fix spl issues, found by brainy.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/isa/seagate.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/seagate.c
diff -u src/sys/dev/isa/seagate.c:1.72 src/sys/dev/isa/seagate.c:1.73
--- src/sys/dev/isa/seagate.c:1.72	Tue Apr  8 09:20:01 2014
+++ src/sys/dev/isa/seagate.c	Sat Sep 12 15:31:41 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: seagate.c,v 1.72 2014/04/08 13:20:01 hannken Exp $	*/
+/*	$NetBSD: seagate.c,v 1.73 2015/09/12 19:31:41 christos Exp $	*/
 
 /*
  * ST01/02, Future Domain TMC-885, TMC-950 SCSI driver
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: seagate.c,v 1.72 2014/04/08 13:20:01 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: seagate.c,v 1.73 2015/09/12 19:31:41 christos Exp $");
 
 #include 
 #include 
@@ -721,51 +721,54 @@ loop:
 			 */
 			for (scb = sea->ready_list.tqh_first; scb;
 			scb = scb->chain.tqe_next) {
-if (!(sea->busy[scb->xs->xs_periph->periph_target] &
-(1 << scb->xs->xs_periph->periph_lun))) {
-	TAILQ_REMOVE(>ready_list, scb,
-	chain);
-
-	/* Re-enable interrupts. */
-	splx(s);
-
-	/*
-	 * Attempt to establish an I_T_L nexus.
-	 * On success, sea->nexus is set.
-	 * On failure, we must add the command
-	 * back to the issue queue so we can
-	 * keep trying.
-	 */
-
-	/*
-	 * REQUEST_SENSE commands are issued
-	 * without tagged queueing, even on
-	 * SCSI-II devices because the
-	 * contingent alligence condition
-	 * exists for the entire unit.
-	 */
-
-	/*
-	 * First check that if any device has
-	 * tried a reconnect while we have done
-	 * other things with interrupts
-	 * disabled.
-	 */
-
-	if ((STATUS & (STAT_SEL | STAT_IO)) ==
-	(STAT_SEL | STAT_IO)) {
-		sea_reselect(sea);
-		break;
-	}
-	if (sea_select(sea, scb)) {
-		s = splbio();
-		TAILQ_INSERT_HEAD(>ready_list,
-		scb, chain);
-		splx(s);
-	} else
-		break;
-} /* if target/lun is not busy */
-			} /* for scb */
+if ((sea->busy[scb->xs->xs_periph->periph_target] &
+(1 << scb->xs->xs_periph->periph_lun)))
+	continue;
+
+/* target/lun is not busy */
+TAILQ_REMOVE(>ready_list, scb, chain);
+
+/* Re-enable interrupts. */
+splx(s);
+
+/*
+ * Attempt to establish an I_T_L nexus.
+ * On success, sea->nexus is set.
+ * On failure, we must add the command
+ * back to the issue queue so we can
+ * keep trying.
+ */
+
+/*
+ * REQUEST_SENSE commands are issued
+ * without tagged queueing, even on
+ * SCSI-II devices because the
+ * contingent alligence condition
+ * exists for the entire unit.
+ */
+
+/*
+ * First check that if any device has
+ * tried a reconnect while we have done
+ * other things with interrupts
+ * disabled.
+ */
+
+if ((STATUS & (STAT_SEL | STAT_IO)) ==
+(STAT_SEL | STAT_IO)) {
+	sea_reselect(sea);
+	s = splbio();
+	break;
+}
+if (sea_select(sea, scb)) {
+	s = splbio();
+	TAILQ_INSERT_HEAD(>ready_list,
+	scb, chain);
+} else {
+	s = splbio();
+	break;
+}
+			}
 			if (!sea->nexus) {
 /* check for reselection phase */
 if ((STATUS & (STAT_SEL | STAT_IO)) ==



CVS commit: src/sys/dev/isa

2015-05-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun May 17 05:20:37 UTC 2015

Modified Files:
src/sys/dev/isa: pcppi.c spkr.c

Log Message:
Modularize the spkr(4) driver (i386 and amd64 only).  Adapt parent
pcppi(4) driver to be able to handle rescan().


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/isa/pcppi.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/isa/spkr.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/pcppi.c
diff -u src/sys/dev/isa/pcppi.c:1.43 src/sys/dev/isa/pcppi.c:1.44
--- src/sys/dev/isa/pcppi.c:1.43	Mon Dec  8 16:16:45 2014
+++ src/sys/dev/isa/pcppi.c	Sun May 17 05:20:37 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: pcppi.c,v 1.43 2014/12/08 16:16:45 msaitoh Exp $ */
+/* $NetBSD: pcppi.c,v 1.44 2015/05/17 05:20:37 pgoyette Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pcppi.c,v 1.43 2014/12/08 16:16:45 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: pcppi.c,v 1.44 2015/05/17 05:20:37 pgoyette Exp $);
 
 #include attimer.h
 
@@ -61,10 +61,11 @@ void	pcppi_pckbd_bell(void *, u_int, u_i
 int	pcppi_match(device_t, cfdata_t, void *);
 void	pcppi_isa_attach(device_t, device_t, void *);
 void	pcppi_childdet(device_t, device_t);
+int	pcppi_rescan(device_t, const char *, const int *);
 
 CFATTACH_DECL3_NEW(pcppi, sizeof(struct pcppi_softc),
-pcppi_match, pcppi_isa_attach, pcppi_detach, NULL, NULL, pcppi_childdet,
-DVF_DETACH_SHUTDOWN);
+pcppi_match, pcppi_isa_attach, pcppi_detach, NULL, pcppi_rescan,
+pcppi_childdet, DVF_DETACH_SHUTDOWN);
 
 static int pcppisearch(device_t, cfdata_t, const int *, void *);
 static void pcppi_bell_stop(struct pcppi_softc *);
@@ -214,7 +215,6 @@ pcppi_detach(device_t self, int flags)
 void
 pcppi_attach(struct pcppi_softc *sc)
 {
-struct pcppi_attach_args pa;
 	device_t self = sc-sc_dv;
 
 	callout_init(sc-sc_bell_ch, CALLOUT_MPSAFE);
@@ -233,8 +233,22 @@ pcppi_attach(struct pcppi_softc *sc)
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, couldn't establish power handler\n);
 
+	pcppi_rescan(self, pcppi, NULL);
+}
+
+int
+pcppi_rescan(device_t self, const char *ifattr, const int *flags)
+{
+	struct pcppi_softc *sc = device_private(self);
+struct pcppi_attach_args pa;
+
+	if (!ifattr_match(ifattr, pcppi))
+		return 0;
+
 	pa.pa_cookie = sc;
 	config_search_loc(pcppisearch, sc-sc_dv, pcppi, NULL, pa);
+
+	return 0;
 }
 
 static int

Index: src/sys/dev/isa/spkr.c
diff -u src/sys/dev/isa/spkr.c:1.35 src/sys/dev/isa/spkr.c:1.36
--- src/sys/dev/isa/spkr.c:1.35	Fri Jul 25 08:10:37 2014
+++ src/sys/dev/isa/spkr.c	Sun May 17 05:20:37 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: spkr.c,v 1.35 2014/07/25 08:10:37 dholland Exp $	*/
+/*	$NetBSD: spkr.c,v 1.36 2015/05/17 05:20:37 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1990 Eric S. Raymond (e...@snark.thyrsus.com)
@@ -43,7 +43,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: spkr.c,v 1.35 2014/07/25 08:10:37 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: spkr.c,v 1.36 2015/05/17 05:20:37 pgoyette Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -51,6 +51,7 @@ __KERNEL_RCSID(0, $NetBSD: spkr.c,v 1.3
 #include sys/errno.h
 #include sys/device.h
 #include sys/malloc.h
+#include sys/module.h
 #include sys/uio.h
 #include sys/proc.h
 #include sys/ioctl.h
@@ -64,9 +65,19 @@ __KERNEL_RCSID(0, $NetBSD: spkr.c,v 1.3
 
 int spkrprobe(device_t, cfdata_t, void *);
 void spkrattach(device_t, device_t, void *);
+int spkrdetach(device_t, int);
+
+#include ioconf.h
+
+MODULE(MODULE_CLASS_DRIVER, spkr, NULL /* pcppi */);
+
+#ifdef _MODULE
+#include ioconf.c
+#endif
+
 
 CFATTACH_DECL_NEW(spkr, 0,
-spkrprobe, spkrattach, NULL, NULL);
+spkrprobe, spkrattach, spkrdetach, NULL);
 
 dev_type_open(spkropen);
 dev_type_close(spkrclose);
@@ -176,7 +187,7 @@ static const int pitchtab[] =
 /* 5 */ 2093, 2217, 2349, 2489, 2637, 2794, 2960, 3136, 3322, 3520, 3729, 3951,
 /* 6 */ 4186, 4435, 4698, 4978, 5274, 5588, 5920, 6272, 6644, 7040, 7459, 7902,
 };
-#define NOCTAVES (__arraycount(pitchtab) / OCTAVE_NOTES)
+#define NOCTAVES (int)(__arraycount(pitchtab) / OCTAVE_NOTES)
 
 static void
 playinit(void)
@@ -424,6 +435,17 @@ spkrattach(device_t parent, device_t sel
 }
 
 int
+spkrdetach(device_t self, int flags)
+{
+
+	pmf_device_deregister(self);
+	spkr_attached = 0;
+	ppicookie = NULL;
+
+	return 0;
+}
+
+int
 spkropen(dev_t dev, int	flags, int mode, struct lwp *l)
 {
 #ifdef SPKRDEBUG
@@ -524,4 +546,43 @@ spkrioctl(dev_t dev, u_long cmd, void *d
 return(0);
 }
 
+static int
+spkr_modcmd(modcmd_t cmd, void *arg)
+{
+#ifdef _MODULE
+	devmajor_t bmajor, cmajor;
+#endif
+	int error = 0;
+
+#ifdef _MODULE
+	switch(cmd) {
+	case MODULE_CMD_INIT:
+		bmajor = cmajor = -1;
+		error = devsw_attach(spkr_cd.cd_name, NULL, bmajor,
+		spkr_cdevsw, cmajor);
+		if 

CVS commit: src/sys/dev/isa

2014-08-16 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Sat Aug 16 13:01:33 UTC 2014

Modified Files:
src/sys/dev/isa: ess.c essreg.h essvar.h

Log Message:
Add support for Spatializer, 3D audio effects embedded in ES1869
and ES1879 to ess(4).

Tested on my old laptop, mobio NX.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/isa/ess.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/isa/essreg.h
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/isa/essvar.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/ess.c
diff -u src/sys/dev/isa/ess.c:1.81 src/sys/dev/isa/ess.c:1.82
--- src/sys/dev/isa/ess.c:1.81	Fri Aug 15 19:55:23 2014
+++ src/sys/dev/isa/ess.c	Sat Aug 16 13:01:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ess.c,v 1.81 2014/08/15 19:55:23 nakayama Exp $	*/
+/*	$NetBSD: ess.c,v 1.82 2014/08/16 13:01:33 nakayama Exp $	*/
 
 /*
  * Copyright 1997
@@ -66,7 +66,7 @@
 */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ess.c,v 1.81 2014/08/15 19:55:23 nakayama Exp $);
+__KERNEL_RCSID(0, $NetBSD: ess.c,v 1.82 2014/08/16 13:01:33 nakayama Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -170,7 +170,7 @@ int	ess_reset(struct ess_softc *);
 void	ess_set_gain(struct ess_softc *, int, int);
 int	ess_set_in_port(struct ess_softc *, int);
 int	ess_set_in_ports(struct ess_softc *, int);
-u_int	ess_srtotc(u_int);
+u_int	ess_srtotc(struct ess_softc *, u_int);
 u_int	ess_srtofc(u_int);
 u_char	ess_get_dsp_status(struct ess_softc *);
 u_char	ess_dsp_read_ready(struct ess_softc *);
@@ -994,7 +994,17 @@ essattach(struct ess_softc *sc, int enab
 	if (ESS_USE_AUDIO1(sc-sc_model)) {
 		ess_write_mix_reg(sc, ESS_MREG_ADC_SOURCE, ESS_SOURCE_MIC);
 		sc-in_port = ESS_SOURCE_MIC;
-		sc-ndevs = ESS_1788_NDEVS;
+		if (ESS_IS_ES18X9(sc-sc_model)) {
+			sc-ndevs = ESS_18X9_NDEVS;
+			sc-sc_spatializer = 0;
+			ess_set_mreg_bits(sc, ESS_MREG_MODE,
+			ESS_MODE_ASYNC_MODE | ESS_MODE_NEWREG);
+			ess_set_mreg_bits(sc, ESS_MREG_SPATIAL_CTRL,
+			ESS_SPATIAL_CTRL_RESET);
+			ess_clear_mreg_bits(sc, ESS_MREG_SPATIAL_CTRL,
+			ESS_SPATIAL_CTRL_ENABLE | ESS_SPATIAL_CTRL_MONO);
+		} else
+			sc-ndevs = ESS_1788_NDEVS;
 	} else {
 		/*
 		 * Set hardware record source to use output of the record
@@ -1015,6 +1025,14 @@ essattach(struct ess_softc *sc, int enab
 	 * are set to 50% volume.
 	 */
 	for (i = 0; i  sc-ndevs; i++) {
+		if (ESS_IS_ES18X9(sc-sc_model)) {
+			switch (i) {
+			case ESS_SPATIALIZER:
+			case ESS_SPATIALIZER_ENABLE:
+v = 0;
+goto skip;
+			}
+		}
 		switch (i) {
 		case ESS_MIC_PLAY_VOL:
 		case ESS_LINE_PLAY_VOL:
@@ -1031,6 +1049,7 @@ essattach(struct ess_softc *sc, int enab
 			v = ESS_4BIT_GAIN(AUDIO_MAX_GAIN / 2);
 			break;
 		}
+skip:
 		sc-gain[i][ESS_LEFT] = sc-gain[i][ESS_RIGHT] = v;
 		ess_set_gain(sc, i, 1);
 	}
@@ -1262,11 +1281,12 @@ ess_set_params(
 	else
 		rate = play-sample_rate;
 
-	ess_write_x_reg(sc, ESS_XCMD_SAMPLE_RATE, ess_srtotc(rate));
+	ess_write_x_reg(sc, ESS_XCMD_SAMPLE_RATE, ess_srtotc(sc, rate));
 	ess_write_x_reg(sc, ESS_XCMD_FILTER_CLOCK, ess_srtofc(rate));
 
 	if (!ESS_USE_AUDIO1(sc-sc_model)) {
-		ess_write_mix_reg(sc, ESS_MREG_SAMPLE_RATE, ess_srtotc(rate));
+		ess_write_mix_reg(sc, ESS_MREG_SAMPLE_RATE,
+		ess_srtotc(sc, rate));
 		ess_write_mix_reg(sc, ESS_MREG_FILTER_CLOCK, ess_srtofc(rate));
 	}
 
@@ -1781,6 +1801,35 @@ ess_set_port(void *addr, mixer_ctrl_t *c
 		return 0;
 	}
 
+	if (ESS_IS_ES18X9(sc-sc_model)) {
+
+		switch (cp-dev) {
+		case ESS_SPATIALIZER:
+			if (cp-type != AUDIO_MIXER_VALUE ||
+			cp-un.value.num_channels != 1)
+return EINVAL;
+
+			sc-gain[cp-dev][ESS_LEFT] =
+sc-gain[cp-dev][ESS_RIGHT] = ESS_6BIT_GAIN(
+cp-un.value.level[AUDIO_MIXER_LEVEL_MONO]);
+			ess_set_gain(sc, cp-dev, 1);
+			return 0;
+
+		case ESS_SPATIALIZER_ENABLE:
+			if (cp-type != AUDIO_MIXER_ENUM)
+return EINVAL;
+
+			sc-sc_spatializer = (cp-un.ord != 0);
+			if (sc-sc_spatializer)
+ess_set_mreg_bits(sc, ESS_MREG_SPATIAL_CTRL,
+ESS_SPATIAL_CTRL_ENABLE);
+			else
+ess_clear_mreg_bits(sc, ESS_MREG_SPATIAL_CTRL,
+ESS_SPATIAL_CTRL_ENABLE);
+			return 0;
+		}
+	}
+
 	if (ESS_USE_AUDIO1(sc-sc_model))
 		return EINVAL;
 
@@ -1886,6 +1935,23 @@ ess_get_port(void *addr, mixer_ctrl_t *c
 		return 0;
 	}
 
+	if (ESS_IS_ES18X9(sc-sc_model)) {
+
+		switch (cp-dev) {
+		case ESS_SPATIALIZER:
+			if (cp-un.value.num_channels != 1)
+return EINVAL;
+
+			cp-un.value.level[AUDIO_MIXER_LEVEL_MONO] =
+sc-gain[cp-dev][ESS_LEFT];
+			return 0;
+
+		case ESS_SPATIALIZER_ENABLE:
+			cp-un.ord = sc-sc_spatializer;
+			return 0;
+		}
+	}
+
 	if (ESS_USE_AUDIO1(sc-sc_model))
 		return EINVAL;
 
@@ -2108,6 +2174,34 @@ ess_query_devinfo(void *addr, mixer_devi
 		return 0;
 	}
 
+	if (ESS_IS_ES18X9(sc-sc_model)) {
+
+		switch (dip-index) {
+		case ESS_SPATIALIZER:
+			dip-mixer_class = ESS_OUTPUT_CLASS;
+			dip-prev 

CVS commit: src/sys/dev/isa

2014-08-15 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri Aug 15 19:55:23 UTC 2014

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

Log Message:
Remove redundant colon.


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

Modified files:

Index: src/sys/dev/isa/ess.c
diff -u src/sys/dev/isa/ess.c:1.80 src/sys/dev/isa/ess.c:1.81
--- src/sys/dev/isa/ess.c:1.80	Thu Nov 24 03:35:57 2011
+++ src/sys/dev/isa/ess.c	Fri Aug 15 19:55:23 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ess.c,v 1.80 2011/11/24 03:35:57 mrg Exp $	*/
+/*	$NetBSD: ess.c,v 1.81 2014/08/15 19:55:23 nakayama Exp $	*/
 
 /*
  * Copyright 1997
@@ -66,7 +66,7 @@
 */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ess.c,v 1.80 2011/11/24 03:35:57 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: ess.c,v 1.81 2014/08/15 19:55:23 nakayama Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -920,7 +920,7 @@ essattach(struct ess_softc *sc, int enab
 		return;
 	}
 
-	aprint_normal(: ESS Technology ES%s [version 0x%04x]\n,
+	aprint_normal(ESS Technology ES%s [version 0x%04x]\n,
 	essmodel[sc-sc_model], sc-sc_version);
 
 	callout_init(sc-sc_poll1_ch, CALLOUT_MPSAFE);



CVS commit: src/sys/dev/isa

2014-04-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Apr  8 13:20:01 UTC 2014

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

Log Message:
Add __diagused.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/isa/seagate.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/seagate.c
diff -u src/sys/dev/isa/seagate.c:1.71 src/sys/dev/isa/seagate.c:1.72
--- src/sys/dev/isa/seagate.c:1.71	Sat Oct 27 17:18:25 2012
+++ src/sys/dev/isa/seagate.c	Tue Apr  8 13:20:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: seagate.c,v 1.71 2012/10/27 17:18:25 chs Exp $	*/
+/*	$NetBSD: seagate.c,v 1.72 2014/04/08 13:20:01 hannken Exp $	*/
 
 /*
  * ST01/02, Future Domain TMC-885, TMC-950 SCSI driver
@@ -65,7 +65,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: seagate.c,v 1.71 2012/10/27 17:18:25 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: seagate.c,v 1.72 2014/04/08 13:20:01 hannken Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -557,7 +557,7 @@ void
 sea_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void *arg)
 {
 	struct scsipi_xfer *xs;
-	struct scsipi_periph *periph;
+	struct scsipi_periph *periph __diagused;
 	struct sea_softc *sea = device_private(chan-chan_adapter-adapt_dev);
 	struct sea_scb *scb;
 	int flags;



CVS commit: src/sys/dev/isa

2014-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 23 02:45:02 UTC 2014

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

Log Message:
remove unused


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/isa/if_ntwoc_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/if_ntwoc_isa.c
diff -u src/sys/dev/isa/if_ntwoc_isa.c:1.24 src/sys/dev/isa/if_ntwoc_isa.c:1.25
--- src/sys/dev/isa/if_ntwoc_isa.c:1.24	Sat Oct 27 13:18:24 2012
+++ src/sys/dev/isa/if_ntwoc_isa.c	Sat Mar 22 22:45:02 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ntwoc_isa.c,v 1.24 2012/10/27 17:18:24 chs Exp $	*/
+/*	$NetBSD: if_ntwoc_isa.c,v 1.25 2014/03/23 02:45:02 christos Exp $	*/
 /*
  * Copyright (c) 1999 Christian E. Hopps
  * Copyright (c) 1996 John Hay.
@@ -29,11 +29,11 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: if_ntwoc_isa.c,v 1.24 2012/10/27 17:18:24 chs Exp $
+ * $Id: if_ntwoc_isa.c,v 1.25 2014/03/23 02:45:02 christos Exp $
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ntwoc_isa.c,v 1.24 2012/10/27 17:18:24 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ntwoc_isa.c,v 1.25 2014/03/23 02:45:02 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -191,7 +191,7 @@ ntwoc_isa_probe(device_t parent, cfdata_
 	struct isa_attach_args *ia;
 	bus_space_tag_t iot, memt;
 	bus_space_handle_t ioh, memh, sca_ioh[16];
-	int i, tmp, dbg, rv;
+	int i, tmp, rv;
 	int gotmem, gotsca[16];
 	u_int32_t ioport;
 
@@ -211,7 +211,6 @@ ntwoc_isa_probe(device_t parent, cfdata_
 
 	memset(gotsca, 0, sizeof(gotsca));
 	gotmem = rv = 0;
-	dbg = 0;
 
 	/* disallow wildcarded I/O base */
 	if (ia-ia_io[0].ir_addr == ISA_UNKNOWN_PORT) {
@@ -390,13 +389,12 @@ ntwoc_isa_attach(device_t parent, device
 	u_int8_t rdiv, tdiv, tmc;
 	u_int32_t flags, ioport;
 	u_int16_t tmp;
-	int i, dbg, pgs, rv;
+	int i, pgs, rv;
 
 	ia = (struct isa_attach_args *)aux;
 	sc = device_private(self);
 	sc-sc_dev = self;
 	sca = sc-sc_sca;
-	dbg = 0;
 
 	printf(: N2 Serial Interface\n);
 	flags = device_cfdata(sc-sc_dev)-cf_flags;



CVS commit: src/sys/dev/isa

2014-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 23 02:46:55 UTC 2014

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

Log Message:
remove unused


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/isa/isic_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/isic_isa.c
diff -u src/sys/dev/isa/isic_isa.c:1.36 src/sys/dev/isa/isic_isa.c:1.37
--- src/sys/dev/isa/isic_isa.c:1.36	Sat Oct 27 13:18:24 2012
+++ src/sys/dev/isa/isic_isa.c	Sat Mar 22 22:46:55 2014
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: isic_isa.c,v 1.36 2012/10/27 17:18:24 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: isic_isa.c,v 1.37 2014/03/23 02:46:55 christos Exp $);
 
 #include sys/param.h
 #include sys/errno.h
@@ -780,23 +780,11 @@ isic_isa_attach(device_t parent, device_
 	struct isic_softc *sc = device_private(self);
 	struct isa_attach_args *ia = aux;
 	int flags = device_cfdata(self)-cf_flags;
-	int ret = 0, iobase, iosize, maddr, msize;
+	int ret = 0, iobase, maddr;
 	struct isic_attach_args args;
 
-	if (ia-ia_nio  0) {
-		iobase = ia-ia_io[0].ir_addr;
-		iosize = ia-ia_io[0].ir_size;
-	} else {
-		iobase = ISA_UNKNOWN_PORT;
-		iosize = 0;
-	}
-	if (ia-ia_niomem  0) {
-		maddr = ia-ia_iomem[0].ir_addr;
-		msize = ia-ia_iomem[0].ir_size;
-	} else {
-		maddr = ISA_UNKNOWN_IOMEM;
-		msize = 0;
-	}
+	iobase = ia-ia_nio  0 ? ia-ia_io[0].ir_addr : ISA_UNKNOWN_PORT;
+	maddr = ia-ia_niomem  0 ? ia-ia_iomem[0].ir_addr : ISA_UNKNOWN_IOMEM;
 
 	/* Setup parameters */
 	sc-sc_dev = self;



CVS commit: src/sys/dev/isa

2014-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 23 02:50:51 UTC 2014

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

Log Message:
remove unused


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/isa/isv.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/isv.c
diff -u src/sys/dev/isa/isv.c:1.5 src/sys/dev/isa/isv.c:1.6
--- src/sys/dev/isa/isv.c:1.5	Sun Mar 16 01:20:28 2014
+++ src/sys/dev/isa/isv.c	Sat Mar 22 22:50:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: isv.c,v 1.5 2014/03/16 05:20:28 dholland Exp $ */
+/*	$NetBSD: isv.c,v 1.6 2014/03/23 02:50:51 christos Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: isv.c,v 1.5 2014/03/16 05:20:28 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: isv.c,v 1.6 2014/03/23 02:50:51 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -324,7 +324,6 @@ static int
 isv_capture(struct isv_softc *sc)
 {
 	int speed;
-	uint16_t discard;
 	int rc, state = ISV_S_CAPTURE0;
 	struct timeval diff, end, start, stop;
 	static const struct timeval wait = {.tv_sec = 0, .tv_usec = 20};
@@ -372,7 +371,7 @@ isv_capture(struct isv_softc *sc)
 	/* read one dummy word to prime the state machine on the
 	 * image capture board
 	 */
-	discard = isv_read(ir, ISV_DATA);
+	isv_read(ir, ISV_DATA);
 	bus_space_read_multi_stream_2(ir-ir_bt, ir-ir_bh, ISV_DATA,
 	sc-sc_frame, ISV_WIDTH * ISV_LINES / 2);
 



CVS commit: src/sys/dev/isa

2014-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 23 02:59:19 UTC 2014

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

Log Message:
fix unused


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/isa/radiotrack.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/radiotrack.c
diff -u src/sys/dev/isa/radiotrack.c:1.19 src/sys/dev/isa/radiotrack.c:1.20
--- src/sys/dev/isa/radiotrack.c:1.19	Sat Oct 27 13:18:25 2012
+++ src/sys/dev/isa/radiotrack.c	Sat Mar 22 22:59:19 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: radiotrack.c,v 1.19 2012/10/27 17:18:25 chs Exp $ */
+/* $NetBSD: radiotrack.c,v 1.20 2014/03/23 02:59:19 christos Exp $ */
 /* $OpenBSD: radiotrack.c,v 1.1 2001/12/05 10:27:06 mickey Exp $ */
 /* $RuOBSD: radiotrack.c,v 1.3 2001/10/18 16:51:36 pva Exp $ */
 
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: radiotrack.c,v 1.19 2012/10/27 17:18:25 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: radiotrack.c,v 1.20 2014/03/23 02:59:19 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -334,10 +334,9 @@ rt_unconv_vol(u_int8_t vol)
 int
 rt_find(bus_space_tag_t iot, bus_space_handle_t ioh)
 {
+#ifdef notdef
 	struct rt_softc sc;
-#if 0
 	u_int i, scanres = 0;
-#endif
 
 	sc.lm.iot = iot;
 	sc.lm.ioh = ioh;
@@ -359,14 +358,14 @@ rt_find(bus_space_tag_t iot, bus_space_h
 	 * Scan whole FM range. If there is a card it'll
 	 * respond on some frequency.
 	 */
-	return 0;
-#if 0
 	for (i = MIN_FM_FREQ; !scanres  i  MAX_FM_FREQ; i += 10) {
 		rt_set_freq(sc, i);
 		scanres += rt_state(iot, ioh);
 	}
 
 	return scanres;
+#else
+	return 0;
 #endif
 }
 



CVS commit: src/sys/dev/isa

2013-11-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov  4 16:53:52 UTC 2013

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

Log Message:
use __USE for debug variable


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 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.39 src/sys/dev/isa/uha_isa.c:1.40
--- src/sys/dev/isa/uha_isa.c:1.39	Sat Oct 27 13:18:25 2012
+++ src/sys/dev/isa/uha_isa.c	Mon Nov  4 11:53:52 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: uha_isa.c,v 1.39 2012/10/27 17:18:25 chs Exp $	*/
+/*	$NetBSD: uha_isa.c,v 1.40 2013/11/04 16:53:52 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uha_isa.c,v 1.39 2012/10/27 17:18:25 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: uha_isa.c,v 1.40 2013/11/04 16:53:52 christos Exp $);
 
 #include opt_ddb.h
 
@@ -363,6 +363,8 @@ u14_intr(void *arg)
 
 #ifdef	UHADEBUG
 		printf(status = 0x%x , uhastat);
+#else
+		__USE(uhastat);
 #endif /*UHADEBUG*/
 
 		/*



CVS commit: src/sys/dev/isa

2013-10-18 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Fri Oct 18 08:09:37 UTC 2013

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

Log Message:
Delete unused function
static inline void egprintstat(u_char);


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 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.85 src/sys/dev/isa/if_eg.c:1.86
--- src/sys/dev/isa/if_eg.c:1.85	Sat Oct 27 17:18:24 2012
+++ src/sys/dev/isa/if_eg.c	Fri Oct 18 08:09:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_eg.c,v 1.85 2012/10/27 17:18:24 chs Exp $	*/
+/*	$NetBSD: if_eg.c,v 1.86 2013/10/18 08:09:37 apb Exp $	*/
 
 /*
  * Copyright (c) 1993 Dean Huxley d...@fsa.ca
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_eg.c,v 1.85 2012/10/27 17:18:24 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_eg.c,v 1.86 2013/10/18 08:09:37 apb Exp $);
 
 #include opt_inet.h
 
@@ -131,7 +131,6 @@ struct mbuf *egget(struct eg_softc *, vo
 void egstop(struct eg_softc *);
 
 static inline void egprintpcb(u_int8_t *);
-static inline void egprintstat(u_char);
 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 int egreadPCBready(bus_space_tag_t, bus_space_handle_t);
@@ -151,20 +150,6 @@ egprintpcb(u_int8_t *pcb)
 		DPRINTF((pcb[%2d] = %x\n, i, pcb[i]));
 }
 
-
-static inline void
-egprintstat(u_char b)
-{
-	DPRINTF((%s %s %s %s %s %s %s\n,
-		 (b  EG_STAT_HCRE)?HCRE:,
-		 (b  EG_STAT_ACRF)?ACRF:,
-		 (b  EG_STAT_DIR )?DIR :,
-		 (b  EG_STAT_DONE)?DONE:,
-		 (b  EG_STAT_ASF3)?ASF3:,
-		 (b  EG_STAT_ASF2)?ASF2:,
-		 (b  EG_STAT_ASF1)?ASF1:));
-}
-
 static int
 egoutPCB(bus_space_tag_t iot, bus_space_handle_t ioh, u_int8_t b)
 {



CVS commit: src/sys/dev/isa

2012-12-17 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Mon Dec 17 17:44:18 UTC 2012

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

Log Message:
Fix the CVS Id marker.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/isa/ptcd.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/ptcd.c
diff -u src/sys/dev/isa/ptcd.c:1.1 src/sys/dev/isa/ptcd.c:1.2
--- src/sys/dev/isa/ptcd.c:1.1	Sun Dec 16 13:09:20 2012
+++ src/sys/dev/isa/ptcd.c	Mon Dec 17 17:44:18 2012
@@ -1,4 +1,4 @@
-/* $NetBSD */
+/* $NetBSD: ptcd.c,v 1.2 2012/12/17 17:44:18 mbalmer Exp $ */
 
 /*
  * Copyright (c) 2012 Marc Balmer m...@msys.ch



CVS commit: src/sys/dev/isa

2012-12-17 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Mon Dec 17 17:46:27 UTC 2012

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

Log Message:
No need to include machine/pio.h now that inb() and outb() are no longer used.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/isa/ptcd.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/ptcd.c
diff -u src/sys/dev/isa/ptcd.c:1.2 src/sys/dev/isa/ptcd.c:1.3
--- src/sys/dev/isa/ptcd.c:1.2	Mon Dec 17 17:44:18 2012
+++ src/sys/dev/isa/ptcd.c	Mon Dec 17 17:46:27 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ptcd.c,v 1.2 2012/12/17 17:44:18 mbalmer Exp $ */
+/* $NetBSD: ptcd.c,v 1.3 2012/12/17 17:46:27 mbalmer Exp $ */
 
 /*
  * Copyright (c) 2012 Marc Balmer m...@msys.ch
@@ -36,8 +36,6 @@
 #include sys/kernel.h
 #include sys/bus.h
 
-#include machine/pio.h
-
 #include dev/gpio/gpiovar.h
 
 #include dev/isa/isareg.h



CVS commit: src/sys/dev/isa

2012-11-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 15 04:45:01 UTC 2012

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

Log Message:
Add support for ITE8720F by Nat Sloss. PR#47169.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/isa/itesio_isa.c
cvs rdiff -u -r1.8 -r1.9 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.23 src/sys/dev/isa/itesio_isa.c:1.24
--- src/sys/dev/isa/itesio_isa.c:1.23	Fri Jul 29 20:58:47 2011
+++ src/sys/dev/isa/itesio_isa.c	Thu Nov 15 04:45:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: itesio_isa.c,v 1.23 2011/07/29 20:58:47 jmcneill Exp $ */
+/*	$NetBSD: itesio_isa.c,v 1.24 2012/11/15 04:45:01 msaitoh Exp $ */
 /*	Derived from $OpenBSD: it.c,v 1.19 2006/04/10 00:57:54 deraadt Exp $	*/
 
 /*
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: itesio_isa.c,v 1.23 2011/07/29 20:58:47 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: itesio_isa.c,v 1.24 2012/11/15 04:45:01 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -140,6 +140,7 @@ itesio_isa_match(device_t parent, cfdata
 	case ITESIO_ID8712:
 	case ITESIO_ID8716:
 	case ITESIO_ID8718:
+	case ITESIO_ID8720:
 	case ITESIO_ID8721:
 	case ITESIO_ID8726:
 		ia-ia_nio = 1;

Index: src/sys/dev/isa/itesio_isavar.h
diff -u src/sys/dev/isa/itesio_isavar.h:1.8 src/sys/dev/isa/itesio_isavar.h:1.9
--- src/sys/dev/isa/itesio_isavar.h:1.8	Fri Aug 13 19:28:26 2010
+++ src/sys/dev/isa/itesio_isavar.h	Thu Nov 15 04:45:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: itesio_isavar.h,v 1.8 2010/08/13 19:28:26 jakllsch Exp $	*/
+/*	$NetBSD: itesio_isavar.h,v 1.9 2012/11/15 04:45:01 msaitoh Exp $	*/
 /*	$OpenBSD: itvar.h,v 1.2 2003/11/05 20:57:10 grange Exp $	*/
 
 /*
@@ -61,6 +61,7 @@
 #define ITESIO_ID8712	0x8712
 #define ITESIO_ID8716	0x8716
 #define ITESIO_ID8718	0x8718
+#define ITESIO_ID8720	0x8720
 #define ITESIO_ID8721	0x8721
 #define ITESIO_ID8726	0x8726
 



CVS commit: src/sys/dev/isa

2012-04-29 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Apr 29 21:13:56 UTC 2012

Modified Files:
src/sys/dev/isa: isadmavar.h

Log Message:
Patch out the 'struct malloc_type' from the isa_dma alloc routines.
All the i386 kernels now build


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/isa/isadmavar.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/isadmavar.h
diff -u src/sys/dev/isa/isadmavar.h:1.25 src/sys/dev/isa/isadmavar.h:1.26
--- src/sys/dev/isa/isadmavar.h:1.25	Tue Aug 18 16:52:42 2009
+++ src/sys/dev/isa/isadmavar.h	Sun Apr 29 21:13:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: isadmavar.h,v 1.25 2009/08/18 16:52:42 dyoung Exp $	*/
+/*	$NetBSD: isadmavar.h,v 1.26 2012/04/29 21:13:56 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -92,7 +92,6 @@ struct isa_mem {
 
 #ifdef _KERNEL
 struct proc;
-struct malloc_type;
 
 void	   _isa_dmainit(struct isa_dma_state *, bus_space_tag_t,
 	   bus_dma_tag_t, device_t);
@@ -132,6 +131,10 @@ int	   _isa_drq_alloc(struct isa_dma_sta
 int	   _isa_drq_free(struct isa_dma_state *, int);
 int	   _isa_drq_isfree(struct isa_dma_state *, int);
 
+#define _isa_malloc(dma_state, c, s, p, f) \
+_isa_malloc(dma_state, c, s, f)
+#define _isa_free(v, p) _isa_free(v)
+
 void  *_isa_malloc(struct isa_dma_state *, int, size_t,
 		struct malloc_type *, int);
 void	   _isa_free(void *, struct malloc_type *);



CVS commit: src/sys/dev/isa

2012-04-06 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Fri Apr  6 20:16:59 UTC 2012

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

Log Message:
device_pmf_is_registered() is not required


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/isa/spkr.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/spkr.c
diff -u src/sys/dev/isa/spkr.c:1.32 src/sys/dev/isa/spkr.c:1.33
--- src/sys/dev/isa/spkr.c:1.32	Wed Feb  1 02:01:28 2012
+++ src/sys/dev/isa/spkr.c	Fri Apr  6 20:16:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: spkr.c,v 1.32 2012/02/01 02:01:28 matt Exp $	*/
+/*	$NetBSD: spkr.c,v 1.33 2012/04/06 20:16:58 plunky Exp $	*/
 
 /*
  * Copyright (c) 1990 Eric S. Raymond (e...@snark.thyrsus.com)
@@ -43,7 +43,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: spkr.c,v 1.32 2012/02/01 02:01:28 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: spkr.c,v 1.33 2012/04/06 20:16:58 plunky Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -409,10 +409,8 @@ spkrattach(device_t parent, device_t sel
 	printf(\n);
 	ppicookie = ((struct pcppi_attach_args *)aux)-pa_cookie;
 	spkr_attached = 1;
-if (!device_pmf_is_registered(self)
-	 !pmf_device_register(self, NULL, NULL))
+	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, couldn't establish power handler\n); 
-
 }
 
 int



CVS commit: src/sys/dev/isa

2012-02-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb  6 04:29:47 UTC 2012

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

Log Message:
PR/45932: Add missing braces... This will probably fix interrupts too!


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/isa/tpm_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/tpm_isa.c
diff -u src/sys/dev/isa/tpm_isa.c:1.1 src/sys/dev/isa/tpm_isa.c:1.2
--- src/sys/dev/isa/tpm_isa.c:1.1	Sun Jan 22 01:44:28 2012
+++ src/sys/dev/isa/tpm_isa.c	Sun Feb  5 23:29:47 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: tpm_isa.c,v 1.1 2012/01/22 06:44:28 christos Exp $	*/
+/*	$NetBSD: tpm_isa.c,v 1.2 2012/02/06 04:29:47 christos Exp $	*/
 
 /*
  * Copyright (c) 2008, 2009 Michael Shalayeff
@@ -19,7 +19,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tpm_isa.c,v 1.1 2012/01/22 06:44:28 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: tpm_isa.c,v 1.2 2012/02/06 04:29:47 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -118,9 +118,10 @@ tpm_isa_attach(device_t parent, device_t
 	}
 
 	if ((rv = (*sc-sc_init)(sc, ia-ia_irq[0].ir_irq,
-	device_xname(sc-sc_dev))) != 0)
+	device_xname(sc-sc_dev))) != 0) {
 		bus_space_unmap(sc-sc_bt, sc-sc_bh, size);
 		return;
+	}
 
 	/*
 	 * Only setup interrupt handler when we have a vector and the



CVS commit: src/sys/dev/isa

2012-01-31 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Feb  1 02:01:29 UTC 2012

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

Log Message:
Use C89 prototypes.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/isa/spkr.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/spkr.c
diff -u src/sys/dev/isa/spkr.c:1.31 src/sys/dev/isa/spkr.c:1.32
--- src/sys/dev/isa/spkr.c:1.31	Tue Jul 27 14:34:34 2010
+++ src/sys/dev/isa/spkr.c	Wed Feb  1 02:01:28 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: spkr.c,v 1.31 2010/07/27 14:34:34 jakllsch Exp $	*/
+/*	$NetBSD: spkr.c,v 1.32 2012/02/01 02:01:28 matt Exp $	*/
 
 /*
  * Copyright (c) 1990 Eric S. Raymond (e...@snark.thyrsus.com)
@@ -43,7 +43,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: spkr.c,v 1.31 2010/07/27 14:34:34 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: spkr.c,v 1.32 2012/02/01 02:01:28 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -88,18 +88,16 @@ static void playinit(void);
 static void playtone(int, int, int);
 static void playstring(char *, int);
 
-static
-void tone(xhz, ticks)
+static void
+tone(u_int xhz, u_int ticks)
 /* emit tone of frequency hz for given number of ticks */
-u_int xhz, ticks;
 {
 	pcppi_bell(ppicookie, xhz, ticks, PCPPI_BELL_SLEEP);
 }
 
 static void
-rest(ticks)
+rest(int ticks)
 /* rest for given number of ticks */
-int	ticks;
 {
 /*
  * Set timeout to endrest function, then give up the timeslice.
@@ -182,9 +180,8 @@ playinit(void)
 }
 
 static void
-playtone(pitch, val, sustain)
+playtone(int pitch, int val, int sustain)
 /* play tone of proper duration for current rhythm signature */
-int	pitch, val, sustain;
 {
 int	sound, silence, snum = 1, sdenom = 1;
 
@@ -215,10 +212,8 @@ playtone(pitch, val, sustain)
 }
 
 static void
-playstring(cp, slen)
+playstring(char *cp, int slen)
 /* interpret and play an item from a notation string */
-char	*cp;
-int		slen;
 {
 int		pitch, lastpitch = OCTAVE_NOTES * DFLT_OCTAVE;
 
@@ -414,10 +409,9 @@ spkrattach(device_t parent, device_t sel
 	printf(\n);
 	ppicookie = ((struct pcppi_attach_args *)aux)-pa_cookie;
 	spkr_attached = 1;
-if (!device_pmf_is_registered(self))
-		if (!pmf_device_register(self, NULL, NULL))
-			aprint_error_dev(self,
-			couldn't establish power handler\n); 
+if (!device_pmf_is_registered(self)
+	 !pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, couldn't establish power handler\n); 
 
 }
 
@@ -463,8 +457,8 @@ spkrwrite(dev_t dev, struct uio *uio, in
 }
 }
 
-int spkrclose(dev_t dev, int flags, int mode,
-struct lwp *l)
+int
+spkrclose(dev_t dev, int flags, int mode, struct lwp *l)
 {
 #ifdef SPKRDEBUG
 printf(spkrclose: entering with dev = %PRIx64\n, dev);
@@ -481,8 +475,8 @@ int spkrclose(dev_t dev, int flags, int 
 return(0);
 }
 
-int spkrioctl(dev_t dev, u_long cmd, void *data, int	flag,
-struct lwp *l)
+int
+spkrioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
 {
 #ifdef SPKRDEBUG
 printf(spkrioctl: entering with dev = %PRIx64, cmd = %lx\n, dev, cmd);



CVS commit: src/sys/dev/isa

2012-01-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Jan 17 16:28:34 UTC 2012

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

Log Message:
Add NULL pmf handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/isa/wbsio.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/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.3 src/sys/dev/isa/wbsio.c:1.4
--- src/sys/dev/isa/wbsio.c:1.3	Wed May 18 01:03:15 2011
+++ src/sys/dev/isa/wbsio.c	Tue Jan 17 16:28:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.3 2011/05/18 01:03:15 dyoung Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.4 2012/01/17 16:28:33 jakllsch Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.5 2009/03/29 21:53:52 sthen Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis kette...@openbsd.org
@@ -216,6 +216,9 @@ wbsio_attach(device_t parent, device_t s
 	/* Escape from configuration mode */
 	wbsio_conf_disable(sc-sc_iot, sc-sc_ioh);
 
+	if (!pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, couldn't establish power handler\n);
+
 	if (iobase == 0)
 		return;
 



CVS commit: src/sys/dev/isa

2012-01-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Jan 17 16:32:04 UTC 2012

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

Log Message:
Add and enable detachment and child detachment functions.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/isa/wbsio.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/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.4 src/sys/dev/isa/wbsio.c:1.5
--- src/sys/dev/isa/wbsio.c:1.4	Tue Jan 17 16:28:33 2012
+++ src/sys/dev/isa/wbsio.c	Tue Jan 17 16:32:03 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.4 2012/01/17 16:28:33 jakllsch Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.5 2012/01/17 16:32:03 jakllsch Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.5 2009/03/29 21:53:52 sthen Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis kette...@openbsd.org
@@ -69,10 +69,12 @@ struct wbsio_softc {
 
 int	wbsio_probe(device_t, cfdata_t, void *);
 void	wbsio_attach(device_t, device_t, void *);
+int	wbsio_detach(device_t, int);
+void	wbsio_childdet(device_t, device_t);
 int	wbsio_print(void *, const char *);
 
-CFATTACH_DECL_NEW(wbsio, sizeof(struct wbsio_softc),
-wbsio_probe, wbsio_attach, NULL, NULL);
+CFATTACH_DECL2_NEW(wbsio, sizeof(struct wbsio_softc),
+wbsio_probe, wbsio_attach, wbsio_detach, NULL, NULL, wbsio_childdet);
 
 static __inline void
 wbsio_conf_enable(bus_space_tag_t iot, bus_space_handle_t ioh)
@@ -228,6 +230,24 @@ wbsio_attach(device_t parent, device_t s
 }
 
 int
+wbsio_detach(device_t self, int flags)
+{
+	int rc;
+
+	if ((rc = config_detach_children(self, flags)) != 0)
+		return rc;
+	bus_space_unmap(sc-sc_iot, sc-sc_ioh, WBSIO_IOSIZE);
+	pmf_device_deregister(self);
+	return 0;
+}
+
+void
+wbsio_childdet(device_t self, device_t child)
+{
+	return;
+}
+
+int
 wbsio_print(void *aux, const char *pnp)
 {
 	struct isa_attach_args *ia = aux;



CVS commit: src/sys/dev/isa

2012-01-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Jan 17 16:34:52 UTC 2012

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

Log Message:
Add module glue.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/isa/wbsio.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/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.5 src/sys/dev/isa/wbsio.c:1.6
--- src/sys/dev/isa/wbsio.c:1.5	Tue Jan 17 16:32:03 2012
+++ src/sys/dev/isa/wbsio.c	Tue Jan 17 16:34:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.5 2012/01/17 16:32:03 jakllsch Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.6 2012/01/17 16:34:52 jakllsch Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.5 2009/03/29 21:53:52 sthen Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis kette...@openbsd.org
@@ -23,6 +23,7 @@
 #include sys/param.h
 #include sys/device.h
 #include sys/kernel.h
+#include sys/module.h
 #include sys/systm.h
 
 #include sys/bus.h
@@ -261,3 +262,32 @@ wbsio_print(void *aux, const char *pnp)
 		ia-ia_io[0].ir_size - 1);
 	return (UNCONF);
 }
+
+MODULE(MODULE_CLASS_DRIVER, wbsio, );
+
+#ifdef _MODULE
+#include ioconf.c
+#endif
+
+static int
+wbsio_modcmd(modcmd_t cmd, void *opaque)
+{
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+#ifdef _MODULE
+		return config_init_component(cfdriver_ioconf_wbsio,
+		cfattach_ioconf_wbsio, cfdata_ioconf_wbsio);
+#else
+		return 0;
+#endif
+	case MODULE_CMD_FINI:
+#ifdef _MODULE
+		return config_fini_component(cfdriver_ioconf_wbsio,
+		cfattach_ioconf_wbsio, cfdata_ioconf_wbsio);
+#else
+		return 0;
+#endif
+	default:
+		return ENOTTY;
+	}
+}



CVS commit: src/sys/dev/isa

2012-01-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Jan 17 17:17:15 UTC 2012

Modified Files:
src/sys/dev/isa: lm_isa_common.c wbsio.c

Log Message:
No module dependencies are denoted with NULL.  Pointed out by jmcneill.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/isa/lm_isa_common.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/isa/wbsio.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/lm_isa_common.c
diff -u src/sys/dev/isa/lm_isa_common.c:1.1 src/sys/dev/isa/lm_isa_common.c:1.2
--- src/sys/dev/isa/lm_isa_common.c:1.1	Tue Jan 17 16:50:07 2012
+++ src/sys/dev/isa/lm_isa_common.c	Tue Jan 17 17:17:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: lm_isa_common.c,v 1.1 2012/01/17 16:50:07 jakllsch Exp $ */
+/*	$NetBSD: lm_isa_common.c,v 1.2 2012/01/17 17:17:15 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lm_isa_common.c,v 1.1 2012/01/17 16:50:07 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: lm_isa_common.c,v 1.2 2012/01/17 17:17:15 jakllsch Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -161,7 +161,7 @@ lm_isa_writereg(struct lm_softc *lmsc, i
 	bus_space_write_1(sc-lm_iot, sc-lm_ioh, LMC_DATA, val);
 }
 
-MODULE(MODULE_CLASS_DRIVER, lm_isa_common, );
+MODULE(MODULE_CLASS_DRIVER, lm_isa_common, NULL);
 
 static int
 lm_isa_common_modcmd(modcmd_t cmd, void *priv)

Index: src/sys/dev/isa/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.6 src/sys/dev/isa/wbsio.c:1.7
--- src/sys/dev/isa/wbsio.c:1.6	Tue Jan 17 16:34:52 2012
+++ src/sys/dev/isa/wbsio.c	Tue Jan 17 17:17:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.6 2012/01/17 16:34:52 jakllsch Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.7 2012/01/17 17:17:15 jakllsch Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.5 2009/03/29 21:53:52 sthen Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis kette...@openbsd.org
@@ -263,7 +263,7 @@ wbsio_print(void *aux, const char *pnp)
 	return (UNCONF);
 }
 
-MODULE(MODULE_CLASS_DRIVER, wbsio, );
+MODULE(MODULE_CLASS_DRIVER, wbsio, NULL);
 
 #ifdef _MODULE
 #include ioconf.c



CVS commit: src/sys/dev/isa

2012-01-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Jan 17 18:04:46 UTC 2012

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

Log Message:
Make this compile.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/isa/wbsio.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/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.7 src/sys/dev/isa/wbsio.c:1.8
--- src/sys/dev/isa/wbsio.c:1.7	Tue Jan 17 17:17:15 2012
+++ src/sys/dev/isa/wbsio.c	Tue Jan 17 18:04:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.7 2012/01/17 17:17:15 jakllsch Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.8 2012/01/17 18:04:46 jakllsch Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.5 2009/03/29 21:53:52 sthen Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis kette...@openbsd.org
@@ -153,7 +153,7 @@ wbsio_probe(device_t parent, cfdata_t ma
 void
 wbsio_attach(device_t parent, device_t self, void *aux)
 {
-	struct wbsio_softc *sc = (void *)self;
+	struct wbsio_softc *sc = device_private(self);
 	struct isa_attach_args *ia = aux;
 	struct isa_attach_args nia;
 	const char *desc = NULL;
@@ -233,6 +233,7 @@ wbsio_attach(device_t parent, device_t s
 int
 wbsio_detach(device_t self, int flags)
 {
+	struct wbsio_softc *sc = device_private(self);
 	int rc;
 
 	if ((rc = config_detach_children(self, flags)) != 0)



CVS commit: src/sys/dev/isa

2012-01-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Jan 17 18:05:15 UTC 2012

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

Log Message:
update for wbsio and lm changes


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/dev/isa/files.isa

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/files.isa
diff -u src/sys/dev/isa/files.isa:1.160 src/sys/dev/isa/files.isa:1.161
--- src/sys/dev/isa/files.isa:1.160	Sun Jun 13 03:09:32 2010
+++ src/sys/dev/isa/files.isa	Tue Jan 17 18:05:15 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.isa,v 1.160 2010/06/13 03:09:32 tsutsui Exp $
+#	$NetBSD: files.isa,v 1.161 2012/01/17 18:05:15 jakllsch Exp $
 #
 # Config file and device description for machine-independent ISA code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -459,7 +459,9 @@ file	dev/isa/wbsio.c			wbsio
 # LM78 temp/fanspeed monitor
 attach	lm at isa with lm_isa
 attach	lm at wbsio with lm_wbsio
-file	dev/isa/lm_isa.c		lm_isa | lm_wbsio
+file	dev/isa/lm_isa_common.c		lm_isa | lm_wbsio
+file	dev/isa/lm_isa.c		lm_isa
+file	dev/isa/lm_wbsio.c		lm_wbsio
 
 # iTE Super I/O with hardware monitor
 device	itesio: sysmon_envsys, sysmon_wdog



CVS commit: src/sys/dev/isa

2012-01-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Jan 18 00:11:43 UTC 2012

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

Log Message:
Improve module dependencies, clean up old #if 0 code.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/isa/lm_isa_common.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/lm_isa_common.c
diff -u src/sys/dev/isa/lm_isa_common.c:1.2 src/sys/dev/isa/lm_isa_common.c:1.3
--- src/sys/dev/isa/lm_isa_common.c:1.2	Tue Jan 17 17:17:15 2012
+++ src/sys/dev/isa/lm_isa_common.c	Wed Jan 18 00:11:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: lm_isa_common.c,v 1.2 2012/01/17 17:17:15 jakllsch Exp $ */
+/*	$NetBSD: lm_isa_common.c,v 1.3 2012/01/18 00:11:43 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lm_isa_common.c,v 1.2 2012/01/17 17:17:15 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: lm_isa_common.c,v 1.3 2012/01/18 00:11:43 jakllsch Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -59,14 +59,6 @@ struct lm_isa_softc {
 	bus_space_handle_t lm_ioh;
 };
 
-#if 0
-CFATTACH_DECL_NEW(lm_isa, sizeof(struct lm_isa_softc),
-lm_isa_match, lm_isa_attach, lm_isa_detach, NULL);
-
-CFATTACH_DECL_NEW(lm_wbsio, sizeof(struct lm_isa_softc),
-lm_isa_match, lm_isa_attach, lm_isa_detach, NULL);
-#endif
-
 int
 lm_isa_match(device_t parent, cfdata_t match, void *aux)
 {
@@ -161,7 +153,7 @@ lm_isa_writereg(struct lm_softc *lmsc, i
 	bus_space_write_1(sc-lm_iot, sc-lm_ioh, LMC_DATA, val);
 }
 
-MODULE(MODULE_CLASS_DRIVER, lm_isa_common, NULL);
+MODULE(MODULE_CLASS_DRIVER, lm_isa_common, lm);
 
 static int
 lm_isa_common_modcmd(modcmd_t cmd, void *priv)



CVS commit: src/sys/dev/isa

2012-01-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Jan 18 00:14:32 UTC 2012

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

Log Message:
Improve module dependency list.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/isa/lm_wbsio.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/lm_wbsio.c
diff -u src/sys/dev/isa/lm_wbsio.c:1.1 src/sys/dev/isa/lm_wbsio.c:1.2
--- src/sys/dev/isa/lm_wbsio.c:1.1	Tue Jan 17 16:50:07 2012
+++ src/sys/dev/isa/lm_wbsio.c	Wed Jan 18 00:14:32 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: lm_wbsio.c,v 1.1 2012/01/17 16:50:07 jakllsch Exp $ */
+/*	$NetBSD: lm_wbsio.c,v 1.2 2012/01/18 00:14:32 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lm_wbsio.c,v 1.1 2012/01/17 16:50:07 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: lm_wbsio.c,v 1.2 2012/01/18 00:14:32 jakllsch Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -49,7 +49,7 @@ __KERNEL_RCSID(0, $NetBSD: lm_wbsio.c,v
 CFATTACH_DECL_NEW(lm_wbsio, sizeof(struct lm_isa_softc),
 lm_isa_match, lm_isa_attach, lm_isa_detach, NULL);
 
-MODULE(MODULE_CLASS_DRIVER, lm_wbsio, lm_isa_common);
+MODULE(MODULE_CLASS_DRIVER, lm_wbsio, lm_isa_common,wbsio);
 
 #ifdef _MODULE
 #include ioconf.c



CVS commit: src/sys/dev/isa

2012-01-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Jan 18 00:23:30 UTC 2012

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

Log Message:
wbsio(4) rescan support.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/isa/wbsio.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/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.8 src/sys/dev/isa/wbsio.c:1.9
--- src/sys/dev/isa/wbsio.c:1.8	Tue Jan 17 18:04:46 2012
+++ src/sys/dev/isa/wbsio.c	Wed Jan 18 00:23:30 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.8 2012/01/17 18:04:46 jakllsch Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.9 2012/01/18 00:23:30 jakllsch Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.5 2009/03/29 21:53:52 sthen Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis kette...@openbsd.org
@@ -62,20 +62,28 @@
 #define WBSIO_HM_ADDR_LSB	0x61	/* Address [7:0] */
 
 struct wbsio_softc {
-	struct device		sc_dev;
+	device_t	sc_dev;
+	device_t	sc_lm_dev;
 
 	bus_space_tag_t		sc_iot;
 	bus_space_handle_t	sc_ioh;
+
+	struct isa_attach_args	sc_ia;
+	struct isa_io		sc_io;
 };
 
 int	wbsio_probe(device_t, cfdata_t, void *);
 void	wbsio_attach(device_t, device_t, void *);
 int	wbsio_detach(device_t, int);
+int	wbsio_rescan(device_t, const char *, const int *);
 void	wbsio_childdet(device_t, device_t);
 int	wbsio_print(void *, const char *);
 
+static int wbsio_search(device_t, cfdata_t, const int *, void *);
+
 CFATTACH_DECL2_NEW(wbsio, sizeof(struct wbsio_softc),
-wbsio_probe, wbsio_attach, wbsio_detach, NULL, NULL, wbsio_childdet);
+wbsio_probe, wbsio_attach, wbsio_detach, NULL,
+wbsio_rescan, wbsio_childdet);
 
 static __inline void
 wbsio_conf_enable(bus_space_tag_t iot, bus_space_handle_t ioh)
@@ -90,16 +98,16 @@ wbsio_conf_disable(bus_space_tag_t iot, 
 	bus_space_write_1(iot, ioh, WBSIO_INDEX, WBSIO_CONF_DS_MAGIC);
 }
 
-static __inline u_int8_t
-wbsio_conf_read(bus_space_tag_t iot, bus_space_handle_t ioh, u_int8_t index)
+static __inline uint8_t
+wbsio_conf_read(bus_space_tag_t iot, bus_space_handle_t ioh, uint8_t index)
 {
 	bus_space_write_1(iot, ioh, WBSIO_INDEX, index);
 	return (bus_space_read_1(iot, ioh, WBSIO_DATA));
 }
 
 static __inline void
-wbsio_conf_write(bus_space_tag_t iot, bus_space_handle_t ioh, u_int8_t index,
-u_int8_t data)
+wbsio_conf_write(bus_space_tag_t iot, bus_space_handle_t ioh, uint8_t index,
+uint8_t data)
 {
 	bus_space_write_1(iot, ioh, WBSIO_INDEX, index);
 	bus_space_write_1(iot, ioh, WBSIO_DATA, data);
@@ -111,7 +119,7 @@ wbsio_probe(device_t parent, cfdata_t ma
 	struct isa_attach_args *ia = aux;
 	bus_space_tag_t iot;
 	bus_space_handle_t ioh;
-	u_int8_t reg;
+	uint8_t reg;
 
 	/* Must supply an address */
 	if (ia-ia_nio  1)
@@ -155,10 +163,12 @@ wbsio_attach(device_t parent, device_t s
 {
 	struct wbsio_softc *sc = device_private(self);
 	struct isa_attach_args *ia = aux;
-	struct isa_attach_args nia;
 	const char *desc = NULL;
-	u_int8_t reg, reg0, reg1;
-	u_int16_t iobase;
+	uint8_t reg;
+
+	sc-sc_dev = self;
+
+	sc-sc_ia = *ia;
 
 	/* Map ISA I/O space */
 	sc-sc_iot = ia-ia_iot;
@@ -203,31 +213,13 @@ wbsio_attach(device_t parent, device_t s
 	aprint_naive(\n);
 	aprint_normal(: Winbond LPC Super I/O %s rev 0x%02x\n, desc, reg);
 
-	/* Select HM logical device */
-	wbsio_conf_write(sc-sc_iot, sc-sc_ioh, WBSIO_LDN, WBSIO_LDN_HM);
-
-	/*
-	 * The address should be 8-byte aligned, but it seems some
-	 * BIOSes ignore this.  They get away with it, because
-	 * Apparently the hardware simply ignores the lower three
-	 * bits.  We do the same here.
-	 */
-	reg0 = wbsio_conf_read(sc-sc_iot, sc-sc_ioh, WBSIO_HM_ADDR_LSB);
-	reg1 = wbsio_conf_read(sc-sc_iot, sc-sc_ioh, WBSIO_HM_ADDR_MSB);
-	iobase = (reg1  8) | (reg0  ~0x7);
-
 	/* Escape from configuration mode */
 	wbsio_conf_disable(sc-sc_iot, sc-sc_ioh);
 
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, couldn't establish power handler\n);
 
-	if (iobase == 0)
-		return;
-
-	nia = *ia;
-	nia.ia_io[0].ir_addr = iobase;
-	config_found(self, nia, wbsio_print);
+	wbsio_rescan(self, wbsio, NULL);
 }
 
 int
@@ -243,10 +235,64 @@ wbsio_detach(device_t self, int flags)
 	return 0;
 }
 
+int
+wbsio_rescan(device_t self, const char *ifattr, const int *locators)
+{
+
+	config_search_loc(wbsio_search, self, ifattr, locators, NULL);
+
+	return 0;
+}
+
 void
 wbsio_childdet(device_t self, device_t child)
 {
-	return;
+	struct wbsio_softc *sc = device_private(self);
+
+	if (sc-sc_lm_dev == child)
+		sc-sc_lm_dev = NULL;
+}
+
+static int
+wbsio_search(device_t parent, cfdata_t cf, const int *slocs, void *aux)
+{
+	struct wbsio_softc *sc = device_private(parent);
+	uint16_t iobase;
+	uint8_t reg0, reg1;
+
+	/* Enter configuration mode */
+	wbsio_conf_enable(sc-sc_iot, sc-sc_ioh);
+
+	/* Select HM logical device */
+	wbsio_conf_write(sc-sc_iot, sc-sc_ioh, WBSIO_LDN, WBSIO_LDN_HM);
+
+	/*
+	 * The address should be 8-byte aligned, 

CVS commit: src/sys/dev/isa

2011-11-26 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Sat Nov 26 15:54:52 UTC 2011

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

Log Message:
stopgap fix to avoid panic due to recursive locking if the keyboard beep
is activated through a tty (which it usually is)
IMO it was no good idea to abuse tty_lock here - it is already
problematic in the tty subsystem


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/isa/pcppi.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/pcppi.c
diff -u src/sys/dev/isa/pcppi.c:1.40 src/sys/dev/isa/pcppi.c:1.41
--- src/sys/dev/isa/pcppi.c:1.40	Fri Nov 25 22:40:02 2011
+++ src/sys/dev/isa/pcppi.c	Sat Nov 26 15:54:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pcppi.c,v 1.40 2011/11/25 22:40:02 riastradh Exp $ */
+/* $NetBSD: pcppi.c,v 1.41 2011/11/26 15:54:51 drochner Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pcppi.c,v 1.40 2011/11/25 22:40:02 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: pcppi.c,v 1.41 2011/11/26 15:54:51 drochner Exp $);
 
 #include attimer.h
 
@@ -358,7 +358,7 @@ pcppi_pckbd_bell(void *arg, u_int pitch,
 	/*
 	 * Comes in as ms, goes out at ticks; volume ignored.
 	 */
-	pcppi_bell(arg, pitch, (period * hz) / 1000,
+	pcppi_bell_locked(arg, pitch, (period * hz) / 1000,
 	poll ? PCPPI_BELL_POLL : 0);
 }
 #endif /* NPCKBD  0 */



CVS commit: src/sys/dev/isa

2011-11-25 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Nov 25 14:31:44 UTC 2011

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

Log Message:
Make locking in pcppi_pckbd_bell() work.  Works around locking problems
triggered when an X server rings the console bell.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/isa/pcppi.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/pcppi.c
diff -u src/sys/dev/isa/pcppi.c:1.38 src/sys/dev/isa/pcppi.c:1.39
--- src/sys/dev/isa/pcppi.c:1.38	Wed Nov 23 23:07:32 2011
+++ src/sys/dev/isa/pcppi.c	Fri Nov 25 14:31:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pcppi.c,v 1.38 2011/11/23 23:07:32 jmcneill Exp $ */
+/* $NetBSD: pcppi.c,v 1.39 2011/11/25 14:31:44 jakllsch Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pcppi.c,v 1.38 2011/11/23 23:07:32 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: pcppi.c,v 1.39 2011/11/25 14:31:44 jakllsch Exp $);
 
 #include attimer.h
 
@@ -355,12 +355,12 @@ pcppi_pckbd_bell(void *arg, u_int pitch,
 int poll)
 {
 
-	KASSERT(mutex_owned(tty_lock));
+	KASSERT(!mutex_owned(tty_lock));
 
 	/*
 	 * Comes in as ms, goes out at ticks; volume ignored.
 	 */
-	pcppi_bell_locked(arg, pitch, (period * hz) / 1000,
+	pcppi_bell(arg, pitch, (period * hz) / 1000,
 	poll ? PCPPI_BELL_POLL : 0);
 }
 #endif /* NPCKBD  0 */



CVS commit: src/sys/dev/isa

2011-11-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Nov 25 22:40:02 UTC 2011

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

Log Message:
KASSERT(!mutex_owned(...)) is not kosher.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/isa/pcppi.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/pcppi.c
diff -u src/sys/dev/isa/pcppi.c:1.39 src/sys/dev/isa/pcppi.c:1.40
--- src/sys/dev/isa/pcppi.c:1.39	Fri Nov 25 14:31:44 2011
+++ src/sys/dev/isa/pcppi.c	Fri Nov 25 22:40:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pcppi.c,v 1.39 2011/11/25 14:31:44 jakllsch Exp $ */
+/* $NetBSD: pcppi.c,v 1.40 2011/11/25 22:40:02 riastradh Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pcppi.c,v 1.39 2011/11/25 14:31:44 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: pcppi.c,v 1.40 2011/11/25 22:40:02 riastradh Exp $);
 
 #include attimer.h
 
@@ -355,8 +355,6 @@ pcppi_pckbd_bell(void *arg, u_int pitch,
 int poll)
 {
 
-	KASSERT(!mutex_owned(tty_lock));
-
 	/*
 	 * Comes in as ms, goes out at ticks; volume ignored.
 	 */



CVS commit: src/sys/dev/isa

2011-11-24 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Nov 24 16:07:28 UTC 2011

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

Log Message:
Make this compile without warnings.
(No static is better than inconsistent and partial use of static.)


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/isa/aria.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/aria.c
diff -u src/sys/dev/isa/aria.c:1.35 src/sys/dev/isa/aria.c:1.36
--- src/sys/dev/isa/aria.c:1.35	Thu Nov 24 03:35:57 2011
+++ src/sys/dev/isa/aria.c	Thu Nov 24 16:07:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: aria.c,v 1.35 2011/11/24 03:35:57 mrg Exp $	*/
+/*	$NetBSD: aria.c,v 1.36 2011/11/24 16:07:28 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1996, 1998 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: aria.c,v 1.35 2011/11/24 03:35:57 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: aria.c,v 1.36 2011/11/24 16:07:28 jakllsch Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1668,7 +1668,7 @@ mute:
 	return 0;
 }
 
-static void
+void
 aria_get_locks(void *addr, kmutex_t **intr, kmutex_t **thread)
 {
 	struct aria_softc *sc;



CVS commit: src/sys/dev/isa

2011-11-24 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Nov 24 16:11:02 UTC 2011

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

Log Message:
This hopefully completes the audiomp conversion of cms(4).


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/isa/cms.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/cms.c
diff -u src/sys/dev/isa/cms.c:1.19 src/sys/dev/isa/cms.c:1.20
--- src/sys/dev/isa/cms.c:1.19	Wed Nov 23 23:07:32 2011
+++ src/sys/dev/isa/cms.c	Thu Nov 24 16:11:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cms.c,v 1.19 2011/11/23 23:07:32 jmcneill Exp $ */
+/* $NetBSD: cms.c,v 1.20 2011/11/24 16:11:02 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cms.c,v 1.19 2011/11/23 23:07:32 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: cms.c,v 1.20 2011/11/24 16:11:02 jakllsch Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -60,6 +60,8 @@ int	cmsdebug = 0;
 struct cms_softc {
 	struct midi_softc sc_mididev;
 
+	kmutex_t sc_lock;
+
 	bus_space_tag_t sc_iot;
 	bus_space_handle_t sc_ioh;
 
@@ -166,6 +168,7 @@ cms_attach(device_t parent, device_t sel
 	struct audio_attach_args arg;
 
 	sc-sc_mididev.dev = self;
+	mutex_init(sc-sc_lock, MUTEX_DEFAULT, IPL_AUDIO);
 
 	aprint_normal(\n);
 



CVS commit: src/sys/dev/isa

2011-08-07 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Aug  7 19:46:22 UTC 2011

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

Log Message:
Appease _LP64 build with GCC 4.5.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/isa/dpt_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/dpt_isa.c
diff -u src/sys/dev/isa/dpt_isa.c:1.20 src/sys/dev/isa/dpt_isa.c:1.21
--- src/sys/dev/isa/dpt_isa.c:1.20	Tue May 12 09:10:15 2009
+++ src/sys/dev/isa/dpt_isa.c	Sun Aug  7 19:46:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: dpt_isa.c,v 1.20 2009/05/12 09:10:15 cegger Exp $	*/
+/*	$NetBSD: dpt_isa.c,v 1.21 2011/08/07 19:46:22 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Andrew Doran a...@netbsd.org
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dpt_isa.c,v 1.20 2009/05/12 09:10:15 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: dpt_isa.c,v 1.21 2011/08/07 19:46:22 jakllsch Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -171,7 +171,7 @@
 	 */
 	bus_space_write_1(iot, ioh, HA_COMMAND, CP_PIO_GETCFG);
 	memset(ec, 0, sizeof(ec));
-	i = ((int)((struct eata_cfg *)0)-ec_cfglen +
+	i = ((uintptr_t)((struct eata_cfg *)0)-ec_cfglen +
 	sizeof(ec.ec_cfglen))  1;
 	p = (u_int16_t *)ec;
 
@@ -183,13 +183,13 @@
 		*p++ = bus_space_read_stream_2(iot, ioh, HA_DATA);
 
 	if ((i = ec.ec_cfglen)  (sizeof(struct eata_cfg)
-	- (int)struct eata_cfg *)0L)-ec_cfglen))
+	- (uintptr_t)struct eata_cfg *)0L)-ec_cfglen))
 	- sizeof(ec.ec_cfglen)))
 		i = sizeof(struct eata_cfg)
-		  - (int)struct eata_cfg *)0L)-ec_cfglen))
+		  - (uintptr_t)struct eata_cfg *)0L)-ec_cfglen))
 		  - sizeof(ec.ec_cfglen);
 
-	j = i + (int)struct eata_cfg *)0L)-ec_cfglen)) +
+	j = i + (uintptr_t)struct eata_cfg *)0L)-ec_cfglen)) +
 	sizeof(ec.ec_cfglen);
 	i = 1;
 



CVS commit: src/sys/dev/isa

2011-07-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul 31 16:18:54 UTC 2011

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

Log Message:
modularize


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 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/smsc.c
diff -u src/sys/dev/isa/smsc.c:1.10 src/sys/dev/isa/smsc.c:1.11
--- src/sys/dev/isa/smsc.c:1.10	Mon Jun 20 18:12:54 2011
+++ src/sys/dev/isa/smsc.c	Sun Jul 31 16:18:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: smsc.c,v 1.10 2011/06/20 18:12:54 pgoyette Exp $ */
+/*	$NetBSD: smsc.c,v 1.11 2011/07/31 16:18:54 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -40,11 +40,12 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: smsc.c,v 1.10 2011/06/20 18:12:54 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: smsc.c,v 1.11 2011/07/31 16:18:54 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/device.h
+#include sys/module.h
 #include sys/bus.h
 
 #include dev/isa/isareg.h
@@ -341,3 +342,32 @@
 		break;
 	}
 }
+
+MODULE(MODULE_CLASS_DRIVER, smsc, NULL);
+
+#ifdef _MODULE
+#include ioconf.c
+#endif
+
+static int
+smsc_modcmd(modcmd_t cmd, void *opaque)
+{
+	int error = 0;
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+#ifdef _MODULE
+		error = config_init_component(cfdriver_ioconf_smsc,
+		cfattach_ioconf_smsc, cfdata_ioconf_smsc);
+#endif
+		return error;
+	case MODULE_CMD_FINI:
+#ifdef _MODULE
+		error = config_fini_component(cfdriver_ioconf_smsc,
+		cfattach_ioconf_smsc, cfdata_ioconf_smsc);
+#endif
+		return error;
+	default:
+		return ENOTTY;
+	}
+}



CVS commit: src/sys/dev/isa

2011-07-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul 31 17:53:26 UTC 2011

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

Log Message:
modularize and recognize ASUS F8000 Super I/O chips


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/isa/finsio_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/finsio_isa.c
diff -u src/sys/dev/isa/finsio_isa.c:1.5 src/sys/dev/isa/finsio_isa.c:1.6
--- src/sys/dev/isa/finsio_isa.c:1.5	Mon Jun 20 18:12:54 2011
+++ src/sys/dev/isa/finsio_isa.c	Sun Jul 31 17:53:26 2011
@@ -1,5 +1,5 @@
 /*	$OpenBSD: fins.c,v 1.1 2008/03/19 19:33:09 deraadt Exp $	*/
-/*	$NetBSD: finsio_isa.c,v 1.5 2011/06/20 18:12:54 pgoyette Exp $	*/
+/*	$NetBSD: finsio_isa.c,v 1.6 2011/07/31 17:53:26 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2008 Juan Romero Pardines
@@ -19,11 +19,12 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: finsio_isa.c,v 1.5 2011/06/20 18:12:54 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: finsio_isa.c,v 1.6 2011/07/31 17:53:26 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/device.h
+#include sys/module.h
 #include sys/bus.h
 
 #include dev/isa/isareg.h
@@ -73,6 +74,7 @@
 # define FINSIO_IDF71806 	0x0341	/* F71872 and F1806 F/FG */
 # define FINSIO_IDF71883	0x0541	/* F71882 and F1883 */
 # define FINSIO_IDF71862 	0x0601	/* F71862FG */
+# define FINSIO_IDF8000 	0x0581	/* F8000 */
 
 /* in bank sensors of config space */
 #define FINSIO_SENSADDR	0x60	/* sensors assigned I/O address (2 bytes) */
@@ -418,7 +420,7 @@
 
 	{	.fs_desc = NULL }
 };
-			
+
 static int
 finsio_isa_match(device_t parent, cfdata_t match, void *aux)
 {
@@ -510,6 +512,10 @@
 		sc-sc_finsio_sensors = f71883_sensors;
 		aprint_normal(: Fintek F71882/F71883 Super I/O\n);
 		break;
+	case FINSIO_IDF8000:
+		sc-sc_finsio_sensors = f71883_sensors;
+		aprint_normal(: ASUS F8000 Super I/O\n);
+		break;
 	default:
 		/* 
 		 * Unknown Chip ID, assume the same register layout
@@ -682,3 +688,32 @@
 		edata-state = ENVSYS_SVALID;
 	}
 }
+
+MODULE(MODULE_CLASS_DRIVER, finsio, NULL);
+
+#ifdef _MODULE
+#include ioconf.c
+#endif
+
+static int
+finsio_modcmd(modcmd_t cmd, void *opaque)
+{
+	int error = 0;
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+#ifdef _MODULE
+		error = config_init_component(cfdriver_ioconf_finsio,
+		cfattach_ioconf_finsio, cfdata_ioconf_finsio);
+#endif
+		return error;
+	case MODULE_CMD_FINI:
+#ifdef _MODULE
+		error = config_fini_component(cfdriver_ioconf_finsio,
+		cfattach_ioconf_finsio, cfdata_ioconf_finsio);
+#endif
+		return error;
+	default:
+		return ENOTTY;
+	}
+}



CVS commit: src/sys/dev/isa

2011-07-31 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jul 31 18:23:46 UTC 2011

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

Log Message:
The Fintek base address registers implement the bottom 3 bits as read/write,
but the address decoder in the chip ignores these three bits.  Do the same.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/isa/finsio_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/finsio_isa.c
diff -u src/sys/dev/isa/finsio_isa.c:1.6 src/sys/dev/isa/finsio_isa.c:1.7
--- src/sys/dev/isa/finsio_isa.c:1.6	Sun Jul 31 17:53:26 2011
+++ src/sys/dev/isa/finsio_isa.c	Sun Jul 31 18:23:46 2011
@@ -1,5 +1,5 @@
 /*	$OpenBSD: fins.c,v 1.1 2008/03/19 19:33:09 deraadt Exp $	*/
-/*	$NetBSD: finsio_isa.c,v 1.6 2011/07/31 17:53:26 jmcneill Exp $	*/
+/*	$NetBSD: finsio_isa.c,v 1.7 2011/07/31 18:23:46 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2008 Juan Romero Pardines
@@ -19,7 +19,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: finsio_isa.c,v 1.6 2011/07/31 17:53:26 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: finsio_isa.c,v 1.7 2011/07/31 18:23:46 jakllsch Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -57,14 +57,10 @@
 #  define FINSIO_FUNC_HWMON 0x4
 
 /* ISA registers index to an internal register space on chip */
-#define FINSIO_ADDR	0	/* global configuration index registers */
-#define FINSIO_DATA	1
-
-/* 
- * The F71882/F71883 chips use a different Hardware Monitor
- * address offset.
- */
-#define FINSIO_F71882_HWM_OFFSET	5
+#define FINSIO_DECODE_SIZE (8)
+#define FINSIO_DECODE_MASK (FINSIO_DECODE_SIZE - 1)
+#define FINSIO_ADDR	5	/* global configuration index */
+#define FINSIO_DATA	6	/* and data registers */
 
 /* Global configuration registers */
 #define FINSIO_MANUF	0x23	/* manufacturer ID */
@@ -493,6 +489,11 @@
 	finsio_exit(sc-sc_iot, ioh);
 	bus_space_unmap(sc-sc_iot, ioh, 2);
 
+	/*
+	 * The address decoder ignores the bottom 3 bits, so do we.
+	 */
+	hwmon_baddr = ~FINSIO_DECODE_MASK;
+
 	switch (chipid) {
 	case FINSIO_IDF71805:
 		sc-sc_finsio_sensors = f71805_sensors;
@@ -503,12 +504,10 @@
 		aprint_normal(: Fintek F71806/F71872 Super I/O\n);
 		break;
 	case FINSIO_IDF71862:
-		hwmon_baddr += FINSIO_F71882_HWM_OFFSET;
 		sc-sc_finsio_sensors = f71883_sensors;
 		aprint_normal(: Fintek F71862 Super I/O\n);
 		break;
 	case FINSIO_IDF71883:
-		hwmon_baddr += FINSIO_F71882_HWM_OFFSET;
 		sc-sc_finsio_sensors = f71883_sensors;
 		aprint_normal(: Fintek F71882/F71883 Super I/O\n);
 		break;
@@ -528,7 +527,8 @@
 	}
 
 	/* Map Hardware Monitor I/O space */
-	if (bus_space_map(sc-sc_iot, hwmon_baddr, 2, 0, sc-sc_ioh)) {
+	if (bus_space_map(sc-sc_iot, hwmon_baddr, FINSIO_DECODE_SIZE,
+	0, sc-sc_ioh)) {
 		aprint_error(: can't map hwmon I/O space\n);
 		return;
 	}
@@ -573,7 +573,7 @@
 
 fail:
 	sysmon_envsys_destroy(sc-sc_sme);
-	bus_space_unmap(sc-sc_iot, sc-sc_ioh, 2);
+	bus_space_unmap(sc-sc_iot, sc-sc_ioh, FINSIO_DECODE_SIZE);
 }
 
 static int
@@ -582,7 +582,7 @@
 	struct finsio_softc *sc = device_private(self);
 
 	sysmon_envsys_unregister(sc-sc_sme);
-	bus_space_unmap(sc-sc_iot, sc-sc_ioh, 2);
+	bus_space_unmap(sc-sc_iot, sc-sc_ioh, FINSIO_DECODE_SIZE);
 	return 0;
 }
 



CVS commit: src/sys/dev/isa

2011-07-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul 29 20:58:47 UTC 2011

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

Log Message:
add module support


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/isa/itesio_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/itesio_isa.c
diff -u src/sys/dev/isa/itesio_isa.c:1.22 src/sys/dev/isa/itesio_isa.c:1.23
--- src/sys/dev/isa/itesio_isa.c:1.22	Mon Jun 20 18:12:54 2011
+++ src/sys/dev/isa/itesio_isa.c	Fri Jul 29 20:58:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: itesio_isa.c,v 1.22 2011/06/20 18:12:54 pgoyette Exp $ */
+/*	$NetBSD: itesio_isa.c,v 1.23 2011/07/29 20:58:47 jmcneill Exp $ */
 /*	Derived from $OpenBSD: it.c,v 1.19 2006/04/10 00:57:54 deraadt Exp $	*/
 
 /*
@@ -34,12 +34,12 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: itesio_isa.c,v 1.22 2011/06/20 18:12:54 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: itesio_isa.c,v 1.23 2011/07/29 20:58:47 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
 #include sys/device.h
-
+#include sys/module.h
 #include sys/bus.h
 
 #include dev/isa/isareg.h
@@ -610,3 +610,32 @@
 
 	return 0;
 }
+
+MODULE(MODULE_CLASS_DRIVER, itesio, NULL);
+
+#ifdef _MODULE
+#include ioconf.c
+#endif
+
+static int
+itesio_modcmd(modcmd_t cmd, void *opaque)
+{
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+#ifdef _MODULE
+		return config_init_component(cfdriver_ioconf_itesio,
+		cfattach_ioconf_itesio, cfdata_ioconf_itesio);
+#else
+		return 0;
+#endif
+	case MODULE_CMD_FINI:
+#ifdef _MODULE
+		return config_fini_component(cfdriver_ioconf_itesio,
+		cfattach_ioconf_itesio, cfdata_ioconf_itesio);
+#else
+		return 0;
+#endif
+	default:
+		return ENOTTY;
+	}
+}



CVS commit: src/sys/dev/isa

2011-07-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul 15 20:56:26 UTC 2011

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

Log Message:
add module support


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/isa/nsclpcsio_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/nsclpcsio_isa.c
diff -u src/sys/dev/isa/nsclpcsio_isa.c:1.29 src/sys/dev/isa/nsclpcsio_isa.c:1.30
--- src/sys/dev/isa/nsclpcsio_isa.c:1.29	Mon Jun 20 18:12:54 2011
+++ src/sys/dev/isa/nsclpcsio_isa.c	Fri Jul 15 20:56:26 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: nsclpcsio_isa.c,v 1.29 2011/06/20 18:12:54 pgoyette Exp $ */
+/* $NetBSD: nsclpcsio_isa.c,v 1.30 2011/07/15 20:56:26 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2002
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: nsclpcsio_isa.c,v 1.29 2011/06/20 18:12:54 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: nsclpcsio_isa.c,v 1.30 2011/07/15 20:56:26 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -40,6 +40,7 @@
 #include sys/mutex.h
 #include sys/gpio.h
 #include sys/bus.h
+#include sys/module.h
 
 /* Don't use gpio for now in the module */
 #ifdef _MODULE
@@ -673,3 +674,32 @@
 	mutex_exit(sc-sc_lock);
 }
 #endif /* NGPIO */
+
+MODULE(MODULE_CLASS_DRIVER, nsclpcsio, NULL);
+
+#ifdef _MODULE
+#include ioconf.c
+#endif
+
+static int
+nsclpcsio_modcmd(modcmd_t cmd, void *opaque)
+{
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+#ifdef _MODULE
+		return config_init_component(cfdriver_ioconf_nsclpcsio,
+		cfattach_ioconf_nsclpcsio, cfdata_ioconf_nsclpcsio);
+#else
+		return 0;
+#endif
+	case MODULE_CMD_FINI:
+#ifdef _MODULE
+		return config_fini_component(cfdriver_ioconf_nsclpcsio,
+		cfattach_ioconf_nsclpcsio, cfdata_ioconf_nsclpcsio);
+#else
+		return 0;
+#endif
+	default:
+		return ENOTTY;
+	}
+}



CVS commit: src/sys/dev/isa

2011-07-02 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Jul  2 13:14:47 UTC 2011

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

Log Message:
fix sequence point errors.  diff explains best:
-   sc-sc_playbuf = ++sc-sc_playbuf % sc-sc_nbufs;
+   sc-sc_playbuf = (sc-sc_playbuf + 1) % sc-sc_nbufs;


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/isa/gus.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/gus.c
diff -u src/sys/dev/isa/gus.c:1.105 src/sys/dev/isa/gus.c:1.106
--- src/sys/dev/isa/gus.c:1.105	Tue May 12 09:10:15 2009
+++ src/sys/dev/isa/gus.c	Sat Jul  2 13:14:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: gus.c,v 1.105 2009/05/12 09:10:15 cegger Exp $	*/
+/*	$NetBSD: gus.c,v 1.106 2011/07/02 13:14:46 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1999 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gus.c,v 1.105 2009/05/12 09:10:15 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: gus.c,v 1.106 2011/07/02 13:14:46 mrg Exp $);
 
 #include gus.h
 #if NGUS  0
@@ -1648,7 +1648,7 @@
 	 * flip to the next DMA buffer
 	 */
 
-	sc-sc_dmabuf = ++sc-sc_dmabuf % sc-sc_nbufs;
+	sc-sc_dmabuf = (sc-sc_dmabuf + 1) % sc-sc_nbufs;
 	/*
 	 * See comments below about DMA admission control strategy.
 	 * We can call the upper level here if we have an
@@ -1744,7 +1744,7 @@
 	   device_xname(sc-sc_dev), sc-sc_bufcnt);
 	gus_falsestops++;
 
-	sc-sc_playbuf = ++sc-sc_playbuf % sc-sc_nbufs;
+	sc-sc_playbuf = (sc-sc_playbuf + 1) % sc-sc_nbufs;
 	gus_start_playing(sc, sc-sc_playbuf);
 } else if (sc-sc_bufcnt  0) {
 	panic(%s: negative bufcnt in stopped voice,
@@ -1919,7 +1919,7 @@
 	 * update playbuf to point to the buffer the hardware just started
 	 * playing
 	 */
-	sc-sc_playbuf = ++sc-sc_playbuf % sc-sc_nbufs;
+	sc-sc_playbuf = (sc-sc_playbuf + 1) % sc-sc_nbufs;
 
 	/*
 	 * account for buffer just finished



CVS commit: src/sys/dev/isa

2011-06-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 20 18:12:54 UTC 2011

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

Log Message:
Initialize sensors states before registering.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/isa/finsio_isa.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/isa/itesio_isa.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/isa/nsclpcsio_isa.c
cvs rdiff -u -r1.9 -r1.10 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/finsio_isa.c
diff -u src/sys/dev/isa/finsio_isa.c:1.4 src/sys/dev/isa/finsio_isa.c:1.5
--- src/sys/dev/isa/finsio_isa.c:1.4	Tue Apr 22 13:33:38 2008
+++ src/sys/dev/isa/finsio_isa.c	Mon Jun 20 18:12:54 2011
@@ -1,5 +1,5 @@
 /*	$OpenBSD: fins.c,v 1.1 2008/03/19 19:33:09 deraadt Exp $	*/
-/*	$NetBSD: finsio_isa.c,v 1.4 2008/04/22 13:33:38 xtraeme Exp $	*/
+/*	$NetBSD: finsio_isa.c,v 1.5 2011/06/20 18:12:54 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2008 Juan Romero Pardines
@@ -19,7 +19,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: finsio_isa.c,v 1.4 2008/04/22 13:33:38 xtraeme Exp $);
+__KERNEL_RCSID(0, $NetBSD: finsio_isa.c,v 1.5 2011/06/20 18:12:54 pgoyette Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -542,6 +542,7 @@
 	 */
 	sc-sc_sme = sysmon_envsys_create();
 	for (i = 0; sc-sc_finsio_sensors[i].fs_desc; i++) {
+		sc-sc_sensor[i].state = ENVSYS_SINVALID;
 		sc-sc_sensor[i].units = sc-sc_finsio_sensors[i].fs_type;
 		if (sc-sc_sensor[i].units == ENVSYS_SVOLTS_DC)
 			sc-sc_sensor[i].flags = ENVSYS_FCHANGERFACT;

Index: src/sys/dev/isa/itesio_isa.c
diff -u src/sys/dev/isa/itesio_isa.c:1.21 src/sys/dev/isa/itesio_isa.c:1.22
--- src/sys/dev/isa/itesio_isa.c:1.21	Fri Aug 13 19:28:26 2010
+++ src/sys/dev/isa/itesio_isa.c	Mon Jun 20 18:12:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: itesio_isa.c,v 1.21 2010/08/13 19:28:26 jakllsch Exp $ */
+/*	$NetBSD: itesio_isa.c,v 1.22 2011/06/20 18:12:54 pgoyette Exp $ */
 /*	Derived from $OpenBSD: it.c,v 1.19 2006/04/10 00:57:54 deraadt Exp $	*/
 
 /*
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: itesio_isa.c,v 1.21 2010/08/13 19:28:26 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: itesio_isa.c,v 1.22 2011/06/20 18:12:54 pgoyette Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -409,6 +409,10 @@
 	COPYDESCR(sc-sc_sensor[12].desc, CPU Fan);
 	COPYDESCR(sc-sc_sensor[13].desc, System Fan);
 	COPYDESCR(sc-sc_sensor[14].desc, Aux Fan);
+
+	/* all */
+	for (i = 0; i  IT_NUM_SENSORS; i++)
+		sc-sc_sensor[i].state = ENVSYS_SINVALID;
 }
 #undef COPYDESCR
 

Index: src/sys/dev/isa/nsclpcsio_isa.c
diff -u src/sys/dev/isa/nsclpcsio_isa.c:1.28 src/sys/dev/isa/nsclpcsio_isa.c:1.29
--- src/sys/dev/isa/nsclpcsio_isa.c:1.28	Wed Nov 12 12:36:12 2008
+++ src/sys/dev/isa/nsclpcsio_isa.c	Mon Jun 20 18:12:54 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: nsclpcsio_isa.c,v 1.28 2008/11/12 12:36:12 ad Exp $ */
+/* $NetBSD: nsclpcsio_isa.c,v 1.29 2011/06/20 18:12:54 pgoyette Exp $ */
 
 /*
  * Copyright (c) 2002
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: nsclpcsio_isa.c,v 1.28 2008/11/12 12:36:12 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: nsclpcsio_isa.c,v 1.29 2011/06/20 18:12:54 pgoyette Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -309,6 +309,7 @@
 
 	sme = sysmon_envsys_create();
 	for (i = 0; i  SIO_NUM_SENSORS; i++) {
+		sc-sc_sensor[i].state = ENVSYS_SINVALID;
 		if (sysmon_envsys_sensor_attach(sme, sc-sc_sensor[i]) != 0) {
 			aprint_error_dev(sc-sc_dev,
 			could not attach sensor %d, i);

Index: src/sys/dev/isa/smsc.c
diff -u src/sys/dev/isa/smsc.c:1.9 src/sys/dev/isa/smsc.c:1.10
--- src/sys/dev/isa/smsc.c:1.9	Tue May 12 09:10:16 2009
+++ src/sys/dev/isa/smsc.c	Mon Jun 20 18:12:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: smsc.c,v 1.9 2009/05/12 09:10:16 cegger Exp $ */
+/*	$NetBSD: smsc.c,v 1.10 2011/06/20 18:12:54 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: smsc.c,v 1.9 2009/05/12 09:10:16 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: smsc.c,v 1.10 2011/06/20 18:12:54 pgoyette Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -212,6 +212,7 @@
 	INITSENSOR(7, Fan3, SMSC_FAN4_LSB, ENVSYS_SFANRPM);
 
 	for (i = 0; i  SMSC_MAX_SENSORS; i++) {
+		sc-sc_sensor[i].state = ENVSYS_SINVALID;
 		if (sysmon_envsys_sensor_attach(sc-sc_sme,
 		sc-sc_sensor[i])) {
 			sysmon_envsys_destroy(sc-sc_sme);



CVS commit: src/sys/dev/isa

2011-06-02 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Jun  2 12:51:52 UTC 2011

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

Log Message:
fix compile failure.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/isa/ad1848_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/ad1848_isa.c
diff -u src/sys/dev/isa/ad1848_isa.c:1.36 src/sys/dev/isa/ad1848_isa.c:1.37
--- src/sys/dev/isa/ad1848_isa.c:1.36	Mon Apr 28 20:23:51 2008
+++ src/sys/dev/isa/ad1848_isa.c	Thu Jun  2 12:51:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ad1848_isa.c,v 1.36 2008/04/28 20:23:51 martin Exp $	*/
+/*	$NetBSD: ad1848_isa.c,v 1.37 2011/06/02 12:51:52 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ad1848_isa.c,v 1.36 2008/04/28 20:23:51 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: ad1848_isa.c,v 1.37 2011/06/02 12:51:52 nonaka Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -454,7 +454,7 @@
 		error = isa_dmamap_create(isc-sc_ic, isc-sc_playdrq,
 		isc-sc_play_maxsize, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW);
 		if (error) {
-			aprint_error_dev(sc-sc_dev, can't create map for drq %d\n,
+			aprint_error_dev(sc-sc_dev, can't create map for drq %d\n,
 			isc-sc_playdrq);
 			return;
 		}
@@ -465,7 +465,7 @@
 		error = isa_dmamap_create(isc-sc_ic, isc-sc_recdrq,
 		isc-sc_rec_maxsize, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW);
 		if (error) {
-			aprint_error_dev(sc-sc_dev, can't create map for drq %d\n,
+			aprint_error_dev(sc-sc_dev, can't create map for drq %d\n,
 			isc-sc_recdrq);
 			isa_dmamap_destroy(isc-sc_ic, isc-sc_playdrq);
 			return;



CVS commit: src/sys/dev/isa

2011-05-24 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue May 24 09:28:03 UTC 2011

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

Log Message:
avoid mutex locking botch and introduce an unlocked version of
pcppi_bell_stop().  fixes a problem reported in private email.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/isa/pcppi.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/pcppi.c
diff -u src/sys/dev/isa/pcppi.c:1.36 src/sys/dev/isa/pcppi.c:1.37
--- src/sys/dev/isa/pcppi.c:1.36	Tue May  3 04:27:13 2011
+++ src/sys/dev/isa/pcppi.c	Tue May 24 09:28:03 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pcppi.c,v 1.36 2011/05/03 04:27:13 mrg Exp $ */
+/* $NetBSD: pcppi.c,v 1.37 2011/05/24 09:28:03 mrg Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pcppi.c,v 1.36 2011/05/03 04:27:13 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: pcppi.c,v 1.37 2011/05/24 09:28:03 mrg Exp $);
 
 #include attimer.h
 
@@ -66,6 +66,7 @@
 DVF_DETACH_SHUTDOWN);
 
 static int pcppisearch(device_t, cfdata_t, const int *, void *);
+static void pcppi_bell_stop_unlocked(void*);
 static void pcppi_bell_stop(void*);
 
 #if NATTIMER  0
@@ -285,7 +286,7 @@
 			cv_broadcast(sc-sc_stop_cv);
 	}
 	if (pitch == 0 || period == 0) {
-		pcppi_bell_stop(sc);
+		pcppi_bell_stop_unlocked(sc);
 		sc-sc_bellpitch = 0;
 		mutex_exit(sc-sc_lock);
 		return;
@@ -305,7 +306,7 @@
 	sc-sc_bellactive = 1;
 	if (slp  PCPPI_BELL_POLL) {
 		delay((period * 100) / hz);
-		pcppi_bell_stop(sc);
+		pcppi_bell_stop_unlocked(sc);
 	} else {
 		sc-sc_timeout = 1;
 		callout_reset(sc-sc_bell_ch, period, pcppi_bell_stop, sc);
@@ -319,11 +320,10 @@
 }
 
 static void
-pcppi_bell_stop(void *arg)
+pcppi_bell_stop_unlocked(void *arg)
 {
 	struct pcppi_softc *sc = arg;
 
-	mutex_enter(sc-sc_lock);
 	sc-sc_timeout = 0;
 
 	/* disable bell */
@@ -333,6 +333,15 @@
 	sc-sc_bellactive = 0;
 	if (sc-sc_slp)
 		cv_broadcast(sc-sc_stop_cv);
+}
+
+static void
+pcppi_bell_stop(void *arg)
+{
+	struct pcppi_softc *sc = arg;
+
+	mutex_enter(sc-sc_lock);
+	pcppi_bell_stop_unlocked(arg);
 	mutex_exit(sc-sc_lock);
 }
 



CVS commit: src/sys/dev/isa

2011-05-17 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed May 18 01:03:15 UTC 2011

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

Log Message:
#include sys/bus.h, not machine/bus.h.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/isa/wbsio.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/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.2 src/sys/dev/isa/wbsio.c:1.3
--- src/sys/dev/isa/wbsio.c:1.2	Fri Mar 19 02:17:41 2010
+++ src/sys/dev/isa/wbsio.c	Wed May 18 01:03:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.2 2010/03/19 02:17:41 cnst Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.3 2011/05/18 01:03:15 dyoung Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.5 2009/03/29 21:53:52 sthen Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis kette...@openbsd.org
@@ -25,7 +25,7 @@
 #include sys/kernel.h
 #include sys/systm.h
 
-#include machine/bus.h
+#include sys/bus.h
 
 #include dev/isa/isareg.h
 #include dev/isa/isavar.h



CVS commit: src/sys/dev/isa

2011-05-02 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue May  3 04:27:13 UTC 2011

Modified Files:
src/sys/dev/isa: pcppi.c pcppivar.h

Log Message:
convert a lockless + spltty() combo to a IPL_VM mutex and cv.

hopefully this will avoid the beep-didn't-stop problem i had recently
that i was able to fix by calling wakeup() on pcppi's softc from ddb.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/isa/pcppi.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/isa/pcppivar.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/pcppi.c
diff -u src/sys/dev/isa/pcppi.c:1.35 src/sys/dev/isa/pcppi.c:1.36
--- src/sys/dev/isa/pcppi.c:1.35	Fri Apr 17 20:46:37 2009
+++ src/sys/dev/isa/pcppi.c	Tue May  3 04:27:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pcppi.c,v 1.35 2009/04/17 20:46:37 dyoung Exp $ */
+/* $NetBSD: pcppi.c,v 1.36 2011/05/03 04:27:13 mrg Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pcppi.c,v 1.35 2009/04/17 20:46:37 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: pcppi.c,v 1.36 2011/05/03 04:27:13 mrg Exp $);
 
 #include attimer.h
 
@@ -39,8 +39,9 @@
 #include sys/proc.h
 #include sys/device.h
 #include sys/errno.h
-
 #include sys/bus.h
+#include sys/mutex.h
+#include sys/condvar.h
 
 #include dev/ic/attimervar.h
 
@@ -199,6 +200,10 @@
 	callout_stop(sc-sc_bell_ch);
 	callout_destroy(sc-sc_bell_ch);
 	bus_space_unmap(sc-sc_iot, sc-sc_ppi_ioh, sc-sc_size);
+
+	mutex_destroy(sc-sc_lock);
+	cv_destroy(sc-sc_stop_cv);
+
 	return 0;
 }
 
@@ -212,6 +217,9 @@
 
 sc-sc_bellactive = sc-sc_bellpitch = sc-sc_slp = 0;
 
+	mutex_init(sc-sc_lock, MUTEX_DEFAULT, IPL_VM);
+	cv_init(sc-sc_stop_cv, bell);
+
 #if NPCKBD  0
 	/* Provide a beeper for the PC Keyboard, if there isn't one already. */
 	pckbd_hookup_bell(pcppi_pckbd_bell, sc);
@@ -266,21 +274,20 @@
 pcppi_bell(pcppi_tag_t self, int pitch, int period, int slp)
 {
 	struct pcppi_softc *sc = self;
-	int s;
 
-	s = spltty(); /* ??? */
+	mutex_enter(sc-sc_lock);
 	if (sc-sc_bellactive) {
 		if (sc-sc_timeout) {
 			sc-sc_timeout = 0;
 			callout_stop(sc-sc_bell_ch);
 		}
 		if (sc-sc_slp)
-			wakeup(pcppi_bell_stop);
+			cv_broadcast(sc-sc_stop_cv);
 	}
 	if (pitch == 0 || period == 0) {
 		pcppi_bell_stop(sc);
 		sc-sc_bellpitch = 0;
-		splx(s);
+		mutex_exit(sc-sc_lock);
 		return;
 	}
 	if (!sc-sc_bellactive || sc-sc_bellpitch != pitch) {
@@ -304,20 +311,19 @@
 		callout_reset(sc-sc_bell_ch, period, pcppi_bell_stop, sc);
 		if (slp  PCPPI_BELL_SLEEP) {
 			sc-sc_slp = 1;
-			tsleep(pcppi_bell_stop, PCPPIPRI | PCATCH, bell, 0);
+			cv_wait_sig(sc-sc_stop_cv, sc-sc_lock);
 			sc-sc_slp = 0;
 		}
 	}
-	splx(s);
+	mutex_exit(sc-sc_lock);
 }
 
 static void
 pcppi_bell_stop(void *arg)
 {
 	struct pcppi_softc *sc = arg;
-	int s;
 
-	s = spltty(); /* ??? */
+	mutex_enter(sc-sc_lock);
 	sc-sc_timeout = 0;
 
 	/* disable bell */
@@ -326,8 +332,8 @@
 			   ~PIT_SPKR);
 	sc-sc_bellactive = 0;
 	if (sc-sc_slp)
-		wakeup(pcppi_bell_stop);
-	splx(s);
+		cv_broadcast(sc-sc_stop_cv);
+	mutex_exit(sc-sc_lock);
 }
 
 #if NPCKBD  0

Index: src/sys/dev/isa/pcppivar.h
diff -u src/sys/dev/isa/pcppivar.h:1.9 src/sys/dev/isa/pcppivar.h:1.10
--- src/sys/dev/isa/pcppivar.h:1.9	Tue Mar  4 16:35:19 2008
+++ src/sys/dev/isa/pcppivar.h	Tue May  3 04:27:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pcppivar.h,v 1.9 2008/03/04 16:35:19 cube Exp $ */
+/* $NetBSD: pcppivar.h,v 1.10 2011/05/03 04:27:13 mrg Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -37,18 +37,21 @@
 };
 
 struct pcppi_softc {
-device_t sc_dv;  
+	device_t sc_dv;  
 
-bus_space_tag_t sc_iot;
-bus_space_handle_t sc_ppi_ioh;
-bus_size_t sc_size;
-device_t sc_timer;
+	bus_space_tag_t sc_iot;
+	bus_space_handle_t sc_ppi_ioh;
+	bus_size_t sc_size;
+	device_t sc_timer;
 
-struct callout sc_bell_ch;
+	struct callout sc_bell_ch;
 
-int sc_bellactive, sc_bellpitch;
-int sc_slp;
-int sc_timeout;
+	int sc_bellactive, sc_bellpitch;
+	int sc_slp;
+	int sc_timeout;
+
+	kmutex_t sc_lock;
+	kcondvar_t sc_stop_cv;
 };
 
 void pcppi_attach(struct pcppi_softc *);



CVS commit: src/sys/dev/isa

2011-04-24 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Sun Apr 24 18:54:41 UTC 2011

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

Log Message:
use static inline for ec_readmem(), it is not referenced elsewhere

(avoids C99 vs GNU semantics for external inline functions)


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/isa/if_ec.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_ec.c
diff -u src/sys/dev/isa/if_ec.c:1.33 src/sys/dev/isa/if_ec.c:1.34
--- src/sys/dev/isa/if_ec.c:1.33	Mon Apr 28 20:23:52 2008
+++ src/sys/dev/isa/if_ec.c	Sun Apr 24 18:54:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ec.c,v 1.33 2008/04/28 20:23:52 martin Exp $	*/
+/*	$NetBSD: if_ec.c,v 1.34 2011/04/24 18:54:41 plunky Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ec.c,v 1.33 2008/04/28 20:23:52 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ec.c,v 1.34 2011/04/24 18:54:41 plunky Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -106,8 +106,6 @@
 int	ec_fake_test_mem(struct dp8390_softc *);
 int	ec_test_mem(struct dp8390_softc *);
 
-inline void ec_readmem(struct ec_softc *, int, u_int8_t *, int);
-
 static const int ec_iobase[] = {
 	0x2e0, 0x2a0, 0x280, 0x250, 0x350, 0x330, 0x310, 0x300,
 };
@@ -549,7 +547,7 @@
  * copy 'len' from NIC to host using shared memory.  The 'len' is rounded
  * up to a word - ok as long as mbufs are word-sized.
  */
-inline void
+static inline void
 ec_readmem(struct ec_softc *esc, int from, uint8_t *to, int len)
 {
 	bus_space_tag_t memt = esc-sc_dp8390.sc_buft;



CVS commit: src/sys/dev/isa

2011-02-16 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Feb 16 10:08:05 UTC 2011

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

Log Message:
As suggested by Sverre Froyen in a follow-up to PR # 41698, change the
sensor names to real words (e.g. temperature 1 instead of TEMP_1).
No functional change; only consistent envstat(8) output with other sensors.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/isa/aps.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.13 src/sys/dev/isa/aps.c:1.14
--- src/sys/dev/isa/aps.c:1.13	Tue Jan 18 16:45:11 2011
+++ src/sys/dev/isa/aps.c	Wed Feb 16 10:08:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: aps.c,v 1.13 2011/01/18 16:45:11 jmcneill Exp $	*/
+/*	$NetBSD: aps.c,v 1.14 2011/02/16 10:08:05 jruoho 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 sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: aps.c,v 1.13 2011/01/18 16:45:11 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: aps.c,v 1.14 2011/02/16 10:08:05 jruoho Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -326,15 +326,15 @@
 	strlcpy(sc-sc_sensor[idx].desc, string,			\
 	sizeof(sc-sc_sensor[idx].desc));
 
-	INITDATA(APS_SENSOR_XACCEL, ENVSYS_INTEGER, X_ACCEL);
-	INITDATA(APS_SENSOR_YACCEL, ENVSYS_INTEGER, Y_ACCEL);
-	INITDATA(APS_SENSOR_TEMP1, ENVSYS_STEMP, TEMP_1);
-	INITDATA(APS_SENSOR_TEMP2, ENVSYS_STEMP, TEMP_2);
-	INITDATA(APS_SENSOR_XVAR, ENVSYS_INTEGER, X_VAR);
-	INITDATA(APS_SENSOR_YVAR, ENVSYS_INTEGER, Y_VAR);
-	INITDATA(APS_SENSOR_KBACT, ENVSYS_INDICATOR, Keyboard Active);
-	INITDATA(APS_SENSOR_MSACT, ENVSYS_INDICATOR, Mouse Active);
-	INITDATA(APS_SENSOR_LIDOPEN, ENVSYS_INDICATOR, Lid Open);
+	INITDATA(APS_SENSOR_XACCEL, ENVSYS_INTEGER, x-acceleration);
+	INITDATA(APS_SENSOR_YACCEL, ENVSYS_INTEGER, y-acceleration);
+	INITDATA(APS_SENSOR_TEMP1, ENVSYS_STEMP, temperature 1);
+	INITDATA(APS_SENSOR_TEMP2, ENVSYS_STEMP, temperature 2);
+	INITDATA(APS_SENSOR_XVAR, ENVSYS_INTEGER, x-variable);
+	INITDATA(APS_SENSOR_YVAR, ENVSYS_INTEGER, y-variable);
+	INITDATA(APS_SENSOR_KBACT, ENVSYS_INDICATOR, keyboard active);
+	INITDATA(APS_SENSOR_MSACT, ENVSYS_INDICATOR, mouse active);
+	INITDATA(APS_SENSOR_LIDOPEN, ENVSYS_INDICATOR, lid open);
 
 	sc-sc_sme = sysmon_envsys_create();
 	for (i = 0; i  APS_NUM_SENSORS; i++) {



CVS commit: src/sys/dev/isa

2011-01-18 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 18 16:45:11 UTC 2011

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

Log Message:
treat temperature readings of 0xff as invalid, as I'm somewhat confident
that my Thinkpad isn't idling at 255 degC.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/isa/aps.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.12 src/sys/dev/isa/aps.c:1.13
--- src/sys/dev/isa/aps.c:1.12	Sun Jan 16 14:16:03 2011
+++ src/sys/dev/isa/aps.c	Tue Jan 18 16:45:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: aps.c,v 1.12 2011/01/16 14:16:03 jmcneill Exp $	*/
+/*	$NetBSD: aps.c,v 1.13 2011/01/18 16:45:11 jmcneill 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 sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: aps.c,v 1.12 2011/01/16 14:16:03 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: aps.c,v 1.13 2011/01/18 16:45:11 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -460,23 +460,35 @@
 {
 	int64_t temp;
 
-	if (aps_read_data(sc))
+	if (aps_read_data(sc)) {
+		printf(aps0: read data failed\n);
 		return;
+	}
 
 	sc-sc_sensor[APS_SENSOR_XACCEL].value_cur = sc-aps_data.x_accel;
 	sc-sc_sensor[APS_SENSOR_YACCEL].value_cur = sc-aps_data.y_accel;
 
-	/* convert to micro (mu) degrees */
-	temp = sc-aps_data.temp1 * 100;	
-	/* convert to kelvin */
-	temp += 27315; 
-	sc-sc_sensor[APS_SENSOR_TEMP1].value_cur = temp;
-
-	/* convert to micro (mu) degrees */
-	temp = sc-aps_data.temp2 * 100;	
-	/* convert to kelvin */
-	temp += 27315; 
-	sc-sc_sensor[APS_SENSOR_TEMP2].value_cur = temp;
+	if (sc-aps_data.temp1 == 0xff)
+		sc-sc_sensor[APS_SENSOR_TEMP1].state = ENVSYS_SINVALID;
+	else {
+		/* convert to micro (mu) degrees */
+		temp = sc-aps_data.temp1 * 100;	
+		/* convert to kelvin */
+		temp += 27315; 
+		sc-sc_sensor[APS_SENSOR_TEMP1].value_cur = temp;
+		sc-sc_sensor[APS_SENSOR_TEMP1].state = ENVSYS_SVALID;
+	}
+
+	if (sc-aps_data.temp2 == 0xff)
+		sc-sc_sensor[APS_SENSOR_TEMP2].state = ENVSYS_SINVALID;
+	else {
+		/* convert to micro (mu) degrees */
+		temp = sc-aps_data.temp2 * 100;	
+		/* convert to kelvin */
+		temp += 27315; 
+		sc-sc_sensor[APS_SENSOR_TEMP2].value_cur = temp;
+		sc-sc_sensor[APS_SENSOR_TEMP2].state = ENVSYS_SVALID;
+	}
 
 	sc-sc_sensor[APS_SENSOR_XVAR].value_cur = sc-aps_data.x_var;
 	sc-sc_sensor[APS_SENSOR_YVAR].value_cur = sc-aps_data.y_var;



CVS commit: src/sys/dev/isa

2011-01-16 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jan 16 14:16:03 UTC 2011

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

Log Message:
save a line of dmesg


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/isa/aps.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.11 src/sys/dev/isa/aps.c:1.12
--- src/sys/dev/isa/aps.c:1.11	Sun Jan 16 01:05:45 2011
+++ src/sys/dev/isa/aps.c	Sun Jan 16 14:16:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: aps.c,v 1.11 2011/01/16 01:05:45 jmcneill Exp $	*/
+/*	$NetBSD: aps.c,v 1.12 2011/01/16 14:16:03 jmcneill 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 sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: aps.c,v 1.11 2011/01/16 01:05:45 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: aps.c,v 1.12 2011/01/16 14:16:03 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -313,7 +313,7 @@
 	sc-sc_bus_space_valid = true;
 
 	aprint_naive(\n);
-	aprint_normal(\n);
+	aprint_normal(: Thinkpad Active Protection System\n);
 
 	if (aps_init(sc)) {
 		aprint_error_dev(self, failed to initialize\n);
@@ -364,7 +364,6 @@
 	/* Refresh sensor data every 0.5 seconds */
 	callout_schedule(sc-sc_callout, (hz) / 2);
 
-aprint_normal_dev(self, Thinkpad Active Protection System\n);
 	return;
 
 out:



CVS commit: src/sys/dev/isa

2011-01-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jan 16 01:05:46 UTC 2011

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

Log Message:
- catch up with OpenBSD driver, adding support for newer Thinkpad models
- add module hooks


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/isa/aps.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.10 src/sys/dev/isa/aps.c:1.11
--- src/sys/dev/isa/aps.c:1.10	Wed Feb 24 22:37:58 2010
+++ src/sys/dev/isa/aps.c	Sun Jan 16 01:05:45 2011
@@ -1,8 +1,9 @@
-/*	$NetBSD: aps.c,v 1.10 2010/02/24 22:37:58 dyoung Exp $	*/
+/*	$NetBSD: aps.c,v 1.11 2011/01/16 01:05:45 jmcneill 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 $	*/
 /*
  * Copyright (c) 2005 Jonathan Gray j...@openbsd.org
+ * Copyright (c) 2008 Can Erkin Acar cana...@openbsd.org
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -23,13 +24,14 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: aps.c,v 1.10 2010/02/24 22:37:58 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: aps.c,v 1.11 2011/01/16 01:05:45 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/device.h
 #include sys/kernel.h
 #include sys/callout.h
+#include sys/module.h
 
 #include sys/bus.h
 
@@ -44,23 +46,62 @@
 #define DPRINTF(x)
 #endif
 
-#define APS_ACCEL_STATE		0x04
-#define APS_INIT		0x10
-#define APS_STATE		0x11
-#define	APS_XACCEL		0x12
-#define APS_YACCEL		0x14
-#define APS_TEMP		0x16
-#define	APS_XVAR		0x17
-#define APS_YVAR		0x19
-#define APS_TEMP2		0x1b
-#define APS_UNKNOWN		0x1c
-#define APS_INPUT		0x1d
-#define APS_CMD			0x1f
 
-#define	APS_STATE_NEWDATA	0x50
+/*
+ * EC interface on Thinkpad Laptops, from Linux HDAPS driver notes.
+ * From Renesans H8S/2140B Group Hardware Manual
+ * http://documentation.renesas.com/eng/products/mpumcu/rej09b0300_2140bhm.pdf
+ *
+ * EC uses LPC Channel 3 registers TWR0..15
+ */
+
+/* STR3 status register */
+#define APS_STR3		0x04
+
+#define APS_STR3_IBF3B	0x80	/* Input buffer full (host-slave) */
+#define APS_STR3_OBF3B	0x40	/* Output buffer full (slave-host)*/
+#define APS_STR3_MWMF	0x20	/* Master write mode */
+#define APS_STR3_SWMF	0x10	/* Slave write mode */
+
+
+/* Base address of TWR registers */
+#define APS_TWR_BASE		0x10
+#define APS_TWR_RET		0x1f
+
+/* TWR registers */
+#define APS_CMD			0x00
+#define APS_ARG1		0x01
+#define APS_ARG2		0x02
+#define APS_ARG3		0x03
+#define APS_RET			0x0f
+
+/* Sensor values */
+#define APS_STATE		0x01
+#define	APS_XACCEL		0x02
+#define APS_YACCEL		0x04
+#define APS_TEMP		0x06
+#define	APS_XVAR		0x07
+#define APS_YVAR		0x09
+#define APS_TEMP2		0x0b
+#define APS_UNKNOWN		0x0c
+#define APS_INPUT		0x0d
+
+/* write masks for I/O, send command + 0-3 arguments*/
+#define APS_WRITE_0		0x0001
+#define APS_WRITE_1		0x0003
+#define APS_WRITE_2		0x0007
+#define APS_WRITE_3		0x000f
+
+/* read masks for I/O, read 0-3 values (skip command byte) */
+#define APS_READ_0		0x
+#define APS_READ_1		0x0002
+#define APS_READ_2		0x0006
+#define APS_READ_3		0x000e
 
-#define APS_CMD_START		0x01
+#define APS_READ_RET		0x8000
+#define APS_READ_ALL		0x
 
+/* Bit definitions for APS_INPUT value */
 #define APS_INPUT_KB		(1  5)
 #define APS_INPUT_MS		(1  6)
 #define APS_INPUT_LIDOPEN	(1  7)
@@ -95,6 +136,7 @@
 struct aps_softc {
 	bus_space_tag_t sc_iot;
 	bus_space_handle_t sc_ioh;
+	bool sc_bus_space_valid;
 
 	struct sysmon_envsys *sc_sme;
 	envsys_data_t sc_sensor[APS_NUM_SENSORS];
@@ -108,23 +150,93 @@
 static int	aps_detach(device_t, int);
 
 static int 	aps_init(struct aps_softc *);
-static uint8_t  aps_mem_read_1(bus_space_tag_t, bus_space_handle_t,
-			   int, uint8_t);
-static void 	aps_refresh_sensor_data(struct aps_softc *sc);
+static int	aps_read_data(struct aps_softc *);
+static void 	aps_refresh_sensor_data(struct aps_softc *);
 static void 	aps_refresh(void *);
+static int	aps_do_io(bus_space_tag_t, bus_space_handle_t,
+			  unsigned char *, int, int);
 static bool 	aps_suspend(device_t, const pmf_qual_t *);
 static bool 	aps_resume(device_t, const pmf_qual_t *);
 
 CFATTACH_DECL_NEW(aps, sizeof(struct aps_softc),
 	  aps_match, aps_attach, aps_detach, NULL);
 
+/* properly communicate with the controller, writing a set of memory
+ * locations and reading back another set  */
+static int
+aps_do_io(bus_space_tag_t iot, bus_space_handle_t ioh,
+	  unsigned char *buf, int wmask, int rmask)
+{
+	int bp, stat, n;
+
+	DPRINTF((aps_do_io: CMD: 0x%02x, wmask: 0x%04x, rmask: 0x%04x\n,
+	buf[0], wmask, rmask));
+
+	/* write init byte using arbitration */
+	for (n = 0; n  100; n++) {
+		stat = bus_space_read_1(iot, ioh, APS_STR3);
+		if (stat  (APS_STR3_OBF3B | 

  1   2   >