aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_main.c68
-rw-r--r--include/linux/qed/qed_if.h1
2 files changed, 69 insertions, 0 deletions
diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c
index e5ac8bd4fd14..0a7645937412 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_main.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_main.c
@@ -67,6 +67,8 @@
67#define QED_ROCE_QPS (8192) 67#define QED_ROCE_QPS (8192)
68#define QED_ROCE_DPIS (8) 68#define QED_ROCE_DPIS (8)
69#define QED_RDMA_SRQS QED_ROCE_QPS 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
71static char version[] = 73static char version[] =
72 "QLogic FastLinQ 4xxxx Core Module qed " DRV_MODULE_VERSION "\n"; 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 return 0; 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 */
2249static 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
2234static int qed_nvm_flash(struct qed_dev *cdev, const char *name) 2299static int qed_nvm_flash(struct qed_dev *cdev, const char *name)
2235{ 2300{
2236 const struct firmware *image; 2301 const struct firmware *image;
@@ -2272,6 +2337,9 @@ static int qed_nvm_flash(struct qed_dev *cdev, const char *name)
2272 rc = qed_nvm_flash_image_access(cdev, &data, 2337 rc = qed_nvm_flash_image_access(cdev, &data,
2273 &check_resp); 2338 &check_resp);
2274 break; 2339 break;
2340 case QED_NVM_FLASH_CMD_NVM_CFG_ID:
2341 rc = qed_nvm_flash_cfg_write(cdev, &data);
2342 break;
2275 default: 2343 default:
2276 DP_ERR(cdev, "Unknown command %08x\n", cmd_type); 2344 DP_ERR(cdev, "Unknown command %08x\n", cmd_type);
2277 rc = -EINVAL; 2345 rc = -EINVAL;
diff --git a/include/linux/qed/qed_if.h b/include/linux/qed/qed_if.h
index 23021366a4e5..e366399874f3 100644
--- a/include/linux/qed/qed_if.h
+++ b/include/linux/qed/qed_if.h
@@ -804,6 +804,7 @@ enum qed_nvm_flash_cmd {
804 QED_NVM_FLASH_CMD_FILE_DATA = 0x2, 804 QED_NVM_FLASH_CMD_FILE_DATA = 0x2,
805 QED_NVM_FLASH_CMD_FILE_START = 0x3, 805 QED_NVM_FLASH_CMD_FILE_START = 0x3,
806 QED_NVM_FLASH_CMD_NVM_CHANGE = 0x4, 806 QED_NVM_FLASH_CMD_NVM_CHANGE = 0x4,
807 QED_NVM_FLASH_CMD_NVM_CFG_ID = 0x5,
807 QED_NVM_FLASH_CMD_NVM_MAX, 808 QED_NVM_FLASH_CMD_NVM_MAX,
808}; 809};
809 810