summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-06-11 20:46:51 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-06-11 20:46:51 +0000
commit8afd1e0abdf70e1817d86d751f72f294f5ba1724 (patch)
tree2bde36d3175cc93c4df6aa6282d44fb88a75be6e
parentdcaea01709bb3167aacceeabbd34212bcd555f22 (diff)
Factorize spl handling functions and software interrupt routines between
m68k-based platforms.
-rw-r--r--sys/arch/hp300/include/intr.h40
-rw-r--r--sys/arch/m68k/include/psl.h45
-rw-r--r--sys/arch/mac68k/include/intr.h41
-rw-r--r--sys/arch/mvme68k/dev/cl.c4
-rw-r--r--sys/arch/mvme68k/dev/zs.c4
-rw-r--r--sys/arch/mvme68k/include/intr.h53
-rw-r--r--sys/arch/mvme68k/mvme68k/trap.c4
7 files changed, 70 insertions, 121 deletions
diff --git a/sys/arch/hp300/include/intr.h b/sys/arch/hp300/include/intr.h
index f64d4a4b1a6..e2259669c5c 100644
--- a/sys/arch/hp300/include/intr.h
+++ b/sys/arch/hp300/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.17 2006/03/13 19:39:52 brad Exp $ */
+/* $OpenBSD: intr.h,v 1.18 2006/06/11 20:46:48 miod Exp $ */
/* $NetBSD: intr.h,v 1.2 1997/07/24 05:43:08 scottr Exp $ */
/*-
@@ -55,40 +55,6 @@ struct isr {
};
/*
- * spl functions; all but spl0 are done in-line
- */
-
-#define _spl(s) \
-({ \
- register int _spl_r; \
- \
- __asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
- "=&d" (_spl_r) : "di" (s)); \
- _spl_r; \
-})
-
-#define _splraise(s) \
-({ \
- int _spl_r; \
- \
- __asm __volatile (" \
- clrl d0 ; \
- movw sr,d0 ; \
- movl d0,%0 ; \
- andw #0x700,d0 ; \
- movw %1,d1 ; \
- andw #0x700,d1 ; \
- cmpw d0,d1 ; \
- jle 1f ; \
- movw %1,sr ; \
- 1:" : \
- "=&d" (_spl_r) : \
- "di" (s) : \
- "d0", "d1"); \
- _spl_r; \
-})
-
-/*
* These four globals contain the appropriate PSL_S|PSL_IPL? values
* to raise interupt priority to the requested level.
*/
@@ -140,9 +106,9 @@ extern volatile u_int8_t ssir;
#define SIR_CLOCK 0x02
#define siron(mask) \
- __asm __volatile ( "orb %0,_ssir" : : "i" ((mask)))
+ __asm __volatile ( "orb %1,%0" : "=m" (ssir) : "i" (mask))
#define siroff(mask) \
- __asm __volatile ( "andb %0,_ssir" : : "ir" (~(mask)));
+ __asm __volatile ( "andb %1,%0" : "=m" (ssir) : "ir" (~(mask)))
#define setsoftnet() siron(SIR_NET)
#define setsoftclock() siron(SIR_CLOCK)
diff --git a/sys/arch/m68k/include/psl.h b/sys/arch/m68k/include/psl.h
index 8e0823dfe9d..9fbbe9b3277 100644
--- a/sys/arch/m68k/include/psl.h
+++ b/sys/arch/m68k/include/psl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: psl.h,v 1.4 2003/06/02 23:27:48 millert Exp $ */
+/* $OpenBSD: psl.h,v 1.5 2006/06/11 20:46:50 miod Exp $ */
/* $NetBSD: psl.h,v 1.5 1994/10/26 07:50:50 cgd Exp $ */
/*
@@ -81,10 +81,11 @@
void splassert_fail(int, int, const char *);
extern int splassert_ctl;
void splassert_check(int, const char *);
-#define splassert(__wantipl) do { \
- if (__predict_false(splassert_ctl > 0)) { \
- splassert_check(__wantipl, __func__); \
- } \
+#define splassert(__wantipl) \
+do { \
+ if (__predict_false(splassert_ctl > 0)) { \
+ splassert_check(__wantipl, __func__); \
+ } \
} while (0)
#else
#define splassert(wantipl) do { /* nothing */ } while (0)
@@ -96,6 +97,40 @@ void splassert_check(int, const char *);
#define PSLTOIPL(x) (((x) >> 8) & 0xf)
#define IPLTOPSL(x) ((((x) & 0xf) << 8) | PSL_S)
+/*
+ * spl functions; all but spl0 are done in-line
+ */
+
+#define _spl(s) \
+({ \
+ register int _spl_r; \
+ \
+ __asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
+ "=&d" (_spl_r) : "di" (s)); \
+ _spl_r; \
+})
+
+#define _splraise(s) \
+({ \
+ register int _spl_r; \
+ \
+ __asm __volatile (" \
+ clrl d0 ; \
+ movw sr,d0 ; \
+ movl d0,%0 ; \
+ andw #0x700,d0 ; \
+ movw %1,d1 ; \
+ andw #0x700,d1 ; \
+ cmpw d0,d1 ; \
+ jle 1f ; \
+ movw %1,sr ; \
+ 1:" : \
+ "=&d" (_spl_r) : \
+ "di" (s) : \
+ "d0", "d1"); \
+ _spl_r; \
+})
+
#endif /* _KERNEL */
#endif /* _M68K_PSL_H_ */
diff --git a/sys/arch/mac68k/include/intr.h b/sys/arch/mac68k/include/intr.h
index 2e0cda8d139..0f3f4902e79 100644
--- a/sys/arch/mac68k/include/intr.h
+++ b/sys/arch/mac68k/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.14 2006/03/13 19:39:52 brad Exp $ */
+/* $OpenBSD: intr.h,v 1.15 2006/06/11 20:46:50 miod Exp $ */
/* $NetBSD: intr.h,v 1.9 1998/08/12 06:58:42 scottr Exp $ */
/*
@@ -31,40 +31,9 @@
#ifndef _MAC68K_INTR_H_
#define _MAC68K_INTR_H_
-#ifdef _KERNEL
-/*
- * spl functions; all but spl0 are done in-line
- */
+#include <machine/psl.h>
-#define _spl(s) \
-({ \
- register int _spl_r; \
- \
- __asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
- "=&d" (_spl_r) : "di" (s)); \
- _spl_r; \
-})
-
-#define _splraise(s) \
-({ \
- int _spl_r; \
- \
- __asm __volatile (" \
- clrl d0 ; \
- movw sr,d0 ; \
- movl d0,%0 ; \
- andw #0x700,d0 ; \
- movw %1,d1 ; \
- andw #0x700,d1 ; \
- cmpw d0,d1 ; \
- jle 1f ; \
- movw %1,sr ; \
- 1:" : \
- "=&d" (_spl_r) : \
- "di" (s) : \
- "d0", "d1"); \
- _spl_r; \
-})
+#ifdef _KERNEL
/*
* splnet must block hardware network interrupts
@@ -136,9 +105,9 @@ extern volatile u_int8_t ssir;
#define SIR_ADB 0x08
#define siron(mask) \
- __asm __volatile ( "orb %0,_ssir" : : "i" (mask))
+ __asm __volatile ( "orb %1,%0" : "=m" (ssir) : "i" (mask))
#define siroff(mask) \
- __asm __volatile ( "andb %0,_ssir" : : "ir" (~(mask)));
+ __asm __volatile ( "andb %1,%0" : "=m" (ssir) : "ir" (~(mask)))
#define setsoftnet() siron(SIR_NET)
#define setsoftclock() siron(SIR_CLOCK)
diff --git a/sys/arch/mvme68k/dev/cl.c b/sys/arch/mvme68k/dev/cl.c
index 85a2f6a322b..da5609800c7 100644
--- a/sys/arch/mvme68k/dev/cl.c
+++ b/sys/arch/mvme68k/dev/cl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cl.c,v 1.42 2006/01/01 11:59:39 miod Exp $ */
+/* $OpenBSD: cl.c,v 1.43 2006/06/11 20:46:50 miod Exp $ */
/*
* Copyright (c) 1995 Dale Rahn. All rights reserved.
@@ -128,7 +128,7 @@ struct clsoftc {
char sc_rxintrname[16 + 3];
char sc_txintrname[16 + 3];
int sc_flags;
- int ssir;
+ u_int8_t ssir;
};
const struct {
diff --git a/sys/arch/mvme68k/dev/zs.c b/sys/arch/mvme68k/dev/zs.c
index 23c6cdfcab4..4ec1daa2049 100644
--- a/sys/arch/mvme68k/dev/zs.c
+++ b/sys/arch/mvme68k/dev/zs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zs.c,v 1.24 2006/03/15 20:04:36 miod Exp $ */
+/* $OpenBSD: zs.c,v 1.25 2006/06/11 20:46:50 miod Exp $ */
/*
* Copyright (c) 2000 Steve Murphree, Jr.
@@ -129,7 +129,7 @@ int zsirq(void *);
int zsregs(vaddr_t, int, volatile u_char **, volatile u_char **);
int zspclk(void);
-u_long sir_zs;
+u_int8_t sir_zs;
void zs_softint(void *);
#define zsunit(dev) (minor(dev) >> 1)
diff --git a/sys/arch/mvme68k/include/intr.h b/sys/arch/mvme68k/include/intr.h
index 68324d79560..41c4a74312d 100644
--- a/sys/arch/mvme68k/include/intr.h
+++ b/sys/arch/mvme68k/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.13 2006/03/12 03:28:28 brad Exp $ */
+/* $OpenBSD: intr.h,v 1.14 2006/06/11 20:46:50 miod Exp $ */
/*
* Copyright (C) 2000 Steve Murphree, Jr.
* All rights reserved.
@@ -29,50 +29,28 @@
#ifndef _MVME68K_INTR_H_
#define _MVME68K_INTR_H_
+#include <machine/psl.h>
+
#ifdef _KERNEL
/*
- * simulated software interrupt register
+ * Simulated software interrupt register.
*/
-extern unsigned char ssir;
+extern volatile u_int8_t ssir;
-#define SIR_NET 0x1
-#define SIR_CLOCK 0x2
+#define SIR_NET 0x01
+#define SIR_CLOCK 0x02
-#define setsoftint(x) ssir |= (x)
-#define setsoftnet() ssir |= SIR_NET
-#define setsoftclock() ssir |= SIR_CLOCK
-u_long allocate_sir(void (*proc)(void *), void *arg);
+#define siron(mask) \
+ __asm __volatile ( "orb %1,%0" : "=m" (ssir) : "ir" (mask))
+#define siroff(mask) \
+ __asm __volatile ( "andb %1,%0" : "=m" (ssir) : "ir" (~(mask)))
-#define _spl(s) \
-({ \
- register int _spl_r; \
-\
- __asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
- "=&d" (_spl_r) : "di" (s)); \
- _spl_r; \
-})
+#define setsoftint(s) siron(s)
+#define setsoftnet() siron(SIR_NET)
+#define setsoftclock() siron(SIR_CLOCK)
-#define _splraise(s) \
-({ \
- int _spl_r; \
- \
- __asm __volatile (" \
- clrl d0 ; \
- movw sr,d0 ; \
- movl d0,%0 ; \
- andw #0x700,d0 ; \
- movw %1,d1 ; \
- andw #0x700,d1 ; \
- cmpw d0,d1 ; \
- jle 1f ; \
- movw %1,sr ; \
- 1:" : \
- "=&d" (_spl_r) : \
- "di" (s) : \
- "d0", "d1"); \
- _spl_r; \
-})
+u_int8_t allocate_sir(void (*proc)(void *), void *arg);
/*
* Interrupt "levels". These are a more abstract representation
@@ -108,5 +86,6 @@ u_long allocate_sir(void (*proc)(void *), void *arg);
/* locore.s */
int spl0(void);
+
#endif /* _KERNEL */
#endif /* _MVME68K_INTR_H_ */
diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c
index 2ebeab657b4..84210a63acd 100644
--- a/sys/arch/mvme68k/mvme68k/trap.c
+++ b/sys/arch/mvme68k/mvme68k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.62 2006/01/30 21:26:19 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.63 2006/06/11 20:46:50 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -1128,7 +1128,7 @@ bad:
/*
* Allocation routines for software interrupts.
*/
-u_long
+u_int8_t
allocate_sir(proc, arg)
void (*proc)(void *);
void *arg;