wsp_pci.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. /*
  2. * Copyright 2010 Ben Herrenschmidt, IBM Corporation
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #ifndef __WSP_PCI_H
  10. #define __WSP_PCI_H
  11. /* Architected registers */
  12. #define PCIE_REG_DMA_CHAN_STATUS 0x110
  13. #define PCIE_REG_CPU_LOADSTORE_STATUS 0x120
  14. #define PCIE_REG_CONFIG_DATA 0x130
  15. #define PCIE_REG_LOCK0 0x138
  16. #define PCIE_REG_CONFIG_ADDRESS 0x140
  17. #define PCIE_REG_CA_ENABLE 0x8000000000000000ull
  18. #define PCIE_REG_CA_BUS_MASK 0x0ff0000000000000ull
  19. #define PCIE_REG_CA_BUS_SHIFT (20+32)
  20. #define PCIE_REG_CA_DEV_MASK 0x000f800000000000ull
  21. #define PCIE_REG_CA_DEV_SHIFT (15+32)
  22. #define PCIE_REG_CA_FUNC_MASK 0x0000700000000000ull
  23. #define PCIE_REG_CA_FUNC_SHIFT (12+32)
  24. #define PCIE_REG_CA_REG_MASK 0x00000fff00000000ull
  25. #define PCIE_REG_CA_REG_SHIFT ( 0+32)
  26. #define PCIE_REG_CA_BE_MASK 0x00000000f0000000ull
  27. #define PCIE_REG_CA_BE_SHIFT ( 28)
  28. #define PCIE_REG_LOCK1 0x148
  29. #define PCIE_REG_PHB_CONFIG 0x160
  30. #define PCIE_REG_PHBC_64B_TCE_EN 0x2000000000000000ull
  31. #define PCIE_REG_PHBC_MMIO_DMA_FREEZE_EN 0x1000000000000000ull
  32. #define PCIE_REG_PHBC_32BIT_MSI_EN 0x0080000000000000ull
  33. #define PCIE_REG_PHBC_M64_EN 0x0040000000000000ull
  34. #define PCIE_REG_PHBC_IO_EN 0x0008000000000000ull
  35. #define PCIE_REG_PHBC_64BIT_MSI_EN 0x0002000000000000ull
  36. #define PCIE_REG_PHBC_M32A_EN 0x0000800000000000ull
  37. #define PCIE_REG_PHBC_M32B_EN 0x0000400000000000ull
  38. #define PCIE_REG_PHBC_MSI_PE_VALIDATE 0x0000200000000000ull
  39. #define PCIE_REG_PHBC_DMA_XLATE_BYPASS 0x0000100000000000ull
  40. #define PCIE_REG_IO_BASE_ADDR 0x170
  41. #define PCIE_REG_IO_BASE_MASK 0x178
  42. #define PCIE_REG_IO_START_ADDR 0x180
  43. #define PCIE_REG_M32A_BASE_ADDR 0x190
  44. #define PCIE_REG_M32A_BASE_MASK 0x198
  45. #define PCIE_REG_M32A_START_ADDR 0x1a0
  46. #define PCIE_REG_M32B_BASE_ADDR 0x1b0
  47. #define PCIE_REG_M32B_BASE_MASK 0x1b8
  48. #define PCIE_REG_M32B_START_ADDR 0x1c0
  49. #define PCIE_REG_M64_BASE_ADDR 0x1e0
  50. #define PCIE_REG_M64_BASE_MASK 0x1e8
  51. #define PCIE_REG_M64_START_ADDR 0x1f0
  52. #define PCIE_REG_TCE_KILL 0x210
  53. #define PCIE_REG_TCEKILL_SINGLE 0x8000000000000000ull
  54. #define PCIE_REG_TCEKILL_ADDR_MASK 0x000003fffffffff8ull
  55. #define PCIE_REG_TCEKILL_PS_4K 0
  56. #define PCIE_REG_TCEKILL_PS_64K 1
  57. #define PCIE_REG_TCEKILL_PS_16M 2
  58. #define PCIE_REG_TCEKILL_PS_16G 3
  59. #define PCIE_REG_IODA_ADDR 0x220
  60. #define PCIE_REG_IODA_AD_AUTOINC 0x8000000000000000ull
  61. #define PCIE_REG_IODA_AD_TBL_MVT 0x0005000000000000ull
  62. #define PCIE_REG_IODA_AD_TBL_PELT 0x0006000000000000ull
  63. #define PCIE_REG_IODA_AD_TBL_PESTA 0x0007000000000000ull
  64. #define PCIE_REG_IODA_AD_TBL_PESTB 0x0008000000000000ull
  65. #define PCIE_REG_IODA_AD_TBL_TVT 0x0009000000000000ull
  66. #define PCIE_REG_IODA_AD_TBL_TCE 0x000a000000000000ull
  67. #define PCIE_REG_IODA_DATA0 0x228
  68. #define PCIE_REG_IODA_DATA1 0x230
  69. #define PCIE_REG_LOCK2 0x240
  70. #define PCIE_REG_PHB_GEN_CAP 0x250
  71. #define PCIE_REG_PHB_TCE_CAP 0x258
  72. #define PCIE_REG_PHB_IRQ_CAP 0x260
  73. #define PCIE_REG_PHB_EEH_CAP 0x268
  74. #define PCIE_REG_PAPR_ERR_INJ_CONTROL 0x2b0
  75. #define PCIE_REG_PAPR_ERR_INJ_ADDR 0x2b8
  76. #define PCIE_REG_PAPR_ERR_INJ_MASK 0x2c0
  77. #define PCIE_REG_SYS_CFG1 0x600
  78. #define PCIE_REG_SYS_CFG1_CLASS_CODE 0x0000000000ffffffull
  79. #define IODA_TVT0_TTA_MASK 0x000fffffffff0000ull
  80. #define IODA_TVT0_TTA_SHIFT 4
  81. #define IODA_TVT0_BUSNUM_VALID_MASK 0x000000000000e000ull
  82. #define IODA_TVT0_TCE_TABLE_SIZE_MASK 0x0000000000001f00ull
  83. #define IODA_TVT0_TCE_TABLE_SIZE_SHIFT 8
  84. #define IODA_TVT0_BUSNUM_VALUE_MASK 0x00000000000000ffull
  85. #define IODA_TVT0_BUSNUM_VALID_SHIFT 0
  86. #define IODA_TVT1_DEVNUM_VALID 0x2000000000000000ull
  87. #define IODA_TVT1_DEVNUM_VALUE_MASK 0x1f00000000000000ull
  88. #define IODA_TVT1_DEVNUM_VALUE_SHIFT 56
  89. #define IODA_TVT1_FUNCNUM_VALID 0x0008000000000000ull
  90. #define IODA_TVT1_FUNCNUM_VALUE_MASK 0x0007000000000000ull
  91. #define IODA_TVT1_FUNCNUM_VALUE_SHIFT 48
  92. #define IODA_TVT1_IO_PAGE_SIZE_MASK 0x00001f0000000000ull
  93. #define IODA_TVT1_IO_PAGE_SIZE_SHIFT 40
  94. #define IODA_TVT1_PE_NUMBER_MASK 0x000000000000003full
  95. #define IODA_TVT1_PE_NUMBER_SHIFT 0
  96. #define IODA_TVT_COUNT 64
  97. /* UTL Core registers */
  98. #define PCIE_UTL_SYS_BUS_CONTROL 0x400
  99. #define PCIE_UTL_STATUS 0x408
  100. #define PCIE_UTL_SYS_BUS_AGENT_STATUS 0x410
  101. #define PCIE_UTL_SYS_BUS_AGENT_ERR_SEV 0x418
  102. #define PCIE_UTL_SYS_BUS_AGENT_IRQ_EN 0x420
  103. #define PCIE_UTL_SYS_BUS_BURST_SZ_CONF 0x440
  104. #define PCIE_UTL_REVISION_ID 0x448
  105. #define PCIE_UTL_OUT_POST_HDR_BUF_ALLOC 0x4c0
  106. #define PCIE_UTL_OUT_POST_DAT_BUF_ALLOC 0x4d0
  107. #define PCIE_UTL_IN_POST_HDR_BUF_ALLOC 0x4e0
  108. #define PCIE_UTL_IN_POST_DAT_BUF_ALLOC 0x4f0
  109. #define PCIE_UTL_OUT_NP_BUF_ALLOC 0x500
  110. #define PCIE_UTL_IN_NP_BUF_ALLOC 0x510
  111. #define PCIE_UTL_PCIE_TAGS_ALLOC 0x520
  112. #define PCIE_UTL_GBIF_READ_TAGS_ALLOC 0x530
  113. #define PCIE_UTL_PCIE_PORT_CONTROL 0x540
  114. #define PCIE_UTL_PCIE_PORT_STATUS 0x548
  115. #define PCIE_UTL_PCIE_PORT_ERROR_SEV 0x550
  116. #define PCIE_UTL_PCIE_PORT_IRQ_EN 0x558
  117. #define PCIE_UTL_RC_STATUS 0x560
  118. #define PCIE_UTL_RC_ERR_SEVERITY 0x568
  119. #define PCIE_UTL_RC_IRQ_EN 0x570
  120. #define PCIE_UTL_EP_STATUS 0x578
  121. #define PCIE_UTL_EP_ERR_SEVERITY 0x580
  122. #define PCIE_UTL_EP_ERR_IRQ_EN 0x588
  123. #define PCIE_UTL_PCI_PM_CTRL1 0x590
  124. #define PCIE_UTL_PCI_PM_CTRL2 0x598
  125. /* PCIe stack registers */
  126. #define PCIE_REG_SYSTEM_CONFIG1 0x600
  127. #define PCIE_REG_SYSTEM_CONFIG2 0x608
  128. #define PCIE_REG_EP_SYSTEM_CONFIG 0x618
  129. #define PCIE_REG_EP_FLR 0x620
  130. #define PCIE_REG_EP_BAR_CONFIG 0x628
  131. #define PCIE_REG_LINK_CONFIG 0x630
  132. #define PCIE_REG_PM_CONFIG 0x640
  133. #define PCIE_REG_DLP_CONTROL 0x650
  134. #define PCIE_REG_DLP_STATUS 0x658
  135. #define PCIE_REG_ERR_REPORT_CONTROL 0x660
  136. #define PCIE_REG_SLOT_CONTROL1 0x670
  137. #define PCIE_REG_SLOT_CONTROL2 0x678
  138. #define PCIE_REG_UTL_CONFIG 0x680
  139. #define PCIE_REG_BUFFERS_CONFIG 0x690
  140. #define PCIE_REG_ERROR_INJECT 0x698
  141. #define PCIE_REG_SRIOV_CONFIG 0x6a0
  142. #define PCIE_REG_PF0_SRIOV_STATUS 0x6a8
  143. #define PCIE_REG_PF1_SRIOV_STATUS 0x6b0
  144. #define PCIE_REG_PORT_NUMBER 0x700
  145. #define PCIE_REG_POR_SYSTEM_CONFIG 0x708
  146. /* PHB internal logic registers */
  147. #define PCIE_REG_PHB_VERSION 0x800
  148. #define PCIE_REG_RESET 0x808
  149. #define PCIE_REG_PHB_CONTROL 0x810
  150. #define PCIE_REG_PHB_TIMEOUT_CONTROL1 0x878
  151. #define PCIE_REG_PHB_QUIESCE_DMA 0x888
  152. #define PCIE_REG_PHB_DMA_READ_TAG_ACTV 0x900
  153. #define PCIE_REG_PHB_TCE_READ_TAG_ACTV 0x908
  154. /* FIR registers */
  155. #define PCIE_REG_LEM_FIR_ACCUM 0xc00
  156. #define PCIE_REG_LEM_FIR_AND_MASK 0xc08
  157. #define PCIE_REG_LEM_FIR_OR_MASK 0xc10
  158. #define PCIE_REG_LEM_ACTION0 0xc18
  159. #define PCIE_REG_LEM_ACTION1 0xc20
  160. #define PCIE_REG_LEM_ERROR_MASK 0xc30
  161. #define PCIE_REG_LEM_ERROR_AND_MASK 0xc38
  162. #define PCIE_REG_LEM_ERROR_OR_MASK 0xc40
  163. /* PHB Error registers */
  164. #define PCIE_REG_PHB_ERR_STATUS 0xc80
  165. #define PCIE_REG_PHB_ERR1_STATUS 0xc88
  166. #define PCIE_REG_PHB_ERR_INJECT 0xc90
  167. #define PCIE_REG_PHB_ERR_LEM_ENABLE 0xc98
  168. #define PCIE_REG_PHB_ERR_IRQ_ENABLE 0xca0
  169. #define PCIE_REG_PHB_ERR_FREEZE_ENABLE 0xca8
  170. #define PCIE_REG_PHB_ERR_SIDE_ENABLE 0xcb8
  171. #define PCIE_REG_PHB_ERR_LOG_0 0xcc0
  172. #define PCIE_REG_PHB_ERR_LOG_1 0xcc8
  173. #define PCIE_REG_PHB_ERR_STATUS_MASK 0xcd0
  174. #define PCIE_REG_PHB_ERR1_STATUS_MASK 0xcd8
  175. #define PCIE_REG_MMIO_ERR_STATUS 0xd00
  176. #define PCIE_REG_MMIO_ERR1_STATUS 0xd08
  177. #define PCIE_REG_MMIO_ERR_INJECT 0xd10
  178. #define PCIE_REG_MMIO_ERR_LEM_ENABLE 0xd18
  179. #define PCIE_REG_MMIO_ERR_IRQ_ENABLE 0xd20
  180. #define PCIE_REG_MMIO_ERR_FREEZE_ENABLE 0xd28
  181. #define PCIE_REG_MMIO_ERR_SIDE_ENABLE 0xd38
  182. #define PCIE_REG_MMIO_ERR_LOG_0 0xd40
  183. #define PCIE_REG_MMIO_ERR_LOG_1 0xd48
  184. #define PCIE_REG_MMIO_ERR_STATUS_MASK 0xd50
  185. #define PCIE_REG_MMIO_ERR1_STATUS_MASK 0xd58
  186. #define PCIE_REG_DMA_ERR_STATUS 0xd80
  187. #define PCIE_REG_DMA_ERR1_STATUS 0xd88
  188. #define PCIE_REG_DMA_ERR_INJECT 0xd90
  189. #define PCIE_REG_DMA_ERR_LEM_ENABLE 0xd98
  190. #define PCIE_REG_DMA_ERR_IRQ_ENABLE 0xda0
  191. #define PCIE_REG_DMA_ERR_FREEZE_ENABLE 0xda8
  192. #define PCIE_REG_DMA_ERR_SIDE_ENABLE 0xdb8
  193. #define PCIE_REG_DMA_ERR_LOG_0 0xdc0
  194. #define PCIE_REG_DMA_ERR_LOG_1 0xdc8
  195. #define PCIE_REG_DMA_ERR_STATUS_MASK 0xdd0
  196. #define PCIE_REG_DMA_ERR1_STATUS_MASK 0xdd8
  197. /* Shortcuts for access to the above using the PHB definitions
  198. * with an offset
  199. */
  200. #define PCIE_REG_ERR_PHB_OFFSET 0x0
  201. #define PCIE_REG_ERR_MMIO_OFFSET 0x80
  202. #define PCIE_REG_ERR_DMA_OFFSET 0x100
  203. /* Debug and Trace registers */
  204. #define PCIE_REG_PHB_DEBUG_CONTROL0 0xe00
  205. #define PCIE_REG_PHB_DEBUG_STATUS0 0xe08
  206. #define PCIE_REG_PHB_DEBUG_CONTROL1 0xe10
  207. #define PCIE_REG_PHB_DEBUG_STATUS1 0xe18
  208. #define PCIE_REG_PHB_DEBUG_CONTROL2 0xe20
  209. #define PCIE_REG_PHB_DEBUG_STATUS2 0xe28
  210. #define PCIE_REG_PHB_DEBUG_CONTROL3 0xe30
  211. #define PCIE_REG_PHB_DEBUG_STATUS3 0xe38
  212. #define PCIE_REG_PHB_DEBUG_CONTROL4 0xe40
  213. #define PCIE_REG_PHB_DEBUG_STATUS4 0xe48
  214. #define PCIE_REG_PHB_DEBUG_CONTROL5 0xe50
  215. #define PCIE_REG_PHB_DEBUG_STATUS5 0xe58
  216. #define PCIE_REG_PHB_DEBUG_CONTROL6 0xe60
  217. #define PCIE_REG_PHB_DEBUG_STATUS6 0xe68
  218. /* Definition for PCIe errors */
  219. struct wsp_pcie_err_log_data {
  220. __u64 phb_err;
  221. __u64 phb_err1;
  222. __u64 phb_log0;
  223. __u64 phb_log1;
  224. __u64 mmio_err;
  225. __u64 mmio_err1;
  226. __u64 mmio_log0;
  227. __u64 mmio_log1;
  228. __u64 dma_err;
  229. __u64 dma_err1;
  230. __u64 dma_log0;
  231. __u64 dma_log1;
  232. __u64 utl_sys_err;
  233. __u64 utl_port_err;
  234. __u64 utl_rc_err;
  235. __u64 unused;
  236. };
  237. #endif /* __WSP_PCI_H */