]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/linux/rio.h
rapidio: convert switch drivers to modules
[karo-tx-linux.git] / include / linux / rio.h
index 18e099342e6f82732a93b347b021ca7aa4e2b22d..fcd492e7aff4a9f81e4bd789aa03551c758fe4dc 100644 (file)
@@ -94,6 +94,23 @@ union rio_pw_msg;
  * @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;
+       u16 switchid;
+       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 +118,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 +136,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 +143,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 +172,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 +312,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 */
 
 /**
@@ -400,20 +411,6 @@ struct rio_device_id {
        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 */