summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/dev/magma.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-04-10 20:53:55 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-04-10 20:53:55 +0000
commitb87d8aad6f1343a2b36ff29986060ba762a45fbb (patch)
tree21dd950980778036b5e89b97f8fd841b4ff956ae /sys/arch/sparc/dev/magma.c
parent2d152c27f3b1a0ab189abf8353c05e196498d89e (diff)
generic soft interrupts support for sparc. Soft interrupt handlers are now
kept in a separate intrhand array, with their own enable bits so that soft interrupts sharing the same level only get invoked if really triggered. Inspired by NetBSD with significant changes. ok kettenis@
Diffstat (limited to 'sys/arch/sparc/dev/magma.c')
-rw-r--r--sys/arch/sparc/dev/magma.c41
1 files changed, 5 insertions, 36 deletions
diff --git a/sys/arch/sparc/dev/magma.c b/sys/arch/sparc/dev/magma.c
index 2c4bedf3456..05b217a790f 100644
--- a/sys/arch/sparc/dev/magma.c
+++ b/sys/arch/sparc/dev/magma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: magma.c,v 1.20 2008/11/29 01:55:06 ray Exp $ */
+/* $OpenBSD: magma.c,v 1.21 2009/04/10 20:53:51 miod Exp $ */
/*-
* Copyright (c) 1998 Iain Hibbert
@@ -59,19 +59,6 @@
#include <sparc/bppioctl.h>
#include <sparc/dev/magmareg.h>
-/*
- * Select tty soft interrupt bit based on TTY ipl. (stolen from zs.c)
- */
-#if IPL_TTY == 1
-# define IE_MSOFT IE_L1
-#elif IPL_TTY == 4
-# define IE_MSOFT IE_L4
-#elif IPL_TTY == 6
-# define IE_MSOFT IE_L6
-#else
-# error "no suitable software interrupt bit"
-#endif
-
#ifdef MAGMA_DEBUG
#define dprintf(x) printf x
#else
@@ -480,9 +467,7 @@ magma_attach(parent, dev, args)
intr_establish(ra->ra_intr[0].int_pri, &sc->ms_hardint, -1,
dev->dv_xname);
- sc->ms_softint.ih_fun = magma_soft;
- sc->ms_softint.ih_arg = sc;
- intr_establish(IPL_TTY, &sc->ms_softint, IPL_TTY, dev->dv_xname);
+ sc->ms_softint = softintr_establish(IPL_SOFTTTY, magma_soft, sc);
}
/*
@@ -715,14 +700,8 @@ magma_hard(arg)
}
*/
- if (needsoftint) { /* trigger the soft interrupt */
-#if defined(SUN4M)
- if (CPU_ISSUN4M)
- raise(0, IPL_TTY);
- else
-#endif
- ienab_bis(IE_MSOFT);
- }
+ if (needsoftint) /* trigger the soft interrupt */
+ softintr_schedule(sc->ms_softint);
return (serviced);
}
@@ -730,11 +709,9 @@ magma_hard(arg)
/*
* magma soft interrupt handler
*
- * returns 1 if it handled it, 0 otherwise
- *
* runs at spltty()
*/
-int
+void
magma_soft(arg)
void *arg;
{
@@ -742,7 +719,6 @@ magma_soft(arg)
struct mtty_softc *mtty = sc->ms_mtty;
struct mbpp_softc *mbpp = sc->ms_mbpp;
int port;
- int serviced = 0;
int s, flags;
/*
@@ -780,7 +756,6 @@ magma_soft(arg)
mtty->ms_dev.dv_xname, port);
(*linesw[tp->t_line].l_rint)(data, tp);
- serviced = 1;
}
s = splhigh(); /* block out hard interrupt routine */
@@ -795,14 +770,12 @@ magma_soft(arg)
mp->mp_carrier ? "on" : "off"));
(*linesw[tp->t_line].l_modem)(tp,
mp->mp_carrier);
- serviced = 1;
}
if (ISSET(flags, MTTYF_RING_OVERFLOW)) {
log(LOG_WARNING,
"%s%x: ring buffer overflow\n",
mtty->ms_dev.dv_xname, port);
- serviced = 1;
}
if (ISSET(flags, MTTYF_DONE)) {
@@ -811,7 +784,6 @@ magma_soft(arg)
CLR(tp->t_state, TS_BUSY);
/* might be some more */
(*linesw[tp->t_line].l_start)(tp);
- serviced = 1;
}
} /* for (each mtty...) */
}
@@ -833,12 +805,9 @@ magma_soft(arg)
if (ISSET(flags, MBPPF_WAKEUP)) {
wakeup(mp);
- serviced = 1;
}
} /* for (each mbpp...) */
}
-
- return (serviced);
}
/************************************************************************