irq.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (C) 2004-2006 Atmel Corporation
  3. *
  4. * Based on arch/i386/kernel/irq.c
  5. * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/interrupt.h>
  12. #include <linux/irq.h>
  13. #include <linux/kernel_stat.h>
  14. #include <linux/proc_fs.h>
  15. #include <linux/seq_file.h>
  16. #include <linux/sysdev.h>
  17. /*
  18. * 'what should we do if we get a hw irq event on an illegal vector'.
  19. * each architecture has to answer this themselves.
  20. */
  21. void ack_bad_irq(unsigned int irq)
  22. {
  23. printk("unexpected IRQ %u\n", irq);
  24. }
  25. /* May be overridden by platform code */
  26. int __weak nmi_enable(void)
  27. {
  28. return -ENOSYS;
  29. }
  30. void __weak nmi_disable(void)
  31. {
  32. }
  33. #ifdef CONFIG_PROC_FS
  34. int show_interrupts(struct seq_file *p, void *v)
  35. {
  36. int i = *(loff_t *)v, cpu;
  37. struct irqaction *action;
  38. unsigned long flags;
  39. if (i == 0) {
  40. seq_puts(p, " ");
  41. for_each_online_cpu(cpu)
  42. seq_printf(p, "CPU%d ", cpu);
  43. seq_putc(p, '\n');
  44. }
  45. if (i < NR_IRQS) {
  46. spin_lock_irqsave(&irq_desc[i].lock, flags);
  47. action = irq_desc[i].action;
  48. if (!action)
  49. goto unlock;
  50. seq_printf(p, "%3d: ", i);
  51. for_each_online_cpu(cpu)
  52. seq_printf(p, "%10u ", kstat_irqs_cpu(i, cpu));
  53. seq_printf(p, " %8s", irq_desc[i].chip->name ? : "-");
  54. seq_printf(p, " %s", action->name);
  55. for (action = action->next; action; action = action->next)
  56. seq_printf(p, ", %s", action->name);
  57. seq_putc(p, '\n');
  58. unlock:
  59. spin_unlock_irqrestore(&irq_desc[i].lock, flags);
  60. }
  61. return 0;
  62. }
  63. #endif