diff for duplicates of <11180976151713@foobar.com> diff --git a/a/1.txt b/N1/1.txt index b590ce9..dfd4487 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -45,15 +45,15 @@ new file mode 100644 + +static void rio_enum_timeout(unsigned long); + -+spinlock_t rio_global_list_lock =3D SPIN_LOCK_UNLOCKED; -+static int next_destid =3D 0; -+static int next_switchid =3D 0; -+static int next_net =3D 0; ++spinlock_t rio_global_list_lock = SPIN_LOCK_UNLOCKED; ++static int next_destid = 0; ++static int next_switchid = 0; ++static int next_net = 0; + -+static struct timer_list rio_enum_timer =3D ++static struct timer_list rio_enum_timer = +TIMER_INITIALIZER(rio_enum_timeout, 0, 0); + -+static int rio_mport_phys_table[] =3D { ++static int rio_mport_phys_table[] = { + RIO_EFB_PAR_EP_ID, + RIO_EFB_PAR_EP_REC_ID, + RIO_EFB_SER_EP_ID, @@ -61,7 +61,7 @@ new file mode 100644 + -1, +}; + -+static int rio_sport_phys_table[] =3D { ++static int rio_sport_phys_table[] = { + RIO_EFB_PAR_EP_FREE_ID, + RIO_EFB_SER_EP_FREE_ID, + -1, @@ -72,15 +72,14 @@ new file mode 100644 + +/** + * rio_get_device_id - Get the base/extended device id for a device -+ * @port: RIO master port=20 ++ * @port: RIO master port + * @destid: Destination ID of device + * @hopcount: Hopcount to device + * + * Reads the base/extended device id from a device. Returns the + * 8/16-bit device ID. + */ -+static u16 rio_get_device_id(struct rio_mport *port, u16 destid, u8 hopcou= -nt) ++static u16 rio_get_device_id(struct rio_mport *port, u16 destid, u8 hopcount) +{ + u32 result; + @@ -91,7 +90,7 @@ nt) + +/** + * rio_set_device_id - Set the base/extended device id for a device -+ * @port: RIO master port=20 ++ * @port: RIO master port + * @destid: Destination ID of device + * @hopcount: Hopcount to device + * @did: Device ID value to be written @@ -107,7 +106,7 @@ nt) + +/** + * rio_local_set_device_id - Set the base/extended device id for a port -+ * @port: RIO master port=20 ++ * @port: RIO master port + * @did: Device ID value to be written + * + * Writes the base/extended device id from a device. @@ -129,7 +128,7 @@ nt) +{ + struct rio_dev *rdev; + u32 result; -+ int ret =3D 0; ++ int ret = 0; + + /* Write component tag CSR magic complete value */ + rio_local_write_config_32(port, RIO_COMPONENT_TAG_CSR, @@ -142,22 +141,21 @@ nt) + rio_local_write_config_32(port, RIO_HOST_DID_LOCK_CSR, + port->host_deviceid); + rio_local_read_config_32(port, RIO_HOST_DID_LOCK_CSR, &result); -+ if ((result & 0xffff) !=3D 0xffff) { ++ if ((result & 0xffff) != 0xffff) { + printk(KERN_INFO -+ "RIO: badness when releasing host lock on master port, result %8.= -8x\n", ++ "RIO: badness when releasing host lock on master port, result %8.8x\n", + result); -+ ret =3D -EINVAL; ++ ret = -EINVAL; + } + list_for_each_entry(rdev, &rio_devices, global_list) { + rio_write_config_32(rdev, RIO_HOST_DID_LOCK_CSR, + port->host_deviceid); + rio_read_config_32(rdev, RIO_HOST_DID_LOCK_CSR, &result); -+ if ((result & 0xffff) !=3D 0xffff) { ++ if ((result & 0xffff) != 0xffff) { + printk(KERN_INFO + "RIO: badness when releasing host lock on vid %4.4x did %4.4x\n", + rdev->vid, rdev->did); -+ ret =3D -EINVAL; ++ ret = -EINVAL; + } + } + @@ -181,21 +179,20 @@ nt) + port->host_deviceid); + + rio_local_read_config_32(port, RIO_HOST_DID_LOCK_CSR, &result); -+ if ((result & 0xffff) !=3D port->host_deviceid) ++ if ((result & 0xffff) != port->host_deviceid) + return -1; + + /* Set master port destid and init destid ctr */ + rio_local_set_device_id(port, port->host_deviceid); + -+ if (next_destid =3D=3D port->host_deviceid) ++ if (next_destid == port->host_deviceid) + next_destid++; + + return 0; +} + +/** -+ * rio_device_has_destid- Test if a device contains a destination ID regis= -ter ++ * rio_device_has_destid- Test if a device contains a destination ID register + * @port: Master port to issue transaction + * @src_ops: RIO device source operations + * @dst_ops: RIO device destination operations @@ -237,7 +234,7 @@ ter +{ + struct rio_dev *rdev; + -+ rdev =3D to_rio_dev(dev); ++ rdev = to_rio_dev(dev); + kfree(rdev); +} + @@ -258,8 +255,7 @@ ter +} + +/** -+ * rio_route_set_ops- Sets routing operations for a particular vendor swit= -ch ++ * rio_route_set_ops- Sets routing operations for a particular vendor switch + * @rdev: RIO device + * + * Searches the RIO route ops table for known switch types. If the vid @@ -268,14 +264,14 @@ ch + */ +static void rio_route_set_ops(struct rio_dev *rdev) +{ -+ struct rio_route_ops *cur =3D __start_rio_route_ops; -+ struct rio_route_ops *end =3D __end_rio_route_ops; ++ struct rio_route_ops *cur = __start_rio_route_ops; ++ struct rio_route_ops *end = __end_rio_route_ops; + + while (cur < end) { -+ if ((cur->vid =3D=3D rdev->vid) && (cur->did =3D=3D rdev->did)) { ++ if ((cur->vid == rdev->vid) && (cur->did == rdev->did)) { + pr_debug("RIO: adding routing ops for %s\n", rio_name(rdev)); -+ rdev->rswitch->add_entry =3D cur->add_hook; -+ rdev->rswitch->get_entry =3D cur->get_hook; ++ rdev->rswitch->add_entry = cur->add_hook; ++ rdev->rswitch->get_entry = cur->get_hook; + } + cur++; + } @@ -328,29 +324,29 @@ ch + struct rio_switch *rswitch; + int result, rdid; + -+ rdev =3D kmalloc(sizeof(struct rio_dev), GFP_KERNEL); ++ rdev = kmalloc(sizeof(struct rio_dev), GFP_KERNEL); + if (!rdev) + goto out; + + memset(rdev, 0, sizeof(struct rio_dev)); -+ rdev->net =3D net; ++ rdev->net = net; + rio_mport_read_config_32(port, destid, hopcount, RIO_DEV_ID_CAR, + &result); -+ rdev->did =3D result >> 16; -+ rdev->vid =3D result & 0xffff; ++ rdev->did = result >> 16; ++ rdev->vid = result & 0xffff; + rio_mport_read_config_32(port, destid, hopcount, RIO_DEV_INFO_CAR, + &rdev->device_rev); + rio_mport_read_config_32(port, destid, hopcount, RIO_ASM_ID_CAR, + &result); -+ rdev->asm_did =3D result >> 16; -+ rdev->asm_vid =3D result & 0xffff; ++ rdev->asm_did = result >> 16; ++ rdev->asm_vid = result & 0xffff; + rio_mport_read_config_32(port, destid, hopcount, RIO_ASM_INFO_CAR, + &result); -+ rdev->asm_rev =3D result >> 16; ++ rdev->asm_rev = result >> 16; + rio_mport_read_config_32(port, destid, hopcount, RIO_PEF_CAR, + &rdev->pef); + if (rdev->pef & RIO_PEF_EXT_FEATURES) -+ rdev->efptr =3D result & 0xffff; ++ rdev->efptr = result & 0xffff; + + rio_mport_read_config_32(port, destid, hopcount, RIO_SRC_OPS_CAR, + &rdev->src_ops); @@ -360,29 +356,29 @@ ch + if (rio_device_has_destid(port, rdev->src_ops, rdev->dst_ops) + && do_enum) { + rio_set_device_id(port, destid, hopcount, next_destid); -+ rdev->destid =3D next_destid++; -+ if (next_destid =3D=3D port->host_deviceid) ++ rdev->destid = next_destid++; ++ if (next_destid == port->host_deviceid) + next_destid++; + } else -+ rdev->destid =3D rio_get_device_id(port, destid, hopcount); ++ rdev->destid = rio_get_device_id(port, destid, hopcount); + + /* If a PE has both switch and other functions, show it as a switch */ + if (rio_is_switch(rdev)) { + rio_mport_read_config_32(port, destid, hopcount, + RIO_SWP_INFO_CAR, &rdev->swpinfo); -+ rswitch =3D kmalloc(sizeof(struct rio_switch), GFP_KERNEL); ++ rswitch = kmalloc(sizeof(struct rio_switch), GFP_KERNEL); + if (!rswitch) { + kfree(rdev); -+ rdev =3D NULL; ++ rdev = NULL; + goto out; + } -+ rswitch->switchid =3D next_switchid; -+ rswitch->hopcount =3D hopcount; -+ rswitch->destid =3D 0xffff; ++ rswitch->switchid = next_switchid; ++ rswitch->hopcount = hopcount; ++ rswitch->destid = 0xffff; + /* Initialize switch route table */ -+ for (rdid =3D 0; rdid < RIO_MAX_ROUTE_ENTRIES; rdid++) -+ rswitch->route_table[rdid] =3D RIO_INVALID_ROUTE; -+ rdev->rswitch =3D rswitch; ++ for (rdid = 0; rdid < RIO_MAX_ROUTE_ENTRIES; rdid++) ++ rswitch->route_table[rdid] = RIO_INVALID_ROUTE; ++ rdev->rswitch = rswitch; + sprintf(rio_name(rdev), "%02x:s:%04x", rdev->net->id, + rdev->rswitch->switchid); + rio_route_set_ops(rdev); @@ -393,14 +389,14 @@ ch + sprintf(rio_name(rdev), "%02x:e:%04x", rdev->net->id, + rdev->destid); + -+ rdev->dev.bus =3D &rio_bus_type; ++ rdev->dev.bus = &rio_bus_type; + + device_initialize(&rdev->dev); -+ rdev->dev.release =3D rio_release_dev; ++ rdev->dev.release = rio_release_dev; + rio_dev_get(rdev); + -+ rdev->dev.dma_mask =3D (u64 *) 0xffffffff; -+ rdev->dev.coherent_dma_mask =3D 0xffffffffULL; ++ rdev->dev.dma_mask = (u64 *) 0xffffffff; ++ rdev->dev.coherent_dma_mask = 0xffffffffULL; + + if ((rdev->pef & RIO_PEF_INB_DOORBELL) && + (rdev->dst_ops & RIO_DST_OPS_DOORBELL)) @@ -426,20 +422,19 @@ ch + * inactive. + */ +static int -+rio_sport_is_active(struct rio_mport *port, u16 destid, u8 hopcount, int s= -port) ++rio_sport_is_active(struct rio_mport *port, u16 destid, u8 hopcount, int sport) +{ + u32 result; + u32 ext_ftr_ptr; + -+ int *entry =3D rio_sport_phys_table; ++ int *entry = rio_sport_phys_table; + + do { -+ if ((ext_ftr_ptr =3D ++ if ((ext_ftr_ptr = + rio_mport_get_feature(port, 0, destid, hopcount, *entry))) + + break; -+ } while (*++entry >=3D 0); ++ } while (*++entry >= 0); + + if (ext_ftr_ptr) + rio_mport_read_config_32(port, destid, hopcount, @@ -465,8 +460,7 @@ port) + * %RIO_GLOBAL_TABLE in @table. Returns %0 on success or %-EINVAL + * on failure. + */ -+static int rio_route_add_entry(struct rio_mport *mport, struct rio_dev *rd= -ev, ++static int rio_route_add_entry(struct rio_mport *mport, struct rio_dev *rdev, + u16 table, u16 route_destid, u8 route_port) +{ + return rdev->rswitch->add_entry(mport, rdev->rswitch->destid, @@ -490,8 +484,7 @@ ev, + * on failure. + */ +static int -+rio_route_get_entry(struct rio_mport *mport, struct rio_dev *rdev, u16 tab= -le, ++rio_route_get_entry(struct rio_mport *mport, struct rio_dev *rdev, u16 table, + u16 route_destid, u8 * route_port) +{ + return rdev->rswitch->get_entry(mport, rdev->rswitch->destid, @@ -500,8 +493,7 @@ le, +} + +/** -+ * rio_get_host_deviceid_lock- Reads the Host Device ID Lock CSR on a devi= -ce ++ * rio_get_host_deviceid_lock- Reads the Host Device ID Lock CSR on a device + * @port: Master port to send transaction + * @hopcount: Number of hops to the device + * @@ -519,7 +511,7 @@ ce +} + +/** -+ * rio_get_swpinfo_inport- Gets the ingress port number=20 ++ * rio_get_swpinfo_inport- Gets the ingress port number + * @mport: Master port to send transaction + * @destid: Destination ID associated with the switch + * @hopcount: Number of hops to the device @@ -590,8 +582,7 @@ ce + u16 destid; + int tmp; + -+ if (rio_get_host_deviceid_lock(port, hopcount) =3D=3D port->host_deviceid= -) { ++ if (rio_get_host_deviceid_lock(port, hopcount) == port->host_deviceid) { + pr_debug("RIO: PE already discovered by this host\n"); + /* + * Already discovered by this host. Add it as another @@ -604,7 +595,7 @@ ce + /* Attempt to acquire device lock */ + rio_mport_write_config_32(port, RIO_ANY_DESTID, hopcount, + RIO_HOST_DID_LOCK_CSR, port->host_deviceid); -+ while ((tmp =3D rio_get_host_deviceid_lock(port, hopcount)) ++ while ((tmp = rio_get_host_deviceid_lock(port, hopcount)) + < port->host_deviceid) { + /* Delay a bit */ + mdelay(1); @@ -621,7 +612,7 @@ ce + } + + /* Setup new RIO device */ -+ if ((rdev =3D rio_setup_device(net, port, RIO_ANY_DESTID, hopcount, 1))) { ++ if ((rdev = rio_setup_device(net, port, RIO_ANY_DESTID, hopcount, 1))) { + /* Add device to the global and bus/net specific list. */ + list_add_tail(&rdev->net_list, &net->devices); + } else @@ -630,27 +621,27 @@ ce + if (rio_is_switch(rdev)) { + next_switchid++; + -+ for (destid =3D 0; destid < next_destid; destid++) { ++ for (destid = 0; destid < next_destid; destid++) { + rio_route_add_entry(port, rdev, RIO_GLOBAL_TABLE, + destid, rio_get_swpinfo_inport(port, + RIO_ANY_DESTID, + hopcount)); -+ rdev->rswitch->route_table[destid] =3D ++ rdev->rswitch->route_table[destid] = + rio_get_swpinfo_inport(port, RIO_ANY_DESTID, + hopcount); + } + -+ num_ports =3D ++ num_ports = + rio_get_swpinfo_tports(port, RIO_ANY_DESTID, hopcount); + pr_debug( + "RIO: found %s (vid %4.4x did %4.4x) with %d ports\n", + rio_name(rdev), rdev->vid, rdev->did, num_ports); -+ for (port_num =3D 0; port_num < num_ports; port_num++) { ++ for (port_num = 0; port_num < num_ports; port_num++) { + if (rio_get_swpinfo_inport -+ (port, RIO_ANY_DESTID, hopcount) =3D=3D port_num) ++ (port, RIO_ANY_DESTID, hopcount) == port_num) + continue; + -+ cur_destid =3D next_destid; ++ cur_destid = next_destid; + + if (rio_sport_is_active + (port, RIO_ANY_DESTID, hopcount, port_num)) { @@ -666,17 +657,17 @@ ce + + /* Update routing tables */ + if (next_destid > cur_destid) { -+ for (destid =3D cur_destid; ++ for (destid = cur_destid; + destid < next_destid; destid++) { + rio_route_add_entry(port, rdev, + RIO_GLOBAL_TABLE, + destid, + port_num); + rdev->rswitch-> -+ route_table[destid] =3D ++ route_table[destid] = + port_num; + } -+ rdev->rswitch->destid =3D cur_destid; ++ rdev->rswitch->destid = cur_destid; + } + } + } @@ -698,12 +689,12 @@ ce +static int rio_enum_complete(struct rio_mport *port) +{ + u32 tag_csr; -+ int ret =3D 0; ++ int ret = 0; + + rio_local_read_config_32(port, RIO_COMPONENT_TAG_CSR, &tag_csr); + -+ if (tag_csr =3D=3D RIO_ENUM_CMPL_MAGIC) -+ ret =3D 1; ++ if (tag_csr == RIO_ENUM_CMPL_MAGIC) ++ ret = 1; + + return ret; +} @@ -728,7 +719,7 @@ ce + u16 ndestid; + + /* Setup new RIO device */ -+ if ((rdev =3D rio_setup_device(net, port, destid, hopcount, 0))) { ++ if ((rdev = rio_setup_device(net, port, destid, hopcount, 0))) { + /* Add device to the global and bus/net specific list. */ + list_add_tail(&rdev->net_list, &net->devices); + } else @@ -738,14 +729,14 @@ ce + next_switchid++; + + /* Associated destid is how we accessed this switch */ -+ rdev->rswitch->destid =3D destid; ++ rdev->rswitch->destid = destid; + -+ num_ports =3D rio_get_swpinfo_tports(port, destid, hopcount); ++ num_ports = rio_get_swpinfo_tports(port, destid, hopcount); + pr_debug( + "RIO: found %s (vid %4.4x did %4.4x) with %d ports\n", + rio_name(rdev), rdev->vid, rdev->did, num_ports); -+ for (port_num =3D 0; port_num < num_ports; port_num++) { -+ if (rio_get_swpinfo_inport(port, destid, hopcount) =3D=3D ++ for (port_num = 0; port_num < num_ports; port_num++) { ++ if (rio_get_swpinfo_inport(port, destid, hopcount) == + port_num) + continue; + @@ -754,13 +745,13 @@ ce + pr_debug( + "RIO: scanning device on port %d\n", + port_num); -+ for (ndestid =3D 0; ndestid < RIO_ANY_DESTID; ++ for (ndestid = 0; ndestid < RIO_ANY_DESTID; + ndestid++) { + rio_route_get_entry(port, rdev, + RIO_GLOBAL_TABLE, + ndestid, + &route_port); -+ if (route_port =3D=3D port_num) ++ if (route_port == port_num) + break; + } + @@ -787,15 +778,15 @@ ce + */ +static int rio_mport_is_active(struct rio_mport *port) +{ -+ u32 result =3D 0; ++ u32 result = 0; + u32 ext_ftr_ptr; -+ int *entry =3D rio_mport_phys_table; ++ int *entry = rio_mport_phys_table; + + do { -+ if ((ext_ftr_ptr =3D ++ if ((ext_ftr_ptr = + rio_mport_get_feature(port, 1, 0, 0, *entry))) + break; -+ } while (*++entry >=3D 0); ++ } while (*++entry >= 0); + + if (ext_ftr_ptr) + rio_local_read_config_32(port, @@ -819,15 +810,15 @@ ce +{ + struct rio_net *net; + -+ net =3D kmalloc(sizeof(struct rio_net), GFP_KERNEL); ++ net = kmalloc(sizeof(struct rio_net), GFP_KERNEL); + if (net) { + memset(net, 0, sizeof(struct rio_net)); + INIT_LIST_HEAD(&net->node); + INIT_LIST_HEAD(&net->devices); + INIT_LIST_HEAD(&net->mports); + list_add_tail(&port->nnode, &net->mports); -+ net->hport =3D port; -+ net->id =3D next_net++; ++ net->hport = port; ++ net->id = next_net++; + } + return net; +} @@ -843,43 +834,41 @@ ce + */ +int rio_enum_mport(struct rio_mport *mport) +{ -+ struct rio_net *net =3D NULL; -+ int rc =3D 0; ++ struct rio_net *net = NULL; ++ int rc = 0; + + printk(KERN_INFO "RIO: enumerate master port %d, %s\n", mport->id, + mport->name); + /* If somebody else enumerated our master port device, bail. */ + if (rio_enum_host(mport) < 0) { + printk(KERN_INFO -+ "RIO: master port %d device has been enumerated by a remote host\= -n", ++ "RIO: master port %d device has been enumerated by a remote host\n", + mport->id); -+ rc =3D -EBUSY; ++ rc = -EBUSY; + goto out; + } + + /* If master port has an active link, allocate net and enum peers */ + if (rio_mport_is_active(mport)) { -+ if (!(net =3D rio_alloc_net(mport))) { ++ if (!(net = rio_alloc_net(mport))) { + printk(KERN_ERR "RIO: failed to allocate new net\n"); -+ rc =3D -ENOMEM; ++ rc = -ENOMEM; + goto out; + } + if (rio_enum_peer(net, mport, 0) < 0) { + /* A higher priority host won enumeration, bail. */ + printk(KERN_INFO -+ "RIO: master port %d device has lost enumeration to a remote hos= -t\n", ++ "RIO: master port %d device has lost enumeration to a remote host\n", + mport->id); + rio_clear_locks(mport); -+ rc =3D -EBUSY; ++ rc = -EBUSY; + goto out; + } + rio_clear_locks(mport); + } else { + printk(KERN_INFO "RIO: master port %d link inactive\n", + mport->id); -+ rc =3D -EINVAL; ++ rc = -EINVAL; + } + + out: @@ -900,12 +889,12 @@ t\n", + + list_for_each_entry(rdev, &rio_devices, global_list) + if (rio_is_switch(rdev)) -+ for (i =3D 0; i < RIO_MAX_ROUTE_ENTRIES; i++) { ++ for (i = 0; i < RIO_MAX_ROUTE_ENTRIES; i++) { + if (rio_route_get_entry + (rdev->net->hport, rdev, RIO_GLOBAL_TABLE, i, + &sport) < 0) + continue; -+ rdev->rswitch->route_table[i] =3D sport; ++ rdev->rswitch->route_table[i] = sport; + } +} + @@ -920,7 +909,7 @@ t\n", +static void rio_enum_timeout(unsigned long data) +{ + /* Enumeration timed out, set flag */ -+ *(int *)data =3D 1; ++ *(int *)data = 1; +} + +/** @@ -935,24 +924,24 @@ t\n", + */ +int rio_disc_mport(struct rio_mport *mport) +{ -+ struct rio_net *net =3D NULL; -+ int enum_timeout_flag =3D 0; ++ struct rio_net *net = NULL; ++ int enum_timeout_flag = 0; + + printk(KERN_INFO "RIO: discover master port %d, %s\n", mport->id, + mport->name); + + /* If master port has an active link, allocate net and discover peers */ + if (rio_mport_is_active(mport)) { -+ if (!(net =3D rio_alloc_net(mport))) { ++ if (!(net = rio_alloc_net(mport))) { + printk(KERN_ERR "RIO: Failed to allocate new net\n"); + goto bail; + } + + pr_debug("RIO: wait for enumeration complete..."); + -+ rio_enum_timer.expires =3D ++ rio_enum_timer.expires = + jiffies + CONFIG_RAPIDIO_DISC_TIMEOUT * HZ; -+ rio_enum_timer.data =3D (unsigned long)&enum_timeout_flag; ++ rio_enum_timer.data = (unsigned long)&enum_timeout_flag; + add_timer(&rio_enum_timer); + while (!rio_enum_complete(mport)) { + mdelay(1); @@ -990,7 +979,7 @@ new file mode 100644 +# Makefile for RIO switches +# + -+obj-$(CONFIG_RAPIDIO) +=3D tsi500.o ++obj-$(CONFIG_RAPIDIO) += tsi500.o diff --git a/drivers/rio/switches/tsi500.c b/drivers/rio/switches/tsi500.c new file mode 100644 --- /dev/null @@ -1014,52 +1003,45 @@ new file mode 100644 +#include "../rio.h" + +static int -+tsi500_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount, u= -16 table, u16 route_destid, u8 route_port) ++tsi500_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount, u16 table, u16 route_destid, u8 route_port) +{ + int i; -+ u32 offset =3D 0x10000 + 0xa00 + ((route_destid / 2)&~0x3); ++ u32 offset = 0x10000 + 0xa00 + ((route_destid / 2)&~0x3); + u32 result; + -+ if (table =3D=3D 0xff) { ++ if (table == 0xff) { + rio_mport_read_config_32(mport, destid, hopcount, offset, &result); -+ result &=3D ~(0xf << (4*(route_destid & 0x7))); -+ for (i=3D0;i<4;i++) -+ rio_mport_write_config_32(mport, destid, hopcount, offset + (0x20000*i)= -, result | (route_port << (4*(route_destid & 0x7)))); ++ result &= ~(0xf << (4*(route_destid & 0x7))); ++ for (i=0;i<4;i++) ++ rio_mport_write_config_32(mport, destid, hopcount, offset + (0x20000*i), result | (route_port << (4*(route_destid & 0x7)))); + } + else { -+ rio_mport_read_config_32(mport, destid, hopcount, offset + (0x20000*tabl= -e), &result); -+ result &=3D ~(0xf << (4*(route_destid & 0x7))); -+ rio_mport_write_config_32(mport, destid, hopcount, offset + (0x20000*tab= -le), result | (route_port << (4*(route_destid & 0x7)))); ++ rio_mport_read_config_32(mport, destid, hopcount, offset + (0x20000*table), &result); ++ result &= ~(0xf << (4*(route_destid & 0x7))); ++ rio_mport_write_config_32(mport, destid, hopcount, offset + (0x20000*table), result | (route_port << (4*(route_destid & 0x7)))); + } + + return 0; +} + +static int -+tsi500_route_get_entry(struct rio_mport *mport, u16 destid, u8 hopcount, u= -16 table, u16 route_destid, u8 *route_port) ++tsi500_route_get_entry(struct rio_mport *mport, u16 destid, u8 hopcount, u16 table, u16 route_destid, u8 *route_port) +{ -+ int ret =3D 0; -+ u32 offset =3D 0x10000 + 0xa00 + ((route_destid / 2)&~0x3); ++ int ret = 0; ++ u32 offset = 0x10000 + 0xa00 + ((route_destid / 2)&~0x3); + u32 result; + -+ if (table =3D=3D 0xff) ++ if (table == 0xff) + rio_mport_read_config_32(mport, destid, hopcount, offset, &result); + else -+ rio_mport_read_config_32(mport, destid, hopcount, offset + (0x20000*tabl= -e), &result); ++ rio_mport_read_config_32(mport, destid, hopcount, offset + (0x20000*table), &result); + -+ result &=3D 0xf << (4*(route_destid & 0x7)); -+ *route_port =3D result >> (4*(route_destid & 0x7)); ++ result &= 0xf << (4*(route_destid & 0x7)); ++ *route_port = result >> (4*(route_destid & 0x7)); + if (*route_port > 3) -+ ret =3D -1; ++ ret = -1; + + return ret; +} + -+DECLARE_RIO_ROUTE_OPS(RIO_VID_TUNDRA, RIO_DID_TSI500, tsi500_route_add_ent= -ry, tsi500_route_get_entry); ++DECLARE_RIO_ROUTE_OPS(RIO_VID_TUNDRA, RIO_DID_TSI500, tsi500_route_add_entry, tsi500_route_get_entry); diff --git a/a/content_digest b/N1/content_digest index f4c09b2..d5a8d93 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -54,15 +54,15 @@ "+\n" "+static void rio_enum_timeout(unsigned long);\n" "+\n" - "+spinlock_t rio_global_list_lock =3D SPIN_LOCK_UNLOCKED;\n" - "+static int next_destid =3D 0;\n" - "+static int next_switchid =3D 0;\n" - "+static int next_net =3D 0;\n" + "+spinlock_t rio_global_list_lock = SPIN_LOCK_UNLOCKED;\n" + "+static int next_destid = 0;\n" + "+static int next_switchid = 0;\n" + "+static int next_net = 0;\n" "+\n" - "+static struct timer_list rio_enum_timer =3D\n" + "+static struct timer_list rio_enum_timer =\n" "+TIMER_INITIALIZER(rio_enum_timeout, 0, 0);\n" "+\n" - "+static int rio_mport_phys_table[] =3D {\n" + "+static int rio_mport_phys_table[] = {\n" "+\tRIO_EFB_PAR_EP_ID,\n" "+\tRIO_EFB_PAR_EP_REC_ID,\n" "+\tRIO_EFB_SER_EP_ID,\n" @@ -70,7 +70,7 @@ "+\t-1,\n" "+};\n" "+\n" - "+static int rio_sport_phys_table[] =3D {\n" + "+static int rio_sport_phys_table[] = {\n" "+\tRIO_EFB_PAR_EP_FREE_ID,\n" "+\tRIO_EFB_SER_EP_FREE_ID,\n" "+\t-1,\n" @@ -81,15 +81,14 @@ "+\n" "+/**\n" "+ * rio_get_device_id - Get the base/extended device id for a device\n" - "+ * @port: RIO master port=20\n" + "+ * @port: RIO master port \n" "+ * @destid: Destination ID of device\n" "+ * @hopcount: Hopcount to device\n" "+ *\n" "+ * Reads the base/extended device id from a device. Returns the\n" "+ * 8/16-bit device ID.\n" "+ */\n" - "+static u16 rio_get_device_id(struct rio_mport *port, u16 destid, u8 hopcou=\n" - "nt)\n" + "+static u16 rio_get_device_id(struct rio_mport *port, u16 destid, u8 hopcount)\n" "+{\n" "+\tu32 result;\n" "+\n" @@ -100,7 +99,7 @@ "+\n" "+/**\n" "+ * rio_set_device_id - Set the base/extended device id for a device\n" - "+ * @port: RIO master port=20\n" + "+ * @port: RIO master port \n" "+ * @destid: Destination ID of device\n" "+ * @hopcount: Hopcount to device\n" "+ * @did: Device ID value to be written\n" @@ -116,7 +115,7 @@ "+\n" "+/**\n" "+ * rio_local_set_device_id - Set the base/extended device id for a port\n" - "+ * @port: RIO master port=20\n" + "+ * @port: RIO master port \n" "+ * @did: Device ID value to be written\n" "+ *\n" "+ * Writes the base/extended device id from a device.\n" @@ -138,7 +137,7 @@ "+{\n" "+\tstruct rio_dev *rdev;\n" "+\tu32 result;\n" - "+\tint ret =3D 0;\n" + "+\tint ret = 0;\n" "+\n" "+\t/* Write component tag CSR magic complete value */\n" "+\trio_local_write_config_32(port, RIO_COMPONENT_TAG_CSR,\n" @@ -151,22 +150,21 @@ "+\trio_local_write_config_32(port, RIO_HOST_DID_LOCK_CSR,\n" "+\t\t\t\t port->host_deviceid);\n" "+\trio_local_read_config_32(port, RIO_HOST_DID_LOCK_CSR, &result);\n" - "+\tif ((result & 0xffff) !=3D 0xffff) {\n" + "+\tif ((result & 0xffff) != 0xffff) {\n" "+\t\tprintk(KERN_INFO\n" - "+\t\t \"RIO: badness when releasing host lock on master port, result %8.=\n" - "8x\\n\",\n" + "+\t\t \"RIO: badness when releasing host lock on master port, result %8.8x\\n\",\n" "+\t\t result);\n" - "+\t\tret =3D -EINVAL;\n" + "+\t\tret = -EINVAL;\n" "+\t}\n" "+\tlist_for_each_entry(rdev, &rio_devices, global_list) {\n" "+\t\trio_write_config_32(rdev, RIO_HOST_DID_LOCK_CSR,\n" "+\t\t\t\t port->host_deviceid);\n" "+\t\trio_read_config_32(rdev, RIO_HOST_DID_LOCK_CSR, &result);\n" - "+\t\tif ((result & 0xffff) !=3D 0xffff) {\n" + "+\t\tif ((result & 0xffff) != 0xffff) {\n" "+\t\t\tprintk(KERN_INFO\n" "+\t\t\t \"RIO: badness when releasing host lock on vid %4.4x did %4.4x\\n\",\n" "+\t\t\t rdev->vid, rdev->did);\n" - "+\t\t\tret =3D -EINVAL;\n" + "+\t\t\tret = -EINVAL;\n" "+\t\t}\n" "+\t}\n" "+\n" @@ -190,21 +188,20 @@ "+\t\t\t\t port->host_deviceid);\n" "+\n" "+\trio_local_read_config_32(port, RIO_HOST_DID_LOCK_CSR, &result);\n" - "+\tif ((result & 0xffff) !=3D port->host_deviceid)\n" + "+\tif ((result & 0xffff) != port->host_deviceid)\n" "+\t\treturn -1;\n" "+\n" "+\t/* Set master port destid and init destid ctr */\n" "+\trio_local_set_device_id(port, port->host_deviceid);\n" "+\n" - "+\tif (next_destid =3D=3D port->host_deviceid)\n" + "+\tif (next_destid == port->host_deviceid)\n" "+\t\tnext_destid++;\n" "+\n" "+\treturn 0;\n" "+}\n" "+\n" "+/**\n" - "+ * rio_device_has_destid- Test if a device contains a destination ID regis=\n" - "ter\n" + "+ * rio_device_has_destid- Test if a device contains a destination ID register\n" "+ * @port: Master port to issue transaction\n" "+ * @src_ops: RIO device source operations\n" "+ * @dst_ops: RIO device destination operations\n" @@ -246,7 +243,7 @@ "+{\n" "+\tstruct rio_dev *rdev;\n" "+\n" - "+\trdev =3D to_rio_dev(dev);\n" + "+\trdev = to_rio_dev(dev);\n" "+\tkfree(rdev);\n" "+}\n" "+\n" @@ -267,8 +264,7 @@ "+}\n" "+\n" "+/**\n" - "+ * rio_route_set_ops- Sets routing operations for a particular vendor swit=\n" - "ch\n" + "+ * rio_route_set_ops- Sets routing operations for a particular vendor switch\n" "+ * @rdev: RIO device\n" "+ *\n" "+ * Searches the RIO route ops table for known switch types. If the vid\n" @@ -277,14 +273,14 @@ "+ */\n" "+static void rio_route_set_ops(struct rio_dev *rdev)\n" "+{\n" - "+\tstruct rio_route_ops *cur =3D __start_rio_route_ops;\n" - "+\tstruct rio_route_ops *end =3D __end_rio_route_ops;\n" + "+\tstruct rio_route_ops *cur = __start_rio_route_ops;\n" + "+\tstruct rio_route_ops *end = __end_rio_route_ops;\n" "+\n" "+\twhile (cur < end) {\n" - "+\t\tif ((cur->vid =3D=3D rdev->vid) && (cur->did =3D=3D rdev->did)) {\n" + "+\t\tif ((cur->vid == rdev->vid) && (cur->did == rdev->did)) {\n" "+\t\t\tpr_debug(\"RIO: adding routing ops for %s\\n\", rio_name(rdev));\n" - "+\t\t\trdev->rswitch->add_entry =3D cur->add_hook;\n" - "+\t\t\trdev->rswitch->get_entry =3D cur->get_hook;\n" + "+\t\t\trdev->rswitch->add_entry = cur->add_hook;\n" + "+\t\t\trdev->rswitch->get_entry = cur->get_hook;\n" "+\t\t}\n" "+\t\tcur++;\n" "+\t}\n" @@ -337,29 +333,29 @@ "+\tstruct rio_switch *rswitch;\n" "+\tint result, rdid;\n" "+\n" - "+\trdev =3D kmalloc(sizeof(struct rio_dev), GFP_KERNEL);\n" + "+\trdev = kmalloc(sizeof(struct rio_dev), GFP_KERNEL);\n" "+\tif (!rdev)\n" "+\t\tgoto out;\n" "+\n" "+\tmemset(rdev, 0, sizeof(struct rio_dev));\n" - "+\trdev->net =3D net;\n" + "+\trdev->net = net;\n" "+\trio_mport_read_config_32(port, destid, hopcount, RIO_DEV_ID_CAR,\n" "+\t\t\t\t &result);\n" - "+\trdev->did =3D result >> 16;\n" - "+\trdev->vid =3D result & 0xffff;\n" + "+\trdev->did = result >> 16;\n" + "+\trdev->vid = result & 0xffff;\n" "+\trio_mport_read_config_32(port, destid, hopcount, RIO_DEV_INFO_CAR,\n" "+\t\t\t\t &rdev->device_rev);\n" "+\trio_mport_read_config_32(port, destid, hopcount, RIO_ASM_ID_CAR,\n" "+\t\t\t\t &result);\n" - "+\trdev->asm_did =3D result >> 16;\n" - "+\trdev->asm_vid =3D result & 0xffff;\n" + "+\trdev->asm_did = result >> 16;\n" + "+\trdev->asm_vid = result & 0xffff;\n" "+\trio_mport_read_config_32(port, destid, hopcount, RIO_ASM_INFO_CAR,\n" "+\t\t\t\t &result);\n" - "+\trdev->asm_rev =3D result >> 16;\n" + "+\trdev->asm_rev = result >> 16;\n" "+\trio_mport_read_config_32(port, destid, hopcount, RIO_PEF_CAR,\n" "+\t\t\t\t &rdev->pef);\n" "+\tif (rdev->pef & RIO_PEF_EXT_FEATURES)\n" - "+\t\trdev->efptr =3D result & 0xffff;\n" + "+\t\trdev->efptr = result & 0xffff;\n" "+\n" "+\trio_mport_read_config_32(port, destid, hopcount, RIO_SRC_OPS_CAR,\n" "+\t\t\t\t &rdev->src_ops);\n" @@ -369,29 +365,29 @@ "+\tif (rio_device_has_destid(port, rdev->src_ops, rdev->dst_ops)\n" "+\t && do_enum) {\n" "+\t\trio_set_device_id(port, destid, hopcount, next_destid);\n" - "+\t\trdev->destid =3D next_destid++;\n" - "+\t\tif (next_destid =3D=3D port->host_deviceid)\n" + "+\t\trdev->destid = next_destid++;\n" + "+\t\tif (next_destid == port->host_deviceid)\n" "+\t\t\tnext_destid++;\n" "+\t} else\n" - "+\t\trdev->destid =3D rio_get_device_id(port, destid, hopcount);\n" + "+\t\trdev->destid = rio_get_device_id(port, destid, hopcount);\n" "+\n" "+\t/* If a PE has both switch and other functions, show it as a switch */\n" "+\tif (rio_is_switch(rdev)) {\n" "+\t\trio_mport_read_config_32(port, destid, hopcount,\n" "+\t\t\t\t\t RIO_SWP_INFO_CAR, &rdev->swpinfo);\n" - "+\t\trswitch =3D kmalloc(sizeof(struct rio_switch), GFP_KERNEL);\n" + "+\t\trswitch = kmalloc(sizeof(struct rio_switch), GFP_KERNEL);\n" "+\t\tif (!rswitch) {\n" "+\t\t\tkfree(rdev);\n" - "+\t\t\trdev =3D NULL;\n" + "+\t\t\trdev = NULL;\n" "+\t\t\tgoto out;\n" "+\t\t}\n" - "+\t\trswitch->switchid =3D next_switchid;\n" - "+\t\trswitch->hopcount =3D hopcount;\n" - "+\t\trswitch->destid =3D 0xffff;\n" + "+\t\trswitch->switchid = next_switchid;\n" + "+\t\trswitch->hopcount = hopcount;\n" + "+\t\trswitch->destid = 0xffff;\n" "+\t\t/* Initialize switch route table */\n" - "+\t\tfor (rdid =3D 0; rdid < RIO_MAX_ROUTE_ENTRIES; rdid++)\n" - "+\t\t\trswitch->route_table[rdid] =3D RIO_INVALID_ROUTE;\n" - "+\t\trdev->rswitch =3D rswitch;\n" + "+\t\tfor (rdid = 0; rdid < RIO_MAX_ROUTE_ENTRIES; rdid++)\n" + "+\t\t\trswitch->route_table[rdid] = RIO_INVALID_ROUTE;\n" + "+\t\trdev->rswitch = rswitch;\n" "+\t\tsprintf(rio_name(rdev), \"%02x:s:%04x\", rdev->net->id,\n" "+\t\t\trdev->rswitch->switchid);\n" "+\t\trio_route_set_ops(rdev);\n" @@ -402,14 +398,14 @@ "+\t\tsprintf(rio_name(rdev), \"%02x:e:%04x\", rdev->net->id,\n" "+\t\t\trdev->destid);\n" "+\n" - "+\trdev->dev.bus =3D &rio_bus_type;\n" + "+\trdev->dev.bus = &rio_bus_type;\n" "+\n" "+\tdevice_initialize(&rdev->dev);\n" - "+\trdev->dev.release =3D rio_release_dev;\n" + "+\trdev->dev.release = rio_release_dev;\n" "+\trio_dev_get(rdev);\n" "+\n" - "+\trdev->dev.dma_mask =3D (u64 *) 0xffffffff;\n" - "+\trdev->dev.coherent_dma_mask =3D 0xffffffffULL;\n" + "+\trdev->dev.dma_mask = (u64 *) 0xffffffff;\n" + "+\trdev->dev.coherent_dma_mask = 0xffffffffULL;\n" "+\n" "+\tif ((rdev->pef & RIO_PEF_INB_DOORBELL) &&\n" "+\t (rdev->dst_ops & RIO_DST_OPS_DOORBELL))\n" @@ -435,20 +431,19 @@ "+ * inactive.\n" "+ */\n" "+static int\n" - "+rio_sport_is_active(struct rio_mport *port, u16 destid, u8 hopcount, int s=\n" - "port)\n" + "+rio_sport_is_active(struct rio_mport *port, u16 destid, u8 hopcount, int sport)\n" "+{\n" "+\tu32 result;\n" "+\tu32 ext_ftr_ptr;\n" "+\n" - "+\tint *entry =3D rio_sport_phys_table;\n" + "+\tint *entry = rio_sport_phys_table;\n" "+\n" "+\tdo {\n" - "+\t\tif ((ext_ftr_ptr =3D\n" + "+\t\tif ((ext_ftr_ptr =\n" "+\t\t rio_mport_get_feature(port, 0, destid, hopcount, *entry)))\n" "+\n" "+\t\t\tbreak;\n" - "+\t} while (*++entry >=3D 0);\n" + "+\t} while (*++entry >= 0);\n" "+\n" "+\tif (ext_ftr_ptr)\n" "+\t\trio_mport_read_config_32(port, destid, hopcount,\n" @@ -474,8 +469,7 @@ "+ * %RIO_GLOBAL_TABLE in @table. Returns %0 on success or %-EINVAL\n" "+ * on failure.\n" "+ */\n" - "+static int rio_route_add_entry(struct rio_mport *mport, struct rio_dev *rd=\n" - "ev,\n" + "+static int rio_route_add_entry(struct rio_mport *mport, struct rio_dev *rdev,\n" "+\t\t\t u16 table, u16 route_destid, u8 route_port)\n" "+{\n" "+\treturn rdev->rswitch->add_entry(mport, rdev->rswitch->destid,\n" @@ -499,8 +493,7 @@ "+ * on failure.\n" "+ */\n" "+static int\n" - "+rio_route_get_entry(struct rio_mport *mport, struct rio_dev *rdev, u16 tab=\n" - "le,\n" + "+rio_route_get_entry(struct rio_mport *mport, struct rio_dev *rdev, u16 table,\n" "+\t\t u16 route_destid, u8 * route_port)\n" "+{\n" "+\treturn rdev->rswitch->get_entry(mport, rdev->rswitch->destid,\n" @@ -509,8 +502,7 @@ "+}\n" "+\n" "+/**\n" - "+ * rio_get_host_deviceid_lock- Reads the Host Device ID Lock CSR on a devi=\n" - "ce\n" + "+ * rio_get_host_deviceid_lock- Reads the Host Device ID Lock CSR on a device\n" "+ * @port: Master port to send transaction\n" "+ * @hopcount: Number of hops to the device\n" "+ *\n" @@ -528,7 +520,7 @@ "+}\n" "+\n" "+/**\n" - "+ * rio_get_swpinfo_inport- Gets the ingress port number=20\n" + "+ * rio_get_swpinfo_inport- Gets the ingress port number \n" "+ * @mport: Master port to send transaction\n" "+ * @destid: Destination ID associated with the switch\n" "+ * @hopcount: Number of hops to the device\n" @@ -599,8 +591,7 @@ "+\tu16 destid;\n" "+\tint tmp;\n" "+\n" - "+\tif (rio_get_host_deviceid_lock(port, hopcount) =3D=3D port->host_deviceid=\n" - ") {\n" + "+\tif (rio_get_host_deviceid_lock(port, hopcount) == port->host_deviceid) {\n" "+\t\tpr_debug(\"RIO: PE already discovered by this host\\n\");\n" "+\t\t/*\n" "+\t\t * Already discovered by this host. Add it as another\n" @@ -613,7 +604,7 @@ "+\t/* Attempt to acquire device lock */\n" "+\trio_mport_write_config_32(port, RIO_ANY_DESTID, hopcount,\n" "+\t\t\t\t RIO_HOST_DID_LOCK_CSR, port->host_deviceid);\n" - "+\twhile ((tmp =3D rio_get_host_deviceid_lock(port, hopcount))\n" + "+\twhile ((tmp = rio_get_host_deviceid_lock(port, hopcount))\n" "+\t < port->host_deviceid) {\n" "+\t\t/* Delay a bit */\n" "+\t\tmdelay(1);\n" @@ -630,7 +621,7 @@ "+\t}\n" "+\n" "+\t/* Setup new RIO device */\n" - "+\tif ((rdev =3D rio_setup_device(net, port, RIO_ANY_DESTID, hopcount, 1))) {\n" + "+\tif ((rdev = rio_setup_device(net, port, RIO_ANY_DESTID, hopcount, 1))) {\n" "+\t\t/* Add device to the global and bus/net specific list. */\n" "+\t\tlist_add_tail(&rdev->net_list, &net->devices);\n" "+\t} else\n" @@ -639,27 +630,27 @@ "+\tif (rio_is_switch(rdev)) {\n" "+\t\tnext_switchid++;\n" "+\n" - "+\t\tfor (destid =3D 0; destid < next_destid; destid++) {\n" + "+\t\tfor (destid = 0; destid < next_destid; destid++) {\n" "+\t\t\trio_route_add_entry(port, rdev, RIO_GLOBAL_TABLE,\n" "+\t\t\t\t\t destid, rio_get_swpinfo_inport(port,\n" "+\t\t\t\t\t\t\t\t\t RIO_ANY_DESTID,\n" "+\t\t\t\t\t\t\t\t\t hopcount));\n" - "+\t\t\trdev->rswitch->route_table[destid] =3D\n" + "+\t\t\trdev->rswitch->route_table[destid] =\n" "+\t\t\t rio_get_swpinfo_inport(port, RIO_ANY_DESTID,\n" "+\t\t\t\t\t\t hopcount);\n" "+\t\t}\n" "+\n" - "+\t\tnum_ports =3D\n" + "+\t\tnum_ports =\n" "+\t\t rio_get_swpinfo_tports(port, RIO_ANY_DESTID, hopcount);\n" "+\t\tpr_debug(\n" "+\t\t \"RIO: found %s (vid %4.4x did %4.4x) with %d ports\\n\",\n" "+\t\t rio_name(rdev), rdev->vid, rdev->did, num_ports);\n" - "+\t\tfor (port_num =3D 0; port_num < num_ports; port_num++) {\n" + "+\t\tfor (port_num = 0; port_num < num_ports; port_num++) {\n" "+\t\t\tif (rio_get_swpinfo_inport\n" - "+\t\t\t (port, RIO_ANY_DESTID, hopcount) =3D=3D port_num)\n" + "+\t\t\t (port, RIO_ANY_DESTID, hopcount) == port_num)\n" "+\t\t\t\tcontinue;\n" "+\n" - "+\t\t\tcur_destid =3D next_destid;\n" + "+\t\t\tcur_destid = next_destid;\n" "+\n" "+\t\t\tif (rio_sport_is_active\n" "+\t\t\t (port, RIO_ANY_DESTID, hopcount, port_num)) {\n" @@ -675,17 +666,17 @@ "+\n" "+\t\t\t\t/* Update routing tables */\n" "+\t\t\t\tif (next_destid > cur_destid) {\n" - "+\t\t\t\t\tfor (destid =3D cur_destid;\n" + "+\t\t\t\t\tfor (destid = cur_destid;\n" "+\t\t\t\t\t destid < next_destid; destid++) {\n" "+\t\t\t\t\t\trio_route_add_entry(port, rdev,\n" "+\t\t\t\t\t\t\t\t RIO_GLOBAL_TABLE,\n" "+\t\t\t\t\t\t\t\t destid,\n" "+\t\t\t\t\t\t\t\t port_num);\n" "+\t\t\t\t\t\trdev->rswitch->\n" - "+\t\t\t\t\t\t route_table[destid] =3D\n" + "+\t\t\t\t\t\t route_table[destid] =\n" "+\t\t\t\t\t\t port_num;\n" "+\t\t\t\t\t}\n" - "+\t\t\t\t\trdev->rswitch->destid =3D cur_destid;\n" + "+\t\t\t\t\trdev->rswitch->destid = cur_destid;\n" "+\t\t\t\t}\n" "+\t\t\t}\n" "+\t\t}\n" @@ -707,12 +698,12 @@ "+static int rio_enum_complete(struct rio_mport *port)\n" "+{\n" "+\tu32 tag_csr;\n" - "+\tint ret =3D 0;\n" + "+\tint ret = 0;\n" "+\n" "+\trio_local_read_config_32(port, RIO_COMPONENT_TAG_CSR, &tag_csr);\n" "+\n" - "+\tif (tag_csr =3D=3D RIO_ENUM_CMPL_MAGIC)\n" - "+\t\tret =3D 1;\n" + "+\tif (tag_csr == RIO_ENUM_CMPL_MAGIC)\n" + "+\t\tret = 1;\n" "+\n" "+\treturn ret;\n" "+}\n" @@ -737,7 +728,7 @@ "+\tu16 ndestid;\n" "+\n" "+\t/* Setup new RIO device */\n" - "+\tif ((rdev =3D rio_setup_device(net, port, destid, hopcount, 0))) {\n" + "+\tif ((rdev = rio_setup_device(net, port, destid, hopcount, 0))) {\n" "+\t\t/* Add device to the global and bus/net specific list. */\n" "+\t\tlist_add_tail(&rdev->net_list, &net->devices);\n" "+\t} else\n" @@ -747,14 +738,14 @@ "+\t\tnext_switchid++;\n" "+\n" "+\t\t/* Associated destid is how we accessed this switch */\n" - "+\t\trdev->rswitch->destid =3D destid;\n" + "+\t\trdev->rswitch->destid = destid;\n" "+\n" - "+\t\tnum_ports =3D rio_get_swpinfo_tports(port, destid, hopcount);\n" + "+\t\tnum_ports = rio_get_swpinfo_tports(port, destid, hopcount);\n" "+\t\tpr_debug(\n" "+\t\t \"RIO: found %s (vid %4.4x did %4.4x) with %d ports\\n\",\n" "+\t\t rio_name(rdev), rdev->vid, rdev->did, num_ports);\n" - "+\t\tfor (port_num =3D 0; port_num < num_ports; port_num++) {\n" - "+\t\t\tif (rio_get_swpinfo_inport(port, destid, hopcount) =3D=3D\n" + "+\t\tfor (port_num = 0; port_num < num_ports; port_num++) {\n" + "+\t\t\tif (rio_get_swpinfo_inport(port, destid, hopcount) ==\n" "+\t\t\t port_num)\n" "+\t\t\t\tcontinue;\n" "+\n" @@ -763,13 +754,13 @@ "+\t\t\t\tpr_debug(\n" "+\t\t\t\t \"RIO: scanning device on port %d\\n\",\n" "+\t\t\t\t port_num);\n" - "+\t\t\t\tfor (ndestid =3D 0; ndestid < RIO_ANY_DESTID;\n" + "+\t\t\t\tfor (ndestid = 0; ndestid < RIO_ANY_DESTID;\n" "+\t\t\t\t ndestid++) {\n" "+\t\t\t\t\trio_route_get_entry(port, rdev,\n" "+\t\t\t\t\t\t\t RIO_GLOBAL_TABLE,\n" "+\t\t\t\t\t\t\t ndestid,\n" "+\t\t\t\t\t\t\t &route_port);\n" - "+\t\t\t\t\tif (route_port =3D=3D port_num)\n" + "+\t\t\t\t\tif (route_port == port_num)\n" "+\t\t\t\t\t\tbreak;\n" "+\t\t\t\t}\n" "+\n" @@ -796,15 +787,15 @@ "+ */\n" "+static int rio_mport_is_active(struct rio_mport *port)\n" "+{\n" - "+\tu32 result =3D 0;\n" + "+\tu32 result = 0;\n" "+\tu32 ext_ftr_ptr;\n" - "+\tint *entry =3D rio_mport_phys_table;\n" + "+\tint *entry = rio_mport_phys_table;\n" "+\n" "+\tdo {\n" - "+\t\tif ((ext_ftr_ptr =3D\n" + "+\t\tif ((ext_ftr_ptr =\n" "+\t\t rio_mport_get_feature(port, 1, 0, 0, *entry)))\n" "+\t\t\tbreak;\n" - "+\t} while (*++entry >=3D 0);\n" + "+\t} while (*++entry >= 0);\n" "+\n" "+\tif (ext_ftr_ptr)\n" "+\t\trio_local_read_config_32(port,\n" @@ -828,15 +819,15 @@ "+{\n" "+\tstruct rio_net *net;\n" "+\n" - "+\tnet =3D kmalloc(sizeof(struct rio_net), GFP_KERNEL);\n" + "+\tnet = kmalloc(sizeof(struct rio_net), GFP_KERNEL);\n" "+\tif (net) {\n" "+\t\tmemset(net, 0, sizeof(struct rio_net));\n" "+\t\tINIT_LIST_HEAD(&net->node);\n" "+\t\tINIT_LIST_HEAD(&net->devices);\n" "+\t\tINIT_LIST_HEAD(&net->mports);\n" "+\t\tlist_add_tail(&port->nnode, &net->mports);\n" - "+\t\tnet->hport =3D port;\n" - "+\t\tnet->id =3D next_net++;\n" + "+\t\tnet->hport = port;\n" + "+\t\tnet->id = next_net++;\n" "+\t}\n" "+\treturn net;\n" "+}\n" @@ -852,43 +843,41 @@ "+ */\n" "+int rio_enum_mport(struct rio_mport *mport)\n" "+{\n" - "+\tstruct rio_net *net =3D NULL;\n" - "+\tint rc =3D 0;\n" + "+\tstruct rio_net *net = NULL;\n" + "+\tint rc = 0;\n" "+\n" "+\tprintk(KERN_INFO \"RIO: enumerate master port %d, %s\\n\", mport->id,\n" "+\t mport->name);\n" "+\t/* If somebody else enumerated our master port device, bail. */\n" "+\tif (rio_enum_host(mport) < 0) {\n" "+\t\tprintk(KERN_INFO\n" - "+\t\t \"RIO: master port %d device has been enumerated by a remote host\\=\n" - "n\",\n" + "+\t\t \"RIO: master port %d device has been enumerated by a remote host\\n\",\n" "+\t\t mport->id);\n" - "+\t\trc =3D -EBUSY;\n" + "+\t\trc = -EBUSY;\n" "+\t\tgoto out;\n" "+\t}\n" "+\n" "+\t/* If master port has an active link, allocate net and enum peers */\n" "+\tif (rio_mport_is_active(mport)) {\n" - "+\t\tif (!(net =3D rio_alloc_net(mport))) {\n" + "+\t\tif (!(net = rio_alloc_net(mport))) {\n" "+\t\t\tprintk(KERN_ERR \"RIO: failed to allocate new net\\n\");\n" - "+\t\t\trc =3D -ENOMEM;\n" + "+\t\t\trc = -ENOMEM;\n" "+\t\t\tgoto out;\n" "+\t\t}\n" "+\t\tif (rio_enum_peer(net, mport, 0) < 0) {\n" "+\t\t\t/* A higher priority host won enumeration, bail. */\n" "+\t\t\tprintk(KERN_INFO\n" - "+\t\t\t \"RIO: master port %d device has lost enumeration to a remote hos=\n" - "t\\n\",\n" + "+\t\t\t \"RIO: master port %d device has lost enumeration to a remote host\\n\",\n" "+\t\t\t mport->id);\n" "+\t\t\trio_clear_locks(mport);\n" - "+\t\t\trc =3D -EBUSY;\n" + "+\t\t\trc = -EBUSY;\n" "+\t\t\tgoto out;\n" "+\t\t}\n" "+\t\trio_clear_locks(mport);\n" "+\t} else {\n" "+\t\tprintk(KERN_INFO \"RIO: master port %d link inactive\\n\",\n" "+\t\t mport->id);\n" - "+\t\trc =3D -EINVAL;\n" + "+\t\trc = -EINVAL;\n" "+\t}\n" "+\n" "+ out:\n" @@ -909,12 +898,12 @@ "+\n" "+\tlist_for_each_entry(rdev, &rio_devices, global_list)\n" "+\t if (rio_is_switch(rdev))\n" - "+\t\tfor (i =3D 0; i < RIO_MAX_ROUTE_ENTRIES; i++) {\n" + "+\t\tfor (i = 0; i < RIO_MAX_ROUTE_ENTRIES; i++) {\n" "+\t\t\tif (rio_route_get_entry\n" "+\t\t\t (rdev->net->hport, rdev, RIO_GLOBAL_TABLE, i,\n" "+\t\t\t &sport) < 0)\n" "+\t\t\t\tcontinue;\n" - "+\t\t\trdev->rswitch->route_table[i] =3D sport;\n" + "+\t\t\trdev->rswitch->route_table[i] = sport;\n" "+\t\t}\n" "+}\n" "+\n" @@ -929,7 +918,7 @@ "+static void rio_enum_timeout(unsigned long data)\n" "+{\n" "+\t/* Enumeration timed out, set flag */\n" - "+\t*(int *)data =3D 1;\n" + "+\t*(int *)data = 1;\n" "+}\n" "+\n" "+/**\n" @@ -944,24 +933,24 @@ "+ */\n" "+int rio_disc_mport(struct rio_mport *mport)\n" "+{\n" - "+\tstruct rio_net *net =3D NULL;\n" - "+\tint enum_timeout_flag =3D 0;\n" + "+\tstruct rio_net *net = NULL;\n" + "+\tint enum_timeout_flag = 0;\n" "+\n" "+\tprintk(KERN_INFO \"RIO: discover master port %d, %s\\n\", mport->id,\n" "+\t mport->name);\n" "+\n" "+\t/* If master port has an active link, allocate net and discover peers */\n" "+\tif (rio_mport_is_active(mport)) {\n" - "+\t\tif (!(net =3D rio_alloc_net(mport))) {\n" + "+\t\tif (!(net = rio_alloc_net(mport))) {\n" "+\t\t\tprintk(KERN_ERR \"RIO: Failed to allocate new net\\n\");\n" "+\t\t\tgoto bail;\n" "+\t\t}\n" "+\n" "+\t\tpr_debug(\"RIO: wait for enumeration complete...\");\n" "+\n" - "+\t\trio_enum_timer.expires =3D\n" + "+\t\trio_enum_timer.expires =\n" "+\t\t jiffies + CONFIG_RAPIDIO_DISC_TIMEOUT * HZ;\n" - "+\t\trio_enum_timer.data =3D (unsigned long)&enum_timeout_flag;\n" + "+\t\trio_enum_timer.data = (unsigned long)&enum_timeout_flag;\n" "+\t\tadd_timer(&rio_enum_timer);\n" "+\t\twhile (!rio_enum_complete(mport)) {\n" "+\t\t\tmdelay(1);\n" @@ -999,7 +988,7 @@ "+# Makefile for RIO switches\n" "+#\n" "+\n" - "+obj-$(CONFIG_RAPIDIO)\t+=3D tsi500.o\n" + "+obj-$(CONFIG_RAPIDIO)\t+= tsi500.o\n" "diff --git a/drivers/rio/switches/tsi500.c b/drivers/rio/switches/tsi500.c\n" "new file mode 100644\n" "--- /dev/null\n" @@ -1023,54 +1012,47 @@ "+#include \"../rio.h\"\n" "+\n" "+static int\n" - "+tsi500_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount, u=\n" - "16 table, u16 route_destid, u8 route_port)\n" + "+tsi500_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount, u16 table, u16 route_destid, u8 route_port)\n" "+{\n" "+\tint i;\n" - "+\tu32 offset =3D 0x10000 + 0xa00 + ((route_destid / 2)&~0x3);\n" + "+\tu32 offset = 0x10000 + 0xa00 + ((route_destid / 2)&~0x3);\n" "+\tu32 result;\n" "+\n" - "+\tif (table =3D=3D 0xff) {\n" + "+\tif (table == 0xff) {\n" "+\t\trio_mport_read_config_32(mport, destid, hopcount, offset, &result);\n" - "+\t\tresult &=3D ~(0xf << (4*(route_destid & 0x7)));\n" - "+\t\tfor (i=3D0;i<4;i++)\n" - "+\t\t\trio_mport_write_config_32(mport, destid, hopcount, offset + (0x20000*i)=\n" - ", result | (route_port << (4*(route_destid & 0x7))));\n" + "+\t\tresult &= ~(0xf << (4*(route_destid & 0x7)));\n" + "+\t\tfor (i=0;i<4;i++)\n" + "+\t\t\trio_mport_write_config_32(mport, destid, hopcount, offset + (0x20000*i), result | (route_port << (4*(route_destid & 0x7))));\n" "+\t}\n" "+\telse {\n" - "+\t\trio_mport_read_config_32(mport, destid, hopcount, offset + (0x20000*tabl=\n" - "e), &result);\n" - "+\t\tresult &=3D ~(0xf << (4*(route_destid & 0x7)));\n" - "+\t\trio_mport_write_config_32(mport, destid, hopcount, offset + (0x20000*tab=\n" - "le), result | (route_port << (4*(route_destid & 0x7))));\n" + "+\t\trio_mport_read_config_32(mport, destid, hopcount, offset + (0x20000*table), &result);\n" + "+\t\tresult &= ~(0xf << (4*(route_destid & 0x7)));\n" + "+\t\trio_mport_write_config_32(mport, destid, hopcount, offset + (0x20000*table), result | (route_port << (4*(route_destid & 0x7))));\n" "+\t}\n" "+\n" "+\treturn 0;\n" "+}\n" "+\n" "+static int\n" - "+tsi500_route_get_entry(struct rio_mport *mport, u16 destid, u8 hopcount, u=\n" - "16 table, u16 route_destid, u8 *route_port)\n" + "+tsi500_route_get_entry(struct rio_mport *mport, u16 destid, u8 hopcount, u16 table, u16 route_destid, u8 *route_port)\n" "+{\n" - "+\tint ret =3D 0;\n" - "+\tu32 offset =3D 0x10000 + 0xa00 + ((route_destid / 2)&~0x3);\n" + "+\tint ret = 0;\n" + "+\tu32 offset = 0x10000 + 0xa00 + ((route_destid / 2)&~0x3);\n" "+\tu32 result;\n" "+\n" - "+\tif (table =3D=3D 0xff)\n" + "+\tif (table == 0xff)\n" "+\t\trio_mport_read_config_32(mport, destid, hopcount, offset, &result);\n" "+\telse\n" - "+\t\trio_mport_read_config_32(mport, destid, hopcount, offset + (0x20000*tabl=\n" - "e), &result);\n" + "+\t\trio_mport_read_config_32(mport, destid, hopcount, offset + (0x20000*table), &result);\n" "+\n" - "+\tresult &=3D 0xf << (4*(route_destid & 0x7));\n" - "+\t*route_port =3D result >> (4*(route_destid & 0x7));\n" + "+\tresult &= 0xf << (4*(route_destid & 0x7));\n" + "+\t*route_port = result >> (4*(route_destid & 0x7));\n" "+\tif (*route_port > 3)\n" - "+\t\tret =3D -1;\n" + "+\t\tret = -1;\n" "+\n" "+\treturn ret;\n" "+}\n" "+\n" - "+DECLARE_RIO_ROUTE_OPS(RIO_VID_TUNDRA, RIO_DID_TSI500, tsi500_route_add_ent=\n" - ry, tsi500_route_get_entry); + +DECLARE_RIO_ROUTE_OPS(RIO_VID_TUNDRA, RIO_DID_TSI500, tsi500_route_add_entry, tsi500_route_get_entry); -af2963854d0bd52b76b621737db6c380eaa8bd8f3630699dd96dd299c088ba38 +6ee93bfcf3c6fa973b9851392e15c8b90dd26a6982a7273103e2e5fb15bbc237
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.