xtensa: fix high memory/reserved memory collision
[cris-mirror.git] / arch / powerpc / include / asm / dma-direct.h
bloba5b59c7654267184b20655a9a6f2d9923aafbe6c
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef ASM_POWERPC_DMA_DIRECT_H
3 #define ASM_POWERPC_DMA_DIRECT_H 1
5 static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
7 #ifdef CONFIG_SWIOTLB
8 struct dev_archdata *sd = &dev->archdata;
10 if (sd->max_direct_dma_addr && addr + size > sd->max_direct_dma_addr)
11 return false;
12 #endif
14 if (!dev->dma_mask)
15 return false;
17 return addr + size - 1 <= *dev->dma_mask;
20 static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
22 return paddr + get_dma_offset(dev);
25 static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
27 return daddr - get_dma_offset(dev);
29 #endif /* ASM_POWERPC_DMA_DIRECT_H */