Deleted Added
full compact
drmP.h (182080) drmP.h (183573)
1/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
2 * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
3 */
4/*-
5 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
6 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
7 * All rights reserved.
8 *

--- 18 unchanged lines hidden (view full) ---

27 *
28 * Authors:
29 * Rickard E. (Rik) Faith <faith@valinux.com>
30 * Gareth Hughes <gareth@valinux.com>
31 *
32 */
33
34#include <sys/cdefs.h>
1/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
2 * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
3 */
4/*-
5 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
6 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
7 * All rights reserved.
8 *

--- 18 unchanged lines hidden (view full) ---

27 *
28 * Authors:
29 * Rickard E. (Rik) Faith <faith@valinux.com>
30 * Gareth Hughes <gareth@valinux.com>
31 *
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/dev/drm/drmP.h 182080 2008-08-23 20:59:12Z rnoland $");
35__FBSDID("$FreeBSD: head/sys/dev/drm/drmP.h 183573 2008-10-03 16:59:11Z rnoland $");
36
37#ifndef _DRM_P_H_
38#define _DRM_P_H_
39
40#if defined(_KERNEL) || defined(__KERNEL__)
41
42struct drm_device;
36
37#ifndef _DRM_P_H_
38#define _DRM_P_H_
39
40#if defined(_KERNEL) || defined(__KERNEL__)
41
42struct drm_device;
43typedef struct drm_file drm_file_t;
43struct drm_file;
44
45#include <sys/param.h>
46#include <sys/queue.h>
47#include <sys/malloc.h>
48#include <sys/kernel.h>
49#include <sys/module.h>
50#include <sys/systm.h>
51#include <sys/conf.h>

--- 16 unchanged lines hidden (view full) ---

68#include <vm/pmap.h>
69#include <vm/vm_extern.h>
70#include <vm/vm_map.h>
71#include <vm/vm_param.h>
72#include <machine/param.h>
73#include <machine/pmap.h>
74#include <machine/bus.h>
75#include <machine/resource.h>
44
45#include <sys/param.h>
46#include <sys/queue.h>
47#include <sys/malloc.h>
48#include <sys/kernel.h>
49#include <sys/module.h>
50#include <sys/systm.h>
51#include <sys/conf.h>

--- 16 unchanged lines hidden (view full) ---

68#include <vm/pmap.h>
69#include <vm/vm_extern.h>
70#include <vm/vm_map.h>
71#include <vm/vm_param.h>
72#include <machine/param.h>
73#include <machine/pmap.h>
74#include <machine/bus.h>
75#include <machine/resource.h>
76#include <machine/specialreg.h>
76#include <machine/sysarch.h>
77#include <sys/endian.h>
78#include <sys/mman.h>
77#include <machine/sysarch.h>
78#include <sys/endian.h>
79#include <sys/mman.h>
79#if defined(__FreeBSD__)
80#include <sys/rman.h>
81#include <sys/memrange.h>
82#if __FreeBSD_version >= 800004
83#include <dev/agp/agpvar.h>
84#else /* __FreeBSD_version >= 800004 */
85#include <pci/agpvar.h>
86#endif /* __FreeBSD_version >= 800004 */
87#include <sys/agpio.h>
80#include <sys/rman.h>
81#include <sys/memrange.h>
82#if __FreeBSD_version >= 800004
83#include <dev/agp/agpvar.h>
84#else /* __FreeBSD_version >= 800004 */
85#include <pci/agpvar.h>
86#endif /* __FreeBSD_version >= 800004 */
87#include <sys/agpio.h>
88#if __FreeBSD_version >= 500000
89#include <sys/mutex.h>
90#include <dev/pci/pcivar.h>
91#include <sys/selinfo.h>
88#include <sys/mutex.h>
89#include <dev/pci/pcivar.h>
90#include <sys/selinfo.h>
92#else /* __FreeBSD_version >= 500000 */
93#include <pci/pcivar.h>
94#include <sys/select.h>
95#endif /* __FreeBSD_version < 500000 */
96#elif defined(__NetBSD__)
97#include <machine/mtrr.h>
98#include <sys/vnode.h>
99#include <sys/select.h>
100#include <sys/device.h>
101#include <sys/resourcevar.h>
102#include <sys/lkm.h>
103#include <sys/agpio.h>
104#include <sys/ttycom.h>
105#include <uvm/uvm.h>
106#include <dev/pci/pcireg.h>
107#include <dev/pci/pcivar.h>
108#include <dev/pci/agpvar.h>
109#elif defined(__OpenBSD__)
110#include <sys/lkm.h>
111#include <uvm/uvm.h>
112#endif
113#include <sys/bus.h>
114
115#include "dev/drm/drm.h"
116#include "dev/drm/drm_linux_list.h"
117#include "dev/drm/drm_atomic.h"
118#include "dev/drm/drm_internal.h"
119
91#include <sys/bus.h>
92
93#include "dev/drm/drm.h"
94#include "dev/drm/drm_linux_list.h"
95#include "dev/drm/drm_atomic.h"
96#include "dev/drm/drm_internal.h"
97
120#ifdef __FreeBSD__
121#include <opt_drm.h>
122#ifdef DRM_DEBUG
123#undef DRM_DEBUG
124#define DRM_DEBUG_DEFAULT_ON 1
125#endif /* DRM_DEBUG */
98#include <opt_drm.h>
99#ifdef DRM_DEBUG
100#undef DRM_DEBUG
101#define DRM_DEBUG_DEFAULT_ON 1
102#endif /* DRM_DEBUG */
126#endif
127
128#if defined(DRM_LINUX) && DRM_LINUX && !defined(__amd64__)
129#include <sys/file.h>
130#include <sys/proc.h>
131#include <machine/../linux/linux.h>
132#include <machine/../linux/linux_proto.h>
133#else
134/* Either it was defined when it shouldn't be (FreeBSD amd64) or it isn't
135 * supported on this OS yet.
136 */
137#undef DRM_LINUX
138#define DRM_LINUX 0
139#endif
140
103
104#if defined(DRM_LINUX) && DRM_LINUX && !defined(__amd64__)
105#include <sys/file.h>
106#include <sys/proc.h>
107#include <machine/../linux/linux.h>
108#include <machine/../linux/linux_proto.h>
109#else
110/* Either it was defined when it shouldn't be (FreeBSD amd64) or it isn't
111 * supported on this OS yet.
112 */
113#undef DRM_LINUX
114#define DRM_LINUX 0
115#endif
116
117/* driver capabilities and requirements mask */
118#define DRIVER_USE_AGP 0x1
119#define DRIVER_REQUIRE_AGP 0x2
120#define DRIVER_USE_MTRR 0x4
121#define DRIVER_PCI_DMA 0x8
122#define DRIVER_SG 0x10
123#define DRIVER_HAVE_DMA 0x20
124#define DRIVER_HAVE_IRQ 0x40
125#define DRIVER_DMA_QUEUE 0x100
126
127
141#define DRM_HASH_SIZE 16 /* Size of key hash table */
142#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
143#define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */
144
145#define DRM_MEM_DMA 0
146#define DRM_MEM_SAREA 1
147#define DRM_MEM_DRIVER 2
148#define DRM_MEM_MAGIC 3

