diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/rio.h | 321 | ||||
-rw-r--r-- | include/linux/rio_drv.h | 469 | ||||
-rw-r--r-- | include/linux/rio_ids.h | 24 | ||||
-rw-r--r-- | include/linux/rio_regs.h | 202 |
4 files changed, 1016 insertions, 0 deletions
diff --git a/include/linux/rio.h b/include/linux/rio.h new file mode 100644 index 000000000000..930bbb7c3802 --- /dev/null +++ b/include/linux/rio.h | |||
@@ -0,0 +1,321 @@ | |||
1 | /* | ||
2 | * RapidIO interconnect services | ||
3 | * (RapidIO Interconnect Specification, http://www.rapidio.org) | ||
4 | * | ||
5 | * Copyright 2005 MontaVista Software, Inc. | ||
6 | * Matt Porter <mporter@kernel.crashing.org> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | */ | ||
13 | |||
14 | #ifndef LINUX_RIO_H | ||
15 | #define LINUX_RIO_H | ||
16 | |||
17 | #ifdef __KERNEL__ | ||
18 | |||
19 | #include <linux/types.h> | ||
20 | #include <linux/config.h> | ||
21 | #include <linux/ioport.h> | ||
22 | #include <linux/list.h> | ||
23 | #include <linux/errno.h> | ||
24 | #include <linux/device.h> | ||
25 | #include <linux/rio_regs.h> | ||
26 | |||
27 | #define RIO_ANY_DESTID 0xff | ||
28 | #define RIO_NO_HOPCOUNT -1 | ||
29 | |||
30 | #define RIO_MAX_MPORT_RESOURCES 16 | ||
31 | #define RIO_MAX_DEV_RESOURCES 16 | ||
32 | |||
33 | #define RIO_GLOBAL_TABLE 0xff /* Indicates access of a switch's | ||
34 | global routing table if it | ||
35 | has multiple (or per port) | ||
36 | tables */ | ||
37 | |||
38 | #define RIO_INVALID_ROUTE 0xff /* Indicates that a route table | ||
39 | entry is invalid (no route | ||
40 | exists for the device ID) */ | ||
41 | |||
42 | #ifdef CONFIG_RAPIDIO_8_BIT_TRANSPORT | ||
43 | #define RIO_MAX_ROUTE_ENTRIES (1 << 8) | ||
44 | #else | ||
45 | #define RIO_MAX_ROUTE_ENTRIES (1 << 16) | ||
46 | #endif | ||
47 | |||
48 | #define RIO_MAX_MBOX 4 | ||
49 | #define RIO_MAX_MSG_SIZE 0x1000 | ||
50 | |||
51 | /* | ||
52 | * Error values that may be returned by RIO functions. | ||
53 | */ | ||
54 | #define RIO_SUCCESSFUL 0x00 | ||
55 | #define RIO_BAD_SIZE 0x81 | ||
56 | |||
57 | /* | ||
58 | * For RIO devices, the region numbers are assigned this way: | ||
59 | * | ||
60 | * 0 RapidIO outbound doorbells | ||
61 | * 1-15 RapidIO memory regions | ||
62 | * | ||
63 | * For RIO master ports, the region number are assigned this way: | ||
64 | * | ||
65 | * 0 RapidIO inbound doorbells | ||
66 | * 1 RapidIO inbound mailboxes | ||
67 | * 1 RapidIO outbound mailboxes | ||
68 | */ | ||
69 | #define RIO_DOORBELL_RESOURCE 0 | ||
70 | #define RIO_INB_MBOX_RESOURCE 1 | ||
71 | #define RIO_OUTB_MBOX_RESOURCE 2 | ||
72 | |||
73 | extern struct bus_type rio_bus_type; | ||
74 | extern struct list_head rio_devices; /* list of all devices */ | ||
75 | |||
76 | struct rio_mport; | ||
77 | |||
78 | /** | ||
79 | * struct rio_dev - RIO device info | ||
80 | * @global_list: Node in list of all RIO devices | ||
81 | * @net_list: Node in list of RIO devices in a network | ||
82 | * @net: Network this device is a part of | ||
83 | * @did: Device ID | ||
84 | * @vid: Vendor ID | ||
85 | * @device_rev: Device revision | ||
86 | * @asm_did: Assembly device ID | ||
87 | * @asm_vid: Assembly vendor ID | ||
88 | * @asm_rev: Assembly revision | ||
89 | * @efptr: Extended feature pointer | ||
90 | * @pef: Processing element features | ||
91 | * @swpinfo: Switch port info | ||
92 | * @src_ops: Source operation capabilities | ||
93 | * @dst_ops: Destination operation capabilities | ||
94 | * @rswitch: Pointer to &struct rio_switch if valid for this device | ||
95 | * @driver: Driver claiming this device | ||
96 | * @dev: Device model device | ||
97 | * @riores: RIO resources this device owns | ||
98 | * @destid: Network destination ID | ||
99 | */ | ||
100 | struct rio_dev { | ||
101 | struct list_head global_list; /* node in list of all RIO devices */ | ||
102 | struct list_head net_list; /* node in per net list */ | ||
103 | struct rio_net *net; /* RIO net this device resides in */ | ||
104 | u16 did; | ||
105 | u16 vid; | ||
106 | u32 device_rev; | ||
107 | u16 asm_did; | ||
108 | u16 asm_vid; | ||
109 | u16 asm_rev; | ||
110 | u16 efptr; | ||
111 | u32 pef; | ||
112 | u32 swpinfo; /* Only used for switches */ | ||
113 | u32 src_ops; | ||
114 | u32 dst_ops; | ||
115 | struct rio_switch *rswitch; /* RIO switch info */ | ||
116 | struct rio_driver *driver; /* RIO driver claiming this device */ | ||
117 | struct device dev; /* LDM device structure */ | ||
118 | struct resource riores[RIO_MAX_DEV_RESOURCES]; | ||
119 | u16 destid; | ||
120 | }; | ||
121 | |||
122 | #define rio_dev_g(n) list_entry(n, struct rio_dev, global_list) | ||
123 | #define rio_dev_f(n) list_entry(n, struct rio_dev, net_list) | ||
124 | #define to_rio_dev(n) container_of(n, struct rio_dev, dev) | ||
125 | |||
126 | /** | ||
127 | * struct rio_msg - RIO message event | ||
128 | * @res: Mailbox resource | ||
129 | * @mcback: Message event callback | ||
130 | */ | ||
131 | struct rio_msg { | ||
132 | struct resource *res; | ||
133 | void (*mcback) (struct rio_mport * mport, int mbox, int slot); | ||
134 | }; | ||
135 | |||
136 | /** | ||
137 | * struct rio_dbell - RIO doorbell event | ||
138 | * @node: Node in list of doorbell events | ||
139 | * @res: Doorbell resource | ||
140 | * @dinb: Doorbell event callback | ||
141 | */ | ||
142 | struct rio_dbell { | ||
143 | struct list_head node; | ||
144 | struct resource *res; | ||
145 | void (*dinb) (struct rio_mport * mport, u16 src, u16 dst, u16 info); | ||
146 | }; | ||
147 | |||
148 | /** | ||
149 | * struct rio_mport - RIO master port info | ||
150 | * @dbells: List of doorbell events | ||
151 | * @node: Node in global list of master ports | ||
152 | * @nnode: Node in network list of master ports | ||
153 | * @iores: I/O mem resource that this master port interface owns | ||
154 | * @riores: RIO resources that this master port interfaces owns | ||
155 | * @inb_msg: RIO inbound message event descriptors | ||
156 | * @outb_msg: RIO outbound message event descriptors | ||
157 | * @host_deviceid: Host device ID associated with this master port | ||
158 | * @ops: configuration space functions | ||
159 | * @id: Port ID, unique among all ports | ||
160 | * @index: Port index, unique among all port interfaces of the same type | ||
161 | * @name: Port name string | ||
162 | */ | ||
163 | struct rio_mport { | ||
164 | struct list_head dbells; /* list of doorbell events */ | ||
165 | struct list_head node; /* node in global list of ports */ | ||
166 | struct list_head nnode; /* node in net list of ports */ | ||
167 | struct resource iores; | ||
168 | struct resource riores[RIO_MAX_MPORT_RESOURCES]; | ||
169 | struct rio_msg inb_msg[RIO_MAX_MBOX]; | ||
170 | struct rio_msg outb_msg[RIO_MAX_MBOX]; | ||
171 | int host_deviceid; /* Host device ID */ | ||
172 | struct rio_ops *ops; /* maintenance transaction functions */ | ||
173 | unsigned char id; /* port ID, unique among all ports */ | ||
174 | unsigned char index; /* port index, unique among all port | ||
175 | interfaces of the same type */ | ||
176 | unsigned char name[40]; | ||
177 | }; | ||
178 | |||
179 | /** | ||
180 | * struct rio_net - RIO network info | ||
181 | * @node: Node in global list of RIO networks | ||
182 | * @devices: List of devices in this network | ||
183 | * @mports: List of master ports accessing this network | ||
184 | * @hport: Default port for accessing this network | ||
185 | * @id: RIO network ID | ||
186 | */ | ||
187 | struct rio_net { | ||
188 | struct list_head node; /* node in list of networks */ | ||
189 | struct list_head devices; /* list of devices in this net */ | ||
190 | struct list_head mports; /* list of ports accessing net */ | ||
191 | struct rio_mport *hport; /* primary port for accessing net */ | ||
192 | unsigned char id; /* RIO network ID */ | ||
193 | }; | ||
194 | |||
195 | /** | ||
196 | * struct rio_switch - RIO switch info | ||
197 | * @node: Node in global list of switches | ||
198 | * @switchid: Switch ID that is unique across a network | ||
199 | * @hopcount: Hopcount to this switch | ||
200 | * @destid: Associated destid in the path | ||
201 | * @route_table: Copy of switch routing table | ||
202 | * @add_entry: Callback for switch-specific route add function | ||
203 | * @get_entry: Callback for switch-specific route get function | ||
204 | */ | ||
205 | struct rio_switch { | ||
206 | struct list_head node; | ||
207 | u16 switchid; | ||
208 | u16 hopcount; | ||
209 | u16 destid; | ||
210 | u8 route_table[RIO_MAX_ROUTE_ENTRIES]; | ||
211 | int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, | ||
212 | u16 table, u16 route_destid, u8 route_port); | ||
213 | int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, | ||
214 | u16 table, u16 route_destid, u8 * route_port); | ||
215 | }; | ||
216 | |||
217 | /* Low-level architecture-dependent routines */ | ||
218 | |||
219 | /** | ||
220 | * struct rio_ops - Low-level RIO configuration space operations | ||
221 | * @lcread: Callback to perform local (master port) read of config space. | ||
222 | * @lcwrite: Callback to perform local (master port) write of config space. | ||
223 | * @cread: Callback to perform network read of config space. | ||
224 | * @cwrite: Callback to perform network write of config space. | ||
225 | * @dsend: Callback to send a doorbell message. | ||
226 | */ | ||
227 | struct rio_ops { | ||
228 | int (*lcread) (int index, u32 offset, int len, u32 * data); | ||
229 | int (*lcwrite) (int index, u32 offset, int len, u32 data); | ||
230 | int (*cread) (int index, u16 destid, u8 hopcount, u32 offset, int len, | ||
231 | u32 * data); | ||
232 | int (*cwrite) (int index, u16 destid, u8 hopcount, u32 offset, int len, | ||
233 | u32 data); | ||
234 | int (*dsend) (int index, u16 destid, u16 data); | ||
235 | }; | ||
236 | |||
237 | #define RIO_RESOURCE_MEM 0x00000100 | ||
238 | #define RIO_RESOURCE_DOORBELL 0x00000200 | ||
239 | #define RIO_RESOURCE_MAILBOX 0x00000400 | ||
240 | |||
241 | #define RIO_RESOURCE_CACHEABLE 0x00010000 | ||
242 | #define RIO_RESOURCE_PCI 0x00020000 | ||
243 | |||
244 | #define RIO_RESOURCE_BUSY 0x80000000 | ||
245 | |||
246 | /** | ||
247 | * struct rio_driver - RIO driver info | ||
248 | * @node: Node in list of drivers | ||
249 | * @name: RIO driver name | ||
250 | * @id_table: RIO device ids to be associated with this driver | ||
251 | * @probe: RIO device inserted | ||
252 | * @remove: RIO device removed | ||
253 | * @suspend: RIO device suspended | ||
254 | * @resume: RIO device awakened | ||
255 | * @enable_wake: RIO device enable wake event | ||
256 | * @driver: LDM driver struct | ||
257 | * | ||
258 | * Provides info on a RIO device driver for insertion/removal and | ||
259 | * power management purposes. | ||
260 | */ | ||
261 | struct rio_driver { | ||
262 | struct list_head node; | ||
263 | char *name; | ||
264 | const struct rio_device_id *id_table; | ||
265 | int (*probe) (struct rio_dev * dev, const struct rio_device_id * id); | ||
266 | void (*remove) (struct rio_dev * dev); | ||
267 | int (*suspend) (struct rio_dev * dev, u32 state); | ||
268 | int (*resume) (struct rio_dev * dev); | ||
269 | int (*enable_wake) (struct rio_dev * dev, u32 state, int enable); | ||
270 | struct device_driver driver; | ||
271 | }; | ||
272 | |||
273 | #define to_rio_driver(drv) container_of(drv,struct rio_driver, driver) | ||
274 | |||
275 | /** | ||
276 | * struct rio_device_id - RIO device identifier | ||
277 | * @did: RIO device ID | ||
278 | * @vid: RIO vendor ID | ||
279 | * @asm_did: RIO assembly device ID | ||
280 | * @asm_vid: RIO assembly vendor ID | ||
281 | * | ||
282 | * Identifies a RIO device based on both the device/vendor IDs and | ||
283 | * the assembly device/vendor IDs. | ||
284 | */ | ||
285 | struct rio_device_id { | ||
286 | u16 did, vid; | ||
287 | u16 asm_did, asm_vid; | ||
288 | }; | ||
289 | |||
290 | /** | ||
291 | * struct rio_route_ops - Per-switch route operations | ||
292 | * @vid: RIO vendor ID | ||
293 | * @did: RIO device ID | ||
294 | * @add_hook: Callback that adds a route entry | ||
295 | * @get_hook: Callback that gets a route entry | ||
296 | * | ||
297 | * Defines the operations that are necessary to manipulate the route | ||
298 | * tables for a particular RIO switch device. | ||
299 | */ | ||
300 | struct rio_route_ops { | ||
301 | u16 vid, did; | ||
302 | int (*add_hook) (struct rio_mport * mport, u16 destid, u8 hopcount, | ||
303 | u16 table, u16 route_destid, u8 route_port); | ||
304 | int (*get_hook) (struct rio_mport * mport, u16 destid, u8 hopcount, | ||
305 | u16 table, u16 route_destid, u8 * route_port); | ||
306 | }; | ||
307 | |||
308 | /* Architecture and hardware-specific functions */ | ||
309 | extern int rio_init_mports(void); | ||
310 | extern void rio_register_mport(struct rio_mport *); | ||
311 | extern int rio_hw_add_outb_message(struct rio_mport *, struct rio_dev *, int, | ||
312 | void *, size_t); | ||
313 | extern int rio_hw_add_inb_buffer(struct rio_mport *, int, void *); | ||
314 | extern void *rio_hw_get_inb_message(struct rio_mport *, int); | ||
315 | extern int rio_open_inb_mbox(struct rio_mport *, int, int); | ||
316 | extern void rio_close_inb_mbox(struct rio_mport *, int); | ||
317 | extern int rio_open_outb_mbox(struct rio_mport *, int, int); | ||
318 | extern void rio_close_outb_mbox(struct rio_mport *, int); | ||
319 | |||
320 | #endif /* __KERNEL__ */ | ||
321 | #endif /* LINUX_RIO_H */ | ||
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h new file mode 100644 index 000000000000..7483dfc0dfa3 --- /dev/null +++ b/include/linux/rio_drv.h | |||
@@ -0,0 +1,469 @@ | |||
1 | /* | ||
2 | * RapidIO driver services | ||
3 | * | ||
4 | * Copyright 2005 MontaVista Software, Inc. | ||
5 | * Matt Porter <mporter@kernel.crashing.org> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef LINUX_RIO_DRV_H | ||
14 | #define LINUX_RIO_DRV_H | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | |||
18 | #include <linux/types.h> | ||
19 | #include <linux/config.h> | ||
20 | #include <linux/ioport.h> | ||
21 | #include <linux/list.h> | ||
22 | #include <linux/errno.h> | ||
23 | #include <linux/device.h> | ||
24 | #include <linux/rio.h> | ||
25 | |||
26 | extern int __rio_local_read_config_32(struct rio_mport *port, u32 offset, | ||
27 | u32 * data); | ||
28 | extern int __rio_local_write_config_32(struct rio_mport *port, u32 offset, | ||
29 | u32 data); | ||
30 | extern int __rio_local_read_config_16(struct rio_mport *port, u32 offset, | ||
31 | u16 * data); | ||
32 | extern int __rio_local_write_config_16(struct rio_mport *port, u32 offset, | ||
33 | u16 data); | ||
34 | extern int __rio_local_read_config_8(struct rio_mport *port, u32 offset, | ||
35 | u8 * data); | ||
36 | extern int __rio_local_write_config_8(struct rio_mport *port, u32 offset, | ||
37 | u8 data); | ||
38 | |||
39 | extern int rio_mport_read_config_32(struct rio_mport *port, u16 destid, | ||
40 | u8 hopcount, u32 offset, u32 * data); | ||
41 | extern int rio_mport_write_config_32(struct rio_mport *port, u16 destid, | ||
42 | u8 hopcount, u32 offset, u32 data); | ||
43 | extern int rio_mport_read_config_16(struct rio_mport *port, u16 destid, | ||
44 | u8 hopcount, u32 offset, u16 * data); | ||
45 | extern int rio_mport_write_config_16(struct rio_mport *port, u16 destid, | ||
46 | u8 hopcount, u32 offset, u16 data); | ||
47 | extern int rio_mport_read_config_8(struct rio_mport *port, u16 destid, | ||
48 | u8 hopcount, u32 offset, u8 * data); | ||
49 | extern int rio_mport_write_config_8(struct rio_mport *port, u16 destid, | ||
50 | u8 hopcount, u32 offset, u8 data); | ||
51 | |||
52 | /** | ||
53 | * rio_local_read_config_32 - Read 32 bits from local configuration space | ||
54 | * @port: Master port | ||
55 | * @offset: Offset into local configuration space | ||
56 | * @data: Pointer to read data into | ||
57 | * | ||
58 | * Reads 32 bits of data from the specified offset within the local | ||
59 | * device's configuration space. | ||
60 | */ | ||
61 | static inline int rio_local_read_config_32(struct rio_mport *port, u32 offset, | ||
62 | u32 * data) | ||
63 | { | ||
64 | return __rio_local_read_config_32(port, offset, data); | ||
65 | } | ||
66 | |||
67 | /** | ||
68 | * rio_local_write_config_32 - Write 32 bits to local configuration space | ||
69 | * @port: Master port | ||
70 | * @offset: Offset into local configuration space | ||
71 | * @data: Data to be written | ||
72 | * | ||
73 | * Writes 32 bits of data to the specified offset within the local | ||
74 | * device's configuration space. | ||
75 | */ | ||
76 | static inline int rio_local_write_config_32(struct rio_mport *port, u32 offset, | ||
77 | u32 data) | ||
78 | { | ||
79 | return __rio_local_write_config_32(port, offset, data); | ||
80 | } | ||
81 | |||
82 | /** | ||
83 | * rio_local_read_config_16 - Read 16 bits from local configuration space | ||
84 | * @port: Master port | ||
85 | * @offset: Offset into local configuration space | ||
86 | * @data: Pointer to read data into | ||
87 | * | ||
88 | * Reads 16 bits of data from the specified offset within the local | ||
89 | * device's configuration space. | ||
90 | */ | ||
91 | static inline int rio_local_read_config_16(struct rio_mport *port, u32 offset, | ||
92 | u16 * data) | ||
93 | { | ||
94 | return __rio_local_read_config_16(port, offset, data); | ||
95 | } | ||
96 | |||
97 | /** | ||
98 | * rio_local_write_config_16 - Write 16 bits to local configuration space | ||
99 | * @port: Master port | ||
100 | * @offset: Offset into local configuration space | ||
101 | * @data: Data to be written | ||
102 | * | ||
103 | * Writes 16 bits of data to the specified offset within the local | ||
104 | * device's configuration space. | ||
105 | */ | ||
106 | |||
107 | static inline int rio_local_write_config_16(struct rio_mport *port, u32 offset, | ||
108 | u16 data) | ||
109 | { | ||
110 | return __rio_local_write_config_16(port, offset, data); | ||
111 | } | ||
112 | |||
113 | /** | ||
114 | * rio_local_read_config_8 - Read 8 bits from local configuration space | ||
115 | * @port: Master port | ||
116 | * @offset: Offset into local configuration space | ||
117 | * @data: Pointer to read data into | ||
118 | * | ||
119 | * Reads 8 bits of data from the specified offset within the local | ||
120 | * device's configuration space. | ||
121 | */ | ||
122 | static inline int rio_local_read_config_8(struct rio_mport *port, u32 offset, | ||
123 | u8 * data) | ||
124 | { | ||
125 | return __rio_local_read_config_8(port, offset, data); | ||
126 | } | ||
127 | |||
128 | /** | ||
129 | * rio_local_write_config_8 - Write 8 bits to local configuration space | ||
130 | * @port: Master port | ||
131 | * @offset: Offset into local configuration space | ||
132 | * @data: Data to be written | ||
133 | * | ||
134 | * Writes 8 bits of data to the specified offset within the local | ||
135 | * device's configuration space. | ||
136 | */ | ||
137 | static inline int rio_local_write_config_8(struct rio_mport *port, u32 offset, | ||
138 | u8 data) | ||
139 | { | ||
140 | return __rio_local_write_config_8(port, offset, data); | ||
141 | } | ||
142 | |||
143 | /** | ||
144 | * rio_read_config_32 - Read 32 bits from configuration space | ||
145 | * @rdev: RIO device | ||
146 | * @offset: Offset into device configuration space | ||
147 | * @data: Pointer to read data into | ||
148 | * | ||
149 | * Reads 32 bits of data from the specified offset within the | ||
150 | * RIO device's configuration space. | ||
151 | */ | ||
152 | static inline int rio_read_config_32(struct rio_dev *rdev, u32 offset, | ||
153 | u32 * data) | ||
154 | { | ||
155 | u8 hopcount = 0xff; | ||
156 | u16 destid = rdev->destid; | ||
157 | |||
158 | if (rdev->rswitch) { | ||
159 | destid = rdev->rswitch->destid; | ||
160 | hopcount = rdev->rswitch->hopcount; | ||
161 | } | ||
162 | |||
163 | return rio_mport_read_config_32(rdev->net->hport, destid, hopcount, | ||
164 | offset, data); | ||
165 | }; | ||
166 | |||
167 | /** | ||
168 | * rio_write_config_32 - Write 32 bits to configuration space | ||
169 | * @rdev: RIO device | ||
170 | * @offset: Offset into device configuration space | ||
171 | * @data: Data to be written | ||
172 | * | ||
173 | * Writes 32 bits of data to the specified offset within the | ||
174 | * RIO device's configuration space. | ||
175 | */ | ||
176 | static inline int rio_write_config_32(struct rio_dev *rdev, u32 offset, | ||
177 | u32 data) | ||
178 | { | ||
179 | u8 hopcount = 0xff; | ||
180 | u16 destid = rdev->destid; | ||
181 | |||
182 | if (rdev->rswitch) { | ||
183 | destid = rdev->rswitch->destid; | ||
184 | hopcount = rdev->rswitch->hopcount; | ||
185 | } | ||
186 | |||
187 | return rio_mport_write_config_32(rdev->net->hport, destid, hopcount, | ||
188 | offset, data); | ||
189 | }; | ||
190 | |||
191 | /** | ||
192 | * rio_read_config_16 - Read 16 bits from configuration space | ||
193 | * @rdev: RIO device | ||
194 | * @offset: Offset into device configuration space | ||
195 | * @data: Pointer to read data into | ||
196 | * | ||
197 | * Reads 16 bits of data from the specified offset within the | ||
198 | * RIO device's configuration space. | ||
199 | */ | ||
200 | static inline int rio_read_config_16(struct rio_dev *rdev, u32 offset, | ||
201 | u16 * data) | ||
202 | { | ||
203 | u8 hopcount = 0xff; | ||
204 | u16 destid = rdev->destid; | ||
205 | |||
206 | if (rdev->rswitch) { | ||
207 | destid = rdev->rswitch->destid; | ||
208 | hopcount = rdev->rswitch->hopcount; | ||
209 | } | ||
210 | |||
211 | return rio_mport_read_config_16(rdev->net->hport, destid, hopcount, | ||
212 | offset, data); | ||
213 | }; | ||
214 | |||
215 | /** | ||
216 | * rio_write_config_16 - Write 16 bits to configuration space | ||
217 | * @rdev: RIO device | ||
218 | * @offset: Offset into device configuration space | ||
219 | * @data: Data to be written | ||
220 | * | ||
221 | * Writes 16 bits of data to the specified offset within the | ||
222 | * RIO device's configuration space. | ||
223 | */ | ||
224 | static inline int rio_write_config_16(struct rio_dev *rdev, u32 offset, | ||
225 | u16 data) | ||
226 | { | ||
227 | u8 hopcount = 0xff; | ||
228 | u16 destid = rdev->destid; | ||
229 | |||
230 | if (rdev->rswitch) { | ||
231 | destid = rdev->rswitch->destid; | ||
232 | hopcount = rdev->rswitch->hopcount; | ||
233 | } | ||
234 | |||
235 | return rio_mport_write_config_16(rdev->net->hport, destid, hopcount, | ||
236 | offset, data); | ||
237 | }; | ||
238 | |||
239 | /** | ||
240 | * rio_read_config_8 - Read 8 bits from configuration space | ||
241 | * @rdev: RIO device | ||
242 | * @offset: Offset into device configuration space | ||
243 | * @data: Pointer to read data into | ||
244 | * | ||
245 | * Reads 8 bits of data from the specified offset within the | ||
246 | * RIO device's configuration space. | ||
247 | */ | ||
248 | static inline int rio_read_config_8(struct rio_dev *rdev, u32 offset, u8 * data) | ||
249 | { | ||
250 | u8 hopcount = 0xff; | ||
251 | u16 destid = rdev->destid; | ||
252 | |||
253 | if (rdev->rswitch) { | ||
254 | destid = rdev->rswitch->destid; | ||
255 | hopcount = rdev->rswitch->hopcount; | ||
256 | } | ||
257 | |||
258 | return rio_mport_read_config_8(rdev->net->hport, destid, hopcount, | ||
259 | offset, data); | ||
260 | }; | ||
261 | |||
262 | /** | ||
263 | * rio_write_config_8 - Write 8 bits to configuration space | ||
264 | * @rdev: RIO device | ||
265 | * @offset: Offset into device configuration space | ||
266 | * @data: Data to be written | ||
267 | * | ||
268 | * Writes 8 bits of data to the specified offset within the | ||
269 | * RIO device's configuration space. | ||
270 | */ | ||
271 | static inline int rio_write_config_8(struct rio_dev *rdev, u32 offset, u8 data) | ||
272 | { | ||
273 | u8 hopcount = 0xff; | ||
274 | u16 destid = rdev->destid; | ||
275 | |||
276 | if (rdev->rswitch) { | ||
277 | destid = rdev->rswitch->destid; | ||
278 | hopcount = rdev->rswitch->hopcount; | ||
279 | } | ||
280 | |||
281 | return rio_mport_write_config_8(rdev->net->hport, destid, hopcount, | ||
282 | offset, data); | ||
283 | }; | ||
284 | |||
285 | extern int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid, | ||
286 | u16 data); | ||
287 | |||
288 | /** | ||
289 | * rio_send_doorbell - Send a doorbell message to a device | ||
290 | * @rdev: RIO device | ||
291 | * @data: Doorbell message data | ||
292 | * | ||
293 | * Send a doorbell message to a RIO device. The doorbell message | ||
294 | * has a 16-bit info field provided by the @data argument. | ||
295 | */ | ||
296 | static inline int rio_send_doorbell(struct rio_dev *rdev, u16 data) | ||
297 | { | ||
298 | return rio_mport_send_doorbell(rdev->net->hport, rdev->destid, data); | ||
299 | }; | ||
300 | |||
301 | /** | ||
302 | * rio_init_mbox_res - Initialize a RIO mailbox resource | ||
303 | * @res: resource struct | ||
304 | * @start: start of mailbox range | ||
305 | * @end: end of mailbox range | ||
306 | * | ||
307 | * This function is used to initialize the fields of a resource | ||
308 | * for use as a mailbox resource. It initializes a range of | ||
309 | * mailboxes using the start and end arguments. | ||
310 | */ | ||
311 | static inline void rio_init_mbox_res(struct resource *res, int start, int end) | ||
312 | { | ||
313 | memset(res, 0, sizeof(struct resource)); | ||
314 | res->start = start; | ||
315 | res->end = end; | ||
316 | res->flags = RIO_RESOURCE_MAILBOX; | ||
317 | } | ||
318 | |||
319 | /** | ||
320 | * rio_init_dbell_res - Initialize a RIO doorbell resource | ||
321 | * @res: resource struct | ||
322 | * @start: start of doorbell range | ||
323 | * @end: end of doorbell range | ||
324 | * | ||
325 | * This function is used to initialize the fields of a resource | ||
326 | * for use as a doorbell resource. It initializes a range of | ||
327 | * doorbell messages using the start and end arguments. | ||
328 | */ | ||
329 | static inline void rio_init_dbell_res(struct resource *res, u16 start, u16 end) | ||
330 | { | ||
331 | memset(res, 0, sizeof(struct resource)); | ||
332 | res->start = start; | ||
333 | res->end = end; | ||
334 | res->flags = RIO_RESOURCE_DOORBELL; | ||
335 | } | ||
336 | |||
337 | /** | ||
338 | * RIO_DEVICE - macro used to describe a specific RIO device | ||
339 | * @vid: the 16 bit RIO vendor ID | ||
340 | * @did: the 16 bit RIO device ID | ||
341 | * | ||
342 | * This macro is used to create a struct rio_device_id that matches a | ||
343 | * specific device. The assembly vendor and assembly device fields | ||
344 | * will be set to %RIO_ANY_ID. | ||
345 | */ | ||
346 | #define RIO_DEVICE(dev,ven) \ | ||
347 | .did = (dev), .vid = (ven), \ | ||
348 | .asm_did = RIO_ANY_ID, .asm_vid = RIO_ANY_ID | ||
349 | |||
350 | /* Mailbox management */ | ||
351 | extern int rio_request_outb_mbox(struct rio_mport *, int, int, | ||
352 | void (*)(struct rio_mport *, int, int)); | ||
353 | extern int rio_release_outb_mbox(struct rio_mport *, int); | ||
354 | |||
355 | /** | ||
356 | * rio_add_outb_message - Add RIO message to an outbound mailbox queue | ||
357 | * @mport: RIO master port containing the outbound queue | ||
358 | * @rdev: RIO device the message is be sent to | ||
359 | * @mbox: The outbound mailbox queue | ||
360 | * @buffer: Pointer to the message buffer | ||
361 | * @len: Length of the message buffer | ||
362 | * | ||
363 | * Adds a RIO message buffer to an outbound mailbox queue for | ||
364 | * transmission. Returns 0 on success. | ||
365 | */ | ||
366 | static inline int rio_add_outb_message(struct rio_mport *mport, | ||
367 | struct rio_dev *rdev, int mbox, | ||
368 | void *buffer, size_t len) | ||
369 | { | ||
370 | return rio_hw_add_outb_message(mport, rdev, mbox, buffer, len); | ||
371 | } | ||
372 | |||
373 | extern int rio_request_inb_mbox(struct rio_mport *, int, int, | ||
374 | void (*)(struct rio_mport *, int, int)); | ||
375 | extern int rio_release_inb_mbox(struct rio_mport *, int); | ||
376 | |||
377 | /** | ||
378 | * rio_add_inb_buffer - Add buffer to an inbound mailbox queue | ||
379 | * @mport: Master port containing the inbound mailbox | ||
380 | * @mbox: The inbound mailbox number | ||
381 | * @buffer: Pointer to the message buffer | ||
382 | * | ||
383 | * Adds a buffer to an inbound mailbox queue for reception. Returns | ||
384 | * 0 on success. | ||
385 | */ | ||
386 | static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox, | ||
387 | void *buffer) | ||
388 | { | ||
389 | return rio_hw_add_inb_buffer(mport, mbox, buffer); | ||
390 | } | ||
391 | |||
392 | /** | ||
393 | * rio_get_inb_message - Get A RIO message from an inbound mailbox queue | ||
394 | * @mport: Master port containing the inbound mailbox | ||
395 | * @mbox: The inbound mailbox number | ||
396 | * @buffer: Pointer to the message buffer | ||
397 | * | ||
398 | * Get a RIO message from an inbound mailbox queue. Returns 0 on success. | ||
399 | */ | ||
400 | static inline void *rio_get_inb_message(struct rio_mport *mport, int mbox) | ||
401 | { | ||
402 | return rio_hw_get_inb_message(mport, mbox); | ||
403 | } | ||
404 | |||
405 | /* Doorbell management */ | ||
406 | extern int rio_request_inb_dbell(struct rio_mport *, u16, u16, | ||
407 | void (*)(struct rio_mport *, u16, u16, u16)); | ||
408 | extern int rio_release_inb_dbell(struct rio_mport *, u16, u16); | ||
409 | extern struct resource *rio_request_outb_dbell(struct rio_dev *, u16, u16); | ||
410 | extern int rio_release_outb_dbell(struct rio_dev *, struct resource *); | ||
411 | |||
412 | /* Memory region management */ | ||
413 | int rio_claim_resource(struct rio_dev *, int); | ||
414 | int rio_request_regions(struct rio_dev *, char *); | ||
415 | void rio_release_regions(struct rio_dev *); | ||
416 | int rio_request_region(struct rio_dev *, int, char *); | ||
417 | void rio_release_region(struct rio_dev *, int); | ||
418 | |||
419 | /* LDM support */ | ||
420 | int rio_register_driver(struct rio_driver *); | ||
421 | void rio_unregister_driver(struct rio_driver *); | ||
422 | struct rio_dev *rio_dev_get(struct rio_dev *); | ||
423 | void rio_dev_put(struct rio_dev *); | ||
424 | |||
425 | /** | ||
426 | * rio_name - Get the unique RIO device identifier | ||
427 | * @rdev: RIO device | ||
428 | * | ||
429 | * Get the unique RIO device identifier. Returns the device | ||
430 | * identifier string. | ||
431 | */ | ||
432 | static inline char *rio_name(struct rio_dev *rdev) | ||
433 | { | ||
434 | return rdev->dev.bus_id; | ||
435 | } | ||
436 | |||
437 | /** | ||
438 | * rio_get_drvdata - Get RIO driver specific data | ||
439 | * @rdev: RIO device | ||
440 | * | ||
441 | * Get RIO driver specific data. Returns a pointer to the | ||
442 | * driver specific data. | ||
443 | */ | ||
444 | static inline void *rio_get_drvdata(struct rio_dev *rdev) | ||
445 | { | ||
446 | return dev_get_drvdata(&rdev->dev); | ||
447 | } | ||
448 | |||
449 | /** | ||
450 | * rio_set_drvdata - Set RIO driver specific data | ||
451 | * @rdev: RIO device | ||
452 | * @data: Pointer to driver specific data | ||
453 | * | ||
454 | * Set RIO driver specific data. device struct driver data pointer | ||
455 | * is set to the @data argument. | ||
456 | */ | ||
457 | static inline void rio_set_drvdata(struct rio_dev *rdev, void *data) | ||
458 | { | ||
459 | dev_set_drvdata(&rdev->dev, data); | ||
460 | } | ||
461 | |||
462 | /* Misc driver helpers */ | ||
463 | extern u16 rio_local_get_device_id(struct rio_mport *port); | ||
464 | extern struct rio_dev *rio_get_device(u16 vid, u16 did, struct rio_dev *from); | ||
465 | extern struct rio_dev *rio_get_asm(u16 vid, u16 did, u16 asm_vid, u16 asm_did, | ||
466 | struct rio_dev *from); | ||
467 | |||
468 | #endif /* __KERNEL__ */ | ||
469 | #endif /* LINUX_RIO_DRV_H */ | ||
diff --git a/include/linux/rio_ids.h b/include/linux/rio_ids.h new file mode 100644 index 000000000000..919d4e07d54e --- /dev/null +++ b/include/linux/rio_ids.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * RapidIO devices | ||
3 | * | ||
4 | * Copyright 2005 MontaVista Software, Inc. | ||
5 | * Matt Porter <mporter@kernel.crashing.org> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef LINUX_RIO_IDS_H | ||
14 | #define LINUX_RIO_IDS_H | ||
15 | |||
16 | #define RIO_ANY_ID 0xffff | ||
17 | |||
18 | #define RIO_VID_FREESCALE 0x0002 | ||
19 | #define RIO_DID_MPC8560 0x0003 | ||
20 | |||
21 | #define RIO_VID_TUNDRA 0x000d | ||
22 | #define RIO_DID_TSI500 0x0500 | ||
23 | |||
24 | #endif /* LINUX_RIO_IDS_H */ | ||
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h new file mode 100644 index 000000000000..f419be3be491 --- /dev/null +++ b/include/linux/rio_regs.h | |||
@@ -0,0 +1,202 @@ | |||
1 | /* | ||
2 | * RapidIO register definitions | ||
3 | * | ||
4 | * Copyright 2005 MontaVista Software, Inc. | ||
5 | * Matt Porter <mporter@kernel.crashing.org> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef LINUX_RIO_REGS_H | ||
14 | #define LINUX_RIO_REGS_H | ||
15 | |||
16 | /* | ||
17 | * In RapidIO, each device has a 2MB configuration space that is | ||
18 | * accessed via maintenance transactions. Portions of configuration | ||
19 | * space are standardized and/or reserved. | ||
20 | */ | ||
21 | #define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */ | ||
22 | #define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */ | ||
23 | #define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */ | ||
24 | #define RIO_ASM_ID_MASK 0xffff0000 /* [I] Asm ID Mask */ | ||
25 | #define RIO_ASM_VEN_ID_MASK 0x0000ffff /* [I] Asm Vend Mask */ | ||
26 | |||
27 | #define RIO_ASM_INFO_CAR 0x0c /* [I] Assembly Information CAR */ | ||
28 | #define RIO_ASM_REV_MASK 0xffff0000 /* [I] Asm Rev Mask */ | ||
29 | #define RIO_EXT_FTR_PTR_MASK 0x0000ffff /* [I] EF_PTR Mask */ | ||
30 | |||
31 | #define RIO_PEF_CAR 0x10 /* [I] Processing Element Features CAR */ | ||
32 | #define RIO_PEF_BRIDGE 0x80000000 /* [I] Bridge */ | ||
33 | #define RIO_PEF_MEMORY 0x40000000 /* [I] MMIO */ | ||
34 | #define RIO_PEF_PROCESSOR 0x20000000 /* [I] Processor */ | ||
35 | #define RIO_PEF_SWITCH 0x10000000 /* [I] Switch */ | ||
36 | #define RIO_PEF_INB_MBOX 0x00f00000 /* [II] Mailboxes */ | ||
37 | #define RIO_PEF_INB_MBOX0 0x00800000 /* [II] Mailbox 0 */ | ||
38 | #define RIO_PEF_INB_MBOX1 0x00400000 /* [II] Mailbox 1 */ | ||
39 | #define RIO_PEF_INB_MBOX2 0x00200000 /* [II] Mailbox 2 */ | ||
40 | #define RIO_PEF_INB_MBOX3 0x00100000 /* [II] Mailbox 3 */ | ||
41 | #define RIO_PEF_INB_DOORBELL 0x00080000 /* [II] Doorbells */ | ||
42 | #define RIO_PEF_CTLS 0x00000010 /* [III] CTLS */ | ||
43 | #define RIO_PEF_EXT_FEATURES 0x00000008 /* [I] EFT_PTR valid */ | ||
44 | #define RIO_PEF_ADDR_66 0x00000004 /* [I] 66 bits */ | ||
45 | #define RIO_PEF_ADDR_50 0x00000002 /* [I] 50 bits */ | ||
46 | #define RIO_PEF_ADDR_34 0x00000001 /* [I] 34 bits */ | ||
47 | |||
48 | #define RIO_SWP_INFO_CAR 0x14 /* [I] Switch Port Information CAR */ | ||
49 | #define RIO_SWP_INFO_PORT_TOTAL_MASK 0x0000ff00 /* [I] Total number of ports */ | ||
50 | #define RIO_SWP_INFO_PORT_NUM_MASK 0x000000ff /* [I] Maintenance transaction port number */ | ||
51 | #define RIO_GET_TOTAL_PORTS(x) ((x & RIO_SWP_INFO_PORT_TOTAL_MASK) >> 8) | ||
52 | |||
53 | #define RIO_SRC_OPS_CAR 0x18 /* [I] Source Operations CAR */ | ||
54 | #define RIO_SRC_OPS_READ 0x00008000 /* [I] Read op */ | ||
55 | #define RIO_SRC_OPS_WRITE 0x00004000 /* [I] Write op */ | ||
56 | #define RIO_SRC_OPS_STREAM_WRITE 0x00002000 /* [I] Str-write op */ | ||
57 | #define RIO_SRC_OPS_WRITE_RESPONSE 0x00001000 /* [I] Write/resp op */ | ||
58 | #define RIO_SRC_OPS_DATA_MSG 0x00000800 /* [II] Data msg op */ | ||
59 | #define RIO_SRC_OPS_DOORBELL 0x00000400 /* [II] Doorbell op */ | ||
60 | #define RIO_SRC_OPS_ATOMIC_TST_SWP 0x00000100 /* [I] Atomic TAS op */ | ||
61 | #define RIO_SRC_OPS_ATOMIC_INC 0x00000080 /* [I] Atomic inc op */ | ||
62 | #define RIO_SRC_OPS_ATOMIC_DEC 0x00000040 /* [I] Atomic dec op */ | ||
63 | #define RIO_SRC_OPS_ATOMIC_SET 0x00000020 /* [I] Atomic set op */ | ||
64 | #define RIO_SRC_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */ | ||
65 | #define RIO_SRC_OPS_PORT_WRITE 0x00000004 /* [I] Port-write op */ | ||
66 | |||
67 | #define RIO_DST_OPS_CAR 0x1c /* Destination Operations CAR */ | ||
68 | #define RIO_DST_OPS_READ 0x00008000 /* [I] Read op */ | ||
69 | #define RIO_DST_OPS_WRITE 0x00004000 /* [I] Write op */ | ||
70 | #define RIO_DST_OPS_STREAM_WRITE 0x00002000 /* [I] Str-write op */ | ||
71 | #define RIO_DST_OPS_WRITE_RESPONSE 0x00001000 /* [I] Write/resp op */ | ||
72 | #define RIO_DST_OPS_DATA_MSG 0x00000800 /* [II] Data msg op */ | ||
73 | #define RIO_DST_OPS_DOORBELL 0x00000400 /* [II] Doorbell op */ | ||
74 | #define RIO_DST_OPS_ATOMIC_TST_SWP 0x00000100 /* [I] Atomic TAS op */ | ||
75 | #define RIO_DST_OPS_ATOMIC_INC 0x00000080 /* [I] Atomic inc op */ | ||
76 | #define RIO_DST_OPS_ATOMIC_DEC 0x00000040 /* [I] Atomic dec op */ | ||
77 | #define RIO_DST_OPS_ATOMIC_SET 0x00000020 /* [I] Atomic set op */ | ||
78 | #define RIO_DST_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */ | ||
79 | #define RIO_DST_OPS_PORT_WRITE 0x00000004 /* [I] Port-write op */ | ||
80 | |||
81 | /* 0x20-0x3c *//* Reserved */ | ||
82 | |||
83 | #define RIO_MBOX_CSR 0x40 /* [II] Mailbox CSR */ | ||
84 | #define RIO_MBOX0_AVAIL 0x80000000 /* [II] Mbox 0 avail */ | ||
85 | #define RIO_MBOX0_FULL 0x40000000 /* [II] Mbox 0 full */ | ||
86 | #define RIO_MBOX0_EMPTY 0x20000000 /* [II] Mbox 0 empty */ | ||
87 | #define RIO_MBOX0_BUSY 0x10000000 /* [II] Mbox 0 busy */ | ||
88 | #define RIO_MBOX0_FAIL 0x08000000 /* [II] Mbox 0 fail */ | ||
89 | #define RIO_MBOX0_ERROR 0x04000000 /* [II] Mbox 0 error */ | ||
90 | #define RIO_MBOX1_AVAIL 0x00800000 /* [II] Mbox 1 avail */ | ||
91 | #define RIO_MBOX1_FULL 0x00200000 /* [II] Mbox 1 full */ | ||
92 | #define RIO_MBOX1_EMPTY 0x00200000 /* [II] Mbox 1 empty */ | ||
93 | #define RIO_MBOX1_BUSY 0x00100000 /* [II] Mbox 1 busy */ | ||
94 | #define RIO_MBOX1_FAIL 0x00080000 /* [II] Mbox 1 fail */ | ||
95 | #define RIO_MBOX1_ERROR 0x00040000 /* [II] Mbox 1 error */ | ||
96 | #define RIO_MBOX2_AVAIL 0x00008000 /* [II] Mbox 2 avail */ | ||
97 | #define RIO_MBOX2_FULL 0x00004000 /* [II] Mbox 2 full */ | ||
98 | #define RIO_MBOX2_EMPTY 0x00002000 /* [II] Mbox 2 empty */ | ||
99 | #define RIO_MBOX2_BUSY 0x00001000 /* [II] Mbox 2 busy */ | ||
100 | #define RIO_MBOX2_FAIL 0x00000800 /* [II] Mbox 2 fail */ | ||
101 | #define RIO_MBOX2_ERROR 0x00000400 /* [II] Mbox 2 error */ | ||
102 | #define RIO_MBOX3_AVAIL 0x00000080 /* [II] Mbox 3 avail */ | ||
103 | #define RIO_MBOX3_FULL 0x00000040 /* [II] Mbox 3 full */ | ||
104 | #define RIO_MBOX3_EMPTY 0x00000020 /* [II] Mbox 3 empty */ | ||
105 | #define RIO_MBOX3_BUSY 0x00000010 /* [II] Mbox 3 busy */ | ||
106 | #define RIO_MBOX3_FAIL 0x00000008 /* [II] Mbox 3 fail */ | ||
107 | #define RIO_MBOX3_ERROR 0x00000004 /* [II] Mbox 3 error */ | ||
108 | |||
109 | #define RIO_WRITE_PORT_CSR 0x44 /* [I] Write Port CSR */ | ||
110 | #define RIO_DOORBELL_CSR 0x44 /* [II] Doorbell CSR */ | ||
111 | #define RIO_DOORBELL_AVAIL 0x80000000 /* [II] Doorbell avail */ | ||
112 | #define RIO_DOORBELL_FULL 0x40000000 /* [II] Doorbell full */ | ||
113 | #define RIO_DOORBELL_EMPTY 0x20000000 /* [II] Doorbell empty */ | ||
114 | #define RIO_DOORBELL_BUSY 0x10000000 /* [II] Doorbell busy */ | ||
115 | #define RIO_DOORBELL_FAILED 0x08000000 /* [II] Doorbell failed */ | ||
116 | #define RIO_DOORBELL_ERROR 0x04000000 /* [II] Doorbell error */ | ||
117 | #define RIO_WRITE_PORT_AVAILABLE 0x00000080 /* [I] Write Port Available */ | ||
118 | #define RIO_WRITE_PORT_FULL 0x00000040 /* [I] Write Port Full */ | ||
119 | #define RIO_WRITE_PORT_EMPTY 0x00000020 /* [I] Write Port Empty */ | ||
120 | #define RIO_WRITE_PORT_BUSY 0x00000010 /* [I] Write Port Busy */ | ||
121 | #define RIO_WRITE_PORT_FAILED 0x00000008 /* [I] Write Port Failed */ | ||
122 | #define RIO_WRITE_PORT_ERROR 0x00000004 /* [I] Write Port Error */ | ||
123 | |||
124 | /* 0x48 *//* Reserved */ | ||
125 | |||
126 | #define RIO_PELL_CTRL_CSR 0x4c /* [I] PE Logical Layer Control CSR */ | ||
127 | #define RIO_PELL_ADDR_66 0x00000004 /* [I] 66-bit addr */ | ||
128 | #define RIO_PELL_ADDR_50 0x00000002 /* [I] 50-bit addr */ | ||
129 | #define RIO_PELL_ADDR_34 0x00000001 /* [I] 34-bit addr */ | ||
130 | |||
131 | /* 0x50-0x54 *//* Reserved */ | ||
132 | |||
133 | #define RIO_LCSH_BA 0x58 /* [I] LCS High Base Address */ | ||
134 | #define RIO_LCSL_BA 0x5c /* [I] LCS Base Address */ | ||
135 | |||
136 | #define RIO_DID_CSR 0x60 /* [III] Base Device ID CSR */ | ||
137 | |||
138 | /* 0x64 *//* Reserved */ | ||
139 | |||
140 | #define RIO_HOST_DID_LOCK_CSR 0x68 /* [III] Host Base Device ID Lock CSR */ | ||
141 | #define RIO_COMPONENT_TAG_CSR 0x6c /* [III] Component Tag CSR */ | ||
142 | |||
143 | /* 0x70-0xf8 *//* Reserved */ | ||
144 | /* 0x100-0xfff8 *//* [I] Extended Features Space */ | ||
145 | /* 0x10000-0xfffff8 *//* [I] Implementation-defined Space */ | ||
146 | |||
147 | /* | ||
148 | * Extended Features Space is a configuration space area where | ||
149 | * functionality is mapped into extended feature blocks via a | ||
150 | * singly linked list of extended feature pointers (EFT_PTR). | ||
151 | * | ||
152 | * Each extended feature block can be identified/located in | ||
153 | * Extended Features Space by walking the extended feature | ||
154 | * list starting with the Extended Feature Pointer located | ||
155 | * in the Assembly Information CAR. | ||
156 | * | ||
157 | * Extended Feature Blocks (EFBs) are identified with an assigned | ||
158 | * EFB ID. Extended feature block offsets in the definitions are | ||
159 | * relative to the offset of the EFB within the Extended Features | ||
160 | * Space. | ||
161 | */ | ||
162 | |||
163 | /* Helper macros to parse the Extended Feature Block header */ | ||
164 | #define RIO_EFB_PTR_MASK 0xffff0000 | ||
165 | #define RIO_EFB_ID_MASK 0x0000ffff | ||
166 | #define RIO_GET_BLOCK_PTR(x) ((x & RIO_EFB_PTR_MASK) >> 16) | ||
167 | #define RIO_GET_BLOCK_ID(x) (x & RIO_EFB_ID_MASK) | ||
168 | |||
169 | /* Extended Feature Block IDs */ | ||
170 | #define RIO_EFB_PAR_EP_ID 0x0001 /* [IV] LP/LVDS EP Devices */ | ||
171 | #define RIO_EFB_PAR_EP_REC_ID 0x0002 /* [IV] LP/LVDS EP Recovery Devices */ | ||
172 | #define RIO_EFB_PAR_EP_FREE_ID 0x0003 /* [IV] LP/LVDS EP Free Devices */ | ||
173 | #define RIO_EFB_SER_EP_ID 0x0004 /* [VI] LP/Serial EP Devices */ | ||
174 | #define RIO_EFB_SER_EP_REC_ID 0x0005 /* [VI] LP/Serial EP Recovery Devices */ | ||
175 | #define RIO_EFB_SER_EP_FREE_ID 0x0006 /* [VI] LP/Serial EP Free Devices */ | ||
176 | |||
177 | /* | ||
178 | * Physical 8/16 LP-LVDS | ||
179 | * ID=0x0001, Generic End Point Devices | ||
180 | * ID=0x0002, Generic End Point Devices, software assisted recovery option | ||
181 | * ID=0x0003, Generic End Point Free Devices | ||
182 | * | ||
183 | * Physical LP-Serial | ||
184 | * ID=0x0004, Generic End Point Devices | ||
185 | * ID=0x0005, Generic End Point Devices, software assisted recovery option | ||
186 | * ID=0x0006, Generic End Point Free Devices | ||
187 | */ | ||
188 | #define RIO_PORT_MNT_HEADER 0x0000 | ||
189 | #define RIO_PORT_REQ_CTL_CSR 0x0020 | ||
190 | #define RIO_PORT_RSP_CTL_CSR 0x0024 /* 0x0001/0x0002 */ | ||
191 | #define RIO_PORT_GEN_CTL_CSR 0x003c | ||
192 | #define RIO_PORT_GEN_HOST 0x80000000 | ||
193 | #define RIO_PORT_GEN_MASTER 0x40000000 | ||
194 | #define RIO_PORT_GEN_DISCOVERED 0x20000000 | ||
195 | #define RIO_PORT_N_MNT_REQ_CSR(x) (0x0040 + x*0x20) /* 0x0002 */ | ||
196 | #define RIO_PORT_N_MNT_RSP_CSR(x) (0x0044 + x*0x20) /* 0x0002 */ | ||
197 | #define RIO_PORT_N_ACK_STS_CSR(x) (0x0048 + x*0x20) /* 0x0002 */ | ||
198 | #define RIO_PORT_N_ERR_STS_CSR(x) (0x58 + x*0x20) | ||
199 | #define PORT_N_ERR_STS_PORT_OK 0x00000002 | ||
200 | #define RIO_PORT_N_CTL_CSR(x) (0x5c + x*0x20) | ||
201 | |||
202 | #endif /* LINUX_RIO_REGS_H */ | ||