File: | dev/pci/drm/drm_ioctl.c |
Warning: | line 1061, column 3 Value stored to 'cmd' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* |
2 | * Created: Fri Jan 8 09:01:26 1999 by faith@valinux.com |
3 | * |
4 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. |
5 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. |
6 | * All Rights Reserved. |
7 | * |
8 | * Author Rickard E. (Rik) Faith <faith@valinux.com> |
9 | * Author Gareth Hughes <gareth@valinux.com> |
10 | * |
11 | * Permission is hereby granted, free of charge, to any person obtaining a |
12 | * copy of this software and associated documentation files (the "Software"), |
13 | * to deal in the Software without restriction, including without limitation |
14 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
15 | * and/or sell copies of the Software, and to permit persons to whom the |
16 | * Software is furnished to do so, subject to the following conditions: |
17 | * |
18 | * The above copyright notice and this permission notice (including the next |
19 | * paragraph) shall be included in all copies or substantial portions of the |
20 | * Software. |
21 | * |
22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
23 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
24 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
25 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
26 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
27 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
28 | * OTHER DEALINGS IN THE SOFTWARE. |
29 | */ |
30 | |
31 | #include <sys/filio.h> |
32 | |
33 | #include <linux/export.h> |
34 | #include <linux/nospec.h> |
35 | #include <linux/pci.h> |
36 | #include <linux/uaccess.h> |
37 | |
38 | #include <drm/drm_auth.h> |
39 | #include <drm/drm_crtc.h> |
40 | #include <drm/drm_drv.h> |
41 | #include <drm/drm_file.h> |
42 | #include <drm/drm_ioctl.h> |
43 | #include <drm/drm_print.h> |
44 | |
45 | #include "drm_crtc_internal.h" |
46 | #include "drm_internal.h" |
47 | #include "drm_legacy.h" |
48 | |
49 | /** |
50 | * DOC: getunique and setversion story |
51 | * |
52 | * BEWARE THE DRAGONS! MIND THE TRAPDOORS! |
53 | * |
54 | * In an attempt to warn anyone else who's trying to figure out what's going |
55 | * on here, I'll try to summarize the story. First things first, let's clear up |
56 | * the names, because the kernel internals, libdrm and the ioctls are all named |
57 | * differently: |
58 | * |
59 | * - GET_UNIQUE ioctl, implemented by drm_getunique is wrapped up in libdrm |
60 | * through the drmGetBusid function. |
61 | * - The libdrm drmSetBusid function is backed by the SET_UNIQUE ioctl. All |
62 | * that code is nerved in the kernel with drm_invalid_op(). |
63 | * - The internal set_busid kernel functions and driver callbacks are |
64 | * exclusively use by the SET_VERSION ioctl, because only drm 1.0 (which is |
65 | * nerved) allowed userspace to set the busid through the above ioctl. |
66 | * - Other ioctls and functions involved are named consistently. |
67 | * |
68 | * For anyone wondering what's the difference between drm 1.1 and 1.4: Correctly |
69 | * handling pci domains in the busid on ppc. Doing this correctly was only |
70 | * implemented in libdrm in 2010, hence can't be nerved yet. No one knows what's |
71 | * special with drm 1.2 and 1.3. |
72 | * |
73 | * Now the actual horror story of how device lookup in drm works. At large, |
74 | * there's 2 different ways, either by busid, or by device driver name. |
75 | * |
76 | * Opening by busid is fairly simple: |
77 | * |
78 | * 1. First call SET_VERSION to make sure pci domains are handled properly. As a |
79 | * side-effect this fills out the unique name in the master structure. |
80 | * 2. Call GET_UNIQUE to read out the unique name from the master structure, |
81 | * which matches the busid thanks to step 1. If it doesn't, proceed to try |
82 | * the next device node. |
83 | * |
84 | * Opening by name is slightly different: |
85 | * |
86 | * 1. Directly call VERSION to get the version and to match against the driver |
87 | * name returned by that ioctl. Note that SET_VERSION is not called, which |
88 | * means the unique name for the master node just opening is _not_ filled |
89 | * out. This despite that with current drm device nodes are always bound to |
90 | * one device, and can't be runtime assigned like with drm 1.0. |
91 | * 2. Match driver name. If it mismatches, proceed to the next device node. |
92 | * 3. Call GET_UNIQUE, and check whether the unique name has length zero (by |
93 | * checking that the first byte in the string is 0). If that's not the case |
94 | * libdrm skips and proceeds to the next device node. Probably this is just |
95 | * copypasta from drm 1.0 times where a set unique name meant that the driver |
96 | * was in use already, but that's just conjecture. |
97 | * |
98 | * Long story short: To keep the open by name logic working, GET_UNIQUE must |
99 | * _not_ return a unique string when SET_VERSION hasn't been called yet, |
100 | * otherwise libdrm breaks. Even when that unique string can't ever change, and |
101 | * is totally irrelevant for actually opening the device because runtime |
102 | * assignable device instances were only support in drm 1.0, which is long dead. |
103 | * But the libdrm code in drmOpenByName somehow survived, hence this can't be |
104 | * broken. |
105 | */ |
106 | |
107 | /* |
108 | * Get the bus id. |
109 | * |
110 | * \param inode device inode. |
111 | * \param file_priv DRM file private. |
112 | * \param cmd command. |
113 | * \param arg user argument, pointing to a drm_unique structure. |
114 | * \return zero on success or a negative number on failure. |
115 | * |
116 | * Copies the bus id from drm_device::unique into user space. |
117 | */ |
118 | int drm_getunique(struct drm_device *dev, void *data, |
119 | struct drm_file *file_priv) |
120 | { |
121 | struct drm_unique *u = data; |
122 | struct drm_master *master; |
123 | |
124 | mutex_lock(&dev->master_mutex)rw_enter_write(&dev->master_mutex); |
125 | master = file_priv->master; |
126 | if (u->unique_len >= master->unique_len) { |
127 | if (copy_to_user(u->unique, master->unique, master->unique_len)) { |
128 | mutex_unlock(&dev->master_mutex)rw_exit_write(&dev->master_mutex); |
129 | return -EFAULT14; |
130 | } |
131 | } |
132 | u->unique_len = master->unique_len; |
133 | mutex_unlock(&dev->master_mutex)rw_exit_write(&dev->master_mutex); |
134 | |
135 | return 0; |
136 | } |
137 | |
138 | static void |
139 | drm_unset_busid(struct drm_device *dev, |
140 | struct drm_master *master) |
141 | { |
142 | kfree(master->unique); |
143 | master->unique = NULL((void *)0); |
144 | master->unique_len = 0; |
145 | } |
146 | |
147 | static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv) |
148 | { |
149 | struct drm_master *master = file_priv->master; |
150 | int ret; |
151 | |
152 | if (master->unique != NULL((void *)0)) |
153 | drm_unset_busid(dev, master); |
154 | |
155 | #ifdef __linux__ |
156 | if (dev->dev && dev_is_pci(dev->dev)) { |
157 | #else |
158 | if (1) { |
159 | #endif |
160 | ret = drm_pci_set_busid(dev, master); |
161 | if (ret) { |
162 | drm_unset_busid(dev, master); |
163 | return ret; |
164 | } |
165 | } else { |
166 | WARN_ON(!dev->unique)({ int __ret = !!(!dev->unique); if (__ret) printf("WARNING %s failed at %s:%d\n" , "!dev->unique", "/usr/src/sys/dev/pci/drm/drm_ioctl.c", 166 ); __builtin_expect(!!(__ret), 0); }); |
167 | master->unique = kstrdup(dev->unique, GFP_KERNEL(0x0001 | 0x0004)); |
168 | if (master->unique) |
169 | master->unique_len = strlen(dev->unique); |
170 | } |
171 | |
172 | return 0; |
173 | } |
174 | |
175 | /* |
176 | * Get client information. |
177 | * |
178 | * \param inode device inode. |
179 | * \param file_priv DRM file private. |
180 | * \param cmd command. |
181 | * \param arg user argument, pointing to a drm_client structure. |
182 | * |
183 | * \return zero on success or a negative number on failure. |
184 | * |
185 | * Searches for the client with the specified index and copies its information |
186 | * into userspace |
187 | */ |
188 | int drm_getclient(struct drm_device *dev, void *data, |
189 | struct drm_file *file_priv) |
190 | { |
191 | struct drm_client *client = data; |
192 | |
193 | /* |
194 | * Hollowed-out getclient ioctl to keep some dead old drm tests/tools |
195 | * not breaking completely. Userspace tools stop enumerating one they |
196 | * get -EINVAL, hence this is the return value we need to hand back for |
197 | * no clients tracked. |
198 | * |
199 | * Unfortunately some clients (*cough* libva *cough*) use this in a fun |
200 | * attempt to figure out whether they're authenticated or not. Since |
201 | * that's the only thing they care about, give it to the directly |
202 | * instead of walking one giant list. |
203 | */ |
204 | if (client->idx == 0) { |
205 | client->auth = file_priv->authenticated; |
206 | #ifdef __linux__ |
207 | client->pid = task_pid_vnr(current); |
208 | client->uid = overflowuid; |
209 | #else |
210 | client->pid = curproc({struct cpu_info *__ci; asm volatile("movq %%gs:%P1,%0" : "=r" (__ci) :"n" (__builtin_offsetof(struct cpu_info, ci_self))); __ci;})->ci_curproc->p_p->ps_pid; |
211 | client->uid = 0xfffe; |
212 | #endif |
213 | client->magic = 0; |
214 | client->iocs = 0; |
215 | |
216 | return 0; |
217 | } else { |
218 | return -EINVAL22; |
219 | } |
220 | } |
221 | |
222 | /* |
223 | * Get statistics information. |
224 | * |
225 | * \param inode device inode. |
226 | * \param file_priv DRM file private. |
227 | * \param cmd command. |
228 | * \param arg user argument, pointing to a drm_stats structure. |
229 | * |
230 | * \return zero on success or a negative number on failure. |
231 | */ |
232 | static int drm_getstats(struct drm_device *dev, void *data, |
233 | struct drm_file *file_priv) |
234 | { |
235 | struct drm_stats *stats = data; |
236 | |
237 | /* Clear stats to prevent userspace from eating its stack garbage. */ |
238 | memset(stats, 0, sizeof(*stats))__builtin_memset((stats), (0), (sizeof(*stats))); |
239 | |
240 | return 0; |
241 | } |
242 | |
243 | /* |
244 | * Get device/driver capabilities |
245 | */ |
246 | static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv) |
247 | { |
248 | struct drm_get_cap *req = data; |
249 | struct drm_crtc *crtc; |
250 | |
251 | req->value = 0; |
252 | |
253 | /* Only some caps make sense with UMS/render-only drivers. */ |
254 | switch (req->capability) { |
255 | case DRM_CAP_TIMESTAMP_MONOTONIC0x6: |
256 | req->value = 1; |
257 | return 0; |
258 | case DRM_CAP_PRIME0x5: |
259 | req->value |= dev->driver->prime_fd_to_handle ? DRM_PRIME_CAP_IMPORT0x1 : 0; |
260 | req->value |= dev->driver->prime_handle_to_fd ? DRM_PRIME_CAP_EXPORT0x2 : 0; |
261 | return 0; |
262 | case DRM_CAP_SYNCOBJ0x13: |
263 | req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ); |
264 | return 0; |
265 | case DRM_CAP_SYNCOBJ_TIMELINE0x14: |
266 | req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE); |
267 | return 0; |
268 | } |
269 | |
270 | /* Other caps only work with KMS drivers */ |
271 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
272 | return -EOPNOTSUPP45; |
273 | |
274 | switch (req->capability) { |
275 | case DRM_CAP_DUMB_BUFFER0x1: |
276 | if (dev->driver->dumb_create) |
277 | req->value = 1; |
278 | break; |
279 | case DRM_CAP_VBLANK_HIGH_CRTC0x2: |
280 | req->value = 1; |
281 | break; |
282 | case DRM_CAP_DUMB_PREFERRED_DEPTH0x3: |
283 | req->value = dev->mode_config.preferred_depth; |
284 | break; |
285 | case DRM_CAP_DUMB_PREFER_SHADOW0x4: |
286 | req->value = dev->mode_config.prefer_shadow; |
287 | break; |
288 | case DRM_CAP_ASYNC_PAGE_FLIP0x7: |
289 | req->value = dev->mode_config.async_page_flip; |
290 | break; |
291 | case DRM_CAP_PAGE_FLIP_TARGET0x11: |
292 | req->value = 1; |
293 | drm_for_each_crtc(crtc, dev)for (crtc = ({ const __typeof( ((__typeof(*crtc) *)0)->head ) *__mptr = ((&(dev)->mode_config.crtc_list)->next ); (__typeof(*crtc) *)( (char *)__mptr - __builtin_offsetof(__typeof (*crtc), head) );}); &crtc->head != (&(dev)->mode_config .crtc_list); crtc = ({ const __typeof( ((__typeof(*crtc) *)0) ->head ) *__mptr = (crtc->head.next); (__typeof(*crtc) * )( (char *)__mptr - __builtin_offsetof(__typeof(*crtc), head) );})) { |
294 | if (!crtc->funcs->page_flip_target) |
295 | req->value = 0; |
296 | } |
297 | break; |
298 | case DRM_CAP_CURSOR_WIDTH0x8: |
299 | if (dev->mode_config.cursor_width) |
300 | req->value = dev->mode_config.cursor_width; |
301 | else |
302 | req->value = 64; |
303 | break; |
304 | case DRM_CAP_CURSOR_HEIGHT0x9: |
305 | if (dev->mode_config.cursor_height) |
306 | req->value = dev->mode_config.cursor_height; |
307 | else |
308 | req->value = 64; |
309 | break; |
310 | case DRM_CAP_ADDFB2_MODIFIERS0x10: |
311 | req->value = !dev->mode_config.fb_modifiers_not_supported; |
312 | break; |
313 | case DRM_CAP_CRTC_IN_VBLANK_EVENT0x12: |
314 | req->value = 1; |
315 | break; |
316 | default: |
317 | return -EINVAL22; |
318 | } |
319 | return 0; |
320 | } |
321 | |
322 | /* |
323 | * Set device/driver capabilities |
324 | */ |
325 | static int |
326 | drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv) |
327 | { |
328 | struct drm_set_client_cap *req = data; |
329 | |
330 | /* No render-only settable capabilities for now */ |
331 | |
332 | /* Below caps that only works with KMS drivers */ |
333 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
334 | return -EOPNOTSUPP45; |
335 | |
336 | switch (req->capability) { |
337 | case DRM_CLIENT_CAP_STEREO_3D1: |
338 | if (req->value > 1) |
339 | return -EINVAL22; |
340 | file_priv->stereo_allowed = req->value; |
341 | break; |
342 | case DRM_CLIENT_CAP_UNIVERSAL_PLANES2: |
343 | if (req->value > 1) |
344 | return -EINVAL22; |
345 | file_priv->universal_planes = req->value; |
346 | break; |
347 | case DRM_CLIENT_CAP_ATOMIC3: |
348 | if (!drm_core_check_feature(dev, DRIVER_ATOMIC)) |
349 | return -EOPNOTSUPP45; |
350 | /* The modesetting DDX has a totally broken idea of atomic. */ |
351 | #ifdef __linux__ |
352 | if (current->comm[0] == 'X' && req->value == 1) { |
353 | #else |
354 | if (curproc({struct cpu_info *__ci; asm volatile("movq %%gs:%P1,%0" : "=r" (__ci) :"n" (__builtin_offsetof(struct cpu_info, ci_self))); __ci;})->ci_curproc->p_p->ps_comm[0] == 'X' && req->value == 1) { |
355 | #endif |
356 | pr_info("broken atomic modeset userspace detected, disabling atomic\n")do { } while(0); |
357 | return -EOPNOTSUPP45; |
358 | } |
359 | if (req->value > 2) |
360 | return -EINVAL22; |
361 | file_priv->atomic = req->value; |
362 | file_priv->universal_planes = req->value; |
363 | /* |
364 | * No atomic user-space blows up on aspect ratio mode bits. |
365 | */ |
366 | file_priv->aspect_ratio_allowed = req->value; |
367 | break; |
368 | case DRM_CLIENT_CAP_ASPECT_RATIO4: |
369 | if (req->value > 1) |
370 | return -EINVAL22; |
371 | file_priv->aspect_ratio_allowed = req->value; |
372 | break; |
373 | case DRM_CLIENT_CAP_WRITEBACK_CONNECTORS5: |
374 | if (!file_priv->atomic) |
375 | return -EINVAL22; |
376 | if (req->value > 1) |
377 | return -EINVAL22; |
378 | file_priv->writeback_connectors = req->value; |
379 | break; |
380 | default: |
381 | return -EINVAL22; |
382 | } |
383 | |
384 | return 0; |
385 | } |
386 | |
387 | /* |
388 | * Setversion ioctl. |
389 | * |
390 | * \param inode device inode. |
391 | * \param file_priv DRM file private. |
392 | * \param cmd command. |
393 | * \param arg user argument, pointing to a drm_lock structure. |
394 | * \return zero on success or negative number on failure. |
395 | * |
396 | * Sets the requested interface version |
397 | */ |
398 | static int drm_setversion(struct drm_device *dev, void *data, struct drm_file *file_priv) |
399 | { |
400 | struct drm_set_version *sv = data; |
401 | int if_version, retcode = 0; |
402 | |
403 | mutex_lock(&dev->master_mutex)rw_enter_write(&dev->master_mutex); |
404 | if (sv->drm_di_major != -1) { |
405 | if (sv->drm_di_major != DRM_IF_MAJOR1 || |
406 | sv->drm_di_minor < 0 || sv->drm_di_minor > DRM_IF_MINOR4) { |
407 | retcode = -EINVAL22; |
408 | goto done; |
409 | } |
410 | if_version = DRM_IF_VERSION(sv->drm_di_major,(sv->drm_di_major << 16 | sv->drm_di_minor) |
411 | sv->drm_di_minor)(sv->drm_di_major << 16 | sv->drm_di_minor); |
412 | dev->if_version = max(if_version, dev->if_version)(((if_version)>(dev->if_version))?(if_version):(dev-> if_version)); |
413 | if (sv->drm_di_minor >= 1) { |
414 | /* |
415 | * Version 1.1 includes tying of DRM to specific device |
416 | * Version 1.4 has proper PCI domain support |
417 | */ |
418 | retcode = drm_set_busid(dev, file_priv); |
419 | if (retcode) |
420 | goto done; |
421 | } |
422 | } |
423 | |
424 | if (sv->drm_dd_major != -1) { |
425 | if (sv->drm_dd_major != dev->driver->major || |
426 | sv->drm_dd_minor < 0 || sv->drm_dd_minor > |
427 | dev->driver->minor) { |
428 | retcode = -EINVAL22; |
429 | goto done; |
430 | } |
431 | } |
432 | |
433 | done: |
434 | sv->drm_di_major = DRM_IF_MAJOR1; |
435 | sv->drm_di_minor = DRM_IF_MINOR4; |
436 | sv->drm_dd_major = dev->driver->major; |
437 | sv->drm_dd_minor = dev->driver->minor; |
438 | mutex_unlock(&dev->master_mutex)rw_exit_write(&dev->master_mutex); |
439 | |
440 | return retcode; |
441 | } |
442 | |
443 | /** |
444 | * drm_noop - DRM no-op ioctl implementation |
445 | * @dev: DRM device for the ioctl |
446 | * @data: data pointer for the ioctl |
447 | * @file_priv: DRM file for the ioctl call |
448 | * |
449 | * This no-op implementation for drm ioctls is useful for deprecated |
450 | * functionality where we can't return a failure code because existing userspace |
451 | * checks the result of the ioctl, but doesn't care about the action. |
452 | * |
453 | * Always returns successfully with 0. |
454 | */ |
455 | int drm_noop(struct drm_device *dev, void *data, |
456 | struct drm_file *file_priv) |
457 | { |
458 | DRM_DEBUG("\n")___drm_dbg(((void *)0), DRM_UT_CORE, "\n"); |
459 | return 0; |
460 | } |
461 | EXPORT_SYMBOL(drm_noop); |
462 | |
463 | /** |
464 | * drm_invalid_op - DRM invalid ioctl implementation |
465 | * @dev: DRM device for the ioctl |
466 | * @data: data pointer for the ioctl |
467 | * @file_priv: DRM file for the ioctl call |
468 | * |
469 | * This no-op implementation for drm ioctls is useful for deprecated |
470 | * functionality where we really don't want to allow userspace to call the ioctl |
471 | * any more. This is the case for old ums interfaces for drivers that |
472 | * transitioned to kms gradually and so kept the old legacy tables around. This |
473 | * only applies to radeon and i915 kms drivers, other drivers shouldn't need to |
474 | * use this function. |
475 | * |
476 | * Always fails with a return value of -EINVAL. |
477 | */ |
478 | int drm_invalid_op(struct drm_device *dev, void *data, |
479 | struct drm_file *file_priv) |
480 | { |
481 | return -EINVAL22; |
482 | } |
483 | EXPORT_SYMBOL(drm_invalid_op); |
484 | |
485 | /* |
486 | * Copy and IOCTL return string to user space |
487 | */ |
488 | static int drm_copy_field(char __user *buf, size_t *buf_len, const char *value) |
489 | { |
490 | size_t len; |
491 | |
492 | /* don't attempt to copy a NULL pointer */ |
493 | if (WARN_ONCE(!value, "BUG: the value to copy was not set!")({ static int __warned; int __ret = !!(!value); if (__ret && !__warned) { printf("BUG: the value to copy was not set!"); __warned = 1; } __builtin_expect(!!(__ret), 0); })) { |
494 | *buf_len = 0; |
495 | return 0; |
496 | } |
497 | |
498 | /* don't overflow userbuf */ |
499 | len = strlen(value); |
500 | if (len > *buf_len) |
501 | len = *buf_len; |
502 | |
503 | /* let userspace know exact length of driver value (which could be |
504 | * larger than the userspace-supplied buffer) */ |
505 | *buf_len = strlen(value); |
506 | |
507 | /* finally, try filling in the userbuf */ |
508 | if (len && buf) |
509 | if (copy_to_user(buf, value, len)) |
510 | return -EFAULT14; |
511 | return 0; |
512 | } |
513 | |
514 | /* |
515 | * Get version information |
516 | * |
517 | * \param inode device inode. |
518 | * \param filp file pointer. |
519 | * \param cmd command. |
520 | * \param arg user argument, pointing to a drm_version structure. |
521 | * \return zero on success or negative number on failure. |
522 | * |
523 | * Fills in the version information in \p arg. |
524 | */ |
525 | int drm_version(struct drm_device *dev, void *data, |
526 | struct drm_file *file_priv) |
527 | { |
528 | struct drm_version *version = data; |
529 | int err; |
530 | |
531 | version->version_major = dev->driver->major; |
532 | version->version_minor = dev->driver->minor; |
533 | version->version_patchlevel = dev->driver->patchlevel; |
534 | err = drm_copy_field(version->name, &version->name_len, |
535 | dev->driver->name); |
536 | if (!err) |
537 | err = drm_copy_field(version->date, &version->date_len, |
538 | dev->driver->date); |
539 | if (!err) |
540 | err = drm_copy_field(version->desc, &version->desc_len, |
541 | dev->driver->desc); |
542 | |
543 | return err; |
544 | } |
545 | |
546 | static int drm_ioctl_permit(u32 flags, struct drm_file *file_priv) |
547 | { |
548 | /* ROOT_ONLY is only for CAP_SYS_ADMIN */ |
549 | if (unlikely((flags & DRM_ROOT_ONLY) && !capable(CAP_SYS_ADMIN))__builtin_expect(!!((flags & DRM_ROOT_ONLY) && !capable (0x1)), 0)) |
550 | return -EACCES13; |
551 | |
552 | /* AUTH is only for authenticated or render client */ |
553 | if (unlikely((flags & DRM_AUTH) && !drm_is_render_client(file_priv) &&__builtin_expect(!!((flags & DRM_AUTH) && !drm_is_render_client (file_priv) && !file_priv->authenticated), 0) |
554 | !file_priv->authenticated)__builtin_expect(!!((flags & DRM_AUTH) && !drm_is_render_client (file_priv) && !file_priv->authenticated), 0)) |
555 | return -EACCES13; |
556 | |
557 | /* MASTER is only for master or control clients */ |
558 | if (unlikely((flags & DRM_MASTER) &&__builtin_expect(!!((flags & DRM_MASTER) && !drm_is_current_master (file_priv)), 0) |
559 | !drm_is_current_master(file_priv))__builtin_expect(!!((flags & DRM_MASTER) && !drm_is_current_master (file_priv)), 0)) |
560 | return -EACCES13; |
561 | |
562 | /* Render clients must be explicitly allowed */ |
563 | if (unlikely(!(flags & DRM_RENDER_ALLOW) &&__builtin_expect(!!(!(flags & DRM_RENDER_ALLOW) && drm_is_render_client(file_priv)), 0) |
564 | drm_is_render_client(file_priv))__builtin_expect(!!(!(flags & DRM_RENDER_ALLOW) && drm_is_render_client(file_priv)), 0)) |
565 | return -EACCES13; |
566 | |
567 | return 0; |
568 | } |
569 | |
570 | #define DRM_IOCTL_DEF(ioctl, _func, _flags)[((ioctl) & 0xff)] = { .cmd = ioctl, .func = _func, .flags = _flags, .name = "ioctl" } \ |
571 | [DRM_IOCTL_NR(ioctl)((ioctl) & 0xff)] = { \ |
572 | .cmd = ioctl, \ |
573 | .func = _func, \ |
574 | .flags = _flags, \ |
575 | .name = #ioctl \ |
576 | } |
577 | |
578 | #if IS_ENABLED(CONFIG_DRM_LEGACY)0 |
579 | #define DRM_LEGACY_IOCTL_DEF(ioctl, _func, _flags)[((ioctl) & 0xff)] = { .cmd = ioctl, .func = drm_invalid_op , .flags = _flags, .name = "ioctl" } DRM_IOCTL_DEF(ioctl, _func, _flags)[((ioctl) & 0xff)] = { .cmd = ioctl, .func = _func, .flags = _flags, .name = "ioctl" } |
580 | #else |
581 | #define DRM_LEGACY_IOCTL_DEF(ioctl, _func, _flags)[((ioctl) & 0xff)] = { .cmd = ioctl, .func = drm_invalid_op , .flags = _flags, .name = "ioctl" } DRM_IOCTL_DEF(ioctl, drm_invalid_op, _flags)[((ioctl) & 0xff)] = { .cmd = ioctl, .func = drm_invalid_op , .flags = _flags, .name = "ioctl" } |
582 | #endif |
583 | |
584 | /* Ioctl table */ |
585 | static const struct drm_ioctl_desc drm_ioctls[] = { |
586 | DRM_IOCTL_DEF(DRM_IOCTL_VERSION, drm_version, DRM_RENDER_ALLOW)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_version) & 0x1fff) << 16) | ((('d' )) << 8) | ((0x00)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_version) & 0x1fff) << 16) | ((('d')) << 8 ) | ((0x00))), .func = drm_version, .flags = DRM_RENDER_ALLOW , .name = "DRM_IOCTL_VERSION" }, |
587 | DRM_IOCTL_DEF(DRM_IOCTL_GET_UNIQUE, drm_getunique, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_unique) & 0x1fff) << 16) | ((('d' )) << 8) | ((0x01)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_unique) & 0x1fff) << 16) | ((('d')) << 8 ) | ((0x01))), .func = drm_getunique, .flags = 0, .name = "DRM_IOCTL_GET_UNIQUE" }, |
588 | DRM_IOCTL_DEF(DRM_IOCTL_GET_MAGIC, drm_getmagic, 0)[((((unsigned long)0x40000000 | ((sizeof(struct drm_auth) & 0x1fff) << 16) | ((('d')) << 8) | ((0x02)))) & 0xff)] = { .cmd = ((unsigned long)0x40000000 | ((sizeof(struct drm_auth) & 0x1fff) << 16) | ((('d')) << 8) | ((0x02))), .func = drm_getmagic, .flags = 0, .name = "DRM_IOCTL_GET_MAGIC" }, |
589 | #ifdef __linux__ |
590 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_IRQ_BUSID, drm_legacy_irq_by_busid,[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_irq_busid) & 0x1fff) << 16) | (( ('d')) << 8) | ((0x03)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_irq_busid) & 0x1fff) << 16) | ((('d')) << 8) | ((0x03))), .func = drm_invalid_op, .flags = DRM_MASTER| DRM_ROOT_ONLY, .name = "(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_irq_busid) & 0x1fff) << 16) | ((('d')) << 8) | ((0x03)))" } |
591 | DRM_MASTER|DRM_ROOT_ONLY)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_irq_busid) & 0x1fff) << 16) | (( ('d')) << 8) | ((0x03)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_irq_busid) & 0x1fff) << 16) | ((('d')) << 8) | ((0x03))), .func = drm_invalid_op, .flags = DRM_MASTER| DRM_ROOT_ONLY, .name = "(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_irq_busid) & 0x1fff) << 16) | ((('d')) << 8) | ((0x03)))" }, |
592 | #endif |
593 | |
594 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_GET_MAP, drm_legacy_getmap_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_map) & 0x1fff) << 16) | ((('d')) << 8) | ((0x04)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_map) & 0x1fff) << 16) | ((('d')) << 8) | ((0x04))), .func = drm_invalid_op, .flags = 0, .name = "(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_map) & 0x1fff) << 16) | ((('d')) << 8) | ((0x04)))" }, |
595 | |
596 | DRM_IOCTL_DEF(DRM_IOCTL_GET_CLIENT, drm_getclient, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_client) & 0x1fff) << 16) | ((('d' )) << 8) | ((0x05)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_client) & 0x1fff) << 16) | ((('d')) << 8 ) | ((0x05))), .func = drm_getclient, .flags = 0, .name = "DRM_IOCTL_GET_CLIENT" }, |
597 | DRM_IOCTL_DEF(DRM_IOCTL_GET_STATS, drm_getstats, 0)[((((unsigned long)0x40000000 | ((sizeof(struct drm_stats) & 0x1fff) << 16) | ((('d')) << 8) | ((0x06)))) & 0xff)] = { .cmd = ((unsigned long)0x40000000 | ((sizeof(struct drm_stats) & 0x1fff) << 16) | ((('d')) << 8) | ((0x06))), .func = drm_getstats, .flags = 0, .name = "DRM_IOCTL_GET_STATS" }, |
598 | DRM_IOCTL_DEF(DRM_IOCTL_GET_CAP, drm_getcap, DRM_RENDER_ALLOW)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_get_cap) & 0x1fff) << 16) | ((('d' )) << 8) | ((0x0c)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_get_cap) & 0x1fff) << 16) | ((('d')) << 8 ) | ((0x0c))), .func = drm_getcap, .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_GET_CAP" }, |
599 | DRM_IOCTL_DEF(DRM_IOCTL_SET_CLIENT_CAP, drm_setclientcap, 0)[((((unsigned long)0x80000000 | ((sizeof(struct drm_set_client_cap ) & 0x1fff) << 16) | ((('d')) << 8) | ((0x0d) ))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_set_client_cap) & 0x1fff) << 16) | ((('d' )) << 8) | ((0x0d))), .func = drm_setclientcap, .flags = 0, .name = "DRM_IOCTL_SET_CLIENT_CAP" }, |
600 | DRM_IOCTL_DEF(DRM_IOCTL_SET_VERSION, drm_setversion, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_set_version) & 0x1fff) << 16) | ( (('d')) << 8) | ((0x07)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_set_version) & 0x1fff) << 16) | ((('d')) << 8) | ((0x07))), .func = drm_setversion, .flags = DRM_MASTER, .name = "DRM_IOCTL_SET_VERSION" }, |
601 | |
602 | DRM_IOCTL_DEF(DRM_IOCTL_SET_UNIQUE, drm_invalid_op, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((((unsigned long)0x80000000 | ((sizeof(struct drm_unique) & 0x1fff) << 16) | ((('d')) << 8) | ((0x10)))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof(struct drm_unique) & 0x1fff) << 16) | ((('d')) << 8 ) | ((0x10))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER |DRM_ROOT_ONLY, .name = "DRM_IOCTL_SET_UNIQUE" }, |
603 | DRM_IOCTL_DEF(DRM_IOCTL_BLOCK, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_block) & 0x1fff) << 16) | ((('d' )) << 8) | ((0x12)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_block) & 0x1fff) << 16) | ((('d')) << 8) | ((0x12))), .func = drm_noop, .flags = DRM_AUTH|DRM_MASTER| DRM_ROOT_ONLY, .name = "DRM_IOCTL_BLOCK" }, |
604 | DRM_IOCTL_DEF(DRM_IOCTL_UNBLOCK, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_block) & 0x1fff) << 16) | ((('d' )) << 8) | ((0x13)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_block) & 0x1fff) << 16) | ((('d')) << 8) | ((0x13))), .func = drm_noop, .flags = DRM_AUTH|DRM_MASTER| DRM_ROOT_ONLY, .name = "DRM_IOCTL_UNBLOCK" }, |
605 | DRM_IOCTL_DEF(DRM_IOCTL_AUTH_MAGIC, drm_authmagic, DRM_MASTER)[((((unsigned long)0x80000000 | ((sizeof(struct drm_auth) & 0x1fff) << 16) | ((('d')) << 8) | ((0x11)))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof(struct drm_auth) & 0x1fff) << 16) | ((('d')) << 8) | ((0x11))), .func = drm_authmagic, .flags = DRM_MASTER, .name = "DRM_IOCTL_AUTH_MAGIC" }, |
606 | |
607 | #ifdef __linux__ |
608 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_ADD_MAP, drm_legacy_addmap_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((DRM_IOCTL_ADD_MAP) & 0xff)] = { .cmd = DRM_IOCTL_ADD_MAP , .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY , .name = "DRM_IOCTL_ADD_MAP" }, |
609 | #else |
610 | DRM_IOCTL_DEF(DRM_IOCTL_GET_PCIINFO, drm_getpciinfo, DRM_UNLOCKED|DRM_RENDER_ALLOW)[((((unsigned long)0x40000000 | ((sizeof(struct drm_pciinfo) & 0x1fff) << 16) | ((('d')) << 8) | ((0x15)))) & 0xff)] = { .cmd = ((unsigned long)0x40000000 | ((sizeof(struct drm_pciinfo) & 0x1fff) << 16) | ((('d')) << 8 ) | ((0x15))), .func = drm_getpciinfo, .flags = DRM_UNLOCKED| DRM_RENDER_ALLOW, .name = "DRM_IOCTL_GET_PCIINFO" }, |
611 | #endif |
612 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_RM_MAP, drm_legacy_rmmap_ioctl, DRM_AUTH)[((((unsigned long)0x80000000 | ((sizeof(struct drm_map) & 0x1fff) << 16) | ((('d')) << 8) | ((0x1b)))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof(struct drm_map) & 0x1fff) << 16) | ((('d')) << 8) | ((0x1b))), .func = drm_invalid_op, .flags = DRM_AUTH, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_map) & 0x1fff) << 16) | ((('d')) << 8) | ((0x1b)))" }, |
613 | |
614 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_SET_SAREA_CTX, drm_legacy_setsareactx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((((unsigned long)0x80000000 | ((sizeof(struct drm_ctx_priv_map ) & 0x1fff) << 16) | ((('d')) << 8) | ((0x1c) ))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_ctx_priv_map) & 0x1fff) << 16) | ((('d' )) << 8) | ((0x1c))), .func = drm_invalid_op, .flags = DRM_AUTH |DRM_MASTER|DRM_ROOT_ONLY, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_ctx_priv_map) & 0x1fff) << 16) | ((('d')) << 8) | ((0x1c)))" }, |
615 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_GET_SAREA_CTX, drm_legacy_getsareactx, DRM_AUTH)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_ctx_priv_map) & 0x1fff) << 16) | ((('d')) << 8) | ((0x1d)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_ctx_priv_map) & 0x1fff) << 16) | ((('d' )) << 8) | ((0x1d))), .func = drm_invalid_op, .flags = DRM_AUTH , .name = "(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_ctx_priv_map) & 0x1fff) << 16) | ((('d')) << 8) | ((0x1d)))" }, |
616 | |
617 | #ifdef __linux__ |
618 | DRM_IOCTL_DEF(DRM_IOCTL_SET_MASTER, drm_setmaster_ioctl, 0)[((((unsigned long)0x20000000 | ((0 & 0x1fff) << 16 ) | ((('d')) << 8) | ((0x1e)))) & 0xff)] = { .cmd = ((unsigned long)0x20000000 | ((0 & 0x1fff) << 16) | ((('d')) << 8) | ((0x1e))), .func = drm_setmaster_ioctl , .flags = 0, .name = "DRM_IOCTL_SET_MASTER" }, |
619 | DRM_IOCTL_DEF(DRM_IOCTL_DROP_MASTER, drm_dropmaster_ioctl, 0)[((((unsigned long)0x20000000 | ((0 & 0x1fff) << 16 ) | ((('d')) << 8) | ((0x1f)))) & 0xff)] = { .cmd = ((unsigned long)0x20000000 | ((0 & 0x1fff) << 16) | ((('d')) << 8) | ((0x1f))), .func = drm_dropmaster_ioctl , .flags = 0, .name = "DRM_IOCTL_DROP_MASTER" }, |
620 | #else |
621 | /* On OpenBSD xorg privdrop has already occurred before this point */ |
622 | DRM_IOCTL_DEF(DRM_IOCTL_SET_MASTER, drm_noop, DRM_UNLOCKED)[((((unsigned long)0x20000000 | ((0 & 0x1fff) << 16 ) | ((('d')) << 8) | ((0x1e)))) & 0xff)] = { .cmd = ((unsigned long)0x20000000 | ((0 & 0x1fff) << 16) | ((('d')) << 8) | ((0x1e))), .func = drm_noop, .flags = DRM_UNLOCKED, .name = "DRM_IOCTL_SET_MASTER" }, |
623 | DRM_IOCTL_DEF(DRM_IOCTL_DROP_MASTER, drm_noop, DRM_UNLOCKED)[((((unsigned long)0x20000000 | ((0 & 0x1fff) << 16 ) | ((('d')) << 8) | ((0x1f)))) & 0xff)] = { .cmd = ((unsigned long)0x20000000 | ((0 & 0x1fff) << 16) | ((('d')) << 8) | ((0x1f))), .func = drm_noop, .flags = DRM_UNLOCKED, .name = "DRM_IOCTL_DROP_MASTER" }, |
624 | #endif |
625 | |
626 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_ADD_CTX, drm_legacy_addctx, DRM_AUTH|DRM_ROOT_ONLY)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x20)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x20))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_ROOT_ONLY , .name = "(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x20)))" }, |
627 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_RM_CTX, drm_legacy_rmctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x21)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x21))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER |DRM_ROOT_ONLY, .name = "(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x21)))" }, |
628 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_MOD_CTX, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((((unsigned long)0x80000000 | ((sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x22)))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x22))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER |DRM_ROOT_ONLY, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x22)))" }, |
629 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_GET_CTX, drm_legacy_getctx, DRM_AUTH)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x23)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x23))), .func = drm_invalid_op, .flags = DRM_AUTH, .name = "(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x23)))" }, |
630 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_SWITCH_CTX, drm_legacy_switchctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((((unsigned long)0x80000000 | ((sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x24)))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x24))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER |DRM_ROOT_ONLY, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x24)))" }, |
631 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_NEW_CTX, drm_legacy_newctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((((unsigned long)0x80000000 | ((sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x25)))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x25))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER |DRM_ROOT_ONLY, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_ctx) & 0x1fff) << 16) | ((('d')) << 8) | ((0x25)))" }, |
632 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_RES_CTX, drm_legacy_resctx, DRM_AUTH)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_ctx_res) & 0x1fff) << 16) | ((('d' )) << 8) | ((0x26)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_ctx_res) & 0x1fff) << 16) | ((('d')) << 8 ) | ((0x26))), .func = drm_invalid_op, .flags = DRM_AUTH, .name = "(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_ctx_res) & 0x1fff) << 16) | ((('d')) << 8) | ((0x26)))" }, |
633 | |
634 | DRM_IOCTL_DEF(DRM_IOCTL_ADD_DRAW, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_draw) & 0x1fff) << 16) | ((('d') ) << 8) | ((0x27)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_draw) & 0x1fff) << 16) | ((('d')) << 8) | ((0x27))), .func = drm_noop, .flags = DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY , .name = "DRM_IOCTL_ADD_DRAW" }, |
635 | DRM_IOCTL_DEF(DRM_IOCTL_RM_DRAW, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_draw) & 0x1fff) << 16) | ((('d') ) << 8) | ((0x28)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_draw) & 0x1fff) << 16) | ((('d')) << 8) | ((0x28))), .func = drm_noop, .flags = DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY , .name = "DRM_IOCTL_RM_DRAW" }, |
636 | |
637 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_LOCK, drm_legacy_lock, DRM_AUTH)[((((unsigned long)0x80000000 | ((sizeof(struct drm_lock) & 0x1fff) << 16) | ((('d')) << 8) | ((0x2a)))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof(struct drm_lock) & 0x1fff) << 16) | ((('d')) << 8) | ((0x2a))), .func = drm_invalid_op, .flags = DRM_AUTH, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_lock) & 0x1fff) << 16) | ((('d')) << 8) | ((0x2a)))" }, |
638 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_UNLOCK, drm_legacy_unlock, DRM_AUTH)[((((unsigned long)0x80000000 | ((sizeof(struct drm_lock) & 0x1fff) << 16) | ((('d')) << 8) | ((0x2b)))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof(struct drm_lock) & 0x1fff) << 16) | ((('d')) << 8) | ((0x2b))), .func = drm_invalid_op, .flags = DRM_AUTH, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_lock) & 0x1fff) << 16) | ((('d')) << 8) | ((0x2b)))" }, |
639 | |
640 | DRM_IOCTL_DEF(DRM_IOCTL_FINISH, drm_noop, DRM_AUTH)[((((unsigned long)0x80000000 | ((sizeof(struct drm_lock) & 0x1fff) << 16) | ((('d')) << 8) | ((0x2c)))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof(struct drm_lock) & 0x1fff) << 16) | ((('d')) << 8) | ((0x2c))), .func = drm_noop, .flags = DRM_AUTH, .name = "DRM_IOCTL_FINISH" }, |
641 | |
642 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_ADD_BUFS, drm_legacy_addbufs, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_buf_desc) & 0x1fff) << 16) | ((( 'd')) << 8) | ((0x16)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_buf_desc) & 0x1fff) << 16) | ((('d')) << 8) | ((0x16))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER |DRM_ROOT_ONLY, .name = "(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_buf_desc) & 0x1fff) << 16) | ((('d')) << 8) | ((0x16)))" }, |
643 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_MARK_BUFS, drm_legacy_markbufs, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((((unsigned long)0x80000000 | ((sizeof(struct drm_buf_desc) & 0x1fff) << 16) | ((('d')) << 8) | ((0x17)) )) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_buf_desc) & 0x1fff) << 16) | ((('d')) << 8) | ((0x17))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER |DRM_ROOT_ONLY, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_buf_desc) & 0x1fff) << 16) | ((('d')) << 8) | ((0x17)))" }, |
644 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_INFO_BUFS, drm_legacy_infobufs, DRM_AUTH)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_buf_info) & 0x1fff) << 16) | ((( 'd')) << 8) | ((0x18)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_buf_info) & 0x1fff) << 16) | ((('d')) << 8) | ((0x18))), .func = drm_invalid_op, .flags = DRM_AUTH, . name = "(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_buf_info) & 0x1fff) << 16) | ((('d')) << 8) | ((0x18)))" }, |
645 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_MAP_BUFS, drm_legacy_mapbufs, DRM_AUTH)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_buf_map) & 0x1fff) << 16) | ((('d' )) << 8) | ((0x19)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_buf_map) & 0x1fff) << 16) | ((('d')) << 8 ) | ((0x19))), .func = drm_invalid_op, .flags = DRM_AUTH, .name = "(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_buf_map) & 0x1fff) << 16) | ((('d')) << 8) | ((0x19)))" }, |
646 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_FREE_BUFS, drm_legacy_freebufs, DRM_AUTH)[((((unsigned long)0x80000000 | ((sizeof(struct drm_buf_free) & 0x1fff) << 16) | ((('d')) << 8) | ((0x1a)) )) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_buf_free) & 0x1fff) << 16) | ((('d')) << 8) | ((0x1a))), .func = drm_invalid_op, .flags = DRM_AUTH, . name = "((unsigned long)0x80000000 | ((sizeof(struct drm_buf_free) & 0x1fff) << 16) | ((('d')) << 8) | ((0x1a)))" }, |
647 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_DMA, drm_legacy_dma_ioctl, DRM_AUTH)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_dma) & 0x1fff) << 16) | ((('d')) << 8) | ((0x29)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_dma) & 0x1fff) << 16) | ((('d')) << 8) | ((0x29))), .func = drm_invalid_op, .flags = DRM_AUTH, .name = "(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_dma) & 0x1fff) << 16) | ((('d')) << 8) | ((0x29)))" }, |
648 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_CONTROL, drm_legacy_irq_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((((unsigned long)0x80000000 | ((sizeof(struct drm_control) & 0x1fff) << 16) | ((('d')) << 8) | ((0x14)))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof(struct drm_control) & 0x1fff) << 16) | ((('d')) << 8 ) | ((0x14))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER |DRM_ROOT_ONLY, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_control) & 0x1fff) << 16) | ((('d')) << 8) | ((0x14)))" }, |
649 | |
650 | #if IS_ENABLED(CONFIG_AGP)1 && defined(__linux__) |
651 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_AGP_ACQUIRE, drm_legacy_agp_acquire_ioctl,[((((unsigned long)0x20000000 | ((0 & 0x1fff) << 16 ) | ((('d')) << 8) | ((0x30)))) & 0xff)] = { .cmd = ((unsigned long)0x20000000 | ((0 & 0x1fff) << 16) | ((('d')) << 8) | ((0x30))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY, .name = "((unsigned long)0x20000000 | ((0 & 0x1fff) << 16) | ((('d')) << 8) | ((0x30)))" } |
652 | DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((((unsigned long)0x20000000 | ((0 & 0x1fff) << 16 ) | ((('d')) << 8) | ((0x30)))) & 0xff)] = { .cmd = ((unsigned long)0x20000000 | ((0 & 0x1fff) << 16) | ((('d')) << 8) | ((0x30))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY, .name = "((unsigned long)0x20000000 | ((0 & 0x1fff) << 16) | ((('d')) << 8) | ((0x30)))" }, |
653 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_AGP_RELEASE, drm_legacy_agp_release_ioctl,[((((unsigned long)0x20000000 | ((0 & 0x1fff) << 16 ) | ((('d')) << 8) | ((0x31)))) & 0xff)] = { .cmd = ((unsigned long)0x20000000 | ((0 & 0x1fff) << 16) | ((('d')) << 8) | ((0x31))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY, .name = "((unsigned long)0x20000000 | ((0 & 0x1fff) << 16) | ((('d')) << 8) | ((0x31)))" } |
654 | DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((((unsigned long)0x20000000 | ((0 & 0x1fff) << 16 ) | ((('d')) << 8) | ((0x31)))) & 0xff)] = { .cmd = ((unsigned long)0x20000000 | ((0 & 0x1fff) << 16) | ((('d')) << 8) | ((0x31))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY, .name = "((unsigned long)0x20000000 | ((0 & 0x1fff) << 16) | ((('d')) << 8) | ((0x31)))" }, |
655 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_AGP_ENABLE, drm_legacy_agp_enable_ioctl,[((((unsigned long)0x80000000 | ((sizeof(struct drm_agp_mode) & 0x1fff) << 16) | ((('d')) << 8) | ((0x32)) )) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_agp_mode) & 0x1fff) << 16) | ((('d')) << 8) | ((0x32))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER |DRM_ROOT_ONLY, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_agp_mode) & 0x1fff) << 16) | ((('d')) << 8) | ((0x32)))" } |
656 | DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((((unsigned long)0x80000000 | ((sizeof(struct drm_agp_mode) & 0x1fff) << 16) | ((('d')) << 8) | ((0x32)) )) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_agp_mode) & 0x1fff) << 16) | ((('d')) << 8) | ((0x32))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER |DRM_ROOT_ONLY, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_agp_mode) & 0x1fff) << 16) | ((('d')) << 8) | ((0x32)))" }, |
657 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_AGP_INFO, drm_legacy_agp_info_ioctl, DRM_AUTH)[((((unsigned long)0x40000000 | ((sizeof(struct drm_agp_info) & 0x1fff) << 16) | ((('d')) << 8) | ((0x33)) )) & 0xff)] = { .cmd = ((unsigned long)0x40000000 | ((sizeof (struct drm_agp_info) & 0x1fff) << 16) | ((('d')) << 8) | ((0x33))), .func = drm_invalid_op, .flags = DRM_AUTH, . name = "((unsigned long)0x40000000 | ((sizeof(struct drm_agp_info) & 0x1fff) << 16) | ((('d')) << 8) | ((0x33)))" }, |
658 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_AGP_ALLOC, drm_legacy_agp_alloc_ioctl,[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_agp_buffer) & 0x1fff) << 16) | ( (('d')) << 8) | ((0x34)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_agp_buffer) & 0x1fff) << 16) | ((('d')) << 8) | ((0x34))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER |DRM_ROOT_ONLY, .name = "(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_agp_buffer) & 0x1fff) << 16) | ((('d')) << 8) | ((0x34)))" } |
659 | DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_agp_buffer) & 0x1fff) << 16) | ( (('d')) << 8) | ((0x34)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_agp_buffer) & 0x1fff) << 16) | ((('d')) << 8) | ((0x34))), .func = drm_invalid_op, .flags = DRM_AUTH|DRM_MASTER |DRM_ROOT_ONLY, .name = "(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_agp_buffer) & 0x1fff) << 16) | ((('d')) << 8) | ((0x34)))" }, |
660 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_AGP_FREE, drm_legacy_agp_free_ioctl,[((((unsigned long)0x80000000 | ((sizeof(struct drm_agp_buffer ) & 0x1fff) << 16) | ((('d')) << 8) | ((0x35) ))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_agp_buffer) & 0x1fff) << 16) | ((('d')) << 8) | ((0x35))), .func = drm_invalid_op, .flags = DRM_AUTH |DRM_MASTER|DRM_ROOT_ONLY, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_agp_buffer) & 0x1fff) << 16) | ((('d')) << 8) | ((0x35)))" } |
661 | DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((((unsigned long)0x80000000 | ((sizeof(struct drm_agp_buffer ) & 0x1fff) << 16) | ((('d')) << 8) | ((0x35) ))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_agp_buffer) & 0x1fff) << 16) | ((('d')) << 8) | ((0x35))), .func = drm_invalid_op, .flags = DRM_AUTH |DRM_MASTER|DRM_ROOT_ONLY, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_agp_buffer) & 0x1fff) << 16) | ((('d')) << 8) | ((0x35)))" }, |
662 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_AGP_BIND, drm_legacy_agp_bind_ioctl,[((((unsigned long)0x80000000 | ((sizeof(struct drm_agp_binding ) & 0x1fff) << 16) | ((('d')) << 8) | ((0x36) ))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_agp_binding) & 0x1fff) << 16) | ((('d') ) << 8) | ((0x36))), .func = drm_invalid_op, .flags = DRM_AUTH |DRM_MASTER|DRM_ROOT_ONLY, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_agp_binding) & 0x1fff) << 16) | ((('d')) << 8) | ((0x36)))" } |
663 | DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((((unsigned long)0x80000000 | ((sizeof(struct drm_agp_binding ) & 0x1fff) << 16) | ((('d')) << 8) | ((0x36) ))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_agp_binding) & 0x1fff) << 16) | ((('d') ) << 8) | ((0x36))), .func = drm_invalid_op, .flags = DRM_AUTH |DRM_MASTER|DRM_ROOT_ONLY, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_agp_binding) & 0x1fff) << 16) | ((('d')) << 8) | ((0x36)))" }, |
664 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_AGP_UNBIND, drm_legacy_agp_unbind_ioctl,[((((unsigned long)0x80000000 | ((sizeof(struct drm_agp_binding ) & 0x1fff) << 16) | ((('d')) << 8) | ((0x37) ))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_agp_binding) & 0x1fff) << 16) | ((('d') ) << 8) | ((0x37))), .func = drm_invalid_op, .flags = DRM_AUTH |DRM_MASTER|DRM_ROOT_ONLY, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_agp_binding) & 0x1fff) << 16) | ((('d')) << 8) | ((0x37)))" } |
665 | DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((((unsigned long)0x80000000 | ((sizeof(struct drm_agp_binding ) & 0x1fff) << 16) | ((('d')) << 8) | ((0x37) ))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_agp_binding) & 0x1fff) << 16) | ((('d') ) << 8) | ((0x37))), .func = drm_invalid_op, .flags = DRM_AUTH |DRM_MASTER|DRM_ROOT_ONLY, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_agp_binding) & 0x1fff) << 16) | ((('d')) << 8) | ((0x37)))" }, |
666 | #endif |
667 | |
668 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_SG_ALLOC, drm_legacy_sg_alloc, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_scatter_gather) & 0x1fff) << 16) | ((('d')) << 8) | ((0x38)))) & 0xff)] = { .cmd = ( ((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_scatter_gather) & 0x1fff) << 16) | ((('d' )) << 8) | ((0x38))), .func = drm_invalid_op, .flags = DRM_AUTH |DRM_MASTER|DRM_ROOT_ONLY, .name = "(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_scatter_gather) & 0x1fff) << 16) | ((('d')) << 8) | ((0x38)))" }, |
669 | DRM_LEGACY_IOCTL_DEF(DRM_IOCTL_SG_FREE, drm_legacy_sg_free, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((((unsigned long)0x80000000 | ((sizeof(struct drm_scatter_gather ) & 0x1fff) << 16) | ((('d')) << 8) | ((0x39) ))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_scatter_gather) & 0x1fff) << 16) | ((('d' )) << 8) | ((0x39))), .func = drm_invalid_op, .flags = DRM_AUTH |DRM_MASTER|DRM_ROOT_ONLY, .name = "((unsigned long)0x80000000 | ((sizeof(struct drm_scatter_gather) & 0x1fff) << 16) | ((('d')) << 8) | ((0x39)))" }, |
670 | |
671 | DRM_IOCTL_DEF(DRM_IOCTL_WAIT_VBLANK, drm_wait_vblank_ioctl, DRM_UNLOCKED)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(union drm_wait_vblank) & 0x1fff) << 16) | ( (('d')) << 8) | ((0x3a)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(union drm_wait_vblank ) & 0x1fff) << 16) | ((('d')) << 8) | ((0x3a) )), .func = drm_wait_vblank_ioctl, .flags = DRM_UNLOCKED, .name = "DRM_IOCTL_WAIT_VBLANK" }, |
672 | |
673 | DRM_IOCTL_DEF(DRM_IOCTL_MODESET_CTL, drm_legacy_modeset_ctl_ioctl, 0)[((((unsigned long)0x80000000 | ((sizeof(struct drm_modeset_ctl ) & 0x1fff) << 16) | ((('d')) << 8) | ((0x08) ))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_modeset_ctl) & 0x1fff) << 16) | ((('d') ) << 8) | ((0x08))), .func = drm_legacy_modeset_ctl_ioctl , .flags = 0, .name = "DRM_IOCTL_MODESET_CTL" }, |
674 | |
675 | DRM_IOCTL_DEF(DRM_IOCTL_UPDATE_DRAW, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)[((((unsigned long)0x80000000 | ((sizeof(struct drm_update_draw ) & 0x1fff) << 16) | ((('d')) << 8) | ((0x3f) ))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_update_draw) & 0x1fff) << 16) | ((('d') ) << 8) | ((0x3f))), .func = drm_noop, .flags = DRM_AUTH |DRM_MASTER|DRM_ROOT_ONLY, .name = "DRM_IOCTL_UPDATE_DRAW" }, |
676 | |
677 | DRM_IOCTL_DEF(DRM_IOCTL_GEM_CLOSE, drm_gem_close_ioctl, DRM_RENDER_ALLOW)[((((unsigned long)0x80000000 | ((sizeof(struct drm_gem_close ) & 0x1fff) << 16) | ((('d')) << 8) | ((0x09) ))) & 0xff)] = { .cmd = ((unsigned long)0x80000000 | ((sizeof (struct drm_gem_close) & 0x1fff) << 16) | ((('d')) << 8) | ((0x09))), .func = drm_gem_close_ioctl, .flags = DRM_RENDER_ALLOW , .name = "DRM_IOCTL_GEM_CLOSE" }, |
678 | DRM_IOCTL_DEF(DRM_IOCTL_GEM_FLINK, drm_gem_flink_ioctl, DRM_AUTH)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_gem_flink) & 0x1fff) << 16) | (( ('d')) << 8) | ((0x0a)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_gem_flink) & 0x1fff) << 16) | ((('d')) << 8) | ((0x0a))), .func = drm_gem_flink_ioctl, .flags = DRM_AUTH , .name = "DRM_IOCTL_GEM_FLINK" }, |
679 | DRM_IOCTL_DEF(DRM_IOCTL_GEM_OPEN, drm_gem_open_ioctl, DRM_AUTH)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_gem_open) & 0x1fff) << 16) | ((( 'd')) << 8) | ((0x0b)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_gem_open) & 0x1fff) << 16) | ((('d')) << 8) | ((0x0b))), .func = drm_gem_open_ioctl, .flags = DRM_AUTH , .name = "DRM_IOCTL_GEM_OPEN" }, |
680 | |
681 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETRESOURCES, drm_mode_getresources, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_card_res) & 0x1fff) << 16) | ((('d')) << 8) | ((0xA0)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_card_res) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xA0))), .func = drm_mode_getresources, .flags = 0, .name = "DRM_IOCTL_MODE_GETRESOURCES" }, |
682 | |
683 | DRM_IOCTL_DEF(DRM_IOCTL_PRIME_HANDLE_TO_FD, drm_prime_handle_to_fd_ioctl, DRM_RENDER_ALLOW)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_prime_handle) & 0x1fff) << 16) | ((('d')) << 8) | ((0x2d)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_prime_handle) & 0x1fff) << 16) | ((('d' )) << 8) | ((0x2d))), .func = drm_prime_handle_to_fd_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_PRIME_HANDLE_TO_FD" }, |
684 | DRM_IOCTL_DEF(DRM_IOCTL_PRIME_FD_TO_HANDLE, drm_prime_fd_to_handle_ioctl, DRM_RENDER_ALLOW)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_prime_handle) & 0x1fff) << 16) | ((('d')) << 8) | ((0x2e)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_prime_handle) & 0x1fff) << 16) | ((('d' )) << 8) | ((0x2e))), .func = drm_prime_fd_to_handle_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_PRIME_FD_TO_HANDLE" }, |
685 | |
686 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANERESOURCES, drm_mode_getplane_res, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_get_plane_res) & 0x1fff) << 16) | ((('d')) << 8) | ((0xB5)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_get_plane_res) & 0x1fff) << 16) | ((('d')) << 8) | ((0xB5))), .func = drm_mode_getplane_res , .flags = 0, .name = "DRM_IOCTL_MODE_GETPLANERESOURCES" }, |
687 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_crtc) & 0x1fff) << 16) | (( ('d')) << 8) | ((0xA1)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_mode_crtc) & 0x1fff) << 16) | ((('d')) << 8) | ((0xA1))), .func = drm_mode_getcrtc, .flags = 0, .name = "DRM_IOCTL_MODE_GETCRTC" }, |
688 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETCRTC, drm_mode_setcrtc, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_crtc) & 0x1fff) << 16) | (( ('d')) << 8) | ((0xA2)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_mode_crtc) & 0x1fff) << 16) | ((('d')) << 8) | ((0xA2))), .func = drm_mode_setcrtc, .flags = DRM_MASTER , .name = "DRM_IOCTL_MODE_SETCRTC" }, |
689 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANE, drm_mode_getplane, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_get_plane) & 0x1fff) << 16) | ((('d')) << 8) | ((0xB6)))) & 0xff)] = { .cmd = ( ((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_get_plane) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xB6))), .func = drm_mode_getplane, .flags = 0, .name = "DRM_IOCTL_MODE_GETPLANE" }, |
690 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPLANE, drm_mode_setplane, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_set_plane) & 0x1fff) << 16) | ((('d')) << 8) | ((0xB7)))) & 0xff)] = { .cmd = ( ((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_set_plane) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xB7))), .func = drm_mode_setplane, .flags = DRM_MASTER, .name = "DRM_IOCTL_MODE_SETPLANE" }, |
691 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_CURSOR, drm_mode_cursor_ioctl, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_cursor) & 0x1fff) << 16) | ( (('d')) << 8) | ((0xA3)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_mode_cursor) & 0x1fff) << 16) | ((('d')) << 8) | ((0xA3))), .func = drm_mode_cursor_ioctl, .flags = DRM_MASTER , .name = "DRM_IOCTL_MODE_CURSOR" }, |
692 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETGAMMA, drm_mode_gamma_get_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_crtc_lut) & 0x1fff) << 16) | ((('d')) << 8) | ((0xA4)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_crtc_lut) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xA4))), .func = drm_mode_gamma_get_ioctl, .flags = 0, .name = "DRM_IOCTL_MODE_GETGAMMA" }, |
693 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETGAMMA, drm_mode_gamma_set_ioctl, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_crtc_lut) & 0x1fff) << 16) | ((('d')) << 8) | ((0xA5)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_crtc_lut) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xA5))), .func = drm_mode_gamma_set_ioctl, .flags = DRM_MASTER, .name = "DRM_IOCTL_MODE_SETGAMMA" }, |
694 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETENCODER, drm_mode_getencoder, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_get_encoder) & 0x1fff) << 16 ) | ((('d')) << 8) | ((0xA6)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_get_encoder) & 0x1fff) << 16) | (( ('d')) << 8) | ((0xA6))), .func = drm_mode_getencoder, . flags = 0, .name = "DRM_IOCTL_MODE_GETENCODER" }, |
695 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCONNECTOR, drm_mode_getconnector, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_get_connector) & 0x1fff) << 16) | ((('d')) << 8) | ((0xA7)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_get_connector) & 0x1fff) << 16) | ((('d')) << 8) | ((0xA7))), .func = drm_mode_getconnector , .flags = 0, .name = "DRM_IOCTL_MODE_GETCONNECTOR" }, |
696 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_ATTACHMODE, drm_noop, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_mode_cmd) & 0x1fff) << 16) | ((('d')) << 8) | ((0xA8)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_mode_cmd) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xA8))), .func = drm_noop, .flags = DRM_MASTER , .name = "DRM_IOCTL_MODE_ATTACHMODE" }, |
697 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_DETACHMODE, drm_noop, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_mode_cmd) & 0x1fff) << 16) | ((('d')) << 8) | ((0xA9)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_mode_cmd) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xA9))), .func = drm_noop, .flags = DRM_MASTER , .name = "DRM_IOCTL_MODE_DETACHMODE" }, |
698 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPERTY, drm_mode_getproperty_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_get_property) & 0x1fff) << 16 ) | ((('d')) << 8) | ((0xAA)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_get_property) & 0x1fff) << 16) | ( (('d')) << 8) | ((0xAA))), .func = drm_mode_getproperty_ioctl , .flags = 0, .name = "DRM_IOCTL_MODE_GETPROPERTY" }, |
699 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPROPERTY, drm_connector_property_set_ioctl, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_connector_set_property) & 0x1fff) << 16) | ((('d')) << 8) | ((0xAB)))) & 0xff) ] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000 ) | ((sizeof(struct drm_mode_connector_set_property) & 0x1fff ) << 16) | ((('d')) << 8) | ((0xAB))), .func = drm_connector_property_set_ioctl , .flags = DRM_MASTER, .name = "DRM_IOCTL_MODE_SETPROPERTY" }, |
700 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPBLOB, drm_mode_getblob_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_get_blob) & 0x1fff) << 16) | ((('d')) << 8) | ((0xAC)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_get_blob) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xAC))), .func = drm_mode_getblob_ioctl, . flags = 0, .name = "DRM_IOCTL_MODE_GETPROPBLOB" }, |
701 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_fb_cmd) & 0x1fff) << 16) | ( (('d')) << 8) | ((0xAD)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_mode_fb_cmd) & 0x1fff) << 16) | ((('d')) << 8) | ((0xAD))), .func = drm_mode_getfb, .flags = 0, .name = "DRM_IOCTL_MODE_GETFB" }, |
702 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB2, drm_mode_getfb2_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_fb_cmd2) & 0x1fff) << 16) | ((('d')) << 8) | ((0xCE)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_fb_cmd2) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xCE))), .func = drm_mode_getfb2_ioctl, .flags = 0, .name = "DRM_IOCTL_MODE_GETFB2" }, |
703 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB, drm_mode_addfb_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_fb_cmd) & 0x1fff) << 16) | ( (('d')) << 8) | ((0xAE)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_mode_fb_cmd) & 0x1fff) << 16) | ((('d')) << 8) | ((0xAE))), .func = drm_mode_addfb_ioctl, .flags = 0, .name = "DRM_IOCTL_MODE_ADDFB" }, |
704 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB2, drm_mode_addfb2_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_fb_cmd2) & 0x1fff) << 16) | ((('d')) << 8) | ((0xB8)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_fb_cmd2) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xB8))), .func = drm_mode_addfb2_ioctl, .flags = 0, .name = "DRM_IOCTL_MODE_ADDFB2" }, |
705 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(unsigned int) & 0x1fff) << 16) | ((('d')) << 8) | ((0xAF)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000 |(unsigned long)0x40000000) | ((sizeof(unsigned int) & 0x1fff ) << 16) | ((('d')) << 8) | ((0xAF))), .func = drm_mode_rmfb_ioctl , .flags = 0, .name = "DRM_IOCTL_MODE_RMFB" }, |
706 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_PAGE_FLIP, drm_mode_page_flip_ioctl, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_crtc_page_flip) & 0x1fff) << 16) | ((('d')) << 8) | ((0xB0)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_crtc_page_flip) & 0x1fff) << 16) | ((('d')) << 8) | ((0xB0))), .func = drm_mode_page_flip_ioctl , .flags = DRM_MASTER, .name = "DRM_IOCTL_MODE_PAGE_FLIP" }, |
707 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_DIRTYFB, drm_mode_dirtyfb_ioctl, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_fb_dirty_cmd) & 0x1fff) << 16 ) | ((('d')) << 8) | ((0xB1)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_fb_dirty_cmd) & 0x1fff) << 16) | ( (('d')) << 8) | ((0xB1))), .func = drm_mode_dirtyfb_ioctl , .flags = DRM_MASTER, .name = "DRM_IOCTL_MODE_DIRTYFB" }, |
708 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_DUMB, drm_mode_create_dumb_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_create_dumb) & 0x1fff) << 16 ) | ((('d')) << 8) | ((0xB2)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_create_dumb) & 0x1fff) << 16) | (( ('d')) << 8) | ((0xB2))), .func = drm_mode_create_dumb_ioctl , .flags = 0, .name = "DRM_IOCTL_MODE_CREATE_DUMB" }, |
709 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_MAP_DUMB, drm_mode_mmap_dumb_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_map_dumb) & 0x1fff) << 16) | ((('d')) << 8) | ((0xB3)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_map_dumb) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xB3))), .func = drm_mode_mmap_dumb_ioctl, .flags = 0, .name = "DRM_IOCTL_MODE_MAP_DUMB" }, |
710 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_DESTROY_DUMB, drm_mode_destroy_dumb_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_destroy_dumb) & 0x1fff) << 16 ) | ((('d')) << 8) | ((0xB4)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_destroy_dumb) & 0x1fff) << 16) | ( (('d')) << 8) | ((0xB4))), .func = drm_mode_destroy_dumb_ioctl , .flags = 0, .name = "DRM_IOCTL_MODE_DESTROY_DUMB" }, |
711 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_OBJ_GETPROPERTIES, drm_mode_obj_get_properties_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_obj_get_properties) & 0x1fff) << 16) | ((('d')) << 8) | ((0xB9)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_obj_get_properties) & 0x1fff) << 16) | ((('d')) << 8) | ((0xB9))), .func = drm_mode_obj_get_properties_ioctl , .flags = 0, .name = "DRM_IOCTL_MODE_OBJ_GETPROPERTIES" }, |
712 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_OBJ_SETPROPERTY, drm_mode_obj_set_property_ioctl, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_obj_set_property) & 0x1fff) << 16) | ((('d')) << 8) | ((0xBA)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_obj_set_property) & 0x1fff) << 16) | ((('d')) << 8) | ((0xBA))), .func = drm_mode_obj_set_property_ioctl , .flags = DRM_MASTER, .name = "DRM_IOCTL_MODE_OBJ_SETPROPERTY" }, |
713 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_CURSOR2, drm_mode_cursor2_ioctl, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_cursor2) & 0x1fff) << 16) | ((('d')) << 8) | ((0xBB)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_cursor2) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xBB))), .func = drm_mode_cursor2_ioctl, . flags = DRM_MASTER, .name = "DRM_IOCTL_MODE_CURSOR2" }, |
714 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_ATOMIC, drm_mode_atomic_ioctl, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_atomic) & 0x1fff) << 16) | ( (('d')) << 8) | ((0xBC)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof(struct drm_mode_atomic) & 0x1fff) << 16) | ((('d')) << 8) | ((0xBC))), .func = drm_mode_atomic_ioctl, .flags = DRM_MASTER , .name = "DRM_IOCTL_MODE_ATOMIC" }, |
715 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATEPROPBLOB, drm_mode_createblob_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_create_blob) & 0x1fff) << 16 ) | ((('d')) << 8) | ((0xBD)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_create_blob) & 0x1fff) << 16) | (( ('d')) << 8) | ((0xBD))), .func = drm_mode_createblob_ioctl , .flags = 0, .name = "DRM_IOCTL_MODE_CREATEPROPBLOB" }, |
716 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_DESTROYPROPBLOB, drm_mode_destroyblob_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_destroy_blob) & 0x1fff) << 16 ) | ((('d')) << 8) | ((0xBE)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_destroy_blob) & 0x1fff) << 16) | ( (('d')) << 8) | ((0xBE))), .func = drm_mode_destroyblob_ioctl , .flags = 0, .name = "DRM_IOCTL_MODE_DESTROYPROPBLOB" }, |
717 | |
718 | DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_CREATE, drm_syncobj_create_ioctl,[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_create) & 0x1fff) << 16) | ((('d')) << 8) | ((0xBF)))) & 0xff)] = { .cmd = ( ((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_create) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xBF))), .func = drm_syncobj_create_ioctl, .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_CREATE" } |
719 | DRM_RENDER_ALLOW)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_create) & 0x1fff) << 16) | ((('d')) << 8) | ((0xBF)))) & 0xff)] = { .cmd = ( ((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_create) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xBF))), .func = drm_syncobj_create_ioctl, .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_CREATE" }, |
720 | DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_DESTROY, drm_syncobj_destroy_ioctl,[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_destroy) & 0x1fff) << 16 ) | ((('d')) << 8) | ((0xC0)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_destroy) & 0x1fff) << 16) | ((( 'd')) << 8) | ((0xC0))), .func = drm_syncobj_destroy_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_DESTROY" } |
721 | DRM_RENDER_ALLOW)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_destroy) & 0x1fff) << 16 ) | ((('d')) << 8) | ((0xC0)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_destroy) & 0x1fff) << 16) | ((( 'd')) << 8) | ((0xC0))), .func = drm_syncobj_destroy_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_DESTROY" }, |
722 | DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD, drm_syncobj_handle_to_fd_ioctl,[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_handle) & 0x1fff) << 16) | ((('d')) << 8) | ((0xC1)))) & 0xff)] = { .cmd = ( ((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_handle) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xC1))), .func = drm_syncobj_handle_to_fd_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD" } |
723 | DRM_RENDER_ALLOW)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_handle) & 0x1fff) << 16) | ((('d')) << 8) | ((0xC1)))) & 0xff)] = { .cmd = ( ((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_handle) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xC1))), .func = drm_syncobj_handle_to_fd_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD" }, |
724 | DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, drm_syncobj_fd_to_handle_ioctl,[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_handle) & 0x1fff) << 16) | ((('d')) << 8) | ((0xC2)))) & 0xff)] = { .cmd = ( ((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_handle) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xC2))), .func = drm_syncobj_fd_to_handle_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE" } |
725 | DRM_RENDER_ALLOW)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_handle) & 0x1fff) << 16) | ((('d')) << 8) | ((0xC2)))) & 0xff)] = { .cmd = ( ((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_handle) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xC2))), .func = drm_syncobj_fd_to_handle_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE" }, |
726 | DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TRANSFER, drm_syncobj_transfer_ioctl,[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_transfer) & 0x1fff) << 16 ) | ((('d')) << 8) | ((0xCC)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_transfer) & 0x1fff) << 16) | (( ('d')) << 8) | ((0xCC))), .func = drm_syncobj_transfer_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_TRANSFER" } |
727 | DRM_RENDER_ALLOW)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_transfer) & 0x1fff) << 16 ) | ((('d')) << 8) | ((0xCC)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_transfer) & 0x1fff) << 16) | (( ('d')) << 8) | ((0xCC))), .func = drm_syncobj_transfer_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_TRANSFER" }, |
728 | DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_WAIT, drm_syncobj_wait_ioctl,[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_wait) & 0x1fff) << 16) | ((('d')) << 8) | ((0xC3)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_wait) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xC3))), .func = drm_syncobj_wait_ioctl, . flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_WAIT" } |
729 | DRM_RENDER_ALLOW)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_wait) & 0x1fff) << 16) | ((('d')) << 8) | ((0xC3)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_wait) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xC3))), .func = drm_syncobj_wait_ioctl, . flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_WAIT" }, |
730 | DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT, drm_syncobj_timeline_wait_ioctl,[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_timeline_wait) & 0x1fff) << 16) | ((('d')) << 8) | ((0xCA)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_timeline_wait) & 0x1fff) << 16) | ((('d')) << 8) | ((0xCA))), .func = drm_syncobj_timeline_wait_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT" } |
731 | DRM_RENDER_ALLOW)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_timeline_wait) & 0x1fff) << 16) | ((('d')) << 8) | ((0xCA)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_timeline_wait) & 0x1fff) << 16) | ((('d')) << 8) | ((0xCA))), .func = drm_syncobj_timeline_wait_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT" }, |
732 | DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_RESET, drm_syncobj_reset_ioctl,[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_array) & 0x1fff) << 16) | ((('d')) << 8) | ((0xC4)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_array) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xC4))), .func = drm_syncobj_reset_ioctl, . flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_RESET" } |
733 | DRM_RENDER_ALLOW)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_array) & 0x1fff) << 16) | ((('d')) << 8) | ((0xC4)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_array) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xC4))), .func = drm_syncobj_reset_ioctl, . flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_RESET" }, |
734 | DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_SIGNAL, drm_syncobj_signal_ioctl,[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_array) & 0x1fff) << 16) | ((('d')) << 8) | ((0xC5)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_array) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xC5))), .func = drm_syncobj_signal_ioctl, .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_SIGNAL" } |
735 | DRM_RENDER_ALLOW)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_array) & 0x1fff) << 16) | ((('d')) << 8) | ((0xC5)))) & 0xff)] = { .cmd = (( (unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_syncobj_array) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xC5))), .func = drm_syncobj_signal_ioctl, .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_SIGNAL" }, |
736 | DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL, drm_syncobj_timeline_signal_ioctl,[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_timeline_array) & 0x1fff) << 16) | ((('d')) << 8) | ((0xCD)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_timeline_array) & 0x1fff) << 16) | ((('d')) << 8) | ((0xCD))), .func = drm_syncobj_timeline_signal_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL" } |
737 | DRM_RENDER_ALLOW)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_timeline_array) & 0x1fff) << 16) | ((('d')) << 8) | ((0xCD)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_timeline_array) & 0x1fff) << 16) | ((('d')) << 8) | ((0xCD))), .func = drm_syncobj_timeline_signal_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL" }, |
738 | DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_QUERY, drm_syncobj_query_ioctl,[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_timeline_array) & 0x1fff) << 16) | ((('d')) << 8) | ((0xCB)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_timeline_array) & 0x1fff) << 16) | ((('d')) << 8) | ((0xCB))), .func = drm_syncobj_query_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_QUERY" } |
739 | DRM_RENDER_ALLOW)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_timeline_array) & 0x1fff) << 16) | ((('d')) << 8) | ((0xCB)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_syncobj_timeline_array) & 0x1fff) << 16) | ((('d')) << 8) | ((0xCB))), .func = drm_syncobj_query_ioctl , .flags = DRM_RENDER_ALLOW, .name = "DRM_IOCTL_SYNCOBJ_QUERY" }, |
740 | DRM_IOCTL_DEF(DRM_IOCTL_CRTC_GET_SEQUENCE, drm_crtc_get_sequence_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_crtc_get_sequence) & 0x1fff) << 16 ) | ((('d')) << 8) | ((0x3b)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_crtc_get_sequence) & 0x1fff) << 16) | ( (('d')) << 8) | ((0x3b))), .func = drm_crtc_get_sequence_ioctl , .flags = 0, .name = "DRM_IOCTL_CRTC_GET_SEQUENCE" }, |
741 | DRM_IOCTL_DEF(DRM_IOCTL_CRTC_QUEUE_SEQUENCE, drm_crtc_queue_sequence_ioctl, 0)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_crtc_queue_sequence) & 0x1fff) << 16) | ((('d')) << 8) | ((0x3c)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_crtc_queue_sequence) & 0x1fff) << 16) | ((('d')) << 8) | ((0x3c))), .func = drm_crtc_queue_sequence_ioctl , .flags = 0, .name = "DRM_IOCTL_CRTC_QUEUE_SEQUENCE" }, |
742 | #ifdef __linux__ |
743 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_LEASE, drm_mode_create_lease_ioctl, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_create_lease) & 0x1fff) << 16 ) | ((('d')) << 8) | ((0xC6)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_create_lease) & 0x1fff) << 16) | ( (('d')) << 8) | ((0xC6))), .func = drm_mode_create_lease_ioctl , .flags = DRM_MASTER, .name = "DRM_IOCTL_MODE_CREATE_LEASE" }, |
744 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_LIST_LESSEES, drm_mode_list_lessees_ioctl, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_list_lessees) & 0x1fff) << 16 ) | ((('d')) << 8) | ((0xC7)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_list_lessees) & 0x1fff) << 16) | ( (('d')) << 8) | ((0xC7))), .func = drm_mode_list_lessees_ioctl , .flags = DRM_MASTER, .name = "DRM_IOCTL_MODE_LIST_LESSEES" }, |
745 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GET_LEASE, drm_mode_get_lease_ioctl, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_get_lease) & 0x1fff) << 16) | ((('d')) << 8) | ((0xC8)))) & 0xff)] = { .cmd = ( ((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_get_lease) & 0x1fff) << 16) | ((('d' )) << 8) | ((0xC8))), .func = drm_mode_get_lease_ioctl, .flags = DRM_MASTER, .name = "DRM_IOCTL_MODE_GET_LEASE" }, |
746 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_REVOKE_LEASE, drm_mode_revoke_lease_ioctl, DRM_MASTER)[(((((unsigned long)0x80000000|(unsigned long)0x40000000) | ( (sizeof(struct drm_mode_revoke_lease) & 0x1fff) << 16 ) | ((('d')) << 8) | ((0xC9)))) & 0xff)] = { .cmd = (((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_mode_revoke_lease) & 0x1fff) << 16) | ( (('d')) << 8) | ((0xC9))), .func = drm_mode_revoke_lease_ioctl , .flags = DRM_MASTER, .name = "DRM_IOCTL_MODE_REVOKE_LEASE" }, |
747 | #endif |
748 | }; |
749 | |
750 | #define DRM_CORE_IOCTL_COUNT(sizeof((drm_ioctls)) / sizeof((drm_ioctls)[0])) ARRAY_SIZE(drm_ioctls)(sizeof((drm_ioctls)) / sizeof((drm_ioctls)[0])) |
751 | |
752 | int |
753 | pledge_ioctl_drm(struct proc *p, long com, dev_t device) |
754 | { |
755 | struct drm_device *dev = drm_get_device_from_kdev(device); |
756 | unsigned int nr = DRM_IOCTL_NR(com)((com) & 0xff); |
757 | const struct drm_ioctl_desc *ioctl; |
758 | |
759 | if (dev == NULL((void *)0)) |
760 | return EPERM1; |
761 | |
762 | if (nr < DRM_CORE_IOCTL_COUNT(sizeof((drm_ioctls)) / sizeof((drm_ioctls)[0])) && |
763 | ((nr < DRM_COMMAND_BASE0x40 || nr >= DRM_COMMAND_END0xA0))) |
764 | ioctl = &drm_ioctls[nr]; |
765 | else if (nr >= DRM_COMMAND_BASE0x40 && nr < DRM_COMMAND_END0xA0 && |
766 | nr < DRM_COMMAND_BASE0x40 + dev->driver->num_ioctls) |
767 | ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE0x40]; |
768 | else |
769 | return EPERM1; |
770 | |
771 | if (ioctl->flags & DRM_RENDER_ALLOW) |
772 | return 0; |
773 | |
774 | /* |
775 | * These are dangerous, but we have to allow them until we |
776 | * have prime/dma-buf support. |
777 | */ |
778 | switch (com) { |
779 | case DRM_IOCTL_GET_MAGIC((unsigned long)0x40000000 | ((sizeof(struct drm_auth) & 0x1fff ) << 16) | ((('d')) << 8) | ((0x02))): |
780 | case DRM_IOCTL_GEM_OPEN(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_gem_open) & 0x1fff) << 16) | ((('d')) << 8) | ((0x0b))): |
781 | return 0; |
782 | } |
783 | |
784 | /* for amdgpu libdrm */ |
785 | if (com == DRM_IOCTL_GET_CLIENT(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct drm_client) & 0x1fff) << 16) | ((('d')) << 8) | ((0x05)))) |
786 | return 0; |
787 | |
788 | return EPERM1; |
789 | } |
790 | |
791 | /** |
792 | * DOC: driver specific ioctls |
793 | * |
794 | * First things first, driver private IOCTLs should only be needed for drivers |
795 | * supporting rendering. Kernel modesetting is all standardized, and extended |
796 | * through properties. There are a few exceptions in some existing drivers, |
797 | * which define IOCTL for use by the display DRM master, but they all predate |
798 | * properties. |
799 | * |
800 | * Now if you do have a render driver you always have to support it through |
801 | * driver private properties. There's a few steps needed to wire all the things |
802 | * up. |
803 | * |
804 | * First you need to define the structure for your IOCTL in your driver private |
805 | * UAPI header in ``include/uapi/drm/my_driver_drm.h``:: |
806 | * |
807 | * struct my_driver_operation { |
808 | * u32 some_thing; |
809 | * u32 another_thing; |
810 | * }; |
811 | * |
812 | * Please make sure that you follow all the best practices from |
813 | * ``Documentation/process/botching-up-ioctls.rst``. Note that drm_ioctl() |
814 | * automatically zero-extends structures, hence make sure you can add more stuff |
815 | * at the end, i.e. don't put a variable sized array there. |
816 | * |
817 | * Then you need to define your IOCTL number, using one of DRM_IO(), DRM_IOR(), |
818 | * DRM_IOW() or DRM_IOWR(). It must start with the DRM_IOCTL\_ prefix:: |
819 | * |
820 | * ##define DRM_IOCTL_MY_DRIVER_OPERATION \ |
821 | * DRM_IOW(DRM_COMMAND_BASE, struct my_driver_operation) |
822 | * |
823 | * DRM driver private IOCTL must be in the range from DRM_COMMAND_BASE to |
824 | * DRM_COMMAND_END. Finally you need an array of &struct drm_ioctl_desc to wire |
825 | * up the handlers and set the access rights:: |
826 | * |
827 | * static const struct drm_ioctl_desc my_driver_ioctls[] = { |
828 | * DRM_IOCTL_DEF_DRV(MY_DRIVER_OPERATION, my_driver_operation, |
829 | * DRM_AUTH|DRM_RENDER_ALLOW), |
830 | * }; |
831 | * |
832 | * And then assign this to the &drm_driver.ioctls field in your driver |
833 | * structure. |
834 | * |
835 | * See the separate chapter on :ref:`file operations<drm_driver_fops>` for how |
836 | * the driver-specific IOCTLs are wired up. |
837 | */ |
838 | |
839 | long drm_ioctl_kernel(struct file *file, drm_ioctl_t *func, void *kdata, |
840 | u32 flags) |
841 | { |
842 | STUB()do { printf("%s: stub\n", __func__); } while(0); |
843 | return -ENOSYS78; |
844 | #ifdef notyet |
845 | struct drm_file *file_priv = file->private_data; |
846 | struct drm_device *dev = file_priv->minor->dev; |
847 | int retcode; |
848 | |
849 | if (drm_dev_is_unplugged(dev)) |
850 | return -ENODEV19; |
851 | |
852 | retcode = drm_ioctl_permit(flags, file_priv); |
853 | if (unlikely(retcode)__builtin_expect(!!(retcode), 0)) |
854 | return retcode; |
855 | |
856 | /* Enforce sane locking for modern driver ioctls. */ |
857 | if (likely(!drm_core_check_feature(dev, DRIVER_LEGACY))__builtin_expect(!!(!drm_core_check_feature(dev, DRIVER_LEGACY )), 1) || |
858 | (flags & DRM_UNLOCKED)) |
859 | retcode = func(dev, kdata, file_priv); |
860 | else { |
861 | mutex_lock(&drm_global_mutex)rw_enter_write(&drm_global_mutex); |
862 | retcode = func(dev, kdata, file_priv); |
863 | mutex_unlock(&drm_global_mutex)rw_exit_write(&drm_global_mutex); |
864 | } |
865 | return retcode; |
866 | #endif |
867 | } |
868 | EXPORT_SYMBOL(drm_ioctl_kernel); |
869 | |
870 | /** |
871 | * drm_ioctl - ioctl callback implementation for DRM drivers |
872 | * @filp: file this ioctl is called on |
873 | * @cmd: ioctl cmd number |
874 | * @arg: user argument |
875 | * |
876 | * Looks up the ioctl function in the DRM core and the driver dispatch table, |
877 | * stored in &drm_driver.ioctls. It checks for necessary permission by calling |
878 | * drm_ioctl_permit(), and dispatches to the respective function. |
879 | * |
880 | * Returns: |
881 | * Zero on success, negative error code on failure. |
882 | */ |
883 | long drm_ioctl(struct file *filp, |
884 | unsigned int cmd, unsigned long arg) |
885 | { |
886 | STUB()do { printf("%s: stub\n", __func__); } while(0); |
887 | return -ENOSYS78; |
888 | #ifdef notyet |
889 | struct drm_file *file_priv = filp->private_data; |
890 | struct drm_device *dev; |
891 | const struct drm_ioctl_desc *ioctl = NULL((void *)0); |
892 | drm_ioctl_t *func; |
893 | unsigned int nr = DRM_IOCTL_NR(cmd)((cmd) & 0xff); |
894 | int retcode = -EINVAL22; |
895 | char stack_kdata[128]; |
896 | char *kdata = NULL((void *)0); |
897 | unsigned int in_size, out_size, drv_size, ksize; |
898 | bool_Bool is_driver_ioctl; |
899 | |
900 | dev = file_priv->minor->dev; |
901 | |
902 | if (drm_dev_is_unplugged(dev)) |
903 | return -ENODEV19; |
904 | |
905 | if (DRM_IOCTL_TYPE(cmd)(((cmd) >> 8) & 0xff) != DRM_IOCTL_BASE'd') |
906 | return -ENOTTY25; |
907 | |
908 | is_driver_ioctl = nr >= DRM_COMMAND_BASE0x40 && nr < DRM_COMMAND_END0xA0; |
909 | |
910 | if (is_driver_ioctl) { |
911 | /* driver ioctl */ |
912 | unsigned int index = nr - DRM_COMMAND_BASE0x40; |
913 | |
914 | if (index >= dev->driver->num_ioctls) |
915 | goto err_i1; |
916 | index = array_index_nospec(index, dev->driver->num_ioctls)(index); |
917 | ioctl = &dev->driver->ioctls[index]; |
918 | } else { |
919 | /* core ioctl */ |
920 | if (nr >= DRM_CORE_IOCTL_COUNT(sizeof((drm_ioctls)) / sizeof((drm_ioctls)[0]))) |
921 | goto err_i1; |
922 | nr = array_index_nospec(nr, DRM_CORE_IOCTL_COUNT)(nr); |
923 | ioctl = &drm_ioctls[nr]; |
924 | } |
925 | |
926 | drv_size = _IOC_SIZE(ioctl->cmd); |
927 | out_size = in_size = _IOC_SIZE(cmd); |
928 | if ((cmd & ioctl->cmd & IOC_IN(unsigned long)0x80000000) == 0) |
929 | in_size = 0; |
930 | if ((cmd & ioctl->cmd & IOC_OUT(unsigned long)0x40000000) == 0) |
931 | out_size = 0; |
932 | ksize = max(max(in_size, out_size), drv_size)((((((in_size)>(out_size))?(in_size):(out_size)))>(drv_size ))?((((in_size)>(out_size))?(in_size):(out_size))):(drv_size )); |
933 | |
934 | DRM_DEBUG("comm=\"%s\" pid=%d, dev=0x%lx, auth=%d, %s\n",___drm_dbg(((void *)0), DRM_UT_CORE, "comm=\"%s\" pid=%d, dev=0x%lx, auth=%d, %s\n" , current->comm, task_pid_nr(current), (long)old_encode_dev (file_priv->minor->kdev->devt), file_priv->authenticated , ioctl->name) |
935 | current->comm, task_pid_nr(current),___drm_dbg(((void *)0), DRM_UT_CORE, "comm=\"%s\" pid=%d, dev=0x%lx, auth=%d, %s\n" , current->comm, task_pid_nr(current), (long)old_encode_dev (file_priv->minor->kdev->devt), file_priv->authenticated , ioctl->name) |
936 | (long)old_encode_dev(file_priv->minor->kdev->devt),___drm_dbg(((void *)0), DRM_UT_CORE, "comm=\"%s\" pid=%d, dev=0x%lx, auth=%d, %s\n" , current->comm, task_pid_nr(current), (long)old_encode_dev (file_priv->minor->kdev->devt), file_priv->authenticated , ioctl->name) |
937 | file_priv->authenticated, ioctl->name)___drm_dbg(((void *)0), DRM_UT_CORE, "comm=\"%s\" pid=%d, dev=0x%lx, auth=%d, %s\n" , current->comm, task_pid_nr(current), (long)old_encode_dev (file_priv->minor->kdev->devt), file_priv->authenticated , ioctl->name); |
938 | |
939 | /* Do not trust userspace, use our own definition */ |
940 | func = ioctl->func; |
941 | |
942 | if (unlikely(!func)__builtin_expect(!!(!func), 0)) { |
943 | DRM_DEBUG("no function\n")___drm_dbg(((void *)0), DRM_UT_CORE, "no function\n"); |
944 | retcode = -EINVAL22; |
945 | goto err_i1; |
946 | } |
947 | |
948 | if (ksize <= sizeof(stack_kdata)) { |
949 | kdata = stack_kdata; |
950 | } else { |
951 | kdata = kmalloc(ksize, GFP_KERNEL(0x0001 | 0x0004)); |
952 | if (!kdata) { |
953 | retcode = -ENOMEM12; |
954 | goto err_i1; |
955 | } |
956 | } |
957 | |
958 | if (copy_from_user(kdata, (void __user *)arg, in_size) != 0) { |
959 | retcode = -EFAULT14; |
960 | goto err_i1; |
961 | } |
962 | |
963 | if (ksize > in_size) |
964 | memset(kdata + in_size, 0, ksize - in_size)__builtin_memset((kdata + in_size), (0), (ksize - in_size)); |
965 | |
966 | retcode = drm_ioctl_kernel(filp, func, kdata, ioctl->flags); |
967 | if (copy_to_user((void __user *)arg, kdata, out_size) != 0) |
968 | retcode = -EFAULT14; |
969 | |
970 | err_i1: |
971 | if (!ioctl) |
972 | DRM_DEBUG("invalid ioctl: comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n",___drm_dbg(((void *)0), DRM_UT_CORE, "invalid ioctl: comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n" , current->comm, task_pid_nr(current), (long)old_encode_dev (file_priv->minor->kdev->devt), file_priv->authenticated , cmd, nr) |
973 | current->comm, task_pid_nr(current),___drm_dbg(((void *)0), DRM_UT_CORE, "invalid ioctl: comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n" , current->comm, task_pid_nr(current), (long)old_encode_dev (file_priv->minor->kdev->devt), file_priv->authenticated , cmd, nr) |
974 | (long)old_encode_dev(file_priv->minor->kdev->devt),___drm_dbg(((void *)0), DRM_UT_CORE, "invalid ioctl: comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n" , current->comm, task_pid_nr(current), (long)old_encode_dev (file_priv->minor->kdev->devt), file_priv->authenticated , cmd, nr) |
975 | file_priv->authenticated, cmd, nr)___drm_dbg(((void *)0), DRM_UT_CORE, "invalid ioctl: comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n" , current->comm, task_pid_nr(current), (long)old_encode_dev (file_priv->minor->kdev->devt), file_priv->authenticated , cmd, nr); |
976 | |
977 | if (kdata != stack_kdata) |
978 | kfree(kdata); |
979 | if (retcode) |
980 | DRM_DEBUG("comm=\"%s\", pid=%d, ret=%d\n", current->comm,___drm_dbg(((void *)0), DRM_UT_CORE, "comm=\"%s\", pid=%d, ret=%d\n" , current->comm, task_pid_nr(current), retcode) |
981 | task_pid_nr(current), retcode)___drm_dbg(((void *)0), DRM_UT_CORE, "comm=\"%s\", pid=%d, ret=%d\n" , current->comm, task_pid_nr(current), retcode); |
982 | return retcode; |
983 | #endif |
984 | } |
985 | EXPORT_SYMBOL(drm_ioctl); |
986 | |
987 | /** |
988 | * drm_ioctl_flags - Check for core ioctl and return ioctl permission flags |
989 | * @nr: ioctl number |
990 | * @flags: where to return the ioctl permission flags |
991 | * |
992 | * This ioctl is only used by the vmwgfx driver to augment the access checks |
993 | * done by the drm core and insofar a pretty decent layering violation. This |
994 | * shouldn't be used by any drivers. |
995 | * |
996 | * Returns: |
997 | * True if the @nr corresponds to a DRM core ioctl number, false otherwise. |
998 | */ |
999 | bool_Bool drm_ioctl_flags(unsigned int nr, unsigned int *flags) |
1000 | { |
1001 | if (nr >= DRM_COMMAND_BASE0x40 && nr < DRM_COMMAND_END0xA0) |
1002 | return false0; |
1003 | |
1004 | if (nr >= DRM_CORE_IOCTL_COUNT(sizeof((drm_ioctls)) / sizeof((drm_ioctls)[0]))) |
1005 | return false0; |
1006 | nr = array_index_nospec(nr, DRM_CORE_IOCTL_COUNT)(nr); |
1007 | |
1008 | *flags = drm_ioctls[nr].flags; |
1009 | return true1; |
1010 | } |
1011 | EXPORT_SYMBOL(drm_ioctl_flags); |
1012 | |
1013 | int |
1014 | drm_do_ioctl(struct drm_device *dev, int minor, u_long cmd, caddr_t data) |
1015 | { |
1016 | struct drm_file *file_priv; |
1017 | const struct drm_ioctl_desc *ioctl; |
1018 | drm_ioctl_t *func; |
1019 | unsigned int nr = DRM_IOCTL_NR(cmd)((cmd) & 0xff); |
1020 | int retcode = -EINVAL22; |
1021 | unsigned int usize, asize; |
1022 | caddr_t adata = data; |
1023 | |
1024 | mutex_lock(&dev->filelist_mutex)rw_enter_write(&dev->filelist_mutex); |
1025 | file_priv = drm_find_file_by_minor(dev, minor); |
1026 | mutex_unlock(&dev->filelist_mutex)rw_exit_write(&dev->filelist_mutex); |
1027 | if (file_priv == NULL((void *)0)) { |
1028 | DRM_ERROR("can't find authenticator\n")__drm_err("can't find authenticator\n"); |
1029 | return -EINVAL22; |
1030 | } |
1031 | |
1032 | DRM_DEBUG("pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n",___drm_dbg(((void *)0), DRM_UT_CORE, "pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n" , ({struct cpu_info *__ci; asm volatile("movq %%gs:%P1,%0" : "=r" (__ci) :"n" (__builtin_offsetof(struct cpu_info, ci_self))); __ci;})->ci_curproc->p_p->ps_pid, cmd, (u_int)((cmd ) & 0xff), (long)&dev->dev, file_priv->authenticated ) |
1033 | curproc->p_p->ps_pid, cmd, (u_int)DRM_IOCTL_NR(cmd), (long)&dev->dev,___drm_dbg(((void *)0), DRM_UT_CORE, "pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n" , ({struct cpu_info *__ci; asm volatile("movq %%gs:%P1,%0" : "=r" (__ci) :"n" (__builtin_offsetof(struct cpu_info, ci_self))); __ci;})->ci_curproc->p_p->ps_pid, cmd, (u_int)((cmd ) & 0xff), (long)&dev->dev, file_priv->authenticated ) |
1034 | file_priv->authenticated)___drm_dbg(((void *)0), DRM_UT_CORE, "pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n" , ({struct cpu_info *__ci; asm volatile("movq %%gs:%P1,%0" : "=r" (__ci) :"n" (__builtin_offsetof(struct cpu_info, ci_self))); __ci;})->ci_curproc->p_p->ps_pid, cmd, (u_int)((cmd ) & 0xff), (long)&dev->dev, file_priv->authenticated ); |
1035 | |
1036 | switch (cmd) { |
1037 | case FIONBIO((unsigned long)0x80000000 | ((sizeof(int) & 0x1fff) << 16) | ((('f')) << 8) | ((126))): |
1038 | case FIOASYNC((unsigned long)0x80000000 | ((sizeof(int) & 0x1fff) << 16) | ((('f')) << 8) | ((125))): |
1039 | return 0; |
1040 | } |
1041 | |
1042 | if ((nr >= DRM_CORE_IOCTL_COUNT(sizeof((drm_ioctls)) / sizeof((drm_ioctls)[0]))) && |
1043 | ((nr < DRM_COMMAND_BASE0x40) || (nr >= DRM_COMMAND_END0xA0))) |
1044 | return (-EINVAL22); |
1045 | if ((nr >= DRM_COMMAND_BASE0x40) && (nr < DRM_COMMAND_END0xA0) && |
1046 | (nr < DRM_COMMAND_BASE0x40 + dev->driver->num_ioctls)) { |
1047 | uint32_t drv_size; |
1048 | ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE0x40]; |
1049 | drv_size = IOCPARM_LEN(ioctl->cmd)(((ioctl->cmd) >> 16) & 0x1fff); |
1050 | usize = asize = IOCPARM_LEN(cmd)(((cmd) >> 16) & 0x1fff); |
1051 | if (drv_size > asize) |
1052 | asize = drv_size; |
1053 | } else if ((nr >= DRM_COMMAND_END0xA0) || (nr < DRM_COMMAND_BASE0x40)) { |
1054 | uint32_t drv_size; |
1055 | ioctl = &drm_ioctls[nr]; |
1056 | |
1057 | drv_size = IOCPARM_LEN(ioctl->cmd)(((ioctl->cmd) >> 16) & 0x1fff); |
1058 | usize = asize = IOCPARM_LEN(cmd)(((cmd) >> 16) & 0x1fff); |
1059 | if (drv_size > asize) |
1060 | asize = drv_size; |
1061 | cmd = ioctl->cmd; |
Value stored to 'cmd' is never read | |
1062 | } else |
1063 | return (-EINVAL22); |
1064 | |
1065 | func = ioctl->func; |
1066 | if (!func) { |
1067 | DRM_DEBUG("no function\n")___drm_dbg(((void *)0), DRM_UT_CORE, "no function\n"); |
1068 | return (-EINVAL22); |
1069 | } |
1070 | |
1071 | retcode = drm_ioctl_permit(ioctl->flags, file_priv); |
1072 | if (unlikely(retcode)__builtin_expect(!!(retcode), 0)) |
1073 | return retcode; |
1074 | |
1075 | if (asize > usize) { |
1076 | adata = malloc(asize, M_DRM145, M_WAITOK0x0001 | M_ZERO0x0008); |
1077 | memcpy(adata, data, usize)__builtin_memcpy((adata), (data), (usize)); |
1078 | } |
1079 | |
1080 | /* Enforce sane locking for modern driver ioctls. */ |
1081 | if (likely(!drm_core_check_feature(dev, DRIVER_LEGACY))__builtin_expect(!!(!drm_core_check_feature(dev, DRIVER_LEGACY )), 1) || |
1082 | (ioctl->flags & DRM_UNLOCKED)) |
1083 | retcode = func(dev, adata, file_priv); |
1084 | else { |
1085 | mutex_lock(&drm_global_mutex)rw_enter_write(&drm_global_mutex); |
1086 | retcode = func(dev, adata, file_priv); |
1087 | mutex_unlock(&drm_global_mutex)rw_exit_write(&drm_global_mutex); |
1088 | } |
1089 | |
1090 | if (asize > usize) { |
1091 | memcpy(data, adata, usize)__builtin_memcpy((data), (adata), (usize)); |
1092 | free(adata, M_DRM145, asize); |
1093 | } |
1094 | |
1095 | return (retcode); |
1096 | } |
1097 | |
1098 | /* drmioctl is called whenever a process performs an ioctl on /dev/drm. |
1099 | */ |
1100 | int |
1101 | drmioctl(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) |
1102 | { |
1103 | struct drm_device *dev = drm_get_device_from_kdev(kdev); |
1104 | int error; |
1105 | |
1106 | if (dev == NULL((void *)0)) |
1107 | return ENODEV19; |
1108 | |
1109 | mtx_enter(&dev->quiesce_mtx); |
1110 | while (dev->quiesce) |
1111 | msleep_nsec(&dev->quiesce, &dev->quiesce_mtx, PZERO22, "drmioc", |
1112 | INFSLP0xffffffffffffffffULL); |
1113 | dev->quiesce_count++; |
1114 | mtx_leave(&dev->quiesce_mtx); |
1115 | |
1116 | error = -drm_do_ioctl(dev, minor(kdev)((unsigned)((kdev) & 0xff) | (((kdev) & 0xffff0000) >> 8)), cmd, data); |
1117 | if (error < 0 && error != ERESTART-1 && error != EJUSTRETURN-2) |
1118 | printf("%s: cmd 0x%lx errno %d\n", __func__, cmd, error); |
1119 | |
1120 | mtx_enter(&dev->quiesce_mtx); |
1121 | dev->quiesce_count--; |
1122 | if (dev->quiesce) |
1123 | wakeup(&dev->quiesce_count); |
1124 | mtx_leave(&dev->quiesce_mtx); |
1125 | |
1126 | return (error); |
1127 | } |