irq.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #ifndef __ASM_SH_IRQ_H
  2. #define __ASM_SH_IRQ_H
  3. #include <asm/machvec.h>
  4. /*
  5. * A sane default based on a reasonable vector table size, platforms are
  6. * advised to cap this at the hard limit that they're interested in
  7. * through the machvec.
  8. */
  9. #define NR_IRQS 256
  10. /*
  11. * Convert back and forth between INTEVT and IRQ values.
  12. */
  13. #ifdef CONFIG_CPU_HAS_INTEVT
  14. #define evt2irq(evt) (((evt) >> 5) - 16)
  15. #define irq2evt(irq) (((irq) + 16) << 5)
  16. #else
  17. #define evt2irq(evt) (evt)
  18. #define irq2evt(irq) (irq)
  19. #endif
  20. /*
  21. * Simple Mask Register Support
  22. */
  23. extern void make_maskreg_irq(unsigned int irq);
  24. extern unsigned short *irq_mask_register;
  25. /*
  26. * PINT IRQs
  27. */
  28. void init_IRQ_pint(void);
  29. /*
  30. * The shift value is now the number of bits to shift, not the number of
  31. * bits/4. This is to make it easier to read the value directly from the
  32. * datasheets. The IPR address, addr, will be set from ipr_idx via the
  33. * map_ipridx_to_addr function.
  34. */
  35. struct ipr_data {
  36. unsigned int irq;
  37. int ipr_idx; /* Index for the IPR registered */
  38. int shift; /* Number of bits to shift the data */
  39. int priority; /* The priority */
  40. unsigned int addr; /* Address of Interrupt Priority Register */
  41. };
  42. /*
  43. * Given an IPR IDX, map the value to an IPR register address.
  44. */
  45. unsigned int map_ipridx_to_addr(int idx);
  46. /*
  47. * Enable individual interrupt mode for external IPR IRQs.
  48. */
  49. void ipr_irq_enable_irlm(void);
  50. /*
  51. * Function for "on chip support modules".
  52. */
  53. void make_ipr_irq(struct ipr_data *table, unsigned int nr_irqs);
  54. void make_imask_irq(unsigned int irq);
  55. void init_IRQ_ipr(void);
  56. struct intc2_data {
  57. unsigned short irq;
  58. unsigned char ipr_offset, ipr_shift;
  59. unsigned char msk_offset, msk_shift;
  60. unsigned char priority;
  61. };
  62. void make_intc2_irq(struct intc2_data *, unsigned int nr_irqs);
  63. void init_IRQ_intc2(void);
  64. static inline int generic_irq_demux(int irq)
  65. {
  66. return irq;
  67. }
  68. #define irq_canonicalize(irq) (irq)
  69. #define irq_demux(irq) sh_mv.mv_irq_demux(irq)
  70. #ifdef CONFIG_4KSTACKS
  71. extern void irq_ctx_init(int cpu);
  72. extern void irq_ctx_exit(int cpu);
  73. # define __ARCH_HAS_DO_SOFTIRQ
  74. #else
  75. # define irq_ctx_init(cpu) do { } while (0)
  76. # define irq_ctx_exit(cpu) do { } while (0)
  77. #endif
  78. #endif /* __ASM_SH_IRQ_H */