summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc/include
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/powerpc/include')
-rw-r--r--sys/arch/powerpc/include/intr.h123
1 files changed, 88 insertions, 35 deletions
diff --git a/sys/arch/powerpc/include/intr.h b/sys/arch/powerpc/include/intr.h
index f05d41e7189..aeacf7eac6d 100644
--- a/sys/arch/powerpc/include/intr.h
+++ b/sys/arch/powerpc/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.35 2008/09/16 04:20:42 drahn Exp $ */
+/* $OpenBSD: intr.h,v 1.36 2008/09/18 03:56:25 drahn Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA.
@@ -36,14 +36,18 @@
#define _POWERPC_INTR_H_
#define IPL_NONE 0
-#define IPL_BIO 1
+#define IPL_SOFT 1
+#define IPL_SOFTCLOCK 2
+#define IPL_SOFTNET 3
+#define IPL_SOFTTTY 4
+#define IPL_BIO 5
#define IPL_AUDIO IPL_BIO /* XXX - was defined this val in audio_if.h */
-#define IPL_NET 2
-#define IPL_TTY 3
-#define IPL_VM 4
-#define IPL_CLOCK 5
-#define IPL_HIGH 6
-#define IPL_NUM 7
+#define IPL_NET 6
+#define IPL_TTY 7
+#define IPL_VM 8
+#define IPL_CLOCK 9
+#define IPL_HIGH 10
+#define IPL_NUM 11
#define IST_NONE 0
#define IST_PULSE 1
@@ -55,9 +59,9 @@
#include <sys/evcount.h>
#include <machine/atomic.h>
-#define PPC_NIRQ 66
-#define PPC_CLK_IRQ 64
-#define PPC_STAT_IRQ 65
+#define PPC_NIRQ 66
+#define PPC_CLK_IRQ 64
+#define PPC_STAT_IRQ 65
void setsoftclock(void);
void clearsoftclock(void);
@@ -70,48 +74,69 @@ int splraise(int);
int spllower(int);
void splx(int);
+typedef int (ppc_splraise_t) (int);
+typedef int (ppc_spllower_t) (int);
+typedef void (ppc_splx_t) (int);
-void do_pending_int(void);
+extern struct ppc_intr_func {
+ ppc_splraise_t *raise;
+ ppc_spllower_t *lower;
+ ppc_splx_t *x;
+}ppc_intr_func;
+
+#if 0
+/* does it make sense to call directly ?? */
+#define splraise(x) ppc_intr.raise(x)
+#define spllower(x) ppc_intr.lower(x)
+#define splx(x) ppc_intr.x(x)
+#endif
+
+extern int ppc_smask[IPL_NUM];
-extern int imask[IPL_NUM];
+void ppc_smask_init(void);
+char *ppc_intr_typename(int type);
+
+void do_pending_int(void);
/* SPL asserts */
#define splassert(wantipl) /* nothing */
#define set_sint(p) atomic_setbits_int(&curcpu()->ci_ipending, p)
+#if 0
#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 splbio() splraise(imask[IPL_BIO])
-#define splnet() splraise(imask[IPL_NET])
-#define spltty() splraise(imask[IPL_TTY])
-#define splaudio() splraise(imask[IPL_AUDIO])
-#define splclock() splraise(imask[IPL_CLOCK])
-#define splvm() splraise(imask[IPL_VM])
-#define splsched() splhigh()
-#define spllock() splhigh()
-#define splstatclock() splhigh()
-#define splsoftclock() splraise(SINT_CLOCK)
-#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)
+#endif
+
+#define splbio() splraise(IPL_BIO)
+#define splnet() splraise(IPL_NET)
+#define spltty() splraise(IPL_TTY)
+#define splaudio() splraise(IPL_AUDIO)
+#define splclock() splraise(IPL_CLOCK)
+#define splvm() splraise(IPL_VM)
+#define splsched() splhigh()
+#define spllock() splhigh()
+#define splstatclock() splhigh()
+#define splsoftclock() splraise(IPL_SOFTCLOCK)
+#define splsoftnet() splraise(IPL_SOFTNET)
+#define splsofttty() splraise(IPL_SOFTTTY)
+
+#define setsoftclock() set_sint(SI_TO_IRQBIT(SI_SOFTCLOCK))
+#define setsoftnet() set_sint(SI_TO_IRQBIT(SI_SOFTNET))
+#define setsofttty() set_sint(SI_TO_IRQBIT(SI_SOFTTTY))
+
+#define splhigh() splraise(IPL_HIGH)
+#define spl0() spllower(IPL_NONE)
/*
* Interrupt control struct used to control the ICU setup.
*/
struct intrhand {
- struct intrhand *ih_next;
+ TAILQ_ENTRY(intrhand) ih_list;
int (*ih_fun)(void *);
void *ih_arg;
struct evcount ih_count;
@@ -119,11 +144,39 @@ struct intrhand {
int ih_irq;
char *ih_what;
};
+
+struct intrq {
+ TAILQ_HEAD(, intrhand) iq_list; /* handler list */
+ int iq_ipl; /* IPL_ to mask while handling */
+ int iq_ist; /* share type */
+};
+
extern int ppc_configed_intr_cnt;
-#define MAX_PRECONF_INTR 16
+#define MAX_PRECONF_INTR 16
extern struct intrhand ppc_configed_intr[MAX_PRECONF_INTR];
void softnet(int isr);
+#define SI_TO_IRQBIT(x) (1 << (x))
+
+#define SI_SOFT 0 /* for IPL_SOFT */
+#define SI_SOFTCLOCK 1 /* for IPL_SOFTCLOCK */
+#define SI_SOFTNET 2 /* for IPL_SOFTNET */
+#define SI_SOFTTTY 3 /* for IPL_SOFTSERIAL */
+
+#define SI_NQUEUES 4
+
+#define SI_QUEUENAMES { \
+ "generic", \
+ "clock", \
+ "net", \
+ "serial", \
+}
+
+#define PPC_IPI_NOP 0
+#define PPC_IPI_DDB 1
+
+void ppc_send_ipi(struct cpu_info *, int);
+
#define PPC_IPI_NOP 0
#define PPC_IPI_DDB 1