dma-mapping-broken.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef _ASM_GENERIC_DMA_MAPPING_H
  2. #define _ASM_GENERIC_DMA_MAPPING_H
  3. /* define the dma api to allow compilation but not linking of
  4. * dma dependent code. Code that depends on the dma-mapping
  5. * API needs to set 'depends on HAS_DMA' in its Kconfig
  6. */
  7. struct scatterlist;
  8. extern void *
  9. dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
  10. gfp_t flag);
  11. extern void
  12. dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
  13. dma_addr_t dma_handle);
  14. static inline void *dma_alloc_attrs(struct device *dev, size_t size,
  15. dma_addr_t *dma_handle, gfp_t flag,
  16. struct dma_attrs *attrs)
  17. {
  18. /* attrs is not supported and ignored */
  19. return dma_alloc_coherent(dev, size, dma_handle, flag);
  20. }
  21. static inline void dma_free_attrs(struct device *dev, size_t size,
  22. void *cpu_addr, dma_addr_t dma_handle,
  23. struct dma_attrs *attrs)
  24. {
  25. /* attrs is not supported and ignored */
  26. dma_free_coherent(dev, size, cpu_addr, dma_handle);
  27. }
  28. #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
  29. #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
  30. extern dma_addr_t
  31. dma_map_single(struct device *dev, void *ptr, size_t size,
  32. enum dma_data_direction direction);
  33. extern void
  34. dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
  35. enum dma_data_direction direction);
  36. extern int
  37. dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
  38. enum dma_data_direction direction);
  39. extern void
  40. dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
  41. enum dma_data_direction direction);
  42. extern dma_addr_t
  43. dma_map_page(struct device *dev, struct page *page, unsigned long offset,
  44. size_t size, enum dma_data_direction direction);
  45. extern void
  46. dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
  47. enum dma_data_direction direction);
  48. extern void
  49. dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
  50. enum dma_data_direction direction);
  51. extern void
  52. dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
  53. unsigned long offset, size_t size,
  54. enum dma_data_direction direction);
  55. extern void
  56. dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
  57. enum dma_data_direction direction);
  58. #define dma_sync_single_for_device dma_sync_single_for_cpu
  59. #define dma_sync_single_range_for_device dma_sync_single_range_for_cpu
  60. #define dma_sync_sg_for_device dma_sync_sg_for_cpu
  61. extern int
  62. dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
  63. extern int
  64. dma_supported(struct device *dev, u64 mask);
  65. extern int
  66. dma_set_mask(struct device *dev, u64 mask);
  67. extern int
  68. dma_get_cache_alignment(void);
  69. extern void
  70. dma_cache_sync(struct device *dev, void *vaddr, size_t size,
  71. enum dma_data_direction direction);
  72. #endif /* _ASM_GENERIC_DMA_MAPPING_H */