aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas/sas_ata.c
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2008-02-24 00:38:44 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-02-24 00:53:04 -0500
commita29c05153630b2cd5ea078c97c0abe084cd830d8 (patch)
tree99904c05815c0a5ec369ecaf15b2820801638223 /drivers/scsi/libsas/sas_ata.c
parent63edf49e67cac710826108697c4e8636c89abd17 (diff)
[SCSI] libsas: use the supplied address for SATA devices rather than changing it
Once the phy reset is plumbed in properly, SATA error handling fails nastily because we change the port attached_sas_address using the WWN field of the IDENTIFY message. This is a nice thing to do in theory, but it really destroys hotplug because any event on the port causes an automatic mismatch between the sas_address the phy just picked up and the one we propagate into the port. However ugly they are, we have to stick with the sas addresses made up by the phys and expanders. Also does a few cosmetic changes to the way port printing is done to make it clearer how a port is formed. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/libsas/sas_ata.c')
-rw-r--r--drivers/scsi/libsas/sas_ata.c39
1 files changed, 2 insertions, 37 deletions
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 7cd05b599a12..b0e5ac372a32 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -236,12 +236,12 @@ static void sas_ata_phy_reset(struct ata_port *ap)
236 struct domain_device *dev = ap->private_data; 236 struct domain_device *dev = ap->private_data;
237 struct sas_internal *i = 237 struct sas_internal *i =
238 to_sas_internal(dev->port->ha->core.shost->transportt); 238 to_sas_internal(dev->port->ha->core.shost->transportt);
239 int res = 0; 239 int res = TMF_RESP_FUNC_FAILED;
240 240
241 if (i->dft->lldd_I_T_nexus_reset) 241 if (i->dft->lldd_I_T_nexus_reset)
242 res = i->dft->lldd_I_T_nexus_reset(dev); 242 res = i->dft->lldd_I_T_nexus_reset(dev);
243 243
244 if (res) 244 if (res != TMF_RESP_FUNC_COMPLETE)
245 SAS_DPRINTK("%s: Unable to reset I T nexus?\n", __FUNCTION__); 245 SAS_DPRINTK("%s: Unable to reset I T nexus?\n", __FUNCTION__);
246 246
247 switch (dev->sata_dev.command_set) { 247 switch (dev->sata_dev.command_set) {
@@ -656,21 +656,6 @@ out:
656 return res; 656 return res;
657} 657}
658 658
659static void sas_sata_propagate_sas_addr(struct domain_device *dev)
660{
661 unsigned long flags;
662 struct asd_sas_port *port = dev->port;
663 struct asd_sas_phy *phy;
664
665 BUG_ON(dev->parent);
666
667 memcpy(port->attached_sas_addr, dev->sas_addr, SAS_ADDR_SIZE);
668 spin_lock_irqsave(&port->phy_list_lock, flags);
669 list_for_each_entry(phy, &port->phy_list, port_phy_el)
670 memcpy(phy->attached_sas_addr, dev->sas_addr, SAS_ADDR_SIZE);
671 spin_unlock_irqrestore(&port->phy_list_lock, flags);
672}
673
674#define ATA_IDENTIFY_DEV 0xEC 659#define ATA_IDENTIFY_DEV 0xEC
675#define ATA_IDENTIFY_PACKET_DEV 0xA1 660#define ATA_IDENTIFY_PACKET_DEV 0xA1
676#define ATA_SET_FEATURES 0xEF 661#define ATA_SET_FEATURES 0xEF
@@ -728,26 +713,6 @@ static int sas_discover_sata_dev(struct domain_device *dev)
728 goto out_err; 713 goto out_err;
729 } 714 }
730cont1: 715cont1:
731 /* Get WWN */
732 if (dev->port->oob_mode != SATA_OOB_MODE) {
733 memcpy(dev->sas_addr, dev->sata_dev.rps_resp.rps.stp_sas_addr,
734 SAS_ADDR_SIZE);
735 } else if (dev->sata_dev.command_set == ATA_COMMAND_SET &&
736 (le16_to_cpu(dev->sata_dev.identify_device[108]) & 0xF000)
737 == 0x5000) {
738 int i;
739
740 for (i = 0; i < 4; i++) {
741 dev->sas_addr[2*i] =
742 (le16_to_cpu(dev->sata_dev.identify_device[108+i]) & 0xFF00) >> 8;
743 dev->sas_addr[2*i+1] =
744 le16_to_cpu(dev->sata_dev.identify_device[108+i]) & 0x00FF;
745 }
746 }
747 sas_hash_addr(dev->hashed_sas_addr, dev->sas_addr);
748 if (!dev->parent)
749 sas_sata_propagate_sas_addr(dev);
750
751 /* XXX Hint: register this SATA device with SATL. 716 /* XXX Hint: register this SATA device with SATL.
752 When this returns, dev->sata_dev->lu is alive and 717 When this returns, dev->sata_dev->lu is alive and
753 present. 718 present.