summaryrefslogtreecommitdiff
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 @@
#include <linux/errno.h>
#include <linux/device.h>
#include <linux/rio_regs.h>
+#include <linux/mod_devicetable.h>
#ifdef CONFIG_RAPIDIO_DMA_ENGINE
#include <linux/dmaengine.h>
#endif
@@ -91,9 +92,24 @@ union rio_pw_msg;
/**
* struct rio_switch - RIO switch info
* @node: Node in global list of switches
- * @switchid: Switch ID that is unique across a network
* @route_table: Copy of switch routing table
* @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0
+ * @ops: pointer to switch-specific operations
+ * @lock: lock to serialize operations updates
+ * @nextdev: Array of per-port pointers to the next attached device
+ */
+struct rio_switch {
+ struct list_head node;
+ u8 *route_table;
+ u32 port_ok;
+ struct rio_switch_ops *ops;
+ spinlock_t lock;
+ struct rio_dev *nextdev[0];
+};
+
+/**
+ * struct rio_switch_ops - Per-switch operations
+ * @owner: The module owner of this structure
* @add_entry: Callback for switch-specific route add function
* @get_entry: Callback for switch-specific route get function
* @clr_table: Callback for switch-specific clear route table function
@@ -101,14 +117,12 @@ union rio_pw_msg;
* @get_domain: Callback for switch-specific domain get function
* @em_init: Callback for switch-specific error management init function
* @em_handle: Callback for switch-specific error management handler function
- * @sw_sysfs: Callback that initializes switch-specific sysfs attributes
- * @nextdev: Array of per-port pointers to the next attached device
+ *
+ * Defines the operations that are necessary to initialize/control
+ * a particular RIO switch device.
*/
-struct rio_switch {
- struct list_head node;
- u16 switchid;
- u8 *route_table;
- u32 port_ok;
+struct rio_switch_ops {
+ struct module *owner;
int (*add_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
u16 table, u16 route_destid, u8 route_port);
int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
@@ -121,8 +135,6 @@ struct rio_switch {
u8 *sw_domain);
int (*em_init) (struct rio_dev *dev);
int (*em_handle) (struct rio_dev *dev, u8 swport);
- int (*sw_sysfs) (struct rio_dev *dev, int create);
- struct rio_dev *nextdev[0];
};
/**
@@ -130,6 +142,7 @@ struct rio_switch {
* @global_list: Node in list of all RIO devices
* @net_list: Node in list of RIO devices in a network
* @net: Network this device is a part of
+ * @do_enum: Enumeration flag
* @did: Device ID
* @vid: Vendor ID
* @device_rev: Device revision
@@ -158,6 +171,7 @@ struct rio_dev {
struct list_head global_list; /* node in list of all RIO devices */
struct list_head net_list; /* node in per net list */
struct rio_net *net; /* RIO net this device resides in */
+ bool do_enum;
u16 did;
u16 vid;
u32 device_rev;
@@ -297,10 +311,6 @@ struct rio_net {
struct rio_id_table destid_table; /* destID allocation table */
};
-/* Definitions used by switch sysfs initialization callback */
-#define RIO_SW_SYSFS_CREATE 1 /* Create switch attributes */
-#define RIO_SW_SYSFS_REMOVE 0 /* Remove switch attributes */
-
/* Low-level architecture-dependent routines */
/**
@@ -385,35 +395,6 @@ struct rio_driver {
#define to_rio_driver(drv) container_of(drv,struct rio_driver, driver)
-/**
- * struct rio_device_id - RIO device identifier
- * @did: RIO device ID
- * @vid: RIO vendor ID
- * @asm_did: RIO assembly device ID
- * @asm_vid: RIO assembly vendor ID
- *
- * Identifies a RIO device based on both the device/vendor IDs and
- * the assembly device/vendor IDs.
- */
-struct rio_device_id {
- u16 did, vid;
- u16 asm_did, asm_vid;
-};
-
-/**
- * struct rio_switch_ops - Per-switch operations
- * @vid: RIO vendor ID
- * @did: RIO device ID
- * @init_hook: Callback that performs switch device initialization
- *
- * Defines the operations that are necessary to initialize/control
- * a particular RIO switch device.
- */
-struct rio_switch_ops {
- u16 vid, did;
- int (*init_hook) (struct rio_dev *rdev, int do_enum);
-};
-
union rio_pw_msg {
struct {
u32 comptag; /* Component Tag CSR */
@@ -468,14 +449,29 @@ static inline struct rio_mport *dma_to_mport(struct dma_device *ddev)
/**
* struct rio_scan - RIO enumeration and discovery operations
+ * @owner: The module owner of this structure
* @enumerate: Callback to perform RapidIO fabric enumeration.
* @discover: Callback to perform RapidIO fabric discovery.
*/
struct rio_scan {
+ struct module *owner;
int (*enumerate)(struct rio_mport *mport, u32 flags);
int (*discover)(struct rio_mport *mport, u32 flags);
};
+/**
+ * struct rio_scan_node - list node to register RapidIO enumeration and
+ * discovery methods with RapidIO core.
+ * @mport_id: ID of an mport (net) serviced by this enumerator
+ * @node: node in global list of registered enumerators
+ * @ops: RIO enumeration and discovery operations
+ */
+struct rio_scan_node {
+ int mport_id;
+ struct list_head node;
+ struct rio_scan *ops;
+};
+
/* Architecture and hardware-specific functions */
extern int rio_register_mport(struct rio_mport *);
extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);