diff options
author | Geoff Levand <geoffrey.levand@am.sony.com> | 2007-01-30 18:20:34 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-02-06 22:03:20 -0500 |
commit | 35063bb2eaf85bd0f6e3acefae2d95cb0120eb3e (patch) | |
tree | 70fcfad56c58b0489430afb81a17df8b9f35bec0 /arch | |
parent | 97ec1675999eae96975a30facbedc2e6c0c832bc (diff) |
[POWERPC] PS3: Fix DMA scatter-gather
Add the missing pieces to support DMA scatter-gather on the PS3 system bus.
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-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 = { |