Lines Matching refs:mrioc

45 static void mpi3mr_send_event_ack(struct mpi3mr_ioc *mrioc, u8 event,
61 static u16 mpi3mr_host_tag_for_scmd(struct mpi3mr_ioc *mrioc, in mpi3mr_host_tag_for_scmd() argument
71 if (hw_queue >= mrioc->num_op_reply_q) in mpi3mr_host_tag_for_scmd()
75 if (WARN_ON(host_tag >= mrioc->max_host_ios)) in mpi3mr_host_tag_for_scmd()
102 struct mpi3mr_ioc *mrioc, u16 host_tag, u16 qidx) in mpi3mr_scmd_from_host_tag() argument
108 if (WARN_ON(host_tag > mrioc->max_host_ios)) in mpi3mr_scmd_from_host_tag()
113 scmd = scsi_host_find_tag(mrioc->shost, unique_tag); in mpi3mr_scmd_from_host_tag()
133 static void mpi3mr_clear_scmd_priv(struct mpi3mr_ioc *mrioc, in mpi3mr_clear_scmd_priv() argument
148 clear_bit(priv->chain_idx, mrioc->chain_bitmap); in mpi3mr_clear_scmd_priv()
152 clear_bit(priv->meta_chain_idx, mrioc->chain_bitmap); in mpi3mr_clear_scmd_priv()
157 static void mpi3mr_dev_rmhs_send_tm(struct mpi3mr_ioc *mrioc, u16 handle,
224 static void mpi3mr_fwevt_add_to_list(struct mpi3mr_ioc *mrioc, in mpi3mr_fwevt_add_to_list() argument
229 if (!mrioc->fwevt_worker_thread) in mpi3mr_fwevt_add_to_list()
232 spin_lock_irqsave(&mrioc->fwevt_lock, flags); in mpi3mr_fwevt_add_to_list()
236 list_add_tail(&fwevt->list, &mrioc->fwevt_list); in mpi3mr_fwevt_add_to_list()
240 queue_work(mrioc->fwevt_worker_thread, &fwevt->work); in mpi3mr_fwevt_add_to_list()
241 spin_unlock_irqrestore(&mrioc->fwevt_lock, flags); in mpi3mr_fwevt_add_to_list()
255 void mpi3mr_hdb_trigger_data_event(struct mpi3mr_ioc *mrioc, in mpi3mr_hdb_trigger_data_event() argument
263 ioc_warn(mrioc, "failed to queue hdb trigger data event\n"); in mpi3mr_hdb_trigger_data_event()
267 fwevt->mrioc = mrioc; in mpi3mr_hdb_trigger_data_event()
275 mpi3mr_fwevt_add_to_list(mrioc, fwevt); in mpi3mr_hdb_trigger_data_event()
287 static void mpi3mr_fwevt_del_from_list(struct mpi3mr_ioc *mrioc, in mpi3mr_fwevt_del_from_list() argument
292 spin_lock_irqsave(&mrioc->fwevt_lock, flags); in mpi3mr_fwevt_del_from_list()
301 spin_unlock_irqrestore(&mrioc->fwevt_lock, flags); in mpi3mr_fwevt_del_from_list()
313 struct mpi3mr_ioc *mrioc) in mpi3mr_dequeue_fwevt() argument
318 spin_lock_irqsave(&mrioc->fwevt_lock, flags); in mpi3mr_dequeue_fwevt()
319 if (!list_empty(&mrioc->fwevt_list)) { in mpi3mr_dequeue_fwevt()
320 fwevt = list_first_entry(&mrioc->fwevt_list, in mpi3mr_dequeue_fwevt()
329 spin_unlock_irqrestore(&mrioc->fwevt_lock, flags); in mpi3mr_dequeue_fwevt()
372 void mpi3mr_cleanup_fwevt_list(struct mpi3mr_ioc *mrioc) in mpi3mr_cleanup_fwevt_list() argument
376 if ((list_empty(&mrioc->fwevt_list) && !mrioc->current_event) || in mpi3mr_cleanup_fwevt_list()
377 !mrioc->fwevt_worker_thread) in mpi3mr_cleanup_fwevt_list()
380 while ((fwevt = mpi3mr_dequeue_fwevt(mrioc))) in mpi3mr_cleanup_fwevt_list()
383 if (mrioc->current_event) { in mpi3mr_cleanup_fwevt_list()
384 fwevt = mrioc->current_event; in mpi3mr_cleanup_fwevt_list()
413 static void mpi3mr_queue_qd_reduction_event(struct mpi3mr_ioc *mrioc, in mpi3mr_queue_qd_reduction_event() argument
429 ioc_warn(mrioc, "failed to queue TG QD reduction event\n"); in mpi3mr_queue_qd_reduction_event()
433 fwevt->mrioc = mrioc; in mpi3mr_queue_qd_reduction_event()
441 dprint_event_bh(mrioc, "qd reduction event queued for tg_id(%d)\n", in mpi3mr_queue_qd_reduction_event()
443 mpi3mr_fwevt_add_to_list(mrioc, fwevt); in mpi3mr_queue_qd_reduction_event()
455 void mpi3mr_invalidate_devhandles(struct mpi3mr_ioc *mrioc) in mpi3mr_invalidate_devhandles() argument
460 list_for_each_entry(tgtdev, &mrioc->tgtdev_list, list) { in mpi3mr_invalidate_devhandles()
486 struct mpi3mr_ioc *mrioc = (struct mpi3mr_ioc *)data; in mpi3mr_print_scmd() local
495 ioc_info(mrioc, "%s :Host Tag = %d, qid = %d\n", in mpi3mr_print_scmd()
517 struct mpi3mr_ioc *mrioc = (struct mpi3mr_ioc *)data; in mpi3mr_flush_scmd() local
527 dma_unmap_sg(&mrioc->pdev->dev, scsi_prot_sglist(scmd), in mpi3mr_flush_scmd()
529 mpi3mr_clear_scmd_priv(mrioc, scmd); in mpi3mr_flush_scmd()
534 mrioc->flush_io_count++; in mpi3mr_flush_scmd()
615 void mpi3mr_flush_host_io(struct mpi3mr_ioc *mrioc) in mpi3mr_flush_host_io() argument
617 struct Scsi_Host *shost = mrioc->shost; in mpi3mr_flush_host_io()
619 mrioc->flush_io_count = 0; in mpi3mr_flush_host_io()
620 ioc_info(mrioc, "%s :Flushing Host I/O cmds post reset\n", __func__); in mpi3mr_flush_host_io()
622 mpi3mr_flush_scmd, (void *)mrioc); in mpi3mr_flush_host_io()
623 ioc_info(mrioc, "%s :Flushed %d Host I/O cmds\n", __func__, in mpi3mr_flush_host_io()
624 mrioc->flush_io_count); in mpi3mr_flush_host_io()
638 void mpi3mr_flush_cmds_for_unrecovered_controller(struct mpi3mr_ioc *mrioc) in mpi3mr_flush_cmds_for_unrecovered_controller() argument
640 struct Scsi_Host *shost = mrioc->shost; in mpi3mr_flush_cmds_for_unrecovered_controller()
643 if (!mrioc->unrecoverable) in mpi3mr_flush_cmds_for_unrecovered_controller()
646 if (mrioc->op_reply_qinfo) { in mpi3mr_flush_cmds_for_unrecovered_controller()
647 for (i = 0; i < mrioc->num_queues; i++) { in mpi3mr_flush_cmds_for_unrecovered_controller()
648 while (atomic_read(&mrioc->op_reply_qinfo[i].in_use)) in mpi3mr_flush_cmds_for_unrecovered_controller()
650 atomic_set(&mrioc->op_reply_qinfo[i].pend_ios, 0); in mpi3mr_flush_cmds_for_unrecovered_controller()
653 mrioc->flush_io_count = 0; in mpi3mr_flush_cmds_for_unrecovered_controller()
655 mpi3mr_flush_scmd, (void *)mrioc); in mpi3mr_flush_cmds_for_unrecovered_controller()
656 mpi3mr_flush_delayed_cmd_lists(mrioc); in mpi3mr_flush_cmds_for_unrecovered_controller()
657 mpi3mr_flush_drv_cmds(mrioc); in mpi3mr_flush_cmds_for_unrecovered_controller()
688 static void mpi3mr_tgtdev_add_to_list(struct mpi3mr_ioc *mrioc, in mpi3mr_tgtdev_add_to_list() argument
693 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_tgtdev_add_to_list()
696 list_add_tail(&tgtdev->list, &mrioc->tgtdev_list); in mpi3mr_tgtdev_add_to_list()
698 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_tgtdev_add_to_list()
712 static void mpi3mr_tgtdev_del_from_list(struct mpi3mr_ioc *mrioc, in mpi3mr_tgtdev_del_from_list() argument
717 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_tgtdev_del_from_list()
725 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_tgtdev_del_from_list()
739 struct mpi3mr_ioc *mrioc, u16 handle) in __mpi3mr_get_tgtdev_by_handle() argument
743 assert_spin_locked(&mrioc->tgtdev_lock); in __mpi3mr_get_tgtdev_by_handle()
744 list_for_each_entry(tgtdev, &mrioc->tgtdev_list, list) in __mpi3mr_get_tgtdev_by_handle()
765 struct mpi3mr_ioc *mrioc, u16 handle) in mpi3mr_get_tgtdev_by_handle() argument
770 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_get_tgtdev_by_handle()
771 tgtdev = __mpi3mr_get_tgtdev_by_handle(mrioc, handle); in mpi3mr_get_tgtdev_by_handle()
772 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_get_tgtdev_by_handle()
787 struct mpi3mr_ioc *mrioc, u16 persist_id) in __mpi3mr_get_tgtdev_by_perst_id() argument
791 assert_spin_locked(&mrioc->tgtdev_lock); in __mpi3mr_get_tgtdev_by_perst_id()
792 list_for_each_entry(tgtdev, &mrioc->tgtdev_list, list) in __mpi3mr_get_tgtdev_by_perst_id()
813 struct mpi3mr_ioc *mrioc, u16 persist_id) in mpi3mr_get_tgtdev_by_perst_id() argument
818 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_get_tgtdev_by_perst_id()
819 tgtdev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, persist_id); in mpi3mr_get_tgtdev_by_perst_id()
820 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_get_tgtdev_by_perst_id()
835 struct mpi3mr_ioc *mrioc, struct mpi3mr_stgt_priv_data *tgt_priv) in __mpi3mr_get_tgtdev_from_tgtpriv() argument
839 assert_spin_locked(&mrioc->tgtdev_lock); in __mpi3mr_get_tgtdev_from_tgtpriv()
857 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
864 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_set_io_divert_for_all_vd_in_tg()
865 list_for_each_entry(tgtdev, &mrioc->tgtdev_list, list) { in mpi3mr_set_io_divert_for_all_vd_in_tg()
872 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_set_io_divert_for_all_vd_in_tg()
884 void mpi3mr_print_device_event_notice(struct mpi3mr_ioc *mrioc, in mpi3mr_print_device_event_notice() argument
887 ioc_notice(mrioc, "Device %s was in progress before the reset and\n", in mpi3mr_print_device_event_notice()
889 ioc_notice(mrioc, "completed after reset, verify whether the exposed devices\n"); in mpi3mr_print_device_event_notice()
890 ioc_notice(mrioc, "are matched with attached devices for correctness\n"); in mpi3mr_print_device_event_notice()
904 void mpi3mr_remove_tgtdev_from_host(struct mpi3mr_ioc *mrioc, in mpi3mr_remove_tgtdev_from_host() argument
909 ioc_info(mrioc, "%s :Removing handle(0x%04x), wwid(0x%016llx)\n", in mpi3mr_remove_tgtdev_from_host()
917 if (!mrioc->sas_transport_enabled || (tgtdev->dev_type != in mpi3mr_remove_tgtdev_from_host()
920 if (mrioc->current_event) in mpi3mr_remove_tgtdev_from_host()
921 mrioc->current_event->pending_at_sml = 1; in mpi3mr_remove_tgtdev_from_host()
924 if (mrioc->current_event) { in mpi3mr_remove_tgtdev_from_host()
925 mrioc->current_event->pending_at_sml = 0; in mpi3mr_remove_tgtdev_from_host()
926 if (mrioc->current_event->discard) { in mpi3mr_remove_tgtdev_from_host()
927 mpi3mr_print_device_event_notice(mrioc, in mpi3mr_remove_tgtdev_from_host()
934 mpi3mr_remove_tgtdev_from_sas_transport(mrioc, tgtdev); in mpi3mr_remove_tgtdev_from_host()
935 mpi3mr_global_trigger(mrioc, in mpi3mr_remove_tgtdev_from_host()
938 ioc_info(mrioc, "%s :Removed handle(0x%04x), wwid(0x%016llx)\n", in mpi3mr_remove_tgtdev_from_host()
953 static int mpi3mr_report_tgtdev_to_host(struct mpi3mr_ioc *mrioc, in mpi3mr_report_tgtdev_to_host() argument
959 if (mrioc->reset_in_progress || mrioc->pci_err_recovery) in mpi3mr_report_tgtdev_to_host()
962 tgtdev = mpi3mr_get_tgtdev_by_perst_id(mrioc, perst_id); in mpi3mr_report_tgtdev_to_host()
971 if (!mrioc->sas_transport_enabled || (tgtdev->dev_type != in mpi3mr_report_tgtdev_to_host()
974 if (mrioc->current_event) in mpi3mr_report_tgtdev_to_host()
975 mrioc->current_event->pending_at_sml = 1; in mpi3mr_report_tgtdev_to_host()
976 scsi_scan_target(&mrioc->shost->shost_gendev, in mpi3mr_report_tgtdev_to_host()
977 mrioc->scsi_device_channel, tgtdev->perst_id, in mpi3mr_report_tgtdev_to_host()
981 if (mrioc->current_event) { in mpi3mr_report_tgtdev_to_host()
982 mrioc->current_event->pending_at_sml = 0; in mpi3mr_report_tgtdev_to_host()
983 if (mrioc->current_event->discard) { in mpi3mr_report_tgtdev_to_host()
984 mpi3mr_print_device_event_notice(mrioc, true); in mpi3mr_report_tgtdev_to_host()
989 mpi3mr_report_tgtdev_to_sas_transport(mrioc, tgtdev); in mpi3mr_report_tgtdev_to_host()
1082 static void mpi3mr_refresh_tgtdevs(struct mpi3mr_ioc *mrioc) in mpi3mr_refresh_tgtdevs() argument
1087 dprint_reset(mrioc, "refresh target devices: check for removals\n"); in mpi3mr_refresh_tgtdevs()
1088 list_for_each_entry_safe(tgtdev, tgtdev_next, &mrioc->tgtdev_list, in mpi3mr_refresh_tgtdevs()
1100 list_for_each_entry_safe(tgtdev, tgtdev_next, &mrioc->tgtdev_list, in mpi3mr_refresh_tgtdevs()
1103 dprint_reset(mrioc, "removing target device with perst_id(%d)\n", in mpi3mr_refresh_tgtdevs()
1106 mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev); in mpi3mr_refresh_tgtdevs()
1107 mpi3mr_tgtdev_del_from_list(mrioc, tgtdev, true); in mpi3mr_refresh_tgtdevs()
1110 dprint_reset(mrioc, "hiding target device with perst_id(%d)\n", in mpi3mr_refresh_tgtdevs()
1112 mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev); in mpi3mr_refresh_tgtdevs()
1117 list_for_each_entry(tgtdev, &mrioc->tgtdev_list, list) { in mpi3mr_refresh_tgtdevs()
1121 mpi3mr_report_tgtdev_to_host(mrioc, in mpi3mr_refresh_tgtdevs()
1142 static void mpi3mr_update_tgtdev(struct mpi3mr_ioc *mrioc, in mpi3mr_update_tgtdev() argument
1163 enclosure_dev = mpi3mr_enclosure_find_by_handle(mrioc, in mpi3mr_update_tgtdev()
1276 if (!mrioc->shost) in mpi3mr_update_tgtdev()
1278 prot_mask = scsi_host_get_prot(mrioc->shost); in mpi3mr_update_tgtdev()
1280 scsi_host_set_prot(mrioc->shost, prot_mask & 0x77); in mpi3mr_update_tgtdev()
1281 ioc_info(mrioc, in mpi3mr_update_tgtdev()
1283 ioc_info(mrioc, in mpi3mr_update_tgtdev()
1305 if (vdinf_io_throttle_group < mrioc->num_io_throttle_group) { in mpi3mr_update_tgtdev()
1306 tg = mrioc->throttle_groups + vdinf_io_throttle_group; in mpi3mr_update_tgtdev()
1337 static void mpi3mr_devstatuschg_evt_bh(struct mpi3mr_ioc *mrioc, in mpi3mr_devstatuschg_evt_bh() argument
1347 ioc_info(mrioc, in mpi3mr_devstatuschg_evt_bh()
1362 ioc_info(mrioc, "%s :Unhandled reason code(0x%x)\n", __func__, in mpi3mr_devstatuschg_evt_bh()
1367 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, dev_handle); in mpi3mr_devstatuschg_evt_bh()
1373 mpi3mr_report_tgtdev_to_host(mrioc, tgtdev->perst_id); in mpi3mr_devstatuschg_evt_bh()
1377 mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev); in mpi3mr_devstatuschg_evt_bh()
1380 mpi3mr_tgtdev_del_from_list(mrioc, tgtdev, false); in mpi3mr_devstatuschg_evt_bh()
1401 static void mpi3mr_devinfochg_evt_bh(struct mpi3mr_ioc *mrioc, in mpi3mr_devinfochg_evt_bh() argument
1409 ioc_info(mrioc, in mpi3mr_devinfochg_evt_bh()
1412 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, dev_handle); in mpi3mr_devinfochg_evt_bh()
1415 mpi3mr_update_tgtdev(mrioc, tgtdev, dev_pg0, false); in mpi3mr_devinfochg_evt_bh()
1417 mpi3mr_report_tgtdev_to_host(mrioc, perst_id); in mpi3mr_devinfochg_evt_bh()
1419 mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev); in mpi3mr_devinfochg_evt_bh()
1436 void mpi3mr_free_enclosure_list(struct mpi3mr_ioc *mrioc) in mpi3mr_free_enclosure_list() argument
1441 enclosure_dev_next, &mrioc->enclosure_list, list) { in mpi3mr_free_enclosure_list()
1458 struct mpi3mr_ioc *mrioc, u16 handle) in mpi3mr_enclosure_find_by_handle() argument
1462 list_for_each_entry(enclosure_dev, &mrioc->enclosure_list, list) { in mpi3mr_enclosure_find_by_handle()
1483 static void mpi3mr_process_trigger_data_event_bh(struct mpi3mr_ioc *mrioc, in mpi3mr_process_trigger_data_event_bh() argument
1501 mpi3mr_soft_reset_handler(mrioc, in mpi3mr_process_trigger_data_event_bh()
1507 retval = mpi3mr_issue_diag_buf_release(mrioc, trace_hdb); in mpi3mr_process_trigger_data_event_bh()
1512 spin_lock_irqsave(&mrioc->trigger_lock, flags); in mpi3mr_process_trigger_data_event_bh()
1513 mrioc->trace_release_trigger_active = false; in mpi3mr_process_trigger_data_event_bh()
1514 spin_unlock_irqrestore(&mrioc->trigger_lock, flags); in mpi3mr_process_trigger_data_event_bh()
1517 retval = mpi3mr_issue_diag_buf_release(mrioc, fw_hdb); in mpi3mr_process_trigger_data_event_bh()
1522 spin_lock_irqsave(&mrioc->trigger_lock, flags); in mpi3mr_process_trigger_data_event_bh()
1523 mrioc->fw_release_trigger_active = false; in mpi3mr_process_trigger_data_event_bh()
1524 spin_unlock_irqrestore(&mrioc->trigger_lock, flags); in mpi3mr_process_trigger_data_event_bh()
1536 static void mpi3mr_encldev_add_chg_evt_debug(struct mpi3mr_ioc *mrioc, in mpi3mr_encldev_add_chg_evt_debug() argument
1541 if (!(mrioc->logging_level & MPI3_DEBUG_EVENT_WORK_TASK)) in mpi3mr_encldev_add_chg_evt_debug()
1549 ioc_info(mrioc, in mpi3mr_encldev_add_chg_evt_debug()
1553 ioc_info(mrioc, in mpi3mr_encldev_add_chg_evt_debug()
1573 static void mpi3mr_encldev_add_chg_evt_bh(struct mpi3mr_ioc *mrioc, in mpi3mr_encldev_add_chg_evt_bh() argument
1583 mpi3mr_encldev_add_chg_evt_debug(mrioc, encl_pg0, added); in mpi3mr_encldev_add_chg_evt_bh()
1591 enclosure_dev = mpi3mr_enclosure_find_by_handle(mrioc, in mpi3mr_encldev_add_chg_evt_bh()
1600 &mrioc->enclosure_list); in mpi3mr_encldev_add_chg_evt_bh()
1623 mpi3mr_sastopochg_evt_debug(struct mpi3mr_ioc *mrioc, in mpi3mr_sastopochg_evt_debug() argument
1649 ioc_info(mrioc, "%s :sas topology change: (%s)\n", in mpi3mr_sastopochg_evt_debug()
1651 ioc_info(mrioc, in mpi3mr_sastopochg_evt_debug()
1686 ioc_info(mrioc, in mpi3mr_sastopochg_evt_debug()
1704 static void mpi3mr_sastopochg_evt_bh(struct mpi3mr_ioc *mrioc, in mpi3mr_sastopochg_evt_bh() argument
1719 mpi3mr_sastopochg_evt_debug(mrioc, event_data); in mpi3mr_sastopochg_evt_bh()
1720 if (mrioc->sas_transport_enabled) { in mpi3mr_sastopochg_evt_bh()
1721 hba_port = mpi3mr_get_hba_port_by_id(mrioc, in mpi3mr_sastopochg_evt_bh()
1724 spin_lock_irqsave(&mrioc->sas_node_lock, flags); in mpi3mr_sastopochg_evt_bh()
1725 sas_expander = __mpi3mr_expander_find_by_handle(mrioc, in mpi3mr_sastopochg_evt_bh()
1731 spin_unlock_irqrestore(&mrioc->sas_node_lock, flags); in mpi3mr_sastopochg_evt_bh()
1734 parent_sas_address = mrioc->sas_hba.sas_address; in mpi3mr_sastopochg_evt_bh()
1743 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, handle); in mpi3mr_sastopochg_evt_bh()
1753 mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev); in mpi3mr_sastopochg_evt_bh()
1754 mpi3mr_tgtdev_del_from_list(mrioc, tgtdev, false); in mpi3mr_sastopochg_evt_bh()
1761 if (!mrioc->sas_transport_enabled || tgtdev->non_stl in mpi3mr_sastopochg_evt_bh()
1771 mpi3mr_update_links(mrioc, parent_sas_address, handle, in mpi3mr_sastopochg_evt_bh()
1782 if (mrioc->sas_transport_enabled && (event_data->exp_status == in mpi3mr_sastopochg_evt_bh()
1785 mpi3mr_expander_remove(mrioc, exp_sas_address, in mpi3mr_sastopochg_evt_bh()
1800 mpi3mr_pcietopochg_evt_debug(struct mpi3mr_ioc *mrioc, in mpi3mr_pcietopochg_evt_debug() argument
1827 ioc_info(mrioc, "%s :pcie topology change: (%s)\n", in mpi3mr_pcietopochg_evt_debug()
1829 ioc_info(mrioc, in mpi3mr_pcietopochg_evt_debug()
1865 ioc_info(mrioc, in mpi3mr_pcietopochg_evt_debug()
1883 static void mpi3mr_pcietopochg_evt_bh(struct mpi3mr_ioc *mrioc, in mpi3mr_pcietopochg_evt_bh() argument
1893 mpi3mr_pcietopochg_evt_debug(mrioc, event_data); in mpi3mr_pcietopochg_evt_bh()
1902 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, handle); in mpi3mr_pcietopochg_evt_bh()
1911 mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev); in mpi3mr_pcietopochg_evt_bh()
1912 mpi3mr_tgtdev_del_from_list(mrioc, tgtdev, false); in mpi3mr_pcietopochg_evt_bh()
1933 static void mpi3mr_logdata_evt_bh(struct mpi3mr_ioc *mrioc, in mpi3mr_logdata_evt_bh() argument
1936 mpi3mr_app_save_logdata(mrioc, fwevt->event_data, in mpi3mr_logdata_evt_bh()
1968 static void mpi3mr_set_qd_for_all_vd_in_tg(struct mpi3mr_ioc *mrioc, in mpi3mr_set_qd_for_all_vd_in_tg() argument
1976 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_set_qd_for_all_vd_in_tg()
1977 list_for_each_entry(tgtdev, &mrioc->tgtdev_list, list) { in mpi3mr_set_qd_for_all_vd_in_tg()
1981 dprint_event_bh(mrioc, in mpi3mr_set_qd_for_all_vd_in_tg()
1991 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_set_qd_for_all_vd_in_tg()
2004 static void mpi3mr_fwevt_bh(struct mpi3mr_ioc *mrioc, in mpi3mr_fwevt_bh() argument
2012 mpi3mr_fwevt_del_from_list(mrioc, fwevt); in mpi3mr_fwevt_bh()
2013 mrioc->current_event = fwevt; in mpi3mr_fwevt_bh()
2015 if (mrioc->stop_drv_processing) in mpi3mr_fwevt_bh()
2018 if (mrioc->unrecoverable) { in mpi3mr_fwevt_bh()
2019 dprint_event_bh(mrioc, in mpi3mr_fwevt_bh()
2035 mpi3mr_report_tgtdev_to_host(mrioc, perst_id); in mpi3mr_fwevt_bh()
2036 else if (mrioc->sas_transport_enabled && in mpi3mr_fwevt_bh()
2040 if (!mrioc->sas_hba.num_phys) in mpi3mr_fwevt_bh()
2041 mpi3mr_sas_host_add(mrioc); in mpi3mr_fwevt_bh()
2043 mpi3mr_sas_host_refresh(mrioc); in mpi3mr_fwevt_bh()
2046 mpi3mr_expander_add(mrioc, handle); in mpi3mr_fwevt_bh()
2055 mpi3mr_devinfochg_evt_bh(mrioc, dev_pg0); in mpi3mr_fwevt_bh()
2060 mpi3mr_devstatuschg_evt_bh(mrioc, fwevt); in mpi3mr_fwevt_bh()
2066 mpi3mr_encldev_add_chg_evt_bh(mrioc, fwevt); in mpi3mr_fwevt_bh()
2072 mpi3mr_sastopochg_evt_bh(mrioc, fwevt); in mpi3mr_fwevt_bh()
2077 mpi3mr_pcietopochg_evt_bh(mrioc, fwevt); in mpi3mr_fwevt_bh()
2082 mpi3mr_logdata_evt_bh(mrioc, fwevt); in mpi3mr_fwevt_bh()
2090 dprint_event_bh(mrioc, in mpi3mr_fwevt_bh()
2094 mpi3mr_set_qd_for_all_vd_in_tg(mrioc, tg); in mpi3mr_fwevt_bh()
2102 while ((mrioc->device_refresh_on || mrioc->block_on_pci_err) && in mpi3mr_fwevt_bh()
2103 !mrioc->unrecoverable && !mrioc->pci_err_recovery) { in mpi3mr_fwevt_bh()
2106 mrioc->unrecoverable = 1; in mpi3mr_fwevt_bh()
2111 if (mrioc->unrecoverable || mrioc->pci_err_recovery) in mpi3mr_fwevt_bh()
2114 dprint_event_bh(mrioc, in mpi3mr_fwevt_bh()
2116 if (mrioc->sas_transport_enabled) { in mpi3mr_fwevt_bh()
2117 mpi3mr_refresh_sas_ports(mrioc); in mpi3mr_fwevt_bh()
2118 mpi3mr_refresh_expanders(mrioc); in mpi3mr_fwevt_bh()
2120 mpi3mr_refresh_tgtdevs(mrioc); in mpi3mr_fwevt_bh()
2121 ioc_info(mrioc, in mpi3mr_fwevt_bh()
2127 mpi3mr_process_trigger_data_event_bh(mrioc, in mpi3mr_fwevt_bh()
2137 mpi3mr_process_event_ack(mrioc, fwevt->event_id, in mpi3mr_fwevt_bh()
2142 mrioc->current_event = NULL; in mpi3mr_fwevt_bh()
2157 mpi3mr_fwevt_bh(fwevt->mrioc, fwevt); in mpi3mr_fwevt_worker()
2177 static int mpi3mr_create_tgtdev(struct mpi3mr_ioc *mrioc, in mpi3mr_create_tgtdev() argument
2189 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_create_tgtdev()
2190 tgtdev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, perst_id); in mpi3mr_create_tgtdev()
2193 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_create_tgtdev()
2196 mpi3mr_update_tgtdev(mrioc, tgtdev, dev_pg0, true); in mpi3mr_create_tgtdev()
2202 mpi3mr_update_tgtdev(mrioc, tgtdev, dev_pg0, true); in mpi3mr_create_tgtdev()
2203 mpi3mr_tgtdev_add_to_list(mrioc, tgtdev); in mpi3mr_create_tgtdev()
2218 void mpi3mr_flush_delayed_cmd_lists(struct mpi3mr_ioc *mrioc) in mpi3mr_flush_delayed_cmd_lists() argument
2223 dprint_reset(mrioc, "flushing delayed dev_remove_hs commands\n"); in mpi3mr_flush_delayed_cmd_lists()
2224 while (!list_empty(&mrioc->delayed_rmhs_list)) { in mpi3mr_flush_delayed_cmd_lists()
2225 _rmhs_node = list_entry(mrioc->delayed_rmhs_list.next, in mpi3mr_flush_delayed_cmd_lists()
2230 dprint_reset(mrioc, "flushing delayed event ack commands\n"); in mpi3mr_flush_delayed_cmd_lists()
2231 while (!list_empty(&mrioc->delayed_evtack_cmds_list)) { in mpi3mr_flush_delayed_cmd_lists()
2232 _evtack_node = list_entry(mrioc->delayed_evtack_cmds_list.next, in mpi3mr_flush_delayed_cmd_lists()
2250 static void mpi3mr_dev_rmhs_complete_iou(struct mpi3mr_ioc *mrioc, in mpi3mr_dev_rmhs_complete_iou() argument
2259 ioc_info(mrioc, in mpi3mr_dev_rmhs_complete_iou()
2266 ioc_info(mrioc, in mpi3mr_dev_rmhs_complete_iou()
2270 mpi3mr_dev_rmhs_send_tm(mrioc, drv_cmd->dev_handle, in mpi3mr_dev_rmhs_complete_iou()
2274 ioc_err(mrioc, in mpi3mr_dev_rmhs_complete_iou()
2278 ioc_info(mrioc, in mpi3mr_dev_rmhs_complete_iou()
2281 clear_bit(drv_cmd->dev_handle, mrioc->removepend_bitmap); in mpi3mr_dev_rmhs_complete_iou()
2284 if (!list_empty(&mrioc->delayed_rmhs_list)) { in mpi3mr_dev_rmhs_complete_iou()
2285 delayed_dev_rmhs = list_entry(mrioc->delayed_rmhs_list.next, in mpi3mr_dev_rmhs_complete_iou()
2290 ioc_info(mrioc, in mpi3mr_dev_rmhs_complete_iou()
2293 mpi3mr_dev_rmhs_send_tm(mrioc, drv_cmd->dev_handle, drv_cmd, in mpi3mr_dev_rmhs_complete_iou()
2305 clear_bit(cmd_idx, mrioc->devrem_bitmap); in mpi3mr_dev_rmhs_complete_iou()
2319 static void mpi3mr_dev_rmhs_complete_tm(struct mpi3mr_ioc *mrioc, in mpi3mr_dev_rmhs_complete_tm() argument
2336 mrioc->name, drv_cmd->dev_handle, drv_cmd->ioc_status, in mpi3mr_dev_rmhs_complete_tm()
2341 mrioc->name, drv_cmd->dev_handle, cmd_idx); in mpi3mr_dev_rmhs_complete_tm()
2353 retval = mpi3mr_admin_request_post(mrioc, &iou_ctrl, sizeof(iou_ctrl), in mpi3mr_dev_rmhs_complete_tm()
2357 mrioc->name); in mpi3mr_dev_rmhs_complete_tm()
2367 clear_bit(cmd_idx, mrioc->devrem_bitmap); in mpi3mr_dev_rmhs_complete_tm()
2383 static void mpi3mr_dev_rmhs_send_tm(struct mpi3mr_ioc *mrioc, u16 handle, in mpi3mr_dev_rmhs_send_tm() argument
2395 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_dev_rmhs_send_tm()
2396 tgtdev = __mpi3mr_get_tgtdev_by_handle(mrioc, handle); in mpi3mr_dev_rmhs_send_tm()
2399 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_dev_rmhs_send_tm()
2404 cmd_idx = find_first_zero_bit(mrioc->devrem_bitmap, in mpi3mr_dev_rmhs_send_tm()
2407 if (!test_and_set_bit(cmd_idx, mrioc->devrem_bitmap)) in mpi3mr_dev_rmhs_send_tm()
2422 &mrioc->delayed_rmhs_list); in mpi3mr_dev_rmhs_send_tm()
2423 ioc_info(mrioc, "%s :DevRmHs: tr:handle(0x%04x) is postponed\n", in mpi3mr_dev_rmhs_send_tm()
2427 drv_cmd = &mrioc->dev_rmhs_cmds[cmd_idx]; in mpi3mr_dev_rmhs_send_tm()
2431 ioc_info(mrioc, in mpi3mr_dev_rmhs_send_tm()
2437 ioc_err(mrioc, "%s :Issue TM: Command is in use\n", __func__); in mpi3mr_dev_rmhs_send_tm()
2451 set_bit(handle, mrioc->removepend_bitmap); in mpi3mr_dev_rmhs_send_tm()
2452 retval = mpi3mr_admin_request_post(mrioc, &tm_req, sizeof(tm_req), 1); in mpi3mr_dev_rmhs_send_tm()
2454 ioc_err(mrioc, "%s :Issue DevRmHsTM: Admin Post failed\n", in mpi3mr_dev_rmhs_send_tm()
2465 clear_bit(cmd_idx, mrioc->devrem_bitmap); in mpi3mr_dev_rmhs_send_tm()
2479 static void mpi3mr_complete_evt_ack(struct mpi3mr_ioc *mrioc, in mpi3mr_complete_evt_ack() argument
2489 dprint_event_th(mrioc, in mpi3mr_complete_evt_ack()
2495 if (!list_empty(&mrioc->delayed_evtack_cmds_list)) { in mpi3mr_complete_evt_ack()
2497 list_entry(mrioc->delayed_evtack_cmds_list.next, in mpi3mr_complete_evt_ack()
2499 mpi3mr_send_event_ack(mrioc, delayed_evtack->event, drv_cmd, in mpi3mr_complete_evt_ack()
2508 clear_bit(cmd_idx, mrioc->evtack_cmds_bitmap); in mpi3mr_complete_evt_ack()
2525 static void mpi3mr_send_event_ack(struct mpi3mr_ioc *mrioc, u8 event, in mpi3mr_send_event_ack() argument
2536 dprint_event_th(mrioc, in mpi3mr_send_event_ack()
2541 dprint_event_th(mrioc, in mpi3mr_send_event_ack()
2545 cmd_idx = find_first_zero_bit(mrioc->evtack_cmds_bitmap, in mpi3mr_send_event_ack()
2549 mrioc->evtack_cmds_bitmap)) in mpi3mr_send_event_ack()
2564 &mrioc->delayed_evtack_cmds_list); in mpi3mr_send_event_ack()
2565 dprint_event_th(mrioc, in mpi3mr_send_event_ack()
2570 drv_cmd = &mrioc->evtack_cmds[cmd_idx]; in mpi3mr_send_event_ack()
2577 dprint_event_th(mrioc, in mpi3mr_send_event_ack()
2588 retval = mpi3mr_admin_request_post(mrioc, &evtack_req, in mpi3mr_send_event_ack()
2591 dprint_event_th(mrioc, in mpi3mr_send_event_ack()
2596 dprint_event_th(mrioc, in mpi3mr_send_event_ack()
2604 clear_bit(cmd_idx, mrioc->evtack_cmds_bitmap); in mpi3mr_send_event_ack()
2619 static void mpi3mr_pcietopochg_evt_th(struct mpi3mr_ioc *mrioc, in mpi3mr_pcietopochg_evt_th() argument
2636 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, handle); in mpi3mr_pcietopochg_evt_th()
2647 mpi3mr_dev_rmhs_send_tm(mrioc, handle, NULL, in mpi3mr_pcietopochg_evt_th()
2685 static void mpi3mr_sastopochg_evt_th(struct mpi3mr_ioc *mrioc, in mpi3mr_sastopochg_evt_th() argument
2703 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, handle); in mpi3mr_sastopochg_evt_th()
2714 mpi3mr_dev_rmhs_send_tm(mrioc, handle, NULL, in mpi3mr_sastopochg_evt_th()
2752 static void mpi3mr_devstatuschg_evt_th(struct mpi3mr_ioc *mrioc, in mpi3mr_devstatuschg_evt_th() argument
2762 if (mrioc->stop_drv_processing) in mpi3mr_devstatuschg_evt_th()
2788 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, dev_handle); in mpi3mr_devstatuschg_evt_th()
2804 mpi3mr_dev_rmhs_send_tm(mrioc, dev_handle, NULL, in mpi3mr_devstatuschg_evt_th()
2807 mpi3mr_dev_rmhs_send_tm(mrioc, dev_handle, NULL, in mpi3mr_devstatuschg_evt_th()
2824 static void mpi3mr_preparereset_evt_th(struct mpi3mr_ioc *mrioc, in mpi3mr_preparereset_evt_th() argument
2831 dprint_event_th(mrioc, in mpi3mr_preparereset_evt_th()
2833 if (mrioc->prepare_for_reset) in mpi3mr_preparereset_evt_th()
2835 mrioc->prepare_for_reset = 1; in mpi3mr_preparereset_evt_th()
2836 mrioc->prepare_for_reset_timeout_counter = 0; in mpi3mr_preparereset_evt_th()
2838 dprint_event_th(mrioc, in mpi3mr_preparereset_evt_th()
2840 mrioc->prepare_for_reset = 0; in mpi3mr_preparereset_evt_th()
2841 mrioc->prepare_for_reset_timeout_counter = 0; in mpi3mr_preparereset_evt_th()
2845 mpi3mr_send_event_ack(mrioc, event_reply->event, NULL, in mpi3mr_preparereset_evt_th()
2858 static void mpi3mr_energypackchg_evt_th(struct mpi3mr_ioc *mrioc, in mpi3mr_energypackchg_evt_th() argument
2866 ioc_warn(mrioc, in mpi3mr_energypackchg_evt_th()
2872 ioc_info(mrioc, in mpi3mr_energypackchg_evt_th()
2874 __func__, mrioc->facts.shutdown_timeout, shutdown_timeout); in mpi3mr_energypackchg_evt_th()
2875 mrioc->facts.shutdown_timeout = shutdown_timeout; in mpi3mr_energypackchg_evt_th()
2887 static void mpi3mr_cablemgmt_evt_th(struct mpi3mr_ioc *mrioc, in mpi3mr_cablemgmt_evt_th() argument
2896 ioc_info(mrioc, "An active cable with receptacle_id %d cannot be powered.\n" in mpi3mr_cablemgmt_evt_th()
2905 ioc_info(mrioc, "A cable with receptacle_id %d is not running at optimal speed\n", in mpi3mr_cablemgmt_evt_th()
2923 void mpi3mr_add_event_wait_for_device_refresh(struct mpi3mr_ioc *mrioc) in mpi3mr_add_event_wait_for_device_refresh() argument
2929 dprint_event_th(mrioc, in mpi3mr_add_event_wait_for_device_refresh()
2934 fwevt->mrioc = mrioc; in mpi3mr_add_event_wait_for_device_refresh()
2940 mpi3mr_fwevt_add_to_list(mrioc, fwevt); in mpi3mr_add_event_wait_for_device_refresh()
2954 void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc, in mpi3mr_os_handle_events() argument
2961 if (mrioc->stop_drv_processing) in mpi3mr_os_handle_events()
2969 mpi3mr_event_trigger(mrioc, event_reply->event); in mpi3mr_os_handle_events()
2976 if (mpi3mr_create_tgtdev(mrioc, dev_pg0)) in mpi3mr_os_handle_events()
2977 ioc_err(mrioc, in mpi3mr_os_handle_events()
2987 mpi3mr_devstatuschg_evt_th(mrioc, event_reply); in mpi3mr_os_handle_events()
2993 mpi3mr_sastopochg_evt_th(mrioc, event_reply); in mpi3mr_os_handle_events()
2999 mpi3mr_pcietopochg_evt_th(mrioc, event_reply); in mpi3mr_os_handle_events()
3004 mpi3mr_preparereset_evt_th(mrioc, event_reply); in mpi3mr_os_handle_events()
3010 mpi3mr_hdbstatuschg_evt_th(mrioc, event_reply); in mpi3mr_os_handle_events()
3023 mpi3mr_energypackchg_evt_th(mrioc, event_reply); in mpi3mr_os_handle_events()
3028 mpi3mr_cablemgmt_evt_th(mrioc, event_reply); in mpi3mr_os_handle_events()
3037 ioc_info(mrioc, "%s :event 0x%02x is not handled\n", in mpi3mr_os_handle_events()
3045 ioc_info(mrioc, "%s :failure at %s:%d/%s()!\n", in mpi3mr_os_handle_events()
3051 fwevt->mrioc = mrioc; in mpi3mr_os_handle_events()
3056 mpi3mr_fwevt_add_to_list(mrioc, fwevt); in mpi3mr_os_handle_events()
3072 static void mpi3mr_setup_eedp(struct mpi3mr_ioc *mrioc, in mpi3mr_setup_eedp() argument
3241 void mpi3mr_process_op_reply_desc(struct mpi3mr_ioc *mrioc, in mpi3mr_process_op_reply_desc() argument
3276 mpi3mr_reply_trigger(mrioc, ioc_status, ioc_loginfo); in mpi3mr_process_op_reply_desc()
3281 scsi_reply = mpi3mr_get_reply_virt_addr(mrioc, in mpi3mr_process_op_reply_desc()
3285 mrioc->name); in mpi3mr_process_op_reply_desc()
3297 sense_buf = mpi3mr_get_sensebuf_virt_addr(mrioc, in mpi3mr_process_op_reply_desc()
3304 panic("%s: Ran out of sense buffers\n", mrioc->name); in mpi3mr_process_op_reply_desc()
3307 mpi3mr_scsisense_trigger(mrioc, sshdr.sense_key, in mpi3mr_process_op_reply_desc()
3310 mpi3mr_reply_trigger(mrioc, ioc_status, ioc_loginfo); in mpi3mr_process_op_reply_desc()
3319 scmd = mpi3mr_scmd_from_host_tag(mrioc, host_tag, qidx); in mpi3mr_process_op_reply_desc()
3322 mrioc->name, host_tag); in mpi3mr_process_op_reply_desc()
3338 if (unlikely((data_len_blks >= mrioc->io_throttle_data_length) && in mpi3mr_process_op_reply_desc()
3341 &mrioc->pend_large_data_sz); in mpi3mr_process_op_reply_desc()
3346 mrioc->io_throttle_low) && in mpi3mr_process_op_reply_desc()
3350 mrioc, tg, 0); in mpi3mr_process_op_reply_desc()
3353 if (ioc_pend_data_len <= mrioc->io_throttle_low) in mpi3mr_process_op_reply_desc()
3357 ioc_pend_data_len = atomic_read(&mrioc->pend_large_data_sz); in mpi3mr_process_op_reply_desc()
3359 if (ioc_pend_data_len <= mrioc->io_throttle_low) in mpi3mr_process_op_reply_desc()
3362 } else if (ioc_pend_data_len <= mrioc->io_throttle_low) { in mpi3mr_process_op_reply_desc()
3367 mrioc, tg, 0); in mpi3mr_process_op_reply_desc()
3461 mrioc->logging_level & MPI3_DEBUG_SCSI_ERROR) { in mpi3mr_process_op_reply_desc()
3462 ioc_info(mrioc, "%s :scmd->result 0x%x\n", __func__, in mpi3mr_process_op_reply_desc()
3465 ioc_info(mrioc, in mpi3mr_process_op_reply_desc()
3469 ioc_info(mrioc, in mpi3mr_process_op_reply_desc()
3474 ioc_info(mrioc, in mpi3mr_process_op_reply_desc()
3482 dma_unmap_sg(&mrioc->pdev->dev, scsi_prot_sglist(scmd), in mpi3mr_process_op_reply_desc()
3485 mpi3mr_clear_scmd_priv(mrioc, scmd); in mpi3mr_process_op_reply_desc()
3490 mpi3mr_repost_sense_buf(mrioc, in mpi3mr_process_op_reply_desc()
3502 static int mpi3mr_get_chain_idx(struct mpi3mr_ioc *mrioc) in mpi3mr_get_chain_idx() argument
3508 spin_lock_irqsave(&mrioc->chain_buf_lock, flags); in mpi3mr_get_chain_idx()
3510 cmd_idx = find_first_zero_bit(mrioc->chain_bitmap, in mpi3mr_get_chain_idx()
3511 mrioc->chain_buf_count); in mpi3mr_get_chain_idx()
3512 if (cmd_idx < mrioc->chain_buf_count) { in mpi3mr_get_chain_idx()
3513 set_bit(cmd_idx, mrioc->chain_bitmap); in mpi3mr_get_chain_idx()
3518 spin_unlock_irqrestore(&mrioc->chain_buf_lock, flags); in mpi3mr_get_chain_idx()
3534 static int mpi3mr_prepare_sg_scmd(struct mpi3mr_ioc *mrioc, in mpi3mr_prepare_sg_scmd() argument
3572 sges_left = dma_map_sg(&mrioc->pdev->dev, in mpi3mr_prepare_sg_scmd()
3599 if (sges_left > mrioc->max_sgl_entries) { in mpi3mr_prepare_sg_scmd()
3606 sges_in_segment = (mrioc->facts.op_req_sz - in mpi3mr_prepare_sg_scmd()
3638 chain_idx = mpi3mr_get_chain_idx(mrioc); in mpi3mr_prepare_sg_scmd()
3641 chain_req = &mrioc->chain_sgl_list[chain_idx]; in mpi3mr_prepare_sg_scmd()
3686 static int mpi3mr_build_sg_scmd(struct mpi3mr_ioc *mrioc, in mpi3mr_build_sg_scmd() argument
3691 ret = mpi3mr_prepare_sg_scmd(mrioc, scmd, scsiio_req); in mpi3mr_build_sg_scmd()
3699 ret = mpi3mr_prepare_sg_scmd(mrioc, scmd, scsiio_req); in mpi3mr_build_sg_scmd()
3754 inline void mpi3mr_poll_pend_io_completions(struct mpi3mr_ioc *mrioc) in mpi3mr_poll_pend_io_completions() argument
3758 mrioc->num_op_reply_q + mrioc->op_reply_q_offset; in mpi3mr_poll_pend_io_completions()
3760 for (i = mrioc->op_reply_q_offset; i < num_of_reply_queues; i++) in mpi3mr_poll_pend_io_completions()
3761 mpi3mr_process_op_reply_q(mrioc, in mpi3mr_poll_pend_io_completions()
3762 mrioc->intr_info[i].op_reply_q); in mpi3mr_poll_pend_io_completions()
3784 int mpi3mr_issue_tm(struct mpi3mr_ioc *mrioc, u8 tm_type, in mpi3mr_issue_tm() argument
3798 ioc_info(mrioc, "%s :Issue TM: TM type (0x%x) for devhandle 0x%04x\n", in mpi3mr_issue_tm()
3800 if (mrioc->unrecoverable) { in mpi3mr_issue_tm()
3802 ioc_err(mrioc, "%s :Issue TM: Unrecoverable controller\n", in mpi3mr_issue_tm()
3811 ioc_err(mrioc, "%s :Issue TM: Command is in use\n", __func__); in mpi3mr_issue_tm()
3815 if (mrioc->reset_in_progress) { in mpi3mr_issue_tm()
3817 ioc_err(mrioc, "%s :Issue TM: Reset in progress\n", __func__); in mpi3mr_issue_tm()
3821 if (mrioc->block_on_pci_err) { in mpi3mr_issue_tm()
3823 dprint_tm(mrioc, "sending task management failed due to\n" in mpi3mr_issue_tm()
3839 tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, handle); in mpi3mr_issue_tm()
3863 retval = mpi3mr_admin_request_post(mrioc, &tm_req, sizeof(tm_req), 1); in mpi3mr_issue_tm()
3865 ioc_err(mrioc, "%s :Issue TM: Admin Post failed\n", __func__); in mpi3mr_issue_tm()
3874 dprint_tm(mrioc, in mpi3mr_issue_tm()
3877 if (mrioc->logging_level & MPI3_DEBUG_TM) in mpi3mr_issue_tm()
3879 mpi3mr_soft_reset_handler(mrioc, in mpi3mr_issue_tm()
3886 dprint_tm(mrioc, "invalid task management reply message\n"); in mpi3mr_issue_tm()
3902 dprint_tm(mrioc, in mpi3mr_issue_tm()
3922 dprint_tm(mrioc, in mpi3mr_issue_tm()
3929 mpi3mr_ioc_disable_intr(mrioc); in mpi3mr_issue_tm()
3930 mpi3mr_poll_pend_io_completions(mrioc); in mpi3mr_issue_tm()
3931 mpi3mr_ioc_enable_intr(mrioc); in mpi3mr_issue_tm()
3932 mpi3mr_poll_pend_io_completions(mrioc); in mpi3mr_issue_tm()
3933 mpi3mr_process_admin_reply_q(mrioc); in mpi3mr_issue_tm()
3940 blk_mq_tagset_busy_iter(&mrioc->shost->tag_set, in mpi3mr_issue_tm()
3948 blk_mq_tagset_busy_iter(&mrioc->shost->tag_set, in mpi3mr_issue_tm()
3954 mpi3mr_global_trigger(mrioc, in mpi3mr_issue_tm()
4018 struct mpi3mr_ioc *mrioc = shost_priv(shost); in mpi3mr_map_queues() local
4022 offset = mrioc->op_reply_q_offset; in mpi3mr_map_queues()
4030 map->nr_queues = mrioc->default_qcount; in mpi3mr_map_queues()
4032 map->nr_queues = mrioc->active_poll_qcount; in mpi3mr_map_queues()
4045 blk_mq_map_hw_queues(map, &mrioc->pdev->dev, offset); in mpi3mr_map_queues()
4062 static inline int mpi3mr_get_fw_pending_ios(struct mpi3mr_ioc *mrioc) in mpi3mr_get_fw_pending_ios() argument
4067 for (i = 0; i < mrioc->num_op_reply_q; i++) in mpi3mr_get_fw_pending_ios()
4068 pend_ios += atomic_read(&mrioc->op_reply_qinfo[i].pend_ios); in mpi3mr_get_fw_pending_ios()
4081 static void mpi3mr_print_pending_host_io(struct mpi3mr_ioc *mrioc) in mpi3mr_print_pending_host_io() argument
4083 struct Scsi_Host *shost = mrioc->shost; in mpi3mr_print_pending_host_io()
4085 ioc_info(mrioc, "%s :Pending commands prior to reset: %d\n", in mpi3mr_print_pending_host_io()
4086 __func__, mpi3mr_get_fw_pending_ios(mrioc)); in mpi3mr_print_pending_host_io()
4088 mpi3mr_print_scmd, (void *)mrioc); in mpi3mr_print_pending_host_io()
4100 void mpi3mr_wait_for_host_io(struct mpi3mr_ioc *mrioc, u32 timeout) in mpi3mr_wait_for_host_io() argument
4105 iocstate = mpi3mr_get_iocstate(mrioc); in mpi3mr_wait_for_host_io()
4109 if (!mpi3mr_get_fw_pending_ios(mrioc)) in mpi3mr_wait_for_host_io()
4111 ioc_info(mrioc, in mpi3mr_wait_for_host_io()
4113 __func__, timeout, mpi3mr_get_fw_pending_ios(mrioc)); in mpi3mr_wait_for_host_io()
4116 if (!mpi3mr_get_fw_pending_ios(mrioc)) in mpi3mr_wait_for_host_io()
4118 iocstate = mpi3mr_get_iocstate(mrioc); in mpi3mr_wait_for_host_io()
4124 ioc_info(mrioc, "%s :Pending I/Os after wait is: %d\n", __func__, in mpi3mr_wait_for_host_io()
4125 mpi3mr_get_fw_pending_ios(mrioc)); in mpi3mr_wait_for_host_io()
4142 static inline void mpi3mr_setup_divert_ws(struct mpi3mr_ioc *mrioc, in mpi3mr_setup_divert_ws() argument
4180 struct mpi3mr_ioc *mrioc = shost_priv(scmd->device->host); in mpi3mr_eh_host_reset() local
4183 ret = mpi3mr_soft_reset_handler(mrioc, in mpi3mr_eh_host_reset()
4208 struct mpi3mr_ioc *mrioc = shost_priv(scmd->device->host); in mpi3mr_eh_bus_reset() local
4222 mpi3mr_wait_for_host_io(mrioc, in mpi3mr_eh_bus_reset()
4224 if (!mpi3mr_get_fw_pending_ios(mrioc)) { in mpi3mr_eh_bus_reset()
4225 while (mrioc->reset_in_progress || in mpi3mr_eh_bus_reset()
4226 mrioc->prepare_for_reset || in mpi3mr_eh_bus_reset()
4227 mrioc->block_on_pci_err) { in mpi3mr_eh_bus_reset()
4239 mpi3mr_print_pending_host_io(mrioc); in mpi3mr_eh_bus_reset()
4260 struct mpi3mr_ioc *mrioc = shost_priv(scmd->device->host); in mpi3mr_eh_target_reset() local
4285 mrioc->name, dev_handle); in mpi3mr_eh_target_reset()
4296 ret = mpi3mr_issue_tm(mrioc, in mpi3mr_eh_target_reset()
4299 MPI3MR_RESETTM_TIMEOUT, &mrioc->host_tm_cmds, &resp_code, scmd); in mpi3mr_eh_target_reset()
4307 mrioc->name, stgt_priv_data->pend_count); in mpi3mr_eh_target_reset()
4314 "%s: target reset is %s for scmd(%p)\n", mrioc->name, in mpi3mr_eh_target_reset()
4332 struct mpi3mr_ioc *mrioc = shost_priv(scmd->device->host); in mpi3mr_eh_dev_reset() local
4357 mrioc->name, dev_handle); in mpi3mr_eh_dev_reset()
4367 ret = mpi3mr_issue_tm(mrioc, in mpi3mr_eh_dev_reset()
4370 MPI3MR_RESETTM_TIMEOUT, &mrioc->host_tm_cmds, &resp_code, scmd); in mpi3mr_eh_dev_reset()
4378 mrioc->name, sdev_priv_data->pend_count); in mpi3mr_eh_dev_reset()
4384 "%s: device(LUN) reset is %s for scmd(%p)\n", mrioc->name, in mpi3mr_eh_dev_reset()
4400 struct mpi3mr_ioc *mrioc = shost_priv(shost); in mpi3mr_scan_start() local
4402 mrioc->scan_started = 1; in mpi3mr_scan_start()
4403 ioc_info(mrioc, "%s :Issuing Port Enable\n", __func__); in mpi3mr_scan_start()
4404 if (mpi3mr_issue_port_enable(mrioc, 1)) { in mpi3mr_scan_start()
4405 ioc_err(mrioc, "%s :Issuing port enable failed\n", __func__); in mpi3mr_scan_start()
4406 mrioc->scan_started = 0; in mpi3mr_scan_start()
4407 mrioc->scan_failed = MPI3_IOCSTATUS_INTERNAL_ERROR; in mpi3mr_scan_start()
4425 struct mpi3mr_ioc *mrioc = shost_priv(shost); in mpi3mr_scan_finished() local
4427 u32 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_scan_finished()
4431 ioc_err(mrioc, "port enable failed due to fault or reset\n"); in mpi3mr_scan_finished()
4432 mpi3mr_print_fault_info(mrioc); in mpi3mr_scan_finished()
4433 mrioc->scan_failed = MPI3_IOCSTATUS_INTERNAL_ERROR; in mpi3mr_scan_finished()
4434 mrioc->scan_started = 0; in mpi3mr_scan_finished()
4435 mrioc->init_cmds.is_waiting = 0; in mpi3mr_scan_finished()
4436 mrioc->init_cmds.callback = NULL; in mpi3mr_scan_finished()
4437 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_scan_finished()
4441 ioc_err(mrioc, "port enable failed due to time out\n"); in mpi3mr_scan_finished()
4442 mpi3mr_check_rh_fault_ioc(mrioc, in mpi3mr_scan_finished()
4444 mrioc->scan_failed = MPI3_IOCSTATUS_INTERNAL_ERROR; in mpi3mr_scan_finished()
4445 mrioc->scan_started = 0; in mpi3mr_scan_finished()
4446 mrioc->init_cmds.is_waiting = 0; in mpi3mr_scan_finished()
4447 mrioc->init_cmds.callback = NULL; in mpi3mr_scan_finished()
4448 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_scan_finished()
4451 if (mrioc->scan_started) in mpi3mr_scan_finished()
4454 if (mrioc->scan_failed) { in mpi3mr_scan_finished()
4455 ioc_err(mrioc, in mpi3mr_scan_finished()
4457 mrioc->scan_failed); in mpi3mr_scan_finished()
4459 ioc_info(mrioc, "port enable is successfully completed\n"); in mpi3mr_scan_finished()
4461 mpi3mr_start_watchdog(mrioc); in mpi3mr_scan_finished()
4462 mrioc->is_driver_loading = 0; in mpi3mr_scan_finished()
4463 mrioc->stop_bsgs = 0; in mpi3mr_scan_finished()
4478 struct mpi3mr_ioc *mrioc; in mpi3mr_sdev_destroy() local
4490 mrioc = shost_priv(shost); in mpi3mr_sdev_destroy()
4495 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_sdev_destroy()
4496 if (starget->channel == mrioc->scsi_device_channel) in mpi3mr_sdev_destroy()
4497 tgt_dev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, starget->id); in mpi3mr_sdev_destroy()
4498 else if (mrioc->sas_transport_enabled && !starget->channel) { in mpi3mr_sdev_destroy()
4500 tgt_dev = __mpi3mr_get_tgtdev_by_addr_and_rphy(mrioc, in mpi3mr_sdev_destroy()
4508 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_sdev_destroy()
4525 struct mpi3mr_ioc *mrioc; in mpi3mr_target_destroy() local
4534 mrioc = shost_priv(shost); in mpi3mr_target_destroy()
4537 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_target_destroy()
4538 tgt_dev = __mpi3mr_get_tgtdev_from_tgtpriv(mrioc, scsi_tgt_priv_data); in mpi3mr_target_destroy()
4548 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_target_destroy()
4569 struct mpi3mr_ioc *mrioc; in mpi3mr_sdev_configure() local
4577 mrioc = shost_priv(shost); in mpi3mr_sdev_configure()
4579 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_sdev_configure()
4580 if (starget->channel == mrioc->scsi_device_channel) in mpi3mr_sdev_configure()
4581 tgt_dev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, starget->id); in mpi3mr_sdev_configure()
4582 else if (mrioc->sas_transport_enabled && !starget->channel) { in mpi3mr_sdev_configure()
4584 tgt_dev = __mpi3mr_get_tgtdev_by_addr_and_rphy(mrioc, in mpi3mr_sdev_configure()
4587 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_sdev_configure()
4612 struct mpi3mr_ioc *mrioc; in mpi3mr_sdev_init() local
4623 mrioc = shost_priv(shost); in mpi3mr_sdev_init()
4626 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_sdev_init()
4628 if (starget->channel == mrioc->scsi_device_channel) in mpi3mr_sdev_init()
4629 tgt_dev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, starget->id); in mpi3mr_sdev_init()
4630 else if (mrioc->sas_transport_enabled && !starget->channel) { in mpi3mr_sdev_init()
4632 tgt_dev = __mpi3mr_get_tgtdev_by_addr_and_rphy(mrioc, in mpi3mr_sdev_init()
4642 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_sdev_init()
4646 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_sdev_init()
4672 struct mpi3mr_ioc *mrioc = shost_priv(shost); in mpi3mr_target_alloc() local
4685 spin_lock_irqsave(&mrioc->tgtdev_lock, flags); in mpi3mr_target_alloc()
4686 if (starget->channel == mrioc->scsi_device_channel) { in mpi3mr_target_alloc()
4687 tgt_dev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, starget->id); in mpi3mr_target_alloc()
4711 } else if (mrioc->sas_transport_enabled && !starget->channel) { in mpi3mr_target_alloc()
4713 tgt_dev = __mpi3mr_get_tgtdev_by_addr_and_rphy(mrioc, in mpi3mr_target_alloc()
4730 spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); in mpi3mr_target_alloc()
4747 static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc, in mpi3mr_check_return_unmap() argument
4755 if (mrioc->pdev->revision) { in mpi3mr_check_return_unmap()
4758 dprint_scsi_command(mrioc, scmd, MPI3_DEBUG_SCSI_ERROR); in mpi3mr_check_return_unmap()
4759 dprint_scsi_err(mrioc, in mpi3mr_check_return_unmap()
4763 dprint_scsi_command(mrioc, scmd, MPI3_DEBUG_SCSI_ERROR); in mpi3mr_check_return_unmap()
4769 ioc_warn(mrioc, in mpi3mr_check_return_unmap()
4779 ioc_warn(mrioc, in mpi3mr_check_return_unmap()
4790 ioc_warn(mrioc, in mpi3mr_check_return_unmap()
4813 ioc_warn(mrioc, in mpi3mr_check_return_unmap()
4828 dprint_scsi_err(mrioc, in mpi3mr_check_return_unmap()
4874 struct mpi3mr_ioc *mrioc = shost_priv(shost); in mpi3mr_qcmd() local
4891 if (mrioc->unrecoverable) { in mpi3mr_qcmd()
4904 if (mrioc->stop_drv_processing && in mpi3mr_qcmd()
4924 if (mrioc->reset_in_progress || mrioc->prepare_for_reset in mpi3mr_qcmd()
4925 || mrioc->block_on_pci_err) { in mpi3mr_qcmd()
4931 if (mrioc->stop_drv_processing) { in mpi3mr_qcmd()
4954 (mrioc->pdev->device == MPI3_MFGPAGE_DEVID_SAS4116) && in mpi3mr_qcmd()
4955 mpi3mr_check_return_unmap(mrioc, scmd)) in mpi3mr_qcmd()
4958 host_tag = mpi3mr_host_tag_for_scmd(mrioc, scmd); in mpi3mr_qcmd()
4989 mpi3mr_setup_eedp(mrioc, scmd, scsiio_req); in mpi3mr_qcmd()
4992 mpi3mr_setup_divert_ws(mrioc, scmd, scsiio_req, &scsiio_flags, in mpi3mr_qcmd()
5002 if (mpi3mr_build_sg_scmd(mrioc, scmd, scsiio_req)) { in mpi3mr_qcmd()
5003 mpi3mr_clear_scmd_priv(mrioc, scmd); in mpi3mr_qcmd()
5007 op_req_q = &mrioc->req_qinfo[scmd_priv_data->req_q_idx]; in mpi3mr_qcmd()
5009 if ((data_len_blks >= mrioc->io_throttle_data_length) && in mpi3mr_qcmd()
5015 &mrioc->pend_large_data_sz); in mpi3mr_qcmd()
5019 mrioc->io_throttle_high) || in mpi3mr_qcmd()
5023 mpi3mr_set_io_divert_for_all_vd_in_tg(mrioc, in mpi3mr_qcmd()
5025 mpi3mr_queue_qd_reduction_event(mrioc, tg); in mpi3mr_qcmd()
5029 &mrioc->pend_large_data_sz); in mpi3mr_qcmd()
5030 if (ioc_pend_data_len >= mrioc->io_throttle_high) in mpi3mr_qcmd()
5042 if (mpi3mr_op_request_post(mrioc, op_req_q, in mpi3mr_qcmd()
5044 mpi3mr_clear_scmd_priv(mrioc, scmd); in mpi3mr_qcmd()
5047 atomic_sub(tracked_io_sz, &mrioc->pend_large_data_sz); in mpi3mr_qcmd()
5201 struct mpi3mr_ioc *mrioc = NULL; in mpi3mr_probe() local
5217 mrioc = shost_priv(shost); in mpi3mr_probe()
5221 mrioc->id = (u8)retval; in mpi3mr_probe()
5222 sprintf(mrioc->driver_name, "%s", MPI3MR_DRIVER_NAME); in mpi3mr_probe()
5223 sprintf(mrioc->name, "%s%d", mrioc->driver_name, mrioc->id); in mpi3mr_probe()
5224 INIT_LIST_HEAD(&mrioc->list); in mpi3mr_probe()
5226 list_add_tail(&mrioc->list, &mrioc_list); in mpi3mr_probe()
5229 spin_lock_init(&mrioc->admin_req_lock); in mpi3mr_probe()
5230 spin_lock_init(&mrioc->reply_free_queue_lock); in mpi3mr_probe()
5231 spin_lock_init(&mrioc->sbq_lock); in mpi3mr_probe()
5232 spin_lock_init(&mrioc->fwevt_lock); in mpi3mr_probe()
5233 spin_lock_init(&mrioc->tgtdev_lock); in mpi3mr_probe()
5234 spin_lock_init(&mrioc->watchdog_lock); in mpi3mr_probe()
5235 spin_lock_init(&mrioc->chain_buf_lock); in mpi3mr_probe()
5236 spin_lock_init(&mrioc->sas_node_lock); in mpi3mr_probe()
5237 spin_lock_init(&mrioc->trigger_lock); in mpi3mr_probe()
5239 INIT_LIST_HEAD(&mrioc->fwevt_list); in mpi3mr_probe()
5240 INIT_LIST_HEAD(&mrioc->tgtdev_list); in mpi3mr_probe()
5241 INIT_LIST_HEAD(&mrioc->delayed_rmhs_list); in mpi3mr_probe()
5242 INIT_LIST_HEAD(&mrioc->delayed_evtack_cmds_list); in mpi3mr_probe()
5243 INIT_LIST_HEAD(&mrioc->sas_expander_list); in mpi3mr_probe()
5244 INIT_LIST_HEAD(&mrioc->hba_port_table_list); in mpi3mr_probe()
5245 INIT_LIST_HEAD(&mrioc->enclosure_list); in mpi3mr_probe()
5247 mutex_init(&mrioc->reset_mutex); in mpi3mr_probe()
5248 mpi3mr_init_drv_cmd(&mrioc->init_cmds, MPI3MR_HOSTTAG_INITCMDS); in mpi3mr_probe()
5249 mpi3mr_init_drv_cmd(&mrioc->host_tm_cmds, MPI3MR_HOSTTAG_BLK_TMS); in mpi3mr_probe()
5250 mpi3mr_init_drv_cmd(&mrioc->bsg_cmds, MPI3MR_HOSTTAG_BSG_CMDS); in mpi3mr_probe()
5251 mpi3mr_init_drv_cmd(&mrioc->cfg_cmds, MPI3MR_HOSTTAG_CFG_CMDS); in mpi3mr_probe()
5252 mpi3mr_init_drv_cmd(&mrioc->transport_cmds, in mpi3mr_probe()
5256 mpi3mr_init_drv_cmd(&mrioc->dev_rmhs_cmds[i], in mpi3mr_probe()
5260 mpi3mr_init_drv_cmd(&mrioc->evtack_cmds[i], in mpi3mr_probe()
5265 mrioc->enable_segqueue = false; in mpi3mr_probe()
5267 mrioc->enable_segqueue = true; in mpi3mr_probe()
5269 init_waitqueue_head(&mrioc->reset_waitq); in mpi3mr_probe()
5270 mrioc->logging_level = logging_level; in mpi3mr_probe()
5271 mrioc->shost = shost; in mpi3mr_probe()
5272 mrioc->pdev = pdev; in mpi3mr_probe()
5273 mrioc->stop_bsgs = 1; in mpi3mr_probe()
5275 mrioc->max_sgl_entries = max_sgl_entries; in mpi3mr_probe()
5277 mrioc->max_sgl_entries = MPI3MR_MAX_SGL_ENTRIES; in mpi3mr_probe()
5279 mrioc->max_sgl_entries = MPI3MR_DEFAULT_SGL_ENTRIES; in mpi3mr_probe()
5281 mrioc->max_sgl_entries /= MPI3MR_DEFAULT_SGL_ENTRIES; in mpi3mr_probe()
5282 mrioc->max_sgl_entries *= MPI3MR_DEFAULT_SGL_ENTRIES; in mpi3mr_probe()
5288 shost->unique_id = mrioc->id; in mpi3mr_probe()
5304 ioc_info(mrioc, in mpi3mr_probe()
5320 mrioc->fwevt_worker_thread = alloc_ordered_workqueue( in mpi3mr_probe()
5321 "%s%d_fwevt_wrkr", 0, mrioc->driver_name, mrioc->id); in mpi3mr_probe()
5322 if (!mrioc->fwevt_worker_thread) { in mpi3mr_probe()
5323 ioc_err(mrioc, "failure at %s:%d/%s()!\n", in mpi3mr_probe()
5329 mrioc->is_driver_loading = 1; in mpi3mr_probe()
5330 mrioc->cpu_count = num_online_cpus(); in mpi3mr_probe()
5331 if (mpi3mr_setup_resources(mrioc)) { in mpi3mr_probe()
5332 ioc_err(mrioc, "setup resources failed\n"); in mpi3mr_probe()
5336 if (mpi3mr_init_ioc(mrioc)) { in mpi3mr_probe()
5337 ioc_err(mrioc, "initializing IOC failed\n"); in mpi3mr_probe()
5342 shost->nr_hw_queues = mrioc->num_op_reply_q; in mpi3mr_probe()
5343 if (mrioc->active_poll_qcount) in mpi3mr_probe()
5346 shost->can_queue = mrioc->max_host_ios; in mpi3mr_probe()
5347 shost->sg_tablesize = mrioc->max_sgl_entries; in mpi3mr_probe()
5348 shost->max_id = mrioc->facts.max_perids + 1; in mpi3mr_probe()
5352 ioc_err(mrioc, "failure at %s:%d/%s()!\n", in mpi3mr_probe()
5358 mpi3mr_bsg_init(mrioc); in mpi3mr_probe()
5362 mpi3mr_stop_watchdog(mrioc); in mpi3mr_probe()
5363 mpi3mr_cleanup_ioc(mrioc); in mpi3mr_probe()
5365 mpi3mr_free_mem(mrioc); in mpi3mr_probe()
5366 mpi3mr_cleanup_resources(mrioc); in mpi3mr_probe()
5368 destroy_workqueue(mrioc->fwevt_worker_thread); in mpi3mr_probe()
5370 ida_free(&mrioc_ida, mrioc->id); in mpi3mr_probe()
5372 list_del(&mrioc->list); in mpi3mr_probe()
5393 struct mpi3mr_ioc *mrioc; in mpi3mr_remove() local
5403 mrioc = shost_priv(shost); in mpi3mr_remove()
5404 while (mrioc->reset_in_progress || mrioc->is_driver_loading) in mpi3mr_remove()
5407 if (mrioc->block_on_pci_err) { in mpi3mr_remove()
5408 mrioc->block_on_pci_err = false; in mpi3mr_remove()
5410 mrioc->unrecoverable = 1; in mpi3mr_remove()
5413 if (!pci_device_is_present(mrioc->pdev) || in mpi3mr_remove()
5414 mrioc->pci_err_recovery) { in mpi3mr_remove()
5415 mrioc->unrecoverable = 1; in mpi3mr_remove()
5416 mpi3mr_flush_cmds_for_unrecovered_controller(mrioc); in mpi3mr_remove()
5419 mpi3mr_bsg_exit(mrioc); in mpi3mr_remove()
5420 mrioc->stop_drv_processing = 1; in mpi3mr_remove()
5421 mpi3mr_cleanup_fwevt_list(mrioc); in mpi3mr_remove()
5422 spin_lock_irqsave(&mrioc->fwevt_lock, flags); in mpi3mr_remove()
5423 wq = mrioc->fwevt_worker_thread; in mpi3mr_remove()
5424 mrioc->fwevt_worker_thread = NULL; in mpi3mr_remove()
5425 spin_unlock_irqrestore(&mrioc->fwevt_lock, flags); in mpi3mr_remove()
5429 if (mrioc->sas_transport_enabled) in mpi3mr_remove()
5434 list_for_each_entry_safe(tgtdev, tgtdev_next, &mrioc->tgtdev_list, in mpi3mr_remove()
5436 mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev); in mpi3mr_remove()
5437 mpi3mr_tgtdev_del_from_list(mrioc, tgtdev, true); in mpi3mr_remove()
5440 mpi3mr_stop_watchdog(mrioc); in mpi3mr_remove()
5441 mpi3mr_cleanup_ioc(mrioc); in mpi3mr_remove()
5442 mpi3mr_free_mem(mrioc); in mpi3mr_remove()
5443 mpi3mr_cleanup_resources(mrioc); in mpi3mr_remove()
5445 spin_lock_irqsave(&mrioc->sas_node_lock, flags); in mpi3mr_remove()
5447 &mrioc->sas_expander_list, list) { in mpi3mr_remove()
5448 spin_unlock_irqrestore(&mrioc->sas_node_lock, flags); in mpi3mr_remove()
5449 mpi3mr_expander_node_remove(mrioc, sas_expander); in mpi3mr_remove()
5450 spin_lock_irqsave(&mrioc->sas_node_lock, flags); in mpi3mr_remove()
5452 list_for_each_entry_safe(port, hba_port_next, &mrioc->hba_port_table_list, list) { in mpi3mr_remove()
5453 ioc_info(mrioc, in mpi3mr_remove()
5459 spin_unlock_irqrestore(&mrioc->sas_node_lock, flags); in mpi3mr_remove()
5461 if (mrioc->sas_hba.num_phys) { in mpi3mr_remove()
5462 kfree(mrioc->sas_hba.phy); in mpi3mr_remove()
5463 mrioc->sas_hba.phy = NULL; in mpi3mr_remove()
5464 mrioc->sas_hba.num_phys = 0; in mpi3mr_remove()
5467 ida_free(&mrioc_ida, mrioc->id); in mpi3mr_remove()
5469 list_del(&mrioc->list); in mpi3mr_remove()
5487 struct mpi3mr_ioc *mrioc; in mpi3mr_shutdown() local
5494 mrioc = shost_priv(shost); in mpi3mr_shutdown()
5495 while (mrioc->reset_in_progress || mrioc->is_driver_loading) in mpi3mr_shutdown()
5498 mrioc->stop_drv_processing = 1; in mpi3mr_shutdown()
5499 mpi3mr_cleanup_fwevt_list(mrioc); in mpi3mr_shutdown()
5500 spin_lock_irqsave(&mrioc->fwevt_lock, flags); in mpi3mr_shutdown()
5501 wq = mrioc->fwevt_worker_thread; in mpi3mr_shutdown()
5502 mrioc->fwevt_worker_thread = NULL; in mpi3mr_shutdown()
5503 spin_unlock_irqrestore(&mrioc->fwevt_lock, flags); in mpi3mr_shutdown()
5507 mpi3mr_stop_watchdog(mrioc); in mpi3mr_shutdown()
5508 mpi3mr_cleanup_ioc(mrioc); in mpi3mr_shutdown()
5509 mpi3mr_cleanup_resources(mrioc); in mpi3mr_shutdown()
5526 struct mpi3mr_ioc *mrioc; in mpi3mr_suspend() local
5531 mrioc = shost_priv(shost); in mpi3mr_suspend()
5532 while (mrioc->reset_in_progress || mrioc->is_driver_loading) in mpi3mr_suspend()
5534 mrioc->stop_drv_processing = 1; in mpi3mr_suspend()
5535 mpi3mr_cleanup_fwevt_list(mrioc); in mpi3mr_suspend()
5537 mpi3mr_stop_watchdog(mrioc); in mpi3mr_suspend()
5538 mpi3mr_cleanup_ioc(mrioc); in mpi3mr_suspend()
5540 ioc_info(mrioc, "pdev=0x%p, slot=%s, entering operating state\n", in mpi3mr_suspend()
5542 mpi3mr_cleanup_resources(mrioc); in mpi3mr_suspend()
5561 struct mpi3mr_ioc *mrioc; in mpi3mr_resume() local
5568 mrioc = shost_priv(shost); in mpi3mr_resume()
5570 ioc_info(mrioc, "pdev=0x%p, slot=%s, previous operating state [D%d]\n", in mpi3mr_resume()
5572 mrioc->pdev = pdev; in mpi3mr_resume()
5573 mrioc->cpu_count = num_online_cpus(); in mpi3mr_resume()
5574 r = mpi3mr_setup_resources(mrioc); in mpi3mr_resume()
5576 ioc_info(mrioc, "%s: Setup resources failed[%d]\n", in mpi3mr_resume()
5581 mrioc->stop_drv_processing = 0; in mpi3mr_resume()
5582 mpi3mr_invalidate_devhandles(mrioc); in mpi3mr_resume()
5583 mpi3mr_free_enclosure_list(mrioc); in mpi3mr_resume()
5584 mpi3mr_memset_buffers(mrioc); in mpi3mr_resume()
5585 r = mpi3mr_reinit_ioc(mrioc, 1); in mpi3mr_resume()
5587 ioc_err(mrioc, "resuming controller failed[%d]\n", r); in mpi3mr_resume()
5592 mrioc->device_refresh_on = 0; in mpi3mr_resume()
5593 mpi3mr_start_watchdog(mrioc); in mpi3mr_resume()
5629 struct mpi3mr_ioc *mrioc; in mpi3mr_pcierr_error_detected() local
5636 mrioc = shost_priv(shost); in mpi3mr_pcierr_error_detected()
5642 mrioc->pci_err_recovery = true; in mpi3mr_pcierr_error_detected()
5643 mrioc->block_on_pci_err = true; in mpi3mr_pcierr_error_detected()
5645 if (mrioc->reset_in_progress || mrioc->is_driver_loading) in mpi3mr_pcierr_error_detected()
5652 mrioc->pci_err_recovery = true; in mpi3mr_pcierr_error_detected()
5653 mrioc->block_on_pci_err = true; in mpi3mr_pcierr_error_detected()
5654 mrioc->unrecoverable = 1; in mpi3mr_pcierr_error_detected()
5655 mpi3mr_stop_watchdog(mrioc); in mpi3mr_pcierr_error_detected()
5656 mpi3mr_flush_cmds_for_unrecovered_controller(mrioc); in mpi3mr_pcierr_error_detected()
5660 scsi_block_requests(mrioc->shost); in mpi3mr_pcierr_error_detected()
5661 mpi3mr_stop_watchdog(mrioc); in mpi3mr_pcierr_error_detected()
5662 mpi3mr_cleanup_resources(mrioc); in mpi3mr_pcierr_error_detected()
5665 mrioc->pci_err_recovery = true; in mpi3mr_pcierr_error_detected()
5666 mrioc->block_on_pci_err = true; in mpi3mr_pcierr_error_detected()
5667 mrioc->unrecoverable = 1; in mpi3mr_pcierr_error_detected()
5668 mpi3mr_stop_watchdog(mrioc); in mpi3mr_pcierr_error_detected()
5669 mpi3mr_flush_cmds_for_unrecovered_controller(mrioc); in mpi3mr_pcierr_error_detected()
5695 struct mpi3mr_ioc *mrioc; in mpi3mr_pcierr_slot_reset() local
5701 mrioc = shost_priv(shost); in mpi3mr_pcierr_slot_reset()
5704 if (mrioc->reset_in_progress) in mpi3mr_pcierr_slot_reset()
5715 if (mpi3mr_setup_resources(mrioc)) { in mpi3mr_pcierr_slot_reset()
5716 ioc_err(mrioc, "setup resources failed\n"); in mpi3mr_pcierr_slot_reset()
5719 mrioc->unrecoverable = 0; in mpi3mr_pcierr_slot_reset()
5720 mrioc->pci_err_recovery = false; in mpi3mr_pcierr_slot_reset()
5722 if (mpi3mr_soft_reset_handler(mrioc, MPI3MR_RESET_FROM_FIRMWARE, 0)) in mpi3mr_pcierr_slot_reset()
5728 mrioc->unrecoverable = 1; in mpi3mr_pcierr_slot_reset()
5729 mrioc->block_on_pci_err = false; in mpi3mr_pcierr_slot_reset()
5731 mpi3mr_start_watchdog(mrioc); in mpi3mr_pcierr_slot_reset()
5748 struct mpi3mr_ioc *mrioc; in mpi3mr_pcierr_resume() local
5753 mrioc = shost_priv(shost); in mpi3mr_pcierr_resume()
5755 if (mrioc->block_on_pci_err) { in mpi3mr_pcierr_resume()
5756 mrioc->block_on_pci_err = false; in mpi3mr_pcierr_resume()
5758 mpi3mr_start_watchdog(mrioc); in mpi3mr_pcierr_resume()
5776 struct mpi3mr_ioc *mrioc; in mpi3mr_pcierr_mmio_enabled() local
5781 mrioc = shost_priv(shost); in mpi3mr_pcierr_mmio_enabled()
5783 if (mrioc->unrecoverable) in mpi3mr_pcierr_mmio_enabled()