FreeBSD/sys/dev/nxge/xge-osdep.h
/**
 * xge_os_dma_sync - Synchronize mapped memory.
 * @pdev: Device context. Used to allocate/pin/map/unmap DMA-able memory.
 * @dmah: DMA handle used to map the memory block. Obtained via
 * xge_os_dma_malloc().
 * @dma_addr: DMA address of the block. Obtained via xge_os_dma_map().
 * @dma_offset: Offset from start of the blocke. Used by Solaris only.
 * @length: Size of the block.
 * @dir: Direction of this operation (XGE_OS_DMA_DIR_TODEVICE, etc.)
 *
 * Make physical and CPU memory consistent for a single streaming mode DMA
 * translation. This API compiles to NOP on cache-coherent platforms. On
 * non cache-coherent platforms, depending on the direction of the "sync"
 * operation, this API will effectively either invalidate CPU cache (that might
 * contain old data), or flush CPU cache to update physical memory.
 * See also: xge_os_dma_malloc(), xge_os_dma_map(),
 * xge_os_dma_unmap().
 */
Synchronize mapped memory.
@pdev: Device context. Used to allocate/pin/map/unmap DMA-able memory.
@dmah: DMA handle used to map the memory block.

Make physical and CPU memory consistent for a single streaming mode DMA
translation. This API compiles to NOP on cache-coherent platforms. On
non cache-coherent platforms, depending on the direction of the "sync"
operation, this API will effectively either invalidate CPU cache (that might
contain old data), or flush CPU cache to update physical memory.
Synchronize mapped memory . @pdev : Device context . Used to allocate / pin / map / unmap DMA - able memory . @dmah : DMA handle used to map the memory block . Make physical and CPU memory consistent for a single streaming mode DMA translation . This API compiles to NOP on cache - coherent platforms . On non cache - coherent platforms depending on the direction of the " sync " operation this API will effectively either invalidate CPU cache ( that might contain old data ) or flush CPU cache to update physical memory .
static inline void
xge_os_dma_sync(pci_dev_h pdev, pci_dma_h dmah, dma_addr_t dma_addr,
	u64 dma_offset, size_t length, int dir)
{
	bus_dmasync_op_t syncop;
	switch(dir) {
	    case XGE_OS_DMA_DIR_TODEVICE:
	        syncop = BUS_DMASYNC_PREWRITE | BUS_DMASYNC_POSTWRITE;
	        break;
	    case XGE_OS_DMA_DIR_FROMDEVICE:
	        syncop = BUS_DMASYNC_PREREAD | BUS_DMASYNC_POSTREAD;
	        break;
	    default:
	        syncop = BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREWRITE;
	        break;
	}
	bus_dmamap_sync(dmah.dma_tag, dmah.dma_map, syncop);
	return;
}
static inline void xge_os_dma_sync ( pci_dev_h pdev , pci_dma_h dmah , dma_addr_t dma_addr , u64 dma_offset , size_t length , int dir ) { bus_dmasync_op_t syncop ; switch ( dir ) { case XGE_OS_DMA_DIR_TODEVICE : syncop = BUS_DMASYNC_PREWRITE | BUS_DMASYNC_POSTWRITE ; break ; case XGE_OS_DMA_DIR_FROMDEVICE : syncop = BUS_DMASYNC_PREREAD | BUS_DMASYNC_POSTREAD ; break ; default : syncop = BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREWRITE ; break ; } bus_dmamap_sync ( dmah . dma_tag , dmah . dma_map , syncop ) ; return ; }
xge_os_dma_sync - Synchronize mapped memory.
xge_os_dma_sync - Synchronize mapped memory .