root/arch/arm/include/asm/dma-direct.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. __phys_to_dma
  2. __dma_to_phys
  3. dma_capable

   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 #ifndef ASM_ARM_DMA_DIRECT_H
   3 #define ASM_ARM_DMA_DIRECT_H 1
   4 
   5 static inline dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr)
   6 {
   7         unsigned int offset = paddr & ~PAGE_MASK;
   8         return pfn_to_dma(dev, __phys_to_pfn(paddr)) + offset;
   9 }
  10 
  11 static inline phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dev_addr)
  12 {
  13         unsigned int offset = dev_addr & ~PAGE_MASK;
  14         return __pfn_to_phys(dma_to_pfn(dev, dev_addr)) + offset;
  15 }
  16 
  17 static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
  18 {
  19         u64 limit, mask;
  20 
  21         if (!dev->dma_mask)
  22                 return 0;
  23 
  24         mask = *dev->dma_mask;
  25 
  26         limit = (mask + 1) & ~mask;
  27         if (limit && size > limit)
  28                 return 0;
  29 
  30         if ((addr | (addr + size - 1)) & ~mask)
  31                 return 0;
  32 
  33         return 1;
  34 }
  35 
  36 #endif /* ASM_ARM_DMA_DIRECT_H */

/* [<][>][^][v][top][bottom][index][help] */