aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nvhost_ioctl.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/nvhost_ioctl.h')
-rw-r--r--include/linux/nvhost_ioctl.h213
1 files changed, 213 insertions, 0 deletions
diff --git a/include/linux/nvhost_ioctl.h b/include/linux/nvhost_ioctl.h
new file mode 100644
index 00000000000..3f6eabf522f
--- /dev/null
+++ b/include/linux/nvhost_ioctl.h
@@ -0,0 +1,213 @@
1/*
2 * include/linux/nvhost_ioctl.h
3 *
4 * Tegra graphics host driver
5 *
6 * Copyright (c) 2009-2012, 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 __LINUX_NVHOST_IOCTL_H
24#define __LINUX_NVHOST_IOCTL_H
25
26#include <linux/ioctl.h>
27#include <linux/types.h>
28
29#if !defined(__KERNEL__)
30#define __user
31#endif
32
33#define NVHOST_INVALID_SYNCPOINT 0xFFFFFFFF
34#define NVHOST_NO_TIMEOUT (-1)
35#define NVHOST_NO_CONTEXT 0x0
36#define NVHOST_IOCTL_MAGIC 'H'
37#define NVHOST_PRIORITY_LOW 50
38#define NVHOST_PRIORITY_MEDIUM 100
39#define NVHOST_PRIORITY_HIGH 150
40
41/* version 0 header (used with write() submit interface) */
42struct nvhost_submit_hdr {
43 __u32 syncpt_id;
44 __u32 syncpt_incrs;
45 __u32 num_cmdbufs;
46 __u32 num_relocs;
47};
48
49#define NVHOST_SUBMIT_VERSION_V0 0x0
50#define NVHOST_SUBMIT_VERSION_V1 0x1
51#define NVHOST_SUBMIT_VERSION_V2 0x2
52#define NVHOST_SUBMIT_VERSION_MAX_SUPPORTED NVHOST_SUBMIT_VERSION_V2
53
54/* version 1 header (used with ioctl() submit interface) */
55struct nvhost_submit_hdr_ext {
56 __u32 syncpt_id; /* version 0 fields */
57 __u32 syncpt_incrs;
58 __u32 num_cmdbufs;
59 __u32 num_relocs;
60 __u32 submit_version; /* version 1 fields */
61 __u32 num_waitchks;
62 __u32 waitchk_mask;
63 __u32 pad[5]; /* future expansion */
64};
65
66struct nvhost_cmdbuf {
67 __u32 mem;
68 __u32 offset;
69 __u32 words;
70};
71
72struct nvhost_reloc {
73 __u32 cmdbuf_mem;
74 __u32 cmdbuf_offset;
75 __u32 target;
76 __u32 target_offset;
77};
78
79struct nvhost_reloc_shift {
80 __u32 shift;
81};
82
83struct nvhost_waitchk {
84 __u32 mem;
85 __u32 offset;
86 __u32 syncpt_id;
87 __u32 thresh;
88};
89
90struct nvhost_get_param_args {
91 __u32 value;
92};
93
94struct nvhost_set_nvmap_fd_args {
95 __u32 fd;
96};
97
98struct nvhost_read_3d_reg_args {
99 __u32 offset;
100 __u32 value;
101};
102
103struct nvhost_clk_rate_args {
104 __u64 rate;
105};
106
107struct nvhost_set_timeout_args {
108 __u32 timeout;
109};
110
111struct nvhost_set_priority_args {
112 __u32 priority;
113};
114
115#define NVHOST_IOCTL_CHANNEL_FLUSH \
116 _IOR(NVHOST_IOCTL_MAGIC, 1, struct nvhost_get_param_args)
117#define NVHOST_IOCTL_CHANNEL_GET_SYNCPOINTS \
118 _IOR(NVHOST_IOCTL_MAGIC, 2, struct nvhost_get_param_args)
119#define NVHOST_IOCTL_CHANNEL_GET_WAITBASES \
120 _IOR(NVHOST_IOCTL_MAGIC, 3, struct nvhost_get_param_args)
121#define NVHOST_IOCTL_CHANNEL_GET_MODMUTEXES \
122 _IOR(NVHOST_IOCTL_MAGIC, 4, struct nvhost_get_param_args)
123#define NVHOST_IOCTL_CHANNEL_SET_NVMAP_FD \
124 _IOW(NVHOST_IOCTL_MAGIC, 5, struct nvhost_set_nvmap_fd_args)
125#define NVHOST_IOCTL_CHANNEL_NULL_KICKOFF \
126 _IOR(NVHOST_IOCTL_MAGIC, 6, struct nvhost_get_param_args)
127#define NVHOST_IOCTL_CHANNEL_SUBMIT_EXT \
128 _IOW(NVHOST_IOCTL_MAGIC, 7, struct nvhost_submit_hdr_ext)
129#define NVHOST_IOCTL_CHANNEL_READ_3D_REG \
130 _IOWR(NVHOST_IOCTL_MAGIC, 8, struct nvhost_read_3d_reg_args)
131#define NVHOST_IOCTL_CHANNEL_GET_CLK_RATE \
132 _IOR(NVHOST_IOCTL_MAGIC, 9, struct nvhost_clk_rate_args)
133#define NVHOST_IOCTL_CHANNEL_SET_CLK_RATE \
134 _IOW(NVHOST_IOCTL_MAGIC, 10, struct nvhost_clk_rate_args)
135#define NVHOST_IOCTL_CHANNEL_SET_TIMEOUT \
136 _IOW(NVHOST_IOCTL_MAGIC, 11, struct nvhost_set_timeout_args)
137#define NVHOST_IOCTL_CHANNEL_GET_TIMEDOUT \
138 _IOR(NVHOST_IOCTL_MAGIC, 12, struct nvhost_get_param_args)
139#define NVHOST_IOCTL_CHANNEL_SET_PRIORITY \
140 _IOW(NVHOST_IOCTL_MAGIC, 13, struct nvhost_set_priority_args)
141#define NVHOST_IOCTL_CHANNEL_LAST \
142 _IOC_NR(NVHOST_IOCTL_CHANNEL_SET_PRIORITY)
143#define NVHOST_IOCTL_CHANNEL_MAX_ARG_SIZE sizeof(struct nvhost_submit_hdr_ext)
144
145struct nvhost_ctrl_syncpt_read_args {
146 __u32 id;
147 __u32 value;
148};
149
150struct nvhost_ctrl_syncpt_incr_args {
151 __u32 id;
152};
153
154struct nvhost_ctrl_syncpt_wait_args {
155 __u32 id;
156 __u32 thresh;
157 __s32 timeout;
158};
159
160struct nvhost_ctrl_syncpt_waitex_args {
161 __u32 id;
162 __u32 thresh;
163 __s32 timeout;
164 __u32 value;
165};
166
167struct nvhost_ctrl_module_mutex_args {
168 __u32 id;
169 __u32 lock;
170};
171
172enum nvhost_module_id {
173 NVHOST_MODULE_NONE = -1,
174 NVHOST_MODULE_DISPLAY_A = 0,
175 NVHOST_MODULE_DISPLAY_B,
176 NVHOST_MODULE_VI,
177 NVHOST_MODULE_ISP,
178 NVHOST_MODULE_MPE,
179};
180
181struct nvhost_ctrl_module_regrdwr_args {
182 __u32 id;
183 __u32 num_offsets;
184 __u32 block_size;
185 __u32 *offsets;
186 __u32 *values;
187 __u32 write;
188};
189
190#define NVHOST_IOCTL_CTRL_SYNCPT_READ \
191 _IOWR(NVHOST_IOCTL_MAGIC, 1, struct nvhost_ctrl_syncpt_read_args)
192#define NVHOST_IOCTL_CTRL_SYNCPT_INCR \
193 _IOW(NVHOST_IOCTL_MAGIC, 2, struct nvhost_ctrl_syncpt_incr_args)
194#define NVHOST_IOCTL_CTRL_SYNCPT_WAIT \
195 _IOW(NVHOST_IOCTL_MAGIC, 3, struct nvhost_ctrl_syncpt_wait_args)
196
197#define NVHOST_IOCTL_CTRL_MODULE_MUTEX \
198 _IOWR(NVHOST_IOCTL_MAGIC, 4, struct nvhost_ctrl_module_mutex_args)
199#define NVHOST_IOCTL_CTRL_MODULE_REGRDWR \
200 _IOWR(NVHOST_IOCTL_MAGIC, 5, struct nvhost_ctrl_module_regrdwr_args)
201
202#define NVHOST_IOCTL_CTRL_SYNCPT_WAITEX \
203 _IOWR(NVHOST_IOCTL_MAGIC, 6, struct nvhost_ctrl_syncpt_waitex_args)
204
205#define NVHOST_IOCTL_CTRL_GET_VERSION \
206 _IOR(NVHOST_IOCTL_MAGIC, 7, struct nvhost_get_param_args)
207
208#define NVHOST_IOCTL_CTRL_LAST \
209 _IOC_NR(NVHOST_IOCTL_CTRL_GET_VERSION)
210#define NVHOST_IOCTL_CTRL_MAX_ARG_SIZE \
211 sizeof(struct nvhost_ctrl_module_regrdwr_args)
212
213#endif