* This allocates one page of cache-coherent memory space and returns
* both the virtual and a "dma" address to that space.
*/
+static
void *consistent_alloc(int gfp, size_t size, dma_addr_t *handle,
unsigned long cache_flags)
{
no_page:
return NULL;
}
-EXPORT_SYMBOL(consistent_alloc);
/*
* Since we have the DMA mask available to us here, we could try to do
/*
* free a page as defined by the above mapping.
*/
-void consistent_free(void *vaddr, size_t size, dma_addr_t handle)
+void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr_t handle)
{
struct vm_region *c;
unsigned long flags;
spin_lock_irqsave(&consistent_lock, flags);
- c = vm_region_find(&consistent_head, (unsigned long)vaddr);
+ c = vm_region_find(&consistent_head, (unsigned long)cpu_addr);
if (!c)
goto no_area;
"invalid area: %p\n", vaddr);
dump_stack();
}
-EXPORT_SYMBOL(consistent_free);
+EXPORT_SYMBOL(dma_free_coherent);
/*
* Initialise the consistent memory allocation.
* devices. This is the "generic" version. The PCI specific version
* is in pci.h
*/
-extern void *consistent_alloc(int gfp, size_t size, dma_addr_t *handle, unsigned long flags);
-extern void consistent_free(void *vaddr, size_t size, dma_addr_t handle);
extern void consistent_sync(void *kaddr, size_t size, int rw);
/*
* References to memory and mappings associated with cpu_addr/handle
* during and after this call executing are illegal.
*/
-static inline void
+extern void
dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
- dma_addr_t handle)
-{
- consistent_free(cpu_addr, size, handle);
-}
+ dma_addr_t handle);
/**
* dma_alloc_writecombine - allocate writecombining memory for DMA