|
67 | 67 | #define QED_ROCE_QPS (8192)
|
68 | 68 | #define QED_ROCE_DPIS (8)
|
69 | 69 | #define QED_RDMA_SRQS QED_ROCE_QPS
|
| 70 | +#define QED_NVM_CFG_SET_FLAGS 0xE |
| 71 | +#define QED_NVM_CFG_SET_PF_FLAGS 0x1E |
70 | 72 |
|
71 | 73 | static char version[] =
|
72 | 74 | "QLogic FastLinQ 4xxxx Core Module qed " DRV_MODULE_VERSION "\n";
|
@@ -2231,6 +2233,69 @@ static int qed_nvm_flash_image_validate(struct qed_dev *cdev,
|
2231 | 2233 | return 0;
|
2232 | 2234 | }
|
2233 | 2235 |
|
| 2236 | +/* Binary file format - |
| 2237 | + * /----------------------------------------------------------------------\ |
| 2238 | + * 0B | 0x5 [command index] | |
| 2239 | + * 4B | Entity ID | Reserved | Number of config attributes | |
| 2240 | + * 8B | Config ID | Length | Value | |
| 2241 | + * | | |
| 2242 | + * \----------------------------------------------------------------------/ |
| 2243 | + * There can be several cfg_id-Length-Value sets as specified by 'Number of...'. |
| 2244 | + * Entity ID - A non zero entity value for which the config need to be updated. |
| 2245 | + * |
| 2246 | + * The API parses config attributes from the user provided buffer and flashes |
| 2247 | + * them to the respective NVM path using Management FW inerface. |
| 2248 | + */ |
| 2249 | +static int qed_nvm_flash_cfg_write(struct qed_dev *cdev, const u8 **data) |
| 2250 | +{ |
| 2251 | + struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev); |
| 2252 | + u8 entity_id, len, buf[32]; |
| 2253 | + struct qed_ptt *ptt; |
| 2254 | + u16 cfg_id, count; |
| 2255 | + int rc = 0, i; |
| 2256 | + u32 flags; |
| 2257 | + |
| 2258 | + ptt = qed_ptt_acquire(hwfn); |
| 2259 | + if (!ptt) |
| 2260 | + return -EAGAIN; |
| 2261 | + |
| 2262 | + /* NVM CFG ID attribute header */ |
| 2263 | + *data += 4; |
| 2264 | + entity_id = **data; |
| 2265 | + *data += 2; |
| 2266 | + count = *((u16 *)*data); |
| 2267 | + *data += 2; |
| 2268 | + |
| 2269 | + DP_VERBOSE(cdev, NETIF_MSG_DRV, |
| 2270 | + "Read config ids: entity id %02x num _attrs = %0d\n", |
| 2271 | + entity_id, count); |
| 2272 | + /* NVM CFG ID attributes */ |
| 2273 | + for (i = 0; i < count; i++) { |
| 2274 | + cfg_id = *((u16 *)*data); |
| 2275 | + *data += 2; |
| 2276 | + len = **data; |
| 2277 | + (*data)++; |
| 2278 | + memcpy(buf, *data, len); |
| 2279 | + *data += len; |
| 2280 | + |
| 2281 | + flags = entity_id ? QED_NVM_CFG_SET_PF_FLAGS : |
| 2282 | + QED_NVM_CFG_SET_FLAGS; |
| 2283 | + |
| 2284 | + DP_VERBOSE(cdev, NETIF_MSG_DRV, |
| 2285 | + "cfg_id = %d len = %d\n", cfg_id, len); |
| 2286 | + rc = qed_mcp_nvm_set_cfg(hwfn, ptt, cfg_id, entity_id, flags, |
| 2287 | + buf, len); |
| 2288 | + if (rc) { |
| 2289 | + DP_ERR(cdev, "Error %d configuring %d\n", rc, cfg_id); |
| 2290 | + break; |
| 2291 | + } |
| 2292 | + } |
| 2293 | + |
| 2294 | + qed_ptt_release(hwfn, ptt); |
| 2295 | + |
| 2296 | + return rc; |
| 2297 | +} |
| 2298 | + |
2234 | 2299 | static int qed_nvm_flash(struct qed_dev *cdev, const char *name)
|
2235 | 2300 | {
|
2236 | 2301 | const struct firmware *image;
|
@@ -2272,6 +2337,9 @@ static int qed_nvm_flash(struct qed_dev *cdev, const char *name)
|
2272 | 2337 | rc = qed_nvm_flash_image_access(cdev, &data,
|
2273 | 2338 | &check_resp);
|
2274 | 2339 | break;
|
| 2340 | + case QED_NVM_FLASH_CMD_NVM_CFG_ID: |
| 2341 | + rc = qed_nvm_flash_cfg_write(cdev, &data); |
| 2342 | + break; |
2275 | 2343 | default:
|
2276 | 2344 | DP_ERR(cdev, "Unknown command %08x\n", cmd_type);
|
2277 | 2345 | rc = -EINVAL;
|
|
0 commit comments