irq.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /* $Id: irq.h,v 1.32 2000/08/26 02:42:28 anton Exp $
  2. * irq.h: IRQ registers on the Sparc.
  3. *
  4. * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  5. */
  6. #ifndef _SPARC_IRQ_H
  7. #define _SPARC_IRQ_H
  8. #include <linux/config.h>
  9. #include <linux/linkage.h>
  10. #include <linux/threads.h> /* For NR_CPUS */
  11. #include <linux/interrupt.h>
  12. #include <asm/system.h> /* For SUN4M_NCPUS */
  13. #include <asm/btfixup.h>
  14. #define __irq_ino(irq) irq
  15. #define __irq_pil(irq) irq
  16. BTFIXUPDEF_CALL(char *, __irq_itoa, unsigned int)
  17. #define __irq_itoa(irq) BTFIXUP_CALL(__irq_itoa)(irq)
  18. #define NR_IRQS 16
  19. #define irq_canonicalize(irq) (irq)
  20. /* Dave Redman (djhr@tadpole.co.uk)
  21. * changed these to function pointers.. it saves cycles and will allow
  22. * the irq dependencies to be split into different files at a later date
  23. * sun4c_irq.c, sun4m_irq.c etc so we could reduce the kernel size.
  24. * Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  25. * Changed these to btfixup entities... It saves cycles :)
  26. */
  27. BTFIXUPDEF_CALL(void, disable_irq, unsigned int)
  28. BTFIXUPDEF_CALL(void, enable_irq, unsigned int)
  29. BTFIXUPDEF_CALL(void, disable_pil_irq, unsigned int)
  30. BTFIXUPDEF_CALL(void, enable_pil_irq, unsigned int)
  31. BTFIXUPDEF_CALL(void, clear_clock_irq, void)
  32. BTFIXUPDEF_CALL(void, clear_profile_irq, int)
  33. BTFIXUPDEF_CALL(void, load_profile_irq, int, unsigned int)
  34. static inline void disable_irq_nosync(unsigned int irq)
  35. {
  36. BTFIXUP_CALL(disable_irq)(irq);
  37. }
  38. static inline void disable_irq(unsigned int irq)
  39. {
  40. BTFIXUP_CALL(disable_irq)(irq);
  41. }
  42. static inline void enable_irq(unsigned int irq)
  43. {
  44. BTFIXUP_CALL(enable_irq)(irq);
  45. }
  46. static inline void disable_pil_irq(unsigned int irq)
  47. {
  48. BTFIXUP_CALL(disable_pil_irq)(irq);
  49. }
  50. static inline void enable_pil_irq(unsigned int irq)
  51. {
  52. BTFIXUP_CALL(enable_pil_irq)(irq);
  53. }
  54. static inline void clear_clock_irq(void)
  55. {
  56. BTFIXUP_CALL(clear_clock_irq)();
  57. }
  58. static inline void clear_profile_irq(int irq)
  59. {
  60. BTFIXUP_CALL(clear_profile_irq)(irq);
  61. }
  62. static inline void load_profile_irq(int cpu, int limit)
  63. {
  64. BTFIXUP_CALL(load_profile_irq)(cpu, limit);
  65. }
  66. extern void (*sparc_init_timers)(irqreturn_t (*lvl10_irq)(int, void *, struct pt_regs *));
  67. extern void claim_ticker14(irqreturn_t (*irq_handler)(int, void *, struct pt_regs *),
  68. int irq,
  69. unsigned int timeout);
  70. #ifdef CONFIG_SMP
  71. BTFIXUPDEF_CALL(void, set_cpu_int, int, int)
  72. BTFIXUPDEF_CALL(void, clear_cpu_int, int, int)
  73. BTFIXUPDEF_CALL(void, set_irq_udt, int)
  74. #define set_cpu_int(cpu,level) BTFIXUP_CALL(set_cpu_int)(cpu,level)
  75. #define clear_cpu_int(cpu,level) BTFIXUP_CALL(clear_cpu_int)(cpu,level)
  76. #define set_irq_udt(cpu) BTFIXUP_CALL(set_irq_udt)(cpu)
  77. #endif
  78. extern int request_fast_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, __const__ char *devname);
  79. /* On the sun4m, just like the timers, we have both per-cpu and master
  80. * interrupt registers.
  81. */
  82. /* These registers are used for sending/receiving irqs from/to
  83. * different cpu's.
  84. */
  85. struct sun4m_intreg_percpu {
  86. unsigned int tbt; /* Interrupts still pending for this cpu. */
  87. /* These next two registers are WRITE-ONLY and are only
  88. * "on bit" sensitive, "off bits" written have NO affect.
  89. */
  90. unsigned int clear; /* Clear this cpus irqs here. */
  91. unsigned int set; /* Set this cpus irqs here. */
  92. unsigned char space[PAGE_SIZE - 12];
  93. };
  94. /*
  95. * djhr
  96. * Actually the clear and set fields in this struct are misleading..
  97. * according to the SLAVIO manual (and the same applies for the SEC)
  98. * the clear field clears bits in the mask which will ENABLE that IRQ
  99. * the set field sets bits in the mask to DISABLE the IRQ.
  100. *
  101. * Also the undirected_xx address in the SLAVIO is defined as
  102. * RESERVED and write only..
  103. *
  104. * DAVEM_NOTE: The SLAVIO only specifies behavior on uniprocessor
  105. * sun4m machines, for MP the layout makes more sense.
  106. */
  107. struct sun4m_intregs {
  108. struct sun4m_intreg_percpu cpu_intregs[SUN4M_NCPUS];
  109. unsigned int tbt; /* IRQ's that are still pending. */
  110. unsigned int irqs; /* Master IRQ bits. */
  111. /* Again, like the above, two these registers are WRITE-ONLY. */
  112. unsigned int clear; /* Clear master IRQ's by setting bits here. */
  113. unsigned int set; /* Set master IRQ's by setting bits here. */
  114. /* This register is both READ and WRITE. */
  115. unsigned int undirected_target; /* Which cpu gets undirected irqs. */
  116. };
  117. extern struct sun4m_intregs *sun4m_interrupts;
  118. /*
  119. * Bit field defines for the interrupt registers on various
  120. * Sparc machines.
  121. */
  122. /* The sun4c interrupt register. */
  123. #define SUN4C_INT_ENABLE 0x01 /* Allow interrupts. */
  124. #define SUN4C_INT_E14 0x80 /* Enable level 14 IRQ. */
  125. #define SUN4C_INT_E10 0x20 /* Enable level 10 IRQ. */
  126. #define SUN4C_INT_E8 0x10 /* Enable level 8 IRQ. */
  127. #define SUN4C_INT_E6 0x08 /* Enable level 6 IRQ. */
  128. #define SUN4C_INT_E4 0x04 /* Enable level 4 IRQ. */
  129. #define SUN4C_INT_E1 0x02 /* Enable level 1 IRQ. */
  130. /* Dave Redman (djhr@tadpole.co.uk)
  131. * The sun4m interrupt registers.
  132. */
  133. #define SUN4M_INT_ENABLE 0x80000000
  134. #define SUN4M_INT_E14 0x00000080
  135. #define SUN4M_INT_E10 0x00080000
  136. #define SUN4M_HARD_INT(x) (0x000000001 << (x))
  137. #define SUN4M_SOFT_INT(x) (0x000010000 << (x))
  138. #define SUN4M_INT_MASKALL 0x80000000 /* mask all interrupts */
  139. #define SUN4M_INT_MODULE_ERR 0x40000000 /* module error */
  140. #define SUN4M_INT_M2S_WRITE 0x20000000 /* write buffer error */
  141. #define SUN4M_INT_ECC 0x10000000 /* ecc memory error */
  142. #define SUN4M_INT_FLOPPY 0x00400000 /* floppy disk */
  143. #define SUN4M_INT_MODULE 0x00200000 /* module interrupt */
  144. #define SUN4M_INT_VIDEO 0x00100000 /* onboard video */
  145. #define SUN4M_INT_REALTIME 0x00080000 /* system timer */
  146. #define SUN4M_INT_SCSI 0x00040000 /* onboard scsi */
  147. #define SUN4M_INT_AUDIO 0x00020000 /* audio/isdn */
  148. #define SUN4M_INT_ETHERNET 0x00010000 /* onboard ethernet */
  149. #define SUN4M_INT_SERIAL 0x00008000 /* serial ports */
  150. #define SUN4M_INT_KBDMS 0x00004000 /* keyboard/mouse */
  151. #define SUN4M_INT_SBUSBITS 0x00003F80 /* sbus int bits */
  152. #define SUN4M_INT_SBUS(x) (1 << (x+7))
  153. #define SUN4M_INT_VME(x) (1 << (x))
  154. struct irqaction;
  155. struct pt_regs;
  156. int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
  157. #endif