intr.h revision 1.4
11.4Sminoura/*	$NetBSD: intr.h,v 1.4 1999/09/23 15:06:37 minoura Exp $	*/
21.1Sminoura
31.1Sminoura/*
41.1Sminoura *
51.1Sminoura * Copyright (c) 1998 NetBSD Foundation, Inc.
61.1Sminoura * All rights reserved.
71.1Sminoura *
81.1Sminoura * This code is derived from software contributed to The NetBSD Foundation
91.1Sminoura * by Minoura Makoto and Jason R. Thorpe.
101.1Sminoura *
111.1Sminoura * Redistribution and use in source and binary forms, with or without
121.1Sminoura * modification, are permitted provided that the following conditions
131.1Sminoura * are met:
141.1Sminoura * 1. Redistributions of source code must retain the above copyright
151.1Sminoura *    notice, this list of conditions and the following disclaimer.
161.1Sminoura * 2. Redistributions in binary form must reproduce the above copyright
171.1Sminoura *    notice, this list of conditions and the following disclaimer in the
181.1Sminoura *    documentation and/or other materials provided with the distribution.
191.1Sminoura * 3. All advertising materials mentioning features or use of this software
201.1Sminoura *    must display the following acknowledgement:
211.1Sminoura *      This product includes software developed by Charles D. Cranor and
221.1Sminoura *      Washington University.
231.1Sminoura * 4. The name of the author may not be used to endorse or promote products
241.1Sminoura *    derived from this software without specific prior written permission.
251.1Sminoura *
261.1Sminoura * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
271.1Sminoura * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
281.1Sminoura * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
291.1Sminoura * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
301.1Sminoura * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
311.1Sminoura * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
321.1Sminoura * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
331.1Sminoura * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
341.1Sminoura * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
351.1Sminoura * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
361.1Sminoura */
371.1Sminoura
381.1Sminoura#ifndef _X68K_INTR_H_
391.1Sminoura#define	_X68K_INTR_H_
401.1Sminoura
411.1Sminoura#include <machine/psl.h>
421.1Sminoura
431.4Sminoura#if defined(_KERNEL) && !defined(_LOCORE)
441.4Sminoura
451.1Sminoura/* spl0 requires checking for software interrupts */
461.1Sminouravoid	spl0 __P((void));
471.1Sminoura
481.1Sminoura#define splnone()       spl0()
491.3Sthorpej#define spllowersoftclock()  spl1()  /* disallow softclock */
501.3Sthorpej#define splsoftclock()  splraise1()  /* disallow softclock */
511.3Sthorpej#define splsoftnet()	splraise1()	/* disallow softnet */
521.1Sminoura#define splnet()        _splraise(PSL_S|PSL_IPL4) /* disallow network */
531.1Sminoura#define splbio()        _splraise(PSL_S|PSL_IPL3) /* disallow block I/O */
541.1Sminoura#define splimp()        _splraise(PSL_S|PSL_IPL4) /* disallow imput */
551.1Sminoura#define spltty()        _splraise(PSL_S|PSL_IPL4) /* disallow tty interrupts */
561.3Sthorpej#define splzs()         splraise5()	/* disallow serial interrupts */
571.3Sthorpej#define splclock()      splraise6()	/* disallow clock interrupt */
581.3Sthorpej#define splstatclock()  splraise6()	/* disallow clock interrupt */
591.1Sminoura#define splvm()         _splraise(PSL_S|PSL_IPL4) /* disallow virtual memory operations */
601.1Sminoura#define splhigh()       spl7()	/* disallow everything */
611.1Sminoura#define splsched()      spl7()	/* disallow scheduling */
621.1Sminoura
631.1Sminoura/* watch out for side effects */
641.1Sminoura#define splx(s)         ((s) & PSL_IPL ? _spl(s) : spl0())
651.1Sminoura
661.1Sminoura/*
671.1Sminoura * simulated software interrupt register
681.1Sminoura */
691.1Sminouraextern unsigned char ssir;
701.1Sminoura
711.1Sminoura#define SIR_NET		0x1
721.1Sminoura#define SIR_CLOCK	0x2
731.1Sminoura#define SIR_SERIAL	0x4
741.1Sminoura#define SIR_KBD		0x8
751.1Sminoura
761.1Sminoura#define siroff(x)	ssir &= ~(x)
771.1Sminoura#define setsoftnet()	ssir |= SIR_NET
781.1Sminoura#define setsoftclock()	ssir |= SIR_CLOCK
791.1Sminoura#define setsoftserial() ssir |= SIR_SERIAL
801.1Sminoura#define setsoftkbd()    ssir |= SIR_KBD
811.1Sminoura
821.4Sminoura#endif /* _KERNEL && ! _LOCORE */
831.1Sminoura#endif
84