Пример #1
0
int isci_task_lu_reset(struct domain_device *dev, u8 *lun)
{
	struct isci_host *ihost = dev_to_ihost(dev);
	struct isci_remote_device *idev;
	unsigned long flags;
	int ret = TMF_RESP_FUNC_COMPLETE;

	spin_lock_irqsave(&ihost->scic_lock, flags);
	idev = isci_get_device(dev->lldd_dev);
	spin_unlock_irqrestore(&ihost->scic_lock, flags);

	dev_dbg(&ihost->pdev->dev,
		"%s: domain_device=%p, isci_host=%p; isci_device=%p\n",
		__func__, dev, ihost, idev);

	if (!idev) {
		/* If the device is gone, escalate to I_T_Nexus_Reset. */
		dev_dbg(&ihost->pdev->dev, "%s: No dev\n", __func__);

		ret = TMF_RESP_FUNC_FAILED;
		goto out;
	}

	/* Suspend the RNC, kill all TCs */
	if (isci_remote_device_suspend_terminate(ihost, idev, NULL)
	    != SCI_SUCCESS) {
		/* The suspend/terminate only fails if isci_get_device fails */
		ret = TMF_RESP_FUNC_FAILED;
		goto out;
	}
	/* All pending I/Os have been terminated and cleaned up. */
	if (!test_bit(IDEV_GONE, &idev->flags)) {
		if (dev_is_sata(dev))
			sas_ata_schedule_reset(dev);
		else
			/* Send the task management part of the reset. */
			ret = isci_task_send_lu_reset_sas(ihost, idev, lun);
	}
 out:
	isci_put_device(idev);
	return ret;
}
Пример #2
0
int isci_task_lu_reset(struct domain_device *dev, u8 *lun)
{
	struct isci_host *isci_host = dev_to_ihost(dev);
	struct isci_remote_device *isci_device;
	unsigned long flags;
	int ret;

	spin_lock_irqsave(&isci_host->scic_lock, flags);
	isci_device = isci_lookup_device(dev);
	spin_unlock_irqrestore(&isci_host->scic_lock, flags);

	dev_dbg(&isci_host->pdev->dev,
		"%s: domain_device=%p, isci_host=%p; isci_device=%p\n",
		 __func__, dev, isci_host, isci_device);

	if (!isci_device) {
		/* If the device is gone, stop the escalations. */
		dev_dbg(&isci_host->pdev->dev, "%s: No dev\n", __func__);

		ret = TMF_RESP_FUNC_COMPLETE;
		goto out;
	}

	/* Send the task management part of the reset. */
	if (dev_is_sata(dev)) {
		sas_ata_schedule_reset(dev);
		ret = TMF_RESP_FUNC_COMPLETE;
	} else
		ret = isci_task_send_lu_reset_sas(isci_host, isci_device, lun);

	/* If the LUN reset worked, all the I/O can now be terminated. */
	if (ret == TMF_RESP_FUNC_COMPLETE)
		/* Terminate all I/O now. */
		isci_terminate_pending_requests(isci_host,
						isci_device);

 out:
	isci_put_device(isci_device);
	return ret;
}
Пример #3
0
int isci_task_lu_reset(struct domain_device *dev, u8 *lun)
{
	struct isci_host *isci_host = dev_to_ihost(dev);
	struct isci_remote_device *isci_device;
	unsigned long flags;
	int ret;

	spin_lock_irqsave(&isci_host->scic_lock, flags);
	isci_device = isci_lookup_device(dev);
	spin_unlock_irqrestore(&isci_host->scic_lock, flags);

	dev_dbg(&isci_host->pdev->dev,
		"%s: domain_device=%p, isci_host=%p; isci_device=%p\n",
		 __func__, dev, isci_host, isci_device);

	if (!isci_device) {
		
		dev_dbg(&isci_host->pdev->dev, "%s: No dev\n", __func__);

		ret = TMF_RESP_FUNC_COMPLETE;
		goto out;
	}

	
	if (dev_is_sata(dev)) {
		sas_ata_schedule_reset(dev);
		ret = TMF_RESP_FUNC_COMPLETE;
	} else
		ret = isci_task_send_lu_reset_sas(isci_host, isci_device, lun);

	
	if (ret == TMF_RESP_FUNC_COMPLETE)
		
		isci_terminate_pending_requests(isci_host,
						isci_device);

 out:
	isci_put_device(isci_device);
	return ret;
}