ipath_registers.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. /*
  2. * Copyright (c) 2006, 2007 QLogic Corporation. All rights reserved.
  3. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
  4. *
  5. * This software is available to you under a choice of one of two
  6. * licenses. You may choose to be licensed under the terms of the GNU
  7. * General Public License (GPL) Version 2, available from the file
  8. * COPYING in the main directory of this source tree, or the
  9. * OpenIB.org BSD license below:
  10. *
  11. * Redistribution and use in source and binary forms, with or
  12. * without modification, are permitted provided that the following
  13. * conditions are met:
  14. *
  15. * - Redistributions of source code must retain the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer.
  18. *
  19. * - Redistributions in binary form must reproduce the above
  20. * copyright notice, this list of conditions and the following
  21. * disclaimer in the documentation and/or other materials
  22. * provided with the distribution.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  28. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  29. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  30. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  31. * SOFTWARE.
  32. */
  33. #ifndef _IPATH_REGISTERS_H
  34. #define _IPATH_REGISTERS_H
  35. /*
  36. * This file should only be included by kernel source, and by the diags. It
  37. * defines the registers, and their contents, for InfiniPath chips.
  38. */
  39. /*
  40. * These are the InfiniPath register and buffer bit definitions,
  41. * that are visible to software, and needed only by the kernel
  42. * and diag code. A few, that are visible to protocol and user
  43. * code are in ipath_common.h. Some bits are specific
  44. * to a given chip implementation, and have been moved to the
  45. * chip-specific source file
  46. */
  47. /* kr_revision bits */
  48. #define INFINIPATH_R_CHIPREVMINOR_MASK 0xFF
  49. #define INFINIPATH_R_CHIPREVMINOR_SHIFT 0
  50. #define INFINIPATH_R_CHIPREVMAJOR_MASK 0xFF
  51. #define INFINIPATH_R_CHIPREVMAJOR_SHIFT 8
  52. #define INFINIPATH_R_ARCH_MASK 0xFF
  53. #define INFINIPATH_R_ARCH_SHIFT 16
  54. #define INFINIPATH_R_SOFTWARE_MASK 0xFF
  55. #define INFINIPATH_R_SOFTWARE_SHIFT 24
  56. #define INFINIPATH_R_BOARDID_MASK 0xFF
  57. #define INFINIPATH_R_BOARDID_SHIFT 32
  58. /* kr_control bits */
  59. #define INFINIPATH_C_FREEZEMODE 0x00000002
  60. #define INFINIPATH_C_LINKENABLE 0x00000004
  61. /* kr_sendctrl bits */
  62. #define INFINIPATH_S_DISARMPIOBUF_SHIFT 16
  63. #define INFINIPATH_S_UPDTHRESH_SHIFT 24
  64. #define INFINIPATH_S_UPDTHRESH_MASK 0x1f
  65. #define IPATH_S_ABORT 0
  66. #define IPATH_S_PIOINTBUFAVAIL 1
  67. #define IPATH_S_PIOBUFAVAILUPD 2
  68. #define IPATH_S_PIOENABLE 3
  69. #define IPATH_S_SDMAINTENABLE 9
  70. #define IPATH_S_SDMASINGLEDESCRIPTOR 10
  71. #define IPATH_S_SDMAENABLE 11
  72. #define IPATH_S_SDMAHALT 12
  73. #define IPATH_S_DISARM 31
  74. #define INFINIPATH_S_ABORT (1U << IPATH_S_ABORT)
  75. #define INFINIPATH_S_PIOINTBUFAVAIL (1U << IPATH_S_PIOINTBUFAVAIL)
  76. #define INFINIPATH_S_PIOBUFAVAILUPD (1U << IPATH_S_PIOBUFAVAILUPD)
  77. #define INFINIPATH_S_PIOENABLE (1U << IPATH_S_PIOENABLE)
  78. #define INFINIPATH_S_SDMAINTENABLE (1U << IPATH_S_SDMAINTENABLE)
  79. #define INFINIPATH_S_SDMASINGLEDESCRIPTOR \
  80. (1U << IPATH_S_SDMASINGLEDESCRIPTOR)
  81. #define INFINIPATH_S_SDMAENABLE (1U << IPATH_S_SDMAENABLE)
  82. #define INFINIPATH_S_SDMAHALT (1U << IPATH_S_SDMAHALT)
  83. #define INFINIPATH_S_DISARM (1U << IPATH_S_DISARM)
  84. /* kr_rcvctrl bits that are the same on multiple chips */
  85. #define INFINIPATH_R_PORTENABLE_SHIFT 0
  86. #define INFINIPATH_R_QPMAP_ENABLE (1ULL << 38)
  87. /* kr_intstatus, kr_intclear, kr_intmask bits */
  88. #define INFINIPATH_I_SDMAINT 0x8000000000000000ULL
  89. #define INFINIPATH_I_SDMADISABLED 0x4000000000000000ULL
  90. #define INFINIPATH_I_ERROR 0x0000000080000000ULL
  91. #define INFINIPATH_I_SPIOSENT 0x0000000040000000ULL
  92. #define INFINIPATH_I_SPIOBUFAVAIL 0x0000000020000000ULL
  93. #define INFINIPATH_I_GPIO 0x0000000010000000ULL
  94. #define INFINIPATH_I_JINT 0x0000000004000000ULL
  95. /* kr_errorstatus, kr_errorclear, kr_errormask bits */
  96. #define INFINIPATH_E_RFORMATERR 0x0000000000000001ULL
  97. #define INFINIPATH_E_RVCRC 0x0000000000000002ULL
  98. #define INFINIPATH_E_RICRC 0x0000000000000004ULL
  99. #define INFINIPATH_E_RMINPKTLEN 0x0000000000000008ULL
  100. #define INFINIPATH_E_RMAXPKTLEN 0x0000000000000010ULL
  101. #define INFINIPATH_E_RLONGPKTLEN 0x0000000000000020ULL
  102. #define INFINIPATH_E_RSHORTPKTLEN 0x0000000000000040ULL
  103. #define INFINIPATH_E_RUNEXPCHAR 0x0000000000000080ULL
  104. #define INFINIPATH_E_RUNSUPVL 0x0000000000000100ULL
  105. #define INFINIPATH_E_REBP 0x0000000000000200ULL
  106. #define INFINIPATH_E_RIBFLOW 0x0000000000000400ULL
  107. #define INFINIPATH_E_RBADVERSION 0x0000000000000800ULL
  108. #define INFINIPATH_E_RRCVEGRFULL 0x0000000000001000ULL
  109. #define INFINIPATH_E_RRCVHDRFULL 0x0000000000002000ULL
  110. #define INFINIPATH_E_RBADTID 0x0000000000004000ULL
  111. #define INFINIPATH_E_RHDRLEN 0x0000000000008000ULL
  112. #define INFINIPATH_E_RHDR 0x0000000000010000ULL
  113. #define INFINIPATH_E_RIBLOSTLINK 0x0000000000020000ULL
  114. #define INFINIPATH_E_SENDSPECIALTRIGGER 0x0000000008000000ULL
  115. #define INFINIPATH_E_SDMADISABLED 0x0000000010000000ULL
  116. #define INFINIPATH_E_SMINPKTLEN 0x0000000020000000ULL
  117. #define INFINIPATH_E_SMAXPKTLEN 0x0000000040000000ULL
  118. #define INFINIPATH_E_SUNDERRUN 0x0000000080000000ULL
  119. #define INFINIPATH_E_SPKTLEN 0x0000000100000000ULL
  120. #define INFINIPATH_E_SDROPPEDSMPPKT 0x0000000200000000ULL
  121. #define INFINIPATH_E_SDROPPEDDATAPKT 0x0000000400000000ULL
  122. #define INFINIPATH_E_SPIOARMLAUNCH 0x0000000800000000ULL
  123. #define INFINIPATH_E_SUNEXPERRPKTNUM 0x0000001000000000ULL
  124. #define INFINIPATH_E_SUNSUPVL 0x0000002000000000ULL
  125. #define INFINIPATH_E_SENDBUFMISUSE 0x0000004000000000ULL
  126. #define INFINIPATH_E_SDMAGENMISMATCH 0x0000008000000000ULL
  127. #define INFINIPATH_E_SDMAOUTOFBOUND 0x0000010000000000ULL
  128. #define INFINIPATH_E_SDMATAILOUTOFBOUND 0x0000020000000000ULL
  129. #define INFINIPATH_E_SDMABASE 0x0000040000000000ULL
  130. #define INFINIPATH_E_SDMA1STDESC 0x0000080000000000ULL
  131. #define INFINIPATH_E_SDMARPYTAG 0x0000100000000000ULL
  132. #define INFINIPATH_E_SDMADWEN 0x0000200000000000ULL
  133. #define INFINIPATH_E_SDMAMISSINGDW 0x0000400000000000ULL
  134. #define INFINIPATH_E_SDMAUNEXPDATA 0x0000800000000000ULL
  135. #define INFINIPATH_E_IBSTATUSCHANGED 0x0001000000000000ULL
  136. #define INFINIPATH_E_INVALIDADDR 0x0002000000000000ULL
  137. #define INFINIPATH_E_RESET 0x0004000000000000ULL
  138. #define INFINIPATH_E_HARDWARE 0x0008000000000000ULL
  139. #define INFINIPATH_E_SDMADESCADDRMISALIGN 0x0010000000000000ULL
  140. #define INFINIPATH_E_INVALIDEEPCMD 0x0020000000000000ULL
  141. /*
  142. * this is used to print "common" packet errors only when the
  143. * __IPATH_ERRPKTDBG bit is set in ipath_debug.
  144. */
  145. #define INFINIPATH_E_PKTERRS ( INFINIPATH_E_SPKTLEN \
  146. | INFINIPATH_E_SDROPPEDDATAPKT | INFINIPATH_E_RVCRC \
  147. | INFINIPATH_E_RICRC | INFINIPATH_E_RSHORTPKTLEN \
  148. | INFINIPATH_E_REBP )
  149. /* Convenience for decoding Send DMA errors */
  150. #define INFINIPATH_E_SDMAERRS ( \
  151. INFINIPATH_E_SDMAGENMISMATCH | INFINIPATH_E_SDMAOUTOFBOUND | \
  152. INFINIPATH_E_SDMATAILOUTOFBOUND | INFINIPATH_E_SDMABASE | \
  153. INFINIPATH_E_SDMA1STDESC | INFINIPATH_E_SDMARPYTAG | \
  154. INFINIPATH_E_SDMADWEN | INFINIPATH_E_SDMAMISSINGDW | \
  155. INFINIPATH_E_SDMAUNEXPDATA | \
  156. INFINIPATH_E_SDMADESCADDRMISALIGN | \
  157. INFINIPATH_E_SDMADISABLED | \
  158. INFINIPATH_E_SENDBUFMISUSE)
  159. /* kr_hwerrclear, kr_hwerrmask, kr_hwerrstatus, bits */
  160. /* TXEMEMPARITYERR bit 0: PIObuf, 1: PIOpbc, 2: launchfifo
  161. * RXEMEMPARITYERR bit 0: rcvbuf, 1: lookupq, 2: expTID, 3: eagerTID
  162. * bit 4: flag buffer, 5: datainfo, 6: header info */
  163. #define INFINIPATH_HWE_TXEMEMPARITYERR_MASK 0xFULL
  164. #define INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT 40
  165. #define INFINIPATH_HWE_RXEMEMPARITYERR_MASK 0x7FULL
  166. #define INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT 44
  167. #define INFINIPATH_HWE_IBCBUSTOSPCPARITYERR 0x4000000000000000ULL
  168. #define INFINIPATH_HWE_IBCBUSFRSPCPARITYERR 0x8000000000000000ULL
  169. /* txe mem parity errors (shift by INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT) */
  170. #define INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF 0x1ULL
  171. #define INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC 0x2ULL
  172. #define INFINIPATH_HWE_TXEMEMPARITYERR_PIOLAUNCHFIFO 0x4ULL
  173. /* rxe mem parity errors (shift by INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT) */
  174. #define INFINIPATH_HWE_RXEMEMPARITYERR_RCVBUF 0x01ULL
  175. #define INFINIPATH_HWE_RXEMEMPARITYERR_LOOKUPQ 0x02ULL
  176. #define INFINIPATH_HWE_RXEMEMPARITYERR_EXPTID 0x04ULL
  177. #define INFINIPATH_HWE_RXEMEMPARITYERR_EAGERTID 0x08ULL
  178. #define INFINIPATH_HWE_RXEMEMPARITYERR_FLAGBUF 0x10ULL
  179. #define INFINIPATH_HWE_RXEMEMPARITYERR_DATAINFO 0x20ULL
  180. #define INFINIPATH_HWE_RXEMEMPARITYERR_HDRINFO 0x40ULL
  181. /* waldo specific -- find the rest in ipath_6110.c */
  182. #define INFINIPATH_HWE_RXDSYNCMEMPARITYERR 0x0000000400000000ULL
  183. /* 6120/7220 specific -- find the rest in ipath_6120.c and ipath_7220.c */
  184. #define INFINIPATH_HWE_MEMBISTFAILED 0x0040000000000000ULL
  185. /* kr_hwdiagctrl bits */
  186. #define INFINIPATH_DC_FORCETXEMEMPARITYERR_MASK 0xFULL
  187. #define INFINIPATH_DC_FORCETXEMEMPARITYERR_SHIFT 40
  188. #define INFINIPATH_DC_FORCERXEMEMPARITYERR_MASK 0x7FULL
  189. #define INFINIPATH_DC_FORCERXEMEMPARITYERR_SHIFT 44
  190. #define INFINIPATH_DC_FORCERXDSYNCMEMPARITYERR 0x0000000400000000ULL
  191. #define INFINIPATH_DC_COUNTERDISABLE 0x1000000000000000ULL
  192. #define INFINIPATH_DC_COUNTERWREN 0x2000000000000000ULL
  193. #define INFINIPATH_DC_FORCEIBCBUSTOSPCPARITYERR 0x4000000000000000ULL
  194. #define INFINIPATH_DC_FORCEIBCBUSFRSPCPARITYERR 0x8000000000000000ULL
  195. /* kr_ibcctrl bits */
  196. #define INFINIPATH_IBCC_FLOWCTRLPERIOD_MASK 0xFFULL
  197. #define INFINIPATH_IBCC_FLOWCTRLPERIOD_SHIFT 0
  198. #define INFINIPATH_IBCC_FLOWCTRLWATERMARK_MASK 0xFFULL
  199. #define INFINIPATH_IBCC_FLOWCTRLWATERMARK_SHIFT 8
  200. #define INFINIPATH_IBCC_LINKINITCMD_MASK 0x3ULL
  201. #define INFINIPATH_IBCC_LINKINITCMD_DISABLE 1
  202. /* cycle through TS1/TS2 till OK */
  203. #define INFINIPATH_IBCC_LINKINITCMD_POLL 2
  204. /* wait for TS1, then go on */
  205. #define INFINIPATH_IBCC_LINKINITCMD_SLEEP 3
  206. #define INFINIPATH_IBCC_LINKINITCMD_SHIFT 16
  207. #define INFINIPATH_IBCC_LINKCMD_MASK 0x3ULL
  208. #define INFINIPATH_IBCC_LINKCMD_DOWN 1 /* move to 0x11 */
  209. #define INFINIPATH_IBCC_LINKCMD_ARMED 2 /* move to 0x21 */
  210. #define INFINIPATH_IBCC_LINKCMD_ACTIVE 3 /* move to 0x31 */
  211. #define INFINIPATH_IBCC_LINKCMD_SHIFT 18
  212. #define INFINIPATH_IBCC_MAXPKTLEN_MASK 0x7FFULL
  213. #define INFINIPATH_IBCC_MAXPKTLEN_SHIFT 20
  214. #define INFINIPATH_IBCC_PHYERRTHRESHOLD_MASK 0xFULL
  215. #define INFINIPATH_IBCC_PHYERRTHRESHOLD_SHIFT 32
  216. #define INFINIPATH_IBCC_OVERRUNTHRESHOLD_MASK 0xFULL
  217. #define INFINIPATH_IBCC_OVERRUNTHRESHOLD_SHIFT 36
  218. #define INFINIPATH_IBCC_CREDITSCALE_MASK 0x7ULL
  219. #define INFINIPATH_IBCC_CREDITSCALE_SHIFT 40
  220. #define INFINIPATH_IBCC_LOOPBACK 0x8000000000000000ULL
  221. #define INFINIPATH_IBCC_LINKDOWNDEFAULTSTATE 0x4000000000000000ULL
  222. /* kr_ibcstatus bits */
  223. #define INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT 0
  224. #define INFINIPATH_IBCS_LINKSTATE_MASK 0x7
  225. #define INFINIPATH_IBCS_TXREADY 0x40000000
  226. #define INFINIPATH_IBCS_TXCREDITOK 0x80000000
  227. /* link training states (shift by
  228. INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT) */
  229. #define INFINIPATH_IBCS_LT_STATE_DISABLED 0x00
  230. #define INFINIPATH_IBCS_LT_STATE_LINKUP 0x01
  231. #define INFINIPATH_IBCS_LT_STATE_POLLACTIVE 0x02
  232. #define INFINIPATH_IBCS_LT_STATE_POLLQUIET 0x03
  233. #define INFINIPATH_IBCS_LT_STATE_SLEEPDELAY 0x04
  234. #define INFINIPATH_IBCS_LT_STATE_SLEEPQUIET 0x05
  235. #define INFINIPATH_IBCS_LT_STATE_CFGDEBOUNCE 0x08
  236. #define INFINIPATH_IBCS_LT_STATE_CFGRCVFCFG 0x09
  237. #define INFINIPATH_IBCS_LT_STATE_CFGWAITRMT 0x0a
  238. #define INFINIPATH_IBCS_LT_STATE_CFGIDLE 0x0b
  239. #define INFINIPATH_IBCS_LT_STATE_RECOVERRETRAIN 0x0c
  240. #define INFINIPATH_IBCS_LT_STATE_RECOVERWAITRMT 0x0e
  241. #define INFINIPATH_IBCS_LT_STATE_RECOVERIDLE 0x0f
  242. /* link state machine states (shift by ibcs_ls_shift) */
  243. #define INFINIPATH_IBCS_L_STATE_DOWN 0x0
  244. #define INFINIPATH_IBCS_L_STATE_INIT 0x1
  245. #define INFINIPATH_IBCS_L_STATE_ARM 0x2
  246. #define INFINIPATH_IBCS_L_STATE_ACTIVE 0x3
  247. #define INFINIPATH_IBCS_L_STATE_ACT_DEFER 0x4
  248. /* kr_extstatus bits */
  249. #define INFINIPATH_EXTS_SERDESPLLLOCK 0x1
  250. #define INFINIPATH_EXTS_GPIOIN_MASK 0xFFFFULL
  251. #define INFINIPATH_EXTS_GPIOIN_SHIFT 48
  252. /* kr_extctrl bits */
  253. #define INFINIPATH_EXTC_GPIOINVERT_MASK 0xFFFFULL
  254. #define INFINIPATH_EXTC_GPIOINVERT_SHIFT 32
  255. #define INFINIPATH_EXTC_GPIOOE_MASK 0xFFFFULL
  256. #define INFINIPATH_EXTC_GPIOOE_SHIFT 48
  257. #define INFINIPATH_EXTC_SERDESENABLE 0x80000000ULL
  258. #define INFINIPATH_EXTC_SERDESCONNECT 0x40000000ULL
  259. #define INFINIPATH_EXTC_SERDESENTRUNKING 0x20000000ULL
  260. #define INFINIPATH_EXTC_SERDESDISRXFIFO 0x10000000ULL
  261. #define INFINIPATH_EXTC_SERDESENPLPBK1 0x08000000ULL
  262. #define INFINIPATH_EXTC_SERDESENPLPBK2 0x04000000ULL
  263. #define INFINIPATH_EXTC_SERDESENENCDEC 0x02000000ULL
  264. #define INFINIPATH_EXTC_LED1SECPORT_ON 0x00000020ULL
  265. #define INFINIPATH_EXTC_LED2SECPORT_ON 0x00000010ULL
  266. #define INFINIPATH_EXTC_LED1PRIPORT_ON 0x00000008ULL
  267. #define INFINIPATH_EXTC_LED2PRIPORT_ON 0x00000004ULL
  268. #define INFINIPATH_EXTC_LEDGBLOK_ON 0x00000002ULL
  269. #define INFINIPATH_EXTC_LEDGBLERR_OFF 0x00000001ULL
  270. /* kr_partitionkey bits */
  271. #define INFINIPATH_PKEY_SIZE 16
  272. #define INFINIPATH_PKEY_MASK 0xFFFF
  273. #define INFINIPATH_PKEY_DEFAULT_PKEY 0xFFFF
  274. /* kr_serdesconfig0 bits */
  275. #define INFINIPATH_SERDC0_RESET_MASK 0xfULL /* overal reset bits */
  276. #define INFINIPATH_SERDC0_RESET_PLL 0x10000000ULL /* pll reset */
  277. /* tx idle enables (per lane) */
  278. #define INFINIPATH_SERDC0_TXIDLE 0xF000ULL
  279. /* rx detect enables (per lane) */
  280. #define INFINIPATH_SERDC0_RXDETECT_EN 0xF0000ULL
  281. /* L1 Power down; use with RXDETECT, Otherwise not used on IB side */
  282. #define INFINIPATH_SERDC0_L1PWR_DN 0xF0ULL
  283. /* common kr_xgxsconfig bits (or safe in all, even if not implemented) */
  284. #define INFINIPATH_XGXS_RX_POL_SHIFT 19
  285. #define INFINIPATH_XGXS_RX_POL_MASK 0xfULL
  286. /*
  287. * IPATH_PIO_MAXIBHDR is the max IB header size allowed for in our
  288. * PIO send buffers. This is well beyond anything currently
  289. * defined in the InfiniBand spec.
  290. */
  291. #define IPATH_PIO_MAXIBHDR 128
  292. typedef u64 ipath_err_t;
  293. /* The following change with the type of device, so
  294. * need to be part of the ipath_devdata struct, or
  295. * we could have problems plugging in devices of
  296. * different types (e.g. one HT, one PCIE)
  297. * in one system, to be managed by one driver.
  298. * On the other hand, this file is may also be included
  299. * by other code, so leave the declarations here
  300. * temporarily. Minor footprint issue if common-model
  301. * linker used, none if C89+ linker used.
  302. */
  303. /* mask of defined bits for various registers */
  304. extern u64 infinipath_i_bitsextant;
  305. extern ipath_err_t infinipath_e_bitsextant, infinipath_hwe_bitsextant;
  306. /* masks that are different in various chips, or only exist in some chips */
  307. extern u32 infinipath_i_rcvavail_mask, infinipath_i_rcvurg_mask;
  308. /*
  309. * These are the infinipath general register numbers (not offsets).
  310. * The kernel registers are used directly, those beyond the kernel
  311. * registers are calculated from one of the base registers. The use of
  312. * an integer type doesn't allow type-checking as thorough as, say,
  313. * an enum but allows for better hiding of chip differences.
  314. */
  315. typedef const u16 ipath_kreg, /* infinipath general registers */
  316. ipath_creg, /* infinipath counter registers */
  317. ipath_sreg; /* kernel-only, infinipath send registers */
  318. /*
  319. * These are the chip registers common to all infinipath chips, and
  320. * used both by the kernel and the diagnostics or other user code.
  321. * They are all implemented such that 64 bit accesses work.
  322. * Some implement no more than 32 bits. Because 64 bit reads
  323. * require 2 HT cmds on opteron, we access those with 32 bit
  324. * reads for efficiency (they are written as 64 bits, since
  325. * the extra 32 bits are nearly free on writes, and it slightly reduces
  326. * complexity). The rest are all accessed as 64 bits.
  327. */
  328. struct ipath_kregs {
  329. /* These are the 32 bit group */
  330. ipath_kreg kr_control;
  331. ipath_kreg kr_counterregbase;
  332. ipath_kreg kr_intmask;
  333. ipath_kreg kr_intstatus;
  334. ipath_kreg kr_pagealign;
  335. ipath_kreg kr_portcnt;
  336. ipath_kreg kr_rcvtidbase;
  337. ipath_kreg kr_rcvtidcnt;
  338. ipath_kreg kr_rcvegrbase;
  339. ipath_kreg kr_rcvegrcnt;
  340. ipath_kreg kr_scratch;
  341. ipath_kreg kr_sendctrl;
  342. ipath_kreg kr_sendpiobufbase;
  343. ipath_kreg kr_sendpiobufcnt;
  344. ipath_kreg kr_sendpiosize;
  345. ipath_kreg kr_sendregbase;
  346. ipath_kreg kr_userregbase;
  347. /* These are the 64 bit group */
  348. ipath_kreg kr_debugport;
  349. ipath_kreg kr_debugportselect;
  350. ipath_kreg kr_errorclear;
  351. ipath_kreg kr_errormask;
  352. ipath_kreg kr_errorstatus;
  353. ipath_kreg kr_extctrl;
  354. ipath_kreg kr_extstatus;
  355. ipath_kreg kr_gpio_clear;
  356. ipath_kreg kr_gpio_mask;
  357. ipath_kreg kr_gpio_out;
  358. ipath_kreg kr_gpio_status;
  359. ipath_kreg kr_hwdiagctrl;
  360. ipath_kreg kr_hwerrclear;
  361. ipath_kreg kr_hwerrmask;
  362. ipath_kreg kr_hwerrstatus;
  363. ipath_kreg kr_ibcctrl;
  364. ipath_kreg kr_ibcstatus;
  365. ipath_kreg kr_intblocked;
  366. ipath_kreg kr_intclear;
  367. ipath_kreg kr_interruptconfig;
  368. ipath_kreg kr_mdio;
  369. ipath_kreg kr_partitionkey;
  370. ipath_kreg kr_rcvbthqp;
  371. ipath_kreg kr_rcvbufbase;
  372. ipath_kreg kr_rcvbufsize;
  373. ipath_kreg kr_rcvctrl;
  374. ipath_kreg kr_rcvhdrcnt;
  375. ipath_kreg kr_rcvhdrentsize;
  376. ipath_kreg kr_rcvhdrsize;
  377. ipath_kreg kr_rcvintmembase;
  378. ipath_kreg kr_rcvintmemsize;
  379. ipath_kreg kr_revision;
  380. ipath_kreg kr_sendbuffererror;
  381. ipath_kreg kr_sendpioavailaddr;
  382. ipath_kreg kr_serdesconfig0;
  383. ipath_kreg kr_serdesconfig1;
  384. ipath_kreg kr_serdesstatus;
  385. ipath_kreg kr_txintmembase;
  386. ipath_kreg kr_txintmemsize;
  387. ipath_kreg kr_xgxsconfig;
  388. ipath_kreg kr_ibpllcfg;
  389. /* use these two (and the following N ports) only with
  390. * ipath_k*_kreg64_port(); not *kreg64() */
  391. ipath_kreg kr_rcvhdraddr;
  392. ipath_kreg kr_rcvhdrtailaddr;
  393. /* remaining registers are not present on all types of infinipath
  394. chips */
  395. ipath_kreg kr_rcvpktledcnt;
  396. ipath_kreg kr_pcierbuftestreg0;
  397. ipath_kreg kr_pcierbuftestreg1;
  398. ipath_kreg kr_pcieq0serdesconfig0;
  399. ipath_kreg kr_pcieq0serdesconfig1;
  400. ipath_kreg kr_pcieq0serdesstatus;
  401. ipath_kreg kr_pcieq1serdesconfig0;
  402. ipath_kreg kr_pcieq1serdesconfig1;
  403. ipath_kreg kr_pcieq1serdesstatus;
  404. ipath_kreg kr_hrtbt_guid;
  405. ipath_kreg kr_ibcddrctrl;
  406. ipath_kreg kr_ibcddrstatus;
  407. ipath_kreg kr_jintreload;
  408. /* send dma related regs */
  409. ipath_kreg kr_senddmabase;
  410. ipath_kreg kr_senddmalengen;
  411. ipath_kreg kr_senddmatail;
  412. ipath_kreg kr_senddmahead;
  413. ipath_kreg kr_senddmaheadaddr;
  414. ipath_kreg kr_senddmabufmask0;
  415. ipath_kreg kr_senddmabufmask1;
  416. ipath_kreg kr_senddmabufmask2;
  417. ipath_kreg kr_senddmastatus;
  418. /* SerDes related regs (IBA7220-only) */
  419. ipath_kreg kr_ibserdesctrl;
  420. ipath_kreg kr_ib_epbacc;
  421. ipath_kreg kr_ib_epbtrans;
  422. ipath_kreg kr_pcie_epbacc;
  423. ipath_kreg kr_pcie_epbtrans;
  424. ipath_kreg kr_ib_ddsrxeq;
  425. };
  426. struct ipath_cregs {
  427. ipath_creg cr_badformatcnt;
  428. ipath_creg cr_erricrccnt;
  429. ipath_creg cr_errlinkcnt;
  430. ipath_creg cr_errlpcrccnt;
  431. ipath_creg cr_errpkey;
  432. ipath_creg cr_errrcvflowctrlcnt;
  433. ipath_creg cr_err_rlencnt;
  434. ipath_creg cr_errslencnt;
  435. ipath_creg cr_errtidfull;
  436. ipath_creg cr_errtidvalid;
  437. ipath_creg cr_errvcrccnt;
  438. ipath_creg cr_ibstatuschange;
  439. ipath_creg cr_intcnt;
  440. ipath_creg cr_invalidrlencnt;
  441. ipath_creg cr_invalidslencnt;
  442. ipath_creg cr_lbflowstallcnt;
  443. ipath_creg cr_iblinkdowncnt;
  444. ipath_creg cr_iblinkerrrecovcnt;
  445. ipath_creg cr_ibsymbolerrcnt;
  446. ipath_creg cr_pktrcvcnt;
  447. ipath_creg cr_pktrcvflowctrlcnt;
  448. ipath_creg cr_pktsendcnt;
  449. ipath_creg cr_pktsendflowcnt;
  450. ipath_creg cr_portovflcnt;
  451. ipath_creg cr_rcvebpcnt;
  452. ipath_creg cr_rcvovflcnt;
  453. ipath_creg cr_rxdroppktcnt;
  454. ipath_creg cr_senddropped;
  455. ipath_creg cr_sendstallcnt;
  456. ipath_creg cr_sendunderruncnt;
  457. ipath_creg cr_unsupvlcnt;
  458. ipath_creg cr_wordrcvcnt;
  459. ipath_creg cr_wordsendcnt;
  460. ipath_creg cr_vl15droppedpktcnt;
  461. ipath_creg cr_rxotherlocalphyerrcnt;
  462. ipath_creg cr_excessbufferovflcnt;
  463. ipath_creg cr_locallinkintegrityerrcnt;
  464. ipath_creg cr_rxvlerrcnt;
  465. ipath_creg cr_rxdlidfltrcnt;
  466. ipath_creg cr_psstat;
  467. ipath_creg cr_psstart;
  468. ipath_creg cr_psinterval;
  469. ipath_creg cr_psrcvdatacount;
  470. ipath_creg cr_psrcvpktscount;
  471. ipath_creg cr_psxmitdatacount;
  472. ipath_creg cr_psxmitpktscount;
  473. ipath_creg cr_psxmitwaitcount;
  474. };
  475. #endif /* _IPATH_REGISTERS_H */