intr.h revision 1.3 1 /* $NetBSD: intr.h,v 1.3 1996/11/17 02:03:10 cgd Exp $ */
2
3 /*
4 * Copyright (c) 1996 Carnegie-Mellon University.
5 * All rights reserved.
6 *
7 * Author: Chris G. Demetriou
8 *
9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation.
14 *
15 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 *
19 * Carnegie Mellon requests users of this software to return to
20 *
21 * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
25 *
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
28 */
29
30 #ifndef _ALPHA_INTR_H_
31 #define _ALPHA_INTR_H_
32
33 #include <sys/queue.h>
34
35 #define IPL_NONE 0 /* disable only this interrupt */
36 #define IPL_BIO 1 /* disable block I/O interrupts */
37 #define IPL_NET 2 /* disable network interrupts */
38 #define IPL_TTY 3 /* disable terminal interrupts */
39 #define IPL_CLOCK 4 /* disable clock interrupts */
40 #define IPL_HIGH 5 /* disable all interrupts */
41
42 #define IST_UNUSABLE -1 /* interrupt cannot be used */
43 #define IST_NONE 0 /* none (dummy) */
44 #define IST_PULSE 1 /* pulsed */
45 #define IST_EDGE 2 /* edge-triggered */
46 #define IST_LEVEL 3 /* level-triggered */
47
48 #define splx(s) \
49 (s == ALPHA_PSL_IPL_0 ? spl0() : alpha_pal_swpipl(s))
50 #define splsoft() alpha_pal_swpipl(ALPHA_PSL_IPL_SOFT)
51 #define splsoftclock() splsoft()
52 #define splsoftnet() splsoft()
53 #define splnet() alpha_pal_swpipl(ALPHA_PSL_IPL_IO)
54 #define splbio() alpha_pal_swpipl(ALPHA_PSL_IPL_IO)
55 #define splimp() alpha_pal_swpipl(ALPHA_PSL_IPL_IO)
56 #define spltty() alpha_pal_swpipl(ALPHA_PSL_IPL_IO)
57 #define splclock() alpha_pal_swpipl(ALPHA_PSL_IPL_CLOCK)
58 #define splstatclock() alpha_pal_swpipl(ALPHA_PSL_IPL_CLOCK)
59 #define splhigh() alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH)
60
61 /*
62 * simulated software interrupt register
63 */
64 extern u_int64_t ssir;
65
66 #define SIR_NET 0x1
67 #define SIR_CLOCK 0x2
68
69 #define siroff(x) ssir &= ~(x)
70 #define setsoftnet() ssir |= SIR_NET
71 #define setsoftclock() ssir |= SIR_CLOCK
72
73 /*
74 * Alpha shared-interrupt-line common code.
75 */
76
77 struct alpha_shared_intrhand {
78 TAILQ_ENTRY(alpha_shared_intrhand)
79 ih_q;
80 int (*ih_fn) __P((void *));
81 void *ih_arg;
82 int ih_level;
83 };
84
85 struct alpha_shared_intr {
86 TAILQ_HEAD(,alpha_shared_intrhand)
87 intr_q;
88 int intr_sharetype;
89 int intr_dfltsharetype;
90 int intr_nstrays;
91 int intr_maxstrays;
92 };
93
94 struct alpha_shared_intr *alpha_shared_intr_alloc __P((unsigned int));
95 int alpha_shared_intr_dispatch __P((struct alpha_shared_intr *,
96 unsigned int));
97 void *alpha_shared_intr_establish __P((struct alpha_shared_intr *,
98 unsigned int, int, int, int (*)(void *), void *, const char *));
99 int alpha_shared_intr_get_sharetype __P((struct alpha_shared_intr *,
100 unsigned int));
101 int alpha_shared_intr_isactive __P((struct alpha_shared_intr *,
102 unsigned int));
103 void alpha_shared_intr_set_dfltsharetype __P((struct alpha_shared_intr *,
104 unsigned int, int));
105 void alpha_shared_intr_set_maxstrays __P((struct alpha_shared_intr *,
106 unsigned int, int));
107 void alpha_shared_intr_stray __P((struct alpha_shared_intr *, unsigned int,
108 const char *));
109
110 #endif
111