GuanXuetao | 10c9c10 | 2011-01-15 18:18:29 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Contains routines needed to support swiotlb for UniCore32. |
| 3 | * |
| 4 | * Copyright (C) 2010 Guan Xuetao |
| 5 | * |
| 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. |
| 10 | */ |
| 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> |
| 17 | |
| 18 | #include <asm/dma.h> |
| 19 | |
Andrzej Pietrasiewicz | ffc4a3f | 2012-03-27 14:48:45 +0200 | [diff] [blame^] | 20 | static void *unicore_swiotlb_alloc_coherent(struct device *dev, size_t size, |
| 21 | dma_addr_t *dma_handle, gfp_t flags, |
| 22 | struct dma_attrs *attrs) |
| 23 | { |
| 24 | return swiotlb_alloc_coherent(dev, size, dma_handle, flags); |
| 25 | } |
| 26 | |
| 27 | static void unicore_swiotlb_free_coherent(struct device *dev, size_t size, |
| 28 | void *vaddr, dma_addr_t dma_addr, |
| 29 | struct dma_attrs *attrs) |
| 30 | { |
| 31 | swiotlb_free_coherent(dev, size, vaddr, dma_addr); |
| 32 | } |
| 33 | |
GuanXuetao | 10c9c10 | 2011-01-15 18:18:29 +0800 | [diff] [blame] | 34 | struct dma_map_ops swiotlb_dma_map_ops = { |
Andrzej Pietrasiewicz | ffc4a3f | 2012-03-27 14:48:45 +0200 | [diff] [blame^] | 35 | .alloc = unicore_swiotlb_alloc_coherent, |
| 36 | .free = unicore_swiotlb_free_coherent, |
GuanXuetao | 10c9c10 | 2011-01-15 18:18:29 +0800 | [diff] [blame] | 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, |
| 47 | }; |
| 48 | EXPORT_SYMBOL(swiotlb_dma_map_ops); |