CVS commit: src/sys/arch/atari/dev

2020-12-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 15:18:04 UTC 2020

Modified Files:
src/sys/arch/atari/dev: event.c

Log Message:
- malloc(9) -> kmem(9)
- Use sel{record,remove}_knote().


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

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

Modified files:

Index: src/sys/arch/atari/dev/event.c
diff -u src/sys/arch/atari/dev/event.c:1.14 src/sys/arch/atari/dev/event.c:1.15
--- src/sys/arch/atari/dev/event.c:1.14	Wed Oct 25 08:12:37 2017
+++ src/sys/arch/atari/dev/event.c	Sat Dec 19 15:18:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: event.c,v 1.14 2017/10/25 08:12:37 maya Exp $	*/
+/*	$NetBSD: event.c,v 1.15 2020/12/19 15:18:04 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -47,11 +47,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: event.c,v 1.14 2017/10/25 08:12:37 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: event.c,v 1.15 2020/12/19 15:18:04 thorpej Exp $");
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -61,6 +61,8 @@ __KERNEL_RCSID(0, "$NetBSD: event.c,v 1.
 #include 
 #include 
 
+#define	EV_Q_ALLOCSIZE		(EV_QSIZE * sizeof(struct firm_event))
+
 /*
  * Initialize a firm_event queue.
  */
@@ -69,8 +71,7 @@ ev_init(register struct evvar *ev)
 {
 
 	ev->ev_get = ev->ev_put = 0;
-	ev->ev_q = malloc((u_long)EV_QSIZE * sizeof(struct firm_event),
-	M_DEVBUF, M_WAITOK|M_ZERO);
+	ev->ev_q = kmem_zalloc(EV_Q_ALLOCSIZE, KM_SLEEP);
 	selinit(>ev_sel);
 }
 
@@ -82,7 +83,7 @@ ev_fini(register struct evvar *ev)
 {
 
 	seldestroy(>ev_sel);
-	free(ev->ev_q, M_DEVBUF);
+	kmem_free(ev->ev_q, EV_Q_ALLOCSIZE);
 }
 
 /*
@@ -166,7 +167,7 @@ filt_evrdetach(struct knote *kn)
 	int s;
 
 	s = splev();
-	SLIST_REMOVE(>ev_sel.sel_klist, kn, knote, kn_selnext);
+	selremove_knote(>ev_sel, kn);
 	splx(s);
 }
 
@@ -199,12 +200,10 @@ static const struct filterops ev_filtops
 int
 ev_kqfilter(struct evvar *ev, struct knote *kn)
 {
-	struct klist *klist;
 	int s;
 
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
-		klist = >ev_sel.sel_klist;
 		kn->kn_fop = _filtops;
 		break;
 
@@ -215,7 +214,7 @@ ev_kqfilter(struct evvar *ev, struct kno
 	kn->kn_hook = ev;
 
 	s = splev();
-	SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+	selrecord_knote(>ev_sel, kn);
 	splx(s);
 
 	return (0);



CVS commit: src/sys/arch/atari/dev

2018-09-19 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Sep 19 23:28:58 UTC 2018

Modified Files:
src/sys/arch/atari/dev: wskbdmap_atari.c

Log Message:
Remove unused KBD_NULLMAP entries copy-paste from sys/dev/pckbport.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/atari/dev/wskbdmap_atari.c

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

Modified files:

Index: src/sys/arch/atari/dev/wskbdmap_atari.c
diff -u src/sys/arch/atari/dev/wskbdmap_atari.c:1.4 src/sys/arch/atari/dev/wskbdmap_atari.c:1.5
--- src/sys/arch/atari/dev/wskbdmap_atari.c:1.4	Mon Apr 28 20:23:15 2008
+++ src/sys/arch/atari/dev/wskbdmap_atari.c	Wed Sep 19 23:28:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wskbdmap_atari.c,v 1.4 2008/04/28 20:23:15 martin Exp $	*/
+/*	$NetBSD: wskbdmap_atari.c,v 1.5 2018/09/19 23:28:58 rin Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wskbdmap_atari.c,v 1.4 2008/04/28 20:23:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wskbdmap_atari.c,v 1.5 2018/09/19 23:28:58 rin Exp $");
 
 #include 
 #include 
@@ -461,9 +461,6 @@ static const keysym_t atarikbd_keydesc_i
 
 #define KBD_MAP(name, base, map) \
 			{ name, base, sizeof(map)/sizeof(keysym_t), map }
-/* KBD_NULLMAP generates a entry for machine native variant.
-   the entry will be modified by machine dependent keyboard driver. */
-#define KBD_NULLMAP(name, base) { name, base, 0, 0 }
 
 const struct wscons_keydesc atarikbd_keydesctab[] = {
 	KBD_MAP(KB_US,			0,	atarikbd_keydesc_us),
@@ -490,12 +487,6 @@ const struct wscons_keydesc atarikbd_key
 	KBD_MAP(KB_US | KB_IOPENER | KB_SWAPCTRLCAPS,	KB_US | KB_IOPENER,
 		atarikbd_keydesc_swapctrlcaps),
 	KBD_MAP(KB_ES ,			KB_US,	atarikbd_keydesc_es),
-	KBD_NULLMAP(KB_US | KB_MACHDEP,	KB_US),
-	KBD_NULLMAP(KB_JP | KB_MACHDEP,	KB_JP),
-	KBD_NULLMAP(KB_US | KB_MACHDEP | KB_SWAPCTRLCAPS,
-		KB_US | KB_SWAPCTRLCAPS),
-	KBD_NULLMAP(KB_JP | KB_MACHDEP | KB_SWAPCTRLCAPS,
-		KB_JP | KB_SWAPCTRLCAPS),
 	{0, 0, 0, 0}
 };
 



CVS commit: src/sys/arch/atari/dev

2018-01-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 20 19:33:53 UTC 2018

Modified Files:
src/sys/arch/atari/dev: nvram.c

Log Message:
Skip NVRAM checksum check and re-initialization on Milan.

Milan's firmware seems to use different check method.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/atari/dev/nvram.c

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

Modified files:

Index: src/sys/arch/atari/dev/nvram.c
diff -u src/sys/arch/atari/dev/nvram.c:1.20 src/sys/arch/atari/dev/nvram.c:1.21
--- src/sys/arch/atari/dev/nvram.c:1.20	Fri Mar  6 12:41:05 2015
+++ src/sys/arch/atari/dev/nvram.c	Sat Jan 20 19:33:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvram.c,v 1.20 2015/03/06 12:41:05 christos Exp $	*/
+/*	$NetBSD: nvram.c,v 1.21 2018/01/20 19:33:53 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvram.c,v 1.20 2015/03/06 12:41:05 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvram.c,v 1.21 2018/01/20 19:33:53 tsutsui Exp $");
 
 #include 
 #include 
@@ -92,11 +92,15 @@ nvr_attach(device_t parent, device_t sel
 	/*
 	 * Check the validity of the NVram contents
 	 */
-	if (!nvram_csum_valid(nvram_csum())) {
-		printf(": Invalid checksum - re-initialized");
-		for (nreg = MC_NVRAM_START; nreg < MC_NVRAM_CSUM; nreg++)
-			mc146818_write(RTC, nreg, 0);
-		nvram_set_csum(nvram_csum());
+	/* XXX: Milan's firmware seems to use different check method */
+	if ((machineid & ATARI_MILAN) == 0) {
+		if (!nvram_csum_valid(nvram_csum())) {
+			printf(": Invalid checksum - re-initialized");
+			for (nreg = MC_NVRAM_START; nreg < MC_NVRAM_CSUM;
+			nreg++)
+mc146818_write(RTC, nreg, 0);
+			nvram_set_csum(nvram_csum());
+		}
 	}
 	sc = device_private(self);
 	sc->sc_dev = self;



CVS commit: src/sys/arch/atari/dev

2016-02-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 29 18:25:29 UTC 2016

Modified Files:
src/sys/arch/atari/dev: ite.c

Log Message:
PR/50868: David Binderman: Fix operator precedence.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/atari/dev/ite.c

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

Modified files:

Index: src/sys/arch/atari/dev/ite.c
diff -u src/sys/arch/atari/dev/ite.c:1.76 src/sys/arch/atari/dev/ite.c:1.77
--- src/sys/arch/atari/dev/ite.c:1.76	Fri Jul 25 04:10:32 2014
+++ src/sys/arch/atari/dev/ite.c	Mon Feb 29 13:25:29 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite.c,v 1.76 2014/07/25 08:10:32 dholland Exp $	*/
+/*	$NetBSD: ite.c,v 1.77 2016/02/29 18:25:29 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.76 2014/07/25 08:10:32 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.77 2016/02/29 18:25:29 christos Exp $");
 
 #include "opt_ddb.h"
 
@@ -801,7 +801,7 @@ ite_cnfilter(u_int c, enum caller caller
 	/* handle dead keys */
 	if (key->mode & KBD_MODE_DEAD) {
 		/* if entered twice, send accent itself */
-		if (last_dead == key->mode & KBD_MODE_ACCMASK)
+		if (last_dead == (key->mode & KBD_MODE_ACCMASK))
 			last_dead = 0;
 		else {
 			last_dead = key->mode & KBD_MODE_ACCMASK;



CVS commit: src/sys/arch/atari/dev

2015-03-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar  6 12:41:05 UTC 2015

Modified Files:
src/sys/arch/atari/dev: nvram.c

Log Message:
rename NV_DEBUG to NVRAM_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/atari/dev/nvram.c

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

Modified files:

Index: src/sys/arch/atari/dev/nvram.c
diff -u src/sys/arch/atari/dev/nvram.c:1.19 src/sys/arch/atari/dev/nvram.c:1.20
--- src/sys/arch/atari/dev/nvram.c:1.19	Sun Jun  5 02:33:43 2011
+++ src/sys/arch/atari/dev/nvram.c	Fri Mar  6 07:41:05 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvram.c,v 1.19 2011/06/05 06:33:43 tsutsui Exp $	*/
+/*	$NetBSD: nvram.c,v 1.20 2015/03/06 12:41:05 christos Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: nvram.c,v 1.19 2011/06/05 06:33:43 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: nvram.c,v 1.20 2015/03/06 12:41:05 christos Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -51,6 +51,12 @@ __KERNEL_RCSID(0, $NetBSD: nvram.c,v 1.
 
 #include nvr.h
 
+#ifdef NVRAM_DEBUG
+#define DPRINTF(a) printf a
+#else
+#define DPRINTF(a)
+#endif
+
 #define	MC_NVRAM_CSUM	(MC_NVRAM_START + MC_NVRAM_SIZE - 2)
 
 #if NNVR  0
@@ -136,11 +142,9 @@ nvram_uio(struct uio *uio)
 	if (!(sc-sc_flags  NVR_CONFIGURED))
 		return ENXIO;
 
-#ifdef NV_DEBUG
-	printf(Request to transfer %d bytes offset: %d, %s nvram\n,
+	DPRINTF((Request to transfer %d bytes offset: %d, %s nvram\n,
 (long)uio-uio_resid, (long)uio-uio_offset,
-(uio-uio_rw == UIO_READ) ? from : to);
-#endif /* NV_DEBUG */
+(uio-uio_rw == UIO_READ) ? from : to));
 
 	offset = uio-uio_offset + MC_NVRAM_START;
 	nleft  = uio-uio_resid;
@@ -151,9 +155,7 @@ nvram_uio(struct uio *uio)
 		if (nleft = 0)
 			return (EINVAL);
 	}
-#ifdef NV_DEBUG
-	printf(Translated: offset = %d, bytes: %d\n, (long)offset, nleft);
-#endif /* NV_DEBUG */
+	DPRINTF((Translated: offset = %d, bytes: %d\n, (long)offset, nleft));
 
 	if (uio-uio_rw == UIO_READ) {
 		for (i = 0, p = buf; i  nleft; i++, p++)



CVS commit: src/sys/arch/atari/dev

2015-01-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan  1 17:46:09 UTC 2015

Modified Files:
src/sys/arch/atari/dev: fd.c

Log Message:
declare error


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/atari/dev/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/arch/atari/dev/fd.c
diff -u src/sys/arch/atari/dev/fd.c:1.81 src/sys/arch/atari/dev/fd.c:1.82
--- src/sys/arch/atari/dev/fd.c:1.81	Wed Dec 31 14:52:04 2014
+++ src/sys/arch/atari/dev/fd.c	Thu Jan  1 12:46:09 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.81 2014/12/31 19:52:04 christos Exp $	*/
+/*	$NetBSD: fd.c,v 1.82 2015/01/01 17:46:09 christos Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -44,7 +44,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.81 2014/12/31 19:52:04 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.82 2015/01/01 17:46:09 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -426,6 +426,7 @@ int
 fdioctl(dev_t dev, u_long cmd, void * addr, int flag, struct lwp *l)
 {
 	struct fd_softc *sc;
+	int error;
 
 	sc = device_lookup_private(fd_cd, DISKUNIT(dev));
 



CVS commit: src/sys/arch/atari/dev

2014-07-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jul  5 09:36:49 UTC 2014

Modified Files:
src/sys/arch/atari/dev: atari5380.c

Log Message:
Appease gcc48 -Wunused-but-set-variable warning.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/atari/dev/atari5380.c

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

Modified files:

Index: src/sys/arch/atari/dev/atari5380.c
diff -u src/sys/arch/atari/dev/atari5380.c:1.60 src/sys/arch/atari/dev/atari5380.c:1.61
--- src/sys/arch/atari/dev/atari5380.c:1.60	Mon Mar 24 18:39:57 2014
+++ src/sys/arch/atari/dev/atari5380.c	Sat Jul  5 09:36:49 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atari5380.c,v 1.60 2014/03/24 18:39:57 christos Exp $	*/
+/*	$NetBSD: atari5380.c,v 1.61 2014/07/05 09:36:49 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: atari5380.c,v 1.60 2014/03/24 18:39:57 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: atari5380.c,v 1.61 2014/07/05 09:36:49 tsutsui Exp $);
 
 #include opt_atariscsi.h
 
@@ -731,9 +731,8 @@ scsi_falcon_idisable(void)
 static inline void
 scsi_falcon_clr_ipend(void)
 {
-	int tmp;
 
-	tmp = get_falcon_5380_reg(NCR5380_IRCV);
+	(void)get_falcon_5380_reg(NCR5380_IRCV);
 	rem_sicallback((si_farg)ncr_ctrl_intr);
 }
 



CVS commit: src/sys/arch/atari/dev

2014-03-29 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Mar 29 16:46:19 UTC 2014

Modified Files:
src/sys/arch/atari/dev: event_var.h

Log Message:
Make sure to acquire proc_lock mutex on calling psignal(9) in EV_WAKEUP().

Without this, Xserver could cause panic on the DIAGNOSTIC kernel as x68k:
http://mail-index.netbsd.org/source-changes/2012/08/15/msg036632.html


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/atari/dev/event_var.h

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

Modified files:

Index: src/sys/arch/atari/dev/event_var.h
diff -u src/sys/arch/atari/dev/event_var.h:1.8 src/sys/arch/atari/dev/event_var.h:1.9
--- src/sys/arch/atari/dev/event_var.h:1.8	Sat Mar 14 14:45:56 2009
+++ src/sys/arch/atari/dev/event_var.h	Sat Mar 29 16:46:19 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: event_var.h,v 1.8 2009/03/14 14:45:56 dsl Exp $	*/
+/*	$NetBSD: event_var.h,v 1.9 2014/03/29 16:46:19 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -69,8 +69,11 @@ struct evvar {
 		(ev)-ev_wanted = 0; \
 		wakeup((void *)(ev)); \
 	} \
-	if ((ev)-ev_async) \
+	if ((ev)-ev_async) { \
+		mutex_enter(proc_lock); \
 		psignal((ev)-ev_io, SIGIO); \
+		mutex_exit(proc_lock); \
+	} \
 }
 
 void	ev_init(struct evvar *);



CVS commit: src/sys/arch/atari/dev

2014-02-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Feb 19 11:40:31 UTC 2014

Modified Files:
src/sys/arch/atari/dev: ite.c

Log Message:
Fix kernel crash when a user tries to switch to nonexistent terminal.

Reported by Gabor Sebestyen in PR port-atari/48599.

Should be pulled up to all netbsd-6 branches.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/atari/dev/ite.c

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

Modified files:

Index: src/sys/arch/atari/dev/ite.c
diff -u src/sys/arch/atari/dev/ite.c:1.71 src/sys/arch/atari/dev/ite.c:1.72
--- src/sys/arch/atari/dev/ite.c:1.71	Sun Jun  5 16:25:12 2011
+++ src/sys/arch/atari/dev/ite.c	Wed Feb 19 11:40:31 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite.c,v 1.71 2011/06/05 16:25:12 tsutsui Exp $	*/
+/*	$NetBSD: ite.c,v 1.72 2014/02/19 11:40:31 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ite.c,v 1.71 2011/06/05 16:25:12 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: ite.c,v 1.72 2014/02/19 11:40:31 tsutsui Exp $);
 
 #include opt_ddb.h
 
@@ -665,8 +665,8 @@ ite_switch(int unit)
 	struct ite_softc	*sc;
 	extern const struct cdevsw view_cdevsw;
 
-	sc = getitesp(unit);
-	if ((sc-flags  (ITE_ATTACHED | ITE_INITED)) == 0)
+	sc = device_lookup_private(ite_cd, unit);
+	if (sc == NULL || (sc-flags  (ITE_ATTACHED | ITE_INITED)) == 0)
 		return;
 
 	/*



CVS commit: src/sys/arch/atari/dev

2013-01-26 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Sat Jan 26 18:13:56 UTC 2013

Modified Files:
src/sys/arch/atari/dev: clock.c

Log Message:
use sizeof(buffer) - 1, not sizeof(buffer - 1)


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/atari/dev/clock.c

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

Modified files:

Index: src/sys/arch/atari/dev/clock.c
diff -u src/sys/arch/atari/dev/clock.c:1.54 src/sys/arch/atari/dev/clock.c:1.55
--- src/sys/arch/atari/dev/clock.c:1.54	Sat Jun 30 12:42:37 2012
+++ src/sys/arch/atari/dev/clock.c	Sat Jan 26 18:13:55 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.54 2012/06/30 12:42:37 tsutsui Exp $	*/
+/*	$NetBSD: clock.c,v 1.55 2013/01/26 18:13:55 apb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.54 2012/06/30 12:42:37 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.55 2013/01/26 18:13:55 apb Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -552,7 +552,7 @@ rtcwrite(dev_t dev, struct uio *uio, int
 	 */
 	length = uio-uio_resid;
 	if (uio-uio_offset || (length != sizeof(buffer)
-	   length != sizeof(buffer - 1)))
+	   length != sizeof(buffer) - 1))
 		return EINVAL;
 	
 	if ((error = uiomove((void *)buffer, sizeof(buffer), uio)))



