scic->phy_startup_timer_pending = true;
}
+static bool is_phy_starting(struct scic_sds_phy *sci_phy)
+{
+ enum scic_sds_phy_states state;
+
+ state = sci_phy->state_machine.current_state_id;
+ switch (state) {
+ case SCI_BASE_PHY_STATE_STARTING:
+ case SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL:
+ case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN:
+ case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF:
+ case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER:
+ case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER:
+ case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN:
+ case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN:
+ case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF:
+ case SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL:
+ return true;
+ default:
+ return false;
+ }
+}
+
/**
* scic_sds_controller_start_next_phy - start phy
* @scic: controller
sci_phy = &ihost->phys[index].sci;
state = sci_phy->state_machine.current_state_id;
- if (!scic_sds_phy_get_port(sci_phy))
+ if (!phy_get_non_dummy_port(sci_phy))
continue;
/* The controller start operation is complete iff:
(sci_phy->is_in_link_training == false &&
state == SCI_BASE_PHY_STATE_STOPPED) ||
(sci_phy->is_in_link_training == true &&
- state == SCI_BASE_PHY_STATE_STARTING)) {
+ is_phy_starting(sci_phy))) {
is_controller_start_complete = false;
break;
}
sci_phy = &ihost->phys[scic->next_phy_to_start].sci;
if (oem->controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) {
- if (scic_sds_phy_get_port(sci_phy) == NULL) {
+ if (phy_get_non_dummy_port(sci_phy) == NULL) {
scic->next_phy_to_start++;
/* Caution recursion ahead be forwarned
for (index = 0; index < scic->logical_port_entries; index++) {
struct scic_sds_port *sci_port = &ihost->ports[index].sci;
- result = sci_port->state_handlers->start_handler(sci_port);
+ result = scic_sds_port_start(sci_port);
if (result)
return result;
}
wait_for_stop(ihost);
scic_controller_reset(&ihost->sci);
+
+ /* Cancel any/all outstanding port timers */
+ for (i = 0; i < ihost->sci.logical_port_entries; i++) {
+ struct scic_sds_port *sci_port = &ihost->ports[i].sci;
+ del_timer_sync(&sci_port->timer.timer);
+ }
+
+ del_timer_sync(&ihost->sci.port_agent.timer.timer);
+
isci_timer_list_destroy(ihost);
}
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);
for (index = 0; index < scic->logical_port_entries; index++) {
struct scic_sds_port *sci_port = &ihost->ports[index].sci;
- scic_sds_port_handler_t stop;
- stop = sci_port->state_handlers->stop_handler;
- port_status = stop(sci_port);
+ port_status = scic_sds_port_stop(sci_port);
if ((port_status != SCI_SUCCESS) &&
(port_status != SCI_FAILURE_INVALID_STATE)) {
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);