Lines Matching refs:cmd
129 static struct sas_task *sas_create_task(struct scsi_cmnd *cmd, in sas_create_task() argument
139 task->uldd_task = cmd; in sas_create_task()
140 ASSIGN_SAS_TASK(cmd, task); in sas_create_task()
145 int_to_scsilun(cmd->device->lun, &lun); in sas_create_task()
148 task->ssp_task.cmd = cmd; in sas_create_task()
150 task->scatter = scsi_sglist(cmd); in sas_create_task()
151 task->num_scatter = scsi_sg_count(cmd); in sas_create_task()
152 task->total_xfer_len = scsi_bufflen(cmd); in sas_create_task()
153 task->data_dir = cmd->sc_data_direction; in sas_create_task()
160 int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) in sas_queuecommand() argument
163 struct domain_device *dev = cmd_to_domain_dev(cmd); in sas_queuecommand()
169 cmd->result = DID_BAD_TARGET << 16; in sas_queuecommand()
175 res = ata_sas_queuecmd(cmd, dev->sata_dev.ap); in sas_queuecommand()
180 task = sas_create_task(cmd, dev, GFP_ATOMIC); in sas_queuecommand()
191 ASSIGN_SAS_TASK(cmd, NULL); in sas_queuecommand()
194 cmd->result = DID_SOFT_ERROR << 16; /* retry */ in sas_queuecommand()
196 cmd->result = DID_ERROR << 16; in sas_queuecommand()
198 scsi_done(cmd); in sas_queuecommand()
203 static void sas_eh_finish_cmd(struct scsi_cmnd *cmd) in sas_eh_finish_cmd() argument
205 struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(cmd->device->host); in sas_eh_finish_cmd()
206 struct domain_device *dev = cmd_to_domain_dev(cmd); in sas_eh_finish_cmd()
207 struct sas_task *task = TO_SAS_TASK(cmd); in sas_eh_finish_cmd()
213 sas_end_task(cmd, task); in sas_eh_finish_cmd()
219 list_move_tail(&cmd->eh_entry, &sas_ha->eh_ata_q); in sas_eh_finish_cmd()
227 scsi_eh_finish_cmd(cmd, &sas_ha->eh_done_q); in sas_eh_finish_cmd()
232 struct scsi_cmnd *cmd, *n; in sas_scsi_clear_queue_lu() local
234 list_for_each_entry_safe(cmd, n, error_q, eh_entry) { in sas_scsi_clear_queue_lu()
235 if (cmd->device->sdev_target == my_cmd->device->sdev_target && in sas_scsi_clear_queue_lu()
236 cmd->device->lun == my_cmd->device->lun) in sas_scsi_clear_queue_lu()
237 sas_eh_finish_cmd(cmd); in sas_scsi_clear_queue_lu()
244 struct scsi_cmnd *cmd, *n; in sas_scsi_clear_queue_I_T() local
246 list_for_each_entry_safe(cmd, n, error_q, eh_entry) { in sas_scsi_clear_queue_I_T()
247 struct domain_device *x = cmd_to_domain_dev(cmd); in sas_scsi_clear_queue_I_T()
250 sas_eh_finish_cmd(cmd); in sas_scsi_clear_queue_I_T()
257 struct scsi_cmnd *cmd, *n; in sas_scsi_clear_queue_port() local
259 list_for_each_entry_safe(cmd, n, error_q, eh_entry) { in sas_scsi_clear_queue_port()
260 struct domain_device *dev = cmd_to_domain_dev(cmd); in sas_scsi_clear_queue_port()
264 sas_eh_finish_cmd(cmd); in sas_scsi_clear_queue_port()
324 static int sas_recover_lu(struct domain_device *dev, struct scsi_cmnd *cmd) in sas_recover_lu() argument
331 int_to_scsilun(cmd->device->lun, &lun); in sas_recover_lu()
335 cmd->device->lun); in sas_recover_lu()
425 int sas_eh_abort_handler(struct scsi_cmnd *cmd) in sas_eh_abort_handler() argument
428 struct sas_task *task = TO_SAS_TASK(cmd); in sas_eh_abort_handler()
429 struct Scsi_Host *host = cmd->device->host; in sas_eh_abort_handler()
430 struct domain_device *dev = cmd_to_domain_dev(cmd); in sas_eh_abort_handler()
457 int sas_eh_device_reset_handler(struct scsi_cmnd *cmd) in sas_eh_device_reset_handler() argument
461 struct Scsi_Host *host = cmd->device->host; in sas_eh_device_reset_handler()
462 struct domain_device *dev = cmd_to_domain_dev(cmd); in sas_eh_device_reset_handler()
466 return sas_queue_reset(dev, SAS_DEV_LU_RESET, cmd->device->lun); in sas_eh_device_reset_handler()
468 int_to_scsilun(cmd->device->lun, &lun); in sas_eh_device_reset_handler()
481 int sas_eh_target_reset_handler(struct scsi_cmnd *cmd) in sas_eh_target_reset_handler() argument
484 struct Scsi_Host *host = cmd->device->host; in sas_eh_target_reset_handler()
485 struct domain_device *dev = cmd_to_domain_dev(cmd); in sas_eh_target_reset_handler()
504 static int try_to_reset_cmd_device(struct scsi_cmnd *cmd) in try_to_reset_cmd_device() argument
507 struct Scsi_Host *shost = cmd->device->host; in try_to_reset_cmd_device()
512 res = shost->hostt->eh_device_reset_handler(cmd); in try_to_reset_cmd_device()
518 return shost->hostt->eh_target_reset_handler(cmd); in try_to_reset_cmd_device()
525 struct scsi_cmnd *cmd, *n; in sas_eh_handle_sas_errors() local
534 list_for_each_entry_safe(cmd, n, work_q, eh_entry) { in sas_eh_handle_sas_errors()
535 struct domain_device *dev = cmd_to_domain_dev(cmd); in sas_eh_handle_sas_errors()
543 task = TO_SAS_TASK(cmd); in sas_eh_handle_sas_errors()
547 list_move_tail(&cmd->eh_entry, &done); in sas_eh_handle_sas_errors()
551 list_for_each_entry_safe(cmd, n, work_q, eh_entry) { in sas_eh_handle_sas_errors()
552 struct sas_task *task = TO_SAS_TASK(cmd); in sas_eh_handle_sas_errors()
554 list_del_init(&cmd->eh_entry); in sas_eh_handle_sas_errors()
573 sas_eh_finish_cmd(cmd); in sas_eh_handle_sas_errors()
578 sas_eh_finish_cmd(cmd); in sas_eh_handle_sas_errors()
583 tmf_resp = sas_recover_lu(task->dev, cmd); in sas_eh_handle_sas_errors()
587 cmd->device->lun); in sas_eh_handle_sas_errors()
588 sas_eh_finish_cmd(cmd); in sas_eh_handle_sas_errors()
589 sas_scsi_clear_queue_lu(work_q, cmd); in sas_eh_handle_sas_errors()
603 sas_eh_finish_cmd(cmd); in sas_eh_handle_sas_errors()
608 try_to_reset_cmd_device(cmd); in sas_eh_handle_sas_errors()
617 sas_eh_finish_cmd(cmd); in sas_eh_handle_sas_errors()
628 sas_eh_finish_cmd(cmd); in sas_eh_handle_sas_errors()
638 cmd->device->lun); in sas_eh_handle_sas_errors()
640 sas_eh_finish_cmd(cmd); in sas_eh_handle_sas_errors()
651 list_for_each_entry_safe(cmd, n, work_q, eh_entry) in sas_eh_handle_sas_errors()
652 sas_eh_finish_cmd(cmd); in sas_eh_handle_sas_errors()
751 int sas_ioctl(struct scsi_device *sdev, unsigned int cmd, void __user *arg) in sas_ioctl() argument
756 return ata_sas_scsi_ioctl(dev->sata_dev.ap, sdev, cmd, arg); in sas_ioctl()