u->max_number_concurrent_device_spin_up = max_concurr_spinup;
}
-static void scic_sds_controller_initial_state_enter(void *object)
+static void scic_sds_controller_initial_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_controller *scic = object;
+ struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine);
sci_base_state_machine_change_state(&scic->state_machine,
SCI_BASE_CONTROLLER_STATE_RESET);
}
-static inline void scic_sds_controller_starting_state_exit(void *object)
+static inline void scic_sds_controller_starting_state_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_controller *scic = object;
+ struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine);
isci_timer_stop(scic->timeout_timer);
}
}
-static void scic_sds_controller_ready_state_enter(void *object)
+static void scic_sds_controller_ready_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_controller *scic = object;
+ struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine);
/* set the default interrupt coalescence number and timeout value. */
scic_controller_set_interrupt_coalescence(scic, 0x10, 250);
}
-static void scic_sds_controller_ready_state_exit(void *object)
+static void scic_sds_controller_ready_state_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_controller *scic = object;
+ struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine);
/* disable interrupt coalescence. */
scic_controller_set_interrupt_coalescence(scic, 0, 0);
return status;
}
-static void scic_sds_controller_stopping_state_enter(void *object)
+static void scic_sds_controller_stopping_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_controller *scic = object;
+ struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine);
/* Stop all of the components for this controller */
scic_sds_controller_stop_phys(scic);
scic_sds_controller_stop_devices(scic);
}
-static void scic_sds_controller_stopping_state_exit(void *object)
+static void scic_sds_controller_stopping_state_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_controller *scic = object;
+ struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine);
isci_timer_stop(scic->timeout_timer);
}
writel(0, &scic->scu_registers->sdma.unsolicited_frame_get_pointer);
}
-static void scic_sds_controller_resetting_state_enter(void *object)
+static void scic_sds_controller_resetting_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_controller *scic = object;
+ struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine);
scic_sds_controller_reset_hardware(scic);
sci_base_state_machine_change_state(&scic->state_machine,
u8 i;
sci_base_state_machine_construct(&scic->state_machine,
- scic, scic_sds_controller_state_table,
- SCI_BASE_CONTROLLER_STATE_INITIAL);
+ scic_sds_controller_state_table,
+ SCI_BASE_CONTROLLER_STATE_INITIAL);
sci_base_state_machine_start(&scic->state_machine);
}
-static void scic_sds_phy_starting_initial_substate_enter(void *object)
+static void scic_sds_phy_starting_initial_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
/* This is just an temporary state go off to the starting state */
sci_base_state_machine_change_state(&sci_phy->state_machine,
SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN);
}
-static void scic_sds_phy_starting_await_sas_power_substate_enter(void *object)
+static void scic_sds_phy_starting_await_sas_power_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller;
scic_sds_controller_power_control_queue_insert(scic, sci_phy);
}
-static void scic_sds_phy_starting_await_sas_power_substate_exit(void *object)
+static void scic_sds_phy_starting_await_sas_power_substate_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller;
scic_sds_controller_power_control_queue_remove(scic, sci_phy);
}
-static void scic_sds_phy_starting_await_sata_power_substate_enter(void *object)
+static void scic_sds_phy_starting_await_sata_power_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller;
scic_sds_controller_power_control_queue_insert(scic, sci_phy);
}
-static void scic_sds_phy_starting_await_sata_power_substate_exit(void *object)
+static void scic_sds_phy_starting_await_sata_power_substate_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller;
scic_sds_controller_power_control_queue_remove(scic, sci_phy);
}
-static void scic_sds_phy_starting_await_sata_phy_substate_enter(void *object)
+static void scic_sds_phy_starting_await_sata_phy_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
isci_timer_start(sci_phy->sata_timeout_timer,
SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT);
}
-static void scic_sds_phy_starting_await_sata_phy_substate_exit(void *object)
+static void scic_sds_phy_starting_await_sata_phy_substate_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
isci_timer_stop(sci_phy->sata_timeout_timer);
}
-static void scic_sds_phy_starting_await_sata_speed_substate_enter(void *object)
+static void scic_sds_phy_starting_await_sata_speed_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
isci_timer_start(sci_phy->sata_timeout_timer,
SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT);
}
-static void scic_sds_phy_starting_await_sata_speed_substate_exit(
- void *object)
+static void scic_sds_phy_starting_await_sata_speed_substate_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
isci_timer_stop(sci_phy->sata_timeout_timer);
}
-static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(void *object)
+static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
if (scic_sds_port_link_detected(sci_phy->owning_port, sci_phy)) {
sci_phy->is_in_link_training = false;
}
-static void scic_sds_phy_starting_await_sig_fis_uf_substate_exit(void *object)
+static void scic_sds_phy_starting_await_sig_fis_uf_substate_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
isci_timer_stop(sci_phy->sata_timeout_timer);
}
-static void scic_sds_phy_starting_final_substate_enter(void *object)
+static void scic_sds_phy_starting_final_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
/* State machine has run to completion so exit out and change
* the base state machine to the ready state
&sci_phy->link_layer_registers->phy_configuration);
}
-static void scic_sds_phy_stopped_state_enter(void *object)
+static void scic_sds_phy_stopped_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
struct scic_sds_port *sci_port = sci_phy->owning_port;
struct scic_sds_controller *scic = sci_port->owning_controller;
struct isci_host *ihost = scic_to_ihost(scic);
sci_phy);
}
-static void scic_sds_phy_starting_state_enter(void *object)
+static void scic_sds_phy_starting_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
scu_link_layer_stop_protocol_engine(sci_phy);
scu_link_layer_start_oob(sci_phy);
SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL);
}
-static void scic_sds_phy_ready_state_enter(void *object)
+static void scic_sds_phy_ready_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
scic_sds_controller_link_up(scic_sds_phy_get_controller(sci_phy),
phy_get_non_dummy_port(sci_phy),
}
-static void scic_sds_phy_ready_state_exit(void *object)
+static void scic_sds_phy_ready_state_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
scic_sds_phy_suspend(sci_phy);
}
-static void scic_sds_phy_resetting_state_enter(void *object)
+static void scic_sds_phy_resetting_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
/* The phy is being reset, therefore deactivate it from the port. In
* the resetting state we don't notify the user regarding link up and
struct scic_sds_port *owning_port, u8 phy_index)
{
sci_base_state_machine_construct(&sci_phy->state_machine,
- sci_phy,
scic_sds_phy_state_table,
SCI_BASE_PHY_STATE_INITIAL);
writel(pts_control_value, &port->port_task_scheduler_registers->control);
}
-static void scic_sds_port_ready_substate_waiting_enter(void *object)
+static void scic_sds_port_ready_substate_waiting_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_port *sci_port = object;
+ struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine);
scic_sds_port_suspend_port_task_scheduler(sci_port);
}
}
-static void scic_sds_port_ready_substate_operational_enter(void *object)
+static void scic_sds_port_ready_substate_operational_enter(struct sci_base_state_machine *sm)
{
u32 index;
- struct scic_sds_port *sci_port = object;
+ struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine);
struct scic_sds_controller *scic = sci_port->owning_controller;
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_port *iport = sci_port_to_iport(sci_port);
* exiting the SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL. This function reports
* the port not ready and suspends the port task scheduler. none
*/
-static void scic_sds_port_ready_substate_operational_exit(void *object)
+static void scic_sds_port_ready_substate_operational_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_port *sci_port = object;
+ struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine);
struct scic_sds_controller *scic = sci_port->owning_controller;
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_port *iport = sci_port_to_iport(sci_port);
scic_sds_port_invalidate_dummy_remote_node(sci_port);
}
-static void scic_sds_port_ready_substate_configuring_enter(void *object)
+static void scic_sds_port_ready_substate_configuring_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_port *sci_port = object;
+ struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine);
struct scic_sds_controller *scic = sci_port->owning_controller;
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_port *iport = sci_port_to_iport(sci_port);
SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL);
}
-static void scic_sds_port_ready_substate_configuring_exit(void *object)
+static void scic_sds_port_ready_substate_configuring_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_port *sci_port = object;
+ struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine);
scic_sds_port_suspend_port_task_scheduler(sci_port);
if (sci_port->ready_exit)
scic_sds_controller_post_request(scic, command);
}
-static void scic_sds_port_stopped_state_enter(void *object)
+static void scic_sds_port_stopped_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_port *sci_port = object;
+ struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine);
if (sci_port->state_machine.previous_state_id == SCI_BASE_PORT_STATE_STOPPING) {
/*
}
}
-static void scic_sds_port_stopped_state_exit(void *object)
+static void scic_sds_port_stopped_state_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_port *sci_port = object;
+ struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine);
/* Enable and suspend the port task scheduler */
scic_sds_port_enable_port_task_scheduler(sci_port);
}
-static void scic_sds_port_ready_state_enter(void *object)
+static void scic_sds_port_ready_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_port *sci_port = object;
+ struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine);
struct scic_sds_controller *scic = sci_port->owning_controller;
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_port *iport = sci_port_to_iport(sci_port);
SCIC_SDS_PORT_READY_SUBSTATE_WAITING);
}
-static void scic_sds_port_resetting_state_exit(void *object)
+static void scic_sds_port_resetting_state_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_port *sci_port = object;
+ struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine);
isci_timer_stop(sci_port->timer_handle);
}
-static void scic_sds_port_stopping_state_exit(void *object)
+static void scic_sds_port_stopping_state_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_port *sci_port = object;
+ struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine);
isci_timer_stop(sci_port->timer_handle);
scic_sds_port_destroy_dummy_resources(sci_port);
}
-static void scic_sds_port_failed_state_enter(void *object)
+static void scic_sds_port_failed_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_port *sci_port = object;
+ struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine);
struct isci_port *iport = sci_port_to_iport(sci_port);
isci_port_hard_reset_complete(iport, SCI_FAILURE_TIMEOUT);
struct scic_sds_controller *scic)
{
sci_base_state_machine_construct(&sci_port->state_machine,
- sci_port,
scic_sds_port_state_table,
SCI_BASE_PORT_STATE_STOPPED);
isci_remote_device_ready(scic_to_ihost(scic), idev);
}
-static void scic_sds_remote_device_initial_state_enter(void *object)
+static void scic_sds_remote_device_initial_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_device *sci_dev = object;
+ struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine);
/* Initial state is a transitional state to the stopped state */
sci_base_state_machine_change_state(&sci_dev->state_machine,
isci_remote_device_deconstruct(ihost, idev);
}
-static void scic_sds_remote_device_stopped_state_enter(void *object)
+static void scic_sds_remote_device_stopped_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_device *sci_dev = object;
+ struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine);
struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller;
struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
u32 prev_state;
scic_sds_controller_remote_device_stopped(scic, sci_dev);
}
-static void scic_sds_remote_device_starting_state_enter(void *object)
+static void scic_sds_remote_device_starting_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_device *sci_dev = object;
+ struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
SCIC_REMOTE_DEVICE_NOT_READY_START_REQUESTED);
}
-static void scic_sds_remote_device_ready_state_enter(void *object)
+static void scic_sds_remote_device_ready_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_device *sci_dev = object;
+ struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine);
struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller;
struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
struct domain_device *dev = idev->domain_dev;
isci_remote_device_ready(scic_to_ihost(scic), idev);
}
-static void scic_sds_remote_device_ready_state_exit(void *object)
+static void scic_sds_remote_device_ready_state_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_device *sci_dev = object;
+ struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine);
struct domain_device *dev = sci_dev_to_domain(sci_dev);
if (dev->dev_type == SAS_END_DEV) {
}
}
-static void scic_sds_remote_device_resetting_state_enter(void *object)
+static void scic_sds_remote_device_resetting_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_device *sci_dev = object;
+ struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine);
scic_sds_remote_node_context_suspend(
&sci_dev->rnc, SCI_SOFTWARE_SUSPENSION, NULL, NULL);
}
-static void scic_sds_remote_device_resetting_state_exit(void *object)
+static void scic_sds_remote_device_resetting_state_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_device *sci_dev = object;
+ struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine);
scic_sds_remote_node_context_resume(&sci_dev->rnc, NULL, NULL);
}
-static void scic_sds_stp_remote_device_ready_idle_substate_enter(void *object)
+static void scic_sds_stp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_device *sci_dev = object;
+ struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine);
sci_dev->working_request = NULL;
if (scic_sds_remote_node_context_is_ready(&sci_dev->rnc)) {
}
}
-static void scic_sds_stp_remote_device_ready_cmd_substate_enter(void *object)
+static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_device *sci_dev = object;
+ struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
BUG_ON(sci_dev->working_request == NULL);
SCIC_REMOTE_DEVICE_NOT_READY_SATA_REQUEST_STARTED);
}
-static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(void *object)
+static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_device *sci_dev = object;
+ struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
sci_dev->not_ready_reason);
}
-static void scic_sds_smp_remote_device_ready_idle_substate_enter(void *object)
+static void scic_sds_smp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_device *sci_dev = object;
+ struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
isci_remote_device_ready(scic_to_ihost(scic), sci_dev_to_idev(sci_dev));
}
-static void scic_sds_smp_remote_device_ready_cmd_substate_enter(void *object)
+static void scic_sds_smp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_device *sci_dev = object;
+ struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
BUG_ON(sci_dev->working_request == NULL);
SCIC_REMOTE_DEVICE_NOT_READY_SMP_REQUEST_STARTED);
}
-static void scic_sds_smp_remote_device_ready_cmd_substate_exit(void *object)
+static void scic_sds_smp_remote_device_ready_cmd_substate_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_device *sci_dev = object;
+ struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine);
sci_dev->working_request = NULL;
}
sci_dev->owning_port = sci_port;
sci_dev->started_request_count = 0;
- sci_base_state_machine_construct(
- &sci_dev->state_machine,
- sci_dev,
- scic_sds_remote_device_state_table,
- SCI_BASE_REMOTE_DEVICE_STATE_INITIAL
- );
+ sci_base_state_machine_construct(&sci_dev->state_machine,
+ scic_sds_remote_device_state_table,
+ SCI_BASE_REMOTE_DEVICE_STATE_INITIAL);
- sci_base_state_machine_start(
- &sci_dev->state_machine
- );
+ sci_base_state_machine_start(&sci_dev->state_machine);
scic_sds_remote_node_context_construct(&sci_dev->rnc,
SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX);
SCU_CONTEXT_COMMAND_POST_RNC_INVALIDATE);
}
-static void scic_sds_remote_node_context_initial_state_enter(void *object)
+static void scic_sds_remote_node_context_initial_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_node_context *rnc = object;
- struct sci_base_state_machine *sm = &rnc->state_machine;
+ struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine);
/* Check to see if we have gotten back to the initial state because
* someone requested to destroy the remote node context object.
}
}
-static void scic_sds_remote_node_context_posting_state_enter(void *object)
+static void scic_sds_remote_node_context_posting_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_node_context *sci_rnc = object;
+ struct scic_sds_remote_node_context *sci_rnc = container_of(sm, typeof(*sci_rnc), state_machine);
scic_sds_remote_node_context_validate_context_buffer(sci_rnc);
}
-static void scic_sds_remote_node_context_invalidating_state_enter(void *object)
+static void scic_sds_remote_node_context_invalidating_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_node_context *rnc = object;
+ struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine);
scic_sds_remote_node_context_invalidate_context_buffer(rnc);
}
-static void scic_sds_remote_node_context_resuming_state_enter(void *object)
+static void scic_sds_remote_node_context_resuming_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_node_context *rnc = object;
+ struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine);
struct scic_sds_remote_device *sci_dev;
struct domain_device *dev;
scic_sds_remote_device_post_request(sci_dev, SCU_CONTEXT_COMMAND_POST_RNC_RESUME);
}
-static void scic_sds_remote_node_context_ready_state_enter(void *object)
+static void scic_sds_remote_node_context_ready_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_node_context *rnc = object;
+ struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine);
rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED;
scic_sds_remote_node_context_notify_user(rnc);
}
-static void scic_sds_remote_node_context_tx_suspended_state_enter(void *object)
+static void scic_sds_remote_node_context_tx_suspended_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_node_context *rnc = object;
+ struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine);
scic_sds_remote_node_context_continue_state_transitions(rnc);
}
-static void scic_sds_remote_node_context_tx_rx_suspended_state_enter(
- void *object)
+static void scic_sds_remote_node_context_tx_rx_suspended_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_remote_node_context *rnc = object;
+ struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine);
scic_sds_remote_node_context_continue_state_transitions(rnc);
}
rnc->remote_node_index = remote_node_index;
rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED;
- sci_base_state_machine_construct(
- &rnc->state_machine,
- rnc,
- scic_sds_remote_node_context_state_table,
- SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE
- );
+ sci_base_state_machine_construct(&rnc->state_machine,
+ scic_sds_remote_node_context_state_table,
+ SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE);
sci_base_state_machine_start(&rnc->state_machine);
}
isci_host_can_dequeue(isci_host, 1);
}
-static void scic_sds_request_started_state_enter(void *object)
+static void scic_sds_request_started_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_request *sci_req = object;
- struct sci_base_state_machine *sm = &sci_req->state_machine;
+ struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), state_machine);
struct isci_request *ireq = sci_req_to_ireq(sci_req);
struct domain_device *dev = sci_dev_to_domain(sci_req->target_device);
struct sas_task *task;
}
}
-static void scic_sds_request_completed_state_enter(void *object)
+static void scic_sds_request_completed_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_request *sci_req = object;
+ struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), state_machine);
struct scic_sds_controller *scic = sci_req->owning_controller;
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_request *ireq = sci_req_to_ireq(sci_req);
isci_task_request_complete(ihost, ireq, sci_req->sci_status);
}
-static void scic_sds_request_aborting_state_enter(void *object)
+static void scic_sds_request_aborting_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_request *sci_req = object;
+ struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), state_machine);
/* Setting the abort bit in the Task Context is required by the silicon. */
sci_req->task_context_buffer->abort = 1;
}
-static void scic_sds_stp_request_started_non_data_await_h2d_completion_enter(
- void *object)
+static void scic_sds_stp_request_started_non_data_await_h2d_completion_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_request *sci_req = object;
+ struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), state_machine);
scic_sds_remote_device_set_working_request(sci_req->target_device,
sci_req);
}
-static void scic_sds_stp_request_started_pio_await_h2d_completion_enter(void *object)
+static void scic_sds_stp_request_started_pio_await_h2d_completion_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_request *sci_req = object;
+ struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), state_machine);
scic_sds_remote_device_set_working_request(sci_req->target_device,
sci_req);
}
-static void scic_sds_stp_request_started_soft_reset_await_h2d_asserted_completion_enter(void *object)
+static void scic_sds_stp_request_started_soft_reset_await_h2d_asserted_completion_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_request *sci_req = object;
+ struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), state_machine);
scic_sds_remote_device_set_working_request(sci_req->target_device,
sci_req);
}
-static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_completion_enter(void *object)
+static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_completion_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_request *sci_req = object;
+ struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), state_machine);
struct scu_task_context *task_context;
struct host_to_dev_fis *h2d_fis;
enum sci_status status;
struct scic_sds_remote_device *sci_dev,
u16 io_tag, struct scic_sds_request *sci_req)
{
- sci_base_state_machine_construct(&sci_req->state_machine, sci_req,
- scic_sds_request_state_table, SCI_BASE_REQUEST_STATE_INITIAL);
+ sci_base_state_machine_construct(&sci_req->state_machine,
+ scic_sds_request_state_table,
+ SCI_BASE_REQUEST_STATE_INITIAL);
sci_base_state_machine_start(&sci_req->state_machine);
sci_req->io_tag = io_tag;
sci_state_transition_t exit = sm->state_table[state].exit_state;
if (exit)
- exit(sm->state_machine_owner);
+ exit(sm);
}
static void sci_state_machine_enter_state(struct sci_base_state_machine *sm)
sci_state_transition_t enter = sm->state_table[state].enter_state;
if (enter)
- enter(sm->state_machine_owner);
+ enter(sm);
}
-/*
- * ******************************************************************************
- * * P R O T E C T E D M E T H O D S
- * ****************************************************************************** */
-
/**
* This method will set the initial state and state table for the state
* machine. The caller should follow this request with the initialize
* request to cause the state machine to start.
* @sm: This parameter provides the state machine object to be
* constructed.
- * @state_machine_owner: This parameter indicates the object that is owns the
- * state machine being constructed.
* @state_table: This parameter specifies the table of state objects that is
* managed by this state machine.
* @initial_state: This parameter specifies the value of the initial state for
*
*/
void sci_base_state_machine_construct(struct sci_base_state_machine *sm,
- void *owner,
const struct sci_base_state *state_table,
u32 initial_state)
{
- sm->state_machine_owner = owner;
sm->initial_state_id = initial_state;
sm->previous_state_id = initial_state;
sm->current_state_id = initial_state;
#include <linux/types.h>
+struct sci_base_state_machine;
typedef void (*sci_base_state_handler_t)(void);
-
-typedef void (*sci_state_transition_t)(void *base_object);
+typedef void (*sci_state_transition_t)(struct sci_base_state_machine *sm);
/**
* struct sci_base_state - The base state object abstracts the fields common to
* invoked when the state is exited.
*/
sci_state_transition_t exit_state;
-
};
/**
*/
const struct sci_base_state *state_table;
- /**
- * This field points to the object to which this state machine is
- * associated. It serves as a cookie to be provided to the state
- * enter/exit methods.
- */
- void *state_machine_owner;
-
/**
* This field simply indicates the state value for the state machine's
* initial state.
};
-/*
- * ******************************************************************************
- * * P R O T E C T E D M E T H O D S
- * ****************************************************************************** */
-
-void sci_base_state_machine_construct(
- struct sci_base_state_machine *this_state_machine,
- void *state_machine_owner,
- const struct sci_base_state *state_table,
- u32 initial_state);
-
-void sci_base_state_machine_start(
- struct sci_base_state_machine *this_state_machine);
-
-void sci_base_state_machine_stop(
- struct sci_base_state_machine *this_state_machine);
-
-void sci_base_state_machine_change_state(
- struct sci_base_state_machine *this_state_machine,
- u32 next_state);
-
-u32 sci_base_state_machine_get_state(
- struct sci_base_state_machine *this_state_machine);
+void sci_base_state_machine_construct(struct sci_base_state_machine *sm,
+ const struct sci_base_state *state_table,
+ u32 initial_state);
+void sci_base_state_machine_start(struct sci_base_state_machine *sm);
+void sci_base_state_machine_stop(struct sci_base_state_machine *sm);
+void sci_base_state_machine_change_state(struct sci_base_state_machine *sm,
+ u32 next_state);
+u32 sci_base_state_machine_get_state(struct sci_base_state_machine *sm);
#endif /* _SCI_BASE_STATE_MACHINE_H_ */