aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/rio.h
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/linux/rio.h
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'include/linux/rio.h')
-rw-r--r--include/linux/rio.h130
1 files changed, 83 insertions, 47 deletions
diff --git a/include/linux/rio.h b/include/linux/rio.h
index bd6eb0ed34a7..4d50611112ba 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -24,6 +24,7 @@
24#define RIO_NO_HOPCOUNT -1 24#define RIO_NO_HOPCOUNT -1
25#define RIO_INVALID_DESTID 0xffff 25#define RIO_INVALID_DESTID 0xffff
26 26
27#define RIO_MAX_MPORTS 8
27#define RIO_MAX_MPORT_RESOURCES 16 28#define RIO_MAX_MPORT_RESOURCES 16
28#define RIO_MAX_DEV_RESOURCES 16 29#define RIO_MAX_DEV_RESOURCES 16
29 30
@@ -66,13 +67,62 @@
66 67
67#define RIO_PW_MSG_SIZE 64 68#define RIO_PW_MSG_SIZE 64
68 69
70/*
71 * A component tag value (stored in the component tag CSR) is used as device's
72 * unique identifier assigned during enumeration. Besides being used for
73 * identifying switches (which do not have device ID register), it also is used
74 * by error management notification and therefore has to be assigned
75 * to endpoints as well.
76 */
77#define RIO_CTAG_RESRVD 0xfffe0000 /* Reserved */
78#define RIO_CTAG_UDEVID 0x0001ffff /* Unique device identifier */
79
69extern struct bus_type rio_bus_type; 80extern struct bus_type rio_bus_type;
81extern struct device rio_bus;
70extern struct list_head rio_devices; /* list of all devices */ 82extern struct list_head rio_devices; /* list of all devices */
71 83
72struct rio_mport; 84struct rio_mport;
85struct rio_dev;
73union rio_pw_msg; 86union rio_pw_msg;
74 87
75/** 88/**
89 * struct rio_switch - RIO switch info
90 * @node: Node in global list of switches
91 * @switchid: Switch ID that is unique across a network
92 * @route_table: Copy of switch routing table
93 * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0
94 * @add_entry: Callback for switch-specific route add function
95 * @get_entry: Callback for switch-specific route get function
96 * @clr_table: Callback for switch-specific clear route table function
97 * @set_domain: Callback for switch-specific domain setting function
98 * @get_domain: Callback for switch-specific domain get function
99 * @em_init: Callback for switch-specific error management init function
100 * @em_handle: Callback for switch-specific error management handler function
101 * @sw_sysfs: Callback that initializes switch-specific sysfs attributes
102 * @nextdev: Array of per-port pointers to the next attached device
103 */
104struct rio_switch {
105 struct list_head node;
106 u16 switchid;
107 u8 *route_table;
108 u32 port_ok;
109 int (*add_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
110 u16 table, u16 route_destid, u8 route_port);
111 int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
112 u16 table, u16 route_destid, u8 *route_port);
113 int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount,
114 u16 table);
115 int (*set_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
116 u8 sw_domain);
117 int (*get_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
118 u8 *sw_domain);
119 int (*em_init) (struct rio_dev *dev);
120 int (*em_handle) (struct rio_dev *dev, u8 swport);
121 int (*sw_sysfs) (struct rio_dev *dev, int create);
122 struct rio_dev *nextdev[0];
123};
124
125/**
76 * struct rio_dev - RIO device info 126 * struct rio_dev - RIO device info
77 * @global_list: Node in list of all RIO devices 127 * @global_list: Node in list of all RIO devices
78 * @net_list: Node in list of RIO devices in a network 128 * @net_list: Node in list of RIO devices in a network
@@ -92,12 +142,14 @@ union rio_pw_msg;
92 * @phys_efptr: RIO device extended features pointer 142 * @phys_efptr: RIO device extended features pointer
93 * @em_efptr: RIO Error Management features pointer 143 * @em_efptr: RIO Error Management features pointer
94 * @dma_mask: Mask of bits of RIO address this device implements 144 * @dma_mask: Mask of bits of RIO address this device implements
95 * @rswitch: Pointer to &struct rio_switch if valid for this device
96 * @driver: Driver claiming this device 145 * @driver: Driver claiming this device
97 * @dev: Device model device 146 * @dev: Device model device
98 * @riores: RIO resources this device owns 147 * @riores: RIO resources this device owns
99 * @pwcback: port-write callback function for this device 148 * @pwcback: port-write callback function for this device
100 * @destid: Network destination ID 149 * @destid: Network destination ID (or associated destid for switch)
150 * @hopcount: Hopcount to this device
151 * @prev: Previous RIO device connected to the current one
152 * @rswitch: struct rio_switch (if valid for this device)
101 */ 153 */
102struct rio_dev { 154struct rio_dev {
103 struct list_head global_list; /* node in list of all RIO devices */ 155 struct list_head global_list; /* node in list of all RIO devices */
@@ -111,24 +163,27 @@ struct rio_dev {
111 u16 asm_rev; 163 u16 asm_rev;
112 u16 efptr; 164 u16 efptr;
113 u32 pef; 165 u32 pef;
114 u32 swpinfo; /* Only used for switches */ 166 u32 swpinfo;
115 u32 src_ops; 167 u32 src_ops;
116 u32 dst_ops; 168 u32 dst_ops;
117 u32 comp_tag; 169 u32 comp_tag;
118 u32 phys_efptr; 170 u32 phys_efptr;
119 u32 em_efptr; 171 u32 em_efptr;
120 u64 dma_mask; 172 u64 dma_mask;
121 struct rio_switch *rswitch; /* RIO switch info */
122 struct rio_driver *driver; /* RIO driver claiming this device */ 173 struct rio_driver *driver; /* RIO driver claiming this device */
123 struct device dev; /* LDM device structure */ 174 struct device dev; /* LDM device structure */
124 struct resource riores[RIO_MAX_DEV_RESOURCES]; 175 struct resource riores[RIO_MAX_DEV_RESOURCES];
125 int (*pwcback) (struct rio_dev *rdev, union rio_pw_msg *msg, int step); 176 int (*pwcback) (struct rio_dev *rdev, union rio_pw_msg *msg, int step);
126 u16 destid; 177 u16 destid;
178 u8 hopcount;
179 struct rio_dev *prev;
180 struct rio_switch rswitch[0]; /* RIO switch info */
127}; 181};
128 182
129#define rio_dev_g(n) list_entry(n, struct rio_dev, global_list) 183#define rio_dev_g(n) list_entry(n, struct rio_dev, global_list)
130#define rio_dev_f(n) list_entry(n, struct rio_dev, net_list) 184#define rio_dev_f(n) list_entry(n, struct rio_dev, net_list)
131#define to_rio_dev(n) container_of(n, struct rio_dev, dev) 185#define to_rio_dev(n) container_of(n, struct rio_dev, dev)
186#define sw_to_rio_dev(n) container_of(n, struct rio_dev, rswitch[0])
132 187
133/** 188/**
134 * struct rio_msg - RIO message event 189 * struct rio_msg - RIO message event
@@ -174,6 +229,7 @@ enum rio_phy_type {
174 * @index: Port index, unique among all port interfaces of the same type 229 * @index: Port index, unique among all port interfaces of the same type
175 * @sys_size: RapidIO common transport system size 230 * @sys_size: RapidIO common transport system size
176 * @phy_type: RapidIO phy type 231 * @phy_type: RapidIO phy type
232 * @phys_efptr: RIO port extended features pointer
177 * @name: Port name string 233 * @name: Port name string
178 * @priv: Master port private data 234 * @priv: Master port private data
179 */ 235 */
@@ -186,7 +242,7 @@ struct rio_mport {
186 struct rio_msg inb_msg[RIO_MAX_MBOX]; 242 struct rio_msg inb_msg[RIO_MAX_MBOX];
187 struct rio_msg outb_msg[RIO_MAX_MBOX]; 243 struct rio_msg outb_msg[RIO_MAX_MBOX];
188 int host_deviceid; /* Host device ID */ 244 int host_deviceid; /* Host device ID */
189 struct rio_ops *ops; /* maintenance transaction functions */ 245 struct rio_ops *ops; /* low-level architecture-dependent routines */
190 unsigned char id; /* port ID, unique among all ports */ 246 unsigned char id; /* port ID, unique among all ports */
191 unsigned char index; /* port index, unique among all port 247 unsigned char index; /* port index, unique among all port
192 interfaces of the same type */ 248 interfaces of the same type */
@@ -195,6 +251,7 @@ struct rio_mport {
195 * 1 - Large size, 65536 devices. 251 * 1 - Large size, 65536 devices.
196 */ 252 */
197 enum rio_phy_type phy_type; /* RapidIO phy type */ 253 enum rio_phy_type phy_type; /* RapidIO phy type */
254 u32 phys_efptr;
198 unsigned char name[40]; 255 unsigned char name[40];
199 void *priv; /* Master port private data */ 256 void *priv; /* Master port private data */
200}; 257};
@@ -215,42 +272,9 @@ struct rio_net {
215 unsigned char id; /* RIO network ID */ 272 unsigned char id; /* RIO network ID */
216}; 273};
217 274
218/** 275/* Definitions used by switch sysfs initialization callback */
219 * struct rio_switch - RIO switch info 276#define RIO_SW_SYSFS_CREATE 1 /* Create switch attributes */
220 * @node: Node in global list of switches 277#define RIO_SW_SYSFS_REMOVE 0 /* Remove switch attributes */
221 * @switchid: Switch ID that is unique across a network
222 * @hopcount: Hopcount to this switch
223 * @destid: Associated destid in the path
224 * @route_table: Copy of switch routing table
225 * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0
226 * @add_entry: Callback for switch-specific route add function
227 * @get_entry: Callback for switch-specific route get function
228 * @clr_table: Callback for switch-specific clear route table function
229 * @set_domain: Callback for switch-specific domain setting function
230 * @get_domain: Callback for switch-specific domain get function
231 * @em_init: Callback for switch-specific error management initialization function
232 * @em_handle: Callback for switch-specific error management handler function
233 */
234struct rio_switch {
235 struct list_head node;
236 u16 switchid;
237 u16 hopcount;
238 u16 destid;
239 u8 *route_table;
240 u32 port_ok;
241 int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
242 u16 table, u16 route_destid, u8 route_port);
243 int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
244 u16 table, u16 route_destid, u8 * route_port);
245 int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount,
246 u16 table);
247 int (*set_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
248 u8 sw_domain);
249 int (*get_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
250 u8 *sw_domain);
251 int (*em_init) (struct rio_dev *dev);
252 int (*em_handle) (struct rio_dev *dev, u8 swport);
253};
254 278
255/* Low-level architecture-dependent routines */ 279/* Low-level architecture-dependent routines */
256 280
@@ -262,6 +286,13 @@ struct rio_switch {
262 * @cwrite: Callback to perform network write of config space. 286 * @cwrite: Callback to perform network write of config space.
263 * @dsend: Callback to send a doorbell message. 287 * @dsend: Callback to send a doorbell message.
264 * @pwenable: Callback to enable/disable port-write message handling. 288 * @pwenable: Callback to enable/disable port-write message handling.
289 * @open_outb_mbox: Callback to initialize outbound mailbox.
290 * @close_outb_mbox: Callback to shut down outbound mailbox.
291 * @open_inb_mbox: Callback to initialize inbound mailbox.
292 * @close_inb_mbox: Callback to shut down inbound mailbox.
293 * @add_outb_message: Callback to add a message to an outbound mailbox queue.
294 * @add_inb_buffer: Callback to add a buffer to an inbound mailbox queue.
295 * @get_inb_message: Callback to get a message from an inbound mailbox queue.
265 */ 296 */
266struct rio_ops { 297struct rio_ops {
267 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len, 298 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
@@ -274,6 +305,16 @@ struct rio_ops {
274 u8 hopcount, u32 offset, int len, u32 data); 305 u8 hopcount, u32 offset, int len, u32 data);
275 int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data); 306 int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data);
276 int (*pwenable) (struct rio_mport *mport, int enable); 307 int (*pwenable) (struct rio_mport *mport, int enable);
308 int (*open_outb_mbox)(struct rio_mport *mport, void *dev_id,
309 int mbox, int entries);
310 void (*close_outb_mbox)(struct rio_mport *mport, int mbox);
311 int (*open_inb_mbox)(struct rio_mport *mport, void *dev_id,
312 int mbox, int entries);
313 void (*close_inb_mbox)(struct rio_mport *mport, int mbox);
314 int (*add_outb_message)(struct rio_mport *mport, struct rio_dev *rdev,
315 int mbox, void *buffer, size_t len);
316 int (*add_inb_buffer)(struct rio_mport *mport, int mbox, void *buf);
317 void *(*get_inb_message)(struct rio_mport *mport, int mbox);
277}; 318};
278 319
279#define RIO_RESOURCE_MEM 0x00000100 320#define RIO_RESOURCE_MEM 0x00000100
@@ -355,12 +396,7 @@ union rio_pw_msg {
355}; 396};
356 397
357/* Architecture and hardware-specific functions */ 398/* Architecture and hardware-specific functions */
358extern int rio_init_mports(void); 399extern int rio_register_mport(struct rio_mport *);
359extern void rio_register_mport(struct rio_mport *);
360extern int rio_hw_add_outb_message(struct rio_mport *, struct rio_dev *, int,
361 void *, size_t);
362extern int rio_hw_add_inb_buffer(struct rio_mport *, int, void *);
363extern void *rio_hw_get_inb_message(struct rio_mport *, int);
364extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int); 400extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);
365extern void rio_close_inb_mbox(struct rio_mport *, int); 401extern void rio_close_inb_mbox(struct rio_mport *, int);
366extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int); 402extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int);