1 /* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
2 * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
5 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
6 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
29 * Rickard E. (Rik) Faith <faith@valinux.com>
30 * Gareth Hughes <gareth@valinux.com>
37 #if defined(_KERNEL) || defined(__KERNEL__)
42 #if defined(__NetBSD__) && defined(_KERNEL_OPT)
46 #include <sys/param.h>
47 #include <sys/queue.h>
48 #include <sys/malloc.h>
49 #include <sys/kernel.h>
50 #include <sys/module.h>
51 #include <sys/systm.h>
54 #if __FreeBSD_version >= 700000
59 #include <sys/fcntl.h>
61 #include <sys/filio.h>
62 #include <sys/sysctl.h>
64 #include <sys/signalvar.h>
70 #include <vm/vm_extern.h>
71 #include <vm/vm_map.h>
72 #include <vm/vm_param.h>
73 #include <machine/resource.h>
74 #include <machine/param.h>
76 #include <machine/pmap.h>
77 #include <machine/bus.h>
78 #if defined(__i386__) || defined(__x86_64__)
79 #include <machine/specialreg.h>
80 #include <machine/sysarch.h>
82 #include <sys/endian.h>
84 #if defined( __FreeBSD__)
86 #include <sys/memrange.h>
87 #if __FreeBSD_version >= 800004
88 #include <dev/agp/agpvar.h>
89 #else /* __FreeBSD_version >= 800004 */
90 #include <pci/agpvar.h>
91 #endif /* __FreeBSD_version >= 800004 */
92 #include <sys/agpio.h>
93 #include <sys/mutex.h>
94 #include <dev/pci/pcivar.h>
95 #include <dev/pci/pcireg.h>
96 #include <sys/selinfo.h>
98 #elif defined(__NetBSD__)
99 #if defined(__i386__) || defined(__x86_64__)
100 #include <machine/mtrr.h>
102 #include <sys/vnode.h>
103 #include <sys/select.h>
104 #include <sys/device.h>
105 #include <sys/resourcevar.h>
106 #include <sys/agpio.h>
107 #include <sys/ttycom.h>
108 #include <sys/mman.h>
109 #include <sys/kauth.h>
110 #include <sys/types.h>
111 #include <sys/file.h>
112 #include <sys/atomic.h>
113 #include <sys/workqueue.h>
115 #include <dev/pci/pcireg.h>
116 #include <dev/pci/pcivar.h>
117 #include <dev/pci/agpvar.h>
121 #include "drm_linux_list.h"
122 #include "drm_atomic.h"
123 #include "drm_internal.h"
131 #define DRM_DEBUG_DEFAULT_ON 1
132 #endif /* DRM_DEBUG */
135 #define DRM_KASSERT(x,y) KASSERT(x,y)
137 #define DRM_KASSERT(x,y) KASSERT(x)
138 #define device_get_softc(x) device_private(x)
139 #define callout_deactivate(x) callout_stop(x)
140 #define callout_drain(x) callout_stop(x)
143 #if defined(DRM_LINUX) && DRM_LINUX && !defined(__amd64__)
144 #include <sys/file.h>
145 #include <sys/proc.h>
146 #include <machine/../linux/linux.h>
147 #include <machine/../linux/linux_proto.h>
149 /* Either it was defined when it shouldn't be (FreeBSD amd64) or it isn't
150 * supported on this OS yet.
156 /* driver capabilities and requirements mask */
157 #define DRIVER_USE_AGP 0x1
158 #define DRIVER_REQUIRE_AGP 0x2
159 #define DRIVER_USE_MTRR 0x4
160 #define DRIVER_PCI_DMA 0x8
161 #define DRIVER_SG 0x10
162 #define DRIVER_HAVE_DMA 0x20
163 #define DRIVER_HAVE_IRQ 0x40
164 #define DRIVER_DMA_QUEUE 0x100
167 #define DRM_HASH_SIZE 16 /* Size of key hash table */
168 #define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
169 #define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */
171 MALLOC_DECLARE(DRM_MEM_DMA
);
172 MALLOC_DECLARE(DRM_MEM_SAREA
);
173 MALLOC_DECLARE(DRM_MEM_DRIVER
);
174 MALLOC_DECLARE(DRM_MEM_MAGIC
);
175 MALLOC_DECLARE(DRM_MEM_IOCTLS
);
176 MALLOC_DECLARE(DRM_MEM_MAPS
);
177 MALLOC_DECLARE(DRM_MEM_BUFS
);
178 MALLOC_DECLARE(DRM_MEM_SEGS
);
179 MALLOC_DECLARE(DRM_MEM_PAGES
);
180 MALLOC_DECLARE(DRM_MEM_FILES
);
181 MALLOC_DECLARE(DRM_MEM_QUEUES
);
182 MALLOC_DECLARE(DRM_MEM_CMDS
);
183 MALLOC_DECLARE(DRM_MEM_MAPPINGS
);
184 MALLOC_DECLARE(DRM_MEM_BUFLISTS
);
185 MALLOC_DECLARE(DRM_MEM_AGPLISTS
);
186 MALLOC_DECLARE(DRM_MEM_CTXBITMAP
);
187 MALLOC_DECLARE(DRM_MEM_SGLISTS
);
188 MALLOC_DECLARE(DRM_MEM_DRAWABLE
);
190 #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
192 /* Internal types and structures */
193 #define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
194 #define DRM_MIN(a,b) ((a)<(b)?(a):(b))
195 #define DRM_MAX(a,b) ((a)>(b)?(a):(b))
197 #define DRM_IF_VERSION(maj, min) (maj << 16 | min)
199 #define __OS_HAS_AGP 1
201 #define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
202 #define DRM_DEV_UID 0
203 #define DRM_DEV_GID 0
205 #define wait_queue_head_t atomic_t
206 #define DRM_WAKEUP(w) wakeup((void *)w)
207 #define DRM_WAKEUP_INT(w) wakeup(w)
208 #define DRM_INIT_WAITQUEUE(queue) do {(void)(queue);} while (0)
210 #if defined(__FreeBSD__)
211 #define DRM_CDEV struct cdev *
212 #define DRM_CURPROC curthread
213 #define DRM_STRUCTPROC struct thread
214 #define DRM_STRUCTCDEVPROC struct thread
215 #define DRM_CDEVPROC_REAL(p) (p)
216 #define DRM_IOCTL_DATA caddr_t
217 #define DRM_SPINTYPE struct mtx
218 #define DRM_SPININIT(l,name) mtx_init(l, name, NULL, MTX_DEF)
219 #define DRM_SPINUNINIT(l) mtx_destroy(l)
220 #define DRM_SPINLOCK(l) mtx_lock(l)
221 #define DRM_SPINUNLOCK(u) mtx_unlock(u)
222 #define DRM_SPINLOCK_IRQSAVE(l, irqflags) do { \
226 #define DRM_SPINUNLOCK_IRQRESTORE(u, irqflags) mtx_unlock(u)
227 #define DRM_SPINLOCK_ASSERT(l) mtx_assert(l, MA_OWNED)
228 #define DRM_CURRENTPID curthread->td_proc->p_pid
229 #define DRM_LOCK() mtx_lock(&dev->dev_lock)
230 #define DRM_UNLOCK() mtx_unlock(&dev->dev_lock)
231 #define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS)
232 #elif defined(__NetBSD__)
233 #define DRM_CDEV dev_t
234 #define DRM_CURPROC curproc
235 #define DRM_STRUCTPROC struct proc
236 #define DRM_STRUCTCDEVPROC struct lwp
237 #define DRM_CDEVPROC_REAL(l) (l)->l_proc
238 #define DRM_IOCTL_DATA void *
239 #define DRM_SPINTYPE kmutex_t
240 #define DRM_SPININIT(l,name) mutex_init(l, MUTEX_DEFAULT, /*IPL_NONE*/ IPL_VM)
241 #define DRM_SPINUNINIT(l) mutex_destroy(l)
242 #define DRM_SPINLOCK(l) mutex_enter(l)
243 #define DRM_SPINUNLOCK(u) mutex_exit(u)
244 #define DRM_SPINLOCK_IRQSAVE(l, irqflags) do { \
248 #define DRM_SPINUNLOCK_IRQRESTORE(u, irqflags) mutex_exit(u)
249 #define DRM_SPINLOCK_ASSERT(l) mutex_owned(l)
250 #define DRM_CURRENTPID curproc->p_pid
251 #define DRM_LOCK() DRM_SPINLOCK(&dev->dev_lock)
252 #define DRM_UNLOCK() DRM_SPINUNLOCK(&dev->dev_lock)
253 #define DRM_SYSCTL_HANDLER_ARGS (SYSCTLFN_ARGS)
254 #define vslock(addr, len) uvm_vslock(curproc->p_vmspace, addr, len, VM_PROT_READ | VM_PROT_WRITE)
255 #define vsunlock(addr, len) uvm_vsunlock(curproc->p_vmspace, addr, len)
258 #define DRM_IRQ_ARGS void *arg
259 #if defined(__FreeBSD__)
260 typedef void irqreturn_t
;
261 #define IRQ_HANDLED /* nothing */
262 #define IRQ_NONE /* nothing */
263 #elif defined(__NetBSD__)
264 typedef int irqreturn_t
;
265 #define IRQ_HANDLED 1
274 #define DRM_AGP_MEM struct agp_memory_info
276 #if defined(__FreeBSD__)
277 #define drm_get_device_from_kdev(_kdev) (_kdev->si_drv1)
278 #elif defined(__NetBSD__)
279 #define drm_get_device_from_kdev(_kdev) ((minor(_kdev) < DRM_MAXUNITS) ? \
280 drm_units[minor(_kdev)] : NULL)
283 #if defined(__FreeBSD__)
284 #define PAGE_ALIGN(addr) round_page(addr)
285 /* DRM_SUSER returns true if the user is superuser */
286 #if __FreeBSD_version >= 700000
287 #define DRM_SUSER(p) (priv_check(p, PRIV_DRIVER) == 0)
289 #define DRM_SUSER(p) (suser(p) == 0)
291 #define DRM_AGP_FIND_DEVICE() agp_find_device()
292 #define DRM_MTRR_WC MDF_WRITECOMBINE
293 #define jiffies ticks
295 #elif defined(__NetBSD__)
297 #define PAGE_ALIGN(addr) ALIGN(addr)
298 #define DRM_SUSER(p) (kauth_cred_getsvuid((p)->p_cred) == 0)
299 #define DRM_AGP_FIND_DEVICE() agp_find_device(0)
301 #define DRM_MTRR_WC MTRR_TYPE_WC
303 #define DRM_MTRR_WC 0
305 #define jiffies hardclock_ticks
307 #define DRM_MAXUNITS 128
308 extern struct drm_device
*drm_units
[];
312 /* Capabilities taken from src/sys/dev/pci/pcireg.h. */
314 #define PCIY_AGP 0x02
318 #define PCIY_EXPRESS 0x10
321 typedef unsigned long dma_addr_t
;
322 #if defined(__FreeBSD__)
323 typedef u_int64_t u64
;
324 typedef u_int32_t u32
;
325 typedef u_int16_t u16
;
328 typedef uint64_t u64
;
329 typedef uint32_t u32
;
330 typedef uint16_t u16
;
334 /* DRM_READMEMORYBARRIER() prevents reordering of reads.
335 * DRM_WRITEMEMORYBARRIER() prevents reordering of writes.
336 * DRM_MEMORYBARRIER() prevents reordering of reads and writes.
338 #if defined(__NetBSD__)
339 #define DRM_READMEMORYBARRIER() membar_consumer()
340 #define DRM_WRITEMEMORYBARRIER() membar_producer()
341 #define DRM_MEMORYBARRIER() membar_sync()
342 #elif defined(__i386__)
343 #define DRM_READMEMORYBARRIER() __asm __volatile( \
344 "lock; addl $0,0(%%esp)" : : : "memory");
345 #define DRM_WRITEMEMORYBARRIER() __asm __volatile("" : : : "memory");
346 #define DRM_MEMORYBARRIER() __asm __volatile( \
347 "lock; addl $0,0(%%esp)" : : : "memory");
348 #elif defined(__alpha__)
349 #define DRM_READMEMORYBARRIER() alpha_mb();
350 #define DRM_WRITEMEMORYBARRIER() alpha_wmb();
351 #define DRM_MEMORYBARRIER() alpha_mb();
352 #elif defined(__amd64__)
353 #define DRM_READMEMORYBARRIER() __asm __volatile( \
354 "lock; addl $0,0(%%rsp)" : : : "memory");
355 #define DRM_WRITEMEMORYBARRIER() __asm __volatile("" : : : "memory");
356 #define DRM_MEMORYBARRIER() __asm __volatile( \
357 "lock; addl $0,0(%%rsp)" : : : "memory");
360 #if defined(__FreeBSD__)
362 #define DRM_READ8(map, offset) \
363 *(volatile u_int8_t *)(((vm_offset_t)(map)->handle) + \
364 (vm_offset_t)(offset))
365 #define DRM_READ16(map, offset) \
366 *(volatile u_int16_t *)(((vm_offset_t)(map)->handle) + \
367 (vm_offset_t)(offset))
368 #define DRM_READ32(map, offset) \
369 *(volatile u_int32_t *)(((vm_offset_t)(map)->handle) + \
370 (vm_offset_t)(offset))
371 #define DRM_WRITE8(map, offset, val) \
372 *(volatile u_int8_t *)(((vm_offset_t)(map)->handle) + \
373 (vm_offset_t)(offset)) = val
374 #define DRM_WRITE16(map, offset, val) \
375 *(volatile u_int16_t *)(((vm_offset_t)(map)->handle) + \
376 (vm_offset_t)(offset)) = val
377 #define DRM_WRITE32(map, offset, val) \
378 *(volatile u_int32_t *)(((vm_offset_t)(map)->handle) + \
379 (vm_offset_t)(offset)) = val
381 #define DRM_VERIFYAREA_READ( uaddr, size ) \
382 (!useracc(__DECONST(caddr_t, uaddr), size, VM_PROT_READ))
384 #elif defined(__NetBSD__)
386 typedef vaddr_t vm_offset_t
;
388 #define DRM_READ8(map, offset) \
389 bus_space_read_1( (map)->bst, (map)->bsh, (offset))
390 #define DRM_READ16(map, offset) \
391 bus_space_read_2( (map)->bst, (map)->bsh, (offset))
392 #define DRM_READ32(map, offset) \
393 bus_space_read_4( (map)->bst, (map)->bsh, (offset))
394 #define DRM_WRITE8(map, offset, val) \
395 bus_space_write_1((map)->bst, (map)->bsh, (offset), (val))
396 #define DRM_WRITE16(map, offset, val) \
397 bus_space_write_2((map)->bst, (map)->bsh, (offset), (val))
398 #define DRM_WRITE32(map, offset, val) \
399 bus_space_write_4((map)->bst, (map)->bsh, (offset), (val))
401 #define DRM_VERIFYAREA_READ( uaddr, size ) \
402 (!uvm_map_checkprot(&(curproc->p_vmspace->vm_map), \
403 (vaddr_t)uaddr, (vaddr_t)uaddr+size, UVM_PROT_READ))
407 #define DRM_COPY_TO_USER(user, kern, size) \
408 copyout(kern, user, size)
409 #define DRM_COPY_FROM_USER(kern, user, size) \
410 copyin(user, kern, size)
411 #define DRM_COPY_FROM_USER_UNCHECKED(arg1, arg2, arg3) \
412 copyin(arg2, arg1, arg3)
413 #define DRM_COPY_TO_USER_UNCHECKED(arg1, arg2, arg3) \
414 copyout(arg2, arg1, arg3)
415 #if defined(__FreeBSD__)
416 #define DRM_GET_USER_UNCHECKED(val, uaddr) \
417 ((val) = fuword32(uaddr), 0)
419 #define DRM_GET_USER_UNCHECKED(val, uaddr) \
420 ((val) = fuword(uaddr), 0)
423 #define cpu_to_le32(x) htole32(x)
424 #define le32_to_cpu(x) le32toh(x)
427 #define DRM_UDELAY(udelay) DELAY(udelay)
428 #define DRM_TIME_SLICE (hz/20) /* Time slice for GLXContexts */
430 #define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \
431 (_map) = (_dev)->context_sareas[_ctx]; \
434 #define LOCK_TEST_WITH_RETURN(dev, file_priv) \
436 if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) || \
437 dev->lock.file_priv != file_priv) { \
438 DRM_ERROR("%s called without lock held\n", \
444 /* Returns -errno to shared code */
445 #if defined(__FreeBSD__)
446 #define DRM_WAIT_ON( ret, queue, timeout, condition ) \
447 for ( ret = 0 ; !ret && !(condition) ; ) { \
449 mtx_lock(&dev->irq_lock); \
451 ret = -mtx_sleep(&(queue), &dev->irq_lock, \
452 PCATCH, "drmwtq", (timeout)); \
453 mtx_unlock(&dev->irq_lock); \
456 #elif defined(__NetBSD__)
457 /* Returns -errno to shared code */
458 #define DRM_WAIT_ON( ret, queue, timeout, condition ) \
459 for ( ret = 0 ; !ret && !(condition) ; ) { \
461 mutex_enter(&dev->irq_lock); \
463 ret = -mtsleep(&(queue), PCATCH, \
464 "drmwtq", (timeout), &dev->irq_lock); \
465 mutex_exit(&dev->irq_lock); \
470 #define DRM_ERROR(fmt, ...) \
471 printf("error: [" DRM_NAME ":pid%d:%s] *ERROR* " fmt, \
472 DRM_CURRENTPID, __func__ , ##__VA_ARGS__)
474 #define DRM_INFO(fmt, ...) printf("info: [" DRM_NAME "] " fmt , ##__VA_ARGS__)
476 #define DRM_DEBUG(fmt, ...) do { \
477 if (drm_debug_flag) \
478 printf("[" DRM_NAME ":pid%d:%s] " fmt, DRM_CURRENTPID, \
479 __func__ , ##__VA_ARGS__); \
482 typedef struct drm_pci_id_list
487 #if defined(__NetBSD__)
494 struct drm_msi_blacklist_entry
501 #define DRM_MASTER 0x2
502 #define DRM_ROOT_ONLY 0x4
503 typedef struct drm_ioctl_desc
{
505 int (*func
)(struct drm_device
*dev
, void *data
,
506 struct drm_file
*file_priv
);
510 * Creates a driver or general drm_ioctl_desc array entry for the given
511 * ioctl, for use by drm_ioctl().
513 #define DRM_IOCTL_DEF(ioctl, func, flags) \
514 [DRM_IOCTL_NR(ioctl)] = {ioctl, func, flags}
516 typedef struct drm_magic_entry
{
518 struct drm_file
*priv
;
519 struct drm_magic_entry
*next
;
522 typedef struct drm_magic_head
{
523 struct drm_magic_entry
*head
;
524 struct drm_magic_entry
*tail
;
527 typedef struct drm_buf
{
528 int idx
; /* Index into master buflist */
529 int total
; /* Buffer size */
530 int order
; /* log-base-2(total) */
531 int used
; /* Amount of buffer in use (for DMA) */
532 unsigned long offset
; /* Byte offset (used internally) */
533 void *address
; /* Address of buffer */
534 unsigned long bus_address
; /* Bus address of buffer */
535 struct drm_buf
*next
; /* Kernel-only: used for free list */
536 __volatile__
int pending
; /* On hardware DMA queue */
537 struct drm_file
*file_priv
; /* Unique identifier of holding process */
538 int context
; /* Kernel queue for this buffer */
546 } list
; /* Which list we're on */
548 int dev_priv_size
; /* Size of buffer private stoarge */
549 void *dev_private
; /* Per-buffer private storage */
552 typedef struct drm_freelist
{
553 int initialized
; /* Freelist in use */
554 atomic_t count
; /* Number of free buffers */
555 drm_buf_t
*next
; /* End pointer */
557 int low_mark
; /* Low water mark */
558 int high_mark
; /* High water mark */
561 typedef struct drm_dma_handle
{
566 #if defined(__NetBSD__)
569 bus_dma_segment_t segs
[1];
573 typedef struct drm_buf_entry
{
578 drm_dma_handle_t
**seglist
;
581 drm_freelist_t freelist
;
584 typedef TAILQ_HEAD(drm_file_list
, drm_file
) drm_file_list_t
;
586 TAILQ_ENTRY(drm_file
) link
;
587 struct drm_device
*dev
;
594 unsigned long ioctl_count
;
598 typedef struct drm_lock_data
{
599 struct drm_hw_lock
*hw_lock
; /* Hardware lock */
600 struct drm_file
*file_priv
; /* Unique identifier of holding process (NULL is kernel)*/
601 int lock_queue
; /* Queue of blocked processes */
602 unsigned long lock_time
; /* Time of last lock in jiffies */
605 /* This structure, in the struct drm_device, is always initialized while the
607 * is open. dev->dma_lock protects the incrementing of dev->buf_use, which
608 * when set marks that no further bufs may be allocated until device teardown
609 * occurs (when the last open of the device has closed). The high/low
610 * watermarks of bufs are only touched by the X Server, and thus not
611 * concurrently accessed, so no locking is needed.
613 typedef struct drm_device_dma
{
614 drm_buf_entry_t bufs
[DRM_MAX_ORDER
+1];
616 drm_buf_t
**buflist
; /* Vector of pointers info bufs */
619 unsigned long *pagelist
;
620 unsigned long byte_count
;
622 _DRM_DMA_USE_AGP
= 0x01,
623 _DRM_DMA_USE_SG
= 0x02
627 typedef struct drm_agp_mem
{
629 unsigned long bound
; /* address */
631 struct drm_agp_mem
*prev
;
632 struct drm_agp_mem
*next
;
635 typedef struct drm_agp_head
{
637 struct agp_info info
;
639 drm_agp_mem_t
*memory
;
645 int cant_use_aperture
;
646 unsigned long page_mask
;
649 typedef struct drm_sg_mem
{
650 unsigned long handle
;
654 struct drm_dma_handle
*sg_dmah
; /* Handle for sg_pages */
655 struct drm_dma_handle
*dmah
; /* Handle to PCI memory */
656 /* for ATI PCIGART table */
659 typedef TAILQ_HEAD(drm_map_list
, drm_local_map
) drm_map_list_t
;
661 typedef struct drm_local_map
{
662 unsigned long offset
; /* Physical address (0 for SAREA)*/
663 unsigned long size
; /* Physical size (bytes) */
664 enum drm_map_type type
; /* Type of memory mapped */
665 enum drm_map_flags flags
; /* Flags */
666 void *handle
; /* User-space: "Handle" to pass to mmap */
667 /* Kernel-space: kernel-virtual address */
668 int mtrr
; /* Boolean: MTRR used */
670 int rid
; /* PCI resource ID for bus_space */
671 #if defined(__FreeBSD__)
672 struct resource
*bsr
;
675 bus_space_handle_t bsh
;
676 drm_dma_handle_t
*dmah
;
677 #if defined(__NetBSD__)
681 TAILQ_ENTRY(drm_local_map
) link
;
684 TAILQ_HEAD(drm_vbl_sig_list
, drm_vbl_sig
);
685 typedef struct drm_vbl_sig
{
686 TAILQ_ENTRY(drm_vbl_sig
) link
;
687 unsigned int sequence
;
692 struct drm_vblank_info
{
693 wait_queue_head_t queue
; /* vblank wait queue */
694 atomic_t count
; /* number of VBLANK interrupts */
695 /* (driver must alloc the right number of counters) */
696 struct drm_vbl_sig_list sigs
; /* signal list to send on VBLANK */
697 atomic_t refcount
; /* number of users of vblank interrupts */
698 u32 last
; /* protected by dev->vbl_lock, used */
699 /* for wraparound handling */
700 int enabled
; /* so we don't call enable more than */
701 /* once per disable */
702 int inmodeset
; /* Display driver is setting mode */
705 /* location of GART table */
706 #define DRM_ATI_GART_MAIN 1
707 #define DRM_ATI_GART_FB 2
709 #define DRM_ATI_GART_PCI 1
710 #define DRM_ATI_GART_PCIE 2
711 #define DRM_ATI_GART_IGP 3
713 struct drm_ati_pcigart_info
{
714 int gart_table_location
;
718 dma_addr_t table_mask
;
719 dma_addr_t member_mask
;
720 struct drm_dma_handle
*table_handle
;
721 drm_local_map_t mapping
;
726 #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (1ULL<<(n)) - 1)
729 #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
731 struct drm_driver_info
{
732 int (*load
)(struct drm_device
*, unsigned long flags
);
733 int (*firstopen
)(struct drm_device
*);
734 int (*open
)(struct drm_device
*, struct drm_file
*);
735 void (*preclose
)(struct drm_device
*, struct drm_file
*file_priv
);
736 void (*postclose
)(struct drm_device
*, struct drm_file
*);
737 void (*lastclose
)(struct drm_device
*);
738 int (*unload
)(struct drm_device
*);
739 void (*reclaim_buffers_locked
)(struct drm_device
*,
740 struct drm_file
*file_priv
);
741 int (*dma_ioctl
)(struct drm_device
*dev
, void *data
,
742 struct drm_file
*file_priv
);
743 void (*dma_ready
)(struct drm_device
*);
744 int (*dma_quiescent
)(struct drm_device
*);
745 int (*dma_flush_block_and_flush
)(struct drm_device
*, int context
,
746 enum drm_lock_flags flags
);
747 int (*dma_flush_unblock
)(struct drm_device
*, int context
,
748 enum drm_lock_flags flags
);
749 int (*context_ctor
)(struct drm_device
*dev
, int context
);
750 int (*context_dtor
)(struct drm_device
*dev
, int context
);
751 int (*kernel_context_switch
)(struct drm_device
*dev
, int old
,
753 int (*kernel_context_switch_unlock
)(struct drm_device
*dev
);
754 void (*irq_preinstall
)(struct drm_device
*dev
);
755 int (*irq_postinstall
)(struct drm_device
*dev
);
756 void (*irq_uninstall
)(struct drm_device
*dev
);
757 irqreturn_t (*irq_handler
)(DRM_IRQ_ARGS
);
758 u32 (*get_vblank_counter
)(struct drm_device
*dev
, int crtc
);
759 int (*enable_vblank
)(struct drm_device
*dev
, int crtc
);
760 void (*disable_vblank
)(struct drm_device
*dev
, int crtc
);
762 drm_pci_id_list_t
*id_entry
; /* PCI ID, name, and chipset private */
765 * Called by \c drm_device_is_agp. Typically used to determine if a
766 * card is really attached to AGP or not.
768 * \param dev DRM device handle
771 * One of three values is returned depending on whether or not the
772 * card is absolutely \b not AGP (return of 0), absolutely \b is AGP
773 * (return of 1), or may or may not be AGP (return of 2).
775 int (*device_is_agp
) (struct drm_device
* dev
);
777 drm_ioctl_desc_t
*ioctls
;
785 const char *name
; /* Simple driver name */
786 const char *desc
; /* Longer driver name */
787 const char *date
; /* Date of last major changes. */
792 /* Length for the array of resource pointers for drm_get_resource_*. */
793 #define DRM_MAX_PCI_RESOURCE 6
795 #if defined(__NetBSD__)
801 bus_space_handle_t bsh
;
808 * DRM device functions structure
811 struct drm_driver_info
*driver
;
812 drm_pci_id_list_t
*id_entry
; /* PCI ID, name, and chipset private */
814 u_int16_t pci_device
; /* PCI device id */
815 u_int16_t pci_vendor
; /* PCI vendor id */
817 char *unique
; /* Unique identifier: e.g., busid */
818 int unique_len
; /* Length of unique field */
819 device_t device
; /* Device instance from newbus */
820 #if defined(__FreeBSD__)
821 struct cdev
*devnode
; /* Device number for mknod */
823 int if_version
; /* Highest interface version set */
825 int flags
; /* Flags to open(2) */
828 DRM_SPINTYPE vbl_lock
; /* protects vblank operations */
829 DRM_SPINTYPE dma_lock
; /* protects dev->dma */
830 DRM_SPINTYPE irq_lock
; /* protects irq condition checks */
831 DRM_SPINTYPE dev_lock
; /* protects everything else */
832 DRM_SPINTYPE drw_lock
;
835 int open_count
; /* Outstanding files open */
836 int buf_use
; /* Buffers in use -- cannot alloc */
838 /* Performance counters */
839 unsigned long counters
;
840 enum drm_stat_type types
[15];
844 drm_file_list_t files
;
845 drm_magic_head_t magiclist
[DRM_HASH_SIZE
];
847 /* Linked list of mappable regions. Protected by dev_lock */
848 drm_map_list_t maplist
;
850 drm_local_map_t
**context_sareas
;
853 drm_lock_data_t lock
; /* Information on hardware lock */
855 /* DMA queues (contexts) */
856 drm_device_dma_t
*dma
; /* Optional pointer for DMA support */
858 /* Context support */
859 int irq
; /* Interrupt used by board */
860 int irq_enabled
; /* True if the irq handler is enabled */
861 int msi_enabled
; /* MSI enabled */
862 #if defined(__FreeBSD__)
863 int irqrid
; /* Interrupt used by board */
864 struct resource
*irqr
; /* Resource for interrupt used by board */
866 /* Storage of resource pointers for drm_get_resource_* */
867 struct resource
*pcir
[DRM_MAX_PCI_RESOURCE
];
868 int pcirid
[DRM_MAX_PCI_RESOURCE
];
869 #elif defined(__NetBSD__)
870 struct pci_attach_args pa
;
871 pci_map_data_t pci_map_data
[DRM_MAX_PCI_RESOURCE
];
872 pci_map_data_t agp_map_data
[DRM_MAX_PCI_RESOURCE
];
875 void *irqh
; /* Handle from bus_setup_intr */
882 atomic_t context_flag
; /* Context swapping flag */
883 int last_context
; /* Last current context */
885 int vblank_disable_allowed
;
886 atomic_t vbl_signal_pending
; /* number of signals pending on all crtcs */
887 struct callout vblank_disable_timer
;
888 u32 max_vblank_count
; /* size of vblank counter register */
889 struct drm_vblank_info
*vblank
; /* per crtc vblank info */
892 #if defined(__FreeBSD__)
893 struct sigio
*buf_sigio
; /* Processes waiting for SIGIO */
894 #elif defined(__NetBSD__)
899 struct drm_sysctl_info
*sysctl
;
902 drm_sg_mem_t
*sg
; /* Scatter gather memory */
903 atomic_t
*ctx_bitmap
;
905 unsigned int agp_buffer_token
;
906 drm_local_map_t
*agp_buffer_map
;
908 #if defined(__FreeBSD__)
909 struct unrhdr
*drw_unrhdr
;
910 #elif defined(__NetBSD__)
913 /* RB tree of drawable infos */
914 RB_HEAD(drawable_tree
, bsd_drm_drawable_info
) drw_head
;
917 static __inline__
int drm_core_check_feature(struct drm_device
*dev
,
920 return ((dev
->driver
->driver_features
& feature
) ? 1 : 0);
924 static inline int drm_core_has_AGP(struct drm_device
*dev
)
926 return drm_core_check_feature(dev
, DRIVER_USE_AGP
);
929 #define drm_core_has_AGP(dev) (0)
932 extern int drm_debug_flag
;
934 /* Device setup support (drm_drv.c) */
935 #if defined(__FreeBSD__)
936 int drm_probe(device_t kdev
, drm_pci_id_list_t
*idlist
);
937 int drm_attach(device_t kdev
, drm_pci_id_list_t
*idlist
);
938 void drm_close(void *data
);
939 int drm_detach(device_t kdev
);
945 #elif defined(__NetBSD__)
946 int drm_probe(struct pci_attach_args
*pa
, drm_pci_id_list_t
*idlist
);
947 void drm_attach(device_t kdev
, struct pci_attach_args
*pa
, drm_pci_id_list_t
*idlist
);
948 int drm_detach(device_t self
, int flags
);
949 dev_type_ioctl(drm_ioctl
);
950 dev_type_open(drm_open
);
951 dev_type_close(drm_close
);
952 dev_type_read(drm_read
);
953 dev_type_poll(drm_poll
);
954 dev_type_mmap(drm_mmap
);
956 extern drm_local_map_t
*drm_getsarea(struct drm_device
*dev
);
958 int drm_close_pid(struct drm_device
*dev
, struct drm_file
*priv
, pid_t pid
);
960 /* File operations helpers (drm_fops.c) */
961 #if defined(__FreeBSD__)
962 extern int drm_open_helper(struct cdev
*kdev
, int flags
, int fmt
,
964 struct drm_device
*dev
);
965 #elif defined(__NetBSD__)
966 extern struct drm_file
*drm_find_file_by_proc(struct drm_device
*dev
,
968 extern int drm_open_helper(dev_t kdev
, int flags
, int fmt
,
969 struct proc
*p
, struct drm_device
*dev
);
972 /* Memory management support (drm_memory.c) */
973 void drm_mem_init(void);
974 void drm_mem_uninit(void);
975 void *drm_ioremap_wc(struct drm_device
*dev
, drm_local_map_t
*map
);
976 void *drm_ioremap(struct drm_device
*dev
, drm_local_map_t
*map
);
977 void drm_ioremapfree(drm_local_map_t
*map
);
978 int drm_mtrr_add(unsigned long offset
, size_t size
, int flags
);
979 int drm_mtrr_del(int handle
, unsigned long offset
, size_t size
, int flags
);
981 int drm_context_switch(struct drm_device
*dev
, int old
, int new);
982 int drm_context_switch_complete(struct drm_device
*dev
, int new);
984 int drm_ctxbitmap_init(struct drm_device
*dev
);
985 void drm_ctxbitmap_cleanup(struct drm_device
*dev
);
986 void drm_ctxbitmap_free(struct drm_device
*dev
, int ctx_handle
);
987 int drm_ctxbitmap_next(struct drm_device
*dev
);
989 /* Locking IOCTL support (drm_lock.c) */
990 int drm_lock_take(struct drm_lock_data
*lock_data
,
991 unsigned int context
);
992 int drm_lock_transfer(struct drm_lock_data
*lock_data
,
993 unsigned int context
);
994 int drm_lock_free(struct drm_lock_data
*lock_data
,
995 unsigned int context
);
997 /* Buffer management support (drm_bufs.c) */
998 unsigned long drm_get_resource_start(struct drm_device
*dev
,
999 unsigned int resource
);
1000 unsigned long drm_get_resource_len(struct drm_device
*dev
,
1001 unsigned int resource
);
1002 void drm_rmmap(struct drm_device
*dev
, drm_local_map_t
*map
);
1003 int drm_order(unsigned long size
);
1004 int drm_addmap(struct drm_device
*dev
, unsigned long offset
,
1006 enum drm_map_type type
, enum drm_map_flags flags
,
1007 drm_local_map_t
**map_ptr
);
1008 int drm_addbufs_pci(struct drm_device
*dev
, struct drm_buf_desc
*request
);
1009 int drm_addbufs_sg(struct drm_device
*dev
, struct drm_buf_desc
*request
);
1010 int drm_addbufs_agp(struct drm_device
*dev
, struct drm_buf_desc
*request
);
1012 /* DMA support (drm_dma.c) */
1013 int drm_dma_setup(struct drm_device
*dev
);
1014 void drm_dma_takedown(struct drm_device
*dev
);
1015 void drm_free_buffer(struct drm_device
*dev
, drm_buf_t
*buf
);
1016 void drm_reclaim_buffers(struct drm_device
*dev
, struct drm_file
*file_priv
);
1017 #define drm_core_reclaim_buffers drm_reclaim_buffers
1019 /* IRQ support (drm_irq.c) */
1020 int drm_irq_install(struct drm_device
*dev
);
1021 int drm_irq_uninstall(struct drm_device
*dev
);
1022 irqreturn_t
drm_irq_handler(DRM_IRQ_ARGS
);
1023 void drm_driver_irq_preinstall(struct drm_device
*dev
);
1024 void drm_driver_irq_postinstall(struct drm_device
*dev
);
1025 void drm_driver_irq_uninstall(struct drm_device
*dev
);
1026 void drm_handle_vblank(struct drm_device
*dev
, int crtc
);
1027 u32
drm_vblank_count(struct drm_device
*dev
, int crtc
);
1028 int drm_vblank_get(struct drm_device
*dev
, int crtc
);
1029 void drm_vblank_put(struct drm_device
*dev
, int crtc
);
1030 void drm_vblank_cleanup(struct drm_device
*dev
);
1031 int drm_vblank_wait(struct drm_device
*dev
, unsigned int *vbl_seq
);
1032 int drm_vblank_init(struct drm_device
*dev
, int num_crtcs
);
1033 void drm_vbl_send_signals(struct drm_device
*dev
, int crtc
);
1034 int drm_modeset_ctl(struct drm_device
*dev
, void *data
,
1035 struct drm_file
*file_priv
);
1037 /* AGP/PCI Express/GART support (drm_agpsupport.c) */
1038 int drm_device_is_agp(struct drm_device
*dev
);
1039 int drm_device_is_pcie(struct drm_device
*dev
);
1040 drm_agp_head_t
*drm_agp_init(struct drm_device
*dev
);
1041 int drm_agp_acquire(struct drm_device
*dev
);
1042 int drm_agp_release(struct drm_device
*dev
);
1043 int drm_agp_info(struct drm_device
* dev
, struct drm_agp_info
*info
);
1044 int drm_agp_enable(struct drm_device
*dev
, struct drm_agp_mode mode
);
1045 void *drm_agp_allocate_memory(size_t pages
, u32 type
);
1046 int drm_agp_free_memory(void *handle
);
1047 int drm_agp_bind_memory(void *handle
, off_t start
);
1048 int drm_agp_unbind_memory(void *handle
);
1049 int drm_agp_alloc(struct drm_device
*dev
, struct drm_agp_buffer
*request
);
1050 int drm_agp_free(struct drm_device
*dev
, struct drm_agp_buffer
*request
);
1051 int drm_agp_bind(struct drm_device
*dev
, struct drm_agp_binding
*request
);
1052 int drm_agp_unbind(struct drm_device
*dev
, struct drm_agp_binding
*request
);
1054 /* Scatter Gather Support (drm_scatter.c) */
1055 void drm_sg_cleanup(drm_sg_mem_t
*entry
);
1056 int drm_sg_alloc(struct drm_device
*dev
, struct drm_scatter_gather
* request
);
1058 /* sysctl support (drm_sysctl.h) */
1059 extern int drm_sysctl_init(struct drm_device
*dev
);
1060 extern int drm_sysctl_cleanup(struct drm_device
*dev
);
1062 /* ATI PCIGART support (ati_pcigart.c) */
1063 int drm_ati_pcigart_init(struct drm_device
*dev
,
1064 struct drm_ati_pcigart_info
*gart_info
);
1065 int drm_ati_pcigart_cleanup(struct drm_device
*dev
,
1066 struct drm_ati_pcigart_info
*gart_info
);
1068 /* Locking IOCTL support (drm_drv.c) */
1069 int drm_lock(struct drm_device
*dev
, void *data
,
1070 struct drm_file
*file_priv
);
1071 int drm_unlock(struct drm_device
*dev
, void *data
,
1072 struct drm_file
*file_priv
);
1073 int drm_version(struct drm_device
*dev
, void *data
,
1074 struct drm_file
*file_priv
);
1075 int drm_setversion(struct drm_device
*dev
, void *data
,
1076 struct drm_file
*file_priv
);
1078 /* Misc. IOCTL support (drm_ioctl.c) */
1079 int drm_irq_by_busid(struct drm_device
*dev
, void *data
,
1080 struct drm_file
*file_priv
);
1081 int drm_getunique(struct drm_device
*dev
, void *data
,
1082 struct drm_file
*file_priv
);
1083 int drm_setunique(struct drm_device
*dev
, void *data
,
1084 struct drm_file
*file_priv
);
1085 int drm_getmap(struct drm_device
*dev
, void *data
,
1086 struct drm_file
*file_priv
);
1087 int drm_getclient(struct drm_device
*dev
, void *data
,
1088 struct drm_file
*file_priv
);
1089 int drm_getstats(struct drm_device
*dev
, void *data
,
1090 struct drm_file
*file_priv
);
1091 int drm_noop(struct drm_device
*dev
, void *data
,
1092 struct drm_file
*file_priv
);
1094 /* Context IOCTL support (drm_context.c) */
1095 int drm_resctx(struct drm_device
*dev
, void *data
,
1096 struct drm_file
*file_priv
);
1097 int drm_addctx(struct drm_device
*dev
, void *data
,
1098 struct drm_file
*file_priv
);
1099 int drm_modctx(struct drm_device
*dev
, void *data
,
1100 struct drm_file
*file_priv
);
1101 int drm_getctx(struct drm_device
*dev
, void *data
,
1102 struct drm_file
*file_priv
);
1103 int drm_switchctx(struct drm_device
*dev
, void *data
,
1104 struct drm_file
*file_priv
);
1105 int drm_newctx(struct drm_device
*dev
, void *data
,
1106 struct drm_file
*file_priv
);
1107 int drm_rmctx(struct drm_device
*dev
, void *data
,
1108 struct drm_file
*file_priv
);
1109 int drm_setsareactx(struct drm_device
*dev
, void *data
,
1110 struct drm_file
*file_priv
);
1111 int drm_getsareactx(struct drm_device
*dev
, void *data
,
1112 struct drm_file
*file_priv
);
1114 /* Drawable IOCTL support (drm_drawable.c) */
1115 int drm_adddraw(struct drm_device
*dev
, void *data
,
1116 struct drm_file
*file_priv
);
1117 int drm_rmdraw(struct drm_device
*dev
, void *data
,
1118 struct drm_file
*file_priv
);
1119 int drm_update_draw(struct drm_device
*dev
, void *data
,
1120 struct drm_file
*file_priv
);
1121 struct drm_drawable_info
*drm_get_drawable_info(struct drm_device
*dev
,
1124 /* Drawable support (drm_drawable.c) */
1125 void drm_drawable_free_all(struct drm_device
*dev
);
1127 /* Authentication IOCTL support (drm_auth.c) */
1128 int drm_getmagic(struct drm_device
*dev
, void *data
,
1129 struct drm_file
*file_priv
);
1130 int drm_authmagic(struct drm_device
*dev
, void *data
,
1131 struct drm_file
*file_priv
);
1133 /* Buffer management support (drm_bufs.c) */
1134 int drm_addmap_ioctl(struct drm_device
*dev
, void *data
,
1135 struct drm_file
*file_priv
);
1136 int drm_rmmap_ioctl(struct drm_device
*dev
, void *data
,
1137 struct drm_file
*file_priv
);
1138 int drm_addbufs(struct drm_device
*dev
, void *data
,
1139 struct drm_file
*file_priv
);
1140 int drm_infobufs(struct drm_device
*dev
, void *data
,
1141 struct drm_file
*file_priv
);
1142 int drm_markbufs(struct drm_device
*dev
, void *data
,
1143 struct drm_file
*file_priv
);
1144 int drm_freebufs(struct drm_device
*dev
, void *data
,
1145 struct drm_file
*file_priv
);
1146 int drm_mapbufs(struct drm_device
*dev
, void *data
,
1147 struct drm_file
*file_priv
);
1149 /* DMA support (drm_dma.c) */
1150 int drm_dma(struct drm_device
*dev
, void *data
, struct drm_file
*file_priv
);
1152 /* IRQ support (drm_irq.c) */
1153 int drm_control(struct drm_device
*dev
, void *data
,
1154 struct drm_file
*file_priv
);
1155 int drm_wait_vblank(struct drm_device
*dev
, void *data
,
1156 struct drm_file
*file_priv
);
1158 /* AGP/GART support (drm_agpsupport.c) */
1159 int drm_agp_acquire_ioctl(struct drm_device
*dev
, void *data
,
1160 struct drm_file
*file_priv
);
1161 int drm_agp_release_ioctl(struct drm_device
*dev
, void *data
,
1162 struct drm_file
*file_priv
);
1163 int drm_agp_enable_ioctl(struct drm_device
*dev
, void *data
,
1164 struct drm_file
*file_priv
);
1165 int drm_agp_info_ioctl(struct drm_device
*dev
, void *data
,
1166 struct drm_file
*file_priv
);
1167 int drm_agp_alloc_ioctl(struct drm_device
*dev
, void *data
,
1168 struct drm_file
*file_priv
);
1169 int drm_agp_free_ioctl(struct drm_device
*dev
, void *data
,
1170 struct drm_file
*file_priv
);
1171 int drm_agp_unbind_ioctl(struct drm_device
*dev
, void *data
,
1172 struct drm_file
*file_priv
);
1173 int drm_agp_bind_ioctl(struct drm_device
*dev
, void *data
,
1174 struct drm_file
*file_priv
);
1176 /* Scatter Gather Support (drm_scatter.c) */
1177 int drm_sg_alloc_ioctl(struct drm_device
*dev
, void *data
,
1178 struct drm_file
*file_priv
);
1179 int drm_sg_free(struct drm_device
*dev
, void *data
,
1180 struct drm_file
*file_priv
);
1182 /* consistent PCI memory functions (drm_pci.c) */
1183 drm_dma_handle_t
*drm_pci_alloc(struct drm_device
*dev
, size_t size
,
1184 size_t align
, dma_addr_t maxaddr
);
1185 void drm_pci_free(struct drm_device
*dev
, drm_dma_handle_t
*dmah
);
1187 /* Inline replacements for drm_alloc and friends */
1188 static __inline__
void *
1189 drm_alloc(size_t size
, struct malloc_type
*area
)
1191 return malloc(size
, area
, M_NOWAIT
);
1194 static __inline__
void *
1195 drm_calloc(size_t nmemb
, size_t size
, struct malloc_type
*area
)
1197 return malloc(size
* nmemb
, area
, M_NOWAIT
| M_ZERO
);
1200 static __inline__
void *
1201 drm_realloc(void *oldpt
, size_t oldsize
, size_t size
,
1202 struct malloc_type
*area
)
1204 #if defined(__FreeBSD__)
1205 return reallocf(oldpt
, size
, area
, M_NOWAIT
);
1206 #elif defined(__NetBSD__)
1209 pt
= malloc(size
, area
, M_NOWAIT
);
1212 if (oldpt
&& oldsize
) {
1213 memcpy(pt
, oldpt
, oldsize
);
1220 static __inline__
void
1221 drm_free(void *pt
, size_t size
, struct malloc_type
*area
)
1226 /* Inline replacements for DRM_IOREMAP macros */
1227 static __inline__
void
1228 drm_core_ioremap_wc(struct drm_local_map
*map
, struct drm_device
*dev
)
1230 map
->handle
= drm_ioremap_wc(dev
, map
);
1232 static __inline__
void
1233 drm_core_ioremap(struct drm_local_map
*map
, struct drm_device
*dev
)
1235 map
->handle
= drm_ioremap(dev
, map
);
1237 static __inline__
void
1238 drm_core_ioremapfree(struct drm_local_map
*map
, struct drm_device
*dev
)
1240 if ( map
->handle
&& map
->size
)
1241 drm_ioremapfree(map
);
1244 static __inline__
struct drm_local_map
*
1245 drm_core_findmap(struct drm_device
*dev
, unsigned long offset
)
1247 drm_local_map_t
*map
;
1249 DRM_SPINLOCK_ASSERT(&dev
->dev_lock
);
1250 TAILQ_FOREACH(map
, &dev
->maplist
, link
) {
1251 if (map
->offset
== offset
)
1257 static __inline__
void drm_core_dropmap(struct drm_map
*map
)
1261 #endif /* __KERNEL__ */
1262 #endif /* _DRM_P_H_ */