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