Lines Matching defs:rdev
166 * @rdev: RIO device
172 int rio_add_device(struct rio_dev *rdev)
176 atomic_set(&rdev->state, RIO_DEVICE_RUNNING);
177 err = device_register(&rdev->dev);
182 list_add_tail(&rdev->global_list, &rio_devices);
183 if (rdev->net) {
184 list_add_tail(&rdev->net_list, &rdev->net->devices);
185 if (rdev->pef & RIO_PEF_SWITCH)
186 list_add_tail(&rdev->rswitch->node,
187 &rdev->net->switches);
197 * @rdev: RIO device
203 void rio_del_device(struct rio_dev *rdev, enum rio_device_state state)
205 pr_debug("RIO: %s: removing %s\n", __func__, rio_name(rdev));
206 atomic_set(&rdev->state, state);
208 list_del(&rdev->global_list);
209 if (rdev->net) {
210 list_del(&rdev->net_list);
211 if (rdev->pef & RIO_PEF_SWITCH) {
212 list_del(&rdev->rswitch->node);
213 kfree(rdev->rswitch->route_table);
217 device_unregister(&rdev->dev);
508 * @rdev: RIO device from which to allocate the doorbell resource
515 struct resource *rio_request_outb_dbell(struct rio_dev *rdev, u16 start,
524 if (request_resource(&rdev->riores[RIO_DOORBELL_RESOURCE], res)
537 * @rdev: RIO device from which to release the doorbell resource
543 int rio_release_outb_dbell(struct rio_dev *rdev, struct resource *res)
614 * @rdev: RIO device to which register inbound port-write callback routine
620 int rio_request_inb_pwrite(struct rio_dev *rdev,
621 int (*pwcback)(struct rio_dev *rdev, union rio_pw_msg *msg, int step))
626 if (rdev->pwcback)
629 rdev->pwcback = pwcback;
639 * @rdev: RIO device which registered for inbound port-write callback
644 int rio_release_inb_pwrite(struct rio_dev *rdev)
649 if (rdev->pwcback) {
650 rdev->pwcback = NULL;
843 struct rio_dev *rdev;
849 rdev = rio_dev_g(n);
850 if (rdev->comp_tag == comp_tag)
854 rdev = NULL;
857 return rdev;
863 * @rdev: Pointer to RIO device control structure
867 int rio_set_port_lockout(struct rio_dev *rdev, u32 pnum, int lock)
871 rio_read_config_32(rdev,
872 RIO_DEV_PORT_N_CTL_CSR(rdev, pnum),
879 rio_write_config_32(rdev,
880 RIO_DEV_PORT_N_CTL_CSR(rdev, pnum),
946 * @rdev: RIO device failed to respond
947 * @nrdev: Last active device on the route to rdev
948 * @npnum: nrdev's port number on the route to rdev
954 rio_chk_dev_route(struct rio_dev *rdev, struct rio_dev **nrdev, int *npnum)
961 while (rdev->prev && (rdev->prev->pef & RIO_PEF_SWITCH)) {
962 if (!rio_read_config_32(rdev->prev, RIO_DEV_ID_CAR, &result)) {
963 prev = rdev->prev;
966 rdev = rdev->prev;
972 p_port = prev->rswitch->route_table[rdev->destid];
981 pr_debug("RIO: failed to trace route to %s\n", rio_name(rdev));
1012 * @rdev: Pointer to RIO device control structure
1014 static int rio_chk_dev_access(struct rio_dev *rdev)
1016 return rio_mport_chk_dev_access(rdev->net->hport,
1017 rdev->destid, rdev->hopcount);
1023 * @rdev: RIO devive to issue Input-status command
1028 rio_get_input_status(struct rio_dev *rdev, int pnum, u32 *lnkresp)
1036 rio_read_config_32(rdev,
1037 RIO_DEV_PORT_N_MNT_RSP_CSR(rdev, pnum),
1043 rio_write_config_32(rdev,
1044 RIO_DEV_PORT_N_MNT_REQ_CSR(rdev, pnum),
1054 rio_read_config_32(rdev,
1055 RIO_DEV_PORT_N_MNT_RSP_CSR(rdev, pnum),
1068 * @rdev: Pointer to RIO device control structure
1079 static int rio_clr_err_stopped(struct rio_dev *rdev, u32 pnum, u32 err_status)
1081 struct rio_dev *nextdev = rdev->rswitch->nextdev[pnum];
1086 rio_read_config_32(rdev,
1087 RIO_DEV_PORT_N_ERR_STS_CSR(rdev, pnum),
1095 if (rio_get_input_status(rdev, pnum, ®val)) {
1104 rio_read_config_32(rdev,
1105 RIO_DEV_PORT_N_ACK_STS_CSR(rdev, pnum),
1122 rio_write_config_32(rdev,
1123 RIO_DEV_PORT_N_ACK_STS_CSR(rdev, pnum),
1142 rio_read_config_32(rdev, RIO_DEV_PORT_N_ERR_STS_CSR(rdev, pnum),
1153 rio_read_config_32(rdev, RIO_DEV_PORT_N_ERR_STS_CSR(rdev, pnum),
1172 struct rio_dev *rdev;
1190 rdev = rio_get_comptag((pw_msg->em.comptag & RIO_CTAG_UDEVID), NULL);
1191 if (rdev) {
1192 pr_debug("RIO: Port-Write message from %s\n", rio_name(rdev));
1204 if (rdev && rdev->pwcback) {
1205 rc = rdev->pwcback(rdev, pw_msg, 0);
1215 if (!rdev)
1229 if (rio_chk_dev_access(rdev)) {
1235 if (rio_chk_dev_route(rdev, &rdev, &portnum)) {
1237 rio_name(rdev));
1244 if (!(rdev->pef & RIO_PEF_SWITCH))
1247 if (rdev->phys_efptr == 0) {
1249 rio_name(rdev));
1256 if (rdev->rswitch->ops && rdev->rswitch->ops->em_handle)
1257 rdev->rswitch->ops->em_handle(rdev, portnum);
1259 rio_read_config_32(rdev, RIO_DEV_PORT_N_ERR_STS_CSR(rdev, portnum),
1265 if (!(rdev->rswitch->port_ok & (1 << portnum))) {
1266 rdev->rswitch->port_ok |= (1 << portnum);
1267 rio_set_port_lockout(rdev, portnum, 0);
1270 rio_name(rdev), portnum);
1279 if (rio_clr_err_stopped(rdev, portnum, err_status))
1280 rio_clr_err_stopped(rdev, portnum, 0);
1284 if (rdev->rswitch->port_ok & (1 << portnum)) {
1285 rdev->rswitch->port_ok &= ~(1 << portnum);
1286 rio_set_port_lockout(rdev, portnum, 1);
1288 if (rdev->phys_rmap == 1) {
1289 rio_write_config_32(rdev,
1290 RIO_DEV_PORT_N_ACK_STS_CSR(rdev, portnum),
1293 rio_write_config_32(rdev,
1294 RIO_DEV_PORT_N_OB_ACK_CSR(rdev, portnum),
1296 rio_write_config_32(rdev,
1297 RIO_DEV_PORT_N_IB_ACK_CSR(rdev, portnum),
1303 rio_name(rdev), portnum);
1307 rio_read_config_32(rdev,
1308 rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum), &em_perrdet);
1313 rio_write_config_32(rdev,
1314 rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum), 0);
1317 rio_read_config_32(rdev,
1318 rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, &em_ltlerrdet);
1323 rio_write_config_32(rdev,
1324 rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, 0);
1328 rio_write_config_32(rdev, RIO_DEV_PORT_N_ERR_STS_CSR(rdev, portnum),
1436 struct rio_dev *rdev;
1443 rdev = rio_dev_g(n);
1444 if ((vid == RIO_ANY_ID || rdev->vid == vid) &&
1445 (did == RIO_ANY_ID || rdev->did == did) &&
1446 (asm_vid == RIO_ANY_ID || rdev->asm_vid == asm_vid) &&
1447 (asm_did == RIO_ANY_ID || rdev->asm_did == asm_did))
1451 rdev = NULL;
1454 rdev = rio_dev_get(rdev);
1456 return rdev;
1664 * @rdev: RIO device
1679 int rio_route_add_entry(struct rio_dev *rdev,
1683 struct rio_switch_ops *ops = rdev->rswitch->ops;
1686 rc = rio_lock_device(rdev->net->hport, rdev->destid,
1687 rdev->hopcount, 1000);
1692 spin_lock(&rdev->rswitch->lock);
1695 rc = rio_std_route_add_entry(rdev->net->hport, rdev->destid,
1696 rdev->hopcount, table,
1699 rc = ops->add_entry(rdev->net->hport, rdev->destid,
1700 rdev->hopcount, table, route_destid,
1705 spin_unlock(&rdev->rswitch->lock);
1708 rio_unlock_device(rdev->net->hport, rdev->destid,
1709 rdev->hopcount);
1717 * @rdev: RIO device
1732 int rio_route_get_entry(struct rio_dev *rdev, u16 table,
1736 struct rio_switch_ops *ops = rdev->rswitch->ops;
1739 rc = rio_lock_device(rdev->net->hport, rdev->destid,
1740 rdev->hopcount, 1000);
1745 spin_lock(&rdev->rswitch->lock);
1748 rc = rio_std_route_get_entry(rdev->net->hport, rdev->destid,
1749 rdev->hopcount, table,
1752 rc = ops->get_entry(rdev->net->hport, rdev->destid,
1753 rdev->hopcount, table, route_destid,
1758 spin_unlock(&rdev->rswitch->lock);
1761 rio_unlock_device(rdev->net->hport, rdev->destid,
1762 rdev->hopcount);
1769 * @rdev: RIO device
1781 int rio_route_clr_table(struct rio_dev *rdev, u16 table, int lock)
1784 struct rio_switch_ops *ops = rdev->rswitch->ops;
1787 rc = rio_lock_device(rdev->net->hport, rdev->destid,
1788 rdev->hopcount, 1000);
1793 spin_lock(&rdev->rswitch->lock);
1796 rc = rio_std_route_clr_table(rdev->net->hport, rdev->destid,
1797 rdev->hopcount, table);
1799 rc = ops->clr_table(rdev->net->hport, rdev->destid,
1800 rdev->hopcount, table);
1805 spin_unlock(&rdev->rswitch->lock);
1808 rio_unlock_device(rdev->net->hport, rdev->destid,
1809 rdev->hopcount);
1845 * @rdev: RIO device associated with DMA transfer
1849 struct dma_chan *rio_request_dma(struct rio_dev *rdev)
1851 return rio_request_mport_dma(rdev->net->hport);
1905 * @rdev: RIO device control structure
1918 struct dma_async_tx_descriptor *rio_dma_prep_slave_sg(struct rio_dev *rdev,
1922 return rio_dma_prep_xfer(dchan, rdev->destid, data, direction, flags);
2287 struct rio_dev *rdev = to_rio_dev(dev);
2290 rio_del_device(rdev, RIO_DEVICE_SHUTDOWN);