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>
This commit is contained in:

committed by
Linus Torvalds

parent
36f0efbbe8
commit
2ec3ba69fa
@@ -94,14 +94,8 @@ 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
|
||||
* @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
|
||||
* @set_domain: Callback for switch-specific domain setting function
|
||||
* @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
|
||||
* @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 {
|
||||
@@ -109,6 +103,27 @@ struct rio_switch {
|
||||
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
|
||||
* @set_domain: Callback for switch-specific domain setting function
|
||||
* @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
|
||||
*
|
||||
* Defines the operations that are necessary to initialize/control
|
||||
* a particular RIO switch device.
|
||||
*/
|
||||
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 */
|
||||
|
Reference in New Issue
Block a user