aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/include/asm/dma-mapping.h28
-rw-r--r--arch/sh/kernel/dma-nommu.c4
-rw-r--r--arch/sh/mm/consistent.c6
3 files changed, 24 insertions, 14 deletions
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 1a73c3e759a7..8bd965e00a15 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -52,25 +52,31 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
52 return dma_addr == 0; 52 return dma_addr == 0;
53} 53}
54 54
55static inline void *dma_alloc_coherent(struct device *dev, size_t size, 55#define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL)
56 dma_addr_t *dma_handle, gfp_t gfp) 56
57static inline void *dma_alloc_attrs(struct device *dev, size_t size,
58 dma_addr_t *dma_handle, gfp_t gfp,
59 struct dma_attrs *attrs)
57{ 60{
58 struct dma_map_ops *ops = get_dma_ops(dev); 61 struct dma_map_ops *ops = get_dma_ops(dev);
59 void *memory; 62 void *memory;
60 63
61 if (dma_alloc_from_coherent(dev, size, dma_handle, &memory)) 64 if (dma_alloc_from_coherent(dev, size, dma_handle, &memory))
62 return memory; 65 return memory;
63 if (!ops->alloc_coherent) 66 if (!ops->alloc)
64 return NULL; 67 return NULL;
65 68
66 memory = ops->alloc_coherent(dev, size, dma_handle, gfp); 69 memory = ops->alloc(dev, size, dma_handle, gfp, attrs);
67 debug_dma_alloc_coherent(dev, size, *dma_handle, memory); 70 debug_dma_alloc_coherent(dev, size, *dma_handle, memory);
68 71
69 return memory; 72 return memory;
70} 73}
71 74
72static inline void dma_free_coherent(struct device *dev, size_t size, 75#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL)
73 void *vaddr, dma_addr_t dma_handle) 76
77static inline void dma_free_attrs(struct device *dev, size_t size,
78 void *vaddr, dma_addr_t dma_handle,
79 struct dma_attrs *attrs)
74{ 80{
75 struct dma_map_ops *ops = get_dma_ops(dev); 81 struct dma_map_ops *ops = get_dma_ops(dev);
76 82
@@ -78,14 +84,16 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
78 return; 84 return;
79 85
80 debug_dma_free_coherent(dev, size, vaddr, dma_handle); 86 debug_dma_free_coherent(dev, size, vaddr, dma_handle);
81 if (ops->free_coherent) 87 if (ops->free)
82 ops->free_coherent(dev, size, vaddr, dma_handle); 88 ops->free(dev, size, vaddr, dma_handle, attrs);
83} 89}
84 90
85/* arch/sh/mm/consistent.c */ 91/* arch/sh/mm/consistent.c */
86extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, 92extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
87 dma_addr_t *dma_addr, gfp_t flag); 93 dma_addr_t *dma_addr, gfp_t flag,
94 struct dma_attrs *attrs);
88extern void dma_generic_free_coherent(struct device *dev, size_t size, 95extern void dma_generic_free_coherent(struct device *dev, size_t size,
89 void *vaddr, dma_addr_t dma_handle); 96 void *vaddr, dma_addr_t dma_handle,
97 struct dma_attrs *attrs);
90 98
91#endif /* __ASM_SH_DMA_MAPPING_H */ 99#endif /* __ASM_SH_DMA_MAPPING_H */
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index 3c55b87f8b63..5b0bfcda6d0b 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -63,8 +63,8 @@ static void nommu_sync_sg(struct device *dev, struct scatterlist *sg,
63#endif 63#endif
64 64
65struct dma_map_ops nommu_dma_ops = { 65struct dma_map_ops nommu_dma_ops = {
66 .alloc_coherent = dma_generic_alloc_coherent, 66 .alloc = dma_generic_alloc_coherent,
67 .free_coherent = dma_generic_free_coherent, 67 .free = dma_generic_free_coherent,
68 .map_page = nommu_map_page, 68 .map_page = nommu_map_page,
69 .map_sg = nommu_map_sg, 69 .map_sg = nommu_map_sg,
70#ifdef CONFIG_DMA_NONCOHERENT 70#ifdef CONFIG_DMA_NONCOHERENT
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index f251b5f27652..b81d9dbf9fef 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -33,7 +33,8 @@ static int __init dma_init(void)
33fs_initcall(dma_init); 33fs_initcall(dma_init);
34 34
35void *dma_generic_alloc_coherent(struct device *dev, size_t size, 35void *dma_generic_alloc_coherent(struct device *dev, size_t size,
36 dma_addr_t *dma_handle, gfp_t gfp) 36 dma_addr_t *dma_handle, gfp_t gfp,
37 struct dma_attrs *attrs)
37{ 38{
38 void *ret, *ret_nocache; 39 void *ret, *ret_nocache;
39 int order = get_order(size); 40 int order = get_order(size);
@@ -64,7 +65,8 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
64} 65}
65 66
66void dma_generic_free_coherent(struct device *dev, size_t size, 67void dma_generic_free_coherent(struct device *dev, size_t size,
67 void *vaddr, dma_addr_t dma_handle) 68 void *vaddr, dma_addr_t dma_handle,
69 struct dma_attrs *attrs)
68{ 70{
69 int order = get_order(size); 71 int order = get_order(size);
70 unsigned long pfn = dma_handle >> PAGE_SHIFT; 72 unsigned long pfn = dma_handle >> PAGE_SHIFT;