--- 32 unchanged lines hidden (view full) ---

181#define DRM_DEV_UID 0
182#define DRM_DEV_GID 0
183
184#define wait_queue_head_t atomic_t
185#define DRM_WAKEUP(w) wakeup((void *)w)
186#define DRM_WAKEUP_INT(w) wakeup(w)
187#define DRM_INIT_WAITQUEUE(queue) do {(void)(queue);} while (0)
188
128#define DRM_HASH_SIZE 16 /* Size of key hash table */
129#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
130#define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */
131
132#define DRM_MEM_DMA 0
133#define DRM_MEM_SAREA 1
134#define DRM_MEM_DRIVER 2
135#define DRM_MEM_MAGIC 3

--- 32 unchanged lines hidden (view full) ---

168#define DRM_DEV_UID 0
169#define DRM_DEV_GID 0
170
171#define wait_queue_head_t atomic_t
172#define DRM_WAKEUP(w) wakeup((void *)w)
173#define DRM_WAKEUP_INT(w) wakeup(w)
174#define DRM_INIT_WAITQUEUE(queue) do {(void)(queue);} while (0)
175
189#if defined(__FreeBSD__) && __FreeBSD_version < 502109
190#define bus_alloc_resource_any(dev, type, rid, flags) \
191 bus_alloc_resource(dev, type, rid, 0ul, ~0ul, 1, flags)
192#endif
193
194#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
195#define DRM_CURPROC curthread
196#define DRM_STRUCTPROC struct thread
197#define DRM_SPINTYPE struct mtx
198#define DRM_SPININIT(l,name) mtx_init(l, name, NULL, MTX_DEF)
199#define DRM_SPINUNINIT(l) mtx_destroy(l)
200#define DRM_SPINLOCK(l) mtx_lock(l)
201#define DRM_SPINUNLOCK(u) mtx_unlock(u)
202#define DRM_SPINLOCK_IRQSAVE(l, irqflags) do { \
203 mtx_lock(l); \
204 (void)irqflags; \
205} while (0)
206#define DRM_SPINUNLOCK_IRQRESTORE(u, irqflags) mtx_unlock(u)
207#define DRM_SPINLOCK_ASSERT(l) mtx_assert(l, MA_OWNED)
208#define DRM_CURRENTPID curthread->td_proc->p_pid
209#define DRM_LOCK() mtx_lock(&dev->dev_lock)
210#define DRM_UNLOCK() mtx_unlock(&dev->dev_lock)
211#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS)
176#define DRM_CURPROC curthread
177#define DRM_STRUCTPROC struct thread
178#define DRM_SPINTYPE struct mtx
179#define DRM_SPININIT(l,name) mtx_init(l, name, NULL, MTX_DEF)
180#define DRM_SPINUNINIT(l) mtx_destroy(l)
181#define DRM_SPINLOCK(l) mtx_lock(l)
182#define DRM_SPINUNLOCK(u) mtx_unlock(u)
183#define DRM_SPINLOCK_IRQSAVE(l, irqflags) do { \
184 mtx_lock(l); \
185 (void)irqflags; \
186} while (0)
187#define DRM_SPINUNLOCK_IRQRESTORE(u, irqflags) mtx_unlock(u)
188#define DRM_SPINLOCK_ASSERT(l) mtx_assert(l, MA_OWNED)
189#define DRM_CURRENTPID curthread->td_proc->p_pid
190#define DRM_LOCK() mtx_lock(&dev->dev_lock)
191#define DRM_UNLOCK() mtx_unlock(&dev->dev_lock)
192#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS)
212#else /* __FreeBSD__ && __FreeBSD_version >= 500000 */
213#define DRM_CURPROC curproc
214#define DRM_STRUCTPROC struct proc
215#define DRM_SPINTYPE struct simplelock
216#define DRM_SPININIT(l,name)
217#define DRM_SPINUNINIT(l)
218#define DRM_SPINLOCK(l)
219#define DRM_SPINUNLOCK(u)
220#define DRM_SPINLOCK_ASSERT(l)
221#define DRM_CURRENTPID curproc->p_pid
222#define DRM_LOCK()
223#define DRM_UNLOCK()
224#define DRM_SYSCTL_HANDLER_ARGS SYSCTL_HANDLER_ARGS
225#define spldrm() spltty()
226#endif /* __NetBSD__ || __OpenBSD__ */
227
228#define DRM_IRQ_ARGS void *arg
229typedef void irqreturn_t;
230#define IRQ_HANDLED /* nothing */
231#define IRQ_NONE /* nothing */
232
233enum {
234 DRM_IS_NOT_AGP,
235 DRM_IS_AGP,
236 DRM_MIGHT_BE_AGP
237};
238#define DRM_AGP_MEM struct agp_memory_info
239
193
194#define DRM_IRQ_ARGS void *arg
195typedef void irqreturn_t;
196#define IRQ_HANDLED /* nothing */
197#define IRQ_NONE /* nothing */
198
199enum {
200 DRM_IS_NOT_AGP,
201 DRM_IS_AGP,
202 DRM_MIGHT_BE_AGP
203};
204#define DRM_AGP_MEM struct agp_memory_info
205
240#if defined(__FreeBSD__)
241#define drm_get_device_from_kdev(_kdev) (_kdev->si_drv1)
206#define drm_get_device_from_kdev(_kdev) (_kdev->si_drv1)
242#elif defined(__NetBSD__)
243#define drm_get_device_from_kdev(_kdev) device_lookup(&drm_cd, minor(_kdev))
244#elif defined(__OpenBSD__)
245#define drm_get_device_from_kdev(_kdev) device_lookup(&drm_cd, \
246 minor(_kdev)))->dv_cfdata->cf_driver->cd_devs[minor(_kdev)]
247#endif
248
207
249#if defined(__FreeBSD__)
250#define PAGE_ALIGN(addr) round_page(addr)
251/* DRM_SUSER returns true if the user is superuser */
252#if __FreeBSD_version >= 700000
253#define DRM_SUSER(p) (priv_check(p, PRIV_DRIVER) == 0)
254#else
255#define DRM_SUSER(p) (suser(p) == 0)
256#endif
257#define DRM_AGP_FIND_DEVICE() agp_find_device()
258#define DRM_MTRR_WC MDF_WRITECOMBINE
259#define jiffies ticks
260
208#define PAGE_ALIGN(addr) round_page(addr)
209/* DRM_SUSER returns true if the user is superuser */
210#if __FreeBSD_version >= 700000
211#define DRM_SUSER(p) (priv_check(p, PRIV_DRIVER) == 0)
212#else
213#define DRM_SUSER(p) (suser(p) == 0)
214#endif
215#define DRM_AGP_FIND_DEVICE() agp_find_device()
216#define DRM_MTRR_WC MDF_WRITECOMBINE
217#define jiffies ticks
218
261#else /* __FreeBSD__ */
262
263#define CDEV_MAJOR 34
264#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
265/* DRM_SUSER returns true if the user is superuser */
266#define DRM_SUSER(p) (suser(p->p_ucred, &p->p_acflag) == 0)
267#define DRM_AGP_FIND_DEVICE() agp_find_device(0)
268#define DRM_MTRR_WC MTRR_TYPE_WC
269#define jiffies hardclock_ticks
270
271typedef struct drm_device *device_t;
272extern struct cfdriver drm_cd;
273#endif /* !__FreeBSD__ */
274
275/* Capabilities taken from src/sys/dev/pci/pcireg.h. */
276#ifndef PCIY_AGP
277#define PCIY_AGP 0x02
278#endif
279
280#ifndef PCIY_EXPRESS
281#define PCIY_EXPRESS 0x10
282#endif

