diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/dma_64.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/dma_64.c b/arch/powerpc/kernel/dma_64.c index 14206e3f0819..a2d076d005c0 100644 --- a/arch/powerpc/kernel/dma_64.c +++ b/arch/powerpc/kernel/dma_64.c | |||
@@ -117,6 +117,11 @@ EXPORT_SYMBOL(dma_iommu_ops); | |||
117 | */ | 117 | */ |
118 | unsigned long dma_direct_offset; | 118 | unsigned long dma_direct_offset; |
119 | 119 | ||
120 | static unsigned long get_dma_direct_offset(struct device *dev) | ||
121 | { | ||
122 | return (unsigned long)dev->archdata.dma_data; | ||
123 | } | ||
124 | |||
120 | static void *dma_direct_alloc_coherent(struct device *dev, size_t size, | 125 | static void *dma_direct_alloc_coherent(struct device *dev, size_t size, |
121 | dma_addr_t *dma_handle, gfp_t flag) | 126 | dma_addr_t *dma_handle, gfp_t flag) |
122 | { | 127 | { |
@@ -130,7 +135,7 @@ static void *dma_direct_alloc_coherent(struct device *dev, size_t size, | |||
130 | return NULL; | 135 | return NULL; |
131 | ret = page_address(page); | 136 | ret = page_address(page); |
132 | memset(ret, 0, size); | 137 | memset(ret, 0, size); |
133 | *dma_handle = virt_to_abs(ret) | dma_direct_offset; | 138 | *dma_handle = virt_to_abs(ret) + get_dma_direct_offset(dev); |
134 | 139 | ||
135 | return ret; | 140 | return ret; |
136 | } | 141 | } |
@@ -145,7 +150,7 @@ static dma_addr_t dma_direct_map_single(struct device *dev, void *ptr, | |||
145 | size_t size, | 150 | size_t size, |
146 | enum dma_data_direction direction) | 151 | enum dma_data_direction direction) |
147 | { | 152 | { |
148 | return virt_to_abs(ptr) | dma_direct_offset; | 153 | return virt_to_abs(ptr) + get_dma_direct_offset(dev); |
149 | } | 154 | } |
150 | 155 | ||
151 | static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr, | 156 | static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr, |
@@ -161,7 +166,7 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, | |||
161 | int i; | 166 | int i; |
162 | 167 | ||
163 | for_each_sg(sgl, sg, nents, i) { | 168 | for_each_sg(sgl, sg, nents, i) { |
164 | sg->dma_address = sg_phys(sg) | dma_direct_offset; | 169 | sg->dma_address = sg_phys(sg) + get_dma_direct_offset(dev); |
165 | sg->dma_length = sg->length; | 170 | sg->dma_length = sg->length; |
166 | } | 171 | } |
167 | 172 | ||