irq_alpha.c 6.4 KB

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