1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_AVINTR_H 28 #define _SYS_AVINTR_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #include <sys/mutex.h> 33 #include <sys/dditypes.h> 34 #include <sys/ddi_intr.h> 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 /* 41 * Period of autovector structures (add this in to get the next level). 42 */ 43 #define MAXIPL 16 44 #define INT_IPL(x) (x) 45 #define AV_INT_SPURIOUS -1 46 47 #ifdef __STDC__ 48 typedef uint_t (*avfunc)(caddr_t, caddr_t); 49 #else 50 typedef uint_t (*avfunc)(); 51 #endif /* __STDC__ */ 52 53 struct autovec { 54 55 /* 56 * Interrupt handler and argument to pass to it. 57 */ 58 59 struct autovec *av_link; /* pointer to next on in chain */ 60 uint_t (*av_vector)(); 61 caddr_t av_intarg1; 62 caddr_t av_intarg2; 63 uint_t av_prilevel; /* priority level */ 64 65 /* 66 * Interrupt handle/id (like intrspec structure pointer) used to 67 * identify a specific instance of interrupt handler in case we 68 * have to remove the interrupt handler later. 69 * 70 */ 71 void *av_intr_id; 72 dev_info_t *av_dip; 73 }; 74 75 struct av_head { 76 struct autovec *avh_link; 77 ushort_t avh_hi_pri; 78 ushort_t avh_lo_pri; 79 }; 80 81 /* softing contains a bit field of software interrupts which are pending */ 82 struct softint { 83 int st_pending; 84 }; 85 86 #ifdef _KERNEL 87 88 extern kmutex_t av_lock; 89 extern ddi_softint_hdl_impl_t softlevel1_hdl; 90 extern int add_avintr(void *intr_id, int lvl, avfunc xxintr, char *name, 91 int vect, caddr_t arg1, caddr_t arg2, dev_info_t *); 92 extern int add_nmintr(int lvl, avfunc nmintr, char *name, caddr_t arg); 93 extern int add_avsoftintr(void *intr_id, int lvl, avfunc xxintr, 94 char *name, caddr_t arg1, caddr_t arg2); 95 extern int rem_avsoftintr(void *intr_id, int lvl, avfunc xxintr); 96 extern void update_avsoftintr_args(void *intr_id, int lvl, caddr_t arg2); 97 extern void rem_avintr(void *intr_id, int lvl, avfunc xxintr, int vect); 98 extern void wait_till_seen(int ipl); 99 extern uint_t softlevel1(caddr_t, caddr_t); 100 101 #endif /* _KERNEL */ 102 103 #ifdef __cplusplus 104 } 105 #endif 106 107 #endif /* _SYS_AVINTR_H */ 108