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 *pci_alloc_consistent(struct pci_dev
*hwdev
, size_t size
,
17 dma_addr_t
*dma_handle
)
22 if (hwdev
== NULL
|| hwdev
->dma_mask
!= 0xffffffff)
24 ret
= (void *)__get_free_pages(gfp
, get_order(size
));
28 *dma_handle
= virt_to_bus(ret
);
33 void pci_free_consistent(struct pci_dev
*hwdev
, size_t size
,
34 void *vaddr
, dma_addr_t dma_handle
)
36 free_pages((unsigned long)vaddr
, get_order(size
));