Lines Matching refs:cmd
224 megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
239 wait_and_poll(struct megasas_instance *instance, struct megasas_cmd *cmd,
305 megasas_issue_dcmd(struct megasas_instance *instance, struct megasas_cmd *cmd) in megasas_issue_dcmd() argument
308 cmd->frame_phys_addr, 0, instance->reg_set); in megasas_issue_dcmd()
322 struct megasas_cmd *cmd = NULL; in megasas_get_cmd() local
327 cmd = list_entry((&instance->cmd_pool)->next, in megasas_get_cmd()
329 list_del_init(&cmd->list); in megasas_get_cmd()
335 return cmd; in megasas_get_cmd()
344 megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd) in megasas_return_cmd() argument
354 if (cmd->flags & DRV_DCMD_POLLED_MODE) in megasas_return_cmd()
360 blk_tags = instance->max_scsi_cmds + cmd->index; in megasas_return_cmd()
364 cmd->scmd = NULL; in megasas_return_cmd()
365 cmd->frame_count = 0; in megasas_return_cmd()
366 cmd->flags = 0; in megasas_return_cmd()
367 memset(cmd->frame, 0, instance->mfi_frame_size); in megasas_return_cmd()
368 cmd->frame->io.context = cpu_to_le32(cmd->index); in megasas_return_cmd()
370 cmd->frame->hdr.cmd = MFI_CMD_INVALID; in megasas_return_cmd()
371 list_add(&cmd->list, (&instance->cmd_pool)->next); in megasas_return_cmd()
1122 megasas_issue_polled(struct megasas_instance *instance, struct megasas_cmd *cmd) in megasas_issue_polled() argument
1124 struct megasas_header *frame_hdr = &cmd->frame->hdr; in megasas_issue_polled()
1135 instance->instancet->issue_dcmd(instance, cmd); in megasas_issue_polled()
1137 return wait_and_poll(instance, cmd, instance->requestorId ? in megasas_issue_polled()
1153 struct megasas_cmd *cmd, int timeout) in megasas_issue_blocked_cmd() argument
1156 cmd->cmd_status_drv = DCMD_INIT; in megasas_issue_blocked_cmd()
1164 instance->instancet->issue_dcmd(instance, cmd); in megasas_issue_blocked_cmd()
1168 cmd->cmd_status_drv != DCMD_INIT, timeout * HZ); in megasas_issue_blocked_cmd()
1172 cmd->frame->dcmd.opcode, __func__); in megasas_issue_blocked_cmd()
1177 cmd->cmd_status_drv != DCMD_INIT); in megasas_issue_blocked_cmd()
1179 return cmd->cmd_status_drv; in megasas_issue_blocked_cmd()
1197 struct megasas_cmd *cmd; in megasas_issue_blocked_abort_cmd() local
1202 cmd = megasas_get_cmd(instance); in megasas_issue_blocked_abort_cmd()
1204 if (!cmd) in megasas_issue_blocked_abort_cmd()
1207 abort_fr = &cmd->frame->abort; in megasas_issue_blocked_abort_cmd()
1212 abort_fr->cmd = MFI_CMD_ABORT; in megasas_issue_blocked_abort_cmd()
1221 cmd->sync_cmd = 1; in megasas_issue_blocked_abort_cmd()
1222 cmd->cmd_status_drv = DCMD_INIT; in megasas_issue_blocked_abort_cmd()
1230 instance->instancet->issue_dcmd(instance, cmd); in megasas_issue_blocked_abort_cmd()
1234 cmd->cmd_status_drv != DCMD_INIT, timeout * HZ); in megasas_issue_blocked_abort_cmd()
1244 cmd->cmd_status_drv != DCMD_INIT); in megasas_issue_blocked_abort_cmd()
1246 cmd->sync_cmd = 0; in megasas_issue_blocked_abort_cmd()
1248 megasas_return_cmd(instance, cmd); in megasas_issue_blocked_abort_cmd()
1249 return cmd->cmd_status_drv; in megasas_issue_blocked_abort_cmd()
1411 struct megasas_cmd *cmd) in megasas_build_dcdb() argument
1420 pthru = (struct megasas_pthru_frame *)cmd->frame; in megasas_build_dcdb()
1436 pthru->cmd = (is_logical) ? MFI_CMD_LD_SCSI_IO : MFI_CMD_PD_SCSI_IO; in megasas_build_dcdb()
1486 cpu_to_le32(upper_32_bits(cmd->sense_phys_addr)); in megasas_build_dcdb()
1488 cpu_to_le32(lower_32_bits(cmd->sense_phys_addr)); in megasas_build_dcdb()
1494 cmd->frame_count = megasas_get_frame_count(instance, pthru->sge_count, in megasas_build_dcdb()
1497 return cmd->frame_count; in megasas_build_dcdb()
1510 struct megasas_cmd *cmd) in megasas_build_ldio() argument
1518 ldio = (struct megasas_io_frame *)cmd->frame; in megasas_build_ldio()
1532 ldio->cmd = (sc & 0x02) ? MFI_CMD_LD_WRITE : MFI_CMD_LD_READ; in megasas_build_ldio()
1627 ldio->sense_buf_phys_addr_lo = cpu_to_le32(cmd->sense_phys_addr); in megasas_build_ldio()
1633 cmd->frame_count = megasas_get_frame_count(instance, in megasas_build_ldio()
1636 return cmd->frame_count; in megasas_build_ldio()
1645 inline int megasas_cmd_type(struct scsi_cmnd *cmd) in megasas_cmd_type() argument
1649 switch (cmd->cmnd[0]) { in megasas_cmd_type()
1658 ret = (MEGASAS_IS_LOGICAL(cmd->device)) ? in megasas_cmd_type()
1662 ret = (MEGASAS_IS_LOGICAL(cmd->device)) ? in megasas_cmd_type()
1676 struct megasas_cmd *cmd; in megasas_dump_pending_frames() local
1693 cmd = instance->cmd_list[i]; in megasas_dump_pending_frames()
1694 if (!cmd->scmd) in megasas_dump_pending_frames()
1696 …->dev, "[%d]: Frame addr :0x%08lx : ",instance->host->host_no,(unsigned long)cmd->frame_phys_addr); in megasas_dump_pending_frames()
1697 if (megasas_cmd_type(cmd->scmd) == READ_WRITE_LDIO) { in megasas_dump_pending_frames()
1698 ldio = (struct megasas_io_frame *)cmd->frame; in megasas_dump_pending_frames()
1703 instance->host->host_no, cmd->frame_count, ldio->cmd, ldio->target_id, in megasas_dump_pending_frames()
1707 pthru = (struct megasas_pthru_frame *) cmd->frame; in megasas_dump_pending_frames()
1712 instance->host->host_no, cmd->frame_count, pthru->cmd, pthru->target_id, in megasas_dump_pending_frames()
1732 cmd = instance->cmd_list[i]; in megasas_dump_pending_frames()
1734 if (cmd->sync_cmd == 1) in megasas_dump_pending_frames()
1735 dev_err(&instance->pdev->dev, "0x%08lx : ", (unsigned long)cmd->frame_phys_addr); in megasas_dump_pending_frames()
1744 struct megasas_cmd *cmd; in megasas_build_and_issue_cmd() local
1747 cmd = megasas_get_cmd(instance); in megasas_build_and_issue_cmd()
1748 if (!cmd) in megasas_build_and_issue_cmd()
1755 frame_count = megasas_build_ldio(instance, scmd, cmd); in megasas_build_and_issue_cmd()
1757 frame_count = megasas_build_dcdb(instance, scmd, cmd); in megasas_build_and_issue_cmd()
1762 cmd->scmd = scmd; in megasas_build_and_issue_cmd()
1763 megasas_priv(scmd)->cmd_priv = cmd; in megasas_build_and_issue_cmd()
1770 instance->instancet->fire_cmd(instance, cmd->frame_phys_addr, in megasas_build_and_issue_cmd()
1771 cmd->frame_count-1, instance->reg_set); in megasas_build_and_issue_cmd()
1775 megasas_return_cmd(instance, cmd); in megasas_build_and_issue_cmd()
2197 (cmd_mfi->frame->hdr.cmd != MFI_CMD_ABORT)) { in megasas_complete_outstanding_ioctls()
2208 if (cmd_mfi->sync_cmd && cmd_mfi->frame->hdr.cmd != in megasas_complete_outstanding_ioctls()
2281 struct megasas_cmd *cmd; in megasas_complete_cmd_dpc() local
2303 cmd = instance->cmd_list[context]; in megasas_complete_cmd_dpc()
2305 megasas_complete_cmd(instance, cmd, DID_OK); in megasas_complete_cmd_dpc()
2364 struct megasas_cmd *cmd; in megasas_get_ld_vf_affiliation_111() local
2371 cmd = megasas_get_cmd(instance); in megasas_get_ld_vf_affiliation_111()
2373 if (!cmd) { in megasas_get_ld_vf_affiliation_111()
2380 dcmd = &cmd->frame->dcmd; in megasas_get_ld_vf_affiliation_111()
2385 megasas_return_cmd(instance, cmd); in megasas_get_ld_vf_affiliation_111()
2401 megasas_return_cmd(instance, cmd); in megasas_get_ld_vf_affiliation_111()
2408 dcmd->cmd = MFI_CMD_DCMD; in megasas_get_ld_vf_affiliation_111()
2431 if (megasas_issue_blocked_cmd(instance, cmd, 0) != DCMD_SUCCESS) { in megasas_get_ld_vf_affiliation_111()
2462 megasas_return_cmd(instance, cmd); in megasas_get_ld_vf_affiliation_111()
2470 struct megasas_cmd *cmd; in megasas_get_ld_vf_affiliation_12() local
2478 cmd = megasas_get_cmd(instance); in megasas_get_ld_vf_affiliation_12()
2480 if (!cmd) { in megasas_get_ld_vf_affiliation_12()
2487 dcmd = &cmd->frame->dcmd; in megasas_get_ld_vf_affiliation_12()
2492 megasas_return_cmd(instance, cmd); in megasas_get_ld_vf_affiliation_12()
2508 megasas_return_cmd(instance, cmd); in megasas_get_ld_vf_affiliation_12()
2515 dcmd->cmd = MFI_CMD_DCMD; in megasas_get_ld_vf_affiliation_12()
2539 if (megasas_issue_blocked_cmd(instance, cmd, 0) != DCMD_SUCCESS) { in megasas_get_ld_vf_affiliation_12()
2627 megasas_return_cmd(instance, cmd); in megasas_get_ld_vf_affiliation_12()
2649 struct megasas_cmd *cmd; in megasas_sriov_start_heartbeat() local
2653 cmd = megasas_get_cmd(instance); in megasas_sriov_start_heartbeat()
2655 if (!cmd) { in megasas_sriov_start_heartbeat()
2662 dcmd = &cmd->frame->dcmd; in megasas_sriov_start_heartbeat()
2682 dcmd->cmd = MFI_CMD_DCMD; in megasas_sriov_start_heartbeat()
2699 retval = megasas_issue_blocked_cmd(instance, cmd, in megasas_sriov_start_heartbeat()
2702 retval = megasas_issue_polled(instance, cmd); in megasas_sriov_start_heartbeat()
2713 megasas_return_cmd(instance, cmd); in megasas_sriov_start_heartbeat()
3001 struct megasas_cmd_fusion *cmd = megasas_priv(scmd)->cmd_priv; in megasas_dump_fusion_io() local
3012 if (cmd) { in megasas_dump_fusion_io()
3013 req_desc = (union MEGASAS_REQUEST_DESCRIPTOR_UNION *)cmd->request_desc; in megasas_dump_fusion_io()
3022 megasas_dump(cmd->io_request, in megasas_dump_fusion_io()
3025 megasas_dump(cmd->sg_frame, in megasas_dump_fusion_io()
3228 megasas_service_aen(struct megasas_instance *instance, struct megasas_cmd *cmd) in megasas_service_aen() argument
3235 if ((!cmd->abort_aen) && (instance->unload == 0)) { in megasas_service_aen()
3243 cmd->abort_aen = 0; in megasas_service_aen()
3247 megasas_return_cmd(instance, cmd); in megasas_service_aen()
3538 struct megasas_cmd *cmd) in megasas_complete_int_cmd() argument
3540 if (cmd->cmd_status_drv == DCMD_INIT) in megasas_complete_int_cmd()
3541 cmd->cmd_status_drv = in megasas_complete_int_cmd()
3542 (cmd->frame->io.cmd_status == MFI_STAT_OK) ? in megasas_complete_int_cmd()
3559 struct megasas_cmd *cmd) in megasas_complete_abort() argument
3561 if (cmd->sync_cmd) { in megasas_complete_abort()
3562 cmd->sync_cmd = 0; in megasas_complete_abort()
3563 cmd->cmd_status_drv = DCMD_SUCCESS; in megasas_complete_abort()
3595 megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, in megasas_complete_cmd() argument
3599 struct megasas_header *hdr = &cmd->frame->hdr; in megasas_complete_cmd()
3605 cmd->retry_for_fw_reset = 0; in megasas_complete_cmd()
3607 if (cmd->scmd) in megasas_complete_cmd()
3608 megasas_priv(cmd->scmd)->cmd_priv = NULL; in megasas_complete_cmd()
3610 switch (hdr->cmd) { in megasas_complete_cmd()
3629 if (cmd->sync_cmd) { in megasas_complete_cmd()
3630 cmd->sync_cmd = 0; in megasas_complete_cmd()
3631 megasas_complete_int_cmd(instance, cmd); in megasas_complete_cmd()
3640 cmd->scmd->result = alt_status << 16; in megasas_complete_cmd()
3648 scsi_dma_unmap(cmd->scmd); in megasas_complete_cmd()
3649 scsi_done(cmd->scmd); in megasas_complete_cmd()
3650 megasas_return_cmd(instance, cmd); in megasas_complete_cmd()
3658 cmd->scmd->result = DID_OK << 16; in megasas_complete_cmd()
3663 cmd->scmd->result = in megasas_complete_cmd()
3669 cmd->scmd->result = (DID_OK << 16) | hdr->scsi_status; in megasas_complete_cmd()
3672 memset(cmd->scmd->sense_buffer, 0, in megasas_complete_cmd()
3674 memcpy(cmd->scmd->sense_buffer, cmd->sense, in megasas_complete_cmd()
3682 cmd->scmd->result = DID_BAD_TARGET << 16; in megasas_complete_cmd()
3688 cmd->scmd->result = DID_ERROR << 16; in megasas_complete_cmd()
3694 scsi_dma_unmap(cmd->scmd); in megasas_complete_cmd()
3695 scsi_done(cmd->scmd); in megasas_complete_cmd()
3696 megasas_return_cmd(instance, cmd); in megasas_complete_cmd()
3704 megasas_complete_int_cmd(instance, cmd); in megasas_complete_cmd()
3708 opcode = le32_to_cpu(cmd->frame->dcmd.opcode); in megasas_complete_cmd()
3711 && (cmd->frame->dcmd.mbox.b[1] == 1)) { in megasas_complete_cmd()
3714 status = cmd->frame->hdr.cmd_status; in megasas_complete_cmd()
3719 cmd->frame->hdr.cmd_status); in megasas_complete_cmd()
3721 megasas_return_cmd(instance, cmd); in megasas_complete_cmd()
3729 megasas_return_cmd(instance, cmd); in megasas_complete_cmd()
3762 (cmd->frame->dcmd.mbox.b[0] == 1)) { in megasas_complete_cmd()
3765 status = cmd->frame->hdr.cmd_status; in megasas_complete_cmd()
3767 megasas_return_cmd(instance, cmd); in megasas_complete_cmd()
3785 megasas_service_aen(instance, cmd); in megasas_complete_cmd()
3787 megasas_complete_int_cmd(instance, cmd); in megasas_complete_cmd()
3795 megasas_complete_abort(instance, cmd); in megasas_complete_cmd()
3800 hdr->cmd); in megasas_complete_cmd()
3801 megasas_complete_int_cmd(instance, cmd); in megasas_complete_cmd()
3814 struct megasas_cmd *cmd; in megasas_issue_pending_cmds_again() local
3826 cmd = list_entry((&clist_local)->next, in megasas_issue_pending_cmds_again()
3828 list_del_init(&cmd->list); in megasas_issue_pending_cmds_again()
3830 if (cmd->sync_cmd || cmd->scmd) { in megasas_issue_pending_cmds_again()
3833 cmd, cmd->scmd, cmd->sync_cmd); in megasas_issue_pending_cmds_again()
3835 cmd->retry_for_fw_reset++; in megasas_issue_pending_cmds_again()
3837 if (cmd->retry_for_fw_reset == 3) { in megasas_issue_pending_cmds_again()
3841 cmd, cmd->scmd, cmd->sync_cmd); in megasas_issue_pending_cmds_again()
3849 if (cmd->sync_cmd == 1) { in megasas_issue_pending_cmds_again()
3850 if (cmd->scmd) { in megasas_issue_pending_cmds_again()
3856 "issue it again.\n", cmd); in megasas_issue_pending_cmds_again()
3857 cmd->cmd_status_drv = DCMD_INIT; in megasas_issue_pending_cmds_again()
3859 cmd->frame_phys_addr, in megasas_issue_pending_cmds_again()
3861 } else if (cmd->scmd) { in megasas_issue_pending_cmds_again()
3864 cmd, cmd->scmd->cmnd[0]); in megasas_issue_pending_cmds_again()
3868 cmd->frame_phys_addr, in megasas_issue_pending_cmds_again()
3869 cmd->frame_count-1, instance->reg_set); in megasas_issue_pending_cmds_again()
3873 cmd); in megasas_issue_pending_cmds_again()
3907 struct megasas_cmd *cmd; in megasas_internal_reset_defer_cmds() local
3916 cmd = instance->cmd_list[i]; in megasas_internal_reset_defer_cmds()
3917 if (cmd->sync_cmd == 1 || cmd->scmd) { in megasas_internal_reset_defer_cmds()
3920 defer_index, cmd, cmd->sync_cmd, cmd->scmd); in megasas_internal_reset_defer_cmds()
3922 if (!list_empty(&cmd->list)) { in megasas_internal_reset_defer_cmds()
3926 cmd, cmd->sync_cmd, cmd->scmd); in megasas_internal_reset_defer_cmds()
3928 list_del_init(&cmd->list); in megasas_internal_reset_defer_cmds()
3931 list_add_tail(&cmd->list, in megasas_internal_reset_defer_cmds()
4287 struct megasas_cmd *cmd; in megasas_teardown_frame_pool() local
4297 cmd = instance->cmd_list[i]; in megasas_teardown_frame_pool()
4299 if (cmd->frame) in megasas_teardown_frame_pool()
4300 dma_pool_free(instance->frame_dma_pool, cmd->frame, in megasas_teardown_frame_pool()
4301 cmd->frame_phys_addr); in megasas_teardown_frame_pool()
4303 if (cmd->sense) in megasas_teardown_frame_pool()
4304 dma_pool_free(instance->sense_dma_pool, cmd->sense, in megasas_teardown_frame_pool()
4305 cmd->sense_phys_addr); in megasas_teardown_frame_pool()
4332 struct megasas_cmd *cmd; in megasas_create_frame_pool() local
4382 cmd = instance->cmd_list[i]; in megasas_create_frame_pool()
4384 cmd->frame = dma_pool_zalloc(instance->frame_dma_pool, in megasas_create_frame_pool()
4385 GFP_KERNEL, &cmd->frame_phys_addr); in megasas_create_frame_pool()
4387 cmd->sense = dma_pool_alloc(instance->sense_dma_pool, in megasas_create_frame_pool()
4388 GFP_KERNEL, &cmd->sense_phys_addr); in megasas_create_frame_pool()
4394 if (!cmd->frame || !cmd->sense) { in megasas_create_frame_pool()
4400 cmd->frame->io.context = cpu_to_le32(cmd->index); in megasas_create_frame_pool()
4401 cmd->frame->io.pad_0 = 0; in megasas_create_frame_pool()
4403 cmd->frame->hdr.cmd = MFI_CMD_INVALID; in megasas_create_frame_pool()
4455 struct megasas_cmd *cmd; in megasas_alloc_cmds() local
4488 cmd = instance->cmd_list[i]; in megasas_alloc_cmds()
4489 memset(cmd, 0, sizeof(struct megasas_cmd)); in megasas_alloc_cmds()
4490 cmd->index = i; in megasas_alloc_cmds()
4491 cmd->scmd = NULL; in megasas_alloc_cmds()
4492 cmd->instance = instance; in megasas_alloc_cmds()
4494 list_add_tail(&cmd->list, &instance->cmd_pool); in megasas_alloc_cmds()
4533 struct megasas_cmd *cmd; in megasas_get_pd_info() local
4540 cmd = megasas_get_cmd(instance); in megasas_get_pd_info()
4542 if (!cmd) { in megasas_get_pd_info()
4547 dcmd = &cmd->frame->dcmd; in megasas_get_pd_info()
4553 dcmd->cmd = MFI_CMD_DCMD; in megasas_get_pd_info()
4567 ret = megasas_issue_blocked_cmd(instance, cmd, MFI_IO_TIMEOUT_SECS); in megasas_get_pd_info()
4569 ret = megasas_issue_polled(instance, cmd); in megasas_get_pd_info()
4583 cmd->flags |= DRV_DCMD_SKIP_REFIRE; in megasas_get_pd_info()
4602 megasas_return_cmd(instance, cmd); in megasas_get_pd_info()
4619 struct megasas_cmd *cmd; in megasas_get_pd_list() local
4632 cmd = megasas_get_cmd(instance); in megasas_get_pd_list()
4634 if (!cmd) { in megasas_get_pd_list()
4639 dcmd = &cmd->frame->dcmd; in megasas_get_pd_list()
4646 dcmd->cmd = MFI_CMD_DCMD; in megasas_get_pd_list()
4660 ret = megasas_issue_blocked_cmd(instance, cmd, in megasas_get_pd_list()
4663 ret = megasas_issue_polled(instance, cmd); in megasas_get_pd_list()
4679 cmd->flags |= DRV_DCMD_SKIP_REFIRE; in megasas_get_pd_list()
4736 megasas_return_cmd(instance, cmd); in megasas_get_pd_list()
4754 struct megasas_cmd *cmd; in megasas_get_ld_list() local
4763 cmd = megasas_get_cmd(instance); in megasas_get_ld_list()
4765 if (!cmd) { in megasas_get_ld_list()
4770 dcmd = &cmd->frame->dcmd; in megasas_get_ld_list()
4777 dcmd->cmd = MFI_CMD_DCMD; in megasas_get_ld_list()
4791 ret = megasas_issue_blocked_cmd(instance, cmd, in megasas_get_ld_list()
4794 ret = megasas_issue_polled(instance, cmd); in megasas_get_ld_list()
4806 cmd->flags |= DRV_DCMD_SKIP_REFIRE; in megasas_get_ld_list()
4853 megasas_return_cmd(instance, cmd); in megasas_get_ld_list()
4871 struct megasas_cmd *cmd; in megasas_ld_list_query() local
4880 cmd = megasas_get_cmd(instance); in megasas_ld_list_query()
4882 if (!cmd) { in megasas_ld_list_query()
4888 dcmd = &cmd->frame->dcmd; in megasas_ld_list_query()
4897 dcmd->cmd = MFI_CMD_DCMD; in megasas_ld_list_query()
4911 ret = megasas_issue_blocked_cmd(instance, cmd, MFI_IO_TIMEOUT_SECS); in megasas_ld_list_query()
4913 ret = megasas_issue_polled(instance, cmd); in megasas_ld_list_query()
4925 cmd->flags |= DRV_DCMD_SKIP_REFIRE; in megasas_ld_list_query()
4969 megasas_return_cmd(instance, cmd); in megasas_ld_list_query()
4993 struct megasas_cmd *cmd; in megasas_host_device_list_query() local
5002 cmd = megasas_get_cmd(instance); in megasas_host_device_list_query()
5004 if (!cmd) { in megasas_host_device_list_query()
5011 dcmd = &cmd->frame->dcmd; in megasas_host_device_list_query()
5017 dcmd->cmd = MFI_CMD_DCMD; in megasas_host_device_list_query()
5029 ret = megasas_issue_blocked_cmd(instance, cmd, in megasas_host_device_list_query()
5032 ret = megasas_issue_polled(instance, cmd); in megasas_host_device_list_query()
5033 cmd->flags |= DRV_DCMD_SKIP_REFIRE; in megasas_host_device_list_query()
5081 cmd->flags |= DRV_DCMD_SKIP_REFIRE; in megasas_host_device_list_query()
5104 megasas_return_cmd(instance, cmd); in megasas_host_device_list_query()
5179 struct megasas_cmd *cmd; in megasas_get_snapdump_properties() local
5190 cmd = megasas_get_cmd(instance); in megasas_get_snapdump_properties()
5192 if (!cmd) { in megasas_get_snapdump_properties()
5197 dcmd = &cmd->frame->dcmd; in megasas_get_snapdump_properties()
5202 dcmd->cmd = MFI_CMD_DCMD; in megasas_get_snapdump_properties()
5215 ret = megasas_issue_blocked_cmd(instance, cmd, in megasas_get_snapdump_properties()
5218 ret = megasas_issue_polled(instance, cmd); in megasas_get_snapdump_properties()
5219 cmd->flags |= DRV_DCMD_SKIP_REFIRE; in megasas_get_snapdump_properties()
5232 cmd->flags |= DRV_DCMD_SKIP_REFIRE; in megasas_get_snapdump_properties()
5249 megasas_return_cmd(instance, cmd); in megasas_get_snapdump_properties()
5264 struct megasas_cmd *cmd; in megasas_get_ctrl_info() local
5272 cmd = megasas_get_cmd(instance); in megasas_get_ctrl_info()
5274 if (!cmd) { in megasas_get_ctrl_info()
5279 dcmd = &cmd->frame->dcmd; in megasas_get_ctrl_info()
5284 dcmd->cmd = MFI_CMD_DCMD; in megasas_get_ctrl_info()
5299 ret = megasas_issue_blocked_cmd(instance, cmd, MFI_IO_TIMEOUT_SECS); in megasas_get_ctrl_info()
5301 ret = megasas_issue_polled(instance, cmd); in megasas_get_ctrl_info()
5302 cmd->flags |= DRV_DCMD_SKIP_REFIRE; in megasas_get_ctrl_info()
5372 cmd->flags |= DRV_DCMD_SKIP_REFIRE; in megasas_get_ctrl_info()
5394 megasas_return_cmd(instance, cmd); in megasas_get_ctrl_info()
5418 struct megasas_cmd *cmd; in megasas_set_crash_dump_params() local
5421 cmd = megasas_get_cmd(instance); in megasas_set_crash_dump_params()
5423 if (!cmd) { in megasas_set_crash_dump_params()
5429 dcmd = &cmd->frame->dcmd; in megasas_set_crash_dump_params()
5433 dcmd->cmd = MFI_CMD_DCMD; in megasas_set_crash_dump_params()
5447 ret = megasas_issue_blocked_cmd(instance, cmd, MFI_IO_TIMEOUT_SECS); in megasas_set_crash_dump_params()
5449 ret = megasas_issue_polled(instance, cmd); in megasas_set_crash_dump_params()
5454 cmd->flags |= DRV_DCMD_SKIP_REFIRE; in megasas_set_crash_dump_params()
5467 megasas_return_cmd(instance, cmd); in megasas_set_crash_dump_params()
5482 struct megasas_cmd *cmd; in megasas_issue_init_mfi() local
5496 cmd = megasas_get_cmd(instance); in megasas_issue_init_mfi()
5498 init_frame = (struct megasas_init_frame *)cmd->frame; in megasas_issue_init_mfi()
5502 init_frame_h = cmd->frame_phys_addr; in megasas_issue_init_mfi()
5516 init_frame->cmd = MFI_CMD_INIT; in megasas_issue_init_mfi()
5534 if (megasas_issue_polled(instance, cmd)) { in megasas_issue_init_mfi()
5536 megasas_return_cmd(instance, cmd); in megasas_issue_init_mfi()
5540 megasas_return_cmd(instance, cmd); in megasas_issue_init_mfi()
6579 struct megasas_cmd *cmd; in megasas_get_seq_num() local
6585 cmd = megasas_get_cmd(instance); in megasas_get_seq_num()
6587 if (!cmd) { in megasas_get_seq_num()
6591 dcmd = &cmd->frame->dcmd; in megasas_get_seq_num()
6596 megasas_return_cmd(instance, cmd); in megasas_get_seq_num()
6602 dcmd->cmd = MFI_CMD_DCMD; in megasas_get_seq_num()
6614 ret = megasas_issue_blocked_cmd(instance, cmd, MFI_IO_TIMEOUT_SECS); in megasas_get_seq_num()
6635 megasas_return_cmd(instance, cmd); in megasas_get_seq_num()
6654 struct megasas_cmd *cmd; in megasas_register_aen() local
6724 cmd = megasas_get_cmd(instance); in megasas_register_aen()
6726 if (!cmd) in megasas_register_aen()
6729 dcmd = &cmd->frame->dcmd; in megasas_register_aen()
6738 dcmd->cmd = MFI_CMD_DCMD; in megasas_register_aen()
6754 megasas_return_cmd(instance, cmd); in megasas_register_aen()
6763 instance->aen_cmd = cmd; in megasas_register_aen()
6768 instance->instancet->issue_dcmd(instance, cmd); in megasas_register_aen()
6796 struct megasas_cmd *cmd; in megasas_get_target_prop() local
6801 cmd = megasas_get_cmd(instance); in megasas_get_target_prop()
6803 if (!cmd) { in megasas_get_target_prop()
6809 dcmd = &cmd->frame->dcmd; in megasas_get_target_prop()
6816 dcmd->cmd = MFI_CMD_DCMD; in megasas_get_target_prop()
6832 cmd, MFI_IO_TIMEOUT_SECS); in megasas_get_target_prop()
6834 ret = megasas_issue_polled(instance, cmd); in megasas_get_target_prop()
6840 cmd->flags |= DRV_DCMD_SKIP_REFIRE; in megasas_get_target_prop()
6858 megasas_return_cmd(instance, cmd); in megasas_get_target_prop()
7637 struct megasas_cmd *cmd; in megasas_flush_cache() local
7643 cmd = megasas_get_cmd(instance); in megasas_flush_cache()
7645 if (!cmd) in megasas_flush_cache()
7648 dcmd = &cmd->frame->dcmd; in megasas_flush_cache()
7652 dcmd->cmd = MFI_CMD_DCMD; in megasas_flush_cache()
7662 if (megasas_issue_blocked_cmd(instance, cmd, MFI_IO_TIMEOUT_SECS) in megasas_flush_cache()
7669 megasas_return_cmd(instance, cmd); in megasas_flush_cache()
7680 struct megasas_cmd *cmd; in megasas_shutdown_controller() local
7686 cmd = megasas_get_cmd(instance); in megasas_shutdown_controller()
7688 if (!cmd) in megasas_shutdown_controller()
7701 dcmd = &cmd->frame->dcmd; in megasas_shutdown_controller()
7705 dcmd->cmd = MFI_CMD_DCMD; in megasas_shutdown_controller()
7714 if (megasas_issue_blocked_cmd(instance, cmd, MFI_IO_TIMEOUT_SECS) in megasas_shutdown_controller()
7721 megasas_return_cmd(instance, cmd); in megasas_shutdown_controller()
8187 static int megasas_set_crash_dump_params_ioctl(struct megasas_cmd *cmd) in megasas_set_crash_dump_params_ioctl() argument
8193 crash_support = cmd->frame->dcmd.mbox.w[0]; in megasas_set_crash_dump_params_ioctl()
8232 struct megasas_cmd *cmd; in megasas_mgmt_fw_ioctl() local
8250 if ((ioc->frame.hdr.cmd >= MFI_CMD_OP_COUNT) || in megasas_mgmt_fw_ioctl()
8251 ((ioc->frame.hdr.cmd == MFI_CMD_NVME) && in megasas_mgmt_fw_ioctl()
8253 ((ioc->frame.hdr.cmd == MFI_CMD_TOOLBOX) && in megasas_mgmt_fw_ioctl()
8257 ioc->frame.hdr.cmd); in megasas_mgmt_fw_ioctl()
8261 cmd = megasas_get_cmd(instance); in megasas_mgmt_fw_ioctl()
8262 if (!cmd) { in megasas_mgmt_fw_ioctl()
8273 memcpy(cmd->frame, ioc->frame.raw, 2 * MEGAMFI_FRAME_SIZE); in megasas_mgmt_fw_ioctl()
8274 cmd->frame->hdr.context = cpu_to_le32(cmd->index); in megasas_mgmt_fw_ioctl()
8275 cmd->frame->hdr.pad_0 = 0; in megasas_mgmt_fw_ioctl()
8277 cmd->frame->hdr.flags &= (~MFI_FRAME_IEEE); in megasas_mgmt_fw_ioctl()
8280 cmd->frame->hdr.flags |= cpu_to_le16((MFI_FRAME_SGL64 | in megasas_mgmt_fw_ioctl()
8283 cmd->frame->hdr.flags &= cpu_to_le16(~(MFI_FRAME_SGL64 | in megasas_mgmt_fw_ioctl()
8286 if (cmd->frame->hdr.cmd == MFI_CMD_DCMD) in megasas_mgmt_fw_ioctl()
8287 opcode = le32_to_cpu(cmd->frame->dcmd.opcode); in megasas_mgmt_fw_ioctl()
8292 megasas_return_cmd(instance, cmd); in megasas_mgmt_fw_ioctl()
8300 error = megasas_set_crash_dump_params_ioctl(cmd); in megasas_mgmt_fw_ioctl()
8301 megasas_return_cmd(instance, cmd); in megasas_mgmt_fw_ioctl()
8315 ((unsigned long)cmd->frame + ioc->sgl_off); in megasas_mgmt_fw_ioctl()
8318 ((unsigned long)cmd->frame + ioc->sgl_off); in megasas_mgmt_fw_ioctl()
8376 sense_ptr = (void *)cmd->frame + ioc->sense_off; in megasas_mgmt_fw_ioctl()
8384 cmd->sync_cmd = 1; in megasas_mgmt_fw_ioctl()
8386 ret = megasas_issue_blocked_cmd(instance, cmd, 0); in megasas_mgmt_fw_ioctl()
8390 cmd->sync_cmd = 0; in megasas_mgmt_fw_ioctl()
8393 __func__, __LINE__, cmd->frame->hdr.cmd, opcode, in megasas_mgmt_fw_ioctl()
8394 cmd->cmd_status_drv); in megasas_mgmt_fw_ioctl()
8399 cmd->sync_cmd = 0; in megasas_mgmt_fw_ioctl()
8445 &cmd->frame->hdr.cmd_status, sizeof(u8))) { in megasas_mgmt_fw_ioctl()
8472 megasas_return_cmd(instance, cmd); in megasas_mgmt_fw_ioctl()
8611 megasas_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) in megasas_mgmt_ioctl() argument
8613 switch (cmd) { in megasas_mgmt_ioctl()
8626 megasas_mgmt_compat_ioctl(struct file *file, unsigned int cmd, in megasas_mgmt_compat_ioctl() argument
8629 switch (cmd) { in megasas_mgmt_compat_ioctl()