aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/dma-mapping.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/include/asm/dma-mapping.h')
-rw-r--r--arch/powerpc/include/asm/dma-mapping.h27
1 files changed, 24 insertions, 3 deletions
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index cb2ca41dd526..e281daebddca 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -26,7 +26,6 @@ extern void *dma_direct_alloc_coherent(struct device *dev, size_t size,
26extern void dma_direct_free_coherent(struct device *dev, size_t size, 26extern void dma_direct_free_coherent(struct device *dev, size_t size,
27 void *vaddr, dma_addr_t dma_handle); 27 void *vaddr, dma_addr_t dma_handle);
28 28
29extern unsigned long get_dma_direct_offset(struct device *dev);
30 29
31#ifdef CONFIG_NOT_COHERENT_CACHE 30#ifdef CONFIG_NOT_COHERENT_CACHE
32/* 31/*
@@ -90,6 +89,28 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
90 dev->archdata.dma_ops = ops; 89 dev->archdata.dma_ops = ops;
91} 90}
92 91
92/*
93 * get_dma_offset()
94 *
95 * Get the dma offset on configurations where the dma address can be determined
96 * from the physical address by looking at a simple offset. Direct dma and
97 * swiotlb use this function, but it is typically not used by implementations
98 * with an iommu.
99 */
100static inline dma_addr_t get_dma_offset(struct device *dev)
101{
102 if (dev)
103 return dev->archdata.dma_data.dma_offset;
104
105 return PCI_DRAM_OFFSET;
106}
107
108static inline void set_dma_offset(struct device *dev, dma_addr_t off)
109{
110 if (dev)
111 dev->archdata.dma_data.dma_offset = off;
112}
113
93/* this will be removed soon */ 114/* this will be removed soon */
94#define flush_write_buffers() 115#define flush_write_buffers()
95 116
@@ -181,12 +202,12 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
181 202
182static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) 203static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
183{ 204{
184 return paddr + get_dma_direct_offset(dev); 205 return paddr + get_dma_offset(dev);
185} 206}
186 207
187static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr) 208static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
188{ 209{
189 return daddr - get_dma_direct_offset(dev); 210 return daddr - get_dma_offset(dev);
190} 211}
191 212
192#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 213#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)