2
* omap dmm user: virtual address space management
4
* Copyright (C) 2010-2011 Texas Instruments
6
* Written by Hari Kanigeri <h-kanigeri2@ti.com>
7
* Ramesh Gupta <grgupta@ti.com>
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License version 2 as
10
* published by the Free Software Foundation.
13
#include <linux/device.h>
14
#include <linux/cdev.h>
15
#include <linux/dma-mapping.h>
17
#ifndef __DMM_USER_MMAP_H
18
#define __DMM_USER_MMAP_H
21
#define DMM_IOC_MAGIC 'V'
23
#define DMM_IOCSETTLBENT _IO(DMM_IOC_MAGIC, 0)
24
#define DMM_IOCMEMMAP _IO(DMM_IOC_MAGIC, 1)
25
#define DMM_IOCMEMUNMAP _IO(DMM_IOC_MAGIC, 2)
26
#define DMM_IOCDATOPA _IO(DMM_IOC_MAGIC, 3)
27
#define DMM_IOCMEMFLUSH _IO(DMM_IOC_MAGIC, 4)
28
#define DMM_IOCMEMINV _IO(DMM_IOC_MAGIC, 5)
29
#define DMM_IOCCREATEPOOL _IO(DMM_IOC_MAGIC, 6)
30
#define DMM_IOCDELETEPOOL _IO(DMM_IOC_MAGIC, 7)
31
#define IOMMU_IOCEVENTREG _IO(DMM_IOC_MAGIC, 10)
32
#define IOMMU_IOCEVENTUNREG _IO(DMM_IOC_MAGIC, 11)
34
#define DMM_DA_ANON 0x1
35
#define DMM_DA_PHYS 0x2
36
#define DMM_DA_USER 0x4
42
struct gen_pool *genpool;
43
struct list_head list;
46
struct iovmm_pool_info {
54
/* used to cache dma mapping information */
55
struct device_dma_map_info {
56
/* number of elements requested by us */
58
/* list of buffers used in this DMA action */
59
struct scatterlist *sg;
74
enum dma_data_direction dir;
77
struct dmm_map_object {
78
struct list_head link;
83
struct gen_pool *gen_pool;
85
struct device_dma_map_info dma_info;
89
struct iovmm_device *iovmm;
90
struct list_head map_list;
95
/* iommu object which this belongs to */
98
/* List of memory pool it manages */
99
struct list_head mmap_pool;
100
struct mutex dmm_map_lock;
106
/* user dmm functions */
107
int dmm_user(struct iodmm_struct *obj, void __user *args);
109
void user_remove_resources(struct iodmm_struct *obj);
111
int user_un_map(struct iodmm_struct *obj, const void __user *args);
113
int proc_begin_dma(struct iodmm_struct *obj, const void __user *args);
115
int proc_end_dma(struct iodmm_struct *obj, const void __user *args);
117
int omap_create_dmm_pool(struct iodmm_struct *obj, const void __user *args);
119
int omap_delete_dmm_pools(struct iodmm_struct *obj);
121
int program_tlb_entry(struct iodmm_struct *obj, const void __user *args);
123
int register_mmufault(struct iodmm_struct *obj, const void __user *args);
125
int unregister_mmufault(struct iodmm_struct *obj, const void __user *args);