page-coherent.h 1.2 KB

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