aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDave Olson <dave.olson@qlogic.com>2008-04-17 00:01:12 -0400
committerRoland Dreier <rolandd@cisco.com>2008-04-17 00:01:12 -0400
commitf2ceb4929ab543e54efaadcad215a105df684f36 (patch)
tree8bbfdfe53c55544080279dec08d9ef8067986097 /drivers
parent3dd59e226e01ddb5b041eb0b2e7c7f28b1f730c9 (diff)
IB/ipath: Make some constants chip-specific, related cleanup
This patch makes some constants chip-specific, and makes some related changes to prepare for supporting another HCA. Signed-off-by: Dave Olson <dave.olson@qlogic.com Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_iba6110.c33
-rw-r--r--drivers/infiniband/hw/ipath/ipath_iba6120.c30
-rw-r--r--drivers/infiniband/hw/ipath/ipath_registers.h2
3 files changed, 35 insertions, 30 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_iba6110.c b/drivers/infiniband/hw/ipath/ipath_iba6110.c
index 9e2ced3cdc5e..684c27e42406 100644
--- a/drivers/infiniband/hw/ipath/ipath_iba6110.c
+++ b/drivers/infiniband/hw/ipath/ipath_iba6110.c
@@ -40,6 +40,7 @@
40#include <linux/pci.h> 40#include <linux/pci.h>
41#include <linux/delay.h> 41#include <linux/delay.h>
42#include <linux/htirq.h> 42#include <linux/htirq.h>
43#include <rdma/ib_verbs.h>
43 44
44#include "ipath_kernel.h" 45#include "ipath_kernel.h"
45#include "ipath_registers.h" 46#include "ipath_registers.h"
@@ -476,7 +477,13 @@ static const struct ipath_hwerror_msgs ipath_6110_hwerror_msgs[] = {
476#define RXE_EAGER_PARITY (INFINIPATH_HWE_RXEMEMPARITYERR_EAGERTID \ 477#define RXE_EAGER_PARITY (INFINIPATH_HWE_RXEMEMPARITYERR_EAGERTID \
477 << INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT) 478 << INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT)
478 479
479static int ipath_ht_txe_recover(struct ipath_devdata *); 480static void ipath_ht_txe_recover(struct ipath_devdata *dd)
481{
482 ++ipath_stats.sps_txeparity;
483 dev_info(&dd->pcidev->dev,
484 "Recovering from TXE PIO parity error\n");
485}
486
480 487
481/** 488/**
482 * ipath_ht_handle_hwerrors - display hardware errors. 489 * ipath_ht_handle_hwerrors - display hardware errors.
@@ -557,11 +564,11 @@ static void ipath_ht_handle_hwerrors(struct ipath_devdata *dd, char *msg,
557 * occur if a processor speculative read is done to the PIO 564 * occur if a processor speculative read is done to the PIO
558 * buffer while we are sending a packet, for example. 565 * buffer while we are sending a packet, for example.
559 */ 566 */
560 if ((hwerrs & TXE_PIO_PARITY) && ipath_ht_txe_recover(dd)) 567 if (hwerrs & TXE_PIO_PARITY) {
568 ipath_ht_txe_recover(dd);
561 hwerrs &= ~TXE_PIO_PARITY; 569 hwerrs &= ~TXE_PIO_PARITY;
562 if (hwerrs & RXE_EAGER_PARITY) 570 }
563 ipath_dev_err(dd, "RXE parity, Eager TID error is not " 571
564 "recoverable\n");
565 if (!hwerrs) { 572 if (!hwerrs) {
566 ipath_dbg("Clearing freezemode on ignored or " 573 ipath_dbg("Clearing freezemode on ignored or "
567 "recovered hardware error\n"); 574 "recovered hardware error\n");
@@ -1653,22 +1660,6 @@ static int ipath_ht_early_init(struct ipath_devdata *dd)
1653} 1660}
1654 1661
1655 1662
1656static int ipath_ht_txe_recover(struct ipath_devdata *dd)
1657{
1658 int cnt = ++ipath_stats.sps_txeparity;
1659 if (cnt >= IPATH_MAX_PARITY_ATTEMPTS) {
1660 if (cnt == IPATH_MAX_PARITY_ATTEMPTS)
1661 ipath_dev_err(dd,
1662 "Too many attempts to recover from "
1663 "TXE parity, giving up\n");
1664 return 0;
1665 }
1666 dev_info(&dd->pcidev->dev,
1667 "Recovering from TXE PIO parity error\n");
1668 return 1;
1669}
1670
1671
1672/** 1663/**
1673 * ipath_init_ht_get_base_info - set chip-specific flags for user code 1664 * ipath_init_ht_get_base_info - set chip-specific flags for user code
1674 * @dd: the infinipath device 1665 * @dd: the infinipath device
diff --git a/drivers/infiniband/hw/ipath/ipath_iba6120.c b/drivers/infiniband/hw/ipath/ipath_iba6120.c
index c7a2f50824c0..8423fee6344b 100644
--- a/drivers/infiniband/hw/ipath/ipath_iba6120.c
+++ b/drivers/infiniband/hw/ipath/ipath_iba6120.c
@@ -38,7 +38,7 @@
38#include <linux/interrupt.h> 38#include <linux/interrupt.h>
39#include <linux/pci.h> 39#include <linux/pci.h>
40#include <linux/delay.h> 40#include <linux/delay.h>
41 41#include <rdma/ib_verbs.h>
42 42
43#include "ipath_kernel.h" 43#include "ipath_kernel.h"
44#include "ipath_registers.h" 44#include "ipath_registers.h"
@@ -311,6 +311,9 @@ static const struct ipath_cregs ipath_pe_cregs = {
311 .cr_ibsymbolerrcnt = IPATH_CREG_OFFSET(IBSymbolErrCnt) 311 .cr_ibsymbolerrcnt = IPATH_CREG_OFFSET(IBSymbolErrCnt)
312}; 312};
313 313
314/* kr_control bits */
315#define INFINIPATH_C_RESET 1U
316
314/* kr_intstatus, kr_intclear, kr_intmask bits */ 317/* kr_intstatus, kr_intclear, kr_intmask bits */
315#define INFINIPATH_I_RCVURG_MASK ((1U<<5)-1) 318#define INFINIPATH_I_RCVURG_MASK ((1U<<5)-1)
316#define INFINIPATH_I_RCVAVAIL_MASK ((1U<<5)-1) 319#define INFINIPATH_I_RCVAVAIL_MASK ((1U<<5)-1)
@@ -338,6 +341,9 @@ static const struct ipath_cregs ipath_pe_cregs = {
338#define INFINIPATH_EXTS_MEMBIST_ENDTEST 0x0000000000004000 341#define INFINIPATH_EXTS_MEMBIST_ENDTEST 0x0000000000004000
339#define INFINIPATH_EXTS_MEMBIST_FOUND 0x0000000000008000 342#define INFINIPATH_EXTS_MEMBIST_FOUND 0x0000000000008000
340 343
344/* kr_xgxsconfig bits */
345#define INFINIPATH_XGXS_RESET 0x5ULL
346
341#define _IPATH_GPIO_SDA_NUM 1 347#define _IPATH_GPIO_SDA_NUM 1
342#define _IPATH_GPIO_SCL_NUM 0 348#define _IPATH_GPIO_SCL_NUM 0
343 349
@@ -346,6 +352,16 @@ static const struct ipath_cregs ipath_pe_cregs = {
346#define IPATH_GPIO_SCL (1ULL << \ 352#define IPATH_GPIO_SCL (1ULL << \
347 (_IPATH_GPIO_SCL_NUM+INFINIPATH_EXTC_GPIOOE_SHIFT)) 353 (_IPATH_GPIO_SCL_NUM+INFINIPATH_EXTC_GPIOOE_SHIFT))
348 354
355#define INFINIPATH_RT_BUFSIZE_MASK 0xe0000000ULL
356#define INFINIPATH_RT_BUFSIZE_SHIFTVAL(tid) \
357 ((((tid) & INFINIPATH_RT_BUFSIZE_MASK) >> 29) + 11 - 1)
358#define INFINIPATH_RT_BUFSIZE(tid) (1 << INFINIPATH_RT_BUFSIZE_SHIFTVAL(tid))
359#define INFINIPATH_RT_IS_VALID(tid) \
360 (((tid) & INFINIPATH_RT_BUFSIZE_MASK) && \
361 ((((tid) & INFINIPATH_RT_BUFSIZE_MASK) != INFINIPATH_RT_BUFSIZE_MASK)))
362#define INFINIPATH_RT_ADDR_MASK 0x1FFFFFFFULL /* 29 bits valid */
363#define INFINIPATH_RT_ADDR_SHIFT 10
364
349#define INFINIPATH_R_INTRAVAIL_SHIFT 16 365#define INFINIPATH_R_INTRAVAIL_SHIFT 16
350#define INFINIPATH_R_TAILUPD_SHIFT 31 366#define INFINIPATH_R_TAILUPD_SHIFT 31
351 367
@@ -372,6 +388,8 @@ static const struct ipath_hwerror_msgs ipath_6120_hwerror_msgs[] = {
372#define TXE_PIO_PARITY ((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | \ 388#define TXE_PIO_PARITY ((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | \
373 INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC) \ 389 INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC) \
374 << INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT) 390 << INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT)
391#define RXE_EAGER_PARITY (INFINIPATH_HWE_RXEMEMPARITYERR_EAGERTID \
392 << INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT)
375 393
376static void ipath_pe_put_tid_2(struct ipath_devdata *, u64 __iomem *, 394static void ipath_pe_put_tid_2(struct ipath_devdata *, u64 __iomem *,
377 u32, unsigned long); 395 u32, unsigned long);
@@ -450,10 +468,8 @@ static void ipath_pe_handle_hwerrors(struct ipath_devdata *dd, char *msg,
450 * make sure we get this much out, unless told to be quiet, 468 * make sure we get this much out, unless told to be quiet,
451 * or it's occurred within the last 5 seconds 469 * or it's occurred within the last 5 seconds
452 */ 470 */
453 if ((hwerrs & ~(dd->ipath_lasthwerror | 471 if ((hwerrs & ~(dd->ipath_lasthwerror | TXE_PIO_PARITY |
454 ((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | 472 RXE_EAGER_PARITY)) ||
455 INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC)
456 << INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT))) ||
457 (ipath_debug & __IPATH_VERBDBG)) 473 (ipath_debug & __IPATH_VERBDBG))
458 dev_info(&dd->pcidev->dev, "Hardware error: hwerr=0x%llx " 474 dev_info(&dd->pcidev->dev, "Hardware error: hwerr=0x%llx "
459 "(cleared)\n", (unsigned long long) hwerrs); 475 "(cleared)\n", (unsigned long long) hwerrs);
@@ -1218,7 +1234,7 @@ static void ipath_pe_put_tid(struct ipath_devdata *dd, u64 __iomem *tidptr,
1218 } 1234 }
1219 pa >>= 11; 1235 pa >>= 11;
1220 /* paranoia check */ 1236 /* paranoia check */
1221 if (pa & (7<<29)) 1237 if (pa & ~INFINIPATH_RT_ADDR_MASK)
1222 ipath_dev_err(dd, 1238 ipath_dev_err(dd,
1223 "BUG: Physical page address 0x%lx " 1239 "BUG: Physical page address 0x%lx "
1224 "has bits set in 31-29\n", pa); 1240 "has bits set in 31-29\n", pa);
@@ -1270,7 +1286,7 @@ static void ipath_pe_put_tid_2(struct ipath_devdata *dd, u64 __iomem *tidptr,
1270 } 1286 }
1271 pa >>= 11; 1287 pa >>= 11;
1272 /* paranoia check */ 1288 /* paranoia check */
1273 if (pa & (7<<29)) 1289 if (pa & ~INFINIPATH_RT_ADDR_MASK)
1274 ipath_dev_err(dd, 1290 ipath_dev_err(dd,
1275 "BUG: Physical page address 0x%lx " 1291 "BUG: Physical page address 0x%lx "
1276 "has bits set in 31-29\n", pa); 1292 "has bits set in 31-29\n", pa);
diff --git a/drivers/infiniband/hw/ipath/ipath_registers.h b/drivers/infiniband/hw/ipath/ipath_registers.h
index 92ad73a7fff0..cb19ea260837 100644
--- a/drivers/infiniband/hw/ipath/ipath_registers.h
+++ b/drivers/infiniband/hw/ipath/ipath_registers.h
@@ -63,7 +63,6 @@
63/* kr_control bits */ 63/* kr_control bits */
64#define INFINIPATH_C_FREEZEMODE 0x00000002 64#define INFINIPATH_C_FREEZEMODE 0x00000002
65#define INFINIPATH_C_LINKENABLE 0x00000004 65#define INFINIPATH_C_LINKENABLE 0x00000004
66#define INFINIPATH_C_RESET 0x00000001
67 66
68/* kr_sendctrl bits */ 67/* kr_sendctrl bits */
69#define INFINIPATH_S_DISARMPIOBUF_SHIFT 16 68#define INFINIPATH_S_DISARMPIOBUF_SHIFT 16
@@ -287,7 +286,6 @@
287#define INFINIPATH_SERDC0_L1PWR_DN 0xF0ULL 286#define INFINIPATH_SERDC0_L1PWR_DN 0xF0ULL
288 287
289/* kr_xgxsconfig bits */ 288/* kr_xgxsconfig bits */
290#define INFINIPATH_XGXS_RESET 0x7ULL
291#define INFINIPATH_XGXS_RX_POL_SHIFT 19 289#define INFINIPATH_XGXS_RX_POL_SHIFT 19
292#define INFINIPATH_XGXS_RX_POL_MASK 0xfULL 290#define INFINIPATH_XGXS_RX_POL_MASK 0xfULL
293 291