irq_alpha.c 6.5 KB

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