aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/powerpc/kernel/dma_64.c34
-rw-r--r--arch/powerpc/kernel/ibmebus.c12
-rw-r--r--arch/powerpc/kernel/iommu.c11
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c4
-rw-r--r--arch/powerpc/platforms/ps3/system-bus.c17
-rw-r--r--include/asm-powerpc/dma-mapping.h116
-rw-r--r--include/asm-powerpc/iommu.h12
8 files changed, 144 insertions, 63 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index f2a0f50146e1..462c86a4eefb 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -110,6 +110,7 @@ config PPC
110 select HAVE_KPROBES 110 select HAVE_KPROBES
111 select HAVE_KRETPROBES 111 select HAVE_KRETPROBES
112 select HAVE_LMB 112 select HAVE_LMB
113 select HAVE_DMA_ATTRS
113 114
114config EARLY_PRINTK 115config EARLY_PRINTK
115 bool 116 bool
diff --git a/arch/powerpc/kernel/dma_64.c b/arch/powerpc/kernel/dma_64.c
index 739744508c6e..3ae0c35d21f9 100644
--- a/arch/powerpc/kernel/dma_64.c
+++ b/arch/powerpc/kernel/dma_64.c
@@ -50,32 +50,38 @@ static void dma_iommu_free_coherent(struct device *dev, size_t size,
50 */ 50 */
51static dma_addr_t dma_iommu_map_single(struct device *dev, void *vaddr, 51static dma_addr_t dma_iommu_map_single(struct device *dev, void *vaddr,
52 size_t size, 52 size_t size,
53 enum dma_data_direction direction) 53 enum dma_data_direction direction,
54 struct dma_attrs *attrs)
54{ 55{
55 return iommu_map_single(dev, dev->archdata.dma_data, vaddr, size, 56 return iommu_map_single(dev, dev->archdata.dma_data, vaddr, size,
56 device_to_mask(dev), direction); 57 device_to_mask(dev), direction, attrs);
57} 58}
58 59
59 60
60static void dma_iommu_unmap_single(struct device *dev, dma_addr_t dma_handle, 61static void dma_iommu_unmap_single(struct device *dev, dma_addr_t dma_handle,
61 size_t size, 62 size_t size,
62 enum dma_data_direction direction) 63 enum dma_data_direction direction,
64 struct dma_attrs *attrs)
63{ 65{
64 iommu_unmap_single(dev->archdata.dma_data, dma_handle, size, direction); 66 iommu_unmap_single(dev->archdata.dma_data, dma_handle, size, direction,
67 attrs);
65} 68}
66 69
67 70
68static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist, 71static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,
69 int nelems, enum dma_data_direction direction) 72 int nelems, enum dma_data_direction direction,
73 struct dma_attrs *attrs)
70{ 74{
71 return iommu_map_sg(dev, dev->archdata.dma_data, sglist, nelems, 75 return iommu_map_sg(dev, dev->archdata.dma_data, sglist, nelems,
72 device_to_mask(dev), direction); 76 device_to_mask(dev), direction, attrs);
73} 77}
74 78
75static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist, 79static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist,
76 int nelems, enum dma_data_direction direction) 80 int nelems, enum dma_data_direction direction,
81 struct dma_attrs *attrs)
77{ 82{
78 iommu_unmap_sg(dev->archdata.dma_data, sglist, nelems, direction); 83 iommu_unmap_sg(dev->archdata.dma_data, sglist, nelems, direction,
84 attrs);
79} 85}
80 86
81/* We support DMA to/from any memory page via the iommu */ 87/* We support DMA to/from any memory page via the iommu */
@@ -148,19 +154,22 @@ static void dma_direct_free_coherent(struct device *dev, size_t size,
148 154
149static dma_addr_t dma_direct_map_single(struct device *dev, void *ptr, 155static dma_addr_t dma_direct_map_single(struct device *dev, void *ptr,
150 size_t size, 156 size_t size,
151 enum dma_data_direction direction) 157 enum dma_data_direction direction,
158 struct dma_attrs *attrs)
152{ 159{
153 return virt_to_abs(ptr) + get_dma_direct_offset(dev); 160 return virt_to_abs(ptr) + get_dma_direct_offset(dev);
154} 161}
155 162
156static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr, 163static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr,
157 size_t size, 164 size_t size,
158 enum dma_data_direction direction) 165 enum dma_data_direction direction,
166 struct dma_attrs *attrs)
159{ 167{
160} 168}
161 169
162static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, 170static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
163 int nents, enum dma_data_direction direction) 171 int nents, enum dma_data_direction direction,
172 struct dma_attrs *attrs)
164{ 173{
165 struct scatterlist *sg; 174 struct scatterlist *sg;
166 int i; 175 int i;
@@ -174,7 +183,8 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
174} 183}
175 184
176static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg, 185static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg,
177 int nents, enum dma_data_direction direction) 186 int nents, enum dma_data_direction direction,
187 struct dma_attrs *attrs)
178{ 188{
179} 189}
180 190
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 9971159c8040..e3b1fcd6d991 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -82,7 +82,8 @@ static void ibmebus_free_coherent(struct device *dev,
82static dma_addr_t ibmebus_map_single(struct device *dev, 82static dma_addr_t ibmebus_map_single(struct device *dev,
83 void *ptr, 83 void *ptr,
84 size_t size, 84 size_t size,
85 enum dma_data_direction direction) 85 enum dma_data_direction direction,
86 struct dma_attrs *attrs)
86{ 87{
87 return (dma_addr_t)(ptr); 88 return (dma_addr_t)(ptr);
88} 89}
@@ -90,14 +91,16 @@ static dma_addr_t ibmebus_map_single(struct device *dev,
90static void ibmebus_unmap_single(struct device *dev, 91static void ibmebus_unmap_single(struct device *dev,
91 dma_addr_t dma_addr, 92 dma_addr_t dma_addr,
92 size_t size, 93 size_t size,
93 enum dma_data_direction direction) 94 enum dma_data_direction direction,
95 struct dma_attrs *attrs)
94{ 96{
95 return; 97 return;
96} 98}
97 99
98static int ibmebus_map_sg(struct device *dev, 100static int ibmebus_map_sg(struct device *dev,
99 struct scatterlist *sgl, 101 struct scatterlist *sgl,
100 int nents, enum dma_data_direction direction) 102 int nents, enum dma_data_direction direction,
103 struct dma_attrs *attrs)
101{ 104{
102 struct scatterlist *sg; 105 struct scatterlist *sg;
103 int i; 106 int i;
@@ -112,7 +115,8 @@ static int ibmebus_map_sg(struct device *dev,
112 115
113static void ibmebus_unmap_sg(struct device *dev, 116static void ibmebus_unmap_sg(struct device *dev,
114 struct scatterlist *sg, 117 struct scatterlist *sg,
115 int nents, enum dma_data_direction direction) 118 int nents, enum dma_data_direction direction,
119 struct dma_attrs *attrs)
116{ 120{
117 return; 121 return;
118} 122}
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index ccf00fe9cee6..8c68ee9e5d1c 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -269,7 +269,8 @@ static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
269 269
270int iommu_map_sg(struct device *dev, struct iommu_table *tbl, 270int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
271 struct scatterlist *sglist, int nelems, 271 struct scatterlist *sglist, int nelems,
272 unsigned long mask, enum dma_data_direction direction) 272 unsigned long mask, enum dma_data_direction direction,
273 struct dma_attrs *attrs)
273{ 274{
274 dma_addr_t dma_next = 0, dma_addr; 275 dma_addr_t dma_next = 0, dma_addr;
275 unsigned long flags; 276 unsigned long flags;
@@ -411,7 +412,8 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
411 412
412 413
413void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, 414void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
414 int nelems, enum dma_data_direction direction) 415 int nelems, enum dma_data_direction direction,
416 struct dma_attrs *attrs)
415{ 417{
416 struct scatterlist *sg; 418 struct scatterlist *sg;
417 unsigned long flags; 419 unsigned long flags;
@@ -553,7 +555,7 @@ void iommu_free_table(struct iommu_table *tbl, const char *node_name)
553 */ 555 */
554dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl, 556dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl,
555 void *vaddr, size_t size, unsigned long mask, 557 void *vaddr, size_t size, unsigned long mask,
556 enum dma_data_direction direction) 558 enum dma_data_direction direction, struct dma_attrs *attrs)
557{ 559{
558 dma_addr_t dma_handle = DMA_ERROR_CODE; 560 dma_addr_t dma_handle = DMA_ERROR_CODE;
559 unsigned long uaddr; 561 unsigned long uaddr;
@@ -586,7 +588,8 @@ dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl,
586} 588}
587 589
588void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, 590void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
589 size_t size, enum dma_data_direction direction) 591 size_t size, enum dma_data_direction direction,
592 struct dma_attrs *attrs)
590{ 593{
591 unsigned int npages; 594 unsigned int npages;
592 595
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c
index 11fa3c772ed5..ab5d8687c3cf 100644
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -214,13 +214,13 @@ dma_addr_t iseries_hv_map(void *vaddr, size_t size,
214 enum dma_data_direction direction) 214 enum dma_data_direction direction)
215{ 215{
216 return iommu_map_single(NULL, &vio_iommu_table, vaddr, size, 216 return iommu_map_single(NULL, &vio_iommu_table, vaddr, size,
217 DMA_32BIT_MASK, direction); 217 DMA_32BIT_MASK, direction, NULL);
218} 218}
219 219
220void iseries_hv_unmap(dma_addr_t dma_handle, size_t size, 220void iseries_hv_unmap(dma_addr_t dma_handle, size_t size,
221 enum dma_data_direction direction) 221 enum dma_data_direction direction)
222{ 222{
223 iommu_unmap_single(&vio_iommu_table, dma_handle, size, direction); 223 iommu_unmap_single(&vio_iommu_table, dma_handle, size, direction, NULL);
224} 224}
225 225
226void __init iommu_vio_init(void) 226void __init iommu_vio_init(void)
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index cf215e981c3e..d66c3628a112 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -555,7 +555,7 @@ static void ps3_free_coherent(struct device *_dev, size_t size, void *vaddr,
555 */ 555 */
556 556
557static dma_addr_t ps3_sb_map_single(struct device *_dev, void *ptr, size_t size, 557static dma_addr_t ps3_sb_map_single(struct device *_dev, void *ptr, size_t size,
558 enum dma_data_direction direction) 558 enum dma_data_direction direction, struct dma_attrs *attrs)
559{ 559{
560 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); 560 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
561 int result; 561 int result;
@@ -575,7 +575,8 @@ static dma_addr_t ps3_sb_map_single(struct device *_dev, void *ptr, size_t size,
575 575
576static dma_addr_t ps3_ioc0_map_single(struct device *_dev, void *ptr, 576static dma_addr_t ps3_ioc0_map_single(struct device *_dev, void *ptr,
577 size_t size, 577 size_t size,
578 enum dma_data_direction direction) 578 enum dma_data_direction direction,
579 struct dma_attrs *attrs)
579{ 580{
580 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); 581 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
581 int result; 582 int result;
@@ -608,7 +609,7 @@ static dma_addr_t ps3_ioc0_map_single(struct device *_dev, void *ptr,
608} 609}
609 610
610static void ps3_unmap_single(struct device *_dev, dma_addr_t dma_addr, 611static void ps3_unmap_single(struct device *_dev, dma_addr_t dma_addr,
611 size_t size, enum dma_data_direction direction) 612 size_t size, enum dma_data_direction direction, struct dma_attrs *attrs)
612{ 613{
613 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); 614 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
614 int result; 615 int result;
@@ -622,7 +623,7 @@ static void ps3_unmap_single(struct device *_dev, dma_addr_t dma_addr,
622} 623}
623 624
624static int ps3_sb_map_sg(struct device *_dev, struct scatterlist *sgl, 625static int ps3_sb_map_sg(struct device *_dev, struct scatterlist *sgl,
625 int nents, enum dma_data_direction direction) 626 int nents, enum dma_data_direction direction, struct dma_attrs *attrs)
626{ 627{
627#if defined(CONFIG_PS3_DYNAMIC_DMA) 628#if defined(CONFIG_PS3_DYNAMIC_DMA)
628 BUG_ON("do"); 629 BUG_ON("do");
@@ -651,14 +652,15 @@ static int ps3_sb_map_sg(struct device *_dev, struct scatterlist *sgl,
651 652
652static int ps3_ioc0_map_sg(struct device *_dev, struct scatterlist *sg, 653static int ps3_ioc0_map_sg(struct device *_dev, struct scatterlist *sg,
653 int nents, 654 int nents,
654 enum dma_data_direction direction) 655 enum dma_data_direction direction,
656 struct dma_attrs *attrs)
655{ 657{
656 BUG(); 658 BUG();
657 return 0; 659 return 0;
658} 660}
659 661
660static void ps3_sb_unmap_sg(struct device *_dev, struct scatterlist *sg, 662static void ps3_sb_unmap_sg(struct device *_dev, struct scatterlist *sg,
661 int nents, enum dma_data_direction direction) 663 int nents, enum dma_data_direction direction, struct dma_attrs *attrs)
662{ 664{
663#if defined(CONFIG_PS3_DYNAMIC_DMA) 665#if defined(CONFIG_PS3_DYNAMIC_DMA)
664 BUG_ON("do"); 666 BUG_ON("do");
@@ -666,7 +668,8 @@ static void ps3_sb_unmap_sg(struct device *_dev, struct scatterlist *sg,
666} 668}
667 669
668static void ps3_ioc0_unmap_sg(struct device *_dev, struct scatterlist *sg, 670static void ps3_ioc0_unmap_sg(struct device *_dev, struct scatterlist *sg,
669 int nents, enum dma_data_direction direction) 671 int nents, enum dma_data_direction direction,
672 struct dma_attrs *attrs)
670{ 673{
671 BUG(); 674 BUG();
672} 675}
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index bbefb69bfb67..de1395023cb1 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -13,6 +13,7 @@
13/* need struct page definitions */ 13/* need struct page definitions */
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/scatterlist.h> 15#include <linux/scatterlist.h>
16#include <linux/dma-attrs.h>
16#include <asm/io.h> 17#include <asm/io.h>
17 18
18#define DMA_ERROR_CODE (~(dma_addr_t)0x0) 19#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
@@ -53,13 +54,17 @@ struct dma_mapping_ops {
53 void (*free_coherent)(struct device *dev, size_t size, 54 void (*free_coherent)(struct device *dev, size_t size,
54 void *vaddr, dma_addr_t dma_handle); 55 void *vaddr, dma_addr_t dma_handle);
55 dma_addr_t (*map_single)(struct device *dev, void *ptr, 56 dma_addr_t (*map_single)(struct device *dev, void *ptr,
56 size_t size, enum dma_data_direction direction); 57 size_t size, enum dma_data_direction direction,
58 struct dma_attrs *attrs);
57 void (*unmap_single)(struct device *dev, dma_addr_t dma_addr, 59 void (*unmap_single)(struct device *dev, dma_addr_t dma_addr,
58 size_t size, enum dma_data_direction direction); 60 size_t size, enum dma_data_direction direction,
61 struct dma_attrs *attrs);
59 int (*map_sg)(struct device *dev, struct scatterlist *sg, 62 int (*map_sg)(struct device *dev, struct scatterlist *sg,
60 int nents, enum dma_data_direction direction); 63 int nents, enum dma_data_direction direction,
64 struct dma_attrs *attrs);
61 void (*unmap_sg)(struct device *dev, struct scatterlist *sg, 65 void (*unmap_sg)(struct device *dev, struct scatterlist *sg,
62 int nents, enum dma_data_direction direction); 66 int nents, enum dma_data_direction direction,
67 struct dma_attrs *attrs);
63 int (*dma_supported)(struct device *dev, u64 mask); 68 int (*dma_supported)(struct device *dev, u64 mask);
64 int (*set_dma_mask)(struct device *dev, u64 dma_mask); 69 int (*set_dma_mask)(struct device *dev, u64 dma_mask);
65}; 70};
@@ -109,6 +114,77 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
109 return 0; 114 return 0;
110} 115}
111 116
117static inline dma_addr_t dma_map_single_attrs(struct device *dev,
118 void *cpu_addr,
119 size_t size,
120 enum dma_data_direction direction,
121 struct dma_attrs *attrs)
122{
123 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
124
125 BUG_ON(!dma_ops);
126 return dma_ops->map_single(dev, cpu_addr, size, direction, attrs);
127}
128
129static inline void dma_unmap_single_attrs(struct device *dev,
130 dma_addr_t dma_addr,
131 size_t size,
132 enum dma_data_direction direction,
133 struct dma_attrs *attrs)
134{
135 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
136
137 BUG_ON(!dma_ops);
138 dma_ops->unmap_single(dev, dma_addr, size, direction, attrs);
139}
140
141static inline dma_addr_t dma_map_page_attrs(struct device *dev,
142 struct page *page,
143 unsigned long offset, size_t size,
144 enum dma_data_direction direction,
145 struct dma_attrs *attrs)
146{
147 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
148
149 BUG_ON(!dma_ops);
150 return dma_ops->map_single(dev, page_address(page) + offset, size,
151 direction, attrs);
152}
153
154static inline void dma_unmap_page_attrs(struct device *dev,
155 dma_addr_t dma_address,
156 size_t size,
157 enum dma_data_direction direction,
158 struct dma_attrs *attrs)
159{
160 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
161
162 BUG_ON(!dma_ops);
163 dma_ops->unmap_single(dev, dma_address, size, direction, attrs);
164}
165
166static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
167 int nents, enum dma_data_direction direction,
168 struct dma_attrs *attrs)
169{
170 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
171
172 BUG_ON(!dma_ops);
173 return dma_ops->map_sg(dev, sg, nents, direction, attrs);
174}
175
176static inline void dma_unmap_sg_attrs(struct device *dev,
177 struct scatterlist *sg,
178 int nhwentries,
179 enum dma_data_direction direction,
180 struct dma_attrs *attrs)
181{
182 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
183
184 BUG_ON(!dma_ops);
185 dma_ops->unmap_sg(dev, sg, nhwentries, direction, attrs);
186}
187
112static inline void *dma_alloc_coherent(struct device *dev, size_t size, 188static inline void *dma_alloc_coherent(struct device *dev, size_t size,
113 dma_addr_t *dma_handle, gfp_t flag) 189 dma_addr_t *dma_handle, gfp_t flag)
114{ 190{
@@ -131,63 +207,43 @@ static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
131 size_t size, 207 size_t size,
132 enum dma_data_direction direction) 208 enum dma_data_direction direction)
133{ 209{
134 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 210 return dma_map_single_attrs(dev, cpu_addr, size, direction, NULL);
135
136 BUG_ON(!dma_ops);
137 return dma_ops->map_single(dev, cpu_addr, size, direction);
138} 211}
139 212
140static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, 213static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
141 size_t size, 214 size_t size,
142 enum dma_data_direction direction) 215 enum dma_data_direction direction)
143{ 216{
144 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 217 dma_unmap_single_attrs(dev, dma_addr, size, direction, NULL);
145
146 BUG_ON(!dma_ops);
147 dma_ops->unmap_single(dev, dma_addr, size, direction);
148} 218}
149 219
150static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, 220static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
151 unsigned long offset, size_t size, 221 unsigned long offset, size_t size,
152 enum dma_data_direction direction) 222 enum dma_data_direction direction)
153{ 223{
154 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 224 return dma_map_page_attrs(dev, page, offset, size, direction, NULL);
155
156 BUG_ON(!dma_ops);
157 return dma_ops->map_single(dev, page_address(page) + offset, size,
158 direction);
159} 225}
160 226
161static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address, 227static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
162 size_t size, 228 size_t size,
163 enum dma_data_direction direction) 229 enum dma_data_direction direction)
164{ 230{
165 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 231 dma_unmap_page_attrs(dev, dma_address, size, direction, NULL);
166
167 BUG_ON(!dma_ops);
168 dma_ops->unmap_single(dev, dma_address, size, direction);
169} 232}
170 233
171static inline int dma_map_sg(struct device *dev, struct scatterlist *sg, 234static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
172 int nents, enum dma_data_direction direction) 235 int nents, enum dma_data_direction direction)
173{ 236{
174 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 237 return dma_map_sg_attrs(dev, sg, nents, direction, NULL);
175
176 BUG_ON(!dma_ops);
177 return dma_ops->map_sg(dev, sg, nents, direction);
178} 238}
179 239
180static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg, 240static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
181 int nhwentries, 241 int nhwentries,
182 enum dma_data_direction direction) 242 enum dma_data_direction direction)
183{ 243{
184 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 244 dma_unmap_sg_attrs(dev, sg, nhwentries, direction, NULL);
185
186 BUG_ON(!dma_ops);
187 dma_ops->unmap_sg(dev, sg, nhwentries, direction);
188} 245}
189 246
190
191/* 247/*
192 * Available generic sets of operations 248 * Available generic sets of operations
193 */ 249 */
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h
index 65f6682bee87..51ecfef8d843 100644
--- a/include/asm-powerpc/iommu.h
+++ b/include/asm-powerpc/iommu.h
@@ -81,9 +81,11 @@ extern struct iommu_table *iommu_init_table(struct iommu_table * tbl,
81 81
82extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl, 82extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
83 struct scatterlist *sglist, int nelems, 83 struct scatterlist *sglist, int nelems,
84 unsigned long mask, enum dma_data_direction direction); 84 unsigned long mask, enum dma_data_direction direction,
85 struct dma_attrs *attrs);
85extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, 86extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
86 int nelems, enum dma_data_direction direction); 87 int nelems, enum dma_data_direction direction,
88 struct dma_attrs *attrs);
87 89
88extern void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl, 90extern void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl,
89 size_t size, dma_addr_t *dma_handle, 91 size_t size, dma_addr_t *dma_handle,
@@ -92,9 +94,11 @@ extern void iommu_free_coherent(struct iommu_table *tbl, size_t size,
92 void *vaddr, dma_addr_t dma_handle); 94 void *vaddr, dma_addr_t dma_handle);
93extern dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl, 95extern dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl,
94 void *vaddr, size_t size, unsigned long mask, 96 void *vaddr, size_t size, unsigned long mask,
95 enum dma_data_direction direction); 97 enum dma_data_direction direction,
98 struct dma_attrs *attrs);
96extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, 99extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
97 size_t size, enum dma_data_direction direction); 100 size_t size, enum dma_data_direction direction,
101 struct dma_attrs *attrs);
98 102
99extern void iommu_init_early_pSeries(void); 103extern void iommu_init_early_pSeries(void);
100extern void iommu_init_early_iSeries(void); 104extern void iommu_init_early_iSeries(void);