diff options
author | Edmund Nadolski <edmund.nadolski@intel.com> | 2011-05-19 07:59:56 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:49 -0400 |
commit | 6cb5853d3e252015eaf72d3761491e3da959556d (patch) | |
tree | e62addf161577f80ed350ef5478a2f9d558a2a48 /drivers/scsi/isci/host.c | |
parent | 0473661a125905240879456567e117ed8a58cf5d (diff) |
isci: convert scic_timeout_timer to sci_timer
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/host.c')
-rw-r--r-- | drivers/scsi/isci/host.c | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index 7b497f2667b7..156b37563761 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c | |||
@@ -1115,7 +1115,7 @@ static enum sci_status scic_controller_start(struct scic_sds_controller *scic, | |||
1115 | 1115 | ||
1116 | scic_sds_controller_start_next_phy(scic); | 1116 | scic_sds_controller_start_next_phy(scic); |
1117 | 1117 | ||
1118 | isci_timer_start(scic->timeout_timer, timeout); | 1118 | sci_mod_timer(&scic->timer, timeout); |
1119 | 1119 | ||
1120 | sci_base_state_machine_change_state(&scic->state_machine, | 1120 | sci_base_state_machine_change_state(&scic->state_machine, |
1121 | SCI_BASE_CONTROLLER_STATE_STARTING); | 1121 | SCI_BASE_CONTROLLER_STATE_STARTING); |
@@ -1296,7 +1296,7 @@ static enum sci_status scic_controller_stop(struct scic_sds_controller *scic, | |||
1296 | return SCI_FAILURE_INVALID_STATE; | 1296 | return SCI_FAILURE_INVALID_STATE; |
1297 | } | 1297 | } |
1298 | 1298 | ||
1299 | isci_timer_start(scic->timeout_timer, timeout); | 1299 | sci_mod_timer(&scic->timer, timeout); |
1300 | sci_base_state_machine_change_state(&scic->state_machine, | 1300 | sci_base_state_machine_change_state(&scic->state_machine, |
1301 | SCI_BASE_CONTROLLER_STATE_STOPPING); | 1301 | SCI_BASE_CONTROLLER_STATE_STOPPING); |
1302 | return SCI_SUCCESS; | 1302 | return SCI_SUCCESS; |
@@ -1376,6 +1376,8 @@ void isci_host_deinit(struct isci_host *ihost) | |||
1376 | 1376 | ||
1377 | del_timer_sync(&ihost->sci.power_control.timer.timer); | 1377 | del_timer_sync(&ihost->sci.power_control.timer.timer); |
1378 | 1378 | ||
1379 | del_timer_sync(&ihost->sci.timer.timer); | ||
1380 | |||
1379 | isci_timer_list_destroy(ihost); | 1381 | isci_timer_list_destroy(ihost); |
1380 | } | 1382 | } |
1381 | 1383 | ||
@@ -1433,7 +1435,7 @@ static inline void scic_sds_controller_starting_state_exit(struct sci_base_state | |||
1433 | { | 1435 | { |
1434 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine); | 1436 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine); |
1435 | 1437 | ||
1436 | isci_timer_stop(scic->timeout_timer); | 1438 | sci_del_timer(&scic->timer); |
1437 | } | 1439 | } |
1438 | 1440 | ||
1439 | #define INTERRUPT_COALESCE_TIMEOUT_BASE_RANGE_LOWER_BOUND_NS 853 | 1441 | #define INTERRUPT_COALESCE_TIMEOUT_BASE_RANGE_LOWER_BOUND_NS 853 |
@@ -1669,7 +1671,7 @@ static void scic_sds_controller_stopping_state_exit(struct sci_base_state_machin | |||
1669 | { | 1671 | { |
1670 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine); | 1672 | struct scic_sds_controller *scic = container_of(sm, typeof(*scic), state_machine); |
1671 | 1673 | ||
1672 | isci_timer_stop(scic->timeout_timer); | 1674 | sci_del_timer(&scic->timer); |
1673 | } | 1675 | } |
1674 | 1676 | ||
1675 | 1677 | ||
@@ -1776,7 +1778,33 @@ static void scic_sds_controller_set_default_config_parameters(struct scic_sds_co | |||
1776 | scic->user_parameters.sds1.no_outbound_task_timeout = 20; | 1778 | scic->user_parameters.sds1.no_outbound_task_timeout = 20; |
1777 | } | 1779 | } |
1778 | 1780 | ||
1781 | static void controller_timeout(unsigned long data) | ||
1782 | { | ||
1783 | struct sci_timer *tmr = (struct sci_timer *)data; | ||
1784 | struct scic_sds_controller *scic = container_of(tmr, typeof(*scic), timer); | ||
1785 | struct isci_host *ihost = scic_to_ihost(scic); | ||
1786 | struct sci_base_state_machine *sm = &scic->state_machine; | ||
1787 | unsigned long flags; | ||
1788 | |||
1789 | spin_lock_irqsave(&ihost->scic_lock, flags); | ||
1790 | |||
1791 | if (tmr->cancel) | ||
1792 | goto done; | ||
1793 | |||
1794 | if (sm->current_state_id == SCI_BASE_CONTROLLER_STATE_STARTING) | ||
1795 | scic_sds_controller_transition_to_ready(scic, SCI_FAILURE_TIMEOUT); | ||
1796 | else if (sm->current_state_id == SCI_BASE_CONTROLLER_STATE_STOPPING) { | ||
1797 | sci_base_state_machine_change_state(sm, SCI_BASE_CONTROLLER_STATE_FAILED); | ||
1798 | isci_host_stop_complete(ihost, SCI_FAILURE_TIMEOUT); | ||
1799 | } else /* / @todo Now what do we want to do in this case? */ | ||
1800 | dev_err(scic_to_dev(scic), | ||
1801 | "%s: Controller timer fired when controller was not " | ||
1802 | "in a state being timed.\n", | ||
1803 | __func__); | ||
1779 | 1804 | ||
1805 | done: | ||
1806 | spin_unlock_irqrestore(&ihost->scic_lock, flags); | ||
1807 | } | ||
1780 | 1808 | ||
1781 | /** | 1809 | /** |
1782 | * scic_controller_construct() - This method will attempt to construct a | 1810 | * scic_controller_construct() - This method will attempt to construct a |
@@ -1826,6 +1854,8 @@ static enum sci_status scic_controller_construct(struct scic_sds_controller *sci | |||
1826 | 1854 | ||
1827 | scic->invalid_phy_mask = 0; | 1855 | scic->invalid_phy_mask = 0; |
1828 | 1856 | ||
1857 | sci_init_timer(&scic->timer, controller_timeout); | ||
1858 | |||
1829 | /* Set the default maximum values */ | 1859 | /* Set the default maximum values */ |
1830 | scic->completion_event_entries = SCU_EVENT_COUNT; | 1860 | scic->completion_event_entries = SCU_EVENT_COUNT; |
1831 | scic->completion_queue_entries = SCU_COMPLETION_QUEUE_COUNT; | 1861 | scic->completion_queue_entries = SCU_COMPLETION_QUEUE_COUNT; |
@@ -1901,24 +1931,6 @@ void scic_oem_parameters_get( | |||
1901 | memcpy(scic_parms, (&scic->oem_parameters), sizeof(*scic_parms)); | 1931 | memcpy(scic_parms, (&scic->oem_parameters), sizeof(*scic_parms)); |
1902 | } | 1932 | } |
1903 | 1933 | ||
1904 | static void scic_sds_controller_timeout_handler(void *_scic) | ||
1905 | { | ||
1906 | struct scic_sds_controller *scic = _scic; | ||
1907 | struct isci_host *ihost = scic_to_ihost(scic); | ||
1908 | struct sci_base_state_machine *sm = &scic->state_machine; | ||
1909 | |||
1910 | if (sm->current_state_id == SCI_BASE_CONTROLLER_STATE_STARTING) | ||
1911 | scic_sds_controller_transition_to_ready(scic, SCI_FAILURE_TIMEOUT); | ||
1912 | else if (sm->current_state_id == SCI_BASE_CONTROLLER_STATE_STOPPING) { | ||
1913 | sci_base_state_machine_change_state(sm, SCI_BASE_CONTROLLER_STATE_FAILED); | ||
1914 | isci_host_stop_complete(ihost, SCI_FAILURE_TIMEOUT); | ||
1915 | } else /* / @todo Now what do we want to do in this case? */ | ||
1916 | dev_err(scic_to_dev(scic), | ||
1917 | "%s: Controller timer fired when controller was not " | ||
1918 | "in a state being timed.\n", | ||
1919 | __func__); | ||
1920 | } | ||
1921 | |||
1922 | static enum sci_status scic_sds_controller_initialize_phy_startup(struct scic_sds_controller *scic) | 1934 | static enum sci_status scic_sds_controller_initialize_phy_startup(struct scic_sds_controller *scic) |
1923 | { | 1935 | { |
1924 | struct isci_host *ihost = scic_to_ihost(scic); | 1936 | struct isci_host *ihost = scic_to_ihost(scic); |
@@ -2246,9 +2258,6 @@ static enum sci_status scic_controller_initialize(struct scic_sds_controller *sc | |||
2246 | 2258 | ||
2247 | sci_base_state_machine_change_state(sm, SCI_BASE_CONTROLLER_STATE_INITIALIZING); | 2259 | sci_base_state_machine_change_state(sm, SCI_BASE_CONTROLLER_STATE_INITIALIZING); |
2248 | 2260 | ||
2249 | scic->timeout_timer = isci_timer_create(ihost, scic, | ||
2250 | scic_sds_controller_timeout_handler); | ||
2251 | |||
2252 | scic_sds_controller_initialize_phy_startup(scic); | 2261 | scic_sds_controller_initialize_phy_startup(scic); |
2253 | 2262 | ||
2254 | scic_sds_controller_initialize_power_control(scic); | 2263 | scic_sds_controller_initialize_power_control(scic); |