diff options
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 *); |