intr.h revision 1.10 1 1.10 ad /* $NetBSD: intr.h,v 1.10 2007/12/03 15:34:21 ad Exp $ */
2 1.1 pk
3 1.1 pk /*-
4 1.1 pk * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 1.1 pk * All rights reserved.
6 1.1 pk *
7 1.1 pk * This code is derived from software contributed to The NetBSD Foundation
8 1.1 pk * by Paul Kranenburg.
9 1.1 pk *
10 1.1 pk * Redistribution and use in source and binary forms, with or without
11 1.1 pk * modification, are permitted provided that the following conditions
12 1.1 pk * are met:
13 1.1 pk * 1. Redistributions of source code must retain the above copyright
14 1.1 pk * notice, this list of conditions and the following disclaimer.
15 1.1 pk * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 pk * notice, this list of conditions and the following disclaimer in the
17 1.1 pk * documentation and/or other materials provided with the distribution.
18 1.1 pk * 3. All advertising materials mentioning features or use of this software
19 1.1 pk * must display the following acknowledgement:
20 1.1 pk * This product includes software developed by the NetBSD
21 1.1 pk * Foundation, Inc. and its contributors.
22 1.1 pk * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 pk * contributors may be used to endorse or promote products derived
24 1.1 pk * from this software without specific prior written permission.
25 1.1 pk *
26 1.1 pk * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 pk * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 pk * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 pk * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 pk * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 pk * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 pk * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 pk * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 pk * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 pk * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 pk * POSSIBILITY OF SUCH DAMAGE.
37 1.1 pk */
38 1.1 pk
39 1.4 pk /*
40 1.4 pk * Device class interrupt levels
41 1.4 pk * Note: sun4 and sun4c hardware only has software interrupt available
42 1.4 pk * on level 1, 4 or 6. This limits the choice of the various
43 1.4 pk * IPL_SOFT* symbols to one of those three values.
44 1.4 pk */
45 1.1 pk #define IPL_NONE 0 /* nothing */
46 1.1 pk #define IPL_SOFTCLOCK 1 /* timeouts */
47 1.1 pk #define IPL_SOFTNET 1 /* protocol stack */
48 1.10 ad #define IPL_SOFTBIO 1 /* block I/O */
49 1.4 pk #define IPL_SOFTAUDIO 4 /* second-level audio */
50 1.4 pk #define IPL_SOFTFDC 4 /* second-level floppy */
51 1.4 pk #define IPL_SOFTSERIAL 6 /* serial */
52 1.7 thorpej #define IPL_VM 7 /* memory allocation */
53 1.6 pk #define IPL_SCHED 11 /* scheduler */
54 1.4 pk #define IPL_HIGH 15 /* everything */
55 1.9 yamt
56 1.9 yamt /*
57 1.9 yamt * fd hardware, ts102, and tadpole microcontoller interrupts are at level 11
58 1.9 yamt */
59 1.9 yamt
60 1.10 ad #define IPL_FD IPL_SCHED
61 1.10 ad #define IPL_TS102 IPL_SCHED
62 1.9 yamt
63 1.9 yamt /*
64 1.9 yamt * zs hardware interrupts are at level 12
65 1.9 yamt * su (com) hardware interrupts are at level 13
66 1.9 yamt * IPL_SERIAL must protect them all.
67 1.9 yamt */
68 1.9 yamt
69 1.10 ad #define IPL_ZS IPL_HIGH
70 1.2 pk
71 1.4 pk #if defined(_KERNEL) && !defined(_LOCORE)
72 1.3 mrg void *
73 1.10 ad sparc_softintr_establish(int level, void (*fun)(void *), void *arg);
74 1.3 mrg
75 1.3 mrg void
76 1.10 ad sparc_softintr_disestablish(void *cookie);
77 1.3 mrg
78 1.5 pk /*
79 1.10 ad * NB that sparc_softintr_schedule() casts the cookie to an int *.
80 1.5 pk * This is to get the sic_pilreq member of the softintr_cookie
81 1.5 pk * structure, which is otherwise internal to intr.c.
82 1.5 pk */
83 1.5 pk #if defined(SUN4M) || defined(SUN4D)
84 1.8 uwe extern void raise(int, int);
85 1.5 pk #if !(defined(SUN4) || defined(SUN4C))
86 1.10 ad #define sparc_softintr_schedule(cookie) raise(0, *((int *) (cookie)))
87 1.5 pk #else /* both defined */
88 1.10 ad #define sparc_softintr_schedule(cookie) do { \
89 1.5 pk if (CPU_ISSUN4M || CPU_ISSUN4D) \
90 1.5 pk raise(0, *((int *)(cookie))); \
91 1.5 pk else \
92 1.5 pk ienab_bis(*((int *)(cookie))); \
93 1.5 pk } while (0)
94 1.5 pk #endif /* SUN4 || SUN4C */
95 1.5 pk #else /* SUN4M || SUN4D */
96 1.10 ad #define sparc_softintr_schedule(cookie) ienab_bis(*((int *) (cookie)))
97 1.5 pk #endif /* SUN4M || SUN4D */
98 1.5 pk
99 1.5 pk #if 0
100 1.10 ad void sparc_softintr_schedule(void *cookie);
101 1.5 pk #endif
102 1.4 pk #endif /* KERNEL && !_LOCORE */
103