2 * Contains routines needed to support swiotlb for UniCore32.
4 * Copyright (C) 2010 Guan Xuetao
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
11 #include <linux/pci.h>
12 #include <linux/cache.h>
13 #include <linux/module.h>
14 #include <linux/dma-mapping.h>
15 #include <linux/swiotlb.h>
16 #include <linux/bootmem.h>
20 static void *unicore_swiotlb_alloc_coherent(struct device
*dev
, size_t size
,
21 dma_addr_t
*dma_handle
, gfp_t flags
,
24 return swiotlb_alloc_coherent(dev
, size
, dma_handle
, flags
);
27 static void unicore_swiotlb_free_coherent(struct device
*dev
, size_t size
,
28 void *vaddr
, dma_addr_t dma_addr
,
31 swiotlb_free_coherent(dev
, size
, vaddr
, dma_addr
);
34 const struct dma_map_ops swiotlb_dma_map_ops
= {
35 .alloc
= unicore_swiotlb_alloc_coherent
,
36 .free
= unicore_swiotlb_free_coherent
,
37 .map_sg
= swiotlb_map_sg_attrs
,
38 .unmap_sg
= swiotlb_unmap_sg_attrs
,
39 .dma_supported
= swiotlb_dma_supported
,
40 .map_page
= swiotlb_map_page
,
41 .unmap_page
= swiotlb_unmap_page
,
42 .sync_single_for_cpu
= swiotlb_sync_single_for_cpu
,
43 .sync_single_for_device
= swiotlb_sync_single_for_device
,
44 .sync_sg_for_cpu
= swiotlb_sync_sg_for_cpu
,
45 .sync_sg_for_device
= swiotlb_sync_sg_for_device
,
46 .mapping_error
= swiotlb_dma_mapping_error
,
48 EXPORT_SYMBOL(swiotlb_dma_map_ops
);