--- 21 unchanged lines hidden (view full) ---

304#elif defined(__amd64__)
305#define DRM_READMEMORYBARRIER() __asm __volatile( \
306 "lock; addl $0,0(%%rsp)" : : : "memory");
307#define DRM_WRITEMEMORYBARRIER() __asm __volatile("" : : : "memory");
308#define DRM_MEMORYBARRIER() __asm __volatile( \
309 "lock; addl $0,0(%%rsp)" : : : "memory");
310#endif
311
219/* Capabilities taken from src/sys/dev/pci/pcireg.h. */
220#ifndef PCIY_AGP
221#define PCIY_AGP 0x02
222#endif
223
224#ifndef PCIY_EXPRESS
225#define PCIY_EXPRESS 0x10
226#endif

--- 21 unchanged lines hidden (view full) ---

248#elif defined(__amd64__)
249#define DRM_READMEMORYBARRIER() __asm __volatile( \
250 "lock; addl $0,0(%%rsp)" : : : "memory");
251#define DRM_WRITEMEMORYBARRIER() __asm __volatile("" : : : "memory");
252#define DRM_MEMORYBARRIER() __asm __volatile( \
253 "lock; addl $0,0(%%rsp)" : : : "memory");
254#endif
255
312#ifdef __FreeBSD__
313#define DRM_READ8(map, offset) \
314 *(volatile u_int8_t *) (((unsigned long)(map)->handle) + (offset))
315#define DRM_READ16(map, offset) \
316 *(volatile u_int16_t *) (((unsigned long)(map)->handle) + (offset))
317#define DRM_READ32(map, offset) \
318 *(volatile u_int32_t *)(((unsigned long)(map)->handle) + (offset))
319#define DRM_WRITE8(map, offset, val) \
320 *(volatile u_int8_t *) (((unsigned long)(map)->handle) + (offset)) = val
321#define DRM_WRITE16(map, offset, val) \
322 *(volatile u_int16_t *) (((unsigned long)(map)->handle) + (offset)) = val
323#define DRM_WRITE32(map, offset, val) \
324 *(volatile u_int32_t *)(((unsigned long)(map)->handle) + (offset)) = val
325
326#define DRM_VERIFYAREA_READ( uaddr, size ) \
327 (!useracc(__DECONST(caddr_t, uaddr), size, VM_PROT_READ))
328
256#define DRM_READ8(map, offset) \
257 *(volatile u_int8_t *) (((unsigned long)(map)->handle) + (offset))
258#define DRM_READ16(map, offset) \
259 *(volatile u_int16_t *) (((unsigned long)(map)->handle) + (offset))
260#define DRM_READ32(map, offset) \
261 *(volatile u_int32_t *)(((unsigned long)(map)->handle) + (offset))
262#define DRM_WRITE8(map, offset, val) \
263 *(volatile u_int8_t *) (((unsigned long)(map)->handle) + (offset)) = val
264#define DRM_WRITE16(map, offset, val) \
265 *(volatile u_int16_t *) (((unsigned long)(map)->handle) + (offset)) = val
266#define DRM_WRITE32(map, offset, val) \
267 *(volatile u_int32_t *)(((unsigned long)(map)->handle) + (offset)) = val
268
269#define DRM_VERIFYAREA_READ( uaddr, size ) \
270 (!useracc(__DECONST(caddr_t, uaddr), size, VM_PROT_READ))
271
329#else /* __FreeBSD__ */
330
331typedef vaddr_t vm_offset_t;
332
333#define DRM_READ8(map, offset) \
334 bus_space_read_1( (map)->bst, (map)->bsh, (offset))
335#define DRM_READ16(map, offset) \
336 bus_space_read_2( (map)->bst, (map)->bsh, (offset))
337#define DRM_READ32(map, offset) \
338 bus_space_read_4( (map)->bst, (map)->bsh, (offset))
339#define DRM_WRITE8(map, offset, val) \
340 bus_space_write_1((map)->bst, (map)->bsh, (offset), (val))
341#define DRM_WRITE16(map, offset, val) \
342 bus_space_write_2((map)->bst, (map)->bsh, (offset), (val))
343#define DRM_WRITE32(map, offset, val) \
344 bus_space_write_4((map)->bst, (map)->bsh, (offset), (val))
345
346#define DRM_VERIFYAREA_READ( uaddr, size ) \
347 (!uvm_useracc((caddr_t)uaddr, size, VM_PROT_READ))
348#endif /* !__FreeBSD__ */
349
350#define DRM_COPY_TO_USER(user, kern, size) \
351 copyout(kern, user, size)
352#define DRM_COPY_FROM_USER(kern, user, size) \
353 copyin(user, kern, size)
354#define DRM_COPY_FROM_USER_UNCHECKED(arg1, arg2, arg3) \
355 copyin(arg2, arg1, arg3)
356#define DRM_COPY_TO_USER_UNCHECKED(arg1, arg2, arg3) \
357 copyout(arg2, arg1, arg3)
272#define DRM_COPY_TO_USER(user, kern, size) \
273 copyout(kern, user, size)
274#define DRM_COPY_FROM_USER(kern, user, size) \
275 copyin(user, kern, size)
276#define DRM_COPY_FROM_USER_UNCHECKED(arg1, arg2, arg3) \
277 copyin(arg2, arg1, arg3)
278#define DRM_COPY_TO_USER_UNCHECKED(arg1, arg2, arg3) \
279 copyout(arg2, arg1, arg3)
358#if __FreeBSD_version > 500000
359#define DRM_GET_USER_UNCHECKED(val, uaddr) \
360 ((val) = fuword32(uaddr), 0)
280#define DRM_GET_USER_UNCHECKED(val, uaddr) \
281 ((val) = fuword32(uaddr), 0)
361#else
362#define DRM_GET_USER_UNCHECKED(val, uaddr) \
363 ((val) = fuword(uaddr), 0)
364#endif
365
366#define cpu_to_le32(x) htole32(x)
367#define le32_to_cpu(x) le32toh(x)
368
369#define DRM_HZ hz
370#define DRM_UDELAY(udelay) DELAY(udelay)
371#define DRM_TIME_SLICE (hz/20) /* Time slice for GLXContexts */
372

--- 6 unchanged lines hidden (view full) ---

379 if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) || \
380 dev->lock.file_priv != file_priv) { \
381 DRM_ERROR("%s called without lock held\n", \
382 __FUNCTION__); \
383 return EINVAL; \
384 } \
385} while (0)
386
282
283#define cpu_to_le32(x) htole32(x)
284#define le32_to_cpu(x) le32toh(x)
285
286#define DRM_HZ hz
287#define DRM_UDELAY(udelay) DELAY(udelay)
288#define DRM_TIME_SLICE (hz/20) /* Time slice for GLXContexts */
289

