diff options
Diffstat (limited to 'arch/powerpc/kernel/dma.c')
| -rw-r--r-- | arch/powerpc/kernel/dma.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c index 84d6367ec003..cf02cad62d9a 100644 --- a/arch/powerpc/kernel/dma.c +++ b/arch/powerpc/kernel/dma.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/memblock.h> | 12 | #include <linux/memblock.h> |
| 13 | #include <asm/bug.h> | 13 | #include <asm/bug.h> |
| 14 | #include <asm/abs_addr.h> | 14 | #include <asm/abs_addr.h> |
| 15 | #include <asm/machdep.h> | ||
| 15 | 16 | ||
| 16 | /* | 17 | /* |
| 17 | * Generic direct DMA implementation | 18 | * Generic direct DMA implementation |
| @@ -89,7 +90,7 @@ static int dma_direct_dma_supported(struct device *dev, u64 mask) | |||
| 89 | /* Could be improved so platforms can set the limit in case | 90 | /* Could be improved so platforms can set the limit in case |
| 90 | * they have limited DMA windows | 91 | * they have limited DMA windows |
| 91 | */ | 92 | */ |
| 92 | return mask >= (memblock_end_of_DRAM() - 1); | 93 | return mask >= get_dma_offset(dev) + (memblock_end_of_DRAM() - 1); |
| 93 | #else | 94 | #else |
| 94 | return 1; | 95 | return 1; |
| 95 | #endif | 96 | #endif |
| @@ -154,6 +155,23 @@ EXPORT_SYMBOL(dma_direct_ops); | |||
| 154 | 155 | ||
| 155 | #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16) | 156 | #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16) |
| 156 | 157 | ||
| 158 | int dma_set_mask(struct device *dev, u64 dma_mask) | ||
| 159 | { | ||
| 160 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | ||
| 161 | |||
| 162 | if (ppc_md.dma_set_mask) | ||
| 163 | return ppc_md.dma_set_mask(dev, dma_mask); | ||
| 164 | if (unlikely(dma_ops == NULL)) | ||
| 165 | return -EIO; | ||
| 166 | if (dma_ops->set_dma_mask != NULL) | ||
| 167 | return dma_ops->set_dma_mask(dev, dma_mask); | ||
| 168 | if (!dev->dma_mask || !dma_supported(dev, dma_mask)) | ||
| 169 | return -EIO; | ||
| 170 | *dev->dma_mask = dma_mask; | ||
| 171 | return 0; | ||
| 172 | } | ||
| 173 | EXPORT_SYMBOL(dma_set_mask); | ||
| 174 | |||
| 157 | static int __init dma_init(void) | 175 | static int __init dma_init(void) |
| 158 | { | 176 | { |
| 159 | dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES); | 177 | dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES); |
