Subject: Re: splraiseipl()
To: None <tech-kern@netbsd.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 11/06/2005 00:38:55
--NextPart-20051105232646-0506700
Content-Type: Text/Plain; charset=us-ascii

> splraiseipl() is an MD/MI interface found in newlock branch.

here's the current implementation status:

- done
	alpha, amd64, i386, xen

- patch attached to this mail  (please review and/or test)
	evbppc, evbmips, evbsh3, hp700, mac68k, vax, x68k

- newlock branch has code
	sparc, sparc64

- notyet  (any volunteers?)
	others


> basically splraiseipl(IPL_BIO) == splbio().

some more notes about the API:

- <machine/param.h> (thus <sys/param.h>) should provide splraiseipl().

- it should provide the following constants as well.

	IPL_NONE	
	IPL_BIO		
	IPL_NET		
	IPL_TTY		
	IPL_VM		
	IPL_CLOCK	
	IPL_STATCLOCK	
	IPL_SCHED	
	IPL_HIGH	
	IPL_LOCK	

- it should provide the following constants as well if and only if
  corresponding splxxx() functions are available.

	IPL_SOFTCLOCK
	IPL_SOFTNET
	IPL_SOFTSERIAL
	IPL_LPT
	IPL_AUDIO
	IPL_SERIAL
	IPL_IPI

- IPL_NONE is a special IPL to indicate "not to raise IPL."
  the following should be safe.

	s = splraiseipl(IPL_NONE); splx(s);

YAMAMOTO Takashi

--NextPart-20051105232646-0506700
Content-Type: Text/Plain; charset=us-ascii
Content-Disposition: attachment; filename="a.diff"

Index: arch/evbmips/include/intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/evbmips/include/intr.h,v
retrieving revision 1.5
diff -u -p -r1.5 intr.h
--- arch/evbmips/include/intr.h	25 May 2003 14:08:20 -0000	1.5
+++ arch/evbmips/include/intr.h	5 Nov 2005 15:35:41 -0000
@@ -53,9 +53,14 @@
 #define	IPL_BIO		5	/* disable block I/O interrupts */
 #define	IPL_NET		6	/* disable network interrupts */
 #define	IPL_TTY		7	/* disable terminal interrupts */
+#define	IPL_LPT		IPL_TTY
+#define	IPL_VM		IPL_TTY
 #define	IPL_SERIAL	7	/* disable serial interrupts */
 #define	IPL_CLOCK	8	/* disable clock interrupts */
+#define	IPL_STATCLOCK	IPL_CLOCK
+#define	IPL_SCHED	IPL_CLOCK
 #define	IPL_HIGH	8	/* disable all interrupts */
+#define	IPL_LOCK	IPL_HIGH
 
 #define	_IPL_NSOFT	4	/* max soft IPL + 1 */
 #define	_IPL_N		9	/* max IPL + 1 */
@@ -94,28 +99,17 @@ extern int		_splnone(int);
 extern int		_setsoftintr(int);
 extern int		_clrsoftintr(int);
 
-#define	splhigh()	_splraise(ipl_sr_bits[IPL_HIGH])
 #define	spl0()		(void) _spllower(0)
 #define	splx(s)		(void) _splset(s)
-#define	splbio()	_splraise(ipl_sr_bits[IPL_BIO])
-#define	splnet()	_splraise(ipl_sr_bits[IPL_NET])
-#define	spltty()	_splraise(ipl_sr_bits[IPL_TTY])
-#define	splserial()	_splraise(ipl_sr_bits[IPL_SERIAL])
-#define	splvm()		spltty()
-#define	splclock()	_splraise(ipl_sr_bits[IPL_CLOCK])
-#define	splstatclock()	splclock()
-
-#define	splsched()	splclock()
-#define	spllock()	splhigh()
-#define	spllpt()	spltty()
 
 #define	splsoft()	_splraise(ipl_sr_bits[IPL_SOFT])
-#define	splsoftclock()	_splraise(ipl_sr_bits[IPL_SOFTCLOCK])
-#define	splsoftnet()	_splraise(ipl_sr_bits[IPL_SOFTNET])
-#define	splsoftserial()	_splraise(ipl_sr_bits[IPL_SOFTSERIAL])
 
 #define	spllowersoftclock() _spllower(ipl_sr_bits[IPL_SOFTCLOCK])
 
