aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-05-12 10:16:06 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:49 -0400
commit6813820c7b892e1a5c2306808a5ccc8a27b7946d (patch)
tree42a10526a557c37ec66cf2b8b45cda83923222fa /drivers
parent051266caaeb15719553c5316e3d43b533d3cd5a0 (diff)
isci: unify port start_io and complete_io handlers
Unify the handlers and kill the state handler infrastructure. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/isci/port.c432
-rw-r--r--drivers/scsi/isci/port.h55
2 files changed, 59 insertions, 428 deletions
diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c
index 61ba37da437d..f43c1f6c9669 100644
--- a/drivers/scsi/isci/port.c
+++ b/drivers/scsi/isci/port.c
@@ -61,8 +61,6 @@
61#define SCIC_SDS_PORT_HARD_RESET_TIMEOUT (1000) 61#define SCIC_SDS_PORT_HARD_RESET_TIMEOUT (1000)
62#define SCU_DUMMY_INDEX (0xFFFF) 62#define SCU_DUMMY_INDEX (0xFFFF)
63 63
64static struct scic_sds_port_state_handler scic_sds_port_state_handler_table[];
65
66static void isci_port_change_state(struct isci_port *iport, enum isci_status status) 64static void isci_port_change_state(struct isci_port *iport, enum isci_status status)
67{ 65{
68 unsigned long flags; 66 unsigned long flags;
@@ -929,40 +927,6 @@ bool scic_sds_port_link_detected(
929} 927}
930 928
931/** 929/**
932 * This method is called to start an IO request on this port.
933 * @sci_port:
934 * @sci_dev:
935 * @sci_req:
936 *
937 * enum sci_status
938 */
939enum sci_status scic_sds_port_start_io(
940 struct scic_sds_port *sci_port,
941 struct scic_sds_remote_device *sci_dev,
942 struct scic_sds_request *sci_req)
943{
944 return sci_port->state_handlers->start_io_handler(
945 sci_port, sci_dev, sci_req);
946}
947
948/**
949 * This method is called to complete an IO request to the port.
950 * @sci_port:
951 * @sci_dev:
952 * @sci_req:
953 *
954 * enum sci_status
955 */
956enum sci_status scic_sds_port_complete_io(
957 struct scic_sds_port *sci_port,
958 struct scic_sds_remote_device *sci_dev,
959 struct scic_sds_request *sci_req)
960{
961 return sci_port->state_handlers->complete_io_handler(
962 sci_port, sci_dev, sci_req);
963}
964
965/**
966 * This method is provided to timeout requests for port operations. Mostly its 930 * This method is provided to timeout requests for port operations. Mostly its
967 * for the port reset operation. 931 * for the port reset operation.
968 * 932 *
@@ -1085,106 +1049,6 @@ static void scic_port_enable_broadcast_change_notification(struct scic_sds_port
1085 } 1049 }
1086} 1050}
1087 1051
1088/*
1089 * ****************************************************************************
1090 * * READY SUBSTATE HANDLERS
1091 * **************************************************************************** */
1092
1093/*
1094 * This method is the general ready substate complete io handler for the
1095 * struct scic_sds_port object. This function decrments the outstanding request count
1096 * for this port object. enum sci_status SCI_SUCCESS
1097 */
1098static enum sci_status scic_sds_port_ready_substate_complete_io_handler(
1099 struct scic_sds_port *port,
1100 struct scic_sds_remote_device *device,
1101 struct scic_sds_request *io_request)
1102{
1103 scic_sds_port_decrement_request_count(port);
1104
1105 return SCI_SUCCESS;
1106}
1107
1108/*
1109 * This method is the ready waiting substate start io handler for the
1110 * struct scic_sds_port object. The port object can not accept new requests so the
1111 * request is failed. enum sci_status SCI_FAILURE_INVALID_STATE
1112 */
1113static enum sci_status scic_sds_port_ready_waiting_substate_start_io_handler(
1114 struct scic_sds_port *port,
1115 struct scic_sds_remote_device *device,
1116 struct scic_sds_request *io_request)
1117{
1118 return SCI_FAILURE_INVALID_STATE;
1119}
1120
1121/*
1122 * This method is the ready operational substate start io handler for the
1123 * struct scic_sds_port object. This function incremetns the outstanding request
1124 * count for this port object. enum sci_status SCI_SUCCESS
1125 */
1126static enum sci_status scic_sds_port_ready_operational_substate_start_io_handler(
1127 struct scic_sds_port *port,
1128 struct scic_sds_remote_device *device,
1129 struct scic_sds_request *io_request)
1130{
1131 port->started_request_count++;
1132 return SCI_SUCCESS;
1133}
1134
1135/**
1136 * scic_sds_port_ready_configuring_substate_complete_io_handler() -
1137 * @port: This is the port that is being requested to complete the io request.
1138 * @device: This is the device on which the io is completing.
1139 *
1140 * This method will decrement the outstanding request count for this port. If
1141 * the request count goes to 0 then the port can be reprogrammed with its new
1142 * phy data.
1143 */
1144static enum sci_status
1145scic_sds_port_ready_configuring_substate_complete_io_handler(
1146 struct scic_sds_port *port,
1147 struct scic_sds_remote_device *device,
1148 struct scic_sds_request *io_request)
1149{
1150 scic_sds_port_decrement_request_count(port);
1151
1152 if (port->started_request_count == 0) {
1153 port_state_machine_change(port,
1154 SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL);
1155 }
1156
1157 return SCI_SUCCESS;
1158}
1159
1160static enum sci_status default_port_handler(struct scic_sds_port *sci_port,
1161 const char *func)
1162{
1163 dev_warn(sciport_to_dev(sci_port),
1164 "%s: in wrong state: %d\n", func,
1165 sci_base_state_machine_get_state(&sci_port->state_machine));
1166 return SCI_FAILURE_INVALID_STATE;
1167}
1168
1169static enum sci_status scic_sds_port_default_start_io_handler(struct scic_sds_port *sci_port,
1170 struct scic_sds_remote_device *sci_dev,
1171 struct scic_sds_request *sci_req)
1172{
1173 return default_port_handler(sci_port, __func__);
1174}
1175
1176static enum sci_status scic_sds_port_default_complete_io_handler(struct scic_sds_port *sci_port,
1177 struct scic_sds_remote_device *sci_dev,
1178 struct scic_sds_request *sci_req)
1179{
1180 return default_port_handler(sci_port, __func__);
1181}
1182
1183/*
1184 * ******************************************************************************
1185 * * PORT STATE PRIVATE METHODS
1186 * ****************************************************************************** */
1187
1188/** 1052/**
1189 * 1053 *
1190 * @sci_port: This is the struct scic_sds_port object to suspend. 1054 * @sci_port: This is the struct scic_sds_port object to suspend.
@@ -1269,28 +1133,10 @@ scic_sds_port_resume_port_task_scheduler(struct scic_sds_port *port)
1269 writel(pts_control_value, &port->port_task_scheduler_registers->control); 1133 writel(pts_control_value, &port->port_task_scheduler_registers->control);
1270} 1134}
1271 1135
1272/*
1273 * ******************************************************************************
1274 * * PORT READY SUBSTATE METHODS
1275 * ****************************************************************************** */
1276
1277/**
1278 *
1279 * @object: This is the object which is cast to a struct scic_sds_port object.
1280 *
1281 * This method will perform the actions required by the struct scic_sds_port on
1282 * entering the SCIC_SDS_PORT_READY_SUBSTATE_WAITING. This function checks the
1283 * port for any ready phys. If there is at least one phy in a ready state then
1284 * the port transitions to the ready operational substate. none
1285 */
1286static void scic_sds_port_ready_substate_waiting_enter(void *object) 1136static void scic_sds_port_ready_substate_waiting_enter(void *object)
1287{ 1137{
1288 struct scic_sds_port *sci_port = object; 1138 struct scic_sds_port *sci_port = object;
1289 1139
1290 scic_sds_port_set_base_state_handlers(
1291 sci_port, SCIC_SDS_PORT_READY_SUBSTATE_WAITING
1292 );
1293
1294 scic_sds_port_suspend_port_task_scheduler(sci_port); 1140 scic_sds_port_suspend_port_task_scheduler(sci_port);
1295 1141
1296 sci_port->not_ready_reason = SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS; 1142 sci_port->not_ready_reason = SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS;
@@ -1302,15 +1148,6 @@ static void scic_sds_port_ready_substate_waiting_enter(void *object)
1302 } 1148 }
1303} 1149}
1304 1150
1305/**
1306 *
1307 * @object: This is the object which is cast to a struct scic_sds_port object.
1308 *
1309 * This function will perform the actions required by the struct scic_sds_port
1310 * on entering the SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL. This function sets
1311 * the state handlers for the port object, notifies the SCI User that the port
1312 * is ready, and resumes port operations. none
1313 */
1314static void scic_sds_port_ready_substate_operational_enter(void *object) 1151static void scic_sds_port_ready_substate_operational_enter(void *object)
1315{ 1152{
1316 u32 index; 1153 u32 index;
@@ -1319,10 +1156,6 @@ static void scic_sds_port_ready_substate_operational_enter(void *object)
1319 struct isci_host *ihost = scic_to_ihost(scic); 1156 struct isci_host *ihost = scic_to_ihost(scic);
1320 struct isci_port *iport = sci_port_to_iport(sci_port); 1157 struct isci_port *iport = sci_port_to_iport(sci_port);
1321 1158
1322 scic_sds_port_set_base_state_handlers(
1323 sci_port,
1324 SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL);
1325
1326 isci_port_ready(ihost, iport); 1159 isci_port_ready(ihost, iport);
1327 1160
1328 for (index = 0; index < SCI_MAX_PHYS; index++) { 1161 for (index = 0; index < SCI_MAX_PHYS; index++) {
@@ -1397,19 +1230,6 @@ static void scic_sds_port_ready_substate_operational_exit(void *object)
1397 scic_sds_port_invalidate_dummy_remote_node(sci_port); 1230 scic_sds_port_invalidate_dummy_remote_node(sci_port);
1398} 1231}
1399 1232
1400/*
1401 * ******************************************************************************
1402 * * PORT READY CONFIGURING METHODS
1403 * ****************************************************************************** */
1404
1405/**
1406 * scic_sds_port_ready_substate_configuring_enter() -
1407 * @object: This is the object which is cast to a struct scic_sds_port object.
1408 *
1409 * This method will perform the actions required by the struct scic_sds_port on
1410 * exiting the SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL. This function reports
1411 * the port not ready and suspends the port task scheduler. none
1412 */
1413static void scic_sds_port_ready_substate_configuring_enter(void *object) 1233static void scic_sds_port_ready_substate_configuring_enter(void *object)
1414{ 1234{
1415 struct scic_sds_port *sci_port = object; 1235 struct scic_sds_port *sci_port = object;
@@ -1417,10 +1237,6 @@ static void scic_sds_port_ready_substate_configuring_enter(void *object)
1417 struct isci_host *ihost = scic_to_ihost(scic); 1237 struct isci_host *ihost = scic_to_ihost(scic);
1418 struct isci_port *iport = sci_port_to_iport(sci_port); 1238 struct isci_port *iport = sci_port_to_iport(sci_port);
1419 1239
1420 scic_sds_port_set_base_state_handlers(
1421 sci_port,
1422 SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING);
1423
1424 if (sci_port->active_phy_mask == 0) { 1240 if (sci_port->active_phy_mask == 0) {
1425 isci_port_not_ready(ihost, iport); 1241 isci_port_not_ready(ihost, iport);
1426 1242
@@ -1440,50 +1256,6 @@ static void scic_sds_port_ready_substate_configuring_exit(void *object)
1440 scic_sds_port_invalidate_dummy_remote_node(sci_port); 1256 scic_sds_port_invalidate_dummy_remote_node(sci_port);
1441} 1257}
1442 1258
1443/* --------------------------------------------------------------------------- */
1444
1445/**
1446 *
1447 * @port: This is the struct scic_sds_port object on which the io request count will
1448 * be decremented.
1449 * @device: This is the struct scic_sds_remote_device object to which the io request
1450 * is being directed. This parameter is not required to complete this
1451 * operation.
1452 * @io_request: This is the request that is being completed on this port
1453 * object. This parameter is not required to complete this operation.
1454 *
1455 * This is a general complete io request handler for the struct scic_sds_port object.
1456 * enum sci_status SCI_SUCCESS
1457 */
1458static enum sci_status scic_sds_port_general_complete_io_handler(
1459 struct scic_sds_port *port,
1460 struct scic_sds_remote_device *device,
1461 struct scic_sds_request *io_request)
1462{
1463 scic_sds_port_decrement_request_count(port);
1464
1465 return SCI_SUCCESS;
1466}
1467
1468/*
1469 * This method takes the struct scic_sds_port that is in a stopping state and handles
1470 * the complete io request. Should the request count reach 0 then the port
1471 * object will transition to the stopped state. enum sci_status SCI_SUCCESS
1472 */
1473static enum sci_status scic_sds_port_stopping_state_complete_io_handler(
1474 struct scic_sds_port *sci_port,
1475 struct scic_sds_remote_device *device,
1476 struct scic_sds_request *io_request)
1477{
1478 scic_sds_port_decrement_request_count(sci_port);
1479
1480 if (sci_port->started_request_count == 0)
1481 port_state_machine_change(sci_port,
1482 SCI_BASE_PORT_STATE_STOPPED);
1483
1484 return SCI_SUCCESS;
1485}
1486
1487enum sci_status scic_sds_port_start(struct scic_sds_port *sci_port) 1259enum sci_status scic_sds_port_start(struct scic_sds_port *sci_port)
1488{ 1260{
1489 struct scic_sds_controller *scic = sci_port->owning_controller; 1261 struct scic_sds_controller *scic = sci_port->owning_controller;
@@ -1818,45 +1590,62 @@ enum sci_status scic_sds_port_link_down(struct scic_sds_port *sci_port,
1818 } 1590 }
1819} 1591}
1820 1592
1821static struct scic_sds_port_state_handler scic_sds_port_state_handler_table[] = { 1593enum sci_status scic_sds_port_start_io(struct scic_sds_port *sci_port,
1822 [SCI_BASE_PORT_STATE_STOPPED] = { 1594 struct scic_sds_remote_device *sci_dev,
1823 .start_io_handler = scic_sds_port_default_start_io_handler, 1595 struct scic_sds_request *sci_req)
1824 .complete_io_handler = scic_sds_port_default_complete_io_handler 1596{
1825 }, 1597 enum scic_sds_port_states state;
1826 [SCI_BASE_PORT_STATE_STOPPING] = { 1598
1827 .start_io_handler = scic_sds_port_default_start_io_handler, 1599 state = sci_port->state_machine.current_state_id;
1828 .complete_io_handler = scic_sds_port_stopping_state_complete_io_handler 1600 switch (state) {
1829 }, 1601 case SCIC_SDS_PORT_READY_SUBSTATE_WAITING:
1830 [SCI_BASE_PORT_STATE_READY] = { 1602 return SCI_FAILURE_INVALID_STATE;
1831 .start_io_handler = scic_sds_port_default_start_io_handler, 1603 case SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL:
1832 .complete_io_handler = scic_sds_port_general_complete_io_handler 1604 sci_port->started_request_count++;
1833 }, 1605 return SCI_SUCCESS;
1834 [SCIC_SDS_PORT_READY_SUBSTATE_WAITING] = { 1606 default:
1835 .start_io_handler = scic_sds_port_ready_waiting_substate_start_io_handler, 1607 dev_warn(sciport_to_dev(sci_port),
1836 .complete_io_handler = scic_sds_port_ready_substate_complete_io_handler, 1608 "%s: in wrong state: %d\n", __func__, state);
1837 }, 1609 return SCI_FAILURE_INVALID_STATE;
1838 [SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL] = {
1839 .start_io_handler = scic_sds_port_ready_operational_substate_start_io_handler,
1840 .complete_io_handler = scic_sds_port_ready_substate_complete_io_handler,
1841 },
1842 [SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING] = {
1843 .start_io_handler = scic_sds_port_default_start_io_handler,
1844 .complete_io_handler = scic_sds_port_ready_configuring_substate_complete_io_handler
1845 },
1846 [SCI_BASE_PORT_STATE_RESETTING] = {
1847 .start_io_handler = scic_sds_port_default_start_io_handler,
1848 .complete_io_handler = scic_sds_port_general_complete_io_handler
1849 },
1850 [SCI_BASE_PORT_STATE_FAILED] = {
1851 .start_io_handler = scic_sds_port_default_start_io_handler,
1852 .complete_io_handler = scic_sds_port_general_complete_io_handler
1853 } 1610 }
1854}; 1611}
1855 1612
1856/* 1613enum sci_status scic_sds_port_complete_io(struct scic_sds_port *sci_port,
1857 * ****************************************************************************** 1614 struct scic_sds_remote_device *sci_dev,
1858 * * PORT STATE PRIVATE METHODS 1615 struct scic_sds_request *sci_req)
1859 * ****************************************************************************** */ 1616{
1617 enum scic_sds_port_states state;
1618
1619 state = sci_port->state_machine.current_state_id;
1620 switch (state) {
1621 case SCI_BASE_PORT_STATE_STOPPED:
1622 dev_warn(sciport_to_dev(sci_port),
1623 "%s: in wrong state: %d\n", __func__, state);
1624 return SCI_FAILURE_INVALID_STATE;
1625 case SCI_BASE_PORT_STATE_STOPPING:
1626 scic_sds_port_decrement_request_count(sci_port);
1627
1628 if (sci_port->started_request_count == 0)
1629 port_state_machine_change(sci_port,
1630 SCI_BASE_PORT_STATE_STOPPED);
1631 break;
1632 case SCI_BASE_PORT_STATE_READY:
1633 case SCI_BASE_PORT_STATE_RESETTING:
1634 case SCI_BASE_PORT_STATE_FAILED:
1635 case SCIC_SDS_PORT_READY_SUBSTATE_WAITING:
1636 case SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL:
1637 scic_sds_port_decrement_request_count(sci_port);
1638 break;
1639 case SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING:
1640 scic_sds_port_decrement_request_count(sci_port);
1641 if (sci_port->started_request_count == 0) {
1642 port_state_machine_change(sci_port,
1643 SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL);
1644 }
1645 break;
1646 }
1647 return SCI_SUCCESS;
1648}
1860 1649
1861/** 1650/**
1862 * 1651 *
@@ -1921,32 +1710,11 @@ static void scic_sds_port_post_dummy_remote_node(struct scic_sds_port *sci_port)
1921 scic_sds_controller_post_request(scic, command); 1710 scic_sds_controller_post_request(scic, command);
1922} 1711}
1923 1712
1924/*
1925 * ******************************************************************************
1926 * * PORT STATE METHODS
1927 * ****************************************************************************** */
1928
1929/**
1930 *
1931 * @object: This is the object which is cast to a struct scic_sds_port object.
1932 *
1933 * This method will perform the actions required by the struct scic_sds_port on
1934 * entering the SCI_BASE_PORT_STATE_STOPPED. This function sets the stopped
1935 * state handlers for the struct scic_sds_port object and disables the port task
1936 * scheduler in the hardware. none
1937 */
1938static void scic_sds_port_stopped_state_enter(void *object) 1713static void scic_sds_port_stopped_state_enter(void *object)
1939{ 1714{
1940 struct scic_sds_port *sci_port = object; 1715 struct scic_sds_port *sci_port = object;
1941 1716
1942 scic_sds_port_set_base_state_handlers( 1717 if (sci_port->state_machine.previous_state_id == SCI_BASE_PORT_STATE_STOPPING) {
1943 sci_port, SCI_BASE_PORT_STATE_STOPPED
1944 );
1945
1946 if (
1947 SCI_BASE_PORT_STATE_STOPPING
1948 == sci_port->state_machine.previous_state_id
1949 ) {
1950 /* 1718 /*
1951 * If we enter this state becasuse of a request to stop 1719 * If we enter this state becasuse of a request to stop
1952 * the port then we want to disable the hardwares port 1720 * the port then we want to disable the hardwares port
@@ -1955,14 +1723,6 @@ static void scic_sds_port_stopped_state_enter(void *object)
1955 } 1723 }
1956} 1724}
1957 1725
1958/**
1959 *
1960 * @object: This is the object which is cast to a struct scic_sds_port object.
1961 *
1962 * This method will perform the actions required by the struct scic_sds_port on
1963 * exiting the SCI_BASE_STATE_STOPPED. This function enables the SCU hardware
1964 * port task scheduler. none
1965 */
1966static void scic_sds_port_stopped_state_exit(void *object) 1726static void scic_sds_port_stopped_state_exit(void *object)
1967{ 1727{
1968 struct scic_sds_port *sci_port = object; 1728 struct scic_sds_port *sci_port = object;
@@ -1971,15 +1731,6 @@ static void scic_sds_port_stopped_state_exit(void *object)
1971 scic_sds_port_enable_port_task_scheduler(sci_port); 1731 scic_sds_port_enable_port_task_scheduler(sci_port);
1972} 1732}
1973 1733
1974/**
1975 * scic_sds_port_ready_state_enter -
1976 * @object: This is the object which is cast to a struct scic_sds_port object.
1977 *
1978 * This method will perform the actions required by the struct scic_sds_port on
1979 * entering the SCI_BASE_PORT_STATE_READY. This function sets the ready state
1980 * handlers for the struct scic_sds_port object, reports the port object as
1981 * not ready and starts the ready substate machine. none
1982 */
1983static void scic_sds_port_ready_state_enter(void *object) 1734static void scic_sds_port_ready_state_enter(void *object)
1984{ 1735{
1985 struct scic_sds_port *sci_port = object; 1736 struct scic_sds_port *sci_port = object;
@@ -1988,9 +1739,6 @@ static void scic_sds_port_ready_state_enter(void *object)
1988 struct isci_port *iport = sci_port_to_iport(sci_port); 1739 struct isci_port *iport = sci_port_to_iport(sci_port);
1989 u32 prev_state; 1740 u32 prev_state;
1990 1741
1991 /* Put the ready state handlers in place though they will not be there long */
1992 scic_sds_port_set_base_state_handlers(sci_port, SCI_BASE_PORT_STATE_READY);
1993
1994 prev_state = sci_port->state_machine.previous_state_id; 1742 prev_state = sci_port->state_machine.previous_state_id;
1995 if (prev_state == SCI_BASE_PORT_STATE_RESETTING) 1743 if (prev_state == SCI_BASE_PORT_STATE_RESETTING)
1996 isci_port_hard_reset_complete(iport, SCI_SUCCESS); 1744 isci_port_hard_reset_complete(iport, SCI_SUCCESS);
@@ -2005,66 +1753,14 @@ static void scic_sds_port_ready_state_enter(void *object)
2005 SCIC_SDS_PORT_READY_SUBSTATE_WAITING); 1753 SCIC_SDS_PORT_READY_SUBSTATE_WAITING);
2006} 1754}
2007 1755
2008/** 1756static void scic_sds_port_resetting_state_exit(void *object)
2009 *
2010 * @object: This is the object which is cast to a struct scic_sds_port object.
2011 *
2012 * This method will perform the actions required by the struct scic_sds_port on
2013 * entering the SCI_BASE_PORT_STATE_RESETTING. This function sets the resetting
2014 * state handlers for the struct scic_sds_port object. none
2015 */
2016static void scic_sds_port_resetting_state_enter(void *object)
2017{
2018 struct scic_sds_port *sci_port = object;
2019
2020 scic_sds_port_set_base_state_handlers(
2021 sci_port, SCI_BASE_PORT_STATE_RESETTING
2022 );
2023}
2024
2025/**
2026 *
2027 * @object: This is the object which is cast to a struct scic_sds_port object.
2028 *
2029 * This function will perform the actions required by the
2030 * struct scic_sds_port on
2031 * exiting the SCI_BASE_STATE_RESETTING. This function does nothing. none
2032 */
2033static inline void scic_sds_port_resetting_state_exit(void *object)
2034{ 1757{
2035 struct scic_sds_port *sci_port = object; 1758 struct scic_sds_port *sci_port = object;
2036 1759
2037 isci_timer_stop(sci_port->timer_handle); 1760 isci_timer_stop(sci_port->timer_handle);
2038} 1761}
2039 1762
2040/** 1763static void scic_sds_port_stopping_state_exit(void *object)
2041 *
2042 * @object: This is the void object which is cast to a
2043 * struct scic_sds_port object.
2044 *
2045 * This method will perform the actions required by the struct scic_sds_port on
2046 * entering the SCI_BASE_PORT_STATE_STOPPING. This function sets the stopping
2047 * state handlers for the struct scic_sds_port object. none
2048 */
2049static void scic_sds_port_stopping_state_enter(void *object)
2050{
2051 struct scic_sds_port *sci_port = object;
2052
2053 scic_sds_port_set_base_state_handlers(
2054 sci_port, SCI_BASE_PORT_STATE_STOPPING
2055 );
2056}
2057
2058/**
2059 *
2060 * @object: This is the object which is cast to a struct scic_sds_port object.
2061 *
2062 * This function will perform the actions required by the
2063 * struct scic_sds_port on
2064 * exiting the SCI_BASE_STATE_STOPPING. This function does nothing. none
2065 */
2066static inline void
2067scic_sds_port_stopping_state_exit(void *object)
2068{ 1764{
2069 struct scic_sds_port *sci_port = object; 1765 struct scic_sds_port *sci_port = object;
2070 1766
@@ -2073,23 +1769,11 @@ scic_sds_port_stopping_state_exit(void *object)
2073 scic_sds_port_destroy_dummy_resources(sci_port); 1769 scic_sds_port_destroy_dummy_resources(sci_port);
2074} 1770}
2075 1771
2076/**
2077 *
2078 * @object: This is the object which is cast to a struct scic_sds_port object.
2079 *
2080 * This function will perform the actions required by the
2081 * struct scic_sds_port on
2082 * entering the SCI_BASE_PORT_STATE_STOPPING. This function sets the stopping
2083 * state handlers for the struct scic_sds_port object. none
2084 */
2085static void scic_sds_port_failed_state_enter(void *object) 1772static void scic_sds_port_failed_state_enter(void *object)
2086{ 1773{
2087 struct scic_sds_port *sci_port = object; 1774 struct scic_sds_port *sci_port = object;
2088 struct isci_port *iport = sci_port_to_iport(sci_port); 1775 struct isci_port *iport = sci_port_to_iport(sci_port);
2089 1776
2090 scic_sds_port_set_base_state_handlers(sci_port,
2091 SCI_BASE_PORT_STATE_FAILED);
2092
2093 isci_port_hard_reset_complete(iport, SCI_FAILURE_TIMEOUT); 1777 isci_port_hard_reset_complete(iport, SCI_FAILURE_TIMEOUT);
2094} 1778}
2095 1779
@@ -2101,7 +1785,6 @@ static const struct sci_base_state scic_sds_port_state_table[] = {
2101 .exit_state = scic_sds_port_stopped_state_exit 1785 .exit_state = scic_sds_port_stopped_state_exit
2102 }, 1786 },
2103 [SCI_BASE_PORT_STATE_STOPPING] = { 1787 [SCI_BASE_PORT_STATE_STOPPING] = {
2104 .enter_state = scic_sds_port_stopping_state_enter,
2105 .exit_state = scic_sds_port_stopping_state_exit 1788 .exit_state = scic_sds_port_stopping_state_exit
2106 }, 1789 },
2107 [SCI_BASE_PORT_STATE_READY] = { 1790 [SCI_BASE_PORT_STATE_READY] = {
@@ -2119,7 +1802,6 @@ static const struct sci_base_state scic_sds_port_state_table[] = {
2119 .exit_state = scic_sds_port_ready_substate_configuring_exit 1802 .exit_state = scic_sds_port_ready_substate_configuring_exit
2120 }, 1803 },
2121 [SCI_BASE_PORT_STATE_RESETTING] = { 1804 [SCI_BASE_PORT_STATE_RESETTING] = {
2122 .enter_state = scic_sds_port_resetting_state_enter,
2123 .exit_state = scic_sds_port_resetting_state_exit 1805 .exit_state = scic_sds_port_resetting_state_exit
2124 }, 1806 },
2125 [SCI_BASE_PORT_STATE_FAILED] = { 1807 [SCI_BASE_PORT_STATE_FAILED] = {
diff --git a/drivers/scsi/isci/port.h b/drivers/scsi/isci/port.h
index bbce0ec583a9..af540e5c03a0 100644
--- a/drivers/scsi/isci/port.h
+++ b/drivers/scsi/isci/port.h
@@ -145,15 +145,6 @@ struct scic_sds_port {
145 void *timer_handle; 145 void *timer_handle;
146 146
147 /** 147 /**
148 * This field points to the current set of state handlers for this port
149 * object. These state handlers are assigned at each enter state of
150 * the state machine.
151 */
152 struct scic_sds_port_state_handler *state_handlers;
153
154 /* / Memory mapped hardware register space */
155
156 /**
157 * This field is the pointer to the port task scheduler registers 148 * This field is the pointer to the port task scheduler registers
158 * for the SCU hardware. 149 * for the SCU hardware.
159 */ 150 */
@@ -286,34 +277,7 @@ enum scic_sds_port_states {
286 */ 277 */
287 SCI_BASE_PORT_STATE_FAILED, 278 SCI_BASE_PORT_STATE_FAILED,
288 279
289 SCI_BASE_PORT_MAX_STATES
290
291};
292
293struct scic_sds_remote_device;
294struct scic_sds_request;
295
296typedef enum sci_status (*scic_sds_port_handler_t)(struct scic_sds_port *);
297
298typedef enum sci_status (*scic_sds_port_phy_handler_t)(struct scic_sds_port *,
299 struct scic_sds_phy *);
300
301typedef enum sci_status (*scic_sds_port_reset_handler_t)(struct scic_sds_port *,
302 u32 timeout);
303
304typedef enum sci_status (*scic_sds_port_event_handler_t)(struct scic_sds_port *, u32);
305 280
306typedef enum sci_status (*scic_sds_port_frame_handler_t)(struct scic_sds_port *, u32);
307
308typedef void (*scic_sds_port_link_handler_t)(struct scic_sds_port *, struct scic_sds_phy *);
309
310typedef enum sci_status (*scic_sds_port_io_request_handler_t)(struct scic_sds_port *,
311 struct scic_sds_remote_device *,
312 struct scic_sds_request *);
313
314struct scic_sds_port_state_handler {
315 scic_sds_port_io_request_handler_t start_io_handler;
316 scic_sds_port_io_request_handler_t complete_io_handler;
317}; 281};
318 282
319/** 283/**
@@ -325,23 +289,6 @@ struct scic_sds_port_state_handler {
325 ((this_port)->owning_controller) 289 ((this_port)->owning_controller)
326 290
327/** 291/**
328 * scic_sds_port_set_base_state_handlers() -
329 *
330 * This macro will change the state handlers to those of the specified state id
331 */
332#define scic_sds_port_set_base_state_handlers(this_port, state_id) \
333 scic_sds_port_set_state_handlers(\
334 (this_port), &scic_sds_port_state_handler_table[(state_id)])
335
336/**
337 * scic_sds_port_set_state_handlers() -
338 *
339 * Helper macro to set the port object state handlers
340 */
341#define scic_sds_port_set_state_handlers(this_port, handlers) \
342 ((this_port)->state_handlers = (handlers))
343
344/**
345 * scic_sds_port_get_index() - 292 * scic_sds_port_get_index() -
346 * 293 *
347 * This macro returns the physical port index for this port object 294 * This macro returns the physical port index for this port object
@@ -404,6 +351,8 @@ enum sci_status scic_sds_port_link_up(struct scic_sds_port *sci_port,
404enum sci_status scic_sds_port_link_down(struct scic_sds_port *sci_port, 351enum sci_status scic_sds_port_link_down(struct scic_sds_port *sci_port,
405 struct scic_sds_phy *sci_phy); 352 struct scic_sds_phy *sci_phy);
406 353
354struct scic_sds_request;
355struct scic_sds_remote_device;
407enum sci_status scic_sds_port_start_io( 356enum sci_status scic_sds_port_start_io(
408 struct scic_sds_port *sci_port, 357 struct scic_sds_port *sci_port,
409 struct scic_sds_remote_device *sci_dev, 358 struct scic_sds_remote_device *sci_dev,