irq_alpha.c 6.6 KB

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