summaryrefslogtreecommitdiff
path: root/sys/arch/sgi
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2007-11-11 14:56:42 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2007-11-11 14:56:42 +0000
commitef611a7ba16083eec393342352c65e5a6336de96 (patch)
treececfc3bc23e2a0988d8f61abe83edd02e9bce64f /sys/arch/sgi
parent80acb47d76651cf5a721170eff7732344d1eb1f9 (diff)
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@
Diffstat (limited to 'sys/arch/sgi')
-rw-r--r--sys/arch/sgi/localbus/macebus.c26
1 files changed, 24 insertions, 2 deletions
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. */
}