dma-mapping_64.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef _X8664_DMA_MAPPING_H
  2. #define _X8664_DMA_MAPPING_H 1
  3. extern dma_addr_t bad_dma_address;
  4. extern int iommu_merge;
  5. static inline int dma_mapping_error(dma_addr_t dma_addr)
  6. {
  7. if (dma_ops->mapping_error)
  8. return dma_ops->mapping_error(dma_addr);
  9. return (dma_addr == bad_dma_address);
  10. }
  11. #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
  12. #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
  13. #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
  14. #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
  15. extern void *dma_alloc_coherent(struct device *dev, size_t size,
  16. dma_addr_t *dma_handle, gfp_t gfp);
  17. extern void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
  18. dma_addr_t dma_handle);
  19. #define dma_map_page(dev,page,offset,size,dir) \
  20. dma_map_single((dev), page_address(page)+(offset), (size), (dir))
  21. #define dma_unmap_page dma_unmap_single
  22. static inline void
  23. dma_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
  24. int nelems, int direction)
  25. {
  26. BUG_ON(!valid_dma_direction(direction));
  27. if (dma_ops->sync_sg_for_device) {
  28. dma_ops->sync_sg_for_device(hwdev, sg, nelems, direction);
  29. }
  30. flush_write_buffers();
  31. }
  32. extern int dma_supported(struct device *hwdev, u64 mask);
  33. /* same for gart, swiotlb, and nommu */
  34. static inline int dma_get_cache_alignment(void)
  35. {
  36. return boot_cpu_data.x86_clflush_size;
  37. }
  38. #define dma_is_consistent(d, h) 1
  39. extern int dma_set_mask(struct device *dev, u64 mask);
  40. static inline void
  41. dma_cache_sync(struct device *dev, void *vaddr, size_t size,
  42. enum dma_data_direction dir)
  43. {
  44. flush_write_buffers();
  45. }
  46. extern struct device fallback_dev;
  47. extern int panic_on_overflow;
  48. #endif /* _X8664_DMA_MAPPING_H */