]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Alpha specific irq code. | |
3 | */ | |
4 | ||
1da177e4 LT |
5 | #include <linux/init.h> |
6 | #include <linux/sched.h> | |
7 | #include <linux/irq.h> | |
8 | #include <linux/kernel_stat.h> | |
cff52daf | 9 | #include <linux/module.h> |
1da177e4 LT |
10 | |
11 | #include <asm/machvec.h> | |
12 | #include <asm/dma.h> | |
979f8671 | 13 | #include <asm/perf_event.h> |
1da177e4 LT |
14 | |
15 | #include "proto.h" | |
16 | #include "irq_impl.h" | |
17 | ||
18 | /* Hack minimum IPL during interrupt processing for broken hardware. */ | |
19 | #ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK | |
20 | int __min_ipl; | |
cff52daf | 21 | EXPORT_SYMBOL(__min_ipl); |
1da177e4 LT |
22 | #endif |
23 | ||
24 | /* | |
25 | * Performance counter hook. A module can override this to | |
26 | * do something useful. | |
27 | */ | |
28 | static void | |
29 | dummy_perf(unsigned long vector, struct pt_regs *regs) | |
30 | { | |
31 | irq_err_count++; | |
32 | printk(KERN_CRIT "Performance counter interrupt!\n"); | |
33 | } | |
34 | ||
35 | void (*perf_irq)(unsigned long, struct pt_regs *) = dummy_perf; | |
cff52daf | 36 | EXPORT_SYMBOL(perf_irq); |
1da177e4 LT |
37 | |
38 | /* | |
39 | * The main interrupt entry point. | |
40 | */ | |
41 | ||
42 | asmlinkage void | |
43 | do_entInt(unsigned long type, unsigned long vector, | |
44 | unsigned long la_ptr, struct pt_regs *regs) | |
45 | { | |
7ca56053 | 46 | struct pt_regs *old_regs; |
1da177e4 LT |
47 | switch (type) { |
48 | case 0: | |
49 | #ifdef CONFIG_SMP | |
50 | handle_ipi(regs); | |
51 | return; | |
52 | #else | |
53 | irq_err_count++; | |
54 | printk(KERN_CRIT "Interprocessor interrupt? " | |
55 | "You must be kidding!\n"); | |
56 | #endif | |
57 | break; | |
58 | case 1: | |
3dbb8c62 | 59 | old_regs = set_irq_regs(regs); |
1da177e4 LT |
60 | #ifdef CONFIG_SMP |
61 | { | |
62 | long cpu; | |
4a89a04f IK |
63 | |
64 | local_irq_disable(); | |
1da177e4 LT |
65 | smp_percpu_timer_interrupt(regs); |
66 | cpu = smp_processor_id(); | |
67 | if (cpu != boot_cpuid) { | |
0b0f0b1c | 68 | kstat_incr_irqs_this_cpu(RTC_IRQ, irq_to_desc(RTC_IRQ)); |
1da177e4 | 69 | } else { |
3dbb8c62 | 70 | handle_irq(RTC_IRQ); |
1da177e4 LT |
71 | } |
72 | } | |
73 | #else | |
3dbb8c62 | 74 | handle_irq(RTC_IRQ); |
1da177e4 | 75 | #endif |
3dbb8c62 | 76 | set_irq_regs(old_regs); |
1da177e4 LT |
77 | return; |
78 | case 2: | |
4fa1970a AV |
79 | old_regs = set_irq_regs(regs); |
80 | alpha_mv.machine_check(vector, la_ptr); | |
81 | set_irq_regs(old_regs); | |
1da177e4 LT |
82 | return; |
83 | case 3: | |
7ca56053 AV |
84 | old_regs = set_irq_regs(regs); |
85 | alpha_mv.device_interrupt(vector); | |
86 | set_irq_regs(old_regs); | |
1da177e4 LT |
87 | return; |
88 | case 4: | |
89 | perf_irq(la_ptr, regs); | |
90 | return; | |
91 | default: | |
92 | printk(KERN_CRIT "Hardware intr %ld %lx? Huh?\n", | |
93 | type, vector); | |
94 | } | |
95 | printk(KERN_CRIT "PC = %016lx PS=%04lx\n", regs->pc, regs->ps); | |
96 | } | |
97 | ||
98 | void __init | |
99 | common_init_isa_dma(void) | |
100 | { | |
101 | outb(0, DMA1_RESET_REG); | |
102 | outb(0, DMA2_RESET_REG); | |
103 | outb(0, DMA1_CLR_MASK_REG); | |
104 | outb(0, DMA2_CLR_MASK_REG); | |
105 | } | |
106 | ||
107 | void __init | |
108 | init_IRQ(void) | |
109 | { | |
110 | /* Just in case the platform init_irq() causes interrupts/mchecks | |
111 | (as is the case with RAWHIDE, at least). */ | |
112 | wrent(entInt, 0); | |
113 | ||
114 | alpha_mv.init_irq(); | |
115 | } | |
116 | ||
117 | /* | |
118 | * machine error checks | |
119 | */ | |
120 | #define MCHK_K_TPERR 0x0080 | |
121 | #define MCHK_K_TCPERR 0x0082 | |
122 | #define MCHK_K_HERR 0x0084 | |
123 | #define MCHK_K_ECC_C 0x0086 | |
124 | #define MCHK_K_ECC_NC 0x0088 | |
125 | #define MCHK_K_OS_BUGCHECK 0x008A | |
126 | #define MCHK_K_PAL_BUGCHECK 0x0090 | |
127 | ||
128 | #ifndef CONFIG_SMP | |
129 | struct mcheck_info __mcheck_info; | |
130 | #endif | |
131 | ||
132 | void | |
133 | process_mcheck_info(unsigned long vector, unsigned long la_ptr, | |
4fa1970a | 134 | const char *machine, int expected) |
1da177e4 LT |
135 | { |
136 | struct el_common *mchk_header; | |
137 | const char *reason; | |
138 | ||
139 | /* | |
140 | * See if the machine check is due to a badaddr() and if so, | |
141 | * ignore it. | |
142 | */ | |
143 | ||
144 | #ifdef CONFIG_VERBOSE_MCHECK | |
145 | if (alpha_verbose_mcheck > 1) { | |
146 | printk(KERN_CRIT "%s machine check %s\n", machine, | |
147 | expected ? "expected." : "NOT expected!!!"); | |
148 | } | |
149 | #endif | |
150 | ||
151 | if (expected) { | |
152 | int cpu = smp_processor_id(); | |
153 | mcheck_expected(cpu) = 0; | |
154 | mcheck_taken(cpu) = 1; | |
155 | return; | |
156 | } | |
157 | ||
158 | mchk_header = (struct el_common *)la_ptr; | |
159 | ||
160 | printk(KERN_CRIT "%s machine check: vector=0x%lx pc=0x%lx code=0x%x\n", | |
4fa1970a | 161 | machine, vector, get_irq_regs()->pc, mchk_header->code); |
1da177e4 LT |
162 | |
163 | switch (mchk_header->code) { | |
164 | /* Machine check reasons. Defined according to PALcode sources. */ | |
165 | case 0x80: reason = "tag parity error"; break; | |
166 | case 0x82: reason = "tag control parity error"; break; | |
167 | case 0x84: reason = "generic hard error"; break; | |
168 | case 0x86: reason = "correctable ECC error"; break; | |
169 | case 0x88: reason = "uncorrectable ECC error"; break; | |
170 | case 0x8A: reason = "OS-specific PAL bugcheck"; break; | |
171 | case 0x90: reason = "callsys in kernel mode"; break; | |
172 | case 0x96: reason = "i-cache read retryable error"; break; | |
173 | case 0x98: reason = "processor detected hard error"; break; | |
174 | ||
175 | /* System specific (these are for Alcor, at least): */ | |
176 | case 0x202: reason = "system detected hard error"; break; | |
177 | case 0x203: reason = "system detected uncorrectable ECC error"; break; | |
178 | case 0x204: reason = "SIO SERR occurred on PCI bus"; break; | |
179 | case 0x205: reason = "parity error detected by core logic"; break; | |
180 | case 0x206: reason = "SIO IOCHK occurred on ISA bus"; break; | |
181 | case 0x207: reason = "non-existent memory error"; break; | |
182 | case 0x208: reason = "MCHK_K_DCSR"; break; | |
183 | case 0x209: reason = "PCI SERR detected"; break; | |
184 | case 0x20b: reason = "PCI data parity error detected"; break; | |
185 | case 0x20d: reason = "PCI address parity error detected"; break; | |
186 | case 0x20f: reason = "PCI master abort error"; break; | |
187 | case 0x211: reason = "PCI target abort error"; break; | |
188 | case 0x213: reason = "scatter/gather PTE invalid error"; break; | |
189 | case 0x215: reason = "flash ROM write error"; break; | |
190 | case 0x217: reason = "IOA timeout detected"; break; | |
191 | case 0x219: reason = "IOCHK#, EISA add-in board parity or other catastrophic error"; break; | |
192 | case 0x21b: reason = "EISA fail-safe timer timeout"; break; | |
193 | case 0x21d: reason = "EISA bus time-out"; break; | |
194 | case 0x21f: reason = "EISA software generated NMI"; break; | |
195 | case 0x221: reason = "unexpected ev5 IRQ[3] interrupt"; break; | |
196 | default: reason = "unknown"; break; | |
197 | } | |
198 | ||
199 | printk(KERN_CRIT "machine check type: %s%s\n", | |
200 | reason, mchk_header->retry ? " (retryable)" : ""); | |
201 | ||
4fa1970a | 202 | dik_show_regs(get_irq_regs(), NULL); |
1da177e4 LT |
203 | |
204 | #ifdef CONFIG_VERBOSE_MCHECK | |
205 | if (alpha_verbose_mcheck > 1) { | |
206 | /* Dump the logout area to give all info. */ | |
207 | unsigned long *ptr = (unsigned long *)la_ptr; | |
208 | long i; | |
209 | for (i = 0; i < mchk_header->size / sizeof(long); i += 2) { | |
210 | printk(KERN_CRIT " +%8lx %016lx %016lx\n", | |
211 | i*sizeof(long), ptr[i], ptr[i+1]); | |
212 | } | |
213 | } | |
214 | #endif /* CONFIG_VERBOSE_MCHECK */ | |
215 | } | |
216 | ||
217 | /* | |
218 | * The special RTC interrupt type. The interrupt itself was | |
219 | * processed by PALcode, and comes in via entInt vector 1. | |
220 | */ | |
221 | ||
222 | static void rtc_enable_disable(unsigned int irq) { } | |
223 | static unsigned int rtc_startup(unsigned int irq) { return 0; } | |
224 | ||
225 | struct irqaction timer_irqaction = { | |
226 | .handler = timer_interrupt, | |
d18ecedc | 227 | .flags = IRQF_DISABLED, |
1da177e4 LT |
228 | .name = "timer", |
229 | }; | |
230 | ||
44377f62 | 231 | static struct irq_chip rtc_irq_type = { |
8ab1221c | 232 | .name = "RTC", |
1da177e4 LT |
233 | .startup = rtc_startup, |
234 | .shutdown = rtc_enable_disable, | |
235 | .enable = rtc_enable_disable, | |
236 | .disable = rtc_enable_disable, | |
237 | .ack = rtc_enable_disable, | |
238 | .end = rtc_enable_disable, | |
239 | }; | |
240 | ||
241 | void __init | |
242 | init_rtc_irq(void) | |
243 | { | |
244 | irq_desc[RTC_IRQ].status = IRQ_DISABLED; | |
d1bef4ed | 245 | irq_desc[RTC_IRQ].chip = &rtc_irq_type; |
1da177e4 LT |
246 | setup_irq(RTC_IRQ, &timer_irqaction); |
247 | } | |
248 | ||
249 | /* Dummy irqactions. */ | |
250 | struct irqaction isa_cascade_irqaction = { | |
251 | .handler = no_action, | |
252 | .name = "isa-cascade" | |
253 | }; | |
254 | ||
255 | struct irqaction timer_cascade_irqaction = { | |
256 | .handler = no_action, | |
257 | .name = "timer-cascade" | |
258 | }; | |
259 | ||
260 | struct irqaction halt_switch_irqaction = { | |
261 | .handler = no_action, | |
262 | .name = "halt-switch" | |
263 | }; |