CVS commit: [netbsd-5] src/sys/arch/x68k/dev

2012-03-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Mar 17 18:40:20 UTC 2012

Modified Files:
src/sys/arch/x68k/dev [netbsd-5]: kbd.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1732):
sys/arch/x68k/dev/kbd.c: revision 1.37
Calling psignal(9) (via EV_WAKEUP()) in interrupt handlers
could cause mutex error panic, so defer it via softint(9).
This should fix panic on heavy key strokes during running Xserver.
Should be pulled up to netbsd-5.
XXX: amiga and atari might have the similar problem?


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.6.1 src/sys/arch/x68k/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/x68k/dev/kbd.c
diff -u src/sys/arch/x68k/dev/kbd.c:1.35 src/sys/arch/x68k/dev/kbd.c:1.35.6.1
--- src/sys/arch/x68k/dev/kbd.c:1.35	Wed Jun 25 08:14:59 2008
+++ src/sys/arch/x68k/dev/kbd.c	Sat Mar 17 18:40:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kbd.c,v 1.35 2008/06/25 08:14:59 isaki Exp $	*/
+/*	$NetBSD: kbd.c,v 1.35.6.1 2012/03/17 18:40:20 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kbd.c,v 1.35 2008/06/25 08:14:59 isaki Exp $);
+__KERNEL_RCSID(0, $NetBSD: kbd.c,v 1.35.6.1 2012/03/17 18:40:20 bouyer Exp $);
 
 #include ite.h
 #include bell.h
@@ -350,7 +350,7 @@ kbdintr(void *arg)
 	fe-value = KEY_UP(c) ? VKEY_UP : VKEY_DOWN;
 	getmicrotime(fe-time);
 	sc-sc_events.ev_put = put;
-	EV_WAKEUP(sc-sc_events);
+	softint_schedule(sc-sc_softintr_cookie);
 
 	return 0;
 }
@@ -358,10 +358,14 @@ kbdintr(void *arg)
 void
 kbdsoftint(void *arg)			/* what if ite is not configured? */
 {
+	struct kbd_softc *sc = arg;
 	int s;
 
 	s = spltty();
 
+	if (sc-sc_event_mode)
+		EV_WAKEUP(sc-sc_events);
+
 	while(kbdgetoff  kbdputoff)
 		ite_filter(kbdbuf[kbdgetoff++  KBDBUFMASK]);
 	kbdgetoff = kbdputoff = 0;



CVS commit: [netbsd-5] src/sys/arch/x68k/dev

2011-05-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri May 20 19:28:06 UTC 2011

Modified Files:
src/sys/arch/x68k/dev [netbsd-5]: fd.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1617):
sys/arch/x68k/dev/fd.c: revision 1.94 via patch
Fix hangup on the first floppy access since 2008.
Problem was reported by isaki@.
On X680x0 (and most other machines other than ISA FDC),
the ready line from FDD is connected to FDC and fdc driver can
be notified of the ready state after fd_set_motor() by interrupts.
In this case no need to use callout(9) to wait the FDD motor stabilized,
and the callout(9) method used in ISA fdc(4) driver rather caused
infinite unhandled interrupts since callout(9) was no longer invoked
during interrupt storm after vmlocking2 merge, I guess.
Should be pulled up to netbsd-5.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.85.6.1 src/sys/arch/x68k/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/x68k/dev/fd.c
diff -u src/sys/arch/x68k/dev/fd.c:1.85 src/sys/arch/x68k/dev/fd.c:1.85.6.1
--- src/sys/arch/x68k/dev/fd.c:1.85	Sun Jun 29 09:44:11 2008
+++ src/sys/arch/x68k/dev/fd.c	Fri May 20 19:28:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.85 2008/06/29 09:44:11 isaki Exp $	*/
+/*	$NetBSD: fd.c,v 1.85.6.1 2011/05/20 19:28:05 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.85 2008/06/29 09:44:11 isaki Exp $);
+__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.85.6.1 2011/05/20 19:28:05 bouyer Exp $);
 
 #include rnd.h
 #include opt_ddb.h
@@ -212,7 +212,9 @@
 	struct fd_type *sc_deftype;	/* default type descriptor */
 	struct fd_type *sc_type;	/* current type descriptor */
 
+#if 0	/* see comments in fd_motor_on() */
 	struct callout sc_motoron_ch;
+#endif
 	struct callout sc_motoroff_ch;
 
 	daddr_t	sc_blkno;	/* starting block number */
@@ -278,7 +280,9 @@
 
 void fd_set_motor(struct fdc_softc *, int);
 void fd_motor_off(void *);
+#if 0
 void fd_motor_on(void *);
+#endif
 int fdcresult(struct fdc_softc *);
 int out_fdc(bus_space_tag_t, bus_space_handle_t, u_char);
 void fdcstart(struct fdc_softc *);
@@ -566,7 +570,9 @@
 	struct fd_type *type = fd_types[0];	/* XXX 1.2MB */
 	int drive = fa-fa_drive;
 
+#if 0
 	callout_init(fd-sc_motoron_ch, 0);
+#endif
 	callout_init(fd-sc_motoroff_ch, 0);
 
 	fd-sc_dev = self;
@@ -790,6 +796,7 @@
 	splx(s);
 }
 
+#if 0 /* on x68k motor on triggers interrupts by state change of ready line. */
 void
 fd_motor_on(void *arg)
 {
@@ -805,6 +812,7 @@
 		(void) fdcintr(fdc);
 	splx(s);
 }
+#endif
 
 int
 fdcresult(struct fdc_softc *fdc)
@@ -1078,9 +1086,11 @@
 			fd-sc_flags |= FD_MOTOR | FD_MOTOR_WAIT;
 			fd_set_motor(fdc, 0);
 			fdc-sc_state = MOTORWAIT;
+#if 0	/* no need to callout on x68k; motor on will trigger interrupts */
 			/* allow .5s for motor to stabilize */
 			callout_reset(fd-sc_motoron_ch, hz / 2,
 			fd_motor_on, fd);
+#endif
 			return 1;
 		}
 		/* Make sure the right drive is selected. */
@@ -1434,8 +1444,21 @@
 		goto doseek;
 
 	case MOTORWAIT:
+#if 0 /* on x68k motor on triggers interrupts by state change of ready line. */
 		if (fd-sc_flags  FD_MOTOR_WAIT)
 			return 1;		/* time's not up yet */
+#else
+		/* check drive ready by state change interrupt */
+		KASSERT(fd-sc_flags  FD_MOTOR_WAIT);
+		out_fdc(iot, ioh, NE7CMD_SENSEI);
+		tmp = fdcresult(fdc);
+		if (tmp != 2 || (st0  0xc0) != 0xc0 /* ready changed */) {
+			printf(%s: unexpected interrupt during MOTORWAIT\n,
+			device_xname(fd-sc_dev));
+			return 1;
+		}
+		fd-sc_flags = ~FD_MOTOR_WAIT;
+#endif
 		goto doseek;
 
 	default: