blob: 772ddfdb71a8e67af8f20e38ff7f8def9af3b943 [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>
Al Virocff52da2006-10-11 17:40:22 +01009#include <linux/module.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010
11#include <asm/machvec.h>
12#include <asm/dma.h>
Michael Cree979f8672010-08-09 17:20:08 -070013#include <asm/perf_event.h>
David Howellsec221202012-03-28 18:11:12 +010014#include <asm/mce.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
16#include "proto.h"
17#include "irq_impl.h"
18
19/* Hack minimum IPL during interrupt processing for broken hardware. */
20#ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK
21int __min_ipl;
Al Virocff52da2006-10-11 17:40:22 +010022EXPORT_SYMBOL(__min_ipl);
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#endif
24
25/*
26 * Performance counter hook. A module can override this to
27 * do something useful.
28 */
29static void
30dummy_perf(unsigned long vector, struct pt_regs *regs)
31{
32 irq_err_count++;
33 printk(KERN_CRIT "Performance counter interrupt!\n");
34}
35
36void (*perf_irq)(unsigned long, struct pt_regs *) = dummy_perf;
Al Virocff52da2006-10-11 17:40:22 +010037EXPORT_SYMBOL(perf_irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
39/*
40 * The main interrupt entry point.
41 */
42
43asmlinkage void
44do_entInt(unsigned long type, unsigned long vector,
45 unsigned long la_ptr, struct pt_regs *regs)
46{
Al Viro7ca56052006-10-08 14:36:08 +010047 struct pt_regs *old_regs;
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 switch (type) {
49 case 0:
50#ifdef CONFIG_SMP
51 handle_ipi(regs);
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:
Al Viro3dbb8c62006-10-08 14:37:32 +010060 old_regs = set_irq_regs(regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -070061#ifdef CONFIG_SMP
62 {
63 long cpu;
Ivan Kokshaysky4a89a042005-07-01 16:46:26 +040064
65 local_irq_disable();
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 smp_percpu_timer_interrupt(regs);
67 cpu = smp_processor_id();
68 if (cpu != boot_cpuid) {
Yinghai Lu0b0f0b12009-01-11 13:35:56 -080069 kstat_incr_irqs_this_cpu(RTC_IRQ, irq_to_desc(RTC_IRQ));
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 } else {
Al Viro3dbb8c62006-10-08 14:37:32 +010071 handle_irq(RTC_IRQ);
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 }
73 }
74#else
Al Viro3dbb8c62006-10-08 14:37:32 +010075 handle_irq(RTC_IRQ);
Linus Torvalds1da177e2005-04-16 15:20:36 -070076#endif
Al Viro3dbb8c62006-10-08 14:37:32 +010077 set_irq_regs(old_regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 return;
79 case 2:
Al Viro4fa19702006-10-08 14:44:38 +010080 old_regs = set_irq_regs(regs);
81 alpha_mv.machine_check(vector, la_ptr);
82 set_irq_regs(old_regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 return;
84 case 3:
Al Viro7ca56052006-10-08 14:36:08 +010085 old_regs = set_irq_regs(regs);
86 alpha_mv.device_interrupt(vector);
87 set_irq_regs(old_regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 return;
89 case 4:
90 perf_irq(la_ptr, regs);
91 return;
92 default:
93 printk(KERN_CRIT "Hardware intr %ld %lx? Huh?\n",
94 type, vector);
95 }
96 printk(KERN_CRIT "PC = %016lx PS=%04lx\n", regs->pc, regs->ps);
97}
98
99void __init
100common_init_isa_dma(void)
101{
102 outb(0, DMA1_RESET_REG);
103 outb(0, DMA2_RESET_REG);
104 outb(0, DMA1_CLR_MASK_REG);
105 outb(0, DMA2_CLR_MASK_REG);
106}
107
108void __init
109init_IRQ(void)
110{
111 /* Just in case the platform init_irq() causes interrupts/mchecks
112 (as is the case with RAWHIDE, at least). */
113 wrent(entInt, 0);
114
115 alpha_mv.init_irq();
116}
117
118/*
119 * machine error checks
120 */
121#define MCHK_K_TPERR 0x0080
122#define MCHK_K_TCPERR 0x0082
123#define MCHK_K_HERR 0x0084
124#define MCHK_K_ECC_C 0x0086
125#define MCHK_K_ECC_NC 0x0088
126#define MCHK_K_OS_BUGCHECK 0x008A
127#define MCHK_K_PAL_BUGCHECK 0x0090
128
129#ifndef CONFIG_SMP
130struct mcheck_info __mcheck_info;
131#endif
132
133void
134process_mcheck_info(unsigned long vector, unsigned long la_ptr,
Al Viro4fa19702006-10-08 14:44:38 +0100135 const char *machine, int expected)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136{
137 struct el_common *mchk_header;
138 const char *reason;
139
140 /*
141 * See if the machine check is due to a badaddr() and if so,
142 * ignore it.
143 */
144
145#ifdef CONFIG_VERBOSE_MCHECK
146 if (alpha_verbose_mcheck > 1) {
147 printk(KERN_CRIT "%s machine check %s\n", machine,
148 expected ? "expected." : "NOT expected!!!");
149 }
150#endif
151
152 if (expected) {
153 int cpu = smp_processor_id();
154 mcheck_expected(cpu) = 0;
155 mcheck_taken(cpu) = 1;
156 return;
157 }
158
159 mchk_header = (struct el_common *)la_ptr;
160
161 printk(KERN_CRIT "%s machine check: vector=0x%lx pc=0x%lx code=0x%x\n",
Al Viro4fa19702006-10-08 14:44:38 +0100162 machine, vector, get_irq_regs()->pc, mchk_header->code);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163
164 switch (mchk_header->code) {
165 /* Machine check reasons. Defined according to PALcode sources. */
166 case 0x80: reason = "tag parity error"; break;
167 case 0x82: reason = "tag control parity error"; break;
168 case 0x84: reason = "generic hard error"; break;
169 case 0x86: reason = "correctable ECC error"; break;
170 case 0x88: reason = "uncorrectable ECC error"; break;
171 case 0x8A: reason = "OS-specific PAL bugcheck"; break;
172 case 0x90: reason = "callsys in kernel mode"; break;
173 case 0x96: reason = "i-cache read retryable error"; break;
174 case 0x98: reason = "processor detected hard error"; break;
175
176 /* System specific (these are for Alcor, at least): */
177 case 0x202: reason = "system detected hard error"; break;
178 case 0x203: reason = "system detected uncorrectable ECC error"; break;
179 case 0x204: reason = "SIO SERR occurred on PCI bus"; break;
180 case 0x205: reason = "parity error detected by core logic"; break;
181 case 0x206: reason = "SIO IOCHK occurred on ISA bus"; break;
182 case 0x207: reason = "non-existent memory error"; break;
183 case 0x208: reason = "MCHK_K_DCSR"; break;
184 case 0x209: reason = "PCI SERR detected"; break;
185 case 0x20b: reason = "PCI data parity error detected"; break;
186 case 0x20d: reason = "PCI address parity error detected"; break;
187 case 0x20f: reason = "PCI master abort error"; break;
188 case 0x211: reason = "PCI target abort error"; break;
189 case 0x213: reason = "scatter/gather PTE invalid error"; break;
190 case 0x215: reason = "flash ROM write error"; break;
191 case 0x217: reason = "IOA timeout detected"; break;
192 case 0x219: reason = "IOCHK#, EISA add-in board parity or other catastrophic error"; break;
193 case 0x21b: reason = "EISA fail-safe timer timeout"; break;
194 case 0x21d: reason = "EISA bus time-out"; break;
195 case 0x21f: reason = "EISA software generated NMI"; break;
196 case 0x221: reason = "unexpected ev5 IRQ[3] interrupt"; break;
197 default: reason = "unknown"; break;
198 }
199
200 printk(KERN_CRIT "machine check type: %s%s\n",
201 reason, mchk_header->retry ? " (retryable)" : "");
202
Al Viro4fa19702006-10-08 14:44:38 +0100203 dik_show_regs(get_irq_regs(), NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204
205#ifdef CONFIG_VERBOSE_MCHECK
206 if (alpha_verbose_mcheck > 1) {
207 /* Dump the logout area to give all info. */
208 unsigned long *ptr = (unsigned long *)la_ptr;
209 long i;
210 for (i = 0; i < mchk_header->size / sizeof(long); i += 2) {
211 printk(KERN_CRIT " +%8lx %016lx %016lx\n",
212 i*sizeof(long), ptr[i], ptr[i+1]);
213 }
214 }
215#endif /* CONFIG_VERBOSE_MCHECK */
216}
217
218/*
219 * The special RTC interrupt type. The interrupt itself was
220 * processed by PALcode, and comes in via entInt vector 1.
221 */
222
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223struct irqaction timer_irqaction = {
224 .handler = timer_interrupt,
Thomas Gleixnerd18eced2006-07-01 19:29:11 -0700225 .flags = IRQF_DISABLED,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226 .name = "timer",
227};
228
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229void __init
230init_rtc_irq(void)
231{
Richard Henderson61813182011-04-17 13:05:25 -0700232 irq_set_chip_and_handler_name(RTC_IRQ, &dummy_irq_chip,
Thomas Gleixnereb1e17f2011-02-06 14:32:58 +0000233 handle_simple_irq, "RTC");
234 setup_irq(RTC_IRQ, &timer_irqaction);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235}
236
237/* Dummy irqactions. */
238struct irqaction isa_cascade_irqaction = {
239 .handler = no_action,
240 .name = "isa-cascade"
241};
242
243struct irqaction timer_cascade_irqaction = {
244 .handler = no_action,
245 .name = "timer-cascade"
246};
247
248struct irqaction halt_switch_irqaction = {
249 .handler = no_action,
250 .name = "halt-switch"
251};