diff options
author | Edmund Nadolski <edmund.nadolski@intel.com> | 2011-06-01 20:10:43 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:50 -0400 |
commit | e301370ac553a9a0ac0d1d25e769b86cf60395b3 (patch) | |
tree | 58c00e0aeb21c3101df389d4b5e34f47e4b32119 /drivers/scsi | |
parent | 8d2c65c09c9e0adc16070562e7944c1c3277f332 (diff) |
isci: state machine cleanup
This cleans up several areas of the state machine mechanism:
o Rename sci_base_state_machine_change_state to sci_change_state
o Remove sci_base_state_machine_get_state function
o Rename 'state_machine' struct member to 'sm' in client structs
o Shorten the name of request states
o Shorten state machine state names as follows:
SCI_BASE_CONTROLLER_STATE_xxx to SCIC_xxx
SCI_BASE_PHY_STATE_xxx to SCI_PHY_xxx
SCIC_SDS_PHY_STARTING_SUBSTATE_xxx to SCI_PHY_SUB_xxx
SCI_BASE_PORT_STATE_xxx to SCI_PORT_xxx and
SCIC_SDS_PORT_READY_SUBSTATE_xxx to SCI_PORT_SUB_xxx
SCI_BASE_REMOTE_DEVICE_STATE_xxx to SCI_DEV_xxx
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_xxx to SCI_STP_DEV_xxx
SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_xxx to SCI_SMP_DEV_xxx
SCIC_SDS_REMOTE_NODE_CONTEXT_xxx_STATE to SCI_RNC_xxx
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/isci/host.c | 201 | ||||
-rw-r--r-- | drivers/scsi/isci/host.h | 25 | ||||
-rw-r--r-- | drivers/scsi/isci/phy.c | 244 | ||||
-rw-r--r-- | drivers/scsi/isci/phy.h | 34 | ||||
-rw-r--r-- | drivers/scsi/isci/port.c | 186 | ||||
-rw-r--r-- | drivers/scsi/isci/port.h | 18 | ||||
-rw-r--r-- | drivers/scsi/isci/port_config.c | 4 | ||||
-rw-r--r-- | drivers/scsi/isci/remote_device.c | 349 | ||||
-rw-r--r-- | drivers/scsi/isci/remote_device.h | 34 | ||||
-rw-r--r-- | drivers/scsi/isci/remote_node_context.c | 154 | ||||
-rw-r--r-- | drivers/scsi/isci/remote_node_context.h | 18 | ||||
-rw-r--r-- | drivers/scsi/isci/request.c | 582 | ||||
-rw-r--r-- | drivers/scsi/isci/request.h | 357 | ||||
-rw-r--r-- | drivers/scsi/isci/state_machine.c | 26 | ||||
-rw-r--r-- | drivers/scsi/isci/state_machine.h | 4 |
15 files changed, 1076 insertions, 1160 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index 8801955be213..81ee64c0a4b7 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c | |||
@@ -635,8 +635,7 @@ static void scic_sds_controller_error_handler(struct scic_sds_controller *scic) | |||
635 | dev_err(scic_to_dev(scic), "%s: status: %#x\n", __func__, | 635 | dev_err(scic_to_dev(scic), "%s: status: %#x\n", __func__, |
636 | interrupt_status); | 636 | interrupt_status); |
637 | 637 | ||
638 | sci_base_state_machine_change_state(&scic->state_machine, | 638 | sci_change_state(&scic->sm, SCIC_FAILED); |
639 | SCI_BASE_CONTROLLER_STATE_FAILED); | ||
640 | 639 | ||
641 | return; | 640 | return; |
642 | } | 641 | } |
@@ -895,14 +894,12 @@ static void scic_sds_controller_transition_to_ready( | |||
895 | { | 894 | { |
896 | struct isci_host *ihost = scic_to_ihost(scic); | 895 | struct isci_host *ihost = scic_to_ihost(scic); |
897 | 896 | ||
898 | if (scic->state_machine.current_state_id == | 897 | if (scic->sm.current_state_id == SCIC_STARTING) { |
899 | SCI_BASE_CONTROLLER_STATE_STARTING) { | ||
900 | /* | 898 | /* |
901 | * We move into the ready state, because some of the phys/ports | 899 | * We move into the ready state, because some of the phys/ports |
902 | * may be up and operational. | 900 | * may be up and operational. |
903 | */ | 901 | */ |
904 | sci_base_state_machine_change_state(&scic->state_machine, | 902 | sci_change_state(&scic->sm, SCIC_READY); |
905 | SCI_BASE_CONTROLLER_STATE_READY); | ||
906 | 903 | ||
907 | isci_host_start_complete(ihost, status); | 904 | isci_host_start_complete(ihost, status); |
908 | } | 905 | } |
@@ -912,18 +909,18 @@ static bool is_phy_starting(struct scic_sds_phy *sci_phy) | |||
912 | { | 909 | { |
913 | enum scic_sds_phy_states state; | 910 | enum scic_sds_phy_states state; |
914 | 911 | ||
915 | state = sci_phy->state_machine.current_state_id; | 912 | state = sci_phy->sm.current_state_id; |
916 | switch (state) { | 913 | switch (state) { |
917 | case SCI_BASE_PHY_STATE_STARTING: | 914 | case SCI_PHY_STARTING: |
918 | case SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL: | 915 | case SCI_PHY_SUB_INITIAL: |
919 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN: | 916 | case SCI_PHY_SUB_AWAIT_SAS_SPEED_EN: |
920 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF: | 917 | case SCI_PHY_SUB_AWAIT_IAF_UF: |
921 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER: | 918 | case SCI_PHY_SUB_AWAIT_SAS_POWER: |
922 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER: | 919 | case SCI_PHY_SUB_AWAIT_SATA_POWER: |
923 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN: | 920 | case SCI_PHY_SUB_AWAIT_SATA_PHY_EN: |
924 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN: | 921 | case SCI_PHY_SUB_AWAIT_SATA_SPEED_EN: |
925 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF: | 922 | case SCI_PHY_SUB_AWAIT_SIG_FIS_UF: |
926 | case SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL: | 923 | case SCI_PHY_SUB_FINAL: |
927 | return true; | 924 | return true; |
928 | default: | 925 | default: |
929 | return false; | 926 | return false; |
@@ -957,7 +954,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro | |||
957 | 954 | ||
958 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 955 | for (index = 0; index < SCI_MAX_PHYS; index++) { |
959 | sci_phy = &ihost->phys[index].sci; | 956 | sci_phy = &ihost->phys[index].sci; |
960 | state = sci_phy->state_machine.current_state_id; | 957 | state = sci_phy->sm.current_state_id; |
961 | 958 | ||
962 | if (!phy_get_non_dummy_port(sci_phy)) | 959 | if (!phy_get_non_dummy_port(sci_phy)) |
963 | continue; | 960 | continue; |
@@ -968,12 +965,9 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro | |||
968 | * - have an indication of a connected device and it has | 965 | * - have an indication of a connected device and it has |
969 | * finished the link training process. | 966 | * finished the link training process. |
970 | */ | 967 | */ |
971 | if ((sci_phy->is_in_link_training == false && | 968 | if ((sci_phy->is_in_link_training == false && state == SCI_PHY_INITIAL) || |
972 | state == SCI_BASE_PHY_STATE_INITIAL) || | 969 | (sci_phy->is_in_link_training == false && state == SCI_PHY_STOPPED) || |
973 | (sci_phy->is_in_link_training == false && | 970 | (sci_phy->is_in_link_training == true && is_phy_starting(sci_phy))) { |
974 | state == SCI_BASE_PHY_STATE_STOPPED) || | ||
975 | (sci_phy->is_in_link_training == true && | ||
976 | is_phy_starting(sci_phy))) { | ||
977 | is_controller_start_complete = false; | 971 | is_controller_start_complete = false; |
978 | break; | 972 | break; |
979 | } | 973 | } |
@@ -1059,8 +1053,7 @@ static enum sci_status scic_controller_start(struct scic_sds_controller *scic, | |||
1059 | enum sci_status result; | 1053 | enum sci_status result; |
1060 | u16 index; | 1054 | u16 index; |
1061 | 1055 | ||
1062 | if (scic->state_machine.current_state_id != | 1056 | if (scic->sm.current_state_id != SCIC_INITIALIZED) { |
1063 | SCI_BASE_CONTROLLER_STATE_INITIALIZED) { | ||
1064 | dev_warn(scic_to_dev(scic), | 1057 | dev_warn(scic_to_dev(scic), |
1065 | "SCIC Controller start operation requested in " | 1058 | "SCIC Controller start operation requested in " |
1066 | "invalid state\n"); | 1059 | "invalid state\n"); |
@@ -1108,8 +1101,7 @@ static enum sci_status scic_controller_start(struct scic_sds_controller *scic, | |||
1108 | 1101 | ||
1109 | sci_mod_timer(&scic->timer, timeout); | 1102 | sci_mod_timer(&scic->timer, timeout); |
1110 | 1103 | ||
1111 | sci_base_state_machine_change_state(&scic->state_machine, | 1104 | sci_change_state(&scic->sm, SCIC_STARTING); |
1112 | SCI_BASE_CONTROLLER_STATE_STARTING); | ||
1113 | 1105 | ||
1114 | return SCI_SUCCESS; | 1106 | return SCI_SUCCESS; |
1115 | } | 1107 | } |
@@ -1279,8 +1271,7 @@ static void isci_host_completion_routine(unsigned long data) | |||
1279 | static enum sci_status scic_controller_stop(struct scic_sds_controller *scic, | 1271 | static enum sci_status scic_controller_stop(struct scic_sds_controller *scic, |
1280 | u32 timeout) | 1272 | u32 timeout) |
1281 | { | 1273 | { |
1282 | if (scic->state_machine.current_state_id != | 1274 | if (scic->sm.current_state_id != SCIC_READY) { |
1283 | SCI_BASE_CONTROLLER_STATE_READY) { | ||
1284 | dev_warn(scic_to_dev(scic), | 1275 | dev_warn(scic_to_dev(scic), |
1285 | "SCIC Controller stop operation requested in " | 1276 | "SCIC Controller stop operation requested in " |
1286 | "invalid state\n"); | 1277 | "invalid state\n"); |
@@ -1288,8 +1279,7 @@ static enum sci_status scic_controller_stop(struct scic_sds_controller *scic, | |||
1288 | } | 1279 | } |
1289 | 1280 | ||
1290 | sci_mod_timer(&scic->timer, timeout); | 1281 | sci_mod_timer(&scic->timer, timeout); |
1291 | sci_base_state_machine_change_state(&scic->state_machine, | 1282 | sci_change_state(&scic->sm, SCIC_STOPPING); |
1292 | SCI_BASE_CONTROLLER_STATE_STOPPING); | ||
1293 | return SCI_SUCCESS; | 1283 | return SCI_SUCCESS; |
1294 | } | 1284 | } |
1295 | 1285 | ||
@@ -1307,17 +1297,16 @@ static enum sci_status scic_controller_stop(struct scic_sds_controller *scic, | |||
1307 | */ | 1297 | */ |
1308 | static enum sci_status scic_controller_reset(struct scic_sds_controller *scic) | 1298 | static enum sci_status scic_controller_reset(struct scic_sds_controller *scic) |
1309 | { | 1299 | { |
1310 | switch (scic->state_machine.current_state_id) { | 1300 | switch (scic->sm.current_state_id) { |
1311 | case SCI_BASE_CONTROLLER_STATE_RESET: | 1301 | case SCIC_RESET: |
1312 | case SCI_BASE_CONTROLLER_STATE_READY: | 1302 | case SCIC_READY: |
1313 | case SCI_BASE_CONTROLLER_STATE_STOPPED: | 1303 | case SCIC_STOPPED: |
1314 | case SCI_BASE_CONTROLLER_STATE_FAILED: | 1304 | case SCIC_FAILED: |
1315 | /* | 1305 | /* |
1316 | * The reset operation is not a graceful cleanup, just | 1306 | * The reset operation is not a graceful cleanup, just |
1317 | * perform the state transition. | 1307 | * perform the state transition. |
1318 | */ | 1308 | */ |
1319 | sci_base_state_machine_change_state(&scic->state_machine, | 1309 | sci_change_state(&scic->sm, SCIC_RESETTING); |
1320 | SCI_BASE_CONTROLLER_STATE_RESETTING); | ||
1321 | return SCI_SUCCESS; | 1310 | return SCI_SUCCESS; |
1322 | default: | 1311 | default: |
1323 | dev_warn(scic_to_dev(scic), | 1312 | dev_warn(scic_to_dev(scic), |
@@ -1416,15 +1405,14 @@ static void isci_user_parameters_get( | |||
1416 | 1405 | ||
1417 | static void scic_sds_controller_initial_state_enter(struct sci_base_state_machine *sm) | 1406 | static void scic_sds_controller_initial_state_enter(struct sci_base_state_machine *sm) |
1418 | { | 1407 | { |
1419 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine); | 1408 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm); |
1420 | 1409 | ||
1421 | sci_base_state_machine_change_state(&scic->state_machine, | 1410 | sci_change_state(&scic->sm, SCIC_RESET); |
1422 | SCI_BASE_CONTROLLER_STATE_RESET); | ||
1423 | } | 1411 | } |
1424 | 1412 | ||
1425 | static inline void scic_sds_controller_starting_state_exit(struct sci_base_state_machine *sm) | 1413 | static inline void scic_sds_controller_starting_state_exit(struct sci_base_state_machine *sm) |
1426 | { | 1414 | { |
1427 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine); | 1415 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm); |
1428 | 1416 | ||
1429 | sci_del_timer(&scic->timer); | 1417 | sci_del_timer(&scic->timer); |
1430 | } | 1418 | } |
@@ -1551,7 +1539,7 @@ static enum sci_status scic_controller_set_interrupt_coalescence( | |||
1551 | 1539 | ||
1552 | static void scic_sds_controller_ready_state_enter(struct sci_base_state_machine *sm) | 1540 | static void scic_sds_controller_ready_state_enter(struct sci_base_state_machine *sm) |
1553 | { | 1541 | { |
1554 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine); | 1542 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm); |
1555 | 1543 | ||
1556 | /* set the default interrupt coalescence number and timeout value. */ | 1544 | /* set the default interrupt coalescence number and timeout value. */ |
1557 | scic_controller_set_interrupt_coalescence(scic, 0x10, 250); | 1545 | scic_controller_set_interrupt_coalescence(scic, 0x10, 250); |
@@ -1559,7 +1547,7 @@ static void scic_sds_controller_ready_state_enter(struct sci_base_state_machine | |||
1559 | 1547 | ||
1560 | static void scic_sds_controller_ready_state_exit(struct sci_base_state_machine *sm) | 1548 | static void scic_sds_controller_ready_state_exit(struct sci_base_state_machine *sm) |
1561 | { | 1549 | { |
1562 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine); | 1550 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm); |
1563 | 1551 | ||
1564 | /* disable interrupt coalescence. */ | 1552 | /* disable interrupt coalescence. */ |
1565 | scic_controller_set_interrupt_coalescence(scic, 0, 0); | 1553 | scic_controller_set_interrupt_coalescence(scic, 0, 0); |
@@ -1650,7 +1638,7 @@ static enum sci_status scic_sds_controller_stop_devices(struct scic_sds_controll | |||
1650 | 1638 | ||
1651 | static void scic_sds_controller_stopping_state_enter(struct sci_base_state_machine *sm) | 1639 | static void scic_sds_controller_stopping_state_enter(struct sci_base_state_machine *sm) |
1652 | { | 1640 | { |
1653 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine); | 1641 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm); |
1654 | 1642 | ||
1655 | /* Stop all of the components for this controller */ | 1643 | /* Stop all of the components for this controller */ |
1656 | scic_sds_controller_stop_phys(scic); | 1644 | scic_sds_controller_stop_phys(scic); |
@@ -1660,7 +1648,7 @@ static void scic_sds_controller_stopping_state_enter(struct sci_base_state_machi | |||
1660 | 1648 | ||
1661 | static void scic_sds_controller_stopping_state_exit(struct sci_base_state_machine *sm) | 1649 | static void scic_sds_controller_stopping_state_exit(struct sci_base_state_machine *sm) |
1662 | { | 1650 | { |
1663 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine); | 1651 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm); |
1664 | 1652 | ||
1665 | sci_del_timer(&scic->timer); | 1653 | sci_del_timer(&scic->timer); |
1666 | } | 1654 | } |
@@ -1691,36 +1679,35 @@ static void scic_sds_controller_reset_hardware(struct scic_sds_controller *scic) | |||
1691 | 1679 | ||
1692 | static void scic_sds_controller_resetting_state_enter(struct sci_base_state_machine *sm) | 1680 | static void scic_sds_controller_resetting_state_enter(struct sci_base_state_machine *sm) |
1693 | { | 1681 | { |
1694 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine); | 1682 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm); |
1695 | 1683 | ||
1696 | scic_sds_controller_reset_hardware(scic); | 1684 | scic_sds_controller_reset_hardware(scic); |
1697 | sci_base_state_machine_change_state(&scic->state_machine, | 1685 | sci_change_state(&scic->sm, SCIC_RESET); |
1698 | SCI_BASE_CONTROLLER_STATE_RESET); | ||
1699 | } | 1686 | } |
1700 | 1687 | ||
1701 | static const struct sci_base_state scic_sds_controller_state_table[] = { | 1688 | static const struct sci_base_state scic_sds_controller_state_table[] = { |
1702 | [SCI_BASE_CONTROLLER_STATE_INITIAL] = { | 1689 | [SCIC_INITIAL] = { |
1703 | .enter_state = scic_sds_controller_initial_state_enter, | 1690 | .enter_state = scic_sds_controller_initial_state_enter, |
1704 | }, | 1691 | }, |
1705 | [SCI_BASE_CONTROLLER_STATE_RESET] = {}, | 1692 | [SCIC_RESET] = {}, |
1706 | [SCI_BASE_CONTROLLER_STATE_INITIALIZING] = {}, | 1693 | [SCIC_INITIALIZING] = {}, |
1707 | [SCI_BASE_CONTROLLER_STATE_INITIALIZED] = {}, | 1694 | [SCIC_INITIALIZED] = {}, |
1708 | [SCI_BASE_CONTROLLER_STATE_STARTING] = { | 1695 | [SCIC_STARTING] = { |
1709 | .exit_state = scic_sds_controller_starting_state_exit, | 1696 | .exit_state = scic_sds_controller_starting_state_exit, |
1710 | }, | 1697 | }, |
1711 | [SCI_BASE_CONTROLLER_STATE_READY] = { | 1698 | [SCIC_READY] = { |
1712 | .enter_state = scic_sds_controller_ready_state_enter, | 1699 | .enter_state = scic_sds_controller_ready_state_enter, |
1713 | .exit_state = scic_sds_controller_ready_state_exit, | 1700 | .exit_state = scic_sds_controller_ready_state_exit, |
1714 | }, | 1701 | }, |
1715 | [SCI_BASE_CONTROLLER_STATE_RESETTING] = { | 1702 | [SCIC_RESETTING] = { |
1716 | .enter_state = scic_sds_controller_resetting_state_enter, | 1703 | .enter_state = scic_sds_controller_resetting_state_enter, |
1717 | }, | 1704 | }, |
1718 | [SCI_BASE_CONTROLLER_STATE_STOPPING] = { | 1705 | [SCIC_STOPPING] = { |
1719 | .enter_state = scic_sds_controller_stopping_state_enter, | 1706 | .enter_state = scic_sds_controller_stopping_state_enter, |
1720 | .exit_state = scic_sds_controller_stopping_state_exit, | 1707 | .exit_state = scic_sds_controller_stopping_state_exit, |
1721 | }, | 1708 | }, |
1722 | [SCI_BASE_CONTROLLER_STATE_STOPPED] = {}, | 1709 | [SCIC_STOPPED] = {}, |
1723 | [SCI_BASE_CONTROLLER_STATE_FAILED] = {} | 1710 | [SCIC_FAILED] = {} |
1724 | }; | 1711 | }; |
1725 | 1712 | ||
1726 | static void scic_sds_controller_set_default_config_parameters(struct scic_sds_controller *scic) | 1713 | static void scic_sds_controller_set_default_config_parameters(struct scic_sds_controller *scic) |
@@ -1774,7 +1761,7 @@ static void controller_timeout(unsigned long data) | |||
1774 | struct sci_timer *tmr = (struct sci_timer *)data; | 1761 | struct sci_timer *tmr = (struct sci_timer *)data; |
1775 | struct scic_sds_controller *scic = container_of(tmr, typeof(*scic), timer); | 1762 | struct scic_sds_controller *scic = container_of(tmr, typeof(*scic), timer); |
1776 | struct isci_host *ihost = scic_to_ihost(scic); | 1763 | struct isci_host *ihost = scic_to_ihost(scic); |
1777 | struct sci_base_state_machine *sm = &scic->state_machine; | 1764 | struct sci_base_state_machine *sm = &scic->sm; |
1778 | unsigned long flags; | 1765 | unsigned long flags; |
1779 | 1766 | ||
1780 | spin_lock_irqsave(&ihost->scic_lock, flags); | 1767 | spin_lock_irqsave(&ihost->scic_lock, flags); |
@@ -1782,10 +1769,10 @@ static void controller_timeout(unsigned long data) | |||
1782 | if (tmr->cancel) | 1769 | if (tmr->cancel) |
1783 | goto done; | 1770 | goto done; |
1784 | 1771 | ||
1785 | if (sm->current_state_id == SCI_BASE_CONTROLLER_STATE_STARTING) | 1772 | if (sm->current_state_id == SCIC_STARTING) |
1786 | scic_sds_controller_transition_to_ready(scic, SCI_FAILURE_TIMEOUT); | 1773 | scic_sds_controller_transition_to_ready(scic, SCI_FAILURE_TIMEOUT); |
1787 | else if (sm->current_state_id == SCI_BASE_CONTROLLER_STATE_STOPPING) { | 1774 | else if (sm->current_state_id == SCIC_STOPPING) { |
1788 | sci_base_state_machine_change_state(sm, SCI_BASE_CONTROLLER_STATE_FAILED); | 1775 | sci_change_state(sm, SCIC_FAILED); |
1789 | isci_host_stop_complete(ihost, SCI_FAILURE_TIMEOUT); | 1776 | isci_host_stop_complete(ihost, SCI_FAILURE_TIMEOUT); |
1790 | } else /* / @todo Now what do we want to do in this case? */ | 1777 | } else /* / @todo Now what do we want to do in this case? */ |
1791 | dev_err(scic_to_dev(scic), | 1778 | dev_err(scic_to_dev(scic), |
@@ -1820,11 +1807,11 @@ static enum sci_status scic_controller_construct(struct scic_sds_controller *sci | |||
1820 | struct isci_host *ihost = scic_to_ihost(scic); | 1807 | struct isci_host *ihost = scic_to_ihost(scic); |
1821 | u8 i; | 1808 | u8 i; |
1822 | 1809 | ||
1823 | sci_base_state_machine_construct(&scic->state_machine, | 1810 | sci_base_state_machine_construct(&scic->sm, |
1824 | scic_sds_controller_state_table, | 1811 | scic_sds_controller_state_table, |
1825 | SCI_BASE_CONTROLLER_STATE_INITIAL); | 1812 | SCIC_INITIAL); |
1826 | 1813 | ||
1827 | sci_base_state_machine_start(&scic->state_machine); | 1814 | sci_base_state_machine_start(&scic->sm); |
1828 | 1815 | ||
1829 | scic->scu_registers = scu_base; | 1816 | scic->scu_registers = scu_base; |
1830 | scic->smu_registers = smu_base; | 1817 | scic->smu_registers = smu_base; |
@@ -1899,11 +1886,11 @@ int scic_oem_parameters_validate(struct scic_sds_oem_params *oem) | |||
1899 | static enum sci_status scic_oem_parameters_set(struct scic_sds_controller *scic, | 1886 | static enum sci_status scic_oem_parameters_set(struct scic_sds_controller *scic, |
1900 | union scic_oem_parameters *scic_parms) | 1887 | union scic_oem_parameters *scic_parms) |
1901 | { | 1888 | { |
1902 | u32 state = scic->state_machine.current_state_id; | 1889 | u32 state = scic->sm.current_state_id; |
1903 | 1890 | ||
1904 | if (state == SCI_BASE_CONTROLLER_STATE_RESET || | 1891 | if (state == SCIC_RESET || |
1905 | state == SCI_BASE_CONTROLLER_STATE_INITIALIZING || | 1892 | state == SCIC_INITIALIZING || |
1906 | state == SCI_BASE_CONTROLLER_STATE_INITIALIZED) { | 1893 | state == SCIC_INITIALIZED) { |
1907 | 1894 | ||
1908 | if (scic_oem_parameters_validate(&scic_parms->sds1)) | 1895 | if (scic_oem_parameters_validate(&scic_parms->sds1)) |
1909 | return SCI_FAILURE_INVALID_PARAMETER_VALUE; | 1896 | return SCI_FAILURE_INVALID_PARAMETER_VALUE; |
@@ -2168,10 +2155,8 @@ static enum sci_status scic_controller_set_mode(struct scic_sds_controller *scic | |||
2168 | { | 2155 | { |
2169 | enum sci_status status = SCI_SUCCESS; | 2156 | enum sci_status status = SCI_SUCCESS; |
2170 | 2157 | ||
2171 | if ((scic->state_machine.current_state_id == | 2158 | if ((scic->sm.current_state_id == SCIC_INITIALIZING) || |
2172 | SCI_BASE_CONTROLLER_STATE_INITIALIZING) || | 2159 | (scic->sm.current_state_id == SCIC_INITIALIZED)) { |
2173 | (scic->state_machine.current_state_id == | ||
2174 | SCI_BASE_CONTROLLER_STATE_INITIALIZED)) { | ||
2175 | switch (operating_mode) { | 2160 | switch (operating_mode) { |
2176 | case SCI_MODE_SPEED: | 2161 | case SCI_MODE_SPEED: |
2177 | scic->remote_node_entries = SCI_MAX_REMOTE_DEVICES; | 2162 | scic->remote_node_entries = SCI_MAX_REMOTE_DEVICES; |
@@ -2216,20 +2201,19 @@ static void scic_sds_controller_initialize_power_control(struct scic_sds_control | |||
2216 | 2201 | ||
2217 | static enum sci_status scic_controller_initialize(struct scic_sds_controller *scic) | 2202 | static enum sci_status scic_controller_initialize(struct scic_sds_controller *scic) |
2218 | { | 2203 | { |
2219 | struct sci_base_state_machine *sm = &scic->state_machine; | 2204 | struct sci_base_state_machine *sm = &scic->sm; |
2220 | enum sci_status result = SCI_SUCCESS; | 2205 | enum sci_status result = SCI_SUCCESS; |
2221 | struct isci_host *ihost = scic_to_ihost(scic); | 2206 | struct isci_host *ihost = scic_to_ihost(scic); |
2222 | u32 index, state; | 2207 | u32 index, state; |
2223 | 2208 | ||
2224 | if (scic->state_machine.current_state_id != | 2209 | if (scic->sm.current_state_id != SCIC_RESET) { |
2225 | SCI_BASE_CONTROLLER_STATE_RESET) { | ||
2226 | dev_warn(scic_to_dev(scic), | 2210 | dev_warn(scic_to_dev(scic), |
2227 | "SCIC Controller initialize operation requested " | 2211 | "SCIC Controller initialize operation requested " |
2228 | "in invalid state\n"); | 2212 | "in invalid state\n"); |
2229 | return SCI_FAILURE_INVALID_STATE; | 2213 | return SCI_FAILURE_INVALID_STATE; |
2230 | } | 2214 | } |
2231 | 2215 | ||
2232 | sci_base_state_machine_change_state(sm, SCI_BASE_CONTROLLER_STATE_INITIALIZING); | 2216 | sci_change_state(sm, SCIC_INITIALIZING); |
2233 | 2217 | ||
2234 | sci_init_timer(&scic->phy_timer, phy_startup_timeout); | 2218 | sci_init_timer(&scic->phy_timer, phy_startup_timeout); |
2235 | 2219 | ||
@@ -2374,10 +2358,10 @@ static enum sci_status scic_controller_initialize(struct scic_sds_controller *sc | |||
2374 | 2358 | ||
2375 | /* Advance the controller state machine */ | 2359 | /* Advance the controller state machine */ |
2376 | if (result == SCI_SUCCESS) | 2360 | if (result == SCI_SUCCESS) |
2377 | state = SCI_BASE_CONTROLLER_STATE_INITIALIZED; | 2361 | state = SCIC_INITIALIZED; |
2378 | else | 2362 | else |
2379 | state = SCI_BASE_CONTROLLER_STATE_FAILED; | 2363 | state = SCIC_FAILED; |
2380 | sci_base_state_machine_change_state(sm, state); | 2364 | sci_change_state(sm, state); |
2381 | 2365 | ||
2382 | return result; | 2366 | return result; |
2383 | } | 2367 | } |
@@ -2386,11 +2370,11 @@ static enum sci_status scic_user_parameters_set( | |||
2386 | struct scic_sds_controller *scic, | 2370 | struct scic_sds_controller *scic, |
2387 | union scic_user_parameters *scic_parms) | 2371 | union scic_user_parameters *scic_parms) |
2388 | { | 2372 | { |
2389 | u32 state = scic->state_machine.current_state_id; | 2373 | u32 state = scic->sm.current_state_id; |
2390 | 2374 | ||
2391 | if (state == SCI_BASE_CONTROLLER_STATE_RESET || | 2375 | if (state == SCIC_RESET || |
2392 | state == SCI_BASE_CONTROLLER_STATE_INITIALIZING || | 2376 | state == SCIC_INITIALIZING || |
2393 | state == SCI_BASE_CONTROLLER_STATE_INITIALIZED) { | 2377 | state == SCIC_INITIALIZED) { |
2394 | u16 index; | 2378 | u16 index; |
2395 | 2379 | ||
2396 | /* | 2380 | /* |
@@ -2612,15 +2596,15 @@ int isci_host_init(struct isci_host *isci_host) | |||
2612 | void scic_sds_controller_link_up(struct scic_sds_controller *scic, | 2596 | void scic_sds_controller_link_up(struct scic_sds_controller *scic, |
2613 | struct scic_sds_port *port, struct scic_sds_phy *phy) | 2597 | struct scic_sds_port *port, struct scic_sds_phy *phy) |
2614 | { | 2598 | { |
2615 | switch (scic->state_machine.current_state_id) { | 2599 | switch (scic->sm.current_state_id) { |
2616 | case SCI_BASE_CONTROLLER_STATE_STARTING: | 2600 | case SCIC_STARTING: |
2617 | sci_del_timer(&scic->phy_timer); | 2601 | sci_del_timer(&scic->phy_timer); |
2618 | scic->phy_startup_timer_pending = false; | 2602 | scic->phy_startup_timer_pending = false; |
2619 | scic->port_agent.link_up_handler(scic, &scic->port_agent, | 2603 | scic->port_agent.link_up_handler(scic, &scic->port_agent, |
2620 | port, phy); | 2604 | port, phy); |
2621 | scic_sds_controller_start_next_phy(scic); | 2605 | scic_sds_controller_start_next_phy(scic); |
2622 | break; | 2606 | break; |
2623 | case SCI_BASE_CONTROLLER_STATE_READY: | 2607 | case SCIC_READY: |
2624 | scic->port_agent.link_up_handler(scic, &scic->port_agent, | 2608 | scic->port_agent.link_up_handler(scic, &scic->port_agent, |
2625 | port, phy); | 2609 | port, phy); |
2626 | break; | 2610 | break; |
@@ -2628,16 +2612,16 @@ void scic_sds_controller_link_up(struct scic_sds_controller *scic, | |||
2628 | dev_dbg(scic_to_dev(scic), | 2612 | dev_dbg(scic_to_dev(scic), |
2629 | "%s: SCIC Controller linkup event from phy %d in " | 2613 | "%s: SCIC Controller linkup event from phy %d in " |
2630 | "unexpected state %d\n", __func__, phy->phy_index, | 2614 | "unexpected state %d\n", __func__, phy->phy_index, |
2631 | scic->state_machine.current_state_id); | 2615 | scic->sm.current_state_id); |
2632 | } | 2616 | } |
2633 | } | 2617 | } |
2634 | 2618 | ||
2635 | void scic_sds_controller_link_down(struct scic_sds_controller *scic, | 2619 | void scic_sds_controller_link_down(struct scic_sds_controller *scic, |
2636 | struct scic_sds_port *port, struct scic_sds_phy *phy) | 2620 | struct scic_sds_port *port, struct scic_sds_phy *phy) |
2637 | { | 2621 | { |
2638 | switch (scic->state_machine.current_state_id) { | 2622 | switch (scic->sm.current_state_id) { |
2639 | case SCI_BASE_CONTROLLER_STATE_STARTING: | 2623 | case SCIC_STARTING: |
2640 | case SCI_BASE_CONTROLLER_STATE_READY: | 2624 | case SCIC_READY: |
2641 | scic->port_agent.link_down_handler(scic, &scic->port_agent, | 2625 | scic->port_agent.link_down_handler(scic, &scic->port_agent, |
2642 | port, phy); | 2626 | port, phy); |
2643 | break; | 2627 | break; |
@@ -2647,7 +2631,7 @@ void scic_sds_controller_link_down(struct scic_sds_controller *scic, | |||
2647 | "unexpected state %d\n", | 2631 | "unexpected state %d\n", |
2648 | __func__, | 2632 | __func__, |
2649 | phy->phy_index, | 2633 | phy->phy_index, |
2650 | scic->state_machine.current_state_id); | 2634 | scic->sm.current_state_id); |
2651 | } | 2635 | } |
2652 | } | 2636 | } |
2653 | 2637 | ||
@@ -2663,8 +2647,7 @@ static bool scic_sds_controller_has_remote_devices_stopping( | |||
2663 | 2647 | ||
2664 | for (index = 0; index < controller->remote_node_entries; index++) { | 2648 | for (index = 0; index < controller->remote_node_entries; index++) { |
2665 | if ((controller->device_table[index] != NULL) && | 2649 | if ((controller->device_table[index] != NULL) && |
2666 | (controller->device_table[index]->state_machine.current_state_id | 2650 | (controller->device_table[index]->sm.current_state_id == SCI_DEV_STOPPING)) |
2667 | == SCI_BASE_REMOTE_DEVICE_STATE_STOPPING)) | ||
2668 | return true; | 2651 | return true; |
2669 | } | 2652 | } |
2670 | 2653 | ||
@@ -2678,19 +2661,17 @@ static bool scic_sds_controller_has_remote_devices_stopping( | |||
2678 | void scic_sds_controller_remote_device_stopped(struct scic_sds_controller *scic, | 2661 | void scic_sds_controller_remote_device_stopped(struct scic_sds_controller *scic, |
2679 | struct scic_sds_remote_device *sci_dev) | 2662 | struct scic_sds_remote_device *sci_dev) |
2680 | { | 2663 | { |
2681 | if (scic->state_machine.current_state_id != | 2664 | if (scic->sm.current_state_id != SCIC_STOPPING) { |
2682 | SCI_BASE_CONTROLLER_STATE_STOPPING) { | ||
2683 | dev_dbg(scic_to_dev(scic), | 2665 | dev_dbg(scic_to_dev(scic), |
2684 | "SCIC Controller 0x%p remote device stopped event " | 2666 | "SCIC Controller 0x%p remote device stopped event " |
2685 | "from device 0x%p in unexpected state %d\n", | 2667 | "from device 0x%p in unexpected state %d\n", |
2686 | scic, sci_dev, | 2668 | scic, sci_dev, |
2687 | scic->state_machine.current_state_id); | 2669 | scic->sm.current_state_id); |
2688 | return; | 2670 | return; |
2689 | } | 2671 | } |
2690 | 2672 | ||
2691 | if (!scic_sds_controller_has_remote_devices_stopping(scic)) { | 2673 | if (!scic_sds_controller_has_remote_devices_stopping(scic)) { |
2692 | sci_base_state_machine_change_state(&scic->state_machine, | 2674 | sci_change_state(&scic->sm, SCIC_STOPPED); |
2693 | SCI_BASE_CONTROLLER_STATE_STOPPED); | ||
2694 | } | 2675 | } |
2695 | } | 2676 | } |
2696 | 2677 | ||
@@ -2948,8 +2929,7 @@ enum sci_status scic_controller_start_io( | |||
2948 | { | 2929 | { |
2949 | enum sci_status status; | 2930 | enum sci_status status; |
2950 | 2931 | ||
2951 | if (scic->state_machine.current_state_id != | 2932 | if (scic->sm.current_state_id != SCIC_READY) { |
2952 | SCI_BASE_CONTROLLER_STATE_READY) { | ||
2953 | dev_warn(scic_to_dev(scic), "invalid state to start I/O"); | 2933 | dev_warn(scic_to_dev(scic), "invalid state to start I/O"); |
2954 | return SCI_FAILURE_INVALID_STATE; | 2934 | return SCI_FAILURE_INVALID_STATE; |
2955 | } | 2935 | } |
@@ -2986,8 +2966,7 @@ enum sci_status scic_controller_terminate_request( | |||
2986 | { | 2966 | { |
2987 | enum sci_status status; | 2967 | enum sci_status status; |
2988 | 2968 | ||
2989 | if (scic->state_machine.current_state_id != | 2969 | if (scic->sm.current_state_id != SCIC_READY) { |
2990 | SCI_BASE_CONTROLLER_STATE_READY) { | ||
2991 | dev_warn(scic_to_dev(scic), | 2970 | dev_warn(scic_to_dev(scic), |
2992 | "invalid state to terminate request\n"); | 2971 | "invalid state to terminate request\n"); |
2993 | return SCI_FAILURE_INVALID_STATE; | 2972 | return SCI_FAILURE_INVALID_STATE; |
@@ -3037,11 +3016,11 @@ enum sci_status scic_controller_complete_io( | |||
3037 | enum sci_status status; | 3016 | enum sci_status status; |
3038 | u16 index; | 3017 | u16 index; |
3039 | 3018 | ||
3040 | switch (scic->state_machine.current_state_id) { | 3019 | switch (scic->sm.current_state_id) { |
3041 | case SCI_BASE_CONTROLLER_STATE_STOPPING: | 3020 | case SCIC_STOPPING: |
3042 | /* XXX: Implement this function */ | 3021 | /* XXX: Implement this function */ |
3043 | return SCI_FAILURE; | 3022 | return SCI_FAILURE; |
3044 | case SCI_BASE_CONTROLLER_STATE_READY: | 3023 | case SCIC_READY: |
3045 | status = scic_sds_remote_device_complete_io(scic, rdev, request); | 3024 | status = scic_sds_remote_device_complete_io(scic, rdev, request); |
3046 | if (status != SCI_SUCCESS) | 3025 | if (status != SCI_SUCCESS) |
3047 | return status; | 3026 | return status; |
@@ -3060,8 +3039,7 @@ enum sci_status scic_controller_continue_io(struct scic_sds_request *sci_req) | |||
3060 | { | 3039 | { |
3061 | struct scic_sds_controller *scic = sci_req->owning_controller; | 3040 | struct scic_sds_controller *scic = sci_req->owning_controller; |
3062 | 3041 | ||
3063 | if (scic->state_machine.current_state_id != | 3042 | if (scic->sm.current_state_id != SCIC_READY) { |
3064 | SCI_BASE_CONTROLLER_STATE_READY) { | ||
3065 | dev_warn(scic_to_dev(scic), "invalid state to continue I/O"); | 3043 | dev_warn(scic_to_dev(scic), "invalid state to continue I/O"); |
3066 | return SCI_FAILURE_INVALID_STATE; | 3044 | return SCI_FAILURE_INVALID_STATE; |
3067 | } | 3045 | } |
@@ -3107,8 +3085,7 @@ enum sci_task_status scic_controller_start_task( | |||
3107 | { | 3085 | { |
3108 | enum sci_status status; | 3086 | enum sci_status status; |
3109 | 3087 | ||
3110 | if (scic->state_machine.current_state_id != | 3088 | if (scic->sm.current_state_id != SCIC_READY) { |
3111 | SCI_BASE_CONTROLLER_STATE_READY) { | ||
3112 | dev_warn(scic_to_dev(scic), | 3089 | dev_warn(scic_to_dev(scic), |
3113 | "%s: SCIC Controller starting task from invalid " | 3090 | "%s: SCIC Controller starting task from invalid " |
3114 | "state\n", | 3091 | "state\n", |
diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h index 4ce39e1803ff..be09765ee1d5 100644 --- a/drivers/scsi/isci/host.h +++ b/drivers/scsi/isci/host.h | |||
@@ -134,7 +134,7 @@ struct scic_sds_controller { | |||
134 | * This field contains the information for the base controller state | 134 | * This field contains the information for the base controller state |
135 | * machine. | 135 | * machine. |
136 | */ | 136 | */ |
137 | struct sci_base_state_machine state_machine; | 137 | struct sci_base_state_machine sm; |
138 | 138 | ||
139 | /** | 139 | /** |
140 | * Timer for controller start/stop operations. | 140 | * Timer for controller start/stop operations. |
@@ -359,7 +359,7 @@ enum scic_sds_controller_states { | |||
359 | /** | 359 | /** |
360 | * Simply the initial state for the base controller state machine. | 360 | * Simply the initial state for the base controller state machine. |
361 | */ | 361 | */ |
362 | SCI_BASE_CONTROLLER_STATE_INITIAL = 0, | 362 | SCIC_INITIAL = 0, |
363 | 363 | ||
364 | /** | 364 | /** |
365 | * This state indicates that the controller is reset. The memory for | 365 | * This state indicates that the controller is reset. The memory for |
@@ -368,7 +368,7 @@ enum scic_sds_controller_states { | |||
368 | * This state is entered from the INITIAL state. | 368 | * This state is entered from the INITIAL state. |
369 | * This state is entered from the RESETTING state. | 369 | * This state is entered from the RESETTING state. |
370 | */ | 370 | */ |
371 | SCI_BASE_CONTROLLER_STATE_RESET, | 371 | SCIC_RESET, |
372 | 372 | ||
373 | /** | 373 | /** |
374 | * This state is typically an action state that indicates the controller | 374 | * This state is typically an action state that indicates the controller |
@@ -376,28 +376,28 @@ enum scic_sds_controller_states { | |||
376 | * are permitted. | 376 | * are permitted. |
377 | * This state is entered from the RESET state. | 377 | * This state is entered from the RESET state. |
378 | */ | 378 | */ |
379 | SCI_BASE_CONTROLLER_STATE_INITIALIZING, | 379 | SCIC_INITIALIZING, |
380 | 380 | ||
381 | /** | 381 | /** |
382 | * This state indicates that the controller has been successfully | 382 | * This state indicates that the controller has been successfully |
383 | * initialized. In this state no new IO operations are permitted. | 383 | * initialized. In this state no new IO operations are permitted. |
384 | * This state is entered from the INITIALIZING state. | 384 | * This state is entered from the INITIALIZING state. |
385 | */ | 385 | */ |
386 | SCI_BASE_CONTROLLER_STATE_INITIALIZED, | 386 | SCIC_INITIALIZED, |
387 | 387 | ||
388 | /** | 388 | /** |
389 | * This state indicates the the controller is in the process of becoming | 389 | * This state indicates the the controller is in the process of becoming |
390 | * ready (i.e. starting). In this state no new IO operations are permitted. | 390 | * ready (i.e. starting). In this state no new IO operations are permitted. |
391 | * This state is entered from the INITIALIZED state. | 391 | * This state is entered from the INITIALIZED state. |
392 | */ | 392 | */ |
393 | SCI_BASE_CONTROLLER_STATE_STARTING, | 393 | SCIC_STARTING, |
394 | 394 | ||
395 | /** | 395 | /** |
396 | * This state indicates the controller is now ready. Thus, the user | 396 | * This state indicates the controller is now ready. Thus, the user |
397 | * is able to perform IO operations on the controller. | 397 | * is able to perform IO operations on the controller. |
398 | * This state is entered from the STARTING state. | 398 | * This state is entered from the STARTING state. |
399 | */ | 399 | */ |
400 | SCI_BASE_CONTROLLER_STATE_READY, | 400 | SCIC_READY, |
401 | 401 | ||
402 | /** | 402 | /** |
403 | * This state is typically an action state that indicates the controller | 403 | * This state is typically an action state that indicates the controller |
@@ -408,7 +408,7 @@ enum scic_sds_controller_states { | |||
408 | * This state is entered from the FAILED state. | 408 | * This state is entered from the FAILED state. |
409 | * This state is entered from the STOPPED state. | 409 | * This state is entered from the STOPPED state. |
410 | */ | 410 | */ |
411 | SCI_BASE_CONTROLLER_STATE_RESETTING, | 411 | SCIC_RESETTING, |
412 | 412 | ||
413 | /** | 413 | /** |
414 | * This state indicates that the controller is in the process of stopping. | 414 | * This state indicates that the controller is in the process of stopping. |
@@ -416,14 +416,14 @@ enum scic_sds_controller_states { | |||
416 | * operations are allowed to complete. | 416 | * operations are allowed to complete. |
417 | * This state is entered from the READY state. | 417 | * This state is entered from the READY state. |
418 | */ | 418 | */ |
419 | SCI_BASE_CONTROLLER_STATE_STOPPING, | 419 | SCIC_STOPPING, |
420 | 420 | ||
421 | /** | 421 | /** |
422 | * This state indicates that the controller has successfully been stopped. | 422 | * This state indicates that the controller has successfully been stopped. |
423 | * In this state no new IO operations are permitted. | 423 | * In this state no new IO operations are permitted. |
424 | * This state is entered from the STOPPING state. | 424 | * This state is entered from the STOPPING state. |
425 | */ | 425 | */ |
426 | SCI_BASE_CONTROLLER_STATE_STOPPED, | 426 | SCIC_STOPPED, |
427 | 427 | ||
428 | /** | 428 | /** |
429 | * This state indicates that the controller could not successfully be | 429 | * This state indicates that the controller could not successfully be |
@@ -433,10 +433,7 @@ enum scic_sds_controller_states { | |||
433 | * This state is entered from the STOPPING state. | 433 | * This state is entered from the STOPPING state. |
434 | * This state is entered from the RESETTING state. | 434 | * This state is entered from the RESETTING state. |
435 | */ | 435 | */ |
436 | SCI_BASE_CONTROLLER_STATE_FAILED, | 436 | SCIC_FAILED, |
437 | |||
438 | SCI_BASE_CONTROLLER_MAX_STATES | ||
439 | |||
440 | }; | 437 | }; |
441 | 438 | ||
442 | 439 | ||
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c index fc196e389ffb..9de21c719351 100644 --- a/drivers/scsi/isci/phy.c +++ b/drivers/scsi/isci/phy.c | |||
@@ -249,8 +249,7 @@ scic_sds_phy_link_layer_initialization(struct scic_sds_phy *sci_phy, | |||
249 | writel(0x1F4, &sci_phy->link_layer_registers->link_layer_hang_detection_timeout); | 249 | writel(0x1F4, &sci_phy->link_layer_registers->link_layer_hang_detection_timeout); |
250 | 250 | ||
251 | /* We can exit the initial state to the stopped state */ | 251 | /* We can exit the initial state to the stopped state */ |
252 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 252 | sci_change_state(&sci_phy->sm, SCI_PHY_STOPPED); |
253 | SCI_BASE_PHY_STATE_STOPPED); | ||
254 | 253 | ||
255 | return SCI_SUCCESS; | 254 | return SCI_SUCCESS; |
256 | } | 255 | } |
@@ -273,8 +272,7 @@ static void phy_sata_timeout(unsigned long data) | |||
273 | __func__, | 272 | __func__, |
274 | sci_phy); | 273 | sci_phy); |
275 | 274 | ||
276 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 275 | sci_change_state(&sci_phy->sm, SCI_PHY_STARTING); |
277 | SCI_BASE_PHY_STATE_STARTING); | ||
278 | done: | 276 | done: |
279 | spin_unlock_irqrestore(&ihost->scic_lock, flags); | 277 | spin_unlock_irqrestore(&ihost->scic_lock, flags); |
280 | } | 278 | } |
@@ -342,8 +340,7 @@ enum sci_status scic_sds_phy_initialize( | |||
342 | /* | 340 | /* |
343 | * There is nothing that needs to be done in this state just | 341 | * There is nothing that needs to be done in this state just |
344 | * transition to the stopped state. */ | 342 | * transition to the stopped state. */ |
345 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 343 | sci_change_state(&sci_phy->sm, SCI_PHY_STOPPED); |
346 | SCI_BASE_PHY_STATE_STOPPED); | ||
347 | 344 | ||
348 | return SCI_SUCCESS; | 345 | return SCI_SUCCESS; |
349 | } | 346 | } |
@@ -436,34 +433,33 @@ void scic_sds_phy_get_protocols(struct scic_sds_phy *sci_phy, | |||
436 | 433 | ||
437 | enum sci_status scic_sds_phy_start(struct scic_sds_phy *sci_phy) | 434 | enum sci_status scic_sds_phy_start(struct scic_sds_phy *sci_phy) |
438 | { | 435 | { |
439 | enum scic_sds_phy_states state = sci_phy->state_machine.current_state_id; | 436 | enum scic_sds_phy_states state = sci_phy->sm.current_state_id; |
440 | 437 | ||
441 | if (state != SCI_BASE_PHY_STATE_STOPPED) { | 438 | if (state != SCI_PHY_STOPPED) { |
442 | dev_dbg(sciphy_to_dev(sci_phy), | 439 | dev_dbg(sciphy_to_dev(sci_phy), |
443 | "%s: in wrong state: %d\n", __func__, state); | 440 | "%s: in wrong state: %d\n", __func__, state); |
444 | return SCI_FAILURE_INVALID_STATE; | 441 | return SCI_FAILURE_INVALID_STATE; |
445 | } | 442 | } |
446 | 443 | ||
447 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 444 | sci_change_state(&sci_phy->sm, SCI_PHY_STARTING); |
448 | SCI_BASE_PHY_STATE_STARTING); | ||
449 | return SCI_SUCCESS; | 445 | return SCI_SUCCESS; |
450 | } | 446 | } |
451 | 447 | ||
452 | enum sci_status scic_sds_phy_stop(struct scic_sds_phy *sci_phy) | 448 | enum sci_status scic_sds_phy_stop(struct scic_sds_phy *sci_phy) |
453 | { | 449 | { |
454 | enum scic_sds_phy_states state = sci_phy->state_machine.current_state_id; | 450 | enum scic_sds_phy_states state = sci_phy->sm.current_state_id; |
455 | 451 | ||
456 | switch (state) { | 452 | switch (state) { |
457 | case SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL: | 453 | case SCI_PHY_SUB_INITIAL: |
458 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN: | 454 | case SCI_PHY_SUB_AWAIT_OSSP_EN: |
459 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN: | 455 | case SCI_PHY_SUB_AWAIT_SAS_SPEED_EN: |
460 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER: | 456 | case SCI_PHY_SUB_AWAIT_SAS_POWER: |
461 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER: | 457 | case SCI_PHY_SUB_AWAIT_SATA_POWER: |
462 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN: | 458 | case SCI_PHY_SUB_AWAIT_SATA_PHY_EN: |
463 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN: | 459 | case SCI_PHY_SUB_AWAIT_SATA_SPEED_EN: |
464 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF: | 460 | case SCI_PHY_SUB_AWAIT_SIG_FIS_UF: |
465 | case SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL: | 461 | case SCI_PHY_SUB_FINAL: |
466 | case SCI_BASE_PHY_STATE_READY: | 462 | case SCI_PHY_READY: |
467 | break; | 463 | break; |
468 | default: | 464 | default: |
469 | dev_dbg(sciphy_to_dev(sci_phy), | 465 | dev_dbg(sciphy_to_dev(sci_phy), |
@@ -471,32 +467,30 @@ enum sci_status scic_sds_phy_stop(struct scic_sds_phy *sci_phy) | |||
471 | return SCI_FAILURE_INVALID_STATE; | 467 | return SCI_FAILURE_INVALID_STATE; |
472 | } | 468 | } |
473 | 469 | ||
474 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 470 | sci_change_state(&sci_phy->sm, SCI_PHY_STOPPED); |
475 | SCI_BASE_PHY_STATE_STOPPED); | ||
476 | return SCI_SUCCESS; | 471 | return SCI_SUCCESS; |
477 | } | 472 | } |
478 | 473 | ||
479 | enum sci_status scic_sds_phy_reset(struct scic_sds_phy *sci_phy) | 474 | enum sci_status scic_sds_phy_reset(struct scic_sds_phy *sci_phy) |
480 | { | 475 | { |
481 | enum scic_sds_phy_states state = sci_phy->state_machine.current_state_id; | 476 | enum scic_sds_phy_states state = sci_phy->sm.current_state_id; |
482 | 477 | ||
483 | if (state != SCI_BASE_PHY_STATE_READY) { | 478 | if (state != SCI_PHY_READY) { |
484 | dev_dbg(sciphy_to_dev(sci_phy), | 479 | dev_dbg(sciphy_to_dev(sci_phy), |
485 | "%s: in wrong state: %d\n", __func__, state); | 480 | "%s: in wrong state: %d\n", __func__, state); |
486 | return SCI_FAILURE_INVALID_STATE; | 481 | return SCI_FAILURE_INVALID_STATE; |
487 | } | 482 | } |
488 | 483 | ||
489 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 484 | sci_change_state(&sci_phy->sm, SCI_PHY_RESETTING); |
490 | SCI_BASE_PHY_STATE_RESETTING); | ||
491 | return SCI_SUCCESS; | 485 | return SCI_SUCCESS; |
492 | } | 486 | } |
493 | 487 | ||
494 | enum sci_status scic_sds_phy_consume_power_handler(struct scic_sds_phy *sci_phy) | 488 | enum sci_status scic_sds_phy_consume_power_handler(struct scic_sds_phy *sci_phy) |
495 | { | 489 | { |
496 | enum scic_sds_phy_states state = sci_phy->state_machine.current_state_id; | 490 | enum scic_sds_phy_states state = sci_phy->sm.current_state_id; |
497 | 491 | ||
498 | switch (state) { | 492 | switch (state) { |
499 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER: { | 493 | case SCI_PHY_SUB_AWAIT_SAS_POWER: { |
500 | u32 enable_spinup; | 494 | u32 enable_spinup; |
501 | 495 | ||
502 | enable_spinup = readl(&sci_phy->link_layer_registers->notify_enable_spinup_control); | 496 | enable_spinup = readl(&sci_phy->link_layer_registers->notify_enable_spinup_control); |
@@ -504,12 +498,11 @@ enum sci_status scic_sds_phy_consume_power_handler(struct scic_sds_phy *sci_phy) | |||
504 | writel(enable_spinup, &sci_phy->link_layer_registers->notify_enable_spinup_control); | 498 | writel(enable_spinup, &sci_phy->link_layer_registers->notify_enable_spinup_control); |
505 | 499 | ||
506 | /* Change state to the final state this substate machine has run to completion */ | 500 | /* Change state to the final state this substate machine has run to completion */ |
507 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 501 | sci_change_state(&sci_phy->sm, SCI_PHY_SUB_FINAL); |
508 | SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL); | ||
509 | 502 | ||
510 | return SCI_SUCCESS; | 503 | return SCI_SUCCESS; |
511 | } | 504 | } |
512 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER: { | 505 | case SCI_PHY_SUB_AWAIT_SATA_POWER: { |
513 | u32 scu_sas_pcfg_value; | 506 | u32 scu_sas_pcfg_value; |
514 | 507 | ||
515 | /* Release the spinup hold state and reset the OOB state machine */ | 508 | /* Release the spinup hold state and reset the OOB state machine */ |
@@ -528,8 +521,7 @@ enum sci_status scic_sds_phy_consume_power_handler(struct scic_sds_phy *sci_phy) | |||
528 | &sci_phy->link_layer_registers->phy_configuration); | 521 | &sci_phy->link_layer_registers->phy_configuration); |
529 | 522 | ||
530 | /* Change state to the final state this substate machine has run to completion */ | 523 | /* Change state to the final state this substate machine has run to completion */ |
531 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 524 | sci_change_state(&sci_phy->sm, SCI_PHY_SUB_AWAIT_SATA_PHY_EN); |
532 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN); | ||
533 | 525 | ||
534 | return SCI_SUCCESS; | 526 | return SCI_SUCCESS; |
535 | } | 527 | } |
@@ -566,10 +558,7 @@ static void scic_sds_phy_start_sas_link_training( | |||
566 | writel(phy_control, | 558 | writel(phy_control, |
567 | &sci_phy->link_layer_registers->phy_configuration); | 559 | &sci_phy->link_layer_registers->phy_configuration); |
568 | 560 | ||
569 | sci_base_state_machine_change_state( | 561 | sci_change_state(&sci_phy->sm, SCI_PHY_SUB_AWAIT_SAS_SPEED_EN); |
570 | &sci_phy->state_machine, | ||
571 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN | ||
572 | ); | ||
573 | 562 | ||
574 | sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_SAS; | 563 | sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_SAS; |
575 | } | 564 | } |
@@ -585,10 +574,7 @@ static void scic_sds_phy_start_sas_link_training( | |||
585 | static void scic_sds_phy_start_sata_link_training( | 574 | static void scic_sds_phy_start_sata_link_training( |
586 | struct scic_sds_phy *sci_phy) | 575 | struct scic_sds_phy *sci_phy) |
587 | { | 576 | { |
588 | sci_base_state_machine_change_state( | 577 | sci_change_state(&sci_phy->sm, SCI_PHY_SUB_AWAIT_SATA_POWER); |
589 | &sci_phy->state_machine, | ||
590 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER | ||
591 | ); | ||
592 | 578 | ||
593 | sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_SATA; | 579 | sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_SATA; |
594 | } | 580 | } |
@@ -611,17 +597,16 @@ static void scic_sds_phy_complete_link_training( | |||
611 | { | 597 | { |
612 | sci_phy->max_negotiated_speed = max_link_rate; | 598 | sci_phy->max_negotiated_speed = max_link_rate; |
613 | 599 | ||
614 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 600 | sci_change_state(&sci_phy->sm, next_state); |
615 | next_state); | ||
616 | } | 601 | } |
617 | 602 | ||
618 | enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | 603 | enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, |
619 | u32 event_code) | 604 | u32 event_code) |
620 | { | 605 | { |
621 | enum scic_sds_phy_states state = sci_phy->state_machine.current_state_id; | 606 | enum scic_sds_phy_states state = sci_phy->sm.current_state_id; |
622 | 607 | ||
623 | switch (state) { | 608 | switch (state) { |
624 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN: | 609 | case SCI_PHY_SUB_AWAIT_OSSP_EN: |
625 | switch (scu_get_event_code(event_code)) { | 610 | switch (scu_get_event_code(event_code)) { |
626 | case SCU_EVENT_SAS_PHY_DETECTED: | 611 | case SCU_EVENT_SAS_PHY_DETECTED: |
627 | scic_sds_phy_start_sas_link_training(sci_phy); | 612 | scic_sds_phy_start_sas_link_training(sci_phy); |
@@ -640,7 +625,7 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | |||
640 | return SCI_FAILURE; | 625 | return SCI_FAILURE; |
641 | } | 626 | } |
642 | return SCI_SUCCESS; | 627 | return SCI_SUCCESS; |
643 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN: | 628 | case SCI_PHY_SUB_AWAIT_SAS_SPEED_EN: |
644 | switch (scu_get_event_code(event_code)) { | 629 | switch (scu_get_event_code(event_code)) { |
645 | case SCU_EVENT_SAS_PHY_DETECTED: | 630 | case SCU_EVENT_SAS_PHY_DETECTED: |
646 | /* | 631 | /* |
@@ -652,21 +637,21 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | |||
652 | scic_sds_phy_complete_link_training( | 637 | scic_sds_phy_complete_link_training( |
653 | sci_phy, | 638 | sci_phy, |
654 | SAS_LINK_RATE_1_5_GBPS, | 639 | SAS_LINK_RATE_1_5_GBPS, |
655 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF); | 640 | SCI_PHY_SUB_AWAIT_IAF_UF); |
656 | break; | 641 | break; |
657 | case SCU_EVENT_SAS_30: | 642 | case SCU_EVENT_SAS_30: |
658 | case SCU_EVENT_SAS_30_SSC: | 643 | case SCU_EVENT_SAS_30_SSC: |
659 | scic_sds_phy_complete_link_training( | 644 | scic_sds_phy_complete_link_training( |
660 | sci_phy, | 645 | sci_phy, |
661 | SAS_LINK_RATE_3_0_GBPS, | 646 | SAS_LINK_RATE_3_0_GBPS, |
662 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF); | 647 | SCI_PHY_SUB_AWAIT_IAF_UF); |
663 | break; | 648 | break; |
664 | case SCU_EVENT_SAS_60: | 649 | case SCU_EVENT_SAS_60: |
665 | case SCU_EVENT_SAS_60_SSC: | 650 | case SCU_EVENT_SAS_60_SSC: |
666 | scic_sds_phy_complete_link_training( | 651 | scic_sds_phy_complete_link_training( |
667 | sci_phy, | 652 | sci_phy, |
668 | SAS_LINK_RATE_6_0_GBPS, | 653 | SAS_LINK_RATE_6_0_GBPS, |
669 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF); | 654 | SCI_PHY_SUB_AWAIT_IAF_UF); |
670 | break; | 655 | break; |
671 | case SCU_EVENT_SATA_SPINUP_HOLD: | 656 | case SCU_EVENT_SATA_SPINUP_HOLD: |
672 | /* | 657 | /* |
@@ -676,8 +661,7 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | |||
676 | break; | 661 | break; |
677 | case SCU_EVENT_LINK_FAILURE: | 662 | case SCU_EVENT_LINK_FAILURE: |
678 | /* Link failure change state back to the starting state */ | 663 | /* Link failure change state back to the starting state */ |
679 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 664 | sci_change_state(&sci_phy->sm, SCI_PHY_STARTING); |
680 | SCI_BASE_PHY_STATE_STARTING); | ||
681 | break; | 665 | break; |
682 | default: | 666 | default: |
683 | dev_warn(sciphy_to_dev(sci_phy), | 667 | dev_warn(sciphy_to_dev(sci_phy), |
@@ -689,7 +673,7 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | |||
689 | break; | 673 | break; |
690 | } | 674 | } |
691 | return SCI_SUCCESS; | 675 | return SCI_SUCCESS; |
692 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF: | 676 | case SCI_PHY_SUB_AWAIT_IAF_UF: |
693 | switch (scu_get_event_code(event_code)) { | 677 | switch (scu_get_event_code(event_code)) { |
694 | case SCU_EVENT_SAS_PHY_DETECTED: | 678 | case SCU_EVENT_SAS_PHY_DETECTED: |
695 | /* Backup the state machine */ | 679 | /* Backup the state machine */ |
@@ -706,8 +690,7 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | |||
706 | case SCU_EVENT_LINK_FAILURE: | 690 | case SCU_EVENT_LINK_FAILURE: |
707 | case SCU_EVENT_HARD_RESET_RECEIVED: | 691 | case SCU_EVENT_HARD_RESET_RECEIVED: |
708 | /* Start the oob/sn state machine over again */ | 692 | /* Start the oob/sn state machine over again */ |
709 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 693 | sci_change_state(&sci_phy->sm, SCI_PHY_STARTING); |
710 | SCI_BASE_PHY_STATE_STARTING); | ||
711 | break; | 694 | break; |
712 | default: | 695 | default: |
713 | dev_warn(sciphy_to_dev(sci_phy), | 696 | dev_warn(sciphy_to_dev(sci_phy), |
@@ -717,12 +700,11 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | |||
717 | return SCI_FAILURE; | 700 | return SCI_FAILURE; |
718 | } | 701 | } |
719 | return SCI_SUCCESS; | 702 | return SCI_SUCCESS; |
720 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER: | 703 | case SCI_PHY_SUB_AWAIT_SAS_POWER: |
721 | switch (scu_get_event_code(event_code)) { | 704 | switch (scu_get_event_code(event_code)) { |
722 | case SCU_EVENT_LINK_FAILURE: | 705 | case SCU_EVENT_LINK_FAILURE: |
723 | /* Link failure change state back to the starting state */ | 706 | /* Link failure change state back to the starting state */ |
724 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 707 | sci_change_state(&sci_phy->sm, SCI_PHY_STARTING); |
725 | SCI_BASE_PHY_STATE_STARTING); | ||
726 | break; | 708 | break; |
727 | default: | 709 | default: |
728 | dev_warn(sciphy_to_dev(sci_phy), | 710 | dev_warn(sciphy_to_dev(sci_phy), |
@@ -733,12 +715,11 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | |||
733 | return SCI_FAILURE; | 715 | return SCI_FAILURE; |
734 | } | 716 | } |
735 | return SCI_SUCCESS; | 717 | return SCI_SUCCESS; |
736 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER: | 718 | case SCI_PHY_SUB_AWAIT_SATA_POWER: |
737 | switch (scu_get_event_code(event_code)) { | 719 | switch (scu_get_event_code(event_code)) { |
738 | case SCU_EVENT_LINK_FAILURE: | 720 | case SCU_EVENT_LINK_FAILURE: |
739 | /* Link failure change state back to the starting state */ | 721 | /* Link failure change state back to the starting state */ |
740 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 722 | sci_change_state(&sci_phy->sm, SCI_PHY_STARTING); |
741 | SCI_BASE_PHY_STATE_STARTING); | ||
742 | break; | 723 | break; |
743 | case SCU_EVENT_SATA_SPINUP_HOLD: | 724 | case SCU_EVENT_SATA_SPINUP_HOLD: |
744 | /* These events are received every 10ms and are | 725 | /* These events are received every 10ms and are |
@@ -762,12 +743,11 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | |||
762 | return SCI_FAILURE; | 743 | return SCI_FAILURE; |
763 | } | 744 | } |
764 | return SCI_SUCCESS; | 745 | return SCI_SUCCESS; |
765 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN: | 746 | case SCI_PHY_SUB_AWAIT_SATA_PHY_EN: |
766 | switch (scu_get_event_code(event_code)) { | 747 | switch (scu_get_event_code(event_code)) { |
767 | case SCU_EVENT_LINK_FAILURE: | 748 | case SCU_EVENT_LINK_FAILURE: |
768 | /* Link failure change state back to the starting state */ | 749 | /* Link failure change state back to the starting state */ |
769 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 750 | sci_change_state(&sci_phy->sm, SCI_PHY_STARTING); |
770 | SCI_BASE_PHY_STATE_STARTING); | ||
771 | break; | 751 | break; |
772 | case SCU_EVENT_SATA_SPINUP_HOLD: | 752 | case SCU_EVENT_SATA_SPINUP_HOLD: |
773 | /* These events might be received since we dont know how many may be in | 753 | /* These events might be received since we dont know how many may be in |
@@ -778,8 +758,7 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | |||
778 | sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_SATA; | 758 | sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_SATA; |
779 | 759 | ||
780 | /* We have received the SATA PHY notification change state */ | 760 | /* We have received the SATA PHY notification change state */ |
781 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 761 | sci_change_state(&sci_phy->sm, SCI_PHY_SUB_AWAIT_SATA_SPEED_EN); |
782 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN); | ||
783 | break; | 762 | break; |
784 | case SCU_EVENT_SAS_PHY_DETECTED: | 763 | case SCU_EVENT_SAS_PHY_DETECTED: |
785 | /* There has been a change in the phy type before OOB/SN for the | 764 | /* There has been a change in the phy type before OOB/SN for the |
@@ -797,7 +776,7 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | |||
797 | return SCI_FAILURE;; | 776 | return SCI_FAILURE;; |
798 | } | 777 | } |
799 | return SCI_SUCCESS; | 778 | return SCI_SUCCESS; |
800 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN: | 779 | case SCI_PHY_SUB_AWAIT_SATA_SPEED_EN: |
801 | switch (scu_get_event_code(event_code)) { | 780 | switch (scu_get_event_code(event_code)) { |
802 | case SCU_EVENT_SATA_PHY_DETECTED: | 781 | case SCU_EVENT_SATA_PHY_DETECTED: |
803 | /* | 782 | /* |
@@ -809,26 +788,25 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | |||
809 | scic_sds_phy_complete_link_training( | 788 | scic_sds_phy_complete_link_training( |
810 | sci_phy, | 789 | sci_phy, |
811 | SAS_LINK_RATE_1_5_GBPS, | 790 | SAS_LINK_RATE_1_5_GBPS, |
812 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF); | 791 | SCI_PHY_SUB_AWAIT_SIG_FIS_UF); |
813 | break; | 792 | break; |
814 | case SCU_EVENT_SATA_30: | 793 | case SCU_EVENT_SATA_30: |
815 | case SCU_EVENT_SATA_30_SSC: | 794 | case SCU_EVENT_SATA_30_SSC: |
816 | scic_sds_phy_complete_link_training( | 795 | scic_sds_phy_complete_link_training( |
817 | sci_phy, | 796 | sci_phy, |
818 | SAS_LINK_RATE_3_0_GBPS, | 797 | SAS_LINK_RATE_3_0_GBPS, |
819 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF); | 798 | SCI_PHY_SUB_AWAIT_SIG_FIS_UF); |
820 | break; | 799 | break; |
821 | case SCU_EVENT_SATA_60: | 800 | case SCU_EVENT_SATA_60: |
822 | case SCU_EVENT_SATA_60_SSC: | 801 | case SCU_EVENT_SATA_60_SSC: |
823 | scic_sds_phy_complete_link_training( | 802 | scic_sds_phy_complete_link_training( |
824 | sci_phy, | 803 | sci_phy, |
825 | SAS_LINK_RATE_6_0_GBPS, | 804 | SAS_LINK_RATE_6_0_GBPS, |
826 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF); | 805 | SCI_PHY_SUB_AWAIT_SIG_FIS_UF); |
827 | break; | 806 | break; |
828 | case SCU_EVENT_LINK_FAILURE: | 807 | case SCU_EVENT_LINK_FAILURE: |
829 | /* Link failure change state back to the starting state */ | 808 | /* Link failure change state back to the starting state */ |
830 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 809 | sci_change_state(&sci_phy->sm, SCI_PHY_STARTING); |
831 | SCI_BASE_PHY_STATE_STARTING); | ||
832 | break; | 810 | break; |
833 | case SCU_EVENT_SAS_PHY_DETECTED: | 811 | case SCU_EVENT_SAS_PHY_DETECTED: |
834 | /* | 812 | /* |
@@ -846,18 +824,16 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | |||
846 | } | 824 | } |
847 | 825 | ||
848 | return SCI_SUCCESS; | 826 | return SCI_SUCCESS; |
849 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF: | 827 | case SCI_PHY_SUB_AWAIT_SIG_FIS_UF: |
850 | switch (scu_get_event_code(event_code)) { | 828 | switch (scu_get_event_code(event_code)) { |
851 | case SCU_EVENT_SATA_PHY_DETECTED: | 829 | case SCU_EVENT_SATA_PHY_DETECTED: |
852 | /* Backup the state machine */ | 830 | /* Backup the state machine */ |
853 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 831 | sci_change_state(&sci_phy->sm, SCI_PHY_SUB_AWAIT_SATA_SPEED_EN); |
854 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN); | ||
855 | break; | 832 | break; |
856 | 833 | ||
857 | case SCU_EVENT_LINK_FAILURE: | 834 | case SCU_EVENT_LINK_FAILURE: |
858 | /* Link failure change state back to the starting state */ | 835 | /* Link failure change state back to the starting state */ |
859 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 836 | sci_change_state(&sci_phy->sm, SCI_PHY_STARTING); |
860 | SCI_BASE_PHY_STATE_STARTING); | ||
861 | break; | 837 | break; |
862 | 838 | ||
863 | default: | 839 | default: |
@@ -870,12 +846,11 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | |||
870 | return SCI_FAILURE; | 846 | return SCI_FAILURE; |
871 | } | 847 | } |
872 | return SCI_SUCCESS; | 848 | return SCI_SUCCESS; |
873 | case SCI_BASE_PHY_STATE_READY: | 849 | case SCI_PHY_READY: |
874 | switch (scu_get_event_code(event_code)) { | 850 | switch (scu_get_event_code(event_code)) { |
875 | case SCU_EVENT_LINK_FAILURE: | 851 | case SCU_EVENT_LINK_FAILURE: |
876 | /* Link failure change state back to the starting state */ | 852 | /* Link failure change state back to the starting state */ |
877 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 853 | sci_change_state(&sci_phy->sm, SCI_PHY_STARTING); |
878 | SCI_BASE_PHY_STATE_STARTING); | ||
879 | break; | 854 | break; |
880 | case SCU_EVENT_BROADCAST_CHANGE: | 855 | case SCU_EVENT_BROADCAST_CHANGE: |
881 | /* Broadcast change received. Notify the port. */ | 856 | /* Broadcast change received. Notify the port. */ |
@@ -892,12 +867,11 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | |||
892 | return SCI_FAILURE_INVALID_STATE; | 867 | return SCI_FAILURE_INVALID_STATE; |
893 | } | 868 | } |
894 | return SCI_SUCCESS; | 869 | return SCI_SUCCESS; |
895 | case SCI_BASE_PHY_STATE_RESETTING: | 870 | case SCI_PHY_RESETTING: |
896 | switch (scu_get_event_code(event_code)) { | 871 | switch (scu_get_event_code(event_code)) { |
897 | case SCU_EVENT_HARD_RESET_TRANSMITTED: | 872 | case SCU_EVENT_HARD_RESET_TRANSMITTED: |
898 | /* Link failure change state back to the starting state */ | 873 | /* Link failure change state back to the starting state */ |
899 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 874 | sci_change_state(&sci_phy->sm, SCI_PHY_STARTING); |
900 | SCI_BASE_PHY_STATE_STARTING); | ||
901 | break; | 875 | break; |
902 | default: | 876 | default: |
903 | dev_warn(sciphy_to_dev(sci_phy), | 877 | dev_warn(sciphy_to_dev(sci_phy), |
@@ -919,12 +893,12 @@ enum sci_status scic_sds_phy_event_handler(struct scic_sds_phy *sci_phy, | |||
919 | enum sci_status scic_sds_phy_frame_handler(struct scic_sds_phy *sci_phy, | 893 | enum sci_status scic_sds_phy_frame_handler(struct scic_sds_phy *sci_phy, |
920 | u32 frame_index) | 894 | u32 frame_index) |
921 | { | 895 | { |
922 | enum scic_sds_phy_states state = sci_phy->state_machine.current_state_id; | 896 | enum scic_sds_phy_states state = sci_phy->sm.current_state_id; |
923 | struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller; | 897 | struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller; |
924 | enum sci_status result; | 898 | enum sci_status result; |
925 | 899 | ||
926 | switch (state) { | 900 | switch (state) { |
927 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF: { | 901 | case SCI_PHY_SUB_AWAIT_IAF_UF: { |
928 | u32 *frame_words; | 902 | u32 *frame_words; |
929 | struct sas_identify_frame iaf; | 903 | struct sas_identify_frame iaf; |
930 | struct isci_phy *iphy = sci_phy_to_iphy(sci_phy); | 904 | struct isci_phy *iphy = sci_phy_to_iphy(sci_phy); |
@@ -946,15 +920,14 @@ enum sci_status scic_sds_phy_frame_handler(struct scic_sds_phy *sci_phy, | |||
946 | * state since there are no power requirements for | 920 | * state since there are no power requirements for |
947 | * expander phys. | 921 | * expander phys. |
948 | */ | 922 | */ |
949 | state = SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL; | 923 | state = SCI_PHY_SUB_FINAL; |
950 | } else { | 924 | } else { |
951 | /* We got the IAF we can now go to the await spinup | 925 | /* We got the IAF we can now go to the await spinup |
952 | * semaphore state | 926 | * semaphore state |
953 | */ | 927 | */ |
954 | state = SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER; | 928 | state = SCI_PHY_SUB_AWAIT_SAS_POWER; |
955 | } | 929 | } |
956 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 930 | sci_change_state(&sci_phy->sm, state); |
957 | state); | ||
958 | result = SCI_SUCCESS; | 931 | result = SCI_SUCCESS; |
959 | } else | 932 | } else |
960 | dev_warn(sciphy_to_dev(sci_phy), | 933 | dev_warn(sciphy_to_dev(sci_phy), |
@@ -965,7 +938,7 @@ enum sci_status scic_sds_phy_frame_handler(struct scic_sds_phy *sci_phy, | |||
965 | scic_sds_controller_release_frame(scic, frame_index); | 938 | scic_sds_controller_release_frame(scic, frame_index); |
966 | return result; | 939 | return result; |
967 | } | 940 | } |
968 | case SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF: { | 941 | case SCI_PHY_SUB_AWAIT_SIG_FIS_UF: { |
969 | struct dev_to_host_fis *frame_header; | 942 | struct dev_to_host_fis *frame_header; |
970 | u32 *fis_frame_data; | 943 | u32 *fis_frame_data; |
971 | struct isci_phy *iphy = sci_phy_to_iphy(sci_phy); | 944 | struct isci_phy *iphy = sci_phy_to_iphy(sci_phy); |
@@ -989,8 +962,7 @@ enum sci_status scic_sds_phy_frame_handler(struct scic_sds_phy *sci_phy, | |||
989 | fis_frame_data); | 962 | fis_frame_data); |
990 | 963 | ||
991 | /* got IAF we can now go to the await spinup semaphore state */ | 964 | /* got IAF we can now go to the await spinup semaphore state */ |
992 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 965 | sci_change_state(&sci_phy->sm, SCI_PHY_SUB_FINAL); |
993 | SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL); | ||
994 | 966 | ||
995 | result = SCI_SUCCESS; | 967 | result = SCI_SUCCESS; |
996 | } else | 968 | } else |
@@ -1014,16 +986,15 @@ enum sci_status scic_sds_phy_frame_handler(struct scic_sds_phy *sci_phy, | |||
1014 | 986 | ||
1015 | static void scic_sds_phy_starting_initial_substate_enter(struct sci_base_state_machine *sm) | 987 | static void scic_sds_phy_starting_initial_substate_enter(struct sci_base_state_machine *sm) |
1016 | { | 988 | { |
1017 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 989 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1018 | 990 | ||
1019 | /* This is just an temporary state go off to the starting state */ | 991 | /* This is just an temporary state go off to the starting state */ |
1020 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 992 | sci_change_state(&sci_phy->sm, SCI_PHY_SUB_AWAIT_OSSP_EN); |
1021 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN); | ||
1022 | } | 993 | } |
1023 | 994 | ||
1024 | static void scic_sds_phy_starting_await_sas_power_substate_enter(struct sci_base_state_machine *sm) | 995 | static void scic_sds_phy_starting_await_sas_power_substate_enter(struct sci_base_state_machine *sm) |
1025 | { | 996 | { |
1026 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 997 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1027 | struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller; | 998 | struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller; |
1028 | 999 | ||
1029 | scic_sds_controller_power_control_queue_insert(scic, sci_phy); | 1000 | scic_sds_controller_power_control_queue_insert(scic, sci_phy); |
@@ -1031,7 +1002,7 @@ static void scic_sds_phy_starting_await_sas_power_substate_enter(struct sci_base | |||
1031 | 1002 | ||
1032 | static void scic_sds_phy_starting_await_sas_power_substate_exit(struct sci_base_state_machine *sm) | 1003 | static void scic_sds_phy_starting_await_sas_power_substate_exit(struct sci_base_state_machine *sm) |
1033 | { | 1004 | { |
1034 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 1005 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1035 | struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller; | 1006 | struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller; |
1036 | 1007 | ||
1037 | scic_sds_controller_power_control_queue_remove(scic, sci_phy); | 1008 | scic_sds_controller_power_control_queue_remove(scic, sci_phy); |
@@ -1039,7 +1010,7 @@ static void scic_sds_phy_starting_await_sas_power_substate_exit(struct sci_base_ | |||
1039 | 1010 | ||
1040 | static void scic_sds_phy_starting_await_sata_power_substate_enter(struct sci_base_state_machine *sm) | 1011 | static void scic_sds_phy_starting_await_sata_power_substate_enter(struct sci_base_state_machine *sm) |
1041 | { | 1012 | { |
1042 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 1013 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1043 | struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller; | 1014 | struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller; |
1044 | 1015 | ||
1045 | scic_sds_controller_power_control_queue_insert(scic, sci_phy); | 1016 | scic_sds_controller_power_control_queue_insert(scic, sci_phy); |
@@ -1047,7 +1018,7 @@ static void scic_sds_phy_starting_await_sata_power_substate_enter(struct sci_bas | |||
1047 | 1018 | ||
1048 | static void scic_sds_phy_starting_await_sata_power_substate_exit(struct sci_base_state_machine *sm) | 1019 | static void scic_sds_phy_starting_await_sata_power_substate_exit(struct sci_base_state_machine *sm) |
1049 | { | 1020 | { |
1050 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 1021 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1051 | struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller; | 1022 | struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller; |
1052 | 1023 | ||
1053 | scic_sds_controller_power_control_queue_remove(scic, sci_phy); | 1024 | scic_sds_controller_power_control_queue_remove(scic, sci_phy); |
@@ -1055,35 +1026,35 @@ static void scic_sds_phy_starting_await_sata_power_substate_exit(struct sci_base | |||
1055 | 1026 | ||
1056 | static void scic_sds_phy_starting_await_sata_phy_substate_enter(struct sci_base_state_machine *sm) | 1027 | static void scic_sds_phy_starting_await_sata_phy_substate_enter(struct sci_base_state_machine *sm) |
1057 | { | 1028 | { |
1058 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 1029 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1059 | 1030 | ||
1060 | sci_mod_timer(&sci_phy->sata_timer, SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT); | 1031 | sci_mod_timer(&sci_phy->sata_timer, SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT); |
1061 | } | 1032 | } |
1062 | 1033 | ||
1063 | static void scic_sds_phy_starting_await_sata_phy_substate_exit(struct sci_base_state_machine *sm) | 1034 | static void scic_sds_phy_starting_await_sata_phy_substate_exit(struct sci_base_state_machine *sm) |
1064 | { | 1035 | { |
1065 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 1036 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1066 | 1037 | ||
1067 | sci_del_timer(&sci_phy->sata_timer); | 1038 | sci_del_timer(&sci_phy->sata_timer); |
1068 | } | 1039 | } |
1069 | 1040 | ||
1070 | static void scic_sds_phy_starting_await_sata_speed_substate_enter(struct sci_base_state_machine *sm) | 1041 | static void scic_sds_phy_starting_await_sata_speed_substate_enter(struct sci_base_state_machine *sm) |
1071 | { | 1042 | { |
1072 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 1043 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1073 | 1044 | ||
1074 | sci_mod_timer(&sci_phy->sata_timer, SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT); | 1045 | sci_mod_timer(&sci_phy->sata_timer, SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT); |
1075 | } | 1046 | } |
1076 | 1047 | ||
1077 | static void scic_sds_phy_starting_await_sata_speed_substate_exit(struct sci_base_state_machine *sm) | 1048 | static void scic_sds_phy_starting_await_sata_speed_substate_exit(struct sci_base_state_machine *sm) |
1078 | { | 1049 | { |
1079 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 1050 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1080 | 1051 | ||
1081 | sci_del_timer(&sci_phy->sata_timer); | 1052 | sci_del_timer(&sci_phy->sata_timer); |
1082 | } | 1053 | } |
1083 | 1054 | ||
1084 | static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(struct sci_base_state_machine *sm) | 1055 | static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(struct sci_base_state_machine *sm) |
1085 | { | 1056 | { |
1086 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 1057 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1087 | 1058 | ||
1088 | if (scic_sds_port_link_detected(sci_phy->owning_port, sci_phy)) { | 1059 | if (scic_sds_port_link_detected(sci_phy->owning_port, sci_phy)) { |
1089 | 1060 | ||
@@ -1103,20 +1074,19 @@ static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(struct sci_bas | |||
1103 | 1074 | ||
1104 | static void scic_sds_phy_starting_await_sig_fis_uf_substate_exit(struct sci_base_state_machine *sm) | 1075 | static void scic_sds_phy_starting_await_sig_fis_uf_substate_exit(struct sci_base_state_machine *sm) |
1105 | { | 1076 | { |
1106 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 1077 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1107 | 1078 | ||
1108 | sci_del_timer(&sci_phy->sata_timer); | 1079 | sci_del_timer(&sci_phy->sata_timer); |
1109 | } | 1080 | } |
1110 | 1081 | ||
1111 | static void scic_sds_phy_starting_final_substate_enter(struct sci_base_state_machine *sm) | 1082 | static void scic_sds_phy_starting_final_substate_enter(struct sci_base_state_machine *sm) |
1112 | { | 1083 | { |
1113 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 1084 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1114 | 1085 | ||
1115 | /* State machine has run to completion so exit out and change | 1086 | /* State machine has run to completion so exit out and change |
1116 | * the base state machine to the ready state | 1087 | * the base state machine to the ready state |
1117 | */ | 1088 | */ |
1118 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 1089 | sci_change_state(&sci_phy->sm, SCI_PHY_READY); |
1119 | SCI_BASE_PHY_STATE_READY); | ||
1120 | } | 1090 | } |
1121 | 1091 | ||
1122 | /** | 1092 | /** |
@@ -1202,7 +1172,7 @@ static void scu_link_layer_tx_hard_reset( | |||
1202 | 1172 | ||
1203 | static void scic_sds_phy_stopped_state_enter(struct sci_base_state_machine *sm) | 1173 | static void scic_sds_phy_stopped_state_enter(struct sci_base_state_machine *sm) |
1204 | { | 1174 | { |
1205 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 1175 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1206 | 1176 | ||
1207 | /* | 1177 | /* |
1208 | * @todo We need to get to the controller to place this PE in a | 1178 | * @todo We need to get to the controller to place this PE in a |
@@ -1212,7 +1182,7 @@ static void scic_sds_phy_stopped_state_enter(struct sci_base_state_machine *sm) | |||
1212 | 1182 | ||
1213 | scu_link_layer_stop_protocol_engine(sci_phy); | 1183 | scu_link_layer_stop_protocol_engine(sci_phy); |
1214 | 1184 | ||
1215 | if (sci_phy->state_machine.previous_state_id != SCI_BASE_PHY_STATE_INITIAL) | 1185 | if (sci_phy->sm.previous_state_id != SCI_PHY_INITIAL) |
1216 | scic_sds_controller_link_down(scic_sds_phy_get_controller(sci_phy), | 1186 | scic_sds_controller_link_down(scic_sds_phy_get_controller(sci_phy), |
1217 | phy_get_non_dummy_port(sci_phy), | 1187 | phy_get_non_dummy_port(sci_phy), |
1218 | sci_phy); | 1188 | sci_phy); |
@@ -1220,7 +1190,7 @@ static void scic_sds_phy_stopped_state_enter(struct sci_base_state_machine *sm) | |||
1220 | 1190 | ||
1221 | static void scic_sds_phy_starting_state_enter(struct sci_base_state_machine *sm) | 1191 | static void scic_sds_phy_starting_state_enter(struct sci_base_state_machine *sm) |
1222 | { | 1192 | { |
1223 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 1193 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1224 | 1194 | ||
1225 | scu_link_layer_stop_protocol_engine(sci_phy); | 1195 | scu_link_layer_stop_protocol_engine(sci_phy); |
1226 | scu_link_layer_start_oob(sci_phy); | 1196 | scu_link_layer_start_oob(sci_phy); |
@@ -1229,18 +1199,17 @@ static void scic_sds_phy_starting_state_enter(struct sci_base_state_machine *sm) | |||
1229 | sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_UNKNOWN; | 1199 | sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_UNKNOWN; |
1230 | sci_phy->bcn_received_while_port_unassigned = false; | 1200 | sci_phy->bcn_received_while_port_unassigned = false; |
1231 | 1201 | ||
1232 | if (sci_phy->state_machine.previous_state_id == SCI_BASE_PHY_STATE_READY) | 1202 | if (sci_phy->sm.previous_state_id == SCI_PHY_READY) |
1233 | scic_sds_controller_link_down(scic_sds_phy_get_controller(sci_phy), | 1203 | scic_sds_controller_link_down(scic_sds_phy_get_controller(sci_phy), |
1234 | phy_get_non_dummy_port(sci_phy), | 1204 | phy_get_non_dummy_port(sci_phy), |
1235 | sci_phy); | 1205 | sci_phy); |
1236 | 1206 | ||
1237 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 1207 | sci_change_state(&sci_phy->sm, SCI_PHY_SUB_INITIAL); |
1238 | SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL); | ||
1239 | } | 1208 | } |
1240 | 1209 | ||
1241 | static void scic_sds_phy_ready_state_enter(struct sci_base_state_machine *sm) | 1210 | static void scic_sds_phy_ready_state_enter(struct sci_base_state_machine *sm) |
1242 | { | 1211 | { |
1243 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 1212 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1244 | 1213 | ||
1245 | scic_sds_controller_link_up(scic_sds_phy_get_controller(sci_phy), | 1214 | scic_sds_controller_link_up(scic_sds_phy_get_controller(sci_phy), |
1246 | phy_get_non_dummy_port(sci_phy), | 1215 | phy_get_non_dummy_port(sci_phy), |
@@ -1250,14 +1219,14 @@ static void scic_sds_phy_ready_state_enter(struct sci_base_state_machine *sm) | |||
1250 | 1219 | ||
1251 | static void scic_sds_phy_ready_state_exit(struct sci_base_state_machine *sm) | 1220 | static void scic_sds_phy_ready_state_exit(struct sci_base_state_machine *sm) |
1252 | { | 1221 | { |
1253 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 1222 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1254 | 1223 | ||
1255 | scic_sds_phy_suspend(sci_phy); | 1224 | scic_sds_phy_suspend(sci_phy); |
1256 | } | 1225 | } |
1257 | 1226 | ||
1258 | static void scic_sds_phy_resetting_state_enter(struct sci_base_state_machine *sm) | 1227 | static void scic_sds_phy_resetting_state_enter(struct sci_base_state_machine *sm) |
1259 | { | 1228 | { |
1260 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); | 1229 | struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), sm); |
1261 | 1230 | ||
1262 | /* The phy is being reset, therefore deactivate it from the port. In | 1231 | /* The phy is being reset, therefore deactivate it from the port. In |
1263 | * the resetting state we don't notify the user regarding link up and | 1232 | * the resetting state we don't notify the user regarding link up and |
@@ -1271,66 +1240,65 @@ static void scic_sds_phy_resetting_state_enter(struct sci_base_state_machine *sm | |||
1271 | /* The SCU does not need to have a discrete reset state so | 1240 | /* The SCU does not need to have a discrete reset state so |
1272 | * just go back to the starting state. | 1241 | * just go back to the starting state. |
1273 | */ | 1242 | */ |
1274 | sci_base_state_machine_change_state(&sci_phy->state_machine, | 1243 | sci_change_state(&sci_phy->sm, SCI_PHY_STARTING); |
1275 | SCI_BASE_PHY_STATE_STARTING); | ||
1276 | } | 1244 | } |
1277 | } | 1245 | } |
1278 | 1246 | ||
1279 | static const struct sci_base_state scic_sds_phy_state_table[] = { | 1247 | static const struct sci_base_state scic_sds_phy_state_table[] = { |
1280 | [SCI_BASE_PHY_STATE_INITIAL] = { }, | 1248 | [SCI_PHY_INITIAL] = { }, |
1281 | [SCI_BASE_PHY_STATE_STOPPED] = { | 1249 | [SCI_PHY_STOPPED] = { |
1282 | .enter_state = scic_sds_phy_stopped_state_enter, | 1250 | .enter_state = scic_sds_phy_stopped_state_enter, |
1283 | }, | 1251 | }, |
1284 | [SCI_BASE_PHY_STATE_STARTING] = { | 1252 | [SCI_PHY_STARTING] = { |
1285 | .enter_state = scic_sds_phy_starting_state_enter, | 1253 | .enter_state = scic_sds_phy_starting_state_enter, |
1286 | }, | 1254 | }, |
1287 | [SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL] = { | 1255 | [SCI_PHY_SUB_INITIAL] = { |
1288 | .enter_state = scic_sds_phy_starting_initial_substate_enter, | 1256 | .enter_state = scic_sds_phy_starting_initial_substate_enter, |
1289 | }, | 1257 | }, |
1290 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN] = { }, | 1258 | [SCI_PHY_SUB_AWAIT_OSSP_EN] = { }, |
1291 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN] = { }, | 1259 | [SCI_PHY_SUB_AWAIT_SAS_SPEED_EN] = { }, |
1292 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF] = { }, | 1260 | [SCI_PHY_SUB_AWAIT_IAF_UF] = { }, |
1293 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER] = { | 1261 | [SCI_PHY_SUB_AWAIT_SAS_POWER] = { |
1294 | .enter_state = scic_sds_phy_starting_await_sas_power_substate_enter, | 1262 | .enter_state = scic_sds_phy_starting_await_sas_power_substate_enter, |
1295 | .exit_state = scic_sds_phy_starting_await_sas_power_substate_exit, | 1263 | .exit_state = scic_sds_phy_starting_await_sas_power_substate_exit, |
1296 | }, | 1264 | }, |
1297 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER] = { | 1265 | [SCI_PHY_SUB_AWAIT_SATA_POWER] = { |
1298 | .enter_state = scic_sds_phy_starting_await_sata_power_substate_enter, | 1266 | .enter_state = scic_sds_phy_starting_await_sata_power_substate_enter, |
1299 | .exit_state = scic_sds_phy_starting_await_sata_power_substate_exit | 1267 | .exit_state = scic_sds_phy_starting_await_sata_power_substate_exit |
1300 | }, | 1268 | }, |
1301 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN] = { | 1269 | [SCI_PHY_SUB_AWAIT_SATA_PHY_EN] = { |
1302 | .enter_state = scic_sds_phy_starting_await_sata_phy_substate_enter, | 1270 | .enter_state = scic_sds_phy_starting_await_sata_phy_substate_enter, |
1303 | .exit_state = scic_sds_phy_starting_await_sata_phy_substate_exit | 1271 | .exit_state = scic_sds_phy_starting_await_sata_phy_substate_exit |
1304 | }, | 1272 | }, |
1305 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN] = { | 1273 | [SCI_PHY_SUB_AWAIT_SATA_SPEED_EN] = { |
1306 | .enter_state = scic_sds_phy_starting_await_sata_speed_substate_enter, | 1274 | .enter_state = scic_sds_phy_starting_await_sata_speed_substate_enter, |
1307 | .exit_state = scic_sds_phy_starting_await_sata_speed_substate_exit | 1275 | .exit_state = scic_sds_phy_starting_await_sata_speed_substate_exit |
1308 | }, | 1276 | }, |
1309 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF] = { | 1277 | [SCI_PHY_SUB_AWAIT_SIG_FIS_UF] = { |
1310 | .enter_state = scic_sds_phy_starting_await_sig_fis_uf_substate_enter, | 1278 | .enter_state = scic_sds_phy_starting_await_sig_fis_uf_substate_enter, |
1311 | .exit_state = scic_sds_phy_starting_await_sig_fis_uf_substate_exit | 1279 | .exit_state = scic_sds_phy_starting_await_sig_fis_uf_substate_exit |
1312 | }, | 1280 | }, |
1313 | [SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL] = { | 1281 | [SCI_PHY_SUB_FINAL] = { |
1314 | .enter_state = scic_sds_phy_starting_final_substate_enter, | 1282 | .enter_state = scic_sds_phy_starting_final_substate_enter, |
1315 | }, | 1283 | }, |
1316 | [SCI_BASE_PHY_STATE_READY] = { | 1284 | [SCI_PHY_READY] = { |
1317 | .enter_state = scic_sds_phy_ready_state_enter, | 1285 | .enter_state = scic_sds_phy_ready_state_enter, |
1318 | .exit_state = scic_sds_phy_ready_state_exit, | 1286 | .exit_state = scic_sds_phy_ready_state_exit, |
1319 | }, | 1287 | }, |
1320 | [SCI_BASE_PHY_STATE_RESETTING] = { | 1288 | [SCI_PHY_RESETTING] = { |
1321 | .enter_state = scic_sds_phy_resetting_state_enter, | 1289 | .enter_state = scic_sds_phy_resetting_state_enter, |
1322 | }, | 1290 | }, |
1323 | [SCI_BASE_PHY_STATE_FINAL] = { }, | 1291 | [SCI_PHY_FINAL] = { }, |
1324 | }; | 1292 | }; |
1325 | 1293 | ||
1326 | void scic_sds_phy_construct(struct scic_sds_phy *sci_phy, | 1294 | void scic_sds_phy_construct(struct scic_sds_phy *sci_phy, |
1327 | struct scic_sds_port *owning_port, u8 phy_index) | 1295 | struct scic_sds_port *owning_port, u8 phy_index) |
1328 | { | 1296 | { |
1329 | sci_base_state_machine_construct(&sci_phy->state_machine, | 1297 | sci_base_state_machine_construct(&sci_phy->sm, |
1330 | scic_sds_phy_state_table, | 1298 | scic_sds_phy_state_table, |
1331 | SCI_BASE_PHY_STATE_INITIAL); | 1299 | SCI_PHY_INITIAL); |
1332 | 1300 | ||
1333 | sci_base_state_machine_start(&sci_phy->state_machine); | 1301 | sci_base_state_machine_start(&sci_phy->sm); |
1334 | 1302 | ||
1335 | /* Copy the rest of the input data to our locals */ | 1303 | /* Copy the rest of the input data to our locals */ |
1336 | sci_phy->owning_port = owning_port; | 1304 | sci_phy->owning_port = owning_port; |
diff --git a/drivers/scsi/isci/phy.h b/drivers/scsi/isci/phy.h index da3f0f1d56d4..9d21d2754dbb 100644 --- a/drivers/scsi/isci/phy.h +++ b/drivers/scsi/isci/phy.h | |||
@@ -94,7 +94,7 @@ struct scic_sds_phy { | |||
94 | /** | 94 | /** |
95 | * This field contains the information for the base phy state machine. | 95 | * This field contains the information for the base phy state machine. |
96 | */ | 96 | */ |
97 | struct sci_base_state_machine state_machine; | 97 | struct sci_base_state_machine sm; |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * This field specifies the port object that owns/contains this phy. | 100 | * This field specifies the port object that owns/contains this phy. |
@@ -410,7 +410,7 @@ enum scic_sds_phy_states { | |||
410 | /** | 410 | /** |
411 | * Simply the initial state for the base domain state machine. | 411 | * Simply the initial state for the base domain state machine. |
412 | */ | 412 | */ |
413 | SCI_BASE_PHY_STATE_INITIAL, | 413 | SCI_PHY_INITIAL, |
414 | 414 | ||
415 | /** | 415 | /** |
416 | * This state indicates that the phy has successfully been stopped. | 416 | * This state indicates that the phy has successfully been stopped. |
@@ -420,7 +420,7 @@ enum scic_sds_phy_states { | |||
420 | * This state is entered from the READY state. | 420 | * This state is entered from the READY state. |
421 | * This state is entered from the RESETTING state. | 421 | * This state is entered from the RESETTING state. |
422 | */ | 422 | */ |
423 | SCI_BASE_PHY_STATE_STOPPED, | 423 | SCI_PHY_STOPPED, |
424 | 424 | ||
425 | /** | 425 | /** |
426 | * This state indicates that the phy is in the process of becomming | 426 | * This state indicates that the phy is in the process of becomming |
@@ -429,57 +429,57 @@ enum scic_sds_phy_states { | |||
429 | * This state is entered from the READY state. | 429 | * This state is entered from the READY state. |
430 | * This state is entered from the RESETTING state. | 430 | * This state is entered from the RESETTING state. |
431 | */ | 431 | */ |
432 | SCI_BASE_PHY_STATE_STARTING, | 432 | SCI_PHY_STARTING, |
433 | 433 | ||
434 | /** | 434 | /** |
435 | * Initial state | 435 | * Initial state |
436 | */ | 436 | */ |
437 | SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL, | 437 | SCI_PHY_SUB_INITIAL, |
438 | 438 | ||
439 | /** | 439 | /** |
440 | * Wait state for the hardware OSSP event type notification | 440 | * Wait state for the hardware OSSP event type notification |
441 | */ | 441 | */ |
442 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN, | 442 | SCI_PHY_SUB_AWAIT_OSSP_EN, |
443 | 443 | ||
444 | /** | 444 | /** |
445 | * Wait state for the PHY speed notification | 445 | * Wait state for the PHY speed notification |
446 | */ | 446 | */ |
447 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN, | 447 | SCI_PHY_SUB_AWAIT_SAS_SPEED_EN, |
448 | 448 | ||
449 | /** | 449 | /** |
450 | * Wait state for the IAF Unsolicited frame notification | 450 | * Wait state for the IAF Unsolicited frame notification |
451 | */ | 451 | */ |
452 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF, | 452 | SCI_PHY_SUB_AWAIT_IAF_UF, |
453 | 453 | ||
454 | /** | 454 | /** |
455 | * Wait state for the request to consume power | 455 | * Wait state for the request to consume power |
456 | */ | 456 | */ |
457 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER, | 457 | SCI_PHY_SUB_AWAIT_SAS_POWER, |
458 | 458 | ||
459 | /** | 459 | /** |
460 | * Wait state for request to consume power | 460 | * Wait state for request to consume power |
461 | */ | 461 | */ |
462 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER, | 462 | SCI_PHY_SUB_AWAIT_SATA_POWER, |
463 | 463 | ||
464 | /** | 464 | /** |
465 | * Wait state for the SATA PHY notification | 465 | * Wait state for the SATA PHY notification |
466 | */ | 466 | */ |
467 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN, | 467 | SCI_PHY_SUB_AWAIT_SATA_PHY_EN, |
468 | 468 | ||
469 | /** | 469 | /** |
470 | * Wait for the SATA PHY speed notification | 470 | * Wait for the SATA PHY speed notification |
471 | */ | 471 | */ |
472 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN, | 472 | SCI_PHY_SUB_AWAIT_SATA_SPEED_EN, |
473 | 473 | ||
474 | /** | 474 | /** |
475 | * Wait state for the SIGNATURE FIS unsolicited frame notification | 475 | * Wait state for the SIGNATURE FIS unsolicited frame notification |
476 | */ | 476 | */ |
477 | SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF, | 477 | SCI_PHY_SUB_AWAIT_SIG_FIS_UF, |
478 | 478 | ||
479 | /** | 479 | /** |
480 | * Exit state for this state machine | 480 | * Exit state for this state machine |
481 | */ | 481 | */ |
482 | SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL, | 482 | SCI_PHY_SUB_FINAL, |
483 | 483 | ||
484 | /** | 484 | /** |
485 | * This state indicates the the phy is now ready. Thus, the user | 485 | * This state indicates the the phy is now ready. Thus, the user |
@@ -487,19 +487,19 @@ enum scic_sds_phy_states { | |||
487 | * is currently part of a valid port. | 487 | * is currently part of a valid port. |
488 | * This state is entered from the STARTING state. | 488 | * This state is entered from the STARTING state. |
489 | */ | 489 | */ |
490 | SCI_BASE_PHY_STATE_READY, | 490 | SCI_PHY_READY, |
491 | 491 | ||
492 | /** | 492 | /** |
493 | * This state indicates that the phy is in the process of being reset. | 493 | * This state indicates that the phy is in the process of being reset. |
494 | * In this state no new IO operations are permitted on this phy. | 494 | * In this state no new IO operations are permitted on this phy. |
495 | * This state is entered from the READY state. | 495 | * This state is entered from the READY state. |
496 | */ | 496 | */ |
497 | SCI_BASE_PHY_STATE_RESETTING, | 497 | SCI_PHY_RESETTING, |
498 | 498 | ||
499 | /** | 499 | /** |
500 | * Simply the final state for the base phy state machine. | 500 | * Simply the final state for the base phy state machine. |
501 | */ | 501 | */ |
502 | SCI_BASE_PHY_STATE_FINAL, | 502 | SCI_PHY_FINAL, |
503 | }; | 503 | }; |
504 | 504 | ||
505 | /** | 505 | /** |
diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c index 8d88ca21a51c..6370b93bd6ae 100644 --- a/drivers/scsi/isci/port.c +++ b/drivers/scsi/isci/port.c | |||
@@ -807,10 +807,10 @@ static void scic_sds_port_invalid_link_up(struct scic_sds_port *sci_port, | |||
807 | static bool is_port_ready_state(enum scic_sds_port_states state) | 807 | static bool is_port_ready_state(enum scic_sds_port_states state) |
808 | { | 808 | { |
809 | switch (state) { | 809 | switch (state) { |
810 | case SCI_BASE_PORT_STATE_READY: | 810 | case SCI_PORT_READY: |
811 | case SCIC_SDS_PORT_READY_SUBSTATE_WAITING: | 811 | case SCI_PORT_SUB_WAITING: |
812 | case SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL: | 812 | case SCI_PORT_SUB_OPERATIONAL: |
813 | case SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING: | 813 | case SCI_PORT_SUB_CONFIGURING: |
814 | return true; | 814 | return true; |
815 | default: | 815 | default: |
816 | return false; | 816 | return false; |
@@ -821,13 +821,13 @@ static bool is_port_ready_state(enum scic_sds_port_states state) | |||
821 | static void port_state_machine_change(struct scic_sds_port *sci_port, | 821 | static void port_state_machine_change(struct scic_sds_port *sci_port, |
822 | enum scic_sds_port_states state) | 822 | enum scic_sds_port_states state) |
823 | { | 823 | { |
824 | struct sci_base_state_machine *sm = &sci_port->state_machine; | 824 | struct sci_base_state_machine *sm = &sci_port->sm; |
825 | enum scic_sds_port_states old_state = sm->current_state_id; | 825 | enum scic_sds_port_states old_state = sm->current_state_id; |
826 | 826 | ||
827 | if (is_port_ready_state(old_state) && !is_port_ready_state(state)) | 827 | if (is_port_ready_state(old_state) && !is_port_ready_state(state)) |
828 | sci_port->ready_exit = true; | 828 | sci_port->ready_exit = true; |
829 | 829 | ||
830 | sci_base_state_machine_change_state(sm, state); | 830 | sci_change_state(sm, state); |
831 | sci_port->ready_exit = false; | 831 | sci_port->ready_exit = false; |
832 | } | 832 | } |
833 | 833 | ||
@@ -862,11 +862,11 @@ static void scic_sds_port_general_link_up_handler(struct scic_sds_port *sci_port | |||
862 | if ((phy_sas_address.high == port_sas_address.high && | 862 | if ((phy_sas_address.high == port_sas_address.high && |
863 | phy_sas_address.low == port_sas_address.low) || | 863 | phy_sas_address.low == port_sas_address.low) || |
864 | sci_port->active_phy_mask == 0) { | 864 | sci_port->active_phy_mask == 0) { |
865 | struct sci_base_state_machine *sm = &sci_port->state_machine; | 865 | struct sci_base_state_machine *sm = &sci_port->sm; |
866 | 866 | ||
867 | scic_sds_port_activate_phy(sci_port, sci_phy, do_notify_user); | 867 | scic_sds_port_activate_phy(sci_port, sci_phy, do_notify_user); |
868 | if (sm->current_state_id == SCI_BASE_PORT_STATE_RESETTING) | 868 | if (sm->current_state_id == SCI_PORT_RESETTING) |
869 | port_state_machine_change(sci_port, SCI_BASE_PORT_STATE_READY); | 869 | port_state_machine_change(sci_port, SCI_PORT_READY); |
870 | } else | 870 | } else |
871 | scic_sds_port_invalid_link_up(sci_port, sci_phy); | 871 | scic_sds_port_invalid_link_up(sci_port, sci_phy); |
872 | } | 872 | } |
@@ -938,14 +938,14 @@ static void port_timeout(unsigned long data) | |||
938 | if (tmr->cancel) | 938 | if (tmr->cancel) |
939 | goto done; | 939 | goto done; |
940 | 940 | ||
941 | current_state = sci_base_state_machine_get_state(&sci_port->state_machine); | 941 | current_state = sci_port->sm.current_state_id; |
942 | 942 | ||
943 | if (current_state == SCI_BASE_PORT_STATE_RESETTING) { | 943 | if (current_state == SCI_PORT_RESETTING) { |
944 | /* if the port is still in the resetting state then the timeout | 944 | /* if the port is still in the resetting state then the timeout |
945 | * fired before the reset completed. | 945 | * fired before the reset completed. |
946 | */ | 946 | */ |
947 | port_state_machine_change(sci_port, SCI_BASE_PORT_STATE_FAILED); | 947 | port_state_machine_change(sci_port, SCI_PORT_FAILED); |
948 | } else if (current_state == SCI_BASE_PORT_STATE_STOPPED) { | 948 | } else if (current_state == SCI_PORT_STOPPED) { |
949 | /* if the port is stopped then the start request failed In this | 949 | /* if the port is stopped then the start request failed In this |
950 | * case stay in the stopped state. | 950 | * case stay in the stopped state. |
951 | */ | 951 | */ |
@@ -953,7 +953,7 @@ static void port_timeout(unsigned long data) | |||
953 | "%s: SCIC Port 0x%p failed to stop before tiemout.\n", | 953 | "%s: SCIC Port 0x%p failed to stop before tiemout.\n", |
954 | __func__, | 954 | __func__, |
955 | sci_port); | 955 | sci_port); |
956 | } else if (current_state == SCI_BASE_PORT_STATE_STOPPING) { | 956 | } else if (current_state == SCI_PORT_STOPPING) { |
957 | /* if the port is still stopping then the stop has not completed */ | 957 | /* if the port is still stopping then the stop has not completed */ |
958 | isci_port_stop_complete(sci_port->owning_controller, | 958 | isci_port_stop_complete(sci_port->owning_controller, |
959 | sci_port, | 959 | sci_port, |
@@ -1139,7 +1139,7 @@ scic_sds_port_resume_port_task_scheduler(struct scic_sds_port *port) | |||
1139 | 1139 | ||
1140 | static void scic_sds_port_ready_substate_waiting_enter(struct sci_base_state_machine *sm) | 1140 | static void scic_sds_port_ready_substate_waiting_enter(struct sci_base_state_machine *sm) |
1141 | { | 1141 | { |
1142 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine); | 1142 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); |
1143 | 1143 | ||
1144 | scic_sds_port_suspend_port_task_scheduler(sci_port); | 1144 | scic_sds_port_suspend_port_task_scheduler(sci_port); |
1145 | 1145 | ||
@@ -1148,14 +1148,14 @@ static void scic_sds_port_ready_substate_waiting_enter(struct sci_base_state_mac | |||
1148 | if (sci_port->active_phy_mask != 0) { | 1148 | if (sci_port->active_phy_mask != 0) { |
1149 | /* At least one of the phys on the port is ready */ | 1149 | /* At least one of the phys on the port is ready */ |
1150 | port_state_machine_change(sci_port, | 1150 | port_state_machine_change(sci_port, |
1151 | SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL); | 1151 | SCI_PORT_SUB_OPERATIONAL); |
1152 | } | 1152 | } |
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | static void scic_sds_port_ready_substate_operational_enter(struct sci_base_state_machine *sm) | 1155 | static void scic_sds_port_ready_substate_operational_enter(struct sci_base_state_machine *sm) |
1156 | { | 1156 | { |
1157 | u32 index; | 1157 | u32 index; |
1158 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine); | 1158 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); |
1159 | struct scic_sds_controller *scic = sci_port->owning_controller; | 1159 | struct scic_sds_controller *scic = sci_port->owning_controller; |
1160 | struct isci_host *ihost = scic_to_ihost(scic); | 1160 | struct isci_host *ihost = scic_to_ihost(scic); |
1161 | struct isci_port *iport = sci_port_to_iport(sci_port); | 1161 | struct isci_port *iport = sci_port_to_iport(sci_port); |
@@ -1211,12 +1211,12 @@ static void scic_sds_port_invalidate_dummy_remote_node(struct scic_sds_port *sci | |||
1211 | * @object: This is the object which is cast to a struct scic_sds_port object. | 1211 | * @object: This is the object which is cast to a struct scic_sds_port object. |
1212 | * | 1212 | * |
1213 | * This method will perform the actions required by the struct scic_sds_port on | 1213 | * This method will perform the actions required by the struct scic_sds_port on |
1214 | * exiting the SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL. This function reports | 1214 | * exiting the SCI_PORT_SUB_OPERATIONAL. This function reports |
1215 | * the port not ready and suspends the port task scheduler. none | 1215 | * the port not ready and suspends the port task scheduler. none |
1216 | */ | 1216 | */ |
1217 | static void scic_sds_port_ready_substate_operational_exit(struct sci_base_state_machine *sm) | 1217 | static void scic_sds_port_ready_substate_operational_exit(struct sci_base_state_machine *sm) |
1218 | { | 1218 | { |
1219 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine); | 1219 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); |
1220 | struct scic_sds_controller *scic = sci_port->owning_controller; | 1220 | struct scic_sds_controller *scic = sci_port->owning_controller; |
1221 | struct isci_host *ihost = scic_to_ihost(scic); | 1221 | struct isci_host *ihost = scic_to_ihost(scic); |
1222 | struct isci_port *iport = sci_port_to_iport(sci_port); | 1222 | struct isci_port *iport = sci_port_to_iport(sci_port); |
@@ -1236,7 +1236,7 @@ static void scic_sds_port_ready_substate_operational_exit(struct sci_base_state_ | |||
1236 | 1236 | ||
1237 | static void scic_sds_port_ready_substate_configuring_enter(struct sci_base_state_machine *sm) | 1237 | static void scic_sds_port_ready_substate_configuring_enter(struct sci_base_state_machine *sm) |
1238 | { | 1238 | { |
1239 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine); | 1239 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); |
1240 | struct scic_sds_controller *scic = sci_port->owning_controller; | 1240 | struct scic_sds_controller *scic = sci_port->owning_controller; |
1241 | struct isci_host *ihost = scic_to_ihost(scic); | 1241 | struct isci_host *ihost = scic_to_ihost(scic); |
1242 | struct isci_port *iport = sci_port_to_iport(sci_port); | 1242 | struct isci_port *iport = sci_port_to_iport(sci_port); |
@@ -1245,15 +1245,15 @@ static void scic_sds_port_ready_substate_configuring_enter(struct sci_base_state | |||
1245 | isci_port_not_ready(ihost, iport); | 1245 | isci_port_not_ready(ihost, iport); |
1246 | 1246 | ||
1247 | port_state_machine_change(sci_port, | 1247 | port_state_machine_change(sci_port, |
1248 | SCIC_SDS_PORT_READY_SUBSTATE_WAITING); | 1248 | SCI_PORT_SUB_WAITING); |
1249 | } else if (sci_port->started_request_count == 0) | 1249 | } else if (sci_port->started_request_count == 0) |
1250 | port_state_machine_change(sci_port, | 1250 | port_state_machine_change(sci_port, |
1251 | SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL); | 1251 | SCI_PORT_SUB_OPERATIONAL); |
1252 | } | 1252 | } |
1253 | 1253 | ||
1254 | static void scic_sds_port_ready_substate_configuring_exit(struct sci_base_state_machine *sm) | 1254 | static void scic_sds_port_ready_substate_configuring_exit(struct sci_base_state_machine *sm) |
1255 | { | 1255 | { |
1256 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine); | 1256 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); |
1257 | 1257 | ||
1258 | scic_sds_port_suspend_port_task_scheduler(sci_port); | 1258 | scic_sds_port_suspend_port_task_scheduler(sci_port); |
1259 | if (sci_port->ready_exit) | 1259 | if (sci_port->ready_exit) |
@@ -1267,8 +1267,8 @@ enum sci_status scic_sds_port_start(struct scic_sds_port *sci_port) | |||
1267 | enum scic_sds_port_states state; | 1267 | enum scic_sds_port_states state; |
1268 | u32 phy_mask; | 1268 | u32 phy_mask; |
1269 | 1269 | ||
1270 | state = sci_port->state_machine.current_state_id; | 1270 | state = sci_port->sm.current_state_id; |
1271 | if (state != SCI_BASE_PORT_STATE_STOPPED) { | 1271 | if (state != SCI_PORT_STOPPED) { |
1272 | dev_warn(sciport_to_dev(sci_port), | 1272 | dev_warn(sciport_to_dev(sci_port), |
1273 | "%s: in wrong state: %d\n", __func__, state); | 1273 | "%s: in wrong state: %d\n", __func__, state); |
1274 | return SCI_FAILURE_INVALID_STATE; | 1274 | return SCI_FAILURE_INVALID_STATE; |
@@ -1315,7 +1315,7 @@ enum sci_status scic_sds_port_start(struct scic_sds_port *sci_port) | |||
1315 | */ | 1315 | */ |
1316 | if (scic_sds_port_is_phy_mask_valid(sci_port, phy_mask) == true) { | 1316 | if (scic_sds_port_is_phy_mask_valid(sci_port, phy_mask) == true) { |
1317 | port_state_machine_change(sci_port, | 1317 | port_state_machine_change(sci_port, |
1318 | SCI_BASE_PORT_STATE_READY); | 1318 | SCI_PORT_READY); |
1319 | 1319 | ||
1320 | return SCI_SUCCESS; | 1320 | return SCI_SUCCESS; |
1321 | } | 1321 | } |
@@ -1332,16 +1332,16 @@ enum sci_status scic_sds_port_stop(struct scic_sds_port *sci_port) | |||
1332 | { | 1332 | { |
1333 | enum scic_sds_port_states state; | 1333 | enum scic_sds_port_states state; |
1334 | 1334 | ||
1335 | state = sci_port->state_machine.current_state_id; | 1335 | state = sci_port->sm.current_state_id; |
1336 | switch (state) { | 1336 | switch (state) { |
1337 | case SCI_BASE_PORT_STATE_STOPPED: | 1337 | case SCI_PORT_STOPPED: |
1338 | return SCI_SUCCESS; | 1338 | return SCI_SUCCESS; |
1339 | case SCIC_SDS_PORT_READY_SUBSTATE_WAITING: | 1339 | case SCI_PORT_SUB_WAITING: |
1340 | case SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL: | 1340 | case SCI_PORT_SUB_OPERATIONAL: |
1341 | case SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING: | 1341 | case SCI_PORT_SUB_CONFIGURING: |
1342 | case SCI_BASE_PORT_STATE_RESETTING: | 1342 | case SCI_PORT_RESETTING: |
1343 | port_state_machine_change(sci_port, | 1343 | port_state_machine_change(sci_port, |
1344 | SCI_BASE_PORT_STATE_STOPPING); | 1344 | SCI_PORT_STOPPING); |
1345 | return SCI_SUCCESS; | 1345 | return SCI_SUCCESS; |
1346 | default: | 1346 | default: |
1347 | dev_warn(sciport_to_dev(sci_port), | 1347 | dev_warn(sciport_to_dev(sci_port), |
@@ -1357,8 +1357,8 @@ static enum sci_status scic_port_hard_reset(struct scic_sds_port *sci_port, u32 | |||
1357 | enum scic_sds_port_states state; | 1357 | enum scic_sds_port_states state; |
1358 | u32 phy_index; | 1358 | u32 phy_index; |
1359 | 1359 | ||
1360 | state = sci_port->state_machine.current_state_id; | 1360 | state = sci_port->sm.current_state_id; |
1361 | if (state != SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL) { | 1361 | if (state != SCI_PORT_SUB_OPERATIONAL) { |
1362 | dev_warn(sciport_to_dev(sci_port), | 1362 | dev_warn(sciport_to_dev(sci_port), |
1363 | "%s: in wrong state: %d\n", __func__, state); | 1363 | "%s: in wrong state: %d\n", __func__, state); |
1364 | return SCI_FAILURE_INVALID_STATE; | 1364 | return SCI_FAILURE_INVALID_STATE; |
@@ -1389,7 +1389,7 @@ static enum sci_status scic_port_hard_reset(struct scic_sds_port *sci_port, u32 | |||
1389 | sci_port->not_ready_reason = SCIC_PORT_NOT_READY_HARD_RESET_REQUESTED; | 1389 | sci_port->not_ready_reason = SCIC_PORT_NOT_READY_HARD_RESET_REQUESTED; |
1390 | 1390 | ||
1391 | port_state_machine_change(sci_port, | 1391 | port_state_machine_change(sci_port, |
1392 | SCI_BASE_PORT_STATE_RESETTING); | 1392 | SCI_PORT_RESETTING); |
1393 | return SCI_SUCCESS; | 1393 | return SCI_SUCCESS; |
1394 | } | 1394 | } |
1395 | 1395 | ||
@@ -1408,9 +1408,9 @@ enum sci_status scic_sds_port_add_phy(struct scic_sds_port *sci_port, | |||
1408 | enum sci_status status; | 1408 | enum sci_status status; |
1409 | enum scic_sds_port_states state; | 1409 | enum scic_sds_port_states state; |
1410 | 1410 | ||
1411 | state = sci_port->state_machine.current_state_id; | 1411 | state = sci_port->sm.current_state_id; |
1412 | switch (state) { | 1412 | switch (state) { |
1413 | case SCI_BASE_PORT_STATE_STOPPED: { | 1413 | case SCI_PORT_STOPPED: { |
1414 | struct sci_sas_address port_sas_address; | 1414 | struct sci_sas_address port_sas_address; |
1415 | 1415 | ||
1416 | /* Read the port assigned SAS Address if there is one */ | 1416 | /* Read the port assigned SAS Address if there is one */ |
@@ -1430,8 +1430,8 @@ enum sci_status scic_sds_port_add_phy(struct scic_sds_port *sci_port, | |||
1430 | } | 1430 | } |
1431 | return scic_sds_port_set_phy(sci_port, sci_phy); | 1431 | return scic_sds_port_set_phy(sci_port, sci_phy); |
1432 | } | 1432 | } |
1433 | case SCIC_SDS_PORT_READY_SUBSTATE_WAITING: | 1433 | case SCI_PORT_SUB_WAITING: |
1434 | case SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL: | 1434 | case SCI_PORT_SUB_OPERATIONAL: |
1435 | status = scic_sds_port_set_phy(sci_port, sci_phy); | 1435 | status = scic_sds_port_set_phy(sci_port, sci_phy); |
1436 | 1436 | ||
1437 | if (status != SCI_SUCCESS) | 1437 | if (status != SCI_SUCCESS) |
@@ -1439,10 +1439,10 @@ enum sci_status scic_sds_port_add_phy(struct scic_sds_port *sci_port, | |||
1439 | 1439 | ||
1440 | scic_sds_port_general_link_up_handler(sci_port, sci_phy, true); | 1440 | scic_sds_port_general_link_up_handler(sci_port, sci_phy, true); |
1441 | sci_port->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; | 1441 | sci_port->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; |
1442 | port_state_machine_change(sci_port, SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING); | 1442 | port_state_machine_change(sci_port, SCI_PORT_SUB_CONFIGURING); |
1443 | 1443 | ||
1444 | return status; | 1444 | return status; |
1445 | case SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING: | 1445 | case SCI_PORT_SUB_CONFIGURING: |
1446 | status = scic_sds_port_set_phy(sci_port, sci_phy); | 1446 | status = scic_sds_port_set_phy(sci_port, sci_phy); |
1447 | 1447 | ||
1448 | if (status != SCI_SUCCESS) | 1448 | if (status != SCI_SUCCESS) |
@@ -1453,7 +1453,7 @@ enum sci_status scic_sds_port_add_phy(struct scic_sds_port *sci_port, | |||
1453 | * the port. | 1453 | * the port. |
1454 | */ | 1454 | */ |
1455 | port_state_machine_change(sci_port, | 1455 | port_state_machine_change(sci_port, |
1456 | SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING); | 1456 | SCI_PORT_SUB_CONFIGURING); |
1457 | return SCI_SUCCESS; | 1457 | return SCI_SUCCESS; |
1458 | default: | 1458 | default: |
1459 | dev_warn(sciport_to_dev(sci_port), | 1459 | dev_warn(sciport_to_dev(sci_port), |
@@ -1477,12 +1477,12 @@ enum sci_status scic_sds_port_remove_phy(struct scic_sds_port *sci_port, | |||
1477 | enum sci_status status; | 1477 | enum sci_status status; |
1478 | enum scic_sds_port_states state; | 1478 | enum scic_sds_port_states state; |
1479 | 1479 | ||
1480 | state = sci_port->state_machine.current_state_id; | 1480 | state = sci_port->sm.current_state_id; |
1481 | 1481 | ||
1482 | switch (state) { | 1482 | switch (state) { |
1483 | case SCI_BASE_PORT_STATE_STOPPED: | 1483 | case SCI_PORT_STOPPED: |
1484 | return scic_sds_port_clear_phy(sci_port, sci_phy); | 1484 | return scic_sds_port_clear_phy(sci_port, sci_phy); |
1485 | case SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL: | 1485 | case SCI_PORT_SUB_OPERATIONAL: |
1486 | status = scic_sds_port_clear_phy(sci_port, sci_phy); | 1486 | status = scic_sds_port_clear_phy(sci_port, sci_phy); |
1487 | if (status != SCI_SUCCESS) | 1487 | if (status != SCI_SUCCESS) |
1488 | return status; | 1488 | return status; |
@@ -1490,9 +1490,9 @@ enum sci_status scic_sds_port_remove_phy(struct scic_sds_port *sci_port, | |||
1490 | scic_sds_port_deactivate_phy(sci_port, sci_phy, true); | 1490 | scic_sds_port_deactivate_phy(sci_port, sci_phy, true); |
1491 | sci_port->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; | 1491 | sci_port->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; |
1492 | port_state_machine_change(sci_port, | 1492 | port_state_machine_change(sci_port, |
1493 | SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING); | 1493 | SCI_PORT_SUB_CONFIGURING); |
1494 | return SCI_SUCCESS; | 1494 | return SCI_SUCCESS; |
1495 | case SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING: | 1495 | case SCI_PORT_SUB_CONFIGURING: |
1496 | status = scic_sds_port_clear_phy(sci_port, sci_phy); | 1496 | status = scic_sds_port_clear_phy(sci_port, sci_phy); |
1497 | 1497 | ||
1498 | if (status != SCI_SUCCESS) | 1498 | if (status != SCI_SUCCESS) |
@@ -1503,7 +1503,7 @@ enum sci_status scic_sds_port_remove_phy(struct scic_sds_port *sci_port, | |||
1503 | * the port | 1503 | * the port |
1504 | */ | 1504 | */ |
1505 | port_state_machine_change(sci_port, | 1505 | port_state_machine_change(sci_port, |
1506 | SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING); | 1506 | SCI_PORT_SUB_CONFIGURING); |
1507 | return SCI_SUCCESS; | 1507 | return SCI_SUCCESS; |
1508 | default: | 1508 | default: |
1509 | dev_warn(sciport_to_dev(sci_port), | 1509 | dev_warn(sciport_to_dev(sci_port), |
@@ -1517,21 +1517,21 @@ enum sci_status scic_sds_port_link_up(struct scic_sds_port *sci_port, | |||
1517 | { | 1517 | { |
1518 | enum scic_sds_port_states state; | 1518 | enum scic_sds_port_states state; |
1519 | 1519 | ||
1520 | state = sci_port->state_machine.current_state_id; | 1520 | state = sci_port->sm.current_state_id; |
1521 | switch (state) { | 1521 | switch (state) { |
1522 | case SCIC_SDS_PORT_READY_SUBSTATE_WAITING: | 1522 | case SCI_PORT_SUB_WAITING: |
1523 | /* Since this is the first phy going link up for the port we | 1523 | /* Since this is the first phy going link up for the port we |
1524 | * can just enable it and continue | 1524 | * can just enable it and continue |
1525 | */ | 1525 | */ |
1526 | scic_sds_port_activate_phy(sci_port, sci_phy, true); | 1526 | scic_sds_port_activate_phy(sci_port, sci_phy, true); |
1527 | 1527 | ||
1528 | port_state_machine_change(sci_port, | 1528 | port_state_machine_change(sci_port, |
1529 | SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL); | 1529 | SCI_PORT_SUB_OPERATIONAL); |
1530 | return SCI_SUCCESS; | 1530 | return SCI_SUCCESS; |
1531 | case SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL: | 1531 | case SCI_PORT_SUB_OPERATIONAL: |
1532 | scic_sds_port_general_link_up_handler(sci_port, sci_phy, true); | 1532 | scic_sds_port_general_link_up_handler(sci_port, sci_phy, true); |
1533 | return SCI_SUCCESS; | 1533 | return SCI_SUCCESS; |
1534 | case SCI_BASE_PORT_STATE_RESETTING: | 1534 | case SCI_PORT_RESETTING: |
1535 | /* TODO We should make sure that the phy that has gone | 1535 | /* TODO We should make sure that the phy that has gone |
1536 | * link up is the same one on which we sent the reset. It is | 1536 | * link up is the same one on which we sent the reset. It is |
1537 | * possible that the phy on which we sent the reset is not the | 1537 | * possible that the phy on which we sent the reset is not the |
@@ -1560,9 +1560,9 @@ enum sci_status scic_sds_port_link_down(struct scic_sds_port *sci_port, | |||
1560 | { | 1560 | { |
1561 | enum scic_sds_port_states state; | 1561 | enum scic_sds_port_states state; |
1562 | 1562 | ||
1563 | state = sci_port->state_machine.current_state_id; | 1563 | state = sci_port->sm.current_state_id; |
1564 | switch (state) { | 1564 | switch (state) { |
1565 | case SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL: | 1565 | case SCI_PORT_SUB_OPERATIONAL: |
1566 | scic_sds_port_deactivate_phy(sci_port, sci_phy, true); | 1566 | scic_sds_port_deactivate_phy(sci_port, sci_phy, true); |
1567 | 1567 | ||
1568 | /* If there are no active phys left in the port, then | 1568 | /* If there are no active phys left in the port, then |
@@ -1571,9 +1571,9 @@ enum sci_status scic_sds_port_link_down(struct scic_sds_port *sci_port, | |||
1571 | */ | 1571 | */ |
1572 | if (sci_port->active_phy_mask == 0) | 1572 | if (sci_port->active_phy_mask == 0) |
1573 | port_state_machine_change(sci_port, | 1573 | port_state_machine_change(sci_port, |
1574 | SCIC_SDS_PORT_READY_SUBSTATE_WAITING); | 1574 | SCI_PORT_SUB_WAITING); |
1575 | return SCI_SUCCESS; | 1575 | return SCI_SUCCESS; |
1576 | case SCI_BASE_PORT_STATE_RESETTING: | 1576 | case SCI_PORT_RESETTING: |
1577 | /* In the resetting state we don't notify the user regarding | 1577 | /* In the resetting state we don't notify the user regarding |
1578 | * link up and link down notifications. */ | 1578 | * link up and link down notifications. */ |
1579 | scic_sds_port_deactivate_phy(sci_port, sci_phy, false); | 1579 | scic_sds_port_deactivate_phy(sci_port, sci_phy, false); |
@@ -1591,11 +1591,11 @@ enum sci_status scic_sds_port_start_io(struct scic_sds_port *sci_port, | |||
1591 | { | 1591 | { |
1592 | enum scic_sds_port_states state; | 1592 | enum scic_sds_port_states state; |
1593 | 1593 | ||
1594 | state = sci_port->state_machine.current_state_id; | 1594 | state = sci_port->sm.current_state_id; |
1595 | switch (state) { | 1595 | switch (state) { |
1596 | case SCIC_SDS_PORT_READY_SUBSTATE_WAITING: | 1596 | case SCI_PORT_SUB_WAITING: |
1597 | return SCI_FAILURE_INVALID_STATE; | 1597 | return SCI_FAILURE_INVALID_STATE; |
1598 | case SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL: | 1598 | case SCI_PORT_SUB_OPERATIONAL: |
1599 | sci_port->started_request_count++; | 1599 | sci_port->started_request_count++; |
1600 | return SCI_SUCCESS; | 1600 | return SCI_SUCCESS; |
1601 | default: | 1601 | default: |
@@ -1611,31 +1611,31 @@ enum sci_status scic_sds_port_complete_io(struct scic_sds_port *sci_port, | |||
1611 | { | 1611 | { |
1612 | enum scic_sds_port_states state; | 1612 | enum scic_sds_port_states state; |
1613 | 1613 | ||
1614 | state = sci_port->state_machine.current_state_id; | 1614 | state = sci_port->sm.current_state_id; |
1615 | switch (state) { | 1615 | switch (state) { |
1616 | case SCI_BASE_PORT_STATE_STOPPED: | 1616 | case SCI_PORT_STOPPED: |
1617 | dev_warn(sciport_to_dev(sci_port), | 1617 | dev_warn(sciport_to_dev(sci_port), |
1618 | "%s: in wrong state: %d\n", __func__, state); | 1618 | "%s: in wrong state: %d\n", __func__, state); |
1619 | return SCI_FAILURE_INVALID_STATE; | 1619 | return SCI_FAILURE_INVALID_STATE; |
1620 | case SCI_BASE_PORT_STATE_STOPPING: | 1620 | case SCI_PORT_STOPPING: |
1621 | scic_sds_port_decrement_request_count(sci_port); | 1621 | scic_sds_port_decrement_request_count(sci_port); |
1622 | 1622 | ||
1623 | if (sci_port->started_request_count == 0) | 1623 | if (sci_port->started_request_count == 0) |
1624 | port_state_machine_change(sci_port, | 1624 | port_state_machine_change(sci_port, |
1625 | SCI_BASE_PORT_STATE_STOPPED); | 1625 | SCI_PORT_STOPPED); |
1626 | break; | 1626 | break; |
1627 | case SCI_BASE_PORT_STATE_READY: | 1627 | case SCI_PORT_READY: |
1628 | case SCI_BASE_PORT_STATE_RESETTING: | 1628 | case SCI_PORT_RESETTING: |
1629 | case SCI_BASE_PORT_STATE_FAILED: | 1629 | case SCI_PORT_FAILED: |
1630 | case SCIC_SDS_PORT_READY_SUBSTATE_WAITING: | 1630 | case SCI_PORT_SUB_WAITING: |
1631 | case SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL: | 1631 | case SCI_PORT_SUB_OPERATIONAL: |
1632 | scic_sds_port_decrement_request_count(sci_port); | 1632 | scic_sds_port_decrement_request_count(sci_port); |
1633 | break; | 1633 | break; |
1634 | case SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING: | 1634 | case SCI_PORT_SUB_CONFIGURING: |
1635 | scic_sds_port_decrement_request_count(sci_port); | 1635 | scic_sds_port_decrement_request_count(sci_port); |
1636 | if (sci_port->started_request_count == 0) { | 1636 | if (sci_port->started_request_count == 0) { |
1637 | port_state_machine_change(sci_port, | 1637 | port_state_machine_change(sci_port, |
1638 | SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL); | 1638 | SCI_PORT_SUB_OPERATIONAL); |
1639 | } | 1639 | } |
1640 | break; | 1640 | break; |
1641 | } | 1641 | } |
@@ -1707,9 +1707,9 @@ static void scic_sds_port_post_dummy_remote_node(struct scic_sds_port *sci_port) | |||
1707 | 1707 | ||
1708 | static void scic_sds_port_stopped_state_enter(struct sci_base_state_machine *sm) | 1708 | static void scic_sds_port_stopped_state_enter(struct sci_base_state_machine *sm) |
1709 | { | 1709 | { |
1710 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine); | 1710 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); |
1711 | 1711 | ||
1712 | if (sci_port->state_machine.previous_state_id == SCI_BASE_PORT_STATE_STOPPING) { | 1712 | if (sci_port->sm.previous_state_id == SCI_PORT_STOPPING) { |
1713 | /* | 1713 | /* |
1714 | * If we enter this state becasuse of a request to stop | 1714 | * If we enter this state becasuse of a request to stop |
1715 | * the port then we want to disable the hardwares port | 1715 | * the port then we want to disable the hardwares port |
@@ -1720,7 +1720,7 @@ static void scic_sds_port_stopped_state_enter(struct sci_base_state_machine *sm) | |||
1720 | 1720 | ||
1721 | static void scic_sds_port_stopped_state_exit(struct sci_base_state_machine *sm) | 1721 | static void scic_sds_port_stopped_state_exit(struct sci_base_state_machine *sm) |
1722 | { | 1722 | { |
1723 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine); | 1723 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); |
1724 | 1724 | ||
1725 | /* Enable and suspend the port task scheduler */ | 1725 | /* Enable and suspend the port task scheduler */ |
1726 | scic_sds_port_enable_port_task_scheduler(sci_port); | 1726 | scic_sds_port_enable_port_task_scheduler(sci_port); |
@@ -1728,14 +1728,14 @@ static void scic_sds_port_stopped_state_exit(struct sci_base_state_machine *sm) | |||
1728 | 1728 | ||
1729 | static void scic_sds_port_ready_state_enter(struct sci_base_state_machine *sm) | 1729 | static void scic_sds_port_ready_state_enter(struct sci_base_state_machine *sm) |
1730 | { | 1730 | { |
1731 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine); | 1731 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); |
1732 | struct scic_sds_controller *scic = sci_port->owning_controller; | 1732 | struct scic_sds_controller *scic = sci_port->owning_controller; |
1733 | struct isci_host *ihost = scic_to_ihost(scic); | 1733 | struct isci_host *ihost = scic_to_ihost(scic); |
1734 | struct isci_port *iport = sci_port_to_iport(sci_port); | 1734 | struct isci_port *iport = sci_port_to_iport(sci_port); |
1735 | u32 prev_state; | 1735 | u32 prev_state; |
1736 | 1736 | ||
1737 | prev_state = sci_port->state_machine.previous_state_id; | 1737 | prev_state = sci_port->sm.previous_state_id; |
1738 | if (prev_state == SCI_BASE_PORT_STATE_RESETTING) | 1738 | if (prev_state == SCI_PORT_RESETTING) |
1739 | isci_port_hard_reset_complete(iport, SCI_SUCCESS); | 1739 | isci_port_hard_reset_complete(iport, SCI_SUCCESS); |
1740 | else | 1740 | else |
1741 | isci_port_not_ready(ihost, iport); | 1741 | isci_port_not_ready(ihost, iport); |
@@ -1745,19 +1745,19 @@ static void scic_sds_port_ready_state_enter(struct sci_base_state_machine *sm) | |||
1745 | 1745 | ||
1746 | /* Start the ready substate machine */ | 1746 | /* Start the ready substate machine */ |
1747 | port_state_machine_change(sci_port, | 1747 | port_state_machine_change(sci_port, |
1748 | SCIC_SDS_PORT_READY_SUBSTATE_WAITING); | 1748 | SCI_PORT_SUB_WAITING); |
1749 | } | 1749 | } |
1750 | 1750 | ||
1751 | static void scic_sds_port_resetting_state_exit(struct sci_base_state_machine *sm) | 1751 | static void scic_sds_port_resetting_state_exit(struct sci_base_state_machine *sm) |
1752 | { | 1752 | { |
1753 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine); | 1753 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); |
1754 | 1754 | ||
1755 | sci_del_timer(&sci_port->timer); | 1755 | sci_del_timer(&sci_port->timer); |
1756 | } | 1756 | } |
1757 | 1757 | ||
1758 | static void scic_sds_port_stopping_state_exit(struct sci_base_state_machine *sm) | 1758 | static void scic_sds_port_stopping_state_exit(struct sci_base_state_machine *sm) |
1759 | { | 1759 | { |
1760 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine); | 1760 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); |
1761 | 1761 | ||
1762 | sci_del_timer(&sci_port->timer); | 1762 | sci_del_timer(&sci_port->timer); |
1763 | 1763 | ||
@@ -1766,7 +1766,7 @@ static void scic_sds_port_stopping_state_exit(struct sci_base_state_machine *sm) | |||
1766 | 1766 | ||
1767 | static void scic_sds_port_failed_state_enter(struct sci_base_state_machine *sm) | 1767 | static void scic_sds_port_failed_state_enter(struct sci_base_state_machine *sm) |
1768 | { | 1768 | { |
1769 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), state_machine); | 1769 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); |
1770 | struct isci_port *iport = sci_port_to_iport(sci_port); | 1770 | struct isci_port *iport = sci_port_to_iport(sci_port); |
1771 | 1771 | ||
1772 | isci_port_hard_reset_complete(iport, SCI_FAILURE_TIMEOUT); | 1772 | isci_port_hard_reset_complete(iport, SCI_FAILURE_TIMEOUT); |
@@ -1775,31 +1775,31 @@ static void scic_sds_port_failed_state_enter(struct sci_base_state_machine *sm) | |||
1775 | /* --------------------------------------------------------------------------- */ | 1775 | /* --------------------------------------------------------------------------- */ |
1776 | 1776 | ||
1777 | static const struct sci_base_state scic_sds_port_state_table[] = { | 1777 | static const struct sci_base_state scic_sds_port_state_table[] = { |
1778 | [SCI_BASE_PORT_STATE_STOPPED] = { | 1778 | [SCI_PORT_STOPPED] = { |
1779 | .enter_state = scic_sds_port_stopped_state_enter, | 1779 | .enter_state = scic_sds_port_stopped_state_enter, |
1780 | .exit_state = scic_sds_port_stopped_state_exit | 1780 | .exit_state = scic_sds_port_stopped_state_exit |
1781 | }, | 1781 | }, |
1782 | [SCI_BASE_PORT_STATE_STOPPING] = { | 1782 | [SCI_PORT_STOPPING] = { |
1783 | .exit_state = scic_sds_port_stopping_state_exit | 1783 | .exit_state = scic_sds_port_stopping_state_exit |
1784 | }, | 1784 | }, |
1785 | [SCI_BASE_PORT_STATE_READY] = { | 1785 | [SCI_PORT_READY] = { |
1786 | .enter_state = scic_sds_port_ready_state_enter, | 1786 | .enter_state = scic_sds_port_ready_state_enter, |
1787 | }, | 1787 | }, |
1788 | [SCIC_SDS_PORT_READY_SUBSTATE_WAITING] = { | 1788 | [SCI_PORT_SUB_WAITING] = { |
1789 | .enter_state = scic_sds_port_ready_substate_waiting_enter, | 1789 | .enter_state = scic_sds_port_ready_substate_waiting_enter, |
1790 | }, | 1790 | }, |
1791 | [SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL] = { | 1791 | [SCI_PORT_SUB_OPERATIONAL] = { |
1792 | .enter_state = scic_sds_port_ready_substate_operational_enter, | 1792 | .enter_state = scic_sds_port_ready_substate_operational_enter, |
1793 | .exit_state = scic_sds_port_ready_substate_operational_exit | 1793 | .exit_state = scic_sds_port_ready_substate_operational_exit |
1794 | }, | 1794 | }, |
1795 | [SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING] = { | 1795 | [SCI_PORT_SUB_CONFIGURING] = { |
1796 | .enter_state = scic_sds_port_ready_substate_configuring_enter, | 1796 | .enter_state = scic_sds_port_ready_substate_configuring_enter, |
1797 | .exit_state = scic_sds_port_ready_substate_configuring_exit | 1797 | .exit_state = scic_sds_port_ready_substate_configuring_exit |
1798 | }, | 1798 | }, |
1799 | [SCI_BASE_PORT_STATE_RESETTING] = { | 1799 | [SCI_PORT_RESETTING] = { |
1800 | .exit_state = scic_sds_port_resetting_state_exit | 1800 | .exit_state = scic_sds_port_resetting_state_exit |
1801 | }, | 1801 | }, |
1802 | [SCI_BASE_PORT_STATE_FAILED] = { | 1802 | [SCI_PORT_FAILED] = { |
1803 | .enter_state = scic_sds_port_failed_state_enter, | 1803 | .enter_state = scic_sds_port_failed_state_enter, |
1804 | } | 1804 | } |
1805 | }; | 1805 | }; |
@@ -1807,11 +1807,11 @@ static const struct sci_base_state scic_sds_port_state_table[] = { | |||
1807 | void scic_sds_port_construct(struct scic_sds_port *sci_port, u8 index, | 1807 | void scic_sds_port_construct(struct scic_sds_port *sci_port, u8 index, |
1808 | struct scic_sds_controller *scic) | 1808 | struct scic_sds_controller *scic) |
1809 | { | 1809 | { |
1810 | sci_base_state_machine_construct(&sci_port->state_machine, | 1810 | sci_base_state_machine_construct(&sci_port->sm, |
1811 | scic_sds_port_state_table, | 1811 | scic_sds_port_state_table, |
1812 | SCI_BASE_PORT_STATE_STOPPED); | 1812 | SCI_PORT_STOPPED); |
1813 | 1813 | ||
1814 | sci_base_state_machine_start(&sci_port->state_machine); | 1814 | sci_base_state_machine_start(&sci_port->sm); |
1815 | 1815 | ||
1816 | sci_port->logical_port_index = SCIC_SDS_DUMMY_PORT; | 1816 | sci_port->logical_port_index = SCIC_SDS_DUMMY_PORT; |
1817 | sci_port->physical_port_index = index; | 1817 | sci_port->physical_port_index = index; |
diff --git a/drivers/scsi/isci/port.h b/drivers/scsi/isci/port.h index 9a6912855fc1..fee6d80df769 100644 --- a/drivers/scsi/isci/port.h +++ b/drivers/scsi/isci/port.h | |||
@@ -84,7 +84,7 @@ struct scic_sds_port { | |||
84 | /** | 84 | /** |
85 | * This field contains the information for the base port state machine. | 85 | * This field contains the information for the base port state machine. |
86 | */ | 86 | */ |
87 | struct sci_base_state_machine state_machine; | 87 | struct sci_base_state_machine sm; |
88 | 88 | ||
89 | bool ready_exit; | 89 | bool ready_exit; |
90 | 90 | ||
@@ -224,7 +224,7 @@ enum scic_sds_port_states { | |||
224 | * In this state no new IO operations are permitted. | 224 | * In this state no new IO operations are permitted. |
225 | * This state is entered from the STOPPING state. | 225 | * This state is entered from the STOPPING state. |
226 | */ | 226 | */ |
227 | SCI_BASE_PORT_STATE_STOPPED, | 227 | SCI_PORT_STOPPED, |
228 | 228 | ||
229 | /** | 229 | /** |
230 | * This state indicates that the port is in the process of stopping. | 230 | * This state indicates that the port is in the process of stopping. |
@@ -232,33 +232,33 @@ enum scic_sds_port_states { | |||
232 | * operations are allowed to complete. | 232 | * operations are allowed to complete. |
233 | * This state is entered from the READY state. | 233 | * This state is entered from the READY state. |
234 | */ | 234 | */ |
235 | SCI_BASE_PORT_STATE_STOPPING, | 235 | SCI_PORT_STOPPING, |
236 | 236 | ||
237 | /** | 237 | /** |
238 | * This state indicates the port is now ready. Thus, the user is | 238 | * This state indicates the port is now ready. Thus, the user is |
239 | * able to perform IO operations on this port. | 239 | * able to perform IO operations on this port. |
240 | * This state is entered from the STARTING state. | 240 | * This state is entered from the STARTING state. |
241 | */ | 241 | */ |
242 | SCI_BASE_PORT_STATE_READY, | 242 | SCI_PORT_READY, |
243 | 243 | ||
244 | /** | 244 | /** |
245 | * The substate where the port is started and ready but has no | 245 | * The substate where the port is started and ready but has no |
246 | * active phys. | 246 | * active phys. |
247 | */ | 247 | */ |
248 | SCIC_SDS_PORT_READY_SUBSTATE_WAITING, | 248 | SCI_PORT_SUB_WAITING, |
249 | 249 | ||
250 | /** | 250 | /** |
251 | * The substate where the port is started and ready and there is | 251 | * The substate where the port is started and ready and there is |
252 | * at least one phy operational. | 252 | * at least one phy operational. |
253 | */ | 253 | */ |
254 | SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL, | 254 | SCI_PORT_SUB_OPERATIONAL, |
255 | 255 | ||
256 | /** | 256 | /** |
257 | * The substate where the port is started and there was an | 257 | * The substate where the port is started and there was an |
258 | * add/remove phy event. This state is only used in Automatic | 258 | * add/remove phy event. This state is only used in Automatic |
259 | * Port Configuration Mode (APC) | 259 | * Port Configuration Mode (APC) |
260 | */ | 260 | */ |
261 | SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING, | 261 | SCI_PORT_SUB_CONFIGURING, |
262 | 262 | ||
263 | /** | 263 | /** |
264 | * This state indicates the port is in the process of performing a hard | 264 | * This state indicates the port is in the process of performing a hard |
@@ -266,14 +266,14 @@ enum scic_sds_port_states { | |||
266 | * port. | 266 | * port. |
267 | * This state is entered from the READY state. | 267 | * This state is entered from the READY state. |
268 | */ | 268 | */ |
269 | SCI_BASE_PORT_STATE_RESETTING, | 269 | SCI_PORT_RESETTING, |
270 | 270 | ||
271 | /** | 271 | /** |
272 | * This state indicates the port has failed a reset request. This state | 272 | * This state indicates the port has failed a reset request. This state |
273 | * is entered when a port reset request times out. | 273 | * is entered when a port reset request times out. |
274 | * This state is entered from the RESETTING state. | 274 | * This state is entered from the RESETTING state. |
275 | */ | 275 | */ |
276 | SCI_BASE_PORT_STATE_FAILED, | 276 | SCI_PORT_FAILED, |
277 | 277 | ||
278 | 278 | ||
279 | }; | 279 | }; |
diff --git a/drivers/scsi/isci/port_config.c b/drivers/scsi/isci/port_config.c index 38401f644e18..fcb8f030b7ae 100644 --- a/drivers/scsi/isci/port_config.c +++ b/drivers/scsi/isci/port_config.c | |||
@@ -661,13 +661,13 @@ static void scic_sds_apc_agent_link_up(struct scic_sds_controller *scic, | |||
661 | scic_sds_apc_agent_configure_ports(scic, port_agent, sci_phy, true); | 661 | scic_sds_apc_agent_configure_ports(scic, port_agent, sci_phy, true); |
662 | } else { | 662 | } else { |
663 | /* the phy is already the part of the port */ | 663 | /* the phy is already the part of the port */ |
664 | u32 port_state = sci_port->state_machine.current_state_id; | 664 | u32 port_state = sci_port->sm.current_state_id; |
665 | 665 | ||
666 | /* if the PORT'S state is resetting then the link up is from | 666 | /* if the PORT'S state is resetting then the link up is from |
667 | * port hard reset in this case, we need to tell the port | 667 | * port hard reset in this case, we need to tell the port |
668 | * that link up is recieved | 668 | * that link up is recieved |
669 | */ | 669 | */ |
670 | BUG_ON(port_state != SCI_BASE_PORT_STATE_RESETTING); | 670 | BUG_ON(port_state != SCI_PORT_RESETTING); |
671 | port_agent->phy_ready_mask |= 1 << phy_index; | 671 | port_agent->phy_ready_mask |= 1 << phy_index; |
672 | scic_sds_port_link_up(sci_port, sci_phy); | 672 | scic_sds_port_link_up(sci_port, sci_phy); |
673 | } | 673 | } |
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c index 68b63b04be19..6c93f20f3dd3 100644 --- a/drivers/scsi/isci/remote_device.c +++ b/drivers/scsi/isci/remote_device.c | |||
@@ -126,8 +126,7 @@ static void rnc_destruct_done(void *_dev) | |||
126 | struct scic_sds_remote_device *sci_dev = _dev; | 126 | struct scic_sds_remote_device *sci_dev = _dev; |
127 | 127 | ||
128 | BUG_ON(sci_dev->started_request_count != 0); | 128 | BUG_ON(sci_dev->started_request_count != 0); |
129 | sci_base_state_machine_change_state(&sci_dev->state_machine, | 129 | sci_change_state(&sci_dev->sm, SCI_DEV_STOPPED); |
130 | SCI_BASE_REMOTE_DEVICE_STATE_STOPPED); | ||
131 | } | 130 | } |
132 | 131 | ||
133 | static enum sci_status scic_sds_remote_device_terminate_requests(struct scic_sds_remote_device *sci_dev) | 132 | static enum sci_status scic_sds_remote_device_terminate_requests(struct scic_sds_remote_device *sci_dev) |
@@ -154,20 +153,20 @@ static enum sci_status scic_sds_remote_device_terminate_requests(struct scic_sds | |||
154 | enum sci_status scic_remote_device_stop(struct scic_sds_remote_device *sci_dev, | 153 | enum sci_status scic_remote_device_stop(struct scic_sds_remote_device *sci_dev, |
155 | u32 timeout) | 154 | u32 timeout) |
156 | { | 155 | { |
157 | struct sci_base_state_machine *sm = &sci_dev->state_machine; | 156 | struct sci_base_state_machine *sm = &sci_dev->sm; |
158 | enum scic_sds_remote_device_states state = sm->current_state_id; | 157 | enum scic_sds_remote_device_states state = sm->current_state_id; |
159 | 158 | ||
160 | switch (state) { | 159 | switch (state) { |
161 | case SCI_BASE_REMOTE_DEVICE_STATE_INITIAL: | 160 | case SCI_DEV_INITIAL: |
162 | case SCI_BASE_REMOTE_DEVICE_STATE_FAILED: | 161 | case SCI_DEV_FAILED: |
163 | case SCI_BASE_REMOTE_DEVICE_STATE_FINAL: | 162 | case SCI_DEV_FINAL: |
164 | default: | 163 | default: |
165 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 164 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", |
166 | __func__, state); | 165 | __func__, state); |
167 | return SCI_FAILURE_INVALID_STATE; | 166 | return SCI_FAILURE_INVALID_STATE; |
168 | case SCI_BASE_REMOTE_DEVICE_STATE_STOPPED: | 167 | case SCI_DEV_STOPPED: |
169 | return SCI_SUCCESS; | 168 | return SCI_SUCCESS; |
170 | case SCI_BASE_REMOTE_DEVICE_STATE_STARTING: | 169 | case SCI_DEV_STARTING: |
171 | /* device not started so there had better be no requests */ | 170 | /* device not started so there had better be no requests */ |
172 | BUG_ON(sci_dev->started_request_count != 0); | 171 | BUG_ON(sci_dev->started_request_count != 0); |
173 | scic_sds_remote_node_context_destruct(&sci_dev->rnc, | 172 | scic_sds_remote_node_context_destruct(&sci_dev->rnc, |
@@ -175,17 +174,17 @@ enum sci_status scic_remote_device_stop(struct scic_sds_remote_device *sci_dev, | |||
175 | /* Transition to the stopping state and wait for the | 174 | /* Transition to the stopping state and wait for the |
176 | * remote node to complete being posted and invalidated. | 175 | * remote node to complete being posted and invalidated. |
177 | */ | 176 | */ |
178 | sci_base_state_machine_change_state(sm, SCI_BASE_REMOTE_DEVICE_STATE_STOPPING); | 177 | sci_change_state(sm, SCI_DEV_STOPPING); |
179 | return SCI_SUCCESS; | 178 | return SCI_SUCCESS; |
180 | case SCI_BASE_REMOTE_DEVICE_STATE_READY: | 179 | case SCI_DEV_READY: |
181 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: | 180 | case SCI_STP_DEV_IDLE: |
182 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD: | 181 | case SCI_STP_DEV_CMD: |
183 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: | 182 | case SCI_STP_DEV_NCQ: |
184 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR: | 183 | case SCI_STP_DEV_NCQ_ERROR: |
185 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET: | 184 | case SCI_STP_DEV_AWAIT_RESET: |
186 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: | 185 | case SCI_SMP_DEV_IDLE: |
187 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD: | 186 | case SCI_SMP_DEV_CMD: |
188 | sci_base_state_machine_change_state(sm, SCI_BASE_REMOTE_DEVICE_STATE_STOPPING); | 187 | sci_change_state(sm, SCI_DEV_STOPPING); |
189 | if (sci_dev->started_request_count == 0) { | 188 | if (sci_dev->started_request_count == 0) { |
190 | scic_sds_remote_node_context_destruct(&sci_dev->rnc, | 189 | scic_sds_remote_node_context_destruct(&sci_dev->rnc, |
191 | rnc_destruct_done, sci_dev); | 190 | rnc_destruct_done, sci_dev); |
@@ -193,70 +192,70 @@ enum sci_status scic_remote_device_stop(struct scic_sds_remote_device *sci_dev, | |||
193 | } else | 192 | } else |
194 | return scic_sds_remote_device_terminate_requests(sci_dev); | 193 | return scic_sds_remote_device_terminate_requests(sci_dev); |
195 | break; | 194 | break; |
196 | case SCI_BASE_REMOTE_DEVICE_STATE_STOPPING: | 195 | case SCI_DEV_STOPPING: |
197 | /* All requests should have been terminated, but if there is an | 196 | /* All requests should have been terminated, but if there is an |
198 | * attempt to stop a device already in the stopping state, then | 197 | * attempt to stop a device already in the stopping state, then |
199 | * try again to terminate. | 198 | * try again to terminate. |
200 | */ | 199 | */ |
201 | return scic_sds_remote_device_terminate_requests(sci_dev); | 200 | return scic_sds_remote_device_terminate_requests(sci_dev); |
202 | case SCI_BASE_REMOTE_DEVICE_STATE_RESETTING: | 201 | case SCI_DEV_RESETTING: |
203 | sci_base_state_machine_change_state(sm, SCI_BASE_REMOTE_DEVICE_STATE_STOPPING); | 202 | sci_change_state(sm, SCI_DEV_STOPPING); |
204 | return SCI_SUCCESS; | 203 | return SCI_SUCCESS; |
205 | } | 204 | } |
206 | } | 205 | } |
207 | 206 | ||
208 | enum sci_status scic_remote_device_reset(struct scic_sds_remote_device *sci_dev) | 207 | enum sci_status scic_remote_device_reset(struct scic_sds_remote_device *sci_dev) |
209 | { | 208 | { |
210 | struct sci_base_state_machine *sm = &sci_dev->state_machine; | 209 | struct sci_base_state_machine *sm = &sci_dev->sm; |
211 | enum scic_sds_remote_device_states state = sm->current_state_id; | 210 | enum scic_sds_remote_device_states state = sm->current_state_id; |
212 | 211 | ||
213 | switch (state) { | 212 | switch (state) { |
214 | case SCI_BASE_REMOTE_DEVICE_STATE_INITIAL: | 213 | case SCI_DEV_INITIAL: |
215 | case SCI_BASE_REMOTE_DEVICE_STATE_STOPPED: | 214 | case SCI_DEV_STOPPED: |
216 | case SCI_BASE_REMOTE_DEVICE_STATE_STARTING: | 215 | case SCI_DEV_STARTING: |
217 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: | 216 | case SCI_SMP_DEV_IDLE: |
218 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD: | 217 | case SCI_SMP_DEV_CMD: |
219 | case SCI_BASE_REMOTE_DEVICE_STATE_STOPPING: | 218 | case SCI_DEV_STOPPING: |
220 | case SCI_BASE_REMOTE_DEVICE_STATE_FAILED: | 219 | case SCI_DEV_FAILED: |
221 | case SCI_BASE_REMOTE_DEVICE_STATE_RESETTING: | 220 | case SCI_DEV_RESETTING: |
222 | case SCI_BASE_REMOTE_DEVICE_STATE_FINAL: | 221 | case SCI_DEV_FINAL: |
223 | default: | 222 | default: |
224 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 223 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", |
225 | __func__, state); | 224 | __func__, state); |
226 | return SCI_FAILURE_INVALID_STATE; | 225 | return SCI_FAILURE_INVALID_STATE; |
227 | case SCI_BASE_REMOTE_DEVICE_STATE_READY: | 226 | case SCI_DEV_READY: |
228 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: | 227 | case SCI_STP_DEV_IDLE: |
229 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD: | 228 | case SCI_STP_DEV_CMD: |
230 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: | 229 | case SCI_STP_DEV_NCQ: |
231 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR: | 230 | case SCI_STP_DEV_NCQ_ERROR: |
232 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET: | 231 | case SCI_STP_DEV_AWAIT_RESET: |
233 | sci_base_state_machine_change_state(sm, SCI_BASE_REMOTE_DEVICE_STATE_RESETTING); | 232 | sci_change_state(sm, SCI_DEV_RESETTING); |
234 | return SCI_SUCCESS; | 233 | return SCI_SUCCESS; |
235 | } | 234 | } |
236 | } | 235 | } |
237 | 236 | ||
238 | enum sci_status scic_remote_device_reset_complete(struct scic_sds_remote_device *sci_dev) | 237 | enum sci_status scic_remote_device_reset_complete(struct scic_sds_remote_device *sci_dev) |
239 | { | 238 | { |
240 | struct sci_base_state_machine *sm = &sci_dev->state_machine; | 239 | struct sci_base_state_machine *sm = &sci_dev->sm; |
241 | enum scic_sds_remote_device_states state = sm->current_state_id; | 240 | enum scic_sds_remote_device_states state = sm->current_state_id; |
242 | 241 | ||
243 | if (state != SCI_BASE_REMOTE_DEVICE_STATE_RESETTING) { | 242 | if (state != SCI_DEV_RESETTING) { |
244 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 243 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", |
245 | __func__, state); | 244 | __func__, state); |
246 | return SCI_FAILURE_INVALID_STATE; | 245 | return SCI_FAILURE_INVALID_STATE; |
247 | } | 246 | } |
248 | 247 | ||
249 | sci_base_state_machine_change_state(sm, SCI_BASE_REMOTE_DEVICE_STATE_READY); | 248 | sci_change_state(sm, SCI_DEV_READY); |
250 | return SCI_SUCCESS; | 249 | return SCI_SUCCESS; |
251 | } | 250 | } |
252 | 251 | ||
253 | enum sci_status scic_sds_remote_device_suspend(struct scic_sds_remote_device *sci_dev, | 252 | enum sci_status scic_sds_remote_device_suspend(struct scic_sds_remote_device *sci_dev, |
254 | u32 suspend_type) | 253 | u32 suspend_type) |
255 | { | 254 | { |
256 | struct sci_base_state_machine *sm = &sci_dev->state_machine; | 255 | struct sci_base_state_machine *sm = &sci_dev->sm; |
257 | enum scic_sds_remote_device_states state = sm->current_state_id; | 256 | enum scic_sds_remote_device_states state = sm->current_state_id; |
258 | 257 | ||
259 | if (state != SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD) { | 258 | if (state != SCI_STP_DEV_CMD) { |
260 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 259 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", |
261 | __func__, state); | 260 | __func__, state); |
262 | return SCI_FAILURE_INVALID_STATE; | 261 | return SCI_FAILURE_INVALID_STATE; |
@@ -269,30 +268,30 @@ enum sci_status scic_sds_remote_device_suspend(struct scic_sds_remote_device *sc | |||
269 | enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_device *sci_dev, | 268 | enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_device *sci_dev, |
270 | u32 frame_index) | 269 | u32 frame_index) |
271 | { | 270 | { |
272 | struct sci_base_state_machine *sm = &sci_dev->state_machine; | 271 | struct sci_base_state_machine *sm = &sci_dev->sm; |
273 | enum scic_sds_remote_device_states state = sm->current_state_id; | 272 | enum scic_sds_remote_device_states state = sm->current_state_id; |
274 | struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller; | 273 | struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller; |
275 | enum sci_status status; | 274 | enum sci_status status; |
276 | 275 | ||
277 | switch (state) { | 276 | switch (state) { |
278 | case SCI_BASE_REMOTE_DEVICE_STATE_INITIAL: | 277 | case SCI_DEV_INITIAL: |
279 | case SCI_BASE_REMOTE_DEVICE_STATE_STOPPED: | 278 | case SCI_DEV_STOPPED: |
280 | case SCI_BASE_REMOTE_DEVICE_STATE_STARTING: | 279 | case SCI_DEV_STARTING: |
281 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: | 280 | case SCI_STP_DEV_IDLE: |
282 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: | 281 | case SCI_SMP_DEV_IDLE: |
283 | case SCI_BASE_REMOTE_DEVICE_STATE_FINAL: | 282 | case SCI_DEV_FINAL: |
284 | default: | 283 | default: |
285 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 284 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", |
286 | __func__, state); | 285 | __func__, state); |
287 | /* Return the frame back to the controller */ | 286 | /* Return the frame back to the controller */ |
288 | scic_sds_controller_release_frame(scic, frame_index); | 287 | scic_sds_controller_release_frame(scic, frame_index); |
289 | return SCI_FAILURE_INVALID_STATE; | 288 | return SCI_FAILURE_INVALID_STATE; |
290 | case SCI_BASE_REMOTE_DEVICE_STATE_READY: | 289 | case SCI_DEV_READY: |
291 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR: | 290 | case SCI_STP_DEV_NCQ_ERROR: |
292 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET: | 291 | case SCI_STP_DEV_AWAIT_RESET: |
293 | case SCI_BASE_REMOTE_DEVICE_STATE_STOPPING: | 292 | case SCI_DEV_STOPPING: |
294 | case SCI_BASE_REMOTE_DEVICE_STATE_FAILED: | 293 | case SCI_DEV_FAILED: |
295 | case SCI_BASE_REMOTE_DEVICE_STATE_RESETTING: { | 294 | case SCI_DEV_RESETTING: { |
296 | struct scic_sds_request *sci_req; | 295 | struct scic_sds_request *sci_req; |
297 | struct ssp_frame_hdr hdr; | 296 | struct ssp_frame_hdr hdr; |
298 | void *frame_header; | 297 | void *frame_header; |
@@ -319,7 +318,7 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi | |||
319 | } | 318 | } |
320 | break; | 319 | break; |
321 | } | 320 | } |
322 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: { | 321 | case SCI_STP_DEV_NCQ: { |
323 | struct dev_to_host_fis *hdr; | 322 | struct dev_to_host_fis *hdr; |
324 | 323 | ||
325 | status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, | 324 | status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, |
@@ -333,7 +332,7 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi | |||
333 | sci_dev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; | 332 | sci_dev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; |
334 | 333 | ||
335 | /* TODO Check sactive and complete associated IO if any. */ | 334 | /* TODO Check sactive and complete associated IO if any. */ |
336 | sci_base_state_machine_change_state(sm, SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR); | 335 | sci_change_state(sm, SCI_STP_DEV_NCQ_ERROR); |
337 | } else if (hdr->fis_type == FIS_REGD2H && | 336 | } else if (hdr->fis_type == FIS_REGD2H && |
338 | (hdr->status & ATA_ERR)) { | 337 | (hdr->status & ATA_ERR)) { |
339 | /* | 338 | /* |
@@ -341,16 +340,15 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi | |||
341 | * Treat this like an SDB error FIS ready reason. | 340 | * Treat this like an SDB error FIS ready reason. |
342 | */ | 341 | */ |
343 | sci_dev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; | 342 | sci_dev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; |
344 | sci_base_state_machine_change_state(&sci_dev->state_machine, | 343 | sci_change_state(&sci_dev->sm, SCI_STP_DEV_NCQ_ERROR); |
345 | SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR); | ||
346 | } else | 344 | } else |
347 | status = SCI_FAILURE; | 345 | status = SCI_FAILURE; |
348 | 346 | ||
349 | scic_sds_controller_release_frame(scic, frame_index); | 347 | scic_sds_controller_release_frame(scic, frame_index); |
350 | break; | 348 | break; |
351 | } | 349 | } |
352 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD: | 350 | case SCI_STP_DEV_CMD: |
353 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD: | 351 | case SCI_SMP_DEV_CMD: |
354 | /* The device does not process any UF received from the hardware while | 352 | /* The device does not process any UF received from the hardware while |
355 | * in this state. All unsolicited frames are forwarded to the io request | 353 | * in this state. All unsolicited frames are forwarded to the io request |
356 | * object. | 354 | * object. |
@@ -365,18 +363,18 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi | |||
365 | static bool is_remote_device_ready(struct scic_sds_remote_device *sci_dev) | 363 | static bool is_remote_device_ready(struct scic_sds_remote_device *sci_dev) |
366 | { | 364 | { |
367 | 365 | ||
368 | struct sci_base_state_machine *sm = &sci_dev->state_machine; | 366 | struct sci_base_state_machine *sm = &sci_dev->sm; |
369 | enum scic_sds_remote_device_states state = sm->current_state_id; | 367 | enum scic_sds_remote_device_states state = sm->current_state_id; |
370 | 368 | ||
371 | switch (state) { | 369 | switch (state) { |
372 | case SCI_BASE_REMOTE_DEVICE_STATE_READY: | 370 | case SCI_DEV_READY: |
373 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: | 371 | case SCI_STP_DEV_IDLE: |
374 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD: | 372 | case SCI_STP_DEV_CMD: |
375 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: | 373 | case SCI_STP_DEV_NCQ: |
376 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR: | 374 | case SCI_STP_DEV_NCQ_ERROR: |
377 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET: | 375 | case SCI_STP_DEV_AWAIT_RESET: |
378 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: | 376 | case SCI_SMP_DEV_IDLE: |
379 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD: | 377 | case SCI_SMP_DEV_CMD: |
380 | return true; | 378 | return true; |
381 | default: | 379 | default: |
382 | return false; | 380 | return false; |
@@ -386,7 +384,7 @@ static bool is_remote_device_ready(struct scic_sds_remote_device *sci_dev) | |||
386 | enum sci_status scic_sds_remote_device_event_handler(struct scic_sds_remote_device *sci_dev, | 384 | enum sci_status scic_sds_remote_device_event_handler(struct scic_sds_remote_device *sci_dev, |
387 | u32 event_code) | 385 | u32 event_code) |
388 | { | 386 | { |
389 | struct sci_base_state_machine *sm = &sci_dev->state_machine; | 387 | struct sci_base_state_machine *sm = &sci_dev->sm; |
390 | enum scic_sds_remote_device_states state = sm->current_state_id; | 388 | enum scic_sds_remote_device_states state = sm->current_state_id; |
391 | enum sci_status status; | 389 | enum sci_status status; |
392 | 390 | ||
@@ -429,7 +427,7 @@ enum sci_status scic_sds_remote_device_event_handler(struct scic_sds_remote_devi | |||
429 | if (status != SCI_SUCCESS) | 427 | if (status != SCI_SUCCESS) |
430 | return status; | 428 | return status; |
431 | 429 | ||
432 | if (state == SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE) { | 430 | if (state == SCI_STP_DEV_IDLE) { |
433 | 431 | ||
434 | /* We pick up suspension events to handle specifically to this | 432 | /* We pick up suspension events to handle specifically to this |
435 | * state. We resume the RNC right away. | 433 | * state. We resume the RNC right away. |
@@ -459,26 +457,26 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
459 | struct scic_sds_remote_device *sci_dev, | 457 | struct scic_sds_remote_device *sci_dev, |
460 | struct scic_sds_request *sci_req) | 458 | struct scic_sds_request *sci_req) |
461 | { | 459 | { |
462 | struct sci_base_state_machine *sm = &sci_dev->state_machine; | 460 | struct sci_base_state_machine *sm = &sci_dev->sm; |
463 | enum scic_sds_remote_device_states state = sm->current_state_id; | 461 | enum scic_sds_remote_device_states state = sm->current_state_id; |
464 | struct scic_sds_port *sci_port = sci_dev->owning_port; | 462 | struct scic_sds_port *sci_port = sci_dev->owning_port; |
465 | struct isci_request *ireq = sci_req_to_ireq(sci_req); | 463 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
466 | enum sci_status status; | 464 | enum sci_status status; |
467 | 465 | ||
468 | switch (state) { | 466 | switch (state) { |
469 | case SCI_BASE_REMOTE_DEVICE_STATE_INITIAL: | 467 | case SCI_DEV_INITIAL: |
470 | case SCI_BASE_REMOTE_DEVICE_STATE_STOPPED: | 468 | case SCI_DEV_STOPPED: |
471 | case SCI_BASE_REMOTE_DEVICE_STATE_STARTING: | 469 | case SCI_DEV_STARTING: |
472 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR: | 470 | case SCI_STP_DEV_NCQ_ERROR: |
473 | case SCI_BASE_REMOTE_DEVICE_STATE_STOPPING: | 471 | case SCI_DEV_STOPPING: |
474 | case SCI_BASE_REMOTE_DEVICE_STATE_FAILED: | 472 | case SCI_DEV_FAILED: |
475 | case SCI_BASE_REMOTE_DEVICE_STATE_RESETTING: | 473 | case SCI_DEV_RESETTING: |
476 | case SCI_BASE_REMOTE_DEVICE_STATE_FINAL: | 474 | case SCI_DEV_FINAL: |
477 | default: | 475 | default: |
478 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 476 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", |
479 | __func__, state); | 477 | __func__, state); |
480 | return SCI_FAILURE_INVALID_STATE; | 478 | return SCI_FAILURE_INVALID_STATE; |
481 | case SCI_BASE_REMOTE_DEVICE_STATE_READY: | 479 | case SCI_DEV_READY: |
482 | /* attempt to start an io request for this device object. The remote | 480 | /* attempt to start an io request for this device object. The remote |
483 | * device object will issue the start request for the io and if | 481 | * device object will issue the start request for the io and if |
484 | * successful it will start the request for the port object then | 482 | * successful it will start the request for the port object then |
@@ -494,7 +492,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
494 | 492 | ||
495 | status = scic_sds_request_start(sci_req); | 493 | status = scic_sds_request_start(sci_req); |
496 | break; | 494 | break; |
497 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: { | 495 | case SCI_STP_DEV_IDLE: { |
498 | /* handle the start io operation for a sata device that is in | 496 | /* handle the start io operation for a sata device that is in |
499 | * the command idle state. - Evalute the type of IO request to | 497 | * the command idle state. - Evalute the type of IO request to |
500 | * be started - If its an NCQ request change to NCQ substate - | 498 | * be started - If its an NCQ request change to NCQ substate - |
@@ -519,15 +517,15 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
519 | break; | 517 | break; |
520 | 518 | ||
521 | if (task->ata_task.use_ncq) | 519 | if (task->ata_task.use_ncq) |
522 | new_state = SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ; | 520 | new_state = SCI_STP_DEV_NCQ; |
523 | else { | 521 | else { |
524 | sci_dev->working_request = sci_req; | 522 | sci_dev->working_request = sci_req; |
525 | new_state = SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD; | 523 | new_state = SCI_STP_DEV_CMD; |
526 | } | 524 | } |
527 | sci_base_state_machine_change_state(sm, new_state); | 525 | sci_change_state(sm, new_state); |
528 | break; | 526 | break; |
529 | } | 527 | } |
530 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: { | 528 | case SCI_STP_DEV_NCQ: { |
531 | struct sas_task *task = isci_request_access_task(ireq); | 529 | struct sas_task *task = isci_request_access_task(ireq); |
532 | 530 | ||
533 | if (task->ata_task.use_ncq) { | 531 | if (task->ata_task.use_ncq) { |
@@ -544,9 +542,9 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
544 | return SCI_FAILURE_INVALID_STATE; | 542 | return SCI_FAILURE_INVALID_STATE; |
545 | break; | 543 | break; |
546 | } | 544 | } |
547 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET: | 545 | case SCI_STP_DEV_AWAIT_RESET: |
548 | return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; | 546 | return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; |
549 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: | 547 | case SCI_SMP_DEV_IDLE: |
550 | status = scic_sds_port_start_io(sci_port, sci_dev, sci_req); | 548 | status = scic_sds_port_start_io(sci_port, sci_dev, sci_req); |
551 | if (status != SCI_SUCCESS) | 549 | if (status != SCI_SUCCESS) |
552 | return status; | 550 | return status; |
@@ -560,11 +558,10 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
560 | break; | 558 | break; |
561 | 559 | ||
562 | sci_dev->working_request = sci_req; | 560 | sci_dev->working_request = sci_req; |
563 | sci_base_state_machine_change_state(&sci_dev->state_machine, | 561 | sci_change_state(&sci_dev->sm, SCI_SMP_DEV_CMD); |
564 | SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD); | ||
565 | break; | 562 | break; |
566 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD: | 563 | case SCI_STP_DEV_CMD: |
567 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD: | 564 | case SCI_SMP_DEV_CMD: |
568 | /* device is already handling a command it can not accept new commands | 565 | /* device is already handling a command it can not accept new commands |
569 | * until this one is complete. | 566 | * until this one is complete. |
570 | */ | 567 | */ |
@@ -597,31 +594,31 @@ enum sci_status scic_sds_remote_device_complete_io(struct scic_sds_controller *s | |||
597 | struct scic_sds_remote_device *sci_dev, | 594 | struct scic_sds_remote_device *sci_dev, |
598 | struct scic_sds_request *sci_req) | 595 | struct scic_sds_request *sci_req) |
599 | { | 596 | { |
600 | struct sci_base_state_machine *sm = &sci_dev->state_machine; | 597 | struct sci_base_state_machine *sm = &sci_dev->sm; |
601 | enum scic_sds_remote_device_states state = sm->current_state_id; | 598 | enum scic_sds_remote_device_states state = sm->current_state_id; |
602 | struct scic_sds_port *sci_port = sci_dev->owning_port; | 599 | struct scic_sds_port *sci_port = sci_dev->owning_port; |
603 | enum sci_status status; | 600 | enum sci_status status; |
604 | 601 | ||
605 | switch (state) { | 602 | switch (state) { |
606 | case SCI_BASE_REMOTE_DEVICE_STATE_INITIAL: | 603 | case SCI_DEV_INITIAL: |
607 | case SCI_BASE_REMOTE_DEVICE_STATE_STOPPED: | 604 | case SCI_DEV_STOPPED: |
608 | case SCI_BASE_REMOTE_DEVICE_STATE_STARTING: | 605 | case SCI_DEV_STARTING: |
609 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: | 606 | case SCI_STP_DEV_IDLE: |
610 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: | 607 | case SCI_SMP_DEV_IDLE: |
611 | case SCI_BASE_REMOTE_DEVICE_STATE_FAILED: | 608 | case SCI_DEV_FAILED: |
612 | case SCI_BASE_REMOTE_DEVICE_STATE_FINAL: | 609 | case SCI_DEV_FINAL: |
613 | default: | 610 | default: |
614 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 611 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", |
615 | __func__, state); | 612 | __func__, state); |
616 | return SCI_FAILURE_INVALID_STATE; | 613 | return SCI_FAILURE_INVALID_STATE; |
617 | case SCI_BASE_REMOTE_DEVICE_STATE_READY: | 614 | case SCI_DEV_READY: |
618 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET: | 615 | case SCI_STP_DEV_AWAIT_RESET: |
619 | case SCI_BASE_REMOTE_DEVICE_STATE_RESETTING: | 616 | case SCI_DEV_RESETTING: |
620 | status = common_complete_io(sci_port, sci_dev, sci_req); | 617 | status = common_complete_io(sci_port, sci_dev, sci_req); |
621 | break; | 618 | break; |
622 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD: | 619 | case SCI_STP_DEV_CMD: |
623 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: | 620 | case SCI_STP_DEV_NCQ: |
624 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR: | 621 | case SCI_STP_DEV_NCQ_ERROR: |
625 | status = common_complete_io(sci_port, sci_dev, sci_req); | 622 | status = common_complete_io(sci_port, sci_dev, sci_req); |
626 | if (status != SCI_SUCCESS) | 623 | if (status != SCI_SUCCESS) |
627 | break; | 624 | break; |
@@ -632,17 +629,17 @@ enum sci_status scic_sds_remote_device_complete_io(struct scic_sds_controller *s | |||
632 | * can reach RNC state handler, these IOs will be completed by RNC with | 629 | * can reach RNC state handler, these IOs will be completed by RNC with |
633 | * status of "DEVICE_RESET_REQUIRED", instead of "INVALID STATE". | 630 | * status of "DEVICE_RESET_REQUIRED", instead of "INVALID STATE". |
634 | */ | 631 | */ |
635 | sci_base_state_machine_change_state(sm, SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET); | 632 | sci_change_state(sm, SCI_STP_DEV_AWAIT_RESET); |
636 | } else if (scic_sds_remote_device_get_request_count(sci_dev) == 0) | 633 | } else if (scic_sds_remote_device_get_request_count(sci_dev) == 0) |
637 | sci_base_state_machine_change_state(sm, SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE); | 634 | sci_change_state(sm, SCI_STP_DEV_IDLE); |
638 | break; | 635 | break; |
639 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD: | 636 | case SCI_SMP_DEV_CMD: |
640 | status = common_complete_io(sci_port, sci_dev, sci_req); | 637 | status = common_complete_io(sci_port, sci_dev, sci_req); |
641 | if (status != SCI_SUCCESS) | 638 | if (status != SCI_SUCCESS) |
642 | break; | 639 | break; |
643 | sci_base_state_machine_change_state(sm, SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE); | 640 | sci_change_state(sm, SCI_SMP_DEV_IDLE); |
644 | break; | 641 | break; |
645 | case SCI_BASE_REMOTE_DEVICE_STATE_STOPPING: | 642 | case SCI_DEV_STOPPING: |
646 | status = common_complete_io(sci_port, sci_dev, sci_req); | 643 | status = common_complete_io(sci_port, sci_dev, sci_req); |
647 | if (status != SCI_SUCCESS) | 644 | if (status != SCI_SUCCESS) |
648 | break; | 645 | break; |
@@ -676,30 +673,30 @@ enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *sc | |||
676 | struct scic_sds_remote_device *sci_dev, | 673 | struct scic_sds_remote_device *sci_dev, |
677 | struct scic_sds_request *sci_req) | 674 | struct scic_sds_request *sci_req) |
678 | { | 675 | { |
679 | struct sci_base_state_machine *sm = &sci_dev->state_machine; | 676 | struct sci_base_state_machine *sm = &sci_dev->sm; |
680 | enum scic_sds_remote_device_states state = sm->current_state_id; | 677 | enum scic_sds_remote_device_states state = sm->current_state_id; |
681 | struct scic_sds_port *sci_port = sci_dev->owning_port; | 678 | struct scic_sds_port *sci_port = sci_dev->owning_port; |
682 | enum sci_status status; | 679 | enum sci_status status; |
683 | 680 | ||
684 | switch (state) { | 681 | switch (state) { |
685 | case SCI_BASE_REMOTE_DEVICE_STATE_INITIAL: | 682 | case SCI_DEV_INITIAL: |
686 | case SCI_BASE_REMOTE_DEVICE_STATE_STOPPED: | 683 | case SCI_DEV_STOPPED: |
687 | case SCI_BASE_REMOTE_DEVICE_STATE_STARTING: | 684 | case SCI_DEV_STARTING: |
688 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: | 685 | case SCI_SMP_DEV_IDLE: |
689 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD: | 686 | case SCI_SMP_DEV_CMD: |
690 | case SCI_BASE_REMOTE_DEVICE_STATE_STOPPING: | 687 | case SCI_DEV_STOPPING: |
691 | case SCI_BASE_REMOTE_DEVICE_STATE_FAILED: | 688 | case SCI_DEV_FAILED: |
692 | case SCI_BASE_REMOTE_DEVICE_STATE_RESETTING: | 689 | case SCI_DEV_RESETTING: |
693 | case SCI_BASE_REMOTE_DEVICE_STATE_FINAL: | 690 | case SCI_DEV_FINAL: |
694 | default: | 691 | default: |
695 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 692 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", |
696 | __func__, state); | 693 | __func__, state); |
697 | return SCI_FAILURE_INVALID_STATE; | 694 | return SCI_FAILURE_INVALID_STATE; |
698 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: | 695 | case SCI_STP_DEV_IDLE: |
699 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD: | 696 | case SCI_STP_DEV_CMD: |
700 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: | 697 | case SCI_STP_DEV_NCQ: |
701 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR: | 698 | case SCI_STP_DEV_NCQ_ERROR: |
702 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET: | 699 | case SCI_STP_DEV_AWAIT_RESET: |
703 | status = scic_sds_port_start_io(sci_port, sci_dev, sci_req); | 700 | status = scic_sds_port_start_io(sci_port, sci_dev, sci_req); |
704 | if (status != SCI_SUCCESS) | 701 | if (status != SCI_SUCCESS) |
705 | return status; | 702 | return status; |
@@ -717,7 +714,7 @@ enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *sc | |||
717 | * management request. | 714 | * management request. |
718 | */ | 715 | */ |
719 | sci_dev->working_request = sci_req; | 716 | sci_dev->working_request = sci_req; |
720 | sci_base_state_machine_change_state(sm, SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD); | 717 | sci_change_state(sm, SCI_STP_DEV_CMD); |
721 | 718 | ||
722 | /* The remote node context must cleanup the TCi to NCQ mapping | 719 | /* The remote node context must cleanup the TCi to NCQ mapping |
723 | * table. The only way to do this correctly is to either write | 720 | * table. The only way to do this correctly is to either write |
@@ -739,7 +736,7 @@ enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *sc | |||
739 | * post TC when RNC gets resumed. | 736 | * post TC when RNC gets resumed. |
740 | */ | 737 | */ |
741 | return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS; | 738 | return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS; |
742 | case SCI_BASE_REMOTE_DEVICE_STATE_READY: | 739 | case SCI_DEV_READY: |
743 | status = scic_sds_port_start_io(sci_port, sci_dev, sci_req); | 740 | status = scic_sds_port_start_io(sci_port, sci_dev, sci_req); |
744 | if (status != SCI_SUCCESS) | 741 | if (status != SCI_SUCCESS) |
745 | return status; | 742 | return status; |
@@ -790,8 +787,7 @@ static void remote_device_resume_done(void *_dev) | |||
790 | return; | 787 | return; |
791 | 788 | ||
792 | /* go 'ready' if we are not already in a ready state */ | 789 | /* go 'ready' if we are not already in a ready state */ |
793 | sci_base_state_machine_change_state(&sci_dev->state_machine, | 790 | sci_change_state(&sci_dev->sm, SCI_DEV_READY); |
794 | SCI_BASE_REMOTE_DEVICE_STATE_READY); | ||
795 | } | 791 | } |
796 | 792 | ||
797 | static void scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(void *_dev) | 793 | static void scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(void *_dev) |
@@ -803,17 +799,16 @@ static void scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handl | |||
803 | /* For NCQ operation we do not issue a isci_remote_device_not_ready(). | 799 | /* For NCQ operation we do not issue a isci_remote_device_not_ready(). |
804 | * As a result, avoid sending the ready notification. | 800 | * As a result, avoid sending the ready notification. |
805 | */ | 801 | */ |
806 | if (sci_dev->state_machine.previous_state_id != SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ) | 802 | if (sci_dev->sm.previous_state_id != SCI_STP_DEV_NCQ) |
807 | isci_remote_device_ready(scic_to_ihost(scic), idev); | 803 | isci_remote_device_ready(scic_to_ihost(scic), idev); |
808 | } | 804 | } |
809 | 805 | ||
810 | static void scic_sds_remote_device_initial_state_enter(struct sci_base_state_machine *sm) | 806 | static void scic_sds_remote_device_initial_state_enter(struct sci_base_state_machine *sm) |
811 | { | 807 | { |
812 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine); | 808 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); |
813 | 809 | ||
814 | /* Initial state is a transitional state to the stopped state */ | 810 | /* Initial state is a transitional state to the stopped state */ |
815 | sci_base_state_machine_change_state(&sci_dev->state_machine, | 811 | sci_change_state(&sci_dev->sm, SCI_DEV_STOPPED); |
816 | SCI_BASE_REMOTE_DEVICE_STATE_STOPPED); | ||
817 | } | 812 | } |
818 | 813 | ||
819 | /** | 814 | /** |
@@ -831,11 +826,11 @@ static void scic_sds_remote_device_initial_state_enter(struct sci_base_state_mac | |||
831 | */ | 826 | */ |
832 | static enum sci_status scic_remote_device_destruct(struct scic_sds_remote_device *sci_dev) | 827 | static enum sci_status scic_remote_device_destruct(struct scic_sds_remote_device *sci_dev) |
833 | { | 828 | { |
834 | struct sci_base_state_machine *sm = &sci_dev->state_machine; | 829 | struct sci_base_state_machine *sm = &sci_dev->sm; |
835 | enum scic_sds_remote_device_states state = sm->current_state_id; | 830 | enum scic_sds_remote_device_states state = sm->current_state_id; |
836 | struct scic_sds_controller *scic; | 831 | struct scic_sds_controller *scic; |
837 | 832 | ||
838 | if (state != SCI_BASE_REMOTE_DEVICE_STATE_STOPPED) { | 833 | if (state != SCI_DEV_STOPPED) { |
839 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 834 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", |
840 | __func__, state); | 835 | __func__, state); |
841 | return SCI_FAILURE_INVALID_STATE; | 836 | return SCI_FAILURE_INVALID_STATE; |
@@ -845,7 +840,7 @@ static enum sci_status scic_remote_device_destruct(struct scic_sds_remote_device | |||
845 | scic_sds_controller_free_remote_node_context(scic, sci_dev, | 840 | scic_sds_controller_free_remote_node_context(scic, sci_dev, |
846 | sci_dev->rnc.remote_node_index); | 841 | sci_dev->rnc.remote_node_index); |
847 | sci_dev->rnc.remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX; | 842 | sci_dev->rnc.remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX; |
848 | sci_base_state_machine_change_state(sm, SCI_BASE_REMOTE_DEVICE_STATE_FINAL); | 843 | sci_change_state(sm, SCI_DEV_FINAL); |
849 | 844 | ||
850 | return SCI_SUCCESS; | 845 | return SCI_SUCCESS; |
851 | } | 846 | } |
@@ -906,7 +901,7 @@ static void isci_remote_device_stop_complete(struct isci_host *ihost, | |||
906 | 901 | ||
907 | static void scic_sds_remote_device_stopped_state_enter(struct sci_base_state_machine *sm) | 902 | static void scic_sds_remote_device_stopped_state_enter(struct sci_base_state_machine *sm) |
908 | { | 903 | { |
909 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine); | 904 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); |
910 | struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller; | 905 | struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller; |
911 | struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); | 906 | struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); |
912 | u32 prev_state; | 907 | u32 prev_state; |
@@ -914,8 +909,8 @@ static void scic_sds_remote_device_stopped_state_enter(struct sci_base_state_mac | |||
914 | /* If we are entering from the stopping state let the SCI User know that | 909 | /* If we are entering from the stopping state let the SCI User know that |
915 | * the stop operation has completed. | 910 | * the stop operation has completed. |
916 | */ | 911 | */ |
917 | prev_state = sci_dev->state_machine.previous_state_id; | 912 | prev_state = sci_dev->sm.previous_state_id; |
918 | if (prev_state == SCI_BASE_REMOTE_DEVICE_STATE_STOPPING) | 913 | if (prev_state == SCI_DEV_STOPPING) |
919 | isci_remote_device_stop_complete(scic_to_ihost(scic), idev); | 914 | isci_remote_device_stop_complete(scic_to_ihost(scic), idev); |
920 | 915 | ||
921 | scic_sds_controller_remote_device_stopped(scic, sci_dev); | 916 | scic_sds_controller_remote_device_stopped(scic, sci_dev); |
@@ -923,7 +918,7 @@ static void scic_sds_remote_device_stopped_state_enter(struct sci_base_state_mac | |||
923 | 918 | ||
924 | static void scic_sds_remote_device_starting_state_enter(struct sci_base_state_machine *sm) | 919 | static void scic_sds_remote_device_starting_state_enter(struct sci_base_state_machine *sm) |
925 | { | 920 | { |
926 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine); | 921 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); |
927 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); | 922 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); |
928 | struct isci_host *ihost = scic_to_ihost(scic); | 923 | struct isci_host *ihost = scic_to_ihost(scic); |
929 | struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); | 924 | struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); |
@@ -934,7 +929,7 @@ static void scic_sds_remote_device_starting_state_enter(struct sci_base_state_ma | |||
934 | 929 | ||
935 | static void scic_sds_remote_device_ready_state_enter(struct sci_base_state_machine *sm) | 930 | static void scic_sds_remote_device_ready_state_enter(struct sci_base_state_machine *sm) |
936 | { | 931 | { |
937 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine); | 932 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); |
938 | struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller; | 933 | struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller; |
939 | struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); | 934 | struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); |
940 | struct domain_device *dev = idev->domain_dev; | 935 | struct domain_device *dev = idev->domain_dev; |
@@ -942,18 +937,16 @@ static void scic_sds_remote_device_ready_state_enter(struct sci_base_state_machi | |||
942 | scic->remote_device_sequence[sci_dev->rnc.remote_node_index]++; | 937 | scic->remote_device_sequence[sci_dev->rnc.remote_node_index]++; |
943 | 938 | ||
944 | if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_SATA)) { | 939 | if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_SATA)) { |
945 | sci_base_state_machine_change_state(&sci_dev->state_machine, | 940 | sci_change_state(&sci_dev->sm, SCI_STP_DEV_IDLE); |
946 | SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE); | ||
947 | } else if (dev_is_expander(dev)) { | 941 | } else if (dev_is_expander(dev)) { |
948 | sci_base_state_machine_change_state(&sci_dev->state_machine, | 942 | sci_change_state(&sci_dev->sm, SCI_SMP_DEV_IDLE); |
949 | SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE); | ||
950 | } else | 943 | } else |
951 | isci_remote_device_ready(scic_to_ihost(scic), idev); | 944 | isci_remote_device_ready(scic_to_ihost(scic), idev); |
952 | } | 945 | } |
953 | 946 | ||
954 | static void scic_sds_remote_device_ready_state_exit(struct sci_base_state_machine *sm) | 947 | static void scic_sds_remote_device_ready_state_exit(struct sci_base_state_machine *sm) |
955 | { | 948 | { |
956 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine); | 949 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); |
957 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 950 | struct domain_device *dev = sci_dev_to_domain(sci_dev); |
958 | 951 | ||
959 | if (dev->dev_type == SAS_END_DEV) { | 952 | if (dev->dev_type == SAS_END_DEV) { |
@@ -967,7 +960,7 @@ static void scic_sds_remote_device_ready_state_exit(struct sci_base_state_machin | |||
967 | 960 | ||
968 | static void scic_sds_remote_device_resetting_state_enter(struct sci_base_state_machine *sm) | 961 | static void scic_sds_remote_device_resetting_state_enter(struct sci_base_state_machine *sm) |
969 | { | 962 | { |
970 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine); | 963 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); |
971 | 964 | ||
972 | scic_sds_remote_node_context_suspend( | 965 | scic_sds_remote_node_context_suspend( |
973 | &sci_dev->rnc, SCI_SOFTWARE_SUSPENSION, NULL, NULL); | 966 | &sci_dev->rnc, SCI_SOFTWARE_SUSPENSION, NULL, NULL); |
@@ -975,14 +968,14 @@ static void scic_sds_remote_device_resetting_state_enter(struct sci_base_state_m | |||
975 | 968 | ||
976 | static void scic_sds_remote_device_resetting_state_exit(struct sci_base_state_machine *sm) | 969 | static void scic_sds_remote_device_resetting_state_exit(struct sci_base_state_machine *sm) |
977 | { | 970 | { |
978 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine); | 971 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); |
979 | 972 | ||
980 | scic_sds_remote_node_context_resume(&sci_dev->rnc, NULL, NULL); | 973 | scic_sds_remote_node_context_resume(&sci_dev->rnc, NULL, NULL); |
981 | } | 974 | } |
982 | 975 | ||
983 | static void scic_sds_stp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm) | 976 | static void scic_sds_stp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm) |
984 | { | 977 | { |
985 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine); | 978 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); |
986 | 979 | ||
987 | sci_dev->working_request = NULL; | 980 | sci_dev->working_request = NULL; |
988 | if (scic_sds_remote_node_context_is_ready(&sci_dev->rnc)) { | 981 | if (scic_sds_remote_node_context_is_ready(&sci_dev->rnc)) { |
@@ -999,7 +992,7 @@ static void scic_sds_stp_remote_device_ready_idle_substate_enter(struct sci_base | |||
999 | 992 | ||
1000 | static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) | 993 | static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) |
1001 | { | 994 | { |
1002 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine); | 995 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); |
1003 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); | 996 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); |
1004 | 997 | ||
1005 | BUG_ON(sci_dev->working_request == NULL); | 998 | BUG_ON(sci_dev->working_request == NULL); |
@@ -1010,7 +1003,7 @@ static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_ | |||
1010 | 1003 | ||
1011 | static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base_state_machine *sm) | 1004 | static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base_state_machine *sm) |
1012 | { | 1005 | { |
1013 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine); | 1006 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); |
1014 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); | 1007 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); |
1015 | struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); | 1008 | struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); |
1016 | 1009 | ||
@@ -1021,7 +1014,7 @@ static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(struct sci | |||
1021 | 1014 | ||
1022 | static void scic_sds_smp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm) | 1015 | static void scic_sds_smp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm) |
1023 | { | 1016 | { |
1024 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine); | 1017 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); |
1025 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); | 1018 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); |
1026 | 1019 | ||
1027 | isci_remote_device_ready(scic_to_ihost(scic), sci_dev_to_idev(sci_dev)); | 1020 | isci_remote_device_ready(scic_to_ihost(scic), sci_dev_to_idev(sci_dev)); |
@@ -1029,7 +1022,7 @@ static void scic_sds_smp_remote_device_ready_idle_substate_enter(struct sci_base | |||
1029 | 1022 | ||
1030 | static void scic_sds_smp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) | 1023 | static void scic_sds_smp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) |
1031 | { | 1024 | { |
1032 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine); | 1025 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); |
1033 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); | 1026 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); |
1034 | 1027 | ||
1035 | BUG_ON(sci_dev->working_request == NULL); | 1028 | BUG_ON(sci_dev->working_request == NULL); |
@@ -1040,50 +1033,50 @@ static void scic_sds_smp_remote_device_ready_cmd_substate_enter(struct sci_base_ | |||
1040 | 1033 | ||
1041 | static void scic_sds_smp_remote_device_ready_cmd_substate_exit(struct sci_base_state_machine *sm) | 1034 | static void scic_sds_smp_remote_device_ready_cmd_substate_exit(struct sci_base_state_machine *sm) |
1042 | { | 1035 | { |
1043 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), state_machine); | 1036 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); |
1044 | 1037 | ||
1045 | sci_dev->working_request = NULL; | 1038 | sci_dev->working_request = NULL; |
1046 | } | 1039 | } |
1047 | 1040 | ||
1048 | static const struct sci_base_state scic_sds_remote_device_state_table[] = { | 1041 | static const struct sci_base_state scic_sds_remote_device_state_table[] = { |
1049 | [SCI_BASE_REMOTE_DEVICE_STATE_INITIAL] = { | 1042 | [SCI_DEV_INITIAL] = { |
1050 | .enter_state = scic_sds_remote_device_initial_state_enter, | 1043 | .enter_state = scic_sds_remote_device_initial_state_enter, |
1051 | }, | 1044 | }, |
1052 | [SCI_BASE_REMOTE_DEVICE_STATE_STOPPED] = { | 1045 | [SCI_DEV_STOPPED] = { |
1053 | .enter_state = scic_sds_remote_device_stopped_state_enter, | 1046 | .enter_state = scic_sds_remote_device_stopped_state_enter, |
1054 | }, | 1047 | }, |
1055 | [SCI_BASE_REMOTE_DEVICE_STATE_STARTING] = { | 1048 | [SCI_DEV_STARTING] = { |
1056 | .enter_state = scic_sds_remote_device_starting_state_enter, | 1049 | .enter_state = scic_sds_remote_device_starting_state_enter, |
1057 | }, | 1050 | }, |
1058 | [SCI_BASE_REMOTE_DEVICE_STATE_READY] = { | 1051 | [SCI_DEV_READY] = { |
1059 | .enter_state = scic_sds_remote_device_ready_state_enter, | 1052 | .enter_state = scic_sds_remote_device_ready_state_enter, |
1060 | .exit_state = scic_sds_remote_device_ready_state_exit | 1053 | .exit_state = scic_sds_remote_device_ready_state_exit |
1061 | }, | 1054 | }, |
1062 | [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = { | 1055 | [SCI_STP_DEV_IDLE] = { |
1063 | .enter_state = scic_sds_stp_remote_device_ready_idle_substate_enter, | 1056 | .enter_state = scic_sds_stp_remote_device_ready_idle_substate_enter, |
1064 | }, | 1057 | }, |
1065 | [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = { | 1058 | [SCI_STP_DEV_CMD] = { |
1066 | .enter_state = scic_sds_stp_remote_device_ready_cmd_substate_enter, | 1059 | .enter_state = scic_sds_stp_remote_device_ready_cmd_substate_enter, |
1067 | }, | 1060 | }, |
1068 | [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ] = { }, | 1061 | [SCI_STP_DEV_NCQ] = { }, |
1069 | [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR] = { | 1062 | [SCI_STP_DEV_NCQ_ERROR] = { |
1070 | .enter_state = scic_sds_stp_remote_device_ready_ncq_error_substate_enter, | 1063 | .enter_state = scic_sds_stp_remote_device_ready_ncq_error_substate_enter, |
1071 | }, | 1064 | }, |
1072 | [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET] = { }, | 1065 | [SCI_STP_DEV_AWAIT_RESET] = { }, |
1073 | [SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = { | 1066 | [SCI_SMP_DEV_IDLE] = { |
1074 | .enter_state = scic_sds_smp_remote_device_ready_idle_substate_enter, | 1067 | .enter_state = scic_sds_smp_remote_device_ready_idle_substate_enter, |
1075 | }, | 1068 | }, |
1076 | [SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = { | 1069 | [SCI_SMP_DEV_CMD] = { |
1077 | .enter_state = scic_sds_smp_remote_device_ready_cmd_substate_enter, | 1070 | .enter_state = scic_sds_smp_remote_device_ready_cmd_substate_enter, |
1078 | .exit_state = scic_sds_smp_remote_device_ready_cmd_substate_exit, | 1071 | .exit_state = scic_sds_smp_remote_device_ready_cmd_substate_exit, |
1079 | }, | 1072 | }, |
1080 | [SCI_BASE_REMOTE_DEVICE_STATE_STOPPING] = { }, | 1073 | [SCI_DEV_STOPPING] = { }, |
1081 | [SCI_BASE_REMOTE_DEVICE_STATE_FAILED] = { }, | 1074 | [SCI_DEV_FAILED] = { }, |
1082 | [SCI_BASE_REMOTE_DEVICE_STATE_RESETTING] = { | 1075 | [SCI_DEV_RESETTING] = { |
1083 | .enter_state = scic_sds_remote_device_resetting_state_enter, | 1076 | .enter_state = scic_sds_remote_device_resetting_state_enter, |
1084 | .exit_state = scic_sds_remote_device_resetting_state_exit | 1077 | .exit_state = scic_sds_remote_device_resetting_state_exit |
1085 | }, | 1078 | }, |
1086 | [SCI_BASE_REMOTE_DEVICE_STATE_FINAL] = { }, | 1079 | [SCI_DEV_FINAL] = { }, |
1087 | }; | 1080 | }; |
1088 | 1081 | ||
1089 | /** | 1082 | /** |
@@ -1102,11 +1095,11 @@ static void scic_remote_device_construct(struct scic_sds_port *sci_port, | |||
1102 | sci_dev->owning_port = sci_port; | 1095 | sci_dev->owning_port = sci_port; |
1103 | sci_dev->started_request_count = 0; | 1096 | sci_dev->started_request_count = 0; |
1104 | 1097 | ||
1105 | sci_base_state_machine_construct(&sci_dev->state_machine, | 1098 | sci_base_state_machine_construct(&sci_dev->sm, |
1106 | scic_sds_remote_device_state_table, | 1099 | scic_sds_remote_device_state_table, |
1107 | SCI_BASE_REMOTE_DEVICE_STATE_INITIAL); | 1100 | SCI_DEV_INITIAL); |
1108 | 1101 | ||
1109 | sci_base_state_machine_start(&sci_dev->state_machine); | 1102 | sci_base_state_machine_start(&sci_dev->sm); |
1110 | 1103 | ||
1111 | scic_sds_remote_node_context_construct(&sci_dev->rnc, | 1104 | scic_sds_remote_node_context_construct(&sci_dev->rnc, |
1112 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX); | 1105 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX); |
@@ -1224,11 +1217,11 @@ static enum sci_status scic_remote_device_ea_construct(struct scic_sds_port *sci | |||
1224 | static enum sci_status scic_remote_device_start(struct scic_sds_remote_device *sci_dev, | 1217 | static enum sci_status scic_remote_device_start(struct scic_sds_remote_device *sci_dev, |
1225 | u32 timeout) | 1218 | u32 timeout) |
1226 | { | 1219 | { |
1227 | struct sci_base_state_machine *sm = &sci_dev->state_machine; | 1220 | struct sci_base_state_machine *sm = &sci_dev->sm; |
1228 | enum scic_sds_remote_device_states state = sm->current_state_id; | 1221 | enum scic_sds_remote_device_states state = sm->current_state_id; |
1229 | enum sci_status status; | 1222 | enum sci_status status; |
1230 | 1223 | ||
1231 | if (state != SCI_BASE_REMOTE_DEVICE_STATE_STOPPED) { | 1224 | if (state != SCI_DEV_STOPPED) { |
1232 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 1225 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", |
1233 | __func__, state); | 1226 | __func__, state); |
1234 | return SCI_FAILURE_INVALID_STATE; | 1227 | return SCI_FAILURE_INVALID_STATE; |
@@ -1240,7 +1233,7 @@ static enum sci_status scic_remote_device_start(struct scic_sds_remote_device *s | |||
1240 | if (status != SCI_SUCCESS) | 1233 | if (status != SCI_SUCCESS) |
1241 | return status; | 1234 | return status; |
1242 | 1235 | ||
1243 | sci_base_state_machine_change_state(sm, SCI_BASE_REMOTE_DEVICE_STATE_STARTING); | 1236 | sci_change_state(sm, SCI_DEV_STARTING); |
1244 | 1237 | ||
1245 | return SCI_SUCCESS; | 1238 | return SCI_SUCCESS; |
1246 | } | 1239 | } |
diff --git a/drivers/scsi/isci/remote_device.h b/drivers/scsi/isci/remote_device.h index a118f5873f64..2b6a5bb7bd60 100644 --- a/drivers/scsi/isci/remote_device.h +++ b/drivers/scsi/isci/remote_device.h | |||
@@ -74,7 +74,7 @@ struct scic_sds_remote_device { | |||
74 | * This field contains the information for the base remote device state | 74 | * This field contains the information for the base remote device state |
75 | * machine. | 75 | * machine. |
76 | */ | 76 | */ |
77 | struct sci_base_state_machine state_machine; | 77 | struct sci_base_state_machine sm; |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * This field is the programmed device port width. This value is | 80 | * This field is the programmed device port width. This value is |
@@ -109,7 +109,7 @@ struct scic_sds_remote_device { | |||
109 | 109 | ||
110 | /** | 110 | /** |
111 | * This field contains the stated request count for the remote device. The | 111 | * This field contains the stated request count for the remote device. The |
112 | * device can not reach the SCI_BASE_REMOTE_DEVICE_STATE_STOPPED until all | 112 | * device can not reach the SCI_DEV_STOPPED until all |
113 | * requests are complete and the rnc_posted value is false. | 113 | * requests are complete and the rnc_posted value is false. |
114 | */ | 114 | */ |
115 | u32 started_request_count; | 115 | u32 started_request_count; |
@@ -213,7 +213,7 @@ enum scic_sds_remote_device_states { | |||
213 | /** | 213 | /** |
214 | * Simply the initial state for the base remote device state machine. | 214 | * Simply the initial state for the base remote device state machine. |
215 | */ | 215 | */ |
216 | SCI_BASE_REMOTE_DEVICE_STATE_INITIAL, | 216 | SCI_DEV_INITIAL, |
217 | 217 | ||
218 | /** | 218 | /** |
219 | * This state indicates that the remote device has successfully been | 219 | * This state indicates that the remote device has successfully been |
@@ -221,7 +221,7 @@ enum scic_sds_remote_device_states { | |||
221 | * This state is entered from the INITIAL state. | 221 | * This state is entered from the INITIAL state. |
222 | * This state is entered from the STOPPING state. | 222 | * This state is entered from the STOPPING state. |
223 | */ | 223 | */ |
224 | SCI_BASE_REMOTE_DEVICE_STATE_STOPPED, | 224 | SCI_DEV_STOPPED, |
225 | 225 | ||
226 | /** | 226 | /** |
227 | * This state indicates the the remote device is in the process of | 227 | * This state indicates the the remote device is in the process of |
@@ -229,34 +229,34 @@ enum scic_sds_remote_device_states { | |||
229 | * are permitted. | 229 | * are permitted. |
230 | * This state is entered from the STOPPED state. | 230 | * This state is entered from the STOPPED state. |
231 | */ | 231 | */ |
232 | SCI_BASE_REMOTE_DEVICE_STATE_STARTING, | 232 | SCI_DEV_STARTING, |
233 | 233 | ||
234 | /** | 234 | /** |
235 | * This state indicates the remote device is now ready. Thus, the user | 235 | * This state indicates the remote device is now ready. Thus, the user |
236 | * is able to perform IO operations on the remote device. | 236 | * is able to perform IO operations on the remote device. |
237 | * This state is entered from the STARTING state. | 237 | * This state is entered from the STARTING state. |
238 | */ | 238 | */ |
239 | SCI_BASE_REMOTE_DEVICE_STATE_READY, | 239 | SCI_DEV_READY, |
240 | 240 | ||
241 | /** | 241 | /** |
242 | * This is the idle substate for the stp remote device. When there are no | 242 | * This is the idle substate for the stp remote device. When there are no |
243 | * active IO for the device it is is in this state. | 243 | * active IO for the device it is is in this state. |
244 | */ | 244 | */ |
245 | SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE, | 245 | SCI_STP_DEV_IDLE, |
246 | 246 | ||
247 | /** | 247 | /** |
248 | * This is the command state for for the STP remote device. This state is | 248 | * This is the command state for for the STP remote device. This state is |
249 | * entered when the device is processing a non-NCQ command. The device object | 249 | * entered when the device is processing a non-NCQ command. The device object |
250 | * will fail any new start IO requests until this command is complete. | 250 | * will fail any new start IO requests until this command is complete. |
251 | */ | 251 | */ |
252 | SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD, | 252 | SCI_STP_DEV_CMD, |
253 | 253 | ||
254 | /** | 254 | /** |
255 | * This is the NCQ state for the STP remote device. This state is entered | 255 | * This is the NCQ state for the STP remote device. This state is entered |
256 | * when the device is processing an NCQ reuqest. It will remain in this state | 256 | * when the device is processing an NCQ reuqest. It will remain in this state |
257 | * so long as there is one or more NCQ requests being processed. | 257 | * so long as there is one or more NCQ requests being processed. |
258 | */ | 258 | */ |
259 | SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ, | 259 | SCI_STP_DEV_NCQ, |
260 | 260 | ||
261 | /** | 261 | /** |
262 | * This is the NCQ error state for the STP remote device. This state is | 262 | * This is the NCQ error state for the STP remote device. This state is |
@@ -264,25 +264,25 @@ enum scic_sds_remote_device_states { | |||
264 | * NCQ state. The device object will only accept a READ LOG command while in | 264 | * NCQ state. The device object will only accept a READ LOG command while in |
265 | * this state. | 265 | * this state. |
266 | */ | 266 | */ |
267 | SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR, | 267 | SCI_STP_DEV_NCQ_ERROR, |
268 | 268 | ||
269 | /** | 269 | /** |
270 | * This is the READY substate indicates the device is waiting for the RESET task | 270 | * This is the READY substate indicates the device is waiting for the RESET task |
271 | * coming to be recovered from certain hardware specific error. | 271 | * coming to be recovered from certain hardware specific error. |
272 | */ | 272 | */ |
273 | SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET, | 273 | SCI_STP_DEV_AWAIT_RESET, |
274 | 274 | ||
275 | /** | 275 | /** |
276 | * This is the ready operational substate for the remote device. This is the | 276 | * This is the ready operational substate for the remote device. This is the |
277 | * normal operational state for a remote device. | 277 | * normal operational state for a remote device. |
278 | */ | 278 | */ |
279 | SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE, | 279 | SCI_SMP_DEV_IDLE, |
280 | 280 | ||
281 | /** | 281 | /** |
282 | * This is the suspended state for the remote device. This is the state that | 282 | * This is the suspended state for the remote device. This is the state that |
283 | * the device is placed in when a RNC suspend is received by the SCU hardware. | 283 | * the device is placed in when a RNC suspend is received by the SCU hardware. |
284 | */ | 284 | */ |
285 | SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD, | 285 | SCI_SMP_DEV_CMD, |
286 | 286 | ||
287 | /** | 287 | /** |
288 | * This state indicates that the remote device is in the process of | 288 | * This state indicates that the remote device is in the process of |
@@ -291,7 +291,7 @@ enum scic_sds_remote_device_states { | |||
291 | * This state is entered from the READY state. | 291 | * This state is entered from the READY state. |
292 | * This state is entered from the FAILED state. | 292 | * This state is entered from the FAILED state. |
293 | */ | 293 | */ |
294 | SCI_BASE_REMOTE_DEVICE_STATE_STOPPING, | 294 | SCI_DEV_STOPPING, |
295 | 295 | ||
296 | /** | 296 | /** |
297 | * This state indicates that the remote device has failed. | 297 | * This state indicates that the remote device has failed. |
@@ -299,19 +299,19 @@ enum scic_sds_remote_device_states { | |||
299 | * This state is entered from the INITIALIZING state. | 299 | * This state is entered from the INITIALIZING state. |
300 | * This state is entered from the READY state. | 300 | * This state is entered from the READY state. |
301 | */ | 301 | */ |
302 | SCI_BASE_REMOTE_DEVICE_STATE_FAILED, | 302 | SCI_DEV_FAILED, |
303 | 303 | ||
304 | /** | 304 | /** |
305 | * This state indicates the device is being reset. | 305 | * This state indicates the device is being reset. |
306 | * In this state no new IO operations are permitted. | 306 | * In this state no new IO operations are permitted. |
307 | * This state is entered from the READY state. | 307 | * This state is entered from the READY state. |
308 | */ | 308 | */ |
309 | SCI_BASE_REMOTE_DEVICE_STATE_RESETTING, | 309 | SCI_DEV_RESETTING, |
310 | 310 | ||
311 | /** | 311 | /** |
312 | * Simply the final state for the base remote device state machine. | 312 | * Simply the final state for the base remote device state machine. |
313 | */ | 313 | */ |
314 | SCI_BASE_REMOTE_DEVICE_STATE_FINAL, | 314 | SCI_DEV_FINAL, |
315 | }; | 315 | }; |
316 | 316 | ||
317 | static inline struct scic_sds_remote_device *rnc_to_dev(struct scic_sds_remote_node_context *rnc) | 317 | static inline struct scic_sds_remote_device *rnc_to_dev(struct scic_sds_remote_node_context *rnc) |
diff --git a/drivers/scsi/isci/remote_node_context.c b/drivers/scsi/isci/remote_node_context.c index e7fa5bac7d53..24b1d8acf7b8 100644 --- a/drivers/scsi/isci/remote_node_context.c +++ b/drivers/scsi/isci/remote_node_context.c | |||
@@ -84,9 +84,9 @@ | |||
84 | bool scic_sds_remote_node_context_is_ready( | 84 | bool scic_sds_remote_node_context_is_ready( |
85 | struct scic_sds_remote_node_context *sci_rnc) | 85 | struct scic_sds_remote_node_context *sci_rnc) |
86 | { | 86 | { |
87 | u32 current_state = sci_base_state_machine_get_state(&sci_rnc->state_machine); | 87 | u32 current_state = sci_rnc->sm.current_state_id; |
88 | 88 | ||
89 | if (current_state == SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE) { | 89 | if (current_state == SCI_RNC_READY) { |
90 | return true; | 90 | return true; |
91 | } | 91 | } |
92 | 92 | ||
@@ -268,12 +268,12 @@ static void scic_sds_remote_node_context_invalidate_context_buffer( | |||
268 | 268 | ||
269 | static void scic_sds_remote_node_context_initial_state_enter(struct sci_base_state_machine *sm) | 269 | static void scic_sds_remote_node_context_initial_state_enter(struct sci_base_state_machine *sm) |
270 | { | 270 | { |
271 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine); | 271 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), sm); |
272 | 272 | ||
273 | /* Check to see if we have gotten back to the initial state because | 273 | /* Check to see if we have gotten back to the initial state because |
274 | * someone requested to destroy the remote node context object. | 274 | * someone requested to destroy the remote node context object. |
275 | */ | 275 | */ |
276 | if (sm->previous_state_id == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE) { | 276 | if (sm->previous_state_id == SCI_RNC_INVALIDATING) { |
277 | rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED; | 277 | rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED; |
278 | scic_sds_remote_node_context_notify_user(rnc); | 278 | scic_sds_remote_node_context_notify_user(rnc); |
279 | } | 279 | } |
@@ -281,21 +281,21 @@ static void scic_sds_remote_node_context_initial_state_enter(struct sci_base_sta | |||
281 | 281 | ||
282 | static void scic_sds_remote_node_context_posting_state_enter(struct sci_base_state_machine *sm) | 282 | static void scic_sds_remote_node_context_posting_state_enter(struct sci_base_state_machine *sm) |
283 | { | 283 | { |
284 | struct scic_sds_remote_node_context *sci_rnc = container_of(sm, typeof(*sci_rnc), state_machine); | 284 | struct scic_sds_remote_node_context *sci_rnc = container_of(sm, typeof(*sci_rnc), sm); |
285 | 285 | ||
286 | scic_sds_remote_node_context_validate_context_buffer(sci_rnc); | 286 | scic_sds_remote_node_context_validate_context_buffer(sci_rnc); |
287 | } | 287 | } |
288 | 288 | ||
289 | static void scic_sds_remote_node_context_invalidating_state_enter(struct sci_base_state_machine *sm) | 289 | static void scic_sds_remote_node_context_invalidating_state_enter(struct sci_base_state_machine *sm) |
290 | { | 290 | { |
291 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine); | 291 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), sm); |
292 | 292 | ||
293 | scic_sds_remote_node_context_invalidate_context_buffer(rnc); | 293 | scic_sds_remote_node_context_invalidate_context_buffer(rnc); |
294 | } | 294 | } |
295 | 295 | ||
296 | static void scic_sds_remote_node_context_resuming_state_enter(struct sci_base_state_machine *sm) | 296 | static void scic_sds_remote_node_context_resuming_state_enter(struct sci_base_state_machine *sm) |
297 | { | 297 | { |
298 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine); | 298 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), sm); |
299 | struct scic_sds_remote_device *sci_dev; | 299 | struct scic_sds_remote_device *sci_dev; |
300 | struct domain_device *dev; | 300 | struct domain_device *dev; |
301 | 301 | ||
@@ -318,7 +318,7 @@ static void scic_sds_remote_node_context_resuming_state_enter(struct sci_base_st | |||
318 | 318 | ||
319 | static void scic_sds_remote_node_context_ready_state_enter(struct sci_base_state_machine *sm) | 319 | static void scic_sds_remote_node_context_ready_state_enter(struct sci_base_state_machine *sm) |
320 | { | 320 | { |
321 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine); | 321 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), sm); |
322 | 322 | ||
323 | rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED; | 323 | rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED; |
324 | 324 | ||
@@ -328,41 +328,41 @@ static void scic_sds_remote_node_context_ready_state_enter(struct sci_base_state | |||
328 | 328 | ||
329 | static void scic_sds_remote_node_context_tx_suspended_state_enter(struct sci_base_state_machine *sm) | 329 | static void scic_sds_remote_node_context_tx_suspended_state_enter(struct sci_base_state_machine *sm) |
330 | { | 330 | { |
331 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine); | 331 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), sm); |
332 | 332 | ||
333 | scic_sds_remote_node_context_continue_state_transitions(rnc); | 333 | scic_sds_remote_node_context_continue_state_transitions(rnc); |
334 | } | 334 | } |
335 | 335 | ||
336 | static void scic_sds_remote_node_context_tx_rx_suspended_state_enter(struct sci_base_state_machine *sm) | 336 | static void scic_sds_remote_node_context_tx_rx_suspended_state_enter(struct sci_base_state_machine *sm) |
337 | { | 337 | { |
338 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine); | 338 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), sm); |
339 | 339 | ||
340 | scic_sds_remote_node_context_continue_state_transitions(rnc); | 340 | scic_sds_remote_node_context_continue_state_transitions(rnc); |
341 | } | 341 | } |
342 | 342 | ||
343 | static const struct sci_base_state scic_sds_remote_node_context_state_table[] = { | 343 | static const struct sci_base_state scic_sds_remote_node_context_state_table[] = { |
344 | [SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE] = { | 344 | [SCI_RNC_INITIAL] = { |
345 | .enter_state = scic_sds_remote_node_context_initial_state_enter, | 345 | .enter_state = scic_sds_remote_node_context_initial_state_enter, |
346 | }, | 346 | }, |
347 | [SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE] = { | 347 | [SCI_RNC_POSTING] = { |
348 | .enter_state = scic_sds_remote_node_context_posting_state_enter, | 348 | .enter_state = scic_sds_remote_node_context_posting_state_enter, |
349 | }, | 349 | }, |
350 | [SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE] = { | 350 | [SCI_RNC_INVALIDATING] = { |
351 | .enter_state = scic_sds_remote_node_context_invalidating_state_enter, | 351 | .enter_state = scic_sds_remote_node_context_invalidating_state_enter, |
352 | }, | 352 | }, |
353 | [SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE] = { | 353 | [SCI_RNC_RESUMING] = { |
354 | .enter_state = scic_sds_remote_node_context_resuming_state_enter, | 354 | .enter_state = scic_sds_remote_node_context_resuming_state_enter, |
355 | }, | 355 | }, |
356 | [SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE] = { | 356 | [SCI_RNC_READY] = { |
357 | .enter_state = scic_sds_remote_node_context_ready_state_enter, | 357 | .enter_state = scic_sds_remote_node_context_ready_state_enter, |
358 | }, | 358 | }, |
359 | [SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE] = { | 359 | [SCI_RNC_TX_SUSPENDED] = { |
360 | .enter_state = scic_sds_remote_node_context_tx_suspended_state_enter, | 360 | .enter_state = scic_sds_remote_node_context_tx_suspended_state_enter, |
361 | }, | 361 | }, |
362 | [SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE] = { | 362 | [SCI_RNC_TX_RX_SUSPENDED] = { |
363 | .enter_state = scic_sds_remote_node_context_tx_rx_suspended_state_enter, | 363 | .enter_state = scic_sds_remote_node_context_tx_rx_suspended_state_enter, |
364 | }, | 364 | }, |
365 | [SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE] = { }, | 365 | [SCI_RNC_AWAIT_SUSPENSION] = { }, |
366 | }; | 366 | }; |
367 | 367 | ||
368 | void scic_sds_remote_node_context_construct(struct scic_sds_remote_node_context *rnc, | 368 | void scic_sds_remote_node_context_construct(struct scic_sds_remote_node_context *rnc, |
@@ -373,11 +373,11 @@ void scic_sds_remote_node_context_construct(struct scic_sds_remote_node_context | |||
373 | rnc->remote_node_index = remote_node_index; | 373 | rnc->remote_node_index = remote_node_index; |
374 | rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED; | 374 | rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED; |
375 | 375 | ||
376 | sci_base_state_machine_construct(&rnc->state_machine, | 376 | sci_base_state_machine_construct(&rnc->sm, |
377 | scic_sds_remote_node_context_state_table, | 377 | scic_sds_remote_node_context_state_table, |
378 | SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE); | 378 | SCI_RNC_INITIAL); |
379 | 379 | ||
380 | sci_base_state_machine_start(&rnc->state_machine); | 380 | sci_base_state_machine_start(&rnc->sm); |
381 | } | 381 | } |
382 | 382 | ||
383 | enum sci_status scic_sds_remote_node_context_event_handler(struct scic_sds_remote_node_context *sci_rnc, | 383 | enum sci_status scic_sds_remote_node_context_event_handler(struct scic_sds_remote_node_context *sci_rnc, |
@@ -385,26 +385,24 @@ enum sci_status scic_sds_remote_node_context_event_handler(struct scic_sds_remot | |||
385 | { | 385 | { |
386 | enum scis_sds_remote_node_context_states state; | 386 | enum scis_sds_remote_node_context_states state; |
387 | 387 | ||
388 | state = sci_rnc->state_machine.current_state_id; | 388 | state = sci_rnc->sm.current_state_id; |
389 | switch (state) { | 389 | switch (state) { |
390 | case SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE: | 390 | case SCI_RNC_POSTING: |
391 | switch (scu_get_event_code(event_code)) { | 391 | switch (scu_get_event_code(event_code)) { |
392 | case SCU_EVENT_POST_RNC_COMPLETE: | 392 | case SCU_EVENT_POST_RNC_COMPLETE: |
393 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 393 | sci_change_state(&sci_rnc->sm, SCI_RNC_READY); |
394 | SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE); | ||
395 | break; | 394 | break; |
396 | default: | 395 | default: |
397 | goto out; | 396 | goto out; |
398 | } | 397 | } |
399 | break; | 398 | break; |
400 | case SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE: | 399 | case SCI_RNC_INVALIDATING: |
401 | if (scu_get_event_code(event_code) == SCU_EVENT_POST_RNC_INVALIDATE_COMPLETE) { | 400 | if (scu_get_event_code(event_code) == SCU_EVENT_POST_RNC_INVALIDATE_COMPLETE) { |
402 | if (sci_rnc->destination_state == SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_FINAL) | 401 | if (sci_rnc->destination_state == SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_FINAL) |
403 | state = SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE; | 402 | state = SCI_RNC_INITIAL; |
404 | else | 403 | else |
405 | state = SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE; | 404 | state = SCI_RNC_POSTING; |
406 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 405 | sci_change_state(&sci_rnc->sm, state); |
407 | state); | ||
408 | } else { | 406 | } else { |
409 | switch (scu_get_event_type(event_code)) { | 407 | switch (scu_get_event_type(event_code)) { |
410 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX: | 408 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX: |
@@ -421,10 +419,9 @@ enum sci_status scic_sds_remote_node_context_event_handler(struct scic_sds_remot | |||
421 | } | 419 | } |
422 | } | 420 | } |
423 | break; | 421 | break; |
424 | case SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE: | 422 | case SCI_RNC_RESUMING: |
425 | if (scu_get_event_code(event_code) == SCU_EVENT_POST_RCN_RELEASE) { | 423 | if (scu_get_event_code(event_code) == SCU_EVENT_POST_RCN_RELEASE) { |
426 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 424 | sci_change_state(&sci_rnc->sm, SCI_RNC_READY); |
427 | SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE); | ||
428 | } else { | 425 | } else { |
429 | switch (scu_get_event_type(event_code)) { | 426 | switch (scu_get_event_type(event_code)) { |
430 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX: | 427 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX: |
@@ -441,32 +438,28 @@ enum sci_status scic_sds_remote_node_context_event_handler(struct scic_sds_remot | |||
441 | } | 438 | } |
442 | } | 439 | } |
443 | break; | 440 | break; |
444 | case SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE: | 441 | case SCI_RNC_READY: |
445 | switch (scu_get_event_type(event_code)) { | 442 | switch (scu_get_event_type(event_code)) { |
446 | case SCU_EVENT_TL_RNC_SUSPEND_TX: | 443 | case SCU_EVENT_TL_RNC_SUSPEND_TX: |
447 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 444 | sci_change_state(&sci_rnc->sm, SCI_RNC_TX_SUSPENDED); |
448 | SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE); | ||
449 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); | 445 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); |
450 | break; | 446 | break; |
451 | case SCU_EVENT_TL_RNC_SUSPEND_TX_RX: | 447 | case SCU_EVENT_TL_RNC_SUSPEND_TX_RX: |
452 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 448 | sci_change_state(&sci_rnc->sm, SCI_RNC_TX_RX_SUSPENDED); |
453 | SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE); | ||
454 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); | 449 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); |
455 | break; | 450 | break; |
456 | default: | 451 | default: |
457 | goto out; | 452 | goto out; |
458 | } | 453 | } |
459 | break; | 454 | break; |
460 | case SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE: | 455 | case SCI_RNC_AWAIT_SUSPENSION: |
461 | switch (scu_get_event_type(event_code)) { | 456 | switch (scu_get_event_type(event_code)) { |
462 | case SCU_EVENT_TL_RNC_SUSPEND_TX: | 457 | case SCU_EVENT_TL_RNC_SUSPEND_TX: |
463 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 458 | sci_change_state(&sci_rnc->sm, SCI_RNC_TX_SUSPENDED); |
464 | SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE); | ||
465 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); | 459 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); |
466 | break; | 460 | break; |
467 | case SCU_EVENT_TL_RNC_SUSPEND_TX_RX: | 461 | case SCU_EVENT_TL_RNC_SUSPEND_TX_RX: |
468 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 462 | sci_change_state(&sci_rnc->sm, SCI_RNC_TX_RX_SUSPENDED); |
469 | SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE); | ||
470 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); | 463 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); |
471 | break; | 464 | break; |
472 | default: | 465 | default: |
@@ -493,22 +486,21 @@ enum sci_status scic_sds_remote_node_context_destruct(struct scic_sds_remote_nod | |||
493 | { | 486 | { |
494 | enum scis_sds_remote_node_context_states state; | 487 | enum scis_sds_remote_node_context_states state; |
495 | 488 | ||
496 | state = sci_rnc->state_machine.current_state_id; | 489 | state = sci_rnc->sm.current_state_id; |
497 | switch (state) { | 490 | switch (state) { |
498 | case SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE: | 491 | case SCI_RNC_INVALIDATING: |
499 | scic_sds_remote_node_context_setup_to_destory(sci_rnc, cb_fn, cb_p); | 492 | scic_sds_remote_node_context_setup_to_destory(sci_rnc, cb_fn, cb_p); |
500 | return SCI_SUCCESS; | 493 | return SCI_SUCCESS; |
501 | case SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE: | 494 | case SCI_RNC_POSTING: |
502 | case SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE: | 495 | case SCI_RNC_RESUMING: |
503 | case SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE: | 496 | case SCI_RNC_READY: |
504 | case SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE: | 497 | case SCI_RNC_TX_SUSPENDED: |
505 | case SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE: | 498 | case SCI_RNC_TX_RX_SUSPENDED: |
506 | case SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE: | 499 | case SCI_RNC_AWAIT_SUSPENSION: |
507 | scic_sds_remote_node_context_setup_to_destory(sci_rnc, cb_fn, cb_p); | 500 | scic_sds_remote_node_context_setup_to_destory(sci_rnc, cb_fn, cb_p); |
508 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 501 | sci_change_state(&sci_rnc->sm, SCI_RNC_INVALIDATING); |
509 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE); | ||
510 | return SCI_SUCCESS; | 502 | return SCI_SUCCESS; |
511 | case SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE: | 503 | case SCI_RNC_INITIAL: |
512 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), | 504 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), |
513 | "%s: invalid state %d\n", __func__, state); | 505 | "%s: invalid state %d\n", __func__, state); |
514 | /* We have decided that the destruct request on the remote node context | 506 | /* We have decided that the destruct request on the remote node context |
@@ -530,8 +522,8 @@ enum sci_status scic_sds_remote_node_context_suspend(struct scic_sds_remote_node | |||
530 | { | 522 | { |
531 | enum scis_sds_remote_node_context_states state; | 523 | enum scis_sds_remote_node_context_states state; |
532 | 524 | ||
533 | state = sci_rnc->state_machine.current_state_id; | 525 | state = sci_rnc->sm.current_state_id; |
534 | if (state != SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE) { | 526 | if (state != SCI_RNC_READY) { |
535 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), | 527 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), |
536 | "%s: invalid state %d\n", __func__, state); | 528 | "%s: invalid state %d\n", __func__, state); |
537 | return SCI_FAILURE_INVALID_STATE; | 529 | return SCI_FAILURE_INVALID_STATE; |
@@ -546,8 +538,7 @@ enum sci_status scic_sds_remote_node_context_suspend(struct scic_sds_remote_node | |||
546 | SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX); | 538 | SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX); |
547 | } | 539 | } |
548 | 540 | ||
549 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 541 | sci_change_state(&sci_rnc->sm, SCI_RNC_AWAIT_SUSPENSION); |
550 | SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE); | ||
551 | return SCI_SUCCESS; | 542 | return SCI_SUCCESS; |
552 | } | 543 | } |
553 | 544 | ||
@@ -557,27 +548,26 @@ enum sci_status scic_sds_remote_node_context_resume(struct scic_sds_remote_node_ | |||
557 | { | 548 | { |
558 | enum scis_sds_remote_node_context_states state; | 549 | enum scis_sds_remote_node_context_states state; |
559 | 550 | ||
560 | state = sci_rnc->state_machine.current_state_id; | 551 | state = sci_rnc->sm.current_state_id; |
561 | switch (state) { | 552 | switch (state) { |
562 | case SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE: | 553 | case SCI_RNC_INITIAL: |
563 | if (sci_rnc->remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) | 554 | if (sci_rnc->remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) |
564 | return SCI_FAILURE_INVALID_STATE; | 555 | return SCI_FAILURE_INVALID_STATE; |
565 | 556 | ||
566 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); | 557 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); |
567 | scic_sds_remote_node_context_construct_buffer(sci_rnc); | 558 | scic_sds_remote_node_context_construct_buffer(sci_rnc); |
568 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 559 | sci_change_state(&sci_rnc->sm, SCI_RNC_POSTING); |
569 | SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE); | ||
570 | return SCI_SUCCESS; | 560 | return SCI_SUCCESS; |
571 | case SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE: | 561 | case SCI_RNC_POSTING: |
572 | case SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE: | 562 | case SCI_RNC_INVALIDATING: |
573 | case SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE: | 563 | case SCI_RNC_RESUMING: |
574 | if (sci_rnc->destination_state != SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_READY) | 564 | if (sci_rnc->destination_state != SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_READY) |
575 | return SCI_FAILURE_INVALID_STATE; | 565 | return SCI_FAILURE_INVALID_STATE; |
576 | 566 | ||
577 | sci_rnc->user_callback = cb_fn; | 567 | sci_rnc->user_callback = cb_fn; |
578 | sci_rnc->user_cookie = cb_p; | 568 | sci_rnc->user_cookie = cb_p; |
579 | return SCI_SUCCESS; | 569 | return SCI_SUCCESS; |
580 | case SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE: { | 570 | case SCI_RNC_TX_SUSPENDED: { |
581 | struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc); | 571 | struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc); |
582 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 572 | struct domain_device *dev = sci_dev_to_domain(sci_dev); |
583 | 573 | ||
@@ -585,27 +575,23 @@ enum sci_status scic_sds_remote_node_context_resume(struct scic_sds_remote_node_ | |||
585 | 575 | ||
586 | /* TODO: consider adding a resume action of NONE, INVALIDATE, WRITE_TLCR */ | 576 | /* TODO: consider adding a resume action of NONE, INVALIDATE, WRITE_TLCR */ |
587 | if (dev->dev_type == SAS_END_DEV || dev_is_expander(dev)) | 577 | if (dev->dev_type == SAS_END_DEV || dev_is_expander(dev)) |
588 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 578 | sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING); |
589 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE); | ||
590 | else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { | 579 | else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { |
591 | if (sci_dev->is_direct_attached) { | 580 | if (sci_dev->is_direct_attached) { |
592 | /* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */ | 581 | /* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */ |
593 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 582 | sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING); |
594 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE); | ||
595 | } else { | 583 | } else { |
596 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 584 | sci_change_state(&sci_rnc->sm, SCI_RNC_INVALIDATING); |
597 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE); | ||
598 | } | 585 | } |
599 | } else | 586 | } else |
600 | return SCI_FAILURE; | 587 | return SCI_FAILURE; |
601 | return SCI_SUCCESS; | 588 | return SCI_SUCCESS; |
602 | } | 589 | } |
603 | case SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE: | 590 | case SCI_RNC_TX_RX_SUSPENDED: |
604 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); | 591 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); |
605 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 592 | sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING); |
606 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE); | ||
607 | return SCI_FAILURE_INVALID_STATE; | 593 | return SCI_FAILURE_INVALID_STATE; |
608 | case SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE: | 594 | case SCI_RNC_AWAIT_SUSPENSION: |
609 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); | 595 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); |
610 | return SCI_SUCCESS; | 596 | return SCI_SUCCESS; |
611 | default: | 597 | default: |
@@ -620,8 +606,8 @@ enum sci_status scic_sds_remote_node_context_start_io(struct scic_sds_remote_nod | |||
620 | { | 606 | { |
621 | enum scis_sds_remote_node_context_states state; | 607 | enum scis_sds_remote_node_context_states state; |
622 | 608 | ||
623 | state = sci_rnc->state_machine.current_state_id; | 609 | state = sci_rnc->sm.current_state_id; |
624 | if (state != SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE) { | 610 | if (state != SCI_RNC_READY) { |
625 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), | 611 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), |
626 | "%s: invalid state %d\n", __func__, state); | 612 | "%s: invalid state %d\n", __func__, state); |
627 | return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; | 613 | return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; |
@@ -634,14 +620,14 @@ enum sci_status scic_sds_remote_node_context_start_task(struct scic_sds_remote_n | |||
634 | { | 620 | { |
635 | enum scis_sds_remote_node_context_states state; | 621 | enum scis_sds_remote_node_context_states state; |
636 | 622 | ||
637 | state = sci_rnc->state_machine.current_state_id; | 623 | state = sci_rnc->sm.current_state_id; |
638 | switch (state) { | 624 | switch (state) { |
639 | case SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE: | 625 | case SCI_RNC_RESUMING: |
640 | case SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE: | 626 | case SCI_RNC_READY: |
641 | case SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE: | 627 | case SCI_RNC_AWAIT_SUSPENSION: |
642 | return SCI_SUCCESS; | 628 | return SCI_SUCCESS; |
643 | case SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE: | 629 | case SCI_RNC_TX_SUSPENDED: |
644 | case SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE: | 630 | case SCI_RNC_TX_RX_SUSPENDED: |
645 | scic_sds_remote_node_context_resume(sci_rnc, NULL, NULL); | 631 | scic_sds_remote_node_context_resume(sci_rnc, NULL, NULL); |
646 | return SCI_SUCCESS; | 632 | return SCI_SUCCESS; |
647 | default: | 633 | default: |
diff --git a/drivers/scsi/isci/remote_node_context.h b/drivers/scsi/isci/remote_node_context.h index f53329f782c8..e6c7248be3f6 100644 --- a/drivers/scsi/isci/remote_node_context.h +++ b/drivers/scsi/isci/remote_node_context.h | |||
@@ -92,45 +92,45 @@ enum scis_sds_remote_node_context_states { | |||
92 | * This state is the initial state for a remote node context. On a resume | 92 | * This state is the initial state for a remote node context. On a resume |
93 | * request the remote node context will transition to the posting state. | 93 | * request the remote node context will transition to the posting state. |
94 | */ | 94 | */ |
95 | SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE, | 95 | SCI_RNC_INITIAL, |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * This is a transition state that posts the RNi to the hardware. Once the RNC | 98 | * This is a transition state that posts the RNi to the hardware. Once the RNC |
99 | * is posted the remote node context will be made ready. | 99 | * is posted the remote node context will be made ready. |
100 | */ | 100 | */ |
101 | SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE, | 101 | SCI_RNC_POSTING, |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * This is a transition state that will post an RNC invalidate to the | 104 | * This is a transition state that will post an RNC invalidate to the |
105 | * hardware. Once the invalidate is complete the remote node context will | 105 | * hardware. Once the invalidate is complete the remote node context will |
106 | * transition to the posting state. | 106 | * transition to the posting state. |
107 | */ | 107 | */ |
108 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE, | 108 | SCI_RNC_INVALIDATING, |
109 | 109 | ||
110 | /** | 110 | /** |
111 | * This is a transition state that will post an RNC resume to the hardare. | 111 | * This is a transition state that will post an RNC resume to the hardare. |
112 | * Once the event notification of resume complete is received the remote node | 112 | * Once the event notification of resume complete is received the remote node |
113 | * context will transition to the ready state. | 113 | * context will transition to the ready state. |
114 | */ | 114 | */ |
115 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE, | 115 | SCI_RNC_RESUMING, |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * This is the state that the remote node context must be in to accept io | 118 | * This is the state that the remote node context must be in to accept io |
119 | * request operations. | 119 | * request operations. |
120 | */ | 120 | */ |
121 | SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE, | 121 | SCI_RNC_READY, |
122 | 122 | ||
123 | /** | 123 | /** |
124 | * This is the state that the remote node context transitions to when it gets | 124 | * This is the state that the remote node context transitions to when it gets |
125 | * a TX suspend notification from the hardware. | 125 | * a TX suspend notification from the hardware. |
126 | */ | 126 | */ |
127 | SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE, | 127 | SCI_RNC_TX_SUSPENDED, |
128 | 128 | ||
129 | /** | 129 | /** |
130 | * This is the state that the remote node context transitions to when it gets | 130 | * This is the state that the remote node context transitions to when it gets |
131 | * a TX RX suspend notification from the hardware. | 131 | * a TX RX suspend notification from the hardware. |
132 | */ | 132 | */ |
133 | SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE, | 133 | SCI_RNC_TX_RX_SUSPENDED, |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * This state is a wait state for the remote node context that waits for a | 136 | * This state is a wait state for the remote node context that waits for a |
@@ -138,7 +138,7 @@ enum scis_sds_remote_node_context_states { | |||
138 | * there is a request to supend the remote node context or when there is a TC | 138 | * there is a request to supend the remote node context or when there is a TC |
139 | * completion where the remote node will be suspended by the hardware. | 139 | * completion where the remote node will be suspended by the hardware. |
140 | */ | 140 | */ |
141 | SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE | 141 | SCI_RNC_AWAIT_SUSPENSION |
142 | }; | 142 | }; |
143 | 143 | ||
144 | /** | 144 | /** |
@@ -194,7 +194,7 @@ struct scic_sds_remote_node_context { | |||
194 | /** | 194 | /** |
195 | * This field contains the data for the object's state machine. | 195 | * This field contains the data for the object's state machine. |
196 | */ | 196 | */ |
197 | struct sci_base_state_machine state_machine; | 197 | struct sci_base_state_machine sm; |
198 | }; | 198 | }; |
199 | 199 | ||
200 | void scic_sds_remote_node_context_construct(struct scic_sds_remote_node_context *rnc, | 200 | void scic_sds_remote_node_context_construct(struct scic_sds_remote_node_context *rnc, |
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index 31c9b2c34259..89f0ab925c27 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c | |||
@@ -649,8 +649,7 @@ static enum sci_status scic_io_request_construct_basic_ssp(struct scic_sds_reque | |||
649 | 649 | ||
650 | scic_sds_io_request_build_ssp_command_iu(sci_req); | 650 | scic_sds_io_request_build_ssp_command_iu(sci_req); |
651 | 651 | ||
652 | sci_base_state_machine_change_state(&sci_req->state_machine, | 652 | sci_change_state(&sci_req->sm, SCI_REQ_CONSTRUCTED); |
653 | SCI_BASE_REQUEST_STATE_CONSTRUCTED); | ||
654 | 653 | ||
655 | return SCI_SUCCESS; | 654 | return SCI_SUCCESS; |
656 | } | 655 | } |
@@ -664,8 +663,7 @@ enum sci_status scic_task_request_construct_ssp( | |||
664 | /* Fill in the SSP Task IU */ | 663 | /* Fill in the SSP Task IU */ |
665 | scic_sds_task_request_build_ssp_task_iu(sci_req); | 664 | scic_sds_task_request_build_ssp_task_iu(sci_req); |
666 | 665 | ||
667 | sci_base_state_machine_change_state(&sci_req->state_machine, | 666 | sci_change_state(&sci_req->sm, SCI_REQ_CONSTRUCTED); |
668 | SCI_BASE_REQUEST_STATE_CONSTRUCTED); | ||
669 | 667 | ||
670 | return SCI_SUCCESS; | 668 | return SCI_SUCCESS; |
671 | } | 669 | } |
@@ -687,8 +685,7 @@ static enum sci_status scic_io_request_construct_basic_sata(struct scic_sds_requ | |||
687 | copy); | 685 | copy); |
688 | 686 | ||
689 | if (status == SCI_SUCCESS) | 687 | if (status == SCI_SUCCESS) |
690 | sci_base_state_machine_change_state(&sci_req->state_machine, | 688 | sci_change_state(&sci_req->sm, SCI_REQ_CONSTRUCTED); |
691 | SCI_BASE_REQUEST_STATE_CONSTRUCTED); | ||
692 | 689 | ||
693 | return status; | 690 | return status; |
694 | } | 691 | } |
@@ -718,8 +715,7 @@ enum sci_status scic_task_request_construct_sata(struct scic_sds_request *sci_re | |||
718 | 715 | ||
719 | if (status != SCI_SUCCESS) | 716 | if (status != SCI_SUCCESS) |
720 | return status; | 717 | return status; |
721 | sci_base_state_machine_change_state(&sci_req->state_machine, | 718 | sci_change_state(&sci_req->sm, SCI_REQ_CONSTRUCTED); |
722 | SCI_BASE_REQUEST_STATE_CONSTRUCTED); | ||
723 | 719 | ||
724 | return status; | 720 | return status; |
725 | } | 721 | } |
@@ -761,8 +757,8 @@ enum sci_status scic_sds_request_start(struct scic_sds_request *sci_req) | |||
761 | scic_sds_remote_device_get_sequence(sci_req->target_device)) | 757 | scic_sds_remote_device_get_sequence(sci_req->target_device)) |
762 | return SCI_FAILURE; | 758 | return SCI_FAILURE; |
763 | 759 | ||
764 | state = sci_req->state_machine.current_state_id; | 760 | state = sci_req->sm.current_state_id; |
765 | if (state != SCI_BASE_REQUEST_STATE_CONSTRUCTED) { | 761 | if (state != SCI_REQ_CONSTRUCTED) { |
766 | dev_warn(scic_to_dev(scic), | 762 | dev_warn(scic_to_dev(scic), |
767 | "%s: SCIC IO Request requested to start while in wrong " | 763 | "%s: SCIC IO Request requested to start while in wrong " |
768 | "state %d\n", __func__, state); | 764 | "state %d\n", __func__, state); |
@@ -818,8 +814,7 @@ enum sci_status scic_sds_request_start(struct scic_sds_request *sci_req) | |||
818 | sci_req->post_context |= scic_sds_io_tag_get_index(sci_req->io_tag); | 814 | sci_req->post_context |= scic_sds_io_tag_get_index(sci_req->io_tag); |
819 | 815 | ||
820 | /* Everything is good go ahead and change state */ | 816 | /* Everything is good go ahead and change state */ |
821 | sci_base_state_machine_change_state(&sci_req->state_machine, | 817 | sci_change_state(&sci_req->sm, SCI_REQ_STARTED); |
822 | SCI_BASE_REQUEST_STATE_STARTED); | ||
823 | 818 | ||
824 | return SCI_SUCCESS; | 819 | return SCI_SUCCESS; |
825 | } | 820 | } |
@@ -832,52 +827,47 @@ scic_sds_io_request_terminate(struct scic_sds_request *sci_req) | |||
832 | { | 827 | { |
833 | enum sci_base_request_states state; | 828 | enum sci_base_request_states state; |
834 | 829 | ||
835 | state = sci_req->state_machine.current_state_id; | 830 | state = sci_req->sm.current_state_id; |
836 | 831 | ||
837 | switch (state) { | 832 | switch (state) { |
838 | case SCI_BASE_REQUEST_STATE_CONSTRUCTED: | 833 | case SCI_REQ_CONSTRUCTED: |
839 | scic_sds_request_set_status(sci_req, | 834 | scic_sds_request_set_status(sci_req, |
840 | SCU_TASK_DONE_TASK_ABORT, | 835 | SCU_TASK_DONE_TASK_ABORT, |
841 | SCI_FAILURE_IO_TERMINATED); | 836 | SCI_FAILURE_IO_TERMINATED); |
842 | 837 | ||
843 | sci_base_state_machine_change_state(&sci_req->state_machine, | 838 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
844 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
845 | return SCI_SUCCESS; | 839 | return SCI_SUCCESS; |
846 | case SCI_BASE_REQUEST_STATE_STARTED: | 840 | case SCI_REQ_STARTED: |
847 | case SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION: | 841 | case SCI_REQ_TASK_WAIT_TC_COMP: |
848 | case SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE: | 842 | case SCI_REQ_SMP_WAIT_RESP: |
849 | case SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION: | 843 | case SCI_REQ_SMP_WAIT_TC_COMP: |
850 | case SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE: | 844 | case SCI_REQ_STP_UDMA_WAIT_TC_COMP: |
851 | case SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE: | 845 | case SCI_REQ_STP_UDMA_WAIT_D2H: |
852 | case SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE: | 846 | case SCI_REQ_STP_NON_DATA_WAIT_H2D: |
853 | case SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE: | 847 | case SCI_REQ_STP_NON_DATA_WAIT_D2H: |
854 | case SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE: | 848 | case SCI_REQ_STP_PIO_WAIT_H2D: |
855 | case SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE: | 849 | case SCI_REQ_STP_PIO_WAIT_FRAME: |
856 | case SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE: | 850 | case SCI_REQ_STP_PIO_DATA_IN: |
857 | case SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE: | 851 | case SCI_REQ_STP_PIO_DATA_OUT: |
858 | case SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE: | 852 | case SCI_REQ_STP_SOFT_RESET_WAIT_H2D_ASSERTED: |
859 | case SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE: | 853 | case SCI_REQ_STP_SOFT_RESET_WAIT_H2D_DIAG: |
860 | case SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE: | 854 | case SCI_REQ_STP_SOFT_RESET_WAIT_D2H: |
861 | sci_base_state_machine_change_state(&sci_req->state_machine, | 855 | sci_change_state(&sci_req->sm, SCI_REQ_ABORTING); |
862 | SCI_BASE_REQUEST_STATE_ABORTING); | ||
863 | return SCI_SUCCESS; | 856 | return SCI_SUCCESS; |
864 | case SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE: | 857 | case SCI_REQ_TASK_WAIT_TC_RESP: |
865 | sci_base_state_machine_change_state(&sci_req->state_machine, | 858 | sci_change_state(&sci_req->sm, SCI_REQ_ABORTING); |
866 | SCI_BASE_REQUEST_STATE_ABORTING); | 859 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
867 | sci_base_state_machine_change_state(&sci_req->state_machine, | ||
868 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
869 | return SCI_SUCCESS; | 860 | return SCI_SUCCESS; |
870 | case SCI_BASE_REQUEST_STATE_ABORTING: | 861 | case SCI_REQ_ABORTING: |
871 | sci_base_state_machine_change_state(&sci_req->state_machine, | 862 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
872 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
873 | return SCI_SUCCESS; | 863 | return SCI_SUCCESS; |
874 | case SCI_BASE_REQUEST_STATE_COMPLETED: | 864 | case SCI_REQ_COMPLETED: |
875 | default: | 865 | default: |
876 | dev_warn(scic_to_dev(sci_req->owning_controller), | 866 | dev_warn(scic_to_dev(sci_req->owning_controller), |
877 | "%s: SCIC IO Request requested to abort while in wrong " | 867 | "%s: SCIC IO Request requested to abort while in wrong " |
878 | "state %d\n", | 868 | "state %d\n", |
879 | __func__, | 869 | __func__, |
880 | sci_base_state_machine_get_state(&sci_req->state_machine)); | 870 | sci_req->sm.current_state_id); |
881 | break; | 871 | break; |
882 | } | 872 | } |
883 | 873 | ||
@@ -889,8 +879,8 @@ enum sci_status scic_sds_request_complete(struct scic_sds_request *sci_req) | |||
889 | enum sci_base_request_states state; | 879 | enum sci_base_request_states state; |
890 | struct scic_sds_controller *scic = sci_req->owning_controller; | 880 | struct scic_sds_controller *scic = sci_req->owning_controller; |
891 | 881 | ||
892 | state = sci_req->state_machine.current_state_id; | 882 | state = sci_req->sm.current_state_id; |
893 | if (WARN_ONCE(state != SCI_BASE_REQUEST_STATE_COMPLETED, | 883 | if (WARN_ONCE(state != SCI_REQ_COMPLETED, |
894 | "isci: request completion from wrong state (%d)\n", state)) | 884 | "isci: request completion from wrong state (%d)\n", state)) |
895 | return SCI_FAILURE_INVALID_STATE; | 885 | return SCI_FAILURE_INVALID_STATE; |
896 | 886 | ||
@@ -902,8 +892,7 @@ enum sci_status scic_sds_request_complete(struct scic_sds_request *sci_req) | |||
902 | sci_req->saved_rx_frame_index); | 892 | sci_req->saved_rx_frame_index); |
903 | 893 | ||
904 | /* XXX can we just stop the machine and remove the 'final' state? */ | 894 | /* XXX can we just stop the machine and remove the 'final' state? */ |
905 | sci_base_state_machine_change_state(&sci_req->state_machine, | 895 | sci_change_state(&sci_req->sm, SCI_REQ_FINAL); |
906 | SCI_BASE_REQUEST_STATE_FINAL); | ||
907 | return SCI_SUCCESS; | 896 | return SCI_SUCCESS; |
908 | } | 897 | } |
909 | 898 | ||
@@ -913,9 +902,9 @@ enum sci_status scic_sds_io_request_event_handler(struct scic_sds_request *sci_r | |||
913 | enum sci_base_request_states state; | 902 | enum sci_base_request_states state; |
914 | struct scic_sds_controller *scic = sci_req->owning_controller; | 903 | struct scic_sds_controller *scic = sci_req->owning_controller; |
915 | 904 | ||
916 | state = sci_req->state_machine.current_state_id; | 905 | state = sci_req->sm.current_state_id; |
917 | 906 | ||
918 | if (state != SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE) { | 907 | if (state != SCI_REQ_STP_PIO_DATA_IN) { |
919 | dev_warn(scic_to_dev(scic), "%s: (%x) in wrong state %d\n", | 908 | dev_warn(scic_to_dev(scic), "%s: (%x) in wrong state %d\n", |
920 | __func__, event_code, state); | 909 | __func__, event_code, state); |
921 | 910 | ||
@@ -927,8 +916,7 @@ enum sci_status scic_sds_io_request_event_handler(struct scic_sds_request *sci_r | |||
927 | /* We are waiting for data and the SCU has R_ERR the data frame. | 916 | /* We are waiting for data and the SCU has R_ERR the data frame. |
928 | * Go back to waiting for the D2H Register FIS | 917 | * Go back to waiting for the D2H Register FIS |
929 | */ | 918 | */ |
930 | sci_base_state_machine_change_state(&sci_req->state_machine, | 919 | sci_change_state(&sci_req->sm, SCI_REQ_STP_PIO_WAIT_FRAME); |
931 | SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE); | ||
932 | return SCI_SUCCESS; | 920 | return SCI_SUCCESS; |
933 | default: | 921 | default: |
934 | dev_err(scic_to_dev(scic), | 922 | dev_err(scic_to_dev(scic), |
@@ -967,8 +955,9 @@ static void scic_sds_io_request_copy_response(struct scic_sds_request *sci_req) | |||
967 | memcpy(resp_buf, ssp_response->resp_data, len); | 955 | memcpy(resp_buf, ssp_response->resp_data, len); |
968 | } | 956 | } |
969 | 957 | ||
970 | static enum sci_status request_started_state_tc_event(struct scic_sds_request *sci_req, | 958 | static enum sci_status |
971 | u32 completion_code) | 959 | request_started_state_tc_event(struct scic_sds_request *sci_req, |
960 | u32 completion_code) | ||
972 | { | 961 | { |
973 | struct ssp_response_iu *resp_iu; | 962 | struct ssp_response_iu *resp_iu; |
974 | u8 datapres; | 963 | u8 datapres; |
@@ -1110,13 +1099,13 @@ static enum sci_status request_started_state_tc_event(struct scic_sds_request *s | |||
1110 | */ | 1099 | */ |
1111 | 1100 | ||
1112 | /* In all cases we will treat this as the completion of the IO req. */ | 1101 | /* In all cases we will treat this as the completion of the IO req. */ |
1113 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1102 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1114 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1115 | return SCI_SUCCESS; | 1103 | return SCI_SUCCESS; |
1116 | } | 1104 | } |
1117 | 1105 | ||
1118 | static enum sci_status request_aborting_state_tc_event(struct scic_sds_request *sci_req, | 1106 | static enum sci_status |
1119 | u32 completion_code) | 1107 | request_aborting_state_tc_event(struct scic_sds_request *sci_req, |
1108 | u32 completion_code) | ||
1120 | { | 1109 | { |
1121 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1110 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1122 | case (SCU_TASK_DONE_GOOD << SCU_COMPLETION_TL_STATUS_SHIFT): | 1111 | case (SCU_TASK_DONE_GOOD << SCU_COMPLETION_TL_STATUS_SHIFT): |
@@ -1124,8 +1113,7 @@ static enum sci_status request_aborting_state_tc_event(struct scic_sds_request * | |||
1124 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_TASK_ABORT, | 1113 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_TASK_ABORT, |
1125 | SCI_FAILURE_IO_TERMINATED); | 1114 | SCI_FAILURE_IO_TERMINATED); |
1126 | 1115 | ||
1127 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1116 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1128 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1129 | break; | 1117 | break; |
1130 | 1118 | ||
1131 | default: | 1119 | default: |
@@ -1146,8 +1134,7 @@ static enum sci_status ssp_task_request_await_tc_event(struct scic_sds_request * | |||
1146 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, | 1134 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, |
1147 | SCI_SUCCESS); | 1135 | SCI_SUCCESS); |
1148 | 1136 | ||
1149 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1137 | sci_change_state(&sci_req->sm, SCI_REQ_TASK_WAIT_TC_RESP); |
1150 | SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE); | ||
1151 | break; | 1138 | break; |
1152 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_ACK_NAK_TO): | 1139 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_ACK_NAK_TO): |
1153 | /* Currently, the decision is to simply allow the task request | 1140 | /* Currently, the decision is to simply allow the task request |
@@ -1160,27 +1147,28 @@ static enum sci_status ssp_task_request_await_tc_event(struct scic_sds_request * | |||
1160 | "ACK/NAK timeout\n", __func__, sci_req, | 1147 | "ACK/NAK timeout\n", __func__, sci_req, |
1161 | completion_code); | 1148 | completion_code); |
1162 | 1149 | ||
1163 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1150 | sci_change_state(&sci_req->sm, SCI_REQ_TASK_WAIT_TC_RESP); |
1164 | SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE); | ||
1165 | break; | 1151 | break; |
1166 | default: | 1152 | default: |
1167 | /* All other completion status cause the IO to be complete. If a NAK | 1153 | /* |
1168 | * was received, then it is up to the user to retry the request. | 1154 | * All other completion status cause the IO to be complete. |
1155 | * If a NAK was received, then it is up to the user to retry | ||
1156 | * the request. | ||
1169 | */ | 1157 | */ |
1170 | scic_sds_request_set_status(sci_req, | 1158 | scic_sds_request_set_status(sci_req, |
1171 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1159 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), |
1172 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | 1160 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
1173 | 1161 | ||
1174 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1162 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1175 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1176 | break; | 1163 | break; |
1177 | } | 1164 | } |
1178 | 1165 | ||
1179 | return SCI_SUCCESS; | 1166 | return SCI_SUCCESS; |
1180 | } | 1167 | } |
1181 | 1168 | ||
1182 | static enum sci_status smp_request_await_response_tc_event(struct scic_sds_request *sci_req, | 1169 | static enum sci_status |
1183 | u32 completion_code) | 1170 | smp_request_await_response_tc_event(struct scic_sds_request *sci_req, |
1171 | u32 completion_code) | ||
1184 | { | 1172 | { |
1185 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1173 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1186 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1174 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
@@ -1191,8 +1179,7 @@ static enum sci_status smp_request_await_response_tc_event(struct scic_sds_reque | |||
1191 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, | 1179 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, |
1192 | SCI_SUCCESS); | 1180 | SCI_SUCCESS); |
1193 | 1181 | ||
1194 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1182 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1195 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1196 | break; | 1183 | break; |
1197 | 1184 | ||
1198 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_RESP_TO_ERR): | 1185 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_RESP_TO_ERR): |
@@ -1209,8 +1196,7 @@ static enum sci_status smp_request_await_response_tc_event(struct scic_sds_reque | |||
1209 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_SMP_RESP_TO_ERR, | 1196 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_SMP_RESP_TO_ERR, |
1210 | SCI_FAILURE_RETRY_REQUIRED); | 1197 | SCI_FAILURE_RETRY_REQUIRED); |
1211 | 1198 | ||
1212 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1199 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1213 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1214 | break; | 1200 | break; |
1215 | 1201 | ||
1216 | default: | 1202 | default: |
@@ -1221,24 +1207,23 @@ static enum sci_status smp_request_await_response_tc_event(struct scic_sds_reque | |||
1221 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1207 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), |
1222 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | 1208 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
1223 | 1209 | ||
1224 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1210 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1225 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1226 | break; | 1211 | break; |
1227 | } | 1212 | } |
1228 | 1213 | ||
1229 | return SCI_SUCCESS; | 1214 | return SCI_SUCCESS; |
1230 | } | 1215 | } |
1231 | 1216 | ||
1232 | static enum sci_status smp_request_await_tc_event(struct scic_sds_request *sci_req, | 1217 | static enum sci_status |
1233 | u32 completion_code) | 1218 | smp_request_await_tc_event(struct scic_sds_request *sci_req, |
1219 | u32 completion_code) | ||
1234 | { | 1220 | { |
1235 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1221 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1236 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1222 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
1237 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, | 1223 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, |
1238 | SCI_SUCCESS); | 1224 | SCI_SUCCESS); |
1239 | 1225 | ||
1240 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1226 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1241 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1242 | break; | 1227 | break; |
1243 | default: | 1228 | default: |
1244 | /* All other completion status cause the IO to be | 1229 | /* All other completion status cause the IO to be |
@@ -1249,8 +1234,7 @@ static enum sci_status smp_request_await_tc_event(struct scic_sds_request *sci_r | |||
1249 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1234 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), |
1250 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | 1235 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
1251 | 1236 | ||
1252 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1237 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1253 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1254 | break; | 1238 | break; |
1255 | } | 1239 | } |
1256 | 1240 | ||
@@ -1311,16 +1295,16 @@ static struct scu_sgl_element *scic_sds_stp_request_pio_get_next_sgl(struct scic | |||
1311 | return current_sgl; | 1295 | return current_sgl; |
1312 | } | 1296 | } |
1313 | 1297 | ||
1314 | static enum sci_status stp_request_non_data_await_h2d_tc_event(struct scic_sds_request *sci_req, | 1298 | static enum sci_status |
1315 | u32 completion_code) | 1299 | stp_request_non_data_await_h2d_tc_event(struct scic_sds_request *sci_req, |
1300 | u32 completion_code) | ||
1316 | { | 1301 | { |
1317 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1302 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1318 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1303 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
1319 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, | 1304 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, |
1320 | SCI_SUCCESS); | 1305 | SCI_SUCCESS); |
1321 | 1306 | ||
1322 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1307 | sci_change_state(&sci_req->sm, SCI_REQ_STP_NON_DATA_WAIT_D2H); |
1323 | SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE); | ||
1324 | break; | 1308 | break; |
1325 | 1309 | ||
1326 | default: | 1310 | default: |
@@ -1332,8 +1316,7 @@ static enum sci_status stp_request_non_data_await_h2d_tc_event(struct scic_sds_r | |||
1332 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1316 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), |
1333 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | 1317 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
1334 | 1318 | ||
1335 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1319 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1336 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1337 | break; | 1320 | break; |
1338 | } | 1321 | } |
1339 | 1322 | ||
@@ -1509,17 +1492,19 @@ static enum sci_status scic_sds_stp_request_pio_data_in_copy_data( | |||
1509 | return status; | 1492 | return status; |
1510 | } | 1493 | } |
1511 | 1494 | ||
1512 | static enum sci_status stp_request_pio_await_h2d_completion_tc_event(struct scic_sds_request *sci_req, | 1495 | static enum sci_status |
1513 | u32 completion_code) | 1496 | stp_request_pio_await_h2d_completion_tc_event(struct scic_sds_request *sci_req, |
1497 | u32 completion_code) | ||
1514 | { | 1498 | { |
1515 | enum sci_status status = SCI_SUCCESS; | 1499 | enum sci_status status = SCI_SUCCESS; |
1516 | 1500 | ||
1517 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1501 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1518 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1502 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
1519 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS); | 1503 | scic_sds_request_set_status(sci_req, |
1504 | SCU_TASK_DONE_GOOD, | ||
1505 | SCI_SUCCESS); | ||
1520 | 1506 | ||
1521 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1507 | sci_change_state(&sci_req->sm, SCI_REQ_STP_PIO_WAIT_FRAME); |
1522 | SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE); | ||
1523 | break; | 1508 | break; |
1524 | 1509 | ||
1525 | default: | 1510 | default: |
@@ -1531,16 +1516,16 @@ static enum sci_status stp_request_pio_await_h2d_completion_tc_event(struct scic | |||
1531 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1516 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), |
1532 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | 1517 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
1533 | 1518 | ||
1534 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1519 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1535 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1536 | break; | 1520 | break; |
1537 | } | 1521 | } |
1538 | 1522 | ||
1539 | return status; | 1523 | return status; |
1540 | } | 1524 | } |
1541 | 1525 | ||
1542 | static enum sci_status pio_data_out_tx_done_tc_event(struct scic_sds_request *sci_req, | 1526 | static enum sci_status |
1543 | u32 completion_code) | 1527 | pio_data_out_tx_done_tc_event(struct scic_sds_request *sci_req, |
1528 | u32 completion_code) | ||
1544 | { | 1529 | { |
1545 | enum sci_status status = SCI_SUCCESS; | 1530 | enum sci_status status = SCI_SUCCESS; |
1546 | bool all_frames_transferred = false; | 1531 | bool all_frames_transferred = false; |
@@ -1566,28 +1551,24 @@ static enum sci_status pio_data_out_tx_done_tc_event(struct scic_sds_request *sc | |||
1566 | /* all data transferred. */ | 1551 | /* all data transferred. */ |
1567 | if (all_frames_transferred) { | 1552 | if (all_frames_transferred) { |
1568 | /* | 1553 | /* |
1569 | * Change the state to SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_FRAME_SUBSTATE | 1554 | * Change the state to SCI_REQ_STP_PIO_DATA_IN |
1570 | * and wait for PIO_SETUP fis / or D2H REg fis. */ | 1555 | * and wait for PIO_SETUP fis / or D2H REg fis. */ |
1571 | sci_base_state_machine_change_state( | 1556 | sci_change_state(&sci_req->sm, SCI_REQ_STP_PIO_WAIT_FRAME); |
1572 | &sci_req->state_machine, | ||
1573 | SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE | ||
1574 | ); | ||
1575 | } | 1557 | } |
1576 | break; | 1558 | break; |
1559 | |||
1577 | default: | 1560 | default: |
1578 | /* | 1561 | /* |
1579 | * All other completion status cause the IO to be complete. If a NAK | 1562 | * All other completion status cause the IO to be complete. |
1580 | * was received, then it is up to the user to retry the request. */ | 1563 | * If a NAK was received, then it is up to the user to retry |
1564 | * the request. | ||
1565 | */ | ||
1581 | scic_sds_request_set_status( | 1566 | scic_sds_request_set_status( |
1582 | sci_req, | 1567 | sci_req, |
1583 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1568 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), |
1584 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR | 1569 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
1585 | ); | ||
1586 | 1570 | ||
1587 | sci_base_state_machine_change_state( | 1571 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1588 | &sci_req->state_machine, | ||
1589 | SCI_BASE_REQUEST_STATE_COMPLETED | ||
1590 | ); | ||
1591 | break; | 1572 | break; |
1592 | } | 1573 | } |
1593 | 1574 | ||
@@ -1600,8 +1581,7 @@ static void scic_sds_stp_request_udma_complete_request( | |||
1600 | enum sci_status sci_status) | 1581 | enum sci_status sci_status) |
1601 | { | 1582 | { |
1602 | scic_sds_request_set_status(request, scu_status, sci_status); | 1583 | scic_sds_request_set_status(request, scu_status, sci_status); |
1603 | sci_base_state_machine_change_state(&request->state_machine, | 1584 | sci_change_state(&request->sm, SCI_REQ_COMPLETED); |
1604 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1605 | } | 1585 | } |
1606 | 1586 | ||
1607 | static enum sci_status scic_sds_stp_request_udma_general_frame_handler(struct scic_sds_request *sci_req, | 1587 | static enum sci_status scic_sds_stp_request_udma_general_frame_handler(struct scic_sds_request *sci_req, |
@@ -1632,8 +1612,9 @@ static enum sci_status scic_sds_stp_request_udma_general_frame_handler(struct sc | |||
1632 | return status; | 1612 | return status; |
1633 | } | 1613 | } |
1634 | 1614 | ||
1635 | enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_req, | 1615 | enum sci_status |
1636 | u32 frame_index) | 1616 | scic_sds_io_request_frame_handler(struct scic_sds_request *sci_req, |
1617 | u32 frame_index) | ||
1637 | { | 1618 | { |
1638 | struct scic_sds_controller *scic = sci_req->owning_controller; | 1619 | struct scic_sds_controller *scic = sci_req->owning_controller; |
1639 | struct scic_sds_stp_request *stp_req = &sci_req->stp.req; | 1620 | struct scic_sds_stp_request *stp_req = &sci_req->stp.req; |
@@ -1641,9 +1622,9 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
1641 | enum sci_status status; | 1622 | enum sci_status status; |
1642 | ssize_t word_cnt; | 1623 | ssize_t word_cnt; |
1643 | 1624 | ||
1644 | state = sci_req->state_machine.current_state_id; | 1625 | state = sci_req->sm.current_state_id; |
1645 | switch (state) { | 1626 | switch (state) { |
1646 | case SCI_BASE_REQUEST_STATE_STARTED: { | 1627 | case SCI_REQ_STARTED: { |
1647 | struct ssp_frame_hdr ssp_hdr; | 1628 | struct ssp_frame_hdr ssp_hdr; |
1648 | void *frame_header; | 1629 | void *frame_header; |
1649 | 1630 | ||
@@ -1684,20 +1665,21 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
1684 | } | 1665 | } |
1685 | 1666 | ||
1686 | /* | 1667 | /* |
1687 | * In any case we are done with this frame buffer return it to the | 1668 | * In any case we are done with this frame buffer return it to |
1688 | * controller | 1669 | * the controller |
1689 | */ | 1670 | */ |
1690 | scic_sds_controller_release_frame(scic, frame_index); | 1671 | scic_sds_controller_release_frame(scic, frame_index); |
1691 | 1672 | ||
1692 | return SCI_SUCCESS; | 1673 | return SCI_SUCCESS; |
1693 | } | 1674 | } |
1694 | case SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE: | 1675 | |
1676 | case SCI_REQ_TASK_WAIT_TC_RESP: | ||
1695 | scic_sds_io_request_copy_response(sci_req); | 1677 | scic_sds_io_request_copy_response(sci_req); |
1696 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1678 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1697 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1698 | scic_sds_controller_release_frame(scic,frame_index); | 1679 | scic_sds_controller_release_frame(scic,frame_index); |
1699 | return SCI_SUCCESS; | 1680 | return SCI_SUCCESS; |
1700 | case SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE: { | 1681 | |
1682 | case SCI_REQ_SMP_WAIT_RESP: { | ||
1701 | struct smp_resp *rsp_hdr = &sci_req->smp.rsp; | 1683 | struct smp_resp *rsp_hdr = &sci_req->smp.rsp; |
1702 | void *frame_header; | 1684 | void *frame_header; |
1703 | 1685 | ||
@@ -1725,32 +1707,40 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
1725 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, | 1707 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, |
1726 | SCI_SUCCESS); | 1708 | SCI_SUCCESS); |
1727 | 1709 | ||
1728 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1710 | sci_change_state(&sci_req->sm, SCI_REQ_SMP_WAIT_TC_COMP); |
1729 | SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION); | ||
1730 | } else { | 1711 | } else { |
1731 | /* This was not a response frame why did it get forwarded? */ | 1712 | /* |
1713 | * This was not a response frame why did it get | ||
1714 | * forwarded? | ||
1715 | */ | ||
1732 | dev_err(scic_to_dev(scic), | 1716 | dev_err(scic_to_dev(scic), |
1733 | "%s: SCIC SMP Request 0x%p received unexpected frame " | 1717 | "%s: SCIC SMP Request 0x%p received unexpected " |
1734 | "%d type 0x%02x\n", __func__, sci_req, | 1718 | "frame %d type 0x%02x\n", |
1735 | frame_index, rsp_hdr->frame_type); | 1719 | __func__, |
1720 | sci_req, | ||
1721 | frame_index, | ||
1722 | rsp_hdr->frame_type); | ||
1736 | 1723 | ||
1737 | scic_sds_request_set_status(sci_req, | 1724 | scic_sds_request_set_status(sci_req, |
1738 | SCU_TASK_DONE_SMP_FRM_TYPE_ERR, | 1725 | SCU_TASK_DONE_SMP_FRM_TYPE_ERR, |
1739 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | 1726 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
1740 | 1727 | ||
1741 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1728 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1742 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1743 | } | 1729 | } |
1744 | 1730 | ||
1745 | scic_sds_controller_release_frame(scic, frame_index); | 1731 | scic_sds_controller_release_frame(scic, frame_index); |
1746 | 1732 | ||
1747 | return SCI_SUCCESS; | 1733 | return SCI_SUCCESS; |
1748 | } | 1734 | } |
1749 | case SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE: | 1735 | |
1750 | return scic_sds_stp_request_udma_general_frame_handler(sci_req, frame_index); | 1736 | case SCI_REQ_STP_UDMA_WAIT_TC_COMP: |
1751 | case SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE: | 1737 | return scic_sds_stp_request_udma_general_frame_handler(sci_req, |
1738 | frame_index); | ||
1739 | |||
1740 | case SCI_REQ_STP_UDMA_WAIT_D2H: | ||
1752 | /* Use the general frame handler to copy the resposne data */ | 1741 | /* Use the general frame handler to copy the resposne data */ |
1753 | status = scic_sds_stp_request_udma_general_frame_handler(sci_req, frame_index); | 1742 | status = scic_sds_stp_request_udma_general_frame_handler(sci_req, |
1743 | frame_index); | ||
1754 | 1744 | ||
1755 | if (status != SCI_SUCCESS) | 1745 | if (status != SCI_SUCCESS) |
1756 | return status; | 1746 | return status; |
@@ -1758,8 +1748,10 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
1758 | scic_sds_stp_request_udma_complete_request(sci_req, | 1748 | scic_sds_stp_request_udma_complete_request(sci_req, |
1759 | SCU_TASK_DONE_CHECK_RESPONSE, | 1749 | SCU_TASK_DONE_CHECK_RESPONSE, |
1760 | SCI_FAILURE_IO_RESPONSE_VALID); | 1750 | SCI_FAILURE_IO_RESPONSE_VALID); |
1751 | |||
1761 | return SCI_SUCCESS; | 1752 | return SCI_SUCCESS; |
1762 | case SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE: { | 1753 | |
1754 | case SCI_REQ_STP_NON_DATA_WAIT_D2H: { | ||
1763 | struct dev_to_host_fis *frame_header; | 1755 | struct dev_to_host_fis *frame_header; |
1764 | u32 *frame_buffer; | 1756 | u32 *frame_buffer; |
1765 | 1757 | ||
@@ -1769,9 +1761,12 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
1769 | 1761 | ||
1770 | if (status != SCI_SUCCESS) { | 1762 | if (status != SCI_SUCCESS) { |
1771 | dev_err(scic_to_dev(scic), | 1763 | dev_err(scic_to_dev(scic), |
1772 | "%s: SCIC IO Request 0x%p could not get frame header " | 1764 | "%s: SCIC IO Request 0x%p could not get frame " |
1773 | "for frame index %d, status %x\n", | 1765 | "header for frame index %d, status %x\n", |
1774 | __func__, stp_req, frame_index, status); | 1766 | __func__, |
1767 | stp_req, | ||
1768 | frame_index, | ||
1769 | status); | ||
1775 | 1770 | ||
1776 | return status; | 1771 | return status; |
1777 | } | 1772 | } |
@@ -1802,15 +1797,15 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
1802 | break; | 1797 | break; |
1803 | } | 1798 | } |
1804 | 1799 | ||
1805 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1800 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1806 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1807 | 1801 | ||
1808 | /* Frame has been decoded return it to the controller */ | 1802 | /* Frame has been decoded return it to the controller */ |
1809 | scic_sds_controller_release_frame(scic, frame_index); | 1803 | scic_sds_controller_release_frame(scic, frame_index); |
1810 | 1804 | ||
1811 | return status; | 1805 | return status; |
1812 | } | 1806 | } |
1813 | case SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE: { | 1807 | |
1808 | case SCI_REQ_STP_PIO_WAIT_FRAME: { | ||
1814 | struct isci_request *ireq = sci_req_to_ireq(sci_req); | 1809 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
1815 | struct sas_task *task = isci_request_access_task(ireq); | 1810 | struct sas_task *task = isci_request_access_task(ireq); |
1816 | struct dev_to_host_fis *frame_header; | 1811 | struct dev_to_host_fis *frame_header; |
@@ -1822,8 +1817,8 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
1822 | 1817 | ||
1823 | if (status != SCI_SUCCESS) { | 1818 | if (status != SCI_SUCCESS) { |
1824 | dev_err(scic_to_dev(scic), | 1819 | dev_err(scic_to_dev(scic), |
1825 | "%s: SCIC IO Request 0x%p could not get frame header " | 1820 | "%s: SCIC IO Request 0x%p could not get frame " |
1826 | "for frame index %d, status %x\n", | 1821 | "header for frame index %d, status %x\n", |
1827 | __func__, stp_req, frame_index, status); | 1822 | __func__, stp_req, frame_index, status); |
1828 | return status; | 1823 | return status; |
1829 | } | 1824 | } |
@@ -1835,9 +1830,10 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
1835 | frame_index, | 1830 | frame_index, |
1836 | (void **)&frame_buffer); | 1831 | (void **)&frame_buffer); |
1837 | 1832 | ||
1838 | /* Get the data from the PIO Setup The SCU Hardware returns | 1833 | /* Get the data from the PIO Setup The SCU Hardware |
1839 | * first word in the frame_header and the rest of the data is in | 1834 | * returns first word in the frame_header and the rest |
1840 | * the frame buffer so we need to back up one dword | 1835 | * of the data is in the frame buffer so we need to |
1836 | * back up one dword | ||
1841 | */ | 1837 | */ |
1842 | 1838 | ||
1843 | /* transfer_count: first 16bits in the 4th dword */ | 1839 | /* transfer_count: first 16bits in the 4th dword */ |
@@ -1856,31 +1852,33 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
1856 | * request was PIO Data-in or Data out | 1852 | * request was PIO Data-in or Data out |
1857 | */ | 1853 | */ |
1858 | if (task->data_dir == DMA_FROM_DEVICE) { | 1854 | if (task->data_dir == DMA_FROM_DEVICE) { |
1859 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1855 | sci_change_state(&sci_req->sm, SCI_REQ_STP_PIO_DATA_IN); |
1860 | SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE); | ||
1861 | } else if (task->data_dir == DMA_TO_DEVICE) { | 1856 | } else if (task->data_dir == DMA_TO_DEVICE) { |
1862 | /* Transmit data */ | 1857 | /* Transmit data */ |
1863 | status = scic_sds_stp_request_pio_data_out_transmit_data(sci_req); | 1858 | status = scic_sds_stp_request_pio_data_out_transmit_data(sci_req); |
1864 | if (status != SCI_SUCCESS) | 1859 | if (status != SCI_SUCCESS) |
1865 | break; | 1860 | break; |
1866 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1861 | sci_change_state(&sci_req->sm, SCI_REQ_STP_PIO_DATA_OUT); |
1867 | SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE); | ||
1868 | } | 1862 | } |
1869 | break; | 1863 | break; |
1864 | |||
1870 | case FIS_SETDEVBITS: | 1865 | case FIS_SETDEVBITS: |
1871 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1866 | sci_change_state(&sci_req->sm, SCI_REQ_STP_PIO_WAIT_FRAME); |
1872 | SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE); | ||
1873 | break; | 1867 | break; |
1868 | |||
1874 | case FIS_REGD2H: | 1869 | case FIS_REGD2H: |
1875 | if (frame_header->status & ATA_BUSY) { | 1870 | if (frame_header->status & ATA_BUSY) { |
1876 | /* Now why is the drive sending a D2H Register FIS when | 1871 | /* |
1877 | * it is still busy? Do nothing since we are still in | 1872 | * Now why is the drive sending a D2H Register |
1878 | * the right state. | 1873 | * FIS when it is still busy? Do nothing since |
1874 | * we are still in the right state. | ||
1879 | */ | 1875 | */ |
1880 | dev_dbg(scic_to_dev(scic), | 1876 | dev_dbg(scic_to_dev(scic), |
1881 | "%s: SCIC PIO Request 0x%p received " | 1877 | "%s: SCIC PIO Request 0x%p received " |
1882 | "D2H Register FIS with BSY status " | 1878 | "D2H Register FIS with BSY status " |
1883 | "0x%x\n", __func__, stp_req, | 1879 | "0x%x\n", |
1880 | __func__, | ||
1881 | stp_req, | ||
1884 | frame_header->status); | 1882 | frame_header->status); |
1885 | break; | 1883 | break; |
1886 | } | 1884 | } |
@@ -1897,9 +1895,9 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
1897 | SCU_TASK_DONE_CHECK_RESPONSE, | 1895 | SCU_TASK_DONE_CHECK_RESPONSE, |
1898 | SCI_FAILURE_IO_RESPONSE_VALID); | 1896 | SCI_FAILURE_IO_RESPONSE_VALID); |
1899 | 1897 | ||
1900 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1898 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1901 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1902 | break; | 1899 | break; |
1900 | |||
1903 | default: | 1901 | default: |
1904 | /* FIXME: what do we do here? */ | 1902 | /* FIXME: what do we do here? */ |
1905 | break; | 1903 | break; |
@@ -1910,7 +1908,8 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
1910 | 1908 | ||
1911 | return status; | 1909 | return status; |
1912 | } | 1910 | } |
1913 | case SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE: { | 1911 | |
1912 | case SCI_REQ_STP_PIO_DATA_IN: { | ||
1914 | struct dev_to_host_fis *frame_header; | 1913 | struct dev_to_host_fis *frame_header; |
1915 | struct sata_fis_data *frame_buffer; | 1914 | struct sata_fis_data *frame_buffer; |
1916 | 1915 | ||
@@ -1920,9 +1919,12 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
1920 | 1919 | ||
1921 | if (status != SCI_SUCCESS) { | 1920 | if (status != SCI_SUCCESS) { |
1922 | dev_err(scic_to_dev(scic), | 1921 | dev_err(scic_to_dev(scic), |
1923 | "%s: SCIC IO Request 0x%p could not get frame header " | 1922 | "%s: SCIC IO Request 0x%p could not get frame " |
1924 | "for frame index %d, status %x\n", | 1923 | "header for frame index %d, status %x\n", |
1925 | __func__, stp_req, frame_index, status); | 1924 | __func__, |
1925 | stp_req, | ||
1926 | frame_index, | ||
1927 | status); | ||
1926 | return status; | 1928 | return status; |
1927 | } | 1929 | } |
1928 | 1930 | ||
@@ -1930,15 +1932,17 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
1930 | dev_err(scic_to_dev(scic), | 1932 | dev_err(scic_to_dev(scic), |
1931 | "%s: SCIC PIO Request 0x%p received frame %d " | 1933 | "%s: SCIC PIO Request 0x%p received frame %d " |
1932 | "with fis type 0x%02x when expecting a data " | 1934 | "with fis type 0x%02x when expecting a data " |
1933 | "fis.\n", __func__, stp_req, frame_index, | 1935 | "fis.\n", |
1936 | __func__, | ||
1937 | stp_req, | ||
1938 | frame_index, | ||
1934 | frame_header->fis_type); | 1939 | frame_header->fis_type); |
1935 | 1940 | ||
1936 | scic_sds_request_set_status(sci_req, | 1941 | scic_sds_request_set_status(sci_req, |
1937 | SCU_TASK_DONE_GOOD, | 1942 | SCU_TASK_DONE_GOOD, |
1938 | SCI_FAILURE_IO_REQUIRES_SCSI_ABORT); | 1943 | SCI_FAILURE_IO_REQUIRES_SCSI_ABORT); |
1939 | 1944 | ||
1940 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1945 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1941 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1942 | 1946 | ||
1943 | /* Frame is decoded return it to the controller */ | 1947 | /* Frame is decoded return it to the controller */ |
1944 | scic_sds_controller_release_frame(scic, frame_index); | 1948 | scic_sds_controller_release_frame(scic, frame_index); |
@@ -1972,15 +1976,14 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
1972 | SCU_TASK_DONE_CHECK_RESPONSE, | 1976 | SCU_TASK_DONE_CHECK_RESPONSE, |
1973 | SCI_FAILURE_IO_RESPONSE_VALID); | 1977 | SCI_FAILURE_IO_RESPONSE_VALID); |
1974 | 1978 | ||
1975 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1979 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
1976 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1977 | } else { | 1980 | } else { |
1978 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1981 | sci_change_state(&sci_req->sm, SCI_REQ_STP_PIO_WAIT_FRAME); |
1979 | SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE); | ||
1980 | } | 1982 | } |
1981 | return status; | 1983 | return status; |
1982 | } | 1984 | } |
1983 | case SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE: { | 1985 | |
1986 | case SCI_REQ_STP_SOFT_RESET_WAIT_D2H: { | ||
1984 | struct dev_to_host_fis *frame_header; | 1987 | struct dev_to_host_fis *frame_header; |
1985 | u32 *frame_buffer; | 1988 | u32 *frame_buffer; |
1986 | 1989 | ||
@@ -1989,9 +1992,12 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
1989 | (void **)&frame_header); | 1992 | (void **)&frame_header); |
1990 | if (status != SCI_SUCCESS) { | 1993 | if (status != SCI_SUCCESS) { |
1991 | dev_err(scic_to_dev(scic), | 1994 | dev_err(scic_to_dev(scic), |
1992 | "%s: SCIC IO Request 0x%p could not get frame header " | 1995 | "%s: SCIC IO Request 0x%p could not get frame " |
1993 | "for frame index %d, status %x\n", | 1996 | "header for frame index %d, status %x\n", |
1994 | __func__, stp_req, frame_index, status); | 1997 | __func__, |
1998 | stp_req, | ||
1999 | frame_index, | ||
2000 | status); | ||
1995 | return status; | 2001 | return status; |
1996 | } | 2002 | } |
1997 | 2003 | ||
@@ -2010,35 +2016,43 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
2010 | SCU_TASK_DONE_CHECK_RESPONSE, | 2016 | SCU_TASK_DONE_CHECK_RESPONSE, |
2011 | SCI_FAILURE_IO_RESPONSE_VALID); | 2017 | SCI_FAILURE_IO_RESPONSE_VALID); |
2012 | break; | 2018 | break; |
2019 | |||
2013 | default: | 2020 | default: |
2014 | dev_warn(scic_to_dev(scic), | 2021 | dev_warn(scic_to_dev(scic), |
2015 | "%s: IO Request:0x%p Frame Id:%d protocol " | 2022 | "%s: IO Request:0x%p Frame Id:%d protocol " |
2016 | "violation occurred\n", __func__, stp_req, | 2023 | "violation occurred\n", |
2024 | __func__, | ||
2025 | stp_req, | ||
2017 | frame_index); | 2026 | frame_index); |
2018 | 2027 | ||
2019 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_UNEXP_FIS, | 2028 | scic_sds_request_set_status(sci_req, |
2029 | SCU_TASK_DONE_UNEXP_FIS, | ||
2020 | SCI_FAILURE_PROTOCOL_VIOLATION); | 2030 | SCI_FAILURE_PROTOCOL_VIOLATION); |
2021 | break; | 2031 | break; |
2022 | } | 2032 | } |
2023 | 2033 | ||
2024 | sci_base_state_machine_change_state(&sci_req->state_machine, | 2034 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
2025 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
2026 | 2035 | ||
2027 | /* Frame has been decoded return it to the controller */ | 2036 | /* Frame has been decoded return it to the controller */ |
2028 | scic_sds_controller_release_frame(scic, frame_index); | 2037 | scic_sds_controller_release_frame(scic, frame_index); |
2029 | 2038 | ||
2030 | return status; | 2039 | return status; |
2031 | } | 2040 | } |
2032 | case SCI_BASE_REQUEST_STATE_ABORTING: | 2041 | case SCI_REQ_ABORTING: |
2033 | /* TODO: Is it even possible to get an unsolicited frame in the | 2042 | /* |
2043 | * TODO: Is it even possible to get an unsolicited frame in the | ||
2034 | * aborting state? | 2044 | * aborting state? |
2035 | */ | 2045 | */ |
2036 | scic_sds_controller_release_frame(scic, frame_index); | 2046 | scic_sds_controller_release_frame(scic, frame_index); |
2037 | return SCI_SUCCESS; | 2047 | return SCI_SUCCESS; |
2048 | |||
2038 | default: | 2049 | default: |
2039 | dev_warn(scic_to_dev(scic), | 2050 | dev_warn(scic_to_dev(scic), |
2040 | "%s: SCIC IO Request given unexpected frame %x while in " | 2051 | "%s: SCIC IO Request given unexpected frame %x while " |
2041 | "state %d\n", __func__, frame_index, state); | 2052 | "in state %d\n", |
2053 | __func__, | ||
2054 | frame_index, | ||
2055 | state); | ||
2042 | 2056 | ||
2043 | scic_sds_controller_release_frame(scic, frame_index); | 2057 | scic_sds_controller_release_frame(scic, frame_index); |
2044 | return SCI_FAILURE_INVALID_STATE; | 2058 | return SCI_FAILURE_INVALID_STATE; |
@@ -2075,8 +2089,7 @@ static enum sci_status stp_request_udma_await_tc_event(struct scic_sds_request * | |||
2075 | * the device so we must change state to wait | 2089 | * the device so we must change state to wait |
2076 | * for it | 2090 | * for it |
2077 | */ | 2091 | */ |
2078 | sci_base_state_machine_change_state(&sci_req->state_machine, | 2092 | sci_change_state(&sci_req->sm, SCI_REQ_STP_UDMA_WAIT_D2H); |
2079 | SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE); | ||
2080 | } | 2093 | } |
2081 | break; | 2094 | break; |
2082 | 2095 | ||
@@ -2105,45 +2118,45 @@ static enum sci_status stp_request_udma_await_tc_event(struct scic_sds_request * | |||
2105 | return status; | 2118 | return status; |
2106 | } | 2119 | } |
2107 | 2120 | ||
2108 | static enum sci_status stp_request_soft_reset_await_h2d_asserted_tc_event(struct scic_sds_request *sci_req, | 2121 | static enum sci_status |
2109 | u32 completion_code) | 2122 | stp_request_soft_reset_await_h2d_asserted_tc_event(struct scic_sds_request *sci_req, |
2123 | u32 completion_code) | ||
2110 | { | 2124 | { |
2111 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 2125 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
2112 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 2126 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
2113 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, | 2127 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, |
2114 | SCI_SUCCESS); | 2128 | SCI_SUCCESS); |
2115 | 2129 | ||
2116 | sci_base_state_machine_change_state(&sci_req->state_machine, | 2130 | sci_change_state(&sci_req->sm, SCI_REQ_STP_SOFT_RESET_WAIT_H2D_DIAG); |
2117 | SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE); | ||
2118 | break; | 2131 | break; |
2119 | 2132 | ||
2120 | default: | 2133 | default: |
2121 | /* | 2134 | /* |
2122 | * All other completion status cause the IO to be complete. If a NAK | 2135 | * All other completion status cause the IO to be complete. |
2123 | * was received, then it is up to the user to retry the request. */ | 2136 | * If a NAK was received, then it is up to the user to retry |
2137 | * the request. | ||
2138 | */ | ||
2124 | scic_sds_request_set_status(sci_req, | 2139 | scic_sds_request_set_status(sci_req, |
2125 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 2140 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), |
2126 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | 2141 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
2127 | 2142 | ||
2128 | sci_base_state_machine_change_state(&sci_req->state_machine, | 2143 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
2129 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
2130 | break; | 2144 | break; |
2131 | } | 2145 | } |
2132 | 2146 | ||
2133 | return SCI_SUCCESS; | 2147 | return SCI_SUCCESS; |
2134 | } | 2148 | } |
2135 | 2149 | ||
2136 | static enum sci_status stp_request_soft_reset_await_h2d_diagnostic_tc_event( | 2150 | static enum sci_status |
2137 | struct scic_sds_request *sci_req, | 2151 | stp_request_soft_reset_await_h2d_diagnostic_tc_event(struct scic_sds_request *sci_req, |
2138 | u32 completion_code) | 2152 | u32 completion_code) |
2139 | { | 2153 | { |
2140 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 2154 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
2141 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 2155 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
2142 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, | 2156 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, |
2143 | SCI_SUCCESS); | 2157 | SCI_SUCCESS); |
2144 | 2158 | ||
2145 | sci_base_state_machine_change_state(&sci_req->state_machine, | 2159 | sci_change_state(&sci_req->sm, SCI_REQ_STP_SOFT_RESET_WAIT_D2H); |
2146 | SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE); | ||
2147 | break; | 2160 | break; |
2148 | 2161 | ||
2149 | default: | 2162 | default: |
@@ -2155,8 +2168,7 @@ static enum sci_status stp_request_soft_reset_await_h2d_diagnostic_tc_event( | |||
2155 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 2168 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), |
2156 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | 2169 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
2157 | 2170 | ||
2158 | sci_base_state_machine_change_state(&sci_req->state_machine, | 2171 | sci_change_state(&sci_req->sm, SCI_REQ_COMPLETED); |
2159 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
2160 | break; | 2172 | break; |
2161 | } | 2173 | } |
2162 | 2174 | ||
@@ -2164,42 +2176,64 @@ static enum sci_status stp_request_soft_reset_await_h2d_diagnostic_tc_event( | |||
2164 | } | 2176 | } |
2165 | 2177 | ||
2166 | enum sci_status | 2178 | enum sci_status |
2167 | scic_sds_io_request_tc_completion(struct scic_sds_request *sci_req, u32 completion_code) | 2179 | scic_sds_io_request_tc_completion(struct scic_sds_request *sci_req, |
2180 | u32 completion_code) | ||
2168 | { | 2181 | { |
2169 | enum sci_base_request_states state; | 2182 | enum sci_base_request_states state; |
2170 | struct scic_sds_controller *scic = sci_req->owning_controller; | 2183 | struct scic_sds_controller *scic = sci_req->owning_controller; |
2171 | 2184 | ||
2172 | state = sci_req->state_machine.current_state_id; | 2185 | state = sci_req->sm.current_state_id; |
2173 | 2186 | ||
2174 | switch (state) { | 2187 | switch (state) { |
2175 | case SCI_BASE_REQUEST_STATE_STARTED: | 2188 | case SCI_REQ_STARTED: |
2176 | return request_started_state_tc_event(sci_req, completion_code); | 2189 | return request_started_state_tc_event(sci_req, completion_code); |
2177 | case SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION: | 2190 | |
2178 | return ssp_task_request_await_tc_event(sci_req, completion_code); | 2191 | case SCI_REQ_TASK_WAIT_TC_COMP: |
2179 | case SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE: | 2192 | return ssp_task_request_await_tc_event(sci_req, |
2180 | return smp_request_await_response_tc_event(sci_req, completion_code); | 2193 | completion_code); |
2181 | case SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION: | 2194 | |
2182 | return smp_request_await_tc_event(sci_req, completion_code); | 2195 | case SCI_REQ_SMP_WAIT_RESP: |
2183 | case SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE: | 2196 | return smp_request_await_response_tc_event(sci_req, |
2184 | return stp_request_udma_await_tc_event(sci_req, completion_code); | 2197 | completion_code); |
2185 | case SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE: | 2198 | |
2186 | return stp_request_non_data_await_h2d_tc_event(sci_req, completion_code); | 2199 | case SCI_REQ_SMP_WAIT_TC_COMP: |
2187 | case SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE: | 2200 | return smp_request_await_tc_event(sci_req, completion_code); |
2188 | return stp_request_pio_await_h2d_completion_tc_event(sci_req, completion_code); | 2201 | |
2189 | case SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE: | 2202 | case SCI_REQ_STP_UDMA_WAIT_TC_COMP: |
2190 | return pio_data_out_tx_done_tc_event(sci_req, completion_code); | 2203 | return stp_request_udma_await_tc_event(sci_req, |
2191 | case SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE: | 2204 | completion_code); |
2192 | return stp_request_soft_reset_await_h2d_asserted_tc_event(sci_req, completion_code); | 2205 | |
2193 | case SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE: | 2206 | case SCI_REQ_STP_NON_DATA_WAIT_H2D: |
2194 | return stp_request_soft_reset_await_h2d_diagnostic_tc_event(sci_req, completion_code); | 2207 | return stp_request_non_data_await_h2d_tc_event(sci_req, |
2195 | case SCI_BASE_REQUEST_STATE_ABORTING: | 2208 | completion_code); |
2196 | return request_aborting_state_tc_event(sci_req, completion_code); | 2209 | |
2197 | default: | 2210 | case SCI_REQ_STP_PIO_WAIT_H2D: |
2198 | dev_warn(scic_to_dev(scic), | 2211 | return stp_request_pio_await_h2d_completion_tc_event(sci_req, |
2199 | "%s: SCIC IO Request given task completion notification %x " | 2212 | completion_code); |
2200 | "while in wrong state %d\n", __func__, completion_code, | 2213 | |
2201 | state); | 2214 | case SCI_REQ_STP_PIO_DATA_OUT: |
2202 | return SCI_FAILURE_INVALID_STATE; | 2215 | return pio_data_out_tx_done_tc_event(sci_req, completion_code); |
2216 | |||
2217 | case SCI_REQ_STP_SOFT_RESET_WAIT_H2D_ASSERTED: | ||
2218 | return stp_request_soft_reset_await_h2d_asserted_tc_event(sci_req, | ||
2219 | completion_code); | ||
2220 | |||
2221 | case SCI_REQ_STP_SOFT_RESET_WAIT_H2D_DIAG: | ||
2222 | return stp_request_soft_reset_await_h2d_diagnostic_tc_event(sci_req, | ||
2223 | completion_code); | ||
2224 | |||
2225 | case SCI_REQ_ABORTING: | ||
2226 | return request_aborting_state_tc_event(sci_req, | ||
2227 | completion_code); | ||
2228 | |||
2229 | default: | ||
2230 | dev_warn(scic_to_dev(scic), | ||
2231 | "%s: SCIC IO Request given task completion " | ||
2232 | "notification %x while in wrong state %d\n", | ||
2233 | __func__, | ||
2234 | completion_code, | ||
2235 | state); | ||
2236 | return SCI_FAILURE_INVALID_STATE; | ||
2203 | } | 2237 | } |
2204 | } | 2238 | } |
2205 | 2239 | ||
@@ -2896,7 +2930,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2896 | 2930 | ||
2897 | static void scic_sds_request_started_state_enter(struct sci_base_state_machine *sm) | 2931 | static void scic_sds_request_started_state_enter(struct sci_base_state_machine *sm) |
2898 | { | 2932 | { |
2899 | struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), state_machine); | 2933 | struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), sm); |
2900 | struct isci_request *ireq = sci_req_to_ireq(sci_req); | 2934 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
2901 | struct domain_device *dev = sci_dev_to_domain(sci_req->target_device); | 2935 | struct domain_device *dev = sci_dev_to_domain(sci_req->target_device); |
2902 | struct sas_task *task; | 2936 | struct sas_task *task; |
@@ -2910,34 +2944,31 @@ static void scic_sds_request_started_state_enter(struct sci_base_state_machine * | |||
2910 | * substates | 2944 | * substates |
2911 | */ | 2945 | */ |
2912 | if (!task && dev->dev_type == SAS_END_DEV) { | 2946 | if (!task && dev->dev_type == SAS_END_DEV) { |
2913 | sci_base_state_machine_change_state(sm, | 2947 | sci_change_state(sm, SCI_REQ_TASK_WAIT_TC_COMP); |
2914 | SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION); | ||
2915 | } else if (!task && | 2948 | } else if (!task && |
2916 | (isci_request_access_tmf(ireq)->tmf_code == isci_tmf_sata_srst_high || | 2949 | (isci_request_access_tmf(ireq)->tmf_code == isci_tmf_sata_srst_high || |
2917 | isci_request_access_tmf(ireq)->tmf_code == isci_tmf_sata_srst_low)) { | 2950 | isci_request_access_tmf(ireq)->tmf_code == isci_tmf_sata_srst_low)) { |
2918 | sci_base_state_machine_change_state(sm, | 2951 | sci_change_state(sm, SCI_REQ_STP_SOFT_RESET_WAIT_H2D_ASSERTED); |
2919 | SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE); | ||
2920 | } else if (task && task->task_proto == SAS_PROTOCOL_SMP) { | 2952 | } else if (task && task->task_proto == SAS_PROTOCOL_SMP) { |
2921 | sci_base_state_machine_change_state(sm, | 2953 | sci_change_state(sm, SCI_REQ_SMP_WAIT_RESP); |
2922 | SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE); | ||
2923 | } else if (task && sas_protocol_ata(task->task_proto) && | 2954 | } else if (task && sas_protocol_ata(task->task_proto) && |
2924 | !task->ata_task.use_ncq) { | 2955 | !task->ata_task.use_ncq) { |
2925 | u32 state; | 2956 | u32 state; |
2926 | 2957 | ||
2927 | if (task->data_dir == DMA_NONE) | 2958 | if (task->data_dir == DMA_NONE) |
2928 | state = SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE; | 2959 | state = SCI_REQ_STP_NON_DATA_WAIT_H2D; |
2929 | else if (task->ata_task.dma_xfer) | 2960 | else if (task->ata_task.dma_xfer) |
2930 | state = SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE; | 2961 | state = SCI_REQ_STP_UDMA_WAIT_TC_COMP; |
2931 | else /* PIO */ | 2962 | else /* PIO */ |
2932 | state = SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE; | 2963 | state = SCI_REQ_STP_PIO_WAIT_H2D; |
2933 | 2964 | ||
2934 | sci_base_state_machine_change_state(sm, state); | 2965 | sci_change_state(sm, state); |
2935 | } | 2966 | } |
2936 | } | 2967 | } |
2937 | 2968 | ||
2938 | static void scic_sds_request_completed_state_enter(struct sci_base_state_machine *sm) | 2969 | static void scic_sds_request_completed_state_enter(struct sci_base_state_machine *sm) |
2939 | { | 2970 | { |
2940 | struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), state_machine); | 2971 | struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), sm); |
2941 | struct scic_sds_controller *scic = sci_req->owning_controller; | 2972 | struct scic_sds_controller *scic = sci_req->owning_controller; |
2942 | struct isci_host *ihost = scic_to_ihost(scic); | 2973 | struct isci_host *ihost = scic_to_ihost(scic); |
2943 | struct isci_request *ireq = sci_req_to_ireq(sci_req); | 2974 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
@@ -2952,7 +2983,7 @@ static void scic_sds_request_completed_state_enter(struct sci_base_state_machine | |||
2952 | 2983 | ||
2953 | static void scic_sds_request_aborting_state_enter(struct sci_base_state_machine *sm) | 2984 | static void scic_sds_request_aborting_state_enter(struct sci_base_state_machine *sm) |
2954 | { | 2985 | { |
2955 | struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), state_machine); | 2986 | struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), sm); |
2956 | 2987 | ||
2957 | /* Setting the abort bit in the Task Context is required by the silicon. */ | 2988 | /* Setting the abort bit in the Task Context is required by the silicon. */ |
2958 | sci_req->task_context_buffer->abort = 1; | 2989 | sci_req->task_context_buffer->abort = 1; |
@@ -2960,7 +2991,7 @@ static void scic_sds_request_aborting_state_enter(struct sci_base_state_machine | |||
2960 | 2991 | ||
2961 | static void scic_sds_stp_request_started_non_data_await_h2d_completion_enter(struct sci_base_state_machine *sm) | 2992 | static void scic_sds_stp_request_started_non_data_await_h2d_completion_enter(struct sci_base_state_machine *sm) |
2962 | { | 2993 | { |
2963 | struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), state_machine); | 2994 | struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), sm); |
2964 | 2995 | ||
2965 | scic_sds_remote_device_set_working_request(sci_req->target_device, | 2996 | scic_sds_remote_device_set_working_request(sci_req->target_device, |
2966 | sci_req); | 2997 | sci_req); |
@@ -2968,7 +2999,7 @@ static void scic_sds_stp_request_started_non_data_await_h2d_completion_enter(str | |||
2968 | 2999 | ||
2969 | static void scic_sds_stp_request_started_pio_await_h2d_completion_enter(struct sci_base_state_machine *sm) | 3000 | static void scic_sds_stp_request_started_pio_await_h2d_completion_enter(struct sci_base_state_machine *sm) |
2970 | { | 3001 | { |
2971 | struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), state_machine); | 3002 | struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), sm); |
2972 | 3003 | ||
2973 | scic_sds_remote_device_set_working_request(sci_req->target_device, | 3004 | scic_sds_remote_device_set_working_request(sci_req->target_device, |
2974 | sci_req); | 3005 | sci_req); |
@@ -2976,7 +3007,7 @@ static void scic_sds_stp_request_started_pio_await_h2d_completion_enter(struct s | |||
2976 | 3007 | ||
2977 | static void scic_sds_stp_request_started_soft_reset_await_h2d_asserted_completion_enter(struct sci_base_state_machine *sm) | 3008 | static void scic_sds_stp_request_started_soft_reset_await_h2d_asserted_completion_enter(struct sci_base_state_machine *sm) |
2978 | { | 3009 | { |
2979 | struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), state_machine); | 3010 | struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), sm); |
2980 | 3011 | ||
2981 | scic_sds_remote_device_set_working_request(sci_req->target_device, | 3012 | scic_sds_remote_device_set_working_request(sci_req->target_device, |
2982 | sci_req); | 3013 | sci_req); |
@@ -2984,7 +3015,7 @@ static void scic_sds_stp_request_started_soft_reset_await_h2d_asserted_completio | |||
2984 | 3015 | ||
2985 | static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_completion_enter(struct sci_base_state_machine *sm) | 3016 | static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_completion_enter(struct sci_base_state_machine *sm) |
2986 | { | 3017 | { |
2987 | struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), state_machine); | 3018 | struct scic_sds_request *sci_req = container_of(sm, typeof(*sci_req), sm); |
2988 | struct scu_task_context *task_context; | 3019 | struct scu_task_context *task_context; |
2989 | struct host_to_dev_fis *h2d_fis; | 3020 | struct host_to_dev_fis *h2d_fis; |
2990 | enum sci_status status; | 3021 | enum sci_status status; |
@@ -3003,51 +3034,53 @@ static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_complet | |||
3003 | } | 3034 | } |
3004 | 3035 | ||
3005 | static const struct sci_base_state scic_sds_request_state_table[] = { | 3036 | static const struct sci_base_state scic_sds_request_state_table[] = { |
3006 | [SCI_BASE_REQUEST_STATE_INITIAL] = { }, | 3037 | [SCI_REQ_INIT] = { }, |
3007 | [SCI_BASE_REQUEST_STATE_CONSTRUCTED] = { }, | 3038 | [SCI_REQ_CONSTRUCTED] = { }, |
3008 | [SCI_BASE_REQUEST_STATE_STARTED] = { | 3039 | [SCI_REQ_STARTED] = { |
3009 | .enter_state = scic_sds_request_started_state_enter, | 3040 | .enter_state = scic_sds_request_started_state_enter, |
3010 | }, | 3041 | }, |
3011 | [SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE] = { | 3042 | [SCI_REQ_STP_NON_DATA_WAIT_H2D] = { |
3012 | .enter_state = scic_sds_stp_request_started_non_data_await_h2d_completion_enter, | 3043 | .enter_state = scic_sds_stp_request_started_non_data_await_h2d_completion_enter, |
3013 | }, | 3044 | }, |
3014 | [SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE] = { }, | 3045 | [SCI_REQ_STP_NON_DATA_WAIT_D2H] = { }, |
3015 | [SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE] = { | 3046 | [SCI_REQ_STP_PIO_WAIT_H2D] = { |
3016 | .enter_state = scic_sds_stp_request_started_pio_await_h2d_completion_enter, | 3047 | .enter_state = scic_sds_stp_request_started_pio_await_h2d_completion_enter, |
3017 | }, | 3048 | }, |
3018 | [SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE] = { }, | 3049 | [SCI_REQ_STP_PIO_WAIT_FRAME] = { }, |
3019 | [SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE] = { }, | 3050 | [SCI_REQ_STP_PIO_DATA_IN] = { }, |
3020 | [SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE] = { }, | 3051 | [SCI_REQ_STP_PIO_DATA_OUT] = { }, |
3021 | [SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE] = { }, | 3052 | [SCI_REQ_STP_UDMA_WAIT_TC_COMP] = { }, |
3022 | [SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE] = { }, | 3053 | [SCI_REQ_STP_UDMA_WAIT_D2H] = { }, |
3023 | [SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE] = { | 3054 | [SCI_REQ_STP_SOFT_RESET_WAIT_H2D_ASSERTED] = { |
3024 | .enter_state = scic_sds_stp_request_started_soft_reset_await_h2d_asserted_completion_enter, | 3055 | .enter_state = scic_sds_stp_request_started_soft_reset_await_h2d_asserted_completion_enter, |
3025 | }, | 3056 | }, |
3026 | [SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE] = { | 3057 | [SCI_REQ_STP_SOFT_RESET_WAIT_H2D_DIAG] = { |
3027 | .enter_state = scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_completion_enter, | 3058 | .enter_state = scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_completion_enter, |
3028 | }, | 3059 | }, |
3029 | [SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE] = { }, | 3060 | [SCI_REQ_STP_SOFT_RESET_WAIT_D2H] = { }, |
3030 | [SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION] = { }, | 3061 | [SCI_REQ_TASK_WAIT_TC_COMP] = { }, |
3031 | [SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE] = { }, | 3062 | [SCI_REQ_TASK_WAIT_TC_RESP] = { }, |
3032 | [SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE] = { }, | 3063 | [SCI_REQ_SMP_WAIT_RESP] = { }, |
3033 | [SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION] = { }, | 3064 | [SCI_REQ_SMP_WAIT_TC_COMP] = { }, |
3034 | [SCI_BASE_REQUEST_STATE_COMPLETED] = { | 3065 | [SCI_REQ_COMPLETED] = { |
3035 | .enter_state = scic_sds_request_completed_state_enter, | 3066 | .enter_state = scic_sds_request_completed_state_enter, |
3036 | }, | 3067 | }, |
3037 | [SCI_BASE_REQUEST_STATE_ABORTING] = { | 3068 | [SCI_REQ_ABORTING] = { |
3038 | .enter_state = scic_sds_request_aborting_state_enter, | 3069 | .enter_state = scic_sds_request_aborting_state_enter, |
3039 | }, | 3070 | }, |
3040 | [SCI_BASE_REQUEST_STATE_FINAL] = { }, | 3071 | [SCI_REQ_FINAL] = { }, |
3041 | }; | 3072 | }; |
3042 | 3073 | ||
3043 | static void scic_sds_general_request_construct(struct scic_sds_controller *scic, | 3074 | static void |
3044 | struct scic_sds_remote_device *sci_dev, | 3075 | scic_sds_general_request_construct(struct scic_sds_controller *scic, |
3045 | u16 io_tag, struct scic_sds_request *sci_req) | 3076 | struct scic_sds_remote_device *sci_dev, |
3077 | u16 io_tag, | ||
3078 | struct scic_sds_request *sci_req) | ||
3046 | { | 3079 | { |
3047 | sci_base_state_machine_construct(&sci_req->state_machine, | 3080 | sci_base_state_machine_construct(&sci_req->sm, |
3048 | scic_sds_request_state_table, | 3081 | scic_sds_request_state_table, |
3049 | SCI_BASE_REQUEST_STATE_INITIAL); | 3082 | SCI_REQ_INIT); |
3050 | sci_base_state_machine_start(&sci_req->state_machine); | 3083 | sci_base_state_machine_start(&sci_req->sm); |
3051 | 3084 | ||
3052 | sci_req->io_tag = io_tag; | 3085 | sci_req->io_tag = io_tag; |
3053 | sci_req->owning_controller = scic; | 3086 | sci_req->owning_controller = scic; |
@@ -3322,8 +3355,7 @@ scic_io_request_construct_smp(struct scic_sds_request *sci_req) | |||
3322 | 3355 | ||
3323 | scu_smp_request_construct_task_context(sci_req, smp_req->req_len); | 3356 | scu_smp_request_construct_task_context(sci_req, smp_req->req_len); |
3324 | 3357 | ||
3325 | sci_base_state_machine_change_state(&sci_req->state_machine, | 3358 | sci_change_state(&sci_req->sm, SCI_REQ_CONSTRUCTED); |
3326 | SCI_BASE_REQUEST_STATE_CONSTRUCTED); | ||
3327 | 3359 | ||
3328 | return SCI_SUCCESS; | 3360 | return SCI_SUCCESS; |
3329 | } | 3361 | } |
diff --git a/drivers/scsi/isci/request.h b/drivers/scsi/isci/request.h index 31d6d5717473..757cd99ae2ed 100644 --- a/drivers/scsi/isci/request.h +++ b/drivers/scsi/isci/request.h | |||
@@ -96,37 +96,42 @@ struct scic_sds_stp_request { | |||
96 | u32 udma; | 96 | u32 udma; |
97 | 97 | ||
98 | struct scic_sds_stp_pio_request { | 98 | struct scic_sds_stp_pio_request { |
99 | /** | 99 | /* |
100 | * Total transfer for the entire PIO request recorded at request constuction | 100 | * Total transfer for the entire PIO request recorded |
101 | * time. | 101 | * at request constuction time. |
102 | * | 102 | * |
103 | * @todo Should we just decrement this value for each byte of data transitted | 103 | * @todo Should we just decrement this value for each |
104 | * or received to elemenate the current_transfer_bytes field? | 104 | * byte of data transitted or received to elemenate |
105 | * the current_transfer_bytes field? | ||
105 | */ | 106 | */ |
106 | u32 total_transfer_bytes; | 107 | u32 total_transfer_bytes; |
107 | 108 | ||
108 | /** | 109 | /* |
109 | * Total number of bytes received/transmitted in data frames since the start | 110 | * Total number of bytes received/transmitted in data |
110 | * of the IO request. At the end of the IO request this should equal the | 111 | * frames since the start of the IO request. At the |
112 | * end of the IO request this should equal the | ||
111 | * total_transfer_bytes. | 113 | * total_transfer_bytes. |
112 | */ | 114 | */ |
113 | u32 current_transfer_bytes; | 115 | u32 current_transfer_bytes; |
114 | 116 | ||
115 | /** | 117 | /* |
116 | * The number of bytes requested in the in the PIO setup. | 118 | * The number of bytes requested in the in the PIO |
119 | * setup. | ||
117 | */ | 120 | */ |
118 | u32 pio_transfer_bytes; | 121 | u32 pio_transfer_bytes; |
119 | 122 | ||
120 | /** | 123 | /* |
121 | * PIO Setup ending status value to tell us if we need to wait for another FIS | 124 | * PIO Setup ending status value to tell us if we need |
122 | * or if the transfer is complete. On the receipt of a D2H FIS this will be | 125 | * to wait for another FIS or if the transfer is |
126 | * complete. On the receipt of a D2H FIS this will be | ||
123 | * the status field of that FIS. | 127 | * the status field of that FIS. |
124 | */ | 128 | */ |
125 | u8 ending_status; | 129 | u8 ending_status; |
126 | 130 | ||
127 | /** | 131 | /* |
128 | * On receipt of a D2H FIS this will be the ending error field if the | 132 | * On receipt of a D2H FIS this will be the ending |
129 | * ending_status has the SATA_STATUS_ERR bit set. | 133 | * error field if the ending_status has the |
134 | * SATA_STATUS_ERR bit set. | ||
130 | */ | 135 | */ |
131 | u8 ending_error; | 136 | u8 ending_error; |
132 | 137 | ||
@@ -138,8 +143,9 @@ struct scic_sds_stp_request { | |||
138 | } pio; | 143 | } pio; |
139 | 144 | ||
140 | struct { | 145 | struct { |
141 | /** | 146 | /* |
142 | * The number of bytes requested in the PIO setup before CDB data frame. | 147 | * The number of bytes requested in the PIO setup |
148 | * before CDB data frame. | ||
143 | */ | 149 | */ |
144 | u32 device_preferred_cdb_length; | 150 | u32 device_preferred_cdb_length; |
145 | } packet; | 151 | } packet; |
@@ -147,57 +153,59 @@ struct scic_sds_stp_request { | |||
147 | }; | 153 | }; |
148 | 154 | ||
149 | struct scic_sds_request { | 155 | struct scic_sds_request { |
150 | /** | 156 | /* |
151 | * This field contains the information for the base request state machine. | 157 | * This field contains the information for the base request state |
158 | * machine. | ||
152 | */ | 159 | */ |
153 | struct sci_base_state_machine state_machine; | 160 | struct sci_base_state_machine sm; |
154 | 161 | ||
155 | /** | 162 | /* |
156 | * This field simply points to the controller to which this IO request | 163 | * This field simply points to the controller to which this IO request |
157 | * is associated. | 164 | * is associated. |
158 | */ | 165 | */ |
159 | struct scic_sds_controller *owning_controller; | 166 | struct scic_sds_controller *owning_controller; |
160 | 167 | ||
161 | /** | 168 | /* |
162 | * This field simply points to the remote device to which this IO request | 169 | * This field simply points to the remote device to which this IO |
163 | * is associated. | 170 | * request is associated. |
164 | */ | 171 | */ |
165 | struct scic_sds_remote_device *target_device; | 172 | struct scic_sds_remote_device *target_device; |
166 | 173 | ||
167 | /** | 174 | /* |
168 | * This field is utilized to determine if the SCI user is managing | 175 | * This field is utilized to determine if the SCI user is managing |
169 | * the IO tag for this request or if the core is managing it. | 176 | * the IO tag for this request or if the core is managing it. |
170 | */ | 177 | */ |
171 | bool was_tag_assigned_by_user; | 178 | bool was_tag_assigned_by_user; |
172 | 179 | ||
173 | /** | 180 | /* |
174 | * This field indicates the IO tag for this request. The IO tag is | 181 | * This field indicates the IO tag for this request. The IO tag is |
175 | * comprised of the task_index and a sequence count. The sequence count | 182 | * comprised of the task_index and a sequence count. The sequence count |
176 | * is utilized to help identify tasks from one life to another. | 183 | * is utilized to help identify tasks from one life to another. |
177 | */ | 184 | */ |
178 | u16 io_tag; | 185 | u16 io_tag; |
179 | 186 | ||
180 | /** | 187 | /* |
181 | * This field specifies the protocol being utilized for this | 188 | * This field specifies the protocol being utilized for this |
182 | * IO request. | 189 | * IO request. |
183 | */ | 190 | */ |
184 | enum sci_request_protocol protocol; | 191 | enum sci_request_protocol protocol; |
185 | 192 | ||
186 | /** | 193 | /* |
187 | * This field indicates the completion status taken from the SCUs | 194 | * This field indicates the completion status taken from the SCUs |
188 | * completion code. It indicates the completion result for the SCU hardware. | 195 | * completion code. It indicates the completion result for the SCU |
196 | * hardware. | ||
189 | */ | 197 | */ |
190 | u32 scu_status; | 198 | u32 scu_status; |
191 | 199 | ||
192 | /** | 200 | /* |
193 | * This field indicates the completion status returned to the SCI user. It | 201 | * This field indicates the completion status returned to the SCI user. |
194 | * indicates the users view of the io request completion. | 202 | * It indicates the users view of the io request completion. |
195 | */ | 203 | */ |
196 | u32 sci_status; | 204 | u32 sci_status; |
197 | 205 | ||
198 | /** | 206 | /* |
199 | * This field contains the value to be utilized when posting (e.g. Post_TC, | 207 | * This field contains the value to be utilized when posting |
200 | * Post_TC_Abort) this request to the silicon. | 208 | * (e.g. Post_TC, * Post_TC_Abort) this request to the silicon. |
201 | */ | 209 | */ |
202 | u32 post_context; | 210 | u32 post_context; |
203 | 211 | ||
@@ -208,26 +216,26 @@ struct scic_sds_request { | |||
208 | #define SCU_SGL_SIZE ((SCU_IO_REQUEST_SGE_COUNT + 1) / 2) | 216 | #define SCU_SGL_SIZE ((SCU_IO_REQUEST_SGE_COUNT + 1) / 2) |
209 | struct scu_sgl_element_pair sg_table[SCU_SGL_SIZE] __attribute__ ((aligned(32))); | 217 | struct scu_sgl_element_pair sg_table[SCU_SGL_SIZE] __attribute__ ((aligned(32))); |
210 | 218 | ||
211 | /** | 219 | /* |
212 | * This field indicates if this request is a task management request or | 220 | * This field indicates if this request is a task management request or |
213 | * normal IO request. | 221 | * normal IO request. |
214 | */ | 222 | */ |
215 | bool is_task_management_request; | 223 | bool is_task_management_request; |
216 | 224 | ||
217 | /** | 225 | /* |
218 | * This field is a pointer to the stored rx frame data. It is used in STP | 226 | * This field is a pointer to the stored rx frame data. It is used in |
219 | * internal requests and SMP response frames. If this field is non-NULL the | 227 | * STP internal requests and SMP response frames. If this field is |
220 | * saved frame must be released on IO request completion. | 228 | * non-NULL the saved frame must be released on IO request completion. |
221 | * | 229 | * |
222 | * @todo In the future do we want to keep a list of RX frame buffers? | 230 | * @todo In the future do we want to keep a list of RX frame buffers? |
223 | */ | 231 | */ |
224 | u32 saved_rx_frame_index; | 232 | u32 saved_rx_frame_index; |
225 | 233 | ||
226 | /** | 234 | /* |
227 | * This field in the recorded device sequence for the io request. This is | 235 | * This field in the recorded device sequence for the io request. |
228 | * recorded during the build operation and is compared in the start | 236 | * This is recorded during the build operation and is compared in the |
229 | * operation. If the sequence is different then there was a change of | 237 | * start operation. If the sequence is different then there was a |
230 | * devices from the build to start operations. | 238 | * change of devices from the build to start operations. |
231 | */ | 239 | */ |
232 | u8 device_sequence; | 240 | u8 device_sequence; |
233 | 241 | ||
@@ -286,7 +294,7 @@ struct isci_request { | |||
286 | dma_addr_t request_daddr; | 294 | dma_addr_t request_daddr; |
287 | dma_addr_t zero_scatter_daddr; | 295 | dma_addr_t zero_scatter_daddr; |
288 | 296 | ||
289 | unsigned int num_sg_entries; /* returned by pci_alloc_sg */ | 297 | unsigned int num_sg_entries; /* returned by pci_alloc_sg */ |
290 | 298 | ||
291 | /** Note: "io_request_completion" is completed in two different ways | 299 | /** Note: "io_request_completion" is completed in two different ways |
292 | * depending on whether this is a TMF or regular request. | 300 | * depending on whether this is a TMF or regular request. |
@@ -315,104 +323,105 @@ static inline struct isci_request *sci_req_to_ireq(struct scic_sds_request *sci_ | |||
315 | * | 323 | * |
316 | */ | 324 | */ |
317 | enum sci_base_request_states { | 325 | enum sci_base_request_states { |
318 | /** | 326 | /* |
319 | * Simply the initial state for the base request state machine. | 327 | * Simply the initial state for the base request state machine. |
320 | */ | 328 | */ |
321 | SCI_BASE_REQUEST_STATE_INITIAL, | 329 | SCI_REQ_INIT, |
322 | 330 | ||
323 | /** | 331 | /* |
324 | * This state indicates that the request has been constructed. This state | 332 | * This state indicates that the request has been constructed. |
325 | * is entered from the INITIAL state. | 333 | * This state is entered from the INITIAL state. |
326 | */ | 334 | */ |
327 | SCI_BASE_REQUEST_STATE_CONSTRUCTED, | 335 | SCI_REQ_CONSTRUCTED, |
328 | 336 | ||
329 | /** | 337 | /* |
330 | * This state indicates that the request has been started. This state is | 338 | * This state indicates that the request has been started. This state |
331 | * entered from the CONSTRUCTED state. | 339 | * is entered from the CONSTRUCTED state. |
332 | */ | 340 | */ |
333 | SCI_BASE_REQUEST_STATE_STARTED, | 341 | SCI_REQ_STARTED, |
334 | 342 | ||
335 | SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE, | 343 | SCI_REQ_STP_UDMA_WAIT_TC_COMP, |
336 | SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE, | 344 | SCI_REQ_STP_UDMA_WAIT_D2H, |
337 | 345 | ||
338 | SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE, | 346 | SCI_REQ_STP_NON_DATA_WAIT_H2D, |
339 | SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE, | 347 | SCI_REQ_STP_NON_DATA_WAIT_D2H, |
340 | 348 | ||
341 | SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE, | 349 | SCI_REQ_STP_SOFT_RESET_WAIT_H2D_ASSERTED, |
342 | SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE, | 350 | SCI_REQ_STP_SOFT_RESET_WAIT_H2D_DIAG, |
343 | SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE, | 351 | SCI_REQ_STP_SOFT_RESET_WAIT_D2H, |
344 | 352 | ||
345 | /** | 353 | /* |
346 | * While in this state the IO request object is waiting for the TC completion | 354 | * While in this state the IO request object is waiting for the TC |
347 | * notification for the H2D Register FIS | 355 | * completion notification for the H2D Register FIS |
348 | */ | 356 | */ |
349 | SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE, | 357 | SCI_REQ_STP_PIO_WAIT_H2D, |
350 | 358 | ||
351 | /** | 359 | /* |
352 | * While in this state the IO request object is waiting for either a PIO Setup | 360 | * While in this state the IO request object is waiting for either a |
353 | * FIS or a D2H register FIS. The type of frame received is based on the | 361 | * PIO Setup FIS or a D2H register FIS. The type of frame received is |
354 | * result of the prior frame and line conditions. | 362 | * based on the result of the prior frame and line conditions. |
355 | */ | 363 | */ |
356 | SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE, | 364 | SCI_REQ_STP_PIO_WAIT_FRAME, |
357 | 365 | ||
358 | /** | 366 | /* |
359 | * While in this state the IO request object is waiting for a DATA frame from | 367 | * While in this state the IO request object is waiting for a DATA |
360 | * the device. | 368 | * frame from the device. |
361 | */ | 369 | */ |
362 | SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE, | 370 | SCI_REQ_STP_PIO_DATA_IN, |
363 | 371 | ||
364 | /** | 372 | /* |
365 | * While in this state the IO request object is waiting to transmit the next data | 373 | * While in this state the IO request object is waiting to transmit |
366 | * frame to the device. | 374 | * the next data frame to the device. |
367 | */ | 375 | */ |
368 | SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE, | 376 | SCI_REQ_STP_PIO_DATA_OUT, |
369 | 377 | ||
370 | /** | 378 | /* |
371 | * The AWAIT_TC_COMPLETION sub-state indicates that the started raw | 379 | * The AWAIT_TC_COMPLETION sub-state indicates that the started raw |
372 | * task management request is waiting for the transmission of the | 380 | * task management request is waiting for the transmission of the |
373 | * initial frame (i.e. command, task, etc.). | 381 | * initial frame (i.e. command, task, etc.). |
374 | */ | 382 | */ |
375 | SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION, | 383 | SCI_REQ_TASK_WAIT_TC_COMP, |
376 | 384 | ||
377 | /** | 385 | /* |
378 | * This sub-state indicates that the started task management request | 386 | * This sub-state indicates that the started task management request |
379 | * is waiting for the reception of an unsolicited frame | 387 | * is waiting for the reception of an unsolicited frame |
380 | * (i.e. response IU). | 388 | * (i.e. response IU). |
381 | */ | 389 | */ |
382 | SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE, | 390 | SCI_REQ_TASK_WAIT_TC_RESP, |
383 | 391 | ||
384 | /** | 392 | /* |
385 | * This sub-state indicates that the started task management request | 393 | * This sub-state indicates that the started task management request |
386 | * is waiting for the reception of an unsolicited frame | 394 | * is waiting for the reception of an unsolicited frame |
387 | * (i.e. response IU). | 395 | * (i.e. response IU). |
388 | */ | 396 | */ |
389 | SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE, | 397 | SCI_REQ_SMP_WAIT_RESP, |
390 | 398 | ||
391 | /** | 399 | /* |
392 | * The AWAIT_TC_COMPLETION sub-state indicates that the started SMP request is | 400 | * The AWAIT_TC_COMPLETION sub-state indicates that the started SMP |
393 | * waiting for the transmission of the initial frame (i.e. command, task, etc.). | 401 | * request is waiting for the transmission of the initial frame |
402 | * (i.e. command, task, etc.). | ||
394 | */ | 403 | */ |
395 | SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION, | 404 | SCI_REQ_SMP_WAIT_TC_COMP, |
396 | 405 | ||
397 | /** | 406 | /* |
398 | * This state indicates that the request has completed. | 407 | * This state indicates that the request has completed. |
399 | * This state is entered from the STARTED state. This state is entered from | 408 | * This state is entered from the STARTED state. This state is entered |
400 | * the ABORTING state. | 409 | * from the ABORTING state. |
401 | */ | 410 | */ |
402 | SCI_BASE_REQUEST_STATE_COMPLETED, | 411 | SCI_REQ_COMPLETED, |
403 | 412 | ||
404 | /** | 413 | /* |
405 | * This state indicates that the request is in the process of being | 414 | * This state indicates that the request is in the process of being |
406 | * terminated/aborted. | 415 | * terminated/aborted. |
407 | * This state is entered from the CONSTRUCTED state. | 416 | * This state is entered from the CONSTRUCTED state. |
408 | * This state is entered from the STARTED state. | 417 | * This state is entered from the STARTED state. |
409 | */ | 418 | */ |
410 | SCI_BASE_REQUEST_STATE_ABORTING, | 419 | SCI_REQ_ABORTING, |
411 | 420 | ||
412 | /** | 421 | /* |
413 | * Simply the final state for the base request state machine. | 422 | * Simply the final state for the base request state machine. |
414 | */ | 423 | */ |
415 | SCI_BASE_REQUEST_STATE_FINAL, | 424 | SCI_REQ_FINAL, |
416 | }; | 425 | }; |
417 | 426 | ||
418 | /** | 427 | /** |
@@ -498,13 +507,18 @@ enum sci_base_request_states { | |||
498 | 507 | ||
499 | enum sci_status scic_sds_request_start(struct scic_sds_request *sci_req); | 508 | enum sci_status scic_sds_request_start(struct scic_sds_request *sci_req); |
500 | enum sci_status scic_sds_io_request_terminate(struct scic_sds_request *sci_req); | 509 | enum sci_status scic_sds_io_request_terminate(struct scic_sds_request *sci_req); |
501 | enum sci_status scic_sds_io_request_event_handler(struct scic_sds_request *sci_req, | 510 | enum sci_status |
502 | u32 event_code); | 511 | scic_sds_io_request_event_handler(struct scic_sds_request *sci_req, |
503 | enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_req, | 512 | u32 event_code); |
504 | u32 frame_index); | 513 | enum sci_status |
505 | enum sci_status scic_sds_task_request_terminate(struct scic_sds_request *sci_req); | 514 | scic_sds_io_request_frame_handler(struct scic_sds_request *sci_req, |
506 | extern enum sci_status scic_sds_request_complete(struct scic_sds_request *sci_req); | 515 | u32 frame_index); |
507 | extern enum sci_status scic_sds_io_request_tc_completion(struct scic_sds_request *sci_req, u32 code); | 516 | enum sci_status |
517 | scic_sds_task_request_terminate(struct scic_sds_request *sci_req); | ||
518 | extern enum sci_status | ||
519 | scic_sds_request_complete(struct scic_sds_request *sci_req); | ||
520 | extern enum sci_status | ||
521 | scic_sds_io_request_tc_completion(struct scic_sds_request *sci_req, u32 code); | ||
508 | 522 | ||
509 | /* XXX open code in caller */ | 523 | /* XXX open code in caller */ |
510 | static inline void *scic_request_get_virt_addr(struct scic_sds_request *sci_req, | 524 | static inline void *scic_request_get_virt_addr(struct scic_sds_request *sci_req, |
@@ -523,8 +537,8 @@ static inline void *scic_request_get_virt_addr(struct scic_sds_request *sci_req, | |||
523 | } | 537 | } |
524 | 538 | ||
525 | /* XXX open code in caller */ | 539 | /* XXX open code in caller */ |
526 | static inline dma_addr_t scic_io_request_get_dma_addr(struct scic_sds_request *sci_req, | 540 | static inline dma_addr_t |
527 | void *virt_addr) | 541 | scic_io_request_get_dma_addr(struct scic_sds_request *sci_req, void *virt_addr) |
528 | { | 542 | { |
529 | struct isci_request *ireq = sci_req_to_ireq(sci_req); | 543 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
530 | 544 | ||
@@ -543,9 +557,8 @@ static inline dma_addr_t scic_io_request_get_dma_addr(struct scic_sds_request *s | |||
543 | * | 557 | * |
544 | * status of the object as a isci_request_status enum. | 558 | * status of the object as a isci_request_status enum. |
545 | */ | 559 | */ |
546 | static inline | 560 | static inline enum isci_request_status |
547 | enum isci_request_status isci_request_get_state( | 561 | isci_request_get_state(struct isci_request *isci_request) |
548 | struct isci_request *isci_request) | ||
549 | { | 562 | { |
550 | BUG_ON(isci_request == NULL); | 563 | BUG_ON(isci_request == NULL); |
551 | 564 | ||
@@ -566,9 +579,9 @@ enum isci_request_status isci_request_get_state( | |||
566 | * @status: This Parameter is the new status of the object | 579 | * @status: This Parameter is the new status of the object |
567 | * | 580 | * |
568 | */ | 581 | */ |
569 | static inline enum isci_request_status isci_request_change_state( | 582 | static inline enum isci_request_status |
570 | struct isci_request *isci_request, | 583 | isci_request_change_state(struct isci_request *isci_request, |
571 | enum isci_request_status status) | 584 | enum isci_request_status status) |
572 | { | 585 | { |
573 | enum isci_request_status old_state; | 586 | enum isci_request_status old_state; |
574 | unsigned long flags; | 587 | unsigned long flags; |
@@ -597,10 +610,10 @@ static inline enum isci_request_status isci_request_change_state( | |||
597 | * | 610 | * |
598 | * state previous to any change. | 611 | * state previous to any change. |
599 | */ | 612 | */ |
600 | static inline enum isci_request_status isci_request_change_started_to_newstate( | 613 | static inline enum isci_request_status |
601 | struct isci_request *isci_request, | 614 | isci_request_change_started_to_newstate(struct isci_request *isci_request, |
602 | struct completion *completion_ptr, | 615 | struct completion *completion_ptr, |
603 | enum isci_request_status newstate) | 616 | enum isci_request_status newstate) |
604 | { | 617 | { |
605 | enum isci_request_status old_state; | 618 | enum isci_request_status old_state; |
606 | unsigned long flags; | 619 | unsigned long flags; |
@@ -615,6 +628,7 @@ static inline enum isci_request_status isci_request_change_started_to_newstate( | |||
615 | isci_request->io_request_completion = completion_ptr; | 628 | isci_request->io_request_completion = completion_ptr; |
616 | isci_request->status = newstate; | 629 | isci_request->status = newstate; |
617 | } | 630 | } |
631 | |||
618 | spin_unlock_irqrestore(&isci_request->state_lock, flags); | 632 | spin_unlock_irqrestore(&isci_request->state_lock, flags); |
619 | 633 | ||
620 | dev_dbg(&isci_request->isci_host->pdev->dev, | 634 | dev_dbg(&isci_request->isci_host->pdev->dev, |
@@ -635,13 +649,13 @@ static inline enum isci_request_status isci_request_change_started_to_newstate( | |||
635 | * | 649 | * |
636 | * state previous to any change. | 650 | * state previous to any change. |
637 | */ | 651 | */ |
638 | static inline enum isci_request_status isci_request_change_started_to_aborted( | 652 | static inline enum isci_request_status |
639 | struct isci_request *isci_request, | 653 | isci_request_change_started_to_aborted(struct isci_request *isci_request, |
640 | struct completion *completion_ptr) | 654 | struct completion *completion_ptr) |
641 | { | 655 | { |
642 | return isci_request_change_started_to_newstate( | 656 | return isci_request_change_started_to_newstate(isci_request, |
643 | isci_request, completion_ptr, aborted | 657 | completion_ptr, |
644 | ); | 658 | aborted); |
645 | } | 659 | } |
646 | /** | 660 | /** |
647 | * isci_request_free() - This function frees the request object. | 661 | * isci_request_free() - This function frees the request object. |
@@ -649,62 +663,33 @@ static inline enum isci_request_status isci_request_change_started_to_aborted( | |||
649 | * @isci_request: This parameter points to the isci_request object | 663 | * @isci_request: This parameter points to the isci_request object |
650 | * | 664 | * |
651 | */ | 665 | */ |
652 | static inline void isci_request_free( | 666 | static inline void isci_request_free(struct isci_host *isci_host, |
653 | struct isci_host *isci_host, | 667 | struct isci_request *isci_request) |
654 | struct isci_request *isci_request) | ||
655 | { | 668 | { |
656 | if (!isci_request) | 669 | if (!isci_request) |
657 | return; | 670 | return; |
658 | 671 | ||
659 | /* release the dma memory if we fail. */ | 672 | /* release the dma memory if we fail. */ |
660 | dma_pool_free(isci_host->dma_pool, isci_request, | 673 | dma_pool_free(isci_host->dma_pool, |
674 | isci_request, | ||
661 | isci_request->request_daddr); | 675 | isci_request->request_daddr); |
662 | } | 676 | } |
663 | 677 | ||
678 | #define isci_request_access_task(req) ((req)->ttype_ptr.io_task_ptr) | ||
664 | 679 | ||
665 | /* #define ISCI_REQUEST_VALIDATE_ACCESS | 680 | #define isci_request_access_tmf(req) ((req)->ttype_ptr.tmf_task_ptr) |
666 | */ | ||
667 | |||
668 | #ifdef ISCI_REQUEST_VALIDATE_ACCESS | ||
669 | |||
670 | static inline | ||
671 | struct sas_task *isci_request_access_task(struct isci_request *isci_request) | ||
672 | { | ||
673 | BUG_ON(isci_request->ttype != io_task); | ||
674 | return isci_request->ttype_ptr.io_task_ptr; | ||
675 | } | ||
676 | |||
677 | static inline | ||
678 | struct isci_tmf *isci_request_access_tmf(struct isci_request *isci_request) | ||
679 | { | ||
680 | BUG_ON(isci_request->ttype != tmf_task); | ||
681 | return isci_request->ttype_ptr.tmf_task_ptr; | ||
682 | } | ||
683 | |||
684 | #else /* not ISCI_REQUEST_VALIDATE_ACCESS */ | ||
685 | |||
686 | #define isci_request_access_task(RequestPtr) \ | ||
687 | ((RequestPtr)->ttype_ptr.io_task_ptr) | ||
688 | |||
689 | #define isci_request_access_tmf(RequestPtr) \ | ||
690 | ((RequestPtr)->ttype_ptr.tmf_task_ptr) | ||
691 | |||
692 | #endif /* not ISCI_REQUEST_VALIDATE_ACCESS */ | ||
693 | |||
694 | 681 | ||
695 | int isci_request_alloc_tmf( | 682 | int isci_request_alloc_tmf(struct isci_host *isci_host, |
696 | struct isci_host *isci_host, | 683 | struct isci_tmf *isci_tmf, |
697 | struct isci_tmf *isci_tmf, | 684 | struct isci_request **isci_request, |
698 | struct isci_request **isci_request, | 685 | struct isci_remote_device *isci_device, |
699 | struct isci_remote_device *isci_device, | 686 | gfp_t gfp_flags); |
700 | gfp_t gfp_flags); | ||
701 | 687 | ||
702 | 688 | ||
703 | int isci_request_execute( | 689 | int isci_request_execute(struct isci_host *isci_host, |
704 | struct isci_host *isci_host, | 690 | struct sas_task *task, |
705 | struct sas_task *task, | 691 | struct isci_request **request, |
706 | struct isci_request **request, | 692 | gfp_t gfp_flags); |
707 | gfp_t gfp_flags); | ||
708 | 693 | ||
709 | /** | 694 | /** |
710 | * isci_request_unmap_sgl() - This function unmaps the DMA address of a given | 695 | * isci_request_unmap_sgl() - This function unmaps the DMA address of a given |
@@ -713,9 +698,8 @@ int isci_request_execute( | |||
713 | * @*pdev: This Parameter is the pci_device struct for the controller | 698 | * @*pdev: This Parameter is the pci_device struct for the controller |
714 | * | 699 | * |
715 | */ | 700 | */ |
716 | static inline void isci_request_unmap_sgl( | 701 | static inline void |
717 | struct isci_request *request, | 702 | isci_request_unmap_sgl(struct isci_request *request, struct pci_dev *pdev) |
718 | struct pci_dev *pdev) | ||
719 | { | 703 | { |
720 | struct sas_task *task = isci_request_access_task(request); | 704 | struct sas_task *task = isci_request_access_task(request); |
721 | 705 | ||
@@ -758,9 +742,9 @@ static inline void isci_request_unmap_sgl( | |||
758 | * | 742 | * |
759 | * pointer to the next sge for specified request. | 743 | * pointer to the next sge for specified request. |
760 | */ | 744 | */ |
761 | static inline void *isci_request_io_request_get_next_sge( | 745 | static inline void * |
762 | struct isci_request *request, | 746 | isci_request_io_request_get_next_sge(struct isci_request *request, |
763 | void *current_sge_address) | 747 | void *current_sge_address) |
764 | { | 748 | { |
765 | struct sas_task *task = isci_request_access_task(request); | 749 | struct sas_task *task = isci_request_access_task(request); |
766 | void *ret = NULL; | 750 | void *ret = NULL; |
@@ -791,15 +775,20 @@ static inline void *isci_request_io_request_get_next_sge( | |||
791 | return ret; | 775 | return ret; |
792 | } | 776 | } |
793 | 777 | ||
794 | void isci_terminate_pending_requests(struct isci_host *isci_host, | 778 | void |
795 | struct isci_remote_device *isci_device, | 779 | isci_terminate_pending_requests(struct isci_host *isci_host, |
796 | enum isci_request_status new_request_state); | 780 | struct isci_remote_device *isci_device, |
797 | enum sci_status scic_task_request_construct(struct scic_sds_controller *scic, | 781 | enum isci_request_status new_request_state); |
798 | struct scic_sds_remote_device *sci_dev, | 782 | enum sci_status |
799 | u16 io_tag, | 783 | scic_task_request_construct(struct scic_sds_controller *scic, |
800 | struct scic_sds_request *sci_req); | 784 | struct scic_sds_remote_device *sci_dev, |
801 | enum sci_status scic_task_request_construct_ssp(struct scic_sds_request *sci_req); | 785 | u16 io_tag, |
802 | enum sci_status scic_task_request_construct_sata(struct scic_sds_request *sci_req); | 786 | struct scic_sds_request *sci_req); |
803 | void scic_stp_io_request_set_ncq_tag(struct scic_sds_request *sci_req, u16 ncq_tag); | 787 | enum sci_status |
788 | scic_task_request_construct_ssp(struct scic_sds_request *sci_req); | ||
789 | enum sci_status | ||
790 | scic_task_request_construct_sata(struct scic_sds_request *sci_req); | ||
791 | void | ||
792 | scic_stp_io_request_set_ncq_tag(struct scic_sds_request *sci_req, u16 ncq_tag); | ||
804 | void scic_sds_smp_request_copy_response(struct scic_sds_request *sci_req); | 793 | void scic_sds_smp_request_copy_response(struct scic_sds_request *sci_req); |
805 | #endif /* !defined(_ISCI_REQUEST_H_) */ | 794 | #endif /* !defined(_ISCI_REQUEST_H_) */ |
diff --git a/drivers/scsi/isci/state_machine.c b/drivers/scsi/isci/state_machine.c index 1bcd925e502f..8cfefb959f22 100644 --- a/drivers/scsi/isci/state_machine.c +++ b/drivers/scsi/isci/state_machine.c | |||
@@ -127,16 +127,7 @@ void sci_base_state_machine_stop( | |||
127 | sci_state_machine_exit_state(sm); | 127 | sci_state_machine_exit_state(sm); |
128 | } | 128 | } |
129 | 129 | ||
130 | /** | 130 | void sci_change_state(struct sci_base_state_machine *sm, u32 next_state) |
131 | * This method performs an update to the current state of the state machine. | ||
132 | * @sm: This parameter specifies the state machine for which | ||
133 | * the caller wishes to perform a state change. | ||
134 | * @next_state: This parameter specifies the new state for the state machine. | ||
135 | * | ||
136 | */ | ||
137 | void sci_base_state_machine_change_state( | ||
138 | struct sci_base_state_machine *sm, | ||
139 | u32 next_state) | ||
140 | { | 131 | { |
141 | sci_state_machine_exit_state(sm); | 132 | sci_state_machine_exit_state(sm); |
142 | 133 | ||
@@ -145,18 +136,3 @@ void sci_base_state_machine_change_state( | |||
145 | 136 | ||
146 | sci_state_machine_enter_state(sm); | 137 | sci_state_machine_enter_state(sm); |
147 | } | 138 | } |
148 | |||
149 | /** | ||
150 | * This method simply returns the current state of the state machine to the | ||
151 | * caller. | ||
152 | * @sm: This parameter specifies the state machine for which to | ||
153 | * retrieve the current state. | ||
154 | * | ||
155 | * This method returns a u32 value indicating the current state for the | ||
156 | * supplied state machine. | ||
157 | */ | ||
158 | u32 sci_base_state_machine_get_state(struct sci_base_state_machine *sm) | ||
159 | { | ||
160 | return sm->current_state_id; | ||
161 | } | ||
162 | |||
diff --git a/drivers/scsi/isci/state_machine.h b/drivers/scsi/isci/state_machine.h index 067ed9126bf2..6cb55a0adc54 100644 --- a/drivers/scsi/isci/state_machine.h +++ b/drivers/scsi/isci/state_machine.h | |||
@@ -117,8 +117,6 @@ void sci_base_state_machine_construct(struct sci_base_state_machine *sm, | |||
117 | u32 initial_state); | 117 | u32 initial_state); |
118 | void sci_base_state_machine_start(struct sci_base_state_machine *sm); | 118 | void sci_base_state_machine_start(struct sci_base_state_machine *sm); |
119 | void sci_base_state_machine_stop(struct sci_base_state_machine *sm); | 119 | void sci_base_state_machine_stop(struct sci_base_state_machine *sm); |
120 | void sci_base_state_machine_change_state(struct sci_base_state_machine *sm, | 120 | void sci_change_state(struct sci_base_state_machine *sm, u32 next_state); |
121 | u32 next_state); | ||
122 | u32 sci_base_state_machine_get_state(struct sci_base_state_machine *sm); | ||
123 | 121 | ||
124 | #endif /* _SCI_BASE_STATE_MACHINE_H_ */ | 122 | #endif /* _SCI_BASE_STATE_MACHINE_H_ */ |