Lines Matching refs:mrioc

44 static void mpi3mr_send_event_ack(struct mpi3mr_ioc *mrioc, u8 event,
60 static u16 mpi3mr_host_tag_for_scmd(struct mpi3mr_ioc *mrioc, in mpi3mr_host_tag_for_scmd() argument
70 if (hw_queue >= mrioc->num_op_reply_q) in mpi3mr_host_tag_for_scmd()
74 if (WARN_ON(host_tag >= mrioc->max_host_ios)) in mpi3mr_host_tag_for_scmd()
101 struct mpi3mr_ioc *mrioc, u16 host_tag, u16 qidx) in mpi3mr_scmd_from_host_tag() argument
107 if (WARN_ON(host_tag > mrioc->max_host_ios)) in mpi3mr_scmd_from_host_tag()
112 scmd = scsi_host_find_tag(mrioc->shost, unique_tag); in mpi3mr_scmd_from_host_tag()
132 static void mpi3mr_clear_scmd_priv(struct mpi3mr_ioc *mrioc, in mpi3mr_clear_scmd_priv() argument
147 clear_bit(priv->chain_idx, mrioc->chain_bitmap); in mpi3mr_clear_scmd_priv()
151 clear_bit(priv->meta_chain_idx, mrioc->chain_bitmap); in mpi3mr_clear_scmd_priv()
156 static void mpi3mr_dev_rmhs_send_tm(struct mpi3mr_ioc *mrioc, u16 handle,
223 static void mpi3mr_fwevt_add_to_list(struct mpi3mr_ioc *mrioc, in mpi3mr_fwevt_add_to_list() argument
228 if (!mrioc->fwevt_worker_thread) in mpi3mr_fwevt_add_to_list()
231 spin_lock_irqsave(&mrioc->fwevt_lock, flags); in mpi3mr_fwevt_add_to_list()
235 list_add_tail(&fwevt->list, &mrioc->fwevt_list); in mpi3mr_fwevt_add_to_list()
239 queue_work(mrioc->fwevt_worker_thread, &fwevt->work); in mpi3mr_fwevt_add_to_list()
240 spin_unlock_irqrestore(&mrioc->fwevt_lock, flags); in mpi3mr_fwevt_add_to_list()
252 static void mpi3mr_fwevt_del_from_list(struct mpi3mr_ioc *mrioc, in mpi3mr_fwevt_del_from_list() argument
257 spin_lock_irqsave(&mrioc->fwevt_lock, flags); in mpi3mr_fwevt_del_from_list()
266 spin_unlock_irqrestore(&mrioc->fwevt_lock, flags); in mpi3mr_fwevt_del_from_list()
278 struct mpi3mr_ioc *mrioc) in mpi3mr_dequeue_fwevt() argument
283 spin_lock_irqsave(&mrioc->fwevt_lock, flags); in mpi3mr_dequeue_fwevt()
284 if (!list_empty(&mrioc->fwevt_list)) { in mpi3mr_dequeue_fwevt()
285 fwevt = list_first_entry(&mrioc->fwevt_list, in mpi3mr_dequeue_fwevt()
294 spin_unlock_irqrestore(&mrioc->fwevt_lock, flags); in mpi3mr_dequeue_fwevt()
337 void mpi3mr_cleanup_fwevt_list(struct mpi3mr_ioc *mrioc) in mpi3mr_cleanup_fwevt_list() argument
341 if ((list_empty(&mrioc->fwevt_list) && !mrioc->current_event) || in mpi3mr_cleanup_fwevt_list()
342 !mrioc->fwevt_worker_thread) in mpi3mr_cleanup_fwevt_list()
345 while ((fwevt = mpi3mr_dequeue_fwevt(mrioc))) in mpi3mr_cleanup_fwevt_list()
348 if (mrioc->current_event) { in mpi3mr_cleanup_fwevt_list()
349 fwevt = mrioc->current_event; in mpi3mr_cleanup_fwevt_list()
378 static void mpi3mr_queue_qd_reduction_event(struct mpi3mr_ioc *mrioc, in mpi3mr_queue_qd_reduction_event() argument
394 ioc_warn(mrioc, "failed to queue TG QD reduction event\n"); in mpi3mr_queue_qd_reduction_event()
398 fwevt->mrioc = mrioc; in mpi3mr_queue_qd_reduction_event()
406 dprint_event_bh(mrioc, "qd reduction event queued for tg_id(%d)\n", in mpi3mr_queue_qd_reduction_event()
408 mpi3mr_fwevt_add_to_list(mrioc, fwevt); in mpi3mr_queue_qd_reduction_event()
420 void mpi3mr_invalidate_devhandles(struct mpi3mr_ioc *mrioc) in mpi3mr_invalidate_devhandles() argument
425 list_for_each_entry(tgtdev, &mrioc->tgtdev_list, list) { in mpi3mr_invalidate_devhandles()
451 struct mpi3mr_ioc *mrioc = (struct mpi3mr_ioc *)data; in mpi3mr_print_scmd() local
460 ioc_info(mrioc, "%s :Host Tag = %d, qid = %d\n", in mpi3mr_print_scmd()
482 struct mpi3mr_ioc *mrioc = (struct mpi3mr_ioc *)data; in mpi3mr_flush_scmd() local
492 dma_unmap_sg(&mrioc->pdev->dev, scsi_prot_sglist(scmd), in mpi3mr_flush_scmd()
494 mpi3mr_clear_scmd_priv(mrioc, scmd); in mpi3mr_flush_scmd()
499 mrioc->flush_io_count++; in mpi3mr_flush_scmd()
580 void mpi3mr_flush_host_io(struct mpi3mr_ioc *mrioc) in mpi3mr_flush_host_io() argument
582 struct Scsi_Host *shost = mrioc->shost; in mpi3mr_flush_host_io()
584 mrioc->flush_io_count = 0; in mpi3mr_flush_host_io()
585 ioc_info(mrioc, "%s :Flushing Host I/O cmds post reset\n", __func__); in mpi3mr_flush_host_io()
587 mpi3mr_flush_scmd, (void *)mrioc); in mpi3mr_flush_host_io()
588 ioc_info(mrioc, "%s :Flushed %d Host I/O cmds\n", __func__, in mpi3mr_flush_host_io()
589 mrioc->flush_io_count); in mpi3mr_flush_host_io()
603 void mpi3mr_flush_cmds_for_unrecovered_controller(struct mpi3mr_ioc *mrioc) in mpi3mr_flush_cmds_for_unrecovered_controller() argument
605 struct Scsi_Host *shost = mrioc->shost; in mpi3mr_flush_cmds_for_unrecovered_controller()
608 if (!mrioc->unrecoverable) in mpi3mr_flush_cmds_for_unrecovered_controller()
611 if (mrioc->op_reply_qinfo) { in mpi3mr_flush_cmds_for_unrecovered_controller()
612 for (i = 0; i < mrioc->num_queues; i++) { in mpi3mr_flush_cmds_for_unrecovered_controller()
613 while (atomic_read(&mrioc->op_reply_qinfo[i].in_use)) in mpi3mr_flush_cmds_for_unrecovered_controller()
615 atomic_set(&mrioc->op_reply_qinfo[i].pend_ios, 0); in mpi3mr_flush_cmds_for_unrecovered_controller()
618 mrioc->flush_io_count = 0; in mpi3mr_flush_cmds_for_unrecovered_controller()
620 mpi3mr_flush_scmd, (void *)mrioc); in mpi3mr_flush_cmds_for_unrecovered_controller()
621 mpi3mr_flush_delayed_cmd_lists(mrioc); in mpi3mr_flush_cmds_for_unrecovered_controller()
622 mpi3mr_flush_drv_cmds(mrioc); in mpi3mr_flush_cmds_for_unrecovered_controller()
653 static void mpi3mr_tgtdev_add_to_list(struct mpi3mr_ioc *mrioc, in mpi3mr_tgtdev_add_to_list() argument
658 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_tgtdev_add_to_list()
661 list_add_tail(&tgtdev->list, &mrioc->tgtdev_list); in mpi3mr_tgtdev_add_to_list()
663 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_tgtdev_add_to_list()
677 static void mpi3mr_tgtdev_del_from_list(struct mpi3mr_ioc *mrioc, in mpi3mr_tgtdev_del_from_list() argument
682 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_tgtdev_del_from_list()
690 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_tgtdev_del_from_list()
704 struct mpi3mr_ioc *mrioc, u16 handle) in __mpi3mr_get_tgtdev_by_handle() argument
708 assert_spin_locked(&mrioc->tgtdev_lock); in __mpi3mr_get_tgtdev_by_handle()
709 list_for_each_entry(tgtdev, &mrioc->tgtdev_list, list) in __mpi3mr_get_tgtdev_by_handle()
730 struct mpi3mr_ioc *mrioc, u16 handle) in mpi3mr_get_tgtdev_by_handle() argument
735 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_get_tgtdev_by_handle()
736 tgtdev = __mpi3mr_get_tgtdev_by_handle(mrioc, handle); in mpi3mr_get_tgtdev_by_handle()
737 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_get_tgtdev_by_handle()
752 struct mpi3mr_ioc *mrioc, u16 persist_id) in __mpi3mr_get_tgtdev_by_perst_id() argument
756 assert_spin_locked(&mrioc->tgtdev_lock); in __mpi3mr_get_tgtdev_by_perst_id()
757 list_for_each_entry(tgtdev, &mrioc->tgtdev_list, list) in __mpi3mr_get_tgtdev_by_perst_id()
778 struct mpi3mr_ioc *mrioc, u16 persist_id) in mpi3mr_get_tgtdev_by_perst_id() argument
783 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_get_tgtdev_by_perst_id()
784 tgtdev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, persist_id); in mpi3mr_get_tgtdev_by_perst_id()
785 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_get_tgtdev_by_perst_id()
800 struct mpi3mr_ioc *mrioc, struct mpi3mr_stgt_priv_data *tgt_priv) in __mpi3mr_get_tgtdev_from_tgtpriv() argument
804 assert_spin_locked(&mrioc->tgtdev_lock); in __mpi3mr_get_tgtdev_from_tgtpriv()
822 static void mpi3mr_set_io_divert_for_all_vd_in_tg(struct mpi3mr_ioc *mrioc, in mpi3mr_set_io_divert_for_all_vd_in_tg() argument
829 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_set_io_divert_for_all_vd_in_tg()
830 list_for_each_entry(tgtdev, &mrioc->tgtdev_list, list) { in mpi3mr_set_io_divert_for_all_vd_in_tg()
837 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_set_io_divert_for_all_vd_in_tg()
849 void mpi3mr_print_device_event_notice(struct mpi3mr_ioc *mrioc, in mpi3mr_print_device_event_notice() argument
852 ioc_notice(mrioc, "Device %s was in progress before the reset and\n", in mpi3mr_print_device_event_notice()
854 ioc_notice(mrioc, "completed after reset, verify whether the exposed devices\n"); in mpi3mr_print_device_event_notice()
855 ioc_notice(mrioc, "are matched with attached devices for correctness\n"); in mpi3mr_print_device_event_notice()
869 void mpi3mr_remove_tgtdev_from_host(struct mpi3mr_ioc *mrioc, in mpi3mr_remove_tgtdev_from_host() argument
874 ioc_info(mrioc, "%s :Removing handle(0x%04x), wwid(0x%016llx)\n", in mpi3mr_remove_tgtdev_from_host()
882 if (!mrioc->sas_transport_enabled || (tgtdev->dev_type != in mpi3mr_remove_tgtdev_from_host()
885 if (mrioc->current_event) in mpi3mr_remove_tgtdev_from_host()
886 mrioc->current_event->pending_at_sml = 1; in mpi3mr_remove_tgtdev_from_host()
889 if (mrioc->current_event) { in mpi3mr_remove_tgtdev_from_host()
890 mrioc->current_event->pending_at_sml = 0; in mpi3mr_remove_tgtdev_from_host()
891 if (mrioc->current_event->discard) { in mpi3mr_remove_tgtdev_from_host()
892 mpi3mr_print_device_event_notice(mrioc, in mpi3mr_remove_tgtdev_from_host()
899 mpi3mr_remove_tgtdev_from_sas_transport(mrioc, tgtdev); in mpi3mr_remove_tgtdev_from_host()
901 ioc_info(mrioc, "%s :Removed handle(0x%04x), wwid(0x%016llx)\n", in mpi3mr_remove_tgtdev_from_host()
916 static int mpi3mr_report_tgtdev_to_host(struct mpi3mr_ioc *mrioc, in mpi3mr_report_tgtdev_to_host() argument
922 if (mrioc->reset_in_progress) in mpi3mr_report_tgtdev_to_host()
925 tgtdev = mpi3mr_get_tgtdev_by_perst_id(mrioc, perst_id); in mpi3mr_report_tgtdev_to_host()
934 if (!mrioc->sas_transport_enabled || (tgtdev->dev_type != in mpi3mr_report_tgtdev_to_host()
937 if (mrioc->current_event) in mpi3mr_report_tgtdev_to_host()
938 mrioc->current_event->pending_at_sml = 1; in mpi3mr_report_tgtdev_to_host()
939 scsi_scan_target(&mrioc->shost->shost_gendev, in mpi3mr_report_tgtdev_to_host()
940 mrioc->scsi_device_channel, tgtdev->perst_id, in mpi3mr_report_tgtdev_to_host()
944 if (mrioc->current_event) { in mpi3mr_report_tgtdev_to_host()
945 mrioc->current_event->pending_at_sml = 0; in mpi3mr_report_tgtdev_to_host()
946 if (mrioc->current_event->discard) { in mpi3mr_report_tgtdev_to_host()
947 mpi3mr_print_device_event_notice(mrioc, true); in mpi3mr_report_tgtdev_to_host()
952 mpi3mr_report_tgtdev_to_sas_transport(mrioc, tgtdev); in mpi3mr_report_tgtdev_to_host()
1041 void mpi3mr_rfresh_tgtdevs(struct mpi3mr_ioc *mrioc) in mpi3mr_rfresh_tgtdevs() argument
1046 dprint_reset(mrioc, "refresh target devices: check for removals\n"); in mpi3mr_rfresh_tgtdevs()
1047 list_for_each_entry_safe(tgtdev, tgtdev_next, &mrioc->tgtdev_list, in mpi3mr_rfresh_tgtdevs()
1058 list_for_each_entry_safe(tgtdev, tgtdev_next, &mrioc->tgtdev_list, in mpi3mr_rfresh_tgtdevs()
1061 dprint_reset(mrioc, "removing target device with perst_id(%d)\n", in mpi3mr_rfresh_tgtdevs()
1064 mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev); in mpi3mr_rfresh_tgtdevs()
1065 mpi3mr_tgtdev_del_from_list(mrioc, tgtdev, true); in mpi3mr_rfresh_tgtdevs()
1071 list_for_each_entry(tgtdev, &mrioc->tgtdev_list, list) { in mpi3mr_rfresh_tgtdevs()
1074 mpi3mr_report_tgtdev_to_host(mrioc, tgtdev->perst_id); in mpi3mr_rfresh_tgtdevs()
1090 static void mpi3mr_update_tgtdev(struct mpi3mr_ioc *mrioc, in mpi3mr_update_tgtdev() argument
1111 enclosure_dev = mpi3mr_enclosure_find_by_handle(mrioc, in mpi3mr_update_tgtdev()
1224 if (!mrioc->shost) in mpi3mr_update_tgtdev()
1226 prot_mask = scsi_host_get_prot(mrioc->shost); in mpi3mr_update_tgtdev()
1228 scsi_host_set_prot(mrioc->shost, prot_mask & 0x77); in mpi3mr_update_tgtdev()
1229 ioc_info(mrioc, in mpi3mr_update_tgtdev()
1231 ioc_info(mrioc, in mpi3mr_update_tgtdev()
1253 if (vdinf_io_throttle_group < mrioc->num_io_throttle_group) { in mpi3mr_update_tgtdev()
1254 tg = mrioc->throttle_groups + vdinf_io_throttle_group; in mpi3mr_update_tgtdev()
1285 static void mpi3mr_devstatuschg_evt_bh(struct mpi3mr_ioc *mrioc, in mpi3mr_devstatuschg_evt_bh() argument
1295 ioc_info(mrioc, in mpi3mr_devstatuschg_evt_bh()
1310 ioc_info(mrioc, "%s :Unhandled reason code(0x%x)\n", __func__, in mpi3mr_devstatuschg_evt_bh()
1315 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, dev_handle); in mpi3mr_devstatuschg_evt_bh()
1321 mpi3mr_report_tgtdev_to_host(mrioc, tgtdev->perst_id); in mpi3mr_devstatuschg_evt_bh()
1325 mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev); in mpi3mr_devstatuschg_evt_bh()
1328 mpi3mr_tgtdev_del_from_list(mrioc, tgtdev, false); in mpi3mr_devstatuschg_evt_bh()
1349 static void mpi3mr_devinfochg_evt_bh(struct mpi3mr_ioc *mrioc, in mpi3mr_devinfochg_evt_bh() argument
1357 ioc_info(mrioc, in mpi3mr_devinfochg_evt_bh()
1360 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, dev_handle); in mpi3mr_devinfochg_evt_bh()
1363 mpi3mr_update_tgtdev(mrioc, tgtdev, dev_pg0, false); in mpi3mr_devinfochg_evt_bh()
1365 mpi3mr_report_tgtdev_to_host(mrioc, perst_id); in mpi3mr_devinfochg_evt_bh()
1367 mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev); in mpi3mr_devinfochg_evt_bh()
1384 void mpi3mr_free_enclosure_list(struct mpi3mr_ioc *mrioc) in mpi3mr_free_enclosure_list() argument
1389 enclosure_dev_next, &mrioc->enclosure_list, list) { in mpi3mr_free_enclosure_list()
1406 struct mpi3mr_ioc *mrioc, u16 handle) in mpi3mr_enclosure_find_by_handle() argument
1410 list_for_each_entry(enclosure_dev, &mrioc->enclosure_list, list) { in mpi3mr_enclosure_find_by_handle()
1428 static void mpi3mr_encldev_add_chg_evt_debug(struct mpi3mr_ioc *mrioc, in mpi3mr_encldev_add_chg_evt_debug() argument
1433 if (!(mrioc->logging_level & MPI3_DEBUG_EVENT_WORK_TASK)) in mpi3mr_encldev_add_chg_evt_debug()
1441 ioc_info(mrioc, in mpi3mr_encldev_add_chg_evt_debug()
1445 ioc_info(mrioc, in mpi3mr_encldev_add_chg_evt_debug()
1465 static void mpi3mr_encldev_add_chg_evt_bh(struct mpi3mr_ioc *mrioc, in mpi3mr_encldev_add_chg_evt_bh() argument
1475 mpi3mr_encldev_add_chg_evt_debug(mrioc, encl_pg0, added); in mpi3mr_encldev_add_chg_evt_bh()
1483 enclosure_dev = mpi3mr_enclosure_find_by_handle(mrioc, in mpi3mr_encldev_add_chg_evt_bh()
1492 &mrioc->enclosure_list); in mpi3mr_encldev_add_chg_evt_bh()
1515 mpi3mr_sastopochg_evt_debug(struct mpi3mr_ioc *mrioc, in mpi3mr_sastopochg_evt_debug() argument
1541 ioc_info(mrioc, "%s :sas topology change: (%s)\n", in mpi3mr_sastopochg_evt_debug()
1543 ioc_info(mrioc, in mpi3mr_sastopochg_evt_debug()
1578 ioc_info(mrioc, in mpi3mr_sastopochg_evt_debug()
1596 static void mpi3mr_sastopochg_evt_bh(struct mpi3mr_ioc *mrioc, in mpi3mr_sastopochg_evt_bh() argument
1611 mpi3mr_sastopochg_evt_debug(mrioc, event_data); in mpi3mr_sastopochg_evt_bh()
1612 if (mrioc->sas_transport_enabled) { in mpi3mr_sastopochg_evt_bh()
1613 hba_port = mpi3mr_get_hba_port_by_id(mrioc, in mpi3mr_sastopochg_evt_bh()
1616 spin_lock_irqsave(&mrioc->sas_node_lock, flags); in mpi3mr_sastopochg_evt_bh()
1617 sas_expander = __mpi3mr_expander_find_by_handle(mrioc, in mpi3mr_sastopochg_evt_bh()
1623 spin_unlock_irqrestore(&mrioc->sas_node_lock, flags); in mpi3mr_sastopochg_evt_bh()
1626 parent_sas_address = mrioc->sas_hba.sas_address; in mpi3mr_sastopochg_evt_bh()
1635 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, handle); in mpi3mr_sastopochg_evt_bh()
1645 mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev); in mpi3mr_sastopochg_evt_bh()
1646 mpi3mr_tgtdev_del_from_list(mrioc, tgtdev, false); in mpi3mr_sastopochg_evt_bh()
1653 if (!mrioc->sas_transport_enabled || tgtdev->non_stl in mpi3mr_sastopochg_evt_bh()
1663 mpi3mr_update_links(mrioc, parent_sas_address, handle, in mpi3mr_sastopochg_evt_bh()
1674 if (mrioc->sas_transport_enabled && (event_data->exp_status == in mpi3mr_sastopochg_evt_bh()
1677 mpi3mr_expander_remove(mrioc, exp_sas_address, in mpi3mr_sastopochg_evt_bh()
1692 mpi3mr_pcietopochg_evt_debug(struct mpi3mr_ioc *mrioc, in mpi3mr_pcietopochg_evt_debug() argument
1719 ioc_info(mrioc, "%s :pcie topology change: (%s)\n", in mpi3mr_pcietopochg_evt_debug()
1721 ioc_info(mrioc, in mpi3mr_pcietopochg_evt_debug()
1757 ioc_info(mrioc, in mpi3mr_pcietopochg_evt_debug()
1775 static void mpi3mr_pcietopochg_evt_bh(struct mpi3mr_ioc *mrioc, in mpi3mr_pcietopochg_evt_bh() argument
1785 mpi3mr_pcietopochg_evt_debug(mrioc, event_data); in mpi3mr_pcietopochg_evt_bh()
1794 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, handle); in mpi3mr_pcietopochg_evt_bh()
1803 mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev); in mpi3mr_pcietopochg_evt_bh()
1804 mpi3mr_tgtdev_del_from_list(mrioc, tgtdev, false); in mpi3mr_pcietopochg_evt_bh()
1825 static void mpi3mr_logdata_evt_bh(struct mpi3mr_ioc *mrioc, in mpi3mr_logdata_evt_bh() argument
1828 mpi3mr_app_save_logdata(mrioc, fwevt->event_data, in mpi3mr_logdata_evt_bh()
1860 static void mpi3mr_set_qd_for_all_vd_in_tg(struct mpi3mr_ioc *mrioc, in mpi3mr_set_qd_for_all_vd_in_tg() argument
1868 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_set_qd_for_all_vd_in_tg()
1869 list_for_each_entry(tgtdev, &mrioc->tgtdev_list, list) { in mpi3mr_set_qd_for_all_vd_in_tg()
1873 dprint_event_bh(mrioc, in mpi3mr_set_qd_for_all_vd_in_tg()
1883 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_set_qd_for_all_vd_in_tg()
1896 static void mpi3mr_fwevt_bh(struct mpi3mr_ioc *mrioc, in mpi3mr_fwevt_bh() argument
1903 mpi3mr_fwevt_del_from_list(mrioc, fwevt); in mpi3mr_fwevt_bh()
1904 mrioc->current_event = fwevt; in mpi3mr_fwevt_bh()
1906 if (mrioc->stop_drv_processing) in mpi3mr_fwevt_bh()
1909 if (mrioc->unrecoverable) { in mpi3mr_fwevt_bh()
1910 dprint_event_bh(mrioc, in mpi3mr_fwevt_bh()
1926 mpi3mr_report_tgtdev_to_host(mrioc, perst_id); in mpi3mr_fwevt_bh()
1927 else if (mrioc->sas_transport_enabled && in mpi3mr_fwevt_bh()
1931 if (!mrioc->sas_hba.num_phys) in mpi3mr_fwevt_bh()
1932 mpi3mr_sas_host_add(mrioc); in mpi3mr_fwevt_bh()
1934 mpi3mr_sas_host_refresh(mrioc); in mpi3mr_fwevt_bh()
1937 mpi3mr_expander_add(mrioc, handle); in mpi3mr_fwevt_bh()
1946 mpi3mr_devinfochg_evt_bh(mrioc, dev_pg0); in mpi3mr_fwevt_bh()
1951 mpi3mr_devstatuschg_evt_bh(mrioc, fwevt); in mpi3mr_fwevt_bh()
1957 mpi3mr_encldev_add_chg_evt_bh(mrioc, fwevt); in mpi3mr_fwevt_bh()
1963 mpi3mr_sastopochg_evt_bh(mrioc, fwevt); in mpi3mr_fwevt_bh()
1968 mpi3mr_pcietopochg_evt_bh(mrioc, fwevt); in mpi3mr_fwevt_bh()
1973 mpi3mr_logdata_evt_bh(mrioc, fwevt); in mpi3mr_fwevt_bh()
1981 dprint_event_bh(mrioc, in mpi3mr_fwevt_bh()
1985 mpi3mr_set_qd_for_all_vd_in_tg(mrioc, tg); in mpi3mr_fwevt_bh()
1992 while (mrioc->device_refresh_on) in mpi3mr_fwevt_bh()
1995 dprint_event_bh(mrioc, in mpi3mr_fwevt_bh()
1997 if (mrioc->sas_transport_enabled) { in mpi3mr_fwevt_bh()
1998 mpi3mr_refresh_sas_ports(mrioc); in mpi3mr_fwevt_bh()
1999 mpi3mr_refresh_expanders(mrioc); in mpi3mr_fwevt_bh()
2001 mpi3mr_rfresh_tgtdevs(mrioc); in mpi3mr_fwevt_bh()
2002 ioc_info(mrioc, in mpi3mr_fwevt_bh()
2012 mpi3mr_process_event_ack(mrioc, fwevt->event_id, in mpi3mr_fwevt_bh()
2017 mrioc->current_event = NULL; in mpi3mr_fwevt_bh()
2032 mpi3mr_fwevt_bh(fwevt->mrioc, fwevt); in mpi3mr_fwevt_worker()
2052 static int mpi3mr_create_tgtdev(struct mpi3mr_ioc *mrioc, in mpi3mr_create_tgtdev() argument
2064 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_create_tgtdev()
2065 tgtdev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, perst_id); in mpi3mr_create_tgtdev()
2068 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_create_tgtdev()
2071 mpi3mr_update_tgtdev(mrioc, tgtdev, dev_pg0, true); in mpi3mr_create_tgtdev()
2077 mpi3mr_update_tgtdev(mrioc, tgtdev, dev_pg0, true); in mpi3mr_create_tgtdev()
2078 mpi3mr_tgtdev_add_to_list(mrioc, tgtdev); in mpi3mr_create_tgtdev()
2093 void mpi3mr_flush_delayed_cmd_lists(struct mpi3mr_ioc *mrioc) in mpi3mr_flush_delayed_cmd_lists() argument
2098 dprint_reset(mrioc, "flushing delayed dev_remove_hs commands\n"); in mpi3mr_flush_delayed_cmd_lists()
2099 while (!list_empty(&mrioc->delayed_rmhs_list)) { in mpi3mr_flush_delayed_cmd_lists()
2100 _rmhs_node = list_entry(mrioc->delayed_rmhs_list.next, in mpi3mr_flush_delayed_cmd_lists()
2105 dprint_reset(mrioc, "flushing delayed event ack commands\n"); in mpi3mr_flush_delayed_cmd_lists()
2106 while (!list_empty(&mrioc->delayed_evtack_cmds_list)) { in mpi3mr_flush_delayed_cmd_lists()
2107 _evtack_node = list_entry(mrioc->delayed_evtack_cmds_list.next, in mpi3mr_flush_delayed_cmd_lists()
2125 static void mpi3mr_dev_rmhs_complete_iou(struct mpi3mr_ioc *mrioc, in mpi3mr_dev_rmhs_complete_iou() argument
2134 ioc_info(mrioc, in mpi3mr_dev_rmhs_complete_iou()
2141 ioc_info(mrioc, in mpi3mr_dev_rmhs_complete_iou()
2145 mpi3mr_dev_rmhs_send_tm(mrioc, drv_cmd->dev_handle, in mpi3mr_dev_rmhs_complete_iou()
2149 ioc_err(mrioc, in mpi3mr_dev_rmhs_complete_iou()
2153 ioc_info(mrioc, in mpi3mr_dev_rmhs_complete_iou()
2156 clear_bit(drv_cmd->dev_handle, mrioc->removepend_bitmap); in mpi3mr_dev_rmhs_complete_iou()
2159 if (!list_empty(&mrioc->delayed_rmhs_list)) { in mpi3mr_dev_rmhs_complete_iou()
2160 delayed_dev_rmhs = list_entry(mrioc->delayed_rmhs_list.next, in mpi3mr_dev_rmhs_complete_iou()
2165 ioc_info(mrioc, in mpi3mr_dev_rmhs_complete_iou()
2168 mpi3mr_dev_rmhs_send_tm(mrioc, drv_cmd->dev_handle, drv_cmd, in mpi3mr_dev_rmhs_complete_iou()
2180 clear_bit(cmd_idx, mrioc->devrem_bitmap); in mpi3mr_dev_rmhs_complete_iou()
2194 static void mpi3mr_dev_rmhs_complete_tm(struct mpi3mr_ioc *mrioc, in mpi3mr_dev_rmhs_complete_tm() argument
2211 mrioc->name, drv_cmd->dev_handle, drv_cmd->ioc_status, in mpi3mr_dev_rmhs_complete_tm()
2216 mrioc->name, drv_cmd->dev_handle, cmd_idx); in mpi3mr_dev_rmhs_complete_tm()
2228 retval = mpi3mr_admin_request_post(mrioc, &iou_ctrl, sizeof(iou_ctrl), in mpi3mr_dev_rmhs_complete_tm()
2232 mrioc->name); in mpi3mr_dev_rmhs_complete_tm()
2242 clear_bit(cmd_idx, mrioc->devrem_bitmap); in mpi3mr_dev_rmhs_complete_tm()
2258 static void mpi3mr_dev_rmhs_send_tm(struct mpi3mr_ioc *mrioc, u16 handle, in mpi3mr_dev_rmhs_send_tm() argument
2270 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_dev_rmhs_send_tm()
2271 tgtdev = __mpi3mr_get_tgtdev_by_handle(mrioc, handle); in mpi3mr_dev_rmhs_send_tm()
2274 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_dev_rmhs_send_tm()
2279 cmd_idx = find_first_zero_bit(mrioc->devrem_bitmap, in mpi3mr_dev_rmhs_send_tm()
2282 if (!test_and_set_bit(cmd_idx, mrioc->devrem_bitmap)) in mpi3mr_dev_rmhs_send_tm()
2297 &mrioc->delayed_rmhs_list); in mpi3mr_dev_rmhs_send_tm()
2298 ioc_info(mrioc, "%s :DevRmHs: tr:handle(0x%04x) is postponed\n", in mpi3mr_dev_rmhs_send_tm()
2302 drv_cmd = &mrioc->dev_rmhs_cmds[cmd_idx]; in mpi3mr_dev_rmhs_send_tm()
2306 ioc_info(mrioc, in mpi3mr_dev_rmhs_send_tm()
2312 ioc_err(mrioc, "%s :Issue TM: Command is in use\n", __func__); in mpi3mr_dev_rmhs_send_tm()
2326 set_bit(handle, mrioc->removepend_bitmap); in mpi3mr_dev_rmhs_send_tm()
2327 retval = mpi3mr_admin_request_post(mrioc, &tm_req, sizeof(tm_req), 1); in mpi3mr_dev_rmhs_send_tm()
2329 ioc_err(mrioc, "%s :Issue DevRmHsTM: Admin Post failed\n", in mpi3mr_dev_rmhs_send_tm()
2340 clear_bit(cmd_idx, mrioc->devrem_bitmap); in mpi3mr_dev_rmhs_send_tm()
2354 static void mpi3mr_complete_evt_ack(struct mpi3mr_ioc *mrioc, in mpi3mr_complete_evt_ack() argument
2364 dprint_event_th(mrioc, in mpi3mr_complete_evt_ack()
2370 if (!list_empty(&mrioc->delayed_evtack_cmds_list)) { in mpi3mr_complete_evt_ack()
2372 list_entry(mrioc->delayed_evtack_cmds_list.next, in mpi3mr_complete_evt_ack()
2374 mpi3mr_send_event_ack(mrioc, delayed_evtack->event, drv_cmd, in mpi3mr_complete_evt_ack()
2383 clear_bit(cmd_idx, mrioc->evtack_cmds_bitmap); in mpi3mr_complete_evt_ack()
2400 static void mpi3mr_send_event_ack(struct mpi3mr_ioc *mrioc, u8 event, in mpi3mr_send_event_ack() argument
2411 dprint_event_th(mrioc, in mpi3mr_send_event_ack()
2416 dprint_event_th(mrioc, in mpi3mr_send_event_ack()
2420 cmd_idx = find_first_zero_bit(mrioc->evtack_cmds_bitmap, in mpi3mr_send_event_ack()
2424 mrioc->evtack_cmds_bitmap)) in mpi3mr_send_event_ack()
2439 &mrioc->delayed_evtack_cmds_list); in mpi3mr_send_event_ack()
2440 dprint_event_th(mrioc, in mpi3mr_send_event_ack()
2445 drv_cmd = &mrioc->evtack_cmds[cmd_idx]; in mpi3mr_send_event_ack()
2452 dprint_event_th(mrioc, in mpi3mr_send_event_ack()
2463 retval = mpi3mr_admin_request_post(mrioc, &evtack_req, in mpi3mr_send_event_ack()
2466 dprint_event_th(mrioc, in mpi3mr_send_event_ack()
2471 dprint_event_th(mrioc, in mpi3mr_send_event_ack()
2479 clear_bit(cmd_idx, mrioc->evtack_cmds_bitmap); in mpi3mr_send_event_ack()
2494 static void mpi3mr_pcietopochg_evt_th(struct mpi3mr_ioc *mrioc, in mpi3mr_pcietopochg_evt_th() argument
2511 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, handle); in mpi3mr_pcietopochg_evt_th()
2522 mpi3mr_dev_rmhs_send_tm(mrioc, handle, NULL, in mpi3mr_pcietopochg_evt_th()
2560 static void mpi3mr_sastopochg_evt_th(struct mpi3mr_ioc *mrioc, in mpi3mr_sastopochg_evt_th() argument
2578 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, handle); in mpi3mr_sastopochg_evt_th()
2589 mpi3mr_dev_rmhs_send_tm(mrioc, handle, NULL, in mpi3mr_sastopochg_evt_th()
2627 static void mpi3mr_devstatuschg_evt_th(struct mpi3mr_ioc *mrioc, in mpi3mr_devstatuschg_evt_th() argument
2637 if (mrioc->stop_drv_processing) in mpi3mr_devstatuschg_evt_th()
2663 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, dev_handle); in mpi3mr_devstatuschg_evt_th()
2679 mpi3mr_dev_rmhs_send_tm(mrioc, dev_handle, NULL, in mpi3mr_devstatuschg_evt_th()
2682 mpi3mr_dev_rmhs_send_tm(mrioc, dev_handle, NULL, in mpi3mr_devstatuschg_evt_th()
2699 static void mpi3mr_preparereset_evt_th(struct mpi3mr_ioc *mrioc, in mpi3mr_preparereset_evt_th() argument
2706 dprint_event_th(mrioc, in mpi3mr_preparereset_evt_th()
2708 if (mrioc->prepare_for_reset) in mpi3mr_preparereset_evt_th()
2710 mrioc->prepare_for_reset = 1; in mpi3mr_preparereset_evt_th()
2711 mrioc->prepare_for_reset_timeout_counter = 0; in mpi3mr_preparereset_evt_th()
2713 dprint_event_th(mrioc, in mpi3mr_preparereset_evt_th()
2715 mrioc->prepare_for_reset = 0; in mpi3mr_preparereset_evt_th()
2716 mrioc->prepare_for_reset_timeout_counter = 0; in mpi3mr_preparereset_evt_th()
2720 mpi3mr_send_event_ack(mrioc, event_reply->event, NULL, in mpi3mr_preparereset_evt_th()
2733 static void mpi3mr_energypackchg_evt_th(struct mpi3mr_ioc *mrioc, in mpi3mr_energypackchg_evt_th() argument
2741 ioc_warn(mrioc, in mpi3mr_energypackchg_evt_th()
2747 ioc_info(mrioc, in mpi3mr_energypackchg_evt_th()
2749 __func__, mrioc->facts.shutdown_timeout, shutdown_timeout); in mpi3mr_energypackchg_evt_th()
2750 mrioc->facts.shutdown_timeout = shutdown_timeout; in mpi3mr_energypackchg_evt_th()
2762 static void mpi3mr_cablemgmt_evt_th(struct mpi3mr_ioc *mrioc, in mpi3mr_cablemgmt_evt_th() argument
2771 ioc_info(mrioc, "An active cable with receptacle_id %d cannot be powered.\n" in mpi3mr_cablemgmt_evt_th()
2780 ioc_info(mrioc, "A cable with receptacle_id %d is not running at optimal speed\n", in mpi3mr_cablemgmt_evt_th()
2798 void mpi3mr_add_event_wait_for_device_refresh(struct mpi3mr_ioc *mrioc) in mpi3mr_add_event_wait_for_device_refresh() argument
2804 dprint_event_th(mrioc, in mpi3mr_add_event_wait_for_device_refresh()
2809 fwevt->mrioc = mrioc; in mpi3mr_add_event_wait_for_device_refresh()
2815 mpi3mr_fwevt_add_to_list(mrioc, fwevt); in mpi3mr_add_event_wait_for_device_refresh()
2829 void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc, in mpi3mr_os_handle_events() argument
2836 if (mrioc->stop_drv_processing) in mpi3mr_os_handle_events()
2850 if (mpi3mr_create_tgtdev(mrioc, dev_pg0)) in mpi3mr_os_handle_events()
2851 ioc_err(mrioc, in mpi3mr_os_handle_events()
2861 mpi3mr_devstatuschg_evt_th(mrioc, event_reply); in mpi3mr_os_handle_events()
2867 mpi3mr_sastopochg_evt_th(mrioc, event_reply); in mpi3mr_os_handle_events()
2873 mpi3mr_pcietopochg_evt_th(mrioc, event_reply); in mpi3mr_os_handle_events()
2878 mpi3mr_preparereset_evt_th(mrioc, event_reply); in mpi3mr_os_handle_events()
2892 mpi3mr_energypackchg_evt_th(mrioc, event_reply); in mpi3mr_os_handle_events()
2897 mpi3mr_cablemgmt_evt_th(mrioc, event_reply); in mpi3mr_os_handle_events()
2906 ioc_info(mrioc, "%s :event 0x%02x is not handled\n", in mpi3mr_os_handle_events()
2914 ioc_info(mrioc, "%s :failure at %s:%d/%s()!\n", in mpi3mr_os_handle_events()
2920 fwevt->mrioc = mrioc; in mpi3mr_os_handle_events()
2925 mpi3mr_fwevt_add_to_list(mrioc, fwevt); in mpi3mr_os_handle_events()
2941 static void mpi3mr_setup_eedp(struct mpi3mr_ioc *mrioc, in mpi3mr_setup_eedp() argument
3110 void mpi3mr_process_op_reply_desc(struct mpi3mr_ioc *mrioc, in mpi3mr_process_op_reply_desc() argument
3149 scsi_reply = mpi3mr_get_reply_virt_addr(mrioc, in mpi3mr_process_op_reply_desc()
3153 mrioc->name); in mpi3mr_process_op_reply_desc()
3165 sense_buf = mpi3mr_get_sensebuf_virt_addr(mrioc, in mpi3mr_process_op_reply_desc()
3172 panic("%s: Ran out of sense buffers\n", mrioc->name); in mpi3mr_process_op_reply_desc()
3181 scmd = mpi3mr_scmd_from_host_tag(mrioc, host_tag, qidx); in mpi3mr_process_op_reply_desc()
3184 mrioc->name, host_tag); in mpi3mr_process_op_reply_desc()
3199 if (unlikely((data_len_blks >= mrioc->io_throttle_data_length) && in mpi3mr_process_op_reply_desc()
3202 &mrioc->pend_large_data_sz); in mpi3mr_process_op_reply_desc()
3207 mrioc->io_throttle_low) && in mpi3mr_process_op_reply_desc()
3211 mrioc, tg, 0); in mpi3mr_process_op_reply_desc()
3214 if (ioc_pend_data_len <= mrioc->io_throttle_low) in mpi3mr_process_op_reply_desc()
3218 ioc_pend_data_len = atomic_read(&mrioc->pend_large_data_sz); in mpi3mr_process_op_reply_desc()
3220 if (ioc_pend_data_len <= mrioc->io_throttle_low) in mpi3mr_process_op_reply_desc()
3223 } else if (ioc_pend_data_len <= mrioc->io_throttle_low) { in mpi3mr_process_op_reply_desc()
3228 mrioc, tg, 0); in mpi3mr_process_op_reply_desc()
3322 mrioc->logging_level & MPI3_DEBUG_SCSI_ERROR) { in mpi3mr_process_op_reply_desc()
3323 ioc_info(mrioc, "%s :scmd->result 0x%x\n", __func__, in mpi3mr_process_op_reply_desc()
3326 ioc_info(mrioc, in mpi3mr_process_op_reply_desc()
3330 ioc_info(mrioc, in mpi3mr_process_op_reply_desc()
3335 ioc_info(mrioc, in mpi3mr_process_op_reply_desc()
3343 dma_unmap_sg(&mrioc->pdev->dev, scsi_prot_sglist(scmd), in mpi3mr_process_op_reply_desc()
3346 mpi3mr_clear_scmd_priv(mrioc, scmd); in mpi3mr_process_op_reply_desc()
3351 mpi3mr_repost_sense_buf(mrioc, in mpi3mr_process_op_reply_desc()
3363 static int mpi3mr_get_chain_idx(struct mpi3mr_ioc *mrioc) in mpi3mr_get_chain_idx() argument
3369 spin_lock_irqsave(&mrioc->chain_buf_lock, flags); in mpi3mr_get_chain_idx()
3371 cmd_idx = find_first_zero_bit(mrioc->chain_bitmap, in mpi3mr_get_chain_idx()
3372 mrioc->chain_buf_count); in mpi3mr_get_chain_idx()
3373 if (cmd_idx < mrioc->chain_buf_count) { in mpi3mr_get_chain_idx()
3374 set_bit(cmd_idx, mrioc->chain_bitmap); in mpi3mr_get_chain_idx()
3379 spin_unlock_irqrestore(&mrioc->chain_buf_lock, flags); in mpi3mr_get_chain_idx()
3395 static int mpi3mr_prepare_sg_scmd(struct mpi3mr_ioc *mrioc, in mpi3mr_prepare_sg_scmd() argument
3433 sges_left = dma_map_sg(&mrioc->pdev->dev, in mpi3mr_prepare_sg_scmd()
3449 if (sges_left > mrioc->max_sgl_entries) { in mpi3mr_prepare_sg_scmd()
3456 sges_in_segment = (mrioc->facts.op_req_sz - in mpi3mr_prepare_sg_scmd()
3488 chain_idx = mpi3mr_get_chain_idx(mrioc); in mpi3mr_prepare_sg_scmd()
3491 chain_req = &mrioc->chain_sgl_list[chain_idx]; in mpi3mr_prepare_sg_scmd()
3536 static int mpi3mr_build_sg_scmd(struct mpi3mr_ioc *mrioc, in mpi3mr_build_sg_scmd() argument
3541 ret = mpi3mr_prepare_sg_scmd(mrioc, scmd, scsiio_req); in mpi3mr_build_sg_scmd()
3549 ret = mpi3mr_prepare_sg_scmd(mrioc, scmd, scsiio_req); in mpi3mr_build_sg_scmd()
3604 inline void mpi3mr_poll_pend_io_completions(struct mpi3mr_ioc *mrioc) in mpi3mr_poll_pend_io_completions() argument
3608 mrioc->num_op_reply_q + mrioc->op_reply_q_offset; in mpi3mr_poll_pend_io_completions()
3610 for (i = mrioc->op_reply_q_offset; i < num_of_reply_queues; i++) in mpi3mr_poll_pend_io_completions()
3611 mpi3mr_process_op_reply_q(mrioc, in mpi3mr_poll_pend_io_completions()
3612 mrioc->intr_info[i].op_reply_q); in mpi3mr_poll_pend_io_completions()
3634 int mpi3mr_issue_tm(struct mpi3mr_ioc *mrioc, u8 tm_type, in mpi3mr_issue_tm() argument
3648 ioc_info(mrioc, "%s :Issue TM: TM type (0x%x) for devhandle 0x%04x\n", in mpi3mr_issue_tm()
3650 if (mrioc->unrecoverable) { in mpi3mr_issue_tm()
3652 ioc_err(mrioc, "%s :Issue TM: Unrecoverable controller\n", in mpi3mr_issue_tm()
3661 ioc_err(mrioc, "%s :Issue TM: Command is in use\n", __func__); in mpi3mr_issue_tm()
3665 if (mrioc->reset_in_progress) { in mpi3mr_issue_tm()
3667 ioc_err(mrioc, "%s :Issue TM: Reset in progress\n", __func__); in mpi3mr_issue_tm()
3682 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, handle); in mpi3mr_issue_tm()
3706 retval = mpi3mr_admin_request_post(mrioc, &tm_req, sizeof(tm_req), 1); in mpi3mr_issue_tm()
3708 ioc_err(mrioc, "%s :Issue TM: Admin Post failed\n", __func__); in mpi3mr_issue_tm()
3717 dprint_tm(mrioc, in mpi3mr_issue_tm()
3720 if (mrioc->logging_level & MPI3_DEBUG_TM) in mpi3mr_issue_tm()
3722 mpi3mr_soft_reset_handler(mrioc, in mpi3mr_issue_tm()
3729 dprint_tm(mrioc, "invalid task management reply message\n"); in mpi3mr_issue_tm()
3745 dprint_tm(mrioc, in mpi3mr_issue_tm()
3765 dprint_tm(mrioc, in mpi3mr_issue_tm()
3772 mpi3mr_ioc_disable_intr(mrioc); in mpi3mr_issue_tm()
3773 mpi3mr_poll_pend_io_completions(mrioc); in mpi3mr_issue_tm()
3774 mpi3mr_ioc_enable_intr(mrioc); in mpi3mr_issue_tm()
3775 mpi3mr_poll_pend_io_completions(mrioc); in mpi3mr_issue_tm()
3776 mpi3mr_process_admin_reply_q(mrioc); in mpi3mr_issue_tm()
3783 blk_mq_tagset_busy_iter(&mrioc->shost->tag_set, in mpi3mr_issue_tm()
3791 blk_mq_tagset_busy_iter(&mrioc->shost->tag_set, in mpi3mr_issue_tm()
3859 struct mpi3mr_ioc *mrioc = shost_priv(shost); in mpi3mr_map_queues() local
3863 offset = mrioc->op_reply_q_offset; in mpi3mr_map_queues()
3871 map->nr_queues = mrioc->default_qcount; in mpi3mr_map_queues()
3873 map->nr_queues = mrioc->active_poll_qcount; in mpi3mr_map_queues()
3886 blk_mq_pci_map_queues(map, mrioc->pdev, offset); in mpi3mr_map_queues()
3903 static inline int mpi3mr_get_fw_pending_ios(struct mpi3mr_ioc *mrioc) in mpi3mr_get_fw_pending_ios() argument
3908 for (i = 0; i < mrioc->num_op_reply_q; i++) in mpi3mr_get_fw_pending_ios()
3909 pend_ios += atomic_read(&mrioc->op_reply_qinfo[i].pend_ios); in mpi3mr_get_fw_pending_ios()
3922 static void mpi3mr_print_pending_host_io(struct mpi3mr_ioc *mrioc) in mpi3mr_print_pending_host_io() argument
3924 struct Scsi_Host *shost = mrioc->shost; in mpi3mr_print_pending_host_io()
3926 ioc_info(mrioc, "%s :Pending commands prior to reset: %d\n", in mpi3mr_print_pending_host_io()
3927 __func__, mpi3mr_get_fw_pending_ios(mrioc)); in mpi3mr_print_pending_host_io()
3929 mpi3mr_print_scmd, (void *)mrioc); in mpi3mr_print_pending_host_io()
3941 void mpi3mr_wait_for_host_io(struct mpi3mr_ioc *mrioc, u32 timeout) in mpi3mr_wait_for_host_io() argument
3946 iocstate = mpi3mr_get_iocstate(mrioc); in mpi3mr_wait_for_host_io()
3950 if (!mpi3mr_get_fw_pending_ios(mrioc)) in mpi3mr_wait_for_host_io()
3952 ioc_info(mrioc, in mpi3mr_wait_for_host_io()
3954 __func__, timeout, mpi3mr_get_fw_pending_ios(mrioc)); in mpi3mr_wait_for_host_io()
3957 if (!mpi3mr_get_fw_pending_ios(mrioc)) in mpi3mr_wait_for_host_io()
3959 iocstate = mpi3mr_get_iocstate(mrioc); in mpi3mr_wait_for_host_io()
3965 ioc_info(mrioc, "%s :Pending I/Os after wait is: %d\n", __func__, in mpi3mr_wait_for_host_io()
3966 mpi3mr_get_fw_pending_ios(mrioc)); in mpi3mr_wait_for_host_io()
3983 static inline void mpi3mr_setup_divert_ws(struct mpi3mr_ioc *mrioc, in mpi3mr_setup_divert_ws() argument
4024 struct mpi3mr_ioc *mrioc = shost_priv(scmd->device->host); in mpi3mr_eh_host_reset() local
4037 mpi3mr_wait_for_host_io(mrioc, in mpi3mr_eh_host_reset()
4039 if (!mpi3mr_get_fw_pending_ios(mrioc)) { in mpi3mr_eh_host_reset()
4045 mpi3mr_print_pending_host_io(mrioc); in mpi3mr_eh_host_reset()
4046 ret = mpi3mr_soft_reset_handler(mrioc, in mpi3mr_eh_host_reset()
4072 struct mpi3mr_ioc *mrioc = shost_priv(scmd->device->host); in mpi3mr_eh_target_reset() local
4097 mrioc->name, dev_handle); in mpi3mr_eh_target_reset()
4108 ret = mpi3mr_issue_tm(mrioc, in mpi3mr_eh_target_reset()
4111 MPI3MR_RESETTM_TIMEOUT, &mrioc->host_tm_cmds, &resp_code, scmd); in mpi3mr_eh_target_reset()
4119 mrioc->name, stgt_priv_data->pend_count); in mpi3mr_eh_target_reset()
4126 "%s: target reset is %s for scmd(%p)\n", mrioc->name, in mpi3mr_eh_target_reset()
4144 struct mpi3mr_ioc *mrioc = shost_priv(scmd->device->host); in mpi3mr_eh_dev_reset() local
4169 mrioc->name, dev_handle); in mpi3mr_eh_dev_reset()
4179 ret = mpi3mr_issue_tm(mrioc, in mpi3mr_eh_dev_reset()
4182 MPI3MR_RESETTM_TIMEOUT, &mrioc->host_tm_cmds, &resp_code, scmd); in mpi3mr_eh_dev_reset()
4190 mrioc->name, sdev_priv_data->pend_count); in mpi3mr_eh_dev_reset()
4196 "%s: device(LUN) reset is %s for scmd(%p)\n", mrioc->name, in mpi3mr_eh_dev_reset()
4212 struct mpi3mr_ioc *mrioc = shost_priv(shost); in mpi3mr_scan_start() local
4214 mrioc->scan_started = 1; in mpi3mr_scan_start()
4215 ioc_info(mrioc, "%s :Issuing Port Enable\n", __func__); in mpi3mr_scan_start()
4216 if (mpi3mr_issue_port_enable(mrioc, 1)) { in mpi3mr_scan_start()
4217 ioc_err(mrioc, "%s :Issuing port enable failed\n", __func__); in mpi3mr_scan_start()
4218 mrioc->scan_started = 0; in mpi3mr_scan_start()
4219 mrioc->scan_failed = MPI3_IOCSTATUS_INTERNAL_ERROR; in mpi3mr_scan_start()
4237 struct mpi3mr_ioc *mrioc = shost_priv(shost); in mpi3mr_scan_finished() local
4239 u32 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_scan_finished()
4243 ioc_err(mrioc, "port enable failed due to fault or reset\n"); in mpi3mr_scan_finished()
4244 mpi3mr_print_fault_info(mrioc); in mpi3mr_scan_finished()
4245 mrioc->scan_failed = MPI3_IOCSTATUS_INTERNAL_ERROR; in mpi3mr_scan_finished()
4246 mrioc->scan_started = 0; in mpi3mr_scan_finished()
4247 mrioc->init_cmds.is_waiting = 0; in mpi3mr_scan_finished()
4248 mrioc->init_cmds.callback = NULL; in mpi3mr_scan_finished()
4249 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_scan_finished()
4253 ioc_err(mrioc, "port enable failed due to time out\n"); in mpi3mr_scan_finished()
4254 mpi3mr_check_rh_fault_ioc(mrioc, in mpi3mr_scan_finished()
4256 mrioc->scan_failed = MPI3_IOCSTATUS_INTERNAL_ERROR; in mpi3mr_scan_finished()
4257 mrioc->scan_started = 0; in mpi3mr_scan_finished()
4258 mrioc->init_cmds.is_waiting = 0; in mpi3mr_scan_finished()
4259 mrioc->init_cmds.callback = NULL; in mpi3mr_scan_finished()
4260 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_scan_finished()
4263 if (mrioc->scan_started) in mpi3mr_scan_finished()
4266 if (mrioc->scan_failed) { in mpi3mr_scan_finished()
4267 ioc_err(mrioc, in mpi3mr_scan_finished()
4269 mrioc->scan_failed); in mpi3mr_scan_finished()
4271 ioc_info(mrioc, "port enable is successfully completed\n"); in mpi3mr_scan_finished()
4273 mpi3mr_start_watchdog(mrioc); in mpi3mr_scan_finished()
4274 mrioc->is_driver_loading = 0; in mpi3mr_scan_finished()
4275 mrioc->stop_bsgs = 0; in mpi3mr_scan_finished()
4290 struct mpi3mr_ioc *mrioc; in mpi3mr_slave_destroy() local
4302 mrioc = shost_priv(shost); in mpi3mr_slave_destroy()
4307 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_slave_destroy()
4308 if (starget->channel == mrioc->scsi_device_channel) in mpi3mr_slave_destroy()
4309 tgt_dev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, starget->id); in mpi3mr_slave_destroy()
4310 else if (mrioc->sas_transport_enabled && !starget->channel) { in mpi3mr_slave_destroy()
4312 tgt_dev = __mpi3mr_get_tgtdev_by_addr_and_rphy(mrioc, in mpi3mr_slave_destroy()
4320 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_slave_destroy()
4337 struct mpi3mr_ioc *mrioc; in mpi3mr_target_destroy() local
4346 mrioc = shost_priv(shost); in mpi3mr_target_destroy()
4349 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_target_destroy()
4350 tgt_dev = __mpi3mr_get_tgtdev_from_tgtpriv(mrioc, scsi_tgt_priv_data); in mpi3mr_target_destroy()
4360 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_target_destroy()
4379 struct mpi3mr_ioc *mrioc; in mpi3mr_slave_configure() local
4387 mrioc = shost_priv(shost); in mpi3mr_slave_configure()
4389 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_slave_configure()
4390 if (starget->channel == mrioc->scsi_device_channel) in mpi3mr_slave_configure()
4391 tgt_dev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, starget->id); in mpi3mr_slave_configure()
4392 else if (mrioc->sas_transport_enabled && !starget->channel) { in mpi3mr_slave_configure()
4394 tgt_dev = __mpi3mr_get_tgtdev_by_addr_and_rphy(mrioc, in mpi3mr_slave_configure()
4397 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_slave_configure()
4442 struct mpi3mr_ioc *mrioc; in mpi3mr_slave_alloc() local
4453 mrioc = shost_priv(shost); in mpi3mr_slave_alloc()
4456 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_slave_alloc()
4458 if (starget->channel == mrioc->scsi_device_channel) in mpi3mr_slave_alloc()
4459 tgt_dev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, starget->id); in mpi3mr_slave_alloc()
4460 else if (mrioc->sas_transport_enabled && !starget->channel) { in mpi3mr_slave_alloc()
4462 tgt_dev = __mpi3mr_get_tgtdev_by_addr_and_rphy(mrioc, in mpi3mr_slave_alloc()
4472 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_slave_alloc()
4476 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_slave_alloc()
4502 struct mpi3mr_ioc *mrioc = shost_priv(shost); in mpi3mr_target_alloc() local
4515 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_target_alloc()
4516 if (starget->channel == mrioc->scsi_device_channel) { in mpi3mr_target_alloc()
4517 tgt_dev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, starget->id); in mpi3mr_target_alloc()
4541 } else if (mrioc->sas_transport_enabled && !starget->channel) { in mpi3mr_target_alloc()
4543 tgt_dev = __mpi3mr_get_tgtdev_by_addr_and_rphy(mrioc, in mpi3mr_target_alloc()
4560 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_target_alloc()
4577 static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc, in mpi3mr_check_return_unmap() argument
4585 if (mrioc->pdev->revision) { in mpi3mr_check_return_unmap()
4588 dprint_scsi_command(mrioc, scmd, MPI3_DEBUG_SCSI_ERROR); in mpi3mr_check_return_unmap()
4589 dprint_scsi_err(mrioc, in mpi3mr_check_return_unmap()
4593 dprint_scsi_command(mrioc, scmd, MPI3_DEBUG_SCSI_ERROR); in mpi3mr_check_return_unmap()
4599 ioc_warn(mrioc, in mpi3mr_check_return_unmap()
4609 ioc_warn(mrioc, in mpi3mr_check_return_unmap()
4620 ioc_warn(mrioc, in mpi3mr_check_return_unmap()
4643 ioc_warn(mrioc, in mpi3mr_check_return_unmap()
4658 dprint_scsi_err(mrioc, in mpi3mr_check_return_unmap()
4704 struct mpi3mr_ioc *mrioc = shost_priv(shost); in mpi3mr_qcmd() local
4721 if (mrioc->unrecoverable) { in mpi3mr_qcmd()
4734 if (mrioc->stop_drv_processing && in mpi3mr_qcmd()
4754 if (mrioc->reset_in_progress) { in mpi3mr_qcmd()
4760 if (mrioc->stop_drv_processing) { in mpi3mr_qcmd()
4783 (mrioc->pdev->device == MPI3_MFGPAGE_DEVID_SAS4116) && in mpi3mr_qcmd()
4784 mpi3mr_check_return_unmap(mrioc, scmd)) in mpi3mr_qcmd()
4787 host_tag = mpi3mr_host_tag_for_scmd(mrioc, scmd); in mpi3mr_qcmd()
4818 mpi3mr_setup_eedp(mrioc, scmd, scsiio_req); in mpi3mr_qcmd()
4821 mpi3mr_setup_divert_ws(mrioc, scmd, scsiio_req, &scsiio_flags, in mpi3mr_qcmd()
4831 if (mpi3mr_build_sg_scmd(mrioc, scmd, scsiio_req)) { in mpi3mr_qcmd()
4832 mpi3mr_clear_scmd_priv(mrioc, scmd); in mpi3mr_qcmd()
4836 op_req_q = &mrioc->req_qinfo[scmd_priv_data->req_q_idx]; in mpi3mr_qcmd()
4838 if ((data_len_blks >= mrioc->io_throttle_data_length) && in mpi3mr_qcmd()
4844 &mrioc->pend_large_data_sz); in mpi3mr_qcmd()
4848 mrioc->io_throttle_high) || in mpi3mr_qcmd()
4852 mpi3mr_set_io_divert_for_all_vd_in_tg(mrioc, in mpi3mr_qcmd()
4854 mpi3mr_queue_qd_reduction_event(mrioc, tg); in mpi3mr_qcmd()
4858 &mrioc->pend_large_data_sz); in mpi3mr_qcmd()
4859 if (ioc_pend_data_len >= mrioc->io_throttle_high) in mpi3mr_qcmd()
4871 if (mpi3mr_op_request_post(mrioc, op_req_q, in mpi3mr_qcmd()
4873 mpi3mr_clear_scmd_priv(mrioc, scmd); in mpi3mr_qcmd()
4876 atomic_sub(tracked_io_sz, &mrioc->pend_large_data_sz); in mpi3mr_qcmd()
5029 struct mpi3mr_ioc *mrioc = NULL; in mpi3mr_probe() local
5045 mrioc = shost_priv(shost); in mpi3mr_probe()
5046 mrioc->id = mrioc_ids++; in mpi3mr_probe()
5047 sprintf(mrioc->driver_name, "%s", MPI3MR_DRIVER_NAME); in mpi3mr_probe()
5048 sprintf(mrioc->name, "%s%d", mrioc->driver_name, mrioc->id); in mpi3mr_probe()
5049 INIT_LIST_HEAD(&mrioc->list); in mpi3mr_probe()
5051 list_add_tail(&mrioc->list, &mrioc_list); in mpi3mr_probe()
5054 spin_lock_init(&mrioc->admin_req_lock); in mpi3mr_probe()
5055 spin_lock_init(&mrioc->reply_free_queue_lock); in mpi3mr_probe()
5056 spin_lock_init(&mrioc->sbq_lock); in mpi3mr_probe()
5057 spin_lock_init(&mrioc->fwevt_lock); in mpi3mr_probe()
5058 spin_lock_init(&mrioc->tgtdev_lock); in mpi3mr_probe()
5059 spin_lock_init(&mrioc->watchdog_lock); in mpi3mr_probe()
5060 spin_lock_init(&mrioc->chain_buf_lock); in mpi3mr_probe()
5061 spin_lock_init(&mrioc->sas_node_lock); in mpi3mr_probe()
5063 INIT_LIST_HEAD(&mrioc->fwevt_list); in mpi3mr_probe()
5064 INIT_LIST_HEAD(&mrioc->tgtdev_list); in mpi3mr_probe()
5065 INIT_LIST_HEAD(&mrioc->delayed_rmhs_list); in mpi3mr_probe()
5066 INIT_LIST_HEAD(&mrioc->delayed_evtack_cmds_list); in mpi3mr_probe()
5067 INIT_LIST_HEAD(&mrioc->sas_expander_list); in mpi3mr_probe()
5068 INIT_LIST_HEAD(&mrioc->hba_port_table_list); in mpi3mr_probe()
5069 INIT_LIST_HEAD(&mrioc->enclosure_list); in mpi3mr_probe()
5071 mutex_init(&mrioc->reset_mutex); in mpi3mr_probe()
5072 mpi3mr_init_drv_cmd(&mrioc->init_cmds, MPI3MR_HOSTTAG_INITCMDS); in mpi3mr_probe()
5073 mpi3mr_init_drv_cmd(&mrioc->host_tm_cmds, MPI3MR_HOSTTAG_BLK_TMS); in mpi3mr_probe()
5074 mpi3mr_init_drv_cmd(&mrioc->bsg_cmds, MPI3MR_HOSTTAG_BSG_CMDS); in mpi3mr_probe()
5075 mpi3mr_init_drv_cmd(&mrioc->cfg_cmds, MPI3MR_HOSTTAG_CFG_CMDS); in mpi3mr_probe()
5076 mpi3mr_init_drv_cmd(&mrioc->transport_cmds, in mpi3mr_probe()
5080 mpi3mr_init_drv_cmd(&mrioc->dev_rmhs_cmds[i], in mpi3mr_probe()
5084 mpi3mr_init_drv_cmd(&mrioc->evtack_cmds[i], in mpi3mr_probe()
5088 mrioc->enable_segqueue = true; in mpi3mr_probe()
5090 init_waitqueue_head(&mrioc->reset_waitq); in mpi3mr_probe()
5091 mrioc->logging_level = logging_level; in mpi3mr_probe()
5092 mrioc->shost = shost; in mpi3mr_probe()
5093 mrioc->pdev = pdev; in mpi3mr_probe()
5094 mrioc->stop_bsgs = 1; in mpi3mr_probe()
5096 mrioc->max_sgl_entries = max_sgl_entries; in mpi3mr_probe()
5098 mrioc->max_sgl_entries = MPI3MR_MAX_SGL_ENTRIES; in mpi3mr_probe()
5100 mrioc->max_sgl_entries = MPI3MR_DEFAULT_SGL_ENTRIES; in mpi3mr_probe()
5102 mrioc->max_sgl_entries /= MPI3MR_DEFAULT_SGL_ENTRIES; in mpi3mr_probe()
5103 mrioc->max_sgl_entries *= MPI3MR_DEFAULT_SGL_ENTRIES; in mpi3mr_probe()
5109 shost->unique_id = mrioc->id; in mpi3mr_probe()
5125 ioc_info(mrioc, in mpi3mr_probe()
5141 snprintf(mrioc->fwevt_worker_name, sizeof(mrioc->fwevt_worker_name), in mpi3mr_probe()
5142 "%s%d_fwevt_wrkr", mrioc->driver_name, mrioc->id); in mpi3mr_probe()
5143 mrioc->fwevt_worker_thread = alloc_ordered_workqueue( in mpi3mr_probe()
5144 mrioc->fwevt_worker_name, 0); in mpi3mr_probe()
5145 if (!mrioc->fwevt_worker_thread) { in mpi3mr_probe()
5146 ioc_err(mrioc, "failure at %s:%d/%s()!\n", in mpi3mr_probe()
5152 mrioc->is_driver_loading = 1; in mpi3mr_probe()
5153 mrioc->cpu_count = num_online_cpus(); in mpi3mr_probe()
5154 if (mpi3mr_setup_resources(mrioc)) { in mpi3mr_probe()
5155 ioc_err(mrioc, "setup resources failed\n"); in mpi3mr_probe()
5159 if (mpi3mr_init_ioc(mrioc)) { in mpi3mr_probe()
5160 ioc_err(mrioc, "initializing IOC failed\n"); in mpi3mr_probe()
5165 shost->nr_hw_queues = mrioc->num_op_reply_q; in mpi3mr_probe()
5166 if (mrioc->active_poll_qcount) in mpi3mr_probe()
5169 shost->can_queue = mrioc->max_host_ios; in mpi3mr_probe()
5170 shost->sg_tablesize = mrioc->max_sgl_entries; in mpi3mr_probe()
5171 shost->max_id = mrioc->facts.max_perids + 1; in mpi3mr_probe()
5175 ioc_err(mrioc, "failure at %s:%d/%s()!\n", in mpi3mr_probe()
5181 mpi3mr_bsg_init(mrioc); in mpi3mr_probe()
5185 mpi3mr_stop_watchdog(mrioc); in mpi3mr_probe()
5186 mpi3mr_cleanup_ioc(mrioc); in mpi3mr_probe()
5188 mpi3mr_free_mem(mrioc); in mpi3mr_probe()
5189 mpi3mr_cleanup_resources(mrioc); in mpi3mr_probe()
5191 destroy_workqueue(mrioc->fwevt_worker_thread); in mpi3mr_probe()
5194 list_del(&mrioc->list); in mpi3mr_probe()
5214 struct mpi3mr_ioc *mrioc; in mpi3mr_remove() local
5224 mrioc = shost_priv(shost); in mpi3mr_remove()
5225 while (mrioc->reset_in_progress || mrioc->is_driver_loading) in mpi3mr_remove()
5228 if (!pci_device_is_present(mrioc->pdev)) { in mpi3mr_remove()
5229 mrioc->unrecoverable = 1; in mpi3mr_remove()
5230 mpi3mr_flush_cmds_for_unrecovered_controller(mrioc); in mpi3mr_remove()
5233 mpi3mr_bsg_exit(mrioc); in mpi3mr_remove()
5234 mrioc->stop_drv_processing = 1; in mpi3mr_remove()
5235 mpi3mr_cleanup_fwevt_list(mrioc); in mpi3mr_remove()
5236 spin_lock_irqsave(&mrioc->fwevt_lock, flags); in mpi3mr_remove()
5237 wq = mrioc->fwevt_worker_thread; in mpi3mr_remove()
5238 mrioc->fwevt_worker_thread = NULL; in mpi3mr_remove()
5239 spin_unlock_irqrestore(&mrioc->fwevt_lock, flags); in mpi3mr_remove()
5243 if (mrioc->sas_transport_enabled) in mpi3mr_remove()
5248 list_for_each_entry_safe(tgtdev, tgtdev_next, &mrioc->tgtdev_list, in mpi3mr_remove()
5250 mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev); in mpi3mr_remove()
5251 mpi3mr_tgtdev_del_from_list(mrioc, tgtdev, true); in mpi3mr_remove()
5254 mpi3mr_stop_watchdog(mrioc); in mpi3mr_remove()
5255 mpi3mr_cleanup_ioc(mrioc); in mpi3mr_remove()
5256 mpi3mr_free_mem(mrioc); in mpi3mr_remove()
5257 mpi3mr_cleanup_resources(mrioc); in mpi3mr_remove()
5259 spin_lock_irqsave(&mrioc->sas_node_lock, flags); in mpi3mr_remove()
5261 &mrioc->sas_expander_list, list) { in mpi3mr_remove()
5262 spin_unlock_irqrestore(&mrioc->sas_node_lock, flags); in mpi3mr_remove()
5263 mpi3mr_expander_node_remove(mrioc, sas_expander); in mpi3mr_remove()
5264 spin_lock_irqsave(&mrioc->sas_node_lock, flags); in mpi3mr_remove()
5266 list_for_each_entry_safe(port, hba_port_next, &mrioc->hba_port_table_list, list) { in mpi3mr_remove()
5267 ioc_info(mrioc, in mpi3mr_remove()
5273 spin_unlock_irqrestore(&mrioc->sas_node_lock, flags); in mpi3mr_remove()
5275 if (mrioc->sas_hba.num_phys) { in mpi3mr_remove()
5276 kfree(mrioc->sas_hba.phy); in mpi3mr_remove()
5277 mrioc->sas_hba.phy = NULL; in mpi3mr_remove()
5278 mrioc->sas_hba.num_phys = 0; in mpi3mr_remove()
5282 list_del(&mrioc->list); in mpi3mr_remove()
5300 struct mpi3mr_ioc *mrioc; in mpi3mr_shutdown() local
5307 mrioc = shost_priv(shost); in mpi3mr_shutdown()
5308 while (mrioc->reset_in_progress || mrioc->is_driver_loading) in mpi3mr_shutdown()
5311 mrioc->stop_drv_processing = 1; in mpi3mr_shutdown()
5312 mpi3mr_cleanup_fwevt_list(mrioc); in mpi3mr_shutdown()
5313 spin_lock_irqsave(&mrioc->fwevt_lock, flags); in mpi3mr_shutdown()
5314 wq = mrioc->fwevt_worker_thread; in mpi3mr_shutdown()
5315 mrioc->fwevt_worker_thread = NULL; in mpi3mr_shutdown()
5316 spin_unlock_irqrestore(&mrioc->fwevt_lock, flags); in mpi3mr_shutdown()
5320 mpi3mr_stop_watchdog(mrioc); in mpi3mr_shutdown()
5321 mpi3mr_cleanup_ioc(mrioc); in mpi3mr_shutdown()
5322 mpi3mr_cleanup_resources(mrioc); in mpi3mr_shutdown()
5339 struct mpi3mr_ioc *mrioc; in mpi3mr_suspend() local
5344 mrioc = shost_priv(shost); in mpi3mr_suspend()
5345 while (mrioc->reset_in_progress || mrioc->is_driver_loading) in mpi3mr_suspend()
5347 mrioc->stop_drv_processing = 1; in mpi3mr_suspend()
5348 mpi3mr_cleanup_fwevt_list(mrioc); in mpi3mr_suspend()
5350 mpi3mr_stop_watchdog(mrioc); in mpi3mr_suspend()
5351 mpi3mr_cleanup_ioc(mrioc); in mpi3mr_suspend()
5353 ioc_info(mrioc, "pdev=0x%p, slot=%s, entering operating state\n", in mpi3mr_suspend()
5355 mpi3mr_cleanup_resources(mrioc); in mpi3mr_suspend()
5374 struct mpi3mr_ioc *mrioc; in mpi3mr_resume() local
5381 mrioc = shost_priv(shost); in mpi3mr_resume()
5383 ioc_info(mrioc, "pdev=0x%p, slot=%s, previous operating state [D%d]\n", in mpi3mr_resume()
5385 mrioc->pdev = pdev; in mpi3mr_resume()
5386 mrioc->cpu_count = num_online_cpus(); in mpi3mr_resume()
5387 r = mpi3mr_setup_resources(mrioc); in mpi3mr_resume()
5389 ioc_info(mrioc, "%s: Setup resources failed[%d]\n", in mpi3mr_resume()
5394 mrioc->stop_drv_processing = 0; in mpi3mr_resume()
5395 mpi3mr_invalidate_devhandles(mrioc); in mpi3mr_resume()
5396 mpi3mr_free_enclosure_list(mrioc); in mpi3mr_resume()
5397 mpi3mr_memset_buffers(mrioc); in mpi3mr_resume()
5398 r = mpi3mr_reinit_ioc(mrioc, 1); in mpi3mr_resume()
5400 ioc_err(mrioc, "resuming controller failed[%d]\n", r); in mpi3mr_resume()
5405 mrioc->device_refresh_on = 0; in mpi3mr_resume()
5406 mpi3mr_start_watchdog(mrioc); in mpi3mr_resume()