xref: /titanic_50/usr/src/uts/common/sys/avintr.h (revision 2df1fe9ca32bb227b9158c67f5c00b54c20b10fd)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_AVINTR_H
27 #define	_SYS_AVINTR_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/mutex.h>
32 #include <sys/dditypes.h>
33 #include <sys/ddi_intr.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 /*
40  * Period of autovector structures (add this in to get the next level).
41  */
42 #define	MAXIPL	16
43 #define	INT_IPL(x) (x)
44 #define	AV_INT_SPURIOUS	-1
45 
46 #ifdef	__STDC__
47 typedef uint_t (*avfunc)(caddr_t, caddr_t);
48 #else
49 typedef uint_t (*avfunc)();
50 #endif	/* __STDC__ */
51 
52 struct autovec {
53 
54 	/*
55 	 * Interrupt handler and argument to pass to it.
56 	 */
57 
58 	struct autovec *av_link;	/* pointer to next on in chain */
59 	uint_t	(*av_vector)();
60 	caddr_t	av_intarg1;
61 	caddr_t	av_intarg2;
62 	uint64_t *av_ticksp;
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 softlevel_hdl[];
90 extern ddi_softint_hdl_impl_t softlevel1_hdl;
91 extern int add_avintr(void *intr_id, int lvl, avfunc xxintr, char *name,
92 	int vect, caddr_t arg1, caddr_t arg2, uint64_t *, dev_info_t *);
93 extern int add_nmintr(int lvl, avfunc nmintr, char *name, caddr_t arg);
94 extern int add_avsoftintr(void *intr_id, int lvl, avfunc xxintr,
95 	char *name, caddr_t arg1, caddr_t arg2);
96 extern int rem_avsoftintr(void *intr_id, int lvl, avfunc xxintr);
97 extern int av_softint_movepri(void *intr_id, int old_lvl);
98 extern void update_avsoftintr_args(void *intr_id, int lvl, caddr_t arg2);
99 extern void rem_avintr(void *intr_id, int lvl, avfunc xxintr, int vect);
100 extern void wait_till_seen(int ipl);
101 extern uint_t softlevel1(caddr_t, caddr_t);
102 
103 #endif	/* _KERNEL */
104 
105 #ifdef	__cplusplus
106 }
107 #endif
108 
109 #endif /* _SYS_AVINTR_H */
110