#include <linux/types.h>
#include <linux/vmalloc.h>
+#include <linux/dma-debug.h>
#include <xen/xen.h>
#include <asm/xen/hypervisor.h>
+#define DMA_ERROR_CODE (~(dma_addr_t)0)
+
extern const struct dma_map_ops dummy_dma_ops;
+extern struct dma_map_ops *dma_ops;
+extern struct dma_map_ops coherent_swiotlb_dma_ops;
+extern struct dma_map_ops noncoherent_swiotlb_dma_ops;
+extern struct dma_map_ops arm_exynos_dma_mcode_ops;
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
.mapping_error = __swiotlb_dma_mapping_error,
};
+static void *arm_exynos_dma_mcode_alloc(struct device *dev, size_t size,
+ dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs);
+static void arm_exynos_dma_mcode_free(struct device *dev, size_t size, void *cpu_addr,
+ dma_addr_t handle, struct dma_attrs *attrs);
+
+struct dma_map_ops arm_exynos_dma_mcode_ops = {
+ .alloc = arm_exynos_dma_mcode_alloc,
+ .free = arm_exynos_dma_mcode_free,
+};
+EXPORT_SYMBOL(arm_exynos_dma_mcode_ops);
+
+static void *arm_exynos_dma_mcode_alloc(struct device *dev, size_t size,
+ dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs)
+{
+ void *addr;
+
+ if (!*handle)
+ return NULL;
+
+ addr = ioremap(*handle, size);
+
+ return addr;
+}
+
+static void arm_exynos_dma_mcode_free(struct device *dev, size_t size, void *cpu_addr,
+ dma_addr_t handle, struct dma_attrs *attrs)
+{
+ iounmap(cpu_addr);
+}
+
static int __init atomic_pool_init(void)
{
pgprot_t prot = __pgprot(PROT_NORMAL_NC);