diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-04-09 13:36:54 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-04-09 13:36:54 -0400 |
commit | f802d969b6a89d3f9b67ef879179824d53420ebe (patch) | |
tree | 73748811278c85817b59240d63e610c8a9565132 /arch/sh/mm | |
parent | b35346fd25f3c8c0b6afeb778f8c4f41c5703c84 (diff) |
sh: Add support for DMA API debugging.
This wires up support for the generic DMA API debugging.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/mm')
-rw-r--r-- | arch/sh/mm/consistent.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c index edcd5fbf9651..8c9ee855328a 100644 --- a/arch/sh/mm/consistent.c +++ b/arch/sh/mm/consistent.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/dma-mapping.h> | 14 | #include <linux/dma-mapping.h> |
15 | #include <linux/dma-debug.h> | ||
15 | #include <asm/cacheflush.h> | 16 | #include <asm/cacheflush.h> |
16 | #include <asm/addrspace.h> | 17 | #include <asm/addrspace.h> |
17 | #include <asm/io.h> | 18 | #include <asm/io.h> |
@@ -45,6 +46,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size, | |||
45 | split_page(pfn_to_page(virt_to_phys(ret) >> PAGE_SHIFT), order); | 46 | split_page(pfn_to_page(virt_to_phys(ret) >> PAGE_SHIFT), order); |
46 | 47 | ||
47 | *dma_handle = virt_to_phys(ret); | 48 | *dma_handle = virt_to_phys(ret); |
49 | |||
50 | debug_dma_alloc_coherent(dev, size, *dma_handle, ret_nocache); | ||
51 | |||
48 | return ret_nocache; | 52 | return ret_nocache; |
49 | } | 53 | } |
50 | EXPORT_SYMBOL(dma_alloc_coherent); | 54 | EXPORT_SYMBOL(dma_alloc_coherent); |
@@ -56,12 +60,15 @@ void dma_free_coherent(struct device *dev, size_t size, | |||
56 | unsigned long pfn = dma_handle >> PAGE_SHIFT; | 60 | unsigned long pfn = dma_handle >> PAGE_SHIFT; |
57 | int k; | 61 | int k; |
58 | 62 | ||
59 | if (!dma_release_from_coherent(dev, order, vaddr)) { | 63 | WARN_ON(irqs_disabled()); /* for portability */ |
60 | WARN_ON(irqs_disabled()); /* for portability */ | 64 | |
61 | for (k = 0; k < (1 << order); k++) | 65 | if (dma_release_from_coherent(dev, order, vaddr)) |
62 | __free_pages(pfn_to_page(pfn + k), 0); | 66 | return; |
63 | iounmap(vaddr); | 67 | |
64 | } | 68 | debug_dma_free_coherent(dev, size, vaddr, dma_handle); |
69 | for (k = 0; k < (1 << order); k++) | ||
70 | __free_pages(pfn_to_page(pfn + k), 0); | ||
71 | iounmap(vaddr); | ||
65 | } | 72 | } |
66 | EXPORT_SYMBOL(dma_free_coherent); | 73 | EXPORT_SYMBOL(dma_free_coherent); |
67 | 74 | ||