1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef ASM_X86_DMA_DIRECT_H
3 #define ASM_X86_DMA_DIRECT_H 1
5 #include <linux/mem_encrypt.h>
7 #ifdef CONFIG_X86_DMA_REMAP /* Platform code defines bridge-specific code */
8 bool dma_capable(struct device
*dev
, dma_addr_t addr
, size_t size
);
9 dma_addr_t
phys_to_dma(struct device
*dev
, phys_addr_t paddr
);
10 phys_addr_t
dma_to_phys(struct device
*dev
, dma_addr_t daddr
);
12 static inline bool dma_capable(struct device
*dev
, dma_addr_t addr
, size_t size
)
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 __sme_set(paddr
);
25 static inline phys_addr_t
dma_to_phys(struct device
*dev
, dma_addr_t daddr
)
27 return __sme_clr(daddr
);
29 #endif /* CONFIG_X86_DMA_REMAP */
30 #endif /* ASM_X86_DMA_DIRECT_H */