open_pic_defs.h 7.1 KB

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