Raise IPL to splsoftnet() before calling callback functions 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.
This commit is contained in:
tsutsui 2009-01-03 06:36:58 +00:00
parent a2c38ed82e
commit c61c988be5
1 changed files with 15 additions and 2 deletions

View File

@ -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 @@ call_sicallbacks(void)
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