irq_alpha.c 6.1 KB

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