Lines Matching refs:rdev
78 int rio_add_device(struct rio_dev *rdev) in rio_add_device() argument
82 err = device_add(&rdev->dev); in rio_add_device()
87 list_add_tail(&rdev->global_list, &rio_devices); in rio_add_device()
90 rio_create_sysfs_dev_files(rdev); in rio_add_device()
360 struct resource *rio_request_outb_dbell(struct rio_dev *rdev, u16 start, in rio_request_outb_dbell() argument
369 if (request_resource(&rdev->riores[RIO_DOORBELL_RESOURCE], res) in rio_request_outb_dbell()
387 int rio_release_outb_dbell(struct rio_dev *rdev, struct resource *res) in rio_release_outb_dbell() argument
404 int rio_request_inb_pwrite(struct rio_dev *rdev, in rio_request_inb_pwrite() argument
405 int (*pwcback)(struct rio_dev *rdev, union rio_pw_msg *msg, int step)) in rio_request_inb_pwrite() argument
410 if (rdev->pwcback != NULL) in rio_request_inb_pwrite()
413 rdev->pwcback = pwcback; in rio_request_inb_pwrite()
427 int rio_release_inb_pwrite(struct rio_dev *rdev) in rio_release_inb_pwrite() argument
432 if (rdev->pwcback) { in rio_release_inb_pwrite()
433 rdev->pwcback = NULL; in rio_release_inb_pwrite()
550 struct rio_dev *rdev; in rio_get_comptag() local
556 rdev = rio_dev_g(n); in rio_get_comptag()
557 if (rdev->comp_tag == comp_tag) in rio_get_comptag()
561 rdev = NULL; in rio_get_comptag()
564 return rdev; in rio_get_comptag()
574 int rio_set_port_lockout(struct rio_dev *rdev, u32 pnum, int lock) in rio_set_port_lockout() argument
578 rio_read_config_32(rdev, in rio_set_port_lockout()
579 rdev->phys_efptr + RIO_PORT_N_CTL_CSR(pnum), in rio_set_port_lockout()
586 rio_write_config_32(rdev, in rio_set_port_lockout()
587 rdev->phys_efptr + RIO_PORT_N_CTL_CSR(pnum), in rio_set_port_lockout()
665 rio_chk_dev_route(struct rio_dev *rdev, struct rio_dev **nrdev, int *npnum) in rio_chk_dev_route() argument
672 while (rdev->prev && (rdev->prev->pef & RIO_PEF_SWITCH)) { in rio_chk_dev_route()
673 if (!rio_read_config_32(rdev->prev, RIO_DEV_ID_CAR, &result)) { in rio_chk_dev_route()
674 prev = rdev->prev; in rio_chk_dev_route()
677 rdev = rdev->prev; in rio_chk_dev_route()
683 p_port = prev->rswitch->route_table[rdev->destid]; in rio_chk_dev_route()
692 pr_debug("RIO: failed to trace route to %s\n", rio_name(rdev)); in rio_chk_dev_route()
725 static int rio_chk_dev_access(struct rio_dev *rdev) in rio_chk_dev_access() argument
727 return rio_mport_chk_dev_access(rdev->net->hport, in rio_chk_dev_access()
728 rdev->destid, rdev->hopcount); in rio_chk_dev_access()
739 rio_get_input_status(struct rio_dev *rdev, int pnum, u32 *lnkresp) in rio_get_input_status() argument
747 rio_read_config_32(rdev, in rio_get_input_status()
748 rdev->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(pnum), in rio_get_input_status()
754 rio_write_config_32(rdev, in rio_get_input_status()
755 rdev->phys_efptr + RIO_PORT_N_MNT_REQ_CSR(pnum), in rio_get_input_status()
765 rio_read_config_32(rdev, in rio_get_input_status()
766 rdev->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(pnum), in rio_get_input_status()
783 static int rio_clr_err_stopped(struct rio_dev *rdev, u32 pnum, u32 err_status) in rio_clr_err_stopped() argument
785 struct rio_dev *nextdev = rdev->rswitch->nextdev[pnum]; in rio_clr_err_stopped()
790 rio_read_config_32(rdev, in rio_clr_err_stopped()
791 rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(pnum), in rio_clr_err_stopped()
799 if (rio_get_input_status(rdev, pnum, ®val)) { in rio_clr_err_stopped()
808 rio_read_config_32(rdev, in rio_clr_err_stopped()
809 rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(pnum), in rio_clr_err_stopped()
826 rio_write_config_32(rdev, in rio_clr_err_stopped()
827 rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(pnum), in rio_clr_err_stopped()
844 rio_read_config_32(rdev, in rio_clr_err_stopped()
845 rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(pnum), in rio_clr_err_stopped()
856 rio_read_config_32(rdev, in rio_clr_err_stopped()
857 rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(pnum), in rio_clr_err_stopped()
875 struct rio_dev *rdev; in rio_inb_pwrite_handler() local
879 rdev = rio_get_comptag((pw_msg->em.comptag & RIO_CTAG_UDEVID), NULL); in rio_inb_pwrite_handler()
880 if (rdev == NULL) { in rio_inb_pwrite_handler()
887 pr_debug("RIO: Port-Write message from %s\n", rio_name(rdev)); in rio_inb_pwrite_handler()
907 if (rdev->pwcback != NULL) { in rio_inb_pwrite_handler()
908 rc = rdev->pwcback(rdev, pw_msg, 0); in rio_inb_pwrite_handler()
919 if (rio_chk_dev_access(rdev)) { in rio_inb_pwrite_handler()
925 if (rio_chk_dev_route(rdev, &rdev, &portnum)) { in rio_inb_pwrite_handler()
927 rio_name(rdev)); in rio_inb_pwrite_handler()
934 if (!(rdev->pef & RIO_PEF_SWITCH)) in rio_inb_pwrite_handler()
937 if (rdev->phys_efptr == 0) { in rio_inb_pwrite_handler()
939 rio_name(rdev)); in rio_inb_pwrite_handler()
946 if (rdev->rswitch->ops && rdev->rswitch->ops->em_handle) in rio_inb_pwrite_handler()
947 rdev->rswitch->ops->em_handle(rdev, portnum); in rio_inb_pwrite_handler()
949 rio_read_config_32(rdev, in rio_inb_pwrite_handler()
950 rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(portnum), in rio_inb_pwrite_handler()
956 if (!(rdev->rswitch->port_ok & (1 << portnum))) { in rio_inb_pwrite_handler()
957 rdev->rswitch->port_ok |= (1 << portnum); in rio_inb_pwrite_handler()
958 rio_set_port_lockout(rdev, portnum, 0); in rio_inb_pwrite_handler()
961 rio_name(rdev), portnum); in rio_inb_pwrite_handler()
970 if (rio_clr_err_stopped(rdev, portnum, err_status)) in rio_inb_pwrite_handler()
971 rio_clr_err_stopped(rdev, portnum, 0); in rio_inb_pwrite_handler()
975 if (rdev->rswitch->port_ok & (1 << portnum)) { in rio_inb_pwrite_handler()
976 rdev->rswitch->port_ok &= ~(1 << portnum); in rio_inb_pwrite_handler()
977 rio_set_port_lockout(rdev, portnum, 1); in rio_inb_pwrite_handler()
979 rio_write_config_32(rdev, in rio_inb_pwrite_handler()
980 rdev->phys_efptr + in rio_inb_pwrite_handler()
986 rio_name(rdev), portnum); in rio_inb_pwrite_handler()
990 rio_read_config_32(rdev, in rio_inb_pwrite_handler()
991 rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum), &em_perrdet); in rio_inb_pwrite_handler()
996 rio_write_config_32(rdev, in rio_inb_pwrite_handler()
997 rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum), 0); in rio_inb_pwrite_handler()
1000 rio_read_config_32(rdev, in rio_inb_pwrite_handler()
1001 rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, &em_ltlerrdet); in rio_inb_pwrite_handler()
1006 rio_write_config_32(rdev, in rio_inb_pwrite_handler()
1007 rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, 0); in rio_inb_pwrite_handler()
1011 rio_write_config_32(rdev, in rio_inb_pwrite_handler()
1012 rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(portnum), in rio_inb_pwrite_handler()
1131 struct rio_dev *rdev; in rio_get_asm() local
1138 rdev = rio_dev_g(n); in rio_get_asm()
1139 if ((vid == RIO_ANY_ID || rdev->vid == vid) && in rio_get_asm()
1140 (did == RIO_ANY_ID || rdev->did == did) && in rio_get_asm()
1141 (asm_vid == RIO_ANY_ID || rdev->asm_vid == asm_vid) && in rio_get_asm()
1142 (asm_did == RIO_ANY_ID || rdev->asm_did == asm_did)) in rio_get_asm()
1146 rdev = NULL; in rio_get_asm()
1149 rdev = rio_dev_get(rdev); in rio_get_asm()
1151 return rdev; in rio_get_asm()
1372 int rio_route_add_entry(struct rio_dev *rdev, in rio_route_add_entry() argument
1376 struct rio_switch_ops *ops = rdev->rswitch->ops; in rio_route_add_entry()
1379 rc = rio_lock_device(rdev->net->hport, rdev->destid, in rio_route_add_entry()
1380 rdev->hopcount, 1000); in rio_route_add_entry()
1385 spin_lock(&rdev->rswitch->lock); in rio_route_add_entry()
1388 rc = rio_std_route_add_entry(rdev->net->hport, rdev->destid, in rio_route_add_entry()
1389 rdev->hopcount, table, in rio_route_add_entry()
1392 rc = ops->add_entry(rdev->net->hport, rdev->destid, in rio_route_add_entry()
1393 rdev->hopcount, table, route_destid, in rio_route_add_entry()
1398 spin_unlock(&rdev->rswitch->lock); in rio_route_add_entry()
1401 rio_unlock_device(rdev->net->hport, rdev->destid, in rio_route_add_entry()
1402 rdev->hopcount); in rio_route_add_entry()
1425 int rio_route_get_entry(struct rio_dev *rdev, u16 table, in rio_route_get_entry() argument
1429 struct rio_switch_ops *ops = rdev->rswitch->ops; in rio_route_get_entry()
1432 rc = rio_lock_device(rdev->net->hport, rdev->destid, in rio_route_get_entry()
1433 rdev->hopcount, 1000); in rio_route_get_entry()
1438 spin_lock(&rdev->rswitch->lock); in rio_route_get_entry()
1441 rc = rio_std_route_get_entry(rdev->net->hport, rdev->destid, in rio_route_get_entry()
1442 rdev->hopcount, table, in rio_route_get_entry()
1445 rc = ops->get_entry(rdev->net->hport, rdev->destid, in rio_route_get_entry()
1446 rdev->hopcount, table, route_destid, in rio_route_get_entry()
1451 spin_unlock(&rdev->rswitch->lock); in rio_route_get_entry()
1454 rio_unlock_device(rdev->net->hport, rdev->destid, in rio_route_get_entry()
1455 rdev->hopcount); in rio_route_get_entry()
1474 int rio_route_clr_table(struct rio_dev *rdev, u16 table, int lock) in rio_route_clr_table() argument
1477 struct rio_switch_ops *ops = rdev->rswitch->ops; in rio_route_clr_table()
1480 rc = rio_lock_device(rdev->net->hport, rdev->destid, in rio_route_clr_table()
1481 rdev->hopcount, 1000); in rio_route_clr_table()
1486 spin_lock(&rdev->rswitch->lock); in rio_route_clr_table()
1489 rc = rio_std_route_clr_table(rdev->net->hport, rdev->destid, in rio_route_clr_table()
1490 rdev->hopcount, table); in rio_route_clr_table()
1492 rc = ops->clr_table(rdev->net->hport, rdev->destid, in rio_route_clr_table()
1493 rdev->hopcount, table); in rio_route_clr_table()
1498 spin_unlock(&rdev->rswitch->lock); in rio_route_clr_table()
1501 rio_unlock_device(rdev->net->hport, rdev->destid, in rio_route_clr_table()
1502 rdev->hopcount); in rio_route_clr_table()
1542 struct dma_chan *rio_request_dma(struct rio_dev *rdev) in rio_request_dma() argument
1544 return rio_request_mport_dma(rdev->net->hport); in rio_request_dma()
1607 struct dma_async_tx_descriptor *rio_dma_prep_slave_sg(struct rio_dev *rdev, in rio_dma_prep_slave_sg() argument
1611 return rio_dma_prep_xfer(dchan, rdev->destid, data, direction, flags); in rio_dma_prep_slave_sg()