Subject: Re: splraiseipl()
To: None <tech-kern@netbsd.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 01/15/2006 20:58:05
--NextPart-20060115205549-0198600
Content-Type: Text/Plain; charset=us-ascii
- patch attached to this mail. please review.
sun2, sun3
YAMAMOTO Takashi
--NextPart-20060115205549-0198600
Content-Type: Text/Plain; charset=us-ascii
Content-Disposition: attachment; filename="sun.ipl.diff"
Index: sun3/include/intr.h
===================================================================
--- sun3/include/intr.h (revision 1481)
+++ sun3/include/intr.h (working copy)
@@ -41,21 +41,23 @@
#include <machine/psl.h>
-/*
- * These are identical to the values used by hp300, but are not meaningful
- * to sun3 code at this time.
- */
-#define IPL_NONE 0 /* disable only this interrupt */
-#define IPL_BIO 1 /* disable block I/O interrupts */
-#define IPL_NET 2 /* disable network interrupts */
-#define IPL_TTY 3 /* disable terminal interrupts */
-#define IPL_TTYNOBUF 4 /* IPL_TTY + higher ISR priority */
-#define IPL_SERIAL 4 /* disable serial interrupts */
-#define IPL_CLOCK 5 /* disable clock interrupts */
-#define IPL_HIGH 6 /* disable all interrupts */
-
#if defined(_KERNEL) && !defined(_LOCORE)
+#define IPL_NONE 0
+#define IPL_SOFTCLOCK (PSL_S|PSL_IPL1)
+#define IPL_SOFTNET (PSL_S|PSL_IPL1)
+#define IPL_BIO (PSL_S|PSL_IPL2)
+#define IPL_NET (PSL_S|PSL_IPL3)
+#define IPL_TTY (PSL_S|PSL_IPL4)
+#define IPL_VM (PSL_S|PSL_IPL4)
+/* Intersil clock hardware interrupts (hard-wired at 5) */
+#define IPL_CLOCK (PSL_S|PSL_IPL5)
+#define IPL_STATCLOCK IPL_CLOCK
+#define IPL_SCHED (PSL_S|PSL_IPL7)
+#define IPL_HIGH (PSL_S|PSL_IPL7)
+#define IPL_LOCK (PSL_S|PSL_IPL7)
+#define IPL_SERIAL (PSL_S|PSL_IPL4)
+
/*
* Define inline functions for PSL manipulation.
* These are as close to macros as one can get.
@@ -89,29 +91,10 @@ _getsr(void)
/* IPL used by soft interrupts: netintr(), softclock() */
#define spllowersoftclock() spl1()
-#define splsoftclock() splraise1()
-#define splsoftnet() splraise1()
-/* Highest block device (strategy) IPL. */
-#define splbio() splraise2()
+#define splraiseipl(x) _splraise(x)
-/* Highest network interface IPL. */
-#define splnet() splraise3()
-
-/* Highest tty device IPL. */
-#define spltty() splraise4()
-
-/* Highest network, tty, or disk IPL. */
-#define splvm() _splraise(PSL_S|PSL_IPL4)
-
-/* Intersil clock hardware interrupts (hard-wired at 5) */
-#define splclock() splraise5()
-#define splstatclock() splclock()
-
-/* Block out all interrupts (except NMI of course). */
-#define splhigh() spl7()
-#define splsched() spl7()
-#define spllock() spl7()
+#include <sys/spl.h>
#endif /* KERNEL && !_LOCORE */
#endif /* _SUN3_INTR_H_ */
Index: sun68k/include/intr.h
===================================================================
--- sun68k/include/intr.h (revision 1481)
+++ sun68k/include/intr.h (working copy)
@@ -46,14 +46,23 @@
#define _IPL_SOFT_LEVEL3 3
#define _IPL_SOFT_LEVEL_MIN 1
#define _IPL_SOFT_LEVEL_MAX 3
-#define IPL_SOFTNET _IPL_SOFT_LEVEL1
-#define IPL_SOFTCLOCK _IPL_SOFT_LEVEL1
-#define IPL_SOFTSERIAL _IPL_SOFT_LEVEL3
-#define IPL_BIO 2
-#define IPL_NET 3
-#define IPL_CLOCK 5
-#define IPL_SERIAL 6
+#define IPL_NONE 0
+#define IPL_SOFTCLOCK (PSL_S|PSL_IPL1)
+#define IPL_SOFTNET (PSL_S|PSL_IPL1)
+#define IPL_BIO (PSL_S|PSL_IPL2)
+#define IPL_NET (PSL_S|PSL_IPL3)
+#define IPL_SOFTSERIAL (PSL_S|PSL_IPL3)
+#define IPL_TTY (PSL_S|PSL_IPL4)
+#define IPL_VM (PSL_S|PSL_IPL4)
+/* Intersil or Am9513 clock hardware interrupts (hard-wired at 5) */
+#define IPL_CLOCK (PSL_S|PSL_IPL5)
+#define IPL_STATCLOCK IPL_CLOCK
+#define IPL_SCHED (PSL_S|PSL_IPL7)
+#define IPL_HIGH (PSL_S|PSL_IPL7)
+#define IPL_LOCK (PSL_S|PSL_IPL7)
+#define IPL_SERIAL (PSL_S|PSL_IPL6)
+
#ifdef _KERNEL
LIST_HEAD(sh_head, softintr_handler);
@@ -123,41 +132,16 @@ _getsr(void)
/* IPL used by soft interrupts: netintr(), softclock() */
#define spllowersoftclock() spl1()
-#define splsoftclock() splraise1()
-#define splsoftnet() splraise1()
-/* Highest block device (strategy) IPL. */
-#define splbio() splraise2()
-
-/* Highest network interface IPL. */
-#define splnet() splraise3()
-
-/* Highest tty device IPL. */
-#define spltty() splraise4()
-
-/*
- * Requirement: imp >= (highest network, tty, or disk IPL)
- * This is used mostly in the VM code.
- * Note that the VM code runs at spl7 during kernel
- * initialization, and later at spl0, so we have to
- * use splraise to avoid enabling interrupts early.
- */
-#define splvm() _splraise(PSL_S|PSL_IPL4)
-
-/* Intersil or Am9513 clock hardware interrupts (hard-wired at 5) */
-#define splclock() splraise5()
-#define splstatclock() splclock()
-
/* Zilog Serial hardware interrupts (hard-wired at 6) */
#define splzs() spl6()
-/* Block out all interrupts (except NMI of course). */
-#define splhigh() spl7()
-#define splsched() spl7()
-#define spllock() spl7()
-
/* This returns true iff the spl given is spl0. */
#define is_spl0(s) (((s) & PSL_IPL7) == 0)
+
+#define splraiseipl(x) _splraise(x)
+
+#include <sys/spl.h>
#endif /* _KERNEL */
Index: sun68k/sun68k/isr.c
===================================================================
--- sun68k/sun68k/isr.c (revision 1464)
+++ sun68k/sun68k/isr.c (working copy)
@@ -306,6 +306,7 @@ softintr_establish(int ipl, void (*func)
struct softintr_handler *sh;
struct softintr_head *shd;
+ ipl &= ~PSL_S;
if (ipl < _IPL_SOFT_LEVEL_MIN || ipl > _IPL_SOFT_LEVEL_MAX)
panic("softintr_establish: unsupported soft IPL");
--NextPart-20060115205549-0198600--