Commit f2ceb492 authored by Dave Olson's avatar Dave Olson Committed by Roland Dreier

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: default avatarRoland Dreier <rolandd@cisco.com>
parent 3dd59e22
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/htirq.h> #include <linux/htirq.h>
#include <rdma/ib_verbs.h>
#include "ipath_kernel.h" #include "ipath_kernel.h"
#include "ipath_registers.h" #include "ipath_registers.h"
...@@ -476,7 +477,13 @@ static const struct ipath_hwerror_msgs ipath_6110_hwerror_msgs[] = { ...@@ -476,7 +477,13 @@ static const struct ipath_hwerror_msgs ipath_6110_hwerror_msgs[] = {
#define RXE_EAGER_PARITY (INFINIPATH_HWE_RXEMEMPARITYERR_EAGERTID \ #define RXE_EAGER_PARITY (INFINIPATH_HWE_RXEMEMPARITYERR_EAGERTID \
<< INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT) << INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT)
static int ipath_ht_txe_recover(struct ipath_devdata *); static void ipath_ht_txe_recover(struct ipath_devdata *dd)
{
++ipath_stats.sps_txeparity;
dev_info(&dd->pcidev->dev,
"Recovering from TXE PIO parity error\n");
}
/** /**
* ipath_ht_handle_hwerrors - display hardware errors. * ipath_ht_handle_hwerrors - display hardware errors.
...@@ -557,11 +564,11 @@ static void ipath_ht_handle_hwerrors(struct ipath_devdata *dd, char *msg, ...@@ -557,11 +564,11 @@ static void ipath_ht_handle_hwerrors(struct ipath_devdata *dd, char *msg,
* occur if a processor speculative read is done to the PIO * occur if a processor speculative read is done to the PIO
* buffer while we are sending a packet, for example. * buffer while we are sending a packet, for example.
*/ */
if ((hwerrs & TXE_PIO_PARITY) && ipath_ht_txe_recover(dd)) if (hwerrs & TXE_PIO_PARITY) {
ipath_ht_txe_recover(dd);
hwerrs &= ~TXE_PIO_PARITY; hwerrs &= ~TXE_PIO_PARITY;
if (hwerrs & RXE_EAGER_PARITY) }
ipath_dev_err(dd, "RXE parity, Eager TID error is not "
"recoverable\n");
if (!hwerrs) { if (!hwerrs) {
ipath_dbg("Clearing freezemode on ignored or " ipath_dbg("Clearing freezemode on ignored or "
"recovered hardware error\n"); "recovered hardware error\n");
...@@ -1653,22 +1660,6 @@ static int ipath_ht_early_init(struct ipath_devdata *dd) ...@@ -1653,22 +1660,6 @@ static int ipath_ht_early_init(struct ipath_devdata *dd)
} }
static int ipath_ht_txe_recover(struct ipath_devdata *dd)
{
int cnt = ++ipath_stats.sps_txeparity;
if (cnt >= IPATH_MAX_PARITY_ATTEMPTS) {
if (cnt == IPATH_MAX_PARITY_ATTEMPTS)
ipath_dev_err(dd,
"Too many attempts to recover from "
"TXE parity, giving up\n");
return 0;
}
dev_info(&dd->pcidev->dev,
"Recovering from TXE PIO parity error\n");
return 1;
}
/** /**
* ipath_init_ht_get_base_info - set chip-specific flags for user code * ipath_init_ht_get_base_info - set chip-specific flags for user code
* @dd: the infinipath device * @dd: the infinipath device
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <rdma/ib_verbs.h>
#include "ipath_kernel.h" #include "ipath_kernel.h"
#include "ipath_registers.h" #include "ipath_registers.h"
...@@ -311,6 +311,9 @@ static const struct ipath_cregs ipath_pe_cregs = { ...@@ -311,6 +311,9 @@ static const struct ipath_cregs ipath_pe_cregs = {
.cr_ibsymbolerrcnt = IPATH_CREG_OFFSET(IBSymbolErrCnt) .cr_ibsymbolerrcnt = IPATH_CREG_OFFSET(IBSymbolErrCnt)
}; };
/* kr_control bits */
#define INFINIPATH_C_RESET 1U
/* kr_intstatus, kr_intclear, kr_intmask bits */ /* kr_intstatus, kr_intclear, kr_intmask bits */
#define INFINIPATH_I_RCVURG_MASK ((1U<<5)-1) #define INFINIPATH_I_RCVURG_MASK ((1U<<5)-1)
#define INFINIPATH_I_RCVAVAIL_MASK ((1U<<5)-1) #define INFINIPATH_I_RCVAVAIL_MASK ((1U<<5)-1)
...@@ -338,6 +341,9 @@ static const struct ipath_cregs ipath_pe_cregs = { ...@@ -338,6 +341,9 @@ static const struct ipath_cregs ipath_pe_cregs = {
#define INFINIPATH_EXTS_MEMBIST_ENDTEST 0x0000000000004000 #define INFINIPATH_EXTS_MEMBIST_ENDTEST 0x0000000000004000
#define INFINIPATH_EXTS_MEMBIST_FOUND 0x0000000000008000 #define INFINIPATH_EXTS_MEMBIST_FOUND 0x0000000000008000
/* kr_xgxsconfig bits */
#define INFINIPATH_XGXS_RESET 0x5ULL
#define _IPATH_GPIO_SDA_NUM 1 #define _IPATH_GPIO_SDA_NUM 1
#define _IPATH_GPIO_SCL_NUM 0 #define _IPATH_GPIO_SCL_NUM 0
...@@ -346,6 +352,16 @@ static const struct ipath_cregs ipath_pe_cregs = { ...@@ -346,6 +352,16 @@ static const struct ipath_cregs ipath_pe_cregs = {
#define IPATH_GPIO_SCL (1ULL << \ #define IPATH_GPIO_SCL (1ULL << \
(_IPATH_GPIO_SCL_NUM+INFINIPATH_EXTC_GPIOOE_SHIFT)) (_IPATH_GPIO_SCL_NUM+INFINIPATH_EXTC_GPIOOE_SHIFT))
#define INFINIPATH_RT_BUFSIZE_MASK 0xe0000000ULL
#define INFINIPATH_RT_BUFSIZE_SHIFTVAL(tid) \
((((tid) & INFINIPATH_RT_BUFSIZE_MASK) >> 29) + 11 - 1)
#define INFINIPATH_RT_BUFSIZE(tid) (1 << INFINIPATH_RT_BUFSIZE_SHIFTVAL(tid))
#define INFINIPATH_RT_IS_VALID(tid) \
(((tid) & INFINIPATH_RT_BUFSIZE_MASK) && \
((((tid) & INFINIPATH_RT_BUFSIZE_MASK) != INFINIPATH_RT_BUFSIZE_MASK)))
#define INFINIPATH_RT_ADDR_MASK 0x1FFFFFFFULL /* 29 bits valid */
#define INFINIPATH_RT_ADDR_SHIFT 10
#define INFINIPATH_R_INTRAVAIL_SHIFT 16 #define INFINIPATH_R_INTRAVAIL_SHIFT 16
#define INFINIPATH_R_TAILUPD_SHIFT 31 #define INFINIPATH_R_TAILUPD_SHIFT 31
...@@ -372,6 +388,8 @@ static const struct ipath_hwerror_msgs ipath_6120_hwerror_msgs[] = { ...@@ -372,6 +388,8 @@ static const struct ipath_hwerror_msgs ipath_6120_hwerror_msgs[] = {
#define TXE_PIO_PARITY ((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | \ #define TXE_PIO_PARITY ((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | \
INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC) \ INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC) \
<< INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT) << INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT)
#define RXE_EAGER_PARITY (INFINIPATH_HWE_RXEMEMPARITYERR_EAGERTID \
<< INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT)
static void ipath_pe_put_tid_2(struct ipath_devdata *, u64 __iomem *, static void ipath_pe_put_tid_2(struct ipath_devdata *, u64 __iomem *,
u32, unsigned long); u32, unsigned long);
...@@ -450,10 +468,8 @@ static void ipath_pe_handle_hwerrors(struct ipath_devdata *dd, char *msg, ...@@ -450,10 +468,8 @@ static void ipath_pe_handle_hwerrors(struct ipath_devdata *dd, char *msg,
* make sure we get this much out, unless told to be quiet, * make sure we get this much out, unless told to be quiet,
* or it's occurred within the last 5 seconds * or it's occurred within the last 5 seconds
*/ */
if ((hwerrs & ~(dd->ipath_lasthwerror | if ((hwerrs & ~(dd->ipath_lasthwerror | TXE_PIO_PARITY |
((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | RXE_EAGER_PARITY)) ||
INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC)
<< INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT))) ||
(ipath_debug & __IPATH_VERBDBG)) (ipath_debug & __IPATH_VERBDBG))
dev_info(&dd->pcidev->dev, "Hardware error: hwerr=0x%llx " dev_info(&dd->pcidev->dev, "Hardware error: hwerr=0x%llx "
"(cleared)\n", (unsigned long long) hwerrs); "(cleared)\n", (unsigned long long) hwerrs);
...@@ -1218,7 +1234,7 @@ static void ipath_pe_put_tid(struct ipath_devdata *dd, u64 __iomem *tidptr, ...@@ -1218,7 +1234,7 @@ static void ipath_pe_put_tid(struct ipath_devdata *dd, u64 __iomem *tidptr,
} }
pa >>= 11; pa >>= 11;
/* paranoia check */ /* paranoia check */
if (pa & (7<<29)) if (pa & ~INFINIPATH_RT_ADDR_MASK)
ipath_dev_err(dd, ipath_dev_err(dd,
"BUG: Physical page address 0x%lx " "BUG: Physical page address 0x%lx "
"has bits set in 31-29\n", pa); "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,7 +1286,7 @@ static void ipath_pe_put_tid_2(struct ipath_devdata *dd, u64 __iomem *tidptr,
} }
pa >>= 11; pa >>= 11;
/* paranoia check */ /* paranoia check */
if (pa & (7<<29)) if (pa & ~INFINIPATH_RT_ADDR_MASK)
ipath_dev_err(dd, ipath_dev_err(dd,
"BUG: Physical page address 0x%lx " "BUG: Physical page address 0x%lx "
"has bits set in 31-29\n", pa); "has bits set in 31-29\n", pa);
......
...@@ -63,7 +63,6 @@ ...@@ -63,7 +63,6 @@
/* kr_control bits */ /* kr_control bits */
#define INFINIPATH_C_FREEZEMODE 0x00000002 #define INFINIPATH_C_FREEZEMODE 0x00000002
#define INFINIPATH_C_LINKENABLE 0x00000004 #define INFINIPATH_C_LINKENABLE 0x00000004
#define INFINIPATH_C_RESET 0x00000001
/* kr_sendctrl bits */ /* kr_sendctrl bits */
#define INFINIPATH_S_DISARMPIOBUF_SHIFT 16 #define INFINIPATH_S_DISARMPIOBUF_SHIFT 16
...@@ -287,7 +286,6 @@ ...@@ -287,7 +286,6 @@
#define INFINIPATH_SERDC0_L1PWR_DN 0xF0ULL #define INFINIPATH_SERDC0_L1PWR_DN 0xF0ULL
/* kr_xgxsconfig bits */ /* kr_xgxsconfig bits */
#define INFINIPATH_XGXS_RESET 0x7ULL
#define INFINIPATH_XGXS_RX_POL_SHIFT 19 #define INFINIPATH_XGXS_RX_POL_SHIFT 19
#define INFINIPATH_XGXS_RX_POL_MASK 0xfULL #define INFINIPATH_XGXS_RX_POL_MASK 0xfULL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment