blob: 9a43d98e500341fc22f9aa886da64d28476f4f14 [file] [log] [blame]
Thomas Hellstromce65a442006-08-07 22:03:22 +10001/**************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 *
Thomas Hellstromce65a442006-08-07 22:03:22 +10003 * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA.
4 * All Rights Reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
Thomas Hellstromce65a442006-08-07 22:03:22 +10007 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
Dave Airlieb5e89ed2005-09-25 14:28:13 +100013 *
Thomas Hellstromce65a442006-08-07 22:03:22 +100014 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
Dave Airlieb5e89ed2005-09-25 14:28:13 +100017 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Thomas Hellstromce65a442006-08-07 22:03:22 +100020 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
Dave Airlieb5e89ed2005-09-25 14:28:13 +100025 *
Thomas Hellstromce65a442006-08-07 22:03:22 +100026 *
27 **************************************************************************/
28
29/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 * Authors:
Jan Engelhardt96de0e22007-10-19 23:21:04 +020031 * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032 */
33
David Howells760285e2012-10-02 18:01:07 +010034#include <drm/drmP.h>
35#include <drm/sis_drm.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070036#include "sis_drv.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
Thomas Hellstromce65a442006-08-07 22:03:22 +100038#include <video/sisfb.h>
39
Dave Airlieb5e89ed2005-09-25 14:28:13 +100040#define VIDEO_TYPE 0
Linus Torvalds1da177e2005-04-16 15:20:36 -070041#define AGP_TYPE 1
42
Linus Torvalds1da177e2005-04-16 15:20:36 -070043
Daniel Vetterbe2fb9d2011-10-26 22:22:59 +020044struct sis_memblock {
45 struct drm_mm_node mm_node;
46 struct sis_memreq req;
47 struct list_head owner_list;
48};
49
David Howells6bb9e4b2008-07-30 12:29:37 -070050#if defined(CONFIG_FB_SIS) || defined(CONFIG_FB_SIS_MODULE)
Dave Airlieb5e89ed2005-09-25 14:28:13 +100051/* fb management via fb device */
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
Thomas Hellstromce65a442006-08-07 22:03:22 +100053#define SIS_MM_ALIGN_SHIFT 0
54#define SIS_MM_ALIGN_MASK 0
Linus Torvalds1da177e2005-04-16 15:20:36 -070055
David Howells6bb9e4b2008-07-30 12:29:37 -070056#else /* CONFIG_FB_SIS[_MODULE] */
Adrian Bunkfb41e542006-08-16 11:55:18 +100057
58#define SIS_MM_ALIGN_SHIFT 4
Nicolas Kaisera7b98b62010-07-09 16:47:28 +020059#define SIS_MM_ALIGN_MASK ((1 << SIS_MM_ALIGN_SHIFT) - 1)
Adrian Bunkfb41e542006-08-16 11:55:18 +100060
David Howells6bb9e4b2008-07-30 12:29:37 -070061#endif /* CONFIG_FB_SIS[_MODULE] */
Thomas Hellstromce65a442006-08-07 22:03:22 +100062
Eric Anholtc153f452007-09-03 12:06:45 +100063static int sis_fb_init(struct drm_device *dev, void *data, struct drm_file *file_priv)
Linus Torvalds1da177e2005-04-16 15:20:36 -070064{
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 drm_sis_private_t *dev_priv = dev->dev_private;
Eric Anholtc153f452007-09-03 12:06:45 +100066 drm_sis_fb_t *fb = data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
Thomas Hellstromce65a442006-08-07 22:03:22 +100068 mutex_lock(&dev->struct_mutex);
Daniel Vetterbe2fb9d2011-10-26 22:22:59 +020069 /* Unconditionally init the drm_mm, even though we don't use it when the
70 * fb sis driver is available - make cleanup easier. */
71 drm_mm_init(&dev_priv->vram_mm, 0, fb->size >> SIS_MM_ALIGN_SHIFT);
Linus Torvalds1da177e2005-04-16 15:20:36 -070072
Andrew Mortona1d0fcf2006-08-14 11:35:15 +100073 dev_priv->vram_initialized = 1;
Eric Anholtc153f452007-09-03 12:06:45 +100074 dev_priv->vram_offset = fb->offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
Thomas Hellstromce65a442006-08-07 22:03:22 +100076 mutex_unlock(&dev->struct_mutex);
Daniel Vetter83bc5fd2012-06-24 19:57:24 +020077 DRM_DEBUG("offset = %lu, size = %lu\n", fb->offset, fb->size);
Linus Torvalds1da177e2005-04-16 15:20:36 -070078
79 return 0;
80}
81
Daniel Vetterfdc0b8a2011-10-25 16:32:34 +020082static int sis_drm_alloc(struct drm_device *dev, struct drm_file *file,
Eric Anholtc153f452007-09-03 12:06:45 +100083 void *data, int pool)
Linus Torvalds1da177e2005-04-16 15:20:36 -070084{
Linus Torvalds1da177e2005-04-16 15:20:36 -070085 drm_sis_private_t *dev_priv = dev->dev_private;
Eric Anholtc153f452007-09-03 12:06:45 +100086 drm_sis_mem_t *mem = data;
Daniel Vetter6de8a742011-10-25 18:00:41 +020087 int retval = 0, user_key;
Daniel Vetterbe2fb9d2011-10-26 22:22:59 +020088 struct sis_memblock *item;
Daniel Vetterfdc0b8a2011-10-25 16:32:34 +020089 struct sis_file_private *file_priv = file->driver_priv;
Daniel Vetterbe2fb9d2011-10-26 22:22:59 +020090 unsigned long offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -070091
Thomas Hellstromce65a442006-08-07 22:03:22 +100092 mutex_lock(&dev->struct_mutex);
93
Andrew Mortona1d0fcf2006-08-14 11:35:15 +100094 if (0 == ((pool == 0) ? dev_priv->vram_initialized :
Thomas Hellstromce65a442006-08-07 22:03:22 +100095 dev_priv->agp_initialized)) {
96 DRM_ERROR
97 ("Attempt to allocate from uninitialized memory manager.\n");
Roel Kluin038477a2007-11-05 10:53:18 +100098 mutex_unlock(&dev->struct_mutex);
Eric Anholt20caafa2007-08-25 19:22:43 +100099 return -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 }
101
Daniel Vetterbe2fb9d2011-10-26 22:22:59 +0200102 item = kzalloc(sizeof(*item), GFP_KERNEL);
Daniel Vetter6de8a742011-10-25 18:00:41 +0200103 if (!item) {
Eric Anholt20caafa2007-08-25 19:22:43 +1000104 retval = -ENOMEM;
Daniel Vetter6de8a742011-10-25 18:00:41 +0200105 goto fail_alloc;
Thomas Hellstromce65a442006-08-07 22:03:22 +1000106 }
Daniel Vetter6de8a742011-10-25 18:00:41 +0200107
Daniel Vetterbe2fb9d2011-10-26 22:22:59 +0200108 mem->size = (mem->size + SIS_MM_ALIGN_MASK) >> SIS_MM_ALIGN_SHIFT;
109 if (pool == AGP_TYPE) {
110 retval = drm_mm_insert_node(&dev_priv->agp_mm,
111 &item->mm_node,
112 mem->size, 0);
113 offset = item->mm_node.start;
114 } else {
115#if defined(CONFIG_FB_SIS) || defined(CONFIG_FB_SIS_MODULE)
116 item->req.size = mem->size;
117 sis_malloc(&item->req);
118 if (item->req.size == 0)
119 retval = -ENOMEM;
120 offset = item->req.offset;
121#else
122 retval = drm_mm_insert_node(&dev_priv->vram_mm,
123 &item->mm_node,
124 mem->size, 0);
125 offset = item->mm_node.start;
126#endif
127 }
128 if (retval)
129 goto fail_alloc;
130
Tejun Heoff512352013-02-27 17:04:11 -0800131 retval = idr_alloc(&dev_priv->object_idr, item, 1, 0, GFP_KERNEL);
132 if (retval < 0)
Daniel Vetter6de8a742011-10-25 18:00:41 +0200133 goto fail_idr;
Tejun Heoff512352013-02-27 17:04:11 -0800134 user_key = retval;
Daniel Vetter6de8a742011-10-25 18:00:41 +0200135
136 list_add(&item->owner_list, &file_priv->obj_list);
Daniel Vetterfdc0b8a2011-10-25 16:32:34 +0200137 mutex_unlock(&dev->struct_mutex);
Thomas Hellstromce65a442006-08-07 22:03:22 +1000138
Daniel Vetter6de8a742011-10-25 18:00:41 +0200139 mem->offset = ((pool == 0) ?
140 dev_priv->vram_offset : dev_priv->agp_offset) +
Daniel Vetterbe2fb9d2011-10-26 22:22:59 +0200141 (offset << SIS_MM_ALIGN_SHIFT);
Daniel Vetter6de8a742011-10-25 18:00:41 +0200142 mem->free = user_key;
143 mem->size = mem->size << SIS_MM_ALIGN_SHIFT;
144
145 return 0;
146
147fail_idr:
Daniel Vetterbe2fb9d2011-10-26 22:22:59 +0200148 drm_mm_remove_node(&item->mm_node);
Daniel Vetter6de8a742011-10-25 18:00:41 +0200149fail_alloc:
Daniel Vetterbe2fb9d2011-10-26 22:22:59 +0200150 kfree(item);
Daniel Vetter6de8a742011-10-25 18:00:41 +0200151 mutex_unlock(&dev->struct_mutex);
152
153 mem->offset = 0;
154 mem->size = 0;
155 mem->free = 0;
156
Daniel Vetter83bc5fd2012-06-24 19:57:24 +0200157 DRM_DEBUG("alloc %d, size = %ld, offset = %ld\n", pool, mem->size,
Eric Anholtc153f452007-09-03 12:06:45 +1000158 mem->offset);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159
160 return retval;
161}
162
Eric Anholtc153f452007-09-03 12:06:45 +1000163static int sis_drm_free(struct drm_device *dev, void *data, struct drm_file *file_priv)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165 drm_sis_private_t *dev_priv = dev->dev_private;
Eric Anholtc153f452007-09-03 12:06:45 +1000166 drm_sis_mem_t *mem = data;
Daniel Vetterbe2fb9d2011-10-26 22:22:59 +0200167 struct sis_memblock *obj;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168
Thomas Hellstromce65a442006-08-07 22:03:22 +1000169 mutex_lock(&dev->struct_mutex);
Daniel Vetter6de8a742011-10-25 18:00:41 +0200170 obj = idr_find(&dev_priv->object_idr, mem->free);
171 if (obj == NULL) {
172 mutex_unlock(&dev->struct_mutex);
173 return -EINVAL;
174 }
175
176 idr_remove(&dev_priv->object_idr, mem->free);
Daniel Vetterbe2fb9d2011-10-26 22:22:59 +0200177 list_del(&obj->owner_list);
178 if (drm_mm_node_allocated(&obj->mm_node))
179 drm_mm_remove_node(&obj->mm_node);
180#if defined(CONFIG_FB_SIS) || defined(CONFIG_FB_SIS_MODULE)
181 else
182 sis_free(obj->req.offset);
183#endif
184 kfree(obj);
Thomas Hellstromce65a442006-08-07 22:03:22 +1000185 mutex_unlock(&dev->struct_mutex);
Eric Anholtc153f452007-09-03 12:06:45 +1000186 DRM_DEBUG("free = 0x%lx\n", mem->free);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187
Daniel Vetterb5215ef2012-01-08 22:42:27 +0100188 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189}
190
Eric Anholtc153f452007-09-03 12:06:45 +1000191static int sis_fb_alloc(struct drm_device *dev, void *data,
192 struct drm_file *file_priv)
Thomas Hellstromce65a442006-08-07 22:03:22 +1000193{
Eric Anholt6c340ea2007-08-25 20:23:09 +1000194 return sis_drm_alloc(dev, file_priv, data, VIDEO_TYPE);
Thomas Hellstromce65a442006-08-07 22:03:22 +1000195}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196
Eric Anholtc153f452007-09-03 12:06:45 +1000197static int sis_ioctl_agp_init(struct drm_device *dev, void *data,
198 struct drm_file *file_priv)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200 drm_sis_private_t *dev_priv = dev->dev_private;
Eric Anholtc153f452007-09-03 12:06:45 +1000201 drm_sis_agp_t *agp = data;
Thomas Hellstromce65a442006-08-07 22:03:22 +1000202 dev_priv = dev->dev_private;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203
Thomas Hellstromce65a442006-08-07 22:03:22 +1000204 mutex_lock(&dev->struct_mutex);
Daniel Vetterbe2fb9d2011-10-26 22:22:59 +0200205 drm_mm_init(&dev_priv->agp_mm, 0, agp->size >> SIS_MM_ALIGN_SHIFT);
Thomas Hellstromce65a442006-08-07 22:03:22 +1000206
Andrew Mortona1d0fcf2006-08-14 11:35:15 +1000207 dev_priv->agp_initialized = 1;
Eric Anholtc153f452007-09-03 12:06:45 +1000208 dev_priv->agp_offset = agp->offset;
Thomas Hellstromce65a442006-08-07 22:03:22 +1000209 mutex_unlock(&dev->struct_mutex);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210
Daniel Vetter83bc5fd2012-06-24 19:57:24 +0200211 DRM_DEBUG("offset = %lu, size = %lu\n", agp->offset, agp->size);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 return 0;
213}
214
Eric Anholtc153f452007-09-03 12:06:45 +1000215static int sis_ioctl_agp_alloc(struct drm_device *dev, void *data,
216 struct drm_file *file_priv)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217{
Thomas Hellstromce65a442006-08-07 22:03:22 +1000218
Eric Anholt6c340ea2007-08-25 20:23:09 +1000219 return sis_drm_alloc(dev, file_priv, data, AGP_TYPE);
Thomas Hellstromce65a442006-08-07 22:03:22 +1000220}
221
Dave Airlie84b1fd12007-07-11 15:53:27 +1000222static drm_local_map_t *sis_reg_init(struct drm_device *dev)
Thomas Hellstrom7981bf72006-08-08 21:34:46 +1000223{
Dave Airlie55910512007-07-11 16:53:40 +1000224 struct drm_map_list *entry;
Thomas Hellstrom7981bf72006-08-08 21:34:46 +1000225 drm_local_map_t *map;
226
Dave Airliebd1b3312007-05-26 05:01:51 +1000227 list_for_each_entry(entry, &dev->maplist, head) {
Thomas Hellstrom7981bf72006-08-08 21:34:46 +1000228 map = entry->map;
229 if (!map)
230 continue;
Nicolas Kaisera7b98b62010-07-09 16:47:28 +0200231 if (map->type == _DRM_REGISTERS)
Thomas Hellstrom7981bf72006-08-08 21:34:46 +1000232 return map;
Thomas Hellstrom7981bf72006-08-08 21:34:46 +1000233 }
234 return NULL;
235}
236
Dave Airlie84b1fd12007-07-11 15:53:27 +1000237int sis_idle(struct drm_device *dev)
Thomas Hellstrom7981bf72006-08-08 21:34:46 +1000238{
239 drm_sis_private_t *dev_priv = dev->dev_private;
240 uint32_t idle_reg;
241 unsigned long end;
242 int i;
243
244 if (dev_priv->idle_fault)
245 return 0;
246
247 if (dev_priv->mmio == NULL) {
248 dev_priv->mmio = sis_reg_init(dev);
249 if (dev_priv->mmio == NULL) {
250 DRM_ERROR("Could not find register map.\n");
251 return 0;
252 }
253 }
Dave Airliebc5f4522007-11-05 12:50:58 +1000254
Thomas Hellstrom7981bf72006-08-08 21:34:46 +1000255 /*
256 * Implement a device switch here if needed
257 */
258
259 if (dev_priv->chipset != SIS_CHIP_315)
260 return 0;
261
262 /*
263 * Timeout after 3 seconds. We cannot use DRM_WAIT_ON here
264 * because its polling frequency is too low.
265 */
266
267 end = jiffies + (DRM_HZ * 3);
268
Nicolas Kaisera7b98b62010-07-09 16:47:28 +0200269 for (i = 0; i < 4; ++i) {
Thomas Hellstrom7981bf72006-08-08 21:34:46 +1000270 do {
271 idle_reg = SIS_READ(0x85cc);
Nicolas Kaisera7b98b62010-07-09 16:47:28 +0200272 } while (!time_after_eq(jiffies, end) &&
Thomas Hellstrom7981bf72006-08-08 21:34:46 +1000273 ((idle_reg & 0x80000000) != 0x80000000));
274 }
275
276 if (time_after_eq(jiffies, end)) {
277 DRM_ERROR("Graphics engine idle timeout. "
278 "Disabling idle check\n");
Andrew Mortona1d0fcf2006-08-14 11:35:15 +1000279 dev_priv->idle_fault = 1;
Thomas Hellstrom7981bf72006-08-08 21:34:46 +1000280 }
281
282 /*
283 * The caller never sees an error code. It gets trapped
284 * in libdrm.
285 */
286
287 return 0;
288}
289
290
Thomas Hellstromce65a442006-08-07 22:03:22 +1000291void sis_lastclose(struct drm_device *dev)
292{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293 drm_sis_private_t *dev_priv = dev->dev_private;
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000294
Thomas Hellstromce65a442006-08-07 22:03:22 +1000295 if (!dev_priv)
296 return;
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000297
Thomas Hellstromce65a442006-08-07 22:03:22 +1000298 mutex_lock(&dev->struct_mutex);
Daniel Vetterbe2fb9d2011-10-26 22:22:59 +0200299 if (dev_priv->vram_initialized) {
300 drm_mm_takedown(&dev_priv->vram_mm);
301 dev_priv->vram_initialized = 0;
302 }
303 if (dev_priv->agp_initialized) {
304 drm_mm_takedown(&dev_priv->agp_mm);
305 dev_priv->agp_initialized = 0;
306 }
Thomas Hellstrom7981bf72006-08-08 21:34:46 +1000307 dev_priv->mmio = NULL;
Thomas Hellstromce65a442006-08-07 22:03:22 +1000308 mutex_unlock(&dev->struct_mutex);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309}
310
Nicolas Kaisera7b98b62010-07-09 16:47:28 +0200311void sis_reclaim_buffers_locked(struct drm_device *dev,
Daniel Vetterfdc0b8a2011-10-25 16:32:34 +0200312 struct drm_file *file)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313{
Daniel Vetterfdc0b8a2011-10-25 16:32:34 +0200314 struct sis_file_private *file_priv = file->driver_priv;
Daniel Vetterbe2fb9d2011-10-26 22:22:59 +0200315 struct sis_memblock *entry, *next;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316
Daniel Vetterea5e4372011-10-25 23:42:59 +0200317 if (!(file->minor->master && file->master->lock.hw_lock))
318 return;
319
320 drm_idlelock_take(&file->master->lock);
321
Thomas Hellstromce65a442006-08-07 22:03:22 +1000322 mutex_lock(&dev->struct_mutex);
Daniel Vetterfdc0b8a2011-10-25 16:32:34 +0200323 if (list_empty(&file_priv->obj_list)) {
Thomas Hellstromce65a442006-08-07 22:03:22 +1000324 mutex_unlock(&dev->struct_mutex);
Daniel Vetterea5e4372011-10-25 23:42:59 +0200325 drm_idlelock_release(&file->master->lock);
326
Thomas Hellstromce65a442006-08-07 22:03:22 +1000327 return;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328 }
329
Daniel Vetterea5e4372011-10-25 23:42:59 +0200330 sis_idle(dev);
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000331
Daniel Vetterfdc0b8a2011-10-25 16:32:34 +0200332
333 list_for_each_entry_safe(entry, next, &file_priv->obj_list,
334 owner_list) {
Daniel Vetterbe2fb9d2011-10-26 22:22:59 +0200335 list_del(&entry->owner_list);
336 if (drm_mm_node_allocated(&entry->mm_node))
337 drm_mm_remove_node(&entry->mm_node);
338#if defined(CONFIG_FB_SIS) || defined(CONFIG_FB_SIS_MODULE)
339 else
340 sis_free(entry->req.offset);
341#endif
342 kfree(entry);
Daniel Vetterfdc0b8a2011-10-25 16:32:34 +0200343 }
Thomas Hellstromce65a442006-08-07 22:03:22 +1000344 mutex_unlock(&dev->struct_mutex);
Daniel Vetterea5e4372011-10-25 23:42:59 +0200345
346 drm_idlelock_release(&file->master->lock);
347
Thomas Hellstromce65a442006-08-07 22:03:22 +1000348 return;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349}
350
Eric Anholtc153f452007-09-03 12:06:45 +1000351struct drm_ioctl_desc sis_ioctls[] = {
Dave Airlie1b2f1482010-08-14 20:20:34 +1000352 DRM_IOCTL_DEF_DRV(SIS_FB_ALLOC, sis_fb_alloc, DRM_AUTH),
353 DRM_IOCTL_DEF_DRV(SIS_FB_FREE, sis_drm_free, DRM_AUTH),
354 DRM_IOCTL_DEF_DRV(SIS_AGP_INIT, sis_ioctl_agp_init, DRM_AUTH | DRM_MASTER | DRM_ROOT_ONLY),
355 DRM_IOCTL_DEF_DRV(SIS_AGP_ALLOC, sis_ioctl_agp_alloc, DRM_AUTH),
356 DRM_IOCTL_DEF_DRV(SIS_AGP_FREE, sis_drm_free, DRM_AUTH),
357 DRM_IOCTL_DEF_DRV(SIS_FB_INIT, sis_fb_init, DRM_AUTH | DRM_MASTER | DRM_ROOT_ONLY),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358};
359
360int sis_max_ioctl = DRM_ARRAY_SIZE(sis_ioctls);