intr.h revision 1.11.8.2 1 1.11.8.2 thorpej /* $NetBSD: intr.h,v 1.11.8.2 2001/04/13 23:30:03 thorpej Exp $ */
2 1.11.8.2 thorpej
3 1.11.8.2 thorpej /*
4 1.11.8.2 thorpej * Copyright (c) 1998 Jonathan Stone. All rights reserved.
5 1.11.8.2 thorpej *
6 1.11.8.2 thorpej * Redistribution and use in source and binary forms, with or without
7 1.11.8.2 thorpej * modification, are permitted provided that the following conditions
8 1.11.8.2 thorpej * are met:
9 1.11.8.2 thorpej * 1. Redistributions of source code must retain the above copyright
10 1.11.8.2 thorpej * notice, this list of conditions and the following disclaimer.
11 1.11.8.2 thorpej * 2. Redistributions in binary form must reproduce the above copyright
12 1.11.8.2 thorpej * notice, this list of conditions and the following disclaimer in the
13 1.11.8.2 thorpej * documentation and/or other materials provided with the distribution.
14 1.11.8.2 thorpej * 3. All advertising materials mentioning features or use of this software
15 1.11.8.2 thorpej * must display the following acknowledgement:
16 1.11.8.2 thorpej * This product includes software developed by Jonathan Stone for
17 1.11.8.2 thorpej * the NetBSD Project.
18 1.11.8.2 thorpej * 4. The name of the author may not be used to endorse or promote products
19 1.11.8.2 thorpej * derived from this software without specific prior written permission.
20 1.11.8.2 thorpej *
21 1.11.8.2 thorpej * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 1.11.8.2 thorpej * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 1.11.8.2 thorpej * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 1.11.8.2 thorpej * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 1.11.8.2 thorpej * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 1.11.8.2 thorpej * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 1.11.8.2 thorpej * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 1.11.8.2 thorpej * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 1.11.8.2 thorpej * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 1.11.8.2 thorpej * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 1.11.8.2 thorpej */
32 1.11.8.2 thorpej
33 1.11.8.2 thorpej #ifndef _MACHINE_INTR_H_
34 1.11.8.2 thorpej #define _MACHINE_INTR_H_
35 1.11.8.2 thorpej
36 1.11.8.2 thorpej #define IPL_NONE 0 /* disable only this interrupt */
37 1.11.8.2 thorpej #define IPL_BIO 1 /* disable block I/O interrupts */
38 1.11.8.2 thorpej #define IPL_NET 2 /* disable network interrupts */
39 1.11.8.2 thorpej #define IPL_TTY 3 /* disable terminal interrupts */
40 1.11.8.2 thorpej #define IPL_CLOCK 4 /* disable clock interrupts */
41 1.11.8.2 thorpej #define IPL_STATCLOCK 5 /* disable profiling interrupts */
42 1.11.8.2 thorpej #define IPL_SERIAL 6 /* disable serial hardware interrupts */
43 1.11.8.2 thorpej #define IPL_HIGH 7 /* disable all interrupts */
44 1.11.8.2 thorpej
45 1.11.8.2 thorpej #ifdef _KERNEL
46 1.11.8.2 thorpej #ifndef _LOCORE
47 1.11.8.2 thorpej #include <mips/cpuregs.h>
48 1.11.8.2 thorpej
49 1.11.8.2 thorpej extern int _splraise __P((int));
50 1.11.8.2 thorpej extern int _spllower __P((int));
51 1.11.8.2 thorpej extern int _splset __P((int));
52 1.11.8.2 thorpej extern int _splget __P((void));
53 1.11.8.2 thorpej extern void _splnone __P((void));
54 1.11.8.2 thorpej extern void _setsoftintr __P((int));
55 1.11.8.2 thorpej extern void _clrsoftintr __P((int));
56 1.11.8.2 thorpej
57 1.11.8.2 thorpej /*
58 1.11.8.2 thorpej * software simulated interrupt
59 1.11.8.2 thorpej */
60 1.11.8.2 thorpej #define SIR_NET 0x01
61 1.11.8.2 thorpej #define SIR_SERIAL 0x02
62 1.11.8.2 thorpej
63 1.11.8.2 thorpej #define setsoft(x) do { \
64 1.11.8.2 thorpej extern u_int ssir; \
65 1.11.8.2 thorpej int s; \
66 1.11.8.2 thorpej \
67 1.11.8.2 thorpej s = splhigh(); \
68 1.11.8.2 thorpej ssir |= (x); \
69 1.11.8.2 thorpej _setsoftintr(MIPS_SOFT_INT_MASK_1); \
70 1.11.8.2 thorpej splx(s); \
71 1.11.8.2 thorpej } while (0)
72 1.11.8.2 thorpej
73 1.11.8.2 thorpej #define setsoftclock() _setsoftintr(MIPS_SOFT_INT_MASK_0)
74 1.11.8.2 thorpej #define setsoftnet() setsoft(SIR_NET)
75 1.11.8.2 thorpej #define setsoftserial() setsoft(SIR_SERIAL)
76 1.11.8.2 thorpej
77 1.11.8.2 thorpej /*
78 1.11.8.2 thorpej * nesting interrupt masks.
79 1.11.8.2 thorpej */
80 1.11.8.2 thorpej #define MIPS_INT_MASK_SPL_SOFT0 MIPS_SOFT_INT_MASK_0
81 1.11.8.2 thorpej #define MIPS_INT_MASK_SPL_SOFT1 (MIPS_SOFT_INT_MASK_1|MIPS_INT_MASK_SPL_SOFT0)
82 1.11.8.2 thorpej #define MIPS_INT_MASK_SPL0 (MIPS_INT_MASK_0|MIPS_INT_MASK_SPL_SOFT1)
83 1.11.8.2 thorpej #define MIPS_INT_MASK_SPL1 (MIPS_INT_MASK_1|MIPS_INT_MASK_SPL0)
84 1.11.8.2 thorpej #define MIPS_INT_MASK_SPL2 (MIPS_INT_MASK_2|MIPS_INT_MASK_SPL1)
85 1.11.8.2 thorpej #define MIPS_INT_MASK_SPL3 (MIPS_INT_MASK_3|MIPS_INT_MASK_SPL2)
86 1.11.8.2 thorpej #define MIPS_INT_MASK_SPL4 (MIPS_INT_MASK_4|MIPS_INT_MASK_SPL3)
87 1.11.8.2 thorpej #define MIPS_INT_MASK_SPL5 (MIPS_INT_MASK_5|MIPS_INT_MASK_SPL4)
88 1.11.8.2 thorpej
89 1.11.8.2 thorpej #define spl0() (void)_spllower(0)
90 1.11.8.2 thorpej #define splx(s) (void)_splset(s)
91 1.11.8.2 thorpej #define splbio() _splraise(MIPS_INT_MASK_SPL0)
92 1.11.8.2 thorpej #define splnet() _splraise(MIPS_INT_MASK_SPL1)
93 1.11.8.2 thorpej #define spltty() _splraise(MIPS_INT_MASK_SPL1)
94 1.11.8.2 thorpej #define splvm() _splraise(MIPS_INT_MASK_SPL1)
95 1.11.8.2 thorpej #define splclock() _splraise(MIPS_INT_MASK_SPL2)
96 1.11.8.2 thorpej #define splstatclock() _splraise(MIPS_INT_MASK_SPL2)
97 1.11.8.2 thorpej #define splhigh() _splraise(MIPS_INT_MASK_SPL2)
98 1.11.8.2 thorpej #define splsched() splhigh()
99 1.11.8.2 thorpej #define spllock() splhigh()
100 1.11.8.2 thorpej
101 1.11.8.2 thorpej #define splsoftclock() _splraise(MIPS_INT_MASK_SPL_SOFT0)
102 1.11.8.2 thorpej #define splsoftnet() _splraise(MIPS_INT_MASK_SPL_SOFT1)
103 1.11.8.2 thorpej #define spllowersoftclock() _spllower(MIPS_INT_MASK_SPL_SOFT0)
104 1.11.8.2 thorpej
105 1.11.8.2 thorpej /*
106 1.11.8.2 thorpej * Index into intrcnt[], which is defined in locore
107 1.11.8.2 thorpej */
108 1.11.8.2 thorpej #define SOFTCLOCK_INTR 0
109 1.11.8.2 thorpej #define SOFTNET_INTR 1
110 1.11.8.2 thorpej #define SERIAL0_INTR 2
111 1.11.8.2 thorpej #define SERIAL1_INTR 3
112 1.11.8.2 thorpej #define SERIAL2_INTR 4
113 1.11.8.2 thorpej #define LANCE_INTR 5
114 1.11.8.2 thorpej #define SCSI_INTR 6
115 1.11.8.2 thorpej #define ERROR_INTR 7
116 1.11.8.2 thorpej #define HARDCLOCK_INTR 8
117 1.11.8.2 thorpej #define FPU_INTR 9
118 1.11.8.2 thorpej #define SLOT1_INTR 10
119 1.11.8.2 thorpej #define SLOT2_INTR 11
120 1.11.8.2 thorpej #define SLOT3_INTR 12
121 1.11.8.2 thorpej #define FLOPPY_INTR 13
122 1.11.8.2 thorpej #define STRAY_INTR 14
123 1.11.8.2 thorpej
124 1.11.8.2 thorpej extern u_int intrcnt[];
125 1.11.8.2 thorpej
126 1.11.8.2 thorpej /* handle i/o device interrupts */
127 1.11.8.2 thorpej extern void news3400_intr __P((u_int, u_int, u_int, u_int));
128 1.11.8.2 thorpej extern void news5000_intr __P((u_int, u_int, u_int, u_int));
129 1.11.8.2 thorpej
130 1.11.8.2 thorpej extern void (*enable_intr) __P((void));
131 1.11.8.2 thorpej extern void (*disable_intr) __P((void));
132 1.11.8.2 thorpej
133 1.11.8.2 thorpej #endif /* !_LOCORE */
134 1.11.8.2 thorpej #endif /* _KERNEL */
135 1.11.8.2 thorpej #endif /* _MACHINE_INTR_H_ */
136