aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rapidio/rio.h
diff options
context:
space:
mode:
authorAlexandre Bounine <alexandre.bounine@idt.com>2010-05-26 17:44:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 12:12:51 -0400
commit058f88d672b3161fe511ebe2996c3faef63c1c8e (patch)
treefb4bb8d93aef661cc9e24e1e6e2e8bd4edc2e764 /drivers/rapidio/rio.h
parent011507e49a696462c30914e2eeebcdda33ed30f8 (diff)
rapidio: modify initialization of switch operations
Modify the way how RapidIO switch operations are declared. Multiple assignments through the linker script replaced by single initialization call. 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: Thomas Moll <thomas.moll@sysgo.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rapidio/rio.h')
-rw-r--r--drivers/rapidio/rio.h56
1 files changed, 15 insertions, 41 deletions
diff --git a/drivers/rapidio/rio.h b/drivers/rapidio/rio.h
index 2f628ce1a1c1..f27b7a9c47d2 100644
--- a/drivers/rapidio/rio.h
+++ b/drivers/rapidio/rio.h
@@ -39,55 +39,29 @@ extern int rio_set_port_lockout(struct rio_dev *rdev, u32 pnum, int lock);
39extern struct device_attribute rio_dev_attrs[]; 39extern struct device_attribute rio_dev_attrs[];
40extern spinlock_t rio_global_list_lock; 40extern spinlock_t rio_global_list_lock;
41 41
42extern struct rio_route_ops __start_rio_route_ops[]; 42extern struct rio_switch_ops __start_rio_switch_ops[];
43extern struct rio_route_ops __end_rio_route_ops[]; 43extern struct rio_switch_ops __end_rio_switch_ops[];
44 44
45/* Helpers internal to the RIO core code */ 45/* Helpers internal to the RIO core code */
46#define DECLARE_RIO_ROUTE_SECTION(section, name, vid, did, add_hook, get_hook, clr_hook) \ 46#define DECLARE_RIO_SWITCH_SECTION(section, name, vid, did, init_hook) \
47 static const struct rio_route_ops __rio_route_##name __used \ 47 static const struct rio_switch_ops __rio_switch_##name __used \
48 __section(section) = { vid, did, add_hook, get_hook, clr_hook }; 48 __section(section) = { vid, did, init_hook };
49 49
50/** 50/**
51 * DECLARE_RIO_ROUTE_OPS - Registers switch routing operations 51 * DECLARE_RIO_SWITCH_INIT - Registers switch initialization routine
52 * @vid: RIO vendor ID 52 * @vid: RIO vendor ID
53 * @did: RIO device ID 53 * @did: RIO device ID
54 * @add_hook: Callback that adds a route entry 54 * @init_hook: Callback that performs switch-specific initialization
55 * @get_hook: Callback that gets a route entry
56 * 55 *
57 * Manipulating switch route tables in RIO is switch specific. This 56 * Manipulating switch route tables and error management in RIO
58 * registers a switch by vendor and device ID with two callbacks for 57 * is switch specific. This registers a switch by vendor and device ID with
59 * modifying and retrieving route entries in a switch. A &struct 58 * initialization callback for setting up switch operations and (if required)
60 * rio_route_ops is initialized with the ops and placed into a 59 * hardware initialization. A &struct rio_switch_ops is initialized with
61 * RIO-specific kernel section. 60 * pointer to the init routine and placed into a RIO-specific kernel section.
62 */ 61 */
63#define DECLARE_RIO_ROUTE_OPS(vid, did, add_hook, get_hook, clr_hook) \ 62#define DECLARE_RIO_SWITCH_INIT(vid, did, init_hook) \
64 DECLARE_RIO_ROUTE_SECTION(.rio_route_ops, vid##did, \ 63 DECLARE_RIO_SWITCH_SECTION(.rio_switch_ops, vid##did, \
65 vid, did, add_hook, get_hook, clr_hook) 64 vid, did, init_hook)
66 65
67#define RIO_GET_DID(size, x) (size ? (x & 0xffff) : ((x & 0x00ff0000) >> 16)) 66#define RIO_GET_DID(size, x) (size ? (x & 0xffff) : ((x & 0x00ff0000) >> 16))
68#define RIO_SET_DID(size, x) (size ? (x & 0xffff) : ((x & 0x000000ff) << 16)) 67#define RIO_SET_DID(size, x) (size ? (x & 0xffff) : ((x & 0x000000ff) << 16))
69
70/*
71 * RapidIO Error Management
72 */
73extern struct rio_em_ops __start_rio_em_ops[];
74extern struct rio_em_ops __end_rio_em_ops[];
75
76/* Helpers internal to the RIO core code */
77#define DECLARE_RIO_EM_SECTION(section, name, vid, did, init_hook, em_hook) \
78 static const struct rio_em_ops __rio_em_##name __used \
79 __section(section) = { vid, did, init_hook, em_hook };
80
81/**
82 * DECLARE_RIO_EM_OPS - Registers switch EM operations
83 * @vid: RIO vendor ID
84 * @did: RIO device ID
85 * @init_hook: Callback that initializes device specific EM
86 * @em_hook: Callback that handles device specific EM
87 *
88 * A &struct rio_em_ops is initialized with the ops and placed into a
89 * RIO-specific kernel section.
90 */
91#define DECLARE_RIO_EM_OPS(vid, did, init_hook, em_hook) \
92 DECLARE_RIO_EM_SECTION(.rio_em_ops, vid##did, \
93 vid, did, init_hook, em_hook)