pci-base_32.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include <linux/mm.h>
  2. #include <linux/kernel.h>
  3. #include <linux/module.h>
  4. #include <linux/dma-mapping.h>
  5. #include <asm/dma-mapping.h>
  6. static dma_addr_t pci32_map_single(struct device *dev, void *ptr,
  7. size_t size, int direction)
  8. {
  9. WARN_ON(size == 0);
  10. flush_write_buffers();
  11. return virt_to_phys(ptr);
  12. }
  13. static int pci32_dma_map_sg(struct device *dev, struct scatterlist *sglist,
  14. int nents, int direction)
  15. {
  16. struct scatterlist *sg;
  17. int i;
  18. WARN_ON(nents == 0 || sglist[0].length == 0);
  19. for_each_sg(sglist, sg, nents, i) {
  20. BUG_ON(!sg_page(sg));
  21. sg->dma_address = sg_phys(sg);
  22. }
  23. flush_write_buffers();
  24. return nents;
  25. }
  26. static const struct dma_mapping_ops pci32_dma_ops = {
  27. .map_single = pci32_map_single,
  28. .unmap_single = NULL,
  29. .map_sg = pci32_dma_map_sg,
  30. .unmap_sg = NULL,
  31. .sync_single_for_cpu = NULL,
  32. .sync_single_for_device = NULL,
  33. .sync_single_range_for_cpu = NULL,
  34. .sync_single_range_for_device = NULL,
  35. .sync_sg_for_cpu = NULL,
  36. .sync_sg_for_device = NULL,
  37. };
  38. const struct dma_mapping_ops *dma_ops = &pci32_dma_ops;
  39. EXPORT_SYMBOL(dma_ops);