--- 6 unchanged lines hidden (view full) ---

296 if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) || \
297 dev->lock.file_priv != file_priv) { \
298 DRM_ERROR("%s called without lock held\n", \
299 __FUNCTION__); \
300 return EINVAL; \
301 } \
302} while (0)
303
387#if defined(__FreeBSD__) && __FreeBSD_version > 500000
388/* Returns -errno to shared code */
389#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
390for ( ret = 0 ; !ret && !(condition) ; ) { \
391 DRM_UNLOCK(); \
392 mtx_lock(&dev->irq_lock); \
393 if (!(condition)) \
394 ret = -mtx_sleep(&(queue), &dev->irq_lock, \
395 PZERO | PCATCH, "drmwtq", (timeout)); \
396 mtx_unlock(&dev->irq_lock); \
397 DRM_LOCK(); \
398}
304/* Returns -errno to shared code */
305#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
306for ( ret = 0 ; !ret && !(condition) ; ) { \
307 DRM_UNLOCK(); \
308 mtx_lock(&dev->irq_lock); \
309 if (!(condition)) \
310 ret = -mtx_sleep(&(queue), &dev->irq_lock, \
311 PZERO | PCATCH, "drmwtq", (timeout)); \
312 mtx_unlock(&dev->irq_lock); \
313 DRM_LOCK(); \
314}
399#else
400/* Returns -errno to shared code */
401#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
402for ( ret = 0 ; !ret && !(condition) ; ) { \
403 int s = spldrm(); \
404 if (!(condition)) \
405 ret = -tsleep( &(queue), PZERO | PCATCH, \
406 "drmwtq", (timeout) ); \
407 splx(s); \
408}
409#endif
410
411#define DRM_ERROR(fmt, arg...) \
412 printf("error: [" DRM_NAME ":pid%d:%s] *ERROR* " fmt, \
413 DRM_CURRENTPID, __func__ , ## arg)
414
415#define DRM_INFO(fmt, arg...) printf("info: [" DRM_NAME "] " fmt , ## arg)
416
417#define DRM_DEBUG(fmt, arg...) do { \

--- 69 unchanged lines hidden (view full) ---

487
488 int low_mark; /* Low water mark */
489 int high_mark; /* High water mark */
490} drm_freelist_t;
491
492typedef struct drm_dma_handle {
493 void *vaddr;
494 bus_addr_t busaddr;
315
316#define DRM_ERROR(fmt, arg...) \
317 printf("error: [" DRM_NAME ":pid%d:%s] *ERROR* " fmt, \
318 DRM_CURRENTPID, __func__ , ## arg)
319
320#define DRM_INFO(fmt, arg...) printf("info: [" DRM_NAME "] " fmt , ## arg)
321
322#define DRM_DEBUG(fmt, arg...) do { \

--- 69 unchanged lines hidden (view full) ---

392
393 int low_mark; /* Low water mark */
394 int high_mark; /* High water mark */
395} drm_freelist_t;
396
397typedef struct drm_dma_handle {
398 void *vaddr;
399 bus_addr_t busaddr;
495#if defined(__FreeBSD__)
496 bus_dma_tag_t tag;
497 bus_dmamap_t map;
400 bus_dma_tag_t tag;
401 bus_dmamap_t map;
498#elif defined(__NetBSD__)
499 bus_dma_segment_t seg;
500#endif
501} drm_dma_handle_t;
502
503typedef struct drm_buf_entry {
504 int buf_size;
505 int buf_count;
506 drm_buf_t *buflist;
507 int seg_count;
508 drm_dma_handle_t **seglist;
509 int page_order;
510
511 drm_freelist_t freelist;
512} drm_buf_entry_t;
513
514typedef TAILQ_HEAD(drm_file_list, drm_file) drm_file_list_t;
515struct drm_file {
516 TAILQ_ENTRY(drm_file) link;
402} drm_dma_handle_t;
403
404typedef struct drm_buf_entry {
405 int buf_size;
406 int buf_count;
407 drm_buf_t *buflist;
408 int seg_count;
409 drm_dma_handle_t **seglist;
410 int page_order;
411
412 drm_freelist_t freelist;
413} drm_buf_entry_t;
414
415typedef TAILQ_HEAD(drm_file_list, drm_file) drm_file_list_t;
416struct drm_file {
417 TAILQ_ENTRY(drm_file) link;
418 struct drm_device *dev;
517 int authenticated;
518 int master;
519 int minor;
520 pid_t pid;
521 uid_t uid;
419 int authenticated;
420 int master;
421 int minor;
422 pid_t pid;
423 uid_t uid;
522 int refs;
523 drm_magic_t magic;
524 unsigned long ioctl_count;
525 void *driver_priv;
526};
527
528typedef struct drm_lock_data {
424 drm_magic_t magic;
425 unsigned long ioctl_count;
426 void *driver_priv;
427};
428
429typedef struct drm_lock_data {
529 drm_hw_lock_t *hw_lock; /* Hardware lock */
430 struct drm_hw_lock *hw_lock; /* Hardware lock */
530 struct drm_file *file_priv; /* Unique identifier of holding process (NULL is kernel)*/
531 int lock_queue; /* Queue of blocked processes */
532 unsigned long lock_time; /* Time of last lock in jiffies */
533} drm_lock_data_t;
534
535/* This structure, in the struct drm_device, is always initialized while the
536 * device
537 * is open. dev->dma_lock protects the incrementing of dev->buf_use, which

--- 46 unchanged lines hidden (view full) ---

584 drm_dma_handle_t *dmah; /* Handle to PCI memory for ATI PCIGART table */
585} drm_sg_mem_t;
586
587typedef TAILQ_HEAD(drm_map_list, drm_local_map) drm_map_list_t;
588
589typedef struct drm_local_map {
590 unsigned long offset; /* Physical address (0 for SAREA)*/
591 unsigned long size; /* Physical size (bytes) */
431 struct drm_file *file_priv; /* Unique identifier of holding process (NULL is kernel)*/
432 int lock_queue; /* Queue of blocked processes */
433 unsigned long lock_time; /* Time of last lock in jiffies */
434} drm_lock_data_t;
435
436/* This structure, in the struct drm_device, is always initialized while the
437 * device
438 * is open. dev->dma_lock protects the incrementing of dev->buf_use, which

--- 46 unchanged lines hidden (view full) ---

485 drm_dma_handle_t *dmah; /* Handle to PCI memory for ATI PCIGART table */
486} drm_sg_mem_t;
487
488typedef TAILQ_HEAD(drm_map_list, drm_local_map) drm_map_list_t;
489
490typedef struct drm_local_map {
491 unsigned long offset; /* Physical address (0 for SAREA)*/
492 unsigned long size; /* Physical size (bytes) */
592 drm_map_type_t type; /* Type of memory mapped */
593 drm_map_flags_t flags; /* Flags */
493 enum drm_map_type type; /* Type of memory mapped */
494 enum drm_map_flags flags; /* Flags */
594 void *handle; /* User-space: "Handle" to pass to mmap */
595 /* Kernel-space: kernel-virtual address */
596 int mtrr; /* Boolean: MTRR used */
597 /* Private data */
598 int rid; /* PCI resource ID for bus_space */
599 struct resource *bsr;
600 bus_space_tag_t bst;
601 bus_space_handle_t bsh;

--- 46 unchanged lines hidden (view full) ---

648#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (1ULL<<(n)) - 1)
649#endif
650
651#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
652
653struct drm_driver_info {
654 int (*load)(struct drm_device *, unsigned long flags);
655 int (*firstopen)(struct drm_device *);
495 void *handle; /* User-space: "Handle" to pass to mmap */
496 /* Kernel-space: kernel-virtual address */
497 int mtrr; /* Boolean: MTRR used */
498 /* Private data */
499 int rid; /* PCI resource ID for bus_space */
500 struct resource *bsr;
501 bus_space_tag_t bst;
502 bus_space_handle_t bsh;

--- 46 unchanged lines hidden (view full) ---

549#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (1ULL<<(n)) - 1)
550#endif
551
552#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
553
554struct drm_driver_info {
555 int (*load)(struct drm_device *, unsigned long flags);
556 int (*firstopen)(struct drm_device *);
656 int (*open)(struct drm_device *, drm_file_t *);
557 int (*open)(struct drm_device *, struct drm_file *);
657 void (*preclose)(struct drm_device *, struct drm_file *file_priv);
558 void (*preclose)(struct drm_device *, struct drm_file *file_priv);
658 void (*postclose)(struct drm_device *, drm_file_t *);
559 void (*postclose)(struct drm_device *, struct drm_file *);
659 void (*lastclose)(struct drm_device *);
660 int (*unload)(struct drm_device *);
661 void (*reclaim_buffers_locked)(struct drm_device *,
662 struct drm_file *file_priv);
663 int (*dma_ioctl)(struct drm_device *dev, void *data,
664 struct drm_file *file_priv);
665 void (*dma_ready)(struct drm_device *);
666 int (*dma_quiescent)(struct drm_device *);
667 int (*dma_flush_block_and_flush)(struct drm_device *, int context,
560 void (*lastclose)(struct drm_device *);
561 int (*unload)(struct drm_device *);
562 void (*reclaim_buffers_locked)(struct drm_device *,
563 struct drm_file *file_priv);
564 int (*dma_ioctl)(struct drm_device *dev, void *data,
565 struct drm_file *file_priv);
566 void (*dma_ready)(struct drm_device *);
567 int (*dma_quiescent)(struct drm_device *);
568 int (*dma_flush_block_and_flush)(struct drm_device *, int context,
668 drm_lock_flags_t flags);
569 enum drm_lock_flags flags);
669 int (*dma_flush_unblock)(struct drm_device *, int context,
570 int (*dma_flush_unblock)(struct drm_device *, int context,
670 drm_lock_flags_t flags);
571 enum drm_lock_flags flags);
671 int (*context_ctor)(struct drm_device *dev, int context);
672 int (*context_dtor)(struct drm_device *dev, int context);
673 int (*kernel_context_switch)(struct drm_device *dev, int old,
674 int new);
675 int (*kernel_context_switch_unlock)(struct drm_device *dev);
676 void (*irq_preinstall)(struct drm_device *dev);
677 int (*irq_postinstall)(struct drm_device *dev);
678 void (*irq_uninstall)(struct drm_device *dev);

--- 24 unchanged lines hidden (view full) ---

703
704 int major;
705 int minor;
706 int patchlevel;
707 const char *name; /* Simple driver name */
708 const char *desc; /* Longer driver name */
709 const char *date; /* Date of last major changes. */
710
572 int (*context_ctor)(struct drm_device *dev, int context);
573 int (*context_dtor)(struct drm_device *dev, int context);
574 int (*kernel_context_switch)(struct drm_device *dev, int old,
575 int new);
576 int (*kernel_context_switch_unlock)(struct drm_device *dev);
577 void (*irq_preinstall)(struct drm_device *dev);
578 int (*irq_postinstall)(struct drm_device *dev);
579 void (*irq_uninstall)(struct drm_device *dev);

--- 24 unchanged lines hidden (view full) ---

604
605 int major;
606 int minor;
607 int patchlevel;
608 const char *name; /* Simple driver name */
609 const char *desc; /* Longer driver name */
610 const char *date; /* Date of last major changes. */
611
711 unsigned use_agp :1;
712 unsigned require_agp :1;
713 unsigned use_sg :1;
714 unsigned use_dma :1;
715 unsigned use_pci_dma :1;
716 unsigned use_dma_queue :1;
717 unsigned use_irq :1;
718 unsigned use_vbl_irq :1;
719 unsigned use_vbl_irq2 :1;
720 unsigned use_mtrr :1;
612 u32 driver_features;
721};
722
723/* Length for the array of resource pointers for drm_get_resource_*. */
724#define DRM_MAX_PCI_RESOURCE 3
725
726/**
727 * DRM device functions structure
728 */
729struct drm_device {
613};
614
615/* Length for the array of resource pointers for drm_get_resource_*. */
616#define DRM_MAX_PCI_RESOURCE 3
617
618/**
619 * DRM device functions structure
620 */
621struct drm_device {
730#if defined(__NetBSD__) || defined(__OpenBSD__)
731 struct device device; /* softc is an extension of struct device */
732#endif
733
734 struct drm_driver_info driver;
622 struct drm_driver_info *driver;
735 drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */
736
737 u_int16_t pci_device; /* PCI device id */
738 u_int16_t pci_vendor; /* PCI vendor id */
739
740 char *unique; /* Unique identifier: e.g., busid */
741 int unique_len; /* Length of unique field */
623 drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */
624
625 u_int16_t pci_device; /* PCI device id */
626 u_int16_t pci_vendor; /* PCI vendor id */
627
628 char *unique; /* Unique identifier: e.g., busid */
629 int unique_len; /* Length of unique field */
742#ifdef __FreeBSD__
743 device_t device; /* Device instance from newbus */
630 device_t device; /* Device instance from newbus */
744#endif
745 struct cdev *devnode; /* Device number for mknod */
746 int if_version; /* Highest interface version set */
747
748 int flags; /* Flags to open(2) */
749
750 /* Locks */
631 struct cdev *devnode; /* Device number for mknod */
632 int if_version; /* Highest interface version set */
633
634 int flags; /* Flags to open(2) */
635
636 /* Locks */
751#if defined(__FreeBSD__) && __FreeBSD_version > 500000
752 struct mtx vbl_lock; /* protects vblank operations */
753 struct mtx dma_lock; /* protects dev->dma */
754 struct mtx irq_lock; /* protects irq condition checks */
755 struct mtx dev_lock; /* protects everything else */
637 struct mtx vbl_lock; /* protects vblank operations */
638 struct mtx dma_lock; /* protects dev->dma */
639 struct mtx irq_lock; /* protects irq condition checks */
640 struct mtx dev_lock; /* protects everything else */
756#endif
757 DRM_SPINTYPE drw_lock;
758 DRM_SPINTYPE tsk_lock;
759
760 /* Usage Counters */
761 int open_count; /* Outstanding files open */
762 int buf_use; /* Buffers in use -- cannot alloc */
763
764 /* Performance counters */
765 unsigned long counters;
641 DRM_SPINTYPE drw_lock;
642 DRM_SPINTYPE tsk_lock;
643
644 /* Usage Counters */
645 int open_count; /* Outstanding files open */
646 int buf_use; /* Buffers in use -- cannot alloc */
647
648 /* Performance counters */
649 unsigned long counters;
766 drm_stat_type_t types[15];
650 enum drm_stat_type types[15];
767 atomic_t counts[15];
768
769 /* Authentication */
770 drm_file_list_t files;
771 drm_magic_head_t magiclist[DRM_HASH_SIZE];
772
773 /* Linked list of mappable regions. Protected by dev_lock */
774 drm_map_list_t maplist;

--- 4 unchanged lines hidden (view full) ---

779 drm_lock_data_t lock; /* Information on hardware lock */
780
781 /* DMA queues (contexts) */
782 drm_device_dma_t *dma; /* Optional pointer for DMA support */
783
784 /* Context support */
785 int irq; /* Interrupt used by board */
786 int irq_enabled; /* True if the irq handler is enabled */
651 atomic_t counts[15];
652
653 /* Authentication */
654 drm_file_list_t files;
655 drm_magic_head_t magiclist[DRM_HASH_SIZE];
656
657 /* Linked list of mappable regions. Protected by dev_lock */
658 drm_map_list_t maplist;

--- 4 unchanged lines hidden (view full) ---

663 drm_lock_data_t lock; /* Information on hardware lock */
664
665 /* DMA queues (contexts) */
666 drm_device_dma_t *dma; /* Optional pointer for DMA support */
667
668 /* Context support */
669 int irq; /* Interrupt used by board */
670 int irq_enabled; /* True if the irq handler is enabled */
787#ifdef __FreeBSD__
788 int irqrid; /* Interrupt used by board */
789 struct resource *irqr; /* Resource for interrupt used by board */
671 int irqrid; /* Interrupt used by board */
672 struct resource *irqr; /* Resource for interrupt used by board */
790#elif defined(__NetBSD__) || defined(__OpenBSD__)
791 struct pci_attach_args pa;
792#endif
793 void *irqh; /* Handle from bus_setup_intr */
794
795 /* Storage of resource pointers for drm_get_resource_* */
796 struct resource *pcir[DRM_MAX_PCI_RESOURCE];
797 int pcirid[DRM_MAX_PCI_RESOURCE];
798
799 int pci_domain;
800 int pci_bus;

--- 5 unchanged lines hidden (view full) ---

806
807 int vblank_disable_allowed;
808 atomic_t vbl_signal_pending; /* number of signals pending on all crtcs */
809 struct callout vblank_disable_timer;
810 u32 max_vblank_count; /* size of vblank counter register */
811 struct drm_vblank_info *vblank; /* per crtc vblank info */
812 int num_crtcs;
813
673 void *irqh; /* Handle from bus_setup_intr */
674
675 /* Storage of resource pointers for drm_get_resource_* */
676 struct resource *pcir[DRM_MAX_PCI_RESOURCE];
677 int pcirid[DRM_MAX_PCI_RESOURCE];
678
679 int pci_domain;
680 int pci_bus;

--- 5 unchanged lines hidden (view full) ---

686
687 int vblank_disable_allowed;
688 atomic_t vbl_signal_pending; /* number of signals pending on all crtcs */
689 struct callout vblank_disable_timer;
690 u32 max_vblank_count; /* size of vblank counter register */
691 struct drm_vblank_info *vblank; /* per crtc vblank info */
692 int num_crtcs;
693
814#ifdef __FreeBSD__
815 struct sigio *buf_sigio; /* Processes waiting for SIGIO */
694 struct sigio *buf_sigio; /* Processes waiting for SIGIO */
816#elif defined(__NetBSD__)
817 pid_t buf_pgid;
818#endif
819
820 /* Sysctl support */
821 struct drm_sysctl_info *sysctl;
822
823 drm_agp_head_t *agp;
824 drm_sg_mem_t *sg; /* Scatter gather memory */
825 atomic_t *ctx_bitmap;
826 void *dev_private;
827 unsigned int agp_buffer_token;
828 drm_local_map_t *agp_buffer_map;
829
830 struct unrhdr *drw_unrhdr;
831 /* RB tree of drawable infos */
832 RB_HEAD(drawable_tree, bsd_drm_drawable_info) drw_head;
833
834 struct task locked_task;
835 void (*locked_task_call)(struct drm_device *dev);
836};
837
695
696 /* Sysctl support */
697 struct drm_sysctl_info *sysctl;
698
699 drm_agp_head_t *agp;
700 drm_sg_mem_t *sg; /* Scatter gather memory */
701 atomic_t *ctx_bitmap;
702 void *dev_private;
703 unsigned int agp_buffer_token;
704 drm_local_map_t *agp_buffer_map;
705
706 struct unrhdr *drw_unrhdr;
707 /* RB tree of drawable infos */
708 RB_HEAD(drawable_tree, bsd_drm_drawable_info) drw_head;
709
710 struct task locked_task;
711 void (*locked_task_call)(struct drm_device *dev);
712};
713
714static __inline__ int drm_core_check_feature(struct drm_device *dev,
715 int feature)
716{
717 return ((dev->driver->driver_features & feature) ? 1 : 0);
718}
719
720#if __OS_HAS_AGP
721static inline int drm_core_has_AGP(struct drm_device *dev)
722{
723 return drm_core_check_feature(dev, DRIVER_USE_AGP);
724}
725#else
726#define drm_core_has_AGP(dev) (0)
727#endif
728
838extern int drm_debug_flag;
839
840/* Device setup support (drm_drv.c) */
729extern int drm_debug_flag;
730
731/* Device setup support (drm_drv.c) */
841#ifdef __FreeBSD__
842int drm_probe(device_t nbdev, drm_pci_id_list_t *idlist);
843int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist);
732int drm_probe(device_t nbdev, drm_pci_id_list_t *idlist);
733int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist);
734void drm_close(void *data);
844int drm_detach(device_t nbdev);
845d_ioctl_t drm_ioctl;
846d_open_t drm_open;
735int drm_detach(device_t nbdev);
736d_ioctl_t drm_ioctl;
737d_open_t drm_open;
847d_close_t drm_close;
848d_read_t drm_read;
849d_poll_t drm_poll;
850d_mmap_t drm_mmap;
738d_read_t drm_read;
739d_poll_t drm_poll;
740d_mmap_t drm_mmap;
851#elif defined(__NetBSD__) || defined(__OpenBSD__)
852int drm_probe(struct pci_attach_args *pa, drm_pci_id_list_t *idlist);
853int drm_attach(struct pci_attach_args *pa, dev_t kdev, drm_pci_id_list_t *idlist);
854dev_type_ioctl(drm_ioctl);
855dev_type_open(drm_open);
856dev_type_close(drm_close);
857dev_type_read(drm_read);
858dev_type_poll(drm_poll);
859dev_type_mmap(drm_mmap);
860#endif
861extern drm_local_map_t *drm_getsarea(struct drm_device *dev);
862
863/* File operations helpers (drm_fops.c) */
741extern drm_local_map_t *drm_getsarea(struct drm_device *dev);
742
743/* File operations helpers (drm_fops.c) */
864#ifdef __FreeBSD__
865extern int drm_open_helper(struct cdev *kdev, int flags, int fmt,
866 DRM_STRUCTPROC *p,
867 struct drm_device *dev);
744extern int drm_open_helper(struct cdev *kdev, int flags, int fmt,
745 DRM_STRUCTPROC *p,
746 struct drm_device *dev);
868extern drm_file_t *drm_find_file_by_proc(struct drm_device *dev,
869 DRM_STRUCTPROC *p);
870#elif defined(__NetBSD__) || defined(__OpenBSD__)
871extern int drm_open_helper(dev_t kdev, int flags, int fmt,
872 DRM_STRUCTPROC *p,
873 struct drm_device *dev);
874extern drm_file_t *drm_find_file_by_proc(struct drm_device *dev,
875 DRM_STRUCTPROC *p);
876#endif /* __NetBSD__ || __OpenBSD__ */
877
878/* Memory management support (drm_memory.c) */
879void drm_mem_init(void);
880void drm_mem_uninit(void);
881void *drm_alloc(size_t size, int area);
882void *drm_calloc(size_t nmemb, size_t size, int area);
883void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
884 int area);
885void drm_free(void *pt, size_t size, int area);
747
748/* Memory management support (drm_memory.c) */
749void drm_mem_init(void);
750void drm_mem_uninit(void);
751void *drm_alloc(size_t size, int area);
752void *drm_calloc(size_t nmemb, size_t size, int area);
753void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
754 int area);
755void drm_free(void *pt, size_t size, int area);
756void *drm_ioremap_wc(struct drm_device *dev, drm_local_map_t *map);
886void *drm_ioremap(struct drm_device *dev, drm_local_map_t *map);
887void drm_ioremapfree(drm_local_map_t *map);
888int drm_mtrr_add(unsigned long offset, size_t size, int flags);
889int drm_mtrr_del(int handle, unsigned long offset, size_t size, int flags);
890
891int drm_context_switch(struct drm_device *dev, int old, int new);
892int drm_context_switch_complete(struct drm_device *dev, int new);
893
894int drm_ctxbitmap_init(struct drm_device *dev);
895void drm_ctxbitmap_cleanup(struct drm_device *dev);
896void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
897int drm_ctxbitmap_next(struct drm_device *dev);
898
899/* Locking IOCTL support (drm_lock.c) */
757void *drm_ioremap(struct drm_device *dev, drm_local_map_t *map);
758void drm_ioremapfree(drm_local_map_t *map);
759int drm_mtrr_add(unsigned long offset, size_t size, int flags);
760int drm_mtrr_del(int handle, unsigned long offset, size_t size, int flags);
761
762int drm_context_switch(struct drm_device *dev, int old, int new);
763int drm_context_switch_complete(struct drm_device *dev, int new);
764
765int drm_ctxbitmap_init(struct drm_device *dev);
766void drm_ctxbitmap_cleanup(struct drm_device *dev);
767void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
768int drm_ctxbitmap_next(struct drm_device *dev);
769
770/* Locking IOCTL support (drm_lock.c) */
900int drm_lock_take(__volatile__ unsigned int *lock,
901 unsigned int context);
902int drm_lock_transfer(struct drm_device *dev,
903 __volatile__ unsigned int *lock,
771int drm_lock_take(struct drm_lock_data *lock_data,
772 unsigned int context);
773int drm_lock_transfer(struct drm_lock_data *lock_data,
904 unsigned int context);
774 unsigned int context);
905int drm_lock_free(struct drm_device *dev,
906 __volatile__ unsigned int *lock,
775int drm_lock_free(struct drm_lock_data *lock_data,
907 unsigned int context);
908
909/* Buffer management support (drm_bufs.c) */
910unsigned long drm_get_resource_start(struct drm_device *dev,
911 unsigned int resource);
912unsigned long drm_get_resource_len(struct drm_device *dev,
913 unsigned int resource);
914void drm_rmmap(struct drm_device *dev, drm_local_map_t *map);
915int drm_order(unsigned long size);
916int drm_addmap(struct drm_device *dev, unsigned long offset,
917 unsigned long size,
776 unsigned int context);
777
778/* Buffer management support (drm_bufs.c) */
779unsigned long drm_get_resource_start(struct drm_device *dev,
780 unsigned int resource);
781unsigned long drm_get_resource_len(struct drm_device *dev,
782 unsigned int resource);
783void drm_rmmap(struct drm_device *dev, drm_local_map_t *map);
784int drm_order(unsigned long size);
785int drm_addmap(struct drm_device *dev, unsigned long offset,
786 unsigned long size,
918 drm_map_type_t type, drm_map_flags_t flags,
787 enum drm_map_type type, enum drm_map_flags flags,
919 drm_local_map_t **map_ptr);
788 drm_local_map_t **map_ptr);
920int drm_addbufs_pci(struct drm_device *dev, drm_buf_desc_t *request);
921int drm_addbufs_sg(struct drm_device *dev, drm_buf_desc_t *request);
922int drm_addbufs_agp(struct drm_device *dev, drm_buf_desc_t *request);
789int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *request);
790int drm_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *request);
791int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *request);
923
924/* DMA support (drm_dma.c) */
925int drm_dma_setup(struct drm_device *dev);
926void drm_dma_takedown(struct drm_device *dev);
927void drm_free_buffer(struct drm_device *dev, drm_buf_t *buf);
928void drm_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv);
929#define drm_core_reclaim_buffers drm_reclaim_buffers
930

