summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-03-25 21:41:42 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-03-25 21:41:42 +0000
commit0d5b57497643d892ab489fc4b8c81662ae6189e4 (patch)
tree7bd143624327a095d4562db928f0c811e8066f9f
parente2b40d73d07e37e0391f3a0d47250b6806505732 (diff)
Deinline softintr_schedule(). Also fix softintr priorities I got inverted after
adding splsoftassert().
-rw-r--r--sys/arch/alpha/alpha/interrupt.c35
-rw-r--r--sys/arch/alpha/include/intr.h41
2 files changed, 37 insertions, 39 deletions
diff --git a/sys/arch/alpha/alpha/interrupt.c b/sys/arch/alpha/alpha/interrupt.c
index 0b03a66bcfa..568aa609610 100644
--- a/sys/arch/alpha/alpha/interrupt.c
+++ b/sys/arch/alpha/alpha/interrupt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interrupt.c,v 1.27 2009/03/15 19:41:33 miod Exp $ */
+/* $OpenBSD: interrupt.c,v 1.28 2009/03/25 21:41:40 miod Exp $ */
/* $NetBSD: interrupt.c,v 1.46 2000/06/03 20:47:36 thorpej Exp $ */
/*-
@@ -521,7 +521,7 @@ softintr_init()
for (i = 0; i < SI_NSOFT; i++) {
asi = &alpha_soft_intrs[i];
TAILQ_INIT(&asi->softintr_q);
- simple_lock_init(&asi->softintr_slock);
+ mtx_init(&asi->softintr_mtx, IPL_HIGH);
asi->softintr_siq = i;
}
@@ -550,8 +550,7 @@ softintr_dispatch()
asi = &alpha_soft_intrs[i];
for (;;) {
- (void) alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH);
- simple_lock(&asi->softintr_slock);
+ mtx_enter(&asi->softintr_mtx);
sih = TAILQ_FIRST(&asi->softintr_q);
if (sih != NULL) {
@@ -560,8 +559,7 @@ softintr_dispatch()
sih->sih_pending = 0;
}
- simple_unlock(&asi->softintr_slock);
- (void) alpha_pal_swpipl(ALPHA_PSL_IPL_SOFT);
+ mtx_leave(&asi->softintr_mtx);
if (sih == NULL)
break;
@@ -633,20 +631,35 @@ softintr_disestablish(void *arg)
{
struct alpha_soft_intrhand *sih = arg;
struct alpha_soft_intr *asi = sih->sih_intrhead;
- int s;
- s = splhigh();
- simple_lock(&asi->softintr_slock);
+ mtx_enter(&asi->softintr_mtx);
if (sih->sih_pending) {
TAILQ_REMOVE(&asi->softintr_q, sih, sih_q);
sih->sih_pending = 0;
}
- simple_unlock(&asi->softintr_slock);
- splx(s);
+ mtx_leave(&asi->softintr_mtx);
free(sih, M_DEVBUF);
}
+/*
+ * Schedule a software interrupt.
+*/
+void
+softintr_schedule(void *arg)
+{
+ struct alpha_soft_intrhand *sih = arg;
+ struct alpha_soft_intr *si = sih->sih_intrhead;
+
+ mtx_enter(&si->softintr_mtx);
+ if (sih->sih_pending == 0) {
+ TAILQ_INSERT_TAIL(&si->softintr_q, sih, sih_q);
+ sih->sih_pending = 1;
+ setsoft(si->softintr_siq);
+ }
+ mtx_leave(&si->softintr_mtx);
+}
+
int
_splraise(int s)
{
diff --git a/sys/arch/alpha/include/intr.h b/sys/arch/alpha/include/intr.h
index ffafa0c3793..ed180370aee 100644
--- a/sys/arch/alpha/include/intr.h
+++ b/sys/arch/alpha/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.32 2009/03/15 19:41:36 miod Exp $ */
+/* $OpenBSD: intr.h,v 1.33 2009/03/25 21:41:41 miod Exp $ */
/* $NetBSD: intr.h,v 1.26 2000/06/03 20:47:41 thorpej Exp $ */
/*-
@@ -63,6 +63,7 @@
#include <sys/evcount.h>
#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/queue.h>
#include <machine/atomic.h>
@@ -119,8 +120,8 @@ struct scbvec {
#define IPL_HIGH ALPHA_PSL_IPL_HIGH
#define IPL_SOFTSERIAL 0 /* serial software interrupts */
-#define IPL_SOFTNET 1 /* network software interrupts */
-#define IPL_SOFTCLOCK 2 /* clock software interrupts */
+#define IPL_SOFTCLOCK 1 /* clock software interrupts */
+#define IPL_SOFTNET 2 /* network software interrupts */
#define IPL_SOFT 3 /* other software interrupts */
#define IST_UNUSABLE -1 /* interrupt cannot be used */
@@ -129,10 +130,10 @@ struct scbvec {
#define IST_EDGE 2 /* edge-triggered */
#define IST_LEVEL 3 /* level-triggered */
-#define SI_SOFTSERIAL 0
-#define SI_SOFTNET 1
-#define SI_SOFTCLOCK 2
-#define SI_SOFT 3
+#define SI_SOFT 0
+#define SI_SOFTCLOCK 1
+#define SI_SOFTNET 2
+#define SI_SOFTSERIAL 3
#define SI_NSOFT 4
#ifdef _KERNEL
@@ -253,31 +254,15 @@ struct alpha_soft_intrhand {
struct alpha_soft_intr {
TAILQ_HEAD(, alpha_soft_intrhand)
softintr_q;
- struct simplelock softintr_slock;
+ struct mutex softintr_mtx;
unsigned long softintr_siq;
};
+void softintr_disestablish(void *);
+void softintr_dispatch(void);
void *softintr_establish(int, void (*)(void *), void *);
-void softintr_disestablish(void *);
-void softintr_init(void);
-void softintr_dispatch(void);
-
-#define softintr_schedule(arg) \
-do { \
- struct alpha_soft_intrhand *__sih = (arg); \
- struct alpha_soft_intr *__si = __sih->sih_intrhead; \
- int __s; \
- \
- __s = splhigh(); \
- simple_lock(&__si->softintr_slock); \
- if (__sih->sih_pending == 0) { \
- TAILQ_INSERT_TAIL(&__si->softintr_q, __sih, sih_q); \
- __sih->sih_pending = 1; \
- setsoft(__si->softintr_siq); \
- } \
- simple_unlock(&__si->softintr_slock); \
- splx(__s); \
-} while (0)
+void softintr_init(void);
+void softintr_schedule(void *);
/* XXX For legacy software interrupts. */
extern struct alpha_soft_intrhand *softnet_intrhand;