diff options
author | James Bottomley <James.Bottomley@steeleye.com> | 2006-06-28 12:22:50 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-06-28 12:40:54 -0400 |
commit | 65c92b09acf0218b64f1c7ba4fdabeb8b732c876 (patch) | |
tree | 16569cf6039b7e4e810c710f91179292a847fd45 /include/scsi/scsi_transport_sas.h | |
parent | 2076eb6ab8339bf09620a0160be3607bbbb61a50 (diff) |
[SCSI] scsi_transport_sas: introduce a sas_port entity
this patch introduces a port object, separates out ports and phys,
with ports becoming the primary objects of the tree.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'include/scsi/scsi_transport_sas.h')
-rw-r--r-- | include/scsi/scsi_transport_sas.h | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h index 93cfb4bf4211..e3c503cd175e 100644 --- a/include/scsi/scsi_transport_sas.h +++ b/include/scsi/scsi_transport_sas.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/transport_class.h> | 4 | #include <linux/transport_class.h> |
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/mutex.h> | ||
6 | 7 | ||
7 | struct scsi_transport_template; | 8 | struct scsi_transport_template; |
8 | struct sas_rphy; | 9 | struct sas_rphy; |
@@ -55,7 +56,6 @@ struct sas_phy { | |||
55 | enum sas_linkrate minimum_linkrate; | 56 | enum sas_linkrate minimum_linkrate; |
56 | enum sas_linkrate maximum_linkrate_hw; | 57 | enum sas_linkrate maximum_linkrate_hw; |
57 | enum sas_linkrate maximum_linkrate; | 58 | enum sas_linkrate maximum_linkrate; |
58 | u8 port_identifier; | ||
59 | 59 | ||
60 | /* internal state */ | 60 | /* internal state */ |
61 | unsigned int local_attached : 1; | 61 | unsigned int local_attached : 1; |
@@ -66,8 +66,8 @@ struct sas_phy { | |||
66 | u32 loss_of_dword_sync_count; | 66 | u32 loss_of_dword_sync_count; |
67 | u32 phy_reset_problem_count; | 67 | u32 phy_reset_problem_count; |
68 | 68 | ||
69 | /* the other end of the link */ | 69 | /* for the list of phys belonging to a port */ |
70 | struct sas_rphy *rphy; | 70 | struct list_head port_siblings; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | #define dev_to_phy(d) \ | 73 | #define dev_to_phy(d) \ |
@@ -124,6 +124,24 @@ struct sas_expander_device { | |||
124 | #define rphy_to_expander_device(r) \ | 124 | #define rphy_to_expander_device(r) \ |
125 | container_of((r), struct sas_expander_device, rphy) | 125 | container_of((r), struct sas_expander_device, rphy) |
126 | 126 | ||
127 | struct sas_port { | ||
128 | struct device dev; | ||
129 | |||
130 | u8 port_identifier; | ||
131 | int num_phys; | ||
132 | |||
133 | /* the other end of the link */ | ||
134 | struct sas_rphy *rphy; | ||
135 | |||
136 | struct mutex phy_list_mutex; | ||
137 | struct list_head phy_list; | ||
138 | }; | ||
139 | |||
140 | #define dev_to_sas_port(d) \ | ||
141 | container_of((d), struct sas_port, dev) | ||
142 | #define transport_class_to_sas_port(cdev) \ | ||
143 | dev_to_sas_port((cdev)->dev) | ||
144 | |||
127 | /* The functions by which the transport class and the driver communicate */ | 145 | /* The functions by which the transport class and the driver communicate */ |
128 | struct sas_function_template { | 146 | struct sas_function_template { |
129 | int (*get_linkerrors)(struct sas_phy *); | 147 | int (*get_linkerrors)(struct sas_phy *); |
@@ -133,6 +151,7 @@ struct sas_function_template { | |||
133 | }; | 151 | }; |
134 | 152 | ||
135 | 153 | ||
154 | void sas_remove_children(struct device *); | ||
136 | extern void sas_remove_host(struct Scsi_Host *); | 155 | extern void sas_remove_host(struct Scsi_Host *); |
137 | 156 | ||
138 | extern struct sas_phy *sas_phy_alloc(struct device *, int); | 157 | extern struct sas_phy *sas_phy_alloc(struct device *, int); |
@@ -141,13 +160,21 @@ extern int sas_phy_add(struct sas_phy *); | |||
141 | extern void sas_phy_delete(struct sas_phy *); | 160 | extern void sas_phy_delete(struct sas_phy *); |
142 | extern int scsi_is_sas_phy(const struct device *); | 161 | extern int scsi_is_sas_phy(const struct device *); |
143 | 162 | ||
144 | extern struct sas_rphy *sas_end_device_alloc(struct sas_phy *); | 163 | extern struct sas_rphy *sas_end_device_alloc(struct sas_port *); |
145 | extern struct sas_rphy *sas_expander_alloc(struct sas_phy *, enum sas_device_type); | 164 | extern struct sas_rphy *sas_expander_alloc(struct sas_port *, enum sas_device_type); |
146 | void sas_rphy_free(struct sas_rphy *); | 165 | void sas_rphy_free(struct sas_rphy *); |
147 | extern int sas_rphy_add(struct sas_rphy *); | 166 | extern int sas_rphy_add(struct sas_rphy *); |
148 | extern void sas_rphy_delete(struct sas_rphy *); | 167 | extern void sas_rphy_delete(struct sas_rphy *); |
149 | extern int scsi_is_sas_rphy(const struct device *); | 168 | extern int scsi_is_sas_rphy(const struct device *); |
150 | 169 | ||
170 | struct sas_port *sas_port_alloc(struct device *, int); | ||
171 | int sas_port_add(struct sas_port *); | ||
172 | void sas_port_free(struct sas_port *); | ||
173 | void sas_port_delete(struct sas_port *); | ||
174 | void sas_port_add_phy(struct sas_port *, struct sas_phy *); | ||
175 | void sas_port_delete_phy(struct sas_port *, struct sas_phy *); | ||
176 | int scsi_is_sas_port(const struct device *); | ||
177 | |||
151 | extern struct scsi_transport_template * | 178 | extern struct scsi_transport_template * |
152 | sas_attach_transport(struct sas_function_template *); | 179 | sas_attach_transport(struct sas_function_template *); |
153 | extern void sas_release_transport(struct scsi_transport_template *); | 180 | extern void sas_release_transport(struct scsi_transport_template *); |