~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/include/asm/dma-mapping.h

Version: ~ [ linux-5.4-rc7 ] ~ [ linux-5.3.10 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.83 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.153 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.200 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.200 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.76 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _ASM_DMA_MAPPING_H
  2 #define _ASM_DMA_MAPPING_H
  3 
  4 #include <asm/scatterlist.h>
  5 #include <asm/cache.h>
  6 #include <asm-generic/dma-coherent.h>
  7 
  8 #ifndef CONFIG_SGI_IP27 /* Kludge to fix 2.6.39 build for IP27 */
  9 #include <dma-coherence.h>
 10 #endif
 11 
 12 extern struct dma_map_ops *mips_dma_map_ops;
 13 
 14 static inline struct dma_map_ops *get_dma_ops(struct device *dev)
 15 {
 16         if (dev && dev->archdata.dma_ops)
 17                 return dev->archdata.dma_ops;
 18         else
 19                 return mips_dma_map_ops;
 20 }
 21 
 22 static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
 23 {
 24         if (!dev->dma_mask)
 25                 return 0;
 26 
 27         return addr + size <= *dev->dma_mask;
 28 }
 29 
 30 static inline void dma_mark_clean(void *addr, size_t size) {}
 31 
 32 #include <asm-generic/dma-mapping-common.h>
 33 
 34 static inline int dma_supported(struct device *dev, u64 mask)
 35 {
 36         struct dma_map_ops *ops = get_dma_ops(dev);
 37         return ops->dma_supported(dev, mask);
 38 }
 39 
 40 static inline int dma_mapping_error(struct device *dev, u64 mask)
 41 {
 42         struct dma_map_ops *ops = get_dma_ops(dev);
 43         return ops->mapping_error(dev, mask);
 44 }
 45 
 46 static inline int
 47 dma_set_mask(struct device *dev, u64 mask)
 48 {
 49         if(!dev->dma_mask || !dma_supported(dev, mask))
 50                 return -EIO;
 51 
 52         *dev->dma_mask = mask;
 53 
 54         return 0;
 55 }
 56 
 57 extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 58                enum dma_data_direction direction);
 59 
 60 #define dma_alloc_coherent(d,s,h,f)     dma_alloc_attrs(d,s,h,f,NULL)
 61 
 62 static inline void *dma_alloc_attrs(struct device *dev, size_t size,
 63                                     dma_addr_t *dma_handle, gfp_t gfp,
 64                                     struct dma_attrs *attrs)
 65 {
 66         void *ret;
 67         struct dma_map_ops *ops = get_dma_ops(dev);
 68 
 69         ret = ops->alloc(dev, size, dma_handle, gfp, attrs);
 70 
 71         debug_dma_alloc_coherent(dev, size, *dma_handle, ret);
 72 
 73         return ret;
 74 }
 75 
 76 #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL)
 77 
 78 static inline void dma_free_attrs(struct device *dev, size_t size,
 79                                   void *vaddr, dma_addr_t dma_handle,
 80                                   struct dma_attrs *attrs)
 81 {
 82         struct dma_map_ops *ops = get_dma_ops(dev);
 83 
 84         ops->free(dev, size, vaddr, dma_handle, attrs);
 85 
 86         debug_dma_free_coherent(dev, size, vaddr, dma_handle);
 87 }
 88 
 89 
 90 void *dma_alloc_noncoherent(struct device *dev, size_t size,
 91                            dma_addr_t *dma_handle, gfp_t flag);
 92 
 93 void dma_free_noncoherent(struct device *dev, size_t size,
 94                          void *vaddr, dma_addr_t dma_handle);
 95 
 96 #endif /* _ASM_DMA_MAPPING_H */
 97 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp