diff options
author | Dave Jiang <dave.jiang@intel.com> | 2011-05-04 18:37:52 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:46 -0400 |
commit | 4b7ebd05fc074ac2ffdc803232d83f3593d4f548 (patch) | |
tree | 697af2c3f57dd5ce58f092d1806f35ce22c614ee | |
parent | e76d6180da436edf2cc3538cbed1f5b02b614613 (diff) |
isci: Convert SAS identify address frame to Linux Native format
Convert struct sci_sas_identify_address_frame to struct sas_identify_frame
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | drivers/scsi/isci/core/intel_sas.h | 29 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_phy.h | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_phy.c | 86 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_phy.h | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/phy.h | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/port.c | 12 |
6 files changed, 27 insertions, 106 deletions
diff --git a/drivers/scsi/isci/core/intel_sas.h b/drivers/scsi/isci/core/intel_sas.h index 119eb5b3094a..61a5ececdd52 100644 --- a/drivers/scsi/isci/core/intel_sas.h +++ b/drivers/scsi/isci/core/intel_sas.h | |||
@@ -112,35 +112,6 @@ struct sci_sas_identify_address_frame_protocols { | |||
112 | }; | 112 | }; |
113 | 113 | ||
114 | /** | 114 | /** |
115 | * struct sci_sas_identify_address_frame - This structure depicts the contents | ||
116 | * of the SAS IDENTIFY ADDRESS FRAME (IAF). | ||
117 | * | ||
118 | * For specific information on each of these individual fields please reference | ||
119 | * the SAS specification Link layer section on address frames. | ||
120 | */ | ||
121 | struct sci_sas_identify_address_frame { | ||
122 | u16 address_frame_type:4; | ||
123 | u16 device_type:3; | ||
124 | u16 reserved1:1; | ||
125 | u16 reason:4; | ||
126 | u16 reserved2:4; | ||
127 | |||
128 | struct sci_sas_identify_address_frame_protocols protocols; | ||
129 | |||
130 | struct sci_sas_address device_name; | ||
131 | struct sci_sas_address sas_address; | ||
132 | |||
133 | u32 phy_identifier:8; | ||
134 | u32 break_reply_capable:1; | ||
135 | u32 requested_in_zpsds:1; | ||
136 | u32 in_zpsds_persistent:1; | ||
137 | u32 reserved5:21; | ||
138 | |||
139 | u32 reserved6[4]; | ||
140 | |||
141 | }; | ||
142 | |||
143 | /** | ||
144 | * struct sas_capabilities - This structure depicts the various SAS | 115 | * struct sas_capabilities - This structure depicts the various SAS |
145 | * capabilities supported by the directly attached target device. For | 116 | * capabilities supported by the directly attached target device. For |
146 | * specific information on each of these individual fields please reference | 117 | * specific information on each of these individual fields please reference |
diff --git a/drivers/scsi/isci/core/scic_phy.h b/drivers/scsi/isci/core/scic_phy.h index d8c4bf1a958a..4e4a6b1f9953 100644 --- a/drivers/scsi/isci/core/scic_phy.h +++ b/drivers/scsi/isci/core/scic_phy.h | |||
@@ -119,7 +119,7 @@ struct scic_sas_phy_properties { | |||
119 | * This field delineates the Identify Address Frame received | 119 | * This field delineates the Identify Address Frame received |
120 | * from the remote end point. | 120 | * from the remote end point. |
121 | */ | 121 | */ |
122 | struct sci_sas_identify_address_frame received_iaf; | 122 | struct sas_identify_frame rcvd_iaf; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * This field delineates the Phy capabilities structure received | 125 | * This field delineates the Phy capabilities structure received |
diff --git a/drivers/scsi/isci/core/scic_sds_phy.c b/drivers/scsi/isci/core/scic_sds_phy.c index 0f292f1be2bb..672e81b57711 100644 --- a/drivers/scsi/isci/core/scic_sds_phy.c +++ b/drivers/scsi/isci/core/scic_sds_phy.c | |||
@@ -411,15 +411,7 @@ static void scic_sds_phy_suspend( | |||
411 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX); | 411 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX); |
412 | } | 412 | } |
413 | 413 | ||
414 | /** | 414 | void scic_sds_phy_resume(struct scic_sds_phy *sci_phy) |
415 | * | ||
416 | * @sci_phy: The phy object to resume. | ||
417 | * | ||
418 | * This function will perform the register reads/writes required to resume the | ||
419 | * SCU hardware protocol engine. none | ||
420 | */ | ||
421 | void scic_sds_phy_resume( | ||
422 | struct scic_sds_phy *sci_phy) | ||
423 | { | 415 | { |
424 | u32 scu_sas_pcfg_value; | 416 | u32 scu_sas_pcfg_value; |
425 | 417 | ||
@@ -430,47 +422,22 @@ void scic_sds_phy_resume( | |||
430 | &sci_phy->link_layer_registers->phy_configuration); | 422 | &sci_phy->link_layer_registers->phy_configuration); |
431 | } | 423 | } |
432 | 424 | ||
433 | /** | 425 | void scic_sds_phy_get_sas_address(struct scic_sds_phy *sci_phy, |
434 | * This method returns the local sas address assigned to this phy. | 426 | struct sci_sas_address *sas_address) |
435 | * @sci_phy: This parameter specifies the phy for which to retrieve the local | ||
436 | * SAS address. | ||
437 | * @sas_address: This parameter specifies the location into which to copy the | ||
438 | * local SAS address. | ||
439 | * | ||
440 | */ | ||
441 | void scic_sds_phy_get_sas_address( | ||
442 | struct scic_sds_phy *sci_phy, | ||
443 | struct sci_sas_address *sas_address) | ||
444 | { | 427 | { |
445 | sas_address->high = readl(&sci_phy->link_layer_registers->source_sas_address_high); | 428 | sas_address->high = readl(&sci_phy->link_layer_registers->source_sas_address_high); |
446 | sas_address->low = readl(&sci_phy->link_layer_registers->source_sas_address_low); | 429 | sas_address->low = readl(&sci_phy->link_layer_registers->source_sas_address_low); |
447 | } | 430 | } |
448 | 431 | ||
449 | /** | 432 | void scic_sds_phy_get_attached_sas_address(struct scic_sds_phy *sci_phy, |
450 | * This method returns the remote end-point (i.e. attached) sas address | 433 | struct sci_sas_address *sas_address) |
451 | * assigned to this phy. | ||
452 | * @sci_phy: This parameter specifies the phy for which to retrieve the remote | ||
453 | * end-point SAS address. | ||
454 | * @sas_address: This parameter specifies the location into which to copy the | ||
455 | * remote end-point SAS address. | ||
456 | * | ||
457 | */ | ||
458 | void scic_sds_phy_get_attached_sas_address( | ||
459 | struct scic_sds_phy *sci_phy, | ||
460 | struct sci_sas_address *sas_address) | ||
461 | { | 434 | { |
462 | sas_address->high | 435 | struct sas_identify_frame *iaf; |
463 | = sci_phy->phy_type.sas.identify_address_frame_buffer.sas_address.high; | 436 | |
464 | sas_address->low | 437 | iaf = &sci_phy->phy_type.sas.identify_address_frame_buffer; |
465 | = sci_phy->phy_type.sas.identify_address_frame_buffer.sas_address.low; | 438 | memcpy(sas_address, iaf->sas_addr, SAS_ADDR_SIZE); |
466 | } | 439 | } |
467 | 440 | ||
468 | /** | ||
469 | * This method returns the supported protocols assigned to this phy | ||
470 | * @sci_phy: | ||
471 | * | ||
472 | * | ||
473 | */ | ||
474 | void scic_sds_phy_get_protocols( | 441 | void scic_sds_phy_get_protocols( |
475 | struct scic_sds_phy *sci_phy, | 442 | struct scic_sds_phy *sci_phy, |
476 | struct sci_sas_identify_address_frame_protocols *protocols) | 443 | struct sci_sas_identify_address_frame_protocols *protocols) |
@@ -481,17 +448,6 @@ void scic_sds_phy_get_protocols( | |||
481 | 0x0000FFFF); | 448 | 0x0000FFFF); |
482 | } | 449 | } |
483 | 450 | ||
484 | /** | ||
485 | * | ||
486 | * @sci_phy: The parameter is the phy object for which the attached phy | ||
487 | * protcols are to be returned. | ||
488 | * | ||
489 | * This method returns the supported protocols for the attached phy. If this | ||
490 | * is a SAS phy the protocols are returned from the identify address frame. If | ||
491 | * this is a SATA phy then protocols are made up and the target phy is an STP | ||
492 | * target phy. The caller will get the entire set of bits for the protocol | ||
493 | * value. | ||
494 | */ | ||
495 | void scic_sds_phy_get_attached_phy_protocols( | 451 | void scic_sds_phy_get_attached_phy_protocols( |
496 | struct scic_sds_phy *sci_phy, | 452 | struct scic_sds_phy *sci_phy, |
497 | struct sci_sas_identify_address_frame_protocols *protocols) | 453 | struct sci_sas_identify_address_frame_protocols *protocols) |
@@ -499,8 +455,10 @@ void scic_sds_phy_get_attached_phy_protocols( | |||
499 | protocols->u.all = 0; | 455 | protocols->u.all = 0; |
500 | 456 | ||
501 | if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) { | 457 | if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) { |
502 | protocols->u.all = | 458 | struct sas_identify_frame *iaf; |
503 | sci_phy->phy_type.sas.identify_address_frame_buffer.protocols.u.all; | 459 | |
460 | iaf = &sci_phy->phy_type.sas.identify_address_frame_buffer; | ||
461 | memcpy(&protocols->u.all, &iaf->initiator_bits, 2); | ||
504 | } else if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) { | 462 | } else if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) { |
505 | protocols->u.bits.stp_target = 1; | 463 | protocols->u.bits.stp_target = 1; |
506 | } | 464 | } |
@@ -599,11 +557,9 @@ enum sci_status scic_sas_phy_get_properties( | |||
599 | struct scic_sas_phy_properties *properties) | 557 | struct scic_sas_phy_properties *properties) |
600 | { | 558 | { |
601 | if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) { | 559 | if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) { |
602 | memcpy( | 560 | memcpy(&properties->rcvd_iaf, |
603 | &properties->received_iaf, | 561 | &sci_phy->phy_type.sas.identify_address_frame_buffer, |
604 | &sci_phy->phy_type.sas.identify_address_frame_buffer, | 562 | sizeof(struct sas_identify_frame)); |
605 | sizeof(struct sci_sas_identify_address_frame) | ||
606 | ); | ||
607 | 563 | ||
608 | properties->received_capabilities.u.all = | 564 | properties->received_capabilities.u.all = |
609 | readl(&sci_phy->link_layer_registers->receive_phycap); | 565 | readl(&sci_phy->link_layer_registers->receive_phycap); |
@@ -1203,7 +1159,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_frame_handler | |||
1203 | { | 1159 | { |
1204 | enum sci_status result; | 1160 | enum sci_status result; |
1205 | u32 *frame_words; | 1161 | u32 *frame_words; |
1206 | struct sci_sas_identify_address_frame *identify_frame; | 1162 | struct sas_identify_frame *identify_frame; |
1207 | 1163 | ||
1208 | result = scic_sds_unsolicited_frame_control_get_header( | 1164 | result = scic_sds_unsolicited_frame_control_get_header( |
1209 | &(scic_sds_phy_get_controller(sci_phy)->uf_control), | 1165 | &(scic_sds_phy_get_controller(sci_phy)->uf_control), |
@@ -1215,9 +1171,9 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_frame_handler | |||
1215 | } | 1171 | } |
1216 | 1172 | ||
1217 | frame_words[0] = SCIC_SWAP_DWORD(frame_words[0]); | 1173 | frame_words[0] = SCIC_SWAP_DWORD(frame_words[0]); |
1218 | identify_frame = (struct sci_sas_identify_address_frame *)frame_words; | 1174 | identify_frame = (struct sas_identify_frame *)frame_words; |
1219 | 1175 | ||
1220 | if (identify_frame->address_frame_type == 0) { | 1176 | if (identify_frame->frame_type == 0) { |
1221 | u32 state; | 1177 | u32 state; |
1222 | 1178 | ||
1223 | /* Byte swap the rest of the frame so we can make | 1179 | /* Byte swap the rest of the frame so we can make |
@@ -1231,9 +1187,9 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_frame_handler | |||
1231 | 1187 | ||
1232 | memcpy(&sci_phy->phy_type.sas.identify_address_frame_buffer, | 1188 | memcpy(&sci_phy->phy_type.sas.identify_address_frame_buffer, |
1233 | identify_frame, | 1189 | identify_frame, |
1234 | sizeof(struct sci_sas_identify_address_frame)); | 1190 | sizeof(struct sas_identify_frame)); |
1235 | 1191 | ||
1236 | if (identify_frame->protocols.u.bits.smp_target) { | 1192 | if (identify_frame->smp_tport) { |
1237 | /* We got the IAF for an expander PHY go to the final state since | 1193 | /* We got the IAF for an expander PHY go to the final state since |
1238 | * there are no power requirements for expander phys. | 1194 | * there are no power requirements for expander phys. |
1239 | */ | 1195 | */ |
diff --git a/drivers/scsi/isci/core/scic_sds_phy.h b/drivers/scsi/isci/core/scic_sds_phy.h index 22b3119ec7fd..7bf95539b2a0 100644 --- a/drivers/scsi/isci/core/scic_sds_phy.h +++ b/drivers/scsi/isci/core/scic_sds_phy.h | |||
@@ -274,7 +274,7 @@ struct scic_sds_phy { | |||
274 | 274 | ||
275 | union { | 275 | union { |
276 | struct { | 276 | struct { |
277 | struct sci_sas_identify_address_frame identify_address_frame_buffer; | 277 | struct sas_identify_frame identify_address_frame_buffer; |
278 | 278 | ||
279 | } sas; | 279 | } sas; |
280 | 280 | ||
diff --git a/drivers/scsi/isci/phy.h b/drivers/scsi/isci/phy.h index 3fe1a8a13169..3100fd87c788 100644 --- a/drivers/scsi/isci/phy.h +++ b/drivers/scsi/isci/phy.h | |||
@@ -80,7 +80,7 @@ struct isci_phy { | |||
80 | u8 sas_addr[SAS_ADDR_SIZE]; | 80 | u8 sas_addr[SAS_ADDR_SIZE]; |
81 | 81 | ||
82 | union { | 82 | union { |
83 | u8 aif[sizeof(struct sci_sas_identify_address_frame)]; | 83 | struct sas_identify_frame iaf; |
84 | struct dev_to_host_fis fis; | 84 | struct dev_to_host_fis fis; |
85 | } frame_rcvd; | 85 | } frame_rcvd; |
86 | }; | 86 | }; |
diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c index 5b38f2f963e0..0a1577327d61 100644 --- a/drivers/scsi/isci/port.c +++ b/drivers/scsi/isci/port.c | |||
@@ -236,18 +236,12 @@ void isci_port_link_up( | |||
236 | 236 | ||
237 | BUG_ON(call_status != SCI_SUCCESS); | 237 | BUG_ON(call_status != SCI_SUCCESS); |
238 | 238 | ||
239 | memcpy(isci_phy->frame_rcvd.aif, | 239 | isci_phy->frame_rcvd.iaf = sas_phy_properties.rcvd_iaf; |
240 | &(sas_phy_properties.received_iaf), | 240 | isci_phy->sas_phy.frame_rcvd_size = sizeof(struct sas_identify_frame); |
241 | sizeof(struct sci_sas_identify_address_frame)); | ||
242 | |||
243 | isci_phy->sas_phy.frame_rcvd_size | ||
244 | = sizeof(struct sci_sas_identify_address_frame); | ||
245 | 241 | ||
246 | /* Copy the attached SAS address from the IAF */ | 242 | /* Copy the attached SAS address from the IAF */ |
247 | memcpy(isci_phy->sas_phy.attached_sas_addr, | 243 | memcpy(isci_phy->sas_phy.attached_sas_addr, |
248 | ((struct sas_identify_frame *) | 244 | isci_phy->frame_rcvd.iaf.sas_addr, SAS_ADDR_SIZE); |
249 | (&isci_phy->frame_rcvd.aif))->sas_addr, | ||
250 | SAS_ADDR_SIZE); | ||
251 | 245 | ||
252 | } else { | 246 | } else { |
253 | dev_err(&isci_host->pdev->dev, "%s: unkown target\n", __func__); | 247 | dev_err(&isci_host->pdev->dev, "%s: unkown target\n", __func__); |