2 * BK Id: SCCS/s.pci-dma.c 1.10 06/13/02 14:57:36 trini
5 * Copyright (C) 2000 Ani Joshi <ajoshi@unixbox.com>
8 * Dynamic DMA mapping support.
14 #include <linux/types.h>
16 #include <linux/string.h>
17 #include <linux/pci.h>
20 void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
21 dma_addr_t *dma_handle)
26 if (hwdev == NULL || hwdev->dma_mask != 0xffffffff)
29 #ifdef CONFIG_NOT_COHERENT_CACHE
30 ret = consistent_alloc(gfp, size, dma_handle);
32 ret = (void *)__get_free_pages(gfp, get_order(size));
37 #ifndef CONFIG_NOT_COHERENT_CACHE
38 *dma_handle = virt_to_bus(ret);
44 void pci_free_consistent(struct pci_dev *hwdev, size_t size,
45 void *vaddr, dma_addr_t dma_handle)
47 #ifdef CONFIG_NOT_COHERENT_CACHE
48 consistent_free(vaddr);
50 free_pages((unsigned long)vaddr, get_order(size));