diff options
author | Becky Bruce <beckyb@kernel.crashing.org> | 2009-09-21 04:26:34 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-09-24 01:31:43 -0400 |
commit | 1cebd7a0f62804ca24f7b7b35e8105000b9e879a (patch) | |
tree | 57f04a5882d595cab859e2820d998bcde4660074 /arch/powerpc/include/asm/dma-mapping.h | |
parent | b9eceb2307f8dda124669a9dc213aad8c1569b5a (diff) |
powerpc: Rename get_dma_direct_offset get_dma_offset
The former is no longer really accurate with the swiotlb case now
a possibility. I also move it into dma-mapping.h - it no longer
needs to be in dma.c, and there are about to be some more accessors
that should all end up in the same place. A comment is added to
indicate that this function is not used in configs where there is no
simple dma offset, such as the iommu case.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include/asm/dma-mapping.h')
-rw-r--r-- | arch/powerpc/include/asm/dma-mapping.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index cb2ca41dd526..34b919fe8cda 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, | |||
26 | extern void dma_direct_free_coherent(struct device *dev, size_t size, | 26 | extern 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 | ||
29 | extern 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,22 @@ 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 | */ | ||
100 | static inline unsigned long get_dma_offset(struct device *dev) | ||
101 | { | ||
102 | if (dev) | ||
103 | return (unsigned long)dev->archdata.dma_data; | ||
104 | |||
105 | return PCI_DRAM_OFFSET; | ||
106 | } | ||
107 | |||
93 | /* this will be removed soon */ | 108 | /* this will be removed soon */ |
94 | #define flush_write_buffers() | 109 | #define flush_write_buffers() |
95 | 110 | ||
@@ -181,12 +196,12 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | |||
181 | 196 | ||
182 | static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) | 197 | static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) |
183 | { | 198 | { |
184 | return paddr + get_dma_direct_offset(dev); | 199 | return paddr + get_dma_offset(dev); |
185 | } | 200 | } |
186 | 201 | ||
187 | static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr) | 202 | static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr) |
188 | { | 203 | { |
189 | return daddr - get_dma_direct_offset(dev); | 204 | return daddr - get_dma_offset(dev); |
190 | } | 205 | } |
191 | 206 | ||
192 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | 207 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) |