irq.h 5.9 KB

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