--- 15 unchanged lines hidden (view full) ---

946 struct drm_file *file_priv);
947
948/* AGP/PCI Express/GART support (drm_agpsupport.c) */
949int drm_device_is_agp(struct drm_device *dev);
950int drm_device_is_pcie(struct drm_device *dev);
951drm_agp_head_t *drm_agp_init(void);
952int drm_agp_acquire(struct drm_device *dev);
953int drm_agp_release(struct drm_device *dev);
792
793/* DMA support (drm_dma.c) */
794int drm_dma_setup(struct drm_device *dev);
795void drm_dma_takedown(struct drm_device *dev);
796void drm_free_buffer(struct drm_device *dev, drm_buf_t *buf);
797void drm_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv);
798#define drm_core_reclaim_buffers drm_reclaim_buffers
799

--- 15 unchanged lines hidden (view full) ---

815 struct drm_file *file_priv);
816
817/* AGP/PCI Express/GART support (drm_agpsupport.c) */
818int drm_device_is_agp(struct drm_device *dev);
819int drm_device_is_pcie(struct drm_device *dev);
820drm_agp_head_t *drm_agp_init(void);
821int drm_agp_acquire(struct drm_device *dev);
822int drm_agp_release(struct drm_device *dev);
954int drm_agp_info(struct drm_device * dev, drm_agp_info_t *info);
955int drm_agp_enable(struct drm_device *dev, drm_agp_mode_t mode);
823int drm_agp_info(struct drm_device * dev, struct drm_agp_info *info);
824int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
956void *drm_agp_allocate_memory(size_t pages, u32 type);
957int drm_agp_free_memory(void *handle);
958int drm_agp_bind_memory(void *handle, off_t start);
959int drm_agp_unbind_memory(void *handle);
825void *drm_agp_allocate_memory(size_t pages, u32 type);
826int drm_agp_free_memory(void *handle);
827int drm_agp_bind_memory(void *handle, off_t start);
828int drm_agp_unbind_memory(void *handle);
960int drm_agp_alloc(struct drm_device *dev, drm_agp_buffer_t *request);
961int drm_agp_free(struct drm_device *dev, drm_agp_buffer_t *request);
962int drm_agp_bind(struct drm_device *dev, drm_agp_binding_t *request);
963int drm_agp_unbind(struct drm_device *dev, drm_agp_binding_t *request);
829int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
830int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
831int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
832int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
964
965/* Scatter Gather Support (drm_scatter.c) */
966void drm_sg_cleanup(drm_sg_mem_t *entry);
833
834/* Scatter Gather Support (drm_scatter.c) */
835void drm_sg_cleanup(drm_sg_mem_t *entry);
967int drm_sg_alloc(struct drm_device *dev, drm_scatter_gather_t * request);
836int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request);
968
837
969#ifdef __FreeBSD__
970/* sysctl support (drm_sysctl.h) */
971extern int drm_sysctl_init(struct drm_device *dev);
972extern int drm_sysctl_cleanup(struct drm_device *dev);
838/* sysctl support (drm_sysctl.h) */
839extern int drm_sysctl_init(struct drm_device *dev);
840extern int drm_sysctl_cleanup(struct drm_device *dev);
973#endif /* __FreeBSD__ */
974
975/* ATI PCIGART support (ati_pcigart.c) */
976int drm_ati_pcigart_init(struct drm_device *dev,
977 struct drm_ati_pcigart_info *gart_info);
978int drm_ati_pcigart_cleanup(struct drm_device *dev,
979 struct drm_ati_pcigart_info *gart_info);
980
981/* Locking IOCTL support (drm_drv.c) */

