Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e301370a authored by Edmund Nadolski's avatar Edmund Nadolski Committed by Dan Williams
Browse files

isci: state machine cleanup



This cleans up several areas of the state machine mechanism:

 o Rename sci_base_state_machine_change_state to sci_change_state
 o Remove sci_base_state_machine_get_state function
 o Rename 'state_machine' struct member to 'sm' in client structs
 o Shorten the name of request states
 o Shorten state machine state names as follows:
        SCI_BASE_CONTROLLER_STATE_xxx to SCIC_xxx
        SCI_BASE_PHY_STATE_xxx to SCI_PHY_xxx
        SCIC_SDS_PHY_STARTING_SUBSTATE_xxx to SCI_PHY_SUB_xxx
        SCI_BASE_PORT_STATE_xxx to SCI_PORT_xxx and
        SCIC_SDS_PORT_READY_SUBSTATE_xxx to SCI_PORT_SUB_xxx
        SCI_BASE_REMOTE_DEVICE_STATE_xxx to SCI_DEV_xxx
        SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_xxx to SCI_STP_DEV_xxx
        SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_xxx to SCI_SMP_DEV_xxx
        SCIC_SDS_REMOTE_NODE_CONTEXT_xxx_STATE to SCI_RNC_xxx

Signed-off-by: default avatarEdmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 8d2c65c0
Loading
Loading
Loading
Loading
+89 −112
Original line number Diff line number Diff line
@@ -635,8 +635,7 @@ static void scic_sds_controller_error_handler(struct scic_sds_controller *scic)
		dev_err(scic_to_dev(scic), "%s: status: %#x\n", __func__,
			interrupt_status);

		sci_base_state_machine_change_state(&scic->state_machine,
						    SCI_BASE_CONTROLLER_STATE_FAILED);
		sci_change_state(&scic->sm, SCIC_FAILED);

		return;
	}
