diff options
author | Dave Olson <dave.olson@qlogic.com> | 2007-12-21 04:50:59 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-01-25 17:15:36 -0500 |
commit | d8274869d742c3d8082e1428de47e54d12104928 (patch) | |
tree | 128d36e05d5facbff15652eb24faf03cbec3da8e /drivers/infiniband | |
parent | c59a80aca0bfc491d90534ed5606d5493eca24a3 (diff) |
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: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_file_ops.c | 15 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_iba6110.c | 12 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_iba6120.c | 9 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_init_chip.c | 6 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_intr.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_kernel.h | 6 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_registers.h | 3 |
7 files changed, 40 insertions, 13 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c index 4277014d6f8e..65da7a9808ec 100644 --- a/drivers/infiniband/hw/ipath/ipath_file_ops.c +++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c | |||
@@ -744,10 +744,10 @@ static int ipath_manage_rcvq(struct ipath_portdata *pd, unsigned subport, | |||
744 | */ | 744 | */ |
745 | if (pd->port_rcvhdrtail_kvaddr) | 745 | if (pd->port_rcvhdrtail_kvaddr) |
746 | ipath_clear_rcvhdrtail(pd); | 746 | ipath_clear_rcvhdrtail(pd); |
747 | set_bit(INFINIPATH_R_PORTENABLE_SHIFT + pd->port_port, | 747 | set_bit(dd->ipath_r_portenable_shift + pd->port_port, |
748 | &dd->ipath_rcvctrl); | 748 | &dd->ipath_rcvctrl); |
749 | } else | 749 | } else |
750 | clear_bit(INFINIPATH_R_PORTENABLE_SHIFT + pd->port_port, | 750 | clear_bit(dd->ipath_r_portenable_shift + pd->port_port, |
751 | &dd->ipath_rcvctrl); | 751 | &dd->ipath_rcvctrl); |
752 | ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, | 752 | ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, |
753 | dd->ipath_rcvctrl); | 753 | dd->ipath_rcvctrl); |
@@ -1405,7 +1405,7 @@ static unsigned int ipath_poll_next(struct ipath_portdata *pd, | |||
1405 | /* flush waiting flag so we don't miss an event */ | 1405 | /* flush waiting flag so we don't miss an event */ |
1406 | wmb(); | 1406 | wmb(); |
1407 | 1407 | ||
1408 | set_bit(pd->port_port + INFINIPATH_R_INTRAVAIL_SHIFT, | 1408 | set_bit(pd->port_port + dd->ipath_r_intravail_shift, |
1409 | &dd->ipath_rcvctrl); | 1409 | &dd->ipath_rcvctrl); |
1410 | 1410 | ||
1411 | ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, | 1411 | ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, |
@@ -1938,10 +1938,11 @@ static int ipath_do_user_init(struct file *fp, | |||
1938 | */ | 1938 | */ |
1939 | if (pd->port_rcvhdrtail_kvaddr) | 1939 | if (pd->port_rcvhdrtail_kvaddr) |
1940 | ipath_clear_rcvhdrtail(pd); | 1940 | ipath_clear_rcvhdrtail(pd); |
1941 | set_bit(INFINIPATH_R_PORTENABLE_SHIFT + pd->port_port, | 1941 | set_bit(dd->ipath_r_portenable_shift + pd->port_port, |
1942 | &dd->ipath_rcvctrl); | 1942 | &dd->ipath_rcvctrl); |
1943 | ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, | 1943 | ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, |
1944 | dd->ipath_rcvctrl & ~INFINIPATH_R_TAILUPD); | 1944 | dd->ipath_rcvctrl & |
1945 | ~(1ULL << dd->ipath_r_tailupd_shift)); | ||
1945 | ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, | 1946 | ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, |
1946 | dd->ipath_rcvctrl); | 1947 | dd->ipath_rcvctrl); |
1947 | /* Notify any waiting slaves */ | 1948 | /* Notify any waiting slaves */ |
@@ -2050,9 +2051,9 @@ static int ipath_close(struct inode *in, struct file *fp) | |||
2050 | if (dd->ipath_kregbase) { | 2051 | if (dd->ipath_kregbase) { |
2051 | int i; | 2052 | int i; |
2052 | /* atomically clear receive enable port and intr avail. */ | 2053 | /* atomically clear receive enable port and intr avail. */ |
2053 | clear_bit(INFINIPATH_R_PORTENABLE_SHIFT + port, | 2054 | clear_bit(dd->ipath_r_portenable_shift + port, |
2054 | &dd->ipath_rcvctrl); | 2055 | &dd->ipath_rcvctrl); |
2055 | clear_bit(pd->port_port + INFINIPATH_R_INTRAVAIL_SHIFT, | 2056 | clear_bit(pd->port_port + dd->ipath_r_intravail_shift, |
2056 | &dd->ipath_rcvctrl); | 2057 | &dd->ipath_rcvctrl); |
2057 | ipath_write_kreg( dd, dd->ipath_kregs->kr_rcvctrl, | 2058 | ipath_write_kreg( dd, dd->ipath_kregs->kr_rcvctrl, |
2058 | dd->ipath_rcvctrl); | 2059 | dd->ipath_rcvctrl); |
diff --git a/drivers/infiniband/hw/ipath/ipath_iba6110.c b/drivers/infiniband/hw/ipath/ipath_iba6110.c index ddbebe4bdb27..c272a7392e22 100644 --- a/drivers/infiniband/hw/ipath/ipath_iba6110.c +++ b/drivers/infiniband/hw/ipath/ipath_iba6110.c | |||
@@ -296,6 +296,12 @@ static const struct ipath_cregs ipath_ht_cregs = { | |||
296 | #define INFINIPATH_RT_BUFSIZE_MASK 0x3FFFULL | 296 | #define INFINIPATH_RT_BUFSIZE_MASK 0x3FFFULL |
297 | #define INFINIPATH_RT_BUFSIZE_SHIFT 48 | 297 | #define INFINIPATH_RT_BUFSIZE_SHIFT 48 |
298 | 298 | ||
299 | #define INFINIPATH_R_INTRAVAIL_SHIFT 16 | ||
300 | #define INFINIPATH_R_TAILUPD_SHIFT 31 | ||
301 | |||
302 | /* kr_xgxsconfig bits */ | ||
303 | #define INFINIPATH_XGXS_RESET 0x7ULL | ||
304 | |||
299 | /* | 305 | /* |
300 | * masks and bits that are different in different chips, or present only | 306 | * masks and bits that are different in different chips, or present only |
301 | * in one | 307 | * in one |
@@ -1079,6 +1085,12 @@ static void ipath_init_ht_variables(struct ipath_devdata *dd) | |||
1079 | dd->ipath_gpio_sda = IPATH_GPIO_SDA; | 1085 | dd->ipath_gpio_sda = IPATH_GPIO_SDA; |
1080 | dd->ipath_gpio_scl = IPATH_GPIO_SCL; | 1086 | dd->ipath_gpio_scl = IPATH_GPIO_SCL; |
1081 | 1087 | ||
1088 | /* Fill in shifts for RcvCtrl. */ | ||
1089 | dd->ipath_r_portenable_shift = INFINIPATH_R_PORTENABLE_SHIFT; | ||
1090 | dd->ipath_r_intravail_shift = INFINIPATH_R_INTRAVAIL_SHIFT; | ||
1091 | dd->ipath_r_tailupd_shift = INFINIPATH_R_TAILUPD_SHIFT; | ||
1092 | dd->ipath_r_portcfg_shift = 0; /* Not on IBA6110 */ | ||
1093 | |||
1082 | dd->ipath_i_bitsextant = | 1094 | dd->ipath_i_bitsextant = |
1083 | (INFINIPATH_I_RCVURG_MASK << INFINIPATH_I_RCVURG_SHIFT) | | 1095 | (INFINIPATH_I_RCVURG_MASK << INFINIPATH_I_RCVURG_SHIFT) | |
1084 | (INFINIPATH_I_RCVAVAIL_MASK << | 1096 | (INFINIPATH_I_RCVAVAIL_MASK << |
diff --git a/drivers/infiniband/hw/ipath/ipath_iba6120.c b/drivers/infiniband/hw/ipath/ipath_iba6120.c index 0103d6f4847b..e6893ebc59d4 100644 --- a/drivers/infiniband/hw/ipath/ipath_iba6120.c +++ b/drivers/infiniband/hw/ipath/ipath_iba6120.c | |||
@@ -296,6 +296,9 @@ static const struct ipath_cregs ipath_pe_cregs = { | |||
296 | #define IPATH_GPIO_SCL (1ULL << \ | 296 | #define IPATH_GPIO_SCL (1ULL << \ |
297 | (_IPATH_GPIO_SCL_NUM+INFINIPATH_EXTC_GPIOOE_SHIFT)) | 297 | (_IPATH_GPIO_SCL_NUM+INFINIPATH_EXTC_GPIOOE_SHIFT)) |
298 | 298 | ||
299 | #define INFINIPATH_R_INTRAVAIL_SHIFT 16 | ||
300 | #define INFINIPATH_R_TAILUPD_SHIFT 31 | ||
301 | |||
299 | /* 6120 specific hardware errors... */ | 302 | /* 6120 specific hardware errors... */ |
300 | static const struct ipath_hwerror_msgs ipath_6120_hwerror_msgs[] = { | 303 | static const struct ipath_hwerror_msgs ipath_6120_hwerror_msgs[] = { |
301 | INFINIPATH_HWE_MSG(PCIEPOISONEDTLP, "PCIe Poisoned TLP"), | 304 | INFINIPATH_HWE_MSG(PCIEPOISONEDTLP, "PCIe Poisoned TLP"), |
@@ -916,6 +919,12 @@ static void ipath_init_pe_variables(struct ipath_devdata *dd) | |||
916 | dd->ipath_gpio_sda = IPATH_GPIO_SDA; | 919 | dd->ipath_gpio_sda = IPATH_GPIO_SDA; |
917 | dd->ipath_gpio_scl = IPATH_GPIO_SCL; | 920 | dd->ipath_gpio_scl = IPATH_GPIO_SCL; |
918 | 921 | ||
922 | /* Fill in shifts for RcvCtrl. */ | ||
923 | dd->ipath_r_portenable_shift = INFINIPATH_R_PORTENABLE_SHIFT; | ||
924 | dd->ipath_r_intravail_shift = INFINIPATH_R_INTRAVAIL_SHIFT; | ||
925 | dd->ipath_r_tailupd_shift = INFINIPATH_R_TAILUPD_SHIFT; | ||
926 | dd->ipath_r_portcfg_shift = 0; /* Not on IBA6120 */ | ||
927 | |||
919 | /* variables for sanity checking interrupt and errors */ | 928 | /* variables for sanity checking interrupt and errors */ |
920 | dd->ipath_hwe_bitsextant = | 929 | dd->ipath_hwe_bitsextant = |
921 | (INFINIPATH_HWE_RXEMEMPARITYERR_MASK << | 930 | (INFINIPATH_HWE_RXEMEMPARITYERR_MASK << |
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c index e161cad21a19..cf64d3855ff5 100644 --- a/drivers/infiniband/hw/ipath/ipath_init_chip.c +++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c | |||
@@ -508,9 +508,9 @@ static void enable_chip(struct ipath_devdata *dd, | |||
508 | * enable port 0 receive, and receive interrupt. other ports | 508 | * enable port 0 receive, and receive interrupt. other ports |
509 | * done as user opens and inits them. | 509 | * done as user opens and inits them. |
510 | */ | 510 | */ |
511 | dd->ipath_rcvctrl = INFINIPATH_R_TAILUPD | | 511 | dd->ipath_rcvctrl = (1ULL << dd->ipath_r_tailupd_shift) | |
512 | (1ULL << INFINIPATH_R_PORTENABLE_SHIFT) | | 512 | (1ULL << dd->ipath_r_portenable_shift) | |
513 | (1ULL << INFINIPATH_R_INTRAVAIL_SHIFT); | 513 | (1ULL << dd->ipath_r_intravail_shift); |
514 | ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, | 514 | ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, |
515 | dd->ipath_rcvctrl); | 515 | dd->ipath_rcvctrl); |
516 | 516 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c index ec18b9b1bb08..d9f8342e954f 100644 --- a/drivers/infiniband/hw/ipath/ipath_intr.c +++ b/drivers/infiniband/hw/ipath/ipath_intr.c | |||
@@ -975,7 +975,7 @@ static void handle_urcv(struct ipath_devdata *dd, u32 istat) | |||
975 | if (portr & (1 << i) && pd && pd->port_cnt) { | 975 | if (portr & (1 << i) && pd && pd->port_cnt) { |
976 | if (test_and_clear_bit(IPATH_PORT_WAITING_RCV, | 976 | if (test_and_clear_bit(IPATH_PORT_WAITING_RCV, |
977 | &pd->port_flag)) { | 977 | &pd->port_flag)) { |
978 | clear_bit(i + INFINIPATH_R_INTRAVAIL_SHIFT, | 978 | clear_bit(i + dd->ipath_r_intravail_shift, |
979 | &dd->ipath_rcvctrl); | 979 | &dd->ipath_rcvctrl); |
980 | wake_up_interruptible(&pd->port_wait); | 980 | wake_up_interruptible(&pd->port_wait); |
981 | rcvdint = 1; | 981 | rcvdint = 1; |
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h index 72252349eaa9..57e21bbd9ffa 100644 --- a/drivers/infiniband/hw/ipath/ipath_kernel.h +++ b/drivers/infiniband/hw/ipath/ipath_kernel.h | |||
@@ -550,6 +550,12 @@ struct ipath_devdata { | |||
550 | u8 ipath_minrev; | 550 | u8 ipath_minrev; |
551 | /* board rev, from ipath_revision */ | 551 | /* board rev, from ipath_revision */ |
552 | u8 ipath_boardrev; | 552 | u8 ipath_boardrev; |
553 | |||
554 | u8 ipath_r_portenable_shift; | ||
555 | u8 ipath_r_intravail_shift; | ||
556 | u8 ipath_r_tailupd_shift; | ||
557 | u8 ipath_r_portcfg_shift; | ||
558 | |||
553 | /* unit # of this chip, if present */ | 559 | /* unit # of this chip, if present */ |
554 | int ipath_unit; | 560 | int ipath_unit; |
555 | /* saved for restore after reset */ | 561 | /* saved for restore after reset */ |
diff --git a/drivers/infiniband/hw/ipath/ipath_registers.h b/drivers/infiniband/hw/ipath/ipath_registers.h index 708eba3165d7..d7181d444ed7 100644 --- a/drivers/infiniband/hw/ipath/ipath_registers.h +++ b/drivers/infiniband/hw/ipath/ipath_registers.h | |||
@@ -82,8 +82,7 @@ | |||
82 | 82 | ||
83 | /* kr_rcvctrl bits */ | 83 | /* kr_rcvctrl bits */ |
84 | #define INFINIPATH_R_PORTENABLE_SHIFT 0 | 84 | #define INFINIPATH_R_PORTENABLE_SHIFT 0 |
85 | #define INFINIPATH_R_INTRAVAIL_SHIFT 16 | 85 | #define INFINIPATH_R_QPMAP_ENABLE (1ULL << 38) |
86 | #define INFINIPATH_R_TAILUPD 0x80000000 | ||
87 | 86 | ||
88 | /* kr_intstatus, kr_intclear, kr_intmask bits */ | 87 | /* kr_intstatus, kr_intclear, kr_intmask bits */ |
89 | #define INFINIPATH_I_RCVURG_SHIFT 0 | 88 | #define INFINIPATH_I_RCVURG_SHIFT 0 |