Lines Matching +full:function +full:- +full:enumerator
8 * Copyright 2009 - 2013 Integrated Device Technology, Inc.
34 * struct rio_pwrite - RIO portwrite event
69 * rio_local_get_device_id - Get the base/extended device id for a port
73 * implementing the master port. Returns the 8/16-bit device
82 return (RIO_GET_DID(port->sys_size, result)); in rio_local_get_device_id()
87 * rio_query_mport - Query mport device attributes
97 if (!port->ops->query_mport) in rio_query_mport()
98 return -ENODATA; in rio_query_mport()
99 return port->ops->query_mport(port, mport_attr); in rio_query_mport()
104 * rio_alloc_net- Allocate and initialize a new RIO network data structure
107 * Allocates a RIO network structure, initializes per-network
117 INIT_LIST_HEAD(&net->node); in rio_alloc_net()
118 INIT_LIST_HEAD(&net->devices); in rio_alloc_net()
119 INIT_LIST_HEAD(&net->switches); in rio_alloc_net()
120 INIT_LIST_HEAD(&net->mports); in rio_alloc_net()
121 mport->net = net; in rio_alloc_net()
131 err = device_register(&net->dev); in rio_add_net()
135 list_add_tail(&net->node, &rio_nets); in rio_add_net()
145 if (!list_empty(&net->node)) in rio_free_net()
146 list_del(&net->node); in rio_free_net()
148 if (net->release) in rio_free_net()
149 net->release(net); in rio_free_net()
150 device_unregister(&net->dev); in rio_free_net()
155 * rio_local_set_device_id - Set the base/extended device id for a port
164 RIO_SET_DID(port->sys_size, did)); in rio_local_set_device_id()
169 * rio_add_device- Adds a RIO device to the device model
180 atomic_set(&rdev->state, RIO_DEVICE_RUNNING); in rio_add_device()
181 err = device_register(&rdev->dev); in rio_add_device()
186 list_add_tail(&rdev->global_list, &rio_devices); in rio_add_device()
187 if (rdev->net) { in rio_add_device()
188 list_add_tail(&rdev->net_list, &rdev->net->devices); in rio_add_device()
189 if (rdev->pef & RIO_PEF_SWITCH) in rio_add_device()
190 list_add_tail(&rdev->rswitch->node, in rio_add_device()
191 &rdev->net->switches); in rio_add_device()
200 * rio_del_device - removes a RIO device from the device model
210 atomic_set(&rdev->state, state); in rio_del_device()
212 list_del(&rdev->global_list); in rio_del_device()
213 if (rdev->net) { in rio_del_device()
214 list_del(&rdev->net_list); in rio_del_device()
215 if (rdev->pef & RIO_PEF_SWITCH) { in rio_del_device()
216 list_del(&rdev->rswitch->node); in rio_del_device()
217 kfree(rdev->rswitch->route_table); in rio_del_device()
221 device_unregister(&rdev->dev); in rio_del_device()
226 * rio_request_inb_mbox - request inbound mailbox service
234 * a callback function to the resource. Returns %0 on success.
243 int rc = -ENOSYS; in rio_request_inb_mbox()
246 if (!mport->ops->open_inb_mbox) in rio_request_inb_mbox()
254 rc = request_resource(&mport->riores[RIO_INB_MBOX_RESOURCE], in rio_request_inb_mbox()
261 mport->inb_msg[mbox].res = res; in rio_request_inb_mbox()
264 mport->inb_msg[mbox].mcback = minb; in rio_request_inb_mbox()
266 rc = mport->ops->open_inb_mbox(mport, dev_id, mbox, entries); in rio_request_inb_mbox()
268 mport->inb_msg[mbox].mcback = NULL; in rio_request_inb_mbox()
269 mport->inb_msg[mbox].res = NULL; in rio_request_inb_mbox()
274 rc = -ENOMEM; in rio_request_inb_mbox()
282 * rio_release_inb_mbox - release inbound mailbox message service
293 if (!mport->ops->close_inb_mbox || !mport->inb_msg[mbox].res) in rio_release_inb_mbox()
294 return -EINVAL; in rio_release_inb_mbox()
296 mport->ops->close_inb_mbox(mport, mbox); in rio_release_inb_mbox()
297 mport->inb_msg[mbox].mcback = NULL; in rio_release_inb_mbox()
299 rc = release_resource(mport->inb_msg[mbox].res); in rio_release_inb_mbox()
303 kfree(mport->inb_msg[mbox].res); in rio_release_inb_mbox()
304 mport->inb_msg[mbox].res = NULL; in rio_release_inb_mbox()
311 * rio_request_outb_mbox - request outbound mailbox service
319 * a callback function to the resource. Returns 0 on success.
327 int rc = -ENOSYS; in rio_request_outb_mbox()
330 if (!mport->ops->open_outb_mbox) in rio_request_outb_mbox()
338 rc = request_resource(&mport->riores[RIO_OUTB_MBOX_RESOURCE], in rio_request_outb_mbox()
345 mport->outb_msg[mbox].res = res; in rio_request_outb_mbox()
348 mport->outb_msg[mbox].mcback = moutb; in rio_request_outb_mbox()
350 rc = mport->ops->open_outb_mbox(mport, dev_id, mbox, entries); in rio_request_outb_mbox()
352 mport->outb_msg[mbox].mcback = NULL; in rio_request_outb_mbox()
353 mport->outb_msg[mbox].res = NULL; in rio_request_outb_mbox()
358 rc = -ENOMEM; in rio_request_outb_mbox()
366 * rio_release_outb_mbox - release outbound mailbox message service
377 if (!mport->ops->close_outb_mbox || !mport->outb_msg[mbox].res) in rio_release_outb_mbox()
378 return -EINVAL; in rio_release_outb_mbox()
380 mport->ops->close_outb_mbox(mport, mbox); in rio_release_outb_mbox()
381 mport->outb_msg[mbox].mcback = NULL; in rio_release_outb_mbox()
383 rc = release_resource(mport->outb_msg[mbox].res); in rio_release_outb_mbox()
387 kfree(mport->outb_msg[mbox].res); in rio_release_outb_mbox()
388 mport->outb_msg[mbox].res = NULL; in rio_release_outb_mbox()
395 * rio_setup_inb_dbell - bind inbound doorbell callback
413 return -ENOMEM; in rio_setup_inb_dbell()
415 dbell->res = res; in rio_setup_inb_dbell()
416 dbell->dinb = dinb; in rio_setup_inb_dbell()
417 dbell->dev_id = dev_id; in rio_setup_inb_dbell()
419 mutex_lock(&mport->lock); in rio_setup_inb_dbell()
420 list_add_tail(&dbell->node, &mport->dbells); in rio_setup_inb_dbell()
421 mutex_unlock(&mport->lock); in rio_setup_inb_dbell()
426 * rio_request_inb_dbell - request inbound doorbell message service
434 * a callback function to the resource. Returns 0 if the request
451 rc = request_resource(&mport->riores[RIO_DOORBELL_RESOURCE], in rio_request_inb_dbell()
461 rc = -ENOMEM; in rio_request_inb_dbell()
469 * rio_release_inb_dbell - release inbound doorbell message service
483 mutex_lock(&mport->lock); in rio_release_inb_dbell()
484 list_for_each_entry(dbell, &mport->dbells, node) { in rio_release_inb_dbell()
485 if ((dbell->res->start == start) && (dbell->res->end == end)) { in rio_release_inb_dbell()
486 list_del(&dbell->node); in rio_release_inb_dbell()
491 mutex_unlock(&mport->lock); in rio_release_inb_dbell()
495 rc = -EINVAL; in rio_release_inb_dbell()
500 rc = release_resource(dbell->res); in rio_release_inb_dbell()
511 * rio_request_outb_dbell - request outbound doorbell message range
528 if (request_resource(&rdev->riores[RIO_DOORBELL_RESOURCE], res) in rio_request_outb_dbell()
540 * rio_release_outb_dbell - release outbound doorbell message range
558 * rio_add_mport_pw_handler - add port-write message handler into the list
573 return -ENOMEM; in rio_add_mport_pw_handler()
575 pwrite->pwcback = pwcback; in rio_add_mport_pw_handler()
576 pwrite->context = context; in rio_add_mport_pw_handler()
577 mutex_lock(&mport->lock); in rio_add_mport_pw_handler()
578 list_add_tail(&pwrite->node, &mport->pwrites); in rio_add_mport_pw_handler()
579 mutex_unlock(&mport->lock); in rio_add_mport_pw_handler()
585 * rio_del_mport_pw_handler - remove port-write message handler from the list
589 * @pwcback: Registered callback function
597 int rc = -EINVAL; in rio_del_mport_pw_handler()
600 mutex_lock(&mport->lock); in rio_del_mport_pw_handler()
601 list_for_each_entry(pwrite, &mport->pwrites, node) { in rio_del_mport_pw_handler()
602 if (pwrite->pwcback == pwcback && pwrite->context == context) { in rio_del_mport_pw_handler()
603 list_del(&pwrite->node); in rio_del_mport_pw_handler()
609 mutex_unlock(&mport->lock); in rio_del_mport_pw_handler()
616 * rio_request_inb_pwrite - request inbound port-write message service for
618 * @rdev: RIO device to which register inbound port-write callback routine
619 * @pwcback: Callback routine to execute when port-write is received
621 * Binds a port-write callback function to the RapidIO device.
630 if (rdev->pwcback) in rio_request_inb_pwrite()
631 rc = -ENOMEM; in rio_request_inb_pwrite()
633 rdev->pwcback = pwcback; in rio_request_inb_pwrite()
641 * rio_release_inb_pwrite - release inbound port-write message service
643 * @rdev: RIO device which registered for inbound port-write callback
650 int rc = -ENOMEM; in rio_release_inb_pwrite()
653 if (rdev->pwcback) { in rio_release_inb_pwrite()
654 rdev->pwcback = NULL; in rio_release_inb_pwrite()
664 * rio_pw_enable - Enables/disables port-write handling by a master port
665 * @mport: Master port associated with port-write handling
670 if (mport->ops->pwenable) { in rio_pw_enable()
671 mutex_lock(&mport->lock); in rio_pw_enable()
673 if ((enable && ++mport->pwe_refcnt == 1) || in rio_pw_enable()
674 (!enable && mport->pwe_refcnt && --mport->pwe_refcnt == 0)) in rio_pw_enable()
675 mport->ops->pwenable(mport, enable); in rio_pw_enable()
676 mutex_unlock(&mport->lock); in rio_pw_enable()
682 * rio_map_inb_region -- Map inbound memory region.
689 * Return: 0 -- Success.
691 * This function will create the mapping from RIO space to local memory.
699 if (!mport->ops->map_inb) in rio_map_inb_region()
700 return -1; in rio_map_inb_region()
702 rc = mport->ops->map_inb(mport, local, rbase, size, rflags); in rio_map_inb_region()
709 * rio_unmap_inb_region -- Unmap the inbound memory region
716 if (!mport->ops->unmap_inb) in rio_unmap_inb_region()
719 mport->ops->unmap_inb(mport, lstart); in rio_unmap_inb_region()
725 * rio_map_outb_region -- Map outbound memory region.
733 * Return: 0 -- Success.
735 * This function will create the mapping from RIO space to local memory.
743 if (!mport->ops->map_outb) in rio_map_outb_region()
744 return -ENODEV; in rio_map_outb_region()
747 rc = mport->ops->map_outb(mport, destid, rbase, size, in rio_map_outb_region()
756 * rio_unmap_inb_region -- Unmap the inbound memory region
765 if (!mport->ops->unmap_outb) in rio_unmap_outb_region()
769 mport->ops->unmap_outb(mport, destid, rstart); in rio_unmap_outb_region()
775 * rio_mport_get_physefb - Helper function that returns register offset
833 * rio_get_comptag - Begin or continue searching for a RIO device by component tag
850 n = from ? from->global_list.next : rio_devices.next; in rio_get_comptag()
854 if (rdev->comp_tag == comp_tag) in rio_get_comptag()
856 n = n->next; in rio_get_comptag()
866 * rio_set_port_lockout - Sets/clears LOCKOUT bit (RIO EM 1.3) for a switch port.
891 * rio_enable_rx_tx_port - enable input receiver and output transmitter of
897 * @port_num: Port (-number on switch) to enable on a far end device
928 return -EIO; in rio_enable_rx_tx_port()
940 return -EIO; in rio_enable_rx_tx_port()
949 * rio_chk_dev_route - Validate route to the specified device.
961 int p_port, rc = -EIO; in rio_chk_dev_route()
965 while (rdev->prev && (rdev->prev->pef & RIO_PEF_SWITCH)) { in rio_chk_dev_route()
966 if (!rio_read_config_32(rdev->prev, RIO_DEV_ID_CAR, &result)) { in rio_chk_dev_route()
967 prev = rdev->prev; in rio_chk_dev_route()
970 rdev = rdev->prev; in rio_chk_dev_route()
976 p_port = prev->rswitch->route_table[rdev->destid]; in rio_chk_dev_route()
979 pr_debug("RIO: link failed on [%s]-P%d\n", in rio_chk_dev_route()
991 * rio_mport_chk_dev_access - Validate access to the specified device.
1006 return -EIO; in rio_mport_chk_dev_access()
1015 * rio_chk_dev_access - Validate access to the specified device.
1020 return rio_mport_chk_dev_access(rdev->net->hport, in rio_chk_dev_access()
1021 rdev->destid, rdev->hopcount); in rio_chk_dev_access()
1025 * rio_get_input_status - Sends a Link-Request/Input-Status control symbol and
1026 * returns link-response (if requested).
1027 * @rdev: RIO devive to issue Input-status command
1046 /* Issue Input-status command */ in rio_get_input_status()
1056 while (checkcount--) { in rio_get_input_status()
1067 return -EIO; in rio_get_input_status()
1071 * rio_clr_err_stopped - Clears port Error-stopped states.
1080 * IDT gen3 switch driver now implements HW-specific error handler that
1085 struct rio_dev *nextdev = rdev->rswitch->nextdev[pnum]; in rio_clr_err_stopped()
1095 pr_debug("RIO_EM: servicing Output Error-Stopped state\n"); in rio_clr_err_stopped()
1097 * Send a Link-Request/Input-Status control symbol in rio_clr_err_stopped()
1100 pr_debug("RIO_EM: Input-status response timeout\n"); in rio_clr_err_stopped()
1104 pr_debug("RIO_EM: SP%d Input-status response=0x%08x\n", in rio_clr_err_stopped()
1141 RIO_GET_PORT_NUM(nextdev->swpinfo)), in rio_clr_err_stopped()
1152 pr_debug("RIO_EM: servicing Input Error-Stopped state\n"); in rio_clr_err_stopped()
1154 RIO_GET_PORT_NUM(nextdev->swpinfo), NULL); in rio_clr_err_stopped()
1167 * rio_inb_pwrite_handler - inbound port-write message handler
1168 * @mport: mport device associated with port-write
1169 * @pw_msg: pointer to inbound port-write message
1171 * Processes an inbound port-write message. Returns 0 if the request
1185 pr_debug("%s: PW to mport_%d:\n", __func__, mport->id); in rio_inb_pwrite_handler()
1188 i * 4, pw_msg->raw[i], pw_msg->raw[i + 1], in rio_inb_pwrite_handler()
1189 pw_msg->raw[i + 2], pw_msg->raw[i + 3]); in rio_inb_pwrite_handler()
1194 rdev = rio_get_comptag((pw_msg->em.comptag & RIO_CTAG_UDEVID), NULL); in rio_inb_pwrite_handler()
1196 pr_debug("RIO: Port-Write message from %s\n", rio_name(rdev)); in rio_inb_pwrite_handler()
1199 __func__, pw_msg->em.comptag); in rio_inb_pwrite_handler()
1202 /* Call a device-specific handler (if it is registered for the device). in rio_inb_pwrite_handler()
1203 * This may be the service for endpoints that send device-specific in rio_inb_pwrite_handler()
1204 * port-write messages. End-point messages expected to be handled in rio_inb_pwrite_handler()
1208 if (rdev && rdev->pwcback) { in rio_inb_pwrite_handler()
1209 rc = rdev->pwcback(rdev, pw_msg, 0); in rio_inb_pwrite_handler()
1214 mutex_lock(&mport->lock); in rio_inb_pwrite_handler()
1215 list_for_each_entry(pwrite, &mport->pwrites, node) in rio_inb_pwrite_handler()
1216 pwrite->pwcback(mport, pwrite->context, pw_msg, 0); in rio_inb_pwrite_handler()
1217 mutex_unlock(&mport->lock); in rio_inb_pwrite_handler()
1224 * how to do default PW handling in combination with per-mport callbacks in rio_inb_pwrite_handler()
1227 portnum = pw_msg->em.is_port & 0xFF; in rio_inb_pwrite_handler()
1234 pr_debug("RIO: device access failed - get link partner\n"); in rio_inb_pwrite_handler()
1242 return -EIO; in rio_inb_pwrite_handler()
1247 /* For End-point devices processing stops here */ in rio_inb_pwrite_handler()
1248 if (!(rdev->pef & RIO_PEF_SWITCH)) in rio_inb_pwrite_handler()
1251 if (rdev->phys_efptr == 0) { in rio_inb_pwrite_handler()
1258 * Process the port-write notification from switch in rio_inb_pwrite_handler()
1260 if (rdev->rswitch->ops && rdev->rswitch->ops->em_handle) in rio_inb_pwrite_handler()
1261 rdev->rswitch->ops->em_handle(rdev, portnum); in rio_inb_pwrite_handler()
1269 if (!(rdev->rswitch->port_ok & (1 << portnum))) { in rio_inb_pwrite_handler()
1270 rdev->rswitch->port_ok |= (1 << portnum); in rio_inb_pwrite_handler()
1273 pr_debug("RIO_PW: Device Insertion on [%s]-P%d\n", in rio_inb_pwrite_handler()
1277 /* Clear error-stopped states (if reported). in rio_inb_pwrite_handler()
1288 if (rdev->rswitch->port_ok & (1 << portnum)) { in rio_inb_pwrite_handler()
1289 rdev->rswitch->port_ok &= ~(1 << portnum); in rio_inb_pwrite_handler()
1292 if (rdev->phys_rmap == 1) { in rio_inb_pwrite_handler()
1306 pr_debug("RIO_PW: Device Extraction on [%s]-P%d\n", in rio_inb_pwrite_handler()
1312 rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum), &em_perrdet); in rio_inb_pwrite_handler()
1318 rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum), 0); in rio_inb_pwrite_handler()
1322 rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, &em_ltlerrdet); in rio_inb_pwrite_handler()
1328 rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, 0); in rio_inb_pwrite_handler()
1331 /* Clear remaining error bits and Port-Write Pending bit */ in rio_inb_pwrite_handler()
1340 * rio_mport_get_efb - get pointer to next extended features block
1374 * rio_mport_get_feature - query for devices' extended features
1420 * rio_get_asm - Begin or continue searching for a RIO device by vid/did/asm_vid/asm_did
1444 n = from ? from->global_list.next : rio_devices.next; in rio_get_asm()
1448 if ((vid == RIO_ANY_ID || rdev->vid == vid) && in rio_get_asm()
1449 (did == RIO_ANY_ID || rdev->did == did) && in rio_get_asm()
1450 (asm_vid == RIO_ANY_ID || rdev->asm_vid == asm_vid) && in rio_get_asm()
1451 (asm_did == RIO_ANY_ID || rdev->asm_did == asm_did)) in rio_get_asm()
1453 n = n->next; in rio_get_asm()
1465 * rio_get_device - Begin or continue searching for a RIO device by vid/did
1485 * rio_std_route_add_entry - Add switch route table entry using standard
1490 * @table: routing table ID (global or port-specific)
1512 * rio_std_route_get_entry - Read switch route table entry (port number)
1518 * @table: routing table ID (global or port-specific)
1541 * rio_std_route_clr_table - Clear swotch route table using standard registers
1546 * @table: routing table ID (global or port-specific)
1560 if (mport->sys_size) { in rio_std_route_clr_table()
1592 * rio_lock_device - Acquires host device lock for specified device
1609 RIO_HOST_DID_LOCK_CSR, port->host_deviceid); in rio_lock_device()
1613 while (result != port->host_deviceid) { in rio_lock_device()
1617 return -EINVAL; in rio_lock_device()
1627 port->host_deviceid); in rio_lock_device()
1638 * rio_unlock_device - Releases host device lock for specified device
1653 port->host_deviceid); in rio_unlock_device()
1659 return -EINVAL; in rio_unlock_device()
1667 * rio_route_add_entry- Add a route entry to a switch routing table
1681 * Returns %0 on success or %-EINVAL on failure.
1686 int rc = -EINVAL; in rio_route_add_entry()
1687 struct rio_switch_ops *ops = rdev->rswitch->ops; in rio_route_add_entry()
1690 rc = rio_lock_device(rdev->net->hport, rdev->destid, in rio_route_add_entry()
1691 rdev->hopcount, 1000); in rio_route_add_entry()
1696 spin_lock(&rdev->rswitch->lock); in rio_route_add_entry()
1698 if (!ops || !ops->add_entry) { in rio_route_add_entry()
1699 rc = rio_std_route_add_entry(rdev->net->hport, rdev->destid, in rio_route_add_entry()
1700 rdev->hopcount, table, in rio_route_add_entry()
1702 } else if (try_module_get(ops->owner)) { in rio_route_add_entry()
1703 rc = ops->add_entry(rdev->net->hport, rdev->destid, in rio_route_add_entry()
1704 rdev->hopcount, table, route_destid, in rio_route_add_entry()
1706 module_put(ops->owner); in rio_route_add_entry()
1709 spin_unlock(&rdev->rswitch->lock); in rio_route_add_entry()
1712 rio_unlock_device(rdev->net->hport, rdev->destid, in rio_route_add_entry()
1713 rdev->hopcount); in rio_route_add_entry()
1720 * rio_route_get_entry- Read an entry from a switch routing table
1734 * Returns %0 on success or %-EINVAL on failure.
1739 int rc = -EINVAL; in rio_route_get_entry()
1740 struct rio_switch_ops *ops = rdev->rswitch->ops; in rio_route_get_entry()
1743 rc = rio_lock_device(rdev->net->hport, rdev->destid, in rio_route_get_entry()
1744 rdev->hopcount, 1000); in rio_route_get_entry()
1749 spin_lock(&rdev->rswitch->lock); in rio_route_get_entry()
1751 if (!ops || !ops->get_entry) { in rio_route_get_entry()
1752 rc = rio_std_route_get_entry(rdev->net->hport, rdev->destid, in rio_route_get_entry()
1753 rdev->hopcount, table, in rio_route_get_entry()
1755 } else if (try_module_get(ops->owner)) { in rio_route_get_entry()
1756 rc = ops->get_entry(rdev->net->hport, rdev->destid, in rio_route_get_entry()
1757 rdev->hopcount, table, route_destid, in rio_route_get_entry()
1759 module_put(ops->owner); in rio_route_get_entry()
1762 spin_unlock(&rdev->rswitch->lock); in rio_route_get_entry()
1765 rio_unlock_device(rdev->net->hport, rdev->destid, in rio_route_get_entry()
1766 rdev->hopcount); in rio_route_get_entry()
1772 * rio_route_clr_table - Clear a switch routing table
1783 * Returns %0 on success or %-EINVAL on failure.
1787 int rc = -EINVAL; in rio_route_clr_table()
1788 struct rio_switch_ops *ops = rdev->rswitch->ops; in rio_route_clr_table()
1791 rc = rio_lock_device(rdev->net->hport, rdev->destid, in rio_route_clr_table()
1792 rdev->hopcount, 1000); in rio_route_clr_table()
1797 spin_lock(&rdev->rswitch->lock); in rio_route_clr_table()
1799 if (!ops || !ops->clr_table) { in rio_route_clr_table()
1800 rc = rio_std_route_clr_table(rdev->net->hport, rdev->destid, in rio_route_clr_table()
1801 rdev->hopcount, table); in rio_route_clr_table()
1802 } else if (try_module_get(ops->owner)) { in rio_route_clr_table()
1803 rc = ops->clr_table(rdev->net->hport, rdev->destid, in rio_route_clr_table()
1804 rdev->hopcount, table); in rio_route_clr_table()
1806 module_put(ops->owner); in rio_route_clr_table()
1809 spin_unlock(&rdev->rswitch->lock); in rio_route_clr_table()
1812 rio_unlock_device(rdev->net->hport, rdev->destid, in rio_route_clr_table()
1813 rdev->hopcount); in rio_route_clr_table()
1826 return mport == container_of(chan->device, struct rio_mport, dma); in rio_chan_filter()
1830 * rio_request_mport_dma - request RapidIO capable DMA channel associated
1847 * rio_request_dma - request RapidIO capable DMA channel that supports
1855 return rio_request_mport_dma(rdev->net->hport); in rio_request_dma()
1860 * rio_release_dma - release specified DMA channel
1870 * rio_dma_prep_xfer - RapidIO specific wrapper
1883 * error-valued pointer or NULL if failed.
1891 if (!dchan->device->device_prep_slave_sg) { in rio_dma_prep_xfer()
1897 rio_ext.rio_addr_u = data->rio_addr_u; in rio_dma_prep_xfer()
1898 rio_ext.rio_addr = data->rio_addr; in rio_dma_prep_xfer()
1899 rio_ext.wr_type = data->wr_type; in rio_dma_prep_xfer()
1901 return dmaengine_prep_rio_sg(dchan, data->sg, data->sg_len, in rio_dma_prep_xfer()
1907 * rio_dma_prep_slave_sg - RapidIO specific wrapper
1920 * error-valued pointer or NULL if failed.
1926 return rio_dma_prep_xfer(dchan, rdev->destid, data, direction, flags); in rio_dma_prep_slave_sg()
1933 * rio_find_mport - find RIO mport by its ID
1946 if (port->id == mport_id) in rio_find_mport()
1957 * rio_register_scan - enumeration/discovery method registration interface
1966 * Returns error if the mport already has an enumerator attached to it.
1979 return -EINVAL; in rio_register_scan()
1984 * Check if there is another enumerator already registered for in rio_register_scan()
1989 if (scan->mport_id == mport_id) { in rio_register_scan()
1990 rc = -EBUSY; in rio_register_scan()
2000 rc = -ENOMEM; in rio_register_scan()
2004 scan->mport_id = mport_id; in rio_register_scan()
2005 scan->ops = scan_ops; in rio_register_scan()
2012 * enumerator registration check above). in rio_register_scan()
2017 if (port->id == mport_id) { in rio_register_scan()
2018 port->nscan = scan_ops; in rio_register_scan()
2020 } else if (mport_id == RIO_MPORT_ANY && !port->nscan) in rio_register_scan()
2021 port->nscan = scan_ops; in rio_register_scan()
2024 list_add_tail(&scan->node, &rio_scans); in rio_register_scan()
2034 * rio_unregister_scan - removes enumeration/discovery method from mport
2052 return -EINVAL; in rio_unregister_scan()
2057 if (port->id == mport_id || in rio_unregister_scan()
2058 (mport_id == RIO_MPORT_ANY && port->nscan == scan_ops)) in rio_unregister_scan()
2059 port->nscan = NULL; in rio_unregister_scan()
2062 if (scan->mport_id == mport_id) { in rio_unregister_scan()
2063 list_del(&scan->node); in rio_unregister_scan()
2076 * rio_mport_scan - execute enumeration/discovery on the specified mport
2086 if (port->id == mport_id) in rio_mport_scan()
2090 return -ENODEV; in rio_mport_scan()
2092 if (!port->nscan) { in rio_mport_scan()
2094 return -EINVAL; in rio_mport_scan()
2097 if (!try_module_get(port->nscan->owner)) { in rio_mport_scan()
2099 return -ENODEV; in rio_mport_scan()
2104 if (port->host_deviceid >= 0) in rio_mport_scan()
2105 rc = port->nscan->enumerate(port, 0); in rio_mport_scan()
2107 rc = port->nscan->discover(port, RIO_SCAN_ENUM_NO_WAIT); in rio_mport_scan()
2109 module_put(port->nscan->owner); in rio_mport_scan()
2140 work->mport->id, work->mport->name); in disc_work_handler()
2141 if (try_module_get(work->mport->nscan->owner)) { in disc_work_handler()
2142 work->mport->nscan->discover(work->mport, 0); in disc_work_handler()
2143 module_put(work->mport->nscan->owner); in disc_work_handler()
2154 return -ENODEV; in rio_init_mports()
2162 if (port->host_deviceid >= 0) { in rio_init_mports()
2163 if (port->nscan && try_module_get(port->nscan->owner)) { in rio_init_mports()
2164 port->nscan->enumerate(port, 0); in rio_init_mports()
2165 module_put(port->nscan->owner); in rio_init_mports()
2198 if (port->host_deviceid < 0 && port->nscan) { in rio_init_mports()
2222 return -1; in rio_get_hdid()
2231 return -ENODEV; in rio_mport_initialize()
2234 atomic_set(&mport->state, RIO_DEVICE_INITIALIZING); in rio_mport_initialize()
2235 mport->id = next_portid++; in rio_mport_initialize()
2236 mport->host_deviceid = rio_get_hdid(mport->id); in rio_mport_initialize()
2237 mport->nscan = NULL; in rio_mport_initialize()
2238 mutex_init(&mport->lock); in rio_mport_initialize()
2239 mport->pwe_refcnt = 0; in rio_mport_initialize()
2240 INIT_LIST_HEAD(&mport->pwrites); in rio_mport_initialize()
2258 if (port->id == scan->mport_id || in rio_register_mport()
2259 scan->mport_id == RIO_MPORT_ANY) { in rio_register_mport()
2260 port->nscan = scan->ops; in rio_register_mport()
2261 if (port->id == scan->mport_id) in rio_register_mport()
2266 list_add_tail(&port->node, &rio_mports); in rio_register_mport()
2269 dev_set_name(&port->dev, "rapidio%d", port->id); in rio_register_mport()
2270 port->dev.class = &rio_mport_class; in rio_register_mport()
2271 atomic_set(&port->state, RIO_DEVICE_RUNNING); in rio_register_mport()
2273 res = device_register(&port->dev); in rio_register_mport()
2275 dev_err(&port->dev, "RIO: mport%d registration failed ERR=%d\n", in rio_register_mport()
2276 port->id, res); in rio_register_mport()
2278 dev_dbg(&port->dev, "RIO: registered mport%d\n", port->id); in rio_register_mport()
2288 if (dev->bus == &rio_bus_type) in rio_mport_cleanup_callback()
2299 device_for_each_child(&net->dev, NULL, rio_mport_cleanup_callback); in rio_net_remove_children()
2305 pr_debug("RIO: %s %s id=%d\n", __func__, port->name, port->id); in rio_unregister_mport()
2308 if (atomic_cmpxchg(&port->state, in rio_unregister_mport()
2312 __func__, port->name); in rio_unregister_mport()
2315 if (port->net && port->net->hport == port) { in rio_unregister_mport()
2316 rio_net_remove_children(port->net); in rio_unregister_mport()
2317 rio_free_net(port->net); in rio_unregister_mport()
2325 list_del(&port->node); in rio_unregister_mport()
2327 device_unregister(&port->dev); in rio_unregister_mport()