#define SCIC_SDS_PORT_HARD_RESET_TIMEOUT (1000)
#define SCU_DUMMY_INDEX (0xFFFF)
-static struct scic_sds_port_state_handler scic_sds_port_state_handler_table[];
-
static void isci_port_change_state(struct isci_port *iport, enum isci_status status)
{
unsigned long flags;
return true;
}
-/**
- * This method is the entry point for the phy to inform the port that it is now
- * in a ready state
- * @sci_port:
- *
- *
- */
-void scic_sds_port_link_up(
- struct scic_sds_port *sci_port,
- struct scic_sds_phy *sci_phy)
-{
- sci_phy->is_in_link_training = false;
-
- sci_port->state_handlers->link_up_handler(sci_port, sci_phy);
-}
-
-/**
- * This method is the entry point for the phy to inform the port that it is no
- * longer in a ready state
- * @sci_port:
- *
- *
- */
-void scic_sds_port_link_down(
- struct scic_sds_port *sci_port,
- struct scic_sds_phy *sci_phy)
-{
- sci_port->state_handlers->link_down_handler(sci_port, sci_phy);
-}
-
-/**
- * This method is called to start an IO request on this port.
- * @sci_port:
- * @sci_dev:
- * @sci_req:
- *
- * enum sci_status
- */
-enum sci_status scic_sds_port_start_io(
- struct scic_sds_port *sci_port,
- struct scic_sds_remote_device *sci_dev,
- struct scic_sds_request *sci_req)
-{
- return sci_port->state_handlers->start_io_handler(
- sci_port, sci_dev, sci_req);
-}
-
-/**
- * This method is called to complete an IO request to the port.
- * @sci_port:
- * @sci_dev:
- * @sci_req:
- *
- * enum sci_status
- */
-enum sci_status scic_sds_port_complete_io(
- struct scic_sds_port *sci_port,
- struct scic_sds_remote_device *sci_dev,
- struct scic_sds_request *sci_req)
-{
- return sci_port->state_handlers->complete_io_handler(
- sci_port, sci_dev, sci_req);
-}
-
/**
* This method is provided to timeout requests for port operations. Mostly its
* for the port reset operation.
}
}
-/*
- * ****************************************************************************
- * * READY SUBSTATE HANDLERS
- * **************************************************************************** */
-
-/*
- * This method is the general ready substate complete io handler for the
- * struct scic_sds_port object. This function decrments the outstanding request count
- * for this port object. enum sci_status SCI_SUCCESS
- */
-static enum sci_status scic_sds_port_ready_substate_complete_io_handler(
- struct scic_sds_port *port,
- struct scic_sds_remote_device *device,
- struct scic_sds_request *io_request)
-{
- scic_sds_port_decrement_request_count(port);
-
- return SCI_SUCCESS;
-}
-
-/**
- *
- * @sci_port: This is the struct scic_sds_port object that which has a phy that has
- * gone link up.
- * @sci_phy: This is the struct scic_sds_phy object that has gone link up.
- *
- * This method is the ready waiting substate link up handler for the
- * struct scic_sds_port object. This methos will report the link up condition for
- * this port and will transition to the ready operational substate. none
- */
-static void scic_sds_port_ready_waiting_substate_link_up_handler(
- struct scic_sds_port *sci_port,
- struct scic_sds_phy *sci_phy)
-{
- /*
- * Since this is the first phy going link up for the port we can just enable
- * it and continue. */
- scic_sds_port_activate_phy(sci_port, sci_phy, true);
-
- port_state_machine_change(sci_port,
- SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL);
-}
-
-/*
- * This method is the ready waiting substate start io handler for the
- * struct scic_sds_port object. The port object can not accept new requests so the
- * request is failed. enum sci_status SCI_FAILURE_INVALID_STATE
- */
-static enum sci_status scic_sds_port_ready_waiting_substate_start_io_handler(
- struct scic_sds_port *port,
- struct scic_sds_remote_device *device,
- struct scic_sds_request *io_request)
-{
- return SCI_FAILURE_INVALID_STATE;
-}
-
-/**
- * scic_sds_port_ready_operational_substate_link_up_handler() -
- * @sci_port: This is the struct scic_sds_port object that which has a phy that has
- * gone link up.
- * @sci_phy: This is the struct scic_sds_phy object that has gone link up.
- *
- * This method is the ready operational substate link up handler for the
- * struct scic_sds_port object. This function notifies the SCI User that the phy has
- * gone link up. none
- */
-static void scic_sds_port_ready_operational_substate_link_up_handler(
- struct scic_sds_port *sci_port,
- struct scic_sds_phy *sci_phy)
-{
- scic_sds_port_general_link_up_handler(sci_port, sci_phy, true);
-}
-
-/**
- * scic_sds_port_ready_operational_substate_link_down_handler() -
- * @sci_port: This is the struct scic_sds_port object that which has a phy that has
- * gone link down.
- * @sci_phy: This is the struct scic_sds_phy object that has gone link down.
- *
- * This method is the ready operational substate link down handler for the
- * struct scic_sds_port object. This function notifies the SCI User that the phy has
- * gone link down and if this is the last phy in the port the port will change
- * state to the ready waiting substate. none
- */
-static void scic_sds_port_ready_operational_substate_link_down_handler(
- struct scic_sds_port *sci_port,
- struct scic_sds_phy *sci_phy)
-{
- scic_sds_port_deactivate_phy(sci_port, sci_phy, true);
-
- /*
- * If there are no active phys left in the port, then transition
- * the port to the WAITING state until such time as a phy goes
- * link up. */
- if (sci_port->active_phy_mask == 0)
- port_state_machine_change(sci_port,
- SCIC_SDS_PORT_READY_SUBSTATE_WAITING);
-}
-
-/*
- * This method is the ready operational substate start io handler for the
- * struct scic_sds_port object. This function incremetns the outstanding request
- * count for this port object. enum sci_status SCI_SUCCESS
- */
-static enum sci_status scic_sds_port_ready_operational_substate_start_io_handler(
- struct scic_sds_port *port,
- struct scic_sds_remote_device *device,
- struct scic_sds_request *io_request)
-{
- port->started_request_count++;
- return SCI_SUCCESS;
-}
-
-/**
- * scic_sds_port_ready_configuring_substate_complete_io_handler() -
- * @port: This is the port that is being requested to complete the io request.
- * @device: This is the device on which the io is completing.
- *
- * This method will decrement the outstanding request count for this port. If
- * the request count goes to 0 then the port can be reprogrammed with its new
- * phy data.
- */
-static enum sci_status
-scic_sds_port_ready_configuring_substate_complete_io_handler(
- struct scic_sds_port *port,
- struct scic_sds_remote_device *device,
- struct scic_sds_request *io_request)
-{
- scic_sds_port_decrement_request_count(port);
-
- if (port->started_request_count == 0) {
- port_state_machine_change(port,
- SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL);
- }
-
- return SCI_SUCCESS;
-}
-
-static enum sci_status default_port_handler(struct scic_sds_port *sci_port,
- const char *func)
-{
- dev_warn(sciport_to_dev(sci_port),
- "%s: in wrong state: %d\n", func,
- sci_base_state_machine_get_state(&sci_port->state_machine));
- return SCI_FAILURE_INVALID_STATE;
-}
-
-/*
- * This is the default method for a port unsolicited frame request. It will
- * report a warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE Is it even
- * possible to receive an unsolicited frame directed to a port object? It
- * seems possible if we implementing virtual functions but until then?
- */
-static enum sci_status
-scic_sds_port_default_frame_handler(struct scic_sds_port *sci_port,
- u32 frame_index)
-{
- struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port);
-
- default_port_handler(sci_port, __func__);
- scic_sds_controller_release_frame(scic, frame_index);
-
- return SCI_FAILURE_INVALID_STATE;
-}
-
-static enum sci_status scic_sds_port_default_event_handler(struct scic_sds_port *sci_port,
- u32 event_code)
-{
- return default_port_handler(sci_port, __func__);
-}
-
-static void scic_sds_port_default_link_up_handler(struct scic_sds_port *sci_port,
- struct scic_sds_phy *sci_phy)
-{
- default_port_handler(sci_port, __func__);
-}
-
-static void scic_sds_port_default_link_down_handler(struct scic_sds_port *sci_port,
- struct scic_sds_phy *sci_phy)
-{
- default_port_handler(sci_port, __func__);
-}
-
-static enum sci_status scic_sds_port_default_start_io_handler(struct scic_sds_port *sci_port,
- struct scic_sds_remote_device *sci_dev,
- struct scic_sds_request *sci_req)
-{
- return default_port_handler(sci_port, __func__);
-}
-
-static enum sci_status scic_sds_port_default_complete_io_handler(struct scic_sds_port *sci_port,
- struct scic_sds_remote_device *sci_dev,
- struct scic_sds_request *sci_req)
-{
- return default_port_handler(sci_port, __func__);
-}
-
-/*
- * ******************************************************************************
- * * PORT STATE PRIVATE METHODS
- * ****************************************************************************** */
-
/**
*
* @sci_port: This is the struct scic_sds_port object to suspend.
writel(pts_control_value, &port->port_task_scheduler_registers->control);
}
-/*
- * ******************************************************************************
- * * PORT READY SUBSTATE METHODS
- * ****************************************************************************** */
-
-/**
- *
- * @object: This is the object which is cast to a struct scic_sds_port object.
- *
- * This method will perform the actions required by the struct scic_sds_port on
- * entering the SCIC_SDS_PORT_READY_SUBSTATE_WAITING. This function checks the
- * port for any ready phys. If there is at least one phy in a ready state then
- * the port transitions to the ready operational substate. none
- */
static void scic_sds_port_ready_substate_waiting_enter(void *object)
{
struct scic_sds_port *sci_port = object;
- scic_sds_port_set_base_state_handlers(
- sci_port, SCIC_SDS_PORT_READY_SUBSTATE_WAITING
- );
-
scic_sds_port_suspend_port_task_scheduler(sci_port);
sci_port->not_ready_reason = SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS;
}
}
-/**
- *
- * @object: This is the object which is cast to a struct scic_sds_port object.
- *
- * This function will perform the actions required by the struct scic_sds_port
- * on entering the SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL. This function sets
- * the state handlers for the port object, notifies the SCI User that the port
- * is ready, and resumes port operations. none
- */
static void scic_sds_port_ready_substate_operational_enter(void *object)
{
u32 index;
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_port *iport = sci_port_to_iport(sci_port);
- scic_sds_port_set_base_state_handlers(
- sci_port,
- SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL);
-
isci_port_ready(ihost, iport);
for (index = 0; index < SCI_MAX_PHYS; index++) {
scic_sds_port_invalidate_dummy_remote_node(sci_port);
}
-/*
- * ******************************************************************************
- * * PORT READY CONFIGURING METHODS
- * ****************************************************************************** */
-
-/**
- * scic_sds_port_ready_substate_configuring_enter() -
- * @object: This is the object which is cast to a struct scic_sds_port object.
- *
- * This method will perform the actions required by the struct scic_sds_port on
- * 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_configuring_enter(void *object)
{
struct scic_sds_port *sci_port = object;
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_port *iport = sci_port_to_iport(sci_port);
- scic_sds_port_set_base_state_handlers(
- sci_port,
- SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING);
-
if (sci_port->active_phy_mask == 0) {
isci_port_not_ready(ihost, iport);
scic_sds_port_invalidate_dummy_remote_node(sci_port);
}
-/* --------------------------------------------------------------------------- */
-
-/**
- *
- * @port: This is the struct scic_sds_port object on which the io request count will
- * be decremented.
- * @device: This is the struct scic_sds_remote_device object to which the io request
- * is being directed. This parameter is not required to complete this
- * operation.
- * @io_request: This is the request that is being completed on this port
- * object. This parameter is not required to complete this operation.
- *
- * This is a general complete io request handler for the struct scic_sds_port object.
- * enum sci_status SCI_SUCCESS
- */
-static enum sci_status scic_sds_port_general_complete_io_handler(
- struct scic_sds_port *port,
- struct scic_sds_remote_device *device,
- struct scic_sds_request *io_request)
-{
- scic_sds_port_decrement_request_count(port);
-
- return SCI_SUCCESS;
-}
-
-/*
- * This method takes the struct scic_sds_port that is in a stopping state and handles
- * the complete io request. Should the request count reach 0 then the port
- * object will transition to the stopped state. enum sci_status SCI_SUCCESS
- */
-static enum sci_status scic_sds_port_stopping_state_complete_io_handler(
- struct scic_sds_port *sci_port,
- struct scic_sds_remote_device *device,
- struct scic_sds_request *io_request)
-{
- scic_sds_port_decrement_request_count(sci_port);
-
- if (sci_port->started_request_count == 0)
- port_state_machine_change(sci_port,
- SCI_BASE_PORT_STATE_STOPPED);
-
- return SCI_SUCCESS;
-}
-
-/*
- * ****************************************************************************
- * * RESETTING STATE HANDLERS
- * **************************************************************************** */
-
-/*
- * This method will transition a failed port to its ready state. The port
- * failed because a hard reset request timed out but at some time later one or
- * more phys in the port became ready. enum sci_status SCI_SUCCESS
- */
-static void scic_sds_port_reset_state_link_up_handler(
- struct scic_sds_port *port,
- struct scic_sds_phy *phy)
-{
- /*
- * / @todo We should make sure that the phy that has gone link up is the same
- * / one on which we sent the reset. It is possible that the phy on
- * / which we sent the reset is not the one that has gone link up and we
- * / want to make sure that phy being reset comes back. Consider the
- * / case where a reset is sent but before the hardware processes the
- * / reset it get a link up on the port because of a hot plug event.
- * / because of the reset request this phy will go link down almost
- * / immediately. */
-
- /*
- * In the resetting state we don't notify the user regarding
- * link up and link down notifications. */
- scic_sds_port_general_link_up_handler(port, phy, false);
-}
-
-/*
- * This method process link down notifications that occur during a port reset
- * operation. Link downs can occur during the reset operation. enum sci_status
- * SCI_SUCCESS
- */
-static void scic_sds_port_reset_state_link_down_handler(
- struct scic_sds_port *port,
- struct scic_sds_phy *phy)
-{
- /*
- * In the resetting state we don't notify the user regarding
- * link up and link down notifications. */
- scic_sds_port_deactivate_phy(port, phy, false);
-}
-
enum sci_status scic_sds_port_start(struct scic_sds_port *sci_port)
{
struct scic_sds_controller *scic = sci_port->owning_controller;
*/
port_state_machine_change(sci_port,
SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING);
+ return SCI_SUCCESS;
+ default:
+ dev_warn(sciport_to_dev(sci_port),
+ "%s: in wrong state: %d\n", __func__, state);
+ return SCI_FAILURE_INVALID_STATE;
+ }
+}
+
+enum sci_status scic_sds_port_link_up(struct scic_sds_port *sci_port,
+ struct scic_sds_phy *sci_phy)
+{
+ enum scic_sds_port_states state;
+
+ state = sci_port->state_machine.current_state_id;
+ switch (state) {
+ case SCIC_SDS_PORT_READY_SUBSTATE_WAITING:
+ /* Since this is the first phy going link up for the port we
+ * can just enable it and continue
+ */
+ scic_sds_port_activate_phy(sci_port, sci_phy, true);
+
+ port_state_machine_change(sci_port,
+ SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL);
+ return SCI_SUCCESS;
+ case SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL:
+ scic_sds_port_general_link_up_handler(sci_port, sci_phy, true);
+ return SCI_SUCCESS;
+ case SCI_BASE_PORT_STATE_RESETTING:
+ /* TODO We should make sure that the phy that has gone
+ * link up is the same one on which we sent the reset. It is
+ * possible that the phy on which we sent the reset is not the
+ * one that has gone link up and we want to make sure that
+ * phy being reset comes back. Consider the case where a
+ * reset is sent but before the hardware processes the reset it
+ * get a link up on the port because of a hot plug event.
+ * because of the reset request this phy will go link down
+ * almost immediately.
+ */
+ /* In the resetting state we don't notify the user regarding
+ * link up and link down notifications.
+ */
+ scic_sds_port_general_link_up_handler(sci_port, sci_phy, false);
return SCI_SUCCESS;
default:
dev_warn(sciport_to_dev(sci_port),
}
}
-static struct scic_sds_port_state_handler scic_sds_port_state_handler_table[] = {
- [SCI_BASE_PORT_STATE_STOPPED] = {
- .frame_handler = scic_sds_port_default_frame_handler,
- .event_handler = scic_sds_port_default_event_handler,
- .link_up_handler = scic_sds_port_default_link_up_handler,
- .link_down_handler = scic_sds_port_default_link_down_handler,
- .start_io_handler = scic_sds_port_default_start_io_handler,
- .complete_io_handler = scic_sds_port_default_complete_io_handler
- },
- [SCI_BASE_PORT_STATE_STOPPING] = {
- .frame_handler = scic_sds_port_default_frame_handler,
- .event_handler = scic_sds_port_default_event_handler,
- .link_up_handler = scic_sds_port_default_link_up_handler,
- .link_down_handler = scic_sds_port_default_link_down_handler,
- .start_io_handler = scic_sds_port_default_start_io_handler,
- .complete_io_handler = scic_sds_port_stopping_state_complete_io_handler
- },
- [SCI_BASE_PORT_STATE_READY] = {
- .frame_handler = scic_sds_port_default_frame_handler,
- .event_handler = scic_sds_port_default_event_handler,
- .link_up_handler = scic_sds_port_default_link_up_handler,
- .link_down_handler = scic_sds_port_default_link_down_handler,
- .start_io_handler = scic_sds_port_default_start_io_handler,
- .complete_io_handler = scic_sds_port_general_complete_io_handler
- },
- [SCIC_SDS_PORT_READY_SUBSTATE_WAITING] = {
- .frame_handler = scic_sds_port_default_frame_handler,
- .event_handler = scic_sds_port_default_event_handler,
- .link_up_handler = scic_sds_port_ready_waiting_substate_link_up_handler,
- .link_down_handler = scic_sds_port_default_link_down_handler,
- .start_io_handler = scic_sds_port_ready_waiting_substate_start_io_handler,
- .complete_io_handler = scic_sds_port_ready_substate_complete_io_handler,
- },
- [SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL] = {
- .frame_handler = scic_sds_port_default_frame_handler,
- .event_handler = scic_sds_port_default_event_handler,
- .link_up_handler = scic_sds_port_ready_operational_substate_link_up_handler,
- .link_down_handler = scic_sds_port_ready_operational_substate_link_down_handler,
- .start_io_handler = scic_sds_port_ready_operational_substate_start_io_handler,
- .complete_io_handler = scic_sds_port_ready_substate_complete_io_handler,
- },
- [SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING] = {
- .frame_handler = scic_sds_port_default_frame_handler,
- .event_handler = scic_sds_port_default_event_handler,
- .link_up_handler = scic_sds_port_default_link_up_handler,
- .link_down_handler = scic_sds_port_default_link_down_handler,
- .start_io_handler = scic_sds_port_default_start_io_handler,
- .complete_io_handler = scic_sds_port_ready_configuring_substate_complete_io_handler
- },
- [SCI_BASE_PORT_STATE_RESETTING] = {
- .frame_handler = scic_sds_port_default_frame_handler,
- .event_handler = scic_sds_port_default_event_handler,
- .link_up_handler = scic_sds_port_reset_state_link_up_handler,
- .link_down_handler = scic_sds_port_reset_state_link_down_handler,
- .start_io_handler = scic_sds_port_default_start_io_handler,
- .complete_io_handler = scic_sds_port_general_complete_io_handler
- },
- [SCI_BASE_PORT_STATE_FAILED] = {
- .frame_handler = scic_sds_port_default_frame_handler,
- .event_handler = scic_sds_port_default_event_handler,
- .link_up_handler = scic_sds_port_default_link_up_handler,
- .link_down_handler = scic_sds_port_default_link_down_handler,
- .start_io_handler = scic_sds_port_default_start_io_handler,
- .complete_io_handler = scic_sds_port_general_complete_io_handler
+enum sci_status scic_sds_port_link_down(struct scic_sds_port *sci_port,
+ struct scic_sds_phy *sci_phy)
+{
+ enum scic_sds_port_states state;
+
+ state = sci_port->state_machine.current_state_id;
+ switch (state) {
+ case SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL:
+ scic_sds_port_deactivate_phy(sci_port, sci_phy, true);
+
+ /* If there are no active phys left in the port, then
+ * transition the port to the WAITING state until such time
+ * as a phy goes link up
+ */
+ if (sci_port->active_phy_mask == 0)
+ port_state_machine_change(sci_port,
+ SCIC_SDS_PORT_READY_SUBSTATE_WAITING);
+ return SCI_SUCCESS;
+ case SCI_BASE_PORT_STATE_RESETTING:
+ /* In the resetting state we don't notify the user regarding
+ * link up and link down notifications. */
+ scic_sds_port_deactivate_phy(sci_port, sci_phy, false);
+ return SCI_SUCCESS;
+ default:
+ dev_warn(sciport_to_dev(sci_port),
+ "%s: in wrong state: %d\n", __func__, state);
+ return SCI_FAILURE_INVALID_STATE;
}
-};
+}
-/*
- * ******************************************************************************
- * * PORT STATE PRIVATE METHODS
- * ****************************************************************************** */
+enum sci_status scic_sds_port_start_io(struct scic_sds_port *sci_port,
+ struct scic_sds_remote_device *sci_dev,
+ struct scic_sds_request *sci_req)
+{
+ enum scic_sds_port_states state;
+
+ state = sci_port->state_machine.current_state_id;
+ switch (state) {
+ case SCIC_SDS_PORT_READY_SUBSTATE_WAITING:
+ return SCI_FAILURE_INVALID_STATE;
+ case SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL:
+ sci_port->started_request_count++;
+ return SCI_SUCCESS;
+ default:
+ dev_warn(sciport_to_dev(sci_port),
+ "%s: in wrong state: %d\n", __func__, state);
+ return SCI_FAILURE_INVALID_STATE;
+ }
+}
+
+enum sci_status scic_sds_port_complete_io(struct scic_sds_port *sci_port,
+ struct scic_sds_remote_device *sci_dev,
+ struct scic_sds_request *sci_req)
+{
+ enum scic_sds_port_states state;
+
+ state = sci_port->state_machine.current_state_id;
+ switch (state) {
+ case SCI_BASE_PORT_STATE_STOPPED:
+ dev_warn(sciport_to_dev(sci_port),
+ "%s: in wrong state: %d\n", __func__, state);
+ return SCI_FAILURE_INVALID_STATE;
+ case SCI_BASE_PORT_STATE_STOPPING:
+ scic_sds_port_decrement_request_count(sci_port);
+
+ if (sci_port->started_request_count == 0)
+ port_state_machine_change(sci_port,
+ SCI_BASE_PORT_STATE_STOPPED);
+ break;
+ case SCI_BASE_PORT_STATE_READY:
+ case SCI_BASE_PORT_STATE_RESETTING:
+ case SCI_BASE_PORT_STATE_FAILED:
+ case SCIC_SDS_PORT_READY_SUBSTATE_WAITING:
+ case SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL:
+ scic_sds_port_decrement_request_count(sci_port);
+ break;
+ case SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING:
+ scic_sds_port_decrement_request_count(sci_port);
+ if (sci_port->started_request_count == 0) {
+ port_state_machine_change(sci_port,
+ SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL);
+ }
+ break;
+ }
+ return SCI_SUCCESS;
+}
/**
*
scic_sds_controller_post_request(scic, command);
}
-/*
- * ******************************************************************************
- * * PORT STATE METHODS
- * ****************************************************************************** */
-
-/**
- *
- * @object: This is the object which is cast to a struct scic_sds_port object.
- *
- * This method will perform the actions required by the struct scic_sds_port on
- * entering the SCI_BASE_PORT_STATE_STOPPED. This function sets the stopped
- * state handlers for the struct scic_sds_port object and disables the port task
- * scheduler in the hardware. none
- */
static void scic_sds_port_stopped_state_enter(void *object)
{
struct scic_sds_port *sci_port = object;
- scic_sds_port_set_base_state_handlers(
- sci_port, SCI_BASE_PORT_STATE_STOPPED
- );
-
- if (
- SCI_BASE_PORT_STATE_STOPPING
- == sci_port->state_machine.previous_state_id
- ) {
+ if (sci_port->state_machine.previous_state_id == SCI_BASE_PORT_STATE_STOPPING) {
/*
* If we enter this state becasuse of a request to stop
* the port then we want to disable the hardwares port
}
}
-/**
- *
- * @object: This is the object which is cast to a struct scic_sds_port object.
- *
- * This method will perform the actions required by the struct scic_sds_port on
- * exiting the SCI_BASE_STATE_STOPPED. This function enables the SCU hardware
- * port task scheduler. none
- */
static void scic_sds_port_stopped_state_exit(void *object)
{
struct scic_sds_port *sci_port = object;
scic_sds_port_enable_port_task_scheduler(sci_port);
}
-/**
- * scic_sds_port_ready_state_enter -
- * @object: This is the object which is cast to a struct scic_sds_port object.
- *
- * This method will perform the actions required by the struct scic_sds_port on
- * entering the SCI_BASE_PORT_STATE_READY. This function sets the ready state
- * handlers for the struct scic_sds_port object, reports the port object as
- * not ready and starts the ready substate machine. none
- */
static void scic_sds_port_ready_state_enter(void *object)
{
struct scic_sds_port *sci_port = object;
struct isci_port *iport = sci_port_to_iport(sci_port);
u32 prev_state;
- /* Put the ready state handlers in place though they will not be there long */
- scic_sds_port_set_base_state_handlers(sci_port, SCI_BASE_PORT_STATE_READY);
-
prev_state = sci_port->state_machine.previous_state_id;
if (prev_state == SCI_BASE_PORT_STATE_RESETTING)
isci_port_hard_reset_complete(iport, SCI_SUCCESS);
SCIC_SDS_PORT_READY_SUBSTATE_WAITING);
}
-/**
- *
- * @object: This is the object which is cast to a struct scic_sds_port object.
- *
- * This method will perform the actions required by the struct scic_sds_port on
- * entering the SCI_BASE_PORT_STATE_RESETTING. This function sets the resetting
- * state handlers for the struct scic_sds_port object. none
- */
-static void scic_sds_port_resetting_state_enter(void *object)
-{
- struct scic_sds_port *sci_port = object;
-
- scic_sds_port_set_base_state_handlers(
- sci_port, SCI_BASE_PORT_STATE_RESETTING
- );
-}
-
-/**
- *
- * @object: This is the object which is cast to a struct scic_sds_port object.
- *
- * This function will perform the actions required by the
- * struct scic_sds_port on
- * exiting the SCI_BASE_STATE_RESETTING. This function does nothing. none
- */
-static inline void scic_sds_port_resetting_state_exit(void *object)
+static void scic_sds_port_resetting_state_exit(void *object)
{
struct scic_sds_port *sci_port = object;
isci_timer_stop(sci_port->timer_handle);
}
-/**
- *
- * @object: This is the void object which is cast to a
- * struct scic_sds_port object.
- *
- * This method will perform the actions required by the struct scic_sds_port on
- * entering the SCI_BASE_PORT_STATE_STOPPING. This function sets the stopping
- * state handlers for the struct scic_sds_port object. none
- */
-static void scic_sds_port_stopping_state_enter(void *object)
-{
- struct scic_sds_port *sci_port = object;
-
- scic_sds_port_set_base_state_handlers(
- sci_port, SCI_BASE_PORT_STATE_STOPPING
- );
-}
-
-/**
- *
- * @object: This is the object which is cast to a struct scic_sds_port object.
- *
- * This function will perform the actions required by the
- * struct scic_sds_port on
- * exiting the SCI_BASE_STATE_STOPPING. This function does nothing. none
- */
-static inline void
-scic_sds_port_stopping_state_exit(void *object)
+static void scic_sds_port_stopping_state_exit(void *object)
{
struct scic_sds_port *sci_port = object;
scic_sds_port_destroy_dummy_resources(sci_port);
}
-/**
- *
- * @object: This is the object which is cast to a struct scic_sds_port object.
- *
- * This function will perform the actions required by the
- * struct scic_sds_port on
- * entering the SCI_BASE_PORT_STATE_STOPPING. This function sets the stopping
- * state handlers for the struct scic_sds_port object. none
- */
static void scic_sds_port_failed_state_enter(void *object)
{
struct scic_sds_port *sci_port = object;
struct isci_port *iport = sci_port_to_iport(sci_port);
- scic_sds_port_set_base_state_handlers(sci_port,
- SCI_BASE_PORT_STATE_FAILED);
-
isci_port_hard_reset_complete(iport, SCI_FAILURE_TIMEOUT);
}
.exit_state = scic_sds_port_stopped_state_exit
},
[SCI_BASE_PORT_STATE_STOPPING] = {
- .enter_state = scic_sds_port_stopping_state_enter,
.exit_state = scic_sds_port_stopping_state_exit
},
[SCI_BASE_PORT_STATE_READY] = {
.exit_state = scic_sds_port_ready_substate_configuring_exit
},
[SCI_BASE_PORT_STATE_RESETTING] = {
- .enter_state = scic_sds_port_resetting_state_enter,
.exit_state = scic_sds_port_resetting_state_exit
},
[SCI_BASE_PORT_STATE_FAILED] = {