page-coherent.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef _ASM_X86_XEN_PAGE_COHERENT_H
  2. #define _ASM_X86_XEN_PAGE_COHERENT_H
  3. #include <asm/page.h>
  4. #include <linux/dma-attrs.h>
  5. #include <linux/dma-mapping.h>
  6. static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size,
  7. dma_addr_t *dma_handle, gfp_t flags,
  8. struct dma_attrs *attrs)
  9. {
  10. void *vstart = (void*)__get_free_pages(flags, get_order(size));
  11. *dma_handle = virt_to_phys(vstart);
  12. return vstart;
  13. }
  14. static inline void xen_free_coherent_pages(struct device *hwdev, size_t size,
  15. void *cpu_addr, dma_addr_t dma_handle,
  16. struct dma_attrs *attrs)
  17. {
  18. free_pages((unsigned long) cpu_addr, get_order(size));
  19. }
  20. static inline void xen_dma_map_page(struct device *hwdev, struct page *page,
  21. unsigned long offset, size_t size, enum dma_data_direction dir,
  22. struct dma_attrs *attrs) { }
  23. static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle,
  24. size_t size, enum dma_data_direction dir,
  25. struct dma_attrs *attrs) { }
  26. static inline void xen_dma_sync_single_for_cpu(struct device *hwdev,
  27. dma_addr_t handle, size_t size, enum dma_data_direction dir) { }
  28. static inline void xen_dma_sync_single_for_device(struct device *hwdev,
  29. dma_addr_t handle, size_t size, enum dma_data_direction dir) { }
  30. #endif /* _ASM_X86_XEN_PAGE_COHERENT_H */