Home | History | Annotate | Line # | Download | only in include
intr.h revision 1.2
      1 /*	$NetBSD: intr.h,v 1.2 2000/03/18 22:33:05 scw Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2000 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Jason R. Thorpe and Steve C. Woodford.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *        This product includes software developed by the NetBSD
     21  *        Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 #ifndef _MVME68K_INTR_H
     40 #define _MVME68K_INTR_H
     41 
     42 #include <machine/psl.h>
     43 
     44 /*
     45  * These are identical to the values used by hp300, but are not meaningful
     46  * to mvme68k code at this time.
     47  */
     48 #define	IPL_NONE	0	/* disable only this interrupt */
     49 #define	IPL_BIO		1	/* disable block I/O interrupts */
     50 #define	IPL_NET		2	/* disable network interrupts */
     51 #define	IPL_TTY		3	/* disable terminal interrupts */
     52 #define	IPL_TTYNOBUF	4	/* IPL_TTY + higher ISR priority */
     53 #define	IPL_CLOCK	5	/* disable clock interrupts */
     54 #define	IPL_HIGH	6	/* disable all interrupts */
     55 
     56 #ifdef _KERNEL
     57 /* spl0 requires checking for software interrupts */
     58 
     59 #define spllowersoftclock()	spl1()
     60 #define splsoftclock()		splraise1()
     61 #define splsoftnet()		splraise1()
     62 #define splbio()		splraise2()
     63 #define splnet()		splraise3()
     64 #define spltty()		splraise3()
     65 #define splimp()		splraise3()
     66 #define splserial()		splraise4()
     67 #define splclock()		splraise5()
     68 #define splstatclock()		splraise5()
     69 #define splvm()			splraise5()
     70 #define splhigh()		spl7()
     71 #define splsched()		spl7()
     72 
     73 /* watch out for side effects */
     74 #define splx(s)         (s & PSL_IPL ? _spl(s) : spl0())
     75 
     76 
     77 #define SIR_NET		0x1
     78 #define SIR_CLOCK	0x2
     79 
     80 /* Following is from next68k/intr.h */
     81 #define	siron(mask)	\
     82 	__asm __volatile ( "orb %1,%0" : "=m" (ssir) : "ir" (mask))
     83 #define	siroff(mask)	\
     84 	__asm __volatile ( "andb %1,%0" : "=m" (ssir) : "ir" (~(mask)));
     85 
     86 #define setsoftint(x)	siron(x)
     87 #define setsoftnet()	siron(SIR_NET)
     88 #define setsoftclock()	siron(SIR_CLOCK)
     89 
     90 
     91 #ifndef _LOCORE
     92 /*
     93  * simulated software interrupt register
     94  */
     95 extern volatile unsigned char ssir;
     96 
     97 extern void init_sir __P((void));
     98 extern unsigned long allocate_sir __P((void (*)(void *), void *));
     99 extern int spl0 __P((void));
    100 #endif /* !_LOCORE */
    101 #endif /* _KERNEL */
    102 
    103 #endif /* _MVME68K_INTR_H */
    104