+#define	splraiseipl(x)	_splraise(ipl_sr_bits[x])
+
+#include <sys/spl.h>
+
 struct evbmips_intrhand {
 	LIST_ENTRY(evbmips_intrhand) ih_q;
 	int (*ih_func)(void *);
Index: arch/evbsh3/include/intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/evbsh3/include/intr.h,v
retrieving revision 1.7
diff -u -p -r1.7 intr.h
--- arch/evbsh3/include/intr.h	22 Apr 2002 02:05:33 -0000	1.7
+++ arch/evbsh3/include/intr.h	5 Nov 2005 15:35:43 -0000
@@ -45,23 +45,17 @@
 #define	IPL_BIO		9	/* block I/O */
 #define	IPL_NET		11	/* network */
 #define	IPL_TTY		12	/* terminal */
+#define	IPL_VM		IPL_TTY
 #define	IPL_SERIAL	12	/* serial */
 #define	IPL_CLOCK	14	/* clock */
+#define	IPL_STATCLOCK	IPL_CLOCK
+#define	IPL_SCHED	IPL_CLOCK
 #define	IPL_HIGH	15	/* everything */
+#define	IPL_LOCK	IPL_HIGH
 
-#define	splsoftclock()		_cpu_intr_raise(IPL_SOFTCLOCK << 4)
-#define	splsoftnet()		_cpu_intr_raise(IPL_SOFTNET << 4)
-#define	splsoftserial()		_cpu_intr_raise(IPL_SOFTSERIAL << 4)
-#define	splbio()		_cpu_intr_raise(IPL_BIO << 4)
-#define	splnet()		_cpu_intr_raise(IPL_NET << 4)
-#define	spltty()		_cpu_intr_raise(IPL_TTY << 4)
-#define	splvm()			spltty()
-#define	splserial()		_cpu_intr_raise(IPL_SERIAL << 4)
-#define	splclock()		_cpu_intr_raise(IPL_CLOCK << 4)
-#define	splstatclock()		splclock()
-#define	splsched()		splclock()
-#define	splhigh()		_cpu_intr_raise(IPL_HIGH << 4)
-#define	spllock()		splhigh()
+#define	splraiseipl(x)		_cpu_intr_raise((x) << 4)
+
+#include <sys/spl.h>
 
 #define	spl0()			_cpu_intr_resume(0)
 #define	splx(x)			_cpu_intr_resume(x)
Index: arch/hp700/include/intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/hp700/include/intr.h,v
retrieving revision 1.3
diff -u -p -r1.3 intr.h
--- arch/hp700/include/intr.h	16 Jun 2003 20:01:00 -0000	1.3
+++ arch/hp700/include/intr.h	5 Nov 2005 15:35:43 -0000
@@ -49,10 +49,14 @@
 #define	IPL_NET		5	/* network */
 #define	IPL_SOFTSERIAL	4	/* serial */
 #define	IPL_TTY		3	/* terminal */
+#define	IPL_LPT		IPL_TTY
 #define	IPL_VM		3	/* memory allocation */
 #define	IPL_AUDIO	2	/* audio */
 #define	IPL_CLOCK	1	/* clock */
+#define	IPL_STATCLOCK	IPL_CLOCK
 #define	IPL_HIGH	1	/* everything */
+#define	IPL_SCHED	IPL_HIGH
+#define	IPL_LOCK	IPL_HIGH
 #define	IPL_SERIAL	0	/* serial */
 #define	NIPL		10
 
@@ -94,38 +98,21 @@ splraise(ncpl)
 void spllower __P((int));
  
 /*
- * Hardware interrupt masks
- */
-#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	splstatclock()	splclock()
-#define	splserial()	splraise(imask[IPL_SERIAL])
-
-#define spllpt()	spltty()
-
-/*
  * Software interrupt masks
  *
  * NOTE: splsoftclock() is used by hardclock() to lower the priority from
  * clock to softclock before it calls softclock().
  */
 #define	spllowersoftclock() spllower(imask[IPL_SOFTCLOCK])
-#define	splsoftclock()	splraise(imask[IPL_SOFTCLOCK])
-#define	splsoftnet()	splraise(imask[IPL_SOFTNET])
-#define	splsoftserial()	splraise(imask[IPL_SOFTSERIAL])
 
 /*
  * Miscellaneous
  */
-#define	splvm()		splraise(imask[IPL_VM])
-#define	splhigh()	splraise(imask[IPL_HIGH])
-#define	splsched()	splhigh()
-#define	spllock()	splhigh()
 #define	spl0()		spllower(0)
 #define	splx(x)		spllower(x)
+#define	splraiseipl(x)	splraise(imask[x])
+
+#include <sys/spl.h>
 
 #define	setsoftast()	(astpending = 1)
 #define	setsoftnet()	hp700_intr_schedule(softnetmask)
Index: arch/mac68k/include/intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/include/intr.h,v
retrieving revision 1.21
diff -u -p -r1.21 intr.h
--- arch/mac68k/include/intr.h	15 Jan 2005 16:00:59 -0000	1.21
+++ arch/mac68k/include/intr.h	5 Nov 2005 15:35:43 -0000
@@ -42,19 +42,20 @@
  */
 extern unsigned short mac68k_ipls[];
 
-#define	MAC68K_IPL_SOFT		0
-#define	MAC68K_IPL_BIO		1
-#define	MAC68K_IPL_NET		2
-#define	MAC68K_IPL_TTY		3
-#define	MAC68K_IPL_IMP		4
-#define	MAC68K_IPL_AUDIO	5
-#define	MAC68K_IPL_SERIAL	6
-#define	MAC68K_IPL_ADB		7
-#define	MAC68K_IPL_CLOCK	8
-#define	MAC68K_IPL_STATCLOCK	9
-#define	MAC68K_IPL_SCHED	10
-#define	MAC68K_IPL_HIGH		11
-#define	MAC68K_NIPLS		12
+#define	MAC68K_IPL_NONE		0
+#define	MAC68K_IPL_SOFT		1
+#define	MAC68K_IPL_BIO		2
+#define	MAC68K_IPL_NET		3
+#define	MAC68K_IPL_TTY		4
+#define	MAC68K_IPL_IMP		5
+#define	MAC68K_IPL_AUDIO	6
+#define	MAC68K_IPL_SERIAL	7
+#define	MAC68K_IPL_ADB		8
+#define	MAC68K_IPL_CLOCK	9
+#define	MAC68K_IPL_STATCLOCK	10
+#define	MAC68K_IPL_SCHED	11
+#define	MAC68K_IPL_HIGH		12
+#define	MAC68K_NIPLS		13
 
 /* These spl calls are _not_ to be used by machine-independent code. */
 #define	spladb()	_splraise(mac68k_ipls[MAC68K_IPL_ADB])
@@ -66,23 +67,29 @@ extern unsigned short mac68k_ipls[];
  * 2) allowing faster devices to take priority
  */
 #define	spllowersoftclock() spl1()
