Lines Matching refs:adapter
38 static int qlcnic_83xx_init_default_driver(struct qlcnic_adapter *adapter);
40 static int qlcnic_83xx_restart_hw(struct qlcnic_adapter *adapter);
132 qlcnic_83xx_idc_check_driver_presence_reg(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_check_driver_presence_reg() argument
136 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_DRV_PRESENCE); in qlcnic_83xx_idc_check_driver_presence_reg()
143 static void qlcnic_83xx_idc_log_state_history(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_log_state_history() argument
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()
155 static int qlcnic_83xx_idc_update_audit_reg(struct qlcnic_adapter *adapter, in qlcnic_83xx_idc_update_audit_reg() argument
162 if (qlcnic_83xx_lock_driver(adapter)) 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()
179 qlcnic_83xx_unlock_driver(adapter); in qlcnic_83xx_idc_update_audit_reg()
184 static void qlcnic_83xx_idc_update_minor_version(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_update_minor_version() argument
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()
194 static int qlcnic_83xx_idc_update_major_version(struct qlcnic_adapter *adapter, in qlcnic_83xx_idc_update_major_version() argument
200 if (qlcnic_83xx_lock_driver(adapter)) 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()
210 qlcnic_83xx_unlock_driver(adapter); in qlcnic_83xx_idc_update_major_version()
216 qlcnic_83xx_idc_update_drv_presence_reg(struct qlcnic_adapter *adapter, in qlcnic_83xx_idc_update_drv_presence_reg() argument
222 if (qlcnic_83xx_lock_driver(adapter)) 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()
234 qlcnic_83xx_idc_update_minor_version(adapter); in qlcnic_83xx_idc_update_drv_presence_reg()
237 qlcnic_83xx_unlock_driver(adapter); in qlcnic_83xx_idc_update_drv_presence_reg()
242 static int qlcnic_83xx_idc_check_major_version(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_check_major_version() argument
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()
260 static int qlcnic_83xx_idc_clear_registers(struct qlcnic_adapter *adapter, in qlcnic_83xx_idc_clear_registers() argument
266 if (qlcnic_83xx_lock_driver(adapter)) 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()
277 qlcnic_83xx_unlock_driver(adapter); in qlcnic_83xx_idc_clear_registers()
282 static int qlcnic_83xx_idc_update_drv_ack_reg(struct qlcnic_adapter *adapter, in qlcnic_83xx_idc_update_drv_ack_reg() argument
288 if (qlcnic_83xx_lock_driver(adapter)) 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()
300 qlcnic_83xx_unlock_driver(adapter); in qlcnic_83xx_idc_update_drv_ack_reg()
305 static int qlcnic_83xx_idc_check_timeout(struct qlcnic_adapter *adapter, in qlcnic_83xx_idc_check_timeout() argument
310 seconds = jiffies / HZ - adapter->ahw->idc.sec_counter; in qlcnic_83xx_idc_check_timeout()
326 static int qlcnic_83xx_idc_check_reset_ack_reg(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_check_reset_ack_reg() argument
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()
337 if (qlcnic_83xx_idc_check_timeout(adapter, timeout)) { 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()
343 if (qlcnic_83xx_lock_driver(adapter)) 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()
349 qlcnic_83xx_unlock_driver(adapter); in qlcnic_83xx_idc_check_reset_ack_reg()
356 dev_info(&adapter->pdev->dev, in qlcnic_83xx_idc_check_reset_ack_reg()
373 static int qlcnic_83xx_idc_tx_soft_reset(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_tx_soft_reset() argument
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()
381 qlcnic_down(adapter, netdev); in qlcnic_83xx_idc_tx_soft_reset()
382 qlcnic_up(adapter, netdev); 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()
398 static void qlcnic_83xx_idc_detach_driver(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_detach_driver() argument
401 struct net_device *netdev = adapter->netdev; in qlcnic_83xx_idc_detach_driver()
404 qlcnic_83xx_detach_mailbox_work(adapter); in qlcnic_83xx_idc_detach_driver()
407 qlcnic_83xx_disable_mbx_intr(adapter); in qlcnic_83xx_idc_detach_driver()
408 qlcnic_down(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()
415 if (qlcnic_sriov_pf_check(adapter)) in qlcnic_83xx_idc_detach_driver()
416 qlcnic_sriov_pf_reset(adapter); in qlcnic_83xx_idc_detach_driver()
428 static void qlcnic_83xx_idc_attach_driver(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_attach_driver() argument
430 struct net_device *netdev = adapter->netdev; in qlcnic_83xx_idc_attach_driver()
433 if (qlcnic_up(adapter, netdev)) in qlcnic_83xx_idc_attach_driver()
441 static int qlcnic_83xx_idc_enter_failed_state(struct qlcnic_adapter *adapter, in qlcnic_83xx_idc_enter_failed_state() argument
445 if (qlcnic_83xx_lock_driver(adapter)) in qlcnic_83xx_idc_enter_failed_state()
449 qlcnic_83xx_idc_clear_registers(adapter, 0); 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()
452 qlcnic_83xx_unlock_driver(adapter); in qlcnic_83xx_idc_enter_failed_state()
454 qlcnic_83xx_idc_log_state_history(adapter); 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()
460 static int qlcnic_83xx_idc_enter_init_state(struct qlcnic_adapter *adapter, in qlcnic_83xx_idc_enter_init_state() argument
464 if (qlcnic_83xx_lock_driver(adapter)) 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()
471 qlcnic_83xx_unlock_driver(adapter); in qlcnic_83xx_idc_enter_init_state()
476 static int qlcnic_83xx_idc_enter_need_quiesce(struct qlcnic_adapter *adapter, in qlcnic_83xx_idc_enter_need_quiesce() argument
480 if (qlcnic_83xx_lock_driver(adapter)) in qlcnic_83xx_idc_enter_need_quiesce()
484 QLCWRX(adapter->ahw, QLC_83XX_IDC_DEV_STATE, in qlcnic_83xx_idc_enter_need_quiesce()
488 qlcnic_83xx_unlock_driver(adapter); in qlcnic_83xx_idc_enter_need_quiesce()
494 qlcnic_83xx_idc_enter_need_reset_state(struct qlcnic_adapter *adapter, int lock) in qlcnic_83xx_idc_enter_need_reset_state() argument
497 if (qlcnic_83xx_lock_driver(adapter)) 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()
505 qlcnic_83xx_unlock_driver(adapter); in qlcnic_83xx_idc_enter_need_reset_state()
510 static int qlcnic_83xx_idc_enter_ready_state(struct qlcnic_adapter *adapter, in qlcnic_83xx_idc_enter_ready_state() argument
514 if (qlcnic_83xx_lock_driver(adapter)) 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()
520 qlcnic_83xx_unlock_driver(adapter); in qlcnic_83xx_idc_enter_ready_state()
536 static int qlcnic_83xx_idc_find_reset_owner_id(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_find_reset_owner_id() argument
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()
574 static int qlcnic_83xx_idc_restart_hw(struct qlcnic_adapter *adapter, int lock) in qlcnic_83xx_idc_restart_hw() argument
578 ret = qlcnic_83xx_restart_hw(adapter); in qlcnic_83xx_idc_restart_hw()
581 qlcnic_83xx_idc_enter_failed_state(adapter, lock); in qlcnic_83xx_idc_restart_hw()
583 qlcnic_83xx_idc_clear_registers(adapter, lock); in qlcnic_83xx_idc_restart_hw()
584 ret = qlcnic_83xx_idc_enter_ready_state(adapter, lock); in qlcnic_83xx_idc_restart_hw()
590 static int qlcnic_83xx_idc_check_fan_failure(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_check_fan_failure() argument
594 status = QLC_SHARED_REG_RD32(adapter, QLCNIC_PEG_HALT_STATUS1); in qlcnic_83xx_idc_check_fan_failure()
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()
612 int qlcnic_83xx_idc_reattach_driver(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_reattach_driver() argument
616 qlcnic_83xx_reinit_mbx_work(adapter->ahw->mailbox); in qlcnic_83xx_idc_reattach_driver()
617 qlcnic_83xx_enable_mbx_interrupt(adapter); in qlcnic_83xx_idc_reattach_driver()
619 qlcnic_83xx_initialize_nic(adapter, 1); in qlcnic_83xx_idc_reattach_driver()
621 err = qlcnic_sriov_pf_reinit(adapter); in qlcnic_83xx_idc_reattach_driver()
625 qlcnic_83xx_enable_mbx_interrupt(adapter); in qlcnic_83xx_idc_reattach_driver()
627 if (qlcnic_83xx_configure_opmode(adapter)) { in qlcnic_83xx_idc_reattach_driver()
628 qlcnic_83xx_idc_enter_failed_state(adapter, 1); in qlcnic_83xx_idc_reattach_driver()
632 if (adapter->nic_ops->init_driver(adapter)) { in qlcnic_83xx_idc_reattach_driver()
633 qlcnic_83xx_idc_enter_failed_state(adapter, 1); in qlcnic_83xx_idc_reattach_driver()
637 if (adapter->portnum == 0) in qlcnic_83xx_idc_reattach_driver()
638 qlcnic_set_drv_version(adapter); in qlcnic_83xx_idc_reattach_driver()
640 qlcnic_dcb_get_info(adapter->dcb); in qlcnic_83xx_idc_reattach_driver()
641 qlcnic_83xx_idc_attach_driver(adapter); in qlcnic_83xx_idc_reattach_driver()
646 static void qlcnic_83xx_idc_update_idc_params(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_update_idc_params() argument
648 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_idc_update_idc_params()
650 qlcnic_83xx_idc_update_drv_presence_reg(adapter, 1, 1); in qlcnic_83xx_idc_update_idc_params()
651 qlcnic_83xx_idc_update_audit_reg(adapter, 0, 1); 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()
659 adapter->tx_timeo_cnt = 0; in qlcnic_83xx_idc_update_idc_params()
662 clear_bit(__QLCNIC_RESETTING, &adapter->state); in qlcnic_83xx_idc_update_idc_params()
676 int qlcnic_83xx_idc_ready_state_entry(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_ready_state_entry() argument
678 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_idc_ready_state_entry()
681 qlcnic_83xx_idc_update_idc_params(adapter); in qlcnic_83xx_idc_ready_state_entry()
685 if (qlcnic_83xx_idc_reattach_driver(adapter)) in qlcnic_83xx_idc_ready_state_entry()
705 int qlcnic_83xx_idc_vnic_pf_entry(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_vnic_pf_entry() argument
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()
714 qlcnic_83xx_idc_enter_failed_state(adapter, 1); in qlcnic_83xx_idc_vnic_pf_entry()
717 dev_info(&adapter->pdev->dev, "vNIC mode disabled\n"); in qlcnic_83xx_idc_vnic_pf_entry()
723 qlcnic_83xx_idc_update_idc_params(adapter); in qlcnic_83xx_idc_vnic_pf_entry()
728 if (qlcnic_83xx_idc_reattach_driver(adapter)) 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()
739 static int qlcnic_83xx_idc_unknown_state(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_unknown_state() argument
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()
760 static int qlcnic_83xx_idc_cold_state_handler(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_cold_state_handler() argument
762 qlcnic_83xx_idc_update_drv_presence_reg(adapter, 1, 0); in qlcnic_83xx_idc_cold_state_handler()
763 qlcnic_83xx_idc_update_audit_reg(adapter, 1, 0); in qlcnic_83xx_idc_cold_state_handler()
766 qlcnic_83xx_idc_restart_hw(adapter, 0); in qlcnic_83xx_idc_cold_state_handler()
768 if (qlcnic_83xx_check_hw_status(adapter)) { in qlcnic_83xx_idc_cold_state_handler()
769 qlcnic_83xx_idc_enter_failed_state(adapter, 0); in qlcnic_83xx_idc_cold_state_handler()
772 qlcnic_83xx_idc_enter_ready_state(adapter, 0); in qlcnic_83xx_idc_cold_state_handler()
790 static int qlcnic_83xx_idc_init_state(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_init_state() argument
796 if (adapter->ahw->idc.prev_state == QLC_83XX_IDC_DEV_NEED_RESET) { in qlcnic_83xx_idc_init_state()
797 owner = qlcnic_83xx_idc_find_reset_owner_id(adapter); in qlcnic_83xx_idc_init_state()
798 if (adapter->ahw->pci_func == owner) in qlcnic_83xx_idc_init_state()
799 ret = qlcnic_83xx_idc_restart_hw(adapter, 1); in qlcnic_83xx_idc_init_state()
801 ret = qlcnic_83xx_idc_check_timeout(adapter, timeout); in qlcnic_83xx_idc_init_state()
818 static int qlcnic_83xx_idc_ready_state(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_ready_state() argument
820 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_idc_ready_state()
826 if (ahw->idc.state_entry(adapter)) in qlcnic_83xx_idc_ready_state()
829 if (qlcnic_check_temp(adapter)) { in qlcnic_83xx_idc_ready_state()
831 qlcnic_83xx_idc_check_fan_failure(adapter); 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()
836 set_bit(__QLCNIC_RESETTING, &adapter->state); in qlcnic_83xx_idc_ready_state()
837 qlcnic_83xx_idc_detach_driver(adapter); in qlcnic_83xx_idc_ready_state()
838 qlcnic_83xx_idc_enter_failed_state(adapter, 1); in qlcnic_83xx_idc_ready_state()
843 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL); in qlcnic_83xx_idc_ready_state()
844 ret = qlcnic_83xx_check_heartbeat(adapter); in qlcnic_83xx_idc_ready_state()
846 adapter->flags |= QLCNIC_FW_HANG; in qlcnic_83xx_idc_ready_state()
849 set_bit(__QLCNIC_RESETTING, &adapter->state); in qlcnic_83xx_idc_ready_state()
850 qlcnic_83xx_idc_enter_need_reset_state(adapter, 1); in qlcnic_83xx_idc_ready_state()
852 netdev_info(adapter->netdev, "%s: Auto firmware recovery is disabled\n", in qlcnic_83xx_idc_ready_state()
854 qlcnic_83xx_idc_enter_failed_state(adapter, 1); in qlcnic_83xx_idc_ready_state()
863 qlcnic_83xx_idc_enter_need_reset_state(adapter, 1); in qlcnic_83xx_idc_ready_state()
870 adapter->ahw->reset_context = 0; in qlcnic_83xx_idc_ready_state()
871 qlcnic_83xx_idc_tx_soft_reset(adapter); in qlcnic_83xx_idc_ready_state()
876 if (adapter->ahw->idc.quiesce_req) { in qlcnic_83xx_idc_ready_state()
877 qlcnic_83xx_idc_enter_need_quiesce(adapter, 1); in qlcnic_83xx_idc_ready_state()
878 qlcnic_83xx_idc_update_audit_reg(adapter, 0, 1); in qlcnic_83xx_idc_ready_state()
897 static int qlcnic_83xx_idc_need_reset_state(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_need_reset_state() argument
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()
903 qlcnic_83xx_idc_update_audit_reg(adapter, 0, 1); in qlcnic_83xx_idc_need_reset_state()
904 set_bit(__QLCNIC_RESETTING, &adapter->state); in qlcnic_83xx_idc_need_reset_state()
906 if (adapter->ahw->nic_mode == QLCNIC_VNIC_MODE) in qlcnic_83xx_idc_need_reset_state()
907 qlcnic_83xx_disable_vnic_mode(adapter, 1); in qlcnic_83xx_idc_need_reset_state()
909 if (qlcnic_check_diag_status(adapter)) { 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()
915 qlcnic_83xx_idc_update_drv_ack_reg(adapter, 1, 1); in qlcnic_83xx_idc_need_reset_state()
916 qlcnic_83xx_idc_detach_driver(adapter); in qlcnic_83xx_idc_need_reset_state()
920 if (qlcnic_check_diag_status(adapter)) { in qlcnic_83xx_idc_need_reset_state()
921 dev_info(&adapter->pdev->dev, in qlcnic_83xx_idc_need_reset_state()
925 if (adapter->ahw->idc.delay_reset) { in qlcnic_83xx_idc_need_reset_state()
926 qlcnic_83xx_idc_update_drv_ack_reg(adapter, 1, 1); in qlcnic_83xx_idc_need_reset_state()
927 qlcnic_83xx_idc_detach_driver(adapter); in qlcnic_83xx_idc_need_reset_state()
928 adapter->ahw->idc.delay_reset = 0; in qlcnic_83xx_idc_need_reset_state()
932 ret = qlcnic_83xx_idc_check_reset_ack_reg(adapter); in qlcnic_83xx_idc_need_reset_state()
934 dev_info(&adapter->pdev->dev, in qlcnic_83xx_idc_need_reset_state()
941 qlcnic_83xx_idc_enter_init_state(adapter, 1); in qlcnic_83xx_idc_need_reset_state()
946 static int qlcnic_83xx_idc_need_quiesce_state(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_need_quiesce_state() argument
948 dev_err(&adapter->pdev->dev, "%s: TBD\n", __func__); in qlcnic_83xx_idc_need_quiesce_state()
952 static void qlcnic_83xx_idc_failed_state(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_failed_state() argument
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()
959 owner = qlcnic_83xx_idc_find_reset_owner_id(adapter); in qlcnic_83xx_idc_failed_state()
961 qlcnic_83xx_stop_hw(adapter); in qlcnic_83xx_idc_failed_state()
962 qlcnic_dump_fw(adapter); 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()
974 static int qlcnic_83xx_idc_quiesce_state(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_quiesce_state() argument
976 dev_info(&adapter->pdev->dev, "%s: TBD\n", __func__); in qlcnic_83xx_idc_quiesce_state()
980 static int qlcnic_83xx_idc_check_state_validity(struct qlcnic_adapter *adapter, in qlcnic_83xx_idc_check_state_validity() argument
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()
1030 int qlcnic_set_vxlan_port(struct qlcnic_adapter *adapter, u16 port) in qlcnic_set_vxlan_port() argument
1037 ret = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_set_vxlan_port()
1047 ret = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_set_vxlan_port()
1049 netdev_err(adapter->netdev, in qlcnic_set_vxlan_port()
1058 int qlcnic_set_vxlan_parsing(struct qlcnic_adapter *adapter, u16 port) in qlcnic_set_vxlan_parsing() argument
1065 ret = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_set_vxlan_parsing()
1073 ret = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_set_vxlan_parsing()
1075 netdev_err(adapter->netdev, in qlcnic_set_vxlan_parsing()
1079 netdev_info(adapter->netdev, in qlcnic_set_vxlan_parsing()
1088 static void qlcnic_83xx_periodic_tasks(struct qlcnic_adapter *adapter) in qlcnic_83xx_periodic_tasks() argument
1090 if (adapter->fhash.fnum) in qlcnic_83xx_periodic_tasks()
1091 qlcnic_prune_lb_filters(adapter); in qlcnic_83xx_periodic_tasks()
1107 struct qlcnic_adapter *adapter; in qlcnic_83xx_idc_poll_dev_state() local
1110 adapter = container_of(work, struct qlcnic_adapter, fw_work.work); in qlcnic_83xx_idc_poll_dev_state()
1111 state = QLCRDX(adapter->ahw, QLC_83XX_IDC_DEV_STATE); in qlcnic_83xx_idc_poll_dev_state()
1113 if (qlcnic_83xx_idc_check_state_validity(adapter, state)) { in qlcnic_83xx_idc_poll_dev_state()
1114 qlcnic_83xx_idc_log_state_history(adapter); 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()
1122 qlcnic_83xx_idc_ready_state(adapter); in qlcnic_83xx_idc_poll_dev_state()
1125 qlcnic_83xx_idc_need_reset_state(adapter); in qlcnic_83xx_idc_poll_dev_state()
1128 qlcnic_83xx_idc_need_quiesce_state(adapter); in qlcnic_83xx_idc_poll_dev_state()
1131 qlcnic_83xx_idc_failed_state(adapter); in qlcnic_83xx_idc_poll_dev_state()
1134 qlcnic_83xx_idc_init_state(adapter); in qlcnic_83xx_idc_poll_dev_state()
1137 qlcnic_83xx_idc_quiesce_state(adapter); in qlcnic_83xx_idc_poll_dev_state()
1140 qlcnic_83xx_idc_unknown_state(adapter); 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()
1144 qlcnic_83xx_periodic_tasks(adapter); 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()
1148 qlcnic_schedule_work(adapter, qlcnic_83xx_idc_poll_dev_state, in qlcnic_83xx_idc_poll_dev_state()
1149 adapter->ahw->idc.delay); in qlcnic_83xx_idc_poll_dev_state()
1152 static void qlcnic_83xx_setup_idc_parameters(struct qlcnic_adapter *adapter) in qlcnic_83xx_setup_idc_parameters() argument
1156 if (qlcnic_83xx_flash_read32(adapter, QLC_83XX_IDC_FLASH_PARAM_ADDR, in qlcnic_83xx_setup_idc_parameters()
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()
1187 qlcnic_83xx_idc_first_to_load_function_handler(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_first_to_load_function_handler() argument
1191 if (qlcnic_83xx_lock_driver(adapter)) 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()
1196 if (qlcnic_83xx_idc_update_major_version(adapter, 0)) { in qlcnic_83xx_idc_first_to_load_function_handler()
1197 qlcnic_83xx_unlock_driver(adapter); 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()
1202 if (qlcnic_83xx_idc_check_state_validity(adapter, state)) { in qlcnic_83xx_idc_first_to_load_function_handler()
1203 qlcnic_83xx_unlock_driver(adapter); 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()
1216 qlcnic_83xx_idc_cold_state_handler(adapter); 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()
1225 qlcnic_83xx_unlock_driver(adapter); in qlcnic_83xx_idc_first_to_load_function_handler()
1230 int qlcnic_83xx_idc_init(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_init() argument
1234 qlcnic_83xx_setup_idc_parameters(adapter); in qlcnic_83xx_idc_init()
1236 if (qlcnic_83xx_get_reset_instruction_template(adapter)) in qlcnic_83xx_idc_init()
1239 if (!qlcnic_83xx_idc_check_driver_presence_reg(adapter)) { in qlcnic_83xx_idc_init()
1240 if (qlcnic_83xx_idc_first_to_load_function_handler(adapter)) in qlcnic_83xx_idc_init()
1243 if (qlcnic_83xx_idc_check_major_version(adapter)) in qlcnic_83xx_idc_init()
1247 qlcnic_83xx_idc_update_audit_reg(adapter, 0, 1); in qlcnic_83xx_idc_init()
1252 void qlcnic_83xx_idc_exit(struct qlcnic_adapter *adapter) in qlcnic_83xx_idc_exit() argument
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()
1281 void qlcnic_83xx_idc_request_reset(struct qlcnic_adapter *adapter, u32 key) in qlcnic_83xx_idc_request_reset() argument
1285 if (qlcnic_sriov_vf_check(adapter)) in qlcnic_83xx_idc_request_reset()
1288 if (qlcnic_83xx_lock_driver(adapter)) { in qlcnic_83xx_idc_request_reset()
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()
1298 qlcnic_83xx_idc_enter_failed_state(adapter, 0); in qlcnic_83xx_idc_request_reset()
1299 qlcnic_83xx_unlock_driver(adapter); 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()
1311 qlcnic_83xx_unlock_driver(adapter); in qlcnic_83xx_idc_request_reset()
1315 static int qlcnic_83xx_copy_bootloader(struct qlcnic_adapter *adapter) in qlcnic_83xx_copy_bootloader() argument
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()
1334 ret = qlcnic_83xx_lockless_flash_read32(adapter, src, p_cache, in qlcnic_83xx_copy_bootloader()
1341 ret = qlcnic_ms_mem_write128(adapter, dest, (u32 *)p_cache, in qlcnic_83xx_copy_bootloader()
1352 static int qlcnic_83xx_copy_fw_file(struct qlcnic_adapter *adapter) in qlcnic_83xx_copy_fw_file() argument
1354 struct qlc_83xx_fw_info *fw_info = adapter->ahw->fw_info; in qlcnic_83xx_copy_fw_file()
1378 dest = QLCRDX(adapter->ahw, QLCNIC_FW_IMAGE_ADDR); in qlcnic_83xx_copy_fw_file()
1383 ret = qlcnic_ms_mem_write128(adapter, addr, in qlcnic_83xx_copy_fw_file()
1386 dev_err(&adapter->pdev->dev, "MS memory write failed\n"); in qlcnic_83xx_copy_fw_file()
1397 ret = qlcnic_ms_mem_write128(adapter, addr, in qlcnic_83xx_copy_fw_file()
1400 dev_err(&adapter->pdev->dev, in qlcnic_83xx_copy_fw_file()
1414 static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter) in qlcnic_83xx_dump_pause_control_regs() argument
1420 val = QLCRD32(adapter, QLC_83XX_SRE_SHIM_REG, &err); 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()
1436 val = QLCRD32(adapter, reg + (i * 0x4), &err); 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()
1455 val = QLCRD32(adapter, reg + (i * 0x4), &err); 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()
1474 val = QLCRD32(adapter, reg, &err); in qlcnic_83xx_dump_pause_control_regs()
1478 QLCWR32(adapter, reg, (val | (i << 29))); in qlcnic_83xx_dump_pause_control_regs()
1479 val = QLCRD32(adapter, reg, &err); 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()
1487 val = QLCRD32(adapter, QLC_83XX_PORT2_IFB_THRESHOLD, &err); in qlcnic_83xx_dump_pause_control_regs()
1490 val1 = QLCRD32(adapter, QLC_83XX_PORT3_IFB_THRESHOLD, &err); in qlcnic_83xx_dump_pause_control_regs()
1493 dev_info(&adapter->pdev->dev, in qlcnic_83xx_dump_pause_control_regs()
1499 static void qlcnic_83xx_disable_pause_frames(struct qlcnic_adapter *adapter) in qlcnic_83xx_disable_pause_frames() argument
1503 if (qlcnic_83xx_lock_driver(adapter)) { in qlcnic_83xx_disable_pause_frames()
1504 dev_err(&adapter->pdev->dev, in qlcnic_83xx_disable_pause_frames()
1509 qlcnic_83xx_dump_pause_control_regs(adapter); in qlcnic_83xx_disable_pause_frames()
1510 QLCWR32(adapter, QLC_83XX_SRE_SHIM_REG, 0x0); in qlcnic_83xx_disable_pause_frames()
1519 QLCWR32(adapter, reg + (i * 0x4), 0x0); in qlcnic_83xx_disable_pause_frames()
1529 QLCWR32(adapter, reg + (i * 0x4), 0x03FF03FF); in qlcnic_83xx_disable_pause_frames()
1532 QLCWR32(adapter, QLC_83XX_PORT2_IFB_THRESHOLD, 0); in qlcnic_83xx_disable_pause_frames()
1533 QLCWR32(adapter, QLC_83XX_PORT3_IFB_THRESHOLD, 0); in qlcnic_83xx_disable_pause_frames()
1534 dev_info(&adapter->pdev->dev, in qlcnic_83xx_disable_pause_frames()
1536 qlcnic_83xx_unlock_driver(adapter); in qlcnic_83xx_disable_pause_frames()
1539 static void qlcnic_83xx_take_eport_out_of_reset(struct qlcnic_adapter *adapter) in qlcnic_83xx_take_eport_out_of_reset() argument
1541 QLCWR32(adapter, QLC_83XX_RESET_REG, 0); in qlcnic_83xx_take_eport_out_of_reset()
1542 QLCWR32(adapter, QLC_83XX_RESET_PORT0, 0); in qlcnic_83xx_take_eport_out_of_reset()
1543 QLCWR32(adapter, QLC_83XX_RESET_PORT1, 0); in qlcnic_83xx_take_eport_out_of_reset()
1544 QLCWR32(adapter, QLC_83XX_RESET_PORT2, 0); in qlcnic_83xx_take_eport_out_of_reset()
1545 QLCWR32(adapter, QLC_83XX_RESET_PORT3, 0); in qlcnic_83xx_take_eport_out_of_reset()
1546 QLCWR32(adapter, QLC_83XX_RESET_SRESHIM, 0); in qlcnic_83xx_take_eport_out_of_reset()
1547 QLCWR32(adapter, QLC_83XX_RESET_EPGSHIM, 0); in qlcnic_83xx_take_eport_out_of_reset()
1548 QLCWR32(adapter, QLC_83XX_RESET_ETHERPCS, 0); in qlcnic_83xx_take_eport_out_of_reset()
1549 QLCWR32(adapter, QLC_83XX_RESET_CONTROL, 1); in qlcnic_83xx_take_eport_out_of_reset()
2073 static int qlcnic_83xx_run_post(struct qlcnic_adapter *adapter) in qlcnic_83xx_run_post() argument
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()
2104 ret = qlcnic_83xx_copy_fw_file(adapter); in qlcnic_83xx_run_post()
2109 qlcnic_ind_wr(adapter, QLC_83XX_POST_SIGNATURE_REG, 0); in qlcnic_83xx_run_post()
2112 qlcnic_ind_wr(adapter, QLC_83XX_POST_MODE_REG, in qlcnic_83xx_run_post()
2113 adapter->ahw->post_mode); in qlcnic_83xx_run_post()
2115 QLC_SHARED_REG_WR32(adapter, QLCNIC_FW_IMG_VALID, in qlcnic_83xx_run_post()
2118 qlcnic_83xx_start_hw(adapter); in qlcnic_83xx_run_post()
2125 signature = qlcnic_ind_rd(adapter, QLC_83XX_POST_SIGNATURE_REG); in qlcnic_83xx_run_post()
2169 static int qlcnic_83xx_load_fw_image_from_host(struct qlcnic_adapter *adapter) in qlcnic_83xx_load_fw_image_from_host() argument
2171 struct qlc_83xx_fw_info *fw_info = adapter->ahw->fw_info; 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()
2178 QLC_SHARED_REG_WR32(adapter, QLCNIC_FW_IMG_VALID, in qlcnic_83xx_load_fw_image_from_host()
2181 if (qlcnic_83xx_copy_fw_file(adapter)) in qlcnic_83xx_load_fw_image_from_host()
2183 QLC_SHARED_REG_WR32(adapter, QLCNIC_FW_IMG_VALID, in qlcnic_83xx_load_fw_image_from_host()
2190 static int qlcnic_83xx_restart_hw(struct qlcnic_adapter *adapter) in qlcnic_83xx_restart_hw() argument
2195 qlcnic_83xx_stop_hw(adapter); in qlcnic_83xx_restart_hw()
2198 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL); in qlcnic_83xx_restart_hw()
2200 qlcnic_dump_fw(adapter); in qlcnic_83xx_restart_hw()
2203 netdev_info(adapter->netdev, "%s: Auto firmware recovery is disabled\n", in qlcnic_83xx_restart_hw()
2205 qlcnic_83xx_idc_enter_failed_state(adapter, 1); in qlcnic_83xx_restart_hw()
2209 qlcnic_83xx_init_hw(adapter); in qlcnic_83xx_restart_hw()
2211 if (qlcnic_83xx_copy_bootloader(adapter)) in qlcnic_83xx_restart_hw()
2215 if (adapter->ahw->run_post) { in qlcnic_83xx_restart_hw()
2216 err = qlcnic_83xx_run_post(adapter); in qlcnic_83xx_restart_hw()
2221 adapter->ahw->run_post = false; in qlcnic_83xx_restart_hw()
2224 qlcnic_83xx_stop_hw(adapter); in qlcnic_83xx_restart_hw()
2225 qlcnic_83xx_init_hw(adapter); in qlcnic_83xx_restart_hw()
2227 err = qlcnic_83xx_copy_bootloader(adapter); in qlcnic_83xx_restart_hw()
2234 err = qlcnic_83xx_load_fw_image_from_host(adapter); in qlcnic_83xx_restart_hw()
2238 QLC_SHARED_REG_WR32(adapter, QLCNIC_FW_IMG_VALID, in qlcnic_83xx_restart_hw()
2242 qlcnic_83xx_start_hw(adapter); in qlcnic_83xx_restart_hw()
2243 if (qlcnic_83xx_check_hw_status(adapter)) in qlcnic_83xx_restart_hw()
2249 static int qlcnic_83xx_get_nic_configuration(struct qlcnic_adapter *adapter) in qlcnic_83xx_get_nic_configuration() argument
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()
2276 if (test_bit(__QLCNIC_SRIOV_CAPABLE, &adapter->state)) in qlcnic_83xx_get_nic_configuration()
2285 int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter) in qlcnic_83xx_configure_opmode() argument
2287 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_configure_opmode()
2291 ret = qlcnic_83xx_get_nic_configuration(adapter); in qlcnic_83xx_configure_opmode()
2298 if (qlcnic_83xx_config_vnic_opmode(adapter)) in qlcnic_83xx_configure_opmode()
2305 adapter->nic_ops->init_driver = qlcnic_83xx_init_default_driver; in qlcnic_83xx_configure_opmode()
2310 dev_err(&adapter->pdev->dev, "%s: Invalid opmode %d\n", 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()
2321 static void qlcnic_83xx_config_buff_descriptors(struct qlcnic_adapter *adapter) in qlcnic_83xx_config_buff_descriptors() argument
2323 struct qlcnic_hardware_context *ahw = adapter->ahw; 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()
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()
2341 static int qlcnic_83xx_init_default_driver(struct qlcnic_adapter *adapter) in qlcnic_83xx_init_default_driver() argument
2345 qlcnic_83xx_get_minidump_template(adapter); in qlcnic_83xx_init_default_driver()
2346 if (qlcnic_83xx_get_port_info(adapter)) in qlcnic_83xx_init_default_driver()
2349 qlcnic_83xx_config_buff_descriptors(adapter); 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()
2360 static void qlcnic_83xx_clear_function_resources(struct qlcnic_adapter *adapter) in qlcnic_83xx_clear_function_resources() argument
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()
2369 if (IS_QLC_83XX_USED(adapter, presence_mask, audit_mask)) { in qlcnic_83xx_clear_function_resources()
2370 status = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_83xx_clear_function_resources()
2376 status = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_clear_function_resources()
2378 dev_err(&adapter->pdev->dev, in qlcnic_83xx_clear_function_resources()
2384 static int qlcnic_83xx_get_fw_info(struct qlcnic_adapter *adapter) in qlcnic_83xx_get_fw_info() argument
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()
2417 static void qlcnic_83xx_init_rings(struct qlcnic_adapter *adapter) in qlcnic_83xx_init_rings() argument
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()
2431 qlcnic_set_tx_ring_count(adapter, tx_cnt); in qlcnic_83xx_init_rings()
2432 qlcnic_set_sds_ring_count(adapter, rx_cnt); in qlcnic_83xx_init_rings()
2435 int qlcnic_83xx_init(struct qlcnic_adapter *adapter) in qlcnic_83xx_init() argument
2437 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_init()
2440 adapter->rx_mac_learn = false; in qlcnic_83xx_init()
2462 qlcnic_83xx_init_rings(adapter); in qlcnic_83xx_init()
2464 err = qlcnic_83xx_init_mailbox_work(adapter); in qlcnic_83xx_init()
2468 if (qlcnic_sriov_vf_check(adapter)) { in qlcnic_83xx_init()
2469 err = qlcnic_sriov_vf_init(adapter); in qlcnic_83xx_init()
2476 if (qlcnic_83xx_read_flash_descriptor_table(adapter) || in qlcnic_83xx_init()
2477 qlcnic_83xx_read_flash_mfg_id(adapter)) { in qlcnic_83xx_init()
2478 dev_err(&adapter->pdev->dev, "Failed reading flash mfg id\n"); in qlcnic_83xx_init()
2483 err = qlcnic_83xx_check_hw_status(adapter); in qlcnic_83xx_init()
2487 err = qlcnic_83xx_get_fw_info(adapter); in qlcnic_83xx_init()
2491 err = qlcnic_83xx_idc_init(adapter); in qlcnic_83xx_init()
2495 err = qlcnic_setup_intr(adapter); 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()
2503 err = qlcnic_83xx_setup_mbx_intr(adapter); in qlcnic_83xx_init()
2507 qlcnic_83xx_clear_function_resources(adapter); 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()
2515 qlcnic_83xx_initialize_nic(adapter, 1); in qlcnic_83xx_init()
2516 qlcnic_dcb_get_info(adapter->dcb); in qlcnic_83xx_init()
2519 err = qlcnic_83xx_configure_opmode(adapter); 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()
2534 qlcnic_83xx_free_mbx_intr(adapter); in qlcnic_83xx_init()
2537 qlcnic_teardown_intr(adapter); in qlcnic_83xx_init()
2540 qlcnic_83xx_detach_mailbox_work(adapter); in qlcnic_83xx_init()
2547 void qlcnic_83xx_aer_stop_poll_work(struct qlcnic_adapter *adapter) in qlcnic_83xx_aer_stop_poll_work() argument
2549 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_aer_stop_poll_work()
2553 cancel_delayed_work_sync(&adapter->fw_work); in qlcnic_83xx_aer_stop_poll_work()
2556 qlcnic_83xx_disable_vnic_mode(adapter, 1); in qlcnic_83xx_aer_stop_poll_work()
2558 qlcnic_83xx_idc_detach_driver(adapter); in qlcnic_83xx_aer_stop_poll_work()
2559 qlcnic_83xx_initialize_nic(adapter, 0); in qlcnic_83xx_aer_stop_poll_work()
2561 cancel_delayed_work_sync(&adapter->idc_aen_work); in qlcnic_83xx_aer_stop_poll_work()
2564 int qlcnic_83xx_aer_reset(struct qlcnic_adapter *adapter) in qlcnic_83xx_aer_reset() argument
2566 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_aer_reset()
2576 owner = qlcnic_83xx_idc_find_reset_owner_id(adapter); in qlcnic_83xx_aer_reset()
2578 ret = qlcnic_83xx_restart_hw(adapter); in qlcnic_83xx_aer_reset()
2581 qlcnic_83xx_idc_clear_registers(adapter, 0); in qlcnic_83xx_aer_reset()
2584 ret = idc->state_entry(adapter); in qlcnic_83xx_aer_reset()
2588 void qlcnic_83xx_aer_start_poll_work(struct qlcnic_adapter *adapter) in qlcnic_83xx_aer_start_poll_work() argument
2590 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_aer_start_poll_work()
2595 owner = qlcnic_83xx_idc_find_reset_owner_id(adapter); in qlcnic_83xx_aer_start_poll_work()
2597 qlcnic_83xx_idc_enter_ready_state(adapter, 0); in qlcnic_83xx_aer_start_poll_work()
2599 qlcnic_schedule_work(adapter, qlcnic_83xx_idc_poll_dev_state, 0); in qlcnic_83xx_aer_start_poll_work()