aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/tegra/nvmap/nvmap_ioctl.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/tegra/nvmap/nvmap_ioctl.h')
-rw-r--r--drivers/video/tegra/nvmap/nvmap_ioctl.h159
1 files changed, 159 insertions, 0 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap_ioctl.h b/drivers/video/tegra/nvmap/nvmap_ioctl.h
new file mode 100644
index 00000000000..c802cd4dd7a
--- /dev/null
+++ b/drivers/video/tegra/nvmap/nvmap_ioctl.h
@@ -0,0 +1,159 @@
1/*
2 * drivers/video/tegra/nvmap/nvmap_ioctl.h
3 *
4 * ioctl declarations for nvmap
5 *
6 * Copyright (c) 2010, NVIDIA Corporation.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#ifndef __VIDEO_TEGRA_NVMAP_IOCTL_H
24#define __VIDEO_TEGRA_NVMAP_IOCTL_H
25
26#include <linux/ioctl.h>
27#include <linux/file.h>
28
29#include <mach/nvmap.h>
30
31enum {
32 NVMAP_HANDLE_PARAM_SIZE = 1,
33 NVMAP_HANDLE_PARAM_ALIGNMENT,
34 NVMAP_HANDLE_PARAM_BASE,
35 NVMAP_HANDLE_PARAM_HEAP,
36};
37
38enum {
39 NVMAP_CACHE_OP_WB = 0,
40 NVMAP_CACHE_OP_INV,
41 NVMAP_CACHE_OP_WB_INV,
42};
43
44
45struct nvmap_create_handle {
46 union {
47 __u32 key; /* ClaimPreservedHandle */
48 __u32 id; /* FromId */
49 __u32 size; /* CreateHandle */
50 };
51 __u32 handle;
52};
53
54struct nvmap_alloc_handle {
55 __u32 handle;
56 __u32 heap_mask;
57 __u32 flags;
58 __u32 align;
59};
60
61struct nvmap_map_caller {
62 __u32 handle; /* hmem */
63 __u32 offset; /* offset into hmem; should be page-aligned */
64 __u32 length; /* number of bytes to map */
65 __u32 flags;
66 unsigned long addr; /* user pointer */
67};
68
69struct nvmap_rw_handle {
70 unsigned long addr; /* user pointer */
71 __u32 handle; /* hmem */
72 __u32 offset; /* offset into hmem */
73 __u32 elem_size; /* individual atom size */
74 __u32 hmem_stride; /* delta in bytes between atoms in hmem */
75 __u32 user_stride; /* delta in bytes between atoms in user */
76 __u32 count; /* number of atoms to copy */
77};
78
79struct nvmap_pin_handle {
80 unsigned long handles; /* array of handles to pin/unpin */
81 unsigned long addr; /* array of addresses to return */
82 __u32 count; /* number of entries in handles */
83};
84
85struct nvmap_handle_param {
86 __u32 handle;
87 __u32 param;
88 unsigned long result;
89};
90
91struct nvmap_cache_op {
92 unsigned long addr;
93 __u32 handle;
94 __u32 len;
95 __s32 op;
96};
97
98#define NVMAP_IOC_MAGIC 'N'
99
100/* Creates a new memory handle. On input, the argument is the size of the new
101 * handle; on return, the argument is the name of the new handle
102 */
103#define NVMAP_IOC_CREATE _IOWR(NVMAP_IOC_MAGIC, 0, struct nvmap_create_handle)
104#define NVMAP_IOC_CLAIM _IOWR(NVMAP_IOC_MAGIC, 1, struct nvmap_create_handle)
105#define NVMAP_IOC_FROM_ID _IOWR(NVMAP_IOC_MAGIC, 2, struct nvmap_create_handle)
106
107/* Actually allocates memory for the specified handle */
108#define NVMAP_IOC_ALLOC _IOW(NVMAP_IOC_MAGIC, 3, struct nvmap_alloc_handle)
109
110/* Frees a memory handle, unpinning any pinned pages and unmapping any mappings
111 */
112#define NVMAP_IOC_FREE _IO(NVMAP_IOC_MAGIC, 4)
113
114/* Maps the region of the specified handle into a user-provided virtual address
115 * that was previously created via an mmap syscall on this fd */
116#define NVMAP_IOC_MMAP _IOWR(NVMAP_IOC_MAGIC, 5, struct nvmap_map_caller)
117
118/* Reads/writes data (possibly strided) from a user-provided buffer into the
119 * hmem at the specified offset */
120#define NVMAP_IOC_WRITE _IOW(NVMAP_IOC_MAGIC, 6, struct nvmap_rw_handle)
121#define NVMAP_IOC_READ _IOW(NVMAP_IOC_MAGIC, 7, struct nvmap_rw_handle)
122
123#define NVMAP_IOC_PARAM _IOWR(NVMAP_IOC_MAGIC, 8, struct nvmap_handle_param)
124
125/* Pins a list of memory handles into IO-addressable memory (either IOVMM
126 * space or physical memory, depending on the allocation), and returns the
127 * address. Handles may be pinned recursively. */
128#define NVMAP_IOC_PIN_MULT _IOWR(NVMAP_IOC_MAGIC, 10, struct nvmap_pin_handle)
129#define NVMAP_IOC_UNPIN_MULT _IOW(NVMAP_IOC_MAGIC, 11, struct nvmap_pin_handle)
130
131#define NVMAP_IOC_CACHE _IOW(NVMAP_IOC_MAGIC, 12, struct nvmap_cache_op)
132
133/* Returns a global ID usable to allow a remote process to create a handle
134 * reference to the same handle */
135#define NVMAP_IOC_GET_ID _IOWR(NVMAP_IOC_MAGIC, 13, struct nvmap_create_handle)
136
137#define NVMAP_IOC_MAXNR (_IOC_NR(NVMAP_IOC_GET_ID))
138
139int nvmap_ioctl_pinop(struct file *filp, bool is_pin, void __user *arg);
140
141int nvmap_ioctl_get_param(struct file *filp, void __user* arg);
142
143int nvmap_ioctl_getid(struct file *filp, void __user *arg);
144
145int nvmap_ioctl_alloc(struct file *filp, void __user *arg);
146
147int nvmap_ioctl_free(struct file *filp, unsigned long arg);
148
149int nvmap_ioctl_create(struct file *filp, unsigned int cmd, void __user *arg);
150
151int nvmap_map_into_caller_ptr(struct file *filp, void __user *arg);
152
153int nvmap_ioctl_cache_maint(struct file *filp, void __user *arg);
154
155int nvmap_ioctl_rw_handle(struct file *filp, int is_read, void __user* arg);
156
157
158
159#endif