-#define	splsoftclock()	_splraise(mac68k_ipls[MAC68K_IPL_SOFT])
-#define	splsoftnet()	_splraise(mac68k_ipls[MAC68K_IPL_SOFT])
-#define	spltty()	_splraise(mac68k_ipls[MAC68K_IPL_TTY])
-#define	splbio()	_splraise(mac68k_ipls[MAC68K_IPL_BIO])
-#define	splnet()	_splraise(mac68k_ipls[MAC68K_IPL_NET])
-#define	splvm()		_splraise(mac68k_ipls[MAC68K_IPL_IMP])
-#define	splaudio()	_splraise(mac68k_ipls[MAC68K_IPL_AUDIO])
-#define	splclock()	_splraise(mac68k_ipls[MAC68K_IPL_CLOCK])
-#define	splstatclock()	_splraise(mac68k_ipls[MAC68K_IPL_STATCLOCK])
-#define	splsched()	_splraise(mac68k_ipls[MAC68K_IPL_SCHED])
-#define	splserial()	_splraise(mac68k_ipls[MAC68K_IPL_SERIAL])
-#define	splhigh()	spl7()
-#define	spllock()	spl7()
 
 /* watch out for side effects */
 #define splx(s)         ((s) & PSL_IPL ? _spl(s) : spl0())
 
+#define	IPL_NONE	MAC68K_IPL_NONE
+#define	IPL_SOFTCLOCK	MAC68K_IPL_SOFT
+#define	IPL_SOFTNET	MAC68K_IPL_SOFT
+#define	IPL_BIO		MAC68K_IPL_BIO
+#define	IPL_NET		MAC68K_IPL_NET
+#define	IPL_TTY		MAC68K_IPL_TTY
+#define	IPL_VM		MAC68K_IPL_IMP
+#define	IPL_AUDIO	MAC68K_IPL_AUDIO
+#define	IPL_CLOCK	MAC68K_IPL_CLOCK
+#define	IPL_STATCLOCK	MAC68K_IPL_STATCLOCK
+#define	IPL_SCHED	MAC68K_IPL_SCHED
+#define	IPL_HIGH	MAC68K_IPL_HIGH
+#define	IPL_LOCK	MAC68K_IPL_HIGH
+#define	IPL_SERIAL	MAC68K_IPL_SERIAL
+
+#define	splraiseipl(x)	_splraise(mac68k_ipls[x])
+
+#include <sys/spl.h>
+
 /*
  * simulated software interrupt register
  */
Index: arch/mac68k/mac68k/intr.c
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/mac68k/intr.c,v
retrieving revision 1.22
diff -u -p -r1.22 intr.c
--- arch/mac68k/mac68k/intr.c	16 Jun 2005 22:45:46 -0000	1.22
+++ arch/mac68k/mac68k/intr.c	5 Nov 2005 15:35:43 -0000
@@ -115,6 +115,7 @@ intr_init(void)
 	const char	*inames;
 	char		*g_inames;
 
+	mac68k_ipls[MAC68K_IPL_NONE] = 0;
 	mac68k_ipls[MAC68K_IPL_SOFT] = PSL_S|PSL_IPL1;
 	mac68k_ipls[MAC68K_IPL_SERIAL] = PSL_S|PSL_IPL4;
 	mac68k_ipls[MAC68K_IPL_HIGH] = PSL_S|PSL_IPL7;
Index: arch/powerpc/include/ibm4xx/ibm4xx_intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/include/ibm4xx/ibm4xx_intr.h,v
retrieving revision 1.7
diff -u -p -r1.7 ibm4xx_intr.h
--- arch/powerpc/include/ibm4xx/ibm4xx_intr.h	4 Sep 2005 15:23:55 -0000	1.7
+++ arch/powerpc/include/ibm4xx/ibm4xx_intr.h	5 Nov 2005 15:35:45 -0000
@@ -47,10 +47,14 @@
 #define	IPL_NET		5	/* network */
 #define	IPL_SOFTSERIAL	4	/* software serial interrupt */
 #define	IPL_TTY		3	/* terminal */
+#define	IPL_LPT		IPL_TTY
 #define	IPL_VM		3	/* memory allocation */
 #define	IPL_AUDIO	2	/* audio */
 #define	IPL_CLOCK	1	/* clock */
+#define	IPL_STATCLOCK	IPL_CLOCK
 #define	IPL_HIGH	1	/* everything */
+#define	IPL_SCHED	IPL_HIGH
+#define	IPL_LOCK	IPL_HIGH
 #define	IPL_SERIAL	0	/* serial */
 #define	NIPL		10
 
@@ -77,9 +81,7 @@ struct intrhand {
 };
 
 void setsoftclock(void);
-int  splsoftclock(void);
 void setsoftnet(void);
-int  splsoftnet(void);
 
 void do_pending_int(void);
 void ext_intr(void);
@@ -178,31 +180,18 @@ set_sint(pending)
 #define	SPL_CLOCK	IRQ_TO_MASK(CNT_CLOCK)
 #define	SINT_MASK	(SINT_CLOCK|SINT_NET|SINT_SERIAL)
 
-#define splbio()	splraise(imask[IPL_BIO])
-#define splnet()	splraise(imask[IPL_NET])
-#define spltty()	splraise(imask[IPL_TTY])
-#define splclock()	splraise(imask[IPL_CLOCK])
-#define splvm()		splraise(imask[IPL_VM])
-#define	splaudio()	splraise(imask[IPL_AUDIO])
-#define	splserial()	splraise(imask[IPL_SERIAL])
-#define splstatclock()	splclock()
 #define	spllowersoftclock() spllower(imask[IPL_SOFTCLOCK])
-#define	splsoftclock()	splraise(imask[IPL_SOFTCLOCK])
-#define	splsoftnet()	splraise(imask[IPL_SOFTNET])
-#define	splsoftserial()	splraise(imask[IPL_SOFTSERIAL])
 
-#define spllpt()	spltty()
+#define	splraiseipl(x)	splraise(x)
+
+#include <sys/spl.h>
 
 #define	setsoftclock()	set_sint(SINT_CLOCK);
 #define	setsoftnet()	set_sint(SINT_NET);
 #define	setsoftserial()	set_sint(SINT_SERIAL);
 
-#define	splhigh()	splraise(imask[IPL_HIGH])
 #define	spl0()		spllower(0)
 
-#define	splsched()	splhigh()
-#define	spllock()	splhigh()
-
 void softnet(void);
 void softserial(void);
 
