intr.h revision 1.20
11.20Stsutsui/*	$NetBSD: intr.h,v 1.20 2008/01/28 17:07:19 tsutsui Exp $	*/
21.1Stsutsui
31.1Stsutsui/*
41.1Stsutsui *
51.1Stsutsui * Copyright (c) 1998 NetBSD Foundation, Inc.
61.1Stsutsui * All rights reserved.
71.1Stsutsui *
81.1Stsutsui * This code is derived from software contributed to The NetBSD Foundation
91.1Stsutsui * by Minoura Makoto and Jason R. Thorpe.
101.1Stsutsui *
111.1Stsutsui * Redistribution and use in source and binary forms, with or without
121.1Stsutsui * modification, are permitted provided that the following conditions
131.1Stsutsui * are met:
141.1Stsutsui * 1. Redistributions of source code must retain the above copyright
151.1Stsutsui *    notice, this list of conditions and the following disclaimer.
161.1Stsutsui * 2. Redistributions in binary form must reproduce the above copyright
171.1Stsutsui *    notice, this list of conditions and the following disclaimer in the
181.1Stsutsui *    documentation and/or other materials provided with the distribution.
191.1Stsutsui * 3. All advertising materials mentioning features or use of this software
201.1Stsutsui *    must display the following acknowledgement:
211.1Stsutsui *      This product includes software developed by The NetBSD Foundation
221.1Stsutsui *	Inc. and its contributers.
231.1Stsutsui * 4. The name of the author may not be used to endorse or promote products
241.1Stsutsui *    derived from this software without specific prior written permission.
251.1Stsutsui *
261.1Stsutsui * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
271.1Stsutsui * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
281.1Stsutsui * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
291.1Stsutsui * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
301.1Stsutsui * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
311.1Stsutsui * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
321.1Stsutsui * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
331.1Stsutsui * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
341.1Stsutsui * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
351.1Stsutsui * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
361.1Stsutsui */
371.1Stsutsui
381.1Stsutsui#ifndef _NEWS68K_INTR_H_
391.1Stsutsui#define	_NEWS68K_INTR_H_
401.1Stsutsui
411.14Stsutsui#include <sys/device.h>
421.14Stsutsui#include <sys/queue.h>
431.1Stsutsui#include <machine/psl.h>
441.5Stsutsui#include <m68k/asm_single.h>
451.1Stsutsui
461.13Syamt#define	IPL_NONE	0
471.14Stsutsui#define	IPL_SOFTCLOCK	1
481.19Sad#define	IPL_SOFTBIO	2
491.19Sad#define	IPL_SOFTNET	3
501.19Sad#define	IPL_SOFTSERIAL	4
511.19Sad#define	IPL_VM		5
521.19Sad#define	IPL_SCHED	6
531.19Sad#define	IPL_HIGH	6
541.19Sad#define	NIPL		7
551.13Syamt
561.20Stsutsuiextern int idepth;
571.20Stsutsui
581.13Syamttypedef int ipl_t;
591.13Syamttypedef struct {
601.18Sthorpej	uint16_t _psl;
611.13Syamt} ipl_cookie_t;
621.13Syamt
631.14Stsutsuiipl_cookie_t makeiplcookie(ipl_t);
641.13Syamt
651.13Syamtstatic inline int
661.13Syamtsplraiseipl(ipl_cookie_t icookie)
671.13Syamt{
681.13Syamt
691.14Stsutsui	return _splraise(icookie._psl);
701.13Syamt}
711.13Syamt
721.12Sperrystatic __inline void
731.9Stsutsuisplx(int sr)
741.9Stsutsui{
751.9Stsutsui
761.11Sperry	__asm volatile("movw %0,%%sr" : : "di" (sr));
771.9Stsutsui}
781.1Stsutsui
791.1Stsutsui/*
801.14Stsutsui * news68k can handle software interrupts by its own hardware
811.14Stsutsui * so has no need to check for any simulated interrupts, etc.
821.14Stsutsui */
831.14Stsutsui#define	spl0()		_spl0()
841.14Stsutsui
851.19Sad#define	splsoftbio()	splraise2()
861.19Sad#define	splsoftclock()	splraise2()
871.19Sad#define	splsoftnet()	splraise2()
881.19Sad#define	splsoftserial()	splraise2()
891.14Stsutsui#define	splvm()		splraise5()
901.14Stsutsui#define	splhigh()	spl7()
911.14Stsutsui#define	splsched()	spl7()
921.1Stsutsui
931.1Stsutsui#endif /* _NEWS68K_INTR_H_ */
94