intr.h revision 1.8
11.8Stsutsui/* $NetBSD: intr.h,v 1.8 2007/03/04 05:28:38 tsutsui Exp $ */ 21.1Snisimura 31.1Snisimura/*- 41.1Snisimura * Copyright (c) 2000 The NetBSD Foundation, Inc. 51.1Snisimura * All rights reserved. 61.1Snisimura * 71.1Snisimura * This code is derived from software contributed to The NetBSD Foundation 81.1Snisimura * by Tohru Nishimura. 91.1Snisimura * 101.1Snisimura * Redistribution and use in source and binary forms, with or without 111.1Snisimura * modification, are permitted provided that the following conditions 121.1Snisimura * are met: 131.1Snisimura * 1. Redistributions of source code must retain the above copyright 141.1Snisimura * notice, this list of conditions and the following disclaimer. 151.1Snisimura * 2. Redistributions in binary form must reproduce the above copyright 161.1Snisimura * notice, this list of conditions and the following disclaimer in the 171.1Snisimura * documentation and/or other materials provided with the distribution. 181.1Snisimura * 3. All advertising materials mentioning features or use of this software 191.1Snisimura * must display the following acknowledgement: 201.1Snisimura * This product includes software developed by the NetBSD 211.1Snisimura * Foundation, Inc. and its contributors. 221.1Snisimura * 4. Neither the name of The NetBSD Foundation nor the names of its 231.1Snisimura * contributors may be used to endorse or promote products derived 241.1Snisimura * from this software without specific prior written permission. 251.1Snisimura * 261.1Snisimura * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 271.1Snisimura * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 281.1Snisimura * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 291.1Snisimura * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 301.1Snisimura * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 311.1Snisimura * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 321.1Snisimura * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 331.1Snisimura * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 341.1Snisimura * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 351.1Snisimura * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 361.1Snisimura * POSSIBILITY OF SUCH DAMAGE. 371.1Snisimura */ 381.1Snisimura 391.1Snisimura#ifndef _MACHINE_INTR_H 401.1Snisimura#define _MACHINE_INTR_H 411.1Snisimura 421.4Sjdolecek#ifdef _KERNEL 431.4Sjdolecek 441.1Snisimura/* 451.1Snisimura * spl functions; all but spl0 are done in-line 461.1Snisimura */ 471.1Snisimura#include <machine/psl.h> 481.1Snisimura 491.1Snisimura#define splnone() spl0() 501.7Stsutsui#define splsoft() splraise1() 511.7Stsutsui#define splsoftclock() splsoft() 521.7Stsutsui#define splsoftnet() splsoft() 531.7Stsutsui#define splsoftserial() splsoft() 541.7Stsutsui#define splbio() splraise2() 551.7Stsutsui#define splnet() splraise3() 561.7Stsutsui#define spltty() splraise6() 571.7Stsutsui#define splclock() splraise5() 581.7Stsutsui#define splstatclock() splraise5() 591.7Stsutsui#define splvm() spl7() 601.7Stsutsui#define splhigh() spl7() 611.7Stsutsui#define splsched() spl7() 621.2Sthorpej#define spllock() spl7() 631.1Snisimura 641.1Snisimura/* watch out for side effects */ 651.1Snisimura#define splx(s) ((s) & PSL_IPL ? _spl(s) : spl0()) 661.1Snisimura 671.1Snisimuraint spl0 __P((void)); 681.4Sjdolecek 691.5Syamt#define IPL_NONE 0 701.5Syamt#define IPL_SOFTCLOCK 1 711.5Syamt#define IPL_SOFTNET 2 721.7Stsutsui#define IPL_SOFTSERIAL 3 731.7Stsutsui#define IPL_SOFT 4 741.7Stsutsui#define IPL_BIO 5 751.7Stsutsui#define IPL_NET 6 761.7Stsutsui#define IPL_CLOCK 7 771.7Stsutsui#define IPL_STATCLOCK 8 781.7Stsutsui#define IPL_TTY 9 791.7Stsutsui#define IPL_VM 10 801.7Stsutsui#define IPL_SCHED 11 811.7Stsutsui#define IPL_HIGH 12 821.7Stsutsui#define IPL_LOCK 13 831.7Stsutsui#define NIPL 14 841.5Syamt 851.7Stsutsuiextern const int ipl2spl_table[NIPL]; 861.5Syamt 871.5Syamttypedef int ipl_t; 881.5Syamttypedef struct { 891.5Syamt int _spl; 901.5Syamt} ipl_cookie_t; 911.5Syamt 921.5Syamtstatic inline ipl_cookie_t 931.5Syamtmakeiplcookie(ipl_t ipl) 941.5Syamt{ 951.5Syamt 961.5Syamt return (ipl_cookie_t){._spl = ipl2spl_table[ipl]}; 971.5Syamt} 981.5Syamt 991.5Syamtstatic inline int 1001.5Syamtsplraiseipl(ipl_cookie_t icookie) 1011.5Syamt{ 1021.5Syamt 1031.5Syamt return _splraise(icookie._spl); 1041.5Syamt} 1051.1Snisimura 1061.7Stsutsui#include <m68k/softintr.h> 1071.7Stsutsui 1081.8Stsutsui#endif /* _KERNEL */ 1091.8Stsutsui 1101.1Snisimura#endif /* _MACHINE_INTR_H */ 111