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