--- 21 unchanged lines hidden (view full) ---

1003 struct drm_file *file_priv);
1004int drm_noop(struct drm_device *dev, void *data,
1005 struct drm_file *file_priv);
1006
1007/* Context IOCTL support (drm_context.c) */
1008int drm_resctx(struct drm_device *dev, void *data,
1009 struct drm_file *file_priv);
1010int drm_addctx(struct drm_device *dev, void *data,
841
842/* ATI PCIGART support (ati_pcigart.c) */
843int drm_ati_pcigart_init(struct drm_device *dev,
844 struct drm_ati_pcigart_info *gart_info);
845int drm_ati_pcigart_cleanup(struct drm_device *dev,
846 struct drm_ati_pcigart_info *gart_info);
847
848/* Locking IOCTL support (drm_drv.c) */

--- 21 unchanged lines hidden (view full) ---

870 struct drm_file *file_priv);
871int drm_noop(struct drm_device *dev, void *data,
872 struct drm_file *file_priv);
873
874/* Context IOCTL support (drm_context.c) */
875int drm_resctx(struct drm_device *dev, void *data,
876 struct drm_file *file_priv);
877int drm_addctx(struct drm_device *dev, void *data,
1011struct drm_file *file_priv);
878 struct drm_file *file_priv);
1012int drm_modctx(struct drm_device *dev, void *data,
1013 struct drm_file *file_priv);
1014int drm_getctx(struct drm_device *dev, void *data,
1015 struct drm_file *file_priv);
1016int drm_switchctx(struct drm_device *dev, void *data,
1017 struct drm_file *file_priv);
1018int drm_newctx(struct drm_device *dev, void *data,
1019 struct drm_file *file_priv);