CVS commit: src/sys/arch/atari/dev

2012-06-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 30 12:42:37 UTC 2012

Modified Files:
src/sys/arch/atari/dev: clock.c

Log Message:
Fix buffer overrun (off by one). PR port-atari/42717


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/atari/dev/clock.c

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

Modified files:

Index: src/sys/arch/atari/dev/clock.c
diff -u src/sys/arch/atari/dev/clock.c:1.53 src/sys/arch/atari/dev/clock.c:1.54
--- src/sys/arch/atari/dev/clock.c:1.53	Sun Jun  5 06:33:42 2011
+++ src/sys/arch/atari/dev/clock.c	Sat Jun 30 12:42:37 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.53 2011/06/05 06:33:42 tsutsui Exp $	*/
+/*	$NetBSD: clock.c,v 1.54 2012/06/30 12:42:37 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.53 2011/06/05 06:33:42 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.54 2012/06/30 12:42:37 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -505,7 +505,7 @@ rtcread(dev_t dev, struct uio *uio, int 
 	struct clock_softc	*sc;
 	mc_todregs		clkregs;
 	int			s, length;
-	char			buffer[16];
+	char			buffer[16 + 1];
 
 	sc = device_lookup_private(clock_cd, minor(dev));
 



CVS commit: src/sys/arch/atari/dev

2011-10-03 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Oct  4 04:50:20 UTC 2011

Modified Files:
src/sys/arch/atari/dev: grfabs_et.h

Log Message:
expand the attr array to hold all the bytes we store in it.
not that the code actually does anything with the extra bytes,
but at least it builds with gcc 4.5.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/atari/dev/grfabs_et.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/arch/atari/dev/grfabs_et.h
diff -u src/sys/arch/atari/dev/grfabs_et.h:1.3 src/sys/arch/atari/dev/grfabs_et.h:1.4
--- src/sys/arch/atari/dev/grfabs_et.h:1.3	Tue Oct 20 19:10:10 2009
+++ src/sys/arch/atari/dev/grfabs_et.h	Tue Oct  4 04:50:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: grfabs_et.h,v 1.3 2009/10/20 19:10:10 snj Exp $	*/
+/*	$NetBSD: grfabs_et.h,v 1.4 2011/10/04 04:50:20 chs Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.
@@ -31,7 +31,7 @@
 typedef struct {
 	u_char	misc_output;
 	u_char	crt[25];	/* Std. VGA crt registers	*/
-	u_char	attr[21];	/* Std. VGA attr. registers	*/
+	u_char	attr[25];	/* Std. VGA attr. registers	*/
 	u_char	grf[9];		/* Std. VGA grf. registers	*/
 	u_char	seq[5];		/* Std. VGA seq. registers	*/
 



CVS commit: src/sys/arch/atari/dev

2010-04-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Apr 17 12:54:29 UTC 2010

Modified Files:
src/sys/arch/atari/dev: atari5380.c ncr5380.c

Log Message:
extern inline - static inline


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/atari/dev/atari5380.c
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/atari/dev/ncr5380.c

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

Modified files:

Index: src/sys/arch/atari/dev/atari5380.c
diff -u src/sys/arch/atari/dev/atari5380.c:1.55 src/sys/arch/atari/dev/atari5380.c:1.56
--- src/sys/arch/atari/dev/atari5380.c:1.55	Tue Apr 13 13:30:37 2010
+++ src/sys/arch/atari/dev/atari5380.c	Sat Apr 17 12:54:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: atari5380.c,v 1.55 2010/04/13 13:30:37 tsutsui Exp $	*/
+/*	$NetBSD: atari5380.c,v 1.56 2010/04/17 12:54:29 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: atari5380.c,v 1.55 2010/04/13 13:30:37 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: atari5380.c,v 1.56 2010/04/17 12:54:29 tsutsui Exp $);
 
 #include opt_atariscsi.h
 
@@ -306,7 +306,7 @@
 	SCSI_5380-scsi_5380[(rnum  1) | 1] = val;
 }
 
-extern inline void
+static inline void
 scsi_tt_ienable(void)
 {
 
@@ -315,7 +315,7 @@
 	single_inst_bset_b(MFP2-mf_imra, IA_SCSI);
 }
 
-extern inline void
+static inline void
 scsi_tt_idisable(void)
 {
 
@@ -324,7 +324,7 @@
 	single_inst_bclr_b(MFP2-mf_imra, IA_SCSI);
 }
 
-extern inline void
+static inline void
 scsi_tt_clr_ipend(void)
 {
 	int tmp;
@@ -718,21 +718,21 @@
 	DMA-dma_data = val;
 }
 
-extern inline void
+static inline void
 scsi_falcon_ienable(void)
 {
 
 	single_inst_bset_b(MFP-mf_imrb, IB_DINT);
 }
 
-extern inline void
+static inline void
 scsi_falcon_idisable(void)
 {
 
 	single_inst_bclr_b(MFP-mf_imrb, IB_DINT);
 }
 
-extern inline void
+static inline void
 scsi_falcon_clr_ipend(void)
 {
 	int tmp;
@@ -741,7 +741,7 @@
 	rem_sicallback((si_farg)ncr_ctrl_intr);
 }
 
-extern inline int
+static inline int
 scsi_falcon_ipending(void)
 {
 
@@ -787,7 +787,7 @@
 
 static	int falcon_lock = 0;
 
-extern inline int
+static inline int
 falcon_claimed_dma(void)
 {
 
@@ -805,7 +805,7 @@
 	return 1;
 }
 
-extern inline void
+static inline void
 falcon_reconsider_dma(void)
 {
 
@@ -990,7 +990,7 @@
 	}
 }
 
-extern inline void
+static inline void
 scsi_ienable(void)
 {
 
@@ -1000,7 +1000,7 @@
 		scsi_tt_ienable();
 }
 
-extern inline void
+static inline void
 scsi_idisable(void)
 {
 
@@ -1010,7 +1010,7 @@
 		scsi_tt_idisable();
 }
 
-extern inline void
+static inline void
 scsi_clr_ipend(void)
 {
 
@@ -1020,7 +1020,7 @@
 		scsi_tt_clr_ipend();
 }
 
-extern inline int
+static inline int
 scsi_ipending(void)
 {
 
@@ -1030,7 +1030,7 @@
 		return GET_TT_REG(NCR5380_DMSTAT)  SC_IRQ_SET;
 }
 
-extern inline void
+static inline void
 scsi_dma_setup(SC_REQ *reqp, u_int phase, uint8_t mbase)
 {
 
@@ -1040,7 +1040,7 @@
 		scsi_tt_dmasetup(reqp, phase, mbase);
 }
 
-extern inline int
+static inline int
 wrong_dma_range(SC_REQ *reqp, struct dma_chain *dm)
 {
 
@@ -1050,7 +1050,7 @@
 		return tt_wrong_dma_range(reqp, dm);
 }
 
-extern inline int
+static inline int
 poll_edma(SC_REQ *reqp)
 {
 
@@ -1060,7 +1060,7 @@
 		return tt_poll_edma(reqp);
 }
 
-extern inline int
+static inline int
 get_dma_result(SC_REQ *reqp, u_long *bytes_left)
 {
 
@@ -1070,7 +1070,7 @@
 		return tt_get_dma_result(reqp, bytes_left);
 }
 
-extern inline int
+static inline int
 can_access_5380(void)
 {
 

Index: src/sys/arch/atari/dev/ncr5380.c
diff -u src/sys/arch/atari/dev/ncr5380.c:1.67 src/sys/arch/atari/dev/ncr5380.c:1.68
--- src/sys/arch/atari/dev/ncr5380.c:1.67	Tue Apr 13 13:30:37 2010
+++ src/sys/arch/atari/dev/ncr5380.c	Sat Apr 17 12:54:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ncr5380.c,v 1.67 2010/04/13 13:30:37 tsutsui Exp $	*/
+/*	$NetBSD: ncr5380.c,v 1.68 2010/04/17 12:54:29 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ncr5380.c,v 1.67 2010/04/13 13:30:37 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: ncr5380.c,v 1.68 2010/04/17 12:54:29 tsutsui Exp $);
 
 /*
  * Bit mask of targets you want debugging to be shown
@@ -96,7 +96,8 @@
  * some cases (especially when using my tapedrive, a Tandberg 3600) the
  * device is busy internally and the first SCSI-phase will be delayed.
  */
