summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-01-08 14:29:47 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-01-08 14:29:47 +0000
commit0bc8c020030981830c91cc6726cdc6e5a2a3fc58 (patch)
tree4d9c44b53be6ceb3fbec232238b0bab12948c7be /sys/arch/mvme88k
parentcf978fce6b3a544c2de7476b9f65f7e0352d4a72 (diff)
Some splfoo() have raise-if-lower semantics; so introduce raiseipl() which
never lowers current spl value, and use it where appropriate.
Diffstat (limited to 'sys/arch/mvme88k')
-rw-r--r--sys/arch/mvme88k/include/intr.h22
-rw-r--r--sys/arch/mvme88k/mvme88k/locore_c_routines.c49
2 files changed, 54 insertions, 17 deletions
diff --git a/sys/arch/mvme88k/include/intr.h b/sys/arch/mvme88k/include/intr.h
index 197d25aa8f4..94b1b7484d3 100644
--- a/sys/arch/mvme88k/include/intr.h
+++ b/sys/arch/mvme88k/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.13 2003/10/11 22:08:57 miod Exp $ */
+/* $OpenBSD: intr.h,v 1.14 2004/01/08 14:29:45 miod Exp $ */
/*
* Copyright (C) 2000 Steve Murphree, Jr.
* All rights reserved.
@@ -83,6 +83,7 @@ extern int intrcnt[M88K_NIRQ];
#ifdef _KERNEL
#ifndef _LOCORE
unsigned setipl(unsigned level);
+unsigned raiseipl(unsigned level);
int spl0(void);
/* needs major cleanup - XXX nivas */
@@ -107,11 +108,6 @@ void splassert_check(int, const char *);
#endif /* _LOCORE */
-#if 0
-spl0 is a function by itself. I really am serious about the clean up
-above...
-#define spl0() spln(0)
-#endif /* 0 */
#define spl1() setipl(1)
#define spl2() setipl(2)
#define spl3() setipl(3)
@@ -124,13 +120,13 @@ above...
#define spllowersoftclock() setipl(IPL_SOFTCLOCK)
#define splsoftclock() setipl(IPL_SOFTCLOCK)
#define splsoftnet() setipl(IPL_SOFTNET)
-#define splbio() setipl(IPL_BIO)
-#define splnet() setipl(IPL_NET)
-#define spltty() setipl(IPL_TTY)
-#define splclock() setipl(IPL_CLOCK)
-#define splstatclock() setipl(IPL_STATCLOCK)
-#define splimp() setipl(IPL_IMP)
-#define splvm() setipl(IPL_VM)
+#define splbio() raiseipl(IPL_BIO)
+#define splnet() raiseipl(IPL_NET)
+#define spltty() raiseipl(IPL_TTY)
+#define splclock() raiseipl(IPL_CLOCK)
+#define splstatclock() raiseipl(IPL_STATCLOCK)
+#define splimp() raiseipl(IPL_IMP)
+#define splvm() raiseipl(IPL_VM)
#define splhigh() setipl(IPL_HIGH)
#define splx(x) ((x) ? setipl((x)) : spl0())
diff --git a/sys/arch/mvme88k/mvme88k/locore_c_routines.c b/sys/arch/mvme88k/mvme88k/locore_c_routines.c
index 79e15d5d706..2cd4d3040ba 100644
--- a/sys/arch/mvme88k/mvme88k/locore_c_routines.c
+++ b/sys/arch/mvme88k/mvme88k/locore_c_routines.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore_c_routines.c,v 1.38 2004/01/05 20:07:03 miod Exp $ */
+/* $OpenBSD: locore_c_routines.c,v 1.39 2004/01/08 14:29:46 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -473,11 +473,9 @@ setipl(unsigned level)
unsigned curspl;
m88k_psr_type psr; /* processor status register */
-#ifdef DIAGNOSTIC
- if (level > 7) {
#ifdef DEBUG
+ if (level > 7) {
printf("setipl: invoked with invalid level %x\n", level);
-#endif
level &= 0x07; /* and pray it will work */
}
#endif
@@ -510,6 +508,49 @@ setipl(unsigned level)
return curspl;
}
+unsigned
+raiseipl(unsigned level)
+{
+ unsigned curspl;
+ m88k_psr_type psr; /* processor status register */
+
+#ifdef DEBUG
+ if (level > 7) {
+ printf("raiseipl: invoked with invalid level %x\n", level);
+ level &= 0x07; /* and pray it will work */
+ }
+#endif
+
+ psr = disable_interrupts_return_psr();
+ switch (brdtyp) {
+#ifdef MVME188
+ case BRD_188:
+ curspl = m188_curspl[cpu_number()];
+ if (curspl < level)
+ setlevel(level);
+ break;
+#endif /* MVME188 */
+#if defined(MVME187) || defined(MVME197)
+ case BRD_187:
+ case BRD_8120:
+ case BRD_197:
+ curspl = *md.intr_mask & 0x07;
+ if (curspl < level)
+ *md.intr_mask = level;
+ break;
+#endif /* defined(MVME187) || defined(MVME197) */
+ }
+
+ flush_pipeline();
+
+ /* The flush pipeline is required to make sure the above write gets
+ * through the data pipe and to the hardware; otherwise, the next
+ * bunch of instructions could execute at the wrong spl protection
+ */
+ set_psr(psr);
+ return curspl;
+}
+
/* XXX Utterly bogus */
#if NCPUS > 1
#include <sys/simplelock.h>