diff options
-rw-r--r-- | arch/powerpc/platforms/ps3/system-bus.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c index 9f2c6a909e4d..bce6136cbce7 100644 --- a/arch/powerpc/platforms/ps3/system-bus.c +++ b/arch/powerpc/platforms/ps3/system-bus.c | |||
@@ -272,10 +272,29 @@ static void ps3_unmap_single(struct device *_dev, dma_addr_t dma_addr, | |||
272 | static int ps3_map_sg(struct device *_dev, struct scatterlist *sg, int nents, | 272 | static int ps3_map_sg(struct device *_dev, struct scatterlist *sg, int nents, |
273 | enum dma_data_direction direction) | 273 | enum dma_data_direction direction) |
274 | { | 274 | { |
275 | struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev); | ||
276 | int i; | ||
277 | |||
275 | #if defined(CONFIG_PS3_DYNAMIC_DMA) | 278 | #if defined(CONFIG_PS3_DYNAMIC_DMA) |
276 | BUG_ON("do"); | 279 | BUG_ON("do"); |
280 | return -EPERM; | ||
281 | #else | ||
282 | for (i = 0; i < nents; i++, sg++) { | ||
283 | int result = ps3_dma_map(dev->d_region, | ||
284 | page_to_phys(sg->page) + sg->offset, sg->length, | ||
285 | &sg->dma_address); | ||
286 | |||
287 | if (result) { | ||
288 | pr_debug("%s:%d: ps3_dma_map failed (%d)\n", | ||
289 | __func__, __LINE__, result); | ||
290 | return -EINVAL; | ||
291 | } | ||
292 | |||
293 | sg->dma_length = sg->length; | ||
294 | } | ||
295 | |||
296 | return nents; | ||
277 | #endif | 297 | #endif |
278 | return 0; | ||
279 | } | 298 | } |
280 | 299 | ||
281 | static void ps3_unmap_sg(struct device *_dev, struct scatterlist *sg, | 300 | static void ps3_unmap_sg(struct device *_dev, struct scatterlist *sg, |
@@ -288,7 +307,7 @@ static void ps3_unmap_sg(struct device *_dev, struct scatterlist *sg, | |||
288 | 307 | ||
289 | static int ps3_dma_supported(struct device *_dev, u64 mask) | 308 | static int ps3_dma_supported(struct device *_dev, u64 mask) |
290 | { | 309 | { |
291 | return 1; | 310 | return mask >= DMA_32BIT_MASK; |
292 | } | 311 | } |
293 | 312 | ||
294 | static struct dma_mapping_ops ps3_dma_ops = { | 313 | static struct dma_mapping_ops ps3_dma_ops = { |