84 dev_dbg(&ihost->
pdev->dev,
"%s: task = %p, response=%d, status=%d\n",
85 __func__, task, response, status);
102 #define for_each_sas_task(num, task) \
103 for (; num > 0; num--,\
104 task = list_entry(task->list.next, struct sas_task, list))
112 isci_task_is_ncq_recovery(task))
133 dev_dbg(&ihost->
pdev->dev,
"%s: num=%d\n", __func__, num);
139 idev = isci_lookup_device(task->
dev);
140 io_ready = isci_device_io_ready(idev, task);
142 spin_unlock_irqrestore(&ihost->
scic_lock, flags);
145 "task: %p, num: %d dev: %p idev: %p:%#lx cmd = %p\n",
146 task, num, task->
dev, idev, idev ? idev->
flags : 0,
167 isci_task_refuse(ihost, task,
189 isci_task_refuse(ihost, task,
201 isci_task_refuse(ihost, task,
214 spin_unlock_irqrestore(&ihost->
scic_lock, flags);
216 isci_put_device(idev);
230 "%s: isci_tmf = %p\n", __func__, isci_tmf);
245 "%s: sci_task_request_construct failed - "
263 static int isci_task_execute_tmf(
struct isci_host *ihost,
272 unsigned long timeleft;
277 spin_unlock_irqrestore(&ihost->
scic_lock, flags);
289 "%s: idev = %p not ready (%#lx)\n",
291 idev, idev ? idev->
flags : 0);
302 ireq = isci_task_request_build(ihost, idev, tag, tmf);
313 "%s: start_io failed - status = 0x%x, request = %p\n",
317 spin_unlock_irqrestore(&ihost->
scic_lock, flags);
320 spin_unlock_irqrestore(&ihost->
scic_lock, flags);
336 isci_print_tmf(ihost, tmf);
343 "SCI_FAILURE_IO_RESPONSE_VALID\n",
350 "%s: completed request = %p\n",
359 spin_unlock_irqrestore(&ihost->
scic_lock, flags);
364 static void isci_task_build_tmf(
struct isci_tmf *tmf,
367 memset(tmf, 0,
sizeof(*tmf));
371 static void isci_task_build_abort_task_tmf(
struct isci_tmf *tmf,
375 isci_task_build_tmf(tmf, code);
386 static int isci_task_send_lu_reset_sas(
395 "%s: isci_host = %p, isci_device = %p\n",
396 __func__, isci_host, isci_device);
404 #define ISCI_LU_RESET_TIMEOUT_MS 2000
405 ret = isci_task_execute_tmf(isci_host, isci_device, &tmf, ISCI_LU_RESET_TIMEOUT_MS);
409 "%s: %p: TMF_LU_RESET passed\n",
410 __func__, isci_device);
413 "%s: %p: TMF_LU_RESET failed (%x)\n",
414 __func__, isci_device, ret);
421 struct isci_host *ihost = dev_to_ihost(dev);
427 idev = isci_get_device(dev->
lldd_dev);
428 spin_unlock_irqrestore(&ihost->
scic_lock, flags);
431 "%s: domain_device=%p, isci_host=%p; isci_device=%p\n",
432 __func__, dev, ihost, idev);
436 dev_dbg(&ihost->
pdev->dev,
"%s: No dev\n", __func__);
451 if (dev_is_sata(dev))
455 ret = isci_task_send_lu_reset_sas(ihost, idev, lun);
458 isci_put_device(idev);
487 struct isci_host *ihost = dev_to_ihost(task->
dev);
509 idev = isci_get_device(task->
dev->lldd_dev);
512 spin_unlock_irqrestore(&ihost->
scic_lock, flags);
515 "%s: dev = %p (%s%s), task = %p, old_request == %p\n",
517 (dev_is_sata(task->
dev) ?
"STP/SATA"
518 : ((dev_is_expander(task->
dev))
531 if (!idev || !old_request) {
546 "%s: abort task not needed for %p\n",
554 "%s: isci_remote_device_reset_terminate(dev=%p, "
555 "req=%p, task=%p) failed\n",
556 __func__, idev, old_request, task);
567 spin_unlock_irqrestore(&ihost->
scic_lock, flags);
574 " or complete_in_target (%d), "
575 "or IDEV_GONE (%d), thus no TMF\n",
584 &old_request->
flags),
599 spin_unlock_irqrestore(&ihost->
scic_lock, flags);
602 #define ISCI_ABORT_TASK_TIMEOUT_MS 500
603 ret = isci_task_execute_tmf(ihost, idev, &tmf,
608 "%s: Done; dev = %p, task = %p , old_request == %p\n",
609 __func__, idev, task, old_request);
610 isci_put_device(idev);
708 "%s: request = %p, status=%d\n",
709 __func__, ireq, completion_status);
714 tmf->
status = completion_status;
745 static int isci_reset_device(
struct isci_host *ihost,
753 dev_dbg(&ihost->
pdev->dev,
"%s: idev %p\n", __func__, idev);
779 dev_dbg(&ihost->
pdev->dev,
"%s: idev %p complete, reset_stat=%d.\n",
780 __func__, idev, reset_stat);
782 sas_put_local_phy(phy);
788 struct isci_host *ihost = dev_to_ihost(dev);
794 idev = isci_get_device(dev->
lldd_dev);
795 spin_unlock_irqrestore(&ihost->
scic_lock, flags);
805 ret = isci_reset_device(ihost, dev, idev);
807 isci_put_device(idev);