- Linus: drop support for old-style Makefiles entirely. Big.
[davej-history.git] / arch / ppc / kernel / pci-dma.c
blob174de223fed6bb66c8311293ec90ecd9f0c0fafc
1 /*
2 * Copyright (C) 2000 Ani Joshi <ajoshi@unixbox.com>
5 * Dynamic DMA mapping support.
7 * swiped from i386
9 */
11 #include <linux/types.h>
12 #include <linux/mm.h>
13 #include <linux/string.h>
14 #include <linux/pci.h>
15 #include <asm/io.h>
17 void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
18 dma_addr_t *dma_handle)
20 void *ret;
21 int gfp = GFP_ATOMIC;
23 if (hwdev == NULL || hwdev->dma_mask != 0xffffffff)
24 gfp |= GFP_DMA;
25 ret = (void *)__get_free_pages(gfp, get_order(size));
27 if (ret != NULL) {
28 memset(ret, 0, size);
29 *dma_handle = virt_to_bus(ret);
31 return ret;
34 void pci_free_consistent(struct pci_dev *hwdev, size_t size,
35 void *vaddr, dma_addr_t dma_handle)
37 free_pages((unsigned long)vaddr, get_order(size));