Lines Matching defs:mport

38 	int (*pwcback)(struct rio_mport *mport, void *context,
83 * rio_query_mport - Query mport device attributes
84 * @port: mport device to query
85 * @mport_attr: mport attributes data structure
87 * Returns attributes of specified mport through the
101 * @mport: Master port associated with the RIO network
108 struct rio_net *rio_alloc_net(struct rio_mport *mport)
117 mport->net = net;
223 * @mport: RIO master port from which to allocate the mailbox resource
232 int rio_request_inb_mbox(struct rio_mport *mport,
236 void (*minb) (struct rio_mport * mport, void *dev_id, int mbox,
242 if (!mport->ops->open_inb_mbox)
250 rc = request_resource(&mport->riores[RIO_INB_MBOX_RESOURCE],
257 mport->inb_msg[mbox].res = res;
260 mport->inb_msg[mbox].mcback = minb;
262 rc = mport->ops->open_inb_mbox(mport, dev_id, mbox, entries);
264 mport->inb_msg[mbox].mcback = NULL;
265 mport->inb_msg[mbox].res = NULL;
279 * @mport: RIO master port from which to release the mailbox resource
285 int rio_release_inb_mbox(struct rio_mport *mport, int mbox)
289 if (!mport->ops->close_inb_mbox || !mport->inb_msg[mbox].res)
292 mport->ops->close_inb_mbox(mport, mbox);
293 mport->inb_msg[mbox].mcback = NULL;
295 rc = release_resource(mport->inb_msg[mbox].res);
299 kfree(mport->inb_msg[mbox].res);
300 mport->inb_msg[mbox].res = NULL;
308 * @mport: RIO master port from which to allocate the mailbox resource
317 int rio_request_outb_mbox(struct rio_mport *mport,
321 void (*moutb) (struct rio_mport * mport, void *dev_id, int mbox, int slot))
326 if (!mport->ops->open_outb_mbox)
334 rc = request_resource(&mport->riores[RIO_OUTB_MBOX_RESOURCE],
341 mport->outb_msg[mbox].res = res;
344 mport->outb_msg[mbox].mcback = moutb;
346 rc = mport->ops->open_outb_mbox(mport, dev_id, mbox, entries);
348 mport->outb_msg[mbox].mcback = NULL;
349 mport->outb_msg[mbox].res = NULL;
363 * @mport: RIO master port from which to release the mailbox resource
369 int rio_release_outb_mbox(struct rio_mport *mport, int mbox)
373 if (!mport->ops->close_outb_mbox || !mport->outb_msg[mbox].res)
376 mport->ops->close_outb_mbox(mport, mbox);
377 mport->outb_msg[mbox].mcback = NULL;
379 rc = release_resource(mport->outb_msg[mbox].res);
383 kfree(mport->outb_msg[mbox].res);
384 mport->outb_msg[mbox].res = NULL;
392 * @mport: RIO master port to bind the doorbell callback
402 rio_setup_inb_dbell(struct rio_mport *mport, void *dev_id, struct resource *res,
403 void (*dinb) (struct rio_mport * mport, void *dev_id, u16 src, u16 dst,
415 mutex_lock(&mport->lock);
416 list_add_tail(&dbell->node, &mport->dbells);
417 mutex_unlock(&mport->lock);
423 * @mport: RIO master port from which to allocate the doorbell resource
433 int rio_request_inb_dbell(struct rio_mport *mport,
437 void (*dinb) (struct rio_mport * mport, void *dev_id, u16 src,
447 rc = request_resource(&mport->riores[RIO_DOORBELL_RESOURCE],
455 rc = rio_setup_inb_dbell(mport, dev_id, res, dinb);
466 * @mport: RIO master port from which to release the doorbell resource
474 int rio_release_inb_dbell(struct rio_mport *mport, u16 start, u16 end)
479 mutex_lock(&mport->lock);
480 list_for_each_entry(dbell, &mport->dbells, node) {
487 mutex_unlock(&mport->lock);
555 * of mport specific pw handlers
556 * @mport: RIO master port to bind the portwrite callback
562 int rio_add_mport_pw_handler(struct rio_mport *mport, void *context,
563 int (*pwcback)(struct rio_mport *mport,
573 mutex_lock(&mport->lock);
574 list_add_tail(&pwrite->node, &mport->pwrites);
575 mutex_unlock(&mport->lock);
582 * of mport specific pw handlers
583 * @mport: RIO master port to bind the portwrite callback
589 int rio_del_mport_pw_handler(struct rio_mport *mport, void *context,
590 int (*pwcback)(struct rio_mport *mport,
596 mutex_lock(&mport->lock);
597 list_for_each_entry(pwrite, &mport->pwrites, node) {
605 mutex_unlock(&mport->lock);
661 * @mport: Master port associated with port-write handling
664 void rio_pw_enable(struct rio_mport *mport, int enable)
666 if (mport->ops->pwenable) {
667 mutex_lock(&mport->lock);
669 if ((enable && ++mport->pwe_refcnt == 1) ||
670 (!enable && mport->pwe_refcnt && --mport->pwe_refcnt == 0))
671 mport->ops->pwenable(mport, enable);
672 mutex_unlock(&mport->lock);
679 * @mport: Master port.
689 int rio_map_inb_region(struct rio_mport *mport, dma_addr_t local,
695 if (!mport->ops->map_inb)
698 rc = mport->ops->map_inb(mport, local, rbase, size, rflags);
706 * @mport: Master port
709 void rio_unmap_inb_region(struct rio_mport *mport, dma_addr_t lstart)
712 if (!mport->ops->unmap_inb)
715 mport->ops->unmap_inb(mport, lstart);
722 * @mport: Master port.
733 int rio_map_outb_region(struct rio_mport *mport, u16 destid, u64 rbase,
739 if (!mport->ops->map_outb)
743 rc = mport->ops->map_outb(mport, destid, rbase, size,
753 * @mport: Master port
757 void rio_unmap_outb_region(struct rio_mport *mport, u16 destid, u64 rstart)
761 if (!mport->ops->unmap_outb)
765 mport->ops->unmap_outb(mport, destid, rstart);
988 * @mport: Master port to send transactions
993 rio_mport_chk_dev_access(struct rio_mport *mport, u16 destid, u8 hopcount)
998 while (rio_mport_read_config_32(mport, destid, hopcount,
1164 * @mport: mport device associated with port-write
1170 int rio_inb_pwrite_handler(struct rio_mport *mport, union rio_pw_msg *pw_msg)
1181 pr_debug("%s: PW to mport_%d:\n", __func__, mport->id);
1210 mutex_lock(&mport->lock);
1211 list_for_each_entry(pwrite, &mport->pwrites, node)
1212 pwrite->pwcback(mport, pwrite->context, pw_msg, 0);
1213 mutex_unlock(&mport->lock);
1220 * how to do default PW handling in combination with per-mport callbacks
1418 * @mport: Master port to issue transaction
1426 rio_std_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
1430 rio_mport_write_config_32(mport, destid, hopcount,
1433 rio_mport_write_config_32(mport, destid, hopcount,
1446 * @mport: Master port to issue transaction
1454 rio_std_route_get_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
1460 rio_mport_write_config_32(mport, destid, hopcount,
1462 rio_mport_read_config_32(mport, destid, hopcount,
1474 * @mport: Master port to issue transaction
1480 rio_std_route_clr_table(struct rio_mport *mport, u16 destid, u8 hopcount,
1488 rio_mport_read_config_32(mport, destid, hopcount,
1491 if (mport->sys_size) {
1492 rio_mport_read_config_32(mport, destid, hopcount,
1508 rio_mport_write_config_32(mport, destid, hopcount,
1511 rio_mport_write_config_32(mport, destid, hopcount,
1754 struct rio_mport *mport = arg;
1757 return mport == container_of(chan->device, struct rio_mport, dma);
1762 * with specified local RapidIO mport device.
1763 * @mport: RIO mport to perform DMA data transfers
1767 struct dma_chan *rio_request_mport_dma(struct rio_mport *mport)
1773 return dma_request_channel(mask, rio_chan_filter, mport);
1864 * rio_find_mport - find RIO mport by its ID
1865 * @mport_id: number (ID) of mport device
1867 * Given a RIO mport number, the desired mport is located
1868 * in the global list of mports. If the mport is found, a pointer to its
1869 * data structure is returned. If no mport is found, %NULL is returned.
1889 * @mport_id: mport device ID for which fabric scan routine has to be set
1894 * attaches it to the specified mport device (or all available mports
1897 * Returns error if the mport already has an enumerator attached to it.
1916 * the same mport ID (including RIO_MPORT_ANY). Multiple enumerators
1917 * for the same mport ID are not supported.
1941 * The new scan with matching mport ID overrides any previously attached
1965 * rio_unregister_scan - removes enumeration/discovery method from mport
1966 * @mport_id: mport device ID for which fabric scan routine has to be
1971 * Removes enumeration or discovery method assigned to the specified mport
2007 * rio_mport_scan - execute enumeration/discovery on the specified mport
2008 * @mport_id: number (ID) of mport device
2048 struct rio_mport *mport;
2056 pr_debug("RIO: discovery work for mport %d %s\n",
2057 work->mport->id, work->mport->name);
2058 if (try_module_get(work->mport->nscan->owner)) {
2059 work->mport->nscan->discover(work->mport, 0);
2060 module_put(work->mport->nscan->owner);
2116 work[n].mport = port;
2142 int rio_mport_initialize(struct rio_mport *mport)
2149 atomic_set(&mport->state, RIO_DEVICE_INITIALIZING);
2150 mport->id = next_portid++;
2151 mport->host_deviceid = rio_get_hdid(mport->id);
2152 mport->nscan = NULL;
2153 mutex_init(&mport->lock);
2154 mport->pwe_refcnt = 0;
2155 INIT_LIST_HEAD(&mport->pwrites);
2170 * that have to be attached to the added mport.
2190 dev_err(&port->dev, "RIO: mport%d registration failed ERR=%d\n",
2197 dev_dbg(&port->dev, "RIO: registered mport%d\n", port->id);
2227 /* Transition mport to the SHUTDOWN state */
2231 pr_err("RIO: %s unexpected state transition for mport %s\n",
2241 * Unregister all RapidIO devices attached to this mport (this will