1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 #ifndef _I386_INTR_H_
34 #define _I386_INTR_H_
35
36 #include <machine/intrdefs.h>
37
38 #ifndef _LOCORE
39
40 #ifdef MULTIPROCESSOR
41 #include <machine/i82489reg.h>
42 #include <machine/i82489var.h>
43 #include <machine/cpu.h>
44 #endif
45
46 extern volatile u_int32_t lapic_tpr;
47
48 extern volatile u_int32_t ipending;
49 extern int imask[];
50 extern int iunmask[];
51
52 #define IMASK(level) imask[IPL(level)]
53 #define IUNMASK(level) iunmask[IPL(level)]
54
55 extern void Xspllower(void);
56
57 extern int splraise(int);
58 extern int spllower(int);
59 extern void splx(int);
60 extern void softintr(int, int);
61
62
63
64
65
66
67
68
69
70 #define __splbarrier() __asm __volatile("":::"memory")
71
72
73 #ifdef DIAGNOSTIC
74
75
76
77
78 void splassert_fail(int, int, const char *);
79 extern int splassert_ctl;
80 void splassert_check(int, const char *);
81 #define splassert(__wantipl) do { \
82 if (splassert_ctl > 0) { \
83 splassert_check(__wantipl, __func__); \
84 } \
85 } while (0)
86 #else
87 #define splassert(wantipl) do { } while (0)
88 #endif
89
90
91
92
93
94 #define _SPLRAISE(ocpl, ncpl) \
95 ocpl = lapic_tpr; \
96 if (ncpl > ocpl) \
97 lapic_tpr = ncpl
98
99
100 #define _SPLX(ncpl) \
101 lapic_tpr = ncpl; \
102 if (ipending & IUNMASK(ncpl)) \
103 Xspllower()
104
105
106
107
108 #define splbio() splraise(IPL_BIO)
109 #define splnet() splraise(IPL_NET)
110 #define spltty() splraise(IPL_TTY)
111 #define splaudio() splraise(IPL_AUDIO)
112 #define splclock() splraise(IPL_CLOCK)
113 #define splstatclock() splhigh()
114 #define splipi() splraise(IPL_IPI)
115
116
117
118
119 #define splsoftclock() splraise(IPL_SOFTCLOCK)
120 #define splsoftnet() splraise(IPL_SOFTNET)
121 #define splsofttty() splraise(IPL_SOFTTTY)
122
123
124
125
126 #define splvm() splraise(IPL_VM)
127 #define splhigh() splraise(IPL_HIGH)
128 #define splsched() splraise(IPL_SCHED)
129 #define spllock() splhigh()
130 #define spl0() spllower(IPL_NONE)
131
132 #define setsoftclock() softintr(1 << SIR_CLOCK, IPL_SOFTCLOCK)
133 #define setsoftnet() softintr(1 << SIR_NET, IPL_SOFTNET)
134 #define setsofttty() softintr(1 << SIR_TTY, IPL_SOFTTTY)
135
136 struct cpu_info;
137
138 #ifdef MULTIPROCESSOR
139 int i386_send_ipi(struct cpu_info *, int);
140 int i386_fast_ipi(struct cpu_info *, int);
141 void i386_broadcast_ipi(int);
142 void i386_multicast_ipi(int, int);
143 void i386_ipi_handler(void);
144 void i386_ipi_microset(struct cpu_info *);
145 void i386_intlock(int);
146 void i386_intunlock(int);
147 void i386_softintlock(void);
148 void i386_softintunlock(void);
149 void i386_setperf_ipi(struct cpu_info *);
150
151 extern void (*ipifunc[I386_NIPI])(struct cpu_info *);
152 #endif
153
154 #endif
155
156 #endif