You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
rapidio: add inbound memory mapping interface
Add common inbound memory mapping/unmapping interface. This allows to make local memory space accessible from the RapidIO side using hardware mapping capabilities of RapidIO bridging devices. The new interface is intended to enable data transfers between RapidIO devices in combination with DMA engine support. This patch is based on patch submitted by Li Yang <leoli@freescale.com> (https://lists.ozlabs.org/pipermail/linuxppc-dev/2009-April/071210.html) Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com> Cc: Matt Porter <mporter@kernel.crashing.org> Cc: Li Yang <leoli@freescale.com> Cc: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
18f6287f53
commit
da1589f073
@@ -33,6 +33,7 @@
|
||||
|
||||
static LIST_HEAD(rio_mports);
|
||||
static unsigned char next_portid;
|
||||
static DEFINE_SPINLOCK(rio_mmap_lock);
|
||||
|
||||
/**
|
||||
* rio_local_get_device_id - Get the base/extended device id for a port
|
||||
@@ -397,6 +398,49 @@ int rio_release_inb_pwrite(struct rio_dev *rdev)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rio_release_inb_pwrite);
|
||||
|
||||
/**
|
||||
* rio_map_inb_region -- Map inbound memory region.
|
||||
* @mport: Master port.
|
||||
* @lstart: physical address of memory region to be mapped
|
||||
* @rbase: RIO base address assigned to this window
|
||||
* @size: Size of the memory region
|
||||
* @rflags: Flags for mapping.
|
||||
*
|
||||
* Return: 0 -- Success.
|
||||
*
|
||||
* This function will create the mapping from RIO space to local memory.
|
||||
*/
|
||||
int rio_map_inb_region(struct rio_mport *mport, dma_addr_t local,
|
||||
u64 rbase, u32 size, u32 rflags)
|
||||
{
|
||||
int rc = 0;
|
||||
unsigned long flags;
|
||||
|
||||
if (!mport->ops->map_inb)
|
||||
return -1;
|
||||
spin_lock_irqsave(&rio_mmap_lock, flags);
|
||||
rc = mport->ops->map_inb(mport, local, rbase, size, rflags);
|
||||
spin_unlock_irqrestore(&rio_mmap_lock, flags);
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rio_map_inb_region);
|
||||
|
||||
/**
|
||||
* rio_unmap_inb_region -- Unmap the inbound memory region
|
||||
* @mport: Master port
|
||||
* @lstart: physical address of memory region to be unmapped
|
||||
*/
|
||||
void rio_unmap_inb_region(struct rio_mport *mport, dma_addr_t lstart)
|
||||
{
|
||||
unsigned long flags;
|
||||
if (!mport->ops->unmap_inb)
|
||||
return;
|
||||
spin_lock_irqsave(&rio_mmap_lock, flags);
|
||||
mport->ops->unmap_inb(mport, lstart);
|
||||
spin_unlock_irqrestore(&rio_mmap_lock, flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rio_unmap_inb_region);
|
||||
|
||||
/**
|
||||
* rio_mport_get_physefb - Helper function that returns register offset
|
||||
* for Physical Layer Extended Features Block.
|
||||
|
||||
Reference in New Issue
Block a user