diff options
author | Alexandre Bounine <alexandre.bounine@idt.com> | 2011-01-12 20:00:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 11:03:17 -0500 |
commit | ded05782719d0f7e79af98be7cf88c7e23a90435 (patch) | |
tree | 5f3fd7ed0d7f9903748b41edefcd3294de81bd5b /include/linux/rio.h | |
parent | a93192a5d245a262dc52fa426de5b20467308a77 (diff) |
rapidio: integrate rio_switch into rio_dev
Convert RIO switches device structures (rio_dev + rio_switch) into a
single allocation unit.
This change is based on the fact that RIO switches are using common RIO
device objects anyway. Allocating RIO switch objects as RIO devices with
added space for switch information simplifies handling of RIO switch
devices.
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/linux/rio.h')
-rw-r--r-- | include/linux/rio.h | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/include/linux/rio.h b/include/linux/rio.h index f6e25b3a6967..9b558856a8b6 100644 --- a/include/linux/rio.h +++ b/include/linux/rio.h | |||
@@ -71,9 +71,47 @@ extern struct device rio_bus; | |||
71 | extern struct list_head rio_devices; /* list of all devices */ | 71 | extern struct list_head rio_devices; /* list of all devices */ |
72 | 72 | ||
73 | struct rio_mport; | 73 | struct rio_mport; |
74 | struct rio_dev; | ||
74 | union rio_pw_msg; | 75 | union rio_pw_msg; |
75 | 76 | ||
76 | /** | 77 | /** |
78 | * struct rio_switch - RIO switch info | ||
79 | * @node: Node in global list of switches | ||
80 | * @switchid: Switch ID that is unique across a network | ||
81 | * @route_table: Copy of switch routing table | ||
82 | * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0 | ||
83 | * @add_entry: Callback for switch-specific route add function | ||
84 | * @get_entry: Callback for switch-specific route get function | ||
85 | * @clr_table: Callback for switch-specific clear route table function | ||
86 | * @set_domain: Callback for switch-specific domain setting function | ||
87 | * @get_domain: Callback for switch-specific domain get function | ||
88 | * @em_init: Callback for switch-specific error management init function | ||
89 | * @em_handle: Callback for switch-specific error management handler function | ||
90 | * @sw_sysfs: Callback that initializes switch-specific sysfs attributes | ||
91 | * @nextdev: Array of per-port pointers to the next attached device | ||
92 | */ | ||
93 | struct rio_switch { | ||
94 | struct list_head node; | ||
95 | u16 switchid; | ||
96 | u8 *route_table; | ||
97 | u32 port_ok; | ||
98 | int (*add_entry) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
99 | u16 table, u16 route_destid, u8 route_port); | ||
100 | int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
101 | u16 table, u16 route_destid, u8 *route_port); | ||
102 | int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
103 | u16 table); | ||
104 | int (*set_domain) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
105 | u8 sw_domain); | ||
106 | int (*get_domain) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
107 | u8 *sw_domain); | ||
108 | int (*em_init) (struct rio_dev *dev); | ||
109 | int (*em_handle) (struct rio_dev *dev, u8 swport); | ||
110 | int (*sw_sysfs) (struct rio_dev *dev, int create); | ||
111 | struct rio_dev *nextdev[0]; | ||
112 | }; | ||
113 | |||
114 | /** | ||
77 | * struct rio_dev - RIO device info | 115 | * struct rio_dev - RIO device info |
78 | * @global_list: Node in list of all RIO devices | 116 | * @global_list: Node in list of all RIO devices |
79 | * @net_list: Node in list of RIO devices in a network | 117 | * @net_list: Node in list of RIO devices in a network |
@@ -93,7 +131,6 @@ union rio_pw_msg; | |||
93 | * @phys_efptr: RIO device extended features pointer | 131 | * @phys_efptr: RIO device extended features pointer |
94 | * @em_efptr: RIO Error Management features pointer | 132 | * @em_efptr: RIO Error Management features pointer |
95 | * @dma_mask: Mask of bits of RIO address this device implements | 133 | * @dma_mask: Mask of bits of RIO address this device implements |
96 | * @rswitch: Pointer to &struct rio_switch if valid for this device | ||
97 | * @driver: Driver claiming this device | 134 | * @driver: Driver claiming this device |
98 | * @dev: Device model device | 135 | * @dev: Device model device |
99 | * @riores: RIO resources this device owns | 136 | * @riores: RIO resources this device owns |
@@ -101,6 +138,7 @@ union rio_pw_msg; | |||
101 | * @destid: Network destination ID (or associated destid for switch) | 138 | * @destid: Network destination ID (or associated destid for switch) |
102 | * @hopcount: Hopcount to this device | 139 | * @hopcount: Hopcount to this device |
103 | * @prev: Previous RIO device connected to the current one | 140 | * @prev: Previous RIO device connected to the current one |
141 | * @rswitch: struct rio_switch (if valid for this device) | ||
104 | */ | 142 | */ |
105 | struct rio_dev { | 143 | struct rio_dev { |
106 | struct list_head global_list; /* node in list of all RIO devices */ | 144 | struct list_head global_list; /* node in list of all RIO devices */ |
@@ -121,7 +159,6 @@ struct rio_dev { | |||
121 | u32 phys_efptr; | 159 | u32 phys_efptr; |
122 | u32 em_efptr; | 160 | u32 em_efptr; |
123 | u64 dma_mask; | 161 | u64 dma_mask; |
124 | struct rio_switch *rswitch; /* RIO switch info */ | ||
125 | struct rio_driver *driver; /* RIO driver claiming this device */ | 162 | struct rio_driver *driver; /* RIO driver claiming this device */ |
126 | struct device dev; /* LDM device structure */ | 163 | struct device dev; /* LDM device structure */ |
127 | struct resource riores[RIO_MAX_DEV_RESOURCES]; | 164 | struct resource riores[RIO_MAX_DEV_RESOURCES]; |
@@ -129,11 +166,13 @@ struct rio_dev { | |||
129 | u16 destid; | 166 | u16 destid; |
130 | u8 hopcount; | 167 | u8 hopcount; |
131 | struct rio_dev *prev; | 168 | struct rio_dev *prev; |
169 | struct rio_switch rswitch[0]; /* RIO switch info */ | ||
132 | }; | 170 | }; |
133 | 171 | ||
134 | #define rio_dev_g(n) list_entry(n, struct rio_dev, global_list) | 172 | #define rio_dev_g(n) list_entry(n, struct rio_dev, global_list) |
135 | #define rio_dev_f(n) list_entry(n, struct rio_dev, net_list) | 173 | #define rio_dev_f(n) list_entry(n, struct rio_dev, net_list) |
136 | #define to_rio_dev(n) container_of(n, struct rio_dev, dev) | 174 | #define to_rio_dev(n) container_of(n, struct rio_dev, dev) |
175 | #define sw_to_rio_dev(n) container_of(n, struct rio_dev, rswitch[0]) | ||
137 | 176 | ||
138 | /** | 177 | /** |
139 | * struct rio_msg - RIO message event | 178 | * struct rio_msg - RIO message event |
@@ -226,45 +265,6 @@ struct rio_net { | |||
226 | #define RIO_SW_SYSFS_CREATE 1 /* Create switch attributes */ | 265 | #define RIO_SW_SYSFS_CREATE 1 /* Create switch attributes */ |
227 | #define RIO_SW_SYSFS_REMOVE 0 /* Remove switch attributes */ | 266 | #define RIO_SW_SYSFS_REMOVE 0 /* Remove switch attributes */ |
228 | 267 | ||
229 | /** | ||
230 | * struct rio_switch - RIO switch info | ||
231 | * @node: Node in global list of switches | ||
232 | * @rdev: Associated RIO device structure | ||
233 | * @switchid: Switch ID that is unique across a network | ||
234 | * @route_table: Copy of switch routing table | ||
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 | ||
237 | * @get_entry: Callback for switch-specific route get function | ||
238 | * @clr_table: Callback for switch-specific clear route table function | ||
239 | * @set_domain: Callback for switch-specific domain setting function | ||
240 | * @get_domain: Callback for switch-specific domain get function | ||
241 | * @em_init: Callback for switch-specific error management initialization function | ||
242 | * @em_handle: Callback for switch-specific error management handler function | ||
243 | * @sw_sysfs: Callback that initializes switch-specific sysfs attributes | ||
244 | * @nextdev: Array of per-port pointers to the next attached device | ||
245 | */ | ||
246 | struct rio_switch { | ||
247 | struct list_head node; | ||
248 | struct rio_dev *rdev; | ||
249 | u16 switchid; | ||
250 | u8 *route_table; | ||
251 | u32 port_ok; | ||
252 | int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, | ||
253 | u16 table, u16 route_destid, u8 route_port); | ||
254 | int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, | ||
255 | u16 table, u16 route_destid, u8 * route_port); | ||
256 | int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
257 | u16 table); | ||
258 | int (*set_domain) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
259 | u8 sw_domain); | ||
260 | int (*get_domain) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
261 | u8 *sw_domain); | ||
262 | int (*em_init) (struct rio_dev *dev); | ||
263 | int (*em_handle) (struct rio_dev *dev, u8 swport); | ||
264 | int (*sw_sysfs) (struct rio_dev *dev, int create); | ||
265 | struct rio_dev *nextdev[0]; | ||
266 | }; | ||
267 | |||
268 | /* Low-level architecture-dependent routines */ | 268 | /* Low-level architecture-dependent routines */ |
269 | 269 | ||
270 | /** | 270 | /** |