summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc/include
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2009-10-01 20:19:20 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2009-10-01 20:19:20 +0000
commit2f170aacf72c46c917cdfe67ac32e89d65edf81d (patch)
tree1dc5956ddab9243ed357fece1a6b970c972f9953 /sys/arch/powerpc/include
parent6c8d318a056e70f92a487ab483553d455ad77e55 (diff)
Generic soft interrupts for macppc. Tested by mk@, deraadt@
ok miod@
Diffstat (limited to 'sys/arch/powerpc/include')
-rw-r--r--sys/arch/powerpc/include/_types.h3
-rw-r--r--sys/arch/powerpc/include/intr.h68
2 files changed, 52 insertions, 19 deletions
diff --git a/sys/arch/powerpc/include/_types.h b/sys/arch/powerpc/include/_types.h
index 9d3a51f6e95..9cf552e0b4f 100644
--- a/sys/arch/powerpc/include/_types.h
+++ b/sys/arch/powerpc/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.8 2008/07/21 20:50:55 martynas Exp $ */
+/* $OpenBSD: _types.h,v 1.9 2009/10/01 20:19:19 kettenis Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -118,6 +118,7 @@ typedef void * __wctrans_t;
typedef void * __wctype_t;
/* Feature test macros */
+#define __HAVE_GENERIC_SOFT_INTERRUPTS
#define __HAVE_TIMECOUNTER
#endif /* _POWERPC__TYPES_H_ */
diff --git a/sys/arch/powerpc/include/intr.h b/sys/arch/powerpc/include/intr.h
index 455cebf38dd..937c3f5f26e 100644
--- a/sys/arch/powerpc/include/intr.h
+++ b/sys/arch/powerpc/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.42 2009/08/22 02:54:50 mk Exp $ */
+/* $OpenBSD: intr.h,v 1.43 2009/10/01 20:19:19 kettenis Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA.
@@ -59,13 +59,6 @@
#define PPC_CLK_IRQ 64
#define PPC_STAT_IRQ 65
-void setsoftclock(void);
-void clearsoftclock(void);
-int splsoftclock(void);
-void setsoftnet(void);
-void clearsoftnet(void);
-int splsoftnet(void);
-
int splraise(int);
int spllower(int);
void splx(int);
@@ -79,13 +72,56 @@ extern int imask[IPL_NUM];
#define splassert(wantipl) /* nothing */
#define splsoftassert(wantipl) /* nothing */
-#define set_sint(p) atomic_setbits_int(&curcpu()->ci_ipending, p)
+#define SINTBIT(q) (31 - (q))
+#define SINTMASK(q) (1 << SINTBIT(q))
+
+#define SPL_CLOCKMASK SINTMASK(SI_NQUEUES)
+
+/* Soft interrupt masks. */
+
+#define IPL_SOFTCLOCK 0
+#define IPL_SOFTNET 1
+#define IPL_SOFTTTY 2
-#define SINT_CLOCK 0x10000000
-#define SINT_NET 0x20000000
-#define SINT_TTY 0x40000000
-#define SPL_CLOCK 0x80000000
-#define SINT_MASK (SINT_CLOCK|SINT_NET|SINT_TTY)
+#define SI_SOFTCLOCK 0 /* for IPL_SOFTCLOCK */
+#define SI_SOFTNET 1 /* for IPL_SOFTNET */
+#define SI_SOFTTTY 2 /* for IPL_SOFTTY */
+
+#define SINT_ALLMASK (SINTMASK(SI_SOFTCLOCK) | \
+ SINTMASK(SI_SOFTNET) | SINTMASK(SI_SOFTTTY))
+#define SI_NQUEUES 3
+
+#include <machine/mutex.h>
+#include <sys/queue.h>
+
+struct soft_intrhand {
+ TAILQ_ENTRY(soft_intrhand) sih_list;
+ void (*sih_func)(void *);
+ void *sih_arg;
+ struct soft_intrq *sih_siq;
+ int sih_pending;
+};
+
+struct soft_intrq {
+ TAILQ_HEAD(, soft_intrhand) siq_list;
+ int siq_si;
+ struct mutex siq_mtx;
+};
+
+void softintr_disestablish(void *);
+void softintr_dispatch(int);
+void *softintr_establish(int, void (*)(void *), void *);
+void softintr_init(void);
+void softintr_schedule(void *);
+
+/* XXX For legacy software interrupts. */
+extern struct soft_intrhand *softnet_intrhand;
+
+#define setsoftnet() softintr_schedule(softnet_intrhand)
+
+#define SINT_CLOCK SINTMASK(SI_SOFTCLOCK)
+#define SINT_NET SINTMASK(SI_SOFTNET)
+#define SINT_TTY SINTMASK(SI_SOFTTTY)
#define splbio() splraise(imask[IPL_BIO])
#define splnet() splraise(imask[IPL_NET])
@@ -100,10 +136,6 @@ extern int imask[IPL_NUM];
#define splsoftnet() splraise(SINT_NET|SINT_CLOCK)
#define splsofttty() splraise(SINT_TTY|SINT_NET|SINT_CLOCK)
-#define setsoftclock() set_sint(SINT_CLOCK);
-#define setsoftnet() set_sint(SINT_NET);
-#define setsofttty() set_sint(SINT_TTY);
-
#define splhigh() splraise(0xffffffff)
#define spl0() spllower(0)