aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/pci-dma_64.c
diff options
context:
space:
mode:
authorGlauber Costa <gcosta@redhat.com>2008-04-08 12:20:58 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-19 13:19:58 -0400
commitd09d815c1b1d437a3ea89ecd92c91179266d1243 (patch)
tree860aac1786676a01909d8ad1325bd3ffbe029039 /arch/x86/kernel/pci-dma_64.c
parent8e8edc6401205da3000cc3dfa76f3fd28a21d73c (diff)
x86: isolate coherent mapping functions
i386 implements the declare coherent memory API, and x86_64 does not it is reflected in pieces of dma_alloc_coherent and dma_free_coherent. Those pieces are isolated in separate functions, that are declared as empty macros in x86_64. This way we can make the code the same. Signed-off-by: Glauber Costa <gcosta@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/pci-dma_64.c')
-rw-r--r--arch/x86/kernel/pci-dma_64.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/x86/kernel/pci-dma_64.c b/arch/x86/kernel/pci-dma_64.c
index e7d45cf82251..6eacd58e451b 100644
--- a/arch/x86/kernel/pci-dma_64.c
+++ b/arch/x86/kernel/pci-dma_64.c
@@ -39,6 +39,8 @@ dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order)
39 return page ? page_address(page) : NULL; 39 return page ? page_address(page) : NULL;
40} 40}
41 41
42#define dma_alloc_from_coherent_mem(dev, size, handle, ret) (0)
43#define dma_release_coherent(dev, order, vaddr) (0)
42/* 44/*
43 * Allocate memory for a coherent mapping. 45 * Allocate memory for a coherent mapping.
44 */ 46 */
@@ -50,6 +52,10 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
50 unsigned long dma_mask = 0; 52 unsigned long dma_mask = 0;
51 u64 bus; 53 u64 bus;
52 54
55
56 if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory))
57 return memory;
58
53 if (!dev) 59 if (!dev)
54 dev = &fallback_dev; 60 dev = &fallback_dev;
55 dma_mask = dev->coherent_dma_mask; 61 dma_mask = dev->coherent_dma_mask;
@@ -141,9 +147,12 @@ EXPORT_SYMBOL(dma_alloc_coherent);
141void dma_free_coherent(struct device *dev, size_t size, 147void dma_free_coherent(struct device *dev, size_t size,
142 void *vaddr, dma_addr_t bus) 148 void *vaddr, dma_addr_t bus)
143{ 149{
150 int order = get_order(size);
144 WARN_ON(irqs_disabled()); /* for portability */ 151 WARN_ON(irqs_disabled()); /* for portability */
152 if (dma_release_coherent(dev, order, vaddr))
153 return;
145 if (dma_ops->unmap_single) 154 if (dma_ops->unmap_single)
146 dma_ops->unmap_single(dev, bus, size, 0); 155 dma_ops->unmap_single(dev, bus, size, 0);
147 free_pages((unsigned long)vaddr, get_order(size)); 156 free_pages((unsigned long)vaddr, order);
148} 157}
149EXPORT_SYMBOL(dma_free_coherent); 158EXPORT_SYMBOL(dma_free_coherent);