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

IB/ipath: Generalize some xxx_SHIFT macros

In preparation for upcoming chips that have different values for
INFINIPATH_R_PORTENABLE_SHIFT, INFINIPATH_R_INTRAVAIL_SHIFT,
INFINIPATH_R_TAILUPD_SHIFT, and portcfg_shift, remove the shared
#defines and use device-specific variables instead.
Signed-off-by: default avatarDave Olson <dave.olson@qlogic.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent c59a80ac
...@@ -744,10 +744,10 @@ static int ipath_manage_rcvq(struct ipath_portdata *pd, unsigned subport, ...@@ -744,10 +744,10 @@ static int ipath_manage_rcvq(struct ipath_portdata *pd, unsigned subport,
*/ */
if (pd->port_rcvhdrtail_kvaddr) if (pd->port_rcvhdrtail_kvaddr)
ipath_clear_rcvhdrtail(pd); ipath_clear_rcvhdrtail(pd);
set_bit(INFINIPATH_R_PORTENABLE_SHIFT + pd->port_port, set_bit(dd->ipath_r_portenable_shift + pd->port_port,
&dd->ipath_rcvctrl); &dd->ipath_rcvctrl);
} else } else
clear_bit(INFINIPATH_R_PORTENABLE_SHIFT + pd->port_port, clear_bit(dd->ipath_r_portenable_shift + pd->port_port,
&dd->ipath_rcvctrl); &dd->ipath_rcvctrl);
ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl,
dd->ipath_rcvctrl); dd->ipath_rcvctrl);
...@@ -1405,7 +1405,7 @@ static unsigned int ipath_poll_next(struct ipath_portdata *pd, ...@@ -1405,7 +1405,7 @@ static unsigned int ipath_poll_next(struct ipath_portdata *pd,
/* flush waiting flag so we don't miss an event */ /* flush waiting flag so we don't miss an event */
wmb(); wmb();
set_bit(pd->port_port + INFINIPATH_R_INTRAVAIL_SHIFT, set_bit(pd->port_port + dd->ipath_r_intravail_shift,
&dd->ipath_rcvctrl); &dd->ipath_rcvctrl);
ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl,
...@@ -1938,10 +1938,11 @@ static int ipath_do_user_init(struct file *fp, ...@@ -1938,10 +1938,11 @@ static int ipath_do_user_init(struct file *fp,
*/ */
if (pd->port_rcvhdrtail_kvaddr) if (pd->port_rcvhdrtail_kvaddr)
ipath_clear_rcvhdrtail(pd); ipath_clear_rcvhdrtail(pd);
set_bit(INFINIPATH_R_PORTENABLE_SHIFT + pd->port_port, set_bit(dd->ipath_r_portenable_shift + pd->port_port,
&dd->ipath_rcvctrl); &dd->ipath_rcvctrl);
ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl,
dd->ipath_rcvctrl & ~INFINIPATH_R_TAILUPD); dd->ipath_rcvctrl &
~(1ULL << dd->ipath_r_tailupd_shift));
ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl,
dd->ipath_rcvctrl); dd->ipath_rcvctrl);
/* Notify any waiting slaves */ /* Notify any waiting slaves */
...@@ -2050,9 +2051,9 @@ static int ipath_close(struct inode *in, struct file *fp) ...@@ -2050,9 +2051,9 @@ static int ipath_close(struct inode *in, struct file *fp)
if (dd->ipath_kregbase) { if (dd->ipath_kregbase) {
int i; int i;
/* atomically clear receive enable port and intr avail. */ /* atomically clear receive enable port and intr avail. */
clear_bit(INFINIPATH_R_PORTENABLE_SHIFT + port, clear_bit(dd->ipath_r_portenable_shift + port,
&dd->ipath_rcvctrl); &dd->ipath_rcvctrl);
clear_bit(pd->port_port + INFINIPATH_R_INTRAVAIL_SHIFT, clear_bit(pd->port_port + dd->ipath_r_intravail_shift,
&dd->ipath_rcvctrl); &dd->ipath_rcvctrl);
ipath_write_kreg( dd, dd->ipath_kregs->kr_rcvctrl, ipath_write_kreg( dd, dd->ipath_kregs->kr_rcvctrl,
dd->ipath_rcvctrl); dd->ipath_rcvctrl);
......
...@@ -296,6 +296,12 @@ static const struct ipath_cregs ipath_ht_cregs = { ...@@ -296,6 +296,12 @@ static const struct ipath_cregs ipath_ht_cregs = {
#define INFINIPATH_RT_BUFSIZE_MASK 0x3FFFULL #define INFINIPATH_RT_BUFSIZE_MASK 0x3FFFULL
#define INFINIPATH_RT_BUFSIZE_SHIFT 48 #define INFINIPATH_RT_BUFSIZE_SHIFT 48
#define INFINIPATH_R_INTRAVAIL_SHIFT 16
#define INFINIPATH_R_TAILUPD_SHIFT 31
/* kr_xgxsconfig bits */
#define INFINIPATH_XGXS_RESET 0x7ULL
/* /*
* masks and bits that are different in different chips, or present only * masks and bits that are different in different chips, or present only
* in one * in one
...@@ -1079,6 +1085,12 @@ static void ipath_init_ht_variables(struct ipath_devdata *dd) ...@@ -1079,6 +1085,12 @@ static void ipath_init_ht_variables(struct ipath_devdata *dd)
dd->ipath_gpio_sda = IPATH_GPIO_SDA; dd->ipath_gpio_sda = IPATH_GPIO_SDA;
dd->ipath_gpio_scl = IPATH_GPIO_SCL; dd->ipath_gpio_scl = IPATH_GPIO_SCL;
/* Fill in shifts for RcvCtrl. */
dd->ipath_r_portenable_shift = INFINIPATH_R_PORTENABLE_SHIFT;
dd->ipath_r_intravail_shift = INFINIPATH_R_INTRAVAIL_SHIFT;
dd->ipath_r_tailupd_shift = INFINIPATH_R_TAILUPD_SHIFT;
dd->ipath_r_portcfg_shift = 0; /* Not on IBA6110 */
dd->ipath_i_bitsextant = dd->ipath_i_bitsextant =
(INFINIPATH_I_RCVURG_MASK << INFINIPATH_I_RCVURG_SHIFT) | (INFINIPATH_I_RCVURG_MASK << INFINIPATH_I_RCVURG_SHIFT) |
(INFINIPATH_I_RCVAVAIL_MASK << (INFINIPATH_I_RCVAVAIL_MASK <<
......
...@@ -296,6 +296,9 @@ static const struct ipath_cregs ipath_pe_cregs = { ...@@ -296,6 +296,9 @@ 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_R_INTRAVAIL_SHIFT 16
#define INFINIPATH_R_TAILUPD_SHIFT 31
/* 6120 specific hardware errors... */ /* 6120 specific hardware errors... */
static const struct ipath_hwerror_msgs ipath_6120_hwerror_msgs[] = { static const struct ipath_hwerror_msgs ipath_6120_hwerror_msgs[] = {
INFINIPATH_HWE_MSG(PCIEPOISONEDTLP, "PCIe Poisoned TLP"), INFINIPATH_HWE_MSG(PCIEPOISONEDTLP, "PCIe Poisoned TLP"),
...@@ -916,6 +919,12 @@ static void ipath_init_pe_variables(struct ipath_devdata *dd) ...@@ -916,6 +919,12 @@ static void ipath_init_pe_variables(struct ipath_devdata *dd)
dd->ipath_gpio_sda = IPATH_GPIO_SDA; dd->ipath_gpio_sda = IPATH_GPIO_SDA;
dd->ipath_gpio_scl = IPATH_GPIO_SCL; dd->ipath_gpio_scl = IPATH_GPIO_SCL;
/* Fill in shifts for RcvCtrl. */
dd->ipath_r_portenable_shift = INFINIPATH_R_PORTENABLE_SHIFT;
dd->ipath_r_intravail_shift = INFINIPATH_R_INTRAVAIL_SHIFT;
dd->ipath_r_tailupd_shift = INFINIPATH_R_TAILUPD_SHIFT;
dd->ipath_r_portcfg_shift = 0; /* Not on IBA6120 */
/* variables for sanity checking interrupt and errors */ /* variables for sanity checking interrupt and errors */
dd->ipath_hwe_bitsextant = dd->ipath_hwe_bitsextant =
(INFINIPATH_HWE_RXEMEMPARITYERR_MASK << (INFINIPATH_HWE_RXEMEMPARITYERR_MASK <<
......
...@@ -508,9 +508,9 @@ static void enable_chip(struct ipath_devdata *dd, ...@@ -508,9 +508,9 @@ static void enable_chip(struct ipath_devdata *dd,
* enable port 0 receive, and receive interrupt. other ports * enable port 0 receive, and receive interrupt. other ports
* done as user opens and inits them. * done as user opens and inits them.
*/ */
dd->ipath_rcvctrl = INFINIPATH_R_TAILUPD | dd->ipath_rcvctrl = (1ULL << dd->ipath_r_tailupd_shift) |
(1ULL << INFINIPATH_R_PORTENABLE_SHIFT) | (1ULL << dd->ipath_r_portenable_shift) |
(1ULL << INFINIPATH_R_INTRAVAIL_SHIFT); (1ULL << dd->ipath_r_intravail_shift);
ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl,
dd->ipath_rcvctrl); dd->ipath_rcvctrl);
......
...@@ -975,7 +975,7 @@ static void handle_urcv(struct ipath_devdata *dd, u32 istat) ...@@ -975,7 +975,7 @@ static void handle_urcv(struct ipath_devdata *dd, u32 istat)
if (portr & (1 << i) && pd && pd->port_cnt) { if (portr & (1 << i) && pd && pd->port_cnt) {
if (test_and_clear_bit(IPATH_PORT_WAITING_RCV, if (test_and_clear_bit(IPATH_PORT_WAITING_RCV,
&pd->port_flag)) { &pd->port_flag)) {
clear_bit(i + INFINIPATH_R_INTRAVAIL_SHIFT, clear_bit(i + dd->ipath_r_intravail_shift,
&dd->ipath_rcvctrl); &dd->ipath_rcvctrl);
wake_up_interruptible(&pd->port_wait); wake_up_interruptible(&pd->port_wait);
rcvdint = 1; rcvdint = 1;
......
...@@ -550,6 +550,12 @@ struct ipath_devdata { ...@@ -550,6 +550,12 @@ struct ipath_devdata {
u8 ipath_minrev; u8 ipath_minrev;
/* board rev, from ipath_revision */ /* board rev, from ipath_revision */
u8 ipath_boardrev; u8 ipath_boardrev;
u8 ipath_r_portenable_shift;
u8 ipath_r_intravail_shift;
u8 ipath_r_tailupd_shift;
u8 ipath_r_portcfg_shift;
/* unit # of this chip, if present */ /* unit # of this chip, if present */
int ipath_unit; int ipath_unit;
/* saved for restore after reset */ /* saved for restore after reset */
......
...@@ -82,8 +82,7 @@ ...@@ -82,8 +82,7 @@
/* kr_rcvctrl bits */ /* kr_rcvctrl bits */
#define INFINIPATH_R_PORTENABLE_SHIFT 0 #define INFINIPATH_R_PORTENABLE_SHIFT 0
#define INFINIPATH_R_INTRAVAIL_SHIFT 16 #define INFINIPATH_R_QPMAP_ENABLE (1ULL << 38)
#define INFINIPATH_R_TAILUPD 0x80000000
/* kr_intstatus, kr_intclear, kr_intmask bits */ /* kr_intstatus, kr_intclear, kr_intmask bits */
#define INFINIPATH_I_RCVURG_SHIFT 0 #define INFINIPATH_I_RCVURG_SHIFT 0
......
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