Index: arch/powerpc/marvell/marvell_intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/marvell/marvell_intr.h,v
retrieving revision 1.7
diff -u -p -r1.7 marvell_intr.h
--- arch/powerpc/marvell/marvell_intr.h	1 Jun 2004 00:49:41 -0000	1.7
+++ arch/powerpc/marvell/marvell_intr.h	5 Nov 2005 15:35:45 -0000
@@ -51,6 +51,7 @@
 #define IPL_SOFTI2C	6	/* i2c */
 #define	IPL_SOFTSERIAL	7	/* serial */
 #define	IPL_TTY		8	/* terminal */
+#define	IPL_LPT		IPL_TTY
 #define IPL_AUDIO       9       /* boom box */
 #define IPL_EJECT	10	/* card eject */
 #define IPL_GTERR	10	/* GT-64260 errors */
@@ -58,6 +59,7 @@
 #define	IPL_VM		12	/* memory allocation */
 #define	IPL_SERIAL	13	/* serial */
 #define	IPL_CLOCK	14	/* clock */
+#define	IPL_STATCLOCK	IPL_CLOCK
 #define	IPL_SCHED	14	/* schedular */
 #define	IPL_LOCK	14	/* same as high for now */
 #define	IPL_HIGH	15	/* everything */
@@ -310,10 +312,8 @@ extern unsigned int spl_stats_enb;
 
 void setsoftclock __P((void));
 void clearsoftclock __P((void));
-int  splsoftclock __P((void));
 void setsoftnet   __P((void));
 void clearsoftnet __P((void));
-int  splsoftnet   __P((void));
 
 void intr_dispatch __P((void));
 #ifdef SPL_INLINE
@@ -452,29 +452,12 @@ spllower(int ncpl)
 			  SIBIT(SIR_HWCLOCK))
 
 /*
- * standard hardware interrupt spl's
- */
-#define splbio()	splraise(IPL_BIO)
-#define splnet()	splraise(IPL_NET)
-#define spltty()	splraise(IPL_TTY)
-#define	splaudio()	splraise(IPL_AUDIO)
-#define splsched()	splraise(IPL_SCHED)
-#define splclock()	splraise(IPL_CLOCK)
-#define splstatclock()	splclock()
-#define	splserial()	splraise(IPL_SERIAL)
-
-#define spllpt()	spltty()
-
-/*
  * Software interrupt spl's
  *
  * NOTE: splsoftclock() is used by hardclock() to lower the priority from
  * clock to softclock before it calls softclock().
  */
 #define	spllowersoftclock()	spllower(IPL_SOFTCLOCK)
-#define	splsoftclock()		splraise(IPL_SOFTCLOCK)
-#define	splsoftnet()		splraise(IPL_SOFTNET)
-#define	splsoftserial()		splraise(IPL_SOFTSERIAL)
 
 struct intrhand;
 extern struct intrhand *softnet_handlers[];
@@ -489,11 +472,12 @@ void softintr_schedule(void *cookie);
 /*
  * Miscellaneous
  */
-#define splvm()		splraise(IPL_VM)
-#define spllock()	splraise(IPL_LOCK)
-#define	splhigh()	splraise(IPL_HIGH)
 #define	spl0()		spllower(IPL_NONE)
 
+#define	splraiseipl(x)	splraise(x)
+
+#include <sys/spl.h>
+
 #define SIBIT(ipl)	(1 << ((ipl) - SIR_BASE))
 #if 0
 #define	setsoftclock()	softintr(SIBIT(SIR_SOFTCLOCK))
Index: arch/vax/include/intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/include/intr.h,v
retrieving revision 1.16
diff -u -p -r1.16 intr.h
--- arch/vax/include/intr.h	3 Jun 2005 11:44:39 -0000	1.16
+++ arch/vax/include/intr.h	5 Nov 2005 15:35:45 -0000
@@ -42,6 +42,7 @@
  */
 #define IPL_HIGH	0x1f	/* high -- blocks all interrupts */
 #define IPL_CLOCK	0x18	/* clock */
+#define IPL_STATCLOCK	IPL_CLOCK
 #define IPL_UBA		0x17	/* unibus adapters */
 #define IPL_VM		0x17	/* memory allocation */
 #define IPL_NET		0x16	/* network */
@@ -59,6 +60,12 @@
 #define IPL_SOFTCLOCK	0x08
 #define IPL_NONE	0x00
 
+/* Misc
+ */
+
+#define	IPL_SCHED	IPL_HIGH
+#define	IPL_LOCK	IPL_HIGH
+
 #define IPL_LEVELS	32
 
 #define IST_UNUSABLE	-1	/* interrupt cannot be used */
