aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2011-05-04 21:08:35 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:46 -0400
commitf700ad4331d55df729a36b2602c4abe2d855036f (patch)
tree81d9d1cb8b6973e2c79ecc65d6f3f8604b9dd9c5 /drivers
parentd20930a2b3271b233f4bef3c59ce602dfc9e5d83 (diff)
isci: remove redundant copies of IAF
We need to remove the extra copies of identify address frame that's being kept around. We only need the one copy that libsas is using. Signed-off-by: Dave Jiang <dave.jiang@intel.com> [further cleanups] Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/isci/core/scic_phy.h43
-rw-r--r--drivers/scsi/isci/core/scic_sds_phy.c69
-rw-r--r--drivers/scsi/isci/core/scic_sds_phy.h5
-rw-r--r--drivers/scsi/isci/phy.h3
-rw-r--r--drivers/scsi/isci/port.c27
5 files changed, 11 insertions, 136 deletions
diff --git a/drivers/scsi/isci/core/scic_phy.h b/drivers/scsi/isci/core/scic_phy.h
index 8fcd3a4c5744..3f43e8d69c4f 100644
--- a/drivers/scsi/isci/core/scic_phy.h
+++ b/drivers/scsi/isci/core/scic_phy.h
@@ -287,47 +287,4 @@ enum scic_phy_counter_id {
287 SCIC_PHY_COUNTER_SN_DWORD_SYNC_ERROR 287 SCIC_PHY_COUNTER_SN_DWORD_SYNC_ERROR
288}; 288};
289 289
290
291/**
292 * scic_sas_phy_get_properties() - This method will enable the user to retrieve
293 * information specific to a SAS phy, such as: the received identify address
294 * frame, received phy capabilities, etc.
295 * @phy: this parameter specifies the phy for which to retrieve properties.
296 * @properties: This parameter specifies the properties structure into which to
297 * copy the requested information.
298 *
299 * This method returns an indication as to whether the SAS phy properties were
300 * successfully retrieved. SCI_SUCCESS This value is returned if the SAS
301 * properties are successfully retrieved. SCI_FAILURE This value is returned if
302 * the SAS properties are not successfully retrieved (e.g. It's not a SAS Phy).
303 */
304enum sci_status scic_sas_phy_get_properties(
305 struct scic_sds_phy *phy,
306 struct scic_sas_phy_properties *properties);
307
308/**
309 * scic_sata_phy_get_properties() - This method will enable the user to
310 * retrieve information specific to a SATA phy, such as: the received
311 * signature FIS, if a port selector is present, etc.
312 * @phy: this parameter specifies the phy for which to retrieve properties.
313 * @properties: This parameter specifies the properties structure into which to
314 * copy the requested information.
315 *
316 * This method returns an indication as to whether the SATA phy properties were
317 * successfully retrieved. SCI_SUCCESS This value is returned if the SATA
318 * properties are successfully retrieved. SCI_FAILURE This value is returned if
319 * the SATA properties are not successfully retrieved (e.g. It's not a SATA
320 * Phy).
321 */
322enum sci_status scic_sata_phy_get_properties(
323 struct scic_sds_phy *phy,
324 struct scic_sata_phy_properties *properties);
325
326
327
328
329
330
331
332#endif /* _SCIC_PHY_H_ */ 290#endif /* _SCIC_PHY_H_ */
333
diff --git a/drivers/scsi/isci/core/scic_sds_phy.c b/drivers/scsi/isci/core/scic_sds_phy.c
index bd2b30587703..4afdb422ab98 100644
--- a/drivers/scsi/isci/core/scic_sds_phy.c
+++ b/drivers/scsi/isci/core/scic_sds_phy.c
@@ -436,8 +436,9 @@ void scic_sds_phy_get_attached_sas_address(struct scic_sds_phy *sci_phy,
436 struct sci_sas_address *sas_address) 436 struct sci_sas_address *sas_address)
437{ 437{
438 struct sas_identify_frame *iaf; 438 struct sas_identify_frame *iaf;
439 struct isci_phy *iphy = sci_phy->iphy;
439 440
440 iaf = &sci_phy->phy_type.sas_id_frame; 441 iaf = &iphy->frame_rcvd.iaf;
441 memcpy(sas_address, iaf->sas_addr, SAS_ADDR_SIZE); 442 memcpy(sas_address, iaf->sas_addr, SAS_ADDR_SIZE);
442} 443}
443 444
@@ -458,13 +459,13 @@ void scic_sds_phy_get_attached_phy_protocols(
458 protocols->u.all = 0; 459 protocols->u.all = 0;
459 460
460 if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) { 461 if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) {
462 struct isci_phy *iphy = sci_phy->iphy;
461 struct sas_identify_frame *iaf; 463 struct sas_identify_frame *iaf;
462 464
463 iaf = &sci_phy->phy_type.sas_id_frame; 465 iaf = &iphy->frame_rcvd.iaf;
464 memcpy(&protocols->u.all, &iaf->initiator_bits, 2); 466 memcpy(&protocols->u.all, &iaf->initiator_bits, 2);
465 } else if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) { 467 } else if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA)
466 protocols->u.bits.stp_target = 1; 468 protocols->u.bits.stp_target = 1;
467 }
468} 469}
469 470
470/* 471/*
@@ -551,49 +552,6 @@ enum sci_status scic_sds_phy_consume_power_handler(
551 552
552/* 553/*
553 * ***************************************************************************** 554 * *****************************************************************************
554 * * SCIC PHY Public Methods
555 * ***************************************************************************** */
556
557
558enum sci_status scic_sas_phy_get_properties(
559 struct scic_sds_phy *sci_phy,
560 struct scic_sas_phy_properties *properties)
561{
562 if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) {
563 memcpy(&properties->rcvd_iaf,
564 &sci_phy->phy_type.sas_id_frame,
565 sizeof(struct sas_identify_frame));
566
567 properties->rcvd_cap.all =
568 readl(&sci_phy->link_layer_registers->receive_phycap);
569
570 return SCI_SUCCESS;
571 }
572
573 return SCI_FAILURE;
574}
575
576
577enum sci_status scic_sata_phy_get_properties(
578 struct scic_sds_phy *sci_phy,
579 struct scic_sata_phy_properties *properties)
580{
581 if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) {
582 memcpy(&properties->signature_fis,
583 &sci_phy->phy_type.sata_sig_fis,
584 sizeof(struct dev_to_host_fis));
585
586 /* / @todo add support for port selectors. */
587 properties->is_port_selector_present = false;
588
589 return SCI_SUCCESS;
590 }
591
592 return SCI_FAILURE;
593}
594
595/*
596 * *****************************************************************************
597 * * SCIC SDS PHY HELPER FUNCTIONS 555 * * SCIC SDS PHY HELPER FUNCTIONS
598 * ***************************************************************************** */ 556 * ***************************************************************************** */
599 557
@@ -1163,6 +1121,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_frame_handler
1163 enum sci_status result; 1121 enum sci_status result;
1164 u32 *frame_words; 1122 u32 *frame_words;
1165 struct sas_identify_frame *identify_frame; 1123 struct sas_identify_frame *identify_frame;
1124 struct isci_phy *iphy = sci_phy->iphy;
1166 1125
1167 result = scic_sds_unsolicited_frame_control_get_header( 1126 result = scic_sds_unsolicited_frame_control_get_header(
1168 &(scic_sds_phy_get_controller(sci_phy)->uf_control), 1127 &(scic_sds_phy_get_controller(sci_phy)->uf_control),
@@ -1188,9 +1147,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_frame_handler
1188 frame_words[4] = SCIC_SWAP_DWORD(frame_words[4]); 1147 frame_words[4] = SCIC_SWAP_DWORD(frame_words[4]);
1189 frame_words[5] = SCIC_SWAP_DWORD(frame_words[5]); 1148 frame_words[5] = SCIC_SWAP_DWORD(frame_words[5]);
1190 1149
1191 memcpy(&sci_phy->phy_type.sas_id_frame, 1150 memcpy(&iphy->frame_rcvd.iaf, identify_frame, sizeof(*identify_frame));
1192 identify_frame,
1193 sizeof(struct sas_identify_frame));
1194 1151
1195 if (identify_frame->smp_tport) { 1152 if (identify_frame->smp_tport) {
1196 /* We got the IAF for an expander PHY go to the final state since 1153 /* We got the IAF for an expander PHY go to the final state since
@@ -1239,6 +1196,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_frame_handle
1239 enum sci_status result; 1196 enum sci_status result;
1240 struct dev_to_host_fis *frame_header; 1197 struct dev_to_host_fis *frame_header;
1241 u32 *fis_frame_data; 1198 u32 *fis_frame_data;
1199 struct isci_phy *iphy = sci_phy->iphy;
1242 1200
1243 result = scic_sds_unsolicited_frame_control_get_header( 1201 result = scic_sds_unsolicited_frame_control_get_header(
1244 &(scic_sds_phy_get_controller(sci_phy)->uf_control), 1202 &(scic_sds_phy_get_controller(sci_phy)->uf_control),
@@ -1255,10 +1213,9 @@ static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_frame_handle
1255 frame_index, 1213 frame_index,
1256 (void **)&fis_frame_data); 1214 (void **)&fis_frame_data);
1257 1215
1258 scic_sds_controller_copy_sata_response( 1216 scic_sds_controller_copy_sata_response(&iphy->frame_rcvd.fis,
1259 &sci_phy->phy_type.sata_sig_fis, 1217 frame_header,
1260 frame_header, 1218 fis_frame_data);
1261 fis_frame_data);
1262 1219
1263 /* got IAF we can now go to the await spinup semaphore state */ 1220 /* got IAF we can now go to the await spinup semaphore state */
1264 sci_base_state_machine_change_state(&sci_phy->starting_substate_machine, 1221 sci_base_state_machine_change_state(&sci_phy->starting_substate_machine,
@@ -2330,7 +2287,6 @@ static const struct sci_base_state scic_sds_phy_state_table[] = {
2330void scic_sds_phy_construct(struct scic_sds_phy *sci_phy, 2287void scic_sds_phy_construct(struct scic_sds_phy *sci_phy,
2331 struct scic_sds_port *owning_port, u8 phy_index) 2288 struct scic_sds_port *owning_port, u8 phy_index)
2332{ 2289{
2333
2334 sci_base_state_machine_construct(&sci_phy->state_machine, 2290 sci_base_state_machine_construct(&sci_phy->state_machine,
2335 sci_phy, 2291 sci_phy,
2336 scic_sds_phy_state_table, 2292 scic_sds_phy_state_table,
@@ -2347,9 +2303,6 @@ void scic_sds_phy_construct(struct scic_sds_phy *sci_phy,
2347 sci_phy->max_negotiated_speed = SAS_LINK_RATE_UNKNOWN; 2303 sci_phy->max_negotiated_speed = SAS_LINK_RATE_UNKNOWN;
2348 sci_phy->sata_timeout_timer = NULL; 2304 sci_phy->sata_timeout_timer = NULL;
2349 2305
2350 /* Clear out the identification buffer data */
2351 memset(&sci_phy->phy_type, 0, sizeof(sci_phy->phy_type));
2352
2353 /* Initialize the the substate machines */ 2306 /* Initialize the the substate machines */
2354 sci_base_state_machine_construct(&sci_phy->starting_substate_machine, 2307 sci_base_state_machine_construct(&sci_phy->starting_substate_machine,
2355 sci_phy, 2308 sci_phy,
diff --git a/drivers/scsi/isci/core/scic_sds_phy.h b/drivers/scsi/isci/core/scic_sds_phy.h
index 47b2194574a0..e91f28316c00 100644
--- a/drivers/scsi/isci/core/scic_sds_phy.h
+++ b/drivers/scsi/isci/core/scic_sds_phy.h
@@ -272,11 +272,6 @@ struct scic_sds_phy {
272 */ 272 */
273 bool is_in_link_training; 273 bool is_in_link_training;
274 274
275 union {
276 struct sas_identify_frame sas_id_frame;
277 struct dev_to_host_fis sata_sig_fis;
278 } phy_type;
279
280 /** 275 /**
281 * This field contains a reference to the timer utilized in detecting 276 * This field contains a reference to the timer utilized in detecting
282 * when a signature FIS timeout has occurred. The signature FIS is the 277 * when a signature FIS timeout has occurred. The signature FIS is the
diff --git a/drivers/scsi/isci/phy.h b/drivers/scsi/isci/phy.h
index 3100fd87c788..d4c4975546e3 100644
--- a/drivers/scsi/isci/phy.h
+++ b/drivers/scsi/isci/phy.h
@@ -71,11 +71,8 @@
71 */ 71 */
72 72
73struct isci_phy { 73struct isci_phy {
74
75 struct scic_sds_phy *sci_phy_handle; 74 struct scic_sds_phy *sci_phy_handle;
76
77 struct asd_sas_phy sas_phy; 75 struct asd_sas_phy sas_phy;
78 struct sas_identify_frame *frame;
79 struct isci_port *isci_port; 76 struct isci_port *isci_port;
80 u8 sas_addr[SAS_ADDR_SIZE]; 77 u8 sas_addr[SAS_ADDR_SIZE];
81 78
diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c
index 0a1577327d61..96a2002dadea 100644
--- a/drivers/scsi/isci/port.c
+++ b/drivers/scsi/isci/port.c
@@ -171,7 +171,6 @@ void isci_port_link_up(
171 struct scic_port_properties properties; 171 struct scic_port_properties properties;
172 struct isci_phy *isci_phy = phy->iphy; 172 struct isci_phy *isci_phy = phy->iphy;
173 struct isci_port *isci_port = port->iport; 173 struct isci_port *isci_port = port->iport;
174 enum sci_status call_status;
175 unsigned long success = true; 174 unsigned long success = true;
176 175
177 BUG_ON(isci_phy->isci_port != NULL); 176 BUG_ON(isci_phy->isci_port != NULL);
@@ -191,21 +190,7 @@ void isci_port_link_up(
191 if (properties.remote.protocols.u.bits.stp_target) { 190 if (properties.remote.protocols.u.bits.stp_target) {
192 u64 attached_sas_address; 191 u64 attached_sas_address;
193 192
194 struct scic_sata_phy_properties sata_phy_properties;
195
196 isci_phy->sas_phy.oob_mode = SATA_OOB_MODE; 193 isci_phy->sas_phy.oob_mode = SATA_OOB_MODE;
197
198 /* Get a copy of the signature fis for libsas */
199 call_status = scic_sata_phy_get_properties(phy,
200 &sata_phy_properties);
201
202 /*
203 * XXX I am concerned about this "assert". shouldn't we
204 * handle the return appropriately?
205 */
206 BUG_ON(call_status != SCI_SUCCESS);
207
208 isci_phy->frame_rcvd.fis = sata_phy_properties.signature_fis;
209 isci_phy->sas_phy.frame_rcvd_size = sizeof(struct dev_to_host_fis); 194 isci_phy->sas_phy.frame_rcvd_size = sizeof(struct dev_to_host_fis);
210 195
211 /* 196 /*
@@ -225,24 +210,12 @@ void isci_port_link_up(
225 210
226 } else if (properties.remote.protocols.u.bits.ssp_target || 211 } else if (properties.remote.protocols.u.bits.ssp_target ||
227 properties.remote.protocols.u.bits.smp_target) { 212 properties.remote.protocols.u.bits.smp_target) {
228
229 struct scic_sas_phy_properties sas_phy_properties;
230
231 isci_phy->sas_phy.oob_mode = SAS_OOB_MODE; 213 isci_phy->sas_phy.oob_mode = SAS_OOB_MODE;
232
233 /* Get a copy of the identify address frame for libsas */
234 call_status = scic_sas_phy_get_properties(phy,
235 &sas_phy_properties);
236
237 BUG_ON(call_status != SCI_SUCCESS);
238
239 isci_phy->frame_rcvd.iaf = sas_phy_properties.rcvd_iaf;
240 isci_phy->sas_phy.frame_rcvd_size = sizeof(struct sas_identify_frame); 214 isci_phy->sas_phy.frame_rcvd_size = sizeof(struct sas_identify_frame);
241 215
242 /* Copy the attached SAS address from the IAF */ 216 /* Copy the attached SAS address from the IAF */
243 memcpy(isci_phy->sas_phy.attached_sas_addr, 217 memcpy(isci_phy->sas_phy.attached_sas_addr,
244 isci_phy->frame_rcvd.iaf.sas_addr, SAS_ADDR_SIZE); 218 isci_phy->frame_rcvd.iaf.sas_addr, SAS_ADDR_SIZE);
245
246 } else { 219 } else {
247 dev_err(&isci_host->pdev->dev, "%s: unkown target\n", __func__); 220 dev_err(&isci_host->pdev->dev, "%s: unkown target\n", __func__);
248 success = false; 221 success = false;