This source file includes following definitions.
- mac_init_IRQ
- mac_irq_enable
- mac_irq_disable
- mac_irq_startup
- mac_irq_shutdown
- mac_nmi_handler
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111 #include <linux/types.h>
112 #include <linux/kernel.h>
113 #include <linux/sched.h>
114 #include <linux/sched/debug.h>
115 #include <linux/interrupt.h>
116 #include <linux/irq.h>
117 #include <linux/delay.h>
118
119 #include <asm/irq.h>
120 #include <asm/macintosh.h>
121 #include <asm/macints.h>
122 #include <asm/mac_via.h>
123 #include <asm/mac_psc.h>
124 #include <asm/mac_oss.h>
125 #include <asm/mac_iop.h>
126 #include <asm/mac_baboon.h>
127 #include <asm/hwtest.h>
128 #include <asm/irq_regs.h>
129
130 extern void show_registers(struct pt_regs *);
131
132 irqreturn_t mac_nmi_handler(int, void *);
133
134 static unsigned int mac_irq_startup(struct irq_data *);
135 static void mac_irq_shutdown(struct irq_data *);
136
137 static struct irq_chip mac_irq_chip = {
138 .name = "mac",
139 .irq_enable = mac_irq_enable,
140 .irq_disable = mac_irq_disable,
141 .irq_startup = mac_irq_startup,
142 .irq_shutdown = mac_irq_shutdown,
143 };
144
145 void __init mac_init_IRQ(void)
146 {
147 m68k_setup_irq_controller(&mac_irq_chip, handle_simple_irq, IRQ_USER,
148 NUM_MAC_SOURCES - IRQ_USER);
149
150
151
152
153
154
155 if (oss_present)
156 oss_register_interrupts();
157 else
158 via_register_interrupts();
159 if (psc)
160 psc_register_interrupts();
161 if (baboon_present)
162 baboon_register_interrupts();
163 iop_register_interrupts();
164 if (request_irq(IRQ_AUTO_7, mac_nmi_handler, 0, "NMI",
165 mac_nmi_handler))
166 pr_err("Couldn't register NMI\n");
167 }
168
169
170
171
172
173
174
175
176 void mac_irq_enable(struct irq_data *data)
177 {
178 int irq = data->irq;
179 int irq_src = IRQ_SRC(irq);
180
181 switch(irq_src) {
182 case 1:
183 case 2:
184 case 7:
185 if (oss_present)
186 oss_irq_enable(irq);
187 else
188 via_irq_enable(irq);
189 break;
190 case 3:
191 case 4:
192 case 5:
193 case 6:
194 if (psc)
195 psc_irq_enable(irq);
196 else if (oss_present)
197 oss_irq_enable(irq);
198 break;
199 case 8:
200 if (baboon_present)
201 baboon_irq_enable(irq);
202 break;
203 }
204 }
205
206 void mac_irq_disable(struct irq_data *data)
207 {
208 int irq = data->irq;
209 int irq_src = IRQ_SRC(irq);
210
211 switch(irq_src) {
212 case 1:
213 case 2:
214 case 7:
215 if (oss_present)
216 oss_irq_disable(irq);
217 else
218 via_irq_disable(irq);
219 break;
220 case 3:
221 case 4:
222 case 5:
223 case 6:
224 if (psc)
225 psc_irq_disable(irq);
226 else if (oss_present)
227 oss_irq_disable(irq);
228 break;
229 case 8:
230 if (baboon_present)
231 baboon_irq_disable(irq);
232 break;
233 }
234 }
235
236 static unsigned int mac_irq_startup(struct irq_data *data)
237 {
238 int irq = data->irq;
239
240 if (IRQ_SRC(irq) == 7 && !oss_present)
241 via_nubus_irq_startup(irq);
242 else
243 mac_irq_enable(data);
244
245 return 0;
246 }
247
248 static void mac_irq_shutdown(struct irq_data *data)
249 {
250 int irq = data->irq;
251
252 if (IRQ_SRC(irq) == 7 && !oss_present)
253 via_nubus_irq_shutdown(irq);
254 else
255 mac_irq_disable(data);
256 }
257
258 static volatile int in_nmi;
259
260 irqreturn_t mac_nmi_handler(int irq, void *dev_id)
261 {
262 if (in_nmi)
263 return IRQ_HANDLED;
264 in_nmi = 1;
265
266 pr_info("Non-Maskable Interrupt\n");
267 show_registers(get_irq_regs());
268
269 in_nmi = 0;
270 return IRQ_HANDLED;
271 }