diff options
author | Arthur Jones <arthur.jones@qlogic.com> | 2007-03-15 17:45:05 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-04-18 23:20:58 -0400 |
commit | 569b87b47f906d65ee35d6ecc4767f20a6390b9b (patch) | |
tree | d674574d3db6b25fe6bb41da8c64e1641bcc0d03 /drivers | |
parent | 7b196e2ff3953063b656212ff517f6115a1477b2 (diff) |
IB/ipath: Force PIOAvail update entry point
Due to a chip bug, the PIOAvail register is not always updated to
memory. This patch allows userspace to force an update.
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_common.h | 7 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_file_ops.c | 38 |
2 files changed, 35 insertions, 10 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_common.h b/drivers/infiniband/hw/ipath/ipath_common.h index 048b928bb4bf..10c008f22ba6 100644 --- a/drivers/infiniband/hw/ipath/ipath_common.h +++ b/drivers/infiniband/hw/ipath/ipath_common.h | |||
@@ -352,7 +352,7 @@ struct ipath_base_info { | |||
352 | * may not be implemented; the user code must deal with this if it | 352 | * may not be implemented; the user code must deal with this if it |
353 | * cares, or it must abort after initialization reports the difference. | 353 | * cares, or it must abort after initialization reports the difference. |
354 | */ | 354 | */ |
355 | #define IPATH_USER_SWMINOR 4 | 355 | #define IPATH_USER_SWMINOR 5 |
356 | 356 | ||
357 | #define IPATH_USER_SWVERSION ((IPATH_USER_SWMAJOR<<16) | IPATH_USER_SWMINOR) | 357 | #define IPATH_USER_SWVERSION ((IPATH_USER_SWMAJOR<<16) | IPATH_USER_SWMINOR) |
358 | 358 | ||
@@ -429,8 +429,11 @@ struct ipath_user_info { | |||
429 | #define __IPATH_CMD_SLAVE_INFO 22 /* return info on slave processes (for old user code) */ | 429 | #define __IPATH_CMD_SLAVE_INFO 22 /* return info on slave processes (for old user code) */ |
430 | #define IPATH_CMD_ASSIGN_PORT 23 /* allocate HCA and port */ | 430 | #define IPATH_CMD_ASSIGN_PORT 23 /* allocate HCA and port */ |
431 | #define IPATH_CMD_USER_INIT 24 /* set up userspace */ | 431 | #define IPATH_CMD_USER_INIT 24 /* set up userspace */ |
432 | #define IPATH_CMD_UNUSED_1 25 | ||
433 | #define IPATH_CMD_UNUSED_2 26 | ||
434 | #define IPATH_CMD_PIOAVAILUPD 27 /* force an update of PIOAvail reg */ | ||
432 | 435 | ||
433 | #define IPATH_CMD_MAX 24 | 436 | #define IPATH_CMD_MAX 27 |
434 | 437 | ||
435 | struct ipath_port_info { | 438 | struct ipath_port_info { |
436 | __u32 num_active; /* number of active units */ | 439 | __u32 num_active; /* number of active units */ |
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c index bb53bde80ee8..9ca582b65fe9 100644 --- a/drivers/infiniband/hw/ipath/ipath_file_ops.c +++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c | |||
@@ -2047,6 +2047,17 @@ static int ipath_get_slave_info(struct ipath_portdata *pd, | |||
2047 | return ret; | 2047 | return ret; |
2048 | } | 2048 | } |
2049 | 2049 | ||
2050 | static int ipath_force_pio_avail_update(struct ipath_devdata *dd) | ||
2051 | { | ||
2052 | u64 reg = dd->ipath_sendctrl; | ||
2053 | |||
2054 | clear_bit(IPATH_S_PIOBUFAVAILUPD, ®); | ||
2055 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, reg); | ||
2056 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, dd->ipath_sendctrl); | ||
2057 | |||
2058 | return 0; | ||
2059 | } | ||
2060 | |||
2050 | static ssize_t ipath_write(struct file *fp, const char __user *data, | 2061 | static ssize_t ipath_write(struct file *fp, const char __user *data, |
2051 | size_t count, loff_t *off) | 2062 | size_t count, loff_t *off) |
2052 | { | 2063 | { |
@@ -2106,22 +2117,30 @@ static ssize_t ipath_write(struct file *fp, const char __user *data, | |||
2106 | dest = &cmd.cmd.slave_mask_addr; | 2117 | dest = &cmd.cmd.slave_mask_addr; |
2107 | src = &ucmd->cmd.slave_mask_addr; | 2118 | src = &ucmd->cmd.slave_mask_addr; |
2108 | break; | 2119 | break; |
2120 | case IPATH_CMD_PIOAVAILUPD: // force an update of PIOAvail reg | ||
2121 | copy = 0; | ||
2122 | src = NULL; | ||
2123 | dest = NULL; | ||
2124 | break; | ||
2109 | default: | 2125 | default: |
2110 | ret = -EINVAL; | 2126 | ret = -EINVAL; |
2111 | goto bail; | 2127 | goto bail; |
2112 | } | 2128 | } |
2113 | 2129 | ||
2114 | if ((count - consumed) < copy) { | 2130 | if (copy) { |
2115 | ret = -EINVAL; | 2131 | if ((count - consumed) < copy) { |
2116 | goto bail; | 2132 | ret = -EINVAL; |
2117 | } | 2133 | goto bail; |
2134 | } | ||
2118 | 2135 | ||
2119 | if (copy_from_user(dest, src, copy)) { | 2136 | if (copy_from_user(dest, src, copy)) { |
2120 | ret = -EFAULT; | 2137 | ret = -EFAULT; |
2121 | goto bail; | 2138 | goto bail; |
2139 | } | ||
2140 | |||
2141 | consumed += copy; | ||
2122 | } | 2142 | } |
2123 | 2143 | ||
2124 | consumed += copy; | ||
2125 | pd = port_fp(fp); | 2144 | pd = port_fp(fp); |
2126 | if (!pd && cmd.type != __IPATH_CMD_USER_INIT && | 2145 | if (!pd && cmd.type != __IPATH_CMD_USER_INIT && |
2127 | cmd.type != IPATH_CMD_ASSIGN_PORT) { | 2146 | cmd.type != IPATH_CMD_ASSIGN_PORT) { |
@@ -2172,6 +2191,9 @@ static ssize_t ipath_write(struct file *fp, const char __user *data, | |||
2172 | (void __user *) (unsigned long) | 2191 | (void __user *) (unsigned long) |
2173 | cmd.cmd.slave_mask_addr); | 2192 | cmd.cmd.slave_mask_addr); |
2174 | break; | 2193 | break; |
2194 | case IPATH_CMD_PIOAVAILUPD: | ||
2195 | ret = ipath_force_pio_avail_update(pd->port_dd); | ||
2196 | break; | ||
2175 | } | 2197 | } |
2176 | 2198 | ||
2177 | if (ret >= 0) | 2199 | if (ret >= 0) |