diff options
author | James Bottomley <James.Bottomley@steeleye.com> | 2006-03-13 14:50:04 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-03-14 13:36:19 -0500 |
commit | 79cb1819e231f811211133a09a5382cb89d7ec67 (patch) | |
tree | 2bc36e3165fe15614283f628e825e9320ca7ab8e /include/scsi | |
parent | c829c394165f981d49f05a9be228404d7a9398d4 (diff) |
[SCSI] add preliminary expander support to the sas transport class
This patch makes expanders appear as labelled objects with properties in
the SAS tree.
I've also modified the phy code to make expander phys appear labelled by
host number, expander number and phy index.
So, for my current config, you see something like this in sysfs:
/sys/class/scsi_host/host1/device/phy-1:4/expander-1:0/phy-1-0:12/rphy-1:0-12/target1:0:1
And the expander properties are:
jejb@sparkweed> cd /sys/class/sas_expander/expander-1\:0/
jejb@sparkweed> for f in *; do echo -n $f ": "; cat $f; done
component_id : 29024
component_revision_id : 4
component_vendor_id : VITESSE
device : cat: device: Is a directory
level : 0
product_id : VSC7160 Eval Brd
product_rev : 4
uevent : cat: uevent: Permission denied
vendor_id : VITESSE
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/scsi_transport_sas.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h index 8fded431cf46..2943ccc22a43 100644 --- a/include/scsi/scsi_transport_sas.h +++ b/include/scsi/scsi_transport_sas.h | |||
@@ -108,6 +108,25 @@ struct sas_end_device { | |||
108 | #define rphy_to_end_device(r) \ | 108 | #define rphy_to_end_device(r) \ |
109 | container_of((r), struct sas_end_device, rphy) | 109 | container_of((r), struct sas_end_device, rphy) |
110 | 110 | ||
111 | struct sas_expander_device { | ||
112 | int level; | ||
113 | |||
114 | #define SAS_EXPANDER_VENDOR_ID_LEN 8 | ||
115 | char vendor_id[SAS_EXPANDER_VENDOR_ID_LEN+1]; | ||
116 | #define SAS_EXPANDER_PRODUCT_ID_LEN 16 | ||
117 | char product_id[SAS_EXPANDER_PRODUCT_ID_LEN+1]; | ||
118 | #define SAS_EXPANDER_PRODUCT_REV_LEN 4 | ||
119 | char product_rev[SAS_EXPANDER_PRODUCT_REV_LEN+1]; | ||
120 | #define SAS_EXPANDER_COMPONENT_VENDOR_ID_LEN 8 | ||
121 | char component_vendor_id[SAS_EXPANDER_COMPONENT_VENDOR_ID_LEN+1]; | ||
122 | u16 component_id; | ||
123 | u8 component_revision_id; | ||
124 | |||
125 | struct sas_rphy rphy; | ||
126 | |||
127 | }; | ||
128 | #define rphy_to_expander_device(r) \ | ||
129 | container_of((r), struct sas_expander_device, rphy) | ||
111 | 130 | ||
112 | /* The functions by which the transport class and the driver communicate */ | 131 | /* The functions by which the transport class and the driver communicate */ |
113 | struct sas_function_template { | 132 | struct sas_function_template { |
@@ -128,6 +147,7 @@ extern int scsi_is_sas_phy(const struct device *); | |||
128 | 147 | ||
129 | extern struct sas_rphy *sas_rphy_alloc(struct sas_phy *); | 148 | extern struct sas_rphy *sas_rphy_alloc(struct sas_phy *); |
130 | extern struct sas_rphy *sas_end_device_alloc(struct sas_phy *); | 149 | extern struct sas_rphy *sas_end_device_alloc(struct sas_phy *); |
150 | extern struct sas_rphy *sas_expander_alloc(struct sas_phy *, enum sas_device_type); | ||
131 | void sas_rphy_free(struct sas_rphy *); | 151 | void sas_rphy_free(struct sas_rphy *); |
132 | extern int sas_rphy_add(struct sas_rphy *); | 152 | extern int sas_rphy_add(struct sas_rphy *); |
133 | extern void sas_rphy_delete(struct sas_rphy *); | 153 | extern void sas_rphy_delete(struct sas_rphy *); |
@@ -138,4 +158,15 @@ sas_attach_transport(struct sas_function_template *); | |||
138 | extern void sas_release_transport(struct scsi_transport_template *); | 158 | extern void sas_release_transport(struct scsi_transport_template *); |
139 | int sas_read_port_mode_page(struct scsi_device *); | 159 | int sas_read_port_mode_page(struct scsi_device *); |
140 | 160 | ||
161 | static inline int | ||
162 | scsi_is_sas_expander_device(struct device *dev) | ||
163 | { | ||
164 | struct sas_rphy *rphy; | ||
165 | if (!scsi_is_sas_rphy(dev)) | ||
166 | return 0; | ||
167 | rphy = dev_to_rphy(dev); | ||
168 | return rphy->identify.device_type == SAS_FANOUT_EXPANDER_DEVICE || | ||
169 | rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE; | ||
170 | } | ||
171 | |||
141 | #endif /* SCSI_TRANSPORT_SAS_H */ | 172 | #endif /* SCSI_TRANSPORT_SAS_H */ |