@@ -108,23 +115,10 @@ do {								\
 
 #define spl0()		_splset(IPL_NONE)		/* IPL00 */
 #define spllowersoftclock() _splset(IPL_SOFTCLOCK)	/* IPL08 */
-#define splsoftclock()	_splraise(IPL_SOFTCLOCK)	/* IPL08 */
-#define splsoftnet()	_splraise(IPL_SOFTNET)		/* IPL0C */
-#define splsoftserial()	_splraise(IPL_SOFTSERIAL)	/* IPL0D */
 #define splddb()	_splraise(IPL_SOFTDDB)		/* IPL0F */
 #define splconsmedia()	_splraise(IPL_CONSMEDIA)	/* IPL14 */
-#define	splipi()	_splraise(IPL_IPI)		/* IPL14 */
-#define splbio()	_splraise(IPL_BIO)		/* IPL15 */
-#define spltty()	_splraise(IPL_TTY)		/* IPL15 */
-#define splaudio()	_splraise(IPL_AUDIO)		/* IPL15 */
-#define splnet()	_splraise(IPL_NET)		/* IPL16 */
-#define splvm()		_splraise(IPL_VM)		/* IPL17 */
-#define splclock()	_splraise(IPL_CLOCK)		/* IPL18 */
-#define splhigh()	_splraise(IPL_HIGH)		/* IPL1F */
-#define splstatclock()	splclock()
 
-#define	splsched()	splhigh()
-#define	spllock()	splhigh()
+#include <sys/spl.h>
 
 /* These are better to use when playing with VAX buses */
 #define	spluba()	_splraise(IPL_UBA)		/* IPL17 */
Index: arch/x68k/include/intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/x68k/include/intr.h,v
retrieving revision 1.9
diff -u -p -r1.9 intr.h
--- arch/x68k/include/intr.h	18 Jan 2005 07:12:16 -0000	1.9
+++ arch/x68k/include/intr.h	5 Nov 2005 15:35:45 -0000
@@ -46,24 +46,30 @@
 /* spl0 requires checking for software interrupts */
 void	spl0(void);
 
-#define splnone()       spl0()
-#define spllowersoftclock()  spl1()  /* disallow softclock */
-#define splsoftclock()  splraise1()  /* disallow softclock */
-#define splsoftnet()	splraise1()	/* disallow softnet */
-#define splnet()        _splraise(PSL_S|PSL_IPL4) /* disallow network */
-#define splbio()        _splraise(PSL_S|PSL_IPL3) /* disallow block I/O */
-#define spltty()        _splraise(PSL_S|PSL_IPL4) /* disallow tty interrupts */
-#define splvm()         _splraise(PSL_S|PSL_IPL4) /* disallow vm */
-#define splzs()         splraise5()	/* disallow serial interrupts */
-#define splclock()      splraise6()	/* disallow clock interrupt */
-#define splstatclock()  splraise6()	/* disallow clock interrupt */
-#define splhigh()       spl7()	/* disallow everything */
-#define splsched()      spl7()	/* disallow scheduling */
-#define spllock()	spl7()	/* disallow scheduling */
+#define	splnone()	spl0()
+#define	spllowersoftclock() spl1()	/* disallow softclock */
+#define	splzs()		splraise5()	/* disallow serial interrupts */
 
 /* watch out for side effects */
 #define splx(s)         ((s) & PSL_IPL ? _spl(s) : spl0())
 
+#define	IPL_NONE	0
+#define	IPL_SOFTCLOCK	(PSL_S|PSL_IPL1)
+#define	IPL_SOFTNET	(PSL_S|PSL_IPL1)
+#define	IPL_BIO		(PSL_S|PSL_IPL3)
+#define	IPL_NET		(PSL_S|PSL_IPL4)
+#define	IPL_TTY		(PSL_S|PSL_IPL4)
+#define	IPL_VM		(PSL_S|PSL_IPL4)
+#define	IPL_CLOCK	(PSL_S|PSL_IPL6)
+#define	IPL_STATCLOCK	(PSL_S|PSL_IPL6)
+#define	IPL_SCHED	(PSL_S|PSL_IPL7)
+#define	IPL_HIGH	(PSL_S|PSL_IPL7)
+#define	IPL_LOCK	(PSL_S|PSL_IPL7)
+
+#define	splraiseipl(x)	_splraise(x)
+
+#include <sys/spl.h>
+
 /*
  * simulated software interrupt register
  */

--NextPart-20051105232646-0506700--