summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc/include/intr.h
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2009-06-02 21:38:11 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2009-06-02 21:38:11 +0000
commitf70288906283f2a7276a9ce61eff992b7cb8b159 (patch)
treed2d247a2dfdaa434991b7979c084feeb181ce8ff /sys/arch/powerpc/include/intr.h
parent09f980458916221509f840029a090c38d3b759ac (diff)
Reintroduce the macppc interrupt subsystem rewrite. Several bugs have
been found and corrected.
Diffstat (limited to 'sys/arch/powerpc/include/intr.h')
-rw-r--r--sys/arch/powerpc/include/intr.h117
1 files changed, 76 insertions, 41 deletions
diff --git a/sys/arch/powerpc/include/intr.h b/sys/arch/powerpc/include/intr.h
index d2f85d51aaf..fd930ce08e9 100644
--- a/sys/arch/powerpc/include/intr.h
+++ b/sys/arch/powerpc/include/intr.h
@@ -1,8 +1,8 @@
-/* $OpenBSD: intr.h,v 1.39 2009/03/15 19:40:40 miod Exp $ */
+/* $OpenBSD: intr.h,v 1.40 2009/06/02 21:38:10 drahn Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -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,10 +74,22 @@ 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;
+
+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 */
@@ -81,38 +97,32 @@ extern int imask[IPL_NUM];
#define set_sint(p) atomic_setbits_int(&curcpu()->ci_ipending, p)
-#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)
+#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;
@@ -120,11 +130,36 @@ 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 */
+
+#if 0
+#define SI_NQUEUES 4
+
+#define SI_QUEUENAMES { \
+ "generic", \
+ "clock", \
+ "net", \
+ "serial", \
+}
+#endif
+
#define PPC_IPI_NOP 0
#define PPC_IPI_DDB 1