summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMartin Reindl <martin@cvs.openbsd.org>2004-12-02 22:00:32 +0000
committerMartin Reindl <martin@cvs.openbsd.org>2004-12-02 22:00:32 +0000
commit456c0edf834b3ad1c6fe2c152932c6f2972f631b (patch)
tree93dd3d503f92b3f8d201c2395fc29af5cb59a306 /sys/arch
parent3abfb88126ee6cfd3c7e729a8bd70c476e4091bb (diff)
move IPL setup to intr.c
ok miod@ >From: NetBSD
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/mac68k/include/intr.h18
-rw-r--r--sys/arch/mac68k/mac68k/intr.c62
-rw-r--r--sys/arch/mac68k/mac68k/machdep.c22
3 files changed, 74 insertions, 28 deletions
diff --git a/sys/arch/mac68k/include/intr.h b/sys/arch/mac68k/include/intr.h
index e043d428349..d17def7d0bb 100644
--- a/sys/arch/mac68k/include/intr.h
+++ b/sys/arch/mac68k/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.10 2004/11/26 21:21:27 miod Exp $ */
+/* $OpenBSD: intr.h,v 1.11 2004/12/02 22:00:31 martin Exp $ */
/* $NetBSD: intr.h,v 1.9 1998/08/12 06:58:42 scottr Exp $ */
/*
@@ -84,12 +84,13 @@
* splnet must block hardware network interrupts
* splimp must be > spltty
*/
-extern unsigned short mac68k_ttyipl;
-extern unsigned short mac68k_bioipl;
-extern unsigned short mac68k_netipl;
-extern unsigned short mac68k_impipl;
-extern unsigned short mac68k_clockipl;
-extern unsigned short mac68k_statclockipl;
+extern u_short mac68k_ttyipl;
+extern u_short mac68k_bioipl;
+extern u_short mac68k_netipl;
+extern u_short mac68k_impipl;
+extern u_short mac68k_audioipl;
+extern u_short mac68k_clockipl;
+extern u_short mac68k_statclockipl;
/*
* Interrupt "levels". These are a more abstract representation
@@ -118,7 +119,6 @@ extern unsigned short mac68k_statclockipl;
* everything at spl2, and everything but the panic switch and
* power at spl4.
*/
-#define spllowersoftclock() splsoft()
#define splsoftclock() splsoft()
#define splsoftnet() splsoft()
#define spltty() _splraise(mac68k_ttyipl)
@@ -126,6 +126,7 @@ extern unsigned short mac68k_statclockipl;
#define splnet() _splraise(mac68k_netipl)
#define splimp() _splraise(mac68k_impipl)
#define splvm() _splraise(mac68k_impipl)
+#define splaudio() _splraise(mac68k_audioipl)
#define splclock() _splraise(mac68k_clockipl)
#define splstatclock() _splraise(mac68k_statclockipl)
#define splserial() spl4()
@@ -157,6 +158,7 @@ extern volatile u_int8_t ssir;
#define setsoftadb() siron(SIR_ADB)
/* intr.c */
+void intr_init(void);
void intr_establish(int (*)(void *), void *, int, const char *);
void intr_disestablish(int);
void intr_dispatch(int);
diff --git a/sys/arch/mac68k/mac68k/intr.c b/sys/arch/mac68k/mac68k/intr.c
index 028a7b82b16..247b905f5ac 100644
--- a/sys/arch/mac68k/mac68k/intr.c
+++ b/sys/arch/mac68k/mac68k/intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.2 2004/11/26 21:21:28 miod Exp $ */
+/* $OpenBSD: intr.c,v 1.3 2004/12/02 22:00:31 martin Exp $ */
/* $NetBSD: intr.c,v 1.2 1998/08/25 04:03:56 scottr Exp $ */
/*-
@@ -64,9 +64,67 @@ void netintr(void);
int intr_debug = 0;
#endif
-struct intrhand intrs[NISR];
+/*
+ * Some of the below are not used yet, but might be used someday on the
+ * Q700/900/950 where the interrupt controller may be reprogrammed to
+ * interrupt on different levels as listed in locore.s
+ */
+u_short mac68k_ttyipl;
+u_short mac68k_bioipl;
+u_short mac68k_netipl;
+u_short mac68k_impipl;
+u_short mac68k_clockipl;
+u_short mac68k_statclockipl;
+
+struct intrhand intrs[NISR];
extern int intrcnt[]; /* from locore.s */
+void intr_computeipl(void);
+
+void
+intr_init()
+{
+ /* Standard spl(9) interrupt priorities */
+ mac68k_ttyipl = (PSL_S | PSL_IPL1);
+ mac68k_bioipl = (PSL_S | PSL_IPL2);
+ mac68k_netipl = (PSL_S | PSL_IPL2);
+ mac68k_impipl = (PSL_S | PSL_IPL2);
+ mac68k_clockipl = (PSL_S | PSL_IPL2);
+ mac68k_statclockipl = (PSL_S | PSL_IPL2);
+
+ if (current_mac_model->class == MACH_CLASSAV)
+ mac68k_bioipl = mac68k_netipl = (PSL_S | PSL_IPL4);
+
+ intr_computeipl();
+}
+
+/*
+ * Compute the interrupt levels for the spl*()
+ * calls. This doesn't have to be fast.
+ */
+void
+intr_computeipl()
+{
+ /*
+ * Enforce `bio <= net <= tty <= imp <= statclock <= clock'
+ * as defined in spl(9)
+ */
+ if (mac68k_bioipl > mac68k_netipl)
+ mac68k_netipl = mac68k_bioipl;
+
+ if (mac68k_netipl > mac68k_ttyipl)
+ mac68k_ttyipl = mac68k_netipl;
+
+ if (mac68k_ttyipl > mac68k_impipl)
+ mac68k_impipl = mac68k_ttyipl;
+
+ if (mac68k_impipl > mac68k_statclockipl)
+ mac68k_statclockipl = mac68k_impipl;
+
+ if (mac68k_statclockipl > mac68k_clockipl)
+ mac68k_clockipl = mac68k_statclockipl;
+}
+
/*
* Establish an autovectored interrupt handler.
* Called by driver attach functions.
diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c
index a4956902d9d..267a69ecaa1 100644
--- a/sys/arch/mac68k/mac68k/machdep.c
+++ b/sys/arch/mac68k/mac68k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.114 2004/12/02 19:37:25 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.115 2004/12/02 22:00:31 martin Exp $ */
/* $NetBSD: machdep.c,v 1.207 1998/07/08 04:39:34 thorpej Exp $ */
/*
@@ -201,19 +201,6 @@ int physmem = MAXMEM; /* max supported memory, changes to actual */
int safepri = PSL_LOWIPL;
/*
- * Some of the below are not used yet, but might be used someday on the
- * Q700/900/950 where the interrupt controller may be reprogrammed to
- * interrupt on different levels as listed in locore.s
- */
-unsigned short mac68k_ttyipl = PSL_S | PSL_IPL2;
-unsigned short mac68k_bioipl = PSL_S | PSL_IPL2;
-unsigned short mac68k_netipl = PSL_S | PSL_IPL2;
-unsigned short mac68k_impipl = PSL_S | PSL_IPL2;
-unsigned short mac68k_clockipl = PSL_S | PSL_IPL2;
-unsigned short mac68k_statclockipl = PSL_S | PSL_IPL2;
-
-
-/*
* Extent maps to manage all memory space, including I/O ranges. Allocate
* storage for 8 regions in each, initially. Later, iomem_malloc_safe
* will indicate that it's safe to use malloc() to dynamically allocate
@@ -289,6 +276,9 @@ mac68k_init()
(caddr_t)iomem_ex_storage, sizeof(iomem_ex_storage),
EX_NOCOALESCE|EX_NOWAIT);
+ /* Initialize the interrupt handlers. */
+ intr_init();
+
/* Initialize the VIAs */
via_init();
@@ -2485,10 +2475,6 @@ mac68k_set_io_offsets(base)
sccA = (volatile u_char *)base + 0x4000;
SCSIBase = base + 0x18000;
PSCBase = (volatile u_char *)base + 0x31000;
- mac68k_bioipl = PSL_S | PSL_IPL4;
- mac68k_netipl = PSL_S | PSL_IPL4;
- mac68k_impipl = PSL_S | PSL_IPL4;
- mac68k_statclockipl = PSL_S | PSL_IPL4;
break;
case MACH_CLASSII:
case MACH_CLASSPB: