RapidIO: Add Port-Write handling for EM
Subsystems (3)
PATCH v3 3/6 RapidIO: Add Port-Write handling for EM
From: Alexandre Bounine <[email protected]>
Add RapidIO Port-Write message handling in the context of Error Management Extensions Specification Rev.1.3.
---
arch/powerpc/sysdev/fsl_rio.c | 2 drivers/rapidio/rio-scan.c | 166 +++++++++++++++---- drivers/rapidio/rio.c | 328 ++++++++++++++++++++++++++++++++++++++ drivers/rapidio/rio.h | 30 +++ drivers/rapidio/switches/tsi568.c | 24 ++ drivers/rapidio/switches/tsi57x.c | 153 +++++++++++++++++ include/asm-generic/vmlinux.lds.h | 5 include/linux/rio.h | 42 ++++ include/linux/rio_drv.h | 6 include/linux/rio_regs.h | 61 ++++++- 10 files changed, 776 insertions(+), 41 deletions(-)
arch/powerpc/sysdev/fsl_rio.c +1 -1
@@ -1056,7 +1056,7 @@ int fsl_rio_setup(struct of_device *dev)dev_info (&dev->dev,"LAW start 0x%016llx, size 0x%016llx.\n" , law_start, law_size); - ops =kmalloc (sizeof (struct rio_ops ),GFP_KERNEL ); + ops =kzalloc (sizeof (struct rio_ops ),GFP_KERNEL );if (!ops) { rc = -ENOMEM ; goto err_ops;
drivers/rapidio/rio-scan.c +130 -36
302 lines not on this page · raw message
drivers/rapidio/rio.c +328 -0
346 lines not on this page · raw message
drivers/rapidio/rio.h +30 -0
@@ -18,6 +18,10 @@extern u32 rio_mport_get_feature (struct rio_mport *mport,int local,u16 destid,u8 hopcount,int ftr); +extern u32 rio_mport_get_physefb (struct rio_mport *port,int local, +u16 destid,u8 hopcount); +extern u32 rio_mport_get_efb (struct rio_mport *port,int local,u16 destid, +u8 hopcount,u32 from);extern int rio_create_sysfs_dev_files (struct rio_dev *rdev);extern int rio_enum_mport (struct rio_mport *mport);extern int rio_disc_mport (struct rio_mport *mport);
@@ -29,6 +33,7 @@ extern int rio_std_route_get_entry(struc u8 *route_port);extern int rio_std_route_clr_table (struct rio_mport *mport,u16 destid,u8 hopcount,u16 table); +extern int rio_set_port_lockout (struct rio_dev *rdev,u32 pnum,int lock);/* Structures internal to the RIO core code */ extern struct device_attribute rio_dev_attrs[];
@@ -61,3 +66,28 @@ extern struct rio_route_ops __end_rio_ro#define RIO_GET_DID (size, x) (size ? (x & 0xffff) : ((x & 0x00ff0000) >> 16))#define RIO_SET_DID (size, x) (size ? (x & 0xffff) : ((x & 0x000000ff) << 16)) + +/* +* RapidIO Error Management +*/ +extern struct rio_em_ops __start_rio_em_ops[]; +extern struct rio_em_ops __end_rio_em_ops[]; + +/* Helpers internal to the RIO core code */ +#define DECLARE_RIO_EM_SECTION (section, name, vid, did, init_hook, em_hook) \ + static const struct rio_em_ops __rio_em_##name __used \ + __section(section) = { vid, did, init_hook, em_hook }; + +/** +* DECLARE_RIO_EM_OPS - Registers switch EM operations +* @vid: RIO vendor ID +* @did: RIO device ID +* @init_hook: Callback that initializes device specific EM +* @em_hook: Callback that handles device specific EM +* +* A &struct rio_em_ops is initialized with the ops and placed into a +* RIO-specific kernel section. +*/ +#define DECLARE_RIO_EM_OPS (vid, did, init_hook, em_hook) \ + DECLARE_RIO_EM_SECTION(.rio_em_ops, vid##did, \ + vid, did, init_hook, em_hook)
drivers/rapidio/switches/tsi568.c +24 -0
@@ -25,6 +25,9 @@#define SPP_ROUTE_CFG_DESTID (n) (0x11070 + 0x100*n)#define SPP_ROUTE_CFG_PORT (n) (0x11074 + 0x100*n) +#define TSI568_SP_MODE_BC 0x10004 +#define TSI568_SP_MODE_PW_DIS 0x08000000 +static int tsi568_route_add_entry (struct rio_mport *mport,u16 destid,u8 hopcount,u16 table,u16 route_destid,u8 route_port)
@@ -104,3 +107,24 @@ tsi568_route_clr_table(struct rio_mport }DECLARE_RIO_ROUTE_OPS (RIO_VID_TUNDRA ,RIO_DID_TSI568 , tsi568_route_add_entry, tsi568_route_get_entry, tsi568_route_clr_table); + +static int +tsi568_em_init (struct rio_dev *rdev) +{ +struct rio_mport *mport = rdev->net->hport; +u16 destid = rdev->rswitch->destid; +u8 hopcount = rdev->rswitch->hopcount; +u32 regval; + +pr_debug ("TSI568 %s [%d:%d]\n" , __func__, destid, hopcount); + +/* Make sure that Port-Writes are disabled (for all ports) */ +rio_mport_read_config_32 (mport, destid, hopcount, +TSI568_SP_MODE_BC , ®val); +rio_mport_write_config_32 (mport, destid, hopcount, +TSI568_SP_MODE_BC , regval |TSI568_SP_MODE_PW_DIS ); + +return 0 ; +} + +DECLARE_RIO_EM_OPS (RIO_VID_TUNDRA ,RIO_DID_TSI568 , tsi568_em_init,NULL );
drivers/rapidio/switches/tsi57x.c +153 -0
162 lines not on this page · raw message
include/asm-generic/vmlinux.lds.h +4 -1
@@ -247,10 +247,13 @@ } \ \/* RapidIO route ops */ \ - .rio_route : AT(ADDR(.rio_route) - LOAD_OFFSET) { \ + .rio_ops : AT(ADDR(.rio_ops) - LOAD_OFFSET) { \ VMLINUX_SYMBOL(__start_rio_route_ops) = .; \ *(.rio_route_ops) \ VMLINUX_SYMBOL(__end_rio_route_ops) = .; \ + VMLINUX_SYMBOL(__start_rio_em_ops) = .; \ + *(.rio_em_ops) \ + VMLINUX_SYMBOL(__end_rio_em_ops) = .; \ } \ \TRACEDATA \
include/linux/rio.h +42 -0
102 lines not on this page · raw message
include/linux/rio_drv.h +6 -0
@@ -413,6 +413,12 @@ void rio_release_regions(struct rio_devint rio_request_region (struct rio_dev *,int ,char *);void rio_release_region (struct rio_dev *,int ); +/* Port-Write management */ +extern int rio_request_inb_pwrite (struct rio_dev *, +int (*)(struct rio_dev *,union rio_pw_msg *,int )); +extern int rio_release_inb_pwrite (struct rio_dev *); +extern int rio_inb_pwrite_handler (union rio_pw_msg *pw_msg); +/* LDM support */ int rio_register_driver (struct rio_driver *);void rio_unregister_driver (struct rio_driver *);
include/linux/rio_regs.h +58 -3
83 lines not on this page · raw message
Quoted 8 lines · On Tue, 6 Apr 2010 17:22:38 -0400 Alexandre Bounine <[email protected]> wrote:
From: Alexandre Bounine <[email protected]>
Add RapidIO Port-Write message handling in the context of Error Management Extensions Specification Rev.1.3.
...
drivers/rapidio/rio.c int rio_release_outb_dbell(struct rio_de · line 448
Quoted 6 lines
drivers/rapidio/rio.c +6
-0+static struct rio_dev *rio_get_comptag (u32 comp_tag,struct rio_dev *from) +{ +struct list_head *n; +struct rio_dev *rdev; + +WARN_ON (in_interrupt ());
The check should be unneeded - lockdep will warn about this.
Quoted 15 lines
drivers/rapidio/rio.c +15
-0+spin_lock (&rio_global_list_lock); + n = from ? from->global_list.next : rio_devices.next; + +while (n && (n != &rio_devices)) { + rdev =rio_dev_g (n); +if (rdev->comp_tag == comp_tag) + goto exit; + n = n->next; + } + rdev =NULL ; +exit: +spin_unlock (&rio_global_list_lock); +return rdev; +} +
Quoted 1 line · Andrew Morton
On Tue, 6 Apr 2010 17:22:38 -0400 Alexandre Bounine
Quoted 10 lines · <[email protected]> wrote:
=20
Quoted 9 lines
From: Alexandre Bounine <[email protected]>
Add RapidIO Port-Write message handling in the context of Error Management Extensions Specification Rev.1.3.
...
+static struct
rio_dev*rio_get_comptag(u32comp_tag, structrio_dev
*from)
Quoted 7 lines
drivers/rapidio/rio.c int rio_release_outb_dbell(struct rio_de · line 448
Quoted 5 lines
drivers/rapidio/rio.c +5
-0+{ +struct list_head *n; +struct rio_dev *rdev; + +WARN_ON (in_interrupt ());=20
The check should be unneeded - lockdep will warn about this.
Thank you. I will remove it in my next set of patches.=20
Quoted 16 lines
=20
Quoted 15 lines
drivers/rapidio/rio.c +15
-0+spin_lock (&rio_global_list_lock); + n =3D from ? from->global_list.next : rio_devices.next; + +while (n && (n !=3D &rio_devices)) { + rdev =3D rio_dev_g(n); + if (rdev->comp_tag =3D=3D comp_tag) + goto exit; + n =3D n->next; + } + rdev =3D NULL; +exit: +spin_unlock (&rio_global_list_lock); +return rdev; +} +