rapidio: change the kernel configurated RapidIO system size to auto-probing
Subsystems (3)
PATCH 12/24 rapidio: change the kernel configurated RapidIO system size to auto-probing
From: Zhang Wei <[email protected]>
The RapidIO system size will auto probe in RIO setup. The route table and rionet_active in rionet.c are changed to be allocated dynamically according the system size.
Signed-off-by Zhang Wei <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
arch/powerpc/sysdev/fsl_rio.c | 6 +++ drivers/net/rionet.c | 16 ++++++++- drivers/rapidio/Kconfig | 8 ---- drivers/rapidio/rio-scan.c | 55 ++++++++++++++++++++++---------- drivers/rapidio/rio-sysfs.c | 3 + drivers/rapidio/rio.c | 2 - drivers/rapidio/rio.h | 9 +---- include/linux/rio.h | 14 ++++---- 8 files changed, 71 insertions(+), 42 deletions(-)
arch/powerpc/sysdev/fsl_rio.c renamed from arch/powerpc/sysdev/fsl_rio.c~rapidio-change-the-kernel-configurated-rapidio-system-size-to-auto-probing +6 -0
@@ -1007,6 +1007,12 @@ int fsl_rio_setup(struct of_device *dev)rio_register_mport (port); priv->regs_win =ioremap (regs.start, regs.end - regs.start +1 ); + + port->sys_size = (in_be32 ((priv->regs_win +RIO_PEF_CAR )) + &RIO_PEF_CTLS ) >>4 ; +dev_info (&dev->dev,"RapidIO Common Transport System size: %d\n" , + port->sys_size ?65536 :256 ); + priv->atmu_regs = (struct rio_atmu_regs *)(priv->regs_win +RIO_ATMU_REGS_OFFSET ); priv->maint_atmu_regs = priv->atmu_regs +1 ;
drivers/net/rionet.c renamed from drivers/net/rionet.c~rapidio-change-the-kernel-configurated-rapidio-system-size-to-auto-probing +14 -2
@@ -77,7 +77,7 @@ static int rionet_capable = 1;* could be made into a hash table to save memory depending * on system trade-offs. */ -static struct rio_dev *rionet_active[RIO_MAX_ROUTE_ENTRIES ]; +static struct rio_dev **rionet_active;#define is_rionet_capable (pef, src_ops, dst_ops) \ ((pef & RIO_PEF_INB_MBOX) && \
@@ -195,7 +195,8 @@ static int rionet_start_xmit(struct sk_b }if (eth->h_dest[0 ] &0x01 ) { -for (i =0 ; i <RIO_MAX_ROUTE_ENTRIES ; i++) +for (i =0 ; i <RIO_MAX_ROUTE_ENTRIES (rnet->mport->sys_size); + i++)if (rionet_active[i])rionet_queue_tx_msg (skb, ndev, rionet_active[i]);
@@ -385,6 +386,8 @@ static void rionet_remove(struct rio_devstruct net_device *ndev =NULL ;struct rionet_peer *peer, *tmp; +free_pages ((unsigned long )rionet_active, rdev->net->hport->sys_size ? +__ilog2 (sizeof (void *)) +4 :0 );unregister_netdev (ndev);kfree (ndev);
@@ -443,6 +446,15 @@ static int rionet_setup_netdev(struct ri goto out; } + rionet_active = (struct rio_dev **)__get_free_pages (GFP_KERNEL , + mport->sys_size ?__ilog2 (sizeof (void *)) +4 :0 ); +if (!rionet_active) { + rc = -ENOMEM ; + goto out; + } +memset ((void *)rionet_active,0 ,sizeof (void *) * +RIO_MAX_ROUTE_ENTRIES (mport->sys_size)); +/* Set up private area */ rnet = (struct rionet_private *)ndev->priv; rnet->mport = mport;
drivers/rapidio/Kconfig renamed from drivers/rapidio/Kconfig~rapidio-change-the-kernel-configurated-rapidio-system-size-to-auto-probing +0 -8
@@ -1,14 +1,6 @@ # # RapidIO configuration # -config RAPIDIO_8_BIT_TRANSPORT - bool "8-bit transport addressing" - depends on RAPIDIO - ---help--- - By default, the kernel assumes a 16-bit addressed RapidIO - network. By selecting this option, the kernel will support - an 8-bit addressed network. - config RAPIDIO_DISC_TIMEOUT int "Discovery timeout duration (seconds)" depends on RAPIDIO
drivers/rapidio/rio-scan.c renamed from drivers/rapidio/rio-scan.c~rapidio-change-the-kernel-configurated-rapidio-system-size-to-auto-probing +39 -16
144 lines not on this page · raw message
drivers/rapidio/rio-sysfs.c renamed from drivers/rapidio/rio-sysfs.c~rapidio-change-the-kernel-configurated-rapidio-system-size-to-auto-probing +2 -1
@@ -43,7 +43,8 @@ static ssize_t routes_show(struct deviceif (!rdev->rswitch) goto out; -for (i =0 ; i <RIO_MAX_ROUTE_ENTRIES ; i++) { +for (i =0 ; i <RIO_MAX_ROUTE_ENTRIES (rdev->net->hport->sys_size); + i++) {if (rdev->rswitch->route_table[i] ==RIO_INVALID_ROUTE )continue ; str +=
drivers/rapidio/rio.c renamed from drivers/rapidio/rio.c~rapidio-change-the-kernel-configurated-rapidio-system-size-to-auto-probing +1 -1
@@ -43,7 +43,7 @@ u16 rio_local_get_device_id(struct rio_mrio_local_read_config_32 (port,RIO_DID_CSR , &result); -return (RIO_GET_DID (result)); +return (RIO_GET_DID (port->sys_size, result)); }/**
drivers/rapidio/rio.h renamed from drivers/rapidio/rio.h~rapidio-change-the-kernel-configurated-rapidio-system-size-to-auto-probing +2 -7
@@ -51,10 +51,5 @@ extern struct rio_route_ops __end_rio_ro DECLARE_RIO_ROUTE_SECTION(.rio_route_ops, \ vid, did, add_hook, get_hook) -#ifdef CONFIG_RAPIDIO_8_BIT_TRANSPORT -#define RIO_GET_DID (x) ((x & 0x00ff0000) >> 16) -#define RIO_SET_DID (x) ((x & 0x000000ff) << 16) -#else -#define RIO_GET_DID (x) (x & 0xffff) -#define RIO_SET_DID (x) (x & 0xffff) -#endif +#define RIO_GET_DID (size, x) (size ? (x & 0xffff) : ((x & 0x00ff0000) >> 16)) +#define RIO_SET_DID (size, x) (size ? (x & 0xffff) : ((x & 0x000000ff) << 16))
include/linux/rio.h renamed from include/linux/rio.h~rapidio-change-the-kernel-configurated-rapidio-system-size-to-auto-probing +7 -7
@@ -23,7 +23,6 @@#include <linux/device.h> #include <linux/rio_regs.h> -#define RIO_ANY_DESTID 0xff#define RIO_NO_HOPCOUNT -1#define RIO_INVALID_DESTID 0xffff
@@ -39,11 +38,8 @@entry is invalid (no route exists for the device ID) */ -#ifdef CONFIG_RAPIDIO_8_BIT_TRANSPORT -#define RIO_MAX_ROUTE_ENTRIES (1 << 8) -#else -#define RIO_MAX_ROUTE_ENTRIES (1 << 16) -#endif +#define RIO_MAX_ROUTE_ENTRIES (size) (size ? (1 << 16) : (1 << 8)) +#define RIO_ANY_DESTID (size) (size ? 0xffff : 0xff)#define RIO_MAX_MBOX 4#define RIO_MAX_MSG_SIZE 0x1000
@@ -178,6 +174,10 @@ struct rio_mport {unsigned char id;/* port ID, unique among all ports */ unsigned char index;/* port index, unique among all port interfaces of the same type */ +unsigned int sys_size;/* RapidIO common transport system size. +* 0 - Small size. 256 devices. +* 1 - Large size, 65536 devices. +*/ unsigned char name[40 ];void *priv;/* Master port private data */ };
@@ -213,7 +213,7 @@ struct rio_switch {u16 switchid;u16 hopcount;u16 destid; -u8 route_table[RIO_MAX_ROUTE_ENTRIES ]; +u8 *route_table;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,
_