summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2003-06-28 16:40:53 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2003-06-28 16:40:53 +0000
commit017106e56897fdd8aa7fd99038bef95ae6247736 (patch)
tree1f31145757b7876d283c8de9633f7e365478f898
parent9a8d72daca484796a6e2209b646356f5ab096724 (diff)
Be more careful when processing interrupts - the TS102 queues them, and we
might get fed an interrupt for a particular condition at a time we are not expecting this condition anymore...
-rw-r--r--sys/arch/sparc/dev/ts102.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/sys/arch/sparc/dev/ts102.c b/sys/arch/sparc/dev/ts102.c
index 7d639585f7c..99ae2ffea4c 100644
--- a/sys/arch/sparc/dev/ts102.c
+++ b/sys/arch/sparc/dev/ts102.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ts102.c,v 1.8 2003/06/28 16:23:54 miod Exp $ */
+/* $OpenBSD: ts102.c,v 1.9 2003/06/28 16:40:52 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
*
@@ -749,7 +749,16 @@ tslot_slot_intr(struct tslot_data *td, int intreg)
sockstat = td->td_status;
- if (intreg & TS102_CARD_INT_STATUS_CARDDETECT_STATUS_CHANGED) {
+ /*
+ * The TS102 queues interrupt request, and may trigger an interrupt
+ * for a condition the driver does not want to receive anymore (for
+ * example, after a card gets removed).
+ * Thus, only proceed if the driver is currently allowing a particular
+ * condition.
+ */
+
+ if ((intreg & TS102_CARD_INT_STATUS_CARDDETECT_STATUS_CHANGED) != 0 &&
+ (intreg & TS102_CARD_INT_MASK_CARDDETECT_STATUS) != 0) {
if (status & TS102_CARD_STS_PRES) {
tslot_queue_event(td->td_parent,
td->td_slot, TSLOT_EVENT_INSERT);
@@ -768,10 +777,11 @@ tslot_slot_intr(struct tslot_data *td, int intreg)
return;
}
- if (intreg & TS102_CARD_INT_STATUS_IRQ) {
+ if ((intreg & TS102_CARD_INT_STATUS_IRQ) != 0 &&
+ (intreg & TS102_CARD_INT_MASK_IRQ) != 0) {
if (sockstat != TS_CARD) {
- printf("%s: spurious interrupt on slot %d\n",
- td->td_parent->sc_dev.dv_xname, td->td_slot);
+ printf("%s: spurious interrupt on slot %d isr %x\n",
+ td->td_parent->sc_dev.dv_xname, td->td_slot, intreg);
return;
}