xref: /titanic_50/usr/src/uts/sun/sys/avintr.h (revision 0e42dee69ed771bf604dd1789fca9d77b5bbe302)
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"	/* SVr4 */
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/dditypes.h>
37 
38 /*
39  * Period of autovector structures (add this in to get the next level).
40  */
41 #define	MAXIPL	16
42 
43 /*
44  * These are only used by sun4m and later OBP versions
45  */
46 #define	INTLEVEL_ONBOARD	0x20
47 #define	INTLEVEL_SBUS		0x30
48 
49 #define	INT_LEVEL(lvl)	((lvl) & ~(MAXIPL-1))
50 #define	INT_IPL(lvl)	((lvl) & (MAXIPL-1))
51 
52 /*
53  * maximum number of autovectored interrupts at a given priority
54  * XXX: This is temporary until we come up with dynamic additions..
55  */
56 
57 #define	NVECT	17	/* 16 shared per level, +1 to end the list */
58 #define	AV_INT_SPURIOUS	-1
59 
60 #ifdef	__STDC__
61 typedef uint_t (*avfunc)(caddr_t, caddr_t);
62 #else
63 typedef uint_t (*avfunc)();
64 #endif	/* __STDC__ */
65 
66 
67 struct autovec {
68 
69 	/*
70 	 * Interrupt handler and argument to pass to it.
71 	 */
72 
73 	avfunc	av_vector;
74 	caddr_t	av_intarg;
75 
76 	/*
77 	 * Device that requested the interrupt, used as an id in case
78 	 * we have to remove it later.
79 	 */
80 	dev_info_t *av_devi;
81 
82 	/*
83 	 *
84 	 * If this flag is true, then this is a 'fast' interrupt reservation.
85 	 * Fast interrupts go directly out of the
86 	 * trap table for speed and do not go through the normal autovector
87 	 * interrupt setup code. There can be only one 'fast' interrupt
88 	 * per autovector level.
89 	 */
90 	uint_t	av_fast;
91 };
92 
93 #ifdef _KERNEL
94 
95 extern const uint_t maxautovec;
96 extern struct autovec * const vectorlist[];
97 
98 extern int add_avintr(dev_info_t *, int, avfunc, caddr_t);
99 extern void rem_avintr(dev_info_t *, int, avfunc);
100 extern int settrap(dev_info_t *, int, avfunc);
101 extern int not_serviced(int *, int, char *);
102 
103 extern void wait_till_seen(int);
104 
105 extern kmutex_t av_lock;
106 
107 #endif	/* _KERNEL */
108 
109 #ifdef	__cplusplus
110 }
111 #endif
112 
113 #endif /* _SYS_AVINTR_H */
114