RapidIO: Add Port-Write handling for EM
Subsystems (3)
PATCH v2 3/7 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
---
Important Notice: This message is intended for the use of the individual to whom it is addressed and may contain information which is privileged, confidential and/or exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or is not the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by telephone or return e-mail and delete the original message from your systems. Thank you.