intr.h revision 1.22
11.22Stsutsui/* $NetBSD: intr.h,v 1.22 2008/06/15 07:20:46 tsutsui Exp $ */ 21.1Stsutsui 31.21Stsutsui/*- 41.21Stsutsui * Copyright (c) 1998 The NetBSD Foundation, Inc. 51.1Stsutsui * All rights reserved. 61.1Stsutsui * 71.1Stsutsui * This code is derived from software contributed to The NetBSD Foundation 81.1Stsutsui * by Minoura Makoto and Jason R. Thorpe. 91.1Stsutsui * 101.1Stsutsui * Redistribution and use in source and binary forms, with or without 111.1Stsutsui * modification, are permitted provided that the following conditions 121.1Stsutsui * are met: 131.1Stsutsui * 1. Redistributions of source code must retain the above copyright 141.1Stsutsui * notice, this list of conditions and the following disclaimer. 151.1Stsutsui * 2. Redistributions in binary form must reproduce the above copyright 161.1Stsutsui * notice, this list of conditions and the following disclaimer in the 171.1Stsutsui * documentation and/or other materials provided with the distribution. 181.1Stsutsui * 191.21Stsutsui * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 201.21Stsutsui * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 211.21Stsutsui * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 221.21Stsutsui * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 231.21Stsutsui * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 241.21Stsutsui * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 251.21Stsutsui * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 261.21Stsutsui * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 271.21Stsutsui * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 281.21Stsutsui * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 291.21Stsutsui * POSSIBILITY OF SUCH DAMAGE. 301.1Stsutsui */ 311.1Stsutsui 321.1Stsutsui#ifndef _NEWS68K_INTR_H_ 331.1Stsutsui#define _NEWS68K_INTR_H_ 341.1Stsutsui 351.14Stsutsui#include <sys/device.h> 361.14Stsutsui#include <sys/queue.h> 371.1Stsutsui#include <machine/psl.h> 381.5Stsutsui#include <m68k/asm_single.h> 391.1Stsutsui 401.13Syamt#define IPL_NONE 0 411.14Stsutsui#define IPL_SOFTCLOCK 1 421.19Sad#define IPL_SOFTBIO 2 431.19Sad#define IPL_SOFTNET 3 441.19Sad#define IPL_SOFTSERIAL 4 451.19Sad#define IPL_VM 5 461.19Sad#define IPL_SCHED 6 471.22Stsutsui#define IPL_HIGH 7 481.22Stsutsui#define NIPL 8 491.13Syamt 501.20Stsutsuiextern int idepth; 511.22Stsutsuiextern const uint16_t ipl2psl_table[NIPL]; 521.20Stsutsui 531.13Syamttypedef int ipl_t; 541.13Syamttypedef struct { 551.18Sthorpej uint16_t _psl; 561.13Syamt} ipl_cookie_t; 571.13Syamt 581.22Stsutsuistatic inline ipl_cookie_t 591.22Stsutsuimakeiplcookie(ipl_t ipl) 601.22Stsutsui{ 611.22Stsutsui 621.22Stsutsui return (ipl_cookie_t){._psl = ipl2psl_table[ipl]}; 631.22Stsutsui} 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