-extern inline int wait_req_true(void)
+static inline int
+wait_req_true(void)
 {
 	int timeout = 25;
 
@@ -109,7 +110,8 @@
  * Wait for request-line to become inactive. When it doesn't return 0.
  * Otherwise return != 0.
  */
-extern inline int wait_req_false(void)
+static inline int
+wait_req_false(void)
 {
 	int timeout = 25;
 
@@ -118,20 +120,23 @@
 	return (GET_5380_REG(NCR5380_IDSTAT)  SC_S_REQ) == 0;
 }
 
-extern inline void ack_message(void)
+static inline void
+ack_message(void)
 {
 
 	

CVS commit: src/sys/arch/atari/dev

2010-04-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Apr 13 13:29:35 UTC 2010

Modified Files:
src/sys/arch/atari/dev: ite_cc.c

Log Message:
Misc KNF.


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

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

Modified files:

Index: src/sys/arch/atari/dev/ite_cc.c
diff -u src/sys/arch/atari/dev/ite_cc.c:1.35 src/sys/arch/atari/dev/ite_cc.c:1.36
--- src/sys/arch/atari/dev/ite_cc.c:1.35	Tue Feb  9 23:05:16 2010
+++ src/sys/arch/atari/dev/ite_cc.c	Tue Apr 13 13:29:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite_cc.c,v 1.35 2010/02/09 23:05:16 wiz Exp $	*/
+/*	$NetBSD: ite_cc.c,v 1.36 2010/04/13 13:29:35 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ite_cc.c,v 1.35 2010/02/09 23:05:16 wiz Exp $);
+__KERNEL_RCSID(0, $NetBSD: ite_cc.c,v 1.36 2010/04/13 13:29:35 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -130,9 +130,9 @@
 int
 grfccmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
 {
-	static int	did_consinit = 0;
-	static int	must_probe = 1;
-	grf_auxp_t	*grf_auxp = auxp;
+	static int did_consinit = 0;
+	static int must_probe = 1;
+	grf_auxp_t *grf_auxp = auxp;
 	extern const struct cdevsw view_cdevsw;
 
 	if (must_probe) {
@@ -140,15 +140,15 @@
 		 * Check if the layers we depend on exist
 		 */
 		if (!(machineid  (ATARI_TT|ATARI_FALCON)))
-			return (0);
+			return 0;
 #ifdef TT_VIDEO
 		if ((machineid  ATARI_TT)  !grfabs_probe(tt_probe_video))
-			return (0);
+			return 0;
 #endif /* TT_VIDEO */
 #ifdef FALCON_VIDEO
-		if ((machineid  ATARI_FALCON)
-		 !grfabs_probe(falcon_probe_video))
-			return (0);
+		if ((machineid  ATARI_FALCON) 
+		!grfabs_probe(falcon_probe_video))
+			return 0;
 #endif /* FALCON_VIDEO */
 
 		viewprobe();
@@ -160,12 +160,12 @@
 		 * Early console init. Only match first unit.
 		 */
 		if (did_consinit)
-			return(0);
+			return 0;
 		if ((*view_cdevsw.d_open)(cfp-cf_unit, 0, 0, NULL))
-			return(0);
+			return 0;
 		cfdata_grf = cfp;
 		did_consinit = 1;
-		return (1);
+		return 1;
 	}
 
 	/*
@@ -174,20 +174,20 @@
 	 * the other configured units.
 	 */
 	if (grf_auxp-from_bus_match  (did_consinit  1))
-		return (0);
+		return 0;
 
 	if (!grf_auxp-from_bus_match  (grf_auxp-unit != cfp-cf_unit))
-		return (0);
+		return 0;
 
 	/*
 	 * Final constraint: each grf needs a view
 	 */
-	if((cfdata_grf == NULL) || (did_consinit  1)) {
-	if((*view_cdevsw.d_open)(cfp-cf_unit, 0, 0, NULL))
-		return(0);
+	if ((cfdata_grf == NULL) || (did_consinit  1)) {
+	if ((*view_cdevsw.d_open)(cfp-cf_unit, 0, 0, NULL))
+		return 0;
 	}
 	did_consinit = 2;
-	return(1);
+	return 1;
 }
 
 /*
@@ -197,12 +197,12 @@
 void
 grfccattach(struct device *pdp, struct device *dp, void *auxp)
 {
-	static struct grf_softc		congrf;
-	static int			first_attach = 1;
-	   grf_auxp_t		*grf_bus_auxp = auxp;
-	   grf_auxp_t		grf_auxp;
-	   struct grf_softc		*gp;
-	   int			maj;
+	static struct grf_softc congrf;
+	static int first_attach = 1;
+	grf_auxp_t *grf_bus_auxp = auxp;
+	grf_auxp_t grf_auxp;
+	struct grf_softc *gp;
+	int maj;
 	extern const struct cdevsw grf_cdevsw;
 
 	/*
@@ -213,7 +213,7 @@
 	/*
 	 * Handle exception case: early console init
 	 */
-	if(dp == NULL) {
+	if (dp == NULL) {
 		congrf.g_unit= cfdata_grf-cf_unit;
 		congrf.g_grfdev  = makedev(maj, congrf.g_unit);
 		congrf.g_itedev  = (dev_t)-1;
@@ -233,15 +233,14 @@
 	gp-g_unit = device_unit(gp-g_device);
 	grfsp[gp-g_unit] = gp;
 
-	if((cfdata_grf != NULL)  (gp-g_unit == congrf.g_unit)) {
+	if ((cfdata_grf != NULL)  (gp-g_unit == congrf.g_unit)) {
 		/*
 		 * We inited earlier just copy the info, take care
 		 * not to copy the device struct though.
 		 */
 		memcpy(gp-g_display, congrf.g_display,
 			(char *)gp[1] - (char *)gp-g_display);
-	}
-	else {
+	} else {
 		gp-g_grfdev  = makedev(maj, gp-g_unit);
 		gp-g_itedev  = (dev_t)-1;
 		gp-g_flags   = GF_ALIVE;
@@ -254,9 +253,10 @@
 
 	printf(: width %d height %d, gp-g_display.gd_dwidth,
 		gp-g_display.gd_dheight);
-	if(gp-g_display.gd_colors == 2)
+	if (gp-g_display.gd_colors == 2)
 		printf( monochrome\n);
-	else printf( colors %d\n, gp-g_display.gd_colors);
+	else
+		printf( colors %d\n, gp-g_display.gd_colors);
 	
 	/*
 	 * try and attach an ite
@@ -270,7 +270,7 @@
 		first_attach = 0;
 		grf_auxp.from_bus_match = 0;
 		for (grf_auxp.unit=1; grf_auxp.unit  NGRFCC; grf_auxp.unit++) {
-		config_found(pdp, (void*)grf_auxp, grf_bus_auxp-busprint);
+			config_found(pdp, grf_auxp, grf_bus_auxp-busprint);
 		}
 	}
 }
@@ -278,9 +278,10 @@
 int
 grfccprint(void *auxp, const char *pnp)
 {
-	if(pnp)
+
+	if (pnp)
 		aprint_normal(ite at %s, pnp);
-	return(UNCONF);
+	return UNCONF;
 }
 
 /*
@@ -289,7 +290,7 @@
 int
 grfcc_cnprobe(void)
 {
-	return(CN_INTERNAL);
+	return CN_INTERNAL;
 }
 /*
 

CVS commit: src/sys/arch/atari/dev

2010-04-12 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Apr 12 12:28:59 UTC 2010

Modified Files:
src/sys/arch/atari/dev: dma.c

Log Message:
KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/atari/dev/dma.c

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

Modified files:

Index: src/sys/arch/atari/dev/dma.c
diff -u src/sys/arch/atari/dev/dma.c:1.25 src/sys/arch/atari/dev/dma.c:1.26
--- src/sys/arch/atari/dev/dma.c:1.25	Sat Apr 10 18:02:05 2010
+++ src/sys/arch/atari/dev/dma.c	Mon Apr 12 12:28:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dma.c,v 1.25 2010/04/10 18:02:05 tsutsui Exp $	*/
+/*	$NetBSD: dma.c,v 1.26 2010/04/12 12:28:59 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -47,7 +47,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dma.c,v 1.25 2010/04/10 18:02:05 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: dma.c,v 1.26 2010/04/12 12:28:59 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -89,7 +89,7 @@
 static void
 st_dma_init(void)
 {
-	int	i;
+	int i;
 
 	TAILQ_INIT(dma_free);
 	TAILQ_INIT(dma_active);
@@ -102,23 +102,24 @@
 }
 
 int
-st_dmagrab(dma_farg int_func, dma_farg call_func, void *softc, int *lock_stat, int rcaller)
+st_dmagrab(dma_farg int_func, dma_farg call_func, void *softc, int *lock_stat,
+int rcaller)
 {
-	int		sps;
-	DMA_ENTRY	*req;
+	int s;
+	DMA_ENTRY *req;
 
-	if(must_init) {
+	if (must_init) {
 		st_dma_init();
 		must_init = 0;
 	}
 	*lock_stat = DMA_LOCK_REQ;
 
-	sps = splhigh();
+	s = splhigh();
 
 	/*
 	 * Create a request...
 	 */
-	if(dma_free.tqh_first == NULL)
+	if (dma_free.tqh_first == NULL)
 		panic(st_dmagrab: Too many outstanding requests);
 	req = dma_free.tqh_first;
 	TAILQ_REMOVE(dma_free, dma_free.tqh_first, entries);
@@ -128,50 +129,50 @@
 	req-lock_stat = lock_stat;
 	TAILQ_INSERT_TAIL(dma_active, req, entries);
 
-	if(dma_active.tqh_first != req) {
+	if (dma_active.tqh_first != req) {
 		if (call_func == NULL) {
 			do {
 tsleep(dma_active, PRIBIO, dmalck, 0);
 			} while (*req-lock_stat != DMA_LOCK_GRANT);
-			splx(sps);
-			return(1);
+			splx(s);
+			return 1;
 		}
-		splx(sps);
-		return(0);
+		splx(s);
+		return 0;
 	}
-	splx(sps);
+	splx(s);
 
 	/*
 	 * We're at the head of the queue, ergo: we got the lock.
 	 */
 	*lock_stat = DMA_LOCK_GRANT;
 
-	if(rcaller || (call_func == NULL)) {
+	if (rcaller || (call_func == NULL)) {
 		/*
 		 * Just return to caller immediately without going
 		 * through 'call_func' first.
 		 */
-		return(1);
+		return 1;
 	}
 
 	(*call_func)(softc);	/* Call followup function		*/
-	return(0);
+	return 0;
 }
 
 void
 st_dmafree(void *softc, int *lock_stat)
 {
-	int		sps;
-	DMA_ENTRY	*req;
+	int s;
+	DMA_ENTRY *req;
 	
-	sps = splhigh();
+	s = splhigh();
 
 	/*
 	 * Some validity checks first.
 	 */
-	if((req = dma_active.tqh_first) == NULL)
+	if ((req = dma_active.tqh_first) == NULL)
 		panic(st_dmafree: empty active queue);
-	if(req-softc != softc)
+	if (req-softc != softc)
 		printf(Caller of st_dmafree is not lock-owner!\n);
 
 	/*
@@ -181,37 +182,37 @@
 	TAILQ_REMOVE(dma_active, req, entries);
 	TAILQ_INSERT_HEAD(dma_free, req, entries);
 
-	if((req = dma_active.tqh_first) != NULL) {
+	if ((req = dma_active.tqh_first) != NULL) {
 		*req-lock_stat = DMA_LOCK_GRANT;
 
 		if (req-call_func == NULL)
 			wakeup((void *)dma_active);
 		else {
-		/*
-		 * Call next request through softint handler. This avoids
-		 * spl-conflicts.
-		 */
-		add_sicallback((si_farg)req-call_func, req-softc, 0);
+			/*
+			 * Call next request through softint handler.
+			 * This avoids spl-conflicts.
+			 */
+			add_sicallback((si_farg)req-call_func, req-softc, 0);
 		}
 	}
-	splx(sps);
-	return;
+	splx(s);
 }
 
 int
 st_dmawanted(void)
 {
-	return(dma_active.tqh_first-entries.tqe_next != NULL);
+
+	return dma_active.tqh_first-entries.tqe_next != NULL;
 }
 
 int
 cdmaint(void *unused, int sr)
 	/* sr:	 sr at time of interrupt */
 {
-	dma_farg	int_func;
-	void		*softc;
+	dma_farg int_func;
+	void *softc;
 
-	if(dma_active.tqh_first != NULL) {
+	if (dma_active.tqh_first != NULL) {
 		/*
 		 * Due to the logic of the ST-DMA chip, it is not possible to
 		 * check for stray interrupts here...
@@ -229,9 +230,9 @@
  * Note: The order _is_ important!
  */
 void
-st_dmaaddr_set(void * address)
+st_dmaaddr_set(void *address)
 {
-	register u_long ad = (u_long)address;
+	u_long ad = (u_long)address;
 
 	DMA-dma_addr[AD_LOW ] = (ad )  0xff;
 	DMA-dma_addr[AD_MID ] = (ad  8)  0xff;
@@ -244,12 +245,12 @@
 u_long
 st_dmaaddr_get(void)
 {
-	register u_long ad = 0;
+	u_long ad = 0;
 
 	ad  = (DMA-dma_addr[AD_LOW ]  0xff);
 	ad |= (DMA-dma_addr[AD_MID ]  0xff)  8;
 	ad |= (DMA-dma_addr[AD_HIGH]  0xff) 16;
-	return(ad);
+	return ad;
 }
 
 /*
@@ -259,6 +260,7 @@
 void
 st_dmacomm(int mode, int nblk)
 {
+
 	DMA-dma_mode = mode;
 	DMA-dma_mode = mode ^ DMA_WRBIT;
 	DMA-dma_mode 

CVS commit: src/sys/arch/atari/dev

2010-04-12 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Apr 12 12:43:39 UTC 2010

Modified Files:
src/sys/arch/atari/dev: dma.c

Log Message:
- more cosmetics
- use queue(3) macro properly


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/atari/dev/dma.c

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

Modified files:

Index: src/sys/arch/atari/dev/dma.c
diff -u src/sys/arch/atari/dev/dma.c:1.26 src/sys/arch/atari/dev/dma.c:1.27
--- src/sys/arch/atari/dev/dma.c:1.26	Mon Apr 12 12:28:59 2010
+++ src/sys/arch/atari/dev/dma.c	Mon Apr 12 12:43:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dma.c,v 1.26 2010/04/12 12:28:59 tsutsui Exp $	*/
+/*	$NetBSD: dma.c,v 1.27 2010/04/12 12:43:39 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -47,7 +47,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dma.c,v 1.26 2010/04/12 12:28:59 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: dma.c,v 1.27 2010/04/12 12:43:39 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -94,7 +94,7 @@
 	TAILQ_INIT(dma_free);
 	TAILQ_INIT(dma_active);
 
-	for(i = 0; i  NDMA_DEV; i++)
+	for (i = 0; i  NDMA_DEV; i++)
 		TAILQ_INSERT_HEAD(dma_free, dmatable[i], entries);
 
 	if (intr_establish(7, USER_VEC, 0, cdmaint, NULL) == NULL)
@@ -119,17 +119,16 @@
 	/*
 	 * Create a request...
 	 */
-	if (dma_free.tqh_first == NULL)
+	if ((req = TAILQ_FIRST(dma_free)) == NULL)
 		panic(st_dmagrab: Too many outstanding requests);
-	req = dma_free.tqh_first;
-	TAILQ_REMOVE(dma_free, dma_free.tqh_first, entries);
+	TAILQ_REMOVE(dma_free, req, entries);
 	req-call_func = call_func;
 	req-int_func  = int_func;
 	req-softc = softc;
 	req-lock_stat = lock_stat;
 	TAILQ_INSERT_TAIL(dma_active, req, entries);
 
-	if (dma_active.tqh_first != req) {
+	if (TAILQ_FIRST(dma_active) != req) {
 		if (call_func == NULL) {
 			do {
 tsleep(dma_active, PRIBIO, dmalck, 0);
@@ -170,7 +169,7 @@
 	/*
 	 * Some validity checks first.
 	 */
-	if ((req = dma_active.tqh_first) == NULL)
+	if ((req = TAILQ_FIRST(dma_active)) == NULL)
 		panic(st_dmafree: empty active queue);
 	if (req-softc != softc)
 		printf(Caller of st_dmafree is not lock-owner!\n);
@@ -182,7 +181,7 @@
 	TAILQ_REMOVE(dma_active, req, entries);
 	TAILQ_INSERT_HEAD(dma_free, req, entries);
 
-	if ((req = dma_active.tqh_first) != NULL) {
+	if ((req = TAILQ_FIRST(dma_active)) != NULL) {
 		*req-lock_stat = DMA_LOCK_GRANT;
 
 		if (req-call_func == NULL)
@@ -202,7 +201,7 @@
 st_dmawanted(void)
 {
 
-	return dma_active.tqh_first-entries.tqe_next != NULL;
+	return TAILQ_NEXT(TAILQ_FIRST(dma_active), entries) != NULL;
 }
 
 int
@@ -212,13 +211,13 @@
 	dma_farg int_func;
 	void *softc;
 
-	if (dma_active.tqh_first != NULL) {
+	if (TAILQ_FIRST(dma_active) != NULL) {
 		/*
 		 * Due to the logic of the ST-DMA chip, it is not possible to
 		 * check for stray interrupts here...
 		 */
-		int_func = dma_active.tqh_first-int_func;
-		softc= dma_active.tqh_first-softc;
+		int_func = TAILQ_FIRST(dma_active)-int_func;
+		softc= TAILQ_FIRST(dma_active)-softc;
 		add_sicallback((si_farg)int_func, softc, 0);
 		return 1;
 	}



CVS commit: src/sys/arch/atari/dev

2010-04-12 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Apr 12 13:05:25 UTC 2010

Modified Files:
src/sys/arch/atari/dev: lpt.c

Log Message:
Replace old MD sicallback functions with MI softint(9).


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/atari/dev/lpt.c

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

Modified files:

Index: src/sys/arch/atari/dev/lpt.c
diff -u src/sys/arch/atari/dev/lpt.c:1.32 src/sys/arch/atari/dev/lpt.c:1.33
--- src/sys/arch/atari/dev/lpt.c:1.32	Mon Nov 23 00:11:43 2009
+++ src/sys/arch/atari/dev/lpt.c	Mon Apr 12 13:05:25 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: lpt.c,v 1.32 2009/11/23 00:11:43 rmind Exp $ */
+/*	$NetBSD: lpt.c,v 1.33 2010/04/12 13:05:25 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1996 Leo Weppelman
@@ -56,7 +56,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lpt.c,v 1.32 2009/11/23 00:11:43 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: lpt.c,v 1.33 2010/04/12 13:05:25 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -104,6 +104,7 @@
 	u_char		sc_flags;
 #define	LPT_AUTOLF	0x20	/* automatic LF on CR XXX: LWP - not yet... */
 #define	LPT_NOINTR	0x40	/* do not use interrupt */
+	void		*sc_sicookie;
 };
 
 #define	LPTUNIT(s)	(minor(s)  0x1f)
@@ -118,9 +119,9 @@
 
 static void lptwakeup (void *arg);
 static int pushbytes (struct lpt_softc *);
-static void lptpseudointr (struct lpt_softc *);
+static void lptpseudointr (void *);
 int lptintr (struct lpt_softc *);
-int lpthwintr (struct lpt_softc *, int);
+int lpthwintr (void *);
 
 
 /*
@@ -166,6 +167,7 @@
 	if (intr_establish(0, USER_VEC, 0, (hw_ifun_t)lpthwintr, sc) == NULL)
 		aprint_error_dev(dp, Can't establish interrupt\n);
 	ym2149_strobe(1);
+	sc-sc_sicookie = softint_establish(SOFTINT_SERIAL, lptpseudointr, sc);
 
 	callout_init(sc-sc_wakeup_ch, 0);
 }
@@ -382,21 +384,24 @@
 }
 
 static void
-lptpseudointr(struct lpt_softc *sc)
+lptpseudointr(void *arg)
 {
+	struct lpt_softc *sc;
 	int	s;
 
+	sc = arg;
 	s = spltty();
 	lptintr(sc);
 	splx(s);
 }
 
 int
-lpthwintr(struct lpt_softc *sc, int sr)
+lpthwintr(void *arg)
 {
-	if (!BASEPRI(sr))
-		add_sicallback((si_farg)lptpseudointr, sc, 0);
-	else lptpseudointr(sc);
+	struct lpt_softc *sc;
+
+	sc = arg;
+	softint_schedule(sc-sc_sicookie);
 	return 1;
 }
 



CVS commit: src/sys/arch/atari/dev

2010-04-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Apr 10 16:07:04 UTC 2010

Modified Files:
src/sys/arch/atari/dev: ser.c

Log Message:
Make local functions static.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/atari/dev/ser.c

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

Modified files:

Index: src/sys/arch/atari/dev/ser.c
diff -u src/sys/arch/atari/dev/ser.c:1.50 src/sys/arch/atari/dev/ser.c:1.51
--- src/sys/arch/atari/dev/ser.c:1.50	Fri Apr  9 11:27:21 2010
+++ src/sys/arch/atari/dev/ser.c	Sat Apr 10 16:07:04 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ser.c,v 1.50 2010/04/09 11:27:21 tsutsui Exp $	*/
+/*	$NetBSD: ser.c,v 1.51 2010/04/10 16:07:04 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ser.c,v 1.50 2010/04/09 11:27:21 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: ser.c,v 1.51 2010/04/10 16:07:04 tsutsui Exp $);
 
 #include opt_ddb.h
 #include opt_mbtype.h
@@ -212,19 +212,19 @@
  */
 #define	SER_HW_CONSOLE	0x01
 
-void	ser_break(struct ser_softc *, int);
-void	ser_hwiflow(struct ser_softc *, int);
-void	ser_iflush(struct ser_softc *);
-void	ser_loadchannelregs(struct ser_softc *);
-void	ser_modem(struct ser_softc *, int);
-void	serdiag(void *);
-int	serhwiflow(struct tty *, int);
-void	serinit(int);
-void	serinitcons(int);
-int	sermintr(void *);
-int	sertrintr(void *);
-int	serparam(struct tty *, struct termios *);
-void	serstart(struct tty *);
+static void	ser_break(struct ser_softc *, int);
+static void	ser_hwiflow(struct ser_softc *, int);
+static void	ser_iflush(struct ser_softc *);
+static void	ser_loadchannelregs(struct ser_softc *);
+static void	ser_modem(struct ser_softc *, int);
+static void	serdiag(void *);
+static int	serhwiflow(struct tty *, int);
+static void	serinit(int);
+static void	serinitcons(int);
+static int	sermintr(void *);
+static int	sertrintr(void *);
+static int	serparam(struct tty *, struct termios *);
+static void	serstart(struct tty *);
 
 struct consdev;
 void	sercnprobe(struct consdev *);



CVS commit: src/sys/arch/atari/dev

2010-04-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Apr 10 18:02:05 UTC 2010

Modified Files:
src/sys/arch/atari/dev: atari5380.c dma.c

Log Message:
Always schedule callback functions via add_sicallback(),
which calls softint_schedule(9).

We cannot use BASEPRI() to check recursive calls any longer
since softint(9) has been reorganized to use kernel thread.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/atari/dev/atari5380.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/atari/dev/dma.c

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

Modified files:

Index: src/sys/arch/atari/dev/atari5380.c
diff -u src/sys/arch/atari/dev/atari5380.c:1.53 src/sys/arch/atari/dev/atari5380.c:1.54
--- src/sys/arch/atari/dev/atari5380.c:1.53	Tue Oct 20 19:10:10 2009
+++ src/sys/arch/atari/dev/atari5380.c	Sat Apr 10 18:02:05 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: atari5380.c,v 1.53 2009/10/20 19:10:10 snj Exp $	*/
+/*	$NetBSD: atari5380.c,v 1.54 2010/04/10 18:02:05 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: atari5380.c,v 1.53 2009/10/20 19:10:10 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: atari5380.c,v 1.54 2010/04/10 18:02:05 tsutsui Exp $);
 
 #include opt_atariscsi.h
 
@@ -1104,14 +1104,7 @@
 {
 	if (GET_5380_REG(NCR5380_DMSTAT)  SC_IRQ_SET) {
 		scsi_idisable();
-		if (!BASEPRI(sr))
-			add_sicallback((si_farg)ncr_ctrl_intr,
-		(void *)cur_softc, 0);
-		else {
-			spl1();
-			ncr_ctrl_intr(cur_softc);
-			spl0();
-		}
+		add_sicallback((si_farg)ncr_ctrl_intr, (void *)cur_softc, 0);
 	}
 }
 
@@ -1125,14 +1118,7 @@
 
 	if ((reqp = connected)  (reqp-dr_flag  DRIVER_IN_DMA)) {
 		scsi_idisable();
-		if (!BASEPRI(sr))
-			add_sicallback((si_farg)ncr_dma_intr,
-	(void *)cur_softc, 0);
-		else {
-			spl1();
-			ncr_dma_intr(cur_softc);
-			spl0();
-		}
+		add_sicallback((si_farg)ncr_dma_intr, (void *)cur_softc, 0);
 	}
 }
 

Index: src/sys/arch/atari/dev/dma.c
diff -u src/sys/arch/atari/dev/dma.c:1.24 src/sys/arch/atari/dev/dma.c:1.25
--- src/sys/arch/atari/dev/dma.c:1.24	Tue Oct 20 19:10:10 2009
+++ src/sys/arch/atari/dev/dma.c	Sat Apr 10 18:02:05 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dma.c,v 1.24 2009/10/20 19:10:10 snj Exp $	*/
+/*	$NetBSD: dma.c,v 1.25 2010/04/10 18:02:05 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -47,7 +47,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dma.c,v 1.24 2009/10/20 19:10:10 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: dma.c,v 1.25 2010/04/10 18:02:05 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -218,14 +218,7 @@
 		 */
 		int_func = dma_active.tqh_first-int_func;
 		softc= dma_active.tqh_first-softc;
-
-		if(!BASEPRI(sr))
-			add_sicallback((si_farg)int_func, softc, 0);
-		else {
-			spl1();
-			(*int_func)(softc);
-			spl0();
-		}
+		add_sicallback((si_farg)int_func, softc, 0);
 		return 1;
 	}
 	return 0;



CVS commit: src/sys/arch/atari/dev

2010-04-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr  9 10:07:14 UTC 2010

Modified Files:
src/sys/arch/atari/dev: ser.c

Log Message:
Include ioconf.h for struct cfdriver.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/atari/dev/ser.c

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

Modified files:

Index: src/sys/arch/atari/dev/ser.c
diff -u src/sys/arch/atari/dev/ser.c:1.46 src/sys/arch/atari/dev/ser.c:1.47
--- src/sys/arch/atari/dev/ser.c:1.46	Fri Apr  9 10:04:35 2010
+++ src/sys/arch/atari/dev/ser.c	Fri Apr  9 10:07:14 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ser.c,v 1.46 2010/04/09 10:04:35 tsutsui Exp $	*/
+/*	$NetBSD: ser.c,v 1.47 2010/04/09 10:07:14 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ser.c,v 1.46 2010/04/09 10:04:35 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: ser.c,v 1.47 2010/04/09 10:07:14 tsutsui Exp $);
 
 #include opt_ddb.h
 #include opt_mbtype.h
@@ -121,6 +121,8 @@
 #include machine/intr.h
 #include atari/dev/serreg.h
 
+#include ioconf.h
+
 #if !defined(_MILANHW_)
 #include atari/dev/ym2149reg.h
 #else
@@ -247,8 +249,6 @@
 CFATTACH_DECL(ser, sizeof(struct ser_softc),
 sermatch, serattach, NULL, NULL);
 
-extern struct cfdriver ser_cd;
-
 dev_type_open(seropen);
 dev_type_close(serclose);
 dev_type_read(serread);



CVS commit: src/sys/arch/atari/dev

2010-04-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr  9 10:49:37 UTC 2010

Modified Files:
src/sys/arch/atari/dev: ser.c

Log Message:
- split device_t/softc
- verbose output on attach as well as zs serial ports


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/atari/dev/ser.c

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

Modified files:

Index: src/sys/arch/atari/dev/ser.c
diff -u src/sys/arch/atari/dev/ser.c:1.47 src/sys/arch/atari/dev/ser.c:1.48
--- src/sys/arch/atari/dev/ser.c:1.47	Fri Apr  9 10:07:14 2010
+++ src/sys/arch/atari/dev/ser.c	Fri Apr  9 10:49:37 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ser.c,v 1.47 2010/04/09 10:07:14 tsutsui Exp $	*/
+/*	$NetBSD: ser.c,v 1.48 2010/04/09 10:49:37 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ser.c,v 1.47 2010/04/09 10:07:14 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: ser.c,v 1.48 2010/04/09 10:49:37 tsutsui Exp $);
 
 #include opt_ddb.h
 #include opt_mbtype.h
@@ -158,7 +158,7 @@
 #define RXHIWAT   (RXBUFSIZE  2)
 
 struct ser_softc {
-	struct device	 sc_dev;
+	device_t	 sc_dev;
 	struct tty	*sc_tty;
 
 	struct callout sc_diag_ch;
@@ -243,10 +243,10 @@
 /*
  * Autoconfig stuff
  */
-static void serattach(struct device *, struct device *, void *);
-static int  sermatch(struct device *, struct cfdata *, void *);
+static int  sermatch(device_t, cfdata_t, void *);
+static void serattach(device_t, device_t, void *);
 
-CFATTACH_DECL(ser, sizeof(struct ser_softc),
+CFATTACH_DECL_NEW(ser, sizeof(struct ser_softc),
 sermatch, serattach, NULL, NULL);
 
 dev_type_open(seropen);
@@ -265,12 +265,12 @@
 
 /*ARGSUSED*/
 static	int
-sermatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+sermatch(device_t parent, cfdata_t cf, void *aux)
 {
 	static int ser_matched = 0;
 
 	/* Match at most one ser unit */
-	if (strcmp((char *)auxp, ser) || ser_matched)
+	if (strcmp((char *)aux, ser) || ser_matched)
 		return 0;
 
 	ser_matched = 1;
@@ -279,24 +279,26 @@
 
 /*ARGSUSED*/
 static void
-serattach(struct device *pdp, struct device *dp, void *auxp)
+serattach(device_t parent, device_t self, void *aux)
 {
-	struct ser_softc *sc = device_private(dp);
+	struct ser_softc *sc = device_private(self);
+
+	sc-sc_dev = self;
 
 	if (intr_establish(1, USER_VEC, 0, (hw_ifun_t)sermintr, sc) == NULL)
-		printf(serattach: Can't establish interrupt (1)\n);
+		aprint_error(: Can't establish interrupt (1)\n);
 	if (intr_establish(2, USER_VEC, 0, (hw_ifun_t)sermintr, sc) == NULL)
-		printf(serattach: Can't establish interrupt (2)\n);
+		aprint_error(: Can't establish interrupt (2)\n);
 	if (intr_establish(14, USER_VEC, 0, (hw_ifun_t)sermintr, sc) == NULL)
-		printf(serattach: Can't establish interrupt (14)\n);
+		aprint_error(: Can't establish interrupt (14)\n);
 	if (intr_establish(9, USER_VEC, 0, (hw_ifun_t)sertrintr, sc) == NULL)
-		printf(serattach: Can't establish interrupt (9)\n);
+		aprint_error(: Can't establish interrupt (9)\n);
 	if (intr_establish(10, USER_VEC, 0, (hw_ifun_t)sertrintr, sc) == NULL)
-		printf(serattach: Can't establish interrupt (10)\n);
+		aprint_error(: Can't establish interrupt (10)\n);
 	if (intr_establish(11, USER_VEC, 0, (hw_ifun_t)sertrintr, sc) == NULL)
-		printf(serattach: Can't establish interrupt (11)\n);
+		aprint_error(: Can't establish interrupt (11)\n);
 	if (intr_establish(12, USER_VEC, 0, (hw_ifun_t)sertrintr, sc) == NULL)
-		printf(serattach: Can't establish interrupt (12)\n);
+		aprint_error(: Can't establish interrupt (12)\n);
 
 	sc-sc_sicookie = softint_establish(SOFTINT_SERIAL, sersoft, sc);
 
@@ -322,10 +324,10 @@
 		SET(sc-sc_hwflags, SER_HW_CONSOLE);
 #endif /* SERCONSOLE  0 */
 
-	printf(\n);
+	aprint_normal(: modem1 on 68901 MFP1 USART\n);
 	if (ISSET(sc-sc_hwflags, SER_HW_CONSOLE)) {
 		serinit(CONSBAUD);
-		printf(%s: console\n, sc-sc_dev.dv_xname);
+		aprint_normal_dev(self, console\n);
 	}
 }
 
@@ -337,7 +339,7 @@
 	struct tty *tp = sc-sc_tty;
 
 	printf(%s: %s %sclocal  %sdcd %sts_carr_on %sdtr %stx_stopped\n,
-	sc-sc_dev.dv_xname, str,
+	device_xname(sc-sc_dev), str,
 	ISSET(tp-t_cflag, CLOCAL) ? + : -,
 	ISSET(sc-sc_msr, MCR_DCD) ? + : -,
 	ISSET(tp-t_state, TS_CARR_ON) ? + : -,
@@ -345,7 +347,7 @@
 	sc-sc_tx_stopped ? + : -);
 
 	printf(%s: %s %scrtscts %scts %sts_ttstop  %srts %srx_blocked\n,
-	sc-sc_dev.dv_xname, str,
+	device_xname(sc-sc_dev), str,
 	ISSET(tp-t_cflag, CRTSCTS) ? + : -,
 	ISSET(sc-sc_msr, MCR_CTS) ? + : -,
 	ISSET(tp-t_state, TS_TTSTOP) ? + : -,
@@ -1006,7 +1008,7 @@
 
 	log(LOG_WARNING,
 	%s: %d silo overflow%s, %d ibuf flood%s\n,
-	sc-sc_dev.dv_xname,
+	device_xname(sc-sc_dev),
 	overflows, overflows == 1 ?  : s,
 	floods, floods == 1 ?  : s);
 }



CVS commit: src/sys/arch/atari/dev

2010-04-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr  9 11:09:03 UTC 2010

Modified Files:
src/sys/arch/atari/dev: ser.c

Log Message:
Make options SERCONSOLE (force serial console if DCD is detected)
patchable by binpatch(8) like:
---
# binpatch -s serconsole -r 0 /netbsd
serconsole(0x23bac4): 0x0001 (1), at offset 0x23bb44 in /netbsd
new value: 0x (0)
#
---

May work around PR port-atari/39849
(netbsd-ATARITT kernel fails with serial port connected)
and some old TT030 with early revision boards.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/atari/dev/ser.c

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

Modified files:

Index: src/sys/arch/atari/dev/ser.c
diff -u src/sys/arch/atari/dev/ser.c:1.48 src/sys/arch/atari/dev/ser.c:1.49
--- src/sys/arch/atari/dev/ser.c:1.48	Fri Apr  9 10:49:37 2010
+++ src/sys/arch/atari/dev/ser.c	Fri Apr  9 11:09:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ser.c,v 1.48 2010/04/09 10:49:37 tsutsui Exp $	*/
+/*	$NetBSD: ser.c,v 1.49 2010/04/09 11:09:03 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ser.c,v 1.48 2010/04/09 10:49:37 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: ser.c,v 1.49 2010/04/09 11:09:03 tsutsui Exp $);
 
 #include opt_ddb.h
 #include opt_mbtype.h
@@ -263,6 +263,11 @@
 	serstop, sertty, serpoll, nommap, ttykqfilter, D_TTY
 };
 
+#ifndef SERCONSOLE
+#define SERCONSOLE	0
+#endif
+int serconsole = SERCONSOLE;	/* patchable */
+
 /*ARGSUSED*/
 static	int
 sermatch(device_t parent, cfdata_t cf, void *aux)
@@ -316,13 +321,13 @@
 
 	callout_init(sc-sc_diag_ch, 0);
 
-#if SERCONSOLE  0
-	/*
-	 * Activate serial console when DCD present...
-	 */
-	if ((MFP-mf_gpip  MCR_DCD) == 0)
-		SET(sc-sc_hwflags, SER_HW_CONSOLE);
-#endif /* SERCONSOLE  0 */
+	if (serconsole) {
+		/*
+		 * Activate serial console when DCD present...
+		 */
+		if ((MFP-mf_gpip  MCR_DCD) == 0)
+			SET(sc-sc_hwflags, SER_HW_CONSOLE);
+	}
 
 	aprint_normal(: modem1 on 68901 MFP1 USART\n);
 	if (ISSET(sc-sc_hwflags, SER_HW_CONSOLE)) {
@@ -1361,11 +1366,10 @@
 	/* initialize required fields */
 	/* XXX: LWP What unit? */
 	cp-cn_dev = makedev(cdevsw_lookup_major(ser_cdevsw), 0);
-#if SERCONSOLE  0
-	cp-cn_pri = CN_REMOTE;	/* Force a serial port console */
-#else
-	cp-cn_pri = CN_NORMAL;
-#endif /* SERCONSOLE  0 */
+	if (serconsole)
+		cp-cn_pri = CN_REMOTE;	/* Force a serial port console */
+	else
+		cp-cn_pri = CN_NORMAL;
 }
 
 void



CVS commit: src/sys/arch/atari/dev

2010-04-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr  9 11:30:19 UTC 2010

Modified Files:
src/sys/arch/atari/dev: zs.c

Log Message:
Include ioconf.h for struct cfdriver.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/atari/dev/zs.c

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

Modified files:

Index: src/sys/arch/atari/dev/zs.c
diff -u src/sys/arch/atari/dev/zs.c:1.64 src/sys/arch/atari/dev/zs.c:1.65
--- src/sys/arch/atari/dev/zs.c:1.64	Sun Jul 19 05:46:15 2009
+++ src/sys/arch/atari/dev/zs.c	Fri Apr  9 11:30:19 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.64 2009/07/19 05:46:15 tsutsui Exp $	*/
+/*	$NetBSD: zs.c,v 1.65 2010/04/09 11:30:19 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.64 2009/07/19 05:46:15 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.65 2010/04/09 11:30:19 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -103,6 +103,9 @@
 
 #include dev/ic/z8530reg.h
 #include atari/dev/zsvar.h
+
+#include ioconf.h
+
 #include zs.h
 #if NZS  1
 #error This driver supports only 1 85C30!
@@ -223,8 +226,6 @@
 CFATTACH_DECL(zs, sizeof(struct zs_softc),
 zsmatch, zsattach, NULL, NULL);
 
-extern struct cfdriver zs_cd;
-
 /* {b,c}devsw[] function prototypes */
 dev_type_open(zsopen);
 dev_type_close(zsclose);



CVS commit: src/sys/arch/atari/dev

2010-04-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr  9 12:09:29 UTC 2010

Modified Files:
src/sys/arch/atari/dev: zs.c zsvar.h

Log Message:
- misc KNF
- remove `register' keyword from variable declarations


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/atari/dev/zs.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/atari/dev/zsvar.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/arch/atari/dev/zs.c
diff -u src/sys/arch/atari/dev/zs.c:1.65 src/sys/arch/atari/dev/zs.c:1.66
--- src/sys/arch/atari/dev/zs.c:1.65	Fri Apr  9 11:30:19 2010
+++ src/sys/arch/atari/dev/zs.c	Fri Apr  9 12:09:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.65 2010/04/09 11:30:19 tsutsui Exp $	*/
+/*	$NetBSD: zs.c,v 1.66 2010/04/09 12:09:29 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.65 2010/04/09 11:30:19 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.66 2010/04/09 12:09:29 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -122,16 +122,16 @@
  * Software state per found chip.
  */
 struct zs_softc {
-struct	device		zi_dev;/* base device		  */
-volatile struct zsdevice	*zi_zs;/* chip registers		  */
-struct	zs_chanstate	zi_cs[2];  /* chan A and B software state */
+	struct	device		zi_dev;/* base device		  */
+	volatile struct zsdevice *zi_zs;   /* chip registers		  */
+	struct	zs_chanstate	zi_cs[2];  /* chan A and B software state */
 };
 
 static void	*zs_softint_cookie;	/* for callback */
 /*
  * Define the registers for a closed port
  */
-static u_char zs_init_regs[16] = {
+static uint8_t zs_init_regs[16] = {
 /*  0 */	0,
 /*  1 */	0,
 /*  2 */	0x60,
@@ -258,18 +258,18 @@
 static int	zsparam(struct tty *, struct termios *);
 static int	zsbaudrate(int, int, int *, int *, int *, int *);
 static int	zs_modem(struct zs_chanstate *, int, int);
-static void	zs_loadchannelregs(volatile struct zschan *, u_char *);
+static void	zs_loadchannelregs(volatile struct zschan *, uint8_t *);
 static void	zs_shutdown(struct zs_chanstate *);
 
 static int
 zsmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
 {
-	static int	zs_matched = 0;
+	static int zs_matched = 0;
 
-	if(strcmp(zs, auxp) || zs_matched)
-		return(0);
+	if (strcmp(zs, auxp) || zs_matched)
+		return 0;
 	zs_matched = 1;
-	return(1);
+	return 1;
 }
 
 /*
@@ -278,10 +278,10 @@
 static void
 zsattach(struct device *parent, struct device *dev, void *aux)
 {
-	register struct zs_softc		*zi;
-	register struct zs_chanstate		*cs;
-	register volatile struct zsdevice	*addr;
-		 chartmp;
+	struct zs_softc *zi;
+	struct zs_chanstate *cs;
+	volatile struct zsdevice *addr;
+	uint8_t tmp;
 
 	addr  = (struct zsdevice *)AD_SCC;
 	zi= (struct zs_softc *)dev;
@@ -309,7 +309,7 @@
 	zs_loadchannelregs(addr-zs_chan[ZS_CHAN_A], zs_init_regs);
 	zs_loadchannelregs(addr-zs_chan[ZS_CHAN_B], zs_init_regs);
 
-	if(machineid  ATARI_TT) {
+	if (machineid  ATARI_TT) {
 		/*
 		 * ininitialise TT-MFP timer C: 307200Hz
 		 * timer C and D share one control register:
@@ -358,28 +358,28 @@
 int
 zsopen(dev_t dev, int flags, int mode, struct lwp *l)
 {
-	register struct tty		*tp;
-	register struct zs_chanstate	*cs;
-		 struct zs_softc	*zi;
-		 int			unit = ZS_UNIT(dev);
-		 int			zs = unit  1;
-		 int			error, s;
+	struct tty *tp;
+	struct zs_chanstate *cs;
+	struct zs_softc *zi;
+	int unit = ZS_UNIT(dev);
+	int zs = unit  1;
+	int error, s;
 
 	zi = device_lookup_private(zs_cd, zs);
 	if (zi == NULL)
-		return (ENXIO);
+		return ENXIO;
 	cs = zi-zi_cs[unit  1];
 
 	/*
 	 * When port A (ser02) is selected on the TT, make sure
 	 * the port is enabled.
 	 */
-	if((machineid  ATARI_TT)  !(unit  1))
+	if ((machineid  ATARI_TT)  !(unit  1))
 		ym2149_ser2(1);
 
 	if (cs-cs_rbuf == NULL) {
 		cs-cs_rbuf = malloc(ZLRB_RING_SIZE * sizeof(int), M_DEVBUF,
-   M_WAITOK);
+		M_WAITOK);
 	}
 
 	tp = cs-cs_ttyp;
@@ -392,14 +392,14 @@
 	}
 
 	if (kauth_authorize_device_tty(l-l_cred, KAUTH_DEVICE_TTY_OPEN, tp))
-		return (EBUSY);
+		return EBUSY;
 
 	s  = spltty();
 
 	/*
 	 * Do the following iff this is a first open.
 	 */
-	if (!(tp-t_state  TS_ISOPEN)  tp-t_wopen == 0) {
+	if ((tp-t_state  TS_ISOPEN) == 0  tp-t_wopen == 0) {
 		if(tp-t_ispeed == 0) {
 			tp-t_iflag = TTYDEF_IFLAG;
 			tp-t_oflag = TTYDEF_OFLAG;
@@ -421,7 +421,7 @@
 		 */
 		zs_modem(cs, ZSWR5_RTS|ZSWR5_DTR, DMSET);
 		/* May never get a status intr. if DCD already on. -gwr */
-		if((cs-cs_rr0 = cs-cs_zc-zc_csr)  ZSRR0_DCD)
+		if (((cs-cs_rr0 = cs-cs_zc-zc_csr)  ZSRR0_DCD) != 0)
 			tp-t_state |= TS_CARR_ON;
 		if(cs-cs_softcar)
 			tp-t_state |= TS_CARR_ON;
@@ -434,19 +434,19 @@
 		goto bad;
 	
 	error = tp-t_linesw-l_open(dev, tp);
-	if(error)
+	if (error)
 		goto bad;
-	return (0);
+	return 0;
 
 bad:
-	if (!(tp-t_state  TS_ISOPEN)  tp-t_wopen == 0) {

CVS commit: src/sys/arch/atari/dev

2010-04-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr  9 12:34:25 UTC 2010

Modified Files:
src/sys/arch/atari/dev: zs.c zsvar.h

Log Message:
Remove unnecessary volatile keyword against struct zschan.
(volatile against structure member is enough)


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/atari/dev/zs.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/atari/dev/zsvar.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/arch/atari/dev/zs.c
diff -u src/sys/arch/atari/dev/zs.c:1.66 src/sys/arch/atari/dev/zs.c:1.67
--- src/sys/arch/atari/dev/zs.c:1.66	Fri Apr  9 12:09:29 2010
+++ src/sys/arch/atari/dev/zs.c	Fri Apr  9 12:34:25 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.66 2010/04/09 12:09:29 tsutsui Exp $	*/
+/*	$NetBSD: zs.c,v 1.67 2010/04/09 12:34:25 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.66 2010/04/09 12:09:29 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.67 2010/04/09 12:34:25 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -122,9 +122,9 @@
  * Software state per found chip.
  */
 struct zs_softc {
-	struct	device		zi_dev;/* base device		  */
-	volatile struct zsdevice *zi_zs;   /* chip registers		  */
-	struct	zs_chanstate	zi_cs[2];  /* chan A and B software state */
+	struct device zi_dev;		/* base device */
+	struct zsdevice *zi_zs;		/* chip registers */
+	struct zs_chanstate zi_cs[2];	/* chan A and B software state */
 };
 
 static void	*zs_softint_cookie;	/* for callback */
@@ -244,9 +244,9 @@
 /* Interrupt handlers. */
 int		zshard(long);
 static int	zssoft(long);
-static int	zsrint(struct zs_chanstate *, volatile struct zschan *);
-static int	zsxint(struct zs_chanstate *, volatile struct zschan *);
-static int	zssint(struct zs_chanstate *, volatile struct zschan *);
+static int	zsrint(struct zs_chanstate *, struct zschan *);
+static int	zsxint(struct zs_chanstate *, struct zschan *);
+static int	zssint(struct zs_chanstate *, struct zschan *);
 
 static struct zs_chanstate *zslist;
 
@@ -258,7 +258,7 @@
 static int	zsparam(struct tty *, struct termios *);
 static int	zsbaudrate(int, int, int *, int *, int *, int *);
 static int	zs_modem(struct zs_chanstate *, int, int);
-static void	zs_loadchannelregs(volatile struct zschan *, uint8_t *);
+static void	zs_loadchannelregs(struct zschan *, uint8_t *);
 static void	zs_shutdown(struct zs_chanstate *);
 
 static int
@@ -280,7 +280,7 @@
 {
 	struct zs_softc *zi;
 	struct zs_chanstate *cs;
-	volatile struct zsdevice *addr;
+	struct zsdevice *addr;
 	uint8_t tmp;
 
 	addr  = (struct zsdevice *)AD_SCC;
@@ -559,7 +559,7 @@
 {
 	struct zs_chanstate *a;
 #define	b (a + 1)
-	volatile struct zschan *zc;
+	struct zschan *zc;
 	int rr3, intflags = 0, v, i;
 
 	do {
@@ -621,7 +621,7 @@
 }
 
 static int
-zsrint(struct zs_chanstate *cs, volatile struct zschan *zc)
+zsrint(struct zs_chanstate *cs, struct zschan *zc)
 {
 	int c;
 
@@ -640,7 +640,7 @@
 }
 
 static int
-zsxint(struct zs_chanstate *cs, volatile struct zschan *zc)
+zsxint(struct zs_chanstate *cs, struct zschan *zc)
 {
 	int i = cs-cs_tbc;
 
@@ -656,7 +656,7 @@
 }
 
 static int
-zssint(struct zs_chanstate *cs, volatile struct zschan *zc)
+zssint(struct zs_chanstate *cs, struct zschan *zc)
 {
 	int rr0;
 
@@ -707,7 +707,7 @@
 zssoft(long sr)
 {
 	struct zs_chanstate *cs;
-	volatile struct zschan *zc;
+	struct zschan *zc;
 	struct linesw *line;
 	struct tty *tp;
 	int get, n, c, cc, unit, s;
@@ -1280,7 +1280,7 @@
  * be disabled for the time it takes to write all the registers.
  */
 static void
-zs_loadchannelregs(volatile struct zschan *zc, uint8_t *reg)
+zs_loadchannelregs(struct zschan *zc, uint8_t *reg)
 {
 	int i;
 

Index: src/sys/arch/atari/dev/zsvar.h
diff -u src/sys/arch/atari/dev/zsvar.h:1.14 src/sys/arch/atari/dev/zsvar.h:1.15
--- src/sys/arch/atari/dev/zsvar.h:1.14	Fri Apr  9 12:09:29 2010
+++ src/sys/arch/atari/dev/zsvar.h	Fri Apr  9 12:34:25 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: zsvar.h,v 1.14 2010/04/09 12:09:29 tsutsui Exp $	*/
+/*	$NetBSD: zsvar.h,v 1.15 2010/04/09 12:34:25 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -119,7 +119,7 @@
 
 struct zs_chanstate {
 	struct zs_chanstate	*cs_next;	/* linked list for zshard() */
-	volatile struct zschan	*cs_zc;		/* points to hardware regs */
+	struct zschan		*cs_zc;		/* points to hardware regs */
 	int			cs_unit;	/* unit number */
 	struct	tty		*cs_ttyp;	/* ### */
 



CVS commit: src/sys/arch/atari/dev

2010-04-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr  9 12:38:48 UTC 2010

Modified Files:
src/sys/arch/atari/dev: zs.c

Log Message:
Rename variables and members of softc for readability.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/atari/dev/zs.c

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

Modified files:

Index: src/sys/arch/atari/dev/zs.c
diff -u src/sys/arch/atari/dev/zs.c:1.67 src/sys/arch/atari/dev/zs.c:1.68
--- src/sys/arch/atari/dev/zs.c:1.67	Fri Apr  9 12:34:25 2010
+++ src/sys/arch/atari/dev/zs.c	Fri Apr  9 12:38:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.67 2010/04/09 12:34:25 tsutsui Exp $	*/
+/*	$NetBSD: zs.c,v 1.68 2010/04/09 12:38:48 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.67 2010/04/09 12:34:25 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.68 2010/04/09 12:38:48 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -122,9 +122,9 @@
  * Software state per found chip.
  */
 struct zs_softc {
-	struct device zi_dev;		/* base device */
-	struct zsdevice *zi_zs;		/* chip registers */
-	struct zs_chanstate zi_cs[2];	/* chan A and B software state */
+	struct device sc_dev;		/* base device */
+	struct zsdevice *sc_zs;		/* chip registers */
+	struct zs_chanstate sc_cs[2];	/* chan A and B software state */
 };
 
 static void	*zs_softint_cookie;	/* for callback */
@@ -278,15 +278,15 @@
 static void
 zsattach(struct device *parent, struct device *dev, void *aux)
 {
-	struct zs_softc *zi;
+	struct zs_softc *sc;
 	struct zs_chanstate *cs;
 	struct zsdevice *addr;
 	uint8_t tmp;
 
 	addr  = (struct zsdevice *)AD_SCC;
-	zi= (struct zs_softc *)dev;
-	zi-zi_zs = addr;
-	cs= zi-zi_cs;
+	sc= (struct zs_softc *)dev;
+	sc-sc_zs = addr;
+	cs= sc-sc_cs;
 
 	/*
 	 * Get the command register into a known state.
@@ -360,15 +360,15 @@
 {
 	struct tty *tp;
 	struct zs_chanstate *cs;
-	struct zs_softc *zi;
+	struct zs_softc *sc;
 	int unit = ZS_UNIT(dev);
 	int zs = unit  1;
 	int error, s;
 
-	zi = device_lookup_private(zs_cd, zs);
-	if (zi == NULL)
+	sc = device_lookup_private(zs_cd, zs);
+	if (sc == NULL)
 		return ENXIO;
-	cs = zi-zi_cs[unit  1];
+	cs = sc-sc_cs[unit  1];
 
 	/*
 	 * When port A (ser02) is selected on the TT, make sure
@@ -457,11 +457,11 @@
 {
 	struct zs_chanstate *cs;
 	struct tty *tp;
-	struct zs_softc *zi;
+	struct zs_softc *sc;
 	int unit = ZS_UNIT(dev);
 
-	zi = device_lookup_private(zs_cd, unit  1);
-	cs = zi-zi_cs[unit  1];
+	sc = device_lookup_private(zs_cd, unit  1);
+	cs = sc-sc_cs[unit  1];
 	tp = cs-cs_ttyp;
 
 	tp-t_linesw-l_close(tp, flags);
@@ -485,13 +485,13 @@
 zsread(dev_t dev, struct uio *uio, int flags)
 {
 	struct zs_chanstate *cs;
-	struct zs_softc *zi;
+	struct zs_softc *sc;
 	struct tty *tp;
 	int unit;
 
 	unit = ZS_UNIT(dev);
-	zi   = device_lookup_private(zs_cd, unit  1);
-	cs   = zi-zi_cs[unit  1];
+	sc   = device_lookup_private(zs_cd, unit  1);
+	cs   = sc-sc_cs[unit  1];
 	tp   = cs-cs_ttyp;
 
 	return (*tp-t_linesw-l_read)(tp, uio, flags);
@@ -501,13 +501,13 @@
 zswrite(dev_t dev, struct uio *uio, int flags)
 {
 	struct zs_chanstate *cs;
-	struct zs_softc *zi;
+	struct zs_softc *sc;
 	struct tty *tp;
 	int unit;
 
 	unit = ZS_UNIT(dev);
-	zi   = device_lookup_private(zs_cd, unit  1);
-	cs   = zi-zi_cs[unit  1];
+	sc   = device_lookup_private(zs_cd, unit  1);
+	cs   = sc-sc_cs[unit  1];
 	tp   = cs-cs_ttyp;
 
 	return (*tp-t_linesw-l_write)(tp, uio, flags);
@@ -517,13 +517,13 @@
 zspoll(dev_t dev, int events, struct lwp *l)
 {
 	struct zs_chanstate *cs;
-	struct zs_softc *zi;
+	struct zs_softc *sc;
 	struct tty *tp;
 	int unit;
 
 	unit = ZS_UNIT(dev);
-	zi   = device_lookup_private(zs_cd, unit  1);
-	cs   = zi-zi_cs[unit  1];
+	sc   = device_lookup_private(zs_cd, unit  1);
+	cs   = sc-sc_cs[unit  1];
 	tp   = cs-cs_ttyp;
  
 	return (*tp-t_linesw-l_poll)(tp, events, l);
@@ -533,12 +533,12 @@
 zstty(dev_t dev)
 {
 	struct zs_chanstate *cs;
-	struct zs_softc *zi;
+	struct zs_softc *sc;
 	int unit;
 
 	unit = ZS_UNIT(dev);
-	zi   = device_lookup_private(zs_cd, unit  1);
-	cs   = zi-zi_cs[unit  1];
+	sc   = device_lookup_private(zs_cd, unit  1);
+	cs   = sc-sc_cs[unit  1];
 	return cs-cs_ttyp;
 }
 
@@ -824,10 +824,10 @@
 zsioctl(dev_t dev, u_long cmd, void * data, int flag, struct lwp *l)
 {
 	int unit = ZS_UNIT(dev);
-	struct zs_softc *zi = device_lookup_private(zs_cd, unit  1);
-	struct tty *tp = zi-zi_cs[unit  1].cs_ttyp;
+	struct zs_softc *sc = device_lookup_private(zs_cd, unit  1);
+	struct tty *tp = sc-sc_cs[unit  1].cs_ttyp;
 	int error, s;
-	struct zs_chanstate *cs = zi-zi_cs[unit  1];
+	struct zs_chanstate *cs = sc-sc_cs[unit  1];
 
 	error = tp-t_linesw-l_ioctl(tp, cmd, data, flag, l);
 	if (error != EPASSTHROUGH)
@@ -946,9 +946,9 @@
 	struct zs_chanstate *cs;
 	int s, nch;
 	int unit = 

CVS commit: src/sys/arch/atari/dev

2010-04-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr  9 12:50:34 UTC 2010

Modified Files:
src/sys/arch/atari/dev: zs.c

Log Message:
Split device_t/softc.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/atari/dev/zs.c

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

Modified files:

Index: src/sys/arch/atari/dev/zs.c
diff -u src/sys/arch/atari/dev/zs.c:1.68 src/sys/arch/atari/dev/zs.c:1.69
--- src/sys/arch/atari/dev/zs.c:1.68	Fri Apr  9 12:38:48 2010
+++ src/sys/arch/atari/dev/zs.c	Fri Apr  9 12:50:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.68 2010/04/09 12:38:48 tsutsui Exp $	*/
+/*	$NetBSD: zs.c,v 1.69 2010/04/09 12:50:34 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.68 2010/04/09 12:38:48 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.69 2010/04/09 12:50:34 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -122,7 +122,7 @@
  * Software state per found chip.
  */
 struct zs_softc {
-	struct device sc_dev;		/* base device */
+	device_t sc_dev;		/* base device */
 	struct zsdevice *sc_zs;		/* chip registers */
 	struct zs_chanstate sc_cs[2];	/* chan A and B software state */
 };
@@ -220,10 +220,10 @@
 static u_long *zs_frequencies;
 
 /* Definition of the driver for autoconfig. */
-static int	zsmatch(struct device *, struct cfdata *, void *);
-static void	zsattach(struct device *, struct device *, void *);
+static int	zsmatch(device_t, cfdata_t, void *);
+static void	zsattach(device_t, device_t, void *);
 
-CFATTACH_DECL(zs, sizeof(struct zs_softc),
+CFATTACH_DECL_NEW(zs, sizeof(struct zs_softc),
 zsmatch, zsattach, NULL, NULL);
 
 /* {b,c}devsw[] function prototypes */
@@ -262,11 +262,11 @@
 static void	zs_shutdown(struct zs_chanstate *);
 
 static int
-zsmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+zsmatch(device_t parent, cfdata_t cf, void *aux)
 {
 	static int zs_matched = 0;
 
-	if (strcmp(zs, auxp) || zs_matched)
+	if (strcmp(zs, aux) || zs_matched)
 		return 0;
 	zs_matched = 1;
 	return 1;
@@ -276,7 +276,7 @@
  * Attach a found zs.
  */
 static void
-zsattach(struct device *parent, struct device *dev, void *aux)
+zsattach(device_t parent, device_t self, void *aux)
 {
 	struct zs_softc *sc;
 	struct zs_chanstate *cs;
@@ -284,7 +284,8 @@
 	uint8_t tmp;
 
 	addr  = (struct zsdevice *)AD_SCC;
-	sc= (struct zs_softc *)dev;
+	sc= device_private(self);
+	sc-sc_dev = self;
 	sc-sc_zs = addr;
 	cs= sc-sc_cs;
 



CVS commit: src/sys/arch/atari/dev

2010-04-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr  9 16:30:16 UTC 2010

Modified Files:
src/sys/arch/atari/dev: zs.c

Log Message:
More KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/atari/dev/zs.c

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

Modified files:

Index: src/sys/arch/atari/dev/zs.c
diff -u src/sys/arch/atari/dev/zs.c:1.69 src/sys/arch/atari/dev/zs.c:1.70
--- src/sys/arch/atari/dev/zs.c:1.69	Fri Apr  9 12:50:34 2010
+++ src/sys/arch/atari/dev/zs.c	Fri Apr  9 16:30:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.69 2010/04/09 12:50:34 tsutsui Exp $	*/
+/*	$NetBSD: zs.c,v 1.70 2010/04/09 16:30:15 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.69 2010/04/09 12:50:34 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.70 2010/04/09 16:30:15 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -384,7 +384,7 @@
 	}
 
 	tp = cs-cs_ttyp;
-	if(tp == NULL) {
+	if (tp == NULL) {
 		cs-cs_ttyp = tp = ttymalloc();
 		tty_attach(tp);
 		tp-t_dev   = dev;
@@ -401,7 +401,7 @@
 	 * Do the following iff this is a first open.
 	 */
 	if ((tp-t_state  TS_ISOPEN) == 0  tp-t_wopen == 0) {
-		if(tp-t_ispeed == 0) {
+		if (tp-t_ispeed == 0) {
 			tp-t_iflag = TTYDEF_IFLAG;
 			tp-t_oflag = TTYDEF_OFLAG;
 			tp-t_cflag = TTYDEF_CFLAG;
@@ -424,7 +424,7 @@
 		/* May never get a status intr. if DCD already on. -gwr */
 		if (((cs-cs_rr0 = cs-cs_zc-zc_csr)  ZSRR0_DCD) != 0)
 			tp-t_state |= TS_CARR_ON;
-		if(cs-cs_softcar)
+		if (cs-cs_softcar)
 			tp-t_state |= TS_CARR_ON;
 	}
 
@@ -694,7 +694,7 @@
 {
 	time_t cur_sec = time_second;
 
-	if(*ptime != cur_sec) {
+	if (*ptime != cur_sec) {
 		*ptime = cur_sec;
 		log(LOG_WARNING, zs%d%c: %s overrun\n, unit  1,
 		(unit  1) + 'a', what);



CVS commit: src/sys/arch/atari/dev

2010-04-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr  9 17:06:31 UTC 2010

Modified Files:
src/sys/arch/atari/dev: zs.c

Log Message:
minor constify


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/atari/dev/zs.c

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

Modified files:

Index: src/sys/arch/atari/dev/zs.c
diff -u src/sys/arch/atari/dev/zs.c:1.70 src/sys/arch/atari/dev/zs.c:1.71
--- src/sys/arch/atari/dev/zs.c:1.70	Fri Apr  9 16:30:15 2010
+++ src/sys/arch/atari/dev/zs.c	Fri Apr  9 17:06:31 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.70 2010/04/09 16:30:15 tsutsui Exp $	*/
+/*	$NetBSD: zs.c,v 1.71 2010/04/09 17:06:31 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.70 2010/04/09 16:30:15 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.71 2010/04/09 17:06:31 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -156,7 +156,7 @@
  * divisor 16, therefor the division by 16 can as
  * well be done here.
  */
-static u_long zs_freqs_tt[] = {
+static const u_long zs_freqs_tt[] = {
 	/*
 	 * Atari TT, RTxCB is generated by TT-MFP timer C,
 	 * which is set to 307.2 kHz during initialisation
@@ -173,7 +173,7 @@
 	2457600		/* TRxCB, from BCLK		*/
 };
 
-static u_long zs_freqs_falcon[] = {
+static const u_long zs_freqs_falcon[] = {
 	/*
 	 * Atari Falcon, XXX no specs available, this might be wrong
 	 */
@@ -188,7 +188,7 @@
 	2457600		/* TRxCB, ???			*/
 };
 
-static u_long zs_freqs_hades[] = {
+static const u_long zs_freqs_hades[] = {
 	/*
 	 * XXX: Channel-A unchecked!
 	 */
@@ -203,7 +203,7 @@
 	3768800		/* TRxCB, 3.7688MHz		*/
 };
 
-static u_long zs_freqs_generic[] = {
+static const u_long zs_freqs_generic[] = {
 	/*
 	 * other machines, assume only PCLK is available
 	 */
@@ -217,7 +217,7 @@
 	  0,	/* RTxCB, unknown		*/
 	  0		/* TRxCB, unknown		*/
 };
-static u_long *zs_frequencies;
+static const u_long *zs_frequencies;
 
 /* Definition of the driver for autoconfig. */
 static int	zsmatch(device_t, cfdata_t, void *);
@@ -1165,7 +1165,7 @@
 	bestdiff = bestbps = 0;
 	unit = (unit  1)  2;
 	for (source = 0; source  4; ++source) {
-		long freq = zs_frequencies[unit + source];
+		u_long freq = zs_frequencies[unit + source];
 		int diff, bps, div, clkm, brgm, tcon;
 
 		bps = div = clkm = brgm = tcon = 0;



CVS commit: src/sys/arch/atari/dev

2010-04-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Apr  7 12:39:59 UTC 2010

Modified Files:
src/sys/arch/atari/dev: fd.c

Log Message:
extern inline - static inline


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/atari/dev/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/arch/atari/dev/fd.c
diff -u src/sys/arch/atari/dev/fd.c:1.72 src/sys/arch/atari/dev/fd.c:1.73
--- src/sys/arch/atari/dev/fd.c:1.72	Tue Oct 20 19:10:10 2009
+++ src/sys/arch/atari/dev/fd.c	Wed Apr  7 12:39:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.72 2009/10/20 19:10:10 snj Exp $	*/
+/*	$NetBSD: fd.c,v 1.73 2010/04/07 12:39:59 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -44,7 +44,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.72 2009/10/20 19:10:10 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.73 2010/04/07 12:39:59 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -216,23 +216,24 @@
 static int	fdselect(int, int, int);
 static void	fddeselect(void);
 static void	fdmoff(struct fd_softc *);
-   u_char	read_fdreg(u_short);
-   void	write_fdreg(u_short, u_short);
-   u_char	read_dmastat(void);
 
-extern inline u_char read_fdreg(u_short regno)
+static inline u_char	read_fdreg(u_short);
+static inline void	write_fdreg(u_short, u_short);
+static inline u_char	read_dmastat(void);
+
+static inline u_char read_fdreg(u_short regno)
 {
 	DMA-dma_mode = regno;
 	return(DMA-dma_data);
 }
 
-extern inline void write_fdreg(u_short regno, u_short val)
+static inline void write_fdreg(u_short regno, u_short val)
 {
 	DMA-dma_mode = regno;
 	DMA-dma_data = val;
 }
 
-extern inline u_char read_dmastat(void)
+static inline u_char read_dmastat(void)
 {
 	DMA-dma_mode = FDC_CS | DMA_SCREG;
 	return(DMA-dma_stat);



CVS commit: src/sys/arch/atari/dev

2010-04-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Apr  7 13:14:23 UTC 2010

Modified Files:
src/sys/arch/atari/dev: fd.c

Log Message:
- split device_t/softc
- use device_lookup_private() directly rather than via local macro


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/atari/dev/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/arch/atari/dev/fd.c
diff -u src/sys/arch/atari/dev/fd.c:1.73 src/sys/arch/atari/dev/fd.c:1.74
--- src/sys/arch/atari/dev/fd.c:1.73	Wed Apr  7 12:39:59 2010
+++ src/sys/arch/atari/dev/fd.c	Wed Apr  7 13:14:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.73 2010/04/07 12:39:59 tsutsui Exp $	*/
+/*	$NetBSD: fd.c,v 1.74 2010/04/07 13:14:23 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -44,7 +44,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.73 2010/04/07 12:39:59 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.74 2010/04/07 13:14:23 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -129,7 +129,7 @@
  * Private per device data
  */
 struct fd_softc {
-	struct device	sc_dv;		/* generic device info		*/
+	device_t	sc_dev;		/* generic device info		*/
 	struct disk	dkdev;		/* generic disk info		*/
 	struct bufq_state *bufq;	/* queue of buf's		*/
 	struct callout	sc_motor_ch;
@@ -263,11 +263,11 @@
  */
 extern struct cfdriver fd_cd;
 
-static int	fdcmatch(struct device *, struct cfdata *, void *);
+static int	fdcmatch(device_t, cfdata_t, void *);
 static int	fdcprint(void *, const char *);
-static void	fdcattach(struct device *, struct device *, void *);
+static void	fdcattach(device_t, device_t, void *);
 
-CFATTACH_DECL(fdc, sizeof(struct device),
+CFATTACH_DECL_NEW(fdc, 0,
 fdcmatch, fdcattach, NULL, NULL);
 
 const struct bdevsw fd_bdevsw = {
@@ -280,19 +280,19 @@
 };
 
 static int
-fdcmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+fdcmatch(device_t parent, cfdata_t match, void *aux)
 {
 	static int	fdc_matched = 0;
 
 	/* Match only once */
-	if(strcmp(fdc, auxp) || fdc_matched)
+	if(strcmp(fdc, aux) || fdc_matched)
 		return(0);
 	fdc_matched = 1;
 	return(1);
 }
 
 static void
-fdcattach(struct device *pdp, struct device *dp, void *auxp)
+fdcattach(device_t parent, device_t self, void *aux)
 {
 	struct fd_softc	fdsoftc;
 	int		i, nfound, first_found;
@@ -315,12 +315,13 @@
 			if(!nfound)
 first_found = i;
 			nfound++;
-			config_found(dp, (void*)i, fdcprint);
+			config_found(self, (void*)i, fdcprint);
 		}
 	}
 
 	if(nfound) {
-		struct fd_softc *fdsc = getsoftc(fd_cd, first_found);
+		struct fd_softc *fdsc =
+		device_lookup_private(fd_cd, first_found);
 
 		/*
 		 * Make sure motor will be turned of when a floppy is
@@ -340,38 +341,39 @@
 }
 
 static int
-fdcprint(void *auxp, const char *pnp)
+fdcprint(void *aux, const char *pnp)
 {
 	if (pnp != NULL)
-		aprint_normal(fd%d at %s:, (int)auxp, pnp);
+		aprint_normal(fd%d at %s:, (int)aux, pnp);
 	
 	return(UNCONF);
 }
 
-static int	fdmatch(struct device *, struct cfdata *, void *);
-static void	fdattach(struct device *, struct device *, void *);
+static int	fdmatch(device_t, cfdata_t, void *);
+static void	fdattach(device_t, device_t, void *);
 
 struct dkdriver fddkdriver = { fdstrategy };
 
-CFATTACH_DECL(fd, sizeof(struct fd_softc),
+CFATTACH_DECL_NEW(fd, sizeof(struct fd_softc),
 fdmatch, fdattach, NULL, NULL);
 
 extern struct cfdriver fd_cd;
 
 static int
-fdmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+fdmatch(device_t parent, cfdata_t match, void *aux)
 {
 	return(1);
 }
 
 static void
-fdattach(struct device *pdp, struct device *dp, void *auxp)
+fdattach(device_t parent, device_t self, void *aux)
 {
 	struct fd_softc	*sc;
 	struct fd_types *type;
 	u_short		swtch;
 
-	sc = device_private(dp);
+	sc = device_private(self);
+	sc-sc_dev = self;
 
 	callout_init(sc-sc_motor_ch, 0);
 
@@ -383,14 +385,14 @@
 	def_type = (swtch  CFG_SWITCH_NOHD) ? FLP_TYPE_720 : FLP_TYPE_144;
 	type = fdtypes[def_type];
 
-	printf(: %s %d cyl, %d head, %d sec\n, type-descr,
+	aprint_normal(: %s %d cyl, %d head, %d sec\n, type-descr,
 		type-nblocks / (type-nsectors * type-nheads), type-nheads,
 		type-nsectors);
 
 	/*
 	 * Initialize and attach the disk structure.
 	 */
-	disk_init(sc-dkdev, sc-sc_dv.dv_xname, fddkdriver);
+	disk_init(sc-dkdev, device_xname(sc-sc_dev), fddkdriver);
 	disk_attach(sc-dkdev);
 }
 
@@ -399,7 +401,7 @@
 {
 	struct fd_softc *sc;
 
-	sc = getsoftc(fd_cd, DISKUNIT(dev));
+	sc = device_lookup_private(fd_cd, DISKUNIT(dev));
 
 	if((sc-flags  FLPF_HAVELAB) == 0)
 		return(EBADF);
@@ -453,7 +455,7 @@
 	if(FLP_TYPE(dev) = NR_TYPES)
 		return(ENXIO);
 
-	if((sc = getsoftc(fd_cd, DISKUNIT(dev))) == NULL)
+	if((sc = device_lookup_private(fd_cd, DISKUNIT(dev))) == NULL)
 		return(ENXIO);
 
 	/*
@@ -544,7 +546,7 @@
 {
 	struct fd_softc	*sc;
 
-	sc = getsoftc(fd_cd, 

CVS commit: src/sys/arch/atari/dev

2010-04-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Apr  7 13:53:05 UTC 2010

Modified Files:
src/sys/arch/atari/dev: fd.c

Log Message:
Misc KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/atari/dev/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/arch/atari/dev/fd.c
diff -u src/sys/arch/atari/dev/fd.c:1.74 src/sys/arch/atari/dev/fd.c:1.75
--- src/sys/arch/atari/dev/fd.c:1.74	Wed Apr  7 13:14:23 2010
+++ src/sys/arch/atari/dev/fd.c	Wed Apr  7 13:53:05 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.74 2010/04/07 13:14:23 tsutsui Exp $	*/
+/*	$NetBSD: fd.c,v 1.75 2010/04/07 13:53:05 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -44,7 +44,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.74 2010/04/07 13:14:23 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.75 2010/04/07 13:53:05 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -72,6 +72,8 @@
 #include atari/dev/ym2149reg.h
 #include atari/dev/fdreg.h
 
+#include ioconf.h
+
 /*
  * Be verbose for debugging
  */
@@ -121,9 +123,9 @@
 static short	nopens   = 0;		/* Number of opens executed	*/
 
 static short	fd_state = FLP_IDLE;	/* Current driver state		*/
-static int	lock_stat= 0;		/* DMA locking status		*/
+static int	lock_stat = 0;		/* DMA locking status		*/
 static short	fd_cmd   = 0;		/* command being executed	*/
-static const char *fd_error= NULL;	/* error from fd_xfer_ok()	*/
+static const char *fd_error = NULL;	/* error from fd_xfer_ok()	*/
 
 /*
  * Private per device data
@@ -142,11 +144,11 @@
 	short		flags;		/* misc flags			*/
 	short		part;		/* Current open partition	*/
 	int		sector;		/* logical sector for I/O	*/
-	char		*io_data;	/* KVA for data transfer	*/
+	uint8_t		*io_data;	/* KVA for data transfer	*/
 	int		io_bytes;	/* bytes left for I/O		*/
 	int		io_dir;		/* B_READ/B_WRITE		*/
 	int		errcnt;		/* current error count		*/
-	u_char		*bounceb;	/* Bounce buffer		*/
+	uint8_t		*bounceb;	/* Bounce buffer		*/
 
 };
 
@@ -217,26 +219,34 @@
 static void	fddeselect(void);
 static void	fdmoff(struct fd_softc *);
 
-static inline u_char	read_fdreg(u_short);
+static u_short rd_cfg_switch(void);
+
+static inline uint8_t	read_fdreg(u_short);
 static inline void	write_fdreg(u_short, u_short);
-static inline u_char	read_dmastat(void);
+static inline uint8_t	read_dmastat(void);
 
-static inline u_char read_fdreg(u_short regno)
+static inline
+uint8_t read_fdreg(u_short regno)
 {
+
 	DMA-dma_mode = regno;
-	return(DMA-dma_data);
+	return DMA-dma_data;
 }
 
-static inline void write_fdreg(u_short regno, u_short val)
+static inline
+void write_fdreg(u_short regno, u_short val)
 {
+
 	DMA-dma_mode = regno;
 	DMA-dma_data = val;
 }
 
-static inline u_char read_dmastat(void)
+static inline
+uint8_t read_dmastat(void)
 {
+
 	DMA-dma_mode = FDC_CS | DMA_SCREG;
-	return(DMA-dma_stat);
+	return DMA-dma_stat;
 }
 
 /*
@@ -246,10 +256,11 @@
  * Note: This location _must_ be read as an u_short. Failure to do so
  *   will return garbage!
  */
-static u_short rd_cfg_switch(void);
-static u_short rd_cfg_switch(void)
+static u_short
+rd_cfg_switch(void)
 {
-	return(*((volatile u_short *)AD_CFG_SWITCH));
+
+	return *(volatile u_short *)AD_CFG_SWITCH;
 }
 
 /*
@@ -261,8 +272,6 @@
 /*
  * Autoconfig stuff
  */
-extern struct cfdriver fd_cd;
-
 static int	fdcmatch(device_t, cfdata_t, void *);
 static int	fdcprint(void *, const char *);
 static void	fdcattach(device_t, device_t, void *);
@@ -282,25 +291,25 @@
 static int
 fdcmatch(device_t parent, cfdata_t match, void *aux)
 {
-	static int	fdc_matched = 0;
+	static int fdc_matched = 0;
 
 	/* Match only once */
-	if(strcmp(fdc, aux) || fdc_matched)
-		return(0);
+	if (strcmp(fdc, aux) || fdc_matched)
+		return 0;
 	fdc_matched = 1;
-	return(1);
+	return 1;
 }
 
 static void
 fdcattach(device_t parent, device_t self, void *aux)
 {
 	struct fd_softc	fdsoftc;
-	int		i, nfound, first_found;
+	int i, nfound, first_found;
 
 	nfound = first_found = 0;
 	printf(\n);
 	fddeselect();
-	for(i = 0; i  NR_DRIVES; i++) {
+	for (i = 0; i  NR_DRIVES; i++) {
 
 		/*
 		 * Test if unit is present
@@ -308,18 +317,18 @@
 		fdsoftc.unit  = i;
 		fdsoftc.flags = 0;
 		st_dmagrab((dma_farg)fdcint, (dma_farg)fdtestdrv, fdsoftc,
-lock_stat, 0);
+		lock_stat, 0);
 		st_dmafree(fdsoftc, lock_stat);
 
-		if(!(fdsoftc.flags  FLPF_NOTRESP)) {
-			if(!nfound)
+		if ((fdsoftc.flags  FLPF_NOTRESP) == 0) {
+			if (nfound == 0)
 first_found = i;
 			nfound++;
-			config_found(self, (void*)i, fdcprint);
+			config_found(self, (void *)i, fdcprint);
 		}
 	}
 
-	if(nfound) {
+	if (nfound != 0) {
 		struct fd_softc *fdsc =
 		device_lookup_private(fd_cd, first_found);
 
@@ -335,7 +344,7 @@
 		 * enable disk related interrupts
 		 */
 		MFP-mf_ierb |= IB_DINT;
-		MFP-mf_iprb  = (u_int8_t)~IB_DINT;
+		MFP-mf_iprb  = 

CVS commit: src/sys/arch/atari/dev

2010-04-06 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Apr  6 15:32:36 UTC 2010

Modified Files:
src/sys/arch/atari/dev: if_ne_mb.c

Log Message:
Use callout_schedule(9) rather than callout_reset(9) on polling
as callout(9) man says.


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

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

Modified files:

Index: src/sys/arch/atari/dev/if_ne_mb.c
diff -u src/sys/arch/atari/dev/if_ne_mb.c:1.1 src/sys/arch/atari/dev/if_ne_mb.c:1.2
--- src/sys/arch/atari/dev/if_ne_mb.c:1.1	Thu Apr  1 17:07:52 2010
+++ src/sys/arch/atari/dev/if_ne_mb.c	Tue Apr  6 15:32:36 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ne_mb.c,v 1.1 2010/04/01 17:07:52 tsutsui Exp $	*/
+/*	$NetBSD: if_ne_mb.c,v 1.2 2010/04/06 15:32:36 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2010 Izumi Tsutsui.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ne_mb.c,v 1.1 2010/04/01 17:07:52 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ne_mb.c,v 1.2 2010/04/06 15:32:36 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -285,7 +285,7 @@
 	(void)dp8390_intr(dsc);
 	splx(s);
 
-	callout_reset(sc-sc_poll, ETHERNEC_TICK, ne_mb_poll, sc);
+	callout_schedule(sc-sc_poll, ETHERNEC_TICK);
 }
 
 /*



CVS commit: src/sys/arch/atari/dev

2009-11-25 Thread David Brownlee
Module Name:src
Committed By:   abs
Date:   Wed Nov 25 20:40:41 UTC 2009

Modified Files:
src/sys/arch/atari/dev: kbd.c

Log Message:
Fix a missed proc - lwp change, only compiled if NWSKBD


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/atari/dev/kbd.c

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

Modified files:

Index: src/sys/arch/atari/dev/kbd.c
diff -u src/sys/arch/atari/dev/kbd.c:1.39 src/sys/arch/atari/dev/kbd.c:1.40
--- src/sys/arch/atari/dev/kbd.c:1.39	Fri Jul  3 14:00:41 2009
+++ src/sys/arch/atari/dev/kbd.c	Wed Nov 25 20:40:41 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kbd.c,v 1.39 2009/07/03 14:00:41 tsutsui Exp $	*/
+/*	$NetBSD: kbd.c,v 1.40 2009/11/25 20:40:41 abs Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kbd.c,v 1.39 2009/07/03 14:00:41 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: kbd.c,v 1.40 2009/11/25 20:40:41 abs Exp $);
 
 #include mouse.h
 #include ite.h
@@ -810,7 +810,7 @@
 }
 
 static int
-kbd_ioctl(void *c, u_long cmd, void *data, int flag, struct proc *p)
+kbd_ioctl(void *c, u_long cmd, void *data, int flag, struct lwp *p)
 {
 	struct wskbd_bell_data *kd;
 



CVS commit: src/sys/arch/atari/dev

2009-10-21 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Oct 21 21:50:15 UTC 2009

Modified Files:
src/sys/arch/atari/dev: grfabs_fal.c

Log Message:
Drop 3rd and 4th clause.  Approved by leo@ and thomas@ (copyright holders).


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/atari/dev/grfabs_fal.c

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

Modified files:

Index: src/sys/arch/atari/dev/grfabs_fal.c
diff -u src/sys/arch/atari/dev/grfabs_fal.c:1.25 src/sys/arch/atari/dev/grfabs_fal.c:1.26
--- src/sys/arch/atari/dev/grfabs_fal.c:1.25	Sun Jul 19 05:43:22 2009
+++ src/sys/arch/atari/dev/grfabs_fal.c	Wed Oct 21 21:50:14 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: grfabs_fal.c,v 1.25 2009/07/19 05:43:22 tsutsui Exp $	*/
+/*	$NetBSD: grfabs_fal.c,v 1.26 2009/10/21 21:50:14 snj Exp $	*/
 
 /*
  * Copyright (c) 1995 Thomas Gerner.
@@ -13,11 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *  This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior written permission
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -32,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: grfabs_fal.c,v 1.25 2009/07/19 05:43:22 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: grfabs_fal.c,v 1.26 2009/10/21 21:50:14 snj Exp $);
 
 #ifdef FALCON_VIDEO
 /*



CVS commit: src/sys/arch/atari/dev

2009-08-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Aug 23 13:46:48 UTC 2009

Modified Files:
src/sys/arch/atari/dev: clock.c

Log Message:
Use proper pointer types and names rather than casts for readability.


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

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

Modified files:

Index: src/sys/arch/atari/dev/clock.c
diff -u src/sys/arch/atari/dev/clock.c:1.49 src/sys/arch/atari/dev/clock.c:1.50
--- src/sys/arch/atari/dev/clock.c:1.49	Tue Jul  7 16:16:18 2009
+++ src/sys/arch/atari/dev/clock.c	Sun Aug 23 13:46:48 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.49 2009/07/07 16:16:18 tsutsui Exp $	*/
+/*	$NetBSD: clock.c,v 1.50 2009/08/23 13:46:48 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.49 2009/07/07 16:16:18 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.50 2009/08/23 13:46:48 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -428,18 +428,20 @@
  *   Real Time Clock support   *
  ***/
 
-u_int mc146818_read(void *rtc, u_int regno)
+u_int mc146818_read(void *cookie, u_int regno)
 {
+	struct rtc *rtc = cookie;
 
-	((struct rtc *)rtc)-rtc_regno = regno;
-	return ((struct rtc *)rtc)-rtc_data  0377;
+	rtc-rtc_regno = regno;
+	return rtc-rtc_data  0xff;
 }
 
-void mc146818_write(void *rtc, u_int regno, u_int value)
+void mc146818_write(void *cookie, u_int regno, u_int value)
 {
+	struct rtc *rtc = cookie;
 
-	((struct rtc *)rtc)-rtc_regno = regno;
-	((struct rtc *)rtc)-rtc_data  = value;
+	rtc-rtc_regno = regno;
+	rtc-rtc_data  = value;
 }
 
 static int



CVS commit: src/sys/arch/atari/dev

2009-07-31 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jul 31 15:55:11 UTC 2009

Modified Files:
src/sys/arch/atari/dev: fd.c

Log Message:
Read AD_CFG_SWITCH via volatile pointer so that
the default density is detected correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/atari/dev/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/arch/atari/dev/fd.c
diff -u src/sys/arch/atari/dev/fd.c:1.70 src/sys/arch/atari/dev/fd.c:1.71
--- src/sys/arch/atari/dev/fd.c:1.70	Sun Jul 19 05:43:22 2009
+++ src/sys/arch/atari/dev/fd.c	Fri Jul 31 15:55:10 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.70 2009/07/19 05:43:22 tsutsui Exp $	*/
+/*	$NetBSD: fd.c,v 1.71 2009/07/31 15:55:10 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -49,7 +49,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.70 2009/07/19 05:43:22 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.71 2009/07/31 15:55:10 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -253,7 +253,7 @@
 static u_short rd_cfg_switch(void);
 static u_short rd_cfg_switch(void)
 {
-	return(*((u_short*)AD_CFG_SWITCH));
+	return(*((volatile u_short *)AD_CFG_SWITCH));
 }
 
 /*



CVS commit: src/sys/arch/atari/dev

2009-07-18 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jul 19 05:46:15 UTC 2009

Modified Files:
src/sys/arch/atari/dev: zs.c

Log Message:
Replace one missed bcopy(9) with memcpy(9).


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/atari/dev/zs.c

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

Modified files:

Index: src/sys/arch/atari/dev/zs.c
diff -u src/sys/arch/atari/dev/zs.c:1.63 src/sys/arch/atari/dev/zs.c:1.64
--- src/sys/arch/atari/dev/zs.c:1.63	Sun Jul 19 05:43:23 2009
+++ src/sys/arch/atari/dev/zs.c	Sun Jul 19 05:46:15 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.63 2009/07/19 05:43:23 tsutsui Exp $	*/
+/*	$NetBSD: zs.c,v 1.64 2009/07/19 05:46:15 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.63 2009/07/19 05:43:23 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.64 2009/07/19 05:46:15 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -761,8 +761,8 @@
 c = zc-zc_csr;
 if((c  ZSRR0_DCD) == 0)
 	cs-cs_preg[3] = ~ZSWR3_HFC;
-bcopy((void *)cs-cs_preg,
-(void *)cs-cs_creg, 16);
+memcpy((void *)cs-cs_creg,
+(void *)cs-cs_preg, 16);
 zs_loadchannelregs(zc, cs-cs_creg);
 splx(sps);
 cs-cs_heldchange = 0;



CVS commit: src/sys/arch/atari/dev

2009-07-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jul  7 15:15:09 UTC 2009

Modified Files:
src/sys/arch/atari/dev: clock.c

Log Message:
Add a workaround for annoying
WARNING: negative runtime; monotonic clock has gone backwards
message. Partially taken from hp300.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/atari/dev/clock.c

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

Modified files:

Index: src/sys/arch/atari/dev/clock.c
diff -u src/sys/arch/atari/dev/clock.c:1.46 src/sys/arch/atari/dev/clock.c:1.47
--- src/sys/arch/atari/dev/clock.c:1.46	Wed Mar 18 10:22:24 2009
+++ src/sys/arch/atari/dev/clock.c	Tue Jul  7 15:15:08 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.46 2009/03/18 10:22:24 cegger Exp $	*/
+/*	$NetBSD: clock.c,v 1.47 2009/07/07 15:15:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.46 2009/03/18 10:22:24 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.47 2009/07/07 15:15:08 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -314,21 +314,29 @@
 static u_int
 clk_getcounter(struct timecounter *tc)
 {
-	u_int delta;
-	u_char ipra, tadr;
-	int s, cur_hardclock;
+	uint32_t delta, count, cur_hardclock;
+	uint8_t ipra, tadr;
+	int s;
+	static uint32_t lastcount;
 
 	s = splhigh();
+	cur_hardclock = hardclock_ticks;
 	ipra = MFP-mf_ipra;
 	tadr = MFP-mf_tadr;
 	delta = divisor - tadr;
 
 	if (ipra  IA_TIMA)
 		delta += divisor;
-	cur_hardclock = hardclock_ticks;
 	splx(s);
 
-	return (divisor - tadr) + divisor * cur_hardclock;
+	count = (divisor * cur_hardclock) + delta;
+	if ((int32_t)(count - lastcount)  0) {
+		/* XXX wrapped; maybe hardclock() is blocked more than 2/HZ */
+		count = lastcount + 1;
+	}
+	lastcount = count;
+
+	return count;
 }
 
 #define TIMB_FREQ	614400



CVS commit: src/sys/arch/atari/dev

2009-07-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jul  7 15:15:35 UTC 2009

Modified Files:
src/sys/arch/atari/dev: md_root.c

Log Message:
Some KNF and cosmetics.


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

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

Modified files:

Index: src/sys/arch/atari/dev/md_root.c
diff -u src/sys/arch/atari/dev/md_root.c:1.31 src/sys/arch/atari/dev/md_root.c:1.32
--- src/sys/arch/atari/dev/md_root.c:1.31	Wed Mar 18 17:06:43 2009
+++ src/sys/arch/atari/dev/md_root.c	Tue Jul  7 15:15:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: md_root.c,v 1.31 2009/03/18 17:06:43 cegger Exp $	*/
+/*	$NetBSD: md_root.c,v 1.32 2009/07/07 15:15:35 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: md_root.c,v 1.31 2009/03/18 17:06:43 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: md_root.c,v 1.32 2009/07/07 15:15:35 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -114,6 +114,7 @@
 void
 md_attach_hook(int unit, struct md_conf *md)
 {
+
 	if (atari_realconfig  (unit  RAMD_NDEV)  rd_info[unit].ramd_flag) {
 		printf (md%d: %sauto-load on open. Size %ld bytes.\n, unit,
 		rd_info[unit].ramd_flag  RAMD_LCOMP ? decompress/ : ,
@@ -127,7 +128,7 @@
 {
 	struct ramd_info *ri;
 
-	if(unit = RAMD_NDEV)
+	if (unit = RAMD_NDEV)
 		return;
 
 	ri = rd_info[unit];
@@ -135,9 +136,9 @@
 		return;	/* Only configure once */
 	md-md_addr = malloc(ri-ramd_size, M_DEVBUF, M_WAITOK);
 	md-md_size = ri-ramd_size;
-	if(md-md_addr == NULL)
+	if (md-md_addr == NULL)
 		return;
-	if(ri-ramd_flag  RAMD_LOAD) {
+	if (ri-ramd_flag  RAMD_LOAD) {
 		if (loaddisk(md, ri-ramd_dev, curlwp)) {
 			free(md-md_addr, M_DEVBUF);
 			md-md_addr = NULL;
@@ -158,7 +159,7 @@
 
 	bdp = bdevsw_lookup(ld_dev);
 	if (bdp == NULL)
-		return (ENXIO);
+		return ENXIO;
 
 	/*
 	 * Initialize our buffer header:
@@ -184,26 +185,26 @@
 	/*
 	 * Open device and try to get some statistics.
 	 */
-	if((error = bdp-d_open(ld_dev, FREAD | FNONBLOCK, 0, lwp)) != 0) {
+	if ((error = bdp-d_open(ld_dev, FREAD | FNONBLOCK, 0, lwp)) != 0) {
 		putiobuf(buf);
-		return(error);
+		return error;
 	}
-	if(bdp-d_ioctl(ld_dev, DIOCGDINFO, (void *)dl, FREAD, lwp) == 0) {
+	if (bdp-d_ioctl(ld_dev, DIOCGDINFO, (void *)dl, FREAD, lwp) == 0) {
 		/* Read on a cylinder basis */
 		rs.chunk= dl.d_secsize * dl.d_secpercyl;
 		rs.media_sz = dl.d_secperunit * dl.d_secsize;
 	}
 
 #ifdef support_compression
-	if(ri-ramd_flag  RAMD_LCOMP)
+	if (ri-ramd_flag  RAMD_LCOMP)
 		error = decompress(cpy_uncompressed, md_compressed, rs);
 	else
 #endif /* support_compression */
 		error = ramd_norm_read(rs);
 
-	bdp-d_close(ld_dev,FREAD | FNONBLOCK, 0, lwp);
+	bdp-d_close(ld_dev, FREAD | FNONBLOCK, 0, lwp);
 	putiobuf(buf);
-	return(error);
+	return error;
 }
 
 static int
@@ -218,7 +219,7 @@
 	bp = rsp-bp;
 	error  = 0;
 
-	while(bytes_left  0) {
+	while (bytes_left  0) {
 		bp-b_cflags = BC_BUSY;
 		bp-b_flags  = B_PHYS | B_READ;
 		bp-b_oflags = ~BO_DONE;
@@ -236,7 +237,7 @@
 
 		/* Dot counter */
 		printf(.);
-		if(!(++dotc % 40))
+		if (!(++dotc % 40))
 			printf(\n);
 
 		done = bp-b_bcount - bp-b_resid;
@@ -245,10 +246,10 @@
 		rsp-offset  += done;
 		rsp-bufp+= done;
 
-		if(error || !done)
+		if (error || !done)
 			break;
 
-		if((rsp-offset == rsp-media_sz)  (bytes_left != 0)) {
+		if ((rsp-offset == rsp-media_sz)  (bytes_left != 0)) {
 			printf(\nInsert next media and hit any key...);
 			cngetc();
 			printf(\n);
@@ -256,7 +257,7 @@
 		}
 	}
 	printf(\n);
-	return(error);
+	return error;
 }
 
 #ifdef support_compression
@@ -269,11 +270,12 @@
 static int
 cpy_uncompressed(void * buf, int nbyte, struct read_info *rsp)
 {
-	if((rsp-bufp + nbyte) = rsp-ebufp)
-		return(0);
-	memcpy( rsp-bufp, buf, nbyte);
+
+	if ((rsp-bufp + nbyte) = rsp-ebufp)
+		return 0;
+	memcpy(rsp-bufp, buf, nbyte);
 	rsp-bufp += nbyte;
-	return(0);
+	return 0;
 }
 
 /*
@@ -292,7 +294,7 @@
 	bp = rsp-bp;
 	nbyte = ~(DEV_BSIZE - 1);
 
-	while(nbyte  0) {
+	while (nbyte  0) {
 		bp-b_cflags = BC_BUSY;
 		bp-b_flags  = B_PHYS | B_READ;
 		bp-b_oflags = ~BO_DONE;
@@ -310,7 +312,7 @@
 
 		/* Dot counter */
 		printf(.);
-		if(!(++dotc % 40))
+		if (!(++dotc % 40))
 			printf(\n);
 
 		done = bp-b_bcount - bp-b_resid;
@@ -319,16 +321,16 @@
 		nread+= done;
 		rsp-offset  += done;
 
-		if(error || !done)
+		if (error || !done)
 			break;
 
-		if((rsp-offset == rsp-media_sz)  (nbyte != 0)) {
+		if ((rsp-offset == rsp-media_sz)  (nbyte != 0)) {
 			printf(\nInsert next media and hit any key...);
-			if(cngetc() != '\n')
+			if (cngetc() != '\n')
 printf(\n);
 			rsp-offset = 0;
 		}
 	}
-	return(nread);
+	return nread;
 }
 #endif /* support_compression */



CVS commit: src/sys/arch/atari/dev

2009-07-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jul  7 16:16:18 UTC 2009

Modified Files:
src/sys/arch/atari/dev: clock.c

Log Message:
KNF, ANSIfy, etc.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/atari/dev/clock.c

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

Modified files:

Index: src/sys/arch/atari/dev/clock.c
diff -u src/sys/arch/atari/dev/clock.c:1.48 src/sys/arch/atari/dev/clock.c:1.49
--- src/sys/arch/atari/dev/clock.c:1.48	Tue Jul  7 15:37:02 2009
+++ src/sys/arch/atari/dev/clock.c	Tue Jul  7 16:16:18 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.48 2009/07/07 15:37:02 tsutsui Exp $	*/
+/*	$NetBSD: clock.c,v 1.49 2009/07/07 16:16:18 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.48 2009/07/07 15:37:02 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.49 2009/07/07 16:16:18 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -187,18 +187,18 @@
 int
 clockmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
 {
-	if(!strcmp(clock, auxp))
-		return(1);
-	return(0);
+
+	if (!strcmp(clock, auxp))
+		return 1;
+	return 0;
 }
 
 /*
  * Start the real-time clock.
  */
-void clockattach(pdp, dp, auxp)
-struct device	*pdp, *dp;
-void		*auxp;
+void clockattach(struct device *pdp, struct device *dp, void *auxp)
 {
+
 	struct clock_softc *sc = (void *)dp;
 	static struct todr_chip_handle	tch;
 
@@ -245,11 +245,11 @@
 	profmin  = (CLOCK_HZ/profhz) - (statvar  1);
 	clk2min  = statmin;
 #endif /* STATCLOCK */
-
 }
 
 void cpu_initclocks(void)
 {
+
 	MFP-mf_tacr  = T_Q200;		/* Start timer			*/
 	MFP-mf_ipra  = (u_int8_t)~IA_TIMA;/* Clear pending interrupts	*/
 	MFP-mf_iera |= IA_TIMA;	/* Enable timer interrupts	*/
@@ -266,6 +266,7 @@
 void
 setstatclockrate(int newhz)
 {
+
 #ifdef STATCLOCK
 	if (newhz == stathz)
 		clk2min = statmin;
@@ -282,7 +283,7 @@
 	var = statvar - 1;
 	do {
 		r = random()  var;
-	} while(r == 0);
+	} while (r == 0);
 
 	/*
 	 * Note that we are always lagging behind as the new divisor
@@ -374,9 +375,9 @@
 		remaining = (unsigned long long) n * TIMB_FREQ / 100;
 	}
 
-	while(remaining  0) {
+	while (remaining  0) {
 		ticks = MFP-mf_tbdr;
-		if(ticks  otick)
+		if (ticks  otick)
 			remaining -= TIMB_LIMIT - (ticks - otick);
 		else
 			remaining -= otick - ticks;
@@ -391,6 +392,7 @@
  */
 profclock(void *pc, int ps)
 {
+
 	/*
 	 * Came from user mode.
 	 * If this process is being profiled record the tick.
@@ -407,7 +409,7 @@
 		register int s = pc - s_lowpc;
 
 		if (s  s_textsize)
-			kcount[s / (HISTFRACTION * sizeof (*kcount))]++;
+			kcount[s / (HISTFRACTION * sizeof(*kcount))]++;
 	}
 	/*
 	 * Kernel profiling was on but has been disabled.
@@ -426,18 +428,16 @@
  *   Real Time Clock support   *
  ***/
 
-u_int mc146818_read(rtc, regno)
-void	*rtc;
-u_int	regno;
+u_int mc146818_read(void *rtc, u_int regno)
 {
+
 	((struct rtc *)rtc)-rtc_regno = regno;
-	return(((struct rtc *)rtc)-rtc_data  0377);
+	return ((struct rtc *)rtc)-rtc_data  0377;
 }
 
-void mc146818_write(rtc, regno, value)
-void	*rtc;
-u_int	regno, value;
+void mc146818_write(void *rtc, u_int regno, u_int value)
 {
+
 	((struct rtc *)rtc)-rtc_regno = regno;
 	((struct rtc *)rtc)-rtc_data  = value;
 }
@@ -459,19 +459,19 @@
 		printf(Error: Nonstandard RealTimeClock Configuration -
 			 value ignored\n
 			   A write to /dev/rtc will correct this.\n);
-			return(0);
+			return 0;
 	}
-	if(clkregs[MC_SEC]  59)
+	if (clkregs[MC_SEC]  59)
 		return -1;
-	if(clkregs[MC_MIN]  59)
+	if (clkregs[MC_MIN]  59)
 		return -1;
-	if(clkregs[MC_HOUR]  23)
+	if (clkregs[MC_HOUR]  23)
 		return -1;
-	if(range_test(clkregs[MC_DOM], 1, 31))
+	if (range_test(clkregs[MC_DOM], 1, 31))
 		return -1;
 	if (range_test(clkregs[MC_MONTH], 1, 12))
 		return -1;
-	if(clkregs[MC_YEAR]  99)
+	if (clkregs[MC_YEAR]  99)
 		return -1;
 
 	dtp-dt_year = clkregs[MC_YEAR] + GEMSTARTOFTIME;
@@ -559,7 +559,7 @@
 	if (length  uio-uio_resid)
 		length = uio-uio_resid;
 
-	return(uiomove((void *)buffer, length, uio));
+	return uiomove((void *)buffer, length, uio);
 }
 
 static int
@@ -571,7 +571,7 @@
 		result = (buffer[pos] - '0') * 10;
 	if (buffer[pos+1] = '0'  buffer[pos+1] = '9')
 		result += (buffer[pos+1] - '0');
-	return(result);
+	return result;
 }
 
 int
@@ -587,17 +587,17 @@
 	length = uio-uio_resid;
 	if (uio-uio_offset || (length != sizeof(buffer)
 	   length != sizeof(buffer - 1)))
-		return(EINVAL);
+		return EINVAL;
 	
 	if ((error = uiomove((void *)buffer, sizeof(buffer), uio)))
-		return(error);
+		return error;
 
 	if (length == sizeof(buffer)  buffer[sizeof(buffer) - 1] != '\n')
-		return(EINVAL);
+		return EINVAL;
 
 	s = splclock();
 	

CVS commit: src/sys/arch/atari/dev

2009-07-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jul  3 13:36:09 UTC 2009

Modified Files:
src/sys/arch/atari/dev: kbd.c

Log Message:
KNF, use uint8_t, and misc cosmetics.


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

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

Modified files:

Index: src/sys/arch/atari/dev/kbd.c
diff -u src/sys/arch/atari/dev/kbd.c:1.36 src/sys/arch/atari/dev/kbd.c:1.37
--- src/sys/arch/atari/dev/kbd.c:1.36	Wed Mar 18 10:22:24 2009
+++ src/sys/arch/atari/dev/kbd.c	Fri Jul  3 13:36:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kbd.c,v 1.36 2009/03/18 10:22:24 cegger Exp $	*/
+/*	$NetBSD: kbd.c,v 1.37 2009/07/03 13:36:09 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kbd.c,v 1.36 2009/03/18 10:22:24 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: kbd.c,v 1.37 2009/07/03 13:36:09 tsutsui Exp $);
 
 #include mouse.h
 #include ite.h
@@ -97,12 +97,12 @@
  * - If an ite is present the data may be fed to it.
  */
 
-u_char			kbd_modifier;	/* Modifier mask		*/
+uint8_t			kbd_modifier;	/* Modifier mask		*/
 
-static u_char		kbd_ring[KBD_RING_SIZE];
+static uint8_t		kbd_ring[KBD_RING_SIZE];
 static volatile u_int	kbd_rbput = 0;	/* 'put' index			*/
 static u_int		kbd_rbget = 0;	/* 'get' index			*/
-static u_char		kbd_soft  = 0;	/* 1: Softint has been scheduled*/
+static uint8_t		kbd_soft  = 0;	/* 1: Softint has been scheduled*/
 
 static struct kbd_softc kbd_softc;
 
@@ -121,10 +121,10 @@
 static void kbdattach(struct device *, struct device *, void *);
 static int  kbdmatch(struct device *, struct cfdata *, void *);
 #if NITE0
-static int  kbd_do_modifier(u_char);
+static int  kbd_do_modifier(uint8_t);
 #endif
-static int  kbd_write_poll(u_char *, int);
-static void kbd_pkg_start(struct kbd_softc *, u_char);
+static int  kbd_write_poll(uint8_t *, int);
+static void kbd_pkg_start(struct kbd_softc *, uint8_t);
 
 CFATTACH_DECL(kbd, sizeof(struct device),
 kbdmatch, kbdattach, NULL, NULL);
@@ -168,18 +168,19 @@
 static	int
 kbdmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
 {
+
 	if (!strcmp((char *)auxp, kbd))
-		return (1);
-	return (0);
+		return 1;
+	return 0;
 }
 
 /*ARGSUSED*/
 static void
 kbdattach(struct device *pdp, struct device *dp, void *auxp)
 {
-	int	timeout;
-	u_char	kbd_rst[]  = { 0x80, 0x01 };
-	u_char	kbd_icmd[] = { 0x12, 0x15 };
+	int timeout;
+	uint8_t kbd_rst[]  = { 0x80, 0x01 };
+	uint8_t kbd_icmd[] = { 0x12, 0x15 };
 
 	/*
 	 * Disable keyboard interrupts from MFP
@@ -245,7 +246,7 @@
 void
 kbdenable(void)
 {
-	int	s, code;
+	int s, code;
 
 	s = spltty();
 
@@ -269,32 +270,35 @@
 
 int kbdopen(dev_t dev, int flags, int mode, struct lwp *l)
 {
+
 	if (kbd_softc.k_events.ev_io)
 		return EBUSY;
 
 	kbd_softc.k_events.ev_io = l-l_proc;
 	ev_init(kbd_softc.k_events);
-	return (0);
+	return 0;
 }
 
 int
 kbdclose(dev_t dev, int flags, int mode, struct lwp *l)
 {
+
 	/* Turn off event mode, dump the queue */
 	kbd_softc.k_event_mode = 0;
 	ev_fini(kbd_softc.k_events);
 	kbd_softc.k_events.ev_io = NULL;
-	return (0);
+	return 0;
 }
 
 int
 kbdread(dev_t dev, struct uio *uio, int flags)
 {
+
 	return ev_read(kbd_softc.k_events, uio, flags);
 }
 
 int
-kbdioctl(dev_t dev,u_long cmd,register void *data,int flag,struct lwp *l)
+kbdioctl(dev_t dev, u_long cmd, register void *data, int flag, struct lwp *l)
 {
 	register struct kbd_softc *k = kbd_softc;
 	struct kbdbell	*kb;
@@ -320,7 +324,7 @@
 			kb = (struct kbdbell *)data;
 			if (kb)
 kbd_bell_sparms(kb-volume, kb-pitch,
-			kb-duration);
+kb-duration);
 			kbdbell();
 			return 0;
 
@@ -355,14 +359,15 @@
 int
 kbdpoll (dev_t dev, int events, struct lwp *l)
 {
-  return ev_poll (kbd_softc.k_events, events, l);
+
+	return ev_poll(kbd_softc.k_events, events, l);
 }
 
 int
 kbdkqfilter(dev_t dev, struct knote *kn)
 {
 
-	return (ev_kqfilter(kbd_softc.k_events, kn));
+	return ev_kqfilter(kbd_softc.k_events, kn);
 }
 
 /*
@@ -425,12 +430,11 @@
 void
 kbdsoft(void *junk1, void *junk2)
 {
-	int			s;
-	u_char			code;
-	struct kbd_softc	*k = kbd_softc;
-	struct firm_event	*fe;
-	int			put;
-	int			n, get;
+	int s;
+	uint8_t code;
+	struct kbd_softc *k = kbd_softc;
+	struct firm_event *fe;
+	int put, get, n;
 
 	kbd_soft = 0;
 	get  = kbd_rbget;
@@ -457,13 +461,13 @@
 /*
  * Package is complete.
  */
-switch(k-k_pkg_type) {
+switch (k-k_pkg_type) {
 #if NMOUSE  0
 case KBD_AMS_PKG:
 case KBD_RMS_PKG:
 case KBD_JOY1_PKG:
 			 		mouse_soft((REL_MOUSE *)k-k_package,
-		k-k_pkg_size, k-k_pkg_type);
+	k-k_pkg_size, k-k_pkg_type);
 #endif /* NMOUSE */
 }
 k-k_pkg_size = 0;
@@ -479,9 +483,9 @@
 			}
 #if NWSKBD0
 			/*
-			 * If we have attached a wskbd and not in polling mode and
-			 * nobody has opened us directly, then send the keystroke
-			

CVS commit: src/sys/arch/atari/dev

2009-07-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jul  3 13:49:39 UTC 2009

Modified Files:
src/sys/arch/atari/dev: kbd.c kbdvar.h

Log Message:
Use more uint8_t, and constify.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/atari/dev/kbd.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/atari/dev/kbdvar.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/arch/atari/dev/kbd.c
diff -u src/sys/arch/atari/dev/kbd.c:1.37 src/sys/arch/atari/dev/kbd.c:1.38
--- src/sys/arch/atari/dev/kbd.c:1.37	Fri Jul  3 13:36:09 2009
+++ src/sys/arch/atari/dev/kbd.c	Fri Jul  3 13:49:39 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kbd.c,v 1.37 2009/07/03 13:36:09 tsutsui Exp $	*/
+/*	$NetBSD: kbd.c,v 1.38 2009/07/03 13:49:39 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kbd.c,v 1.37 2009/07/03 13:36:09 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: kbd.c,v 1.38 2009/07/03 13:49:39 tsutsui Exp $);
 
 #include mouse.h
 #include ite.h
@@ -123,7 +123,7 @@
 #if NITE0
 static int  kbd_do_modifier(uint8_t);
 #endif
-static int  kbd_write_poll(uint8_t *, int);
+static int  kbd_write_poll(const uint8_t *, int);
 static void kbd_pkg_start(struct kbd_softc *, uint8_t);
 
 CFATTACH_DECL(kbd, sizeof(struct device),
@@ -179,8 +179,8 @@
 kbdattach(struct device *pdp, struct device *dp, void *auxp)
 {
 	int timeout;
-	uint8_t kbd_rst[]  = { 0x80, 0x01 };
-	uint8_t kbd_icmd[] = { 0x12, 0x15 };
+	const uint8_t kbd_rst[]  = { 0x80, 0x01 };
+	const uint8_t kbd_icmd[] = { 0x12, 0x15 };
 
 	/*
 	 * Disable keyboard interrupts from MFP
@@ -649,7 +649,7 @@
  * Write a command to the keyboard in 'polled' mode.
  */
 static int
-kbd_write_poll(uint8_t *cmd, int len)
+kbd_write_poll(const uint8_t *cmd, int len)
 {
 	int	timeout;
 
@@ -667,7 +667,7 @@
  * Write a command to the keyboard. Return when command is send.
  */
 void
-kbd_write(uint8_t *cmd, int len)
+kbd_write(const uint8_t *cmd, int len)
 {
 	struct kbd_softc	*k = kbd_softc;
 	int			sps;

Index: src/sys/arch/atari/dev/kbdvar.h
diff -u src/sys/arch/atari/dev/kbdvar.h:1.6 src/sys/arch/atari/dev/kbdvar.h:1.7
--- src/sys/arch/atari/dev/kbdvar.h:1.6	Sat Mar 14 14:45:56 2009
+++ src/sys/arch/atari/dev/kbdvar.h	Fri Jul  3 13:49:39 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kbdvar.h,v 1.6 2009/03/14 14:45:56 dsl Exp $	*/
+/*	$NetBSD: kbdvar.h,v 1.7 2009/07/03 13:49:39 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.
@@ -44,12 +44,12 @@
 	int		k_event_mode;	/* if 1, collect events,	*/
 	/*   else pass to ite		*/
 	struct evvar	k_events;	/* event queue state		*/
-	u_char		k_soft_cs;	/* control-reg. copy		*/
-	u_char		k_package[20];	/* XXX package being build	*/
-	u_char		k_pkg_size;	/* Size of the package		*/
-	u_char		k_pkg_idx;	/* Running pkg assembly index	*/
-	u_char		k_pkg_type;	/* Type of package		*/
-	u_char		*k_sendp;	/* Output pointer		*/
+	uint8_t		k_soft_cs;	/* control-reg. copy		*/
+	uint8_t		k_package[20];	/* XXX package being build	*/
+	uint8_t		k_pkg_size;	/* Size of the package		*/
+	uint8_t		k_pkg_idx;	/* Running pkg assembly index	*/
+	uint8_t		k_pkg_type;	/* Type of package		*/
+	const uint8_t	*k_sendp;	/* Output pointer		*/
 	int		k_send_cnt;	/* Chars left for output	*/
 #if NWSKBD0
 	struct device	*k_wskbddev;	/* pointer to wskbd for sending strokes */
@@ -69,11 +69,11 @@
 #define	KBD_TIMEO_PKG	6		/* Timeout package		*/
 
 #ifdef _KERNEL
-extern	u_char	kbd_modifier;
+extern	uint8_t	kbd_modifier;
 
 void	kbd_bell_gparms(u_int *, u_int *, u_int *);
 void	kbd_bell_sparms(u_int, u_int, u_int);
-void	kbd_write(u_char *, int);
+void	kbd_write(const uint8_t *, int);
 int	kbdgetcn(void);
 void	kbdbell(void);
 void	kbdenable(void);



CVS commit: src/sys/arch/atari/dev

2009-07-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jul  3 14:00:41 UTC 2009

Modified Files:
src/sys/arch/atari/dev: kbd.c kbdvar.h

Log Message:
Replace one traditional MD si_callback() with MI softint(9).


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/atari/dev/kbd.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/atari/dev/kbdvar.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/arch/atari/dev/kbd.c
diff -u src/sys/arch/atari/dev/kbd.c:1.38 src/sys/arch/atari/dev/kbd.c:1.39
--- src/sys/arch/atari/dev/kbd.c:1.38	Fri Jul  3 13:49:39 2009
+++ src/sys/arch/atari/dev/kbd.c	Fri Jul  3 14:00:41 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kbd.c,v 1.38 2009/07/03 13:49:39 tsutsui Exp $	*/
+/*	$NetBSD: kbd.c,v 1.39 2009/07/03 14:00:41 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kbd.c,v 1.38 2009/07/03 13:49:39 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: kbd.c,v 1.39 2009/07/03 14:00:41 tsutsui Exp $);
 
 #include mouse.h
 #include ite.h
@@ -102,7 +102,6 @@
 static uint8_t		kbd_ring[KBD_RING_SIZE];
 static volatile u_int	kbd_rbput = 0;	/* 'put' index			*/
 static u_int		kbd_rbget = 0;	/* 'get' index			*/
-static uint8_t		kbd_soft  = 0;	/* 1: Softint has been scheduled*/
 
 static struct kbd_softc kbd_softc;
 
@@ -117,7 +116,7 @@
 /* Interrupt handler */
 void	kbdintr(int);
 
-static void kbdsoft(void *, void *);
+static void kbdsoft(void *);
 static void kbdattach(struct device *, struct device *, void *);
 static int  kbdmatch(struct device *, struct cfdata *, void *);
 #if NITE0
@@ -220,6 +219,8 @@
 
 	printf(\n);
 
+	kbd_softc.k_sicookie = softint_establish(SOFTINT_SERIAL, kbdsoft, NULL);
+
 #if NWSKBD0
 	if (dp != NULL) {
 		/*
@@ -413,22 +414,15 @@
 	/*
 	 * Activate software-level to handle possible input.
 	 */
-	if (got_char) {
-		if (!BASEPRI(sr)) {
-			if (!kbd_soft++)
-add_sicallback(kbdsoft, 0, 0);
-		} else {
-			spl1();
-			kbdsoft(NULL, NULL);
-		}
-	}
+	if (got_char)
+		softint_schedule(kbd_softc.k_sicookie);
 }
 
 /*
  * Keyboard soft interrupt handler
  */
-void
-kbdsoft(void *junk1, void *junk2)
+static void
+kbdsoft(void *junk1)
 {
 	int s;
 	uint8_t code;
@@ -436,7 +430,6 @@
 	struct firm_event *fe;
 	int put, get, n;
 
-	kbd_soft = 0;
 	get  = kbd_rbget;
 
 	for (;;) {

Index: src/sys/arch/atari/dev/kbdvar.h
diff -u src/sys/arch/atari/dev/kbdvar.h:1.7 src/sys/arch/atari/dev/kbdvar.h:1.8
--- src/sys/arch/atari/dev/kbdvar.h:1.7	Fri Jul  3 13:49:39 2009
+++ src/sys/arch/atari/dev/kbdvar.h	Fri Jul  3 14:00:41 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kbdvar.h,v 1.7 2009/07/03 13:49:39 tsutsui Exp $	*/
+/*	$NetBSD: kbdvar.h,v 1.8 2009/07/03 14:00:41 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.
@@ -55,6 +55,7 @@
 	struct device	*k_wskbddev;	/* pointer to wskbd for sending strokes */
 	int		k_pollingmode;	/* polling mode on? whatever it isss... */
 #endif
+	void		*k_sicookie;	/* softint(9) cookie		*/
 };
 
 /*