Sat Jan 3 06:36:59 2009 UTC ()
Raise IPL to splsoftnet() before calling callback funcions registered
via (atari specific) add_sicallback(), as a workaround hack.

Many drivers which use the MD sicallback depend on BASEPRI() macro
defined in <machine/cpu.h> to check nested interrupts,
but functions invoked from MI softint(9) won't run at IPL_SOFT
any longer and the BASEPRI() macro doesn't return expected value
as the past.

Fixes lost interrupt problem on Falcon wdc(4) reported by
Tuomo Makinen on port-atari, and also confirmed by him.

Should be pulled up to netbsd-5.


(tsutsui)
diff -r1.154 -r1.155 src/sys/arch/atari/atari/machdep.c

cvs diff -r1.154 -r1.155 src/sys/arch/atari/atari/machdep.c (expand / switch to context diff)
--- src/sys/arch/atari/atari/machdep.c 2008/11/30 18:21:32 1.154
+++ src/sys/arch/atari/atari/machdep.c 2009/01/03 06:36:58 1.155
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.154 2008/11/30 18:21:32 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.155 2009/01/03 06:36:58 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.154 2008/11/30 18:21:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.155 2009/01/03 06:36:58 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -810,7 +810,20 @@
 			si->next = si_free;
 			si_free  = si;
 			splx(s);
+
+			/*
+			 * Raise spl for BASEPRI() checks to see
+			 * nested interrupts in some drivers using callbacks
+			 * since modern MI softint(9) doesn't seem to do it
+			 * in !__HAVE_FAST_SOFTINTS case.
+			 *
+			 * XXX: This is just a workaround hack.
+			 *      Each driver should raise spl in its handler
+			 *      to avoid nested interrupts if necessary.
+			 */
+			s = splsoftnet();	/* XXX */
 			function(rock1, rock2);
+			splx(s);
 		}
 	} while (si);
 #ifdef DIAGNOSTIC