Sun Jan 17 17:49:55 2016 UTC ()
Fix fatal "intr_dispatch: stray level 6 interrupt" panic by the GENERIC
kernel on machines without arcofi(4) audio (i.e. all hp300 except HP425e).

I failed to pull all necessary changes for arcofi(4) from OpenBSD
and I should have tested 7.0_RC kernels on my HP382 too :-(

Should be pulled up to netbsd-7 and netbsd-7-0.


(tsutsui)
diff -r1.41 -r1.42 src/sys/arch/hp300/hp300/intr.c

cvs diff -r1.41 -r1.42 src/sys/arch/hp300/hp300/intr.c (expand / switch to unified diff)

--- src/sys/arch/hp300/hp300/intr.c 2014/08/24 08:17:44 1.41
+++ src/sys/arch/hp300/hp300/intr.c 2016/01/17 17:49:55 1.42
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: intr.c,v 1.41 2014/08/24 08:17:44 tsutsui Exp $ */ 1/* $NetBSD: intr.c,v 1.42 2016/01/17 17:49:55 tsutsui Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1996, 1997, 1999 The NetBSD Foundation, Inc. 4 * Copyright (c) 1996, 1997, 1999 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Adam Glass, Gordon W. Ross, and Jason R. Thorpe. 8 * by Adam Glass, Gordon W. Ross, and Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
33 * Link and dispatch interrupts. 33 * Link and dispatch interrupts.
34 */ 34 */
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.41 2014/08/24 08:17:44 tsutsui Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.42 2016/01/17 17:49:55 tsutsui Exp $");
38 38
39#define _HP300_INTR_H_PRIVATE 39#define _HP300_INTR_H_PRIVATE
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/malloc.h> 43#include <sys/malloc.h>
44#include <sys/vmmeter.h> 44#include <sys/vmmeter.h>
45#include <sys/cpu.h> 45#include <sys/cpu.h>
46#include <sys/intr.h> 46#include <sys/intr.h>
47 47
48#include "audio.h" 48#include "audio.h"
49 49
50/* 50/*
@@ -189,29 +189,32 @@ intr_dispatch(int evec /* format | vecto @@ -189,29 +189,32 @@ intr_dispatch(int evec /* format | vecto
189 189
190 vec = (evec & 0xfff) >> 2; 190 vec = (evec & 0xfff) >> 2;
191#ifdef DIAGNOSTIC 191#ifdef DIAGNOSTIC
192 if ((vec < ISRLOC) || (vec >= (ISRLOC + NISR))) 192 if ((vec < ISRLOC) || (vec >= (ISRLOC + NISR)))
193 panic("intr_dispatch: bad vec 0x%x", vec); 193 panic("intr_dispatch: bad vec 0x%x", vec);
194#endif 194#endif
195 ipl = vec - ISRLOC; 195 ipl = vec - ISRLOC;
196 196
197 hp300_intr_list[ipl].hi_evcnt.ev_count++; 197 hp300_intr_list[ipl].hi_evcnt.ev_count++;
198 curcpu()->ci_data.cpu_nintr++; 198 curcpu()->ci_data.cpu_nintr++;
199 199
200 list = &hp300_intr_list[ipl]; 200 list = &hp300_intr_list[ipl];
201 if (LIST_FIRST(&list->hi_q) == NULL) { 201 if (LIST_FIRST(&list->hi_q) == NULL) {
202 printf("intr_dispatch: ipl %d unexpected\n", ipl); 202 if (ipl != 6) {
203 if (++unexpected > 10) 203 printf("intr_dispatch: ipl %d unexpected\n", ipl);
204 panic("intr_dispatch: too many unexpected interrupts"); 204 if (++unexpected > 10)
 205 panic("intr_dispatch:"
 206 " too many unexpected interrupts");
 207 }
205 return; 208 return;
206 } 209 }
207 210
208 handled = 0; 211 handled = 0;
209 /* Give all the handlers a chance. */ 212 /* Give all the handlers a chance. */
210 for (ih = LIST_FIRST(&list->hi_q) ; ih != NULL; 213 for (ih = LIST_FIRST(&list->hi_q) ; ih != NULL;
211 ih = LIST_NEXT(ih, ih_q)) 214 ih = LIST_NEXT(ih, ih_q))
212 handled |= (*ih->ih_fn)(ih->ih_arg); 215 handled |= (*ih->ih_fn)(ih->ih_arg);
213 216
214#if NAUDIO > 0 217#if NAUDIO > 0
215 /* hardclock() on ipl 6 is already handled in locore.s */ 218 /* hardclock() on ipl 6 is already handled in locore.s */
216 if (ipl == 6) 219 if (ipl == 6)
217 return; 220 return;