INIT_LIST_HEAD(&isci_device->reqs_in_process);
INIT_LIST_HEAD(&isci_device->node);
- isci_device->host_quiesce = false;
spin_lock_init(&isci_device->state_lock);
- spin_lock_init(&isci_device->host_quiesce_lock);
isci_remote_device_change_state(isci_device, isci_freed);
return isci_device;
}
-/**
- * isci_device_set_host_quiesce_lock_state() - This function sets the host I/O
- * quiesce lock state for the remote_device object.
- * @isci_device,: This parameter points to the isci_remote_device object
- * @isci_device: This parameter specifies the new quiesce state.
- *
- */
-void isci_device_set_host_quiesce_lock_state(
- struct isci_remote_device *isci_device,
- bool lock_state)
-{
- unsigned long flags;
-
- dev_dbg(&isci_device->isci_port->isci_host->pdev->dev,
- "%s: isci_device=%p, lock_state=%d\n",
- __func__, isci_device, lock_state);
-
- spin_lock_irqsave(&isci_device->host_quiesce_lock, flags);
- isci_device->host_quiesce = lock_state;
- spin_unlock_irqrestore(&isci_device->host_quiesce_lock, flags);
-}
/**
* isci_remote_device_ready() - This function is called by the scic when the
"%s: isci_device = %p\n", __func__, isci_device);
/* device ready is actually a "ready for io" state. */
- if ((isci_starting == isci_remote_device_get_state(isci_device)) ||
- (isci_ready == isci_remote_device_get_state(isci_device))) {
+ if (isci_device->status == isci_starting ||
+ isci_device->status == isci_ready) {
spin_lock_irqsave(&isci_device->isci_port->remote_device_lock,
flags);
isci_remote_device_change_state(isci_device, isci_ready_for_io);
struct list_head reqs_in_process;
struct work_struct stop_work;
spinlock_t state_lock;
- spinlock_t host_quiesce_lock;
- bool host_quiesce;
};
static inline struct scic_sds_remote_device *to_sci_dev(struct isci_remote_device *idev)
/**
- * This function gets the status of the remote_device object.
- * @isci_device: This parameter points to the isci_remote_device object
- *
- * status of the object as a isci_status enum.
- */
-static inline
-enum isci_status isci_remote_device_get_state(
- struct isci_remote_device *isci_device)
-{
- return (isci_device->host_quiesce)
- ? isci_host_quiesce
- : isci_device->status;
-}
-
-
-/**
* isci_dev_from_domain_dev() - This accessor retrieves the remote_device
* object reference from the Linux domain_device reference.
* @domdev,: This parameter points to the Linux domain_device object .
void isci_device_clear_reset_pending(
struct isci_remote_device *isci_device);
-void isci_device_set_host_quiesce_lock_state(
- struct isci_remote_device *isci_device,
- bool lock_state);
-
void isci_remote_device_change_state(
struct isci_remote_device *isci_device,
enum isci_status status);
struct isci_request *request = NULL;
struct isci_remote_device *device;
unsigned long flags;
- unsigned long quiesce_flags = 0;
int ret;
enum sci_status status;
isci_host = isci_host_from_sas_ha(task->dev->port->ha);
- /* check if the controller hasn't started or if the device
- * is ready but not accepting IO.
- */
- if (device) {
-
- spin_lock_irqsave(&device->host_quiesce_lock,
- quiesce_flags);
- }
- /* From this point onward, any process that needs to guarantee
- * that there is no kernel I/O being started will have to wait
- * for the quiesce spinlock.
- */
-
- if ((device && ((isci_remote_device_get_state(device) == isci_ready) ||
- (isci_remote_device_get_state(device) == isci_host_quiesce)))) {
+ if (device && device->status == isci_ready) {
/* Forces a retry from scsi mid layer. */
dev_warn(task->dev->port->ha->dev,
if (device)
dev_dbg(task->dev->port->ha->dev,
"%s: device->status = 0x%x\n",
- __func__,
- isci_remote_device_get_state(device));
+ __func__, device->status);
/* Indicate QUEUE_FULL so that the scsi midlayer
* retries.
isci_host_can_dequeue(isci_host, 1);
}
/* the device is going down... */
- else if (!device || (isci_ready_for_io != isci_remote_device_get_state(device))) {
+ else if (!device || device->status != isci_ready_for_io) {
dev_dbg(task->dev->port->ha->dev,
"%s: task %p: isci_host->status = %d, "
if (device)
dev_dbg(task->dev->port->ha->dev,
"%s: device->status = 0x%x\n",
- __func__,
- isci_remote_device_get_state(device));
+ __func__, device->status);
/* Indicate SAS_TASK_UNDELIVERED, so that the scsi
* midlayer removes the target.
isci_host_can_dequeue(isci_host, 1);
}
}
- if (device) {
- spin_unlock_irqrestore(&device->host_quiesce_lock,
- quiesce_flags
- );
- }
task = list_entry(task->list.next, struct sas_task, list);
} while (--num > 0);
return 0;
/* sanity check, return TMF_RESP_FUNC_FAILED
* if the device is not there and ready.
*/
- if (!isci_device ||
- ((isci_ready_for_io != isci_remote_device_get_state(isci_device)) &&
- (isci_host_quiesce != isci_remote_device_get_state(isci_device)))) {
+ if (!isci_device || isci_device->status != isci_ready_for_io) {
dev_dbg(&isci_host->pdev->dev,
"%s: isci_device = %p not ready (%d)\n",
__func__,
- isci_device,
- isci_remote_device_get_state(isci_device));
+ isci_device, isci_device->status);
return TMF_RESP_FUNC_FAILED;
} else
dev_dbg(&isci_host->pdev->dev,
return TMF_RESP_FUNC_FAILED;
}
- /* Stop I/O to the remote device. */
- isci_device_set_host_quiesce_lock_state(isci_device, true);
-
/* Send the task management part of the reset. */
if (sas_protocol_ata(domain_device->tproto)) {
ret = isci_task_send_lu_reset_sata(
isci_device,
terminating);
- /* Resume I/O to the remote device. */
- isci_device_set_host_quiesce_lock_state(isci_device, false);
-
return ret;
}
if (isci_host != NULL)
spin_unlock_irqrestore(&isci_host->scic_lock, flags);
- /* Stop I/O to the remote device. */
- isci_device_set_host_quiesce_lock_state(isci_dev, true);
-
/* Make sure all pending requests are able to be fully terminated. */
isci_device_clear_reset_pending(isci_dev);
"%s: cmd %p, isci_dev %p complete.\n",
__func__, cmd, isci_dev);
- /* Resume I/O to the remote device. */
- isci_device_set_host_quiesce_lock_state(isci_dev, false);
-
return TMF_RESP_FUNC_COMPLETE;
}