dma-mapping-broken.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
  15. #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
  16. extern dma_addr_t
  17. dma_map_single(struct device *dev, void *ptr, size_t size,
  18. enum dma_data_direction direction);
  19. extern void
  20. dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
  21. enum dma_data_direction direction);
  22. extern int
  23. dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
  24. enum dma_data_direction direction);
  25. extern void
  26. dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
  27. enum dma_data_direction direction);
  28. extern dma_addr_t
  29. dma_map_page(struct device *dev, struct page *page, unsigned long offset,
  30. size_t size, enum dma_data_direction direction);
  31. extern void
  32. dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
  33. enum dma_data_direction direction);
  34. extern void
  35. dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
  36. enum dma_data_direction direction);
  37. extern void
  38. dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
  39. unsigned long offset, size_t size,
  40. enum dma_data_direction direction);
  41. extern void
  42. dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
  43. enum dma_data_direction direction);
  44. #define dma_sync_single_for_device dma_sync_single_for_cpu
  45. #define dma_sync_single_range_for_device dma_sync_single_range_for_cpu
  46. #define dma_sync_sg_for_device dma_sync_sg_for_cpu
  47. extern int
  48. dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
  49. extern int
  50. dma_supported(struct device *dev, u64 mask);
  51. extern int
  52. dma_set_mask(struct device *dev, u64 mask);
  53. extern int
  54. dma_get_cache_alignment(void);
  55. extern void
  56. dma_cache_sync(struct device *dev, void *vaddr, size_t size,
  57. enum dma_data_direction direction);
  58. #endif /* _ASM_GENERIC_DMA_MAPPING_H */