From ef611a7ba16083eec393342352c65e5a6336de96 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Sun, 11 Nov 2007 14:56:42 +0000 Subject: Add spurious interrupt detection to macebus. This allows for the detection of interrupt storms and enables the user to "boot poweroff" from ddb, instead of pulling the powercord. Initial code heavily reworked by miod@ ok miod@ --- sys/arch/sgi/localbus/macebus.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'sys/arch/sgi/localbus/macebus.c') diff --git a/sys/arch/sgi/localbus/macebus.c b/sys/arch/sgi/localbus/macebus.c index 0d87778b3db..fe2633d42bf 100644 --- a/sys/arch/sgi/localbus/macebus.c +++ b/sys/arch/sgi/localbus/macebus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macebus.c,v 1.29 2007/10/14 11:18:42 jsing Exp $ */ +/* $OpenBSD: macebus.c,v 1.30 2007/11/11 14:56:41 jsing Exp $ */ /* * Copyright (c) 2000-2004 Opsycon AB (www.opsycon.se) @@ -733,6 +733,9 @@ macebus_iointr(intrmask_t hwpend, struct trap_frame *cf) int v; intrmask_t pending; u_int64_t intstat, isastat, mask; +#ifdef DIAGNOSTIC + static int spurious = 0; +#endif intstat = bus_space_read_8(&crimebus_tag, crime_h, CRIME_INT_STAT); intstat &= 0xffff; @@ -768,8 +771,27 @@ macebus_iointr(intrmask_t hwpend, struct trap_frame *cf) } } - if (caught) + if (caught) { +#ifdef DIAGNOSTIC + spurious = 0; +#endif return CR_INT_0; + } + +#ifdef DIAGNOSTIC + if (pending != 0) { + printf("stray interrupt, mace mask %lx stat %lx\n" + "crime mask %lx stat %lx hard %lx (pending %lx caught %lx)\n", + bus_space_read_8(&macebus_tag, mace_h, MACE_ISA_INT_MASK), + bus_space_read_8(&macebus_tag, mace_h, MACE_ISA_INT_STAT), + bus_space_read_8(&crimebus_tag, crime_h, CRIME_INT_MASK), + bus_space_read_8(&crimebus_tag, crime_h, CRIME_INT_STAT), + bus_space_read_8(&crimebus_tag, crime_h, CRIME_INT_HARD), + pending, caught); + if (++spurious >= 10) + panic("too many stray interrupts"); + } +#endif return 0; /* Not found here. */ } -- cgit v1.2.3