intr.h revision 1.13
11.7Srin/* $NetBSD: intr.h,v 1.13 2001/06/08 00:32:03 matt Exp $ */ 21.1Sdholland 31.1Sdholland/*- 41.1Sdholland * Copyright (c) 1998 The NetBSD Foundation, Inc. 51.1Sdholland * All rights reserved. 61.1Sdholland * 71.1Sdholland * This code is derived from software contributed to The NetBSD Foundation 81.1Sdholland * by Charles M. Hannum. 91.1Sdholland * 101.1Sdholland * Redistribution and use in source and binary forms, with or without 111.1Sdholland * modification, are permitted provided that the following conditions 121.1Sdholland * are met: 131.1Sdholland * 1. Redistributions of source code must retain the above copyright 141.1Sdholland * notice, this list of conditions and the following disclaimer. 151.1Sdholland * 2. Redistributions in binary form must reproduce the above copyright 161.1Sdholland * notice, this list of conditions and the following disclaimer in the 171.1Sdholland * documentation and/or other materials provided with the distribution. 181.1Sdholland * 3. All advertising materials mentioning features or use of this software 191.1Sdholland * must display the following acknowledgement: 201.1Sdholland * This product includes software developed by the NetBSD 211.1Sdholland * Foundation, Inc. and its contributors. 221.1Sdholland * 4. Neither the name of The NetBSD Foundation nor the names of its 231.1Sdholland * contributors may be used to endorse or promote products derived 241.1Sdholland * from this software without specific prior written permission. 251.1Sdholland * 261.1Sdholland * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 271.1Sdholland * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 281.1Sdholland * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 291.1Sdholland * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 301.1Sdholland * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 311.1Sdholland * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 321.1Sdholland * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 331.1Sdholland * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 341.1Sdholland * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 351.1Sdholland * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 361.2Spgoyette * POSSIBILITY OF SUCH DAMAGE. 371.7Srin */ 381.1Sdholland 391.1Sdholland#ifndef _MACPPC_INTR_H_ 401.1Sdholland#define _MACPPC_INTR_H_ 411.1Sdholland 421.1Sdholland/* Interrupt priority `levels'. */ 431.1Sdholland#define IPL_NONE 9 /* nothing */ 441.1Sdholland#define IPL_SOFTCLOCK 8 /* timeouts */ 451.2Spgoyette#define IPL_SOFTNET 7 /* protocol stacks */ 461.1Sdholland#define IPL_BIO 6 /* block I/O */ 471.2Spgoyette#define IPL_NET 5 /* network */ 481.2Spgoyette#define IPL_SOFTSERIAL 4 /* serial */ 491.2Spgoyette#define IPL_TTY 3 /* terminal */ 501.2Spgoyette#define IPL_IMP 3 /* memory allocation */ 511.1Sdholland#define IPL_AUDIO 2 /* audio */ 521.2Spgoyette#define IPL_CLOCK 1 /* clock */ 531.1Sdholland#define IPL_HIGH 1 /* everything */ 541.1Sdholland#define IPL_SERIAL 0 /* serial */ 551.1Sdholland#define NIPL 10 561.1Sdholland 571.1Sdholland/* Interrupt sharing types. */ 581.1Sdholland#define IST_NONE 0 /* none */ 591.1Sdholland#define IST_PULSE 1 /* pulsed */ 601.1Sdholland#define IST_EDGE 2 /* edge-triggered */ 611.1Sdholland#define IST_LEVEL 3 /* level-triggered */ 621.1Sdholland 631.1Sdholland#ifndef _LOCORE 641.1Sdholland 651.1Sdholland/* 661.1Sdholland * Interrupt handler chains. intr_establish() inserts a handler into 671.1Sdholland * the list. The handler is called with its (single) argument. 681.1Sdholland */ 691.1Sdhollandstruct intrhand { 701.1Sdholland int (*ih_fun) __P((void *)); 711.1Sdholland void *ih_arg; 721.1Sdholland u_long ih_count; 731.1Sdholland struct intrhand *ih_next; 741.1Sdholland int ih_level; 751.2Spgoyette int ih_irq; 761.1Sdholland}; 771.1Sdholland 781.2Spgoyettevoid clearsoftclock __P((void)); 791.1Sdhollandvoid clearsoftnet __P((void)); 801.1Sdhollandvoid softnet __P((void)); 811.1Sdhollandvoid softserial __P((void)); 821.1Sdholland 831.1Sdhollandint splraise __P((int)); 841.1Sdhollandint spllower __P((int)); 851.1Sdhollandvoid splx __P((int)); 861.1Sdhollandvoid softintr __P((int)); 871.1Sdholland 881.1Sdhollandextern volatile int astpending, tickspending; 891.1Sdhollandextern int imask[]; 901.1Sdholland 911.1Sdholland#define ICU_LEN 64 921.1Sdholland 931.1Sdholland/* Soft interrupt masks. */ 941.1Sdholland#define SIR_CLOCK 28 951.1Sdholland#define SIR_NET 29 961.1Sdholland#define SIR_SERIAL 30 971.1Sdholland#define SPL_CLOCK 31 981.1Sdholland 991.1Sdholland/* 1001.1Sdholland * Hardware interrupt masks 1011.1Sdholland */ 1021.1Sdholland#define splbio() splraise(imask[IPL_BIO]) 1031.1Sdholland#define splnet() splraise(imask[IPL_NET]) 1041.1Sdholland#define spltty() splraise(imask[IPL_TTY]) 1051.1Sdholland#define splaudio() splraise(imask[IPL_AUDIO]) 1061.1Sdholland#define splclock() splraise(imask[IPL_CLOCK]) 1071.1Sdholland#define splstatclock() splclock() 1081.1Sdholland#define splserial() splraise(imask[IPL_SERIAL]) 1091.1Sdholland 1101.1Sdholland#define spllpt() spltty() 1111.1Sdholland 1121.1Sdholland/* 1131.2Spgoyette * Software interrupt masks 1141.2Spgoyette * 1151.1Sdholland * NOTE: splsoftclock() is used by hardclock() to lower the priority from 1161.1Sdholland * clock to softclock before it calls softclock(). 1171.1Sdholland */ 1181.1Sdholland#define spllowersoftclock() spllower(imask[IPL_SOFTCLOCK]) 1191.1Sdholland#define splsoftclock() splraise(imask[IPL_SOFTCLOCK]) 1201.1Sdholland#define splsoftnet() splraise(imask[IPL_SOFTNET]) 1211.1Sdholland#define splsoftserial() splraise(imask[IPL_SOFTSERIAL]) 1221.1Sdholland 1231.1Sdholland/* 1241.1Sdholland * Miscellaneous 1251.1Sdholland */ 1261.1Sdholland#define splvm() splraise(imask[IPL_IMP]) 1271.1Sdholland#define splhigh() splraise(imask[IPL_HIGH]) 1281.1Sdholland#define splsched() splhigh() 1291.1Sdholland#define spllock() splhigh() 1301.1Sdholland#define spl0() spllower(0) 1311.1Sdholland 1321.1Sdholland#define setsoftclock() softintr(SIR_CLOCK) 1331.1Sdholland#define setsoftnet() softintr(SIR_NET) 1341.1Sdholland#define setsoftserial() softintr(SIR_SERIAL) 1351.1Sdholland 1361.1Sdhollandextern long intrcnt[]; 1371.1Sdholland 1381.1Sdholland#define CNT_IRQ0 0 1391.1Sdholland#define CNT_CLOCK 64 1401.1Sdholland#define CNT_SOFTCLOCK 65 1411.1Sdholland#define CNT_SOFTNET 66 1421.1Sdholland#define CNT_SOFTSERIAL 67 1431.1Sdholland 1441.1Sdholland#define MACPPC_IPI_HALT 0x01 1451.1Sdholland#define MACPPC_IPI_FLUSH_FPU 0x02 1461.1Sdholland 1471.1Sdholland#ifdef MULTIPROCESSOR 1481.1Sdhollandstruct cpu_info; 1491.1Sdhollandvoid macppc_send_ipi(volatile struct cpu_info *, int); 1501.1Sdholland#endif 1511.1Sdholland 1521.1Sdholland#endif /* _LOCORE */ 1531.1Sdholland 1541.1Sdholland#endif /* _MACPPC_INTR_H_ */ 1551.1Sdholland