linux/arch/sparc/kernel/ioport.c
/* Free and unmap a consistent DMA buffer.
 * cpu_addr is what was returned arch_dma_alloc, size must be the same as what
 * was passed into arch_dma_alloc, and likewise dma_addr must be the same as
 * what *dma_ndler was set to.
 *
 * References to the memory and mappings associated with cpu_addr/dma_addr
 * past this call are illegal.
 */
Free and unmap a consistent DMA buffer.
cpu_addr is what was returned arch_dma_alloc, size must be the same as what
was passed into arch_dma_alloc, and likewise dma_addr must be the same as
what *dma_ndler was set to.

References to the memory and mappings associated with cpu_addr/dma_addr
past this call are illegal.
Free and unmap a consistent DMA buffer . cpu_addr is what was returned arch_dma_alloc size must be the same as what was passed into arch_dma_alloc and likewise dma_addr must be the same as what * dma_ndler was set to . References to the memory and mappings associated with cpu_addr / dma_addr past this call are illegal .
void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
		dma_addr_t dma_addr, unsigned long attrs)
{
	struct resource *res;
	if ((res = lookup_resource(&_sparc_dvma,
	    (unsigned long)cpu_addr)) == NULL) {
		printk("%s: cannot free %p\n", __func__, cpu_addr);
		return;
	}
	if (((unsigned long)cpu_addr & (PAGE_SIZE-1)) != 0) {
		printk("%s: unaligned va %p\n", __func__, cpu_addr);
		return;
	}
	size = PAGE_ALIGN(size);
	if (resource_size(res) != size) {
		printk("%s: region 0x%lx asked 0x%zx\n", __func__,
		    (long)resource_size(res), size);
		return;
	}
	dma_make_coherent(dma_addr, size);
	srmmu_unmapiorange((unsigned long)cpu_addr, size);
	release_resource(res);
	kfree(res);
	free_pages((unsigned long)phys_to_virt(dma_addr), get_order(size));
}
void arch_dma_free ( struct device * dev , size_t size , void * cpu_addr , dma_addr_t dma_addr , unsigned long attrs ) { struct resource * res ; if ( ( res = lookup_resource ( & _sparc_dvma , ( unsigned long ) cpu_addr ) ) == NULL ) { printk ( " \n " , __func__ , cpu_addr ) ; return ; } if ( ( ( unsigned long ) cpu_addr & ( PAGE_SIZE - 1 ) ) != 0 ) { printk ( " \n " , __func__ , cpu_addr ) ; return ; } size = PAGE_ALIGN ( size ) ; if ( resource_size ( res ) != size ) { printk ( " \n " , __func__ , ( long ) resource_size ( res ) , size ) ; return ; } dma_make_coherent ( dma_addr , size ) ; srmmu_unmapiorange ( ( unsigned long ) cpu_addr , size ) ; release_resource ( res ) ; kfree ( res ) ; free_pages ( ( unsigned long ) phys_to_virt ( dma_addr ) , get_order ( size ) ) ; }
Free and unmap a consistent DMA buffer.
Free and unmap a consistent DMA buffer .