2 * Dynamic DMA mapping support.
4 * On i386 there is no hardware dynamic DMA address translation,
5 * so consistent alloc/free are merely page allocation/freeing.
6 * The rest of the dynamic DMA mapping interface is implemented
10 #include <linux/types.h>
12 #include <linux/string.h>
13 #include <linux/pci.h>
16 void *dma_alloc_coherent(struct device *dev, size_t size,
17 dma_addr_t *dma_handle, int gfp)
20 /* ignore region specifiers */
21 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
23 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
26 ret = (void *)__get_free_pages(gfp, get_order(size));
30 *dma_handle = virt_to_phys(ret);
35 void dma_free_coherent(struct device *dev, size_t size,
36 void *vaddr, dma_addr_t dma_handle)
38 free_pages((unsigned long)vaddr, get_order(size));