irq.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 1994 by Waldorf GMBH, written by Ralf Baechle
  7. * Copyright (C) 1995, 96, 97, 98, 99, 2000, 01, 02, 03 by Ralf Baechle
  8. */
  9. #ifndef _ASM_IRQ_H
  10. #define _ASM_IRQ_H
  11. #include <linux/linkage.h>
  12. #include <asm/mipsmtregs.h>
  13. #include <irq.h>
  14. #ifdef CONFIG_I8259
  15. static inline int irq_canonicalize(int irq)
  16. {
  17. return ((irq == I8259A_IRQ_BASE + 2) ? I8259A_IRQ_BASE + 9 : irq);
  18. }
  19. #else
  20. #define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
  21. #endif
  22. #ifdef CONFIG_MIPS_MT_SMTC
  23. /*
  24. * Clear interrupt mask handling "backstop" if irq_hwmask
  25. * entry so indicates. This implies that the ack() or end()
  26. * functions will take over re-enabling the low-level mask.
  27. * Otherwise it will be done on return from exception.
  28. */
  29. #define __DO_IRQ_SMTC_HOOK(irq) \
  30. do { \
  31. if (irq_hwmask[irq] & 0x0000ff00) \
  32. write_c0_tccontext(read_c0_tccontext() & \
  33. ~(irq_hwmask[irq] & 0x0000ff00)); \
  34. } while (0)
  35. #else
  36. #define __DO_IRQ_SMTC_HOOK(irq) do { } while (0)
  37. #endif
  38. /*
  39. * do_IRQ handles all normal device IRQ's (the special
  40. * SMP cross-CPU interrupts have their own specific
  41. * handlers).
  42. *
  43. * Ideally there should be away to get this into kernel/irq/handle.c to
  44. * avoid the overhead of a call for just a tiny function ...
  45. */
  46. #define do_IRQ(irq) \
  47. do { \
  48. irq_enter(); \
  49. __DO_IRQ_SMTC_HOOK(irq); \
  50. generic_handle_irq(irq); \
  51. irq_exit(); \
  52. } while (0)
  53. extern void arch_init_irq(void);
  54. extern void spurious_interrupt(void);
  55. #ifdef CONFIG_MIPS_MT_SMTC
  56. struct irqaction;
  57. extern unsigned long irq_hwmask[];
  58. extern int setup_irq_smtc(unsigned int irq, struct irqaction * new,
  59. unsigned long hwmask);
  60. #endif /* CONFIG_MIPS_MT_SMTC */
  61. extern int allocate_irqno(void);
  62. extern void alloc_legacy_irqno(void);
  63. extern void free_irqno(unsigned int irq);
  64. #endif /* _ASM_IRQ_H */