diff options
Diffstat (limited to 'include/linux/rio.h')
-rw-r--r-- | include/linux/rio.h | 100 |
1 files changed, 54 insertions, 46 deletions
diff --git a/include/linux/rio.h b/include/linux/rio.h index 0bed941f9b1..ff681ebba58 100644 --- a/include/linux/rio.h +++ b/include/linux/rio.h | |||
@@ -66,14 +66,62 @@ | |||
66 | 66 | ||
67 | #define RIO_PW_MSG_SIZE 64 | 67 | #define RIO_PW_MSG_SIZE 64 |
68 | 68 | ||
69 | /* | ||
70 | * A component tag value (stored in the component tag CSR) is used as device's | ||
71 | * unique identifier assigned during enumeration. Besides being used for | ||
72 | * identifying switches (which do not have device ID register), it also is used | ||
73 | * by error management notification and therefore has to be assigned | ||
74 | * to endpoints as well. | ||
75 | */ | ||
76 | #define RIO_CTAG_RESRVD 0xfffe0000 /* Reserved */ | ||
77 | #define RIO_CTAG_UDEVID 0x0001ffff /* Unique device identifier */ | ||
78 | |||
69 | extern struct bus_type rio_bus_type; | 79 | extern struct bus_type rio_bus_type; |
70 | extern struct device rio_bus; | 80 | extern struct device rio_bus; |
71 | extern struct list_head rio_devices; /* list of all devices */ | 81 | extern struct list_head rio_devices; /* list of all devices */ |
72 | 82 | ||
73 | struct rio_mport; | 83 | struct rio_mport; |
84 | struct rio_dev; | ||
74 | union rio_pw_msg; | 85 | union rio_pw_msg; |
75 | 86 | ||
76 | /** | 87 | /** |
88 | * struct rio_switch - RIO switch info | ||
89 | * @node: Node in global list of switches | ||
90 | * @switchid: Switch ID that is unique across a network | ||
91 | * @route_table: Copy of switch routing table | ||
92 | * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0 | ||
93 | * @add_entry: Callback for switch-specific route add function | ||
94 | * @get_entry: Callback for switch-specific route get function | ||
95 | * @clr_table: Callback for switch-specific clear route table function | ||
96 | * @set_domain: Callback for switch-specific domain setting function | ||
97 | * @get_domain: Callback for switch-specific domain get function | ||
98 | * @em_init: Callback for switch-specific error management init function | ||
99 | * @em_handle: Callback for switch-specific error management handler function | ||
100 | * @sw_sysfs: Callback that initializes switch-specific sysfs attributes | ||
101 | * @nextdev: Array of per-port pointers to the next attached device | ||
102 | */ | ||
103 | struct rio_switch { | ||
104 | struct list_head node; | ||
105 | u16 switchid; | ||
106 | u8 *route_table; | ||
107 | u32 port_ok; | ||
108 | int (*add_entry) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
109 | u16 table, u16 route_destid, u8 route_port); | ||
110 | int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
111 | u16 table, u16 route_destid, u8 *route_port); | ||
112 | int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
113 | u16 table); | ||
114 | int (*set_domain) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
115 | u8 sw_domain); | ||
116 | int (*get_domain) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
117 | u8 *sw_domain); | ||
118 | int (*em_init) (struct rio_dev *dev); | ||
119 | int (*em_handle) (struct rio_dev *dev, u8 swport); | ||
120 | int (*sw_sysfs) (struct rio_dev *dev, int create); | ||
121 | struct rio_dev *nextdev[0]; | ||
122 | }; | ||
123 | |||
124 | /** | ||
77 | * struct rio_dev - RIO device info | 125 | * struct rio_dev - RIO device info |
78 | * @global_list: Node in list of all RIO devices | 126 | * @global_list: Node in list of all RIO devices |
79 | * @net_list: Node in list of RIO devices in a network | 127 | * @net_list: Node in list of RIO devices in a network |
@@ -93,13 +141,14 @@ union rio_pw_msg; | |||
93 | * @phys_efptr: RIO device extended features pointer | 141 | * @phys_efptr: RIO device extended features pointer |
94 | * @em_efptr: RIO Error Management features pointer | 142 | * @em_efptr: RIO Error Management features pointer |
95 | * @dma_mask: Mask of bits of RIO address this device implements | 143 | * @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 | 144 | * @driver: Driver claiming this device |
98 | * @dev: Device model device | 145 | * @dev: Device model device |
99 | * @riores: RIO resources this device owns | 146 | * @riores: RIO resources this device owns |
100 | * @pwcback: port-write callback function for this device | 147 | * @pwcback: port-write callback function for this device |
101 | * @destid: Network destination ID | 148 | * @destid: Network destination ID (or associated destid for switch) |
149 | * @hopcount: Hopcount to this device | ||
102 | * @prev: Previous RIO device connected to the current one | 150 | * @prev: Previous RIO device connected to the current one |
151 | * @rswitch: struct rio_switch (if valid for this device) | ||
103 | */ | 152 | */ |
104 | struct rio_dev { | 153 | struct rio_dev { |
105 | struct list_head global_list; /* node in list of all RIO devices */ | 154 | struct list_head global_list; /* node in list of all RIO devices */ |
@@ -120,18 +169,20 @@ struct rio_dev { | |||
120 | u32 phys_efptr; | 169 | u32 phys_efptr; |
121 | u32 em_efptr; | 170 | u32 em_efptr; |
122 | u64 dma_mask; | 171 | u64 dma_mask; |
123 | struct rio_switch *rswitch; /* RIO switch info */ | ||
124 | struct rio_driver *driver; /* RIO driver claiming this device */ | 172 | struct rio_driver *driver; /* RIO driver claiming this device */ |
125 | struct device dev; /* LDM device structure */ | 173 | struct device dev; /* LDM device structure */ |
126 | struct resource riores[RIO_MAX_DEV_RESOURCES]; | 174 | struct resource riores[RIO_MAX_DEV_RESOURCES]; |
127 | int (*pwcback) (struct rio_dev *rdev, union rio_pw_msg *msg, int step); | 175 | int (*pwcback) (struct rio_dev *rdev, union rio_pw_msg *msg, int step); |
128 | u16 destid; | 176 | u16 destid; |
177 | u8 hopcount; | ||
129 | struct rio_dev *prev; | 178 | struct rio_dev *prev; |
179 | struct rio_switch rswitch[0]; /* RIO switch info */ | ||
130 | }; | 180 | }; |
131 | 181 | ||
132 | #define rio_dev_g(n) list_entry(n, struct rio_dev, global_list) | 182 | #define rio_dev_g(n) list_entry(n, struct rio_dev, global_list) |
133 | #define rio_dev_f(n) list_entry(n, struct rio_dev, net_list) | 183 | #define rio_dev_f(n) list_entry(n, struct rio_dev, net_list) |
134 | #define to_rio_dev(n) container_of(n, struct rio_dev, dev) | 184 | #define to_rio_dev(n) container_of(n, struct rio_dev, dev) |
185 | #define sw_to_rio_dev(n) container_of(n, struct rio_dev, rswitch[0]) | ||
135 | 186 | ||
136 | /** | 187 | /** |
137 | * struct rio_msg - RIO message event | 188 | * struct rio_msg - RIO message event |
@@ -224,49 +275,6 @@ struct rio_net { | |||
224 | #define RIO_SW_SYSFS_CREATE 1 /* Create switch attributes */ | 275 | #define RIO_SW_SYSFS_CREATE 1 /* Create switch attributes */ |
225 | #define RIO_SW_SYSFS_REMOVE 0 /* Remove switch attributes */ | 276 | #define RIO_SW_SYSFS_REMOVE 0 /* Remove switch attributes */ |
226 | 277 | ||
227 | /** | ||
228 | * struct rio_switch - RIO switch info | ||
229 | * @node: Node in global list of switches | ||
230 | * @rdev: Associated RIO device structure | ||
231 | * @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 | ||
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 | u16 hopcount; | ||
251 | u16 destid; | ||
252 | u8 *route_table; | ||
253 | u32 port_ok; | ||
254 | int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, | ||
255 | u16 table, u16 route_destid, u8 route_port); | ||
256 | int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, | ||
257 | u16 table, u16 route_destid, u8 * route_port); | ||
258 | int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
259 | u16 table); | ||
260 | int (*set_domain) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
261 | u8 sw_domain); | ||
262 | int (*get_domain) (struct rio_mport *mport, u16 destid, u8 hopcount, | ||
263 | u8 *sw_domain); | ||
264 | int (*em_init) (struct rio_dev *dev); | ||
265 | int (*em_handle) (struct rio_dev *dev, u8 swport); | ||
266 | int (*sw_sysfs) (struct rio_dev *dev, int create); | ||
267 | struct rio_dev *nextdev[0]; | ||
268 | }; | ||
269 | |||
270 | /* Low-level architecture-dependent routines */ | 278 | /* Low-level architecture-dependent routines */ |
271 | 279 | ||
272 | /** | 280 | /** |