summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/pci-nommu.c
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2008-09-24 20:48:35 +0900
committerIngo Molnar <mingo@elte.hu>2008-09-25 11:02:25 +0200
commit9f6ac57729724b58df81ca5dc005326759a806fe (patch)
treed9ee77c4518d83582bf1de1acf43e1834932f5f3 /arch/x86/kernel/pci-nommu.c
parentafa9fdc2f5f8e4d98f3e77bfa204412cbc181346 (diff)
downloadlinux-9f6ac57729724b58df81ca5dc005326759a806fe.tar.bz2
x86: export pci-nommu's alloc_coherent
This patch exports nommu_alloc_coherent (renamed dma_generic_alloc_coherent). GART needs this function. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/pci-nommu.c')
-rw-r--r--arch/x86/kernel/pci-nommu.c39
1 files changed, 1 insertions, 38 deletions
diff --git a/arch/x86/kernel/pci-nommu.c b/arch/x86/kernel/pci-nommu.c
index 1c1c98a31d57..c70ab5a5d4c8 100644
--- a/arch/x86/kernel/pci-nommu.c
+++ b/arch/x86/kernel/pci-nommu.c
@@ -72,43 +72,6 @@ static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
return nents;
}
-static void *
-nommu_alloc_coherent(struct device *hwdev, size_t size,
- dma_addr_t *dma_addr, gfp_t gfp)
-{
- unsigned long dma_mask;
- int node;
- struct page *page;
- dma_addr_t addr;
-
- dma_mask = dma_alloc_coherent_mask(hwdev, gfp);
-
- gfp |= __GFP_ZERO;
-
- node = dev_to_node(hwdev);
-again:
- page = alloc_pages_node(node, gfp, get_order(size));
- if (!page)
- return NULL;
-
- addr = page_to_phys(page);
- if (!is_buffer_dma_capable(dma_mask, addr, size) && !(gfp & GFP_DMA)) {
- free_pages((unsigned long)page_address(page), get_order(size));
- gfp |= GFP_DMA;
- goto again;
- }
-
- if (check_addr("alloc_coherent", hwdev, addr, size)) {
- *dma_addr = addr;
- flush_write_buffers();
- return page_address(page);
- }
-
- free_pages((unsigned long)page_address(page), get_order(size));
-
- return NULL;
-}
-
static void nommu_free_coherent(struct device *dev, size_t size, void *vaddr,
dma_addr_t dma_addr)
{
@@ -116,7 +79,7 @@ static void nommu_free_coherent(struct device *dev, size_t size, void *vaddr,
}
struct dma_mapping_ops nommu_dma_ops = {
- .alloc_coherent = nommu_alloc_coherent,
+ .alloc_coherent = dma_generic_alloc_coherent,
.free_coherent = nommu_free_coherent,
.map_single = nommu_map_single,
.map_sg = nommu_map_sg,