ipath_iba6120.c 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354
  1. /*
  2. * Copyright (c) 2006 QLogic, Inc. 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. /*
  34. * This file contains all of the code that is specific to the
  35. * InfiniPath PCIe chip.
  36. */
  37. #include <linux/interrupt.h>
  38. #include <linux/pci.h>
  39. #include <linux/delay.h>
  40. #include "ipath_kernel.h"
  41. #include "ipath_registers.h"
  42. /*
  43. * This file contains all the chip-specific register information and
  44. * access functions for the QLogic InfiniPath PCI-Express chip.
  45. *
  46. * This lists the InfiniPath registers, in the actual chip layout.
  47. * This structure should never be directly accessed.
  48. */
  49. struct _infinipath_do_not_use_kernel_regs {
  50. unsigned long long Revision;
  51. unsigned long long Control;
  52. unsigned long long PageAlign;
  53. unsigned long long PortCnt;
  54. unsigned long long DebugPortSelect;
  55. unsigned long long Reserved0;
  56. unsigned long long SendRegBase;
  57. unsigned long long UserRegBase;
  58. unsigned long long CounterRegBase;
  59. unsigned long long Scratch;
  60. unsigned long long Reserved1;
  61. unsigned long long Reserved2;
  62. unsigned long long IntBlocked;
  63. unsigned long long IntMask;
  64. unsigned long long IntStatus;
  65. unsigned long long IntClear;
  66. unsigned long long ErrorMask;
  67. unsigned long long ErrorStatus;
  68. unsigned long long ErrorClear;
  69. unsigned long long HwErrMask;
  70. unsigned long long HwErrStatus;
  71. unsigned long long HwErrClear;
  72. unsigned long long HwDiagCtrl;
  73. unsigned long long MDIO;
  74. unsigned long long IBCStatus;
  75. unsigned long long IBCCtrl;
  76. unsigned long long ExtStatus;
  77. unsigned long long ExtCtrl;
  78. unsigned long long GPIOOut;
  79. unsigned long long GPIOMask;
  80. unsigned long long GPIOStatus;
  81. unsigned long long GPIOClear;
  82. unsigned long long RcvCtrl;
  83. unsigned long long RcvBTHQP;
  84. unsigned long long RcvHdrSize;
  85. unsigned long long RcvHdrCnt;
  86. unsigned long long RcvHdrEntSize;
  87. unsigned long long RcvTIDBase;
  88. unsigned long long RcvTIDCnt;
  89. unsigned long long RcvEgrBase;
  90. unsigned long long RcvEgrCnt;
  91. unsigned long long RcvBufBase;
  92. unsigned long long RcvBufSize;
  93. unsigned long long RxIntMemBase;
  94. unsigned long long RxIntMemSize;
  95. unsigned long long RcvPartitionKey;
  96. unsigned long long Reserved3;
  97. unsigned long long RcvPktLEDCnt;
  98. unsigned long long Reserved4[8];
  99. unsigned long long SendCtrl;
  100. unsigned long long SendPIOBufBase;
  101. unsigned long long SendPIOSize;
  102. unsigned long long SendPIOBufCnt;
  103. unsigned long long SendPIOAvailAddr;
  104. unsigned long long TxIntMemBase;
  105. unsigned long long TxIntMemSize;
  106. unsigned long long Reserved5;
  107. unsigned long long PCIeRBufTestReg0;
  108. unsigned long long PCIeRBufTestReg1;
  109. unsigned long long Reserved51[6];
  110. unsigned long long SendBufferError;
  111. unsigned long long SendBufferErrorCONT1;
  112. unsigned long long Reserved6SBE[6];
  113. unsigned long long RcvHdrAddr0;
  114. unsigned long long RcvHdrAddr1;
  115. unsigned long long RcvHdrAddr2;
  116. unsigned long long RcvHdrAddr3;
  117. unsigned long long RcvHdrAddr4;
  118. unsigned long long Reserved7RHA[11];
  119. unsigned long long RcvHdrTailAddr0;
  120. unsigned long long RcvHdrTailAddr1;
  121. unsigned long long RcvHdrTailAddr2;
  122. unsigned long long RcvHdrTailAddr3;
  123. unsigned long long RcvHdrTailAddr4;
  124. unsigned long long Reserved8RHTA[11];
  125. unsigned long long Reserved9SW[8];
  126. unsigned long long SerdesConfig0;
  127. unsigned long long SerdesConfig1;
  128. unsigned long long SerdesStatus;
  129. unsigned long long XGXSConfig;
  130. unsigned long long IBPLLCfg;
  131. unsigned long long Reserved10SW2[3];
  132. unsigned long long PCIEQ0SerdesConfig0;
  133. unsigned long long PCIEQ0SerdesConfig1;
  134. unsigned long long PCIEQ0SerdesStatus;
  135. unsigned long long Reserved11;
  136. unsigned long long PCIEQ1SerdesConfig0;
  137. unsigned long long PCIEQ1SerdesConfig1;
  138. unsigned long long PCIEQ1SerdesStatus;
  139. unsigned long long Reserved12;
  140. };
  141. #define IPATH_KREG_OFFSET(field) (offsetof(struct \
  142. _infinipath_do_not_use_kernel_regs, field) / sizeof(u64))
  143. #define IPATH_CREG_OFFSET(field) (offsetof( \
  144. struct infinipath_counters, field) / sizeof(u64))
  145. static const struct ipath_kregs ipath_pe_kregs = {
  146. .kr_control = IPATH_KREG_OFFSET(Control),
  147. .kr_counterregbase = IPATH_KREG_OFFSET(CounterRegBase),
  148. .kr_debugportselect = IPATH_KREG_OFFSET(DebugPortSelect),
  149. .kr_errorclear = IPATH_KREG_OFFSET(ErrorClear),
  150. .kr_errormask = IPATH_KREG_OFFSET(ErrorMask),
  151. .kr_errorstatus = IPATH_KREG_OFFSET(ErrorStatus),
  152. .kr_extctrl = IPATH_KREG_OFFSET(ExtCtrl),
  153. .kr_extstatus = IPATH_KREG_OFFSET(ExtStatus),
  154. .kr_gpio_clear = IPATH_KREG_OFFSET(GPIOClear),
  155. .kr_gpio_mask = IPATH_KREG_OFFSET(GPIOMask),
  156. .kr_gpio_out = IPATH_KREG_OFFSET(GPIOOut),
  157. .kr_gpio_status = IPATH_KREG_OFFSET(GPIOStatus),
  158. .kr_hwdiagctrl = IPATH_KREG_OFFSET(HwDiagCtrl),
  159. .kr_hwerrclear = IPATH_KREG_OFFSET(HwErrClear),
  160. .kr_hwerrmask = IPATH_KREG_OFFSET(HwErrMask),
  161. .kr_hwerrstatus = IPATH_KREG_OFFSET(HwErrStatus),
  162. .kr_ibcctrl = IPATH_KREG_OFFSET(IBCCtrl),
  163. .kr_ibcstatus = IPATH_KREG_OFFSET(IBCStatus),
  164. .kr_intblocked = IPATH_KREG_OFFSET(IntBlocked),
  165. .kr_intclear = IPATH_KREG_OFFSET(IntClear),
  166. .kr_intmask = IPATH_KREG_OFFSET(IntMask),
  167. .kr_intstatus = IPATH_KREG_OFFSET(IntStatus),
  168. .kr_mdio = IPATH_KREG_OFFSET(MDIO),
  169. .kr_pagealign = IPATH_KREG_OFFSET(PageAlign),
  170. .kr_partitionkey = IPATH_KREG_OFFSET(RcvPartitionKey),
  171. .kr_portcnt = IPATH_KREG_OFFSET(PortCnt),
  172. .kr_rcvbthqp = IPATH_KREG_OFFSET(RcvBTHQP),
  173. .kr_rcvbufbase = IPATH_KREG_OFFSET(RcvBufBase),
  174. .kr_rcvbufsize = IPATH_KREG_OFFSET(RcvBufSize),
  175. .kr_rcvctrl = IPATH_KREG_OFFSET(RcvCtrl),
  176. .kr_rcvegrbase = IPATH_KREG_OFFSET(RcvEgrBase),
  177. .kr_rcvegrcnt = IPATH_KREG_OFFSET(RcvEgrCnt),
  178. .kr_rcvhdrcnt = IPATH_KREG_OFFSET(RcvHdrCnt),
  179. .kr_rcvhdrentsize = IPATH_KREG_OFFSET(RcvHdrEntSize),
  180. .kr_rcvhdrsize = IPATH_KREG_OFFSET(RcvHdrSize),
  181. .kr_rcvintmembase = IPATH_KREG_OFFSET(RxIntMemBase),
  182. .kr_rcvintmemsize = IPATH_KREG_OFFSET(RxIntMemSize),
  183. .kr_rcvtidbase = IPATH_KREG_OFFSET(RcvTIDBase),
  184. .kr_rcvtidcnt = IPATH_KREG_OFFSET(RcvTIDCnt),
  185. .kr_revision = IPATH_KREG_OFFSET(Revision),
  186. .kr_scratch = IPATH_KREG_OFFSET(Scratch),
  187. .kr_sendbuffererror = IPATH_KREG_OFFSET(SendBufferError),
  188. .kr_sendctrl = IPATH_KREG_OFFSET(SendCtrl),
  189. .kr_sendpioavailaddr = IPATH_KREG_OFFSET(SendPIOAvailAddr),
  190. .kr_sendpiobufbase = IPATH_KREG_OFFSET(SendPIOBufBase),
  191. .kr_sendpiobufcnt = IPATH_KREG_OFFSET(SendPIOBufCnt),
  192. .kr_sendpiosize = IPATH_KREG_OFFSET(SendPIOSize),
  193. .kr_sendregbase = IPATH_KREG_OFFSET(SendRegBase),
  194. .kr_txintmembase = IPATH_KREG_OFFSET(TxIntMemBase),
  195. .kr_txintmemsize = IPATH_KREG_OFFSET(TxIntMemSize),
  196. .kr_userregbase = IPATH_KREG_OFFSET(UserRegBase),
  197. .kr_serdesconfig0 = IPATH_KREG_OFFSET(SerdesConfig0),
  198. .kr_serdesconfig1 = IPATH_KREG_OFFSET(SerdesConfig1),
  199. .kr_serdesstatus = IPATH_KREG_OFFSET(SerdesStatus),
  200. .kr_xgxsconfig = IPATH_KREG_OFFSET(XGXSConfig),
  201. .kr_ibpllcfg = IPATH_KREG_OFFSET(IBPLLCfg),
  202. /*
  203. * These should not be used directly via ipath_read_kreg64(),
  204. * use them with ipath_read_kreg64_port()
  205. */
  206. .kr_rcvhdraddr = IPATH_KREG_OFFSET(RcvHdrAddr0),
  207. .kr_rcvhdrtailaddr = IPATH_KREG_OFFSET(RcvHdrTailAddr0),
  208. /* The rcvpktled register controls one of the debug port signals, so
  209. * a packet activity LED can be connected to it. */
  210. .kr_rcvpktledcnt = IPATH_KREG_OFFSET(RcvPktLEDCnt),
  211. .kr_pcierbuftestreg0 = IPATH_KREG_OFFSET(PCIeRBufTestReg0),
  212. .kr_pcierbuftestreg1 = IPATH_KREG_OFFSET(PCIeRBufTestReg1),
  213. .kr_pcieq0serdesconfig0 = IPATH_KREG_OFFSET(PCIEQ0SerdesConfig0),
  214. .kr_pcieq0serdesconfig1 = IPATH_KREG_OFFSET(PCIEQ0SerdesConfig1),
  215. .kr_pcieq0serdesstatus = IPATH_KREG_OFFSET(PCIEQ0SerdesStatus),
  216. .kr_pcieq1serdesconfig0 = IPATH_KREG_OFFSET(PCIEQ1SerdesConfig0),
  217. .kr_pcieq1serdesconfig1 = IPATH_KREG_OFFSET(PCIEQ1SerdesConfig1),
  218. .kr_pcieq1serdesstatus = IPATH_KREG_OFFSET(PCIEQ1SerdesStatus)
  219. };
  220. static const struct ipath_cregs ipath_pe_cregs = {
  221. .cr_badformatcnt = IPATH_CREG_OFFSET(RxBadFormatCnt),
  222. .cr_erricrccnt = IPATH_CREG_OFFSET(RxICRCErrCnt),
  223. .cr_errlinkcnt = IPATH_CREG_OFFSET(RxLinkProblemCnt),
  224. .cr_errlpcrccnt = IPATH_CREG_OFFSET(RxLPCRCErrCnt),
  225. .cr_errpkey = IPATH_CREG_OFFSET(RxPKeyMismatchCnt),
  226. .cr_errrcvflowctrlcnt = IPATH_CREG_OFFSET(RxFlowCtrlErrCnt),
  227. .cr_err_rlencnt = IPATH_CREG_OFFSET(RxLenErrCnt),
  228. .cr_errslencnt = IPATH_CREG_OFFSET(TxLenErrCnt),
  229. .cr_errtidfull = IPATH_CREG_OFFSET(RxTIDFullErrCnt),
  230. .cr_errtidvalid = IPATH_CREG_OFFSET(RxTIDValidErrCnt),
  231. .cr_errvcrccnt = IPATH_CREG_OFFSET(RxVCRCErrCnt),
  232. .cr_ibstatuschange = IPATH_CREG_OFFSET(IBStatusChangeCnt),
  233. .cr_intcnt = IPATH_CREG_OFFSET(LBIntCnt),
  234. .cr_invalidrlencnt = IPATH_CREG_OFFSET(RxMaxMinLenErrCnt),
  235. .cr_invalidslencnt = IPATH_CREG_OFFSET(TxMaxMinLenErrCnt),
  236. .cr_lbflowstallcnt = IPATH_CREG_OFFSET(LBFlowStallCnt),
  237. .cr_pktrcvcnt = IPATH_CREG_OFFSET(RxDataPktCnt),
  238. .cr_pktrcvflowctrlcnt = IPATH_CREG_OFFSET(RxFlowPktCnt),
  239. .cr_pktsendcnt = IPATH_CREG_OFFSET(TxDataPktCnt),
  240. .cr_pktsendflowcnt = IPATH_CREG_OFFSET(TxFlowPktCnt),
  241. .cr_portovflcnt = IPATH_CREG_OFFSET(RxP0HdrEgrOvflCnt),
  242. .cr_rcvebpcnt = IPATH_CREG_OFFSET(RxEBPCnt),
  243. .cr_rcvovflcnt = IPATH_CREG_OFFSET(RxBufOvflCnt),
  244. .cr_senddropped = IPATH_CREG_OFFSET(TxDroppedPktCnt),
  245. .cr_sendstallcnt = IPATH_CREG_OFFSET(TxFlowStallCnt),
  246. .cr_sendunderruncnt = IPATH_CREG_OFFSET(TxUnderrunCnt),
  247. .cr_wordrcvcnt = IPATH_CREG_OFFSET(RxDwordCnt),
  248. .cr_wordsendcnt = IPATH_CREG_OFFSET(TxDwordCnt),
  249. .cr_unsupvlcnt = IPATH_CREG_OFFSET(TxUnsupVLErrCnt),
  250. .cr_rxdroppktcnt = IPATH_CREG_OFFSET(RxDroppedPktCnt),
  251. .cr_iblinkerrrecovcnt = IPATH_CREG_OFFSET(IBLinkErrRecoveryCnt),
  252. .cr_iblinkdowncnt = IPATH_CREG_OFFSET(IBLinkDownedCnt),
  253. .cr_ibsymbolerrcnt = IPATH_CREG_OFFSET(IBSymbolErrCnt)
  254. };
  255. /* kr_intstatus, kr_intclear, kr_intmask bits */
  256. #define INFINIPATH_I_RCVURG_MASK 0x1F
  257. #define INFINIPATH_I_RCVAVAIL_MASK 0x1F
  258. /* kr_hwerrclear, kr_hwerrmask, kr_hwerrstatus, bits */
  259. #define INFINIPATH_HWE_PCIEMEMPARITYERR_MASK 0x000000000000003fULL
  260. #define INFINIPATH_HWE_PCIEMEMPARITYERR_SHIFT 0
  261. #define INFINIPATH_HWE_PCIEPOISONEDTLP 0x0000000010000000ULL
  262. #define INFINIPATH_HWE_PCIECPLTIMEOUT 0x0000000020000000ULL
  263. #define INFINIPATH_HWE_PCIEBUSPARITYXTLH 0x0000000040000000ULL
  264. #define INFINIPATH_HWE_PCIEBUSPARITYXADM 0x0000000080000000ULL
  265. #define INFINIPATH_HWE_PCIEBUSPARITYRADM 0x0000000100000000ULL
  266. #define INFINIPATH_HWE_COREPLL_FBSLIP 0x0080000000000000ULL
  267. #define INFINIPATH_HWE_COREPLL_RFSLIP 0x0100000000000000ULL
  268. #define INFINIPATH_HWE_PCIE1PLLFAILED 0x0400000000000000ULL
  269. #define INFINIPATH_HWE_PCIE0PLLFAILED 0x0800000000000000ULL
  270. #define INFINIPATH_HWE_SERDESPLLFAILED 0x1000000000000000ULL
  271. /* kr_extstatus bits */
  272. #define INFINIPATH_EXTS_FREQSEL 0x2
  273. #define INFINIPATH_EXTS_SERDESSEL 0x4
  274. #define INFINIPATH_EXTS_MEMBIST_ENDTEST 0x0000000000004000
  275. #define INFINIPATH_EXTS_MEMBIST_FOUND 0x0000000000008000
  276. #define _IPATH_GPIO_SDA_NUM 1
  277. #define _IPATH_GPIO_SCL_NUM 0
  278. #define IPATH_GPIO_SDA (1ULL << \
  279. (_IPATH_GPIO_SDA_NUM+INFINIPATH_EXTC_GPIOOE_SHIFT))
  280. #define IPATH_GPIO_SCL (1ULL << \
  281. (_IPATH_GPIO_SCL_NUM+INFINIPATH_EXTC_GPIOOE_SHIFT))
  282. /*
  283. * Rev2 silicon allows suppressing check for ArmLaunch errors.
  284. * this can speed up short packet sends on systems that do
  285. * not guaranteee write-order.
  286. */
  287. #define INFINIPATH_XGXS_SUPPRESS_ARMLAUNCH_ERR (1ULL<<63)
  288. /**
  289. * ipath_pe_handle_hwerrors - display hardware errors.
  290. * @dd: the infinipath device
  291. * @msg: the output buffer
  292. * @msgl: the size of the output buffer
  293. *
  294. * Use same msg buffer as regular errors to avoid excessive stack
  295. * use. Most hardware errors are catastrophic, but for right now,
  296. * we'll print them and continue. We reuse the same message buffer as
  297. * ipath_handle_errors() to avoid excessive stack usage.
  298. */
  299. static void ipath_pe_handle_hwerrors(struct ipath_devdata *dd, char *msg,
  300. size_t msgl)
  301. {
  302. ipath_err_t hwerrs;
  303. u32 bits, ctrl;
  304. int isfatal = 0;
  305. char bitsmsg[64];
  306. hwerrs = ipath_read_kreg64(dd, dd->ipath_kregs->kr_hwerrstatus);
  307. if (!hwerrs) {
  308. /*
  309. * better than printing cofusing messages
  310. * This seems to be related to clearing the crc error, or
  311. * the pll error during init.
  312. */
  313. ipath_cdbg(VERBOSE, "Called but no hardware errors set\n");
  314. return;
  315. } else if (hwerrs == ~0ULL) {
  316. ipath_dev_err(dd, "Read of hardware error status failed "
  317. "(all bits set); ignoring\n");
  318. return;
  319. }
  320. ipath_stats.sps_hwerrs++;
  321. /* Always clear the error status register, except MEMBISTFAIL,
  322. * regardless of whether we continue or stop using the chip.
  323. * We want that set so we know it failed, even across driver reload.
  324. * We'll still ignore it in the hwerrmask. We do this partly for
  325. * diagnostics, but also for support */
  326. ipath_write_kreg(dd, dd->ipath_kregs->kr_hwerrclear,
  327. hwerrs&~INFINIPATH_HWE_MEMBISTFAILED);
  328. hwerrs &= dd->ipath_hwerrmask;
  329. /*
  330. * make sure we get this much out, unless told to be quiet,
  331. * or it's occurred within the last 5 seconds
  332. */
  333. if ((hwerrs & ~dd->ipath_lasthwerror) ||
  334. (ipath_debug & __IPATH_VERBDBG))
  335. dev_info(&dd->pcidev->dev, "Hardware error: hwerr=0x%llx "
  336. "(cleared)\n", (unsigned long long) hwerrs);
  337. dd->ipath_lasthwerror |= hwerrs;
  338. if (hwerrs & ~infinipath_hwe_bitsextant)
  339. ipath_dev_err(dd, "hwerror interrupt with unknown errors "
  340. "%llx set\n", (unsigned long long)
  341. (hwerrs & ~infinipath_hwe_bitsextant));
  342. ctrl = ipath_read_kreg32(dd, dd->ipath_kregs->kr_control);
  343. if (ctrl & INFINIPATH_C_FREEZEMODE) {
  344. if (hwerrs) {
  345. /*
  346. * if any set that we aren't ignoring only make the
  347. * complaint once, in case it's stuck or recurring,
  348. * and we get here multiple times
  349. */
  350. if (dd->ipath_flags & IPATH_INITTED) {
  351. ipath_dev_err(dd, "Fatal Hardware Error (freeze "
  352. "mode), no longer usable, SN %.16s\n",
  353. dd->ipath_serial);
  354. isfatal = 1;
  355. }
  356. /*
  357. * Mark as having had an error for driver, and also
  358. * for /sys and status word mapped to user programs.
  359. * This marks unit as not usable, until reset
  360. */
  361. *dd->ipath_statusp &= ~IPATH_STATUS_IB_READY;
  362. *dd->ipath_statusp |= IPATH_STATUS_HWERROR;
  363. dd->ipath_flags &= ~IPATH_INITTED;
  364. } else {
  365. ipath_dbg("Clearing freezemode on ignored hardware "
  366. "error\n");
  367. ctrl &= ~INFINIPATH_C_FREEZEMODE;
  368. ipath_write_kreg(dd, dd->ipath_kregs->kr_control,
  369. ctrl);
  370. }
  371. }
  372. *msg = '\0';
  373. if (hwerrs & INFINIPATH_HWE_MEMBISTFAILED) {
  374. strlcat(msg, "[Memory BIST test failed, InfiniPath hardware unusable]",
  375. msgl);
  376. /* ignore from now on, so disable until driver reloaded */
  377. *dd->ipath_statusp |= IPATH_STATUS_HWERROR;
  378. dd->ipath_hwerrmask &= ~INFINIPATH_HWE_MEMBISTFAILED;
  379. ipath_write_kreg(dd, dd->ipath_kregs->kr_hwerrmask,
  380. dd->ipath_hwerrmask);
  381. }
  382. if (hwerrs & (INFINIPATH_HWE_RXEMEMPARITYERR_MASK
  383. << INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT)) {
  384. bits = (u32) ((hwerrs >>
  385. INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT) &
  386. INFINIPATH_HWE_RXEMEMPARITYERR_MASK);
  387. snprintf(bitsmsg, sizeof bitsmsg, "[RXE Parity Errs %x] ",
  388. bits);
  389. strlcat(msg, bitsmsg, msgl);
  390. }
  391. if (hwerrs & (INFINIPATH_HWE_TXEMEMPARITYERR_MASK
  392. << INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT)) {
  393. bits = (u32) ((hwerrs >>
  394. INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT) &
  395. INFINIPATH_HWE_TXEMEMPARITYERR_MASK);
  396. snprintf(bitsmsg, sizeof bitsmsg, "[TXE Parity Errs %x] ",
  397. bits);
  398. strlcat(msg, bitsmsg, msgl);
  399. }
  400. if (hwerrs & (INFINIPATH_HWE_PCIEMEMPARITYERR_MASK
  401. << INFINIPATH_HWE_PCIEMEMPARITYERR_SHIFT)) {
  402. bits = (u32) ((hwerrs >>
  403. INFINIPATH_HWE_PCIEMEMPARITYERR_SHIFT) &
  404. INFINIPATH_HWE_PCIEMEMPARITYERR_MASK);
  405. snprintf(bitsmsg, sizeof bitsmsg,
  406. "[PCIe Mem Parity Errs %x] ", bits);
  407. strlcat(msg, bitsmsg, msgl);
  408. }
  409. if (hwerrs & INFINIPATH_HWE_IBCBUSTOSPCPARITYERR)
  410. strlcat(msg, "[IB2IPATH Parity]", msgl);
  411. if (hwerrs & INFINIPATH_HWE_IBCBUSFRSPCPARITYERR)
  412. strlcat(msg, "[IPATH2IB Parity]", msgl);
  413. #define _IPATH_PLL_FAIL (INFINIPATH_HWE_COREPLL_FBSLIP | \
  414. INFINIPATH_HWE_COREPLL_RFSLIP )
  415. if (hwerrs & _IPATH_PLL_FAIL) {
  416. snprintf(bitsmsg, sizeof bitsmsg,
  417. "[PLL failed (%llx), InfiniPath hardware unusable]",
  418. (unsigned long long) hwerrs & _IPATH_PLL_FAIL);
  419. strlcat(msg, bitsmsg, msgl);
  420. /* ignore from now on, so disable until driver reloaded */
  421. dd->ipath_hwerrmask &= ~(hwerrs & _IPATH_PLL_FAIL);
  422. ipath_write_kreg(dd, dd->ipath_kregs->kr_hwerrmask,
  423. dd->ipath_hwerrmask);
  424. }
  425. if (hwerrs & INFINIPATH_HWE_SERDESPLLFAILED) {
  426. /*
  427. * If it occurs, it is left masked since the eternal
  428. * interface is unused
  429. */
  430. dd->ipath_hwerrmask &= ~INFINIPATH_HWE_SERDESPLLFAILED;
  431. ipath_write_kreg(dd, dd->ipath_kregs->kr_hwerrmask,
  432. dd->ipath_hwerrmask);
  433. }
  434. if (hwerrs & INFINIPATH_HWE_PCIEPOISONEDTLP)
  435. strlcat(msg, "[PCIe Poisoned TLP]", msgl);
  436. if (hwerrs & INFINIPATH_HWE_PCIECPLTIMEOUT)
  437. strlcat(msg, "[PCIe completion timeout]", msgl);
  438. /*
  439. * In practice, it's unlikely wthat we'll see PCIe PLL, or bus
  440. * parity or memory parity error failures, because most likely we
  441. * won't be able to talk to the core of the chip. Nonetheless, we
  442. * might see them, if they are in parts of the PCIe core that aren't
  443. * essential.
  444. */
  445. if (hwerrs & INFINIPATH_HWE_PCIE1PLLFAILED)
  446. strlcat(msg, "[PCIePLL1]", msgl);
  447. if (hwerrs & INFINIPATH_HWE_PCIE0PLLFAILED)
  448. strlcat(msg, "[PCIePLL0]", msgl);
  449. if (hwerrs & INFINIPATH_HWE_PCIEBUSPARITYXTLH)
  450. strlcat(msg, "[PCIe XTLH core parity]", msgl);
  451. if (hwerrs & INFINIPATH_HWE_PCIEBUSPARITYXADM)
  452. strlcat(msg, "[PCIe ADM TX core parity]", msgl);
  453. if (hwerrs & INFINIPATH_HWE_PCIEBUSPARITYRADM)
  454. strlcat(msg, "[PCIe ADM RX core parity]", msgl);
  455. if (hwerrs & INFINIPATH_HWE_RXDSYNCMEMPARITYERR)
  456. strlcat(msg, "[Rx Dsync]", msgl);
  457. if (hwerrs & INFINIPATH_HWE_SERDESPLLFAILED)
  458. strlcat(msg, "[SerDes PLL]", msgl);
  459. ipath_dev_err(dd, "%s hardware error\n", msg);
  460. if (isfatal && !ipath_diag_inuse && dd->ipath_freezemsg) {
  461. /*
  462. * for /sys status file ; if no trailing } is copied, we'll
  463. * know it was truncated.
  464. */
  465. snprintf(dd->ipath_freezemsg, dd->ipath_freezelen,
  466. "{%s}", msg);
  467. }
  468. }
  469. /**
  470. * ipath_pe_boardname - fill in the board name
  471. * @dd: the infinipath device
  472. * @name: the output buffer
  473. * @namelen: the size of the output buffer
  474. *
  475. * info is based on the board revision register
  476. */
  477. static int ipath_pe_boardname(struct ipath_devdata *dd, char *name,
  478. size_t namelen)
  479. {
  480. char *n = NULL;
  481. u8 boardrev = dd->ipath_boardrev;
  482. int ret;
  483. switch (boardrev) {
  484. case 0:
  485. n = "InfiniPath_Emulation";
  486. break;
  487. case 1:
  488. n = "InfiniPath_QLE7140-Bringup";
  489. break;
  490. case 2:
  491. n = "InfiniPath_QLE7140";
  492. break;
  493. case 3:
  494. n = "InfiniPath_QMI7140";
  495. break;
  496. case 4:
  497. n = "InfiniPath_QEM7140";
  498. break;
  499. case 5:
  500. n = "InfiniPath_QMH7140";
  501. break;
  502. default:
  503. ipath_dev_err(dd,
  504. "Don't yet know about board with ID %u\n",
  505. boardrev);
  506. snprintf(name, namelen, "Unknown_InfiniPath_PCIe_%u",
  507. boardrev);
  508. break;
  509. }
  510. if (n)
  511. snprintf(name, namelen, "%s", n);
  512. if (dd->ipath_majrev != 4 || !dd->ipath_minrev || dd->ipath_minrev>2) {
  513. ipath_dev_err(dd, "Unsupported InfiniPath hardware revision %u.%u!\n",
  514. dd->ipath_majrev, dd->ipath_minrev);
  515. ret = 1;
  516. } else
  517. ret = 0;
  518. return ret;
  519. }
  520. /**
  521. * ipath_pe_init_hwerrors - enable hardware errors
  522. * @dd: the infinipath device
  523. *
  524. * now that we have finished initializing everything that might reasonably
  525. * cause a hardware error, and cleared those errors bits as they occur,
  526. * we can enable hardware errors in the mask (potentially enabling
  527. * freeze mode), and enable hardware errors as errors (along with
  528. * everything else) in errormask
  529. */
  530. static void ipath_pe_init_hwerrors(struct ipath_devdata *dd)
  531. {
  532. ipath_err_t val;
  533. u64 extsval;
  534. extsval = ipath_read_kreg64(dd, dd->ipath_kregs->kr_extstatus);
  535. if (!(extsval & INFINIPATH_EXTS_MEMBIST_ENDTEST))
  536. ipath_dev_err(dd, "MemBIST did not complete!\n");
  537. val = ~0ULL; /* barring bugs, all hwerrors become interrupts, */
  538. if (!dd->ipath_boardrev) // no PLL for Emulator
  539. val &= ~INFINIPATH_HWE_SERDESPLLFAILED;
  540. if (dd->ipath_minrev < 2) {
  541. /* workaround bug 9460 in internal interface bus parity
  542. * checking. Fixed (HW bug 9490) in Rev2.
  543. */
  544. val &= ~INFINIPATH_HWE_PCIEBUSPARITYRADM;
  545. }
  546. dd->ipath_hwerrmask = val;
  547. }
  548. /**
  549. * ipath_pe_bringup_serdes - bring up the serdes
  550. * @dd: the infinipath device
  551. */
  552. static int ipath_pe_bringup_serdes(struct ipath_devdata *dd)
  553. {
  554. u64 val, tmp, config1, prev_val;
  555. int ret = 0;
  556. ipath_dbg("Trying to bringup serdes\n");
  557. if (ipath_read_kreg64(dd, dd->ipath_kregs->kr_hwerrstatus) &
  558. INFINIPATH_HWE_SERDESPLLFAILED) {
  559. ipath_dbg("At start, serdes PLL failed bit set "
  560. "in hwerrstatus, clearing and continuing\n");
  561. ipath_write_kreg(dd, dd->ipath_kregs->kr_hwerrclear,
  562. INFINIPATH_HWE_SERDESPLLFAILED);
  563. }
  564. val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_serdesconfig0);
  565. config1 = ipath_read_kreg64(dd, dd->ipath_kregs->kr_serdesconfig1);
  566. ipath_cdbg(VERBOSE, "SerDes status config0=%llx config1=%llx, "
  567. "xgxsconfig %llx\n", (unsigned long long) val,
  568. (unsigned long long) config1, (unsigned long long)
  569. ipath_read_kreg64(dd, dd->ipath_kregs->kr_xgxsconfig));
  570. /*
  571. * Force reset on, also set rxdetect enable. Must do before reading
  572. * serdesstatus at least for simulation, or some of the bits in
  573. * serdes status will come back as undefined and cause simulation
  574. * failures
  575. */
  576. val |= INFINIPATH_SERDC0_RESET_PLL | INFINIPATH_SERDC0_RXDETECT_EN
  577. | INFINIPATH_SERDC0_L1PWR_DN;
  578. ipath_write_kreg(dd, dd->ipath_kregs->kr_serdesconfig0, val);
  579. /* be sure chip saw it */
  580. tmp = ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
  581. udelay(5); /* need pll reset set at least for a bit */
  582. /*
  583. * after PLL is reset, set the per-lane Resets and TxIdle and
  584. * clear the PLL reset and rxdetect (to get falling edge).
  585. * Leave L1PWR bits set (permanently)
  586. */
  587. val &= ~(INFINIPATH_SERDC0_RXDETECT_EN | INFINIPATH_SERDC0_RESET_PLL
  588. | INFINIPATH_SERDC0_L1PWR_DN);
  589. val |= INFINIPATH_SERDC0_RESET_MASK | INFINIPATH_SERDC0_TXIDLE;
  590. ipath_cdbg(VERBOSE, "Clearing pll reset and setting lane resets "
  591. "and txidle (%llx)\n", (unsigned long long) val);
  592. ipath_write_kreg(dd, dd->ipath_kregs->kr_serdesconfig0, val);
  593. /* be sure chip saw it */
  594. tmp = ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
  595. /* need PLL reset clear for at least 11 usec before lane
  596. * resets cleared; give it a few more to be sure */
  597. udelay(15);
  598. val &= ~(INFINIPATH_SERDC0_RESET_MASK | INFINIPATH_SERDC0_TXIDLE);
  599. ipath_cdbg(VERBOSE, "Clearing lane resets and txidle "
  600. "(writing %llx)\n", (unsigned long long) val);
  601. ipath_write_kreg(dd, dd->ipath_kregs->kr_serdesconfig0, val);
  602. /* be sure chip saw it */
  603. val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
  604. val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_xgxsconfig);
  605. prev_val = val;
  606. if (((val >> INFINIPATH_XGXS_MDIOADDR_SHIFT) &
  607. INFINIPATH_XGXS_MDIOADDR_MASK) != 3) {
  608. val &=
  609. ~(INFINIPATH_XGXS_MDIOADDR_MASK <<
  610. INFINIPATH_XGXS_MDIOADDR_SHIFT);
  611. /* MDIO address 3 */
  612. val |= 3ULL << INFINIPATH_XGXS_MDIOADDR_SHIFT;
  613. }
  614. if (val & INFINIPATH_XGXS_RESET) {
  615. val &= ~INFINIPATH_XGXS_RESET;
  616. }
  617. if (((val >> INFINIPATH_XGXS_RX_POL_SHIFT) &
  618. INFINIPATH_XGXS_RX_POL_MASK) != dd->ipath_rx_pol_inv ) {
  619. /* need to compensate for Tx inversion in partner */
  620. val &= ~(INFINIPATH_XGXS_RX_POL_MASK <<
  621. INFINIPATH_XGXS_RX_POL_SHIFT);
  622. val |= dd->ipath_rx_pol_inv <<
  623. INFINIPATH_XGXS_RX_POL_SHIFT;
  624. }
  625. if (dd->ipath_minrev >= 2) {
  626. /* Rev 2. can tolerate multiple writes to PBC, and
  627. * allowing them can provide lower latency on some
  628. * CPUs, but this feature is off by default, only
  629. * turned on by setting D63 of XGXSconfig reg.
  630. * May want to make this conditional more
  631. * fine-grained in future. This is not exactly
  632. * related to XGXS, but where the bit ended up.
  633. */
  634. val |= INFINIPATH_XGXS_SUPPRESS_ARMLAUNCH_ERR;
  635. }
  636. if (val != prev_val)
  637. ipath_write_kreg(dd, dd->ipath_kregs->kr_xgxsconfig, val);
  638. val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_serdesconfig0);
  639. /* clear current and de-emphasis bits */
  640. config1 &= ~0x0ffffffff00ULL;
  641. /* set current to 20ma */
  642. config1 |= 0x00000000000ULL;
  643. /* set de-emphasis to -5.68dB */
  644. config1 |= 0x0cccc000000ULL;
  645. ipath_write_kreg(dd, dd->ipath_kregs->kr_serdesconfig1, config1);
  646. ipath_cdbg(VERBOSE, "done: SerDes status config0=%llx "
  647. "config1=%llx, sstatus=%llx xgxs=%llx\n",
  648. (unsigned long long) val, (unsigned long long) config1,
  649. (unsigned long long)
  650. ipath_read_kreg64(dd, dd->ipath_kregs->kr_serdesstatus),
  651. (unsigned long long)
  652. ipath_read_kreg64(dd, dd->ipath_kregs->kr_xgxsconfig));
  653. if (!ipath_waitfor_mdio_cmdready(dd)) {
  654. ipath_write_kreg(
  655. dd, dd->ipath_kregs->kr_mdio,
  656. ipath_mdio_req(IPATH_MDIO_CMD_READ, 31,
  657. IPATH_MDIO_CTRL_XGXS_REG_8, 0));
  658. if (ipath_waitfor_complete(dd, dd->ipath_kregs->kr_mdio,
  659. IPATH_MDIO_DATAVALID, &val))
  660. ipath_dbg("Never got MDIO data for XGXS "
  661. "status read\n");
  662. else
  663. ipath_cdbg(VERBOSE, "MDIO Read reg8, "
  664. "'bank' 31 %x\n", (u32) val);
  665. } else
  666. ipath_dbg("Never got MDIO cmdready for XGXS status read\n");
  667. return ret;
  668. }
  669. /**
  670. * ipath_pe_quiet_serdes - set serdes to txidle
  671. * @dd: the infinipath device
  672. * Called when driver is being unloaded
  673. */
  674. static void ipath_pe_quiet_serdes(struct ipath_devdata *dd)
  675. {
  676. u64 val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_serdesconfig0);
  677. val |= INFINIPATH_SERDC0_TXIDLE;
  678. ipath_dbg("Setting TxIdleEn on serdes (config0 = %llx)\n",
  679. (unsigned long long) val);
  680. ipath_write_kreg(dd, dd->ipath_kregs->kr_serdesconfig0, val);
  681. }
  682. static int ipath_pe_intconfig(struct ipath_devdata *dd)
  683. {
  684. u64 val;
  685. u32 chiprev;
  686. /*
  687. * If the chip supports added error indication via GPIO pins,
  688. * enable interrupts on those bits so the interrupt routine
  689. * can count the events. Also set flag so interrupt routine
  690. * can know they are expected.
  691. */
  692. chiprev = dd->ipath_revision >> INFINIPATH_R_CHIPREVMINOR_SHIFT;
  693. if ((chiprev & INFINIPATH_R_CHIPREVMINOR_MASK) > 1) {
  694. /* Rev2+ reports extra errors via internal GPIO pins */
  695. dd->ipath_flags |= IPATH_GPIO_ERRINTRS;
  696. val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_gpio_mask);
  697. val |= IPATH_GPIO_ERRINTR_MASK;
  698. ipath_write_kreg( dd, dd->ipath_kregs->kr_gpio_mask, val);
  699. }
  700. return 0;
  701. }
  702. /**
  703. * ipath_setup_pe_setextled - set the state of the two external LEDs
  704. * @dd: the infinipath device
  705. * @lst: the L state
  706. * @ltst: the LT state
  707. * These LEDs indicate the physical and logical state of IB link.
  708. * For this chip (at least with recommended board pinouts), LED1
  709. * is Yellow (logical state) and LED2 is Green (physical state),
  710. *
  711. * Note: We try to match the Mellanox HCA LED behavior as best
  712. * we can. Green indicates physical link state is OK (something is
  713. * plugged in, and we can train).
  714. * Amber indicates the link is logically up (ACTIVE).
  715. * Mellanox further blinks the amber LED to indicate data packet
  716. * activity, but we have no hardware support for that, so it would
  717. * require waking up every 10-20 msecs and checking the counters
  718. * on the chip, and then turning the LED off if appropriate. That's
  719. * visible overhead, so not something we will do.
  720. *
  721. */
  722. static void ipath_setup_pe_setextled(struct ipath_devdata *dd, u64 lst,
  723. u64 ltst)
  724. {
  725. u64 extctl;
  726. /* the diags use the LED to indicate diag info, so we leave
  727. * the external LED alone when the diags are running */
  728. if (ipath_diag_inuse)
  729. return;
  730. extctl = dd->ipath_extctrl & ~(INFINIPATH_EXTC_LED1PRIPORT_ON |
  731. INFINIPATH_EXTC_LED2PRIPORT_ON);
  732. if (ltst & INFINIPATH_IBCS_LT_STATE_LINKUP)
  733. extctl |= INFINIPATH_EXTC_LED2PRIPORT_ON;
  734. if (lst == INFINIPATH_IBCS_L_STATE_ACTIVE)
  735. extctl |= INFINIPATH_EXTC_LED1PRIPORT_ON;
  736. dd->ipath_extctrl = extctl;
  737. ipath_write_kreg(dd, dd->ipath_kregs->kr_extctrl, extctl);
  738. }
  739. /**
  740. * ipath_setup_pe_cleanup - clean up any per-chip chip-specific stuff
  741. * @dd: the infinipath device
  742. *
  743. * This is called during driver unload.
  744. * We do the pci_disable_msi here, not in generic code, because it
  745. * isn't used for the HT chips. If we do end up needing pci_enable_msi
  746. * at some point in the future for HT, we'll move the call back
  747. * into the main init_one code.
  748. */
  749. static void ipath_setup_pe_cleanup(struct ipath_devdata *dd)
  750. {
  751. dd->ipath_msi_lo = 0; /* just in case unload fails */
  752. pci_disable_msi(dd->pcidev);
  753. }
  754. /**
  755. * ipath_setup_pe_config - setup PCIe config related stuff
  756. * @dd: the infinipath device
  757. * @pdev: the PCI device
  758. *
  759. * The pci_enable_msi() call will fail on systems with MSI quirks
  760. * such as those with AMD8131, even if the device of interest is not
  761. * attached to that device, (in the 2.6.13 - 2.6.15 kernels, at least, fixed
  762. * late in 2.6.16).
  763. * All that can be done is to edit the kernel source to remove the quirk
  764. * check until that is fixed.
  765. * We do not need to call enable_msi() for our HyperTransport chip,
  766. * even though it uses MSI, and we want to avoid the quirk warning, so
  767. * So we call enable_msi only for PCIe. If we do end up needing
  768. * pci_enable_msi at some point in the future for HT, we'll move the
  769. * call back into the main init_one code.
  770. * We save the msi lo and hi values, so we can restore them after
  771. * chip reset (the kernel PCI infrastructure doesn't yet handle that
  772. * correctly).
  773. */
  774. static int ipath_setup_pe_config(struct ipath_devdata *dd,
  775. struct pci_dev *pdev)
  776. {
  777. int pos, ret;
  778. dd->ipath_msi_lo = 0; /* used as a flag during reset processing */
  779. ret = pci_enable_msi(dd->pcidev);
  780. if (ret)
  781. ipath_dev_err(dd, "pci_enable_msi failed: %d, "
  782. "interrupts may not work\n", ret);
  783. /* continue even if it fails, we may still be OK... */
  784. if ((pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSI))) {
  785. u16 control;
  786. pci_read_config_dword(dd->pcidev, pos + PCI_MSI_ADDRESS_LO,
  787. &dd->ipath_msi_lo);
  788. pci_read_config_dword(dd->pcidev, pos + PCI_MSI_ADDRESS_HI,
  789. &dd->ipath_msi_hi);
  790. pci_read_config_word(dd->pcidev, pos + PCI_MSI_FLAGS,
  791. &control);
  792. /* now save the data (vector) info */
  793. pci_read_config_word(dd->pcidev,
  794. pos + ((control & PCI_MSI_FLAGS_64BIT)
  795. ? 12 : 8),
  796. &dd->ipath_msi_data);
  797. ipath_cdbg(VERBOSE, "Read msi data 0x%x from config offset "
  798. "0x%x, control=0x%x\n", dd->ipath_msi_data,
  799. pos + ((control & PCI_MSI_FLAGS_64BIT) ? 12 : 8),
  800. control);
  801. /* we save the cachelinesize also, although it doesn't
  802. * really matter */
  803. pci_read_config_byte(dd->pcidev, PCI_CACHE_LINE_SIZE,
  804. &dd->ipath_pci_cacheline);
  805. } else
  806. ipath_dev_err(dd, "Can't find MSI capability, "
  807. "can't save MSI settings for reset\n");
  808. if ((pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_EXP))) {
  809. u16 linkstat;
  810. pci_read_config_word(dd->pcidev, pos + PCI_EXP_LNKSTA,
  811. &linkstat);
  812. linkstat >>= 4;
  813. linkstat &= 0x1f;
  814. if (linkstat != 8)
  815. ipath_dev_err(dd, "PCIe width %u, "
  816. "performance reduced\n", linkstat);
  817. }
  818. else
  819. ipath_dev_err(dd, "Can't find PCI Express "
  820. "capability!\n");
  821. return 0;
  822. }
  823. static void ipath_init_pe_variables(void)
  824. {
  825. /*
  826. * bits for selecting i2c direction and values,
  827. * used for I2C serial flash
  828. */
  829. ipath_gpio_sda_num = _IPATH_GPIO_SDA_NUM;
  830. ipath_gpio_scl_num = _IPATH_GPIO_SCL_NUM;
  831. ipath_gpio_sda = IPATH_GPIO_SDA;
  832. ipath_gpio_scl = IPATH_GPIO_SCL;
  833. /* variables for sanity checking interrupt and errors */
  834. infinipath_hwe_bitsextant =
  835. (INFINIPATH_HWE_RXEMEMPARITYERR_MASK <<
  836. INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT) |
  837. (INFINIPATH_HWE_PCIEMEMPARITYERR_MASK <<
  838. INFINIPATH_HWE_PCIEMEMPARITYERR_SHIFT) |
  839. INFINIPATH_HWE_PCIE1PLLFAILED |
  840. INFINIPATH_HWE_PCIE0PLLFAILED |
  841. INFINIPATH_HWE_PCIEPOISONEDTLP |
  842. INFINIPATH_HWE_PCIECPLTIMEOUT |
  843. INFINIPATH_HWE_PCIEBUSPARITYXTLH |
  844. INFINIPATH_HWE_PCIEBUSPARITYXADM |
  845. INFINIPATH_HWE_PCIEBUSPARITYRADM |
  846. INFINIPATH_HWE_MEMBISTFAILED |
  847. INFINIPATH_HWE_COREPLL_FBSLIP |
  848. INFINIPATH_HWE_COREPLL_RFSLIP |
  849. INFINIPATH_HWE_SERDESPLLFAILED |
  850. INFINIPATH_HWE_IBCBUSTOSPCPARITYERR |
  851. INFINIPATH_HWE_IBCBUSFRSPCPARITYERR;
  852. infinipath_i_bitsextant =
  853. (INFINIPATH_I_RCVURG_MASK << INFINIPATH_I_RCVURG_SHIFT) |
  854. (INFINIPATH_I_RCVAVAIL_MASK <<
  855. INFINIPATH_I_RCVAVAIL_SHIFT) |
  856. INFINIPATH_I_ERROR | INFINIPATH_I_SPIOSENT |
  857. INFINIPATH_I_SPIOBUFAVAIL | INFINIPATH_I_GPIO;
  858. infinipath_e_bitsextant =
  859. INFINIPATH_E_RFORMATERR | INFINIPATH_E_RVCRC |
  860. INFINIPATH_E_RICRC | INFINIPATH_E_RMINPKTLEN |
  861. INFINIPATH_E_RMAXPKTLEN | INFINIPATH_E_RLONGPKTLEN |
  862. INFINIPATH_E_RSHORTPKTLEN | INFINIPATH_E_RUNEXPCHAR |
  863. INFINIPATH_E_RUNSUPVL | INFINIPATH_E_REBP |
  864. INFINIPATH_E_RIBFLOW | INFINIPATH_E_RBADVERSION |
  865. INFINIPATH_E_RRCVEGRFULL | INFINIPATH_E_RRCVHDRFULL |
  866. INFINIPATH_E_RBADTID | INFINIPATH_E_RHDRLEN |
  867. INFINIPATH_E_RHDR | INFINIPATH_E_RIBLOSTLINK |
  868. INFINIPATH_E_SMINPKTLEN | INFINIPATH_E_SMAXPKTLEN |
  869. INFINIPATH_E_SUNDERRUN | INFINIPATH_E_SPKTLEN |
  870. INFINIPATH_E_SDROPPEDSMPPKT | INFINIPATH_E_SDROPPEDDATAPKT |
  871. INFINIPATH_E_SPIOARMLAUNCH | INFINIPATH_E_SUNEXPERRPKTNUM |
  872. INFINIPATH_E_SUNSUPVL | INFINIPATH_E_IBSTATUSCHANGED |
  873. INFINIPATH_E_INVALIDADDR | INFINIPATH_E_RESET |
  874. INFINIPATH_E_HARDWARE;
  875. infinipath_i_rcvavail_mask = INFINIPATH_I_RCVAVAIL_MASK;
  876. infinipath_i_rcvurg_mask = INFINIPATH_I_RCVURG_MASK;
  877. }
  878. /* setup the MSI stuff again after a reset. I'd like to just call
  879. * pci_enable_msi() and request_irq() again, but when I do that,
  880. * the MSI enable bit doesn't get set in the command word, and
  881. * we switch to to a different interrupt vector, which is confusing,
  882. * so I instead just do it all inline. Perhaps somehow can tie this
  883. * into the PCIe hotplug support at some point
  884. * Note, because I'm doing it all here, I don't call pci_disable_msi()
  885. * or free_irq() at the start of ipath_setup_pe_reset().
  886. */
  887. static int ipath_reinit_msi(struct ipath_devdata *dd)
  888. {
  889. int pos;
  890. u16 control;
  891. int ret;
  892. if (!dd->ipath_msi_lo) {
  893. dev_info(&dd->pcidev->dev, "Can't restore MSI config, "
  894. "initial setup failed?\n");
  895. ret = 0;
  896. goto bail;
  897. }
  898. if (!(pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSI))) {
  899. ipath_dev_err(dd, "Can't find MSI capability, "
  900. "can't restore MSI settings\n");
  901. ret = 0;
  902. goto bail;
  903. }
  904. ipath_cdbg(VERBOSE, "Writing msi_lo 0x%x to config offset 0x%x\n",
  905. dd->ipath_msi_lo, pos + PCI_MSI_ADDRESS_LO);
  906. pci_write_config_dword(dd->pcidev, pos + PCI_MSI_ADDRESS_LO,
  907. dd->ipath_msi_lo);
  908. ipath_cdbg(VERBOSE, "Writing msi_lo 0x%x to config offset 0x%x\n",
  909. dd->ipath_msi_hi, pos + PCI_MSI_ADDRESS_HI);
  910. pci_write_config_dword(dd->pcidev, pos + PCI_MSI_ADDRESS_HI,
  911. dd->ipath_msi_hi);
  912. pci_read_config_word(dd->pcidev, pos + PCI_MSI_FLAGS, &control);
  913. if (!(control & PCI_MSI_FLAGS_ENABLE)) {
  914. ipath_cdbg(VERBOSE, "MSI control at off %x was %x, "
  915. "setting MSI enable (%x)\n", pos + PCI_MSI_FLAGS,
  916. control, control | PCI_MSI_FLAGS_ENABLE);
  917. control |= PCI_MSI_FLAGS_ENABLE;
  918. pci_write_config_word(dd->pcidev, pos + PCI_MSI_FLAGS,
  919. control);
  920. }
  921. /* now rewrite the data (vector) info */
  922. pci_write_config_word(dd->pcidev, pos +
  923. ((control & PCI_MSI_FLAGS_64BIT) ? 12 : 8),
  924. dd->ipath_msi_data);
  925. /* we restore the cachelinesize also, although it doesn't really
  926. * matter */
  927. pci_write_config_byte(dd->pcidev, PCI_CACHE_LINE_SIZE,
  928. dd->ipath_pci_cacheline);
  929. /* and now set the pci master bit again */
  930. pci_set_master(dd->pcidev);
  931. ret = 1;
  932. bail:
  933. return ret;
  934. }
  935. /* This routine sleeps, so it can only be called from user context, not
  936. * from interrupt context. If we need interrupt context, we can split
  937. * it into two routines.
  938. */
  939. static int ipath_setup_pe_reset(struct ipath_devdata *dd)
  940. {
  941. u64 val;
  942. int i;
  943. int ret;
  944. /* Use ERROR so it shows up in logs, etc. */
  945. ipath_dev_err(dd, "Resetting InfiniPath unit %u\n", dd->ipath_unit);
  946. /* keep chip from being accessed in a few places */
  947. dd->ipath_flags &= ~(IPATH_INITTED|IPATH_PRESENT);
  948. val = dd->ipath_control | INFINIPATH_C_RESET;
  949. ipath_write_kreg(dd, dd->ipath_kregs->kr_control, val);
  950. mb();
  951. for (i = 1; i <= 5; i++) {
  952. int r;
  953. /* allow MBIST, etc. to complete; longer on each retry.
  954. * We sometimes get machine checks from bus timeout if no
  955. * response, so for now, make it *really* long.
  956. */
  957. msleep(1000 + (1 + i) * 2000);
  958. if ((r =
  959. pci_write_config_dword(dd->pcidev, PCI_BASE_ADDRESS_0,
  960. dd->ipath_pcibar0)))
  961. ipath_dev_err(dd, "rewrite of BAR0 failed: %d\n",
  962. r);
  963. if ((r =
  964. pci_write_config_dword(dd->pcidev, PCI_BASE_ADDRESS_1,
  965. dd->ipath_pcibar1)))
  966. ipath_dev_err(dd, "rewrite of BAR1 failed: %d\n",
  967. r);
  968. /* now re-enable memory access */
  969. if ((r = pci_enable_device(dd->pcidev)))
  970. ipath_dev_err(dd, "pci_enable_device failed after "
  971. "reset: %d\n", r);
  972. /* whether it worked or not, mark as present, again */
  973. dd->ipath_flags |= IPATH_PRESENT;
  974. val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_revision);
  975. if (val == dd->ipath_revision) {
  976. ipath_cdbg(VERBOSE, "Got matching revision "
  977. "register %llx on try %d\n",
  978. (unsigned long long) val, i);
  979. ret = ipath_reinit_msi(dd);
  980. goto bail;
  981. }
  982. /* Probably getting -1 back */
  983. ipath_dbg("Didn't get expected revision register, "
  984. "got %llx, try %d\n", (unsigned long long) val,
  985. i + 1);
  986. }
  987. ret = 0; /* failed */
  988. bail:
  989. return ret;
  990. }
  991. /**
  992. * ipath_pe_put_tid - write a TID in chip
  993. * @dd: the infinipath device
  994. * @tidptr: pointer to the expected TID (in chip) to udpate
  995. * @tidtype: 0 for eager, 1 for expected
  996. * @pa: physical address of in memory buffer; ipath_tidinvalid if freeing
  997. *
  998. * This exists as a separate routine to allow for special locking etc.
  999. * It's used for both the full cleanup on exit, as well as the normal
  1000. * setup and teardown.
  1001. */
  1002. static void ipath_pe_put_tid(struct ipath_devdata *dd, u64 __iomem *tidptr,
  1003. u32 type, unsigned long pa)
  1004. {
  1005. u32 __iomem *tidp32 = (u32 __iomem *)tidptr;
  1006. unsigned long flags = 0; /* keep gcc quiet */
  1007. if (pa != dd->ipath_tidinvalid) {
  1008. if (pa & ((1U << 11) - 1)) {
  1009. dev_info(&dd->pcidev->dev, "BUG: physaddr %lx "
  1010. "not 4KB aligned!\n", pa);
  1011. return;
  1012. }
  1013. pa >>= 11;
  1014. /* paranoia check */
  1015. if (pa & (7<<29))
  1016. ipath_dev_err(dd,
  1017. "BUG: Physical page address 0x%lx "
  1018. "has bits set in 31-29\n", pa);
  1019. if (type == 0)
  1020. pa |= dd->ipath_tidtemplate;
  1021. else /* for now, always full 4KB page */
  1022. pa |= 2 << 29;
  1023. }
  1024. /* workaround chip bug 9437 by writing each TID twice
  1025. * and holding a spinlock around the writes, so they don't
  1026. * intermix with other TID (eager or expected) writes
  1027. * Unfortunately, this call can be done from interrupt level
  1028. * for the port 0 eager TIDs, so we have to use irqsave
  1029. */
  1030. spin_lock_irqsave(&dd->ipath_tid_lock, flags);
  1031. ipath_write_kreg(dd, dd->ipath_kregs->kr_scratch, 0xfeeddeaf);
  1032. if (dd->ipath_kregbase)
  1033. writel(pa, tidp32);
  1034. ipath_write_kreg(dd, dd->ipath_kregs->kr_scratch, 0xdeadbeef);
  1035. mmiowb();
  1036. spin_unlock_irqrestore(&dd->ipath_tid_lock, flags);
  1037. }
  1038. /**
  1039. * ipath_pe_put_tid_2 - write a TID in chip, Revision 2 or higher
  1040. * @dd: the infinipath device
  1041. * @tidptr: pointer to the expected TID (in chip) to udpate
  1042. * @tidtype: 0 for eager, 1 for expected
  1043. * @pa: physical address of in memory buffer; ipath_tidinvalid if freeing
  1044. *
  1045. * This exists as a separate routine to allow for selection of the
  1046. * appropriate "flavor". The static calls in cleanup just use the
  1047. * revision-agnostic form, as they are not performance critical.
  1048. */
  1049. static void ipath_pe_put_tid_2(struct ipath_devdata *dd, u64 __iomem *tidptr,
  1050. u32 type, unsigned long pa)
  1051. {
  1052. u32 __iomem *tidp32 = (u32 __iomem *)tidptr;
  1053. if (pa != dd->ipath_tidinvalid) {
  1054. if (pa & ((1U << 11) - 1)) {
  1055. dev_info(&dd->pcidev->dev, "BUG: physaddr %lx "
  1056. "not 4KB aligned!\n", pa);
  1057. return;
  1058. }
  1059. pa >>= 11;
  1060. /* paranoia check */
  1061. if (pa & (7<<29))
  1062. ipath_dev_err(dd,
  1063. "BUG: Physical page address 0x%lx "
  1064. "has bits set in 31-29\n", pa);
  1065. if (type == 0)
  1066. pa |= dd->ipath_tidtemplate;
  1067. else /* for now, always full 4KB page */
  1068. pa |= 2 << 29;
  1069. }
  1070. if (dd->ipath_kregbase)
  1071. writel(pa, tidp32);
  1072. mmiowb();
  1073. }
  1074. /**
  1075. * ipath_pe_clear_tid - clear all TID entries for a port, expected and eager
  1076. * @dd: the infinipath device
  1077. * @port: the port
  1078. *
  1079. * clear all TID entries for a port, expected and eager.
  1080. * Used from ipath_close(). On this chip, TIDs are only 32 bits,
  1081. * not 64, but they are still on 64 bit boundaries, so tidbase
  1082. * is declared as u64 * for the pointer math, even though we write 32 bits
  1083. */
  1084. static void ipath_pe_clear_tids(struct ipath_devdata *dd, unsigned port)
  1085. {
  1086. u64 __iomem *tidbase;
  1087. unsigned long tidinv;
  1088. int i;
  1089. if (!dd->ipath_kregbase)
  1090. return;
  1091. ipath_cdbg(VERBOSE, "Invalidate TIDs for port %u\n", port);
  1092. tidinv = dd->ipath_tidinvalid;
  1093. tidbase = (u64 __iomem *)
  1094. ((char __iomem *)(dd->ipath_kregbase) +
  1095. dd->ipath_rcvtidbase +
  1096. port * dd->ipath_rcvtidcnt * sizeof(*tidbase));
  1097. for (i = 0; i < dd->ipath_rcvtidcnt; i++)
  1098. ipath_pe_put_tid(dd, &tidbase[i], 0, tidinv);
  1099. tidbase = (u64 __iomem *)
  1100. ((char __iomem *)(dd->ipath_kregbase) +
  1101. dd->ipath_rcvegrbase +
  1102. port * dd->ipath_rcvegrcnt * sizeof(*tidbase));
  1103. for (i = 0; i < dd->ipath_rcvegrcnt; i++)
  1104. ipath_pe_put_tid(dd, &tidbase[i], 1, tidinv);
  1105. }
  1106. /**
  1107. * ipath_pe_tidtemplate - setup constants for TID updates
  1108. * @dd: the infinipath device
  1109. *
  1110. * We setup stuff that we use a lot, to avoid calculating each time
  1111. */
  1112. static void ipath_pe_tidtemplate(struct ipath_devdata *dd)
  1113. {
  1114. u32 egrsize = dd->ipath_rcvegrbufsize;
  1115. /* For now, we always allocate 4KB buffers (at init) so we can
  1116. * receive max size packets. We may want a module parameter to
  1117. * specify 2KB or 4KB and/or make be per port instead of per device
  1118. * for those who want to reduce memory footprint. Note that the
  1119. * ipath_rcvhdrentsize size must be large enough to hold the largest
  1120. * IB header (currently 96 bytes) that we expect to handle (plus of
  1121. * course the 2 dwords of RHF).
  1122. */
  1123. if (egrsize == 2048)
  1124. dd->ipath_tidtemplate = 1U << 29;
  1125. else if (egrsize == 4096)
  1126. dd->ipath_tidtemplate = 2U << 29;
  1127. else {
  1128. egrsize = 4096;
  1129. dev_info(&dd->pcidev->dev, "BUG: unsupported egrbufsize "
  1130. "%u, using %u\n", dd->ipath_rcvegrbufsize,
  1131. egrsize);
  1132. dd->ipath_tidtemplate = 2U << 29;
  1133. }
  1134. dd->ipath_tidinvalid = 0;
  1135. }
  1136. static int ipath_pe_early_init(struct ipath_devdata *dd)
  1137. {
  1138. dd->ipath_flags |= IPATH_4BYTE_TID;
  1139. /*
  1140. * For openfabrics, we need to be able to handle an IB header of
  1141. * 24 dwords. HT chip has arbitrary sized receive buffers, so we
  1142. * made them the same size as the PIO buffers. This chip does not
  1143. * handle arbitrary size buffers, so we need the header large enough
  1144. * to handle largest IB header, but still have room for a 2KB MTU
  1145. * standard IB packet.
  1146. */
  1147. dd->ipath_rcvhdrentsize = 24;
  1148. dd->ipath_rcvhdrsize = IPATH_DFLT_RCVHDRSIZE;
  1149. /*
  1150. * To truly support a 4KB MTU (for usermode), we need to
  1151. * bump this to a larger value. For now, we use them for
  1152. * the kernel only.
  1153. */
  1154. dd->ipath_rcvegrbufsize = 2048;
  1155. /*
  1156. * the min() check here is currently a nop, but it may not always
  1157. * be, depending on just how we do ipath_rcvegrbufsize
  1158. */
  1159. dd->ipath_ibmaxlen = min(dd->ipath_piosize2k,
  1160. dd->ipath_rcvegrbufsize +
  1161. (dd->ipath_rcvhdrentsize << 2));
  1162. dd->ipath_init_ibmaxlen = dd->ipath_ibmaxlen;
  1163. /*
  1164. * We can request a receive interrupt for 1 or
  1165. * more packets from current offset. For now, we set this
  1166. * up for a single packet.
  1167. */
  1168. dd->ipath_rhdrhead_intr_off = 1ULL<<32;
  1169. ipath_get_eeprom_info(dd);
  1170. return 0;
  1171. }
  1172. int __attribute__((weak)) ipath_unordered_wc(void)
  1173. {
  1174. return 0;
  1175. }
  1176. /**
  1177. * ipath_init_pe_get_base_info - set chip-specific flags for user code
  1178. * @pd: the infinipath port
  1179. * @kbase: ipath_base_info pointer
  1180. *
  1181. * We set the PCIE flag because the lower bandwidth on PCIe vs
  1182. * HyperTransport can affect some user packet algorithims.
  1183. */
  1184. static int ipath_pe_get_base_info(struct ipath_portdata *pd, void *kbase)
  1185. {
  1186. struct ipath_base_info *kinfo = kbase;
  1187. struct ipath_devdata *dd;
  1188. if (ipath_unordered_wc()) {
  1189. kinfo->spi_runtime_flags |= IPATH_RUNTIME_FORCE_WC_ORDER;
  1190. ipath_cdbg(PROC, "Intel processor, forcing WC order\n");
  1191. }
  1192. else
  1193. ipath_cdbg(PROC, "Not Intel processor, WC ordered\n");
  1194. if (pd == NULL)
  1195. goto done;
  1196. dd = pd->port_dd;
  1197. if (dd != NULL && dd->ipath_minrev >= 2) {
  1198. ipath_cdbg(PROC, "IBA6120 Rev2, allow multiple PBC write\n");
  1199. kinfo->spi_runtime_flags |= IPATH_RUNTIME_PBC_REWRITE;
  1200. ipath_cdbg(PROC, "IBA6120 Rev2, allow loose DMA alignment\n");
  1201. kinfo->spi_runtime_flags |= IPATH_RUNTIME_LOOSE_DMA_ALIGN;
  1202. }
  1203. done:
  1204. kinfo->spi_runtime_flags |= IPATH_RUNTIME_PCIE;
  1205. return 0;
  1206. }
  1207. /**
  1208. * ipath_init_iba6120_funcs - set up the chip-specific function pointers
  1209. * @dd: the infinipath device
  1210. *
  1211. * This is global, and is called directly at init to set up the
  1212. * chip-specific function pointers for later use.
  1213. */
  1214. void ipath_init_iba6120_funcs(struct ipath_devdata *dd)
  1215. {
  1216. dd->ipath_f_intrsetup = ipath_pe_intconfig;
  1217. dd->ipath_f_bus = ipath_setup_pe_config;
  1218. dd->ipath_f_reset = ipath_setup_pe_reset;
  1219. dd->ipath_f_get_boardname = ipath_pe_boardname;
  1220. dd->ipath_f_init_hwerrors = ipath_pe_init_hwerrors;
  1221. dd->ipath_f_early_init = ipath_pe_early_init;
  1222. dd->ipath_f_handle_hwerrors = ipath_pe_handle_hwerrors;
  1223. dd->ipath_f_quiet_serdes = ipath_pe_quiet_serdes;
  1224. dd->ipath_f_bringup_serdes = ipath_pe_bringup_serdes;
  1225. dd->ipath_f_clear_tids = ipath_pe_clear_tids;
  1226. if (dd->ipath_minrev >= 2)
  1227. dd->ipath_f_put_tid = ipath_pe_put_tid_2;
  1228. else
  1229. dd->ipath_f_put_tid = ipath_pe_put_tid;
  1230. dd->ipath_f_cleanup = ipath_setup_pe_cleanup;
  1231. dd->ipath_f_setextled = ipath_setup_pe_setextled;
  1232. dd->ipath_f_get_base_info = ipath_pe_get_base_info;
  1233. /* initialize chip-specific variables */
  1234. dd->ipath_f_tidtemplate = ipath_pe_tidtemplate;
  1235. /*
  1236. * setup the register offsets, since they are different for each
  1237. * chip
  1238. */
  1239. dd->ipath_kregs = &ipath_pe_kregs;
  1240. dd->ipath_cregs = &ipath_pe_cregs;
  1241. ipath_init_pe_variables();
  1242. }