Lines Matching refs:rdev

40 static void rio_init_em(struct rio_dev *rdev);
213 struct rio_dev *rdev;
227 list_for_each_entry(rdev, &net->devices, net_list) {
228 rio_write_config_32(rdev, RIO_HOST_DID_LOCK_CSR,
230 rio_read_config_32(rdev, RIO_HOST_DID_LOCK_CSR, &result);
234 rdev->vid, rdev->did);
239 rio_read_config_32(rdev,
240 rdev->phys_efptr + RIO_PORT_GEN_CTL_CSR,
243 rio_write_config_32(rdev,
244 rdev->phys_efptr + RIO_PORT_GEN_CTL_CSR,
303 struct rio_dev *rdev;
305 rdev = to_rio_dev(dev);
306 kfree(rdev);
311 * @rdev: RIO device
318 static int rio_is_switch(struct rio_dev *rdev)
320 if (rdev->pef & RIO_PEF_SWITCH)
346 struct rio_dev *rdev;
366 rdev = kzalloc(size, GFP_KERNEL);
367 if (!rdev)
370 rdev->net = net;
371 rdev->pef = result;
372 rdev->swpinfo = swpinfo;
375 rdev->did = result >> 16;
376 rdev->vid = result & 0xffff;
378 &rdev->device_rev);
381 rdev->asm_did = result >> 16;
382 rdev->asm_vid = result & 0xffff;
385 rdev->asm_rev = result >> 16;
386 if (rdev->pef & RIO_PEF_EXT_FEATURES) {
387 rdev->efptr = result & 0xffff;
388 rdev->phys_efptr = rio_mport_get_physefb(port, 0, destid,
391 rdev->em_efptr = rio_mport_get_feature(port, 0, destid,
396 &rdev->src_ops);
398 &rdev->dst_ops);
408 rdev->comp_tag = next_comptag++;
409 rdev->do_enum = true;
413 &rdev->comp_tag);
416 if (rio_device_has_destid(port, rdev->src_ops, rdev->dst_ops)) {
419 rdev->destid = next_destid;
422 rdev->destid = rio_get_device_id(port, destid, hopcount);
424 rdev->hopcount = 0xff;
429 rdev->destid = destid;
430 rdev->hopcount = hopcount;
434 if (rio_is_switch(rdev)) {
435 rswitch = rdev->rswitch;
447 dev_set_name(&rdev->dev, "%02x:s:%04x", rdev->net->id,
448 rdev->comp_tag & RIO_CTAG_UDEVID);
451 rio_route_clr_table(rdev, RIO_GLOBAL_TABLE, 0);
460 dev_set_name(&rdev->dev, "%02x:e:%04x", rdev->net->id,
461 rdev->comp_tag & RIO_CTAG_UDEVID);
464 rdev->dev.parent = &port->dev;
465 rio_attach_device(rdev);
467 device_initialize(&rdev->dev);
468 rdev->dev.release = rio_release_dev;
469 rio_dev_get(rdev);
471 rdev->dma_mask = DMA_BIT_MASK(32);
472 rdev->dev.dma_mask = &rdev->dma_mask;
473 rdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
475 if (rdev->dst_ops & RIO_DST_OPS_DOORBELL)
476 rio_init_dbell_res(&rdev->riores[RIO_DOORBELL_RESOURCE],
479 ret = rio_add_device(rdev);
483 return rdev;
489 kfree(rdev);
567 struct rio_dev *rdev;
587 rdev = rio_get_comptag((regval & 0xffff), NULL);
589 if (rdev && prev && rio_is_switch(prev)) {
591 rio_name(rdev));
592 prev->rswitch->nextdev[prev_port] = rdev;
621 rdev = rio_setup_device(net, port, RIO_ANY_DESTID(port->sys_size),
623 if (rdev) {
625 list_add_tail(&rdev->net_list, &net->devices);
626 rdev->prev = prev;
628 prev->rswitch->nextdev[prev_port] = rdev;
632 if (rio_is_switch(rdev)) {
639 sw_inport = RIO_GET_PORT_NUM(rdev->swpinfo);
640 rio_route_add_entry(rdev, RIO_GLOBAL_TABLE,
642 rdev->rswitch->route_table[port->host_deviceid] = sw_inport;
647 rio_route_add_entry(rdev, RIO_GLOBAL_TABLE,
649 rdev->rswitch->route_table[destid] = sw_inport;
655 rio_name(rdev), rdev->vid, rdev->did,
656 RIO_GET_TOTAL_PORTS(rdev->swpinfo));
659 port_num < RIO_GET_TOTAL_PORTS(rdev->swpinfo);
665 rdev->rswitch->port_ok |= (1 << port_num);
680 rdev->rswitch->port_ok |= (1 << port_num);
681 rio_route_add_entry(rdev, RIO_GLOBAL_TABLE,
686 rdev, port_num) < 0)
695 rio_route_add_entry(rdev,
700 rdev->rswitch->
712 if (rdev->em_efptr)
713 rio_set_port_lockout(rdev, port_num, 1);
715 rdev->rswitch->port_ok &= ~(1 << port_num);
720 if ((rdev->src_ops & RIO_SRC_OPS_PORT_WRITE) &&
721 (rdev->em_efptr)) {
722 rio_write_config_32(rdev,
723 rdev->em_efptr + RIO_EM_PW_TGT_DEVID,
728 rio_init_em(rdev);
734 rdev->destid = sw_destid;
737 rio_name(rdev), rdev->vid, rdev->did);
776 struct rio_dev *rdev;
780 if ((rdev = rio_setup_device(net, port, destid, hopcount, 0))) {
782 list_add_tail(&rdev->net_list, &net->devices);
783 rdev->prev = prev;
785 prev->rswitch->nextdev[prev_port] = rdev;
789 if (rio_is_switch(rdev)) {
791 rdev->destid = destid;
795 rio_name(rdev), rdev->vid, rdev->did,
796 RIO_GET_TOTAL_PORTS(rdev->swpinfo));
798 port_num < RIO_GET_TOTAL_PORTS(rdev->swpinfo);
800 if (RIO_GET_PORT_NUM(rdev->swpinfo) == port_num)
814 rio_route_get_entry(rdev,
826 hopcount + 1, rdev, port_num) < 0)
832 rio_name(rdev), rdev->vid, rdev->did);
924 struct rio_dev *rdev, *swrdev;
929 list_for_each_entry(rdev, &net->devices, net_list) {
931 destid = rdev->destid;
935 if (rio_is_switch(rdev) && (rdev->rswitch == rswitch))
957 * @rdev: RIO device
962 static void rio_init_em(struct rio_dev *rdev)
964 if (rio_is_switch(rdev) && (rdev->em_efptr) &&
965 rdev->rswitch->ops && rdev->rswitch->ops->em_init) {
966 rdev->rswitch->ops->em_init(rdev);
1072 struct rio_dev *rdev;
1077 rdev = sw_to_rio_dev(rswitch);
1079 rio_lock_device(net->hport, rdev->destid,
1080 rdev->hopcount, 1000);
1084 if (rio_route_get_entry(rdev, RIO_GLOBAL_TABLE,
1090 rio_unlock_device(net->hport, rdev->destid, rdev->hopcount);