aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2005-10-19 14:01:17 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-10-28 20:06:45 -0400
commitac01bbbd3b7ebfca64357aed12cf476b16abe3ce (patch)
treee0ab34ebdabb88f31a0b06321df5c7ff7122455a
parent80d904c43b11105c16395b240078ccc2f7ac6074 (diff)
[SCSI] sas: add flag for locally attached PHYs
Add a flag to mark a PHY as attached to the HBA as opposed to beeing on an expander. This is needed because various features are only supported on those. This is a crude hack, the proper fix would be to use different classes for host-attached vs expander phys. I'm looking into that. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/message/fusion/mptsas.c10
-rw-r--r--drivers/scsi/scsi_transport_sas.c3
-rw-r--r--include/scsi/scsi_transport_sas.h3
3 files changed, 13 insertions, 3 deletions
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 6512027bc69a..dcdf0380be86 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -760,7 +760,7 @@ mptsas_parse_device_info(struct sas_identify *identify,
760} 760}
761 761
762static int mptsas_probe_one_phy(struct device *dev, 762static int mptsas_probe_one_phy(struct device *dev,
763 struct mptsas_phyinfo *phy_info, int index) 763 struct mptsas_phyinfo *phy_info, int index, int local)
764{ 764{
765 struct sas_phy *port; 765 struct sas_phy *port;
766 int error; 766 int error;
@@ -853,6 +853,9 @@ static int mptsas_probe_one_phy(struct device *dev,
853 break; 853 break;
854 } 854 }
855 855
856 if (local)
857 port->local_attached = 1;
858
856 error = sas_phy_add(port); 859 error = sas_phy_add(port);
857 if (error) { 860 if (error) {
858 sas_phy_free(port); 861 sas_phy_free(port);
@@ -918,7 +921,7 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc, int *index)
918 } 921 }
919 922
920 mptsas_probe_one_phy(&ioc->sh->shost_gendev, 923 mptsas_probe_one_phy(&ioc->sh->shost_gendev,
921 &port_info->phy_info[i], *index); 924 &port_info->phy_info[i], *index, 1);
922 (*index)++; 925 (*index)++;
923 } 926 }
924 927
@@ -989,7 +992,8 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle, int *index)
989 } 992 }
990 } 993 }
991 994
992 mptsas_probe_one_phy(parent, &port_info->phy_info[i], *index); 995 mptsas_probe_one_phy(parent, &port_info->phy_info[i],
996 *index, 0);
993 (*index)++; 997 (*index)++;
994 } 998 }
995 999
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index 63445f90097e..f5618c1116f4 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -266,6 +266,9 @@ show_sas_phy_##field(struct class_device *cdev, char *buf) \
266 struct sas_internal *i = to_sas_internal(shost->transportt); \ 266 struct sas_internal *i = to_sas_internal(shost->transportt); \
267 int error; \ 267 int error; \
268 \ 268 \
269 if (!phy->local_attached) \
270 return -EINVAL; \
271 \
269 error = i->f->get_linkerrors(phy); \ 272 error = i->f->get_linkerrors(phy); \
270 if (error) \ 273 if (error) \
271 return error; \ 274 return error; \
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index 38389d8dd56e..57eb68c6e9a7 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -56,6 +56,9 @@ struct sas_phy {
56 enum sas_linkrate maximum_linkrate; 56 enum sas_linkrate maximum_linkrate;
57 u8 port_identifier; 57 u8 port_identifier;
58 58
59 /* internal state */
60 unsigned int local_attached : 1;
61
59 /* link error statistics */ 62 /* link error statistics */
60 u32 invalid_dword_count; 63 u32 invalid_dword_count;
61 u32 running_disparity_error_count; 64 u32 running_disparity_error_count;