aboutsummaryrefslogtreecommitdiff
path: root/arch/powerpc/platforms/ps3/system-bus.c
diff options
context:
space:
mode:
authorGeoff Levand <geoffrey.levand@am.sony.com>2007-01-30 15:20:34 -0800
committerPaul Mackerras <paulus@samba.org>2007-02-07 14:03:20 +1100
commit35063bb2eaf85bd0f6e3acefae2d95cb0120eb3e (patch)
tree70fcfad56c58b0489430afb81a17df8b9f35bec0 /arch/powerpc/platforms/ps3/system-bus.c
parent97ec1675999eae96975a30facbedc2e6c0c832bc (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/powerpc/platforms/ps3/system-bus.c')
-rw-r--r--arch/powerpc/platforms/ps3/system-bus.c23
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 9f2c6a909e4..bce6136cbce 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,
static int ps3_map_sg(struct device *_dev, struct scatterlist *sg, int nents,
enum dma_data_direction direction)
{
+ struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
+ int i;
+
#if defined(CONFIG_PS3_DYNAMIC_DMA)
BUG_ON("do");
+ return -EPERM;
+#else
+ for (i = 0; i < nents; i++, sg++) {
+ int result = ps3_dma_map(dev->d_region,
+ page_to_phys(sg->page) + sg->offset, sg->length,
+ &sg->dma_address);
+
+ if (result) {
+ pr_debug("%s:%d: ps3_dma_map failed (%d)\n",
+ __func__, __LINE__, result);
+ return -EINVAL;
+ }
+
+ sg->dma_length = sg->length;
+ }
+
+ return nents;
#endif
- return 0;
}
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,
static int ps3_dma_supported(struct device *_dev, u64 mask)
{
- return 1;
+ return mask >= DMA_32BIT_MASK;
}
static struct dma_mapping_ops ps3_dma_ops = {