~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/arm/plat-omap/include/plat/dmm_user.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * omap dmm user: virtual address space management
3
 
 *
4
 
 * Copyright (C) 2010-2011 Texas Instruments
5
 
 *
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.
11
 
 */
12
 
 
13
 
#include <linux/device.h>
14
 
#include <linux/cdev.h>
15
 
#include <linux/dma-mapping.h>
16
 
 
17
 
#ifndef __DMM_USER_MMAP_H
18
 
#define __DMM_USER_MMAP_H
19
 
 
20
 
 
21
 
#define DMM_IOC_MAGIC           'V'
22
 
 
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)
33
 
 
34
 
#define DMM_DA_ANON     0x1
35
 
#define DMM_DA_PHYS     0x2
36
 
#define DMM_DA_USER     0x4
37
 
 
38
 
struct iovmm_pool {
39
 
        u32                     pool_id;
40
 
        u32                     da_begin;
41
 
        u32                     da_end;
42
 
        struct gen_pool         *genpool;
43
 
        struct list_head        list;
44
 
};
45
 
 
46
 
struct iovmm_pool_info {
47
 
        u32     pool_id;
48
 
        u32     da_begin;
49
 
        u32     da_end;
50
 
        u32     size;
51
 
        u32     flags;
52
 
};
53
 
 
54
 
/* used to cache dma mapping information */
55
 
struct device_dma_map_info {
56
 
        /* number of elements requested by us */
57
 
        int     num_pages;
58
 
        /* list of buffers used in this DMA action */
59
 
        struct scatterlist      *sg;
60
 
};
61
 
 
62
 
struct dmm_map_info {
63
 
        u32     mpu_addr;
64
 
        u32     *da;
65
 
        u32     num_of_buf;
66
 
        u32     size;
67
 
        u32     pool_id;
68
 
        u32     flags;
69
 
};
70
 
 
71
 
struct dmm_dma_info {
72
 
        void    *pva;
73
 
        u32     ul_size;
74
 
        enum dma_data_direction dir;
75
 
};
76
 
 
77
 
struct dmm_map_object {
78
 
        struct list_head        link;
79
 
        u32     da;
80
 
        u32     va;
81
 
        u32     size;
82
 
        u32     num_usr_pgs;
83
 
        struct gen_pool *gen_pool;
84
 
        struct page     **pages;
85
 
        struct device_dma_map_info      dma_info;
86
 
};
87
 
 
88
 
struct iodmm_struct {
89
 
        struct iovmm_device     *iovmm;
90
 
        struct list_head        map_list;
91
 
        u32                     pool_id;
92
 
};
93
 
 
94
 
struct iovmm_device {
95
 
        /* iommu object which this belongs to */
96
 
        struct iommu            *iommu;
97
 
        const char              *name;
98
 
        /* List of memory pool it manages */
99
 
        struct list_head        mmap_pool;
100
 
        struct mutex            dmm_map_lock;
101
 
        int                     minor;
102
 
        struct cdev             cdev;
103
 
        int                     refcount;
104
 
};
105
 
 
106
 
/* user dmm functions */
107
 
int dmm_user(struct iodmm_struct *obj,  void __user *args);
108
 
 
109
 
void user_remove_resources(struct iodmm_struct *obj);
110
 
 
111
 
int user_un_map(struct iodmm_struct *obj, const void __user *args);
112
 
 
113
 
int proc_begin_dma(struct iodmm_struct *obj, const void __user *args);
114
 
 
115
 
int proc_end_dma(struct iodmm_struct *obj, const void __user *args);
116
 
 
117
 
int omap_create_dmm_pool(struct iodmm_struct *obj, const void __user *args);
118
 
 
119
 
int omap_delete_dmm_pools(struct iodmm_struct *obj);
120
 
 
121
 
int program_tlb_entry(struct iodmm_struct *obj, const void __user *args);
122
 
 
123
 
int register_mmufault(struct iodmm_struct *obj, const void __user *args);
124
 
 
125
 
int unregister_mmufault(struct iodmm_struct *obj, const void __user *args);
126
 
#endif