* sets the starting state handlers, sets the device not ready, and posts the
* remote node context to the hardware. none
*/
-static void scic_sds_remote_device_starting_state_enter(
- struct sci_base_object *object)
+static void scic_sds_remote_device_starting_state_enter(struct sci_base_object *object)
{
- struct scic_sds_controller *scic;
- struct scic_sds_remote_device *sci_dev =
- (struct scic_sds_remote_device *)object;
+ struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
+ parent.parent);
+ struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
+ struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev);
- scic = scic_sds_remote_device_get_controller(sci_dev);
-
- SET_STATE_HANDLER(
- sci_dev,
- scic_sds_remote_device_state_handler_table,
- SCI_BASE_REMOTE_DEVICE_STATE_STARTING);
+ SET_STATE_HANDLER(sci_dev, scic_sds_remote_device_state_handler_table,
+ SCI_BASE_REMOTE_DEVICE_STATE_STARTING);
- isci_remote_device_not_ready(
- idev,
- SCIC_REMOTE_DEVICE_NOT_READY_START_REQUESTED);
+ isci_remote_device_not_ready(ihost, idev,
+ SCIC_REMOTE_DEVICE_NOT_READY_START_REQUESTED);
}
static void scic_sds_remote_device_starting_state_exit(struct sci_base_object *object)
* This is the enter function for the SCI_BASE_REMOTE_DEVICE_STATE_READY it sets
* the ready state handlers, and starts the ready substate machine. none
*/
-static void scic_sds_remote_device_ready_state_enter(
- struct sci_base_object *object)
+static void scic_sds_remote_device_ready_state_enter(struct sci_base_object *object)
{
- struct scic_sds_remote_device *sci_dev =
- (struct scic_sds_remote_device *)object;
+ struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
+ parent.parent);
+ struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
+ struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev);
- struct scic_sds_controller *scic
- = scic_sds_remote_device_get_controller(sci_dev);
SET_STATE_HANDLER(sci_dev,
scic_sds_remote_device_state_handler_table,
if (sci_dev->has_ready_substate_machine)
sci_base_state_machine_start(&sci_dev->ready_substate_machine);
else
- isci_remote_device_ready(idev);
+ isci_remote_device_ready(ihost, idev);
}
/**
static void scic_sds_remote_device_ready_state_exit(
struct sci_base_object *object)
{
- struct scic_sds_remote_device *sci_dev =
- (struct scic_sds_remote_device *)object;
- struct isci_remote_device *idev = sci_object_get_association(sci_dev);
-
+ struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
+ parent.parent);
if (sci_dev->has_ready_substate_machine)
sci_base_state_machine_stop(&sci_dev->ready_substate_machine);
- else
- isci_remote_device_not_ready(
- idev,
- SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED);
+ else {
+ struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
+ struct isci_host *ihost = sci_object_get_association(scic);
+ struct isci_remote_device *idev = sci_object_get_association(sci_dev);
+
+ isci_remote_device_not_ready(ihost, idev,
+ SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED);
+ }
}
/**
* This function sets the ready cmd substate handlers and reports the device as
* ready. none
*/
-static inline void scic_sds_smp_remote_device_ready_idle_substate_enter(
- struct sci_base_object *object)
+static void scic_sds_smp_remote_device_ready_idle_substate_enter(struct sci_base_object *object)
{
- struct scic_sds_remote_device *sci_dev =
- (struct scic_sds_remote_device *)object;
+ struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
+ parent.parent);
+ struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
+ struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev);
+ SET_STATE_HANDLER(sci_dev,
+ scic_sds_smp_remote_device_ready_substate_handler_table,
+ SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
- SET_STATE_HANDLER(
- sci_dev,
- scic_sds_smp_remote_device_ready_substate_handler_table,
- SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
-
- isci_remote_device_ready(idev);
+ isci_remote_device_ready(ihost, idev);
}
/**
static void scic_sds_smp_remote_device_ready_cmd_substate_enter(
struct sci_base_object *object)
{
- struct scic_sds_remote_device *sci_dev =
- (struct scic_sds_remote_device *)object;
+ struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
+ parent.parent);
+ struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
+ struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev);
BUG_ON(sci_dev->working_request == NULL);
- SET_STATE_HANDLER(
- sci_dev,
- scic_sds_smp_remote_device_ready_substate_handler_table,
- SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
+ SET_STATE_HANDLER(sci_dev,
+ scic_sds_smp_remote_device_ready_substate_handler_table,
+ SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
- isci_remote_device_not_ready(
- idev,
- SCIC_REMOTE_DEVICE_NOT_READY_SMP_REQUEST_STARTED);
+ isci_remote_device_not_ready(ihost, idev,
+ SCIC_REMOTE_DEVICE_NOT_READY_SMP_REQUEST_STARTED);
}
/**
*
* This is the SCIC_SDS_SSP_REMOTE_DEVICE_READY_SUBSTATE_CMD exit method. none
*/
-static void scic_sds_smp_remote_device_ready_cmd_substate_exit(
- struct sci_base_object *object)
+static void scic_sds_smp_remote_device_ready_cmd_substate_exit(struct sci_base_object *object)
{
- struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)object;
-
- this_device->working_request = NULL;
+ struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
+ parent.parent);
+ sci_dev->working_request = NULL;
}
/* --------------------------------------------------------------------------- */
* * STP REMOTE DEVICE READY SUBSTATE PRIVATE METHODS
* ***************************************************************************** */
-static inline void
-scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(
- void *user_cookie)
+static void
+scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(void *user_cookie)
{
- struct scic_sds_remote_device *sci_dev =
- (struct scic_sds_remote_device *)user_cookie;
+ struct scic_sds_remote_device *sci_dev = user_cookie;
struct isci_remote_device *idev = sci_object_get_association(sci_dev);
+ struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
+ struct isci_host *ihost = sci_object_get_association(scic);
/*
* For NCQ operation we do not issue a
*/
if (sci_dev->ready_substate_machine.previous_state_id !=
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ)
- isci_remote_device_ready(idev);
+ isci_remote_device_ready(ihost, idev);
}
/*
}
}
-/*
- * *****************************************************************************
- * * STP REMOTE DEVICE READY CMD SUBSTATE
- * ***************************************************************************** */
-
-/**
- *
- * @device: This is the SCI base object which is cast into a
- * struct scic_sds_remote_device object.
- *
- */
-static inline void scic_sds_stp_remote_device_ready_cmd_substate_enter(
- struct sci_base_object *device)
+static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_object *object)
{
- struct scic_sds_remote_device *sci_dev =
- (struct scic_sds_remote_device *)device;
+ struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
+ parent.parent);
+ struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
+ struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev);
BUG_ON(sci_dev->working_request == NULL);
- SET_STATE_HANDLER(
- sci_dev,
- scic_sds_stp_remote_device_ready_substate_handler_table,
- SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
+ SET_STATE_HANDLER(sci_dev,
+ scic_sds_stp_remote_device_ready_substate_handler_table,
+ SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
- isci_remote_device_not_ready(
- idev,
- SCIC_REMOTE_DEVICE_NOT_READY_SATA_REQUEST_STARTED);
+ isci_remote_device_not_ready(ihost, idev,
+ SCIC_REMOTE_DEVICE_NOT_READY_SATA_REQUEST_STARTED);
}
-/*
- * *****************************************************************************
- * * STP REMOTE DEVICE READY NCQ SUBSTATE
- * ***************************************************************************** */
-
-/**
- *
- * @device: This is the SCI base object which is cast into a
- * struct scic_sds_remote_device object.
- *
- */
-static void scic_sds_stp_remote_device_ready_ncq_substate_enter(
- struct sci_base_object *device)
+static void scic_sds_stp_remote_device_ready_ncq_substate_enter(struct sci_base_object *object)
{
- struct scic_sds_remote_device *this_device;
-
- this_device = (struct scic_sds_remote_device *)device;
-
- SET_STATE_HANDLER(
- this_device,
- scic_sds_stp_remote_device_ready_substate_handler_table,
- SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ
- );
+ struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
+ parent.parent);
+ SET_STATE_HANDLER(sci_dev,
+ scic_sds_stp_remote_device_ready_substate_handler_table,
+ SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ);
}
-/*
- * *****************************************************************************
- * * STP REMOTE DEVICE READY NCQ ERROR SUBSTATE
- * ***************************************************************************** */
-
-/**
- *
- * @device: This is the SCI base object which is cast into a
- * struct scic_sds_remote_device object.
- *
- */
-static inline void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(
- struct sci_base_object *device)
+static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base_object *object)
{
- struct scic_sds_remote_device *sci_dev =
- (struct scic_sds_remote_device *)device;
+ struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
+ parent.parent);
+ struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
+ struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev);
- SET_STATE_HANDLER(
- sci_dev,
- scic_sds_stp_remote_device_ready_substate_handler_table,
- SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR);
+ SET_STATE_HANDLER(sci_dev,
+ scic_sds_stp_remote_device_ready_substate_handler_table,
+ SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR);
if (sci_dev->not_ready_reason ==
SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED)
- isci_remote_device_not_ready(idev, sci_dev->not_ready_reason);
+ isci_remote_device_not_ready(ihost, idev, sci_dev->not_ready_reason);
}
/*
* isci_remote_device_ready() - This function is called by the scic when the
* remote device is ready. We mark the isci device as ready and signal the
* waiting proccess.
- * @idev: This parameter specifies the remote device
+ * @ihost: our valid isci_host
+ * @idev: remote device
*
*/
-void isci_remote_device_ready(struct isci_remote_device *idev)
+void isci_remote_device_ready(struct isci_host *ihost, struct isci_remote_device *idev)
{
- struct isci_host *ihost = idev->isci_port->isci_host;
-
dev_dbg(&ihost->pdev->dev,
"%s: idev = %p\n", __func__, idev);
* @isci_device: This parameter specifies the remote device
*
*/
-void isci_remote_device_not_ready(
- struct isci_remote_device *isci_device,
- u32 reason_code)
+void isci_remote_device_not_ready(struct isci_host *ihost,
+ struct isci_remote_device *idev, u32 reason)
{
- dev_dbg(&isci_device->isci_port->isci_host->pdev->dev,
- "%s: isci_device = %p\n", __func__, isci_device);
+ dev_dbg(&ihost->pdev->dev,
+ "%s: isci_device = %p\n", __func__, idev);
- if (reason_code == SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED)
- isci_remote_device_change_state(isci_device, isci_stopping);
+ if (reason == SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED)
+ isci_remote_device_change_state(idev, isci_stopping);
else
/* device ready is actually a "not ready for io" state. */
- isci_remote_device_change_state(isci_device, isci_ready);
+ isci_remote_device_change_state(idev, isci_ready);
}
/**
void isci_remote_device_nuke_requests(
struct isci_remote_device *isci_device);
-void isci_remote_device_ready(
- struct isci_remote_device *);
+void isci_remote_device_ready(struct isci_host *ihost,
+ struct isci_remote_device *idev);
-void isci_remote_device_not_ready(
- struct isci_remote_device *,
- u32);
+void isci_remote_device_not_ready(struct isci_host *ihost,
+ struct isci_remote_device *idev, u32 reason);
void isci_remote_device_gone(
struct domain_device *domain_dev);