Lines Matching +full:post +full:- +full:delay
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (c) 2009-2013 QLogic Corporation
74 u16 delay; member
78 u16 delay;
136 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_DRV_PRESENCE); in qlcnic_83xx_idc_check_driver_presence_reg()
146 cur = adapter->ahw->idc.curr_state; in qlcnic_83xx_idc_log_state_history()
147 prev = adapter->ahw->idc.prev_state; in qlcnic_83xx_idc_log_state_history()
149 dev_info(&adapter->pdev->dev, in qlcnic_83xx_idc_log_state_history()
151 adapter->ahw->idc.name[cur], in qlcnic_83xx_idc_log_state_history()
152 adapter->ahw->idc.name[prev]); in qlcnic_83xx_idc_log_state_history()
163 return -EBUSY; in qlcnic_83xx_idc_update_audit_reg()
166 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_DRV_AUDIT); in qlcnic_83xx_idc_update_audit_reg()
167 val |= (adapter->portnum & 0xf); in qlcnic_83xx_idc_update_audit_reg()
170 seconds = jiffies / HZ - adapter->ahw->idc.sec_counter; in qlcnic_83xx_idc_update_audit_reg()
175 QLCWRX(adapter->ahw, QLC_83XX_IDC_DRV_AUDIT, val); in qlcnic_83xx_idc_update_audit_reg()
176 adapter->ahw->idc.sec_counter = jiffies / HZ; in qlcnic_83xx_idc_update_audit_reg()
188 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_MIN_VERSION); in qlcnic_83xx_idc_update_minor_version()
189 val = val & ~(0x3 << (adapter->portnum * 2)); in qlcnic_83xx_idc_update_minor_version()
190 val = val | (QLC_83XX_IDC_MINOR_VERSION << (adapter->portnum * 2)); in qlcnic_83xx_idc_update_minor_version()
191 QLCWRX(adapter->ahw, QLC_83XX_IDC_MIN_VERSION, val); in qlcnic_83xx_idc_update_minor_version()
201 return -EBUSY; in qlcnic_83xx_idc_update_major_version()
204 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_MAJ_VERSION); in qlcnic_83xx_idc_update_major_version()
207 QLCWRX(adapter->ahw, QLC_83XX_IDC_MAJ_VERSION, val); in qlcnic_83xx_idc_update_major_version()
223 return -EBUSY; in qlcnic_83xx_idc_update_drv_presence_reg()
226 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_DRV_PRESENCE); in qlcnic_83xx_idc_update_drv_presence_reg()
229 val = val | (1 << adapter->portnum); in qlcnic_83xx_idc_update_drv_presence_reg()
231 val = val & ~(1 << adapter->portnum); in qlcnic_83xx_idc_update_drv_presence_reg()
233 QLCWRX(adapter->ahw, QLC_83XX_IDC_DRV_PRESENCE, val); in qlcnic_83xx_idc_update_drv_presence_reg()
247 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_MAJ_VERSION); in qlcnic_83xx_idc_check_major_version()
251 dev_info(&adapter->pdev->dev, in qlcnic_83xx_idc_check_major_version()
254 return -EIO; in qlcnic_83xx_idc_check_major_version()
267 return -EBUSY; in qlcnic_83xx_idc_clear_registers()
270 QLCWRX(adapter->ahw, QLC_83XX_IDC_DRV_ACK, 0); in qlcnic_83xx_idc_clear_registers()
272 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL); in qlcnic_83xx_idc_clear_registers()
274 QLCWRX(adapter->ahw, QLC_83XX_IDC_CTRL, val); in qlcnic_83xx_idc_clear_registers()
289 return -EBUSY; in qlcnic_83xx_idc_update_drv_ack_reg()
292 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_DRV_ACK); in qlcnic_83xx_idc_update_drv_ack_reg()
294 val = val | (1 << adapter->portnum); in qlcnic_83xx_idc_update_drv_ack_reg()
296 val = val & ~(1 << adapter->portnum); in qlcnic_83xx_idc_update_drv_ack_reg()
297 QLCWRX(adapter->ahw, QLC_83XX_IDC_DRV_ACK, val); in qlcnic_83xx_idc_update_drv_ack_reg()
310 seconds = jiffies / HZ - adapter->ahw->idc.sec_counter; in qlcnic_83xx_idc_check_timeout()
314 return -EBUSY; in qlcnic_83xx_idc_check_timeout()
332 ack = QLCRDX(adapter->ahw, QLC_83XX_IDC_DRV_ACK); in qlcnic_83xx_idc_check_reset_ack_reg()
333 presence = QLCRDX(adapter->ahw, QLC_83XX_IDC_DRV_PRESENCE); in qlcnic_83xx_idc_check_reset_ack_reg()
334 dev_info(&adapter->pdev->dev, in qlcnic_83xx_idc_check_reset_ack_reg()
339 dev_info(&adapter->pdev->dev, in qlcnic_83xx_idc_check_reset_ack_reg()
341 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_DRV_PRESENCE); in qlcnic_83xx_idc_check_reset_ack_reg()
344 return -EBUSY; in qlcnic_83xx_idc_check_reset_ack_reg()
345 QLCWRX(adapter->ahw, QLC_83XX_IDC_DRV_PRESENCE, val); in qlcnic_83xx_idc_check_reset_ack_reg()
346 dev_info(&adapter->pdev->dev, in qlcnic_83xx_idc_check_reset_ack_reg()
356 dev_info(&adapter->pdev->dev, in qlcnic_83xx_idc_check_reset_ack_reg()
370 * Returns -EBUSY or Success (0)
375 struct net_device *netdev = adapter->netdev; in qlcnic_83xx_idc_tx_soft_reset()
377 if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state)) in qlcnic_83xx_idc_tx_soft_reset()
378 return -EBUSY; in qlcnic_83xx_idc_tx_soft_reset()
384 clear_bit(__QLCNIC_RESETTING, &adapter->state); in qlcnic_83xx_idc_tx_soft_reset()
385 netdev_info(adapter->netdev, "%s: soft reset complete.\n", __func__); in qlcnic_83xx_idc_tx_soft_reset()
401 struct net_device *netdev = adapter->netdev; in qlcnic_83xx_idc_detach_driver()
409 for (i = 0; i < adapter->ahw->num_msix; i++) { in qlcnic_83xx_idc_detach_driver()
410 adapter->ahw->intr_tbl[i].id = i; in qlcnic_83xx_idc_detach_driver()
411 adapter->ahw->intr_tbl[i].enabled = 0; in qlcnic_83xx_idc_detach_driver()
412 adapter->ahw->intr_tbl[i].src = 0; in qlcnic_83xx_idc_detach_driver()
424 * Re-attach and re-enable net interface
430 struct net_device *netdev = adapter->netdev; in qlcnic_83xx_idc_attach_driver()
446 return -EBUSY; in qlcnic_83xx_idc_enter_failed_state()
450 QLCWRX(adapter->ahw, QLC_83XX_IDC_DEV_STATE, QLC_83XX_IDC_DEV_FAILED); in qlcnic_83xx_idc_enter_failed_state()
455 dev_info(&adapter->pdev->dev, "Device will enter failed state\n"); in qlcnic_83xx_idc_enter_failed_state()
465 return -EBUSY; in qlcnic_83xx_idc_enter_init_state()
468 QLCWRX(adapter->ahw, QLC_83XX_IDC_DEV_STATE, QLC_83XX_IDC_DEV_INIT); in qlcnic_83xx_idc_enter_init_state()
481 return -EBUSY; in qlcnic_83xx_idc_enter_need_quiesce()
484 QLCWRX(adapter->ahw, QLC_83XX_IDC_DEV_STATE, in qlcnic_83xx_idc_enter_need_quiesce()
498 return -EBUSY; in qlcnic_83xx_idc_enter_need_reset_state()
501 QLCWRX(adapter->ahw, QLC_83XX_IDC_DEV_STATE, in qlcnic_83xx_idc_enter_need_reset_state()
515 return -EBUSY; in qlcnic_83xx_idc_enter_ready_state()
518 QLCWRX(adapter->ahw, QLC_83XX_IDC_DEV_STATE, QLC_83XX_IDC_DEV_READY); in qlcnic_83xx_idc_enter_ready_state()
533 * Returns: reset owner id or failure indication (-EIO)
540 reg1 = QLCRDX(adapter->ahw, QLC_83XX_IDC_DEV_PARTITION_INFO_1); in qlcnic_83xx_idc_find_reset_owner_id()
541 reg2 = QLCRDX(adapter->ahw, QLC_83XX_IDC_DEV_PARTITION_INFO_2); in qlcnic_83xx_idc_find_reset_owner_id()
551 if (i == (QLC_83XX_IDC_MAX_FUNC_PER_PARTITION_INFO - 1)) { in qlcnic_83xx_idc_find_reset_owner_id()
558 if (i == (QLC_83XX_IDC_MAX_CNA_FUNCTIONS - 1)) { in qlcnic_83xx_idc_find_reset_owner_id()
564 return -EIO; in qlcnic_83xx_idc_find_reset_owner_id()
597 dev_err(&adapter->pdev->dev, in qlcnic_83xx_idc_check_fan_failure()
600 dev_err(&adapter->pdev->dev, in qlcnic_83xx_idc_check_fan_failure()
603 dev_err(&adapter->pdev->dev, in qlcnic_83xx_idc_check_fan_failure()
605 return -EIO; in qlcnic_83xx_idc_check_fan_failure()
616 qlcnic_83xx_reinit_mbx_work(adapter->ahw->mailbox); in qlcnic_83xx_idc_reattach_driver()
629 return -EIO; in qlcnic_83xx_idc_reattach_driver()
632 if (adapter->nic_ops->init_driver(adapter)) { in qlcnic_83xx_idc_reattach_driver()
634 return -EIO; in qlcnic_83xx_idc_reattach_driver()
637 if (adapter->portnum == 0) in qlcnic_83xx_idc_reattach_driver()
640 qlcnic_dcb_get_info(adapter->dcb); in qlcnic_83xx_idc_reattach_driver()
648 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_idc_update_idc_params()
652 set_bit(QLC_83XX_MODULE_LOADED, &adapter->ahw->idc.status); in qlcnic_83xx_idc_update_idc_params()
654 ahw->idc.quiesce_req = 0; in qlcnic_83xx_idc_update_idc_params()
655 ahw->idc.delay = QLC_83XX_IDC_FW_POLL_DELAY; in qlcnic_83xx_idc_update_idc_params()
656 ahw->idc.err_code = 0; in qlcnic_83xx_idc_update_idc_params()
657 ahw->idc.collect_dump = 0; in qlcnic_83xx_idc_update_idc_params()
658 ahw->reset_context = 0; in qlcnic_83xx_idc_update_idc_params()
659 adapter->tx_timeo_cnt = 0; in qlcnic_83xx_idc_update_idc_params()
660 ahw->idc.delay_reset = 0; in qlcnic_83xx_idc_update_idc_params()
662 clear_bit(__QLCNIC_RESETTING, &adapter->state); in qlcnic_83xx_idc_update_idc_params()
678 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_idc_ready_state_entry()
680 if (ahw->idc.prev_state != QLC_83XX_IDC_DEV_READY) { in qlcnic_83xx_idc_ready_state_entry()
682 /* Re-attach the device if required */ in qlcnic_83xx_idc_ready_state_entry()
683 if ((ahw->idc.prev_state == QLC_83XX_IDC_DEV_NEED_RESET) || in qlcnic_83xx_idc_ready_state_entry()
684 (ahw->idc.prev_state == QLC_83XX_IDC_DEV_INIT)) { in qlcnic_83xx_idc_ready_state_entry()
686 return -EIO; in qlcnic_83xx_idc_ready_state_entry()
702 * Returns: -EIO or 0
708 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_idc_vnic_pf_entry()
711 state = QLCRDX(adapter->ahw, QLC_83XX_VNIC_STATE); in qlcnic_83xx_idc_vnic_pf_entry()
713 if (!ahw->idc.vnic_wait_limit--) { in qlcnic_83xx_idc_vnic_pf_entry()
715 return -EIO; in qlcnic_83xx_idc_vnic_pf_entry()
717 dev_info(&adapter->pdev->dev, "vNIC mode disabled\n"); in qlcnic_83xx_idc_vnic_pf_entry()
718 return -EIO; in qlcnic_83xx_idc_vnic_pf_entry()
722 if (ahw->idc.vnic_state != QLCNIC_DEV_NPAR_OPER) { in qlcnic_83xx_idc_vnic_pf_entry()
727 if (ahw->idc.prev_state != QLC_83XX_IDC_DEV_UNKNOWN) { in qlcnic_83xx_idc_vnic_pf_entry()
729 return -EIO; in qlcnic_83xx_idc_vnic_pf_entry()
731 adapter->ahw->idc.vnic_state = QLCNIC_DEV_NPAR_OPER; in qlcnic_83xx_idc_vnic_pf_entry()
732 dev_info(&adapter->pdev->dev, "vNIC mode enabled\n"); in qlcnic_83xx_idc_vnic_pf_entry()
741 adapter->ahw->idc.err_code = -EIO; in qlcnic_83xx_idc_unknown_state()
742 dev_err(&adapter->pdev->dev, in qlcnic_83xx_idc_unknown_state()
744 clear_bit(__QLCNIC_RESETTING, &adapter->state); in qlcnic_83xx_idc_unknown_state()
770 return -EIO; in qlcnic_83xx_idc_cold_state_handler()
796 if (adapter->ahw->idc.prev_state == QLC_83XX_IDC_DEV_NEED_RESET) { in qlcnic_83xx_idc_init_state()
798 if (adapter->ahw->pci_func == owner) in qlcnic_83xx_idc_init_state()
820 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_idc_ready_state()
821 struct qlcnic_mailbox *mbx = ahw->mailbox; in qlcnic_83xx_idc_ready_state()
826 if (ahw->idc.state_entry(adapter)) in qlcnic_83xx_idc_ready_state()
827 return -EIO; in qlcnic_83xx_idc_ready_state()
830 if (ahw->temp == QLCNIC_TEMP_PANIC) { in qlcnic_83xx_idc_ready_state()
832 dev_err(&adapter->pdev->dev, in qlcnic_83xx_idc_ready_state()
834 adapter->ahw->temp); in qlcnic_83xx_idc_ready_state()
835 clear_bit(QLC_83XX_MBX_READY, &mbx->status); in qlcnic_83xx_idc_ready_state()
836 set_bit(__QLCNIC_RESETTING, &adapter->state); in qlcnic_83xx_idc_ready_state()
839 return -EIO; in qlcnic_83xx_idc_ready_state()
843 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL); in qlcnic_83xx_idc_ready_state()
846 adapter->flags |= QLCNIC_FW_HANG; in qlcnic_83xx_idc_ready_state()
848 clear_bit(QLC_83XX_MBX_READY, &mbx->status); in qlcnic_83xx_idc_ready_state()
849 set_bit(__QLCNIC_RESETTING, &adapter->state); in qlcnic_83xx_idc_ready_state()
852 netdev_info(adapter->netdev, "%s: Auto firmware recovery is disabled\n", in qlcnic_83xx_idc_ready_state()
856 return -EIO; in qlcnic_83xx_idc_ready_state()
859 if ((val & QLC_83XX_IDC_GRACEFULL_RESET) || ahw->idc.collect_dump) { in qlcnic_83xx_idc_ready_state()
860 clear_bit(QLC_83XX_MBX_READY, &mbx->status); in qlcnic_83xx_idc_ready_state()
868 if (ahw->reset_context && in qlcnic_83xx_idc_ready_state()
870 adapter->ahw->reset_context = 0; in qlcnic_83xx_idc_ready_state()
876 if (adapter->ahw->idc.quiesce_req) { in qlcnic_83xx_idc_ready_state()
899 struct qlcnic_mailbox *mbx = adapter->ahw->mailbox; in qlcnic_83xx_idc_need_reset_state()
902 if (adapter->ahw->idc.prev_state != QLC_83XX_IDC_DEV_NEED_RESET) { in qlcnic_83xx_idc_need_reset_state()
904 set_bit(__QLCNIC_RESETTING, &adapter->state); in qlcnic_83xx_idc_need_reset_state()
905 clear_bit(QLC_83XX_MBX_READY, &mbx->status); in qlcnic_83xx_idc_need_reset_state()
906 if (adapter->ahw->nic_mode == QLCNIC_VNIC_MODE) in qlcnic_83xx_idc_need_reset_state()
910 dev_info(&adapter->pdev->dev, in qlcnic_83xx_idc_need_reset_state()
912 adapter->ahw->idc.delay_reset = 1; in qlcnic_83xx_idc_need_reset_state()
921 dev_info(&adapter->pdev->dev, in qlcnic_83xx_idc_need_reset_state()
923 return -1; in qlcnic_83xx_idc_need_reset_state()
925 if (adapter->ahw->idc.delay_reset) { in qlcnic_83xx_idc_need_reset_state()
928 adapter->ahw->idc.delay_reset = 0; in qlcnic_83xx_idc_need_reset_state()
934 dev_info(&adapter->pdev->dev, in qlcnic_83xx_idc_need_reset_state()
936 return -1; in qlcnic_83xx_idc_need_reset_state()
948 dev_err(&adapter->pdev->dev, "%s: TBD\n", __func__); in qlcnic_83xx_idc_need_quiesce_state()
954 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_idc_failed_state()
957 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL); in qlcnic_83xx_idc_failed_state()
960 if (ahw->pci_func == owner) { in qlcnic_83xx_idc_failed_state()
966 netdev_warn(adapter->netdev, "%s: Reboot will be required to recover the adapter!!\n", in qlcnic_83xx_idc_failed_state()
968 clear_bit(__QLCNIC_RESETTING, &adapter->state); in qlcnic_83xx_idc_failed_state()
969 ahw->idc.err_code = -EIO; in qlcnic_83xx_idc_failed_state()
976 dev_info(&adapter->pdev->dev, "%s: TBD\n", __func__); in qlcnic_83xx_idc_quiesce_state()
985 cur = adapter->ahw->idc.curr_state; in qlcnic_83xx_idc_check_state_validity()
986 prev = adapter->ahw->idc.prev_state; in qlcnic_83xx_idc_check_state_validity()
991 dev_err(&adapter->pdev->dev, in qlcnic_83xx_idc_check_state_validity()
1001 dev_err(&adapter->pdev->dev, in qlcnic_83xx_idc_check_state_validity()
1012 dev_err(&adapter->pdev->dev, in qlcnic_83xx_idc_check_state_validity()
1049 netdev_err(adapter->netdev, in qlcnic_set_vxlan_port()
1075 netdev_err(adapter->netdev, in qlcnic_set_vxlan_parsing()
1079 netdev_info(adapter->netdev, in qlcnic_set_vxlan_parsing()
1090 if (adapter->fhash.fnum) in qlcnic_83xx_periodic_tasks()
1111 state = QLCRDX(adapter->ahw, QLC_83XX_IDC_DEV_STATE); in qlcnic_83xx_idc_poll_dev_state()
1115 adapter->ahw->idc.curr_state = QLC_83XX_IDC_DEV_UNKNOWN; in qlcnic_83xx_idc_poll_dev_state()
1117 adapter->ahw->idc.curr_state = state; in qlcnic_83xx_idc_poll_dev_state()
1120 switch (adapter->ahw->idc.curr_state) { in qlcnic_83xx_idc_poll_dev_state()
1143 adapter->ahw->idc.prev_state = adapter->ahw->idc.curr_state; in qlcnic_83xx_idc_poll_dev_state()
1146 /* Re-schedule the function */ in qlcnic_83xx_idc_poll_dev_state()
1147 if (test_bit(QLC_83XX_MODULE_LOADED, &adapter->ahw->idc.status)) in qlcnic_83xx_idc_poll_dev_state()
1149 adapter->ahw->idc.delay); in qlcnic_83xx_idc_poll_dev_state()
1158 dev_info(&adapter->pdev->dev, in qlcnic_83xx_setup_idc_parameters()
1160 adapter->dev_init_timeo = QLC_83XX_IDC_INIT_TIMEOUT_SECS; in qlcnic_83xx_setup_idc_parameters()
1161 adapter->reset_ack_timeo = QLC_83XX_IDC_RESET_TIMEOUT_SECS; in qlcnic_83xx_setup_idc_parameters()
1163 adapter->dev_init_timeo = idc_params & 0xFFFF; in qlcnic_83xx_setup_idc_parameters()
1164 adapter->reset_ack_timeo = ((idc_params >> 16) & 0xFFFF); in qlcnic_83xx_setup_idc_parameters()
1167 adapter->ahw->idc.curr_state = QLC_83XX_IDC_DEV_UNKNOWN; in qlcnic_83xx_setup_idc_parameters()
1168 adapter->ahw->idc.prev_state = QLC_83XX_IDC_DEV_UNKNOWN; in qlcnic_83xx_setup_idc_parameters()
1169 adapter->ahw->idc.delay = QLC_83XX_IDC_FW_POLL_DELAY; in qlcnic_83xx_setup_idc_parameters()
1170 adapter->ahw->idc.err_code = 0; in qlcnic_83xx_setup_idc_parameters()
1171 adapter->ahw->idc.collect_dump = 0; in qlcnic_83xx_setup_idc_parameters()
1172 adapter->ahw->idc.name = (char **)qlc_83xx_idc_states; in qlcnic_83xx_setup_idc_parameters()
1174 clear_bit(__QLCNIC_RESETTING, &adapter->state); in qlcnic_83xx_setup_idc_parameters()
1175 set_bit(QLC_83XX_MODULE_LOADED, &adapter->ahw->idc.status); in qlcnic_83xx_setup_idc_parameters()
1180 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL); in qlcnic_83xx_setup_idc_parameters()
1182 QLCWRX(adapter->ahw, QLC_83XX_IDC_CTRL, val); in qlcnic_83xx_setup_idc_parameters()
1192 return -EIO; in qlcnic_83xx_idc_first_to_load_function_handler()
1195 QLCWRX(adapter->ahw, QLC_83XX_RECOVER_DRV_LOCK, 0); in qlcnic_83xx_idc_first_to_load_function_handler()
1198 return -EIO; in qlcnic_83xx_idc_first_to_load_function_handler()
1201 state = QLCRDX(adapter->ahw, QLC_83XX_IDC_DEV_STATE); in qlcnic_83xx_idc_first_to_load_function_handler()
1204 return -EIO; in qlcnic_83xx_idc_first_to_load_function_handler()
1208 QLCWRX(adapter->ahw, QLC_83XX_IDC_DEV_STATE, in qlcnic_83xx_idc_first_to_load_function_handler()
1213 adapter->ahw->idc.curr_state = state; in qlcnic_83xx_idc_first_to_load_function_handler()
1220 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL); in qlcnic_83xx_idc_first_to_load_function_handler()
1222 QLCWRX(adapter->ahw, QLC_83XX_IDC_CTRL, val); in qlcnic_83xx_idc_first_to_load_function_handler()
1232 int ret = -EIO; in qlcnic_83xx_idc_init()
1241 return -EIO; in qlcnic_83xx_idc_init()
1244 return -EIO; in qlcnic_83xx_idc_init()
1257 while (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state)) in qlcnic_83xx_idc_exit()
1260 id = QLCRDX(adapter->ahw, QLC_83XX_DRV_LOCK_ID); in qlcnic_83xx_idc_exit()
1263 if (id == adapter->portnum) { in qlcnic_83xx_idc_exit()
1264 dev_err(&adapter->pdev->dev, in qlcnic_83xx_idc_exit()
1267 id = QLCRDX(adapter->ahw, QLC_83XX_DRV_LOCK_ID); in qlcnic_83xx_idc_exit()
1272 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_DRV_PRESENCE); in qlcnic_83xx_idc_exit()
1273 val = val & ~(1 << adapter->portnum); in qlcnic_83xx_idc_exit()
1274 QLCWRX(adapter->ahw, QLC_83XX_IDC_DRV_PRESENCE, val); in qlcnic_83xx_idc_exit()
1275 clear_bit(QLC_83XX_MODULE_LOADED, &adapter->ahw->idc.status); in qlcnic_83xx_idc_exit()
1276 clear_bit(__QLCNIC_RESETTING, &adapter->state); in qlcnic_83xx_idc_exit()
1278 cancel_delayed_work_sync(&adapter->fw_work); in qlcnic_83xx_idc_exit()
1289 dev_err(&adapter->pdev->dev, in qlcnic_83xx_idc_request_reset()
1294 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL); in qlcnic_83xx_idc_request_reset()
1296 netdev_info(adapter->netdev, "%s: Auto firmware recovery is disabled\n", in qlcnic_83xx_idc_request_reset()
1304 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL); in qlcnic_83xx_idc_request_reset()
1306 QLCWRX(adapter->ahw, QLC_83XX_IDC_CTRL, val); in qlcnic_83xx_idc_request_reset()
1308 adapter->ahw->idc.collect_dump = 1; in qlcnic_83xx_idc_request_reset()
1320 int ret = -EIO; in qlcnic_83xx_copy_bootloader()
1323 dest = QLCRDX(adapter->ahw, QLCNIC_BOOTLOADER_ADDR); in qlcnic_83xx_copy_bootloader()
1324 size = QLCRDX(adapter->ahw, QLCNIC_BOOTLOADER_SIZE); in qlcnic_83xx_copy_bootloader()
1332 return -ENOMEM; in qlcnic_83xx_copy_bootloader()
1354 struct qlc_83xx_fw_info *fw_info = adapter->ahw->fw_info; in qlcnic_83xx_copy_fw_file()
1355 const struct firmware *fw = fw_info->fw; in qlcnic_83xx_copy_fw_file()
1363 temp = vzalloc(fw->size); in qlcnic_83xx_copy_fw_file()
1366 fw_info->fw = NULL; in qlcnic_83xx_copy_fw_file()
1367 return -ENOMEM; in qlcnic_83xx_copy_fw_file()
1370 temp_le = (__le32 *)fw->data; in qlcnic_83xx_copy_fw_file()
1375 for (i = 0; i < fw->size / sizeof(u32); i++) in qlcnic_83xx_copy_fw_file()
1378 dest = QLCRDX(adapter->ahw, QLCNIC_FW_IMAGE_ADDR); in qlcnic_83xx_copy_fw_file()
1379 size = (fw->size & ~0xF); in qlcnic_83xx_copy_fw_file()
1386 dev_err(&adapter->pdev->dev, "MS memory write failed\n"); in qlcnic_83xx_copy_fw_file()
1391 if (fw->size & 0xF) { in qlcnic_83xx_copy_fw_file()
1393 for (i = 0; i < (fw->size & 0xF); i++) in qlcnic_83xx_copy_fw_file()
1400 dev_err(&adapter->pdev->dev, in qlcnic_83xx_copy_fw_file()
1408 fw_info->fw = NULL; in qlcnic_83xx_copy_fw_file()
1421 if (err == -EIO) in qlcnic_83xx_dump_pause_control_regs()
1423 dev_info(&adapter->pdev->dev, "SRE-Shim Ctrl:0x%x\n", val); in qlcnic_83xx_dump_pause_control_regs()
1427 dev_info(&adapter->pdev->dev, in qlcnic_83xx_dump_pause_control_regs()
1431 dev_info(&adapter->pdev->dev, in qlcnic_83xx_dump_pause_control_regs()
1437 if (err == -EIO) in qlcnic_83xx_dump_pause_control_regs()
1439 dev_info(&adapter->pdev->dev, "0x%x ", val); in qlcnic_83xx_dump_pause_control_regs()
1441 dev_info(&adapter->pdev->dev, "\n"); in qlcnic_83xx_dump_pause_control_regs()
1446 dev_info(&adapter->pdev->dev, in qlcnic_83xx_dump_pause_control_regs()
1450 dev_info(&adapter->pdev->dev, in qlcnic_83xx_dump_pause_control_regs()
1456 if (err == -EIO) in qlcnic_83xx_dump_pause_control_regs()
1458 dev_info(&adapter->pdev->dev, "0x%x ", val); in qlcnic_83xx_dump_pause_control_regs()
1460 dev_info(&adapter->pdev->dev, "\n"); in qlcnic_83xx_dump_pause_control_regs()
1465 dev_info(&adapter->pdev->dev, in qlcnic_83xx_dump_pause_control_regs()
1469 dev_info(&adapter->pdev->dev, in qlcnic_83xx_dump_pause_control_regs()
1473 for (i = 7; i >= 0; i--) { in qlcnic_83xx_dump_pause_control_regs()
1475 if (err == -EIO) in qlcnic_83xx_dump_pause_control_regs()
1480 if (err == -EIO) in qlcnic_83xx_dump_pause_control_regs()
1482 dev_info(&adapter->pdev->dev, "0x%x ", val); in qlcnic_83xx_dump_pause_control_regs()
1484 dev_info(&adapter->pdev->dev, "\n"); in qlcnic_83xx_dump_pause_control_regs()
1488 if (err == -EIO) in qlcnic_83xx_dump_pause_control_regs()
1491 if (err == -EIO) in qlcnic_83xx_dump_pause_control_regs()
1493 dev_info(&adapter->pdev->dev, in qlcnic_83xx_dump_pause_control_regs()
1494 "IFB-Pause Thresholds: Port 2:0x%x, Port 3:0x%x\n", in qlcnic_83xx_dump_pause_control_regs()
1504 dev_err(&adapter->pdev->dev, in qlcnic_83xx_disable_pause_frames()
1534 dev_info(&adapter->pdev->dev, in qlcnic_83xx_disable_pause_frames()
1555 int retries, ret = -EIO, err = 0; in qlcnic_83xx_check_heartbeat()
1558 p_dev->heartbeat = QLC_SHARED_REG_RD32(p_dev, in qlcnic_83xx_check_heartbeat()
1565 if (heartbeat != p_dev->heartbeat) { in qlcnic_83xx_check_heartbeat()
1569 } while (--retries); in qlcnic_83xx_check_heartbeat()
1572 dev_err(&p_dev->pdev->dev, "firmware hang detected\n"); in qlcnic_83xx_check_heartbeat()
1577 dev_info(&p_dev->pdev->dev, "Dumping HW/FW registers\n" in qlcnic_83xx_check_heartbeat()
1590 dev_err(&p_dev->pdev->dev, in qlcnic_83xx_check_heartbeat()
1607 } while (--retries); in qlcnic_83xx_check_cmd_peg_status()
1609 dev_err(&p_dev->pdev->dev, "%s: failed, state = 0x%x\n", __func__, val); in qlcnic_83xx_check_cmd_peg_status()
1610 return -EIO; in qlcnic_83xx_check_cmd_peg_status()
1636 if (err == -EIO) in qlcnic_83xx_poll_reg()
1645 if (err == -EIO) in qlcnic_83xx_poll_reg()
1651 } while (retries--); in qlcnic_83xx_poll_reg()
1654 p_dev->ahw->reset.seq_error++; in qlcnic_83xx_poll_reg()
1655 dev_err(&p_dev->pdev->dev, in qlcnic_83xx_poll_reg()
1657 __func__, p_dev->ahw->reset.seq_index); in qlcnic_83xx_poll_reg()
1658 dev_err(&p_dev->pdev->dev, in qlcnic_83xx_poll_reg()
1669 u16 *buff = (u16 *)p_dev->ahw->reset.buff; in qlcnic_83xx_reset_template_checksum()
1670 int count = p_dev->ahw->reset.hdr->size / sizeof(u16); in qlcnic_83xx_reset_template_checksum()
1672 while (count-- > 0) in qlcnic_83xx_reset_template_checksum()
1681 dev_err(&p_dev->pdev->dev, "%s: failed\n", __func__); in qlcnic_83xx_reset_template_checksum()
1682 return -1; in qlcnic_83xx_reset_template_checksum()
1688 struct qlcnic_hardware_context *ahw = p_dev->ahw; in qlcnic_83xx_get_reset_instruction_template()
1692 if (ahw->reset.buff != NULL) { in qlcnic_83xx_get_reset_instruction_template()
1693 prev_ver = p_dev->fw_version; in qlcnic_83xx_get_reset_instruction_template()
1696 kfree(ahw->reset.buff); in qlcnic_83xx_get_reset_instruction_template()
1701 ahw->reset.seq_error = 0; in qlcnic_83xx_get_reset_instruction_template()
1702 ahw->reset.buff = kzalloc(QLC_83XX_RESTART_TEMPLATE_SIZE, GFP_KERNEL); in qlcnic_83xx_get_reset_instruction_template()
1703 if (ahw->reset.buff == NULL) in qlcnic_83xx_get_reset_instruction_template()
1704 return -ENOMEM; in qlcnic_83xx_get_reset_instruction_template()
1706 p_buff = p_dev->ahw->reset.buff; in qlcnic_83xx_get_reset_instruction_template()
1712 dev_err(&p_dev->pdev->dev, "%s: flash read failed\n", __func__); in qlcnic_83xx_get_reset_instruction_template()
1713 return -EIO; in qlcnic_83xx_get_reset_instruction_template()
1715 ahw->reset.hdr = (struct qlc_83xx_reset_hdr *)ahw->reset.buff; in qlcnic_83xx_get_reset_instruction_template()
1716 addr = QLC_83XX_RESET_TEMPLATE_ADDR + ahw->reset.hdr->hdr_size; in qlcnic_83xx_get_reset_instruction_template()
1717 p_buff = ahw->reset.buff + ahw->reset.hdr->hdr_size; in qlcnic_83xx_get_reset_instruction_template()
1718 count = (ahw->reset.hdr->size - ahw->reset.hdr->hdr_size) / sizeof(u32); in qlcnic_83xx_get_reset_instruction_template()
1722 dev_err(&p_dev->pdev->dev, "%s: flash read failed\n", __func__); in qlcnic_83xx_get_reset_instruction_template()
1723 return -EIO; in qlcnic_83xx_get_reset_instruction_template()
1727 return -EIO; in qlcnic_83xx_get_reset_instruction_template()
1729 ahw->reset.init_offset = ahw->reset.buff + ahw->reset.hdr->init_offset; in qlcnic_83xx_get_reset_instruction_template()
1730 ahw->reset.start_offset = ahw->reset.buff + in qlcnic_83xx_get_reset_instruction_template()
1731 ahw->reset.hdr->start_offset; in qlcnic_83xx_get_reset_instruction_template()
1732 ahw->reset.stop_offset = ahw->reset.buff + ahw->reset.hdr->hdr_size; in qlcnic_83xx_get_reset_instruction_template()
1744 if (err == -EIO) in qlcnic_83xx_read_write_crb_reg()
1757 if (p_rmw_hdr->index_a) { in qlcnic_83xx_rmw_crb_reg()
1758 value = p_dev->ahw->reset.array[p_rmw_hdr->index_a]; in qlcnic_83xx_rmw_crb_reg()
1761 if (err == -EIO) in qlcnic_83xx_rmw_crb_reg()
1765 value &= p_rmw_hdr->mask; in qlcnic_83xx_rmw_crb_reg()
1766 value <<= p_rmw_hdr->shl; in qlcnic_83xx_rmw_crb_reg()
1767 value >>= p_rmw_hdr->shr; in qlcnic_83xx_rmw_crb_reg()
1768 value |= p_rmw_hdr->or_value; in qlcnic_83xx_rmw_crb_reg()
1769 value ^= p_rmw_hdr->xor_value; in qlcnic_83xx_rmw_crb_reg()
1783 for (i = 0; i < p_hdr->count; i++, entry++) { in qlcnic_83xx_write_list()
1784 qlcnic_83xx_wrt_reg_indirect(p_dev, entry->arg1, in qlcnic_83xx_write_list()
1785 entry->arg2); in qlcnic_83xx_write_list()
1786 if (p_hdr->delay) in qlcnic_83xx_write_list()
1787 udelay((u32)(p_hdr->delay)); in qlcnic_83xx_write_list()
1801 for (i = 0; i < p_hdr->count; i++, entry++) { in qlcnic_83xx_read_write_list()
1802 qlcnic_83xx_read_write_crb_reg(p_dev, entry->arg1, in qlcnic_83xx_read_write_list()
1803 entry->arg2); in qlcnic_83xx_read_write_list()
1804 if (p_hdr->delay) in qlcnic_83xx_read_write_list()
1805 udelay((u32)(p_hdr->delay)); in qlcnic_83xx_read_write_list()
1813 long delay; in qlcnic_83xx_poll_list() local
1824 delay = (long)p_hdr->delay; in qlcnic_83xx_poll_list()
1826 if (!delay) { in qlcnic_83xx_poll_list()
1827 for (i = 0; i < p_hdr->count; i++, entry++) in qlcnic_83xx_poll_list()
1828 qlcnic_83xx_poll_reg(p_dev, entry->arg1, in qlcnic_83xx_poll_list()
1829 delay, poll->mask, in qlcnic_83xx_poll_list()
1830 poll->status); in qlcnic_83xx_poll_list()
1832 for (i = 0; i < p_hdr->count; i++, entry++) { in qlcnic_83xx_poll_list()
1833 arg1 = entry->arg1; in qlcnic_83xx_poll_list()
1834 arg2 = entry->arg2; in qlcnic_83xx_poll_list()
1835 if (delay) { in qlcnic_83xx_poll_list()
1837 arg1, delay, in qlcnic_83xx_poll_list()
1838 poll->mask, in qlcnic_83xx_poll_list()
1839 poll->status)){ in qlcnic_83xx_poll_list()
1841 if (err == -EIO) in qlcnic_83xx_poll_list()
1844 if (err == -EIO) in qlcnic_83xx_poll_list()
1857 long delay; in qlcnic_83xx_poll_write_list() local
1865 delay = (long)p_hdr->delay; in qlcnic_83xx_poll_write_list()
1867 for (i = 0; i < p_hdr->count; i++, entry++) { in qlcnic_83xx_poll_write_list()
1868 qlcnic_83xx_wrt_reg_indirect(p_dev, entry->dr_addr, in qlcnic_83xx_poll_write_list()
1869 entry->dr_value); in qlcnic_83xx_poll_write_list()
1870 qlcnic_83xx_wrt_reg_indirect(p_dev, entry->ar_addr, in qlcnic_83xx_poll_write_list()
1871 entry->ar_value); in qlcnic_83xx_poll_write_list()
1872 if (delay) in qlcnic_83xx_poll_write_list()
1873 qlcnic_83xx_poll_reg(p_dev, entry->ar_addr, delay, in qlcnic_83xx_poll_write_list()
1874 poll->mask, poll->status); in qlcnic_83xx_poll_write_list()
1892 for (i = 0; i < p_hdr->count; i++, entry++) { in qlcnic_83xx_read_modify_write()
1893 qlcnic_83xx_rmw_crb_reg(p_dev, entry->arg1, in qlcnic_83xx_read_modify_write()
1894 entry->arg2, rmw_hdr); in qlcnic_83xx_read_modify_write()
1895 if (p_hdr->delay) in qlcnic_83xx_read_modify_write()
1896 udelay((u32)(p_hdr->delay)); in qlcnic_83xx_read_modify_write()
1902 if (p_hdr->delay) in qlcnic_83xx_pause()
1903 mdelay((u32)((long)p_hdr->delay)); in qlcnic_83xx_pause()
1910 long delay; in qlcnic_83xx_poll_read_list() local
1921 delay = (long)p_hdr->delay; in qlcnic_83xx_poll_read_list()
1923 for (i = 0; i < p_hdr->count; i++, entry++) { in qlcnic_83xx_poll_read_list()
1924 qlcnic_83xx_wrt_reg_indirect(p_dev, entry->ar_addr, in qlcnic_83xx_poll_read_list()
1925 entry->ar_value); in qlcnic_83xx_poll_read_list()
1926 if (delay) { in qlcnic_83xx_poll_read_list()
1927 if (!qlcnic_83xx_poll_reg(p_dev, entry->ar_addr, delay, in qlcnic_83xx_poll_read_list()
1928 poll->mask, poll->status)){ in qlcnic_83xx_poll_read_list()
1929 index = p_dev->ahw->reset.array_index; in qlcnic_83xx_poll_read_list()
1930 addr = entry->dr_addr; in qlcnic_83xx_poll_read_list()
1932 if (err == -EIO) in qlcnic_83xx_poll_read_list()
1935 p_dev->ahw->reset.array[index++] = j; in qlcnic_83xx_poll_read_list()
1938 p_dev->ahw->reset.array_index = 1; in qlcnic_83xx_poll_read_list()
1946 p_dev->ahw->reset.seq_end = 1; in qlcnic_83xx_seq_end()
1951 p_dev->ahw->reset.template_end = 1; in qlcnic_83xx_template_end()
1952 if (p_dev->ahw->reset.seq_error == 0) in qlcnic_83xx_template_end()
1953 dev_err(&p_dev->pdev->dev, in qlcnic_83xx_template_end()
1956 dev_err(&p_dev->pdev->dev, in qlcnic_83xx_template_end()
1970 * flash and executes the instructions located at pre-defined offsets.
1981 p_dev->ahw->reset.seq_end = 0; in qlcnic_83xx_exec_template_cmd()
1982 p_dev->ahw->reset.template_end = 0; in qlcnic_83xx_exec_template_cmd()
1983 entries = p_dev->ahw->reset.hdr->entries; in qlcnic_83xx_exec_template_cmd()
1984 index = p_dev->ahw->reset.seq_index; in qlcnic_83xx_exec_template_cmd()
1986 for (; (!p_dev->ahw->reset.seq_end) && (index < entries); index++) { in qlcnic_83xx_exec_template_cmd()
1989 switch (p_hdr->cmd) { in qlcnic_83xx_exec_template_cmd()
2020 dev_err(&p_dev->pdev->dev, in qlcnic_83xx_exec_template_cmd()
2022 __func__, p_hdr->cmd, index); in qlcnic_83xx_exec_template_cmd()
2025 entry += p_hdr->size; in qlcnic_83xx_exec_template_cmd()
2028 p_dev->ahw->reset.seq_index = index; in qlcnic_83xx_exec_template_cmd()
2033 p_dev->ahw->reset.seq_index = 0; in qlcnic_83xx_stop_hw()
2035 qlcnic_83xx_exec_template_cmd(p_dev, p_dev->ahw->reset.stop_offset); in qlcnic_83xx_stop_hw()
2036 if (p_dev->ahw->reset.seq_end != 1) in qlcnic_83xx_stop_hw()
2037 dev_err(&p_dev->pdev->dev, "%s: failed\n", __func__); in qlcnic_83xx_stop_hw()
2042 qlcnic_83xx_exec_template_cmd(p_dev, p_dev->ahw->reset.start_offset); in qlcnic_83xx_start_hw()
2043 if (p_dev->ahw->reset.template_end != 1) in qlcnic_83xx_start_hw()
2044 dev_err(&p_dev->pdev->dev, "%s: failed\n", __func__); in qlcnic_83xx_start_hw()
2049 qlcnic_83xx_exec_template_cmd(p_dev, p_dev->ahw->reset.init_offset); in qlcnic_83xx_init_hw()
2050 if (p_dev->ahw->reset.seq_end != 1) in qlcnic_83xx_init_hw()
2051 dev_err(&p_dev->pdev->dev, "%s: failed\n", __func__); in qlcnic_83xx_init_hw()
2054 /* POST FW related definations*/
2061 /* POST Timeout values in milliseconds */
2066 /* POST result values */
2075 struct qlc_83xx_fw_info *fw_info = adapter->ahw->fw_info; in qlcnic_83xx_run_post()
2076 struct device *dev = &adapter->pdev->dev; in qlcnic_83xx_run_post()
2081 switch (adapter->ahw->post_mode) { in qlcnic_83xx_run_post()
2092 return -EINVAL; in qlcnic_83xx_run_post()
2095 strscpy(fw_info->fw_file_name, QLC_83XX_POST_FW_FILE_NAME, in qlcnic_83xx_run_post()
2096 sizeof(fw_info->fw_file_name)); in qlcnic_83xx_run_post()
2098 ret = request_firmware(&fw_info->fw, fw_info->fw_file_name, dev); in qlcnic_83xx_run_post()
2100 dev_err(dev, "POST firmware can not be loaded, skipping POST\n"); in qlcnic_83xx_run_post()
2111 /* Set POST mode */ in qlcnic_83xx_run_post()
2113 adapter->ahw->post_mode); in qlcnic_83xx_run_post()
2131 dev_err(dev, "POST timed out, signature = 0x%08x\n", signature); in qlcnic_83xx_run_post()
2132 return -EIO; in qlcnic_83xx_run_post()
2137 dev_info(dev, "POST passed, Signature = 0x%08x\n", signature); in qlcnic_83xx_run_post()
2140 dev_err(dev, "POST failed, Test case : ASIC STRESS TEST, Signature = 0x%08x\n", in qlcnic_83xx_run_post()
2142 ret = -EIO; in qlcnic_83xx_run_post()
2145 dev_err(dev, "POST failed, Test case : DDT TEST, Signature = 0x%08x\n", in qlcnic_83xx_run_post()
2147 ret = -EIO; in qlcnic_83xx_run_post()
2150 dev_err(dev, "POST failed, Test case : ASIC MEMORY TEST, Signature = 0x%08x\n", in qlcnic_83xx_run_post()
2152 ret = -EIO; in qlcnic_83xx_run_post()
2155 dev_err(dev, "POST failed, Test case : FLASH TEST, Signature = 0x%08x\n", in qlcnic_83xx_run_post()
2157 ret = -EIO; in qlcnic_83xx_run_post()
2160 dev_err(dev, "POST failed, Test case : INVALID, Signature = 0x%08x\n", in qlcnic_83xx_run_post()
2162 ret = -EIO; in qlcnic_83xx_run_post()
2171 struct qlc_83xx_fw_info *fw_info = adapter->ahw->fw_info; in qlcnic_83xx_load_fw_image_from_host()
2172 int err = -EIO; in qlcnic_83xx_load_fw_image_from_host()
2174 if (request_firmware(&fw_info->fw, fw_info->fw_file_name, in qlcnic_83xx_load_fw_image_from_host()
2175 &(adapter->pdev->dev))) { in qlcnic_83xx_load_fw_image_from_host()
2176 dev_err(&adapter->pdev->dev, in qlcnic_83xx_load_fw_image_from_host()
2193 int err = -EIO; in qlcnic_83xx_restart_hw()
2198 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL); in qlcnic_83xx_restart_hw()
2203 netdev_info(adapter->netdev, "%s: Auto firmware recovery is disabled\n", in qlcnic_83xx_restart_hw()
2214 /* Check if POST needs to be run */ in qlcnic_83xx_restart_hw()
2215 if (adapter->ahw->run_post) { in qlcnic_83xx_restart_hw()
2220 /* No need to run POST in next reset sequence */ in qlcnic_83xx_restart_hw()
2221 adapter->ahw->run_post = false; in qlcnic_83xx_restart_hw()
2244 return -EIO; in qlcnic_83xx_restart_hw()
2253 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_get_nic_configuration()
2256 err = qlcnic_get_nic_info(adapter, &nic_info, ahw->pci_func); in qlcnic_83xx_get_nic_configuration()
2258 return -EIO; in qlcnic_83xx_get_nic_configuration()
2260 ahw->physical_port = (u8) nic_info.phys_port; in qlcnic_83xx_get_nic_configuration()
2261 ahw->switch_mode = nic_info.switch_mode; in qlcnic_83xx_get_nic_configuration()
2262 ahw->max_tx_ques = nic_info.max_tx_ques; in qlcnic_83xx_get_nic_configuration()
2263 ahw->max_rx_ques = nic_info.max_rx_ques; in qlcnic_83xx_get_nic_configuration()
2264 ahw->capabilities = nic_info.capabilities; in qlcnic_83xx_get_nic_configuration()
2265 ahw->max_mac_filters = nic_info.max_mac_filters; in qlcnic_83xx_get_nic_configuration()
2266 ahw->max_mtu = nic_info.max_mtu; in qlcnic_83xx_get_nic_configuration()
2270 * If SR-IOV capability is detected, SR-IOV physical function in qlcnic_83xx_get_nic_configuration()
2272 * SR-IOV virtual function initialization follows a in qlcnic_83xx_get_nic_configuration()
2276 if (test_bit(__QLCNIC_SRIOV_CAPABLE, &adapter->state)) in qlcnic_83xx_get_nic_configuration()
2279 if (ahw->capabilities & QLC_83XX_ESWITCH_CAPABILITY) in qlcnic_83xx_get_nic_configuration()
2287 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_configure_opmode()
2292 if (ret == -EIO) in qlcnic_83xx_configure_opmode()
2293 return -EIO; in qlcnic_83xx_configure_opmode()
2296 ahw->nic_mode = QLCNIC_VNIC_MODE; in qlcnic_83xx_configure_opmode()
2299 return -EIO; in qlcnic_83xx_configure_opmode()
2304 ahw->nic_mode = QLCNIC_DEFAULT_MODE; in qlcnic_83xx_configure_opmode()
2305 adapter->nic_ops->init_driver = qlcnic_83xx_init_default_driver; in qlcnic_83xx_configure_opmode()
2306 ahw->idc.state_entry = qlcnic_83xx_idc_ready_state_entry; in qlcnic_83xx_configure_opmode()
2310 dev_err(&adapter->pdev->dev, "%s: Invalid opmode %d\n", in qlcnic_83xx_configure_opmode()
2312 return -EIO; in qlcnic_83xx_configure_opmode()
2315 adapter->max_sds_rings = min(ahw->max_rx_ques, max_sds_rings); in qlcnic_83xx_configure_opmode()
2316 adapter->max_tx_rings = min(ahw->max_tx_ques, max_tx_rings); in qlcnic_83xx_configure_opmode()
2323 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_config_buff_descriptors()
2325 if (ahw->port_type == QLCNIC_XGBE) { in qlcnic_83xx_config_buff_descriptors()
2326 adapter->num_rxd = DEFAULT_RCV_DESCRIPTORS_10G; in qlcnic_83xx_config_buff_descriptors()
2327 adapter->max_rxd = MAX_RCV_DESCRIPTORS_10G; in qlcnic_83xx_config_buff_descriptors()
2328 adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_10G; in qlcnic_83xx_config_buff_descriptors()
2329 adapter->max_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_10G; in qlcnic_83xx_config_buff_descriptors()
2331 } else if (ahw->port_type == QLCNIC_GBE) { in qlcnic_83xx_config_buff_descriptors()
2332 adapter->num_rxd = DEFAULT_RCV_DESCRIPTORS_1G; in qlcnic_83xx_config_buff_descriptors()
2333 adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_1G; in qlcnic_83xx_config_buff_descriptors()
2334 adapter->max_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_1G; in qlcnic_83xx_config_buff_descriptors()
2335 adapter->max_rxd = MAX_RCV_DESCRIPTORS_1G; in qlcnic_83xx_config_buff_descriptors()
2337 adapter->num_txd = MAX_CMD_DESCRIPTORS; in qlcnic_83xx_config_buff_descriptors()
2338 adapter->max_rds_rings = MAX_RDS_RINGS; in qlcnic_83xx_config_buff_descriptors()
2343 int err = -EIO; in qlcnic_83xx_init_default_driver()
2350 adapter->ahw->msix_supported = !!qlcnic_use_msi_x; in qlcnic_83xx_init_default_driver()
2351 adapter->flags |= QLCNIC_ADAPTER_INITIALIZED; in qlcnic_83xx_init_default_driver()
2353 dev_info(&adapter->pdev->dev, "HAL Version: %d\n", in qlcnic_83xx_init_default_driver()
2354 adapter->ahw->fw_hal_version); in qlcnic_83xx_init_default_driver()
2359 #define IS_QLC_83XX_USED(a, b, c) (((1 << a->portnum) & b) || ((c >> 6) & 0x1))
2366 presence_mask = QLCRDX(adapter->ahw, QLC_83XX_IDC_DRV_PRESENCE); in qlcnic_83xx_clear_function_resources()
2367 audit_mask = QLCRDX(adapter->ahw, QLC_83XX_IDC_DRV_AUDIT); in qlcnic_83xx_clear_function_resources()
2378 dev_err(&adapter->pdev->dev, in qlcnic_83xx_clear_function_resources()
2386 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_get_fw_info()
2387 struct pci_dev *pdev = adapter->pdev; in qlcnic_83xx_get_fw_info()
2391 ahw->fw_info = kzalloc(sizeof(*fw_info), GFP_KERNEL); in qlcnic_83xx_get_fw_info()
2392 if (!ahw->fw_info) { in qlcnic_83xx_get_fw_info()
2393 err = -ENOMEM; in qlcnic_83xx_get_fw_info()
2395 fw_info = ahw->fw_info; in qlcnic_83xx_get_fw_info()
2396 switch (pdev->device) { in qlcnic_83xx_get_fw_info()
2399 strscpy(fw_info->fw_file_name, QLC_83XX_FW_FILE_NAME, in qlcnic_83xx_get_fw_info()
2400 sizeof(fw_info->fw_file_name)); in qlcnic_83xx_get_fw_info()
2403 strscpy(fw_info->fw_file_name, QLC_84XX_FW_FILE_NAME, in qlcnic_83xx_get_fw_info()
2404 sizeof(fw_info->fw_file_name)); in qlcnic_83xx_get_fw_info()
2407 dev_err(&pdev->dev, "%s: Invalid device id\n", in qlcnic_83xx_get_fw_info()
2409 err = -EINVAL; in qlcnic_83xx_get_fw_info()
2422 adapter->max_tx_rings = QLCNIC_MAX_TX_RINGS; in qlcnic_83xx_init_rings()
2423 adapter->max_sds_rings = QLCNIC_MAX_SDS_RINGS; in qlcnic_83xx_init_rings()
2425 if (!adapter->ahw->msix_supported) { in qlcnic_83xx_init_rings()
2437 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_init()
2440 adapter->rx_mac_learn = false; in qlcnic_83xx_init()
2441 ahw->msix_supported = !!qlcnic_use_msi_x; in qlcnic_83xx_init()
2443 /* Check if POST needs to be run */ in qlcnic_83xx_init()
2446 ahw->post_mode = QLC_83XX_POST_FAST_MODE; in qlcnic_83xx_init()
2447 ahw->run_post = true; in qlcnic_83xx_init()
2450 ahw->post_mode = QLC_83XX_POST_MEDIUM_MODE; in qlcnic_83xx_init()
2451 ahw->run_post = true; in qlcnic_83xx_init()
2454 ahw->post_mode = QLC_83XX_POST_SLOW_MODE; in qlcnic_83xx_init()
2455 ahw->run_post = true; in qlcnic_83xx_init()
2458 ahw->run_post = false; in qlcnic_83xx_init()
2478 dev_err(&adapter->pdev->dev, "Failed reading flash mfg id\n"); in qlcnic_83xx_init()
2479 err = -ENOTRECOVERABLE; in qlcnic_83xx_init()
2497 dev_err(&adapter->pdev->dev, "Failed to setup interrupt\n"); in qlcnic_83xx_init()
2501 INIT_DELAYED_WORK(&adapter->idc_aen_work, qlcnic_83xx_idc_aen_work); in qlcnic_83xx_init()
2509 err = qlcnic_dcb_enable(adapter->dcb); in qlcnic_83xx_init()
2511 qlcnic_dcb_free(adapter->dcb); in qlcnic_83xx_init()
2516 qlcnic_dcb_get_info(adapter->dcb); in qlcnic_83xx_init()
2518 /* Configure default, SR-IOV or Virtual NIC mode of operation */ in qlcnic_83xx_init()
2525 err = adapter->nic_ops->init_driver(adapter); in qlcnic_83xx_init()
2530 qlcnic_83xx_idc_poll_dev_state(&adapter->fw_work.work); in qlcnic_83xx_init()
2541 qlcnic_83xx_free_mailbox(ahw->mailbox); in qlcnic_83xx_init()
2542 ahw->mailbox = NULL; in qlcnic_83xx_init()
2549 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_aer_stop_poll_work()
2550 struct qlc_83xx_idc *idc = &ahw->idc; in qlcnic_83xx_aer_stop_poll_work()
2552 clear_bit(QLC_83XX_MBX_READY, &idc->status); in qlcnic_83xx_aer_stop_poll_work()
2553 cancel_delayed_work_sync(&adapter->fw_work); in qlcnic_83xx_aer_stop_poll_work()
2555 if (ahw->nic_mode == QLCNIC_VNIC_MODE) in qlcnic_83xx_aer_stop_poll_work()
2561 cancel_delayed_work_sync(&adapter->idc_aen_work); in qlcnic_83xx_aer_stop_poll_work()
2566 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_aer_reset()
2567 struct qlc_83xx_idc *idc = &ahw->idc; in qlcnic_83xx_aer_reset()
2575 idc->prev_state = QLC_83XX_IDC_DEV_NEED_RESET; in qlcnic_83xx_aer_reset()
2577 if (ahw->pci_func == owner) { in qlcnic_83xx_aer_reset()
2584 ret = idc->state_entry(adapter); in qlcnic_83xx_aer_reset()
2590 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_aer_start_poll_work()
2591 struct qlc_83xx_idc *idc = &ahw->idc; in qlcnic_83xx_aer_start_poll_work()
2594 idc->prev_state = QLC_83XX_IDC_DEV_READY; in qlcnic_83xx_aer_start_poll_work()
2596 if (ahw->pci_func == owner) in qlcnic_83xx_aer_start_poll_work()