Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Geoff Levand and committed by
Paul Mackerras
35063bb2 97ec1675

+21 -2
+21 -2
arch/powerpc/platforms/ps3/system-bus.c
··· 272 272 static int ps3_map_sg(struct device *_dev, struct scatterlist *sg, int nents, 273 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 278 #if defined(CONFIG_PS3_DYNAMIC_DMA) 276 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 297 #endif 278 - return 0; 279 298 } 280 299 281 300 static void ps3_unmap_sg(struct device *_dev, struct scatterlist *sg, ··· 307 288 308 289 static int ps3_dma_supported(struct device *_dev, u64 mask) 309 290 { 310 - return 1; 291 + return mask >= DMA_32BIT_MASK; 311 292 } 312 293 313 294 static struct dma_mapping_ops ps3_dma_ops = {