aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci
diff options
context:
space:
mode:
authorEdmund Nadolski <edmund.nadolski@intel.com>2011-05-19 07:59:36 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:49 -0400
commita628d478570d71fb8751ad09b8017139c5056002 (patch)
tree109dc04c6542abc528c53826ba3834e8e4c52adc /drivers/scsi/isci
parentac0eeb4f774261d1da21a68169f7ddd4f6c082fc (diff)
isci: convert phy sata_timeout_timer to sci_timer
Convert the sata_timeout_timer in the scic_sds_phy struct to use a struct 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')
-rw-r--r--drivers/scsi/isci/host.c6
-rw-r--r--drivers/scsi/isci/phy.c70
-rw-r--r--drivers/scsi/isci/phy.h8
3 files changed, 35 insertions, 49 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index 468357ffc771..aa00cce37821 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -1366,6 +1366,12 @@ void isci_host_deinit(struct isci_host *ihost)
1366 del_timer_sync(&sci_port->timer.timer); 1366 del_timer_sync(&sci_port->timer.timer);
1367 } 1367 }
1368 1368
1369 /* Cancel any/all outstanding phy timers */
1370 for (i = 0; i < SCI_MAX_PHYS; i++) {
1371 struct scic_sds_phy *sci_phy = &ihost->phys[i].sci;
1372 del_timer_sync(&sci_phy->sata_timer.timer);
1373 }
1374
1369 del_timer_sync(&ihost->sci.port_agent.timer.timer); 1375 del_timer_sync(&ihost->sci.port_agent.timer.timer);
1370 1376
1371 isci_timer_list_destroy(ihost); 1377 isci_timer_list_destroy(ihost);
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c
index f21e10e2888c..b663bbdd4e59 100644
--- a/drivers/scsi/isci/phy.c
+++ b/drivers/scsi/isci/phy.c
@@ -256,14 +256,17 @@ scic_sds_phy_link_layer_initialization(struct scic_sds_phy *sci_phy,
256 return SCI_SUCCESS; 256 return SCI_SUCCESS;
257} 257}
258 258
259/** 259static void phy_sata_timeout(unsigned long data)
260 * This function will handle the sata SIGNATURE FIS timeout condition. It will
261 * restart the starting substate machine since we dont know what has actually
262 * happening.
263 */
264static void scic_sds_phy_sata_timeout(void *phy)
265{ 260{
266 struct scic_sds_phy *sci_phy = phy; 261 struct sci_timer *tmr = (struct sci_timer *)data;
262 struct scic_sds_phy *sci_phy = container_of(tmr, typeof(*sci_phy), sata_timer);
263 struct isci_host *ihost = scic_to_ihost(sci_phy->owning_port->owning_controller);
264 unsigned long flags;
265
266 spin_lock_irqsave(&ihost->scic_lock, flags);
267
268 if (tmr->cancel)
269 goto done;
267 270
268 dev_dbg(sciphy_to_dev(sci_phy), 271 dev_dbg(sciphy_to_dev(sci_phy),
269 "%s: SCIC SDS Phy 0x%p did not receive signature fis before " 272 "%s: SCIC SDS Phy 0x%p did not receive signature fis before "
@@ -273,6 +276,8 @@ static void scic_sds_phy_sata_timeout(void *phy)
273 276
274 sci_base_state_machine_change_state(&sci_phy->state_machine, 277 sci_base_state_machine_change_state(&sci_phy->state_machine,
275 SCI_BASE_PHY_STATE_STARTING); 278 SCI_BASE_PHY_STATE_STARTING);
279done:
280 spin_unlock_irqrestore(&ihost->scic_lock, flags);
276} 281}
277 282
278/** 283/**
@@ -327,16 +332,6 @@ enum sci_status scic_sds_phy_initialize(
327 struct scu_transport_layer_registers __iomem *transport_layer_registers, 332 struct scu_transport_layer_registers __iomem *transport_layer_registers,
328 struct scu_link_layer_registers __iomem *link_layer_registers) 333 struct scu_link_layer_registers __iomem *link_layer_registers)
329{ 334{
330 struct scic_sds_controller *scic = scic_sds_phy_get_controller(sci_phy);
331 struct isci_host *ihost = scic_to_ihost(scic);
332
333 /* Create the SIGNATURE FIS Timeout timer for this phy */
334 sci_phy->sata_timeout_timer =
335 isci_timer_create(
336 ihost,
337 sci_phy,
338 scic_sds_phy_sata_timeout);
339
340 /* Perfrom the initialization of the TL hardware */ 335 /* Perfrom the initialization of the TL hardware */
341 scic_sds_phy_transport_layer_initialization( 336 scic_sds_phy_transport_layer_initialization(
342 sci_phy, 337 sci_phy,
@@ -442,9 +437,7 @@ void scic_sds_phy_get_protocols(struct scic_sds_phy *sci_phy,
442 437
443enum sci_status scic_sds_phy_start(struct scic_sds_phy *sci_phy) 438enum sci_status scic_sds_phy_start(struct scic_sds_phy *sci_phy)
444{ 439{
445 struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller;
446 enum scic_sds_phy_states state = sci_phy->state_machine.current_state_id; 440 enum scic_sds_phy_states state = sci_phy->state_machine.current_state_id;
447 struct isci_host *ihost = scic_to_ihost(scic);
448 441
449 if (state != SCI_BASE_PHY_STATE_STOPPED) { 442 if (state != SCI_BASE_PHY_STATE_STOPPED) {
450 dev_dbg(sciphy_to_dev(sci_phy), 443 dev_dbg(sciphy_to_dev(sci_phy),
@@ -452,14 +445,8 @@ enum sci_status scic_sds_phy_start(struct scic_sds_phy *sci_phy)
452 return SCI_FAILURE_INVALID_STATE; 445 return SCI_FAILURE_INVALID_STATE;
453 } 446 }
454 447
455 /* Create the SIGNATURE FIS Timeout timer for this phy */ 448 sci_base_state_machine_change_state(&sci_phy->state_machine,
456 sci_phy->sata_timeout_timer = isci_timer_create(ihost, sci_phy, 449 SCI_BASE_PHY_STATE_STARTING);
457 scic_sds_phy_sata_timeout);
458
459 if (sci_phy->sata_timeout_timer)
460 sci_base_state_machine_change_state(&sci_phy->state_machine,
461 SCI_BASE_PHY_STATE_STARTING);
462
463 return SCI_SUCCESS; 450 return SCI_SUCCESS;
464} 451}
465 452
@@ -1071,30 +1058,28 @@ static void scic_sds_phy_starting_await_sata_phy_substate_enter(struct sci_base_
1071{ 1058{
1072 struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); 1059 struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
1073 1060
1074 isci_timer_start(sci_phy->sata_timeout_timer, 1061 sci_mod_timer(&sci_phy->sata_timer, SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT);
1075 SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT);
1076} 1062}
1077 1063
1078static void scic_sds_phy_starting_await_sata_phy_substate_exit(struct sci_base_state_machine *sm) 1064static void scic_sds_phy_starting_await_sata_phy_substate_exit(struct sci_base_state_machine *sm)
1079{ 1065{
1080 struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); 1066 struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
1081 1067
1082 isci_timer_stop(sci_phy->sata_timeout_timer); 1068 sci_del_timer(&sci_phy->sata_timer);
1083} 1069}
1084 1070
1085static void scic_sds_phy_starting_await_sata_speed_substate_enter(struct sci_base_state_machine *sm) 1071static void scic_sds_phy_starting_await_sata_speed_substate_enter(struct sci_base_state_machine *sm)
1086{ 1072{
1087 struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); 1073 struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
1088 1074
1089 isci_timer_start(sci_phy->sata_timeout_timer, 1075 sci_mod_timer(&sci_phy->sata_timer, SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT);
1090 SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT);
1091} 1076}
1092 1077
1093static void scic_sds_phy_starting_await_sata_speed_substate_exit(struct sci_base_state_machine *sm) 1078static void scic_sds_phy_starting_await_sata_speed_substate_exit(struct sci_base_state_machine *sm)
1094{ 1079{
1095 struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); 1080 struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
1096 1081
1097 isci_timer_stop(sci_phy->sata_timeout_timer); 1082 sci_del_timer(&sci_phy->sata_timer);
1098} 1083}
1099 1084
1100static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(struct sci_base_state_machine *sm) 1085static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(struct sci_base_state_machine *sm)
@@ -1111,8 +1096,8 @@ static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(struct sci_bas
1111 */ 1096 */
1112 scic_sds_phy_resume(sci_phy); 1097 scic_sds_phy_resume(sci_phy);
1113 1098
1114 isci_timer_start(sci_phy->sata_timeout_timer, 1099 sci_mod_timer(&sci_phy->sata_timer,
1115 SCIC_SDS_SIGNATURE_FIS_TIMEOUT); 1100 SCIC_SDS_SIGNATURE_FIS_TIMEOUT);
1116 } else 1101 } else
1117 sci_phy->is_in_link_training = false; 1102 sci_phy->is_in_link_training = false;
1118} 1103}
@@ -1121,7 +1106,7 @@ static void scic_sds_phy_starting_await_sig_fis_uf_substate_exit(struct sci_base
1121{ 1106{
1122 struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); 1107 struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
1123 1108
1124 isci_timer_stop(sci_phy->sata_timeout_timer); 1109 sci_del_timer(&sci_phy->sata_timer);
1125} 1110}
1126 1111
1127static void scic_sds_phy_starting_final_substate_enter(struct sci_base_state_machine *sm) 1112static void scic_sds_phy_starting_final_substate_enter(struct sci_base_state_machine *sm)
@@ -1219,19 +1204,12 @@ static void scu_link_layer_tx_hard_reset(
1219static void scic_sds_phy_stopped_state_enter(struct sci_base_state_machine *sm) 1204static void scic_sds_phy_stopped_state_enter(struct sci_base_state_machine *sm)
1220{ 1205{
1221 struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine); 1206 struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
1222 struct scic_sds_port *sci_port = sci_phy->owning_port;
1223 struct scic_sds_controller *scic = sci_port->owning_controller;
1224 struct isci_host *ihost = scic_to_ihost(scic);
1225 1207
1226 /* 1208 /*
1227 * @todo We need to get to the controller to place this PE in a 1209 * @todo We need to get to the controller to place this PE in a
1228 * reset state 1210 * reset state
1229 */ 1211 */
1230 if (sci_phy->sata_timeout_timer != NULL) { 1212 sci_del_timer(&sci_phy->sata_timer);
1231 isci_del_timer(ihost, sci_phy->sata_timeout_timer);
1232
1233 sci_phy->sata_timeout_timer = NULL;
1234 }
1235 1213
1236 scu_link_layer_stop_protocol_engine(sci_phy); 1214 scu_link_layer_stop_protocol_engine(sci_phy);
1237 1215
@@ -1362,7 +1340,9 @@ void scic_sds_phy_construct(struct scic_sds_phy *sci_phy,
1362 sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_UNKNOWN; 1340 sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_UNKNOWN;
1363 sci_phy->link_layer_registers = NULL; 1341 sci_phy->link_layer_registers = NULL;
1364 sci_phy->max_negotiated_speed = SAS_LINK_RATE_UNKNOWN; 1342 sci_phy->max_negotiated_speed = SAS_LINK_RATE_UNKNOWN;
1365 sci_phy->sata_timeout_timer = NULL; 1343
1344 /* Create the SIGNATURE FIS Timeout timer for this phy */
1345 sci_init_timer(&sci_phy->sata_timer, phy_sata_timeout);
1366} 1346}
1367 1347
1368void isci_phy_init(struct isci_phy *iphy, struct isci_host *ihost, int index) 1348void isci_phy_init(struct isci_phy *iphy, struct isci_host *ihost, int index)
diff --git a/drivers/scsi/isci/phy.h b/drivers/scsi/isci/phy.h
index 7694ec4d76b5..da3f0f1d56d4 100644
--- a/drivers/scsi/isci/phy.h
+++ b/drivers/scsi/isci/phy.h
@@ -134,11 +134,11 @@ struct scic_sds_phy {
134 bool is_in_link_training; 134 bool is_in_link_training;
135 135
136 /** 136 /**
137 * This field contains a reference to the timer utilized in detecting 137 * Timer to detect when a signature FIS timeout has occurred. The
138 * when a signature FIS timeout has occurred. The signature FIS is the 138 * signature FIS is the first FIS sent by an attached SATA device
139 * first FIS sent by an attached SATA device after OOB/SN. 139 * after OOB/SN.
140 */ 140 */
141 void *sata_timeout_timer; 141 struct sci_timer sata_timer;
142 142
143 /** 143 /**
144 * This field is the pointer to the transport layer register for the SCU 144 * This field is the pointer to the transport layer register for the SCU