open_pic_defs.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. /*
  2. * arch/ppc/kernel/open_pic_defs.h -- OpenPIC definitions
  3. *
  4. * Copyright (C) 1997 Geert Uytterhoeven
  5. *
  6. * This file is based on the following documentation:
  7. *
  8. * The Open Programmable Interrupt Controller (PIC)
  9. * Register Interface Specification Revision 1.2
  10. *
  11. * Issue Date: October 1995
  12. *
  13. * Issued jointly by Advanced Micro Devices and Cyrix Corporation
  14. *
  15. * AMD is a registered trademark of Advanced Micro Devices, Inc.
  16. * Copyright (C) 1995, Advanced Micro Devices, Inc. and Cyrix, Inc.
  17. * All Rights Reserved.
  18. *
  19. * To receive a copy of this documentation, send an email to openpic@amd.com.
  20. *
  21. * This file is subject to the terms and conditions of the GNU General Public
  22. * License. See the file COPYING in the main directory of this archive
  23. * for more details.
  24. */
  25. #ifndef _LINUX_OPENPIC_H
  26. #define _LINUX_OPENPIC_H
  27. #ifdef __KERNEL__
  28. /*
  29. * OpenPIC supports up to 2048 interrupt sources and up to 32 processors
  30. */
  31. #define OPENPIC_MAX_SOURCES 2048
  32. #define OPENPIC_MAX_PROCESSORS 32
  33. #define OPENPIC_MAX_ISU 16
  34. #define OPENPIC_NUM_TIMERS 4
  35. #define OPENPIC_NUM_IPI 4
  36. #define OPENPIC_NUM_PRI 16
  37. #define OPENPIC_NUM_VECTORS 256
  38. /*
  39. * OpenPIC Registers are 32 bits and aligned on 128 bit boundaries
  40. */
  41. typedef struct _OpenPIC_Reg {
  42. u_int Reg; /* Little endian! */
  43. char Pad[0xc];
  44. } OpenPIC_Reg;
  45. /*
  46. * Per Processor Registers
  47. */
  48. typedef struct _OpenPIC_Processor {
  49. /*
  50. * Private Shadow Registers (for SLiC backwards compatibility)
  51. */
  52. u_int IPI0_Dispatch_Shadow; /* Write Only */
  53. char Pad1[0x4];
  54. u_int IPI0_Vector_Priority_Shadow; /* Read/Write */
  55. char Pad2[0x34];
  56. /*
  57. * Interprocessor Interrupt Command Ports
  58. */
  59. OpenPIC_Reg _IPI_Dispatch[OPENPIC_NUM_IPI]; /* Write Only */
  60. /*
  61. * Current Task Priority Register
  62. */
  63. OpenPIC_Reg _Current_Task_Priority; /* Read/Write */
  64. char Pad3[0x10];
  65. /*
  66. * Interrupt Acknowledge Register
  67. */
  68. OpenPIC_Reg _Interrupt_Acknowledge; /* Read Only */
  69. /*
  70. * End of Interrupt (EOI) Register
  71. */
  72. OpenPIC_Reg _EOI; /* Read/Write */
  73. char Pad5[0xf40];
  74. } OpenPIC_Processor;
  75. /*
  76. * Timer Registers
  77. */
  78. typedef struct _OpenPIC_Timer {
  79. OpenPIC_Reg _Current_Count; /* Read Only */
  80. OpenPIC_Reg _Base_Count; /* Read/Write */
  81. OpenPIC_Reg _Vector_Priority; /* Read/Write */
  82. OpenPIC_Reg _Destination; /* Read/Write */
  83. } OpenPIC_Timer;
  84. /*
  85. * Global Registers
  86. */
  87. typedef struct _OpenPIC_Global {
  88. /*
  89. * Feature Reporting Registers
  90. */
  91. OpenPIC_Reg _Feature_Reporting0; /* Read Only */
  92. OpenPIC_Reg _Feature_Reporting1; /* Future Expansion */
  93. /*
  94. * Global Configuration Registers
  95. */
  96. OpenPIC_Reg _Global_Configuration0; /* Read/Write */
  97. OpenPIC_Reg _Global_Configuration1; /* Future Expansion */
  98. /*
  99. * Vendor Specific Registers
  100. */
  101. OpenPIC_Reg _Vendor_Specific[4];
  102. /*
  103. * Vendor Identification Register
  104. */
  105. OpenPIC_Reg _Vendor_Identification; /* Read Only */
  106. /*
  107. * Processor Initialization Register
  108. */
  109. OpenPIC_Reg _Processor_Initialization; /* Read/Write */
  110. /*
  111. * IPI Vector/Priority Registers
  112. */
  113. OpenPIC_Reg _IPI_Vector_Priority[OPENPIC_NUM_IPI]; /* Read/Write */
  114. /*
  115. * Spurious Vector Register
  116. */
  117. OpenPIC_Reg _Spurious_Vector; /* Read/Write */
  118. /*
  119. * Global Timer Registers
  120. */
  121. OpenPIC_Reg _Timer_Frequency; /* Read/Write */
  122. OpenPIC_Timer Timer[OPENPIC_NUM_TIMERS];
  123. char Pad1[0xee00];
  124. } OpenPIC_Global;
  125. /*
  126. * Interrupt Source Registers
  127. */
  128. typedef struct _OpenPIC_Source {
  129. OpenPIC_Reg _Vector_Priority; /* Read/Write */
  130. OpenPIC_Reg _Destination; /* Read/Write */
  131. } OpenPIC_Source, *OpenPIC_SourcePtr;
  132. /*
  133. * OpenPIC Register Map
  134. */
  135. struct OpenPIC {
  136. char Pad1[0x1000];
  137. /*
  138. * Global Registers
  139. */
  140. OpenPIC_Global Global;
  141. /*
  142. * Interrupt Source Configuration Registers
  143. */
  144. OpenPIC_Source Source[OPENPIC_MAX_SOURCES];
  145. /*
  146. * Per Processor Registers
  147. */
  148. OpenPIC_Processor Processor[OPENPIC_MAX_PROCESSORS];
  149. };
  150. /*
  151. * Current Task Priority Register
  152. */
  153. #define OPENPIC_CURRENT_TASK_PRIORITY_MASK 0x0000000f
  154. /*
  155. * Who Am I Register
  156. */
  157. #define OPENPIC_WHO_AM_I_ID_MASK 0x0000001f
  158. /*
  159. * Feature Reporting Register 0
  160. */
  161. #define OPENPIC_FEATURE_LAST_SOURCE_MASK 0x07ff0000
  162. #define OPENPIC_FEATURE_LAST_SOURCE_SHIFT 16
  163. #define OPENPIC_FEATURE_LAST_PROCESSOR_MASK 0x00001f00
  164. #define OPENPIC_FEATURE_LAST_PROCESSOR_SHIFT 8
  165. #define OPENPIC_FEATURE_VERSION_MASK 0x000000ff
  166. /*
  167. * Global Configuration Register 0
  168. */
  169. #define OPENPIC_CONFIG_RESET 0x80000000
  170. #define OPENPIC_CONFIG_8259_PASSTHROUGH_DISABLE 0x20000000
  171. #define OPENPIC_CONFIG_BASE_MASK 0x000fffff
  172. /*
  173. * Global Configuration Register 1
  174. * This is the EICR on EPICs.
  175. */
  176. #define OPENPIC_EICR_S_CLK_MASK 0x70000000
  177. #define OPENPIC_EICR_SIE 0x08000000
  178. /*
  179. * Vendor Identification Register
  180. */
  181. #define OPENPIC_VENDOR_ID_STEPPING_MASK 0x00ff0000
  182. #define OPENPIC_VENDOR_ID_STEPPING_SHIFT 16
  183. #define OPENPIC_VENDOR_ID_DEVICE_ID_MASK 0x0000ff00
  184. #define OPENPIC_VENDOR_ID_DEVICE_ID_SHIFT 8
  185. #define OPENPIC_VENDOR_ID_VENDOR_ID_MASK 0x000000ff
  186. /*
  187. * Vector/Priority Registers
  188. */
  189. #define OPENPIC_MASK 0x80000000
  190. #define OPENPIC_ACTIVITY 0x40000000 /* Read Only */
  191. #define OPENPIC_PRIORITY_MASK 0x000f0000
  192. #define OPENPIC_PRIORITY_SHIFT 16
  193. #define OPENPIC_VECTOR_MASK 0x000000ff
  194. /*
  195. * Interrupt Source Registers
  196. */
  197. #define OPENPIC_POLARITY_POSITIVE 0x00800000
  198. #define OPENPIC_POLARITY_NEGATIVE 0x00000000
  199. #define OPENPIC_POLARITY_MASK 0x00800000
  200. #define OPENPIC_SENSE_LEVEL 0x00400000
  201. #define OPENPIC_SENSE_EDGE 0x00000000
  202. #define OPENPIC_SENSE_MASK 0x00400000
  203. /*
  204. * Timer Registers
  205. */
  206. #define OPENPIC_COUNT_MASK 0x7fffffff
  207. #define OPENPIC_TIMER_TOGGLE 0x80000000
  208. #define OPENPIC_TIMER_COUNT_INHIBIT 0x80000000
  209. /*
  210. * Aliases to make life simpler
  211. */
  212. /* Per Processor Registers */
  213. #define IPI_Dispatch(i) _IPI_Dispatch[i].Reg
  214. #define Current_Task_Priority _Current_Task_Priority.Reg
  215. #define Interrupt_Acknowledge _Interrupt_Acknowledge.Reg
  216. #define EOI _EOI.Reg
  217. /* Global Registers */
  218. #define Feature_Reporting0 _Feature_Reporting0.Reg
  219. #define Feature_Reporting1 _Feature_Reporting1.Reg
  220. #define Global_Configuration0 _Global_Configuration0.Reg
  221. #define Global_Configuration1 _Global_Configuration1.Reg
  222. #define Vendor_Specific(i) _Vendor_Specific[i].Reg
  223. #define Vendor_Identification _Vendor_Identification.Reg
  224. #define Processor_Initialization _Processor_Initialization.Reg
  225. #define IPI_Vector_Priority(i) _IPI_Vector_Priority[i].Reg
  226. #define Spurious_Vector _Spurious_Vector.Reg
  227. #define Timer_Frequency _Timer_Frequency.Reg
  228. /* Timer Registers */
  229. #define Current_Count _Current_Count.Reg
  230. #define Base_Count _Base_Count.Reg
  231. #define Vector_Priority _Vector_Priority.Reg
  232. #define Destination _Destination.Reg
  233. /* Interrupt Source Registers */
  234. #define Vector_Priority _Vector_Priority.Reg
  235. #define Destination _Destination.Reg
  236. #endif /* __KERNEL__ */
  237. #endif /* _LINUX_OPENPIC_H */