aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorEdmund Nadolski <edmund.nadolski@intel.com>2011-05-19 23:26:02 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:49 -0400
commitbb3dbdf6c835a145e46119ed18a920a774694583 (patch)
tree0ce8f5823212a451a705d83008d23c89f363068f /drivers/scsi
parent6cb5853d3e252015eaf72d3761491e3da959556d (diff)
isci: convert phy_startup_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')
-rw-r--r--drivers/scsi/isci/host.c70
-rw-r--r--drivers/scsi/isci/host.h11
2 files changed, 34 insertions, 47 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index 156b37563761..e79f35d510c7 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -917,21 +917,6 @@ static void scic_sds_controller_transition_to_ready(
917 } 917 }
918} 918}
919 919
920static void scic_sds_controller_phy_timer_stop(struct scic_sds_controller *scic)
921{
922 isci_timer_stop(scic->phy_startup_timer);
923
924 scic->phy_startup_timer_pending = false;
925}
926
927static void scic_sds_controller_phy_timer_start(struct scic_sds_controller *scic)
928{
929 isci_timer_start(scic->phy_startup_timer,
930 SCIC_SDS_CONTROLLER_PHY_START_TIMEOUT);
931
932 scic->phy_startup_timer_pending = true;
933}
934
935static bool is_phy_starting(struct scic_sds_phy *sci_phy) 920static bool is_phy_starting(struct scic_sds_phy *sci_phy)
936{ 921{
937 enum scic_sds_phy_states state; 922 enum scic_sds_phy_states state;
@@ -1008,7 +993,8 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro
1008 * Inform the SCI Core user and transition to the READY state. */ 993 * Inform the SCI Core user and transition to the READY state. */
1009 if (is_controller_start_complete == true) { 994 if (is_controller_start_complete == true) {
1010 scic_sds_controller_transition_to_ready(scic, SCI_SUCCESS); 995 scic_sds_controller_transition_to_ready(scic, SCI_SUCCESS);
1011 scic_sds_controller_phy_timer_stop(scic); 996 sci_del_timer(&scic->phy_timer);
997 scic->phy_startup_timer_pending = false;
1012 } 998 }
1013 } else { 999 } else {
1014 sci_phy = &ihost->phys[scic->next_phy_to_start].sci; 1000 sci_phy = &ihost->phys[scic->next_phy_to_start].sci;
@@ -1033,7 +1019,9 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro
1033 status = scic_sds_phy_start(sci_phy); 1019 status = scic_sds_phy_start(sci_phy);
1034 1020
1035 if (status == SCI_SUCCESS) { 1021 if (status == SCI_SUCCESS) {
1036 scic_sds_controller_phy_timer_start(scic); 1022 sci_mod_timer(&scic->phy_timer,
1023 SCIC_SDS_CONTROLLER_PHY_START_TIMEOUT);
1024 scic->phy_startup_timer_pending = true;
1037 } else { 1025 } else {
1038 dev_warn(scic_to_dev(scic), 1026 dev_warn(scic_to_dev(scic),
1039 "%s: Controller stop operation failed " 1027 "%s: Controller stop operation failed "
@@ -1050,15 +1038,27 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro
1050 return status; 1038 return status;
1051} 1039}
1052 1040
1053static void scic_sds_controller_phy_startup_timeout_handler(void *_scic) 1041static void phy_startup_timeout(unsigned long data)
1054{ 1042{
1055 struct scic_sds_controller *scic = _scic; 1043 struct sci_timer *tmr = (struct sci_timer *)data;
1044 struct scic_sds_controller *scic = container_of(tmr, typeof(*scic), phy_timer);
1045 struct isci_host *ihost = scic_to_ihost(scic);
1046 unsigned long flags;
1056 enum sci_status status; 1047 enum sci_status status;
1057 1048
1049 spin_lock_irqsave(&ihost->scic_lock, flags);
1050
1051 if (tmr->cancel)
1052 goto done;
1053
1058 scic->phy_startup_timer_pending = false; 1054 scic->phy_startup_timer_pending = false;
1059 status = SCI_FAILURE; 1055
1060 while (status != SCI_SUCCESS) 1056 do {
1061 status = scic_sds_controller_start_next_phy(scic); 1057 status = scic_sds_controller_start_next_phy(scic);
1058 } while (status != SCI_SUCCESS);
1059
1060done:
1061 spin_unlock_irqrestore(&ihost->scic_lock, flags);
1062} 1062}
1063 1063
1064static enum sci_status scic_controller_start(struct scic_sds_controller *scic, 1064static enum sci_status scic_controller_start(struct scic_sds_controller *scic,
@@ -1378,6 +1378,8 @@ void isci_host_deinit(struct isci_host *ihost)
1378 1378
1379 del_timer_sync(&ihost->sci.timer.timer); 1379 del_timer_sync(&ihost->sci.timer.timer);
1380 1380
1381 del_timer_sync(&ihost->sci.phy_timer.timer);
1382
1381 isci_timer_list_destroy(ihost); 1383 isci_timer_list_destroy(ihost);
1382} 1384}
1383 1385
@@ -1931,24 +1933,6 @@ void scic_oem_parameters_get(
1931 memcpy(scic_parms, (&scic->oem_parameters), sizeof(*scic_parms)); 1933 memcpy(scic_parms, (&scic->oem_parameters), sizeof(*scic_parms));
1932} 1934}
1933 1935
1934static enum sci_status scic_sds_controller_initialize_phy_startup(struct scic_sds_controller *scic)
1935{
1936 struct isci_host *ihost = scic_to_ihost(scic);
1937
1938 scic->phy_startup_timer = isci_timer_create(ihost,
1939 scic,
1940 scic_sds_controller_phy_startup_timeout_handler);
1941
1942 if (scic->phy_startup_timer == NULL)
1943 return SCI_FAILURE_INSUFFICIENT_RESOURCES;
1944 else {
1945 scic->next_phy_to_start = 0;
1946 scic->phy_startup_timer_pending = false;
1947 }
1948
1949 return SCI_SUCCESS;
1950}
1951
1952static void power_control_timeout(unsigned long data) 1936static void power_control_timeout(unsigned long data)
1953{ 1937{
1954 struct sci_timer *tmr = (struct sci_timer *)data; 1938 struct sci_timer *tmr = (struct sci_timer *)data;
@@ -2258,7 +2242,10 @@ static enum sci_status scic_controller_initialize(struct scic_sds_controller *sc
2258 2242
2259 sci_base_state_machine_change_state(sm, SCI_BASE_CONTROLLER_STATE_INITIALIZING); 2243 sci_base_state_machine_change_state(sm, SCI_BASE_CONTROLLER_STATE_INITIALIZING);
2260 2244
2261 scic_sds_controller_initialize_phy_startup(scic); 2245 sci_init_timer(&scic->phy_timer, phy_startup_timeout);
2246
2247 scic->next_phy_to_start = 0;
2248 scic->phy_startup_timer_pending = false;
2262 2249
2263 scic_sds_controller_initialize_power_control(scic); 2250 scic_sds_controller_initialize_power_control(scic);
2264 2251
@@ -2640,7 +2627,8 @@ void scic_sds_controller_link_up(struct scic_sds_controller *scic,
2640{ 2627{
2641 switch (scic->state_machine.current_state_id) { 2628 switch (scic->state_machine.current_state_id) {
2642 case SCI_BASE_CONTROLLER_STATE_STARTING: 2629 case SCI_BASE_CONTROLLER_STATE_STARTING:
2643 scic_sds_controller_phy_timer_stop(scic); 2630 sci_del_timer(&scic->phy_timer);
2631 scic->phy_startup_timer_pending = false;
2644 scic->port_agent.link_up_handler(scic, &scic->port_agent, 2632 scic->port_agent.link_up_handler(scic, &scic->port_agent,
2645 port, phy); 2633 port, phy);
2646 scic_sds_controller_start_next_phy(scic); 2634 scic_sds_controller_start_next_phy(scic);
diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h
index 80808661ce5c..9fd47b42da05 100644
--- a/drivers/scsi/isci/host.h
+++ b/drivers/scsi/isci/host.h
@@ -271,15 +271,14 @@ struct scic_sds_controller {
271 271
272 /* Phy Startup Data */ 272 /* Phy Startup Data */
273 /** 273 /**
274 * This field is the driver timer handle for controller phy request startup. 274 * Timer for controller phy request startup. On controller start the
275 * On controller start the controller will start each PHY individually in 275 * controller will start each PHY individually in order of phy index.
276 * order of phy index.
277 */ 276 */
278 void *phy_startup_timer; 277 struct sci_timer phy_timer;
279 278
280 /** 279 /**
281 * This field is set when the phy_startup_timer is running and is cleared when 280 * This field is set when the phy_timer is running and is cleared when
282 * the phy_startup_timer is stopped. 281 * the phy_timer is stopped.
283 */ 282 */
284 bool phy_startup_timer_pending; 283 bool phy_startup_timer_pending;
285 284