diff options
author | Alexandre Bounine <alexandre.bounine@idt.com> | 2013-07-03 18:08:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 19:08:04 -0400 |
commit | 2ec3ba69faf301fb599e3651515e808e8efa533e (patch) | |
tree | 953f10726fd0cd61fec02082233c6097287d7257 /include/linux/rio.h | |
parent | 36f0efbbe8e21c153dfc2f94c91f89ab06fd64c5 (diff) |
rapidio: convert switch drivers to modules
Rework RapidIO switch drivers to add an option to build them as loadable
kernel modules.
This patch removes RapidIO-specific vmlinux section and converts switch
drivers to be compatible with LDM driver registration method. To simplify
registration of device-specific callback routines this patch introduces
rio_switch_ops data structure. The sw_sysfs() callback is removed from
the list of device-specific operations because under the new structure its
functions can be handled by switch driver's probe() and remove() routines.
If a specific switch device driver is not loaded the RapidIO subsystem
core will use default standard-based operations to configure a switch.
Because the current implementation of RapidIO enumeration/discovery method
relies on availability of device-specific operations for error management,
switch device drivers must be loaded before the RapidIO
enumeration/discovery starts.
This patch also moves several common routines from enumeration/discovery
module into the RapidIO core code to make switch-specific operations
accessible to all components of RapidIO subsystem.
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Andre van Herk <andre.van.herk@Prodrive.nl>
Cc: Micha Nelissen <micha.nelissen@Prodrive.nl>
Cc: Stef van Os <stef.van.os@Prodrive.nl>
Cc: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/rio.h')
-rw-r--r-- | include/linux/rio.h | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/include/linux/rio.h b/include/linux/rio.h index 18e099342e6f..fcd492e7aff4 100644 --- a/include/linux/rio.h +++ b/include/linux/rio.h | |||
@@ -94,6 +94,23 @@ union rio_pw_msg; | |||
94 | * @switchid: Switch ID that is unique across a network | 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 | */ | ||
101 | struct rio_switch { | ||
102 | struct list_head node; | ||
103 | u16 switchid; | ||
104 | u8 *route_table; | ||
105 | u32 port_ok; | ||
106 | struct rio_switch_ops *ops; | ||
107 | spinlock_t lock; | ||
108 | struct rio_dev *nextdev[0]; | ||
109 | }; | ||
110 | |||
111 | /** | ||
112 | * struct rio_switch_ops - Per-switch operations | ||
113 | * @owner: The module owner of this structure | ||
97 | * @add_entry: Callback for switch-specific route add function | 114 | * @add_entry: Callback for switch-specific route add function |
98 | * @get_entry: Callback for switch-specific route get function | 115 | * @get_entry: Callback for switch-specific route get function |
99 | * @clr_table: Callback for switch-specific clear route table function | 116 | * @clr_table: Callback for switch-specific clear route table function |
@@ -101,14 +118,12 @@ union rio_pw_msg; | |||
101 | * @get_domain: Callback for switch-specific domain get function | 118 | * @get_domain: Callback for switch-specific domain get function |
102 | * @em_init: Callback for switch-specific error management init function | 119 | * @em_init: Callback for switch-specific error management init function |
103 | * @em_handle: Callback for switch-specific error management handler function | 120 | * @em_handle: Callback for switch-specific error management handler function |
104 | * @sw_sysfs: Callback that initializes switch-specific sysfs attributes | 121 | * |
105 | * @nextdev: Array of per-port pointers to the next attached device | 122 | * Defines the operations that are necessary to initialize/control |
123 | * a particular RIO switch device. | ||
106 | */ | 124 | */ |
107 | struct rio_switch { | 125 | struct rio_switch_ops { |
108 | struct list_head node; | 126 | 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, | 127 | int (*add_entry) (struct rio_mport *mport, u16 destid, u8 hopcount, |
113 | u16 table, u16 route_destid, u8 route_port); | 128 | u16 table, u16 route_destid, u8 route_port); |
114 | int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount, | 129 | int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount, |
@@ -121,8 +136,6 @@ struct rio_switch { | |||
121 | u8 *sw_domain); | 136 | u8 *sw_domain); |
122 | int (*em_init) (struct rio_dev *dev); | 137 | int (*em_init) (struct rio_dev *dev); |
123 | int (*em_handle) (struct rio_dev *dev, u8 swport); | 138 | 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 | }; | 139 | }; |
127 | 140 | ||
128 | /** | 141 | /** |
@@ -130,6 +143,7 @@ struct rio_switch { | |||
130 | * @global_list: Node in list of all RIO devices | 143 | * @global_list: Node in list of all RIO devices |
131 | * @net_list: Node in list of RIO devices in a network | 144 | * @net_list: Node in list of RIO devices in a network |
132 | * @net: Network this device is a part of | 145 | * @net: Network this device is a part of |
146 | * @do_enum: Enumeration flag | ||
133 | * @did: Device ID | 147 | * @did: Device ID |
134 | * @vid: Vendor ID | 148 | * @vid: Vendor ID |
135 | * @device_rev: Device revision | 149 | * @device_rev: Device revision |
@@ -158,6 +172,7 @@ struct rio_dev { | |||
158 | struct list_head global_list; /* node in list of all RIO devices */ | 172 | struct list_head global_list; /* node in list of all RIO devices */ |
159 | struct list_head net_list; /* node in per net list */ | 173 | struct list_head net_list; /* node in per net list */ |
160 | struct rio_net *net; /* RIO net this device resides in */ | 174 | struct rio_net *net; /* RIO net this device resides in */ |
175 | bool do_enum; | ||
161 | u16 did; | 176 | u16 did; |
162 | u16 vid; | 177 | u16 vid; |
163 | u32 device_rev; | 178 | u32 device_rev; |
@@ -297,10 +312,6 @@ struct rio_net { | |||
297 | struct rio_id_table destid_table; /* destID allocation table */ | 312 | struct rio_id_table destid_table; /* destID allocation table */ |
298 | }; | 313 | }; |
299 | 314 | ||
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 */ | 315 | /* Low-level architecture-dependent routines */ |
305 | 316 | ||
306 | /** | 317 | /** |
@@ -400,20 +411,6 @@ struct rio_device_id { | |||
400 | u16 asm_did, asm_vid; | 411 | u16 asm_did, asm_vid; |
401 | }; | 412 | }; |
402 | 413 | ||
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 | */ | ||
412 | struct rio_switch_ops { | ||
413 | u16 vid, did; | ||
414 | int (*init_hook) (struct rio_dev *rdev, int do_enum); | ||
415 | }; | ||
416 | |||
417 | union rio_pw_msg { | 414 | union rio_pw_msg { |
418 | struct { | 415 | struct { |
419 | u32 comptag; /* Component Tag CSR */ | 416 | u32 comptag; /* Component Tag CSR */ |