--- 38 unchanged lines hidden (view full) ---

1058 struct drm_file *file_priv);
1059int drm_mapbufs(struct drm_device *dev, void *data,
1060 struct drm_file *file_priv);
1061
1062/* DMA support (drm_dma.c) */
1063int drm_dma(struct drm_device *dev, void *data, struct drm_file *file_priv);
1064
1065/* IRQ support (drm_irq.c) */
879int drm_modctx(struct drm_device *dev, void *data,
880 struct drm_file *file_priv);
881int drm_getctx(struct drm_device *dev, void *data,
882 struct drm_file *file_priv);
883int drm_switchctx(struct drm_device *dev, void *data,
884 struct drm_file *file_priv);
885int drm_newctx(struct drm_device *dev, void *data,
886 struct drm_file *file_priv);

--- 38 unchanged lines hidden (view full) ---

925 struct drm_file *file_priv);
926int drm_mapbufs(struct drm_device *dev, void *data,
927 struct drm_file *file_priv);
928
929/* DMA support (drm_dma.c) */
930int drm_dma(struct drm_device *dev, void *data, struct drm_file *file_priv);
931
932/* IRQ support (drm_irq.c) */
1066int drm_control(struct drm_device *dev, void *data, struct drm_file *file_priv);
933int drm_control(struct drm_device *dev, void *data,
934 struct drm_file *file_priv);
1067int drm_wait_vblank(struct drm_device *dev, void *data,
1068 struct drm_file *file_priv);
1069void drm_locked_tasklet(struct drm_device *dev,
1070 void (*tasklet)(struct drm_device *dev));
1071
1072/* AGP/GART support (drm_agpsupport.c) */
1073int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
1074 struct drm_file *file_priv);

