1 /*- 2 * Copyright (c) 1993 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the University nor the names of its contributors 14 * may be used to endorse or promote products derived from this software 15 * without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 /* 30 * Copyright (c) 1997, Stefan Esser <se@freebsd.org> 31 * All rights reserved. 32 * 33 * Redistribution and use in source and binary forms, with or without 34 * modification, are permitted provided that the following conditions 35 * are met: 36 * 1. Redistributions of source code must retain the above copyright 37 * notice unmodified, this list of conditions, and the following 38 * disclaimer. 39 * 2. Redistributions in binary form must reproduce the above copyright 40 * notice, this list of conditions and the following disclaimer in the 41 * documentation and/or other materials provided with the distribution. 42 * 43 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 44 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 45 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 46 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 47 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 48 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 52 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53 * 54 * $FreeBSD: src/sys/sys/interrupt.h,v 1.9.2.1 2001/10/14 20:05:50 luigi Exp $ 55 * $FreeBSD: src/sys/i386/include/ipl.h,v 1.17.2.3 2002/12/17 18:04:02 sam Exp $ 56 * $DragonFly: src/sys/sys/interrupt.h,v 1.19 2008/05/14 11:59:24 sephe Exp $ 57 */ 58 59 #ifndef _SYS_INTERRUPT_H_ 60 #define _SYS_INTERRUPT_H_ 61 62 /* 63 * System hard and soft interrupt limits. Note that the architecture may 64 * further limit available hardware and software interrupts. 65 */ 66 #define MAX_HARDINTS 192 67 #define MAX_SOFTINTS 64 68 #define FIRST_SOFTINT MAX_HARDINTS 69 #define MAX_INTS (MAX_HARDINTS + MAX_SOFTINTS) 70 71 typedef void inthand2_t (void *, void *); 72 73 /* 74 * Software interrupt bit numbers in priority order. The priority only 75 * determines which swi will be dispatched next; a higher priority swi 76 * may be dispatched when a nested h/w interrupt handler returns. 77 */ 78 #define SWI_TTY (FIRST_SOFTINT + 0) 79 #define SWI_UNUSED01 (FIRST_SOFTINT + 1) 80 #define SWI_CAMNET (FIRST_SOFTINT + 2) 81 #define SWI_CRYPTO SWI_CAMNET 82 #define SWI_CAMBIO (FIRST_SOFTINT + 3) 83 #define SWI_VM (FIRST_SOFTINT + 4) 84 #define SWI_TQ (FIRST_SOFTINT + 5) 85 #define SWI_UNUSED02 (FIRST_SOFTINT + 6) 86 87 /* 88 * Corresponding interrupt-pending bits for spending. NOTE: i386 only 89 * supports 32 software interupts (due to its gd_spending mask). 90 */ 91 #define SWI_TTY_PENDING (1 << (SWI_TTY - FIRST_SOFTINT)) 92 #define SWI_UNUSED01_PENDING (1 << (SWI_UNUSED01 - FIRST_SOFTINT)) 93 #define SWI_CAMNET_PENDING (1 << (SWI_CAMNET - FIRST_SOFTINT)) 94 #define SWI_CRYPTO_PENDING SWI_CAMNET_PENDING 95 #define SWI_CAMBIO_PENDING (1 << (SWI_CAMBIO - FIRST_SOFTINT)) 96 #define SWI_VM_PENDING (1 << (SWI_VM - FIRST_SOFTINT)) 97 #define SWI_TQ_PENDING (1 << (SWI_TQ - FIRST_SOFTINT)) 98 #define SWI_UNUSED02_PENDING (1 << (SWI_UNUSED02 - FIRST_SOFTINT)) 99 100 #ifdef _KERNEL 101 102 struct intrframe; 103 struct thread; 104 struct lwkt_serialize; 105 void *register_swi(int intr, inthand2_t *handler, void *arg, 106 const char *name, 107 struct lwkt_serialize *serializer, int cpuid); 108 void *register_swi_mp(int intr, inthand2_t *handler, void *arg, 109 const char *name, 110 struct lwkt_serialize *serializer, int cpuid); 111 void *register_int(int intr, inthand2_t *handler, void *arg, 112 const char *name, 113 struct lwkt_serialize *serializer, int flags, 114 int cpuid); 115 long get_interrupt_counter(int intr, int cpuid); 116 117 void unregister_swi(void *id, int intr, int cpuid); 118 void unregister_int(void *id, int cpuid); 119 void register_randintr(int intr); 120 void unregister_randintr(int intr); 121 int next_registered_randintr(int intr); 122 void sched_ithd_soft(int intr); /* procedure called from MD */ 123 void sched_ithd_hard(int intr); /* procedure called from MD */ 124 125 #ifdef _KERNEL_VIRTUAL 126 void *register_int_virtual(int intr, inthand2_t *handler, void *arg, 127 const char *name, struct lwkt_serialize *serializer, int flags); 128 void unregister_int_virtual(void *id); 129 void sched_ithd_hard_virtual(int intr); 130 #endif 131 132 extern char eintrnames[]; /* end of intrnames[] */ 133 extern char intrnames[]; /* string table containing device names */ 134 135 #endif 136 #endif 137