@@ -895,14 +894,12 @@ static void scic_sds_controller_transition_to_ready(
{
	struct isci_host *ihost = scic_to_ihost(scic);

	if (scic->state_machine.current_state_id ==
	    SCI_BASE_CONTROLLER_STATE_STARTING) {
	if (scic->sm.current_state_id == SCIC_STARTING) {
		/*
		 * We move into the ready state, because some of the phys/ports
		 * may be up and operational.
		 */
		sci_base_state_machine_change_state(&scic->state_machine,
						    SCI_BASE_CONTROLLER_STATE_READY);
		sci_change_state(&scic->sm, SCIC_READY);

		isci_host_start_complete(ihost, status);
	}
@@ -912,18 +909,18 @@ 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;
	state = sci_phy->sm.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:
	case SCI_PHY_STARTING:
	case SCI_PHY_SUB_INITIAL:
	case SCI_PHY_SUB_AWAIT_SAS_SPEED_EN:
	case SCI_PHY_SUB_AWAIT_IAF_UF:
	case SCI_PHY_SUB_AWAIT_SAS_POWER:
	case SCI_PHY_SUB_AWAIT_SATA_POWER:
	case SCI_PHY_SUB_AWAIT_SATA_PHY_EN:
	case SCI_PHY_SUB_AWAIT_SATA_SPEED_EN:
	case SCI_PHY_SUB_AWAIT_SIG_FIS_UF:
	case SCI_PHY_SUB_FINAL:
		return true;
	default:
		return false;
@@ -957,7 +954,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro

		for (index = 0; index < SCI_MAX_PHYS; index++) {
			sci_phy = &ihost->phys[index].sci;
			state = sci_phy->state_machine.current_state_id;
			state = sci_phy->sm.current_state_id;

			if (!phy_get_non_dummy_port(sci_phy))
				continue;
@@ -968,12 +965,9 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro
			 * - have an indication of a connected device and it has
			 *   finished the link training process.
			 */
			if ((sci_phy->is_in_link_training == false &&
			     state == SCI_BASE_PHY_STATE_INITIAL) ||
			    (sci_phy->is_in_link_training == false &&
			     state == SCI_BASE_PHY_STATE_STOPPED) ||
			    (sci_phy->is_in_link_training == true &&
			     is_phy_starting(sci_phy))) {
			if ((sci_phy->is_in_link_training == false && state == SCI_PHY_INITIAL) ||
			    (sci_phy->is_in_link_training == false && state == SCI_PHY_STOPPED) ||
			    (sci_phy->is_in_link_training == true && is_phy_starting(sci_phy))) {
				is_controller_start_complete = false;
				break;
			}
@@ -1059,8 +1053,7 @@ static enum sci_status scic_controller_start(struct scic_sds_controller *scic,
	enum sci_status result;
	u16 index;

	if (scic->state_machine.current_state_id !=
	    SCI_BASE_CONTROLLER_STATE_INITIALIZED) {
	if (scic->sm.current_state_id != SCIC_INITIALIZED) {
		dev_warn(scic_to_dev(scic),
			 "SCIC Controller start operation requested in "
			 "invalid state\n");
@@ -1108,8 +1101,7 @@ static enum sci_status scic_controller_start(struct scic_sds_controller *scic,

	sci_mod_timer(&scic->timer, timeout);

	sci_base_state_machine_change_state(&scic->state_machine,
					    SCI_BASE_CONTROLLER_STATE_STARTING);
	sci_change_state(&scic->sm, SCIC_STARTING);

	return SCI_SUCCESS;
}
@@ -1279,8 +1271,7 @@ static void isci_host_completion_routine(unsigned long data)
static enum sci_status scic_controller_stop(struct scic_sds_controller *scic,
					    u32 timeout)
{
	if (scic->state_machine.current_state_id !=
	    SCI_BASE_CONTROLLER_STATE_READY) {
	if (scic->sm.current_state_id != SCIC_READY) {
		dev_warn(scic_to_dev(scic),
			 "SCIC Controller stop operation requested in "
			 "invalid state\n");
@@ -1288,8 +1279,7 @@ static enum sci_status scic_controller_stop(struct scic_sds_controller *scic,
	}

	sci_mod_timer(&scic->timer, timeout);
	sci_base_state_machine_change_state(&scic->state_machine,
					    SCI_BASE_CONTROLLER_STATE_STOPPING);
	sci_change_state(&scic->sm, SCIC_STOPPING);
	return SCI_SUCCESS;
}

@@ -1307,17 +1297,16 @@ static enum sci_status scic_controller_stop(struct scic_sds_controller *scic,
 */
static enum sci_status scic_controller_reset(struct scic_sds_controller *scic)
{
	switch (scic->state_machine.current_state_id) {
	case SCI_BASE_CONTROLLER_STATE_RESET:
	case SCI_BASE_CONTROLLER_STATE_READY:
	case SCI_BASE_CONTROLLER_STATE_STOPPED:
	case SCI_BASE_CONTROLLER_STATE_FAILED:
	switch (scic->sm.current_state_id) {
	case SCIC_RESET:
	case SCIC_READY:
	case SCIC_STOPPED:
	case SCIC_FAILED:
		/*
		 * The reset operation is not a graceful cleanup, just
		 * perform the state transition.
		 */
		sci_base_state_machine_change_state(&scic->state_machine,
				SCI_BASE_CONTROLLER_STATE_RESETTING);
		sci_change_state(&scic->sm, SCIC_RESETTING);
		return SCI_SUCCESS;
	default:
		dev_warn(scic_to_dev(scic),
@@ -1416,15 +1405,14 @@ static void isci_user_parameters_get(

static void scic_sds_controller_initial_state_enter(struct sci_base_state_machine *sm)
{
	struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine);
	struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm);

	sci_base_state_machine_change_state(&scic->state_machine,
			SCI_BASE_CONTROLLER_STATE_RESET);
	sci_change_state(&scic->sm, SCIC_RESET);
}

static inline void scic_sds_controller_starting_state_exit(struct sci_base_state_machine *sm)
{
	struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine);
	struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm);

	sci_del_timer(&scic->timer);
}
@@ -1551,7 +1539,7 @@ static enum sci_status scic_controller_set_interrupt_coalescence(

static void scic_sds_controller_ready_state_enter(struct sci_base_state_machine *sm)
{
	struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine);
	struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm);

	/* set the default interrupt coalescence number and timeout value. */
	scic_controller_set_interrupt_coalescence(scic, 0x10, 250);
@@ -1559,7 +1547,7 @@ static void scic_sds_controller_ready_state_enter(struct sci_base_state_machine

static void scic_sds_controller_ready_state_exit(struct sci_base_state_machine *sm)
{
	struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine);
	struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm);

	/* disable interrupt coalescence. */
	scic_controller_set_interrupt_coalescence(scic, 0, 0);
@@ -1650,7 +1638,7 @@ static enum sci_status scic_sds_controller_stop_devices(struct scic_sds_controll

static void scic_sds_controller_stopping_state_enter(struct sci_base_state_machine *sm)
{
	struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine);
	struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm);

	/* Stop all of the components for this controller */
	scic_sds_controller_stop_phys(scic);
@@ -1660,7 +1648,7 @@ static void scic_sds_controller_stopping_state_enter(struct sci_base_state_machi

static void scic_sds_controller_stopping_state_exit(struct sci_base_state_machine *sm)
{
	struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine);
	struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm);

	sci_del_timer(&scic->timer);
}
@@ -1691,36 +1679,35 @@ static void scic_sds_controller_reset_hardware(struct scic_sds_controller *scic)

static void scic_sds_controller_resetting_state_enter(struct sci_base_state_machine *sm)
{
	struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine);
	struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm);

	scic_sds_controller_reset_hardware(scic);
	sci_base_state_machine_change_state(&scic->state_machine,
					    SCI_BASE_CONTROLLER_STATE_RESET);
	sci_change_state(&scic->sm, SCIC_RESET);
}

static const struct sci_base_state scic_sds_controller_state_table[] = {
	[SCI_BASE_CONTROLLER_STATE_INITIAL] = {
	[SCIC_INITIAL] = {
		.enter_state = scic_sds_controller_initial_state_enter,
	},
	[SCI_BASE_CONTROLLER_STATE_RESET] = {},
	[SCI_BASE_CONTROLLER_STATE_INITIALIZING] = {},
	[SCI_BASE_CONTROLLER_STATE_INITIALIZED] = {},
	[SCI_BASE_CONTROLLER_STATE_STARTING] = {
	[SCIC_RESET] = {},
	[SCIC_INITIALIZING] = {},
	[SCIC_INITIALIZED] = {},
	[SCIC_STARTING] = {
		.exit_state  = scic_sds_controller_starting_state_exit,
	},
	[SCI_BASE_CONTROLLER_STATE_READY] = {
	[SCIC_READY] = {
		.enter_state = scic_sds_controller_ready_state_enter,
		.exit_state  = scic_sds_controller_ready_state_exit,
	},
	[SCI_BASE_CONTROLLER_STATE_RESETTING] = {
	[SCIC_RESETTING] = {
		.enter_state = scic_sds_controller_resetting_state_enter,
	},
	[SCI_BASE_CONTROLLER_STATE_STOPPING] = {
	[SCIC_STOPPING] = {
		.enter_state = scic_sds_controller_stopping_state_enter,
		.exit_state = scic_sds_controller_stopping_state_exit,
	},
	[SCI_BASE_CONTROLLER_STATE_STOPPED] = {},
	[SCI_BASE_CONTROLLER_STATE_FAILED] = {}
	[SCIC_STOPPED] = {},
	[SCIC_FAILED] = {}
};

static void scic_sds_controller_set_default_config_parameters(struct scic_sds_controller *scic)
@@ -1774,7 +1761,7 @@ static void controller_timeout(unsigned long data)
	struct sci_timer *tmr = (struct sci_timer *)data;
	struct scic_sds_controller *scic = container_of(tmr, typeof(*scic), timer);
	struct isci_host *ihost = scic_to_ihost(scic);
	struct sci_base_state_machine *sm = &scic->state_machine;
	struct sci_base_state_machine *sm = &scic->sm;
	unsigned long flags;

	spin_lock_irqsave(&ihost->scic_lock, flags);
@@ -1782,10 +1769,10 @@ static void controller_timeout(unsigned long data)
	if (tmr->cancel)
		goto done;

	if (sm->current_state_id == SCI_BASE_CONTROLLER_STATE_STARTING)
	if (sm->current_state_id == SCIC_STARTING)
		scic_sds_controller_transition_to_ready(scic, SCI_FAILURE_TIMEOUT);
	else if (sm->current_state_id == SCI_BASE_CONTROLLER_STATE_STOPPING) {
		sci_base_state_machine_change_state(sm, SCI_BASE_CONTROLLER_STATE_FAILED);
	else if (sm->current_state_id == SCIC_STOPPING) {
		sci_change_state(sm, SCIC_FAILED);
		isci_host_stop_complete(ihost, SCI_FAILURE_TIMEOUT);
	} else	/* / @todo Now what do we want to do in this case? */
		dev_err(scic_to_dev(scic),
@@ -1820,11 +1807,11 @@ static enum sci_status scic_controller_construct(struct scic_sds_controller *sci
	struct isci_host *ihost = scic_to_ihost(scic);
	u8 i;

	sci_base_state_machine_construct(&scic->state_machine,
	sci_base_state_machine_construct(&scic->sm,
					 scic_sds_controller_state_table,
					 SCI_BASE_CONTROLLER_STATE_INITIAL);
					 SCIC_INITIAL);

	sci_base_state_machine_start(&scic->state_machine);
	sci_base_state_machine_start(&scic->sm);

	scic->scu_registers = scu_base;
	scic->smu_registers = smu_base;
@@ -1899,11 +1886,11 @@ int scic_oem_parameters_validate(struct scic_sds_oem_params *oem)
static enum sci_status scic_oem_parameters_set(struct scic_sds_controller *scic,
					union scic_oem_parameters *scic_parms)
{
	u32 state = scic->state_machine.current_state_id;
	u32 state = scic->sm.current_state_id;

	if (state == SCI_BASE_CONTROLLER_STATE_RESET ||
	    state == SCI_BASE_CONTROLLER_STATE_INITIALIZING ||
	    state == SCI_BASE_CONTROLLER_STATE_INITIALIZED) {
	if (state == SCIC_RESET ||
	    state == SCIC_INITIALIZING ||
	    state == SCIC_INITIALIZED) {

		if (scic_oem_parameters_validate(&scic_parms->sds1))
			return SCI_FAILURE_INVALID_PARAMETER_VALUE;
@@ -2168,10 +2155,8 @@ static enum sci_status scic_controller_set_mode(struct scic_sds_controller *scic
{
	enum sci_status status          = SCI_SUCCESS;

	if ((scic->state_machine.current_state_id ==
				SCI_BASE_CONTROLLER_STATE_INITIALIZING) ||
	    (scic->state_machine.current_state_id ==
				SCI_BASE_CONTROLLER_STATE_INITIALIZED)) {
	if ((scic->sm.current_state_id == SCIC_INITIALIZING) ||
	    (scic->sm.current_state_id == SCIC_INITIALIZED)) {
		switch (operating_mode) {
		case SCI_MODE_SPEED:
			scic->remote_node_entries      = SCI_MAX_REMOTE_DEVICES;
@@ -2216,20 +2201,19 @@ static void scic_sds_controller_initialize_power_control(struct scic_sds_control

static enum sci_status scic_controller_initialize(struct scic_sds_controller *scic)
{
	struct sci_base_state_machine *sm = &scic->state_machine;
	struct sci_base_state_machine *sm = &scic->sm;
	enum sci_status result = SCI_SUCCESS;
	struct isci_host *ihost = scic_to_ihost(scic);
	u32 index, state;

	if (scic->state_machine.current_state_id !=
	    SCI_BASE_CONTROLLER_STATE_RESET) {
	if (scic->sm.current_state_id != SCIC_RESET) {
		dev_warn(scic_to_dev(scic),
			 "SCIC Controller initialize operation requested "
			 "in invalid state\n");
		return SCI_FAILURE_INVALID_STATE;
	}

	sci_base_state_machine_change_state(sm, SCI_BASE_CONTROLLER_STATE_INITIALIZING);
	sci_change_state(sm, SCIC_INITIALIZING);

	sci_init_timer(&scic->phy_timer, phy_startup_timeout);

@@ -2374,10 +2358,10 @@ static enum sci_status scic_controller_initialize(struct scic_sds_controller *sc

	/* Advance the controller state machine */
	if (result == SCI_SUCCESS)
		state = SCI_BASE_CONTROLLER_STATE_INITIALIZED;
		state = SCIC_INITIALIZED;
	else
		state = SCI_BASE_CONTROLLER_STATE_FAILED;
	sci_base_state_machine_change_state(sm, state);
		state = SCIC_FAILED;
	sci_change_state(sm, state);

	return result;
}
@@ -2386,11 +2370,11 @@ static enum sci_status scic_user_parameters_set(
	struct scic_sds_controller *scic,
	union scic_user_parameters *scic_parms)
{
	u32 state = scic->state_machine.current_state_id;
	u32 state = scic->sm.current_state_id;

	if (state == SCI_BASE_CONTROLLER_STATE_RESET ||
	    state == SCI_BASE_CONTROLLER_STATE_INITIALIZING ||
	    state == SCI_BASE_CONTROLLER_STATE_INITIALIZED) {
	if (state == SCIC_RESET ||
	    state == SCIC_INITIALIZING ||
	    state == SCIC_INITIALIZED) {
		u16 index;

		/*
@@ -2612,15 +2596,15 @@ int isci_host_init(struct isci_host *isci_host)
void scic_sds_controller_link_up(struct scic_sds_controller *scic,
		struct scic_sds_port *port, struct scic_sds_phy *phy)
{
	switch (scic->state_machine.current_state_id) {
	case SCI_BASE_CONTROLLER_STATE_STARTING:
	switch (scic->sm.current_state_id) {
	case SCIC_STARTING:
		sci_del_timer(&scic->phy_timer);
		scic->phy_startup_timer_pending = false;
		scic->port_agent.link_up_handler(scic, &scic->port_agent,
						 port, phy);
		scic_sds_controller_start_next_phy(scic);
		break;
	case SCI_BASE_CONTROLLER_STATE_READY:
	case SCIC_READY:
		scic->port_agent.link_up_handler(scic, &scic->port_agent,
						 port, phy);
		break;
@@ -2628,16 +2612,16 @@ void scic_sds_controller_link_up(struct scic_sds_controller *scic,
		dev_dbg(scic_to_dev(scic),
			"%s: SCIC Controller linkup event from phy %d in "
			"unexpected state %d\n", __func__, phy->phy_index,
			scic->state_machine.current_state_id);
			scic->sm.current_state_id);
	}
}

void scic_sds_controller_link_down(struct scic_sds_controller *scic,
		struct scic_sds_port *port, struct scic_sds_phy *phy)
{
	switch (scic->state_machine.current_state_id) {
	case SCI_BASE_CONTROLLER_STATE_STARTING:
	case SCI_BASE_CONTROLLER_STATE_READY:
	switch (scic->sm.current_state_id) {
	case SCIC_STARTING:
	case SCIC_READY:
		scic->port_agent.link_down_handler(scic, &scic->port_agent,
						   port, phy);
		break;
@@ -2647,7 +2631,7 @@ void scic_sds_controller_link_down(struct scic_sds_controller *scic,
			"unexpected state %d\n",
			__func__,
			phy->phy_index,
			scic->state_machine.current_state_id);
			scic->sm.current_state_id);
	}
}

@@ -2663,8 +2647,7 @@ static bool scic_sds_controller_has_remote_devices_stopping(

	for (index = 0; index < controller->remote_node_entries; index++) {
		if ((controller->device_table[index] != NULL) &&
		   (controller->device_table[index]->state_machine.current_state_id
		    == SCI_BASE_REMOTE_DEVICE_STATE_STOPPING))
		   (controller->device_table[index]->sm.current_state_id == SCI_DEV_STOPPING))
			return true;
	}

@@ -2678,19 +2661,17 @@ static bool scic_sds_controller_has_remote_devices_stopping(
void scic_sds_controller_remote_device_stopped(struct scic_sds_controller *scic,
					       struct scic_sds_remote_device *sci_dev)
{
	if (scic->state_machine.current_state_id !=
	    SCI_BASE_CONTROLLER_STATE_STOPPING) {
	if (scic->sm.current_state_id != SCIC_STOPPING) {
		dev_dbg(scic_to_dev(scic),
			"SCIC Controller 0x%p remote device stopped event "
			"from device 0x%p in unexpected state %d\n",
			scic, sci_dev,
			scic->state_machine.current_state_id);
			scic->sm.current_state_id);
		return;
	}

	if (!scic_sds_controller_has_remote_devices_stopping(scic)) {
		sci_base_state_machine_change_state(&scic->state_machine,
				SCI_BASE_CONTROLLER_STATE_STOPPED);
		sci_change_state(&scic->sm, SCIC_STOPPED);
	}
}

@@ -2948,8 +2929,7 @@ enum sci_status scic_controller_start_io(
{
	enum sci_status status;

	if (scic->state_machine.current_state_id !=
	    SCI_BASE_CONTROLLER_STATE_READY) {
	if (scic->sm.current_state_id != SCIC_READY) {
		dev_warn(scic_to_dev(scic), "invalid state to start I/O");
		return SCI_FAILURE_INVALID_STATE;
	}
@@ -2986,8 +2966,7 @@ enum sci_status scic_controller_terminate_request(
{
	enum sci_status status;

	if (scic->state_machine.current_state_id !=
	    SCI_BASE_CONTROLLER_STATE_READY) {
	if (scic->sm.current_state_id != SCIC_READY) {
		dev_warn(scic_to_dev(scic),
			 "invalid state to terminate request\n");
		return SCI_FAILURE_INVALID_STATE;
@@ -3037,11 +3016,11 @@ enum sci_status scic_controller_complete_io(
	enum sci_status status;
	u16 index;

	switch (scic->state_machine.current_state_id) {
	case SCI_BASE_CONTROLLER_STATE_STOPPING:
	switch (scic->sm.current_state_id) {
	case SCIC_STOPPING:
		/* XXX: Implement this function */
		return SCI_FAILURE;
	case SCI_BASE_CONTROLLER_STATE_READY:
	case SCIC_READY:
		status = scic_sds_remote_device_complete_io(scic, rdev, request);
		if (status != SCI_SUCCESS)
			return status;
@@ -3060,8 +3039,7 @@ enum sci_status scic_controller_continue_io(struct scic_sds_request *sci_req)
{
	struct scic_sds_controller *scic = sci_req->owning_controller;

	if (scic->state_machine.current_state_id !=
	    SCI_BASE_CONTROLLER_STATE_READY) {
	if (scic->sm.current_state_id != SCIC_READY) {
		dev_warn(scic_to_dev(scic), "invalid state to continue I/O");
		return SCI_FAILURE_INVALID_STATE;
	}
@@ -3107,8 +3085,7 @@ enum sci_task_status scic_controller_start_task(
{
	enum sci_status status;

	if (scic->state_machine.current_state_id !=
	    SCI_BASE_CONTROLLER_STATE_READY) {
	if (scic->sm.current_state_id != SCIC_READY) {
		dev_warn(scic_to_dev(scic),
			 "%s: SCIC Controller starting task from invalid "
			 "state\n",
+11 −14
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ struct scic_sds_controller {
	 * This field contains the information for the base controller state
	 * machine.
	 */
	struct sci_base_state_machine state_machine;
	struct sci_base_state_machine sm;

	/**
	 * Timer for controller start/stop operations.
@@ -359,7 +359,7 @@ enum scic_sds_controller_states {
	/**
	 * Simply the initial state for the base controller state machine.
	 */
	SCI_BASE_CONTROLLER_STATE_INITIAL = 0,
	SCIC_INITIAL = 0,

	/**
	 * This state indicates that the controller is reset.  The memory for
@@ -368,7 +368,7 @@ enum scic_sds_controller_states {
	 * This state is entered from the INITIAL state.
	 * This state is entered from the RESETTING state.
	 */
	SCI_BASE_CONTROLLER_STATE_RESET,
	SCIC_RESET,

	/**
	 * This state is typically an action state that indicates the controller
@@ -376,28 +376,28 @@ enum scic_sds_controller_states {
	 * are permitted.
	 * This state is entered from the RESET state.
	 */
	SCI_BASE_CONTROLLER_STATE_INITIALIZING,
	SCIC_INITIALIZING,

	/**
	 * This state indicates that the controller has been successfully
	 * initialized.  In this state no new IO operations are permitted.
	 * This state is entered from the INITIALIZING state.
	 */
	SCI_BASE_CONTROLLER_STATE_INITIALIZED,
	SCIC_INITIALIZED,

	/**
	 * This state indicates the the controller is in the process of becoming
	 * ready (i.e. starting).  In this state no new IO operations are permitted.
	 * This state is entered from the INITIALIZED state.
	 */
	SCI_BASE_CONTROLLER_STATE_STARTING,
	SCIC_STARTING,

	/**
	 * This state indicates the controller is now ready.  Thus, the user
	 * is able to perform IO operations on the controller.
	 * This state is entered from the STARTING state.
	 */
	SCI_BASE_CONTROLLER_STATE_READY,
	SCIC_READY,

	/**
	 * This state is typically an action state that indicates the controller
@@ -408,7 +408,7 @@ enum scic_sds_controller_states {
	 * This state is entered from the FAILED state.
	 * This state is entered from the STOPPED state.
	 */
	SCI_BASE_CONTROLLER_STATE_RESETTING,
	SCIC_RESETTING,

	/**
	 * This state indicates that the controller is in the process of stopping.
@@ -416,14 +416,14 @@ enum scic_sds_controller_states {
	 * operations are allowed to complete.
	 * This state is entered from the READY state.
	 */
	SCI_BASE_CONTROLLER_STATE_STOPPING,
	SCIC_STOPPING,

	/**
	 * This state indicates that the controller has successfully been stopped.
	 * In this state no new IO operations are permitted.
	 * This state is entered from the STOPPING state.
	 */
	SCI_BASE_CONTROLLER_STATE_STOPPED,
	SCIC_STOPPED,

	/**
	 * This state indicates that the controller could not successfully be
@@ -433,10 +433,7 @@ enum scic_sds_controller_states {
	 * This state is entered from the STOPPING state.
	 * This state is entered from the RESETTING state.
	 */
	SCI_BASE_CONTROLLER_STATE_FAILED,

	SCI_BASE_CONTROLLER_MAX_STATES

	SCIC_FAILED,
};


+106 −138

File changed.

Preview size limit exceeded, changes collapsed.

+17 −17
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ struct scic_sds_phy {
	/**
	 * This field contains the information for the base phy state machine.
	 */
	struct sci_base_state_machine state_machine;
	struct sci_base_state_machine sm;

	/**
	 * This field specifies the port object that owns/contains this phy.
@@ -410,7 +410,7 @@ enum scic_sds_phy_states {
	/**
	 * Simply the initial state for the base domain state machine.
	 */
	SCI_BASE_PHY_STATE_INITIAL,
	SCI_PHY_INITIAL,

	/**
	 * This state indicates that the phy has successfully been stopped.
@@ -420,7 +420,7 @@ enum scic_sds_phy_states {
	 * This state is entered from the READY state.
	 * This state is entered from the RESETTING state.
	 */
	SCI_BASE_PHY_STATE_STOPPED,
	SCI_PHY_STOPPED,

	/**
	 * This state indicates that the phy is in the process of becomming
@@ -429,57 +429,57 @@ enum scic_sds_phy_states {
	 * This state is entered from the READY state.
	 * This state is entered from the RESETTING state.
	 */
	SCI_BASE_PHY_STATE_STARTING,
	SCI_PHY_STARTING,

	/**
	 * Initial state
	 */
	SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL,
	SCI_PHY_SUB_INITIAL,

	/**
	 * Wait state for the hardware OSSP event type notification
	 */
	SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN,
	SCI_PHY_SUB_AWAIT_OSSP_EN,

	/**
	 * Wait state for the PHY speed notification
	 */
	SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN,
	SCI_PHY_SUB_AWAIT_SAS_SPEED_EN,

	/**
	 * Wait state for the IAF Unsolicited frame notification
	 */
	SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF,
	SCI_PHY_SUB_AWAIT_IAF_UF,

	/**
	 * Wait state for the request to consume power
	 */
	SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER,
	SCI_PHY_SUB_AWAIT_SAS_POWER,

	/**
	 * Wait state for request to consume power
	 */
	SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER,
	SCI_PHY_SUB_AWAIT_SATA_POWER,

	/**
	 * Wait state for the SATA PHY notification
	 */
	SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN,
	SCI_PHY_SUB_AWAIT_SATA_PHY_EN,

	/**
	 * Wait for the SATA PHY speed notification
	 */
	SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN,
	SCI_PHY_SUB_AWAIT_SATA_SPEED_EN,

	/**
	 * Wait state for the SIGNATURE FIS unsolicited frame notification
	 */
	SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF,
	SCI_PHY_SUB_AWAIT_SIG_FIS_UF,

	/**
	 * Exit state for this state machine
	 */
	SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL,
	SCI_PHY_SUB_FINAL,

	/**
	 * This state indicates the the phy is now ready.  Thus, the user
@@ -487,19 +487,19 @@ enum scic_sds_phy_states {
	 * is currently part of a valid port.
	 * This state is entered from the STARTING state.
	 */
	SCI_BASE_PHY_STATE_READY,
	SCI_PHY_READY,

	/**
	 * This state indicates that the phy is in the process of being reset.
	 * In this state no new IO operations are permitted on this phy.
	 * This state is entered from the READY state.
	 */
	SCI_BASE_PHY_STATE_RESETTING,
	SCI_PHY_RESETTING,

	/**
	 * Simply the final state for the base phy state machine.
	 */
	SCI_BASE_PHY_STATE_FINAL,
	SCI_PHY_FINAL,
};

/**
+93 −93

File changed.

Preview size limit exceeded, changes collapsed.

Loading