Lines Matching +full:hsi +full:- +full:mac
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
3 * Copyright (c) 2015-2017 QLogic Corporation
4 * Copyright (c) 2019-2020 Marvell International Ltd.
34 qed_wr(_p_hwfn, _p_ptt, (_p_hwfn->mcp_info->_ptr + (_offset)), \
38 qed_rd(_p_hwfn, _p_ptt, (_p_hwfn->mcp_info->_ptr + (_offset)))
55 if (!p_hwfn->mcp_info || !p_hwfn->mcp_info->public_base) in qed_mcp_is_init()
62 u32 addr = SECTION_OFFSIZE_ADDR(p_hwfn->mcp_info->public_base, in qed_mcp_cmd_port_init()
66 p_hwfn->mcp_info->port_addr = SECTION_ADDR(mfw_mb_offsize, in qed_mcp_cmd_port_init()
70 p_hwfn->mcp_info->port_addr, MFW_PORT(p_hwfn)); in qed_mcp_cmd_port_init()
75 u32 length = MFW_DRV_MSG_MAX_DWORDS(p_hwfn->mcp_info->mfw_mb_length); in qed_mcp_read_mb()
78 if (!p_hwfn->mcp_info->public_base) in qed_mcp_read_mb()
83 p_hwfn->mcp_info->mfw_mb_addr + in qed_mcp_read_mb()
87 ((u32 *)p_hwfn->mcp_info->mfw_mb_cur)[i] = in qed_mcp_read_mb()
111 p_cmd_elem->p_mb_params = p_mb_params; in qed_mcp_cmd_add_elem()
112 p_cmd_elem->expected_seq_num = expected_seq_num; in qed_mcp_cmd_add_elem()
113 list_add(&p_cmd_elem->list, &p_hwfn->mcp_info->cmd_list); in qed_mcp_cmd_add_elem()
122 list_del(&p_cmd_elem->list); in qed_mcp_cmd_del_elem()
132 list_for_each_entry(p_cmd_elem, &p_hwfn->mcp_info->cmd_list, list) { in qed_mcp_cmd_get_elem()
133 if (p_cmd_elem->expected_seq_num == seq_num) in qed_mcp_cmd_get_elem()
142 if (p_hwfn->mcp_info) { in qed_mcp_free()
145 kfree(p_hwfn->mcp_info->mfw_mb_cur); in qed_mcp_free()
146 kfree(p_hwfn->mcp_info->mfw_mb_shadow); in qed_mcp_free()
148 spin_lock_bh(&p_hwfn->mcp_info->cmd_lock); in qed_mcp_free()
151 &p_hwfn->mcp_info->cmd_list, list) { in qed_mcp_free()
154 spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); in qed_mcp_free()
157 kfree(p_hwfn->mcp_info); in qed_mcp_free()
158 p_hwfn->mcp_info = NULL; in qed_mcp_free()
169 struct qed_mcp_info *p_info = p_hwfn->mcp_info; in qed_load_mcp_offsets()
175 p_info->public_base = qed_rd(p_hwfn, p_ptt, MISC_REG_SHARED_MEM_ADDR); in qed_load_mcp_offsets()
176 if (!p_info->public_base) { in qed_load_mcp_offsets()
178 "The address of the MCP scratch-pad is not configured\n"); in qed_load_mcp_offsets()
179 return -EINVAL; in qed_load_mcp_offsets()
182 p_info->public_base |= GRCBASE_MCP; in qed_load_mcp_offsets()
186 SECTION_OFFSIZE_ADDR(p_info->public_base, in qed_load_mcp_offsets()
188 p_info->mfw_mb_addr = SECTION_ADDR(mfw_mb_offsize, mcp_pf_id); in qed_load_mcp_offsets()
189 p_info->mfw_mb_length = (u16)qed_rd(p_hwfn, p_ptt, in qed_load_mcp_offsets()
190 p_info->mfw_mb_addr + in qed_load_mcp_offsets()
199 while (!p_info->mfw_mb_length && --cnt) { in qed_load_mcp_offsets()
201 p_info->mfw_mb_length = in qed_load_mcp_offsets()
203 p_info->mfw_mb_addr + in qed_load_mcp_offsets()
211 return -EBUSY; in qed_load_mcp_offsets()
216 SECTION_OFFSIZE_ADDR(p_info->public_base, in qed_load_mcp_offsets()
218 p_info->drv_mb_addr = SECTION_ADDR(drv_mb_offsize, mcp_pf_id); in qed_load_mcp_offsets()
221 drv_mb_offsize, p_info->drv_mb_addr, mcp_pf_id); in qed_load_mcp_offsets()
226 p_info->drv_mb_seq = DRV_MB_RD(p_hwfn, p_ptt, drv_mb_header) & in qed_load_mcp_offsets()
230 p_info->drv_pulse_seq = DRV_MB_RD(p_hwfn, p_ptt, drv_pulse_mb) & in qed_load_mcp_offsets()
233 p_info->mcp_hist = qed_rd(p_hwfn, p_ptt, MISCS_REG_GENERIC_POR_0); in qed_load_mcp_offsets()
244 p_hwfn->mcp_info = kzalloc(sizeof(*p_hwfn->mcp_info), GFP_KERNEL); in qed_mcp_cmd_init()
245 if (!p_hwfn->mcp_info) in qed_mcp_cmd_init()
247 p_info = p_hwfn->mcp_info; in qed_mcp_cmd_init()
250 spin_lock_init(&p_info->cmd_lock); in qed_mcp_cmd_init()
251 spin_lock_init(&p_info->link_lock); in qed_mcp_cmd_init()
252 spin_lock_init(&p_info->unload_lock); in qed_mcp_cmd_init()
254 INIT_LIST_HEAD(&p_info->cmd_list); in qed_mcp_cmd_init()
264 size = MFW_DRV_MSG_MAX_DWORDS(p_info->mfw_mb_length) * sizeof(u32); in qed_mcp_cmd_init()
265 p_info->mfw_mb_cur = kzalloc(size, GFP_KERNEL); in qed_mcp_cmd_init()
266 p_info->mfw_mb_shadow = kzalloc(size, GFP_KERNEL); in qed_mcp_cmd_init()
267 if (!p_info->mfw_mb_cur || !p_info->mfw_mb_shadow) in qed_mcp_cmd_init()
274 return -ENOMEM; in qed_mcp_cmd_init()
285 if (p_hwfn->mcp_info->mcp_hist != generic_por_0) { in qed_mcp_reread_offsets()
289 p_hwfn->mcp_info->mcp_hist, generic_por_0); in qed_mcp_reread_offsets()
301 if (p_hwfn->mcp_info->b_block_cmd) { in qed_mcp_reset()
304 return -EBUSY; in qed_mcp_reset()
308 spin_lock_bh(&p_hwfn->mcp_info->cmd_lock); in qed_mcp_reset()
314 seq = ++p_hwfn->mcp_info->drv_mb_seq; in qed_mcp_reset()
331 rc = -EAGAIN; in qed_mcp_reset()
334 spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); in qed_mcp_reset()
345 * exists - it is placed at the HEAD of the list. in qed_mcp_has_pending_cmd()
347 if (!list_empty(&p_hwfn->mcp_info->cmd_list)) { in qed_mcp_has_pending_cmd()
348 p_cmd_elem = list_first_entry(&p_hwfn->mcp_info->cmd_list, in qed_mcp_has_pending_cmd()
350 return !p_cmd_elem->b_is_completed; in qed_mcp_has_pending_cmd()
368 /* Return if no new non-handled response has been received */ in qed_mcp_update_pending_cmd()
369 if (seq_num != p_hwfn->mcp_info->drv_mb_seq) in qed_mcp_update_pending_cmd()
370 return -EAGAIN; in qed_mcp_update_pending_cmd()
377 return -EINVAL; in qed_mcp_update_pending_cmd()
380 p_mb_params = p_cmd_elem->p_mb_params; in qed_mcp_update_pending_cmd()
383 p_mb_params->mcp_resp = mcp_resp; in qed_mcp_update_pending_cmd()
386 p_mb_params->mcp_param = DRV_MB_RD(p_hwfn, p_ptt, fw_mb_param); in qed_mcp_update_pending_cmd()
389 if (p_mb_params->p_data_dst && p_mb_params->data_dst_size) { in qed_mcp_update_pending_cmd()
390 u32 union_data_addr = p_hwfn->mcp_info->drv_mb_addr + in qed_mcp_update_pending_cmd()
393 qed_memcpy_from(p_hwfn, p_ptt, p_mb_params->p_data_dst, in qed_mcp_update_pending_cmd()
394 union_data_addr, p_mb_params->data_dst_size); in qed_mcp_update_pending_cmd()
397 p_cmd_elem->b_is_completed = true; in qed_mcp_update_pending_cmd()
412 union_data_addr = p_hwfn->mcp_info->drv_mb_addr + in __qed_mcp_cmd_and_union()
415 if (p_mb_params->p_data_src && p_mb_params->data_src_size) in __qed_mcp_cmd_and_union()
416 memcpy(&union_data, p_mb_params->p_data_src, in __qed_mcp_cmd_and_union()
417 p_mb_params->data_src_size); in __qed_mcp_cmd_and_union()
422 DRV_MB_WR(p_hwfn, p_ptt, drv_mb_param, p_mb_params->param); in __qed_mcp_cmd_and_union()
425 DRV_MB_WR(p_hwfn, p_ptt, drv_mb_header, (p_mb_params->cmd | seq_num)); in __qed_mcp_cmd_and_union()
429 (p_mb_params->cmd | seq_num), p_mb_params->param); in __qed_mcp_cmd_and_union()
434 p_hwfn->mcp_info->b_block_cmd = block_cmd; in qed_mcp_cmd_set_blocking()
469 /* Wait until the mailbox is non-occupied */ in _qed_mcp_cmd_and_union()
476 spin_lock_bh(&p_hwfn->mcp_info->cmd_lock); in _qed_mcp_cmd_and_union()
484 else if (rc != -EAGAIN) in _qed_mcp_cmd_and_union()
487 spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); in _qed_mcp_cmd_and_union()
499 p_mb_params->cmd, p_mb_params->param); in _qed_mcp_cmd_and_union()
500 return -EAGAIN; in _qed_mcp_cmd_and_union()
505 seq_num = ++p_hwfn->mcp_info->drv_mb_seq; in _qed_mcp_cmd_and_union()
508 rc = -ENOMEM; in _qed_mcp_cmd_and_union()
513 spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); in _qed_mcp_cmd_and_union()
528 spin_lock_bh(&p_hwfn->mcp_info->cmd_lock); in _qed_mcp_cmd_and_union()
530 if (p_cmd_elem->b_is_completed) in _qed_mcp_cmd_and_union()
536 else if (rc != -EAGAIN) in _qed_mcp_cmd_and_union()
539 spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); in _qed_mcp_cmd_and_union()
545 p_mb_params->cmd, p_mb_params->param); in _qed_mcp_cmd_and_union()
548 spin_lock_bh(&p_hwfn->mcp_info->cmd_lock); in _qed_mcp_cmd_and_union()
550 spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); in _qed_mcp_cmd_and_union()
557 return -EAGAIN; in _qed_mcp_cmd_and_union()
561 spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); in _qed_mcp_cmd_and_union()
566 p_mb_params->mcp_resp, in _qed_mcp_cmd_and_union()
567 p_mb_params->mcp_param, in _qed_mcp_cmd_and_union()
572 p_mb_params->mcp_resp &= FW_MSG_CODE_MASK; in _qed_mcp_cmd_and_union()
577 spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); in _qed_mcp_cmd_and_union()
590 return -EBUSY; in qed_mcp_cmd_and_union()
593 if (p_hwfn->mcp_info->b_block_cmd) { in qed_mcp_cmd_and_union()
596 p_mb_params->cmd, p_mb_params->param); in qed_mcp_cmd_and_union()
597 return -EBUSY; in qed_mcp_cmd_and_union()
600 if (p_mb_params->data_src_size > union_data_size || in qed_mcp_cmd_and_union()
601 p_mb_params->data_dst_size > union_data_size) { in qed_mcp_cmd_and_union()
604 p_mb_params->data_src_size, in qed_mcp_cmd_and_union()
605 p_mb_params->data_dst_size, union_data_size); in qed_mcp_cmd_and_union()
606 return -EINVAL; in qed_mcp_cmd_and_union()
684 p_hwfn->nvm_info.valid = false; in qed_mcp_nvm_wr_cmd()
832 load_req.drv_ver_0 = p_in_params->drv_ver_0; in __qed_mcp_load_req()
833 load_req.drv_ver_1 = p_in_params->drv_ver_1; in __qed_mcp_load_req()
834 load_req.fw_ver = p_in_params->fw_ver; in __qed_mcp_load_req()
835 QED_MFW_SET_FIELD(load_req.misc0, LOAD_REQ_ROLE, p_in_params->drv_role); in __qed_mcp_load_req()
837 p_in_params->timeout_val); in __qed_mcp_load_req()
839 p_in_params->force_cmd); in __qed_mcp_load_req()
841 p_in_params->avoid_eng_reset); in __qed_mcp_load_req()
843 hsi_ver = (p_in_params->hsi_ver == QED_LOAD_REQ_HSI_VER_DEFAULT) ? in __qed_mcp_load_req()
845 (p_in_params->hsi_ver << DRV_ID_MCP_HSI_VER_SHIFT); in __qed_mcp_load_req()
849 mb_params.param = PDA_COMP | hsi_ver | p_hwfn->cdev->drv_type; in __qed_mcp_load_req()
864 if (p_in_params->hsi_ver != QED_LOAD_REQ_HSI_VER_1) { in __qed_mcp_load_req()
886 p_out_params->load_code = mb_params.mcp_resp; in __qed_mcp_load_req()
888 if (p_in_params->hsi_ver != QED_LOAD_REQ_HSI_VER_1 && in __qed_mcp_load_req()
889 p_out_params->load_code != FW_MSG_CODE_DRV_LOAD_REFUSED_HSI_1) { in __qed_mcp_load_req()
901 p_out_params->exist_drv_ver_0 = load_rsp.drv_ver_0; in __qed_mcp_load_req()
902 p_out_params->exist_drv_ver_1 = load_rsp.drv_ver_1; in __qed_mcp_load_req()
903 p_out_params->exist_fw_ver = load_rsp.fw_ver; in __qed_mcp_load_req()
904 p_out_params->exist_drv_role = in __qed_mcp_load_req()
906 p_out_params->mfw_hsi_ver = in __qed_mcp_load_req()
908 p_out_params->drv_exists = in __qed_mcp_load_req()
929 return -EINVAL; in eocre_get_mfw_drv_role()
971 rc = eocre_get_mfw_drv_role(p_hwfn, p_params->drv_role, &mfw_drv_role); in qed_mcp_load_req()
976 in_params.timeout_val = p_params->timeout_val; in qed_mcp_load_req()
981 in_params.avoid_eng_reset = p_params->avoid_eng_reset; in qed_mcp_load_req()
989 * - MFW expects the old interface [HSI version = 1] in qed_mcp_load_req()
990 * - MFW responds that a force load request is required in qed_mcp_load_req()
994 "MFW refused a load request due to HSI > 1. Resending with HSI = 1\n"); in qed_mcp_load_req()
1005 p_params->override_force_load)) { in qed_mcp_load_req()
1027 …er, drv_ver}: loading={%d, 0x%08x, x%08x_0x%08x}, existing={%d, 0x%08x, 0x%08x_0x%08x}] - Avoid\n", in qed_mcp_load_req()
1038 return -EBUSY; in qed_mcp_load_req()
1057 return -EINVAL; in qed_mcp_load_req()
1064 return -EBUSY; in qed_mcp_load_req()
1067 p_params->load_code = out_params.load_code; in qed_mcp_load_req()
1085 /* Check if there is a DID mismatch between nvm-cfg/efuse */ in qed_mcp_load_done()
1103 switch (p_hwfn->cdev->wol_config) { in qed_mcp_unload_req()
1113 p_hwfn->cdev->wol_config); in qed_mcp_unload_req()
1124 spin_lock_bh(&p_hwfn->mcp_info->unload_lock); in qed_mcp_unload_req()
1126 &p_hwfn->mcp_info->mcp_handling_status); in qed_mcp_unload_req()
1127 spin_unlock_bh(&p_hwfn->mcp_info->unload_lock); in qed_mcp_unload_req()
1132 &p_hwfn->mcp_info->mcp_handling_status) && --cnt) in qed_mcp_unload_req()
1151 /* Set the primary MAC if WoL is enabled */ in qed_mcp_unload_done()
1152 if (p_hwfn->cdev->wol_config == QED_OV_WOL_ENABLED) { in qed_mcp_unload_done()
1153 u8 *p_mac = p_hwfn->cdev->wol_mac; in qed_mcp_unload_done()
1162 "Setting WoL MAC: %pM --> [%08x,%08x]\n", in qed_mcp_unload_done()
1175 u32 addr = SECTION_OFFSIZE_ADDR(p_hwfn->mcp_info->public_base, in qed_mcp_handle_vf_flr()
1195 "FLR-ed VFs [%08x,...,%08x] - %08x\n", in qed_mcp_handle_vf_flr()
1196 i * 32, (i + 1) * 32 - 1, disabled_vfs[i]); in qed_mcp_handle_vf_flr()
1206 u32 addr = SECTION_OFFSIZE_ADDR(p_hwfn->mcp_info->public_base, in qed_mcp_ack_vf_flr()
1217 "Acking VFs [%08x,...,%08x] - %08x\n", in qed_mcp_ack_vf_flr()
1218 i * 32, (i + 1) * 32 - 1, vfs_to_ack[i]); in qed_mcp_ack_vf_flr()
1227 return -EBUSY; in qed_mcp_ack_vf_flr()
1246 p_hwfn->mcp_info->port_addr + in qed_mcp_handle_transceiver_change()
1254 (u32)(p_hwfn->mcp_info->port_addr + in qed_mcp_handle_transceiver_change()
1272 p_link->eee_adv_caps = 0; in qed_mcp_read_eee_config()
1273 p_link->eee_lp_adv_caps = 0; in qed_mcp_read_eee_config()
1276 p_hwfn->mcp_info->port_addr + in qed_mcp_read_eee_config()
1278 p_link->eee_active = !!(eee_status & EEE_ACTIVE_BIT); in qed_mcp_read_eee_config()
1281 p_link->eee_adv_caps |= QED_EEE_1G_ADV; in qed_mcp_read_eee_config()
1283 p_link->eee_adv_caps |= QED_EEE_10G_ADV; in qed_mcp_read_eee_config()
1286 p_link->eee_lp_adv_caps |= QED_EEE_1G_ADV; in qed_mcp_read_eee_config()
1288 p_link->eee_lp_adv_caps |= QED_EEE_10G_ADV; in qed_mcp_read_eee_config()
1295 u32 addr = SECTION_OFFSIZE_ADDR(p_hwfn->mcp_info->public_base, in qed_mcp_get_shmem_func()
1316 p_info = &p_hwfn->mcp_info->func_info; in qed_read_pf_bandwidth()
1318 p_info->bandwidth_min = QED_MFW_GET_FIELD(p_shmem_info->config, in qed_read_pf_bandwidth()
1320 if (p_info->bandwidth_min < 1 || p_info->bandwidth_min > 100) { in qed_read_pf_bandwidth()
1323 p_info->bandwidth_min); in qed_read_pf_bandwidth()
1324 p_info->bandwidth_min = 1; in qed_read_pf_bandwidth()
1327 p_info->bandwidth_max = QED_MFW_GET_FIELD(p_shmem_info->config, in qed_read_pf_bandwidth()
1329 if (p_info->bandwidth_max < 1 || p_info->bandwidth_max > 100) { in qed_read_pf_bandwidth()
1332 p_info->bandwidth_max); in qed_read_pf_bandwidth()
1333 p_info->bandwidth_max = 100; in qed_read_pf_bandwidth()
1345 spin_lock_bh(&p_hwfn->mcp_info->link_lock); in qed_mcp_handle_link_change()
1347 p_link = &p_hwfn->mcp_info->link_output; in qed_mcp_handle_link_change()
1351 p_hwfn->mcp_info->port_addr + in qed_mcp_handle_link_change()
1356 (u32)(p_hwfn->mcp_info->port_addr + in qed_mcp_handle_link_change()
1364 if (p_hwfn->b_drv_link_init) { in qed_mcp_handle_link_change()
1365 /* Link indication with modern MFW arrives as per-PF in qed_mcp_handle_link_change()
1368 if (p_hwfn->mcp_info->capabilities & in qed_mcp_handle_link_change()
1374 p_link->link_up = !!(shmem_info.status & in qed_mcp_handle_link_change()
1378 "Virtual link_up = %d\n", p_link->link_up); in qed_mcp_handle_link_change()
1380 p_link->link_up = !!(status & LINK_STATUS_LINK_UP); in qed_mcp_handle_link_change()
1382 "Physical link_up = %d\n", p_link->link_up); in qed_mcp_handle_link_change()
1385 p_link->link_up = false; in qed_mcp_handle_link_change()
1388 p_link->full_duplex = true; in qed_mcp_handle_link_change()
1391 p_link->speed = 100000; in qed_mcp_handle_link_change()
1394 p_link->speed = 50000; in qed_mcp_handle_link_change()
1397 p_link->speed = 40000; in qed_mcp_handle_link_change()
1400 p_link->speed = 25000; in qed_mcp_handle_link_change()
1403 p_link->speed = 20000; in qed_mcp_handle_link_change()
1406 p_link->speed = 10000; in qed_mcp_handle_link_change()
1409 p_link->full_duplex = false; in qed_mcp_handle_link_change()
1412 p_link->speed = 1000; in qed_mcp_handle_link_change()
1415 p_link->speed = 0; in qed_mcp_handle_link_change()
1416 p_link->link_up = 0; in qed_mcp_handle_link_change()
1419 if (p_link->link_up && p_link->speed) in qed_mcp_handle_link_change()
1420 p_link->line_speed = p_link->speed; in qed_mcp_handle_link_change()
1422 p_link->line_speed = 0; in qed_mcp_handle_link_change()
1424 max_bw = p_hwfn->mcp_info->func_info.bandwidth_max; in qed_mcp_handle_link_change()
1425 min_bw = p_hwfn->mcp_info->func_info.bandwidth_min; in qed_mcp_handle_link_change()
1432 qed_configure_vp_wfq_on_link_change(p_hwfn->cdev, p_ptt, in qed_mcp_handle_link_change()
1433 p_link->min_pf_rate); in qed_mcp_handle_link_change()
1435 p_link->an = !!(status & LINK_STATUS_AUTO_NEGOTIATE_ENABLED); in qed_mcp_handle_link_change()
1436 p_link->an_complete = !!(status & in qed_mcp_handle_link_change()
1438 p_link->parallel_detection = !!(status & in qed_mcp_handle_link_change()
1440 p_link->pfc_enabled = !!(status & LINK_STATUS_PFC_ENABLED); in qed_mcp_handle_link_change()
1442 p_link->partner_adv_speed |= in qed_mcp_handle_link_change()
1445 p_link->partner_adv_speed |= in qed_mcp_handle_link_change()
1448 p_link->partner_adv_speed |= in qed_mcp_handle_link_change()
1451 p_link->partner_adv_speed |= in qed_mcp_handle_link_change()
1454 p_link->partner_adv_speed |= in qed_mcp_handle_link_change()
1457 p_link->partner_adv_speed |= in qed_mcp_handle_link_change()
1460 p_link->partner_adv_speed |= in qed_mcp_handle_link_change()
1463 p_link->partner_adv_speed |= in qed_mcp_handle_link_change()
1467 p_link->partner_tx_flow_ctrl_en = in qed_mcp_handle_link_change()
1469 p_link->partner_rx_flow_ctrl_en = in qed_mcp_handle_link_change()
1474 p_link->partner_adv_pause = QED_LINK_PARTNER_SYMMETRIC_PAUSE; in qed_mcp_handle_link_change()
1477 p_link->partner_adv_pause = QED_LINK_PARTNER_ASYMMETRIC_PAUSE; in qed_mcp_handle_link_change()
1480 p_link->partner_adv_pause = QED_LINK_PARTNER_BOTH_PAUSE; in qed_mcp_handle_link_change()
1483 p_link->partner_adv_pause = 0; in qed_mcp_handle_link_change()
1486 p_link->sfp_tx_fault = !!(status & LINK_STATUS_SFP_TX_FAULT); in qed_mcp_handle_link_change()
1488 if (p_hwfn->mcp_info->capabilities & FW_MB_PARAM_FEATURE_SUPPORT_EEE) in qed_mcp_handle_link_change()
1491 if (p_hwfn->mcp_info->capabilities & in qed_mcp_handle_link_change()
1495 p_link->fec_active = QED_FEC_MODE_NONE; in qed_mcp_handle_link_change()
1498 p_link->fec_active = QED_FEC_MODE_FIRECODE; in qed_mcp_handle_link_change()
1501 p_link->fec_active = QED_FEC_MODE_RS; in qed_mcp_handle_link_change()
1504 p_link->fec_active = QED_FEC_MODE_AUTO; in qed_mcp_handle_link_change()
1507 p_link->fec_active = QED_FEC_MODE_UNSUPPORTED; in qed_mcp_handle_link_change()
1512 spin_unlock_bh(&p_hwfn->mcp_info->link_lock); in qed_mcp_handle_link_change()
1517 struct qed_mcp_link_params *params = &p_hwfn->mcp_info->link_input; in qed_mcp_set_link()
1527 if (!params->speed.autoneg) in qed_mcp_set_link()
1528 phy_cfg.speed = params->speed.forced_speed; in qed_mcp_set_link()
1529 phy_cfg.pause |= (params->pause.autoneg) ? ETH_PAUSE_AUTONEG : 0; in qed_mcp_set_link()
1530 phy_cfg.pause |= (params->pause.forced_rx) ? ETH_PAUSE_RX : 0; in qed_mcp_set_link()
1531 phy_cfg.pause |= (params->pause.forced_tx) ? ETH_PAUSE_TX : 0; in qed_mcp_set_link()
1532 phy_cfg.adv_speed = params->speed.advertised_speeds; in qed_mcp_set_link()
1533 phy_cfg.loopback_mode = params->loopback_mode; in qed_mcp_set_link()
1540 if ((p_hwfn->mcp_info->capabilities & in qed_mcp_set_link()
1541 FW_MB_PARAM_FEATURE_SUPPORT_EEE) && params->eee.enable) { in qed_mcp_set_link()
1543 if (params->eee.tx_lpi_enable) in qed_mcp_set_link()
1545 if (params->eee.adv_caps & QED_EEE_1G_ADV) in qed_mcp_set_link()
1547 if (params->eee.adv_caps & QED_EEE_10G_ADV) in qed_mcp_set_link()
1549 phy_cfg.eee_cfg |= (params->eee.tx_lpi_timer << in qed_mcp_set_link()
1554 if (p_hwfn->mcp_info->capabilities & in qed_mcp_set_link()
1556 if (params->fec & QED_FEC_MODE_NONE) in qed_mcp_set_link()
1558 else if (params->fec & QED_FEC_MODE_FIRECODE) in qed_mcp_set_link()
1560 else if (params->fec & QED_FEC_MODE_RS) in qed_mcp_set_link()
1562 else if (params->fec & QED_FEC_MODE_AUTO) in qed_mcp_set_link()
1568 if (p_hwfn->mcp_info->capabilities & in qed_mcp_set_link()
1571 if (params->ext_speed.autoneg) in qed_mcp_set_link()
1574 val = params->ext_speed.forced_speed; in qed_mcp_set_link()
1599 val = params->ext_speed.advertised_speeds; in qed_mcp_set_link()
1622 params->ext_fec_mode); in qed_mcp_set_link()
1625 p_hwfn->b_drv_link_init = b_up; in qed_mcp_set_link()
1649 /* Mimic link-change attention, done for several reasons: in qed_mcp_set_link()
1650 * - On reset, there's no guarantee MFW would trigger in qed_mcp_set_link()
1652 * - On initialization, older MFWs might not indicate link change in qed_mcp_set_link()
1665 if (IS_VF(p_hwfn->cdev)) in qed_get_process_kill_counter()
1666 return -EINVAL; in qed_get_process_kill_counter()
1668 path_offsize_addr = SECTION_OFFSIZE_ADDR(p_hwfn->mcp_info->public_base, in qed_get_process_kill_counter()
1684 struct qed_dev *cdev = p_hwfn->cdev; in qed_mcp_handle_process_kill()
1688 * and till its load phase, during which they will be re-enabled. in qed_mcp_handle_process_kill()
1700 if (cdev->recov_in_prog) { in qed_mcp_handle_process_kill()
1706 cdev->recov_in_prog = true; in qed_mcp_handle_process_kill()
1745 qed_get_protocol_stats(p_hwfn->cdev, stats_type, &stats); in qed_mcp_send_protocol_stats()
1765 p_info = &p_hwfn->mcp_info->func_info; in qed_mcp_update_bw()
1767 qed_configure_pf_min_bandwidth(p_hwfn->cdev, p_info->bandwidth_min); in qed_mcp_update_bw()
1768 qed_configure_pf_max_bandwidth(p_hwfn->cdev, p_info->bandwidth_max); in qed_mcp_update_bw()
1782 p_hwfn->mcp_info->func_info.ovlan = (u16)shmem_info.ovlan_stag & in qed_mcp_update_stag()
1784 p_hwfn->hw_info.ovlan = p_hwfn->mcp_info->func_info.ovlan; in qed_mcp_update_stag()
1785 if (test_bit(QED_MF_OVLAN_CLSS, &p_hwfn->cdev->mf_bits)) { in qed_mcp_update_stag()
1786 if (p_hwfn->hw_info.ovlan != QED_MCP_VLAN_UNSET) { in qed_mcp_update_stag()
1788 p_hwfn->hw_info.ovlan); in qed_mcp_update_stag()
1794 p_hwfn->hw_info.ovlan); in qed_mcp_update_stag()
1806 p_hwfn->mcp_info->func_info.ovlan, p_hwfn->hw_info.hw_mode); in qed_mcp_update_stag()
1817 if (p_hwfn != QED_LEADING_HWFN(p_hwfn->cdev)) in qed_mcp_handle_fan_failure()
1843 mb_params.param = p_mdump_cmd_params->cmd; in qed_mcp_mdump_cmd()
1844 mb_params.p_data_src = p_mdump_cmd_params->p_data_src; in qed_mcp_mdump_cmd()
1845 mb_params.data_src_size = p_mdump_cmd_params->data_src_size; in qed_mcp_mdump_cmd()
1846 mb_params.p_data_dst = p_mdump_cmd_params->p_data_dst; in qed_mcp_mdump_cmd()
1847 mb_params.data_dst_size = p_mdump_cmd_params->data_dst_size; in qed_mcp_mdump_cmd()
1852 p_mdump_cmd_params->mcp_resp = mb_params.mcp_resp; in qed_mcp_mdump_cmd()
1854 if (p_mdump_cmd_params->mcp_resp == FW_MSG_CODE_MDUMP_INVALID_CMD) { in qed_mcp_mdump_cmd()
1857 p_mdump_cmd_params->cmd); in qed_mcp_mdump_cmd()
1858 rc = -EOPNOTSUPP; in qed_mcp_mdump_cmd()
1859 } else if (p_mdump_cmd_params->mcp_resp == FW_MSG_CODE_UNSUPPORTED) { in qed_mcp_mdump_cmd()
1862 rc = -EOPNOTSUPP; in qed_mcp_mdump_cmd()
1899 return -EINVAL; in qed_mcp_mdump_get_retain()
1911 /* In CMT mode - no need for more than a single acknowledgment to the in qed_mcp_handle_critical_error()
1914 if (p_hwfn != QED_LEADING_HWFN(p_hwfn->cdev)) in qed_mcp_handle_critical_error()
1939 if (!test_bit(QED_MF_UFP_SPECIFIC, &p_hwfn->cdev->mf_bits)) in qed_mcp_read_ufp_config()
1942 memset(&p_hwfn->ufp_info, 0, sizeof(p_hwfn->ufp_info)); in qed_mcp_read_ufp_config()
1943 port_cfg = qed_rd(p_hwfn, p_ptt, p_hwfn->mcp_info->port_addr + in qed_mcp_read_ufp_config()
1954 p_hwfn->ufp_info.mode = QED_UFP_MODE_ETS; in qed_mcp_read_ufp_config()
1956 p_hwfn->ufp_info.mode = QED_UFP_MODE_VNIC_BW; in qed_mcp_read_ufp_config()
1958 p_hwfn->ufp_info.mode = QED_UFP_MODE_UNKNOWN; in qed_mcp_read_ufp_config()
1967 p_hwfn->ufp_info.tc = (u8)val; in qed_mcp_read_ufp_config()
1971 p_hwfn->ufp_info.pri_type = QED_UFP_PRI_VNIC; in qed_mcp_read_ufp_config()
1973 p_hwfn->ufp_info.pri_type = QED_UFP_PRI_OS; in qed_mcp_read_ufp_config()
1975 p_hwfn->ufp_info.pri_type = QED_UFP_PRI_UNKNOWN; in qed_mcp_read_ufp_config()
1983 p_hwfn->ufp_info.mode, p_hwfn->ufp_info.tc, in qed_mcp_read_ufp_config()
1984 p_hwfn->ufp_info.pri_type, MFW_PORT(p_hwfn)); in qed_mcp_read_ufp_config()
1992 if (p_hwfn->ufp_info.mode == QED_UFP_MODE_VNIC_BW) { in qed_mcp_handle_ufp_event()
1993 p_hwfn->qm_info.ooo_tc = p_hwfn->ufp_info.tc; in qed_mcp_handle_ufp_event()
1994 qed_hw_info_set_offload_tc(&p_hwfn->hw_info, in qed_mcp_handle_ufp_event()
1995 p_hwfn->ufp_info.tc); in qed_mcp_handle_ufp_event()
1998 } else if (p_hwfn->ufp_info.mode == QED_UFP_MODE_ETS) { in qed_mcp_handle_ufp_event()
2004 return -EINVAL; in qed_mcp_handle_ufp_event()
2019 struct qed_mcp_info *info = p_hwfn->mcp_info; in qed_mcp_handle_events()
2030 for (i = 0; i < info->mfw_mb_length; i++) { in qed_mcp_handle_events()
2031 if (info->mfw_mb_cur[i] == info->mfw_mb_shadow[i]) in qed_mcp_handle_events()
2037 "Msg [%d] - old CMD 0x%02x, new CMD 0x%02x\n", in qed_mcp_handle_events()
2038 i, info->mfw_mb_shadow[i], info->mfw_mb_cur[i]); in qed_mcp_handle_events()
2040 spin_lock_bh(&p_hwfn->mcp_info->unload_lock); in qed_mcp_handle_events()
2042 &p_hwfn->mcp_info->mcp_handling_status)) { in qed_mcp_handle_events()
2043 spin_unlock_bh(&p_hwfn->mcp_info->unload_lock); in qed_mcp_handle_events()
2050 &p_hwfn->mcp_info->mcp_handling_status); in qed_mcp_handle_events()
2051 spin_unlock_bh(&p_hwfn->mcp_info->unload_lock); in qed_mcp_handle_events()
2104 rc = -EINVAL; in qed_mcp_handle_events()
2108 &p_hwfn->mcp_info->mcp_handling_status); in qed_mcp_handle_events()
2112 for (i = 0; i < MFW_DRV_MSG_MAX_DWORDS(info->mfw_mb_length); i++) { in qed_mcp_handle_events()
2113 __be32 val = cpu_to_be32(((u32 *)info->mfw_mb_cur)[i]); in qed_mcp_handle_events()
2117 info->mfw_mb_addr + sizeof(u32) + in qed_mcp_handle_events()
2118 MFW_DRV_MSG_MAX_DWORDS(info->mfw_mb_length) * in qed_mcp_handle_events()
2126 rc = -EINVAL; in qed_mcp_handle_events()
2130 memcpy(info->mfw_mb_shadow, info->mfw_mb_cur, info->mfw_mb_length); in qed_mcp_handle_events()
2141 if (IS_VF(p_hwfn->cdev)) { in qed_mcp_get_mfw_ver()
2142 if (p_hwfn->vf_iov_info) { in qed_mcp_get_mfw_ver()
2145 p_resp = &p_hwfn->vf_iov_info->acquire_resp; in qed_mcp_get_mfw_ver()
2146 *p_mfw_ver = p_resp->pfdev_info.mfw_ver; in qed_mcp_get_mfw_ver()
2152 return -EINVAL; in qed_mcp_get_mfw_ver()
2156 public_base = p_hwfn->mcp_info->public_base; in qed_mcp_get_mfw_ver()
2180 if (IS_VF(p_hwfn->cdev)) in qed_mcp_get_mbi_ver()
2181 return -EINVAL; in qed_mcp_get_mbi_ver()
2187 return -EINVAL; in qed_mcp_get_mbi_ver()
2210 if (IS_VF(p_hwfn->cdev)) in qed_mcp_get_media_type()
2211 return -EINVAL; in qed_mcp_get_media_type()
2215 return -EBUSY; in qed_mcp_get_media_type()
2220 return -EINVAL; in qed_mcp_get_media_type()
2224 p_hwfn->mcp_info->port_addr + in qed_mcp_get_media_type()
2241 if (IS_VF(p_hwfn->cdev)) in qed_mcp_get_transceiver_data()
2242 return -EINVAL; in qed_mcp_get_transceiver_data()
2246 return -EBUSY; in qed_mcp_get_transceiver_data()
2250 p_hwfn->mcp_info->port_addr + in qed_mcp_get_transceiver_data()
2292 return -EINVAL; in qed_mcp_trans_speed_mask()
2398 if (IS_VF(p_hwfn->cdev)) in qed_mcp_get_board_config()
2399 return -EINVAL; in qed_mcp_get_board_config()
2403 return -EBUSY; in qed_mcp_get_board_config()
2407 return -EINVAL; in qed_mcp_get_board_config()
2430 if (test_bit(QED_DEV_CAP_ROCE, &p_hwfn->hw_info.device_capabilities)) in qed_mcp_get_shmem_proto_legacy()
2456 return -EINVAL; in qed_mcp_get_shmem_proto_mfw()
2476 return -EINVAL; in qed_mcp_get_shmem_proto_mfw()
2494 switch (p_info->config & FUNC_MF_CFG_PROTOCOL_MASK) { in qed_mcp_get_shmem_proto()
2511 rc = -EINVAL; in qed_mcp_get_shmem_proto()
2524 info = &p_hwfn->mcp_info->func_info; in qed_mcp_fill_shmem_func_info()
2526 info->pause_on_host = (shmem_info.config & in qed_mcp_fill_shmem_func_info()
2530 &info->protocol)) { in qed_mcp_fill_shmem_func_info()
2533 return -EINVAL; in qed_mcp_fill_shmem_func_info()
2539 info->mac[0] = (u8)(shmem_info.mac_upper >> 8); in qed_mcp_fill_shmem_func_info()
2540 info->mac[1] = (u8)(shmem_info.mac_upper); in qed_mcp_fill_shmem_func_info()
2541 info->mac[2] = (u8)(shmem_info.mac_lower >> 24); in qed_mcp_fill_shmem_func_info()
2542 info->mac[3] = (u8)(shmem_info.mac_lower >> 16); in qed_mcp_fill_shmem_func_info()
2543 info->mac[4] = (u8)(shmem_info.mac_lower >> 8); in qed_mcp_fill_shmem_func_info()
2544 info->mac[5] = (u8)(shmem_info.mac_lower); in qed_mcp_fill_shmem_func_info()
2546 /* Store primary MAC for later possible WoL */ in qed_mcp_fill_shmem_func_info()
2547 memcpy(&p_hwfn->cdev->wol_mac, info->mac, ETH_ALEN); in qed_mcp_fill_shmem_func_info()
2549 DP_NOTICE(p_hwfn, "MAC is 0 in shmem\n"); in qed_mcp_fill_shmem_func_info()
2552 info->wwn_port = (u64)shmem_info.fcoe_wwn_port_name_lower | in qed_mcp_fill_shmem_func_info()
2554 info->wwn_node = (u64)shmem_info.fcoe_wwn_node_name_lower | in qed_mcp_fill_shmem_func_info()
2557 info->ovlan = (u16)(shmem_info.ovlan_stag & FUNC_MF_CFG_OV_STAG_MASK); in qed_mcp_fill_shmem_func_info()
2559 info->mtu = (u16)shmem_info.mtu_size; in qed_mcp_fill_shmem_func_info()
2561 p_hwfn->hw_info.b_wol_support = QED_WOL_SUPPORT_NONE; in qed_mcp_fill_shmem_func_info()
2562 p_hwfn->cdev->wol_config = (u8)QED_OV_WOL_DEFAULT; in qed_mcp_fill_shmem_func_info()
2572 p_hwfn->hw_info.b_wol_support = QED_WOL_SUPPORT_PME; in qed_mcp_fill_shmem_func_info()
2576 …"Read configuration from shmem: pause_on_host %02x protocol %02x BW [%02x - %02x] MAC %pM wwn port… in qed_mcp_fill_shmem_func_info()
2577 info->pause_on_host, info->protocol, in qed_mcp_fill_shmem_func_info()
2578 info->bandwidth_min, info->bandwidth_max, in qed_mcp_fill_shmem_func_info()
2579 info->mac, in qed_mcp_fill_shmem_func_info()
2580 info->wwn_port, info->wwn_node, in qed_mcp_fill_shmem_func_info()
2581 info->ovlan, (u8)p_hwfn->hw_info.b_wol_support); in qed_mcp_fill_shmem_func_info()
2589 if (!p_hwfn || !p_hwfn->mcp_info) in qed_mcp_get_link_params()
2591 return &p_hwfn->mcp_info->link_input; in qed_mcp_get_link_params()
2597 if (!p_hwfn || !p_hwfn->mcp_info) in qed_mcp_get_link_state()
2599 return &p_hwfn->mcp_info->link_output; in qed_mcp_get_link_state()
2605 if (!p_hwfn || !p_hwfn->mcp_info) in qed_mcp_get_link_capabilities()
2607 return &p_hwfn->mcp_info->link_capabilities; in qed_mcp_get_link_capabilities()
2629 if (IS_VF(p_hwfn->cdev)) in qed_mcp_get_flash_size()
2630 return -EINVAL; in qed_mcp_get_flash_size()
2644 struct qed_dev *cdev = p_hwfn->cdev; in qed_start_recovery_process()
2646 if (cdev->recov_in_prog) { in qed_start_recovery_process()
2649 return -EAGAIN; in qed_start_recovery_process()
2663 struct qed_ptt *p_ptt = p_hwfn->p_main_ptt; in qed_recovery_prolog()
2689 num *= p_hwfn->cdev->num_hwfns; in qed_mcp_config_vf_msix_bb()
2700 DP_NOTICE(p_hwfn, "VF[%d]: MFW failed to set MSI-X\n", vf_id); in qed_mcp_config_vf_msix_bb()
2701 rc = -EINVAL; in qed_mcp_config_vf_msix_bb()
2704 "Requested 0x%02x MSI-x interrupts from VF 0x%02x\n", in qed_mcp_config_vf_msix_bb()
2722 DP_NOTICE(p_hwfn, "MFW failed to set MSI-X for VFs\n"); in qed_mcp_config_vf_msix_ah()
2723 rc = -EINVAL; in qed_mcp_config_vf_msix_ah()
2726 "Requested 0x%02x MSI-x interrupts for VFs\n", num); in qed_mcp_config_vf_msix_ah()
2735 if (QED_IS_BB(p_hwfn->cdev)) in qed_mcp_config_vf_msix()
2753 drv_version.version = p_ver->version; in qed_mcp_send_drv_version()
2754 for (i = 0; i < (MCP_DRV_VER_STR_SIZE - 4) / sizeof(u32); i++) { in qed_mcp_send_drv_version()
2755 val = cpu_to_be32(*((u32 *)&p_ver->name[i * sizeof(u32)])); in qed_mcp_send_drv_version()
2797 return -EBUSY; in qed_mcp_halt()
2823 return -EBUSY; in qed_mcp_resume()
2851 return -EINVAL; in qed_mcp_ov_update_current_config()
2882 return -EINVAL; in qed_mcp_ov_update_driver_state()
2910 struct qed_ptt *p_ptt, const u8 *mac) in qed_mcp_ov_update_mac() argument
2923 * in 32-bit granularity. in qed_mcp_ov_update_mac()
2924 * So the MAC has to be set in native order [and not byte order], in qed_mcp_ov_update_mac()
2927 mfw_mac[0] = mac[0] << 24 | mac[1] << 16 | mac[2] << 8 | mac[3]; in qed_mcp_ov_update_mac()
2928 mfw_mac[1] = mac[4] << 24 | mac[5] << 16; in qed_mcp_ov_update_mac()
2934 DP_ERR(p_hwfn, "Failed to send mac address, rc = %d\n", rc); in qed_mcp_ov_update_mac()
2936 /* Store primary MAC for later possible WoL */ in qed_mcp_ov_update_mac()
2937 memcpy(p_hwfn->cdev->wol_mac, mac, ETH_ALEN); in qed_mcp_ov_update_mac()
2949 if (p_hwfn->hw_info.b_wol_support == QED_WOL_SUPPORT_NONE) { in qed_mcp_ov_update_wol()
2952 return -EINVAL; in qed_mcp_ov_update_wol()
2967 return -EINVAL; in qed_mcp_ov_update_wol()
2976 p_hwfn->cdev->wol_config = (u8)wol; in qed_mcp_ov_update_wol()
3001 return -EINVAL; in qed_mcp_ov_update_eswitch()
3030 return -EINVAL; in qed_mcp_set_led()
3054 rc = -EINVAL; in qed_mcp_mask_parities()
3070 return -EBUSY; in qed_mcp_nvm_read()
3090 bytes_left -= read_len; in qed_mcp_nvm_read()
3093 cdev->mcp_nvm_resp = resp; in qed_mcp_nvm_read()
3106 return -EBUSY; in qed_mcp_nvm_resp()
3108 memcpy(p_buf, &cdev->mcp_nvm_resp, sizeof(cdev->mcp_nvm_resp)); in qed_mcp_nvm_resp()
3120 int rc = -EINVAL; in qed_mcp_nvm_write()
3124 return -EBUSY; in qed_mcp_nvm_write()
3138 rc = -EINVAL; in qed_mcp_nvm_write()
3142 buf_size = min_t(u32, (len - buf_idx), MCP_DRV_NVM_BUF_LEN); in qed_mcp_nvm_write()
3164 rc = -EINVAL; in qed_mcp_nvm_write()
3169 * isn't pre-emptable. Sleep a bit to prevent CPU hogging. in qed_mcp_nvm_write()
3186 buf_size = min_t(u32, (len - buf_idx), in qed_mcp_nvm_write()
3191 cdev->mcp_nvm_resp = resp; in qed_mcp_nvm_write()
3236 return -ENODEV; in qed_mcp_phy_sfp_read()
3238 return -EINVAL; in qed_mcp_phy_sfp_read()
3241 bytes_left -= buf_size; in qed_mcp_phy_sfp_read()
3263 rc = -EAGAIN; in qed_mcp_bist_register_test()
3284 rc = -EAGAIN; in qed_mcp_bist_clock_test()
3305 rc = -EOPNOTSUPP; in qed_mcp_bist_nvm_get_num_images()
3307 rc = -EINVAL; in qed_mcp_bist_nvm_get_num_images()
3333 (p_image_att->return_code != 1)) in qed_mcp_bist_nvm_get_image_att()
3334 rc = -EINVAL; in qed_mcp_bist_nvm_get_image_att()
3346 if (p_hwfn->nvm_info.valid) in qed_mcp_nvm_info_populate()
3352 return -EBUSY; in qed_mcp_nvm_info_populate()
3359 if (rc == -EOPNOTSUPP) { in qed_mcp_nvm_info_populate()
3372 rc = -ENOMEM; in qed_mcp_nvm_info_populate()
3392 p_hwfn->nvm_info.num_images = nvm_info.num_images; in qed_mcp_nvm_info_populate()
3393 kfree(p_hwfn->nvm_info.image_att); in qed_mcp_nvm_info_populate()
3394 p_hwfn->nvm_info.image_att = nvm_info.image_att; in qed_mcp_nvm_info_populate()
3395 p_hwfn->nvm_info.valid = true; in qed_mcp_nvm_info_populate()
3410 kfree(p_hwfn->nvm_info.image_att); in qed_mcp_nvm_info_free()
3411 p_hwfn->nvm_info.image_att = NULL; in qed_mcp_nvm_info_free()
3412 p_hwfn->nvm_info.valid = false; in qed_mcp_nvm_info_free()
3447 return -EINVAL; in qed_mcp_get_nvm_image_att()
3454 for (i = 0; i < p_hwfn->nvm_info.num_images; i++) in qed_mcp_get_nvm_image_att()
3455 if (type == p_hwfn->nvm_info.image_att[i].image_type) in qed_mcp_get_nvm_image_att()
3457 if (i == p_hwfn->nvm_info.num_images) { in qed_mcp_get_nvm_image_att()
3461 return -ENOENT; in qed_mcp_get_nvm_image_att()
3464 p_image_att->start_addr = p_hwfn->nvm_info.image_att[i].nvm_start_addr; in qed_mcp_get_nvm_image_att()
3465 p_image_att->length = p_hwfn->nvm_info.image_att[i].len; in qed_mcp_get_nvm_image_att()
3483 /* Validate sizes - both the image's and the supplied buffer's */ in qed_mcp_get_nvm_image()
3486 "Image [%d] is too small - only %d bytes\n", in qed_mcp_get_nvm_image()
3488 return -EINVAL; in qed_mcp_get_nvm_image()
3494 "Image [%d] is too big - %08x bytes where only %08x are available\n", in qed_mcp_get_nvm_image()
3496 return -ENOMEM; in qed_mcp_get_nvm_image()
3499 return qed_mcp_nvm_read(p_hwfn->cdev, image_att.start_addr, in qed_mcp_get_nvm_image()
3528 /* Each VFC resource can accommodate both a MAC and a VLAN */ in qed_mcp_get_mfw_res_id()
3594 mfw_resc_info.res_id = qed_mcp_get_mfw_res_id(p_in_params->res_id); in qed_mcp_resc_allocation_msg()
3598 p_in_params->res_id, in qed_mcp_resc_allocation_msg()
3599 qed_hw_get_resc_name(p_in_params->res_id)); in qed_mcp_resc_allocation_msg()
3600 return -EINVAL; in qed_mcp_resc_allocation_msg()
3603 switch (p_in_params->cmd) { in qed_mcp_resc_allocation_msg()
3605 mfw_resc_info.size = p_in_params->resc_max_val; in qed_mcp_resc_allocation_msg()
3611 p_in_params->cmd); in qed_mcp_resc_allocation_msg()
3612 return -EINVAL; in qed_mcp_resc_allocation_msg()
3616 mb_params.cmd = p_in_params->cmd; in qed_mcp_resc_allocation_msg()
3626 p_in_params->cmd, in qed_mcp_resc_allocation_msg()
3627 p_in_params->res_id, in qed_mcp_resc_allocation_msg()
3628 qed_hw_get_resc_name(p_in_params->res_id), in qed_mcp_resc_allocation_msg()
3633 p_in_params->resc_max_val); in qed_mcp_resc_allocation_msg()
3639 p_out_params->mcp_resp = mb_params.mcp_resp; in qed_mcp_resc_allocation_msg()
3640 p_out_params->mcp_param = mb_params.mcp_param; in qed_mcp_resc_allocation_msg()
3641 p_out_params->resc_num = mfw_resc_info.size; in qed_mcp_resc_allocation_msg()
3642 p_out_params->resc_start = mfw_resc_info.offset; in qed_mcp_resc_allocation_msg()
3643 p_out_params->vf_resc_num = mfw_resc_info.vf_size; in qed_mcp_resc_allocation_msg()
3644 p_out_params->vf_resc_start = mfw_resc_info.vf_offset; in qed_mcp_resc_allocation_msg()
3645 p_out_params->flags = mfw_resc_info.flags; in qed_mcp_resc_allocation_msg()
3650 QED_MFW_GET_FIELD(p_out_params->mcp_param, in qed_mcp_resc_allocation_msg()
3652 QED_MFW_GET_FIELD(p_out_params->mcp_param, in qed_mcp_resc_allocation_msg()
3654 p_out_params->resc_num, in qed_mcp_resc_allocation_msg()
3655 p_out_params->resc_start, in qed_mcp_resc_allocation_msg()
3656 p_out_params->vf_resc_num, in qed_mcp_resc_allocation_msg()
3657 p_out_params->vf_resc_start, p_out_params->flags); in qed_mcp_resc_allocation_msg()
3738 return -EINVAL; in qed_mcp_resource_cmd()
3747 return -EINVAL; in qed_mcp_resource_cmd()
3762 switch (p_params->timeout) { in __qed_mcp_resc_lock()
3765 p_params->timeout = 0; in __qed_mcp_resc_lock()
3769 p_params->timeout = 0; in __qed_mcp_resc_lock()
3776 QED_MFW_SET_FIELD(param, RESOURCE_CMD_REQ_RESC, p_params->resource); in __qed_mcp_resc_lock()
3778 QED_MFW_SET_FIELD(param, RESOURCE_CMD_REQ_AGE, p_params->timeout); in __qed_mcp_resc_lock()
3783 param, p_params->timeout, opcode, p_params->resource); in __qed_mcp_resc_lock()
3791 p_params->owner = QED_MFW_GET_FIELD(mcp_param, RESOURCE_CMD_RSP_OWNER); in __qed_mcp_resc_lock()
3797 mcp_param, opcode, p_params->owner); in __qed_mcp_resc_lock()
3801 p_params->b_granted = true; in __qed_mcp_resc_lock()
3804 p_params->b_granted = false; in __qed_mcp_resc_lock()
3810 return -EINVAL; in __qed_mcp_resc_lock()
3826 if (p_params->sleep_b4_retry) { in qed_mcp_resc_lock()
3828 DIV_ROUND_UP(p_params->retry_interval, in qed_mcp_resc_lock()
3833 udelay(p_params->retry_interval); in qed_mcp_resc_lock()
3841 if (p_params->b_granted) in qed_mcp_resc_lock()
3843 } while (retry_cnt++ < p_params->retry_num); in qed_mcp_resc_lock()
3857 opcode = p_params->b_force ? RESOURCE_OPCODE_FORCE_RELEASE in qed_mcp_resc_unlock()
3859 QED_MFW_SET_FIELD(param, RESOURCE_CMD_REQ_RESC, p_params->resource); in qed_mcp_resc_unlock()
3864 param, opcode, p_params->resource); in qed_mcp_resc_unlock()
3882 p_params->resource); in qed_mcp_resc_unlock()
3885 p_params->b_released = true; in qed_mcp_resc_unlock()
3888 p_params->b_released = false; in qed_mcp_resc_unlock()
3894 return -EINVAL; in qed_mcp_resc_unlock()
3913 p_lock->timeout = QED_MCP_RESC_LOCK_TO_NONE; in qed_mcp_resc_lock_default_init()
3915 p_lock->retry_num = QED_MCP_RESC_LOCK_RETRY_CNT_DFLT; in qed_mcp_resc_lock_default_init()
3916 p_lock->retry_interval = in qed_mcp_resc_lock_default_init()
3918 p_lock->sleep_b4_retry = true; in qed_mcp_resc_lock_default_init()
3921 p_lock->resource = resource; in qed_mcp_resc_lock_default_init()
3926 p_unlock->resource = resource; in qed_mcp_resc_lock_default_init()
3932 return !!(p_hwfn->mcp_info->capabilities & in qed_mcp_is_smart_an_supported()
3942 0, &mcp_resp, &p_hwfn->mcp_info->capabilities); in qed_mcp_get_capabilities()
3946 p_hwfn->mcp_info->capabilities); in qed_mcp_get_capabilities()
3966 struct qed_dev *cdev = p_hwfn->cdev; in qed_mcp_get_engine_config()
3978 return -EOPNOTSUPP; in qed_mcp_get_engine_config()
3984 cdev->fir_affin = in qed_mcp_get_engine_config()
3991 cdev->l2_affin_hint = in qed_mcp_get_engine_config()
3997 fir_valid, cdev->fir_affin, l2_valid, cdev->l2_affin_hint); in qed_mcp_get_engine_config()
4005 struct qed_dev *cdev = p_hwfn->cdev; in qed_mcp_get_ppfid_bitmap()
4016 return -EOPNOTSUPP; in qed_mcp_get_ppfid_bitmap()
4019 cdev->ppfid_bitmap = QED_MFW_GET_FIELD(mb_params.mcp_param, in qed_mcp_get_ppfid_bitmap()
4023 cdev->ppfid_bitmap); in qed_mcp_get_ppfid_bitmap()
4093 (QED_MCP_DBG_DATA_MAX_SIZE - QED_MCP_DBG_DATA_MAX_HEADER_SIZE)
4106 return -EINVAL; in __qed_mcp_send_debug_data()
4121 return -EOPNOTSUPP; in __qed_mcp_send_debug_data()
4124 return -EBUSY; in __qed_mcp_send_debug_data()
4129 return -EINVAL; in __qed_mcp_send_debug_data()
4166 seq = (u16)atomic_inc_return(&p_hwfn->mcp_info->dbg_data_seq); in qed_mcp_send_debug_data()
4175 SET_MFW_FIELD(*p_header, QED_MCP_DBG_DATA_HDR_PF, p_hwfn->abs_pf_id); in qed_mcp_send_debug_data()
4192 tmp_size -= QED_MCP_DBG_DATA_MAX_PAYLOAD_SIZE; in qed_mcp_send_debug_data()
4216 return !!(p_hwfn->mcp_info->capabilities & in qed_mcp_is_esl_supported()