diff options
author | Alexandre Bounine <alexandre.bounine@idt.com> | 2011-01-12 20:00:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 11:03:17 -0500 |
commit | a93192a5d245a262dc52fa426de5b20467308a77 (patch) | |
tree | f3231240286ef3d204375e047f6b2e1a8efbbcd2 /include | |
parent | e6d7202b66d99bf514c8e901db68386b1fcd6d56 (diff) |
rapidio: use common destid storage for endpoints and switches
Change code to use one storage location common for switches and endpoints.
This eliminates unnecessary device type checks during basic access
operations. Logic that assigns destid to RIO devices stays unchanged - as
before, switches use an associated destid because they do not have their
own.
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Thomas Moll <thomas.moll@sysgo.com>
Cc: Micha Nelissen <micha@neli.hopto.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/rio.h | 8 | ||||
-rw-r--r-- | include/linux/rio_drv.h | 72 |
2 files changed, 15 insertions, 65 deletions
diff --git a/include/linux/rio.h b/include/linux/rio.h index 0bed941f9b13..f6e25b3a6967 100644 --- a/include/linux/rio.h +++ b/include/linux/rio.h | |||
@@ -98,7 +98,8 @@ union rio_pw_msg; | |||
98 | * @dev: Device model device | 98 | * @dev: Device model device |
99 | * @riores: RIO resources this device owns | 99 | * @riores: RIO resources this device owns |
100 | * @pwcback: port-write callback function for this device | 100 | * @pwcback: port-write callback function for this device |
101 | * @destid: Network destination ID | 101 | * @destid: Network destination ID (or associated destid for switch) |
102 | * @hopcount: Hopcount to this device | ||
102 | * @prev: Previous RIO device connected to the current one | 103 | * @prev: Previous RIO device connected to the current one |
103 | */ | 104 | */ |
104 | struct rio_dev { | 105 | struct rio_dev { |
@@ -126,6 +127,7 @@ struct rio_dev { | |||
126 | struct resource riores[RIO_MAX_DEV_RESOURCES]; | 127 | struct resource riores[RIO_MAX_DEV_RESOURCES]; |
127 | int (*pwcback) (struct rio_dev *rdev, union rio_pw_msg *msg, int step); | 128 | int (*pwcback) (struct rio_dev *rdev, union rio_pw_msg *msg, int step); |
128 | u16 destid; | 129 | u16 destid; |
130 | u8 hopcount; | ||
129 | struct rio_dev *prev; | 131 | struct rio_dev *prev; |
130 | }; | 132 | }; |
131 | 133 | ||
@@ -229,8 +231,6 @@ struct rio_net { | |||
229 | * @node: Node in global list of switches | 231 | * @node: Node in global list of switches |
230 | * @rdev: Associated RIO device structure | 232 | * @rdev: Associated RIO device structure |
231 | * @switchid: Switch ID that is unique across a network | 233 | * @switchid: Switch ID that is unique across a network |
232 | * @hopcount: Hopcount to this switch | ||
233 | * @destid: Associated destid in the path | ||
234 | * @route_table: Copy of switch routing table | 234 | * @route_table: Copy of switch routing table |
235 | * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0 | 235 | * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0 |
236 | * @add_entry: Callback for switch-specific route add function | 236 | * @add_entry: Callback for switch-specific route add function |
@@ -247,8 +247,6 @@ struct rio_switch { | |||
247 | struct list_head node; | 247 | struct list_head node; |
248 | struct rio_dev *rdev; | 248 | struct rio_dev *rdev; |
249 | u16 switchid; | 249 | u16 switchid; |
250 | u16 hopcount; | ||
251 | u16 destid; | ||
252 | u8 *route_table; | 250 | u8 *route_table; |
253 | u32 port_ok; | 251 | u32 port_ok; |
254 | int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, | 252 | int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, |
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h index edc55da717b3..e09e565c4bce 100644 --- a/include/linux/rio_drv.h +++ b/include/linux/rio_drv.h | |||
@@ -150,16 +150,8 @@ static inline int rio_local_write_config_8(struct rio_mport *port, u32 offset, | |||
150 | static inline int rio_read_config_32(struct rio_dev *rdev, u32 offset, | 150 | static inline int rio_read_config_32(struct rio_dev *rdev, u32 offset, |
151 | u32 * data) | 151 | u32 * data) |
152 | { | 152 | { |
153 | u8 hopcount = 0xff; | 153 | return rio_mport_read_config_32(rdev->net->hport, rdev->destid, |
154 | u16 destid = rdev->destid; | 154 | rdev->hopcount, offset, data); |
155 | |||
156 | if (rdev->rswitch) { | ||
157 | destid = rdev->rswitch->destid; | ||
158 | hopcount = rdev->rswitch->hopcount; | ||
159 | } | ||
160 | |||
161 | return rio_mport_read_config_32(rdev->net->hport, destid, hopcount, | ||
162 | offset, data); | ||
163 | }; | 155 | }; |
164 | 156 | ||
165 | /** | 157 | /** |
@@ -174,16 +166,8 @@ static inline int rio_read_config_32(struct rio_dev *rdev, u32 offset, | |||
174 | static inline int rio_write_config_32(struct rio_dev *rdev, u32 offset, | 166 | static inline int rio_write_config_32(struct rio_dev *rdev, u32 offset, |
175 | u32 data) | 167 | u32 data) |
176 | { | 168 | { |
177 | u8 hopcount = 0xff; | 169 | return rio_mport_write_config_32(rdev->net->hport, rdev->destid, |
178 | u16 destid = rdev->destid; | 170 | rdev->hopcount, offset, data); |
179 | |||
180 | if (rdev->rswitch) { | ||
181 | destid = rdev->rswitch->destid; | ||
182 | hopcount = rdev->rswitch->hopcount; | ||
183 | } | ||
184 | |||
185 | return rio_mport_write_config_32(rdev->net->hport, destid, hopcount, | ||
186 | offset, data); | ||
187 | }; | 171 | }; |
188 | 172 | ||
189 | /** | 173 | /** |
@@ -198,16 +182,8 @@ static inline int rio_write_config_32(struct rio_dev *rdev, u32 offset, | |||
198 | static inline int rio_read_config_16(struct rio_dev *rdev, u32 offset, | 182 | static inline int rio_read_config_16(struct rio_dev *rdev, u32 offset, |
199 | u16 * data) | 183 | u16 * data) |
200 | { | 184 | { |
201 | u8 hopcount = 0xff; | 185 | return rio_mport_read_config_16(rdev->net->hport, rdev->destid, |
202 | u16 destid = rdev->destid; | 186 | rdev->hopcount, offset, data); |
203 | |||
204 | if (rdev->rswitch) { | ||
205 | destid = rdev->rswitch->destid; | ||
206 | hopcount = rdev->rswitch->hopcount; | ||
207 | } | ||
208 | |||
209 | return rio_mport_read_config_16(rdev->net->hport, destid, hopcount, | ||
210 | offset, data); | ||
211 | }; | 187 | }; |
212 | 188 | ||
213 | /** | 189 | /** |
@@ -222,16 +198,8 @@ static inline int rio_read_config_16(struct rio_dev *rdev, u32 offset, | |||
222 | static inline int rio_write_config_16(struct rio_dev *rdev, u32 offset, | 198 | static inline int rio_write_config_16(struct rio_dev *rdev, u32 offset, |
223 | u16 data) | 199 | u16 data) |
224 | { | 200 | { |
225 | u8 hopcount = 0xff; | 201 | return rio_mport_write_config_16(rdev->net->hport, rdev->destid, |
226 | u16 destid = rdev->destid; | 202 | rdev->hopcount, offset, data); |
227 | |||
228 | if (rdev->rswitch) { | ||
229 | destid = rdev->rswitch->destid; | ||
230 | hopcount = rdev->rswitch->hopcount; | ||
231 | } | ||
232 | |||
233 | return rio_mport_write_config_16(rdev->net->hport, destid, hopcount, | ||
234 | offset, data); | ||
235 | }; | 203 | }; |
236 | 204 | ||
237 | /** | 205 | /** |
@@ -245,16 +213,8 @@ static inline int rio_write_config_16(struct rio_dev *rdev, u32 offset, | |||
245 | */ | 213 | */ |
246 | static inline int rio_read_config_8(struct rio_dev *rdev, u32 offset, u8 * data) | 214 | static inline int rio_read_config_8(struct rio_dev *rdev, u32 offset, u8 * data) |
247 | { | 215 | { |
248 | u8 hopcount = 0xff; | 216 | return rio_mport_read_config_8(rdev->net->hport, rdev->destid, |
249 | u16 destid = rdev->destid; | 217 | rdev->hopcount, offset, data); |
250 | |||
251 | if (rdev->rswitch) { | ||
252 | destid = rdev->rswitch->destid; | ||
253 | hopcount = rdev->rswitch->hopcount; | ||
254 | } | ||
255 | |||
256 | return rio_mport_read_config_8(rdev->net->hport, destid, hopcount, | ||
257 | offset, data); | ||
258 | }; | 218 | }; |
259 | 219 | ||
260 | /** | 220 | /** |
@@ -268,16 +228,8 @@ static inline int rio_read_config_8(struct rio_dev *rdev, u32 offset, u8 * data) | |||
268 | */ | 228 | */ |
269 | static inline int rio_write_config_8(struct rio_dev *rdev, u32 offset, u8 data) | 229 | static inline int rio_write_config_8(struct rio_dev *rdev, u32 offset, u8 data) |
270 | { | 230 | { |
271 | u8 hopcount = 0xff; | 231 | return rio_mport_write_config_8(rdev->net->hport, rdev->destid, |
272 | u16 destid = rdev->destid; | 232 | rdev->hopcount, offset, data); |
273 | |||
274 | if (rdev->rswitch) { | ||
275 | destid = rdev->rswitch->destid; | ||
276 | hopcount = rdev->rswitch->hopcount; | ||
277 | } | ||
278 | |||
279 | return rio_mport_write_config_8(rdev->net->hport, destid, hopcount, | ||
280 | offset, data); | ||
281 | }; | 233 | }; |
282 | 234 | ||
283 | extern int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid, | 235 | extern int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid, |