2 #include <linux/kernel.h>
3 #include <linux/module.h>
4 #include <linux/dma-mapping.h>
5 #include <asm/dma-mapping.h>
7 static dma_addr_t pci32_map_single(struct device *dev, phys_addr_t ptr,
8 size_t size, int direction)
11 flush_write_buffers();
15 static int pci32_dma_map_sg(struct device *dev, struct scatterlist *sglist,
16 int nents, int direction)
18 struct scatterlist *sg;
21 WARN_ON(nents == 0 || sglist[0].length == 0);
23 for_each_sg(sglist, sg, nents, i) {
26 sg->dma_address = sg_phys(sg);
29 flush_write_buffers();
33 /* Make sure we keep the same behaviour */
34 static int pci32_map_error(dma_addr_t dma_addr)
39 static const struct dma_mapping_ops pci32_dma_ops = {
40 .map_single = pci32_map_single,
42 .map_sg = pci32_dma_map_sg,
44 .sync_single_for_cpu = NULL,
45 .sync_single_for_device = NULL,
46 .sync_single_range_for_cpu = NULL,
47 .sync_single_range_for_device = NULL,
48 .sync_sg_for_cpu = NULL,
49 .sync_sg_for_device = NULL,
50 .mapping_error = pci32_map_error,
53 const struct dma_mapping_ops *dma_ops = &pci32_dma_ops;
54 EXPORT_SYMBOL(dma_ops);