GNU Linux-libre 4.14.266-gnu1
[releases.git] / arch / sparc / include / asm / dma-mapping.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef ___ASM_SPARC_DMA_MAPPING_H
3 #define ___ASM_SPARC_DMA_MAPPING_H
4
5 #include <linux/scatterlist.h>
6 #include <linux/mm.h>
7 #include <linux/dma-debug.h>
8
9 static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
10                                   enum dma_data_direction dir)
11 {
12         /* Since dma_{alloc,free}_noncoherent() allocated coherent memory, this
13          * routine can be a nop.
14          */
15 }
16
17 extern const struct dma_map_ops *dma_ops;
18 extern const struct dma_map_ops pci32_dma_ops;
19
20 extern struct bus_type pci_bus_type;
21
22 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
23 {
24 #ifdef CONFIG_SPARC_LEON
25         if (sparc_cpu_model == sparc_leon)
26                 return &pci32_dma_ops;
27 #endif
28 #if defined(CONFIG_SPARC32) && defined(CONFIG_PCI)
29         if (bus == &pci_bus_type)
30                 return &pci32_dma_ops;
31 #endif
32         return dma_ops;
33 }
34
35 #endif