aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-02-25 13:25:21 -0500
committerDan Williams <dan.j.williams@intel.com>2011-07-03 06:55:28 -0400
commit150fc6fc725055b400a8865e6785dc8dd0a2225d (patch)
tree800fe37980919606017c603c77d8d7384beaa7dc /drivers
parent7392d27580df2d14b5c3b1a1d7989c06457a819d (diff)
isci: fix sas address reporting
Undo the open coded and incorrect translation of the oem parameter sas address to its libsas expected format. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/isci/host.c5
-rw-r--r--drivers/scsi/isci/host.h1
-rw-r--r--drivers/scsi/isci/init.c2
-rw-r--r--drivers/scsi/isci/phy.c32
-rw-r--r--drivers/scsi/isci/port.c17
5 files changed, 19 insertions, 38 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index aa86615fa7a9..d8d6f67bd69c 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -517,11 +517,6 @@ int isci_host_init(struct isci_host *isci_host)
517 for (index = 0; index < SCI_MAX_PHYS; index++) 517 for (index = 0; index < SCI_MAX_PHYS; index++)
518 isci_phy_init(&isci_host->phys[index], isci_host, index); 518 isci_phy_init(&isci_host->phys[index], isci_host, index);
519 519
520 /* Why are we doing this? Is this even necessary? */
521 memcpy(&isci_host->sas_addr[0],
522 &isci_host->phys[0].sas_addr[0],
523 SAS_ADDR_SIZE);
524
525 /* Start the ports */ 520 /* Start the ports */
526 for (index = 0; index < SCI_MAX_PORTS; index++) { 521 for (index = 0; index < SCI_MAX_PORTS; index++) {
527 scic_controller_get_port_handle(controller, index, &scic_port); 522 scic_controller_get_port_handle(controller, index, &scic_port);
diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h
index 06154a625aec..b794dfd0819e 100644
--- a/drivers/scsi/isci/host.h
+++ b/drivers/scsi/isci/host.h
@@ -105,7 +105,6 @@ struct isci_host {
105 spinlock_t state_lock; 105 spinlock_t state_lock;
106 106
107 struct pci_dev *pdev; 107 struct pci_dev *pdev;
108 u8 sas_addr[SAS_ADDR_SIZE];
109 108
110 enum isci_status status; 109 enum isci_status status;
111 #define IHOST_START_PENDING 0 110 #define IHOST_START_PENDING 0
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 6ca623aff051..d01c44f5be99 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -209,7 +209,7 @@ static int isci_register_sas_ha(struct isci_host *isci_host)
209 209
210 sas_ha->sas_ha_name = DRV_NAME; 210 sas_ha->sas_ha_name = DRV_NAME;
211 sas_ha->lldd_module = THIS_MODULE; 211 sas_ha->lldd_module = THIS_MODULE;
212 sas_ha->sas_addr = &(isci_host->sas_addr[0]); 212 sas_ha->sas_addr = &isci_host->phys[0].sas_addr[0];
213 213
214 /* set the array of phy and port structs. */ 214 /* set the array of phy and port structs. */
215 for (i = 0; i < SCI_MAX_PHYS; i++) { 215 for (i = 0; i < SCI_MAX_PHYS; i++) {
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c
index fbda570d25e1..1eefaaeb1141 100644
--- a/drivers/scsi/isci/phy.c
+++ b/drivers/scsi/isci/phy.c
@@ -75,14 +75,15 @@ void isci_phy_init(
75 struct isci_host *isci_host, 75 struct isci_host *isci_host,
76 int index) 76 int index)
77{ 77{
78 struct scic_sds_controller *controller = isci_host->core_controller; 78 struct scic_sds_controller *scic = isci_host->core_controller;
79 struct scic_sds_phy *scic_phy; 79 struct scic_sds_phy *scic_phy;
80 union scic_oem_parameters oem_parameters; 80 union scic_oem_parameters oem;
81 enum sci_status status = SCI_SUCCESS; 81 enum sci_status status = SCI_SUCCESS;
82 u64 sas_addr;
82 83
83 /*--------------- SCU_Phy Initialization Stuff -----------------------*/ 84 /*--------------- SCU_Phy Initialization Stuff -----------------------*/
84 85
85 status = scic_controller_get_phy_handle(controller, index, &scic_phy); 86 status = scic_controller_get_phy_handle(scic, index, &scic_phy);
86 if (status == SCI_SUCCESS) { 87 if (status == SCI_SUCCESS) {
87 sci_object_set_association(scic_phy, (void *)phy); 88 sci_object_set_association(scic_phy, (void *)phy);
88 phy->sci_phy_handle = scic_phy; 89 phy->sci_phy_handle = scic_phy;
@@ -90,24 +91,13 @@ void isci_phy_init(
90 dev_err(&isci_host->pdev->dev, 91 dev_err(&isci_host->pdev->dev,
91 "failed scic_controller_get_phy_handle\n"); 92 "failed scic_controller_get_phy_handle\n");
92 93
93 scic_oem_parameters_get(controller, &oem_parameters); 94 scic_oem_parameters_get(scic, &oem);
94 95 sas_addr = oem.sds1.phys[index].sas_address.high;
95 phy->sas_addr[0] = oem_parameters.sds1.phys[index].sas_address.low 96 sas_addr <<= 32;
96 & 0xFF; 97 sas_addr |= oem.sds1.phys[index].sas_address.low;
97 phy->sas_addr[1] = (oem_parameters.sds1.phys[index].sas_address.low 98 swab64s(&sas_addr);
98 >> 8) & 0xFF; 99
99 phy->sas_addr[2] = (oem_parameters.sds1.phys[index].sas_address.low 100 memcpy(phy->sas_addr, &sas_addr, sizeof(sas_addr));
100 >> 16) & 0xFF;
101 phy->sas_addr[3] = (oem_parameters.sds1.phys[index].sas_address.low
102 >> 24) & 0xFF;
103 phy->sas_addr[4] = oem_parameters.sds1.phys[index].sas_address.high
104 & 0xFF;
105 phy->sas_addr[5] = (oem_parameters.sds1.phys[index].sas_address.high
106 >> 8) & 0xFF;
107 phy->sas_addr[6] = (oem_parameters.sds1.phys[index].sas_address.high
108 >> 16) & 0xFF;
109 phy->sas_addr[7] = (oem_parameters.sds1.phys[index].sas_address.high
110 >> 24) & 0xFF;
111 101
112 phy->isci_port = NULL; 102 phy->isci_port = NULL;
113 phy->sas_phy.enabled = 0; 103 phy->sas_phy.enabled = 0;
diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c
index 446da20521c9..30da3ec703e3 100644
--- a/drivers/scsi/isci/port.c
+++ b/drivers/scsi/isci/port.c
@@ -192,6 +192,7 @@ void isci_port_link_up(
192 scic_port_get_properties(port, &properties); 192 scic_port_get_properties(port, &properties);
193 193
194 if (properties.remote.protocols.u.bits.stp_target) { 194 if (properties.remote.protocols.u.bits.stp_target) {
195 u64 attached_sas_address;
195 196
196 struct scic_sata_phy_properties sata_phy_properties; 197 struct scic_sata_phy_properties sata_phy_properties;
197 198
@@ -220,17 +221,13 @@ void isci_port_link_up(
220 * will not be the same as assigned to the PHY and needs 221 * will not be the same as assigned to the PHY and needs
221 * to be obtained from struct scic_port_properties properties. 222 * to be obtained from struct scic_port_properties properties.
222 */ 223 */
224 attached_sas_address = properties.remote.sas_address.high;
225 attached_sas_address <<= 32;
226 attached_sas_address |= properties.remote.sas_address.low;
227 swab64s(&attached_sas_address);
223 228
224 BUG_ON(((size_t)SAS_ADDR_SIZE / 2) 229 memcpy(&isci_phy->sas_phy.attached_sas_addr,
225 != sizeof(properties.remote.sas_address.low)); 230 &attached_sas_address, sizeof(attached_sas_address));
226
227 memcpy(&isci_phy->sas_phy.attached_sas_addr[0],
228 &properties.remote.sas_address.low,
229 SAS_ADDR_SIZE / 2);
230
231 memcpy(&isci_phy->sas_phy.attached_sas_addr[4],
232 &properties.remote.sas_address.high,
233 SAS_ADDR_SIZE / 2);
234 231
235 } else if (properties.remote.protocols.u.bits.ssp_target || 232 } else if (properties.remote.protocols.u.bits.ssp_target ||
236 properties.remote.protocols.u.bits.smp_target) { 233 properties.remote.protocols.u.bits.smp_target) {