Lines Matching defs:rdev

36 static void rio_init_em(struct rio_dev *rdev);
194 struct rio_dev *rdev;
208 list_for_each_entry(rdev, &net->devices, net_list) {
209 rio_write_config_32(rdev, RIO_HOST_DID_LOCK_CSR,
211 rio_read_config_32(rdev, RIO_HOST_DID_LOCK_CSR, &result);
215 rdev->vid, rdev->did);
220 rio_read_config_32(rdev,
221 rdev->phys_efptr + RIO_PORT_GEN_CTL_CSR,
224 rio_write_config_32(rdev,
225 rdev->phys_efptr + RIO_PORT_GEN_CTL_CSR,
284 struct rio_dev *rdev;
286 rdev = to_rio_dev(dev);
287 kfree(rdev);
292 * @rdev: RIO device
299 static int rio_is_switch(struct rio_dev *rdev)
301 if (rdev->pef & RIO_PEF_SWITCH)
327 struct rio_dev *rdev;
333 size = sizeof(*rdev);
345 rdev = kzalloc(size, GFP_KERNEL);
346 if (!rdev)
349 rdev->net = net;
350 rdev->pef = result;
351 rdev->swpinfo = swpinfo;
354 rdev->did = result >> 16;
355 rdev->vid = result & 0xffff;
357 &rdev->device_rev);
360 rdev->asm_did = result >> 16;
361 rdev->asm_vid = result & 0xffff;
364 rdev->asm_rev = result >> 16;
365 if (rdev->pef & RIO_PEF_EXT_FEATURES) {
366 rdev->efptr = result & 0xffff;
367 rdev->phys_efptr = rio_mport_get_physefb(port, 0, destid,
368 hopcount, &rdev->phys_rmap);
370 __func__, rdev->phys_rmap);
372 rdev->em_efptr = rio_mport_get_feature(port, 0, destid,
374 if (!rdev->em_efptr)
375 rdev->em_efptr = rio_mport_get_feature(port, 0, destid,
380 &rdev->src_ops);
382 &rdev->dst_ops);
392 rdev->comp_tag = next_comptag++;
393 rdev->do_enum = true;
397 &rdev->comp_tag);
400 if (rio_device_has_destid(port, rdev->src_ops, rdev->dst_ops)) {
403 rdev->destid = next_destid;
406 rdev->destid = rio_get_device_id(port, destid, hopcount);
408 rdev->hopcount = 0xff;
413 rdev->destid = destid;
414 rdev->hopcount = hopcount;
418 if (rio_is_switch(rdev)) {
419 rswitch = rdev->rswitch;
431 dev_set_name(&rdev->dev, "%02x:s:%04x", rdev->net->id,
432 rdev->comp_tag & RIO_CTAG_UDEVID);
435 rio_route_clr_table(rdev, RIO_GLOBAL_TABLE, 0);
441 dev_set_name(&rdev->dev, "%02x:e:%04x", rdev->net->id,
442 rdev->comp_tag & RIO_CTAG_UDEVID);
445 rdev->dev.parent = &net->dev;
446 rio_attach_device(rdev);
447 rdev->dev.release = rio_release_dev;
448 rdev->dma_mask = DMA_BIT_MASK(32);
449 rdev->dev.dma_mask = &rdev->dma_mask;
450 rdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
452 if (rdev->dst_ops & RIO_DST_OPS_DOORBELL)
453 rio_init_dbell_res(&rdev->riores[RIO_DOORBELL_RESOURCE],
456 ret = rio_add_device(rdev);
460 put_device(&rdev->dev);
464 rio_dev_get(rdev);
466 return rdev;
472 kfree(rdev);
478 * @rdev: RapidIO device object
487 rio_sport_is_active(struct rio_dev *rdev, int sp)
491 rio_read_config_32(rdev, RIO_DEV_PORT_N_ERR_STS_CSR(rdev, sp),
529 struct rio_dev *rdev;
549 rdev = rio_get_comptag((regval & 0xffff), NULL);
551 if (rdev && prev && rio_is_switch(prev)) {
553 rio_name(rdev));
554 prev->rswitch->nextdev[prev_port] = rdev;
583 rdev = rio_setup_device(net, port, RIO_ANY_DESTID(port->sys_size),
585 if (rdev) {
586 rdev->prev = prev;
588 prev->rswitch->nextdev[prev_port] = rdev;
592 if (rio_is_switch(rdev)) {
599 sw_inport = RIO_GET_PORT_NUM(rdev->swpinfo);
600 rio_route_add_entry(rdev, RIO_GLOBAL_TABLE,
602 rdev->rswitch->route_table[port->host_deviceid] = sw_inport;
607 rio_route_add_entry(rdev, RIO_GLOBAL_TABLE,
609 rdev->rswitch->route_table[destid] = sw_inport;
615 rio_name(rdev), rdev->vid, rdev->did,
616 RIO_GET_TOTAL_PORTS(rdev->swpinfo));
619 port_num < RIO_GET_TOTAL_PORTS(rdev->swpinfo);
625 rdev->rswitch->port_ok |= (1 << port_num);
631 if (rio_sport_is_active(rdev, port_num)) {
638 rdev->rswitch->port_ok |= (1 << port_num);
639 rio_route_add_entry(rdev, RIO_GLOBAL_TABLE,
644 rdev, port_num) < 0)
653 rio_route_add_entry(rdev,
658 rdev->rswitch->
670 if (rdev->em_efptr)
671 rio_set_port_lockout(rdev, port_num, 1);
673 rdev->rswitch->port_ok &= ~(1 << port_num);
678 if ((rdev->src_ops & RIO_SRC_OPS_PORT_WRITE) &&
679 (rdev->em_efptr)) {
680 rio_write_config_32(rdev,
681 rdev->em_efptr + RIO_EM_PW_TGT_DEVID,
686 rio_init_em(rdev);
692 rdev->destid = sw_destid;
695 rio_name(rdev), rdev->vid, rdev->did);
734 struct rio_dev *rdev;
738 if ((rdev = rio_setup_device(net, port, destid, hopcount, 0))) {
739 rdev->prev = prev;
741 prev->rswitch->nextdev[prev_port] = rdev;
745 if (rio_is_switch(rdev)) {
747 rdev->destid = destid;
751 rio_name(rdev), rdev->vid, rdev->did,
752 RIO_GET_TOTAL_PORTS(rdev->swpinfo));
754 port_num < RIO_GET_TOTAL_PORTS(rdev->swpinfo);
756 if (RIO_GET_PORT_NUM(rdev->swpinfo) == port_num)
759 if (rio_sport_is_active(rdev, port_num)) {
769 rio_route_get_entry(rdev,
781 hopcount + 1, rdev, port_num) < 0)
787 rio_name(rdev), rdev->vid, rdev->did);
890 struct rio_dev *rdev, *swrdev;
895 list_for_each_entry(rdev, &net->devices, net_list) {
897 destid = rdev->destid;
901 if (rio_is_switch(rdev) && (rdev->rswitch == rswitch))
923 * @rdev: RIO device
928 static void rio_init_em(struct rio_dev *rdev)
930 if (rio_is_switch(rdev) && (rdev->em_efptr) &&
931 rdev->rswitch->ops && rdev->rswitch->ops->em_init) {
932 rdev->rswitch->ops->em_init(rdev);
1027 struct rio_dev *rdev;
1032 rdev = sw_to_rio_dev(rswitch);
1034 rio_lock_device(net->hport, rdev->destid,
1035 rdev->hopcount, 1000);
1039 if (rio_route_get_entry(rdev, RIO_GLOBAL_TABLE,
1045 rio_unlock_device(net->hport, rdev->destid, rdev->hopcount);