intr.h revision 1.3
11.3Sagc/*	$NetBSD: intr.h,v 1.3 2003/08/07 16:27:16 agc Exp $	*/
21.2Skleink
31.2Skleink/*
41.2Skleink * Copyright (c) 1982, 1986, 1990, 1993
51.2Skleink *	The Regents of the University of California.  All rights reserved.
61.3Sagc *
71.3Sagc * This code is derived from software contributed to Berkeley by
81.3Sagc * the Systems Programming Group of the University of Utah Computer
91.3Sagc * Science Department.
101.3Sagc *
111.3Sagc * Redistribution and use in source and binary forms, with or without
121.3Sagc * modification, are permitted provided that the following conditions
131.3Sagc * are met:
141.3Sagc * 1. Redistributions of source code must retain the above copyright
151.3Sagc *    notice, this list of conditions and the following disclaimer.
161.3Sagc * 2. Redistributions in binary form must reproduce the above copyright
171.3Sagc *    notice, this list of conditions and the following disclaimer in the
181.3Sagc *    documentation and/or other materials provided with the distribution.
191.3Sagc * 3. Neither the name of the University nor the names of its contributors
201.3Sagc *    may be used to endorse or promote products derived from this software
211.3Sagc *    without specific prior written permission.
221.3Sagc *
231.3Sagc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
241.3Sagc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
251.3Sagc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
261.3Sagc * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
271.3Sagc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
281.3Sagc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
291.3Sagc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
301.3Sagc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
311.3Sagc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
321.3Sagc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
331.3Sagc * SUCH DAMAGE.
341.3Sagc *
351.3Sagc * from: Utah $Hdr: machparam.h 1.16 92/12/20$
361.3Sagc *
371.3Sagc *	from: @(#)param.h	8.1 (Berkeley) 6/10/93
381.3Sagc */
391.3Sagc/*
401.3Sagc * Copyright (c) 1988 University of Utah.
411.2Skleink *
421.2Skleink * This code is derived from software contributed to Berkeley by
431.2Skleink * the Systems Programming Group of the University of Utah Computer
441.2Skleink * Science Department.
451.2Skleink *
461.2Skleink * Redistribution and use in source and binary forms, with or without
471.2Skleink * modification, are permitted provided that the following conditions
481.2Skleink * are met:
491.2Skleink * 1. Redistributions of source code must retain the above copyright
501.2Skleink *    notice, this list of conditions and the following disclaimer.
511.2Skleink * 2. Redistributions in binary form must reproduce the above copyright
521.2Skleink *    notice, this list of conditions and the following disclaimer in the
531.2Skleink *    documentation and/or other materials provided with the distribution.
541.2Skleink * 3. All advertising materials mentioning features or use of this software
551.2Skleink *    must display the following acknowledgement:
561.2Skleink *	This product includes software developed by the University of
571.2Skleink *	California, Berkeley and its contributors.
581.2Skleink * 4. Neither the name of the University nor the names of its contributors
591.2Skleink *    may be used to endorse or promote products derived from this software
601.2Skleink *    without specific prior written permission.
611.2Skleink *
621.2Skleink * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
631.2Skleink * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
641.2Skleink * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
651.2Skleink * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
661.2Skleink * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
671.2Skleink * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
681.2Skleink * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
691.2Skleink * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
701.2Skleink * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
711.2Skleink * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
721.2Skleink * SUCH DAMAGE.
731.2Skleink *
741.2Skleink * from: Utah $Hdr: machparam.h 1.16 92/12/20$
751.2Skleink *
761.2Skleink *	from: @(#)param.h	8.1 (Berkeley) 6/10/93
771.2Skleink */
781.2Skleink
791.2Skleink#ifndef _CESFIC_INTR_H_
801.2Skleink#define _CESFIC_INTR_H_
811.2Skleink
821.2Skleink/*
831.2Skleink * spl functions; all but spl0 are done in-line
841.2Skleink */
851.2Skleink#include <machine/psl.h>
861.2Skleink
871.2Skleink#if defined(_KERNEL) && !defined(_LOCORE)
881.2Skleink/* spl0 requires checking for software interrupts */
891.2Skleink#define spl1()  _spl(PSL_S|PSL_IPL1)
901.2Skleink#define spl2()  _spl(PSL_S|PSL_IPL2)
911.2Skleink#define spl3()  _spl(PSL_S|PSL_IPL3)
921.2Skleink#define spl4()  _spl(PSL_S|PSL_IPL4)
931.2Skleink#define spl5()  _spl(PSL_S|PSL_IPL5)
941.2Skleink#define spl6()  _spl(PSL_S|PSL_IPL6)
951.2Skleink#define spl7()  _spl(PSL_S|PSL_IPL7)
961.2Skleink
971.2Skleink/*
981.2Skleink * These four globals contain the appropriate PSL_S|PSL_IPL? values
991.2Skleink * to raise interrupt priority to the requested level.
1001.2Skleink */
1011.2Skleinkextern	unsigned short cesfic_bioipl;
1021.2Skleinkextern	unsigned short cesfic_netipl;
1031.2Skleinkextern	unsigned short cesfic_ttyipl;
1041.2Skleinkextern	unsigned short cesfic_impipl;
1051.2Skleink
1061.2Skleink/* These spl calls are used by machine-independent code. */
1071.2Skleink#define	spllowersoftclock() spl1()
1081.2Skleink#define	splsoft()	splraise1()
1091.2Skleink#define splsoftclock()	splsoft()
1101.2Skleink#define splsoftnet()	splsoft()
1111.2Skleink#define splbio()	_splraise(cesfic_bioipl)
1121.2Skleink#define splnet()	_splraise(cesfic_netipl)
1131.2Skleink#define spltty()	_splraise(cesfic_ttyipl)
1141.2Skleink#define splvm()		_splraise(cesfic_impipl)
1151.2Skleink#define splclock()	spl6()
1161.2Skleink#define splstatclock()	spl6()
1171.2Skleink#define splhigh()	spl7()
1181.2Skleink#define splsched()	spl7()
1191.2Skleink#define spllock()	spl7()
1201.2Skleink
1211.2Skleink/* watch out for side effects */
1221.2Skleink#define splx(s)         (s & PSL_IPL ? _spl(s) : spl0())
1231.2Skleink
1241.2Skleinkint	spl0 __P((void));
1251.2Skleink#endif /* _KERNEL && !_LOCORE */
1261.2Skleink
1271.2Skleink#endif /* !_CESFIC_INTR_H_ */
128