diff options
author | Mark Nelson <markn@au1.ibm.com> | 2008-07-04 15:05:42 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-07-09 02:30:43 -0400 |
commit | 3affedc4e1ce837033b6c5e9289d2ce2f5a62d31 (patch) | |
tree | 83296af2c727e5b5f64b88b629dcf37f8e60e3f0 /arch/powerpc/kernel/dma_64.c | |
parent | c8692362db3db3a6f644e05a477161d967430aac (diff) |
powerpc/dma: implement new dma_*map*_attrs() interfaces
Update powerpc to use the new dma_*map*_attrs() interfaces. In doing so
update struct dma_mapping_ops to accept a struct dma_attrs and propagate
these changes through to all users of the code (generic IOMMU and the
64bit DMA code, and the iseries and ps3 platform code).
The old dma_*map_*() interfaces are reimplemented as calls to the
corresponding new interfaces.
Signed-off-by: Mark Nelson <markn@au1.ibm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/dma_64.c')
-rw-r--r-- | arch/powerpc/kernel/dma_64.c | 34 |
1 files changed, 22 insertions, 12 deletions
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 | */ |
51 | static dma_addr_t dma_iommu_map_single(struct device *dev, void *vaddr, | 51 | static 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 | ||
60 | static void dma_iommu_unmap_single(struct device *dev, dma_addr_t dma_handle, | 61 | static 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 | ||
68 | static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist, | 71 | static 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 | ||
75 | static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist, | 79 | static 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 | ||
149 | static dma_addr_t dma_direct_map_single(struct device *dev, void *ptr, | 155 | static 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 | ||
156 | static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr, | 163 | static 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 | ||
162 | static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, | 170 | static 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 | ||
176 | static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg, | 185 | static 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 | ||