linux/arch/hexagon/kernel/dma.c
/* Allocates from a pool of uncached memory that was reserved at boot time */
Allocates from a pool of uncached memory that was reserved at boot time
Allocates from a pool of uncached memory that was reserved at boot time
static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
				 dma_addr_t *dma_addr, gfp_t flag,
				 unsigned long attrs)
{
	void *ret;
	if (coherent_pool == NULL) {
		coherent_pool = gen_pool_create(PAGE_SHIFT, -1);
		if (coherent_pool == NULL)
			panic("Can't create %s() memory pool!", __func__);
		else
			gen_pool_add(coherent_pool,
				(unsigned long)pfn_to_virt(max_low_pfn),
				hexagon_coherent_pool_size, -1);
	}
	ret = (void *) gen_pool_alloc(coherent_pool, size);
	if (ret) {
		memset(ret, 0, size);
		*dma_addr = (dma_addr_t) virt_to_phys(ret);
	} else
		*dma_addr = ~0;
	return ret;
}
static void * hexagon_dma_alloc_coherent ( struct device * dev , size_t size , dma_addr_t * dma_addr , gfp_t flag , unsigned long attrs ) { void * ret ; if ( coherent_pool == NULL ) { coherent_pool = gen_pool_create ( PAGE_SHIFT , -1 ) ; if ( coherent_pool == NULL ) panic ( " " , __func__ ) ; else gen_pool_add ( coherent_pool , ( unsigned long ) pfn_to_virt ( max_low_pfn ) , hexagon_coherent_pool_size , -1 ) ; } ret = ( void * ) gen_pool_alloc ( coherent_pool , size ) ; if ( ret ) { memset ( ret , 0 , size ) ; * dma_addr = ( dma_addr_t ) virt_to_phys ( ret ) ; } else * dma_addr = ~ 0 ; return ret ; }
Allocates from a pool of uncached memory that was reserved at boot time
Allocates from a pool of uncached memory that was reserved at boot time
/*
	 * Our max_low_pfn should have been backed off by 16MB in
	 * mm/init.c to create DMA coherent space.  Use that as the VA
	 * for the pool.
	 */