aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/rio.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/rio.h')
-rw-r--r--include/linux/rio.h82
1 files changed, 39 insertions, 43 deletions
diff --git a/include/linux/rio.h b/include/linux/rio.h
index 18e099342e6f..b71d5738e683 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -20,6 +20,7 @@
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/rio_regs.h> 22#include <linux/rio_regs.h>
23#include <linux/mod_devicetable.h>
23#ifdef CONFIG_RAPIDIO_DMA_ENGINE 24#ifdef CONFIG_RAPIDIO_DMA_ENGINE
24#include <linux/dmaengine.h> 25#include <linux/dmaengine.h>
25#endif 26#endif
@@ -91,9 +92,24 @@ union rio_pw_msg;
91/** 92/**
92 * struct rio_switch - RIO switch info 93 * struct rio_switch - RIO switch info
93 * @node: Node in global list of switches 94 * @node: Node in global list of switches
94 * @switchid: Switch ID that is unique across a network
95 * @route_table: Copy of switch routing table 95 * @route_table: Copy of switch routing table
96 * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0 96 * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0
97 * @ops: pointer to switch-specific operations
98 * @lock: lock to serialize operations updates
99 * @nextdev: Array of per-port pointers to the next attached device
100 */
101struct rio_switch {
102 struct list_head node;
103 u8 *route_table;
104 u32 port_ok;
105 struct rio_switch_ops *ops;
106 spinlock_t lock;
107 struct rio_dev *nextdev[0];
108};
109
110/**
111 * struct rio_switch_ops - Per-switch operations
112 * @owner: The module owner of this structure
97 * @add_entry: Callback for switch-specific route add function 113 * @add_entry: Callback for switch-specific route add function
98 * @get_entry: Callback for switch-specific route get function 114 * @get_entry: Callback for switch-specific route get function
99 * @clr_table: Callback for switch-specific clear route table function 115 * @clr_table: Callback for switch-specific clear route table function
@@ -101,14 +117,12 @@ union rio_pw_msg;
101 * @get_domain: Callback for switch-specific domain get function 117 * @get_domain: Callback for switch-specific domain get function
102 * @em_init: Callback for switch-specific error management init function 118 * @em_init: Callback for switch-specific error management init function
103 * @em_handle: Callback for switch-specific error management handler function 119 * @em_handle: Callback for switch-specific error management handler function
104 * @sw_sysfs: Callback that initializes switch-specific sysfs attributes 120 *
105 * @nextdev: Array of per-port pointers to the next attached device 121 * Defines the operations that are necessary to initialize/control
122 * a particular RIO switch device.
106 */ 123 */
107struct rio_switch { 124struct rio_switch_ops {
108 struct list_head node; 125 struct module *owner;
109 u16 switchid;
110 u8 *route_table;
111 u32 port_ok;
112 int (*add_entry) (struct rio_mport *mport, u16 destid, u8 hopcount, 126 int (*add_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
113 u16 table, u16 route_destid, u8 route_port); 127 u16 table, u16 route_destid, u8 route_port);
114 int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount, 128 int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
@@ -121,8 +135,6 @@ struct rio_switch {
121 u8 *sw_domain); 135 u8 *sw_domain);
122 int (*em_init) (struct rio_dev *dev); 136 int (*em_init) (struct rio_dev *dev);
123 int (*em_handle) (struct rio_dev *dev, u8 swport); 137 int (*em_handle) (struct rio_dev *dev, u8 swport);
124 int (*sw_sysfs) (struct rio_dev *dev, int create);
125 struct rio_dev *nextdev[0];
126}; 138};
127 139
128/** 140/**
@@ -130,6 +142,7 @@ struct rio_switch {
130 * @global_list: Node in list of all RIO devices 142 * @global_list: Node in list of all RIO devices
131 * @net_list: Node in list of RIO devices in a network 143 * @net_list: Node in list of RIO devices in a network
132 * @net: Network this device is a part of 144 * @net: Network this device is a part of
145 * @do_enum: Enumeration flag
133 * @did: Device ID 146 * @did: Device ID
134 * @vid: Vendor ID 147 * @vid: Vendor ID
135 * @device_rev: Device revision 148 * @device_rev: Device revision
@@ -158,6 +171,7 @@ struct rio_dev {
158 struct list_head global_list; /* node in list of all RIO devices */ 171 struct list_head global_list; /* node in list of all RIO devices */
159 struct list_head net_list; /* node in per net list */ 172 struct list_head net_list; /* node in per net list */
160 struct rio_net *net; /* RIO net this device resides in */ 173 struct rio_net *net; /* RIO net this device resides in */
174 bool do_enum;
161 u16 did; 175 u16 did;
162 u16 vid; 176 u16 vid;
163 u32 device_rev; 177 u32 device_rev;
@@ -297,10 +311,6 @@ struct rio_net {
297 struct rio_id_table destid_table; /* destID allocation table */ 311 struct rio_id_table destid_table; /* destID allocation table */
298}; 312};
299 313
300/* Definitions used by switch sysfs initialization callback */
301#define RIO_SW_SYSFS_CREATE 1 /* Create switch attributes */
302#define RIO_SW_SYSFS_REMOVE 0 /* Remove switch attributes */
303
304/* Low-level architecture-dependent routines */ 314/* Low-level architecture-dependent routines */
305 315
306/** 316/**
@@ -385,35 +395,6 @@ struct rio_driver {
385 395
386#define to_rio_driver(drv) container_of(drv,struct rio_driver, driver) 396#define to_rio_driver(drv) container_of(drv,struct rio_driver, driver)
387 397
388/**
389 * struct rio_device_id - RIO device identifier
390 * @did: RIO device ID
391 * @vid: RIO vendor ID
392 * @asm_did: RIO assembly device ID
393 * @asm_vid: RIO assembly vendor ID
394 *
395 * Identifies a RIO device based on both the device/vendor IDs and
396 * the assembly device/vendor IDs.
397 */
398struct rio_device_id {
399 u16 did, vid;
400 u16 asm_did, asm_vid;
401};
402
403/**
404 * struct rio_switch_ops - Per-switch operations
405 * @vid: RIO vendor ID
406 * @did: RIO device ID
407 * @init_hook: Callback that performs switch device initialization
408 *
409 * Defines the operations that are necessary to initialize/control
410 * a particular RIO switch device.
411 */
412struct rio_switch_ops {
413 u16 vid, did;
414 int (*init_hook) (struct rio_dev *rdev, int do_enum);
415};
416
417union rio_pw_msg { 398union rio_pw_msg {
418 struct { 399 struct {
419 u32 comptag; /* Component Tag CSR */ 400 u32 comptag; /* Component Tag CSR */
@@ -468,14 +449,29 @@ static inline struct rio_mport *dma_to_mport(struct dma_device *ddev)
468 449
469/** 450/**
470 * struct rio_scan - RIO enumeration and discovery operations 451 * struct rio_scan - RIO enumeration and discovery operations
452 * @owner: The module owner of this structure
471 * @enumerate: Callback to perform RapidIO fabric enumeration. 453 * @enumerate: Callback to perform RapidIO fabric enumeration.
472 * @discover: Callback to perform RapidIO fabric discovery. 454 * @discover: Callback to perform RapidIO fabric discovery.
473 */ 455 */
474struct rio_scan { 456struct rio_scan {
457 struct module *owner;
475 int (*enumerate)(struct rio_mport *mport, u32 flags); 458 int (*enumerate)(struct rio_mport *mport, u32 flags);
476 int (*discover)(struct rio_mport *mport, u32 flags); 459 int (*discover)(struct rio_mport *mport, u32 flags);
477}; 460};
478 461
462/**
463 * struct rio_scan_node - list node to register RapidIO enumeration and
464 * discovery methods with RapidIO core.
465 * @mport_id: ID of an mport (net) serviced by this enumerator
466 * @node: node in global list of registered enumerators
467 * @ops: RIO enumeration and discovery operations
468 */
469struct rio_scan_node {
470 int mport_id;
471 struct list_head node;
472 struct rio_scan *ops;
473};
474
479/* Architecture and hardware-specific functions */ 475/* Architecture and hardware-specific functions */
480extern int rio_register_mport(struct rio_mport *); 476extern int rio_register_mport(struct rio_mport *);
481extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int); 477extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);