--- 18 unchanged lines hidden (view full) ---

1093int drm_sg_free(struct drm_device *dev, void *data,
1094 struct drm_file *file_priv);
1095
1096/* consistent PCI memory functions (drm_pci.c) */
1097drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
1098 size_t align, dma_addr_t maxaddr);
1099void drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah);
1100
935int drm_wait_vblank(struct drm_device *dev, void *data,
936 struct drm_file *file_priv);
937void drm_locked_tasklet(struct drm_device *dev,
938 void (*tasklet)(struct drm_device *dev));
939
940/* AGP/GART support (drm_agpsupport.c) */
941int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
942 struct drm_file *file_priv);

--- 18 unchanged lines hidden (view full) ---

961int drm_sg_free(struct drm_device *dev, void *data,
962 struct drm_file *file_priv);
963
964/* consistent PCI memory functions (drm_pci.c) */
965drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
966 size_t align, dma_addr_t maxaddr);
967void drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah);
968
1101#define drm_core_ioremap_wc drm_core_ioremap
1102
1103/* Inline replacements for DRM_IOREMAP macros */
1104static __inline__ void
969/* Inline replacements for DRM_IOREMAP macros */
970static __inline__ void
971drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev)
972{
973 map->handle = drm_ioremap_wc(dev, map);
974}
975static __inline__ void
1105drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
1106{
1107 map->handle = drm_ioremap(dev, map);
1108}
1109static __inline__ void
1110drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
1111{
1112 if ( map->handle && map->size )

--- 22 unchanged lines hidden ---
976drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
977{
978 map->handle = drm_ioremap(dev, map);
979}
980static __inline__ void
981drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
982{
983 if ( map->handle && map->size )

--- 22 unchanged lines hidden ---