dma-mapping.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef ___ASM_SPARC_DMA_MAPPING_H
  2. #define ___ASM_SPARC_DMA_MAPPING_H
  3. #if defined(__sparc__) && defined(__arch64__)
  4. #include <asm/dma-mapping_64.h>
  5. #else
  6. #include <asm/dma-mapping_32.h>
  7. #endif
  8. #define DMA_ERROR_CODE (~(dma_addr_t)0x0)
  9. extern int dma_supported(struct device *dev, u64 mask);
  10. extern int dma_set_mask(struct device *dev, u64 dma_mask);
  11. static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
  12. {
  13. return (dma_addr == DMA_ERROR_CODE);
  14. }
  15. static inline int dma_get_cache_alignment(void)
  16. {
  17. /*
  18. * no easy way to get cache size on all processors, so return
  19. * the maximum possible, to be safe
  20. */
  21. return (1 << INTERNODE_CACHE_SHIFT);
  22. }
  23. #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
  24. #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
  25. #define dma_is_consistent(d, h) (1)
  26. static inline void dma_sync_single_range_for_cpu(struct device *dev,
  27. dma_addr_t dma_handle,
  28. unsigned long offset,
  29. size_t size,
  30. enum dma_data_direction dir)
  31. {
  32. dma_sync_single_for_cpu(dev, dma_handle+offset, size, dir);
  33. }
  34. static inline void dma_sync_single_range_for_device(struct device *dev,
  35. dma_addr_t dma_handle,
  36. unsigned long offset,
  37. size_t size,
  38. enum dma_data_direction dir)
  39. {
  40. dma_sync_single_for_device(dev, dma_handle+offset, size, dir);
  41. }
  42. #endif