Lines Matching refs:instance

100 int megasas_transition_to_ready(struct megasas_instance *instance, int ocr);
101 static int megasas_get_pd_list(struct megasas_instance *instance);
102 static int megasas_ld_list_query(struct megasas_instance *instance,
104 static int megasas_issue_init_mfi(struct megasas_instance *instance);
105 static int megasas_register_aen(struct megasas_instance *instance,
164 megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
169 megasas_adp_reset_gen2(struct megasas_instance *instance,
173 megasas_init_adapter_mfi(struct megasas_instance *instance);
175 megasas_build_and_issue_cmd(struct megasas_instance *instance,
179 megasas_release_fusion(struct megasas_instance *instance);
181 megasas_ioc_init_fusion(struct megasas_instance *instance);
183 megasas_free_cmds_fusion(struct megasas_instance *instance);
185 megasas_get_map_info(struct megasas_instance *instance);
187 megasas_sync_map_info(struct megasas_instance *instance);
189 wait_and_poll(struct megasas_instance *instance, struct megasas_cmd *cmd,
191 void megasas_reset_reply_desc(struct megasas_instance *instance);
194 static int megasas_get_ld_vf_affiliation(struct megasas_instance *instance,
196 int megasas_check_mpio_paths(struct megasas_instance *instance,
200 megasas_issue_dcmd(struct megasas_instance *instance, struct megasas_cmd *cmd) in megasas_issue_dcmd() argument
202 instance->instancet->fire_cmd(instance, in megasas_issue_dcmd()
203 cmd->frame_phys_addr, 0, instance->reg_set); in megasas_issue_dcmd()
213 *instance) in megasas_get_cmd()
218 spin_lock_irqsave(&instance->mfi_pool_lock, flags); in megasas_get_cmd()
220 if (!list_empty(&instance->cmd_pool)) { in megasas_get_cmd()
221 cmd = list_entry((&instance->cmd_pool)->next, in megasas_get_cmd()
225 dev_err(&instance->pdev->dev, "Command pool empty!\n"); in megasas_get_cmd()
228 spin_unlock_irqrestore(&instance->mfi_pool_lock, flags); in megasas_get_cmd()
238 megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd) in megasas_return_cmd() argument
243 struct fusion_context *fusion = instance->ctrl_context; in megasas_return_cmd()
251 spin_lock_irqsave(&instance->mfi_pool_lock, flags); in megasas_return_cmd()
254 blk_tags = instance->max_scsi_cmds + cmd->index; in megasas_return_cmd()
256 megasas_return_cmd_fusion(instance, cmd_fusion); in megasas_return_cmd()
263 list_add(&cmd->list, (&instance->cmd_pool)->next); in megasas_return_cmd()
265 spin_unlock_irqrestore(&instance->mfi_pool_lock, flags); in megasas_return_cmd()
314 megasas_decode_evt(struct megasas_instance *instance) in megasas_decode_evt() argument
316 struct megasas_evt_detail *evt_detail = instance->evt_detail; in megasas_decode_evt()
321 dev_info(&instance->pdev->dev, "%d (%s/0x%04x/%s) - %s\n", in megasas_decode_evt()
339 megasas_enable_intr_xscale(struct megasas_instance *instance) in megasas_enable_intr_xscale() argument
343 regs = instance->reg_set; in megasas_enable_intr_xscale()
355 megasas_disable_intr_xscale(struct megasas_instance *instance) in megasas_disable_intr_xscale() argument
360 regs = instance->reg_set; in megasas_disable_intr_xscale()
414 megasas_fire_cmd_xscale(struct megasas_instance *instance, in megasas_fire_cmd_xscale() argument
421 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_fire_cmd_xscale()
424 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_fire_cmd_xscale()
432 megasas_adp_reset_xscale(struct megasas_instance *instance, in megasas_adp_reset_xscale() argument
443 pci_read_config_dword(instance->pdev, MFI_1068_PCSR_OFFSET, &pcidata); in megasas_adp_reset_xscale()
444 dev_notice(&instance->pdev->dev, "pcidata = %x\n", pcidata); in megasas_adp_reset_xscale()
446 dev_notice(&instance->pdev->dev, "mfi 1068 offset read=%x\n", pcidata); in megasas_adp_reset_xscale()
448 pci_write_config_dword(instance->pdev, in megasas_adp_reset_xscale()
455 pci_read_config_dword(instance->pdev, in megasas_adp_reset_xscale()
457 dev_notice(&instance->pdev->dev, "1068 offset handshake read=%x\n", pcidata); in megasas_adp_reset_xscale()
459 dev_notice(&instance->pdev->dev, "1068 offset pcidt=%x\n", pcidata); in megasas_adp_reset_xscale()
461 pci_write_config_dword(instance->pdev, in megasas_adp_reset_xscale()
473 megasas_check_reset_xscale(struct megasas_instance *instance, in megasas_check_reset_xscale() argument
476 if ((instance->adprecovery != MEGASAS_HBA_OPERATIONAL) && in megasas_check_reset_xscale()
477 (le32_to_cpu(*instance->consumer) == in megasas_check_reset_xscale()
514 megasas_enable_intr_ppc(struct megasas_instance *instance) in megasas_enable_intr_ppc() argument
518 regs = instance->reg_set; in megasas_enable_intr_ppc()
532 megasas_disable_intr_ppc(struct megasas_instance *instance) in megasas_disable_intr_ppc() argument
537 regs = instance->reg_set; in megasas_disable_intr_ppc()
591 megasas_fire_cmd_ppc(struct megasas_instance *instance, in megasas_fire_cmd_ppc() argument
598 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_fire_cmd_ppc()
601 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_fire_cmd_ppc()
609 megasas_check_reset_ppc(struct megasas_instance *instance, in megasas_check_reset_ppc() argument
612 if (instance->adprecovery != MEGASAS_HBA_OPERATIONAL) in megasas_check_reset_ppc()
639 megasas_enable_intr_skinny(struct megasas_instance *instance) in megasas_enable_intr_skinny() argument
643 regs = instance->reg_set; in megasas_enable_intr_skinny()
657 megasas_disable_intr_skinny(struct megasas_instance *instance) in megasas_disable_intr_skinny() argument
662 regs = instance->reg_set; in megasas_disable_intr_skinny()
726 megasas_fire_cmd_skinny(struct megasas_instance *instance, in megasas_fire_cmd_skinny() argument
733 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_fire_cmd_skinny()
738 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_fire_cmd_skinny()
746 megasas_check_reset_skinny(struct megasas_instance *instance, in megasas_check_reset_skinny() argument
749 if (instance->adprecovery != MEGASAS_HBA_OPERATIONAL) in megasas_check_reset_skinny()
782 megasas_enable_intr_gen2(struct megasas_instance *instance) in megasas_enable_intr_gen2() argument
786 regs = instance->reg_set; in megasas_enable_intr_gen2()
801 megasas_disable_intr_gen2(struct megasas_instance *instance) in megasas_disable_intr_gen2() argument
806 regs = instance->reg_set; in megasas_disable_intr_gen2()
862 megasas_fire_cmd_gen2(struct megasas_instance *instance, in megasas_fire_cmd_gen2() argument
869 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_fire_cmd_gen2()
872 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_fire_cmd_gen2()
880 megasas_adp_reset_gen2(struct megasas_instance *instance, in megasas_adp_reset_gen2() argument
888 if (instance->instancet == &megasas_instance_template_skinny) { in megasas_adp_reset_gen2()
907 dev_notice(&instance->pdev->dev, "RESETGEN2: retry=%x, hostdiag=%x\n", in megasas_adp_reset_gen2()
915 dev_notice(&instance->pdev->dev, "ADP_RESET_GEN2: HostDiag=%x\n", HostDiag); in megasas_adp_reset_gen2()
925 dev_notice(&instance->pdev->dev, "RESET_GEN2: retry=%x, hostdiag=%x\n", in megasas_adp_reset_gen2()
940 megasas_check_reset_gen2(struct megasas_instance *instance, in megasas_check_reset_gen2() argument
943 if (instance->adprecovery != MEGASAS_HBA_OPERATIONAL) { in megasas_check_reset_gen2()
984 megasas_issue_polled(struct megasas_instance *instance, struct megasas_cmd *cmd) in megasas_issue_polled() argument
995 instance->instancet->issue_dcmd(instance, cmd); in megasas_issue_polled()
1000 if (instance->requestorId) in megasas_issue_polled()
1004 return wait_and_poll(instance, cmd, seconds); in megasas_issue_polled()
1018 megasas_issue_blocked_cmd(struct megasas_instance *instance, in megasas_issue_blocked_cmd() argument
1025 instance->instancet->issue_dcmd(instance, cmd); in megasas_issue_blocked_cmd()
1027 ret = wait_event_timeout(instance->int_cmd_wait_q, in megasas_issue_blocked_cmd()
1032 wait_event(instance->int_cmd_wait_q, in megasas_issue_blocked_cmd()
1051 megasas_issue_blocked_abort_cmd(struct megasas_instance *instance, in megasas_issue_blocked_abort_cmd() argument
1058 cmd = megasas_get_cmd(instance); in megasas_issue_blocked_abort_cmd()
1080 instance->instancet->issue_dcmd(instance, cmd); in megasas_issue_blocked_abort_cmd()
1083 ret = wait_event_timeout(instance->abort_cmd_wait_q, in megasas_issue_blocked_abort_cmd()
1086 dev_err(&instance->pdev->dev, "Command timedout" in megasas_issue_blocked_abort_cmd()
1091 wait_event(instance->abort_cmd_wait_q, in megasas_issue_blocked_abort_cmd()
1096 megasas_return_cmd(instance, cmd); in megasas_issue_blocked_abort_cmd()
1110 megasas_make_sgl32(struct megasas_instance *instance, struct scsi_cmnd *scp, in megasas_make_sgl32() argument
1139 megasas_make_sgl64(struct megasas_instance *instance, struct scsi_cmnd *scp, in megasas_make_sgl64() argument
1168 megasas_make_sgl_skinny(struct megasas_instance *instance, in megasas_make_sgl_skinny() argument
1197 static u32 megasas_get_frame_count(struct megasas_instance *instance, in megasas_get_frame_count() argument
1208 if (instance->flag_ieee) { in megasas_get_frame_count()
1219 if (instance->flag_ieee == 1) { in megasas_get_frame_count()
1226 if (instance->flag_ieee == 1) { in megasas_get_frame_count()
1258 megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp, in megasas_build_dcdb() argument
1277 if (instance->flag_ieee == 1) { in megasas_build_dcdb()
1311 if (instance->flag_ieee == 1) { in megasas_build_dcdb()
1313 pthru->sge_count = megasas_make_sgl_skinny(instance, scp, in megasas_build_dcdb()
1317 pthru->sge_count = megasas_make_sgl64(instance, scp, in megasas_build_dcdb()
1320 pthru->sge_count = megasas_make_sgl32(instance, scp, in megasas_build_dcdb()
1323 if (pthru->sge_count > instance->max_num_sge) { in megasas_build_dcdb()
1324 dev_err(&instance->pdev->dev, "DCDB too many SGE NUM=%x\n", in megasas_build_dcdb()
1342 cmd->frame_count = megasas_get_frame_count(instance, pthru->sge_count, in megasas_build_dcdb()
1357 megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp, in megasas_build_ldio() argument
1373 if (instance->flag_ieee == 1) { in megasas_build_ldio()
1454 if (instance->flag_ieee) { in megasas_build_ldio()
1456 ldio->sge_count = megasas_make_sgl_skinny(instance, scp, in megasas_build_ldio()
1460 ldio->sge_count = megasas_make_sgl64(instance, scp, &ldio->sgl); in megasas_build_ldio()
1462 ldio->sge_count = megasas_make_sgl32(instance, scp, &ldio->sgl); in megasas_build_ldio()
1464 if (ldio->sge_count > instance->max_num_sge) { in megasas_build_ldio()
1465 dev_err(&instance->pdev->dev, "build_ld_io: sge_count = %x\n", in megasas_build_ldio()
1481 cmd->frame_count = megasas_get_frame_count(instance, in megasas_build_ldio()
1522 megasas_dump_pending_frames(struct megasas_instance *instance) in megasas_dump_pending_frames() argument
1530 u32 max_cmd = instance->max_fw_cmds; in megasas_dump_pending_frames()
1532 …dev_err(&instance->pdev->dev, "[%d]: Dumping Frame Phys Address of all pending cmds in FW\n",insta… in megasas_dump_pending_frames()
1533 …dev_err(&instance->pdev->dev, "[%d]: Total OS Pending cmds : %d\n",instance->host->host_no,atomic_… in megasas_dump_pending_frames()
1535 dev_err(&instance->pdev->dev, "[%d]: 64 bit SGLs were sent to FW\n",instance->host->host_no); in megasas_dump_pending_frames()
1537 dev_err(&instance->pdev->dev, "[%d]: 32 bit SGLs were sent to FW\n",instance->host->host_no); in megasas_dump_pending_frames()
1539 dev_err(&instance->pdev->dev, "[%d]: Pending OS cmds in FW : \n",instance->host->host_no); in megasas_dump_pending_frames()
1541 cmd = instance->cmd_list[i]; in megasas_dump_pending_frames()
1544 …dev_err(&instance->pdev->dev, "[%d]: Frame addr :0x%08lx : ",instance->host->host_no,(unsigned lon… in megasas_dump_pending_frames()
1549 dev_err(&instance->pdev->dev, "[%d]: frame count : 0x%x, Cmd : 0x%x, Tgt id : 0x%x," in megasas_dump_pending_frames()
1551 instance->host->host_no, cmd->frame_count, ldio->cmd, ldio->target_id, in megasas_dump_pending_frames()
1558 dev_err(&instance->pdev->dev, "[%d]: frame count : 0x%x, Cmd : 0x%x, Tgt id : 0x%x, " in megasas_dump_pending_frames()
1560 instance->host->host_no, cmd->frame_count, pthru->cmd, pthru->target_id, in megasas_dump_pending_frames()
1567 dev_err(&instance->pdev->dev, "sgl len : 0x%x, sgl addr : 0x%llx\n", in megasas_dump_pending_frames()
1571 dev_err(&instance->pdev->dev, "sgl len : 0x%x, sgl addr : 0x%x\n", in megasas_dump_pending_frames()
1577 dev_err(&instance->pdev->dev, "[%d]: Pending Internal cmds in FW : \n",instance->host->host_no); in megasas_dump_pending_frames()
1580 cmd = instance->cmd_list[i]; in megasas_dump_pending_frames()
1583 dev_err(&instance->pdev->dev, "0x%08lx : ", (unsigned long)cmd->frame_phys_addr); in megasas_dump_pending_frames()
1585 dev_err(&instance->pdev->dev, "[%d]: Dumping Done\n\n",instance->host->host_no); in megasas_dump_pending_frames()
1589 megasas_build_and_issue_cmd(struct megasas_instance *instance, in megasas_build_and_issue_cmd() argument
1595 cmd = megasas_get_cmd(instance); in megasas_build_and_issue_cmd()
1603 frame_count = megasas_build_ldio(instance, scmd, cmd); in megasas_build_and_issue_cmd()
1605 frame_count = megasas_build_dcdb(instance, scmd, cmd); in megasas_build_and_issue_cmd()
1616 atomic_inc(&instance->fw_outstanding); in megasas_build_and_issue_cmd()
1618 instance->instancet->fire_cmd(instance, cmd->frame_phys_addr, in megasas_build_and_issue_cmd()
1619 cmd->frame_count-1, instance->reg_set); in megasas_build_and_issue_cmd()
1623 megasas_return_cmd(instance, cmd); in megasas_build_and_issue_cmd()
1636 struct megasas_instance *instance; in megasas_queue_command() local
1639 instance = (struct megasas_instance *) in megasas_queue_command()
1642 if (instance->unload == 1) { in megasas_queue_command()
1648 if (instance->issuepend_done == 0) in megasas_queue_command()
1651 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_queue_command()
1654 if (instance->adprecovery == MEGASAS_ADPRESET_SM_INFAULT) { in megasas_queue_command()
1655 if (megasas_check_mpio_paths(instance, scmd) == in megasas_queue_command()
1657 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_queue_command()
1660 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_queue_command()
1667 if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) { in megasas_queue_command()
1668 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_queue_command()
1674 if (instance->adprecovery != MEGASAS_HBA_OPERATIONAL) { in megasas_queue_command()
1675 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_queue_command()
1679 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_queue_command()
1684 (scmd->device->id >= instance->fw_supported_vd_count || in megasas_queue_command()
1702 if (instance->instancet->build_and_issue_cmd(instance, scmd)) { in megasas_queue_command()
1703 dev_err(&instance->pdev->dev, "Err returned from build_and_issue_cmd\n"); in megasas_queue_command()
1720 if ((megasas_mgmt_info.instance[i]) && in megasas_lookup_instance()
1721 (megasas_mgmt_info.instance[i]->host->host_no == host_no)) in megasas_lookup_instance()
1722 return megasas_mgmt_info.instance[i]; in megasas_lookup_instance()
1738 struct megasas_instance *instance; in megasas_set_dma_alignment() local
1743 instance = megasas_lookup_instance(sdev->host->host_no); in megasas_set_dma_alignment()
1744 fusion = instance->ctrl_context; in megasas_set_dma_alignment()
1752 local_map_ptr = fusion->ld_drv_map[(instance->map_id & 1)]; in megasas_set_dma_alignment()
1764 struct megasas_instance *instance; in megasas_slave_configure() local
1766 instance = megasas_lookup_instance(sdev->host->host_no); in megasas_slave_configure()
1767 if (instance->allow_fw_scan) { in megasas_slave_configure()
1772 if (instance->pd_list[pd_index].driveState != in megasas_slave_configure()
1790 struct megasas_instance *instance ; in megasas_slave_alloc() local
1792 instance = megasas_lookup_instance(sdev->host->host_no); in megasas_slave_alloc()
1800 if ((instance->allow_fw_scan || instance->pd_list[pd_index].driveState == in megasas_slave_alloc()
1815 static void megasas_complete_outstanding_ioctls(struct megasas_instance *instance) in megasas_complete_outstanding_ioctls() argument
1820 struct fusion_context *fusion = instance->ctrl_context; in megasas_complete_outstanding_ioctls()
1824 for (i = 0; i < instance->max_fw_cmds; i++) { in megasas_complete_outstanding_ioctls()
1827 cmd_mfi = instance->cmd_list[cmd_fusion->sync_cmd_idx]; in megasas_complete_outstanding_ioctls()
1830 megasas_complete_cmd(instance, in megasas_complete_outstanding_ioctls()
1835 for (i = 0; i < instance->max_fw_cmds; i++) { in megasas_complete_outstanding_ioctls()
1836 cmd_mfi = instance->cmd_list[i]; in megasas_complete_outstanding_ioctls()
1839 megasas_complete_cmd(instance, cmd_mfi, DID_OK); in megasas_complete_outstanding_ioctls()
1845 void megaraid_sas_kill_hba(struct megasas_instance *instance) in megaraid_sas_kill_hba() argument
1848 instance->adprecovery = MEGASAS_HW_CRITICAL_ERROR; in megaraid_sas_kill_hba()
1851 if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) || in megaraid_sas_kill_hba()
1852 (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY) || in megaraid_sas_kill_hba()
1853 (instance->ctrl_context)) { in megaraid_sas_kill_hba()
1854 writel(MFI_STOP_ADP, &instance->reg_set->doorbell); in megaraid_sas_kill_hba()
1856 readl(&instance->reg_set->doorbell); in megaraid_sas_kill_hba()
1857 if (instance->mpio && instance->requestorId) in megaraid_sas_kill_hba()
1858 memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS); in megaraid_sas_kill_hba()
1861 &instance->reg_set->inbound_doorbell); in megaraid_sas_kill_hba()
1864 megasas_complete_outstanding_ioctls(instance); in megaraid_sas_kill_hba()
1874 megasas_check_and_restore_queue_depth(struct megasas_instance *instance) in megasas_check_and_restore_queue_depth() argument
1878 if (instance->flag & MEGASAS_FW_BUSY in megasas_check_and_restore_queue_depth()
1879 && time_after(jiffies, instance->last_time + 5 * HZ) in megasas_check_and_restore_queue_depth()
1880 && atomic_read(&instance->fw_outstanding) < in megasas_check_and_restore_queue_depth()
1881 instance->throttlequeuedepth + 1) { in megasas_check_and_restore_queue_depth()
1883 spin_lock_irqsave(instance->host->host_lock, flags); in megasas_check_and_restore_queue_depth()
1884 instance->flag &= ~MEGASAS_FW_BUSY; in megasas_check_and_restore_queue_depth()
1886 instance->host->can_queue = instance->max_scsi_cmds; in megasas_check_and_restore_queue_depth()
1887 spin_unlock_irqrestore(instance->host->host_lock, flags); in megasas_check_and_restore_queue_depth()
1903 struct megasas_instance *instance = in megasas_complete_cmd_dpc() local
1908 if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) in megasas_complete_cmd_dpc()
1911 spin_lock_irqsave(&instance->completion_lock, flags); in megasas_complete_cmd_dpc()
1913 producer = le32_to_cpu(*instance->producer); in megasas_complete_cmd_dpc()
1914 consumer = le32_to_cpu(*instance->consumer); in megasas_complete_cmd_dpc()
1917 context = le32_to_cpu(instance->reply_queue[consumer]); in megasas_complete_cmd_dpc()
1918 if (context >= instance->max_fw_cmds) { in megasas_complete_cmd_dpc()
1919 dev_err(&instance->pdev->dev, "Unexpected context value %x\n", in megasas_complete_cmd_dpc()
1924 cmd = instance->cmd_list[context]; in megasas_complete_cmd_dpc()
1926 megasas_complete_cmd(instance, cmd, DID_OK); in megasas_complete_cmd_dpc()
1929 if (consumer == (instance->max_fw_cmds + 1)) { in megasas_complete_cmd_dpc()
1934 *instance->consumer = cpu_to_le32(producer); in megasas_complete_cmd_dpc()
1936 spin_unlock_irqrestore(&instance->completion_lock, flags); in megasas_complete_cmd_dpc()
1941 megasas_check_and_restore_queue_depth(instance); in megasas_complete_cmd_dpc()
1952 void megasas_start_timer(struct megasas_instance *instance, in megasas_start_timer() argument
1958 timer->data = (unsigned long)instance; in megasas_start_timer()
1964 megasas_internal_reset_defer_cmds(struct megasas_instance *instance);
1969 void megasas_do_ocr(struct megasas_instance *instance) in megasas_do_ocr() argument
1971 if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS1064R) || in megasas_do_ocr()
1972 (instance->pdev->device == PCI_DEVICE_ID_DELL_PERC5) || in megasas_do_ocr()
1973 (instance->pdev->device == PCI_DEVICE_ID_LSI_VERDE_ZCR)) { in megasas_do_ocr()
1974 *instance->consumer = cpu_to_le32(MEGASAS_ADPRESET_INPROG_SIGN); in megasas_do_ocr()
1976 instance->instancet->disable_intr(instance); in megasas_do_ocr()
1977 instance->adprecovery = MEGASAS_ADPRESET_SM_INFAULT; in megasas_do_ocr()
1978 instance->issuepend_done = 0; in megasas_do_ocr()
1980 atomic_set(&instance->fw_outstanding, 0); in megasas_do_ocr()
1981 megasas_internal_reset_defer_cmds(instance); in megasas_do_ocr()
1982 process_fw_state_change_wq(&instance->work_init); in megasas_do_ocr()
1985 static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance, in megasas_get_ld_vf_affiliation_111() argument
1995 cmd = megasas_get_cmd(instance); in megasas_get_ld_vf_affiliation_111()
1998 dev_printk(KERN_DEBUG, &instance->pdev->dev, "megasas_get_ld_vf_affiliation_111:" in megasas_get_ld_vf_affiliation_111()
2000 instance->host->host_no); in megasas_get_ld_vf_affiliation_111()
2006 if (!instance->vf_affiliation_111) { in megasas_get_ld_vf_affiliation_111()
2007 dev_warn(&instance->pdev->dev, "SR-IOV: Couldn't get LD/VF " in megasas_get_ld_vf_affiliation_111()
2008 "affiliation for scsi%d\n", instance->host->host_no); in megasas_get_ld_vf_affiliation_111()
2009 megasas_return_cmd(instance, cmd); in megasas_get_ld_vf_affiliation_111()
2014 memset(instance->vf_affiliation_111, 0, in megasas_get_ld_vf_affiliation_111()
2018 pci_alloc_consistent(instance->pdev, in megasas_get_ld_vf_affiliation_111()
2022 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate " in megasas_get_ld_vf_affiliation_111()
2024 instance->host->host_no); in megasas_get_ld_vf_affiliation_111()
2025 megasas_return_cmd(instance, cmd); in megasas_get_ld_vf_affiliation_111()
2046 cpu_to_le32(instance->vf_affiliation_111_h); in megasas_get_ld_vf_affiliation_111()
2054 dev_warn(&instance->pdev->dev, "SR-IOV: Getting LD/VF affiliation for " in megasas_get_ld_vf_affiliation_111()
2055 "scsi%d\n", instance->host->host_no); in megasas_get_ld_vf_affiliation_111()
2057 megasas_issue_blocked_cmd(instance, cmd, 0); in megasas_get_ld_vf_affiliation_111()
2060 dev_warn(&instance->pdev->dev, "SR-IOV: LD/VF affiliation DCMD" in megasas_get_ld_vf_affiliation_111()
2062 dcmd->cmd_status, instance->host->host_no); in megasas_get_ld_vf_affiliation_111()
2070 if (instance->vf_affiliation_111->map[ld].policy[thisVf] != in megasas_get_ld_vf_affiliation_111()
2072 dev_warn(&instance->pdev->dev, "SR-IOV: " in megasas_get_ld_vf_affiliation_111()
2074 instance->host->host_no); in megasas_get_ld_vf_affiliation_111()
2075 memcpy(instance->vf_affiliation_111, in megasas_get_ld_vf_affiliation_111()
2084 pci_free_consistent(instance->pdev, in megasas_get_ld_vf_affiliation_111()
2090 megasas_return_cmd(instance, cmd); in megasas_get_ld_vf_affiliation_111()
2095 static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance, in megasas_get_ld_vf_affiliation_12() argument
2106 cmd = megasas_get_cmd(instance); in megasas_get_ld_vf_affiliation_12()
2109 dev_printk(KERN_DEBUG, &instance->pdev->dev, "megasas_get_ld_vf_affiliation12: " in megasas_get_ld_vf_affiliation_12()
2111 instance->host->host_no); in megasas_get_ld_vf_affiliation_12()
2117 if (!instance->vf_affiliation) { in megasas_get_ld_vf_affiliation_12()
2118 dev_warn(&instance->pdev->dev, "SR-IOV: Couldn't get LD/VF " in megasas_get_ld_vf_affiliation_12()
2119 "affiliation for scsi%d\n", instance->host->host_no); in megasas_get_ld_vf_affiliation_12()
2120 megasas_return_cmd(instance, cmd); in megasas_get_ld_vf_affiliation_12()
2125 memset(instance->vf_affiliation, 0, (MAX_LOGICAL_DRIVES + 1) * in megasas_get_ld_vf_affiliation_12()
2129 pci_alloc_consistent(instance->pdev, in megasas_get_ld_vf_affiliation_12()
2134 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate " in megasas_get_ld_vf_affiliation_12()
2136 instance->host->host_no); in megasas_get_ld_vf_affiliation_12()
2137 megasas_return_cmd(instance, cmd); in megasas_get_ld_vf_affiliation_12()
2158 cpu_to_le32(instance->vf_affiliation_h); in megasas_get_ld_vf_affiliation_12()
2166 dev_warn(&instance->pdev->dev, "SR-IOV: Getting LD/VF affiliation for " in megasas_get_ld_vf_affiliation_12()
2167 "scsi%d\n", instance->host->host_no); in megasas_get_ld_vf_affiliation_12()
2169 megasas_issue_blocked_cmd(instance, cmd, 0); in megasas_get_ld_vf_affiliation_12()
2172 dev_warn(&instance->pdev->dev, "SR-IOV: LD/VF affiliation DCMD" in megasas_get_ld_vf_affiliation_12()
2174 dcmd->cmd_status, instance->host->host_no); in megasas_get_ld_vf_affiliation_12()
2181 dev_warn(&instance->pdev->dev, "SR-IOV: Got new LD/VF " in megasas_get_ld_vf_affiliation_12()
2183 instance->host->host_no); in megasas_get_ld_vf_affiliation_12()
2188 savedmap = instance->vf_affiliation->map; in megasas_get_ld_vf_affiliation_12()
2192 for (j = 0; j < instance->vf_affiliation->ldCount; in megasas_get_ld_vf_affiliation_12()
2217 savedmap = instance->vf_affiliation->map; in megasas_get_ld_vf_affiliation_12()
2219 for (i = 0 ; i < instance->vf_affiliation->ldCount; i++) { in megasas_get_ld_vf_affiliation_12()
2247 dev_warn(&instance->pdev->dev, "SR-IOV: Got new LD/VF " in megasas_get_ld_vf_affiliation_12()
2248 "affiliation for scsi%d\n", instance->host->host_no); in megasas_get_ld_vf_affiliation_12()
2249 memcpy(instance->vf_affiliation, new_affiliation, in megasas_get_ld_vf_affiliation_12()
2255 pci_free_consistent(instance->pdev, in megasas_get_ld_vf_affiliation_12()
2259 megasas_return_cmd(instance, cmd); in megasas_get_ld_vf_affiliation_12()
2265 static int megasas_get_ld_vf_affiliation(struct megasas_instance *instance, in megasas_get_ld_vf_affiliation() argument
2270 if (instance->PlasmaFW111) in megasas_get_ld_vf_affiliation()
2271 retval = megasas_get_ld_vf_affiliation_111(instance, initial); in megasas_get_ld_vf_affiliation()
2273 retval = megasas_get_ld_vf_affiliation_12(instance, initial); in megasas_get_ld_vf_affiliation()
2278 int megasas_sriov_start_heartbeat(struct megasas_instance *instance, in megasas_sriov_start_heartbeat() argument
2285 cmd = megasas_get_cmd(instance); in megasas_sriov_start_heartbeat()
2288 dev_printk(KERN_DEBUG, &instance->pdev->dev, "megasas_sriov_start_heartbeat: " in megasas_sriov_start_heartbeat()
2290 instance->host->host_no); in megasas_sriov_start_heartbeat()
2297 instance->hb_host_mem = in megasas_sriov_start_heartbeat()
2298 pci_zalloc_consistent(instance->pdev, in megasas_sriov_start_heartbeat()
2300 &instance->hb_host_mem_h); in megasas_sriov_start_heartbeat()
2301 if (!instance->hb_host_mem) { in megasas_sriov_start_heartbeat()
2302 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate" in megasas_sriov_start_heartbeat()
2304 instance->host->host_no); in megasas_sriov_start_heartbeat()
2321 dcmd->sgl.sge32[0].phys_addr = cpu_to_le32(instance->hb_host_mem_h); in megasas_sriov_start_heartbeat()
2324 dev_warn(&instance->pdev->dev, "SR-IOV: Starting heartbeat for scsi%d\n", in megasas_sriov_start_heartbeat()
2325 instance->host->host_no); in megasas_sriov_start_heartbeat()
2327 if (instance->ctrl_context && !instance->mask_interrupts) in megasas_sriov_start_heartbeat()
2328 retval = megasas_issue_blocked_cmd(instance, cmd, in megasas_sriov_start_heartbeat()
2331 retval = megasas_issue_polled(instance, cmd); in megasas_sriov_start_heartbeat()
2334 dev_warn(&instance->pdev->dev, "SR-IOV: MR_DCMD_CTRL_SHARED_HOST" in megasas_sriov_start_heartbeat()
2337 "timed out" : "failed", instance->host->host_no); in megasas_sriov_start_heartbeat()
2342 megasas_return_cmd(instance, cmd); in megasas_sriov_start_heartbeat()
2350 struct megasas_instance *instance = in megasas_sriov_heartbeat_handler() local
2353 if (instance->hb_host_mem->HB.fwCounter != in megasas_sriov_heartbeat_handler()
2354 instance->hb_host_mem->HB.driverCounter) { in megasas_sriov_heartbeat_handler()
2355 instance->hb_host_mem->HB.driverCounter = in megasas_sriov_heartbeat_handler()
2356 instance->hb_host_mem->HB.fwCounter; in megasas_sriov_heartbeat_handler()
2357 mod_timer(&instance->sriov_heartbeat_timer, in megasas_sriov_heartbeat_handler()
2360 dev_warn(&instance->pdev->dev, "SR-IOV: Heartbeat never " in megasas_sriov_heartbeat_handler()
2361 "completed for scsi%d\n", instance->host->host_no); in megasas_sriov_heartbeat_handler()
2362 schedule_work(&instance->work_init); in megasas_sriov_heartbeat_handler()
2374 static int megasas_wait_for_outstanding(struct megasas_instance *instance) in megasas_wait_for_outstanding() argument
2386 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_wait_for_outstanding()
2387 adprecovery = instance->adprecovery; in megasas_wait_for_outstanding()
2388 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_wait_for_outstanding()
2393 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_wait_for_outstanding()
2394 list_splice_init(&instance->internal_reset_pending_q, in megasas_wait_for_outstanding()
2396 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_wait_for_outstanding()
2398 dev_notice(&instance->pdev->dev, "HBA reset wait ...\n"); in megasas_wait_for_outstanding()
2401 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_wait_for_outstanding()
2402 adprecovery = instance->adprecovery; in megasas_wait_for_outstanding()
2403 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_wait_for_outstanding()
2409 dev_notice(&instance->pdev->dev, "reset: Stopping HBA.\n"); in megasas_wait_for_outstanding()
2410 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_wait_for_outstanding()
2411 instance->adprecovery = MEGASAS_HW_CRITICAL_ERROR; in megasas_wait_for_outstanding()
2412 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_wait_for_outstanding()
2423 dev_notice(&instance->pdev->dev, "%d:%p reset [%02x]\n", in megasas_wait_for_outstanding()
2428 megasas_return_cmd(instance, reset_cmd); in megasas_wait_for_outstanding()
2430 dev_notice(&instance->pdev->dev, "%p synch cmds" in megasas_wait_for_outstanding()
2435 instance->instancet->fire_cmd(instance, in megasas_wait_for_outstanding()
2437 0, instance->reg_set); in megasas_wait_for_outstanding()
2439 dev_notice(&instance->pdev->dev, "%p unexpected" in megasas_wait_for_outstanding()
2450 int outstanding = atomic_read(&instance->fw_outstanding); in megasas_wait_for_outstanding()
2456 dev_notice(&instance->pdev->dev, "[%2d]waiting for %d " in megasas_wait_for_outstanding()
2462 megasas_complete_cmd_dpc((unsigned long)instance); in megasas_wait_for_outstanding()
2471 fw_state = instance->instancet->read_fw_status_reg( in megasas_wait_for_outstanding()
2472 instance->reg_set) & MFI_STATE_MASK; in megasas_wait_for_outstanding()
2474 (instance->disableOnlineCtrlReset == 0)) { in megasas_wait_for_outstanding()
2479 megasas_do_ocr(instance); in megasas_wait_for_outstanding()
2488 if (atomic_read(&instance->fw_outstanding) && !kill_adapter_flag) { in megasas_wait_for_outstanding()
2489 if (instance->disableOnlineCtrlReset == 0) { in megasas_wait_for_outstanding()
2490 megasas_do_ocr(instance); in megasas_wait_for_outstanding()
2495 atomic_read(&instance->fw_outstanding); in megasas_wait_for_outstanding()
2503 if (atomic_read(&instance->fw_outstanding) || in megasas_wait_for_outstanding()
2505 dev_notice(&instance->pdev->dev, "pending cmds after reset\n"); in megasas_wait_for_outstanding()
2510 if ((instance->pdev->device == in megasas_wait_for_outstanding()
2512 (instance->pdev->device == in megasas_wait_for_outstanding()
2515 &instance->reg_set->doorbell); in megasas_wait_for_outstanding()
2518 &instance->reg_set->inbound_doorbell); in megasas_wait_for_outstanding()
2520 megasas_dump_pending_frames(instance); in megasas_wait_for_outstanding()
2521 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_wait_for_outstanding()
2522 instance->adprecovery = MEGASAS_HW_CRITICAL_ERROR; in megasas_wait_for_outstanding()
2523 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_wait_for_outstanding()
2527 dev_notice(&instance->pdev->dev, "no pending cmds after reset\n"); in megasas_wait_for_outstanding()
2543 struct megasas_instance *instance; in megasas_generic_reset() local
2545 instance = (struct megasas_instance *)scmd->device->host->hostdata; in megasas_generic_reset()
2550 if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) { in megasas_generic_reset()
2551 dev_err(&instance->pdev->dev, "cannot recover from previous reset failures\n"); in megasas_generic_reset()
2555 ret_val = megasas_wait_for_outstanding(instance); in megasas_generic_reset()
2557 dev_notice(&instance->pdev->dev, "reset successful\n"); in megasas_generic_reset()
2559 dev_err(&instance->pdev->dev, "failed to do reset\n"); in megasas_generic_reset()
2574 struct megasas_instance *instance; in megasas_reset_timer() local
2582 instance = (struct megasas_instance *)scmd->device->host->hostdata; in megasas_reset_timer()
2583 if (!(instance->flag & MEGASAS_FW_BUSY)) { in megasas_reset_timer()
2585 spin_lock_irqsave(instance->host->host_lock, flags); in megasas_reset_timer()
2587 instance->host->can_queue = instance->throttlequeuedepth; in megasas_reset_timer()
2588 instance->last_time = jiffies; in megasas_reset_timer()
2589 instance->flag |= MEGASAS_FW_BUSY; in megasas_reset_timer()
2591 spin_unlock_irqrestore(instance->host->host_lock, flags); in megasas_reset_timer()
2613 struct megasas_instance *instance; in megasas_reset_bus_host() local
2615 instance = (struct megasas_instance *)scmd->device->host->hostdata; in megasas_reset_bus_host()
2620 if (instance->ctrl_context) in megasas_reset_bus_host()
2687 megasas_service_aen(struct megasas_instance *instance, struct megasas_cmd *cmd) in megasas_service_aen() argument
2694 if ((!cmd->abort_aen) && (instance->unload == 0)) { in megasas_service_aen()
2704 instance->aen_cmd = NULL; in megasas_service_aen()
2706 megasas_return_cmd(instance, cmd); in megasas_service_aen()
2708 if ((instance->unload == 0) && in megasas_service_aen()
2709 ((instance->issuepend_done == 1))) { in megasas_service_aen()
2714 dev_err(&instance->pdev->dev, "megasas_service_aen: out of memory\n"); in megasas_service_aen()
2716 ev->instance = instance; in megasas_service_aen()
2717 instance->ev = ev; in megasas_service_aen()
2730 struct megasas_instance *instance = in megasas_fw_crash_buffer_store() local
2738 spin_lock_irqsave(&instance->crashdump_lock, flags); in megasas_fw_crash_buffer_store()
2739 instance->fw_crash_buffer_offset = val; in megasas_fw_crash_buffer_store()
2740 spin_unlock_irqrestore(&instance->crashdump_lock, flags); in megasas_fw_crash_buffer_store()
2749 struct megasas_instance *instance = in megasas_fw_crash_buffer_show() local
2758 spin_lock_irqsave(&instance->crashdump_lock, flags); in megasas_fw_crash_buffer_show()
2759 buff_offset = instance->fw_crash_buffer_offset; in megasas_fw_crash_buffer_show()
2760 if (!instance->crash_dump_buf && in megasas_fw_crash_buffer_show()
2761 !((instance->fw_crash_state == AVAILABLE) || in megasas_fw_crash_buffer_show()
2762 (instance->fw_crash_state == COPYING))) { in megasas_fw_crash_buffer_show()
2763 dev_err(&instance->pdev->dev, in megasas_fw_crash_buffer_show()
2765 spin_unlock_irqrestore(&instance->crashdump_lock, flags); in megasas_fw_crash_buffer_show()
2771 if (buff_offset > (instance->fw_crash_buffer_size * dmachunk)) { in megasas_fw_crash_buffer_show()
2772 dev_err(&instance->pdev->dev, in megasas_fw_crash_buffer_show()
2774 spin_unlock_irqrestore(&instance->crashdump_lock, flags); in megasas_fw_crash_buffer_show()
2778 size = (instance->fw_crash_buffer_size * dmachunk) - buff_offset; in megasas_fw_crash_buffer_show()
2781 src_addr = (unsigned long)instance->crash_buf[buff_offset / dmachunk] + in megasas_fw_crash_buffer_show()
2784 spin_unlock_irqrestore(&instance->crashdump_lock, flags); in megasas_fw_crash_buffer_show()
2794 struct megasas_instance *instance = in megasas_fw_crash_buffer_size_show() local
2798 ((instance->fw_crash_buffer_size) * 1024 * 1024)/PAGE_SIZE); in megasas_fw_crash_buffer_size_show()
2806 struct megasas_instance *instance = in megasas_fw_crash_state_store() local
2815 dev_err(&instance->pdev->dev, "application updates invalid " in megasas_fw_crash_state_store()
2820 instance->fw_crash_state = val; in megasas_fw_crash_state_store()
2823 spin_lock_irqsave(&instance->crashdump_lock, flags); in megasas_fw_crash_state_store()
2824 megasas_free_host_crash_buffer(instance); in megasas_fw_crash_state_store()
2825 spin_unlock_irqrestore(&instance->crashdump_lock, flags); in megasas_fw_crash_state_store()
2827 dev_info(&instance->pdev->dev, "application failed to " in megasas_fw_crash_state_store()
2830 dev_info(&instance->pdev->dev, "Firmware crash dump " in megasas_fw_crash_state_store()
2841 struct megasas_instance *instance = in megasas_fw_crash_state_show() local
2844 return snprintf(buf, PAGE_SIZE, "%d\n", instance->fw_crash_state); in megasas_fw_crash_state_show()
2903 megasas_complete_int_cmd(struct megasas_instance *instance, in megasas_complete_int_cmd() argument
2907 wake_up(&instance->int_cmd_wait_q); in megasas_complete_int_cmd()
2920 megasas_complete_abort(struct megasas_instance *instance, in megasas_complete_abort() argument
2926 wake_up(&instance->abort_cmd_wait_q); in megasas_complete_abort()
2941 megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, in megasas_complete_cmd() argument
2947 struct fusion_context *fusion = instance->ctrl_context; in megasas_complete_cmd()
2962 dev_warn(&instance->pdev->dev, "MFI_CMD_INVALID command " in megasas_complete_cmd()
2964 dev_warn(&instance->pdev->dev, "If you have a controller " in megasas_complete_cmd()
2977 megasas_complete_int_cmd(instance, cmd); in megasas_complete_cmd()
2991 atomic_dec(&instance->fw_outstanding); in megasas_complete_cmd()
2995 megasas_return_cmd(instance, cmd); in megasas_complete_cmd()
3033 dev_printk(KERN_DEBUG, &instance->pdev->dev, "MFI FW status %#x\n", in megasas_complete_cmd()
3039 atomic_dec(&instance->fw_outstanding); in megasas_complete_cmd()
3043 megasas_return_cmd(instance, cmd); in megasas_complete_cmd()
3055 spin_lock_irqsave(instance->host->host_lock, flags); in megasas_complete_cmd()
3056 instance->map_update_cmd = NULL; in megasas_complete_cmd()
3060 dev_warn(&instance->pdev->dev, "map syncfailed, status = 0x%x\n", in megasas_complete_cmd()
3063 megasas_return_cmd(instance, cmd); in megasas_complete_cmd()
3065 instance->host->host_lock, in megasas_complete_cmd()
3070 instance->map_id++; in megasas_complete_cmd()
3071 megasas_return_cmd(instance, cmd); in megasas_complete_cmd()
3078 if (MR_ValidateMapInfo(instance)) in megasas_complete_cmd()
3082 megasas_sync_map_info(instance); in megasas_complete_cmd()
3083 spin_unlock_irqrestore(instance->host->host_lock, in megasas_complete_cmd()
3098 spin_lock_irqsave(instance->host->host_lock, flags); in megasas_complete_cmd()
3100 instance->jbod_seq_cmd = NULL; in megasas_complete_cmd()
3101 megasas_return_cmd(instance, cmd); in megasas_complete_cmd()
3104 instance->pd_seq_map_id++; in megasas_complete_cmd()
3106 if (megasas_sync_pd_seq_num(instance, true)) in megasas_complete_cmd()
3107 instance->use_seqnum_jbod_fp = false; in megasas_complete_cmd()
3109 instance->use_seqnum_jbod_fp = false; in megasas_complete_cmd()
3111 spin_unlock_irqrestore(instance->host->host_lock, flags); in megasas_complete_cmd()
3119 megasas_service_aen(instance, cmd); in megasas_complete_cmd()
3121 megasas_complete_int_cmd(instance, cmd); in megasas_complete_cmd()
3129 megasas_complete_abort(instance, cmd); in megasas_complete_cmd()
3133 dev_info(&instance->pdev->dev, "Unknown command completed! [0x%X]\n", in megasas_complete_cmd()
3145 megasas_issue_pending_cmds_again(struct megasas_instance *instance) in megasas_issue_pending_cmds_again() argument
3154 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_issue_pending_cmds_again()
3155 list_splice_init(&instance->internal_reset_pending_q, &clist_local); in megasas_issue_pending_cmds_again()
3156 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_issue_pending_cmds_again()
3164 dev_notice(&instance->pdev->dev, "command %p, %p:%d" in megasas_issue_pending_cmds_again()
3171 dev_notice(&instance->pdev->dev, "cmd %p, %p:%d" in megasas_issue_pending_cmds_again()
3175 instance->instancet->disable_intr(instance); in megasas_issue_pending_cmds_again()
3176 atomic_set(&instance->fw_reset_no_pci_access, 1); in megasas_issue_pending_cmds_again()
3177 megaraid_sas_kill_hba(instance); in megasas_issue_pending_cmds_again()
3184 dev_notice(&instance->pdev->dev, "unexpected" in megasas_issue_pending_cmds_again()
3187 dev_notice(&instance->pdev->dev, "%p synchronous cmd" in megasas_issue_pending_cmds_again()
3191 instance->instancet->fire_cmd(instance, in megasas_issue_pending_cmds_again()
3193 0, instance->reg_set); in megasas_issue_pending_cmds_again()
3195 dev_notice(&instance->pdev->dev, "%p scsi cmd [%02x]" in megasas_issue_pending_cmds_again()
3199 atomic_inc(&instance->fw_outstanding); in megasas_issue_pending_cmds_again()
3200 instance->instancet->fire_cmd(instance, in megasas_issue_pending_cmds_again()
3202 cmd->frame_count-1, instance->reg_set); in megasas_issue_pending_cmds_again()
3204 dev_notice(&instance->pdev->dev, "%p unexpected cmd on the" in megasas_issue_pending_cmds_again()
3210 if (instance->aen_cmd) { in megasas_issue_pending_cmds_again()
3211 dev_notice(&instance->pdev->dev, "aen_cmd in def process\n"); in megasas_issue_pending_cmds_again()
3212 megasas_return_cmd(instance, instance->aen_cmd); in megasas_issue_pending_cmds_again()
3214 instance->aen_cmd = NULL; in megasas_issue_pending_cmds_again()
3220 seq_num = instance->last_seq_num; in megasas_issue_pending_cmds_again()
3225 megasas_register_aen(instance, seq_num, class_locale.word); in megasas_issue_pending_cmds_again()
3238 megasas_internal_reset_defer_cmds(struct megasas_instance *instance) in megasas_internal_reset_defer_cmds() argument
3242 u32 max_cmd = instance->max_fw_cmds; in megasas_internal_reset_defer_cmds()
3247 spin_lock_irqsave(&instance->mfi_pool_lock, flags); in megasas_internal_reset_defer_cmds()
3249 cmd = instance->cmd_list[i]; in megasas_internal_reset_defer_cmds()
3251 dev_notice(&instance->pdev->dev, "moving cmd[%d]:%p:%d:%p" in megasas_internal_reset_defer_cmds()
3256 dev_notice(&instance->pdev->dev, "ERROR while" in megasas_internal_reset_defer_cmds()
3265 &instance->internal_reset_pending_q); in megasas_internal_reset_defer_cmds()
3268 spin_unlock_irqrestore(&instance->mfi_pool_lock, flags); in megasas_internal_reset_defer_cmds()
3275 struct megasas_instance *instance = in process_fw_state_change_wq() local
3280 if (instance->adprecovery != MEGASAS_ADPRESET_SM_INFAULT) { in process_fw_state_change_wq()
3281 dev_notice(&instance->pdev->dev, "error, recovery st %x\n", in process_fw_state_change_wq()
3282 instance->adprecovery); in process_fw_state_change_wq()
3286 if (instance->adprecovery == MEGASAS_ADPRESET_SM_INFAULT) { in process_fw_state_change_wq()
3287 dev_notice(&instance->pdev->dev, "FW detected to be in fault" in process_fw_state_change_wq()
3290 instance->instancet->disable_intr(instance); in process_fw_state_change_wq()
3291 atomic_set(&instance->fw_outstanding, 0); in process_fw_state_change_wq()
3293 atomic_set(&instance->fw_reset_no_pci_access, 1); in process_fw_state_change_wq()
3294 instance->instancet->adp_reset(instance, instance->reg_set); in process_fw_state_change_wq()
3295 atomic_set(&instance->fw_reset_no_pci_access, 0); in process_fw_state_change_wq()
3297 dev_notice(&instance->pdev->dev, "FW restarted successfully," in process_fw_state_change_wq()
3300 dev_notice(&instance->pdev->dev, "HBA recovery state machine," in process_fw_state_change_wq()
3308 if (megasas_transition_to_ready(instance, 1)) { in process_fw_state_change_wq()
3309 dev_notice(&instance->pdev->dev, "adapter not ready\n"); in process_fw_state_change_wq()
3311 atomic_set(&instance->fw_reset_no_pci_access, 1); in process_fw_state_change_wq()
3312 megaraid_sas_kill_hba(instance); in process_fw_state_change_wq()
3316 if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS1064R) || in process_fw_state_change_wq()
3317 (instance->pdev->device == PCI_DEVICE_ID_DELL_PERC5) || in process_fw_state_change_wq()
3318 (instance->pdev->device == PCI_DEVICE_ID_LSI_VERDE_ZCR) in process_fw_state_change_wq()
3320 *instance->consumer = *instance->producer; in process_fw_state_change_wq()
3322 *instance->consumer = 0; in process_fw_state_change_wq()
3323 *instance->producer = 0; in process_fw_state_change_wq()
3326 megasas_issue_init_mfi(instance); in process_fw_state_change_wq()
3328 spin_lock_irqsave(&instance->hba_lock, flags); in process_fw_state_change_wq()
3329 instance->adprecovery = MEGASAS_HBA_OPERATIONAL; in process_fw_state_change_wq()
3330 spin_unlock_irqrestore(&instance->hba_lock, flags); in process_fw_state_change_wq()
3331 instance->instancet->enable_intr(instance); in process_fw_state_change_wq()
3333 megasas_issue_pending_cmds_again(instance); in process_fw_state_change_wq()
3334 instance->issuepend_done = 1; in process_fw_state_change_wq()
3347 megasas_deplete_reply_queue(struct megasas_instance *instance, in megasas_deplete_reply_queue() argument
3353 if ((mfiStatus = instance->instancet->check_reset(instance, in megasas_deplete_reply_queue()
3354 instance->reg_set)) == 1) { in megasas_deplete_reply_queue()
3358 if ((mfiStatus = instance->instancet->clear_intr( in megasas_deplete_reply_queue()
3359 instance->reg_set) in megasas_deplete_reply_queue()
3362 if (!instance->msix_vectors) in megasas_deplete_reply_queue()
3366 instance->mfiStatus = mfiStatus; in megasas_deplete_reply_queue()
3369 fw_state = instance->instancet->read_fw_status_reg( in megasas_deplete_reply_queue()
3370 instance->reg_set) & MFI_STATE_MASK; in megasas_deplete_reply_queue()
3373 dev_notice(&instance->pdev->dev, "fw state:%x\n", in megasas_deplete_reply_queue()
3378 (instance->disableOnlineCtrlReset == 0)) { in megasas_deplete_reply_queue()
3379 dev_notice(&instance->pdev->dev, "wait adp restart\n"); in megasas_deplete_reply_queue()
3381 if ((instance->pdev->device == in megasas_deplete_reply_queue()
3383 (instance->pdev->device == in megasas_deplete_reply_queue()
3385 (instance->pdev->device == in megasas_deplete_reply_queue()
3388 *instance->consumer = in megasas_deplete_reply_queue()
3393 instance->instancet->disable_intr(instance); in megasas_deplete_reply_queue()
3394 instance->adprecovery = MEGASAS_ADPRESET_SM_INFAULT; in megasas_deplete_reply_queue()
3395 instance->issuepend_done = 0; in megasas_deplete_reply_queue()
3397 atomic_set(&instance->fw_outstanding, 0); in megasas_deplete_reply_queue()
3398 megasas_internal_reset_defer_cmds(instance); in megasas_deplete_reply_queue()
3400 dev_notice(&instance->pdev->dev, "fwState=%x, stage:%d\n", in megasas_deplete_reply_queue()
3401 fw_state, instance->adprecovery); in megasas_deplete_reply_queue()
3403 schedule_work(&instance->work_init); in megasas_deplete_reply_queue()
3407 dev_notice(&instance->pdev->dev, "fwstate:%x, dis_OCR=%x\n", in megasas_deplete_reply_queue()
3408 fw_state, instance->disableOnlineCtrlReset); in megasas_deplete_reply_queue()
3412 tasklet_schedule(&instance->isr_tasklet); in megasas_deplete_reply_queue()
3421 struct megasas_instance *instance = irq_context->instance; in megasas_isr() local
3425 if (atomic_read(&instance->fw_reset_no_pci_access)) in megasas_isr()
3428 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_isr()
3429 rc = megasas_deplete_reply_queue(instance, DID_OK); in megasas_isr()
3430 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_isr()
3445 megasas_transition_to_ready(struct megasas_instance *instance, int ocr) in megasas_transition_to_ready() argument
3453 abs_state = instance->instancet->read_fw_status_reg(instance->reg_set); in megasas_transition_to_ready()
3457 dev_info(&instance->pdev->dev, "Waiting for FW to come to ready" in megasas_transition_to_ready()
3465 dev_printk(KERN_DEBUG, &instance->pdev->dev, "FW in FAULT state!!\n"); in megasas_transition_to_ready()
3477 if ((instance->pdev->device == in megasas_transition_to_ready()
3479 (instance->pdev->device == in megasas_transition_to_ready()
3481 (instance->ctrl_context)) in megasas_transition_to_ready()
3484 &instance->reg_set->doorbell); in megasas_transition_to_ready()
3488 &instance->reg_set->inbound_doorbell); in megasas_transition_to_ready()
3495 if ((instance->pdev->device == in megasas_transition_to_ready()
3497 (instance->pdev->device == in megasas_transition_to_ready()
3499 (instance->ctrl_context)) in megasas_transition_to_ready()
3501 &instance->reg_set->doorbell); in megasas_transition_to_ready()
3504 &instance->reg_set->inbound_doorbell); in megasas_transition_to_ready()
3514 instance->instancet->disable_intr(instance); in megasas_transition_to_ready()
3515 if ((instance->pdev->device == in megasas_transition_to_ready()
3517 (instance->pdev->device == in megasas_transition_to_ready()
3519 (instance->ctrl_context)) { in megasas_transition_to_ready()
3521 &instance->reg_set->doorbell); in megasas_transition_to_ready()
3523 if (instance->ctrl_context) { in megasas_transition_to_ready()
3526 &instance-> in megasas_transition_to_ready()
3536 &instance->reg_set->inbound_doorbell); in megasas_transition_to_ready()
3576 dev_printk(KERN_DEBUG, &instance->pdev->dev, "Unknown state 0x%x\n", in megasas_transition_to_ready()
3585 curr_abs_state = instance->instancet-> in megasas_transition_to_ready()
3586 read_fw_status_reg(instance->reg_set); in megasas_transition_to_ready()
3598 dev_printk(KERN_DEBUG, &instance->pdev->dev, "FW state [%d] hasn't changed " in megasas_transition_to_ready()
3606 dev_info(&instance->pdev->dev, "FW now in Ready state\n"); in megasas_transition_to_ready()
3615 static void megasas_teardown_frame_pool(struct megasas_instance *instance) in megasas_teardown_frame_pool() argument
3618 u32 max_cmd = instance->max_mfi_cmds; in megasas_teardown_frame_pool()
3621 if (!instance->frame_dma_pool) in megasas_teardown_frame_pool()
3629 cmd = instance->cmd_list[i]; in megasas_teardown_frame_pool()
3632 pci_pool_free(instance->frame_dma_pool, cmd->frame, in megasas_teardown_frame_pool()
3636 pci_pool_free(instance->sense_dma_pool, cmd->sense, in megasas_teardown_frame_pool()
3643 pci_pool_destroy(instance->frame_dma_pool); in megasas_teardown_frame_pool()
3644 pci_pool_destroy(instance->sense_dma_pool); in megasas_teardown_frame_pool()
3646 instance->frame_dma_pool = NULL; in megasas_teardown_frame_pool()
3647 instance->sense_dma_pool = NULL; in megasas_teardown_frame_pool()
3659 static int megasas_create_frame_pool(struct megasas_instance *instance) in megasas_create_frame_pool() argument
3668 max_cmd = instance->max_mfi_cmds; in megasas_create_frame_pool()
3677 if (instance->flag_ieee) in megasas_create_frame_pool()
3691 frame_count = instance->ctrl_context ? (3 + 1) : (15 + 1); in megasas_create_frame_pool()
3696 instance->frame_dma_pool = pci_pool_create("megasas frame pool", in megasas_create_frame_pool()
3697 instance->pdev, total_sz, 256, 0); in megasas_create_frame_pool()
3699 if (!instance->frame_dma_pool) { in megasas_create_frame_pool()
3700 dev_printk(KERN_DEBUG, &instance->pdev->dev, "failed to setup frame pool\n"); in megasas_create_frame_pool()
3704 instance->sense_dma_pool = pci_pool_create("megasas sense pool", in megasas_create_frame_pool()
3705 instance->pdev, 128, 4, 0); in megasas_create_frame_pool()
3707 if (!instance->sense_dma_pool) { in megasas_create_frame_pool()
3708 dev_printk(KERN_DEBUG, &instance->pdev->dev, "failed to setup sense pool\n"); in megasas_create_frame_pool()
3710 pci_pool_destroy(instance->frame_dma_pool); in megasas_create_frame_pool()
3711 instance->frame_dma_pool = NULL; in megasas_create_frame_pool()
3723 cmd = instance->cmd_list[i]; in megasas_create_frame_pool()
3725 cmd->frame = pci_pool_alloc(instance->frame_dma_pool, in megasas_create_frame_pool()
3728 cmd->sense = pci_pool_alloc(instance->sense_dma_pool, in megasas_create_frame_pool()
3736 dev_printk(KERN_DEBUG, &instance->pdev->dev, "pci_pool_alloc failed\n"); in megasas_create_frame_pool()
3737 megasas_teardown_frame_pool(instance); in megasas_create_frame_pool()
3744 if (!instance->ctrl_context && reset_devices) in megasas_create_frame_pool()
3755 void megasas_free_cmds(struct megasas_instance *instance) in megasas_free_cmds() argument
3760 megasas_teardown_frame_pool(instance); in megasas_free_cmds()
3763 for (i = 0; i < instance->max_mfi_cmds; i++) in megasas_free_cmds()
3765 kfree(instance->cmd_list[i]); in megasas_free_cmds()
3768 kfree(instance->cmd_list); in megasas_free_cmds()
3769 instance->cmd_list = NULL; in megasas_free_cmds()
3771 INIT_LIST_HEAD(&instance->cmd_pool); in megasas_free_cmds()
3792 int megasas_alloc_cmds(struct megasas_instance *instance) in megasas_alloc_cmds() argument
3800 fusion = instance->ctrl_context; in megasas_alloc_cmds()
3801 max_cmd = instance->max_mfi_cmds; in megasas_alloc_cmds()
3808 instance->cmd_list = kcalloc(max_cmd, sizeof(struct megasas_cmd*), GFP_KERNEL); in megasas_alloc_cmds()
3810 if (!instance->cmd_list) { in megasas_alloc_cmds()
3811 dev_printk(KERN_DEBUG, &instance->pdev->dev, "out of memory\n"); in megasas_alloc_cmds()
3815 memset(instance->cmd_list, 0, sizeof(struct megasas_cmd *) *max_cmd); in megasas_alloc_cmds()
3818 instance->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd), in megasas_alloc_cmds()
3821 if (!instance->cmd_list[i]) { in megasas_alloc_cmds()
3824 kfree(instance->cmd_list[j]); in megasas_alloc_cmds()
3826 kfree(instance->cmd_list); in megasas_alloc_cmds()
3827 instance->cmd_list = NULL; in megasas_alloc_cmds()
3834 cmd = instance->cmd_list[i]; in megasas_alloc_cmds()
3838 cmd->instance = instance; in megasas_alloc_cmds()
3840 list_add_tail(&cmd->list, &instance->cmd_pool); in megasas_alloc_cmds()
3846 if (megasas_create_frame_pool(instance)) { in megasas_alloc_cmds()
3847 dev_printk(KERN_DEBUG, &instance->pdev->dev, "Error creating frame DMA pool\n"); in megasas_alloc_cmds()
3848 megasas_free_cmds(instance); in megasas_alloc_cmds()
3864 megasas_get_pd_list(struct megasas_instance *instance) in megasas_get_pd_list() argument
3873 cmd = megasas_get_cmd(instance); in megasas_get_pd_list()
3876 dev_printk(KERN_DEBUG, &instance->pdev->dev, "(get_pd_list): Failed to get cmd\n"); in megasas_get_pd_list()
3882 ci = pci_alloc_consistent(instance->pdev, in megasas_get_pd_list()
3886 dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to alloc mem for pd_list\n"); in megasas_get_pd_list()
3887 megasas_return_cmd(instance, cmd); in megasas_get_pd_list()
3907 if (instance->ctrl_context && !instance->mask_interrupts) in megasas_get_pd_list()
3908 ret = megasas_issue_blocked_cmd(instance, cmd, in megasas_get_pd_list()
3911 ret = megasas_issue_polled(instance, cmd); in megasas_get_pd_list()
3923 memset(instance->local_pd_list, 0, in megasas_get_pd_list()
3928 instance->local_pd_list[le16_to_cpu(pd_addr->deviceId)].tid = in megasas_get_pd_list()
3930 instance->local_pd_list[le16_to_cpu(pd_addr->deviceId)].driveType = in megasas_get_pd_list()
3932 instance->local_pd_list[le16_to_cpu(pd_addr->deviceId)].driveState = in megasas_get_pd_list()
3936 memcpy(instance->pd_list, instance->local_pd_list, in megasas_get_pd_list()
3937 sizeof(instance->pd_list)); in megasas_get_pd_list()
3940 pci_free_consistent(instance->pdev, in megasas_get_pd_list()
3944 megasas_return_cmd(instance, cmd); in megasas_get_pd_list()
3959 megasas_get_ld_list(struct megasas_instance *instance) in megasas_get_ld_list() argument
3968 cmd = megasas_get_cmd(instance); in megasas_get_ld_list()
3971 dev_printk(KERN_DEBUG, &instance->pdev->dev, "megasas_get_ld_list: Failed to get cmd\n"); in megasas_get_ld_list()
3977 ci = pci_alloc_consistent(instance->pdev, in megasas_get_ld_list()
3982 dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to alloc mem in get_ld_list\n"); in megasas_get_ld_list()
3983 megasas_return_cmd(instance, cmd); in megasas_get_ld_list()
3990 if (instance->supportmax256vd) in megasas_get_ld_list()
4003 if (instance->ctrl_context && !instance->mask_interrupts) in megasas_get_ld_list()
4004 ret = megasas_issue_blocked_cmd(instance, cmd, in megasas_get_ld_list()
4007 ret = megasas_issue_polled(instance, cmd); in megasas_get_ld_list()
4014 if ((ret == 0) && (ld_count <= instance->fw_supported_vd_count)) { in megasas_get_ld_list()
4015 memset(instance->ld_ids, 0xff, MAX_LOGICAL_DRIVES_EXT); in megasas_get_ld_list()
4020 instance->ld_ids[ids] = in megasas_get_ld_list()
4026 pci_free_consistent(instance->pdev, in megasas_get_ld_list()
4031 megasas_return_cmd(instance, cmd); in megasas_get_ld_list()
4045 megasas_ld_list_query(struct megasas_instance *instance, u8 query_type) in megasas_ld_list_query() argument
4054 cmd = megasas_get_cmd(instance); in megasas_ld_list_query()
4057 dev_warn(&instance->pdev->dev, in megasas_ld_list_query()
4064 ci = pci_alloc_consistent(instance->pdev, in megasas_ld_list_query()
4068 dev_warn(&instance->pdev->dev, in megasas_ld_list_query()
4070 megasas_return_cmd(instance, cmd); in megasas_ld_list_query()
4078 if (instance->supportmax256vd) in megasas_ld_list_query()
4092 if (instance->ctrl_context && !instance->mask_interrupts) in megasas_ld_list_query()
4093 ret = megasas_issue_blocked_cmd(instance, cmd, in megasas_ld_list_query()
4096 ret = megasas_issue_polled(instance, cmd); in megasas_ld_list_query()
4100 if ((ret == 0) && (tgtid_count <= (instance->fw_supported_vd_count))) { in megasas_ld_list_query()
4101 memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS); in megasas_ld_list_query()
4104 instance->ld_ids[ids] = ci->targetId[ld_index]; in megasas_ld_list_query()
4109 pci_free_consistent(instance->pdev, sizeof(struct MR_LD_TARGETID_LIST), in megasas_ld_list_query()
4112 megasas_return_cmd(instance, cmd); in megasas_ld_list_query()
4121 static void megasas_update_ext_vd_details(struct megasas_instance *instance) in megasas_update_ext_vd_details() argument
4127 fusion = instance->ctrl_context; in megasas_update_ext_vd_details()
4132 instance->supportmax256vd = in megasas_update_ext_vd_details()
4133 instance->ctrl_info->adapterOperations3.supportMaxExtLDs; in megasas_update_ext_vd_details()
4135 if (instance->ctrl_info->max_lds > 64) in megasas_update_ext_vd_details()
4136 instance->supportmax256vd = 1; in megasas_update_ext_vd_details()
4138 instance->drv_supported_vd_count = MEGASAS_MAX_LD_CHANNELS in megasas_update_ext_vd_details()
4140 instance->drv_supported_pd_count = MEGASAS_MAX_PD_CHANNELS in megasas_update_ext_vd_details()
4142 if (instance->supportmax256vd) { in megasas_update_ext_vd_details()
4143 instance->fw_supported_vd_count = MAX_LOGICAL_DRIVES_EXT; in megasas_update_ext_vd_details()
4144 instance->fw_supported_pd_count = MAX_PHYSICAL_DEVICES; in megasas_update_ext_vd_details()
4146 instance->fw_supported_vd_count = MAX_LOGICAL_DRIVES; in megasas_update_ext_vd_details()
4147 instance->fw_supported_pd_count = MAX_PHYSICAL_DEVICES; in megasas_update_ext_vd_details()
4150 dev_info(&instance->pdev->dev, in megasas_update_ext_vd_details()
4152 instance->supportmax256vd ? "Extended VD(240 VD)firmware" : in megasas_update_ext_vd_details()
4157 (instance->fw_supported_vd_count - 1)); in megasas_update_ext_vd_details()
4161 (instance->drv_supported_vd_count - 1)); in megasas_update_ext_vd_details()
4166 if (instance->supportmax256vd) in megasas_update_ext_vd_details()
4181 megasas_get_ctrl_info(struct megasas_instance *instance) in megasas_get_ctrl_info() argument
4190 ctrl_info = instance->ctrl_info; in megasas_get_ctrl_info()
4192 cmd = megasas_get_cmd(instance); in megasas_get_ctrl_info()
4195 dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to get a free cmd\n"); in megasas_get_ctrl_info()
4201 ci = pci_alloc_consistent(instance->pdev, in megasas_get_ctrl_info()
4205 dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to alloc mem for ctrl info\n"); in megasas_get_ctrl_info()
4206 megasas_return_cmd(instance, cmd); in megasas_get_ctrl_info()
4225 if (instance->ctrl_context && !instance->mask_interrupts) in megasas_get_ctrl_info()
4226 ret = megasas_issue_blocked_cmd(instance, cmd, in megasas_get_ctrl_info()
4229 ret = megasas_issue_polled(instance, cmd); in megasas_get_ctrl_info()
4236 megasas_update_ext_vd_details(instance); in megasas_get_ctrl_info()
4237 instance->use_seqnum_jbod_fp = in megasas_get_ctrl_info()
4239 instance->is_imr = (ctrl_info->memory_size ? 0 : 1); in megasas_get_ctrl_info()
4240 dev_info(&instance->pdev->dev, in megasas_get_ctrl_info()
4242 instance->is_imr ? "iMR" : "MR", in megasas_get_ctrl_info()
4244 instance->disableOnlineCtrlReset = in megasas_get_ctrl_info()
4246 dev_info(&instance->pdev->dev, "Online Controller Reset(OCR)\t: %s\n", in megasas_get_ctrl_info()
4247 instance->disableOnlineCtrlReset ? "Disabled" : "Enabled"); in megasas_get_ctrl_info()
4248 instance->secure_jbod_support = in megasas_get_ctrl_info()
4250 dev_info(&instance->pdev->dev, "Secure JBOD support\t: %s\n", in megasas_get_ctrl_info()
4251 instance->secure_jbod_support ? "Yes" : "No"); in megasas_get_ctrl_info()
4254 pci_free_consistent(instance->pdev, sizeof(struct megasas_ctrl_info), in megasas_get_ctrl_info()
4257 megasas_return_cmd(instance, cmd); in megasas_get_ctrl_info()
4276 int megasas_set_crash_dump_params(struct megasas_instance *instance, in megasas_set_crash_dump_params() argument
4283 cmd = megasas_get_cmd(instance); in megasas_set_crash_dump_params()
4286 dev_err(&instance->pdev->dev, "Failed to get a free cmd\n"); in megasas_set_crash_dump_params()
4303 dcmd->sgl.sge32[0].phys_addr = cpu_to_le32(instance->crash_dump_h); in megasas_set_crash_dump_params()
4306 if (instance->ctrl_context && !instance->mask_interrupts) in megasas_set_crash_dump_params()
4307 ret = megasas_issue_blocked_cmd(instance, cmd, in megasas_set_crash_dump_params()
4310 ret = megasas_issue_polled(instance, cmd); in megasas_set_crash_dump_params()
4312 megasas_return_cmd(instance, cmd); in megasas_set_crash_dump_params()
4323 megasas_issue_init_mfi(struct megasas_instance *instance) in megasas_issue_init_mfi() argument
4340 cmd = megasas_get_cmd(instance); in megasas_issue_init_mfi()
4354 initq_info->reply_queue_entries = cpu_to_le32(instance->max_fw_cmds + 1); in megasas_issue_init_mfi()
4355 initq_info->reply_queue_start_phys_addr_lo = cpu_to_le32(instance->reply_queue_h); in megasas_issue_init_mfi()
4357 initq_info->producer_index_phys_addr_lo = cpu_to_le32(instance->producer_h); in megasas_issue_init_mfi()
4358 initq_info->consumer_index_phys_addr_lo = cpu_to_le32(instance->consumer_h); in megasas_issue_init_mfi()
4372 instance->instancet->disable_intr(instance); in megasas_issue_init_mfi()
4378 if (megasas_issue_polled(instance, cmd)) { in megasas_issue_init_mfi()
4379 dev_err(&instance->pdev->dev, "Failed to init firmware\n"); in megasas_issue_init_mfi()
4380 megasas_return_cmd(instance, cmd); in megasas_issue_init_mfi()
4384 megasas_return_cmd(instance, cmd); in megasas_issue_init_mfi()
4393 megasas_init_adapter_mfi(struct megasas_instance *instance) in megasas_init_adapter_mfi() argument
4399 reg_set = instance->reg_set; in megasas_init_adapter_mfi()
4404 instance->max_fw_cmds = instance->instancet->read_fw_status_reg(reg_set) & 0x00FFFF; in megasas_init_adapter_mfi()
4410 instance->max_fw_cmds = instance->max_fw_cmds-1; in megasas_init_adapter_mfi()
4411 instance->max_mfi_cmds = instance->max_fw_cmds; in megasas_init_adapter_mfi()
4412 instance->max_num_sge = (instance->instancet->read_fw_status_reg(reg_set) & 0xFF0000) >> in megasas_init_adapter_mfi()
4418 if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) || in megasas_init_adapter_mfi()
4419 (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY)) { in megasas_init_adapter_mfi()
4420 instance->max_scsi_cmds = (instance->max_fw_cmds - in megasas_init_adapter_mfi()
4422 sema_init(&instance->ioctl_sem, MEGASAS_SKINNY_INT_CMDS); in megasas_init_adapter_mfi()
4424 instance->max_scsi_cmds = (instance->max_fw_cmds - in megasas_init_adapter_mfi()
4426 sema_init(&instance->ioctl_sem, (MEGASAS_MFI_IOCTL_CMDS)); in megasas_init_adapter_mfi()
4432 if (megasas_alloc_cmds(instance)) in megasas_init_adapter_mfi()
4445 reply_q_sz = context_sz * (instance->max_fw_cmds + 1); in megasas_init_adapter_mfi()
4447 instance->reply_queue = pci_alloc_consistent(instance->pdev, in megasas_init_adapter_mfi()
4449 &instance->reply_queue_h); in megasas_init_adapter_mfi()
4451 if (!instance->reply_queue) { in megasas_init_adapter_mfi()
4452 dev_printk(KERN_DEBUG, &instance->pdev->dev, "Out of DMA mem for reply queue\n"); in megasas_init_adapter_mfi()
4456 if (megasas_issue_init_mfi(instance)) in megasas_init_adapter_mfi()
4459 if (megasas_get_ctrl_info(instance)) { in megasas_init_adapter_mfi()
4460 dev_err(&instance->pdev->dev, "(%d): Could get controller info " in megasas_init_adapter_mfi()
4461 "Fail from %s %d\n", instance->unique_id, in megasas_init_adapter_mfi()
4466 instance->fw_support_ieee = 0; in megasas_init_adapter_mfi()
4467 instance->fw_support_ieee = in megasas_init_adapter_mfi()
4468 (instance->instancet->read_fw_status_reg(reg_set) & in megasas_init_adapter_mfi()
4471 dev_notice(&instance->pdev->dev, "megasas_init_mfi: fw_support_ieee=%d", in megasas_init_adapter_mfi()
4472 instance->fw_support_ieee); in megasas_init_adapter_mfi()
4474 if (instance->fw_support_ieee) in megasas_init_adapter_mfi()
4475 instance->flag_ieee = 1; in megasas_init_adapter_mfi()
4481 pci_free_consistent(instance->pdev, reply_q_sz, in megasas_init_adapter_mfi()
4482 instance->reply_queue, instance->reply_queue_h); in megasas_init_adapter_mfi()
4484 megasas_free_cmds(instance); in megasas_init_adapter_mfi()
4499 megasas_setup_irqs_ioapic(struct megasas_instance *instance) in megasas_setup_irqs_ioapic() argument
4503 pdev = instance->pdev; in megasas_setup_irqs_ioapic()
4504 instance->irq_context[0].instance = instance; in megasas_setup_irqs_ioapic()
4505 instance->irq_context[0].MSIxIndex = 0; in megasas_setup_irqs_ioapic()
4506 if (request_irq(pdev->irq, instance->instancet->service_isr, in megasas_setup_irqs_ioapic()
4507 IRQF_SHARED, "megasas", &instance->irq_context[0])) { in megasas_setup_irqs_ioapic()
4508 dev_err(&instance->pdev->dev, in megasas_setup_irqs_ioapic()
4526 megasas_setup_irqs_msix(struct megasas_instance *instance, u8 is_probe) in megasas_setup_irqs_msix() argument
4531 pdev = instance->pdev; in megasas_setup_irqs_msix()
4535 for (i = 0; i < instance->msix_vectors; i++) { in megasas_setup_irqs_msix()
4536 instance->irq_context[i].instance = instance; in megasas_setup_irqs_msix()
4537 instance->irq_context[i].MSIxIndex = i; in megasas_setup_irqs_msix()
4538 if (request_irq(instance->msixentry[i].vector, in megasas_setup_irqs_msix()
4539 instance->instancet->service_isr, 0, "megasas", in megasas_setup_irqs_msix()
4540 &instance->irq_context[i])) { in megasas_setup_irqs_msix()
4541 dev_err(&instance->pdev->dev, in megasas_setup_irqs_msix()
4546 instance->msixentry[j].vector, NULL); in megasas_setup_irqs_msix()
4547 free_irq(instance->msixentry[j].vector, in megasas_setup_irqs_msix()
4548 &instance->irq_context[j]); in megasas_setup_irqs_msix()
4551 instance->msix_vectors = 0; in megasas_setup_irqs_msix()
4553 return megasas_setup_irqs_ioapic(instance); in megasas_setup_irqs_msix()
4558 if (irq_set_affinity_hint(instance->msixentry[i].vector, in megasas_setup_irqs_msix()
4560 dev_err(&instance->pdev->dev, in megasas_setup_irqs_msix()
4575 megasas_destroy_irqs(struct megasas_instance *instance) { in megasas_destroy_irqs() argument
4579 if (instance->msix_vectors) in megasas_destroy_irqs()
4580 for (i = 0; i < instance->msix_vectors; i++) { in megasas_destroy_irqs()
4583 instance->msixentry[i].vector, NULL); in megasas_destroy_irqs()
4584 free_irq(instance->msixentry[i].vector, in megasas_destroy_irqs()
4585 &instance->irq_context[i]); in megasas_destroy_irqs()
4588 free_irq(instance->pdev->irq, &instance->irq_context[0]); in megasas_destroy_irqs()
4599 megasas_setup_jbod_map(struct megasas_instance *instance) in megasas_setup_jbod_map() argument
4602 struct fusion_context *fusion = instance->ctrl_context; in megasas_setup_jbod_map()
4609 !instance->ctrl_info->adapterOperations3.useSeqNumJbodFP) { in megasas_setup_jbod_map()
4610 dev_info(&instance->pdev->dev, in megasas_setup_jbod_map()
4613 instance->use_seqnum_jbod_fp = false; in megasas_setup_jbod_map()
4622 (&instance->pdev->dev, pd_seq_map_sz, in megasas_setup_jbod_map()
4625 dev_err(&instance->pdev->dev, in megasas_setup_jbod_map()
4629 dma_free_coherent(&instance->pdev->dev, in megasas_setup_jbod_map()
4634 instance->use_seqnum_jbod_fp = false; in megasas_setup_jbod_map()
4640 if (!megasas_sync_pd_seq_num(instance, false) && in megasas_setup_jbod_map()
4641 !megasas_sync_pd_seq_num(instance, true)) in megasas_setup_jbod_map()
4642 instance->use_seqnum_jbod_fp = true; in megasas_setup_jbod_map()
4644 instance->use_seqnum_jbod_fp = false; in megasas_setup_jbod_map()
4654 static int megasas_init_fw(struct megasas_instance *instance) in megasas_init_fw() argument
4667 fusion = instance->ctrl_context; in megasas_init_fw()
4670 bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM); in megasas_init_fw()
4671 instance->bar = find_first_bit(&bar_list, sizeof(unsigned long)); in megasas_init_fw()
4672 if (pci_request_selected_regions(instance->pdev, instance->bar, in megasas_init_fw()
4674 dev_printk(KERN_DEBUG, &instance->pdev->dev, "IO memory region busy!\n"); in megasas_init_fw()
4678 base_addr = pci_resource_start(instance->pdev, instance->bar); in megasas_init_fw()
4679 instance->reg_set = ioremap_nocache(base_addr, 8192); in megasas_init_fw()
4681 if (!instance->reg_set) { in megasas_init_fw()
4682 dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to map IO mem\n"); in megasas_init_fw()
4686 reg_set = instance->reg_set; in megasas_init_fw()
4688 switch (instance->pdev->device) { in megasas_init_fw()
4697 instance->instancet = &megasas_instance_template_fusion; in megasas_init_fw()
4701 instance->instancet = &megasas_instance_template_ppc; in megasas_init_fw()
4705 instance->instancet = &megasas_instance_template_gen2; in megasas_init_fw()
4709 instance->instancet = &megasas_instance_template_skinny; in megasas_init_fw()
4714 instance->instancet = &megasas_instance_template_xscale; in megasas_init_fw()
4715 instance->allow_fw_scan = 1; in megasas_init_fw()
4719 if (megasas_transition_to_ready(instance, 0)) { in megasas_init_fw()
4720 atomic_set(&instance->fw_reset_no_pci_access, 1); in megasas_init_fw()
4721 instance->instancet->adp_reset in megasas_init_fw()
4722 (instance, instance->reg_set); in megasas_init_fw()
4723 atomic_set(&instance->fw_reset_no_pci_access, 0); in megasas_init_fw()
4724 dev_info(&instance->pdev->dev, in megasas_init_fw()
4731 if (megasas_transition_to_ready(instance, 0)) in megasas_init_fw()
4739 instance->reply_post_host_index_addr[0] = in megasas_init_fw()
4740 (u32 __iomem *)((u8 __iomem *)instance->reg_set + in megasas_init_fw()
4744 msix_enable = (instance->instancet->read_fw_status_reg(reg_set) & in megasas_init_fw()
4748 (&instance->reg_set->outbound_scratch_pad_2); in megasas_init_fw()
4752 instance->msix_vectors = (scratch_pad_2 in megasas_init_fw()
4754 fw_msix_count = instance->msix_vectors; in megasas_init_fw()
4756 instance->msix_vectors = ((scratch_pad_2 in megasas_init_fw()
4759 fw_msix_count = instance->msix_vectors; in megasas_init_fw()
4765 instance->reply_post_host_index_addr[loop] = in megasas_init_fw()
4767 ((u8 __iomem *)instance->reg_set + in megasas_init_fw()
4773 instance->msix_vectors = min(msix_vectors, in megasas_init_fw()
4774 instance->msix_vectors); in megasas_init_fw()
4776 instance->msix_vectors = 1; in megasas_init_fw()
4778 instance->msix_vectors = min(instance->msix_vectors, in megasas_init_fw()
4780 for (i = 0; i < instance->msix_vectors; i++) in megasas_init_fw()
4781 instance->msixentry[i].entry = i; in megasas_init_fw()
4782 i = pci_enable_msix_range(instance->pdev, instance->msixentry, in megasas_init_fw()
4783 1, instance->msix_vectors); in megasas_init_fw()
4785 instance->msix_vectors = i; in megasas_init_fw()
4787 instance->msix_vectors = 0; in megasas_init_fw()
4790 dev_info(&instance->pdev->dev, in megasas_init_fw()
4792 dev_info(&instance->pdev->dev, in megasas_init_fw()
4794 instance->msix_vectors, (unsigned int)num_online_cpus()); in megasas_init_fw()
4796 tasklet_init(&instance->isr_tasklet, instance->instancet->tasklet, in megasas_init_fw()
4797 (unsigned long)instance); in megasas_init_fw()
4799 if (instance->msix_vectors ? in megasas_init_fw()
4800 megasas_setup_irqs_msix(instance, 1) : in megasas_init_fw()
4801 megasas_setup_irqs_ioapic(instance)) in megasas_init_fw()
4804 instance->ctrl_info = kzalloc(sizeof(struct megasas_ctrl_info), in megasas_init_fw()
4806 if (instance->ctrl_info == NULL) in megasas_init_fw()
4813 instance->fw_supported_vd_count = MAX_LOGICAL_DRIVES; in megasas_init_fw()
4814 instance->fw_supported_pd_count = MAX_PHYSICAL_DEVICES; in megasas_init_fw()
4816 if (instance->instancet->init_adapter(instance)) in megasas_init_fw()
4820 instance->instancet->enable_intr(instance); in megasas_init_fw()
4822 dev_err(&instance->pdev->dev, "INIT adapter done\n"); in megasas_init_fw()
4824 megasas_setup_jbod_map(instance); in megasas_init_fw()
4829 memset(instance->pd_list, 0, in megasas_init_fw()
4831 if (megasas_get_pd_list(instance) < 0) { in megasas_init_fw()
4832 dev_err(&instance->pdev->dev, "failed to get PD list\n"); in megasas_init_fw()
4836 memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS); in megasas_init_fw()
4837 if (megasas_ld_list_query(instance, in megasas_init_fw()
4839 megasas_get_ld_list(instance); in megasas_init_fw()
4851 ctrl_info = instance->ctrl_info; in megasas_init_fw()
4859 instance->mpio = ctrl_info->adapterOperations2.mpio; in megasas_init_fw()
4860 instance->UnevenSpanSupport = in megasas_init_fw()
4862 if (instance->UnevenSpanSupport) { in megasas_init_fw()
4863 struct fusion_context *fusion = instance->ctrl_context; in megasas_init_fw()
4864 if (MR_ValidateMapInfo(instance)) in megasas_init_fw()
4871 instance->requestorId = ctrl_info->iov.requestorId; in megasas_init_fw()
4872 if (instance->pdev->device == PCI_DEVICE_ID_LSI_PLASMA) { in megasas_init_fw()
4874 instance->PlasmaFW111 = 1; in megasas_init_fw()
4876 dev_info(&instance->pdev->dev, "SR-IOV: firmware type: %s\n", in megasas_init_fw()
4877 instance->PlasmaFW111 ? "1.11" : "new"); in megasas_init_fw()
4879 if (instance->PlasmaFW111) { in megasas_init_fw()
4882 instance->requestorId = iovPtr->requestorId; in megasas_init_fw()
4885 dev_info(&instance->pdev->dev, "SRIOV: VF requestorId %d\n", in megasas_init_fw()
4886 instance->requestorId); in megasas_init_fw()
4889 instance->crash_dump_fw_support = in megasas_init_fw()
4891 instance->crash_dump_drv_support = in megasas_init_fw()
4892 (instance->crash_dump_fw_support && in megasas_init_fw()
4893 instance->crash_dump_buf); in megasas_init_fw()
4894 if (instance->crash_dump_drv_support) in megasas_init_fw()
4895 megasas_set_crash_dump_params(instance, in megasas_init_fw()
4899 if (instance->crash_dump_buf) in megasas_init_fw()
4900 pci_free_consistent(instance->pdev, in megasas_init_fw()
4902 instance->crash_dump_buf, in megasas_init_fw()
4903 instance->crash_dump_h); in megasas_init_fw()
4904 instance->crash_dump_buf = NULL; in megasas_init_fw()
4908 dev_info(&instance->pdev->dev, in megasas_init_fw()
4914 dev_info(&instance->pdev->dev, "unevenspan support : %s\n", in megasas_init_fw()
4915 instance->UnevenSpanSupport ? "yes" : "no"); in megasas_init_fw()
4916 dev_info(&instance->pdev->dev, "firmware crash dump : %s\n", in megasas_init_fw()
4917 instance->crash_dump_drv_support ? "yes" : "no"); in megasas_init_fw()
4918 dev_info(&instance->pdev->dev, "jbod sync map : %s\n", in megasas_init_fw()
4919 instance->use_seqnum_jbod_fp ? "yes" : "no"); in megasas_init_fw()
4922 instance->max_sectors_per_req = instance->max_num_sge * in megasas_init_fw()
4924 if (tmp_sectors && (instance->max_sectors_per_req > tmp_sectors)) in megasas_init_fw()
4925 instance->max_sectors_per_req = tmp_sectors; in megasas_init_fw()
4929 throttlequeuedepth <= instance->max_scsi_cmds) in megasas_init_fw()
4930 instance->throttlequeuedepth = throttlequeuedepth; in megasas_init_fw()
4932 instance->throttlequeuedepth = in megasas_init_fw()
4937 if (instance->requestorId) { in megasas_init_fw()
4938 if (!megasas_sriov_start_heartbeat(instance, 1)) in megasas_init_fw()
4939 megasas_start_timer(instance, in megasas_init_fw()
4940 &instance->sriov_heartbeat_timer, in megasas_init_fw()
4944 instance->skip_heartbeat_timer_del = 1; in megasas_init_fw()
4950 instance->instancet->disable_intr(instance); in megasas_init_fw()
4952 megasas_destroy_irqs(instance); in megasas_init_fw()
4954 if (instance->msix_vectors) in megasas_init_fw()
4955 pci_disable_msix(instance->pdev); in megasas_init_fw()
4956 instance->msix_vectors = 0; in megasas_init_fw()
4958 kfree(instance->ctrl_info); in megasas_init_fw()
4959 instance->ctrl_info = NULL; in megasas_init_fw()
4960 iounmap(instance->reg_set); in megasas_init_fw()
4963 pci_release_selected_regions(instance->pdev, instance->bar); in megasas_init_fw()
4972 static void megasas_release_mfi(struct megasas_instance *instance) in megasas_release_mfi() argument
4974 u32 reply_q_sz = sizeof(u32) *(instance->max_mfi_cmds + 1); in megasas_release_mfi()
4976 if (instance->reply_queue) in megasas_release_mfi()
4977 pci_free_consistent(instance->pdev, reply_q_sz, in megasas_release_mfi()
4978 instance->reply_queue, instance->reply_queue_h); in megasas_release_mfi()
4980 megasas_free_cmds(instance); in megasas_release_mfi()
4982 iounmap(instance->reg_set); in megasas_release_mfi()
4984 pci_release_selected_regions(instance->pdev, instance->bar); in megasas_release_mfi()
5000 megasas_get_seq_num(struct megasas_instance *instance, in megasas_get_seq_num() argument
5008 cmd = megasas_get_cmd(instance); in megasas_get_seq_num()
5015 el_info = pci_alloc_consistent(instance->pdev, in megasas_get_seq_num()
5020 megasas_return_cmd(instance, cmd); in megasas_get_seq_num()
5038 if (megasas_issue_blocked_cmd(instance, cmd, 30)) in megasas_get_seq_num()
5039 dev_err(&instance->pdev->dev, "Command timedout" in megasas_get_seq_num()
5052 pci_free_consistent(instance->pdev, sizeof(struct megasas_evt_log_info), in megasas_get_seq_num()
5055 megasas_return_cmd(instance, cmd); in megasas_get_seq_num()
5070 megasas_register_aen(struct megasas_instance *instance, u32 seq_num, in megasas_register_aen() argument
5094 if (instance->aen_cmd) { in megasas_register_aen()
5097 le32_to_cpu(instance->aen_cmd->frame->dcmd.mbox.w[1]); in megasas_register_aen()
5123 instance->aen_cmd->abort_aen = 1; in megasas_register_aen()
5124 ret_val = megasas_issue_blocked_abort_cmd(instance, in megasas_register_aen()
5125 instance-> in megasas_register_aen()
5129 dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to abort " in megasas_register_aen()
5136 cmd = megasas_get_cmd(instance); in megasas_register_aen()
5143 memset(instance->evt_detail, 0, sizeof(struct megasas_evt_detail)); in megasas_register_aen()
5159 instance->last_seq_num = seq_num; in megasas_register_aen()
5161 dcmd->sgl.sge32[0].phys_addr = cpu_to_le32(instance->evt_detail_h); in megasas_register_aen()
5164 if (instance->aen_cmd != NULL) { in megasas_register_aen()
5165 megasas_return_cmd(instance, cmd); in megasas_register_aen()
5174 instance->aen_cmd = cmd; in megasas_register_aen()
5179 instance->instancet->issue_dcmd(instance, cmd); in megasas_register_aen()
5188 static int megasas_start_aen(struct megasas_instance *instance) in megasas_start_aen() argument
5198 if (megasas_get_seq_num(instance, &eli)) in megasas_start_aen()
5208 return megasas_register_aen(instance, in megasas_start_aen()
5217 static int megasas_io_attach(struct megasas_instance *instance) in megasas_io_attach() argument
5219 struct Scsi_Host *host = instance->host; in megasas_io_attach()
5224 host->irq = instance->pdev->irq; in megasas_io_attach()
5225 host->unique_id = instance->unique_id; in megasas_io_attach()
5226 host->can_queue = instance->max_scsi_cmds; in megasas_io_attach()
5227 host->this_id = instance->init_id; in megasas_io_attach()
5228 host->sg_tablesize = instance->max_num_sge; in megasas_io_attach()
5230 if (instance->fw_support_ieee) in megasas_io_attach()
5231 instance->max_sectors_per_req = MEGASAS_MAX_SECTORS_IEEE; in megasas_io_attach()
5236 if (max_sectors && max_sectors < instance->max_sectors_per_req) in megasas_io_attach()
5237 instance->max_sectors_per_req = max_sectors; in megasas_io_attach()
5240 if (((instance->pdev->device == in megasas_io_attach()
5242 (instance->pdev->device == in megasas_io_attach()
5245 instance->max_sectors_per_req = max_sectors; in megasas_io_attach()
5247 dev_info(&instance->pdev->dev, "max_sectors should be > 0" in megasas_io_attach()
5249 instance->max_sectors_per_req); in megasas_io_attach()
5254 host->max_sectors = instance->max_sectors_per_req; in megasas_io_attach()
5262 if (instance->ctrl_context) { in megasas_io_attach()
5270 if (scsi_add_host(host, &instance->pdev->dev)) { in megasas_io_attach()
5271 dev_err(&instance->pdev->dev, in megasas_io_attach()
5326 struct megasas_instance *instance; in megasas_probe_one() local
5368 instance = (struct megasas_instance *)host->hostdata; in megasas_probe_one()
5369 memset(instance, 0, sizeof(*instance)); in megasas_probe_one()
5370 atomic_set(&instance->fw_reset_no_pci_access, 0); in megasas_probe_one()
5371 instance->pdev = pdev; in megasas_probe_one()
5373 switch (instance->pdev->device) { in megasas_probe_one()
5383 instance->ctrl_context_pages = in megasas_probe_one()
5385 instance->ctrl_context = (void *)__get_free_pages(GFP_KERNEL, in megasas_probe_one()
5386 instance->ctrl_context_pages); in megasas_probe_one()
5387 if (!instance->ctrl_context) { in megasas_probe_one()
5392 fusion = instance->ctrl_context; in megasas_probe_one()
5394 ((1 << PAGE_SHIFT) << instance->ctrl_context_pages)); in megasas_probe_one()
5395 if ((instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) || in megasas_probe_one()
5396 (instance->pdev->device == PCI_DEVICE_ID_LSI_PLASMA)) in megasas_probe_one()
5404 instance->producer = in megasas_probe_one()
5406 &instance->producer_h); in megasas_probe_one()
5407 instance->consumer = in megasas_probe_one()
5409 &instance->consumer_h); in megasas_probe_one()
5411 if (!instance->producer || !instance->consumer) { in megasas_probe_one()
5417 *instance->producer = 0; in megasas_probe_one()
5418 *instance->consumer = 0; in megasas_probe_one()
5422 instance->system_info_buf = pci_zalloc_consistent(pdev, in megasas_probe_one()
5424 &instance->system_info_h); in megasas_probe_one()
5426 if (!instance->system_info_buf) in megasas_probe_one()
5427 dev_info(&instance->pdev->dev, "Can't allocate system info buffer\n"); in megasas_probe_one()
5430 instance->drv_buf_index = 0; in megasas_probe_one()
5431 instance->drv_buf_alloc = 0; in megasas_probe_one()
5432 instance->crash_dump_fw_support = 0; in megasas_probe_one()
5433 instance->crash_dump_app_support = 0; in megasas_probe_one()
5434 instance->fw_crash_state = UNAVAILABLE; in megasas_probe_one()
5435 spin_lock_init(&instance->crashdump_lock); in megasas_probe_one()
5436 instance->crash_dump_buf = NULL; in megasas_probe_one()
5439 instance->crash_dump_buf = pci_alloc_consistent(pdev, in megasas_probe_one()
5441 &instance->crash_dump_h); in megasas_probe_one()
5442 if (!instance->crash_dump_buf) in megasas_probe_one()
5447 instance->flag_ieee = 0; in megasas_probe_one()
5448 instance->ev = NULL; in megasas_probe_one()
5449 instance->issuepend_done = 1; in megasas_probe_one()
5450 instance->adprecovery = MEGASAS_HBA_OPERATIONAL; in megasas_probe_one()
5451 instance->is_imr = 0; in megasas_probe_one()
5453 instance->evt_detail = pci_alloc_consistent(pdev, in megasas_probe_one()
5456 &instance->evt_detail_h); in megasas_probe_one()
5458 if (!instance->evt_detail) { in megasas_probe_one()
5467 INIT_LIST_HEAD(&instance->cmd_pool); in megasas_probe_one()
5468 INIT_LIST_HEAD(&instance->internal_reset_pending_q); in megasas_probe_one()
5470 atomic_set(&instance->fw_outstanding,0); in megasas_probe_one()
5472 init_waitqueue_head(&instance->int_cmd_wait_q); in megasas_probe_one()
5473 init_waitqueue_head(&instance->abort_cmd_wait_q); in megasas_probe_one()
5475 spin_lock_init(&instance->mfi_pool_lock); in megasas_probe_one()
5476 spin_lock_init(&instance->hba_lock); in megasas_probe_one()
5477 spin_lock_init(&instance->completion_lock); in megasas_probe_one()
5479 mutex_init(&instance->aen_mutex); in megasas_probe_one()
5480 mutex_init(&instance->reset_mutex); in megasas_probe_one()
5485 instance->host = host; in megasas_probe_one()
5486 instance->unique_id = pdev->bus->number << 8 | pdev->devfn; in megasas_probe_one()
5487 instance->init_id = MEGASAS_DEFAULT_INIT_ID; in megasas_probe_one()
5488 instance->ctrl_info = NULL; in megasas_probe_one()
5491 if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) || in megasas_probe_one()
5492 (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY)) in megasas_probe_one()
5493 instance->flag_ieee = 1; in megasas_probe_one()
5496 instance->flag = 0; in megasas_probe_one()
5497 instance->unload = 1; in megasas_probe_one()
5498 instance->last_time = 0; in megasas_probe_one()
5499 instance->disableOnlineCtrlReset = 1; in megasas_probe_one()
5500 instance->UnevenSpanSupport = 0; in megasas_probe_one()
5502 if (instance->ctrl_context) { in megasas_probe_one()
5503 INIT_WORK(&instance->work_init, megasas_fusion_ocr_wq); in megasas_probe_one()
5504 INIT_WORK(&instance->crash_init, megasas_fusion_crash_dump_wq); in megasas_probe_one()
5506 INIT_WORK(&instance->work_init, process_fw_state_change_wq); in megasas_probe_one()
5511 if (megasas_init_fw(instance)) in megasas_probe_one()
5514 if (instance->requestorId) { in megasas_probe_one()
5515 if (instance->PlasmaFW111) { in megasas_probe_one()
5516 instance->vf_affiliation_111 = in megasas_probe_one()
5518 &instance->vf_affiliation_111_h); in megasas_probe_one()
5519 if (!instance->vf_affiliation_111) in megasas_probe_one()
5523 instance->vf_affiliation = in megasas_probe_one()
5527 &instance->vf_affiliation_h); in megasas_probe_one()
5528 if (!instance->vf_affiliation) in megasas_probe_one()
5537 pci_set_drvdata(pdev, instance); in megasas_probe_one()
5544 megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = instance; in megasas_probe_one()
5550 if (megasas_io_attach(instance)) in megasas_probe_one()
5553 instance->unload = 0; in megasas_probe_one()
5562 if (megasas_start_aen(instance)) { in megasas_probe_one()
5568 if (instance->requestorId) in megasas_probe_one()
5569 megasas_get_ld_vf_affiliation(instance, 1); in megasas_probe_one()
5576 megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = NULL; in megasas_probe_one()
5579 instance->instancet->disable_intr(instance); in megasas_probe_one()
5580 megasas_destroy_irqs(instance); in megasas_probe_one()
5582 if (instance->ctrl_context) in megasas_probe_one()
5583 megasas_release_fusion(instance); in megasas_probe_one()
5585 megasas_release_mfi(instance); in megasas_probe_one()
5586 if (instance->msix_vectors) in megasas_probe_one()
5587 pci_disable_msix(instance->pdev); in megasas_probe_one()
5590 if (instance->evt_detail) in megasas_probe_one()
5592 instance->evt_detail, in megasas_probe_one()
5593 instance->evt_detail_h); in megasas_probe_one()
5595 if (instance->producer) in megasas_probe_one()
5596 pci_free_consistent(pdev, sizeof(u32), instance->producer, in megasas_probe_one()
5597 instance->producer_h); in megasas_probe_one()
5598 if (instance->consumer) in megasas_probe_one()
5599 pci_free_consistent(pdev, sizeof(u32), instance->consumer, in megasas_probe_one()
5600 instance->consumer_h); in megasas_probe_one()
5614 static void megasas_flush_cache(struct megasas_instance *instance) in megasas_flush_cache() argument
5619 if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) in megasas_flush_cache()
5622 cmd = megasas_get_cmd(instance); in megasas_flush_cache()
5641 if (megasas_issue_blocked_cmd(instance, cmd, 30)) in megasas_flush_cache()
5642 dev_err(&instance->pdev->dev, "Command timedout" in megasas_flush_cache()
5645 megasas_return_cmd(instance, cmd); in megasas_flush_cache()
5653 static void megasas_shutdown_controller(struct megasas_instance *instance, in megasas_shutdown_controller() argument
5659 if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) in megasas_shutdown_controller()
5662 cmd = megasas_get_cmd(instance); in megasas_shutdown_controller()
5667 if (instance->aen_cmd) in megasas_shutdown_controller()
5668 megasas_issue_blocked_abort_cmd(instance, in megasas_shutdown_controller()
5669 instance->aen_cmd, MEGASAS_BLOCKED_CMD_TIMEOUT); in megasas_shutdown_controller()
5670 if (instance->map_update_cmd) in megasas_shutdown_controller()
5671 megasas_issue_blocked_abort_cmd(instance, in megasas_shutdown_controller()
5672 instance->map_update_cmd, MEGASAS_BLOCKED_CMD_TIMEOUT); in megasas_shutdown_controller()
5673 if (instance->jbod_seq_cmd) in megasas_shutdown_controller()
5674 megasas_issue_blocked_abort_cmd(instance, in megasas_shutdown_controller()
5675 instance->jbod_seq_cmd, MEGASAS_BLOCKED_CMD_TIMEOUT); in megasas_shutdown_controller()
5690 if (megasas_issue_blocked_cmd(instance, cmd, 30)) in megasas_shutdown_controller()
5691 dev_err(&instance->pdev->dev, "Command timedout" in megasas_shutdown_controller()
5694 megasas_return_cmd(instance, cmd); in megasas_shutdown_controller()
5707 struct megasas_instance *instance; in megasas_suspend() local
5709 instance = pci_get_drvdata(pdev); in megasas_suspend()
5710 host = instance->host; in megasas_suspend()
5711 instance->unload = 1; in megasas_suspend()
5714 if (instance->requestorId && !instance->skip_heartbeat_timer_del) in megasas_suspend()
5715 del_timer_sync(&instance->sriov_heartbeat_timer); in megasas_suspend()
5717 megasas_flush_cache(instance); in megasas_suspend()
5718 megasas_shutdown_controller(instance, MR_DCMD_HIBERNATE_SHUTDOWN); in megasas_suspend()
5721 if (instance->ev != NULL) { in megasas_suspend()
5722 struct megasas_aen_event *ev = instance->ev; in megasas_suspend()
5724 instance->ev = NULL; in megasas_suspend()
5727 tasklet_kill(&instance->isr_tasklet); in megasas_suspend()
5729 pci_set_drvdata(instance->pdev, instance); in megasas_suspend()
5730 instance->instancet->disable_intr(instance); in megasas_suspend()
5732 megasas_destroy_irqs(instance); in megasas_suspend()
5734 if (instance->msix_vectors) in megasas_suspend()
5735 pci_disable_msix(instance->pdev); in megasas_suspend()
5754 struct megasas_instance *instance; in megasas_resume() local
5756 instance = pci_get_drvdata(pdev); in megasas_resume()
5757 host = instance->host; in megasas_resume()
5781 atomic_set(&instance->fw_outstanding, 0); in megasas_resume()
5786 if (megasas_transition_to_ready(instance, 0)) in megasas_resume()
5790 if (instance->msix_vectors && in megasas_resume()
5791 pci_enable_msix_exact(instance->pdev, instance->msixentry, in megasas_resume()
5792 instance->msix_vectors)) in megasas_resume()
5795 if (instance->ctrl_context) { in megasas_resume()
5796 megasas_reset_reply_desc(instance); in megasas_resume()
5797 if (megasas_ioc_init_fusion(instance)) { in megasas_resume()
5798 megasas_free_cmds(instance); in megasas_resume()
5799 megasas_free_cmds_fusion(instance); in megasas_resume()
5802 if (!megasas_get_map_info(instance)) in megasas_resume()
5803 megasas_sync_map_info(instance); in megasas_resume()
5805 *instance->producer = 0; in megasas_resume()
5806 *instance->consumer = 0; in megasas_resume()
5807 if (megasas_issue_init_mfi(instance)) in megasas_resume()
5811 tasklet_init(&instance->isr_tasklet, instance->instancet->tasklet, in megasas_resume()
5812 (unsigned long)instance); in megasas_resume()
5814 if (instance->msix_vectors ? in megasas_resume()
5815 megasas_setup_irqs_msix(instance, 0) : in megasas_resume()
5816 megasas_setup_irqs_ioapic(instance)) in megasas_resume()
5820 if (instance->requestorId) { in megasas_resume()
5821 if (!megasas_sriov_start_heartbeat(instance, 0)) in megasas_resume()
5822 megasas_start_timer(instance, in megasas_resume()
5823 &instance->sriov_heartbeat_timer, in megasas_resume()
5827 instance->skip_heartbeat_timer_del = 1; in megasas_resume()
5832 instance->instancet->enable_intr(instance); in megasas_resume()
5833 megasas_setup_jbod_map(instance); in megasas_resume()
5834 instance->unload = 0; in megasas_resume()
5839 if (megasas_start_aen(instance)) in megasas_resume()
5840 dev_err(&instance->pdev->dev, "Start AEN failed\n"); in megasas_resume()
5845 if (instance->evt_detail) in megasas_resume()
5847 instance->evt_detail, in megasas_resume()
5848 instance->evt_detail_h); in megasas_resume()
5850 if (instance->producer) in megasas_resume()
5851 pci_free_consistent(pdev, sizeof(u32), instance->producer, in megasas_resume()
5852 instance->producer_h); in megasas_resume()
5853 if (instance->consumer) in megasas_resume()
5854 pci_free_consistent(pdev, sizeof(u32), instance->consumer, in megasas_resume()
5855 instance->consumer_h); in megasas_resume()
5879 struct megasas_instance *instance; in megasas_detach_one() local
5883 instance = pci_get_drvdata(pdev); in megasas_detach_one()
5884 instance->unload = 1; in megasas_detach_one()
5885 host = instance->host; in megasas_detach_one()
5886 fusion = instance->ctrl_context; in megasas_detach_one()
5889 if (instance->requestorId && !instance->skip_heartbeat_timer_del) in megasas_detach_one()
5890 del_timer_sync(&instance->sriov_heartbeat_timer); in megasas_detach_one()
5892 if (instance->fw_crash_state != UNAVAILABLE) in megasas_detach_one()
5893 megasas_free_host_crash_buffer(instance); in megasas_detach_one()
5894 scsi_remove_host(instance->host); in megasas_detach_one()
5895 megasas_flush_cache(instance); in megasas_detach_one()
5896 megasas_shutdown_controller(instance, MR_DCMD_CTRL_SHUTDOWN); in megasas_detach_one()
5899 if (instance->ev != NULL) { in megasas_detach_one()
5900 struct megasas_aen_event *ev = instance->ev; in megasas_detach_one()
5902 instance->ev = NULL; in megasas_detach_one()
5906 wake_up_all(&instance->int_cmd_wait_q); in megasas_detach_one()
5908 tasklet_kill(&instance->isr_tasklet); in megasas_detach_one()
5915 if (megasas_mgmt_info.instance[i] == instance) { in megasas_detach_one()
5917 megasas_mgmt_info.instance[i] = NULL; in megasas_detach_one()
5923 instance->instancet->disable_intr(instance); in megasas_detach_one()
5925 megasas_destroy_irqs(instance); in megasas_detach_one()
5927 if (instance->msix_vectors) in megasas_detach_one()
5928 pci_disable_msix(instance->pdev); in megasas_detach_one()
5930 if (instance->ctrl_context) { in megasas_detach_one()
5931 megasas_release_fusion(instance); in megasas_detach_one()
5937 dma_free_coherent(&instance->pdev->dev, in megasas_detach_one()
5945 dma_free_coherent(&instance->pdev->dev, in megasas_detach_one()
5950 free_pages((ulong)instance->ctrl_context, in megasas_detach_one()
5951 instance->ctrl_context_pages); in megasas_detach_one()
5953 megasas_release_mfi(instance); in megasas_detach_one()
5955 instance->producer, in megasas_detach_one()
5956 instance->producer_h); in megasas_detach_one()
5958 instance->consumer, in megasas_detach_one()
5959 instance->consumer_h); in megasas_detach_one()
5962 kfree(instance->ctrl_info); in megasas_detach_one()
5964 if (instance->evt_detail) in megasas_detach_one()
5966 instance->evt_detail, instance->evt_detail_h); in megasas_detach_one()
5968 if (instance->vf_affiliation) in megasas_detach_one()
5971 instance->vf_affiliation, in megasas_detach_one()
5972 instance->vf_affiliation_h); in megasas_detach_one()
5974 if (instance->vf_affiliation_111) in megasas_detach_one()
5977 instance->vf_affiliation_111, in megasas_detach_one()
5978 instance->vf_affiliation_111_h); in megasas_detach_one()
5980 if (instance->hb_host_mem) in megasas_detach_one()
5982 instance->hb_host_mem, in megasas_detach_one()
5983 instance->hb_host_mem_h); in megasas_detach_one()
5985 if (instance->crash_dump_buf) in megasas_detach_one()
5987 instance->crash_dump_buf, instance->crash_dump_h); in megasas_detach_one()
5989 if (instance->system_info_buf) in megasas_detach_one()
5991 instance->system_info_buf, instance->system_info_h); in megasas_detach_one()
6004 struct megasas_instance *instance = pci_get_drvdata(pdev); in megasas_shutdown() local
6006 instance->unload = 1; in megasas_shutdown()
6007 megasas_flush_cache(instance); in megasas_shutdown()
6008 megasas_shutdown_controller(instance, MR_DCMD_CTRL_SHUTDOWN); in megasas_shutdown()
6009 instance->instancet->disable_intr(instance); in megasas_shutdown()
6010 megasas_destroy_irqs(instance); in megasas_shutdown()
6012 if (instance->msix_vectors) in megasas_shutdown()
6013 pci_disable_msix(instance->pdev); in megasas_shutdown()
6091 local_instance = megasas_mgmt_info.instance[i]; in megasas_set_crash_dump_params_ioctl()
6120 megasas_mgmt_fw_ioctl(struct megasas_instance *instance, in megasas_mgmt_fw_ioctl() argument
6136 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SGE count [%d] > max limit [%d]\n", in megasas_mgmt_fw_ioctl()
6141 cmd = megasas_get_cmd(instance); in megasas_mgmt_fw_ioctl()
6143 dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to get a cmd packet\n"); in megasas_mgmt_fw_ioctl()
6162 megasas_return_cmd(instance, cmd); in megasas_mgmt_fw_ioctl()
6184 kbuff_arr[i] = dma_alloc_coherent(&instance->pdev->dev, in megasas_mgmt_fw_ioctl()
6188 dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to alloc " in megasas_mgmt_fw_ioctl()
6213 sense = dma_alloc_coherent(&instance->pdev->dev, ioc->sense_len, in megasas_mgmt_fw_ioctl()
6230 megasas_issue_blocked_cmd(instance, cmd, 0); in megasas_mgmt_fw_ioctl()
6233 if (instance->unload == 1) { in megasas_mgmt_fw_ioctl()
6234 dev_info(&instance->pdev->dev, "Driver unload is in progress " in megasas_mgmt_fw_ioctl()
6262 dev_err(&instance->pdev->dev, "Failed to copy out to user " in megasas_mgmt_fw_ioctl()
6274 dev_printk(KERN_DEBUG, &instance->pdev->dev, "Error copying out cmd_status\n"); in megasas_mgmt_fw_ioctl()
6280 dma_free_coherent(&instance->pdev->dev, ioc->sense_len, in megasas_mgmt_fw_ioctl()
6286 dma_free_coherent(&instance->pdev->dev, in megasas_mgmt_fw_ioctl()
6294 megasas_return_cmd(instance, cmd); in megasas_mgmt_fw_ioctl()
6303 struct megasas_instance *instance; in megasas_mgmt_ioctl_fw() local
6318 instance = megasas_lookup_instance(ioc->host_no); in megasas_mgmt_ioctl_fw()
6319 if (!instance) { in megasas_mgmt_ioctl_fw()
6325 if (instance->requestorId) in megasas_mgmt_ioctl_fw()
6329 if (instance->requestorId && !allow_vf_ioctls) { in megasas_mgmt_ioctl_fw()
6334 if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) { in megasas_mgmt_ioctl_fw()
6335 dev_err(&instance->pdev->dev, "Controller in crit error\n"); in megasas_mgmt_ioctl_fw()
6340 if (instance->unload == 1) { in megasas_mgmt_ioctl_fw()
6345 if (down_interruptible(&instance->ioctl_sem)) { in megasas_mgmt_ioctl_fw()
6352 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_mgmt_ioctl_fw()
6353 if (instance->adprecovery == MEGASAS_HBA_OPERATIONAL) { in megasas_mgmt_ioctl_fw()
6354 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_mgmt_ioctl_fw()
6357 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_mgmt_ioctl_fw()
6360 dev_notice(&instance->pdev->dev, "waiting" in megasas_mgmt_ioctl_fw()
6367 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_mgmt_ioctl_fw()
6368 if (instance->adprecovery != MEGASAS_HBA_OPERATIONAL) { in megasas_mgmt_ioctl_fw()
6369 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_mgmt_ioctl_fw()
6371 dev_err(&instance->pdev->dev, "timed out while" in megasas_mgmt_ioctl_fw()
6376 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_mgmt_ioctl_fw()
6378 error = megasas_mgmt_fw_ioctl(instance, user_ioc, ioc); in megasas_mgmt_ioctl_fw()
6380 up(&instance->ioctl_sem); in megasas_mgmt_ioctl_fw()
6389 struct megasas_instance *instance; in megasas_mgmt_ioctl_aen() local
6405 instance = megasas_lookup_instance(aen.host_no); in megasas_mgmt_ioctl_aen()
6407 if (!instance) in megasas_mgmt_ioctl_aen()
6410 if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) { in megasas_mgmt_ioctl_aen()
6414 if (instance->unload == 1) { in megasas_mgmt_ioctl_aen()
6420 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_mgmt_ioctl_aen()
6421 if (instance->adprecovery == MEGASAS_HBA_OPERATIONAL) { in megasas_mgmt_ioctl_aen()
6422 spin_unlock_irqrestore(&instance->hba_lock, in megasas_mgmt_ioctl_aen()
6427 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_mgmt_ioctl_aen()
6430 dev_notice(&instance->pdev->dev, "waiting for" in megasas_mgmt_ioctl_aen()
6437 spin_lock_irqsave(&instance->hba_lock, flags); in megasas_mgmt_ioctl_aen()
6438 if (instance->adprecovery != MEGASAS_HBA_OPERATIONAL) { in megasas_mgmt_ioctl_aen()
6439 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_mgmt_ioctl_aen()
6440 dev_err(&instance->pdev->dev, "timed out while waiting" in megasas_mgmt_ioctl_aen()
6444 spin_unlock_irqrestore(&instance->hba_lock, flags); in megasas_mgmt_ioctl_aen()
6446 mutex_lock(&instance->aen_mutex); in megasas_mgmt_ioctl_aen()
6447 error = megasas_register_aen(instance, aen.seq_num, in megasas_mgmt_ioctl_aen()
6449 mutex_unlock(&instance->aen_mutex); in megasas_mgmt_ioctl_aen()
6642 struct megasas_instance *instance = ev->instance; in megasas_aen_polling() local
6652 if (!instance) { in megasas_aen_polling()
6659 if (instance->requestorId) in megasas_aen_polling()
6664 if (instance->adprecovery == MEGASAS_HBA_OPERATIONAL) in megasas_aen_polling()
6667 dev_notice(&instance->pdev->dev, "%s waiting for " in megasas_aen_polling()
6669 __func__, instance->host->host_no); in megasas_aen_polling()
6674 instance->ev = NULL; in megasas_aen_polling()
6675 host = instance->host; in megasas_aen_polling()
6676 if (instance->evt_detail) { in megasas_aen_polling()
6677 megasas_decode_evt(instance); in megasas_aen_polling()
6679 switch (le32_to_cpu(instance->evt_detail->code)) { in megasas_aen_polling()
6681 if (megasas_get_pd_list(instance) == 0) { in megasas_aen_polling()
6692 if (instance->pd_list[pd_index].driveState in megasas_aen_polling()
6707 if (megasas_get_pd_list(instance) == 0) { in megasas_aen_polling()
6718 if (instance->pd_list[pd_index].driveState in megasas_aen_polling()
6737 if (!instance->requestorId || in megasas_aen_polling()
6738 megasas_get_ld_vf_affiliation(instance, 0)) { in megasas_aen_polling()
6739 if (megasas_ld_list_query(instance, in megasas_aen_polling()
6741 megasas_get_ld_list(instance); in megasas_aen_polling()
6752 if (instance->ld_ids[ld_index] in megasas_aen_polling()
6768 if (!instance->requestorId || in megasas_aen_polling()
6769 megasas_get_ld_vf_affiliation(instance, 0)) { in megasas_aen_polling()
6770 if (megasas_ld_list_query(instance, in megasas_aen_polling()
6772 megasas_get_ld_list(instance); in megasas_aen_polling()
6782 if (instance->ld_ids[ld_index] in megasas_aen_polling()
6800 megasas_get_ctrl_info(instance); in megasas_aen_polling()
6807 dev_err(&instance->pdev->dev, "invalid evt_detail!\n"); in megasas_aen_polling()
6813 dev_info(&instance->pdev->dev, "scanning for scsi%d...\n", in megasas_aen_polling()
6814 instance->host->host_no); in megasas_aen_polling()
6815 if (megasas_get_pd_list(instance) == 0) { in megasas_aen_polling()
6820 if (instance->pd_list[pd_index].driveState == in megasas_aen_polling()
6837 if (!instance->requestorId || in megasas_aen_polling()
6838 megasas_get_ld_vf_affiliation(instance, 0)) { in megasas_aen_polling()
6839 if (megasas_ld_list_query(instance, in megasas_aen_polling()
6841 megasas_get_ld_list(instance); in megasas_aen_polling()
6850 if (instance->ld_ids[ld_index] in megasas_aen_polling()
6867 if (instance->aen_cmd != NULL) { in megasas_aen_polling()
6872 seq_num = le32_to_cpu(instance->evt_detail->seq_num) + 1; in megasas_aen_polling()
6878 mutex_lock(&instance->aen_mutex); in megasas_aen_polling()
6879 error = megasas_register_aen(instance, seq_num, in megasas_aen_polling()
6881 mutex_unlock(&instance->aen_mutex); in megasas_aen_polling()
6884 dev_err(&instance->pdev->dev, "register aen failed error %x\n", error); in megasas_aen_polling()