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

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
This diff is collapsed.
......@@ -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,
};
......
This diff is collapsed.
......@@ -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,
};
/**
......
This diff is collapsed.
......@@ -84,7 +84,7 @@ struct scic_sds_port {
/**
* This field contains the information for the base port state machine.
*/
struct sci_base_state_machine state_machine;
struct sci_base_state_machine sm;
bool ready_exit;
......@@ -224,7 +224,7 @@ enum scic_sds_port_states {
* In this state no new IO operations are permitted.
* This state is entered from the STOPPING state.
*/
SCI_BASE_PORT_STATE_STOPPED,
SCI_PORT_STOPPED,
/**
* This state indicates that the port is in the process of stopping.
......@@ -232,33 +232,33 @@ enum scic_sds_port_states {
* operations are allowed to complete.
* This state is entered from the READY state.
*/
SCI_BASE_PORT_STATE_STOPPING,
SCI_PORT_STOPPING,
/**
* This state indicates the port is now ready. Thus, the user is
* able to perform IO operations on this port.
* This state is entered from the STARTING state.
*/
SCI_BASE_PORT_STATE_READY,
SCI_PORT_READY,
/**
* The substate where the port is started and ready but has no
* active phys.
*/
SCIC_SDS_PORT_READY_SUBSTATE_WAITING,
SCI_PORT_SUB_WAITING,
/**
* The substate where the port is started and ready and there is
* at least one phy operational.
*/
SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL,
SCI_PORT_SUB_OPERATIONAL,
/**
* The substate where the port is started and there was an
* add/remove phy event. This state is only used in Automatic
* Port Configuration Mode (APC)
*/
SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING,
SCI_PORT_SUB_CONFIGURING,
/**
* This state indicates the port is in the process of performing a hard
......@@ -266,14 +266,14 @@ enum scic_sds_port_states {
* port.
* This state is entered from the READY state.
*/
SCI_BASE_PORT_STATE_RESETTING,
SCI_PORT_RESETTING,
/**
* This state indicates the port has failed a reset request. This state
* is entered when a port reset request times out.
* This state is entered from the RESETTING state.
*/
SCI_BASE_PORT_STATE_FAILED,
SCI_PORT_FAILED,
};
......
......@@ -661,13 +661,13 @@ static void scic_sds_apc_agent_link_up(struct scic_sds_controller *scic,
scic_sds_apc_agent_configure_ports(scic, port_agent, sci_phy, true);
} else {
/* the phy is already the part of the port */
u32 port_state = sci_port->state_machine.current_state_id;
u32 port_state = sci_port->sm.current_state_id;
/* if the PORT'S state is resetting then the link up is from
* port hard reset in this case, we need to tell the port
* that link up is recieved
*/
BUG_ON(port_state != SCI_BASE_PORT_STATE_RESETTING);
BUG_ON(port_state != SCI_PORT_RESETTING);
port_agent->phy_ready_mask |= 1 << phy_index;
scic_sds_port_link_up(sci_port, sci_phy);
}
......
This diff is collapsed.
......@@ -74,7 +74,7 @@ struct scic_sds_remote_device {
* This field contains the information for the base remote device state
* machine.
*/
struct sci_base_state_machine state_machine;
struct sci_base_state_machine sm;
/**
* This field is the programmed device port width. This value is
......@@ -109,7 +109,7 @@ struct scic_sds_remote_device {
/**
* This field contains the stated request count for the remote device. The
* device can not reach the SCI_BASE_REMOTE_DEVICE_STATE_STOPPED until all
* device can not reach the SCI_DEV_STOPPED until all
* requests are complete and the rnc_posted value is false.
*/
u32 started_request_count;
......@@ -213,7 +213,7 @@ enum scic_sds_remote_device_states {
/**
* Simply the initial state for the base remote device state machine.
*/
SCI_BASE_REMOTE_DEVICE_STATE_INITIAL,
SCI_DEV_INITIAL,
/**
* This state indicates that the remote device has successfully been
......@@ -221,7 +221,7 @@ enum scic_sds_remote_device_states {
* This state is entered from the INITIAL state.
* This state is entered from the STOPPING state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_STOPPED,
SCI_DEV_STOPPED,
/**
* This state indicates the the remote device is in the process of
......@@ -229,34 +229,34 @@ enum scic_sds_remote_device_states {
* are permitted.
* This state is entered from the STOPPED state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_STARTING,
SCI_DEV_STARTING,
/**
* This state indicates the remote device is now ready. Thus, the user
* is able to perform IO operations on the remote device.
* This state is entered from the STARTING state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_READY,
SCI_DEV_READY,
/**
* This is the idle substate for the stp remote device. When there are no
* active IO for the device it is is in this state.
*/
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE,
SCI_STP_DEV_IDLE,
/**
* This is the command state for for the STP remote device. This state is
* entered when the device is processing a non-NCQ command. The device object
* will fail any new start IO requests until this command is complete.
*/
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD,
SCI_STP_DEV_CMD,
/**
* This is the NCQ state for the STP remote device. This state is entered
* when the device is processing an NCQ reuqest. It will remain in this state
* so long as there is one or more NCQ requests being processed.
*/
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ,
SCI_STP_DEV_NCQ,
/**
* This is the NCQ error state for the STP remote device. This state is
......@@ -264,25 +264,25 @@ enum scic_sds_remote_device_states {
* NCQ state. The device object will only accept a READ LOG command while in
* this state.
*/
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR,
SCI_STP_DEV_NCQ_ERROR,
/**
* This is the READY substate indicates the device is waiting for the RESET task
* coming to be recovered from certain hardware specific error.
*/
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET,
SCI_STP_DEV_AWAIT_RESET,
/**
* This is the ready operational substate for the remote device. This is the
* normal operational state for a remote device.
*/
SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE,
SCI_SMP_DEV_IDLE,
/**
* This is the suspended state for the remote device. This is the state that
* the device is placed in when a RNC suspend is received by the SCU hardware.
*/
SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD,
SCI_SMP_DEV_CMD,
/**
* This state indicates that the remote device is in the process of
......@@ -291,7 +291,7 @@ enum scic_sds_remote_device_states {
* This state is entered from the READY state.
* This state is entered from the FAILED state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_STOPPING,
SCI_DEV_STOPPING,
/**
* This state indicates that the remote device has failed.
......@@ -299,19 +299,19 @@ enum scic_sds_remote_device_states {
* This state is entered from the INITIALIZING state.
* This state is entered from the READY state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_FAILED,
SCI_DEV_FAILED,
/**
* This state indicates the device is being reset.
* In this state no new IO operations are permitted.
* This state is entered from the READY state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_RESETTING,
SCI_DEV_RESETTING,
/**
* Simply the final state for the base remote device state machine.
*/
SCI_BASE_REMOTE_DEVICE_STATE_FINAL,
SCI_DEV_FINAL,
};
static inline struct scic_sds_remote_device *rnc_to_dev(struct scic_sds_remote_node_context *rnc)
......
This diff is collapsed.
......@@ -92,45 +92,45 @@ enum scis_sds_remote_node_context_states {
* This state is the initial state for a remote node context. On a resume
* request the remote node context will transition to the posting state.
*/
SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE,
SCI_RNC_INITIAL,
/**
* This is a transition state that posts the RNi to the hardware. Once the RNC
* is posted the remote node context will be made ready.
*/
SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE,
SCI_RNC_POSTING,
/**
* This is a transition state that will post an RNC invalidate to the
* hardware. Once the invalidate is complete the remote node context will
* transition to the posting state.
*/
SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE,
SCI_RNC_INVALIDATING,
/**
* This is a transition state that will post an RNC resume to the hardare.
* Once the event notification of resume complete is received the remote node
* context will transition to the ready state.
*/
SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE,
SCI_RNC_RESUMING,
/**
* This is the state that the remote node context must be in to accept io
* request operations.
*/
SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE,
SCI_RNC_READY,
/**
* This is the state that the remote node context transitions to when it gets
* a TX suspend notification from the hardware.
*/
SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE,
SCI_RNC_TX_SUSPENDED,
/**
* This is the state that the remote node context transitions to when it gets
* a TX RX suspend notification from the hardware.
*/
SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE,
SCI_RNC_TX_RX_SUSPENDED,
/**
* This state is a wait state for the remote node context that waits for a
......@@ -138,7 +138,7 @@ enum scis_sds_remote_node_context_states {
* there is a request to supend the remote node context or when there is a TC
* completion where the remote node will be suspended by the hardware.
*/
SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE
SCI_RNC_AWAIT_SUSPENSION
};
/**
......@@ -194,7 +194,7 @@ struct scic_sds_remote_node_context {
/**
* This field contains the data for the object's state machine.
*/
struct sci_base_state_machine state_machine;
struct sci_base_state_machine sm;
};
void scic_sds_remote_node_context_construct(struct scic_sds_remote_node_context *rnc,
......
This diff is collapsed.
This diff is collapsed.
......@@ -127,16 +127,7 @@ void sci_base_state_machine_stop(
sci_state_machine_exit_state(sm);
}
/**
* This method performs an update to the current state of the state machine.
* @sm: This parameter specifies the state machine for which
* the caller wishes to perform a state change.
* @next_state: This parameter specifies the new state for the state machine.
*
*/
void sci_base_state_machine_change_state(
struct sci_base_state_machine *sm,
u32 next_state)
void sci_change_state(struct sci_base_state_machine *sm, u32 next_state)
{
sci_state_machine_exit_state(sm);
......@@ -145,18 +136,3 @@ void sci_base_state_machine_change_state(
sci_state_machine_enter_state(sm);
}
/**
* This method simply returns the current state of the state machine to the
* caller.
* @sm: This parameter specifies the state machine for which to
* retrieve the current state.
*
* This method returns a u32 value indicating the current state for the
* supplied state machine.
*/
u32 sci_base_state_machine_get_state(struct sci_base_state_machine *sm)
{
return sm->current_state_id;
}
......@@ -117,8 +117,6 @@ void sci_base_state_machine_construct(struct sci_base_state_machine *sm,
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);
void sci_change_state(struct sci_base_state_machine *sm, u32 next_state);
#endif /* _SCI_BASE_STATE_MACHINE_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment