irq_alpha.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:7k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  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. #ifndef CONFIG_SMP
  14. unsigned long __irq_attempt[NR_IRQS];
  15. #endif
  16. /* Hack minimum IPL during interrupt processing for broken hardware.  */
  17. #ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK
  18. int __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. /*
  32.  * The main interrupt entry point.
  33.  */
  34. asmlinkage void 
  35. do_entInt(unsigned long type, unsigned long vector, unsigned long la_ptr,
  36.   unsigned long a3, unsigned long a4, unsigned long a5,
  37.   struct pt_regs regs)
  38. {
  39. switch (type) {
  40. case 0:
  41. #ifdef CONFIG_SMP
  42. handle_ipi(&regs);
  43. return;
  44. #else
  45. irq_err_count++;
  46. printk(KERN_CRIT "Interprocessor interrupt? "
  47.        "You must be kidding!n");
  48. #endif
  49. break;
  50. case 1:
  51. #ifdef CONFIG_SMP
  52.   {
  53. long cpu;
  54. smp_percpu_timer_interrupt(&regs);
  55. cpu = smp_processor_id();
  56. if (cpu != boot_cpuid) {
  57.         irq_attempt(cpu, RTC_IRQ)++;
  58.         kstat.irqs[cpu][RTC_IRQ]++;
  59. } else {
  60. handle_irq(RTC_IRQ, &regs);
  61. }
  62.   }
  63. #else
  64. handle_irq(RTC_IRQ, &regs);
  65. #endif
  66. return;
  67. case 2:
  68. alpha_mv.machine_check(vector, la_ptr, &regs);
  69. return;
  70. case 3:
  71. alpha_mv.device_interrupt(vector, &regs);
  72. return;
  73. case 4:
  74. perf_irq(vector, &regs);
  75. return;
  76. default:
  77. printk(KERN_CRIT "Hardware intr %ld %lx? Huh?n",
  78.        type, vector);
  79. }
  80. printk("PC = %016lx PS=%04lxn", regs.pc, regs.ps);
  81. }
  82. void __init
  83. common_init_isa_dma(void)
  84. {
  85. outb(0, DMA1_RESET_REG);
  86. outb(0, DMA2_RESET_REG);
  87. outb(0, DMA1_CLR_MASK_REG);
  88. outb(0, DMA2_CLR_MASK_REG);
  89. }
  90. void __init
  91. init_IRQ(void)
  92. {
  93. /* Uh, this really MUST come first, just in case
  94.  * the platform init_irq() causes interrupts/mchecks
  95.  * (as is the case with RAWHIDE, at least).
  96.  */
  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.     struct pt_regs *regs, const char *machine,
  116.     int expected)
  117. {
  118. struct el_common *mchk_header;
  119. const char *reason;
  120. /*
  121.  * See if the machine check is due to a badaddr() and if so,
  122.  * ignore it.
  123.  */
  124. #if DEBUG_MCHECK > 0
  125.  printk(KERN_CRIT "%s machine check %sn", machine,
  126.         expected ? "expected." : "NOT expected!!!");
  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%lxn",
  136.        machine, vector, regs->pc, mchk_header->code);
  137. switch ((unsigned int) 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%sn",
  172.        reason, mchk_header->retry ? " (retryable)" : "");
  173. dik_show_regs(regs, NULL);
  174. #if DEBUG_MCHECK > 1
  175. {
  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 %016lxn",
  181.        i*sizeof(long), ptr[i], ptr[i+1]);
  182. }
  183. }
  184. #endif
  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. static void rtc_enable_disable(unsigned int irq) { }
  191. static unsigned int rtc_startup(unsigned int irq) { return 0; }
  192. struct irqaction timer_irqaction = {
  193. handler: timer_interrupt,
  194. flags: SA_INTERRUPT,
  195. name: "timer",
  196. };
  197. static struct hw_interrupt_type rtc_irq_type = {
  198. typename: "RTC",
  199. startup: rtc_startup,
  200. shutdown: rtc_enable_disable,
  201. enable: rtc_enable_disable,
  202. disable: rtc_enable_disable,
  203. ack: rtc_enable_disable,
  204. end: rtc_enable_disable,
  205. };
  206. void __init
  207. init_rtc_irq(void)
  208. {
  209. irq_desc[RTC_IRQ].status = IRQ_DISABLED;
  210. irq_desc[RTC_IRQ].handler = &rtc_irq_type;
  211. setup_irq(RTC_IRQ, &timer_irqaction);
  212. }
  213. /* Dummy irqactions.  */
  214. struct irqaction isa_cascade_irqaction = {
  215. handler: no_action,
  216. name: "isa-cascade"
  217. };
  218. struct irqaction timer_cascade_irqaction = {
  219. handler: no_action,
  220. name: "timer-cascade"
  221. };
  222. struct irqaction halt_switch_irqaction = {
  223. handler: no_action,
  224. name: "halt-switch"
  225. };