aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/isci/core/scic_sds_controller.c100
-rw-r--r--drivers/scsi/isci/core/scic_sds_controller.h6
-rw-r--r--drivers/scsi/isci/core/scic_sds_phy.c6
-rw-r--r--drivers/scsi/isci/core/scic_sds_phy.h6
-rw-r--r--drivers/scsi/isci/core/scic_sds_port.c2
-rw-r--r--drivers/scsi/isci/core/scic_sds_port_configuration_agent.c209
-rw-r--r--drivers/scsi/isci/phy.c86
-rw-r--r--drivers/scsi/isci/phy.h41
-rw-r--r--drivers/scsi/isci/port.c42
-rw-r--r--drivers/scsi/isci/sci_environment.h2
10 files changed, 187 insertions, 313 deletions
diff --git a/drivers/scsi/isci/core/scic_sds_controller.c b/drivers/scsi/isci/core/scic_sds_controller.c
index b59548254e2..4ad31550c8a 100644
--- a/drivers/scsi/isci/core/scic_sds_controller.c
+++ b/drivers/scsi/isci/core/scic_sds_controller.c
@@ -673,6 +673,7 @@ static void scic_sds_controller_phy_timer_stop(struct scic_sds_controller *scic)
673 */ 673 */
674static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_controller *scic) 674static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_controller *scic)
675{ 675{
676 struct isci_host *ihost = scic_to_ihost(scic);
676 struct scic_sds_oem_params *oem = &scic->oem_parameters.sds1; 677 struct scic_sds_oem_params *oem = &scic->oem_parameters.sds1;
677 struct scic_sds_phy *sci_phy; 678 struct scic_sds_phy *sci_phy;
678 enum sci_status status; 679 enum sci_status status;
@@ -688,7 +689,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro
688 u8 index; 689 u8 index;
689 690
690 for (index = 0; index < SCI_MAX_PHYS; index++) { 691 for (index = 0; index < SCI_MAX_PHYS; index++) {
691 sci_phy = &scic->phy_table[index]; 692 sci_phy = &ihost->phys[index].sci;
692 state = sci_phy->state_machine.current_state_id; 693 state = sci_phy->state_machine.current_state_id;
693 694
694 if (!scic_sds_phy_get_port(sci_phy)) 695 if (!scic_sds_phy_get_port(sci_phy))
@@ -719,7 +720,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro
719 scic_sds_controller_phy_timer_stop(scic); 720 scic_sds_controller_phy_timer_stop(scic);
720 } 721 }
721 } else { 722 } else {
722 sci_phy = &scic->phy_table[scic->next_phy_to_start]; 723 sci_phy = &ihost->phys[scic->next_phy_to_start].sci;
723 724
724 if (oem->controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) { 725 if (oem->controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) {
725 if (scic_sds_phy_get_port(sci_phy) == NULL) { 726 if (scic_sds_phy_get_port(sci_phy) == NULL) {
@@ -748,7 +749,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro
748 "to stop phy %d because of status " 749 "to stop phy %d because of status "
749 "%d.\n", 750 "%d.\n",
750 __func__, 751 __func__,
751 scic->phy_table[scic->next_phy_to_start].phy_index, 752 ihost->phys[scic->next_phy_to_start].sci.phy_index,
752 status); 753 status);
753 } 754 }
754 755
@@ -792,23 +793,22 @@ static enum sci_status scic_sds_controller_stop_phys(struct scic_sds_controller
792 u32 index; 793 u32 index;
793 enum sci_status status; 794 enum sci_status status;
794 enum sci_status phy_status; 795 enum sci_status phy_status;
796 struct isci_host *ihost = scic_to_ihost(scic);
795 797
796 status = SCI_SUCCESS; 798 status = SCI_SUCCESS;
797 799
798 for (index = 0; index < SCI_MAX_PHYS; index++) { 800 for (index = 0; index < SCI_MAX_PHYS; index++) {
799 phy_status = scic_sds_phy_stop(&scic->phy_table[index]); 801 phy_status = scic_sds_phy_stop(&ihost->phys[index].sci);
800 802
801 if ( 803 if (phy_status != SCI_SUCCESS &&
802 (phy_status != SCI_SUCCESS) 804 phy_status != SCI_FAILURE_INVALID_STATE) {
803 && (phy_status != SCI_FAILURE_INVALID_STATE)
804 ) {
805 status = SCI_FAILURE; 805 status = SCI_FAILURE;
806 806
807 dev_warn(scic_to_dev(scic), 807 dev_warn(scic_to_dev(scic),
808 "%s: Controller stop operation failed to stop " 808 "%s: Controller stop operation failed to stop "
809 "phy %d because of status %d.\n", 809 "phy %d because of status %d.\n",
810 __func__, 810 __func__,
811 scic->phy_table[index].phy_index, phy_status); 811 ihost->phys[index].sci.phy_index, phy_status);
812 } 812 }
813 } 813 }
814 814
@@ -1069,21 +1069,13 @@ static void scic_sds_controller_sdma_completion(
1069 } 1069 }
1070} 1070}
1071 1071
1072/** 1072static void scic_sds_controller_unsolicited_frame(struct scic_sds_controller *scic,
1073 * 1073 u32 completion_entry)
1074 * @scic:
1075 * @completion_entry:
1076 *
1077 * This method processes an unsolicited frame message. This is called from
1078 * within the controller completion handler. none
1079 */
1080static void scic_sds_controller_unsolicited_frame(
1081 struct scic_sds_controller *scic,
1082 u32 completion_entry)
1083{ 1074{
1084 u32 index; 1075 u32 index;
1085 u32 frame_index; 1076 u32 frame_index;
1086 1077
1078 struct isci_host *ihost = scic_to_ihost(scic);
1087 struct scu_unsolicited_frame_header *frame_header; 1079 struct scu_unsolicited_frame_header *frame_header;
1088 struct scic_sds_phy *phy; 1080 struct scic_sds_phy *phy;
1089 struct scic_sds_remote_device *device; 1081 struct scic_sds_remote_device *device;
@@ -1092,10 +1084,8 @@ static void scic_sds_controller_unsolicited_frame(
1092 1084
1093 frame_index = SCU_GET_FRAME_INDEX(completion_entry); 1085 frame_index = SCU_GET_FRAME_INDEX(completion_entry);
1094 1086
1095 frame_header 1087 frame_header = scic->uf_control.buffers.array[frame_index].header;
1096 = scic->uf_control.buffers.array[frame_index].header; 1088 scic->uf_control.buffers.array[frame_index].state = UNSOLICITED_FRAME_IN_USE;
1097 scic->uf_control.buffers.array[frame_index].state
1098 = UNSOLICITED_FRAME_IN_USE;
1099 1089
1100 if (SCU_GET_FRAME_ERROR(completion_entry)) { 1090 if (SCU_GET_FRAME_ERROR(completion_entry)) {
1101 /* 1091 /*
@@ -1108,10 +1098,8 @@ static void scic_sds_controller_unsolicited_frame(
1108 1098
1109 if (frame_header->is_address_frame) { 1099 if (frame_header->is_address_frame) {
1110 index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry); 1100 index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry);
1111 phy = &scic->phy_table[index]; 1101 phy = &ihost->phys[index].sci;
1112 if (phy != NULL) { 1102 result = scic_sds_phy_frame_handler(phy, frame_index);
1113 result = scic_sds_phy_frame_handler(phy, frame_index);
1114 }
1115 } else { 1103 } else {
1116 1104
1117 index = SCU_GET_COMPLETION_INDEX(completion_entry); 1105 index = SCU_GET_COMPLETION_INDEX(completion_entry);
@@ -1122,7 +1110,7 @@ static void scic_sds_controller_unsolicited_frame(
1122 * device that has not yet been created. In either case forwared 1110 * device that has not yet been created. In either case forwared
1123 * the frame to the PE and let it take care of the frame data. */ 1111 * the frame to the PE and let it take care of the frame data. */
1124 index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry); 1112 index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry);
1125 phy = &scic->phy_table[index]; 1113 phy = &ihost->phys[index].sci;
1126 result = scic_sds_phy_frame_handler(phy, frame_index); 1114 result = scic_sds_phy_frame_handler(phy, frame_index);
1127 } else { 1115 } else {
1128 if (index < scic->remote_node_entries) 1116 if (index < scic->remote_node_entries)
@@ -1144,21 +1132,14 @@ static void scic_sds_controller_unsolicited_frame(
1144 } 1132 }
1145} 1133}
1146 1134
1147/** 1135static void scic_sds_controller_event_completion(struct scic_sds_controller *scic,
1148 * This method processes an event completion entry. This is called from within 1136 u32 completion_entry)
1149 * the controller completion handler.
1150 * @scic:
1151 * @completion_entry:
1152 *
1153 */
1154static void scic_sds_controller_event_completion(
1155 struct scic_sds_controller *scic,
1156 u32 completion_entry)
1157{ 1137{
1158 u32 index; 1138 struct isci_host *ihost = scic_to_ihost(scic);
1159 struct scic_sds_request *io_request; 1139 struct scic_sds_request *io_request;
1160 struct scic_sds_remote_device *device; 1140 struct scic_sds_remote_device *device;
1161 struct scic_sds_phy *phy; 1141 struct scic_sds_phy *phy;
1142 u32 index;
1162 1143
1163 index = SCU_GET_COMPLETION_INDEX(completion_entry); 1144 index = SCU_GET_COMPLETION_INDEX(completion_entry);
1164 1145
@@ -1237,7 +1218,7 @@ static void scic_sds_controller_event_completion(
1237 * we get the event notification. This is a type 4 event. */ 1218 * we get the event notification. This is a type 4 event. */
1238 case SCU_EVENT_TYPE_OSSP_EVENT: 1219 case SCU_EVENT_TYPE_OSSP_EVENT:
1239 index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry); 1220 index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry);
1240 phy = &scic->phy_table[index]; 1221 phy = &ihost->phys[index].sci;
1241 scic_sds_phy_event_handler(phy, completion_entry); 1222 scic_sds_phy_event_handler(phy, completion_entry);
1242 break; 1223 break;
1243 1224
@@ -2155,38 +2136,6 @@ enum sci_task_status scic_controller_start_task(
2155} 2136}
2156 2137
2157/** 2138/**
2158 * scic_controller_get_phy_handle() - This method simply provides the user with
2159 * a unique handle for a given SAS/SATA phy index/identifier.
2160 * @controller: This parameter represents the handle to the controller object
2161 * from which to retrieve a phy (SAS or SATA) handle.
2162 * @phy_index: This parameter specifies the phy index in the controller for
2163 * which to retrieve the phy handle. 0 <= phy_index < maximum number of phys.
2164 * @phy_handle: This parameter specifies the retrieved phy handle to be
2165 * provided to the caller.
2166 *
2167 * Indicate if the retrieval of the phy handle was successful. SCI_SUCCESS This
2168 * value is returned if the retrieval was successful. SCI_FAILURE_INVALID_PHY
2169 * This value is returned if the supplied phy id is not in the supported range.
2170 */
2171enum sci_status scic_controller_get_phy_handle(
2172 struct scic_sds_controller *scic,
2173 u8 phy_index,
2174 struct scic_sds_phy **phy_handle)
2175{
2176 if (phy_index < ARRAY_SIZE(scic->phy_table)) {
2177 *phy_handle = &scic->phy_table[phy_index];
2178
2179 return SCI_SUCCESS;
2180 }
2181
2182 dev_err(scic_to_dev(scic),
2183 "%s: Controller:0x%p PhyId:0x%x invalid phy index\n",
2184 __func__, scic, phy_index);
2185
2186 return SCI_FAILURE_INVALID_PHY;
2187}
2188
2189/**
2190 * scic_controller_allocate_io_tag() - This method will allocate a tag from the 2139 * scic_controller_allocate_io_tag() - This method will allocate a tag from the
2191 * pool of free IO tags. Direct allocation of IO tags by the SCI Core user 2140 * pool of free IO tags. Direct allocation of IO tags by the SCI Core user
2192 * is optional. The scic_controller_start_io() method will allocate an IO 2141 * is optional. The scic_controller_start_io() method will allocate an IO
@@ -2724,7 +2673,7 @@ enum sci_status scic_controller_initialize(struct scic_sds_controller *scic)
2724 (result == SCI_SUCCESS) && (index < SCI_MAX_PHYS); 2673 (result == SCI_SUCCESS) && (index < SCI_MAX_PHYS);
2725 index++) { 2674 index++) {
2726 result = scic_sds_phy_initialize( 2675 result = scic_sds_phy_initialize(
2727 &scic->phy_table[index], 2676 &ihost->phys[index].sci,
2728 &scic->scu_registers->peg0.pe[index].tl, 2677 &scic->scu_registers->peg0.pe[index].tl,
2729 &scic->scu_registers->peg0.pe[index].ll); 2678 &scic->scu_registers->peg0.pe[index].ll);
2730 } 2679 }
@@ -2979,6 +2928,7 @@ enum sci_status scic_controller_construct(struct scic_sds_controller *scic,
2979 void __iomem *scu_base, 2928 void __iomem *scu_base,
2980 void __iomem *smu_base) 2929 void __iomem *smu_base)
2981{ 2930{
2931 struct isci_host *ihost = scic_to_ihost(scic);
2982 u8 i; 2932 u8 i;
2983 2933
2984 sci_base_state_machine_construct(&scic->state_machine, 2934 sci_base_state_machine_construct(&scic->state_machine,
@@ -3000,7 +2950,7 @@ enum sci_status scic_controller_construct(struct scic_sds_controller *scic,
3000 /* Construct the phys for this controller */ 2950 /* Construct the phys for this controller */
3001 for (i = 0; i < SCI_MAX_PHYS; i++) { 2951 for (i = 0; i < SCI_MAX_PHYS; i++) {
3002 /* Add all the PHYs to the dummy port */ 2952 /* Add all the PHYs to the dummy port */
3003 scic_sds_phy_construct(&scic->phy_table[i], 2953 scic_sds_phy_construct(&ihost->phys[i].sci,
3004 &scic->port_table[SCI_MAX_PORTS], i); 2954 &scic->port_table[SCI_MAX_PORTS], i);
3005 } 2955 }
3006 2956
diff --git a/drivers/scsi/isci/core/scic_sds_controller.h b/drivers/scsi/isci/core/scic_sds_controller.h
index 0a9bb8b7725..aaaf15ab7cf 100644
--- a/drivers/scsi/isci/core/scic_sds_controller.h
+++ b/drivers/scsi/isci/core/scic_sds_controller.h
@@ -168,12 +168,6 @@ struct scic_sds_controller {
168 struct scic_sds_port port_table[SCI_MAX_PORTS + 1]; 168 struct scic_sds_port port_table[SCI_MAX_PORTS + 1];
169 169
170 /** 170 /**
171 * This field is the array of phy objects that are controlled by this
172 * controller object.
173 */
174 struct scic_sds_phy phy_table[SCI_MAX_PHYS];
175
176 /**
177 * This field is the array of device objects that are currently constructed 171 * This field is the array of device objects that are currently constructed
178 * for this controller object. This table is used as a fast lookup of device 172 * for this controller object. This table is used as a fast lookup of device
179 * objects that need to handle device completion notifications from the 173 * objects that need to handle device completion notifications from the
diff --git a/drivers/scsi/isci/core/scic_sds_phy.c b/drivers/scsi/isci/core/scic_sds_phy.c
index 8f1e3db6bb2..f0f4c74e461 100644
--- a/drivers/scsi/isci/core/scic_sds_phy.c
+++ b/drivers/scsi/isci/core/scic_sds_phy.c
@@ -436,7 +436,7 @@ 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 struct isci_phy *iphy = sci_phy_to_iphy(sci_phy);
440 440
441 iaf = &iphy->frame_rcvd.iaf; 441 iaf = &iphy->frame_rcvd.iaf;
442 memcpy(sas_address, iaf->sas_addr, SAS_ADDR_SIZE); 442 memcpy(sas_address, iaf->sas_addr, SAS_ADDR_SIZE);
@@ -1099,7 +1099,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_frame_handler
1099 enum sci_status result; 1099 enum sci_status result;
1100 u32 *frame_words; 1100 u32 *frame_words;
1101 struct sas_identify_frame iaf; 1101 struct sas_identify_frame iaf;
1102 struct isci_phy *iphy = sci_phy->iphy; 1102 struct isci_phy *iphy = sci_phy_to_iphy(sci_phy);
1103 1103
1104 result = scic_sds_unsolicited_frame_control_get_header( 1104 result = scic_sds_unsolicited_frame_control_get_header(
1105 &(scic_sds_phy_get_controller(sci_phy)->uf_control), 1105 &(scic_sds_phy_get_controller(sci_phy)->uf_control),
@@ -1164,7 +1164,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_frame_handle
1164 enum sci_status result; 1164 enum sci_status result;
1165 struct dev_to_host_fis *frame_header; 1165 struct dev_to_host_fis *frame_header;
1166 u32 *fis_frame_data; 1166 u32 *fis_frame_data;
1167 struct isci_phy *iphy = sci_phy->iphy; 1167 struct isci_phy *iphy = sci_phy_to_iphy(sci_phy);
1168 1168
1169 result = scic_sds_unsolicited_frame_control_get_header( 1169 result = scic_sds_unsolicited_frame_control_get_header(
1170 &(scic_sds_phy_get_controller(sci_phy)->uf_control), 1170 &(scic_sds_phy_get_controller(sci_phy)->uf_control),
diff --git a/drivers/scsi/isci/core/scic_sds_phy.h b/drivers/scsi/isci/core/scic_sds_phy.h
index b6a0ed1045d..c40c09b0c72 100644
--- a/drivers/scsi/isci/core/scic_sds_phy.h
+++ b/drivers/scsi/isci/core/scic_sds_phy.h
@@ -217,7 +217,6 @@ enum scic_sds_phy_protocol {
217 SCIC_SDS_MAX_PHY_PROTOCOLS 217 SCIC_SDS_MAX_PHY_PROTOCOLS
218}; 218};
219 219
220struct isci_phy;
221/** 220/**
222 * struct scic_sds_phy - This structure contains or references all of the data 221 * struct scic_sds_phy - This structure contains or references all of the data
223 * necessary to represent the core phy object and SCU harware protocol 222 * necessary to represent the core phy object and SCU harware protocol
@@ -227,11 +226,6 @@ struct isci_phy;
227 */ 226 */
228struct scic_sds_phy { 227struct scic_sds_phy {
229 /** 228 /**
230 * This field depicts the peer object for the phy.
231 */
232 struct isci_phy *iphy;
233
234 /**
235 * This field contains the information for the base phy state machine. 229 * This field contains the information for the base phy state machine.
236 */ 230 */
237 struct sci_base_state_machine state_machine; 231 struct sci_base_state_machine state_machine;
diff --git a/drivers/scsi/isci/core/scic_sds_port.c b/drivers/scsi/isci/core/scic_sds_port.c
index e1c873406e5..84b8abb421a 100644
--- a/drivers/scsi/isci/core/scic_sds_port.c
+++ b/drivers/scsi/isci/core/scic_sds_port.c
@@ -645,7 +645,7 @@ void scic_sds_port_deactivate_phy(struct scic_sds_port *sci_port,
645 struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port); 645 struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port);
646 struct isci_port *iport = sci_port->iport; 646 struct isci_port *iport = sci_port->iport;
647 struct isci_host *ihost = scic_to_ihost(scic); 647 struct isci_host *ihost = scic_to_ihost(scic);
648 struct isci_phy *iphy = sci_phy->iphy; 648 struct isci_phy *iphy = sci_phy_to_iphy(sci_phy);
649 649
650 sci_port->active_phy_mask &= ~(1 << sci_phy->phy_index); 650 sci_port->active_phy_mask &= ~(1 << sci_phy->phy_index);
651 651
diff --git a/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c b/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c
index 6b2fb445a8f..aa7ac95ecbc 100644
--- a/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c
+++ b/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c
@@ -170,32 +170,27 @@ static enum sci_status scic_sds_port_configuration_agent_validate_ports(
170 struct scic_sds_controller *controller, 170 struct scic_sds_controller *controller,
171 struct scic_sds_port_configuration_agent *port_agent) 171 struct scic_sds_port_configuration_agent *port_agent)
172{ 172{
173 struct isci_host *ihost = scic_to_ihost(controller);
173 struct sci_sas_address first_address; 174 struct sci_sas_address first_address;
174 struct sci_sas_address second_address; 175 struct sci_sas_address second_address;
175 176
176 /* 177 /*
177 * Sanity check the max ranges for all the phys the max index 178 * Sanity check the max ranges for all the phys the max index
178 * is always equal to the port range index */ 179 * is always equal to the port range index */
179 if ( 180 if (port_agent->phy_valid_port_range[0].max_index != 0 ||
180 (port_agent->phy_valid_port_range[0].max_index != 0) 181 port_agent->phy_valid_port_range[1].max_index != 1 ||
181 || (port_agent->phy_valid_port_range[1].max_index != 1) 182 port_agent->phy_valid_port_range[2].max_index != 2 ||
182 || (port_agent->phy_valid_port_range[2].max_index != 2) 183 port_agent->phy_valid_port_range[3].max_index != 3)
183 || (port_agent->phy_valid_port_range[3].max_index != 3)
184 ) {
185 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION; 184 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
186 }
187 185
188 /* 186 /*
189 * This is a request to configure a single x4 port or at least attempt 187 * This is a request to configure a single x4 port or at least attempt
190 * to make all the phys into a single port */ 188 * to make all the phys into a single port */
191 if ( 189 if (port_agent->phy_valid_port_range[0].min_index == 0 &&
192 (port_agent->phy_valid_port_range[0].min_index == 0) 190 port_agent->phy_valid_port_range[1].min_index == 0 &&
193 && (port_agent->phy_valid_port_range[1].min_index == 0) 191 port_agent->phy_valid_port_range[2].min_index == 0 &&
194 && (port_agent->phy_valid_port_range[2].min_index == 0) 192 port_agent->phy_valid_port_range[3].min_index == 0)
195 && (port_agent->phy_valid_port_range[3].min_index == 0)
196 ) {
197 return SCI_SUCCESS; 193 return SCI_SUCCESS;
198 }
199 194
200 /* 195 /*
201 * This is a degenerate case where phy 1 and phy 2 are assigned 196 * This is a degenerate case where phy 1 and phy 2 are assigned
@@ -210,8 +205,8 @@ static enum sci_status scic_sds_port_configuration_agent_validate_ports(
210 * PE0 and PE3 can never have the same SAS Address unless they 205 * PE0 and PE3 can never have the same SAS Address unless they
211 * are part of the same x4 wide port and we have already checked 206 * are part of the same x4 wide port and we have already checked
212 * for this condition. */ 207 * for this condition. */
213 scic_sds_phy_get_sas_address(&controller->phy_table[0], &first_address); 208 scic_sds_phy_get_sas_address(&ihost->phys[0].sci, &first_address);
214 scic_sds_phy_get_sas_address(&controller->phy_table[3], &second_address); 209 scic_sds_phy_get_sas_address(&ihost->phys[3].sci, &second_address);
215 210
216 if (sci_sas_address_compare(first_address, second_address) == 0) { 211 if (sci_sas_address_compare(first_address, second_address) == 0) {
217 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION; 212 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
@@ -221,12 +216,10 @@ static enum sci_status scic_sds_port_configuration_agent_validate_ports(
221 * PE0 and PE1 are configured into a 2x1 ports make sure that the 216 * PE0 and PE1 are configured into a 2x1 ports make sure that the
222 * SAS Address for PE0 and PE2 are different since they can not be 217 * SAS Address for PE0 and PE2 are different since they can not be
223 * part of the same port. */ 218 * part of the same port. */
224 if ( 219 if (port_agent->phy_valid_port_range[0].min_index == 0 &&
225 (port_agent->phy_valid_port_range[0].min_index == 0) 220 port_agent->phy_valid_port_range[1].min_index == 1) {
226 && (port_agent->phy_valid_port_range[1].min_index == 1) 221 scic_sds_phy_get_sas_address(&ihost->phys[0].sci, &first_address);
227 ) { 222 scic_sds_phy_get_sas_address(&ihost->phys[2].sci, &second_address);
228 scic_sds_phy_get_sas_address(&controller->phy_table[0], &first_address);
229 scic_sds_phy_get_sas_address(&controller->phy_table[2], &second_address);
230 223
231 if (sci_sas_address_compare(first_address, second_address) == 0) { 224 if (sci_sas_address_compare(first_address, second_address) == 0) {
232 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION; 225 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
@@ -237,12 +230,10 @@ static enum sci_status scic_sds_port_configuration_agent_validate_ports(
237 * PE2 and PE3 are configured into a 2x1 ports make sure that the 230 * PE2 and PE3 are configured into a 2x1 ports make sure that the
238 * SAS Address for PE1 and PE3 are different since they can not be 231 * SAS Address for PE1 and PE3 are different since they can not be
239 * part of the same port. */ 232 * part of the same port. */
240 if ( 233 if (port_agent->phy_valid_port_range[2].min_index == 2 &&
241 (port_agent->phy_valid_port_range[2].min_index == 2) 234 port_agent->phy_valid_port_range[3].min_index == 3) {
242 && (port_agent->phy_valid_port_range[3].min_index == 3) 235 scic_sds_phy_get_sas_address(&ihost->phys[1].sci, &first_address);
243 ) { 236 scic_sds_phy_get_sas_address(&ihost->phys[3].sci, &second_address);
244 scic_sds_phy_get_sas_address(&controller->phy_table[1], &first_address);
245 scic_sds_phy_get_sas_address(&controller->phy_table[3], &second_address);
246 237
247 if (sci_sas_address_compare(first_address, second_address) == 0) { 238 if (sci_sas_address_compare(first_address, second_address) == 0) {
248 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION; 239 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
@@ -267,6 +258,7 @@ static enum sci_status scic_sds_mpc_agent_validate_phy_configuration(
267 struct scic_sds_controller *controller, 258 struct scic_sds_controller *controller,
268 struct scic_sds_port_configuration_agent *port_agent) 259 struct scic_sds_port_configuration_agent *port_agent)
269{ 260{
261 struct isci_host *ihost = scic_to_ihost(controller);
270 u32 phy_mask; 262 u32 phy_mask;
271 u32 assigned_phy_mask; 263 u32 assigned_phy_mask;
272 struct sci_sas_address sas_address; 264 struct sci_sas_address sas_address;
@@ -281,68 +273,64 @@ static enum sci_status scic_sds_mpc_agent_validate_phy_configuration(
281 for (port_index = 0; port_index < SCI_MAX_PORTS; port_index++) { 273 for (port_index = 0; port_index < SCI_MAX_PORTS; port_index++) {
282 phy_mask = controller->oem_parameters.sds1.ports[port_index].phy_mask; 274 phy_mask = controller->oem_parameters.sds1.ports[port_index].phy_mask;
283 275
284 if (phy_mask != 0) { 276 if (!phy_mask)
285 /* 277 continue;
286 * Make sure that one or more of the phys were not already assinged to 278 /*
287 * a different port. */ 279 * Make sure that one or more of the phys were not already assinged to
288 if ((phy_mask & ~assigned_phy_mask) == 0) { 280 * a different port. */
289 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION; 281 if ((phy_mask & ~assigned_phy_mask) == 0) {
290 } 282 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
283 }
291 284
292 /* Find the starting phy index for this round through the loop */ 285 /* Find the starting phy index for this round through the loop */
293 for (phy_index = 0; phy_index < SCI_MAX_PHYS; phy_index++) { 286 for (phy_index = 0; phy_index < SCI_MAX_PHYS; phy_index++) {
294 if ((1 << phy_index) & phy_mask) { 287 if ((phy_mask & (1 << phy_index)) == 0)
295 scic_sds_phy_get_sas_address( 288 continue;
296 &controller->phy_table[phy_index], &sas_address 289 scic_sds_phy_get_sas_address(&ihost->phys[phy_index].sci,
297 ); 290 &sas_address);
298 291
299 /* 292 /*
300 * The phy_index can be used as the starting point for the 293 * The phy_index can be used as the starting point for the
301 * port range since the hardware starts all logical ports 294 * port range since the hardware starts all logical ports
302 * the same as the PE index. */ 295 * the same as the PE index. */
303 port_agent->phy_valid_port_range[phy_index].min_index = port_index; 296 port_agent->phy_valid_port_range[phy_index].min_index = port_index;
304 port_agent->phy_valid_port_range[phy_index].max_index = phy_index; 297 port_agent->phy_valid_port_range[phy_index].max_index = phy_index;
305
306 if (phy_index != port_index) {
307 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
308 }
309 298
310 break; 299 if (phy_index != port_index) {
311 } 300 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
312 } 301 }
313 302
314 /* 303 break;
315 * See how many additional phys are being added to this logical port. 304 }
316 * Note: We have not moved the current phy_index so we will actually
317 * compare the startting phy with itself.
318 * This is expected and required to add the phy to the port. */
319 while (phy_index < SCI_MAX_PHYS) {
320 if ((1 << phy_index) & phy_mask) {
321 scic_sds_phy_get_sas_address(
322 &controller->phy_table[phy_index], &phy_assigned_address
323 );
324
325 if (sci_sas_address_compare(sas_address, phy_assigned_address) != 0) {
326 /*
327 * The phy mask specified that this phy is part of the same port
328 * as the starting phy and it is not so fail this configuration */
329 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
330 }
331 305
332 port_agent->phy_valid_port_range[phy_index].min_index = port_index; 306 /*
333 port_agent->phy_valid_port_range[phy_index].max_index = phy_index; 307 * See how many additional phys are being added to this logical port.
308 * Note: We have not moved the current phy_index so we will actually
309 * compare the startting phy with itself.
310 * This is expected and required to add the phy to the port. */
311 while (phy_index < SCI_MAX_PHYS) {
312 if ((phy_mask & (1 << phy_index)) == 0)
313 continue;
314 scic_sds_phy_get_sas_address(&ihost->phys[phy_index].sci,
315 &phy_assigned_address);
316
317 if (sci_sas_address_compare(sas_address, phy_assigned_address) != 0) {
318 /*
319 * The phy mask specified that this phy is part of the same port
320 * as the starting phy and it is not so fail this configuration */
321 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
322 }
334 323
335 scic_sds_port_add_phy( 324 port_agent->phy_valid_port_range[phy_index].min_index = port_index;
336 &controller->port_table[port_index], 325 port_agent->phy_valid_port_range[phy_index].max_index = phy_index;
337 &controller->phy_table[phy_index]
338 );
339 326
340 assigned_phy_mask |= (1 << phy_index); 327 scic_sds_port_add_phy(&controller->port_table[port_index],
341 } 328 &ihost->phys[phy_index].sci);
342 329
343 phy_index++; 330 assigned_phy_mask |= (1 << phy_index);
344 }
345 } 331 }
332
333 phy_index++;
346 } 334 }
347 335
348 return scic_sds_port_configuration_agent_validate_ports(controller, port_agent); 336 return scic_sds_port_configuration_agent_validate_ports(controller, port_agent);
@@ -355,12 +343,12 @@ static enum sci_status scic_sds_mpc_agent_validate_phy_configuration(
355 * device objects before a new series of link up notifications because a link 343 * device objects before a new series of link up notifications because a link
356 * down has allowed a better port configuration. 344 * down has allowed a better port configuration.
357 */ 345 */
358static void scic_sds_mpc_agent_timeout_handler( 346static void scic_sds_mpc_agent_timeout_handler(void *object)
359 void *object)
360{ 347{
361 u8 index; 348 u8 index;
362 struct scic_sds_controller *controller = (struct scic_sds_controller *)object; 349 struct scic_sds_controller *scic = object;
363 struct scic_sds_port_configuration_agent *port_agent = &controller->port_agent; 350 struct isci_host *ihost = scic_to_ihost(scic);
351 struct scic_sds_port_configuration_agent *port_agent = &scic->port_agent;
364 u16 configure_phy_mask; 352 u16 configure_phy_mask;
365 353
366 port_agent->timer_pending = false; 354 port_agent->timer_pending = false;
@@ -369,13 +357,12 @@ static void scic_sds_mpc_agent_timeout_handler(
369 configure_phy_mask = ~port_agent->phy_configured_mask & port_agent->phy_ready_mask; 357 configure_phy_mask = ~port_agent->phy_configured_mask & port_agent->phy_ready_mask;
370 358
371 for (index = 0; index < SCI_MAX_PHYS; index++) { 359 for (index = 0; index < SCI_MAX_PHYS; index++) {
360 struct scic_sds_phy *sci_phy = &ihost->phys[index].sci;
361
372 if (configure_phy_mask & (1 << index)) { 362 if (configure_phy_mask & (1 << index)) {
373 port_agent->link_up_handler( 363 port_agent->link_up_handler(scic, port_agent,
374 controller, 364 scic_sds_phy_get_port(sci_phy),
375 port_agent, 365 sci_phy);
376 scic_sds_phy_get_port(&controller->phy_table[index]),
377 &controller->phy_table[index]
378 );
379 } 366 }
380 } 367 }
381} 368}
@@ -489,6 +476,7 @@ static enum sci_status scic_sds_apc_agent_validate_phy_configuration(
489 u8 port_index; 476 u8 port_index;
490 struct sci_sas_address sas_address; 477 struct sci_sas_address sas_address;
491 struct sci_sas_address phy_assigned_address; 478 struct sci_sas_address phy_assigned_address;
479 struct isci_host *ihost = scic_to_ihost(controller);
492 480
493 phy_index = 0; 481 phy_index = 0;
494 482
@@ -496,14 +484,12 @@ static enum sci_status scic_sds_apc_agent_validate_phy_configuration(
496 port_index = phy_index; 484 port_index = phy_index;
497 485
498 /* Get the assigned SAS Address for the first PHY on the controller. */ 486 /* Get the assigned SAS Address for the first PHY on the controller. */
499 scic_sds_phy_get_sas_address( 487 scic_sds_phy_get_sas_address(&ihost->phys[phy_index].sci,
500 &controller->phy_table[phy_index], &sas_address 488 &sas_address);
501 );
502 489
503 while (++phy_index < SCI_MAX_PHYS) { 490 while (++phy_index < SCI_MAX_PHYS) {
504 scic_sds_phy_get_sas_address( 491 scic_sds_phy_get_sas_address(&ihost->phys[phy_index].sci,
505 &controller->phy_table[phy_index], &phy_assigned_address 492 &phy_assigned_address);
506 );
507 493
508 /* Verify each of the SAS address are all the same for every PHY */ 494 /* Verify each of the SAS address are all the same for every PHY */
509 if (sci_sas_address_compare(sas_address, phy_assigned_address) == 0) { 495 if (sci_sas_address_compare(sas_address, phy_assigned_address) == 0) {
@@ -739,33 +725,30 @@ static void scic_sds_apc_agent_link_down(
739 } 725 }
740} 726}
741 727
742/** 728/* configure the phys into ports when the timer fires */
743 * 729static void scic_sds_apc_agent_timeout_handler(void *object)
744 *
745 * This routine will try to configure the phys into ports when the timer fires.
746 */
747static void scic_sds_apc_agent_timeout_handler(
748 void *object)
749{ 730{
750 u32 index; 731 u32 index;
751 struct scic_sds_port_configuration_agent *port_agent; 732 struct scic_sds_port_configuration_agent *port_agent;
752 struct scic_sds_controller *controller = (struct scic_sds_controller *)object; 733 struct scic_sds_controller *scic = object;
734 struct isci_host *ihost = scic_to_ihost(scic);
753 u16 configure_phy_mask; 735 u16 configure_phy_mask;
754 736
755 port_agent = scic_sds_controller_get_port_configuration_agent(controller); 737 port_agent = scic_sds_controller_get_port_configuration_agent(scic);
756 738
757 port_agent->timer_pending = false; 739 port_agent->timer_pending = false;
758 740
759 configure_phy_mask = ~port_agent->phy_configured_mask & port_agent->phy_ready_mask; 741 configure_phy_mask = ~port_agent->phy_configured_mask & port_agent->phy_ready_mask;
760 742
761 if (configure_phy_mask != 0x00) { 743 if (!configure_phy_mask)
762 for (index = 0; index < SCI_MAX_PHYS; index++) { 744 return;
763 if (configure_phy_mask & (1 << index)) { 745
764 scic_sds_apc_agent_configure_ports( 746 for (index = 0; index < SCI_MAX_PHYS; index++) {
765 controller, port_agent, &controller->phy_table[index], false 747 if ((configure_phy_mask & (1 << index)) == 0)
766 ); 748 continue;
767 } 749
768 } 750 scic_sds_apc_agent_configure_ports(scic, port_agent,
751 &ihost->phys[index].sci, false);
769 } 752 }
770} 753}
771 754
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c
index 160790a0de0..32800491832 100644
--- a/drivers/scsi/isci/phy.c
+++ b/drivers/scsi/isci/phy.c
@@ -63,61 +63,35 @@ struct scic_sds_phy;
63extern enum sci_status scic_sds_phy_start(struct scic_sds_phy *sci_phy); 63extern enum sci_status scic_sds_phy_start(struct scic_sds_phy *sci_phy);
64extern enum sci_status scic_sds_phy_stop(struct scic_sds_phy *sci_phy); 64extern enum sci_status scic_sds_phy_stop(struct scic_sds_phy *sci_phy);
65 65
66/** 66void isci_phy_init(struct isci_phy *iphy, struct isci_host *ihost, int index)
67 * isci_phy_init() - This function is called by the probe function to
68 * initialize the phy objects. This func assumes that the isci_port objects
69 * associated with the SCU have been initialized.
70 * @isci_phy: This parameter specifies the isci_phy object to initialize
71 * @isci_host: This parameter specifies the parent SCU host object for this
72 * isci_phy
73 * @index: This parameter specifies which SCU phy associates with this
74 * isci_phy. Generally, SCU phy 0 relates isci_phy 0, etc.
75 *
76 */
77void isci_phy_init(
78 struct isci_phy *phy,
79 struct isci_host *isci_host,
80 int index)
81{ 67{
82 struct scic_sds_phy *scic_phy;
83 union scic_oem_parameters oem; 68 union scic_oem_parameters oem;
84 enum sci_status status = SCI_SUCCESS; 69 u64 sci_sas_addr;
85 u64 sas_addr; 70 __be64 sas_addr;
86 71
87 /*--------------- SCU_Phy Initialization Stuff -----------------------*/ 72 scic_oem_parameters_get(&ihost->sci, &oem);
88 73 sci_sas_addr = oem.sds1.phys[index].sas_address.high;
89 status = scic_controller_get_phy_handle(&isci_host->sci, index, &scic_phy); 74 sci_sas_addr <<= 32;
90 if (status == SCI_SUCCESS) { 75 sci_sas_addr |= oem.sds1.phys[index].sas_address.low;
91 phy->sci_phy_handle = scic_phy; 76 sas_addr = cpu_to_be64(sci_sas_addr);
92 scic_phy->iphy = phy; 77 memcpy(iphy->sas_addr, &sas_addr, sizeof(sas_addr));
93 } else 78
94 dev_err(&isci_host->pdev->dev, 79 iphy->isci_port = NULL;
95 "failed scic_controller_get_phy_handle\n"); 80 iphy->sas_phy.enabled = 0;
96 81 iphy->sas_phy.id = index;
97 scic_oem_parameters_get(&isci_host->sci, &oem); 82 iphy->sas_phy.sas_addr = &iphy->sas_addr[0];
98 sas_addr = oem.sds1.phys[index].sas_address.high; 83 iphy->sas_phy.frame_rcvd = (u8 *)&iphy->frame_rcvd;
99 sas_addr <<= 32; 84 iphy->sas_phy.ha = &ihost->sas_ha;
100 sas_addr |= oem.sds1.phys[index].sas_address.low; 85 iphy->sas_phy.lldd_phy = iphy;
101 swab64s(&sas_addr); 86 iphy->sas_phy.enabled = 1;
102 87 iphy->sas_phy.class = SAS;
103 memcpy(phy->sas_addr, &sas_addr, sizeof(sas_addr)); 88 iphy->sas_phy.iproto = SAS_PROTOCOL_ALL;
104 89 iphy->sas_phy.tproto = 0;
105 phy->isci_port = NULL; 90 iphy->sas_phy.type = PHY_TYPE_PHYSICAL;
106 phy->sas_phy.enabled = 0; 91 iphy->sas_phy.role = PHY_ROLE_INITIATOR;
107 phy->sas_phy.id = index; 92 iphy->sas_phy.oob_mode = OOB_NOT_CONNECTED;
108 phy->sas_phy.sas_addr = &phy->sas_addr[0]; 93 iphy->sas_phy.linkrate = SAS_LINK_RATE_UNKNOWN;
109 phy->sas_phy.frame_rcvd = (u8 *)&phy->frame_rcvd; 94 memset(&iphy->frame_rcvd, 0, sizeof(iphy->frame_rcvd));
110 phy->sas_phy.ha = &isci_host->sas_ha;
111 phy->sas_phy.lldd_phy = phy;
112 phy->sas_phy.enabled = 1;
113 phy->sas_phy.class = SAS;
114 phy->sas_phy.iproto = SAS_PROTOCOL_ALL;
115 phy->sas_phy.tproto = 0;
116 phy->sas_phy.type = PHY_TYPE_PHYSICAL;
117 phy->sas_phy.role = PHY_ROLE_INITIATOR;
118 phy->sas_phy.oob_mode = OOB_NOT_CONNECTED;
119 phy->sas_phy.linkrate = SAS_LINK_RATE_UNKNOWN;
120 memset((u8 *)&phy->frame_rcvd, 0, sizeof(phy->frame_rcvd));
121} 95}
122 96
123 97
@@ -147,14 +121,14 @@ int isci_phy_control(struct asd_sas_phy *sas_phy,
147 switch (func) { 121 switch (func) {
148 case PHY_FUNC_DISABLE: 122 case PHY_FUNC_DISABLE:
149 spin_lock_irqsave(&ihost->scic_lock, flags); 123 spin_lock_irqsave(&ihost->scic_lock, flags);
150 scic_sds_phy_stop(iphy->sci_phy_handle); 124 scic_sds_phy_stop(&iphy->sci);
151 spin_unlock_irqrestore(&ihost->scic_lock, flags); 125 spin_unlock_irqrestore(&ihost->scic_lock, flags);
152 break; 126 break;
153 127
154 case PHY_FUNC_LINK_RESET: 128 case PHY_FUNC_LINK_RESET:
155 spin_lock_irqsave(&ihost->scic_lock, flags); 129 spin_lock_irqsave(&ihost->scic_lock, flags);
156 scic_sds_phy_stop(iphy->sci_phy_handle); 130 scic_sds_phy_stop(&iphy->sci);
157 scic_sds_phy_start(iphy->sci_phy_handle); 131 scic_sds_phy_start(&iphy->sci);
158 spin_unlock_irqrestore(&ihost->scic_lock, flags); 132 spin_unlock_irqrestore(&ihost->scic_lock, flags);
159 break; 133 break;
160 134
diff --git a/drivers/scsi/isci/phy.h b/drivers/scsi/isci/phy.h
index 21f6050eadb..93ec2d4a9c3 100644
--- a/drivers/scsi/isci/phy.h
+++ b/drivers/scsi/isci/phy.h
@@ -54,24 +54,17 @@
54 */ 54 */
55 55
56 56
57#if !defined(_ISCI_PHY_H_) 57#ifndef _ISCI_PHY_H_
58#define _ISCI_PHY_H_ 58#define _ISCI_PHY_H_
59 59
60#include "port.h"
61#include "host.h"
62#include <scsi/sas.h> 60#include <scsi/sas.h>
63#include <scsi/libsas.h> 61#include <scsi/libsas.h>
64 62#include "scic_sds_phy.h"
65 63#include "port.h"
66/** 64#include "host.h"
67 * struct isci_phy - This class implements the ISCI specific representation of
68 * the phy object.
69 *
70 *
71 */
72 65
73struct isci_phy { 66struct isci_phy {
74 struct scic_sds_phy *sci_phy_handle; 67 struct scic_sds_phy sci;
75 struct asd_sas_phy sas_phy; 68 struct asd_sas_phy sas_phy;
76 struct isci_port *isci_port; 69 struct isci_port *isci_port;
77 u8 sas_addr[SAS_ADDR_SIZE]; 70 u8 sas_addr[SAS_ADDR_SIZE];
@@ -82,17 +75,21 @@ struct isci_phy {
82 } frame_rcvd; 75 } frame_rcvd;
83}; 76};
84 77
85#define to_isci_phy(p) \ 78static inline struct isci_phy *to_isci_phy(struct asd_sas_phy *sas_phy)
86 container_of(p, struct isci_phy, sas_phy); 79{
80 struct isci_phy *iphy = container_of(sas_phy, typeof(*iphy), sas_phy);
81
82 return iphy;
83}
84
85static inline struct isci_phy *sci_phy_to_iphy(struct scic_sds_phy *sci_phy)
86{
87 struct isci_phy *iphy = container_of(sci_phy, typeof(*iphy), sci);
87 88
88void isci_phy_init( 89 return iphy;
89 struct isci_phy *phy, 90}
90 struct isci_host *isci_host,
91 int index);
92 91
93int isci_phy_control( 92void isci_phy_init(struct isci_phy *iphy, struct isci_host *ihost, int index);
94 struct asd_sas_phy *phy, 93int isci_phy_control(struct asd_sas_phy *phy, enum phy_func func, void *buf);
95 enum phy_func func,
96 void *buf);
97 94
98#endif /* !defined(_ISCI_PHY_H_) */ 95#endif /* !defined(_ISCI_PHY_H_) */
diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c
index 6110306e8e2..5e87fedb567 100644
--- a/drivers/scsi/isci/port.c
+++ b/drivers/scsi/isci/port.c
@@ -120,44 +120,26 @@ static void isci_port_change_state(
120 spin_unlock_irqrestore(&isci_port->state_lock, flags); 120 spin_unlock_irqrestore(&isci_port->state_lock, flags);
121} 121}
122 122
123void isci_port_bc_change_received( 123void isci_port_bc_change_received(struct isci_host *ihost,
124 struct isci_host *isci_host, 124 struct scic_sds_port *sci_port,
125 struct scic_sds_port *port, 125 struct scic_sds_phy *sci_phy)
126 struct scic_sds_phy *phy)
127{ 126{
128 struct isci_phy *isci_phy = phy->iphy; 127 struct isci_phy *iphy = sci_phy_to_iphy(sci_phy);
129 128
130 dev_dbg(&isci_host->pdev->dev, 129 dev_dbg(&ihost->pdev->dev, "%s: iphy = %p, sas_phy = %p\n",
131 "%s: isci_phy = %p, sas_phy = %p\n", 130 __func__, iphy, &iphy->sas_phy);
132 __func__,
133 isci_phy,
134 &isci_phy->sas_phy);
135
136 isci_host->sas_ha.notify_port_event(
137 &isci_phy->sas_phy,
138 PORTE_BROADCAST_RCVD
139 );
140 131
141 scic_port_enable_broadcast_change_notification(port); 132 ihost->sas_ha.notify_port_event(&iphy->sas_phy, PORTE_BROADCAST_RCVD);
133 scic_port_enable_broadcast_change_notification(sci_port);
142} 134}
143 135
144/** 136void isci_port_link_up(struct isci_host *isci_host,
145 * isci_port_link_up() - This function is called by the sci core when a link 137 struct scic_sds_port *port,
146 * becomes active. the identify address frame is retrieved from the core and 138 struct scic_sds_phy *phy)
147 * a notify port event is sent to libsas.
148 * @isci_host: This parameter specifies the isci host object.
149 * @port: This parameter specifies the sci port with the active link.
150 * @phy: This parameter specifies the sci phy with the active link.
151 *
152 */
153void isci_port_link_up(
154 struct isci_host *isci_host,
155 struct scic_sds_port *port,
156 struct scic_sds_phy *phy)
157{ 139{
158 unsigned long flags; 140 unsigned long flags;
159 struct scic_port_properties properties; 141 struct scic_port_properties properties;
160 struct isci_phy *isci_phy = phy->iphy; 142 struct isci_phy *isci_phy = sci_phy_to_iphy(phy);
161 struct isci_port *isci_port = port->iport; 143 struct isci_port *isci_port = port->iport;
162 unsigned long success = true; 144 unsigned long success = true;
163 145
diff --git a/drivers/scsi/isci/sci_environment.h b/drivers/scsi/isci/sci_environment.h
index 8394f60c5c2..bb07ed31b51 100644
--- a/drivers/scsi/isci/sci_environment.h
+++ b/drivers/scsi/isci/sci_environment.h
@@ -67,7 +67,7 @@ static inline struct device *scic_to_dev(struct scic_sds_controller *scic)
67 67
68static inline struct device *sciphy_to_dev(struct scic_sds_phy *sci_phy) 68static inline struct device *sciphy_to_dev(struct scic_sds_phy *sci_phy)
69{ 69{
70 struct isci_phy *iphy = sci_phy->iphy; 70 struct isci_phy *iphy = sci_phy_to_iphy(sci_phy);
71 71
72 if (!iphy || !iphy->isci_port || !iphy->isci_port->isci_host) 72 if (!iphy || !iphy->isci_port || !iphy->isci_port->isci_host)
73 return NULL; 73 return NULL;