summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMaciej Trela <maciej.trela@intel.com>2011-04-13 00:28:37 (GMT)
committerDan Williams <dan.j.williams@intel.com>2011-07-03 11:00:37 (GMT)
commit41e2b90584695cf5ae3a29eaa115e31913fbefe0 (patch)
tree060f55d9bba2887ecde8121a55a69c58238c9591 /drivers
parent0ea99d52cbcdb4bf5f5dd3097088a2919a115981 (diff)
downloadlinux-41e2b90584695cf5ae3a29eaa115e31913fbefe0.tar.xz
isci: remove base_port abstraction
Merge struct sci_base_port into scic_sds_port. Until now sci_base_port was referenced indirectly with scic_sds_port->parent field. 'sci_base_port' state machine handlers were also incorporated into scic_sds_port handlers. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Maciej Trela <Maciej.Trela@intel.com> Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/isci/core/sci_base_port.h187
-rw-r--r--drivers/scsi/isci/core/scic_sds_controller.c10
-rw-r--r--drivers/scsi/isci/core/scic_sds_port.c442
-rw-r--r--drivers/scsi/isci/core/scic_sds_port.h168
-rw-r--r--drivers/scsi/isci/core/scic_sds_port_configuration_agent.c2
5 files changed, 285 insertions, 524 deletions
diff --git a/drivers/scsi/isci/core/sci_base_port.h b/drivers/scsi/isci/core/sci_base_port.h
deleted file mode 100644
index 252d48c..0000000
--- a/drivers/scsi/isci/core/sci_base_port.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * This file is provided under a dual BSD/GPLv2 license. When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.GPL.
- *
- * BSD LICENSE
- *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SCI_BASE_PORT_H_
-#define _SCI_BASE_PORT_H_
-
-#include "sci_base_state_machine.h"
-#include "sci_object.h"
-
-/**
- * enum sci_base_port_states - This enumeration depicts all the states for the
- * common port state machine.
- *
- *
- */
-enum sci_base_port_states {
- /**
- * This state indicates that the port has successfully been stopped.
- * In this state no new IO operations are permitted.
- * This state is entered from the STOPPING state.
- */
- SCI_BASE_PORT_STATE_STOPPED,
-
- /**
- * This state indicates that the port is in the process of stopping.
- * In this state no new IO operations are permitted, but existing IO
- * operations are allowed to complete.
- * This state is entered from the READY state.
- */
- SCI_BASE_PORT_STATE_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,
-
- /**
- * This state indicates the port is in the process of performing a hard
- * reset. Thus, the user is unable to perform IO operations on this
- * port.
- * This state is entered from the READY state.
- */
- SCI_BASE_PORT_STATE_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_BASE_PORT_MAX_STATES
-
-};
-
-/**
- * struct sci_base_port - The base port object abstracts the fields common to
- * all SCI port objects.
- *
- *
- */
-struct sci_base_port {
- /**
- * The field specifies that the parent object for the base controller
- * is the base object itself.
- */
- struct sci_base_object parent;
-
- /**
- * This field contains the information for the base port state machine.
- */
- struct sci_base_state_machine state_machine;
-};
-
-struct sci_base_phy;
-
-typedef enum sci_status (*sci_base_port_handler_t) (
- struct sci_base_port *);
-
-typedef enum sci_status (*sci_base_port_phy_handler_t) (
- struct sci_base_port *,
- struct sci_base_phy *);
-
-typedef enum sci_status (*sci_base_port_reset_handler_t) (
- struct sci_base_port *,
- u32 timeout);
-
-/**
- * struct sci_base_port_state_handler - This structure contains all of the
- * state handler methods common to base port state machines. Handler
- * methods provide the ability to change the behavior for user requests or
- * transitions depending on the state the machine is in.
- *
- *
- */
-struct sci_base_port_state_handler {
- /**
- * The start_handler specifies the method invoked when a user
- * attempts to start a port.
- */
- sci_base_port_handler_t start_handler;
-
- /**
- * The stop_handler specifies the method invoked when a user
- * attempts to stop a port.
- */
- sci_base_port_handler_t stop_handler;
-
- /**
- * The destruct_handler specifies the method invoked when attempting to
- * destruct a port.
- */
- sci_base_port_handler_t destruct_handler;
-
- /**
- * The reset_handler specifies the method invoked when a user
- * attempts to hard reset a port.
- */
- sci_base_port_reset_handler_t reset_handler;
-
- /**
- * The add_phy_handler specifies the method invoked when a user
- * attempts to add another phy into the port.
- */
- sci_base_port_phy_handler_t add_phy_handler;
-
- /**
- * The remove_phy_handler specifies the method invoked when a user
- * attempts to remove a phy from the port.
- */
- sci_base_port_phy_handler_t remove_phy_handler;
-};
-#endif /* _SCI_BASE_PORT_H_ */
diff --git a/drivers/scsi/isci/core/scic_sds_controller.c b/drivers/scsi/isci/core/scic_sds_controller.c
index 7a0c590..577d1df 100644
--- a/drivers/scsi/isci/core/scic_sds_controller.c
+++ b/drivers/scsi/isci/core/scic_sds_controller.c
@@ -616,10 +616,10 @@ static enum sci_status scic_sds_controller_stop_ports(struct scic_sds_controller
for (index = 0; index < scic->logical_port_entries; index++) {
struct scic_sds_port *sci_port = &scic->port_table[index];
- sci_base_port_handler_t stop;
+ scic_sds_port_handler_t stop;
- stop = sci_port->state_handlers->parent.stop_handler;
- port_status = stop(&sci_port->parent);
+ stop = sci_port->state_handlers->stop_handler;
+ port_status = stop(sci_port);
if ((port_status != SCI_SUCCESS) &&
(port_status != SCI_FAILURE_INVALID_STATE)) {
@@ -2860,8 +2860,8 @@ enum sci_status scic_controller_start(struct scic_sds_controller *scic,
for (index = 0; index < scic->logical_port_entries; index++) {
struct scic_sds_port *sci_port = &scic->port_table[index];
- result = sci_port->state_handlers->parent.start_handler(
- &sci_port->parent);
+ result = sci_port->state_handlers->start_handler(
+ sci_port);
if (result)
return result;
}
diff --git a/drivers/scsi/isci/core/scic_sds_port.c b/drivers/scsi/isci/core/scic_sds_port.c
index ef9cb9e..ff9ac73 100644
--- a/drivers/scsi/isci/core/scic_sds_port.c
+++ b/drivers/scsi/isci/core/scic_sds_port.c
@@ -54,7 +54,6 @@
*/
#include "intel_sas.h"
-#include "sci_base_port.h"
#include "scic_controller.h"
#include "scic_phy.h"
#include "scic_port.h"
@@ -73,22 +72,6 @@
#define SCIC_SDS_PORT_HARD_RESET_TIMEOUT (1000)
#define SCU_DUMMY_INDEX (0xFFFF)
-static void sci_base_port_construct(
- struct sci_base_port *base_port,
- const struct sci_base_state *state_table)
-{
- base_port->parent.private = NULL;
- sci_base_state_machine_construct(
- &base_port->state_machine,
- &base_port->parent,
- state_table,
- SCI_BASE_PORT_STATE_STOPPED
- );
-
- sci_base_state_machine_start(
- &base_port->state_machine
- );
-}
/**
*
@@ -332,8 +315,8 @@ enum sci_status scic_sds_port_add_phy(
struct scic_sds_port *this_port,
struct scic_sds_phy *the_phy)
{
- return this_port->state_handlers->parent.add_phy_handler(
- &this_port->parent, &the_phy->parent);
+ return this_port->state_handlers->add_phy_handler(
+ this_port, &the_phy->parent);
}
@@ -350,8 +333,8 @@ enum sci_status scic_sds_port_remove_phy(
struct scic_sds_port *this_port,
struct scic_sds_phy *the_phy)
{
- return this_port->state_handlers->parent.remove_phy_handler(
- &this_port->parent, &the_phy->parent);
+ return this_port->state_handlers->remove_phy_handler(
+ this_port, &the_phy->parent);
}
/**
@@ -632,8 +615,8 @@ enum sci_status scic_port_hard_reset(
struct scic_sds_port *port,
u32 reset_timeout)
{
- return port->state_handlers->parent.reset_handler(
- &port->parent, reset_timeout);
+ return port->state_handlers->reset_handler(
+ port, reset_timeout);
}
/**
@@ -768,7 +751,7 @@ static void scic_sds_port_general_link_up_handler(struct scic_sds_port *sci_port
if ((phy_sas_address.high == port_sas_address.high &&
phy_sas_address.low == port_sas_address.low) ||
sci_port->active_phy_mask == 0) {
- struct sci_base_state_machine *sm = &sci_port->parent.state_machine;
+ struct sci_base_state_machine *sm = &sci_port->state_machine;
scic_sds_port_activate_phy(sci_port, sci_phy, do_notify_user);
if (sm->current_state_id == SCI_BASE_PORT_STATE_RESETTING)
@@ -913,7 +896,7 @@ static void scic_sds_port_timeout_handler(void *port)
u32 current_state;
current_state = sci_base_state_machine_get_state(
- &sci_port->parent.state_machine);
+ &sci_port->state_machine);
if (current_state == SCI_BASE_PORT_STATE_RESETTING) {
/*
@@ -921,7 +904,7 @@ static void scic_sds_port_timeout_handler(void *port)
* timeout fired before the reset completed.
*/
sci_base_state_machine_change_state(
- &sci_port->parent.state_machine,
+ &sci_port->state_machine,
SCI_BASE_PORT_STATE_FAILED);
} else if (current_state == SCI_BASE_PORT_STATE_STOPPED) {
/*
@@ -1068,22 +1051,16 @@ void scic_port_enable_broadcast_change_notification(
* * READY SUBSTATE HANDLERS
* **************************************************************************** */
-/**
- *
- * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
- * object.
- *
+/*
* This method is the general ready state stop handler for the struct scic_sds_port
* object. This function will transition the ready substate machine to its
* final state. enum sci_status SCI_SUCCESS
*/
static enum sci_status scic_sds_port_ready_substate_stop_handler(
- struct sci_base_port *port)
+ struct scic_sds_port *port)
{
- struct scic_sds_port *this_port = (struct scic_sds_port *)port;
-
sci_base_state_machine_change_state(
- &this_port->parent.state_machine,
+ &port->state_machine,
SCI_BASE_PORT_STATE_STOPPING
);
@@ -1100,30 +1077,27 @@ static enum sci_status scic_sds_port_ready_substate_complete_io_handler(
struct scic_sds_remote_device *device,
struct scic_sds_request *io_request)
{
- struct scic_sds_port *this_port = (struct scic_sds_port *)port;
-
- scic_sds_port_decrement_request_count(this_port);
+ scic_sds_port_decrement_request_count(port);
return SCI_SUCCESS;
}
static enum sci_status scic_sds_port_ready_substate_add_phy_handler(
- struct sci_base_port *port,
+ struct scic_sds_port *port,
struct sci_base_phy *phy)
{
- struct scic_sds_port *this_port = (struct scic_sds_port *)port;
struct scic_sds_phy *this_phy = (struct scic_sds_phy *)phy;
enum sci_status status;
- status = scic_sds_port_set_phy(this_port, this_phy);
+ status = scic_sds_port_set_phy(port, this_phy);
if (status == SCI_SUCCESS) {
- scic_sds_port_general_link_up_handler(this_port, this_phy, true);
+ scic_sds_port_general_link_up_handler(port, this_phy, true);
- this_port->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING;
+ port->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING;
sci_base_state_machine_change_state(
- &this_port->ready_substate_machine,
+ &port->ready_substate_machine,
SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING
);
}
@@ -1133,22 +1107,21 @@ static enum sci_status scic_sds_port_ready_substate_add_phy_handler(
static enum sci_status scic_sds_port_ready_substate_remove_phy_handler(
- struct sci_base_port *port,
+ struct scic_sds_port *port,
struct sci_base_phy *phy)
{
- struct scic_sds_port *this_port = (struct scic_sds_port *)port;
struct scic_sds_phy *this_phy = (struct scic_sds_phy *)phy;
enum sci_status status;
- status = scic_sds_port_clear_phy(this_port, this_phy);
+ status = scic_sds_port_clear_phy(port, this_phy);
if (status == SCI_SUCCESS) {
- scic_sds_port_deactivate_phy(this_port, this_phy, true);
+ scic_sds_port_deactivate_phy(port, this_phy, true);
- this_port->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING;
+ port->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING;
sci_base_state_machine_change_state(
- &this_port->ready_substate_machine,
+ &port->ready_substate_machine,
SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING
);
}
@@ -1204,22 +1177,16 @@ static enum sci_status scic_sds_port_ready_waiting_substate_start_io_handler(
* * READY SUBSTATE OPERATIONAL HANDLERS
* **************************************************************************** */
-/**
- *
- * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
- * object.
- * @timeout: This is the timeout for the reset request to complete.
- *
+/*
* This method will casue the port to reset. enum sci_status SCI_SUCCESS
*/
static enum
sci_status scic_sds_port_ready_operational_substate_reset_handler(
- struct sci_base_port *port,
+ struct scic_sds_port *port,
u32 timeout)
{
enum sci_status status = SCI_FAILURE_INVALID_PHY;
u32 phy_index;
- struct scic_sds_port *sci_port = (struct scic_sds_port *)port;
struct scic_sds_phy *selected_phy = NULL;
@@ -1227,10 +1194,10 @@ sci_status scic_sds_port_ready_operational_substate_reset_handler(
for (phy_index = 0;
(phy_index < SCI_MAX_PHYS) && (selected_phy == NULL);
phy_index++) {
- selected_phy = sci_port->phy_table[phy_index];
+ selected_phy = port->phy_table[phy_index];
if ((selected_phy != NULL) &&
- !scic_sds_port_active_phy(sci_port, selected_phy)) {
+ !scic_sds_port_active_phy(port, selected_phy)) {
/*
* We found a phy but it is not ready select
* different phy
@@ -1244,12 +1211,12 @@ sci_status scic_sds_port_ready_operational_substate_reset_handler(
status = scic_sds_phy_reset(selected_phy);
if (status == SCI_SUCCESS) {
- isci_timer_start(sci_port->timer_handle, timeout);
- sci_port->not_ready_reason =
+ isci_timer_start(port->timer_handle, timeout);
+ port->not_ready_reason =
SCIC_PORT_NOT_READY_HARD_RESET_REQUESTED;
sci_base_state_machine_change_state(
- &sci_port->parent.state_machine,
+ &port->state_machine,
SCI_BASE_PORT_STATE_RESETTING);
}
}
@@ -1310,9 +1277,7 @@ static enum sci_status scic_sds_port_ready_operational_substate_start_io_handler
struct scic_sds_remote_device *device,
struct scic_sds_request *io_request)
{
- struct scic_sds_port *this_port = (struct scic_sds_port *)port;
-
- scic_sds_port_increment_request_count(this_port);
+ scic_sds_port_increment_request_count(port);
return SCI_SUCCESS;
}
@@ -1322,32 +1287,27 @@ static enum sci_status scic_sds_port_ready_operational_substate_start_io_handler
* * READY SUBSTATE OPERATIONAL HANDLERS
* **************************************************************************** */
-/**
- * scic_sds_port_ready_configuring_substate_add_phy_handler() -
- * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
- * object.
- *
+/*
* This is the default method for a port add phy request. It will report a
* warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
*/
static enum sci_status scic_sds_port_ready_configuring_substate_add_phy_handler(
- struct sci_base_port *port,
+ struct scic_sds_port *port,
struct sci_base_phy *phy)
{
- struct scic_sds_port *this_port = (struct scic_sds_port *)port;
struct scic_sds_phy *this_phy = (struct scic_sds_phy *)phy;
enum sci_status status;
- status = scic_sds_port_set_phy(this_port, this_phy);
+ status = scic_sds_port_set_phy(port, this_phy);
if (status == SCI_SUCCESS) {
- scic_sds_port_general_link_up_handler(this_port, this_phy, true);
+ scic_sds_port_general_link_up_handler(port, this_phy, true);
/*
* Re-enter the configuring state since this may be the last phy in
* the port. */
sci_base_state_machine_change_state(
- &this_port->ready_substate_machine,
+ &port->ready_substate_machine,
SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING
);
}
@@ -1355,32 +1315,27 @@ static enum sci_status scic_sds_port_ready_configuring_substate_add_phy_handler(
return status;
}
-/**
- * scic_sds_port_ready_configuring_substate_remove_phy_handler() -
- * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
- * object.
- *
+/*
* This is the default method for a port remove phy request. It will report a
* warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
*/
static enum sci_status scic_sds_port_ready_configuring_substate_remove_phy_handler(
- struct sci_base_port *port,
+ struct scic_sds_port *port,
struct sci_base_phy *phy)
{
- struct scic_sds_port *this_port = (struct scic_sds_port *)port;
struct scic_sds_phy *this_phy = (struct scic_sds_phy *)phy;
enum sci_status status;
- status = scic_sds_port_clear_phy(this_port, this_phy);
+ status = scic_sds_port_clear_phy(port, this_phy);
if (status == SCI_SUCCESS) {
- scic_sds_port_deactivate_phy(this_port, this_phy, true);
+ scic_sds_port_deactivate_phy(port, this_phy, true);
/*
* Re-enter the configuring state since this may be the last phy in
* the port. */
sci_base_state_machine_change_state(
- &this_port->ready_substate_machine,
+ &port->ready_substate_machine,
SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING
);
}
@@ -1397,7 +1352,8 @@ static enum sci_status scic_sds_port_ready_configuring_substate_remove_phy_handl
* 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(
+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)
@@ -1414,66 +1370,67 @@ static enum sci_status scic_sds_port_ready_configuring_substate_complete_io_hand
return SCI_SUCCESS;
}
-static enum sci_status default_port_handler(struct sci_base_port *base_port, const char *func)
+static enum sci_status default_port_handler(struct scic_sds_port *sci_port,
+ const char *func)
{
- struct scic_sds_port *sci_port;
-
- sci_port = container_of(base_port, typeof(*sci_port), parent);
dev_warn(sciport_to_dev(sci_port),
"%s: in wrong state: %d\n", func,
- sci_base_state_machine_get_state(&base_port->state_machine));
+ sci_base_state_machine_get_state(&sci_port->state_machine));
return SCI_FAILURE_INVALID_STATE;
}
-static enum sci_status scic_sds_port_default_start_handler(struct sci_base_port *base_port)
+static enum sci_status
+scic_sds_port_default_start_handler(struct scic_sds_port *sci_port)
{
- return default_port_handler(base_port, __func__);
+ return default_port_handler(sci_port, __func__);
}
-static enum sci_status scic_sds_port_default_stop_handler(struct sci_base_port *base_port)
+static enum sci_status
+scic_sds_port_default_stop_handler(struct scic_sds_port *sci_port)
{
- return default_port_handler(base_port, __func__);
+ return default_port_handler(sci_port, __func__);
}
-static enum sci_status scic_sds_port_default_destruct_handler(struct sci_base_port *base_port)
+static enum sci_status
+scic_sds_port_default_destruct_handler(struct scic_sds_port *sci_port)
{
- return default_port_handler(base_port, __func__);
+ return default_port_handler(sci_port, __func__);
}
-static enum sci_status scic_sds_port_default_reset_handler(struct sci_base_port *base_port,
- u32 timeout)
+static enum sci_status
+scic_sds_port_default_reset_handler(struct scic_sds_port *sci_port,
+ u32 timeout)
{
- return default_port_handler(base_port, __func__);
+ return default_port_handler(sci_port, __func__);
}
-static enum sci_status scic_sds_port_default_add_phy_handler(struct sci_base_port *base_port,
- struct sci_base_phy *base_phy)
+static enum sci_status
+scic_sds_port_default_add_phy_handler(struct scic_sds_port *sci_port,
+ struct sci_base_phy *base_phy)
{
- return default_port_handler(base_port, __func__);
+ return default_port_handler(sci_port, __func__);
}
-static enum sci_status scic_sds_port_default_remove_phy_handler(struct sci_base_port *base_port,
- struct sci_base_phy *base_phy)
+static enum sci_status
+scic_sds_port_default_remove_phy_handler(struct scic_sds_port *sci_port,
+ struct sci_base_phy *base_phy)
{
- return default_port_handler(base_port, __func__);
+ return default_port_handler(sci_port, __func__);
}
-/**
- * scic_sds_port_default_frame_handler
- * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
- * object.
- *
+/*
* 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)
+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->parent, __func__);
+ default_port_handler(sci_port, __func__);
scic_sds_controller_release_frame(scic, frame_index);
return SCI_FAILURE_INVALID_STATE;
@@ -1482,50 +1439,47 @@ static enum sci_status scic_sds_port_default_frame_handler(struct scic_sds_port
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->parent, __func__);
+ 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->parent, __func__);
+ 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->parent, __func__);
+ 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->parent, __func__);
+ 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->parent, __func__);
+ return default_port_handler(sci_port, __func__);
}
static struct scic_sds_port_state_handler
-scic_sds_port_ready_substate_handler_table[SCIC_SDS_PORT_READY_MAX_SUBSTATES] =
-{
- /* SCIC_SDS_PORT_READY_SUBSTATE_WAITING */
+scic_sds_port_ready_substate_handler_table[SCIC_SDS_PORT_READY_MAX_SUBSTATES] = {
{
- {
- scic_sds_port_default_start_handler,
- scic_sds_port_ready_substate_stop_handler,
- scic_sds_port_default_destruct_handler,
- scic_sds_port_default_reset_handler,
- scic_sds_port_ready_substate_add_phy_handler,
- scic_sds_port_default_remove_phy_handler
- },
+ /* SCIC_SDS_PORT_READY_SUBSTATE_WAITING */
+ scic_sds_port_default_start_handler,
+ scic_sds_port_ready_substate_stop_handler,
+ scic_sds_port_default_destruct_handler,
+ scic_sds_port_default_reset_handler,
+ scic_sds_port_ready_substate_add_phy_handler,
+ scic_sds_port_default_remove_phy_handler,
scic_sds_port_default_frame_handler,
scic_sds_port_default_event_handler,
scic_sds_port_ready_waiting_substate_link_up_handler,
@@ -1533,33 +1487,31 @@ scic_sds_port_ready_substate_handler_table[SCIC_SDS_PORT_READY_MAX_SUBSTATES] =
scic_sds_port_ready_waiting_substate_start_io_handler,
scic_sds_port_ready_substate_complete_io_handler,
},
- /* SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL */
+
{
- {
- scic_sds_port_default_start_handler,
- scic_sds_port_ready_substate_stop_handler,
- scic_sds_port_default_destruct_handler,
- scic_sds_port_ready_operational_substate_reset_handler,
- scic_sds_port_ready_substate_add_phy_handler,
- scic_sds_port_ready_substate_remove_phy_handler
- },
+ /* SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL */
+ scic_sds_port_default_start_handler,
+ scic_sds_port_ready_substate_stop_handler,
+ scic_sds_port_default_destruct_handler,
+ scic_sds_port_ready_operational_substate_reset_handler,
+ scic_sds_port_ready_substate_add_phy_handler,
+ scic_sds_port_ready_substate_remove_phy_handler,
scic_sds_port_default_frame_handler,
scic_sds_port_default_event_handler,
scic_sds_port_ready_operational_substate_link_up_handler,
scic_sds_port_ready_operational_substate_link_down_handler,
scic_sds_port_ready_operational_substate_start_io_handler,
- scic_sds_port_ready_substate_complete_io_handler
+ scic_sds_port_ready_substate_complete_io_handler,
},
- /* SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING */
+
{
- {
- scic_sds_port_default_start_handler,
- scic_sds_port_ready_substate_stop_handler,
- scic_sds_port_default_destruct_handler,
- scic_sds_port_default_reset_handler,
- scic_sds_port_ready_configuring_substate_add_phy_handler,
- scic_sds_port_ready_configuring_substate_remove_phy_handler
- },
+ /* SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING */
+ scic_sds_port_default_start_handler,
+ scic_sds_port_ready_substate_stop_handler,
+ scic_sds_port_default_destruct_handler,
+ scic_sds_port_default_reset_handler,
+ scic_sds_port_ready_configuring_substate_add_phy_handler,
+ scic_sds_port_ready_configuring_substate_remove_phy_handler,
scic_sds_port_default_frame_handler,
scic_sds_port_default_event_handler,
scic_sds_port_default_link_up_handler,
@@ -1857,9 +1809,7 @@ static enum sci_status scic_sds_port_general_complete_io_handler(
struct scic_sds_remote_device *device,
struct scic_sds_request *io_request)
{
- struct scic_sds_port *this_port = (struct scic_sds_port *)port;
-
- scic_sds_port_decrement_request_count(this_port);
+ scic_sds_port_decrement_request_count(port);
return SCI_SUCCESS;
}
@@ -1867,7 +1817,7 @@ static enum sci_status scic_sds_port_general_complete_io_handler(
/**
* scic_sds_port_stopped_state_start_handler() - stop a port from "started"
*
- * @port: This is the struct sci_base_port object which is cast into a
+ * @port: This is the struct scic_sds_port object which is cast into a
* struct scic_sds_port object.
*
* This function takes the struct scic_sds_port from a stopped state and
@@ -1883,10 +1833,8 @@ static enum sci_status scic_sds_port_general_complete_io_handler(
* has transitioned to the SCI_BASE_PORT_STATE_READY.
*/
static enum sci_status
-scic_sds_port_stopped_state_start_handler(struct sci_base_port *base_port)
+scic_sds_port_stopped_state_start_handler(struct scic_sds_port *sci_port)
{
- struct scic_sds_port *sci_port =
- container_of(base_port, typeof(*sci_port), parent);
struct scic_sds_controller *scic = sci_port->owning_controller;
struct isci_host *ihost = sci_object_get_association(scic);
enum sci_status status = SCI_SUCCESS;
@@ -1941,8 +1889,9 @@ scic_sds_port_stopped_state_start_handler(struct sci_base_port *base_port)
* silicon.
*/
if (scic_sds_port_is_phy_mask_valid(sci_port, phy_mask) == true) {
- sci_base_state_machine_change_state(&base_port->state_machine,
- SCI_BASE_PORT_STATE_READY);
+ sci_base_state_machine_change_state(
+ &sci_port->state_machine,
+ SCI_BASE_PORT_STATE_READY);
return SCI_SUCCESS;
} else
@@ -1955,49 +1904,33 @@ scic_sds_port_stopped_state_start_handler(struct sci_base_port *base_port)
return status;
}
-/**
- *
- * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
- * object.
- *
+/*
* This method takes the struct scic_sds_port that is in a stopped state and handles a
* stop request. This function takes no action. enum sci_status SCI_SUCCESS the
* stop request is successful as the struct scic_sds_port object is already stopped.
*/
static enum sci_status scic_sds_port_stopped_state_stop_handler(
- struct sci_base_port *port)
+ struct scic_sds_port *port)
{
/* We are already stopped so there is nothing to do here */
return SCI_SUCCESS;
}
-/**
- *
- * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
- * object.
- *
+/*
* This method takes the struct scic_sds_port that is in a stopped state and handles
* the destruct request. The stopped state is the only state in which the
* struct scic_sds_port can be destroyed. This function causes the port object to
* transition to the SCI_BASE_PORT_STATE_FINAL. enum sci_status SCI_SUCCESS
*/
static enum sci_status scic_sds_port_stopped_state_destruct_handler(
- struct sci_base_port *port)
+ struct scic_sds_port *port)
{
- struct scic_sds_port *this_port = (struct scic_sds_port *)port;
-
- sci_base_state_machine_stop(&this_port->parent.state_machine);
+ sci_base_state_machine_stop(&port->state_machine);
return SCI_SUCCESS;
}
-/**
- *
- * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
- * object.
- * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
- * object.
- *
+/*
* This method takes the struct scic_sds_port that is in a stopped state and handles
* the add phy request. In MPC mode the only time a phy can be added to a port
* is in the SCI_BASE_PORT_STATE_STOPPED. enum sci_status
@@ -2005,15 +1938,14 @@ static enum sci_status scic_sds_port_stopped_state_destruct_handler(
* be added to the port. SCI_SUCCESS if the phy is added to the port.
*/
static enum sci_status scic_sds_port_stopped_state_add_phy_handler(
- struct sci_base_port *port,
+ struct scic_sds_port *port,
struct sci_base_phy *phy)
{
- struct scic_sds_port *this_port = (struct scic_sds_port *)port;
struct scic_sds_phy *this_phy = (struct scic_sds_phy *)phy;
struct sci_sas_address port_sas_address;
/* Read the port assigned SAS Address if there is one */
- scic_sds_port_get_sas_address(this_port, &port_sas_address);
+ scic_sds_port_get_sas_address(port, &port_sas_address);
if (port_sas_address.high != 0 && port_sas_address.low != 0) {
struct sci_sas_address phy_sas_address;
@@ -2031,17 +1963,11 @@ static enum sci_status scic_sds_port_stopped_state_add_phy_handler(
}
}
- return scic_sds_port_set_phy(this_port, this_phy);
+ return scic_sds_port_set_phy(port, this_phy);
}
-/**
- *
- * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
- * object.
- * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
- * object.
- *
+/*
* This method takes the struct scic_sds_port that is in a stopped state and handles
* the remove phy request. In MPC mode the only time a phy can be removed from
* a port is in the SCI_BASE_PORT_STATE_STOPPED. enum sci_status
@@ -2049,13 +1975,12 @@ static enum sci_status scic_sds_port_stopped_state_add_phy_handler(
* be added to the port. SCI_SUCCESS if the phy is added to the port.
*/
static enum sci_status scic_sds_port_stopped_state_remove_phy_handler(
- struct sci_base_port *port,
+ struct scic_sds_port *port,
struct sci_base_phy *phy)
{
- struct scic_sds_port *this_port = (struct scic_sds_port *)port;
struct scic_sds_phy *this_phy = (struct scic_sds_phy *)phy;
- return scic_sds_port_clear_phy(this_port, this_phy);
+ return scic_sds_port_clear_phy(port, this_phy);
}
/*
@@ -2073,16 +1998,7 @@ static enum sci_status scic_sds_port_stopped_state_remove_phy_handler(
* * STOPPING STATE HANDLERS
* **************************************************************************** */
-/**
- *
- * @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 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
@@ -2095,7 +2011,7 @@ static enum sci_status scic_sds_port_stopping_state_complete_io_handler(
scic_sds_port_decrement_request_count(sci_port);
if (sci_port->started_request_count == 0) {
- sci_base_state_machine_change_state(&sci_port->parent.state_machine,
+ sci_base_state_machine_change_state(&sci_port->state_machine,
SCI_BASE_PORT_STATE_STOPPED);
}
@@ -2115,29 +2031,23 @@ static enum sci_status scic_sds_port_stopping_state_complete_io_handler(
* stopping state. enum sci_status SCI_SUCCESS
*/
static enum sci_status scic_sds_port_reset_state_stop_handler(
- struct sci_base_port *port)
+ struct scic_sds_port *port)
{
- struct scic_sds_port *this_port = (struct scic_sds_port *)port;
-
sci_base_state_machine_change_state(
- &this_port->parent.state_machine,
+ &port->state_machine,
SCI_BASE_PORT_STATE_STOPPING
);
return SCI_SUCCESS;
}
-/**
- *
- * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
- * object.
- *
+/*
* 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 *this_port,
+ struct scic_sds_port *port,
struct scic_sds_phy *phy)
{
/*
@@ -2153,26 +2063,22 @@ static void scic_sds_port_reset_state_link_up_handler(
/*
* In the resetting state we don't notify the user regarding
* link up and link down notifications. */
- scic_sds_port_general_link_up_handler(this_port, phy, false);
+ scic_sds_port_general_link_up_handler(port, phy, false);
}
-/**
- *
- * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
- * object.
- *
+/*
* 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 *this_port,
+ 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(this_port, phy, false);
+ scic_sds_port_deactivate_phy(port, phy, false);
}
static struct scic_sds_port_state_handler
@@ -2180,14 +2086,12 @@ scic_sds_port_state_handler_table[SCI_BASE_PORT_MAX_STATES] =
{
/* SCI_BASE_PORT_STATE_STOPPED */
{
- {
- scic_sds_port_stopped_state_start_handler,
- scic_sds_port_stopped_state_stop_handler,
- scic_sds_port_stopped_state_destruct_handler,
- scic_sds_port_default_reset_handler,
- scic_sds_port_stopped_state_add_phy_handler,
- scic_sds_port_stopped_state_remove_phy_handler
- },
+ scic_sds_port_stopped_state_start_handler,
+ scic_sds_port_stopped_state_stop_handler,
+ scic_sds_port_stopped_state_destruct_handler,
+ scic_sds_port_default_reset_handler,
+ scic_sds_port_stopped_state_add_phy_handler,
+ scic_sds_port_stopped_state_remove_phy_handler,
scic_sds_port_default_frame_handler,
scic_sds_port_default_event_handler,
scic_sds_port_default_link_up_handler,
@@ -2197,14 +2101,12 @@ scic_sds_port_state_handler_table[SCI_BASE_PORT_MAX_STATES] =
},
/* SCI_BASE_PORT_STATE_STOPPING */
{
- {
- scic_sds_port_default_start_handler,
- scic_sds_port_default_stop_handler,
- scic_sds_port_default_destruct_handler,
- scic_sds_port_default_reset_handler,
- scic_sds_port_default_add_phy_handler,
- scic_sds_port_default_remove_phy_handler
- },
+ scic_sds_port_default_start_handler,
+ scic_sds_port_default_stop_handler,
+ scic_sds_port_default_destruct_handler,
+ scic_sds_port_default_reset_handler,
+ scic_sds_port_default_add_phy_handler,
+ scic_sds_port_default_remove_phy_handler,
scic_sds_port_default_frame_handler,
scic_sds_port_default_event_handler,
scic_sds_port_default_link_up_handler,
@@ -2214,14 +2116,12 @@ scic_sds_port_state_handler_table[SCI_BASE_PORT_MAX_STATES] =
},
/* SCI_BASE_PORT_STATE_READY */
{
- {
- scic_sds_port_default_start_handler,
- scic_sds_port_default_stop_handler,
- scic_sds_port_default_destruct_handler,
- scic_sds_port_default_reset_handler,
- scic_sds_port_default_add_phy_handler,
- scic_sds_port_default_remove_phy_handler
- },
+ scic_sds_port_default_start_handler,
+ scic_sds_port_default_stop_handler,
+ scic_sds_port_default_destruct_handler,
+ scic_sds_port_default_reset_handler,
+ scic_sds_port_default_add_phy_handler,
+ scic_sds_port_default_remove_phy_handler,
scic_sds_port_default_frame_handler,
scic_sds_port_default_event_handler,
scic_sds_port_default_link_up_handler,
@@ -2231,14 +2131,12 @@ scic_sds_port_state_handler_table[SCI_BASE_PORT_MAX_STATES] =
},
/* SCI_BASE_PORT_STATE_RESETTING */
{
- {
- scic_sds_port_default_start_handler,
- scic_sds_port_reset_state_stop_handler,
- scic_sds_port_default_destruct_handler,
- scic_sds_port_default_reset_handler,
- scic_sds_port_default_add_phy_handler,
- scic_sds_port_default_remove_phy_handler
- },
+ scic_sds_port_default_start_handler,
+ scic_sds_port_reset_state_stop_handler,
+ scic_sds_port_default_destruct_handler,
+ scic_sds_port_default_reset_handler,
+ scic_sds_port_default_add_phy_handler,
+ scic_sds_port_default_remove_phy_handler,
scic_sds_port_default_frame_handler,
scic_sds_port_default_event_handler,
scic_sds_port_reset_state_link_up_handler,
@@ -2248,14 +2146,12 @@ scic_sds_port_state_handler_table[SCI_BASE_PORT_MAX_STATES] =
},
/* SCI_BASE_PORT_STATE_FAILED */
{
- {
- scic_sds_port_default_start_handler,
- scic_sds_port_default_stop_handler,
- scic_sds_port_default_destruct_handler,
- scic_sds_port_default_reset_handler,
- scic_sds_port_default_add_phy_handler,
- scic_sds_port_default_remove_phy_handler
- },
+ scic_sds_port_default_start_handler,
+ scic_sds_port_default_stop_handler,
+ scic_sds_port_default_destruct_handler,
+ scic_sds_port_default_reset_handler,
+ scic_sds_port_default_add_phy_handler,
+ scic_sds_port_default_remove_phy_handler,
scic_sds_port_default_frame_handler,
scic_sds_port_default_event_handler,
scic_sds_port_default_link_up_handler,
@@ -2385,7 +2281,7 @@ static void scic_sds_port_stopped_state_enter(
if (
SCI_BASE_PORT_STATE_STOPPING
- == this_port->parent.state_machine.previous_state_id
+ == this_port->state_machine.previous_state_id
) {
/*
* If we enter this state becasuse of a request to stop
@@ -2431,7 +2327,7 @@ static void scic_sds_port_ready_state_enter(struct sci_base_object *object)
struct isci_host *ihost;
u32 prev_state;
- sci_port = container_of(object, typeof(*sci_port), parent.parent);
+ sci_port = container_of(object, typeof(*sci_port), parent);
scic = scic_sds_port_get_controller(sci_port);
ihost = sci_object_get_association(scic);
iport = sci_object_get_association(sci_port);
@@ -2439,7 +2335,7 @@ static void scic_sds_port_ready_state_enter(struct sci_base_object *object)
/* 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->parent.state_machine.previous_state_id;
+ 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);
else
@@ -2456,7 +2352,7 @@ static void scic_sds_port_ready_state_exit(struct sci_base_object *object)
{
struct scic_sds_port *sci_port;
- sci_port = container_of(object, typeof(*sci_port), parent.parent);
+ sci_port = container_of(object, typeof(*sci_port), parent);
sci_base_state_machine_stop(&sci_port->ready_substate_machine);
scic_sds_port_invalidate_dummy_remote_node(sci_port);
}
@@ -2587,10 +2483,16 @@ void scic_sds_port_construct(struct scic_sds_port *sci_port, u8 port_index,
{
u32 index;
- sci_base_port_construct(&sci_port->parent, scic_sds_port_state_table);
+ sci_port->parent.private = NULL;
+ sci_base_state_machine_construct(&sci_port->state_machine,
+ &sci_port->parent,
+ scic_sds_port_state_table,
+ SCI_BASE_PORT_STATE_STOPPED);
+
+ sci_base_state_machine_start(&sci_port->state_machine);
sci_base_state_machine_construct(&sci_port->ready_substate_machine,
- &sci_port->parent.parent,
+ &sci_port->parent,
scic_sds_port_ready_substate_table,
SCIC_SDS_PORT_READY_SUBSTATE_WAITING);
diff --git a/drivers/scsi/isci/core/scic_sds_port.h b/drivers/scsi/isci/core/scic_sds_port.h
index 4cd6bbb..528c84d 100644
--- a/drivers/scsi/isci/core/scic_sds_port.h
+++ b/drivers/scsi/isci/core/scic_sds_port.h
@@ -56,22 +56,19 @@
#ifndef _SCIC_SDS_PORT_H_
#define _SCIC_SDS_PORT_H_
-/**
- * This file contains the structures, constants and prototypes for the
- * struct scic_sds_port object.
- *
- *
- */
-
#include <linux/kernel.h>
#include "sci_controller_constants.h"
#include "intel_sas.h"
-#include "sci_base_port.h"
#include "sci_base_phy.h"
#include "scu_registers.h"
#define SCIC_SDS_DUMMY_PORT 0xFF
+struct scic_sds_controller;
+struct scic_sds_phy;
+struct scic_sds_remote_device;
+struct scic_sds_request;
+
/**
* This constant defines the value utilized by SCI Components to indicate
* an invalid handle.
@@ -107,10 +104,53 @@ enum scic_sds_port_ready_substates {
SCIC_SDS_PORT_READY_MAX_SUBSTATES
};
-struct scic_sds_controller;
-struct scic_sds_phy;
-struct scic_sds_remote_device;
-struct scic_sds_request;
+/**
+ * enum scic_sds_port_states - This enumeration depicts all the states for the
+ * common port state machine.
+ *
+ *
+ */
+enum scic_sds_port_states {
+ /**
+ * This state indicates that the port has successfully been stopped.
+ * In this state no new IO operations are permitted.
+ * This state is entered from the STOPPING state.
+ */
+ SCI_BASE_PORT_STATE_STOPPED,
+
+ /**
+ * This state indicates that the port is in the process of stopping.
+ * In this state no new IO operations are permitted, but existing IO
+ * operations are allowed to complete.
+ * This state is entered from the READY state.
+ */
+ SCI_BASE_PORT_STATE_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,
+
+ /**
+ * This state indicates the port is in the process of performing a hard
+ * reset. Thus, the user is unable to perform IO operations on this
+ * port.
+ * This state is entered from the READY state.
+ */
+ SCI_BASE_PORT_STATE_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_BASE_PORT_MAX_STATES
+
+};
/**
* struct scic_sds_port -
@@ -119,9 +159,15 @@ struct scic_sds_request;
*/
struct scic_sds_port {
/**
- * This field is the oommon base port object.
+ * The field specifies that the parent object for the base controller
+ * is the base object itself.
*/
- struct sci_base_port parent;
+ struct sci_base_object parent;
+
+ /**
+ * This field contains the information for the base port state machine.
+ */
+ struct sci_base_state_machine state_machine;
/**
* This field is the port index that is reported to the SCI USER.
@@ -214,6 +260,15 @@ struct scic_sds_port {
};
+struct sci_base_phy;
+
+typedef enum sci_status (*scic_sds_port_handler_t)(struct scic_sds_port *);
+
+typedef enum sci_status (*scic_sds_port_phy_handler_t)(struct scic_sds_port *,
+ struct sci_base_phy *);
+
+typedef enum sci_status (*scic_sds_port_reset_handler_t)(struct scic_sds_port *,
+ u32 timeout);
typedef enum sci_status (*scic_sds_port_event_handler_t)(struct scic_sds_port *, u32);
@@ -221,13 +276,46 @@ typedef enum sci_status (*scic_sds_port_frame_handler_t)(struct scic_sds_port *,
typedef void (*scic_sds_port_link_handler_t)(struct scic_sds_port *, struct scic_sds_phy *);
-typedef enum sci_status (*scic_sds_port_io_request_handler_t)(
- struct scic_sds_port *,
- struct scic_sds_remote_device *,
- struct scic_sds_request *);
+typedef enum sci_status (*scic_sds_port_io_request_handler_t)(struct scic_sds_port *,
+ struct scic_sds_remote_device *,
+ struct scic_sds_request *);
struct scic_sds_port_state_handler {
- struct sci_base_port_state_handler parent;
+ /**
+ * The start_handler specifies the method invoked when a user
+ * attempts to start a port.
+ */
+ scic_sds_port_handler_t start_handler;
+
+ /**
+ * The stop_handler specifies the method invoked when a user
+ * attempts to stop a port.
+ */
+ scic_sds_port_handler_t stop_handler;
+
+ /**
+ * The destruct_handler specifies the method invoked when attempting to
+ * destruct a port.
+ */
+ scic_sds_port_handler_t destruct_handler;
+
+ /**
+ * The reset_handler specifies the method invoked when a user
+ * attempts to hard reset a port.
+ */
+ scic_sds_port_reset_handler_t reset_handler;
+
+ /**
+ * The add_phy_handler specifies the method invoked when a user
+ * attempts to add another phy into the port.
+ */
+ scic_sds_port_phy_handler_t add_phy_handler;
+
+ /**
+ * The remove_phy_handler specifies the method invoked when a user
+ * attempts to remove a phy from the port.
+ */
+ scic_sds_port_phy_handler_t remove_phy_handler;
scic_sds_port_frame_handler_t frame_handler;
scic_sds_port_event_handler_t event_handler;
@@ -292,15 +380,6 @@ static inline void scic_sds_port_decrement_request_count(struct scic_sds_port *s
#define scic_sds_port_active_phy(port, phy) \
(((port)->active_phy_mask & (1 << (phy)->phy_index)) != 0)
-/* --------------------------------------------------------------------------- */
-
-
-
-
-/* --------------------------------------------------------------------------- */
-
-/* --------------------------------------------------------------------------- */
-
void scic_sds_port_construct(
struct scic_sds_port *this_port,
u8 port_index,
@@ -312,8 +391,6 @@ enum sci_status scic_sds_port_initialize(
void __iomem *port_configuration_regsiter,
void __iomem *viit_registers);
-/* --------------------------------------------------------------------------- */
-
enum sci_status scic_sds_port_add_phy(
struct scic_sds_port *this_port,
struct scic_sds_phy *the_phy);
@@ -332,9 +409,6 @@ void scic_sds_port_deactivate_phy(
struct scic_sds_phy *phy,
bool do_notify_user);
-
-
-
bool scic_sds_port_link_detected(
struct scic_sds_port *this_port,
struct scic_sds_phy *phy);
@@ -347,11 +421,6 @@ void scic_sds_port_link_down(
struct scic_sds_port *this_port,
struct scic_sds_phy *phy);
-/* --------------------------------------------------------------------------- */
-
-
-/* --------------------------------------------------------------------------- */
-
enum sci_status scic_sds_port_start_io(
struct scic_sds_port *this_port,
struct scic_sds_remote_device *the_device,
@@ -362,23 +431,6 @@ enum sci_status scic_sds_port_complete_io(
struct scic_sds_remote_device *the_device,
struct scic_sds_request *the_io_request);
-/* --------------------------------------------------------------------------- */
-
-
-/* --------------------------------------------------------------------------- */
-
-
-
-
-
-
-
-
-
-
-
-
-
enum sci_sas_link_rate scic_sds_port_get_max_allowed_speed(
struct scic_sds_port *this_port);
@@ -390,8 +442,6 @@ bool scic_sds_port_is_valid_phy_assignment(
struct scic_sds_port *this_port,
u32 phy_index);
-
-
void scic_sds_port_get_sas_address(
struct scic_sds_port *this_port,
struct sci_sas_address *sas_address);
@@ -404,8 +454,4 @@ void scic_sds_port_get_attached_protocols(
struct scic_sds_port *this_port,
struct sci_sas_identify_address_frame_protocols *protocols);
-
-
-
-
#endif /* _SCIC_SDS_PORT_H_ */
diff --git a/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c b/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c
index 22703b3..a7e3833 100644
--- a/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c
+++ b/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c
@@ -700,7 +700,7 @@ 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->parent.state_machine.current_state_id;
+ u32 port_state = sci_port->state_machine.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