intr.h revision 1.5
11.5Sminoura/*	$NetBSD: intr.h,v 1.5 2000/01/16 14:21:00 minoura Exp $	*/
21.1Sminoura
31.5Sminoura/*-
41.5Sminoura * Copyright (c) 1998 The NetBSD Foundation, Inc.
51.1Sminoura * All rights reserved.
61.1Sminoura *
71.1Sminoura * This code is derived from software contributed to The NetBSD Foundation
81.1Sminoura * by Minoura Makoto and Jason R. Thorpe.
91.1Sminoura *
101.1Sminoura * Redistribution and use in source and binary forms, with or without
111.1Sminoura * modification, are permitted provided that the following conditions
121.1Sminoura * are met:
131.1Sminoura * 1. Redistributions of source code must retain the above copyright
141.1Sminoura *    notice, this list of conditions and the following disclaimer.
151.1Sminoura * 2. Redistributions in binary form must reproduce the above copyright
161.1Sminoura *    notice, this list of conditions and the following disclaimer in the
171.1Sminoura *    documentation and/or other materials provided with the distribution.
181.1Sminoura * 3. All advertising materials mentioning features or use of this software
191.1Sminoura *    must display the following acknowledgement:
201.5Sminoura *        This product includes software developed by the NetBSD
211.5Sminoura *        Foundation, Inc. and its contributors.
221.5Sminoura * 4. Neither the name of The NetBSD Foundation nor the names of its
231.5Sminoura *    contributors may be used to endorse or promote products derived
241.5Sminoura *    from this software without specific prior written permission.
251.1Sminoura *
261.5Sminoura * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
271.5Sminoura * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
281.5Sminoura * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
291.5Sminoura * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
301.5Sminoura * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
311.5Sminoura * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
321.5Sminoura * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
331.5Sminoura * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
341.5Sminoura * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
351.5Sminoura * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
361.5Sminoura * POSSIBILITY OF SUCH DAMAGE.
371.1Sminoura */
381.1Sminoura
391.1Sminoura#ifndef _X68K_INTR_H_
401.1Sminoura#define	_X68K_INTR_H_
411.1Sminoura
421.1Sminoura#include <machine/psl.h>
431.1Sminoura
441.4Sminoura#if defined(_KERNEL) && !defined(_LOCORE)
451.4Sminoura
461.1Sminoura/* spl0 requires checking for software interrupts */
471.1Sminouravoid	spl0 __P((void));
481.1Sminoura
491.1Sminoura#define splnone()       spl0()
501.3Sthorpej#define spllowersoftclock()  spl1()  /* disallow softclock */
511.3Sthorpej#define splsoftclock()  splraise1()  /* disallow softclock */
521.3Sthorpej#define splsoftnet()	splraise1()	/* disallow softnet */
531.1Sminoura#define splnet()        _splraise(PSL_S|PSL_IPL4) /* disallow network */
541.1Sminoura#define splbio()        _splraise(PSL_S|PSL_IPL3) /* disallow block I/O */
551.1Sminoura#define splimp()        _splraise(PSL_S|PSL_IPL4) /* disallow imput */
561.1Sminoura#define spltty()        _splraise(PSL_S|PSL_IPL4) /* disallow tty interrupts */
571.3Sthorpej#define splzs()         splraise5()	/* disallow serial interrupts */
581.3Sthorpej#define splclock()      splraise6()	/* disallow clock interrupt */
591.3Sthorpej#define splstatclock()  splraise6()	/* disallow clock interrupt */
601.1Sminoura#define splvm()         _splraise(PSL_S|PSL_IPL4) /* disallow virtual memory operations */
611.1Sminoura#define splhigh()       spl7()	/* disallow everything */
621.1Sminoura#define splsched()      spl7()	/* disallow scheduling */
631.1Sminoura
641.1Sminoura/* watch out for side effects */
651.1Sminoura#define splx(s)         ((s) & PSL_IPL ? _spl(s) : spl0())
661.1Sminoura
671.1Sminoura/*
681.1Sminoura * simulated software interrupt register
691.1Sminoura */
701.1Sminouraextern unsigned char ssir;
711.1Sminoura
721.1Sminoura#define SIR_NET		0x1
731.1Sminoura#define SIR_CLOCK	0x2
741.1Sminoura#define SIR_SERIAL	0x4
751.1Sminoura#define SIR_KBD		0x8
761.1Sminoura
771.1Sminoura#define siroff(x)	ssir &= ~(x)
781.1Sminoura#define setsoftnet()	ssir |= SIR_NET
791.1Sminoura#define setsoftclock()	ssir |= SIR_CLOCK
801.1Sminoura#define setsoftserial() ssir |= SIR_SERIAL
811.1Sminoura#define setsoftkbd()    ssir |= SIR_KBD
821.1Sminoura
831.4Sminoura#endif /* _KERNEL && ! _LOCORE */
841.1Sminoura#endif
85