rename amd64 architecture to x86_64
[dragonfly.git] / sys / dev / drm / drmP.h
CommitLineData
984263bc
MD
1/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
2 * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
7f3c3d6f
HT
3 */
4/*-
984263bc
MD
5 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
6 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
7 * All rights reserved.
8 *
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:
15 *
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
18 * Software.
19 *
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.
27 *
28 * Authors:
29 * Rickard E. (Rik) Faith <faith@valinux.com>
30 * Gareth Hughes <gareth@valinux.com>
7f3c3d6f 31 *
984263bc
MD
32 */
33
34#ifndef _DRM_P_H_
35#define _DRM_P_H_
36
37#if defined(_KERNEL) || defined(__KERNEL__)
38
b3705d71
HT
39struct drm_device;
40struct drm_file;
7f3c3d6f
HT
41
42#include <sys/param.h>
43#include <sys/queue.h>
44#include <sys/malloc.h>
45#include <sys/kernel.h>
46#include <sys/module.h>
47#include <sys/systm.h>
48#include <sys/conf.h>
49#include <sys/stat.h>
7f3c3d6f 50#include <sys/priv.h>
7f3c3d6f
HT
51#include <sys/proc.h>
52#include <sys/lock.h>
53#include <sys/fcntl.h>
54#include <sys/uio.h>
55#include <sys/filio.h>
56#include <sys/sysctl.h>
57#include <sys/bus.h>
58#include <sys/signalvar.h>
59#include <sys/poll.h>
60#include <sys/tree.h>
61#include <sys/taskqueue.h>
62#include <vm/vm.h>
63#include <vm/pmap.h>
64#include <vm/vm_extern.h>
65#include <vm/vm_map.h>
66#include <vm/vm_param.h>
67#include <machine/param.h>
68#include <machine/pmap.h>
7f3c3d6f
HT
69#include <sys/bus.h>
70#include <sys/resource.h>
b3705d71 71#include <machine/specialreg.h>
7f3c3d6f
HT
72#include <machine/sysarch.h>
73#include <sys/endian.h>
74#include <sys/mman.h>
7f3c3d6f
HT
75#include <sys/rman.h>
76#include <sys/memrange.h>
7f3c3d6f 77#include <dev/agp/agpvar.h>
7f3c3d6f 78#include <sys/device.h>
b3705d71
HT
79#include <sys/agpio.h>
80#include <sys/spinlock.h>
299d1b7a 81#include <sys/spinlock2.h>
7f3c3d6f 82#include <bus/pci/pcivar.h>
b3705d71 83#include <bus/pci/pcireg.h>
7f3c3d6f 84#include <sys/selinfo.h>
7f3c3d6f
HT
85#include <sys/bus.h>
86
b3705d71
HT
87#include "dev/drm/drm.h"
88#include "dev/drm/drm_linux_list.h"
89#include "dev/drm/drm_atomic.h"
90#include "dev/drm/drm_internal.h"
7f3c3d6f 91
7f3c3d6f
HT
92#include <opt_drm.h>
93#ifdef DRM_DEBUG
94#undef DRM_DEBUG
95#define DRM_DEBUG_DEFAULT_ON 1
96#endif /* DRM_DEBUG */
984263bc 97
c1543a89 98#if defined(DRM_LINUX) && DRM_LINUX && !defined(__x86_64__) && !defined(__DragonFly__) /* XXX */
7f3c3d6f
HT
99#include <sys/file.h>
100#include <sys/proc.h>
101#include <machine/../linux/linux.h>
102#include <machine/../linux/linux_proto.h>
103#else
104/* Either it was defined when it shouldn't be (FreeBSD amd64) or it isn't
105 * supported on this OS yet.
106 */
107#undef DRM_LINUX
108#define DRM_LINUX 0
984263bc
MD
109#endif
110
b3705d71
HT
111/* driver capabilities and requirements mask */
112#define DRIVER_USE_AGP 0x1
113#define DRIVER_REQUIRE_AGP 0x2
114#define DRIVER_USE_MTRR 0x4
115#define DRIVER_PCI_DMA 0x8
116#define DRIVER_SG 0x10
117#define DRIVER_HAVE_DMA 0x20
118#define DRIVER_HAVE_IRQ 0x40
119#define DRIVER_DMA_QUEUE 0x100
120
121
984263bc
MD
122#define DRM_HASH_SIZE 16 /* Size of key hash table */
123#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
124#define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */
125
b3705d71
HT
126MALLOC_DECLARE(DRM_MEM_DMA);
127MALLOC_DECLARE(DRM_MEM_SAREA);
128MALLOC_DECLARE(DRM_MEM_DRIVER);
129MALLOC_DECLARE(DRM_MEM_MAGIC);
130MALLOC_DECLARE(DRM_MEM_IOCTLS);
131MALLOC_DECLARE(DRM_MEM_MAPS);
132MALLOC_DECLARE(DRM_MEM_BUFS);
133MALLOC_DECLARE(DRM_MEM_SEGS);
134MALLOC_DECLARE(DRM_MEM_PAGES);
135MALLOC_DECLARE(DRM_MEM_FILES);
136MALLOC_DECLARE(DRM_MEM_QUEUES);
137MALLOC_DECLARE(DRM_MEM_CMDS);
138MALLOC_DECLARE(DRM_MEM_MAPPINGS);
139MALLOC_DECLARE(DRM_MEM_BUFLISTS);
140MALLOC_DECLARE(DRM_MEM_AGPLISTS);
141MALLOC_DECLARE(DRM_MEM_CTXBITMAP);
142MALLOC_DECLARE(DRM_MEM_SGLISTS);
143MALLOC_DECLARE(DRM_MEM_DRAWABLE);
984263bc
MD
144
145#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
146
984263bc
MD
147 /* Internal types and structures */
148#define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
149#define DRM_MIN(a,b) ((a)<(b)?(a):(b))
150#define DRM_MAX(a,b) ((a)>(b)?(a):(b))
151
7f3c3d6f
HT
152#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
153
7f3c3d6f
HT
154#define __OS_HAS_AGP 1
155
156#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
157#define DRM_DEV_UID 0
158#define DRM_DEV_GID 0
159
160#define wait_queue_head_t atomic_t
161#define DRM_WAKEUP(w) wakeup((void *)w)
162#define DRM_WAKEUP_INT(w) wakeup(w)
163#define DRM_INIT_WAITQUEUE(queue) do {(void)(queue);} while (0)
164
7f3c3d6f
HT
165#define DRM_CURPROC curthread
166#define DRM_STRUCTPROC struct thread
b3705d71
HT
167#define DRM_SPINTYPE struct lock
168#define DRM_SPININIT(l,name) lockinit(l, name, 0, LK_CANRECURSE)
169#define DRM_SPINUNINIT(l)
170#define DRM_SPINLOCK(l) lockmgr(l, LK_EXCLUSIVE|LK_RETRY|LK_CANRECURSE)
171#define DRM_SPINUNLOCK(u) lockmgr(u, LK_RELEASE)
7f3c3d6f 172#define DRM_SPINLOCK_IRQSAVE(l, irqflags) do { \
b3705d71 173 DRM_SPINLOCK(l); \
7f3c3d6f
HT
174 (void)irqflags; \
175} while (0)
176#define DRM_SPINUNLOCK_IRQRESTORE(u, irqflags) DRM_SPINUNLOCK(u)
177#define DRM_SPINLOCK_ASSERT(l)
178#define DRM_CURRENTPID curthread->td_proc->p_pid
179#define DRM_LOCK() DRM_SPINLOCK(&dev->dev_lock)
b3705d71 180#define DRM_UNLOCK() DRM_SPINUNLOCK(&dev->dev_lock)
7f3c3d6f 181#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS)
7f3c3d6f
HT
182
183#define DRM_IRQ_ARGS void *arg
184typedef void irqreturn_t;
185#define IRQ_HANDLED /* nothing */
186#define IRQ_NONE /* nothing */
187
188enum {
189 DRM_IS_NOT_AGP,
190 DRM_IS_AGP,
191 DRM_MIGHT_BE_AGP
192};
193#define DRM_AGP_MEM struct agp_memory_info
194
7f3c3d6f 195#define drm_get_device_from_kdev(_kdev) (_kdev->si_drv1)
7f3c3d6f 196
7f3c3d6f
HT
197#define PAGE_ALIGN(addr) round_page(addr)
198/* DRM_SUSER returns true if the user is superuser */
7f3c3d6f 199#define DRM_SUSER(p) (priv_check(p, PRIV_DRIVER) == 0)
7f3c3d6f
HT
200#define DRM_AGP_FIND_DEVICE() agp_find_device()
201#define DRM_MTRR_WC MDF_WRITECOMBINE
202#define jiffies ticks
203
7f3c3d6f
HT
204typedef unsigned long dma_addr_t;
205typedef u_int64_t u64;
206typedef u_int32_t u32;
207typedef u_int16_t u16;
208typedef u_int8_t u8;
209
210/* DRM_READMEMORYBARRIER() prevents reordering of reads.
211 * DRM_WRITEMEMORYBARRIER() prevents reordering of writes.
212 * DRM_MEMORYBARRIER() prevents reordering of reads and writes.
213 */
214#if defined(__i386__)
215#define DRM_READMEMORYBARRIER() __asm __volatile( \
216 "lock; addl $0,0(%%esp)" : : : "memory");
217#define DRM_WRITEMEMORYBARRIER() __asm __volatile("" : : : "memory");
218#define DRM_MEMORYBARRIER() __asm __volatile( \
219 "lock; addl $0,0(%%esp)" : : : "memory");
220#elif defined(__alpha__)
221#define DRM_READMEMORYBARRIER() alpha_mb();
222#define DRM_WRITEMEMORYBARRIER() alpha_wmb();
223#define DRM_MEMORYBARRIER() alpha_mb();
c1543a89 224#elif defined(__x86_64__)
7f3c3d6f
HT
225#define DRM_READMEMORYBARRIER() __asm __volatile( \
226 "lock; addl $0,0(%%rsp)" : : : "memory");
227#define DRM_WRITEMEMORYBARRIER() __asm __volatile("" : : : "memory");
228#define DRM_MEMORYBARRIER() __asm __volatile( \
229 "lock; addl $0,0(%%rsp)" : : : "memory");
230#endif
231
7f3c3d6f 232#define DRM_READ8(map, offset) \
b3705d71
HT
233 *(volatile u_int8_t *)(((vm_offset_t)(map)->handle) + \
234 (vm_offset_t)(offset))
7f3c3d6f 235#define DRM_READ16(map, offset) \
b3705d71
HT
236 *(volatile u_int16_t *)(((vm_offset_t)(map)->handle) + \
237 (vm_offset_t)(offset))
7f3c3d6f 238#define DRM_READ32(map, offset) \
b3705d71
HT
239 *(volatile u_int32_t *)(((vm_offset_t)(map)->handle) + \
240 (vm_offset_t)(offset))
7f3c3d6f 241#define DRM_WRITE8(map, offset, val) \
b3705d71
HT
242 *(volatile u_int8_t *)(((vm_offset_t)(map)->handle) + \
243 (vm_offset_t)(offset)) = val
7f3c3d6f 244#define DRM_WRITE16(map, offset, val) \
b3705d71
HT
245 *(volatile u_int16_t *)(((vm_offset_t)(map)->handle) + \
246 (vm_offset_t)(offset)) = val
7f3c3d6f 247#define DRM_WRITE32(map, offset, val) \
b3705d71
HT
248 *(volatile u_int32_t *)(((vm_offset_t)(map)->handle) + \
249 (vm_offset_t)(offset)) = val
7f3c3d6f
HT
250
251#define DRM_VERIFYAREA_READ( uaddr, size ) \
252 (!useracc(__DECONST(caddr_t, uaddr), size, VM_PROT_READ))
253
7f3c3d6f
HT
254#define DRM_COPY_TO_USER(user, kern, size) \
255 copyout(kern, user, size)
256#define DRM_COPY_FROM_USER(kern, user, size) \
257 copyin(user, kern, size)
258#define DRM_COPY_FROM_USER_UNCHECKED(arg1, arg2, arg3) \
259 copyin(arg2, arg1, arg3)
260#define DRM_COPY_TO_USER_UNCHECKED(arg1, arg2, arg3) \
261 copyout(arg2, arg1, arg3)
7f3c3d6f
HT
262#define DRM_GET_USER_UNCHECKED(val, uaddr) \
263 ((val) = fuword32(uaddr), 0)
7f3c3d6f
HT
264
265#define cpu_to_le32(x) htole32(x)
266#define le32_to_cpu(x) le32toh(x)
267
268#define DRM_HZ hz
269#define DRM_UDELAY(udelay) DELAY(udelay)
270#define DRM_TIME_SLICE (hz/20) /* Time slice for GLXContexts */
984263bc
MD
271
272#define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \
273 (_map) = (_dev)->context_sareas[_ctx]; \
274} while(0)
275
7f3c3d6f
HT
276#define LOCK_TEST_WITH_RETURN(dev, file_priv) \
277do { \
278 if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) || \
279 dev->lock.file_priv != file_priv) { \
280 DRM_ERROR("%s called without lock held\n", \
281 __FUNCTION__); \
282 return EINVAL; \
283 } \
284} while (0)
285
7f3c3d6f
HT
286/* Returns -errno to shared code */
287#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
288for ( ret = 0 ; !ret && !(condition) ; ) { \
289 DRM_UNLOCK(); \
7f3c3d6f
HT
290 lwkt_serialize_enter(&dev->irq_lock); \
291 if (!(condition)) { \
ae8e83e6 292 tsleep_interlock(&(queue), PCATCH); \
b3705d71 293 lwkt_serialize_exit(&dev->irq_lock); \
d9345d3a 294 ret = -tsleep(&(queue), PCATCH | PINTERLOCKED, \
b3705d71 295 "drmwtq", (timeout)); \
7f3c3d6f
HT
296 } else { \
297 lwkt_serialize_exit(&dev->irq_lock); \
298 } \
299 DRM_LOCK(); \
300}
7f3c3d6f 301
7f3c3d6f
HT
302#define printf kprintf
303#define snprintf ksnprintf
304#define sscanf ksscanf
305#define malloc kmalloc
306#define realloc krealloc
b3705d71 307#define reallocf krealloc /* XXX XXX XXX */
7f3c3d6f
HT
308
309__inline static void
310free(void *addr, struct malloc_type *type)
311{
312 if (addr != NULL)
313 kfree(addr, type);
314}
984263bc 315
b3705d71 316#define DRM_ERROR(fmt, ...) \
7f3c3d6f 317 printf("error: [" DRM_NAME ":pid%d:%s] *ERROR* " fmt, \
b3705d71 318 DRM_CURRENTPID, __func__ , ##__VA_ARGS__)
7f3c3d6f 319
b3705d71
HT
320#define DRM_INFO(fmt, ...) printf("info: [" DRM_NAME "] " fmt , ##__VA_ARGS__)
321
322#define DRM_DEBUG(fmt, ...) do { \
7f3c3d6f
HT
323 if (drm_debug_flag) \
324 printf("[" DRM_NAME ":pid%d:%s] " fmt, DRM_CURRENTPID, \
b3705d71 325 __func__ , ##__VA_ARGS__); \
7f3c3d6f
HT
326} while (0)
327
328typedef struct drm_pci_id_list
329{
330 int vendor;
331 int device;
332 long driver_private;
333 char *name;
334} drm_pci_id_list_t;
335
b3705d71
HT
336struct drm_msi_blacklist_entry
337{
338 int vendor;
339 int device;
340};
341
7f3c3d6f
HT
342#define DRM_AUTH 0x1
343#define DRM_MASTER 0x2
344#define DRM_ROOT_ONLY 0x4
984263bc 345typedef struct drm_ioctl_desc {
7f3c3d6f 346 unsigned long cmd;
b3705d71
HT
347 int (*func)(struct drm_device *dev, void *data,
348 struct drm_file *file_priv);
7f3c3d6f 349 int flags;
984263bc 350} drm_ioctl_desc_t;
7f3c3d6f
HT
351/**
352 * Creates a driver or general drm_ioctl_desc array entry for the given
353 * ioctl, for use by drm_ioctl().
354 */
355#define DRM_IOCTL_DEF(ioctl, func, flags) \
356 [DRM_IOCTL_NR(ioctl)] = {ioctl, func, flags}
984263bc
MD
357
358typedef struct drm_magic_entry {
359 drm_magic_t magic;
360 struct drm_file *priv;
361 struct drm_magic_entry *next;
362} drm_magic_entry_t;
363
364typedef struct drm_magic_head {
365 struct drm_magic_entry *head;
366 struct drm_magic_entry *tail;
367} drm_magic_head_t;
368
369typedef struct drm_buf {
370 int idx; /* Index into master buflist */
371 int total; /* Buffer size */
372 int order; /* log-base-2(total) */
373 int used; /* Amount of buffer in use (for DMA) */
374 unsigned long offset; /* Byte offset (used internally) */
375 void *address; /* Address of buffer */
376 unsigned long bus_address; /* Bus address of buffer */
377 struct drm_buf *next; /* Kernel-only: used for free list */
378 __volatile__ int pending; /* On hardware DMA queue */
7f3c3d6f 379 struct drm_file *file_priv; /* Unique identifier of holding process */
984263bc
MD
380 int context; /* Kernel queue for this buffer */
381 enum {
382 DRM_LIST_NONE = 0,
383 DRM_LIST_FREE = 1,
384 DRM_LIST_WAIT = 2,
385 DRM_LIST_PEND = 3,
386 DRM_LIST_PRIO = 4,
387 DRM_LIST_RECLAIM = 5
388 } list; /* Which list we're on */
389
390 int dev_priv_size; /* Size of buffer private stoarge */
391 void *dev_private; /* Per-buffer private storage */
392} drm_buf_t;
393
984263bc
MD
394typedef struct drm_freelist {
395 int initialized; /* Freelist in use */
396 atomic_t count; /* Number of free buffers */
397 drm_buf_t *next; /* End pointer */
398
399 int low_mark; /* Low water mark */
400 int high_mark; /* High water mark */
984263bc
MD
401} drm_freelist_t;
402
7f3c3d6f
HT
403typedef struct drm_dma_handle {
404 void *vaddr;
405 bus_addr_t busaddr;
7f3c3d6f
HT
406 bus_dma_tag_t tag;
407 bus_dmamap_t map;
7f3c3d6f
HT
408} drm_dma_handle_t;
409
984263bc
MD
410typedef struct drm_buf_entry {
411 int buf_size;
412 int buf_count;
413 drm_buf_t *buflist;
414 int seg_count;
7f3c3d6f 415 drm_dma_handle_t **seglist;
984263bc 416 int page_order;
984263bc
MD
417
418 drm_freelist_t freelist;
419} drm_buf_entry_t;
420
984263bc
MD
421typedef TAILQ_HEAD(drm_file_list, drm_file) drm_file_list_t;
422struct drm_file {
423 TAILQ_ENTRY(drm_file) link;
b3705d71 424 struct drm_device *dev;
984263bc 425 int authenticated;
7f3c3d6f 426 int master;
984263bc
MD
427 int minor;
428 pid_t pid;
429 uid_t uid;
430 int refs;
431 drm_magic_t magic;
432 unsigned long ioctl_count;
7f3c3d6f 433 void *driver_priv;
984263bc
MD
434};
435
436typedef struct drm_lock_data {
b3705d71 437 struct drm_hw_lock *hw_lock; /* Hardware lock */
7f3c3d6f
HT
438 struct drm_file *file_priv; /* Unique identifier of holding process (NULL is kernel)*/
439 int lock_queue; /* Queue of blocked processes */
984263bc
MD
440 unsigned long lock_time; /* Time of last lock in jiffies */
441} drm_lock_data_t;
442
b3705d71
HT
443/* This structure, in the struct drm_device, is always initialized while the
444 * device
7f3c3d6f
HT
445 * is open. dev->dma_lock protects the incrementing of dev->buf_use, which
446 * when set marks that no further bufs may be allocated until device teardown
447 * occurs (when the last open of the device has closed). The high/low
448 * watermarks of bufs are only touched by the X Server, and thus not
449 * concurrently accessed, so no locking is needed.
450 */
984263bc
MD
451typedef struct drm_device_dma {
452 drm_buf_entry_t bufs[DRM_MAX_ORDER+1];
453 int buf_count;
454 drm_buf_t **buflist; /* Vector of pointers info bufs */
455 int seg_count;
456 int page_count;
457 unsigned long *pagelist;
458 unsigned long byte_count;
459 enum {
460 _DRM_DMA_USE_AGP = 0x01,
461 _DRM_DMA_USE_SG = 0x02
462 } flags;
984263bc
MD
463} drm_device_dma_t;
464
984263bc
MD
465typedef struct drm_agp_mem {
466 void *handle;
467 unsigned long bound; /* address */
468 int pages;
469 struct drm_agp_mem *prev;
470 struct drm_agp_mem *next;
471} drm_agp_mem_t;
472
473typedef struct drm_agp_head {
474 device_t agpdev;
475 struct agp_info info;
476 const char *chipset;
477 drm_agp_mem_t *memory;
478 unsigned long mode;
479 int enabled;
480 int acquired;
481 unsigned long base;
7f3c3d6f 482 int mtrr;
984263bc
MD
483 int cant_use_aperture;
484 unsigned long page_mask;
485} drm_agp_head_t;
984263bc
MD
486
487typedef struct drm_sg_mem {
b3705d71
HT
488 unsigned long handle;
489 void *virtual;
490 int pages;
491 dma_addr_t *busaddr;
492 struct drm_dma_handle *dmah; /* Handle to PCI memory */
984263bc
MD
493} drm_sg_mem_t;
494
7f3c3d6f
HT
495typedef TAILQ_HEAD(drm_map_list, drm_local_map) drm_map_list_t;
496
984263bc
MD
497typedef struct drm_local_map {
498 unsigned long offset; /* Physical address (0 for SAREA)*/
499 unsigned long size; /* Physical size (bytes) */
b3705d71
HT
500 enum drm_map_type type; /* Type of memory mapped */
501 enum drm_map_flags flags; /* Flags */
984263bc
MD
502 void *handle; /* User-space: "Handle" to pass to mmap */
503 /* Kernel-space: kernel-virtual address */
7f3c3d6f 504 int mtrr; /* Boolean: MTRR used */
984263bc 505 /* Private data */
7f3c3d6f
HT
506 int rid; /* PCI resource ID for bus_space */
507 struct resource *bsr;
508 bus_space_tag_t bst;
509 bus_space_handle_t bsh;
510 drm_dma_handle_t *dmah;
511 TAILQ_ENTRY(drm_local_map) link;
984263bc
MD
512} drm_local_map_t;
513
b3705d71
HT
514struct drm_vblank_info {
515 wait_queue_head_t queue; /* vblank wait queue */
516 atomic_t count; /* number of VBLANK interrupts */
517 /* (driver must alloc the right number of counters) */
b3705d71
HT
518 atomic_t refcount; /* number of users of vblank interrupts */
519 u32 last; /* protected by dev->vbl_lock, used */
520 /* for wraparound handling */
521 int enabled; /* so we don't call enable more than */
522 /* once per disable */
523 int inmodeset; /* Display driver is setting mode */
524};
525
7f3c3d6f
HT
526/* location of GART table */
527#define DRM_ATI_GART_MAIN 1
528#define DRM_ATI_GART_FB 2
529
530#define DRM_ATI_GART_PCI 1
531#define DRM_ATI_GART_PCIE 2
532#define DRM_ATI_GART_IGP 3
533
534struct drm_ati_pcigart_info {
535 int gart_table_location;
536 int gart_reg_if;
537 void *addr;
538 dma_addr_t bus_addr;
b3705d71
HT
539 dma_addr_t table_mask;
540 dma_addr_t member_mask;
541 struct drm_dma_handle *table_handle;
7f3c3d6f
HT
542 drm_local_map_t mapping;
543 int table_size;
b3705d71 544 struct drm_dma_handle *dmah; /* handle for ATI PCIGART table */
7f3c3d6f
HT
545};
546
b3705d71
HT
547#ifndef DMA_BIT_MASK
548#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (1ULL<<(n)) - 1)
549#endif
550
551#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
552
7f3c3d6f
HT
553struct drm_driver_info {
554 int (*load)(struct drm_device *, unsigned long flags);
555 int (*firstopen)(struct drm_device *);
b3705d71 556 int (*open)(struct drm_device *, struct drm_file *);
7f3c3d6f 557 void (*preclose)(struct drm_device *, struct drm_file *file_priv);
b3705d71 558 void (*postclose)(struct drm_device *, struct drm_file *);
7f3c3d6f
HT
559 void (*lastclose)(struct drm_device *);
560 int (*unload)(struct drm_device *);
561 void (*reclaim_buffers_locked)(struct drm_device *,
562 struct drm_file *file_priv);
b3705d71
HT
563 int (*dma_ioctl)(struct drm_device *dev, void *data,
564 struct drm_file *file_priv);
7f3c3d6f
HT
565 void (*dma_ready)(struct drm_device *);
566 int (*dma_quiescent)(struct drm_device *);
567 int (*dma_flush_block_and_flush)(struct drm_device *, int context,
b3705d71 568 enum drm_lock_flags flags);
7f3c3d6f 569 int (*dma_flush_unblock)(struct drm_device *, int context,
b3705d71 570 enum drm_lock_flags flags);
7f3c3d6f
HT
571 int (*context_ctor)(struct drm_device *dev, int context);
572 int (*context_dtor)(struct drm_device *dev, int context);
573 int (*kernel_context_switch)(struct drm_device *dev, int old,
574 int new);
575 int (*kernel_context_switch_unlock)(struct drm_device *dev);
b3705d71
HT
576 void (*irq_preinstall)(struct drm_device *dev);
577 int (*irq_postinstall)(struct drm_device *dev);
578 void (*irq_uninstall)(struct drm_device *dev);
7f3c3d6f 579 void (*irq_handler)(DRM_IRQ_ARGS);
b3705d71
HT
580 u32 (*get_vblank_counter)(struct drm_device *dev, int crtc);
581 int (*enable_vblank)(struct drm_device *dev, int crtc);
582 void (*disable_vblank)(struct drm_device *dev, int crtc);
7f3c3d6f
HT
583
584 drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */
585
586 /**
587 * Called by \c drm_device_is_agp. Typically used to determine if a
588 * card is really attached to AGP or not.
589 *
590 * \param dev DRM device handle
591 *
592 * \returns
593 * One of three values is returned depending on whether or not the
594 * card is absolutely \b not AGP (return of 0), absolutely \b is AGP
595 * (return of 1), or may or may not be AGP (return of 2).
596 */
597 int (*device_is_agp) (struct drm_device * dev);
598
599 drm_ioctl_desc_t *ioctls;
600 int max_ioctl;
601
602 int buf_priv_size;
603
604 int major;
605 int minor;
606 int patchlevel;
607 const char *name; /* Simple driver name */
608 const char *desc; /* Longer driver name */
609 const char *date; /* Date of last major changes. */
610
b3705d71 611 u32 driver_features;
7f3c3d6f
HT
612};
613
614/* Length for the array of resource pointers for drm_get_resource_*. */
b3705d71 615#define DRM_MAX_PCI_RESOURCE 6
7f3c3d6f
HT
616
617/**
618 * DRM device functions structure
619 */
984263bc 620struct drm_device {
b3705d71 621 struct drm_driver_info *driver;
7f3c3d6f
HT
622 drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */
623
624 u_int16_t pci_device; /* PCI device id */
625 u_int16_t pci_vendor; /* PCI vendor id */
626
984263bc
MD
627 char *unique; /* Unique identifier: e.g., busid */
628 int unique_len; /* Length of unique field */
984263bc 629 device_t device; /* Device instance from newbus */
7f3c3d6f
HT
630 struct cdev *devnode; /* Device number for mknod */
631 int if_version; /* Highest interface version set */
984263bc
MD
632
633 int flags; /* Flags to open(2) */
634
635 /* Locks */
b3705d71
HT
636 DRM_SPINTYPE vbl_lock; /* protects vblank operations */
637 DRM_SPINTYPE dma_lock; /* protects dev->dma */
7f3c3d6f 638 struct lwkt_serialize irq_lock; /* protects irq condition checks */
b3705d71 639 DRM_SPINTYPE dev_lock; /* protects everything else */
7f3c3d6f
HT
640 DRM_SPINTYPE drw_lock;
641
984263bc
MD
642 /* Usage Counters */
643 int open_count; /* Outstanding files open */
644 int buf_use; /* Buffers in use -- cannot alloc */
984263bc
MD
645
646 /* Performance counters */
647 unsigned long counters;
b3705d71 648 enum drm_stat_type types[15];
984263bc
MD
649 atomic_t counts[15];
650
651 /* Authentication */
652 drm_file_list_t files;
653 drm_magic_head_t magiclist[DRM_HASH_SIZE];
654
7f3c3d6f
HT
655 /* Linked list of mappable regions. Protected by dev_lock */
656 drm_map_list_t maplist;
984263bc
MD
657
658 drm_local_map_t **context_sareas;
659 int max_context;
660
661 drm_lock_data_t lock; /* Information on hardware lock */
662
663 /* DMA queues (contexts) */
664 drm_device_dma_t *dma; /* Optional pointer for DMA support */
665
666 /* Context support */
667 int irq; /* Interrupt used by board */
7f3c3d6f 668 int irq_enabled; /* True if the irq handler is enabled */
b3705d71 669 int msi_enabled; /* MSI enabled */
7f3c3d6f 670 int irqrid; /* Interrupt used by board */
984263bc 671 struct resource *irqr; /* Resource for interrupt used by board */
984263bc 672 void *irqh; /* Handle from bus_setup_intr */
7f3c3d6f
HT
673
674 /* Storage of resource pointers for drm_get_resource_* */
675 struct resource *pcir[DRM_MAX_PCI_RESOURCE];
676 int pcirid[DRM_MAX_PCI_RESOURCE];
677
678 int pci_domain;
679 int pci_bus;
680 int pci_slot;
681 int pci_func;
682
984263bc 683 atomic_t context_flag; /* Context swapping flag */
984263bc 684 int last_context; /* Last current context */
984263bc 685
b3705d71 686 int vblank_disable_allowed;
b3705d71
HT
687 struct callout vblank_disable_timer;
688 u32 max_vblank_count; /* size of vblank counter register */
689 struct drm_vblank_info *vblank; /* per crtc vblank info */
690 int num_crtcs;
691
984263bc 692 struct sigio *buf_sigio; /* Processes waiting for SIGIO */
984263bc
MD
693
694 /* Sysctl support */
695 struct drm_sysctl_info *sysctl;
696
984263bc 697 drm_agp_head_t *agp;
984263bc
MD
698 drm_sg_mem_t *sg; /* Scatter gather memory */
699 atomic_t *ctx_bitmap;
700 void *dev_private;
7f3c3d6f
HT
701 unsigned int agp_buffer_token;
702 drm_local_map_t *agp_buffer_map;
984263bc 703
7f3c3d6f
HT
704 /* RB tree of drawable infos */
705 RB_HEAD(drawable_tree, bsd_drm_drawable_info) drw_head;
7f3c3d6f 706};
984263bc 707
b3705d71
HT
708static __inline__ int drm_core_check_feature(struct drm_device *dev,
709 int feature)
710{
711 return ((dev->driver->driver_features & feature) ? 1 : 0);
712}
713
714#if __OS_HAS_AGP
715static inline int drm_core_has_AGP(struct drm_device *dev)
716{
717 return drm_core_check_feature(dev, DRIVER_USE_AGP);
718}
719#else
720#define drm_core_has_AGP(dev) (0)
721#endif
722
7f3c3d6f
HT
723extern int drm_debug_flag;
724
725/* Device setup support (drm_drv.c) */
b3705d71
HT
726int drm_probe(device_t kdev, drm_pci_id_list_t *idlist);
727int drm_attach(device_t kdev, drm_pci_id_list_t *idlist);
b3705d71 728int drm_detach(device_t kdev);
7f3c3d6f
HT
729d_ioctl_t drm_ioctl;
730d_open_t drm_open;
2c845b81 731d_close_t drm_close;
7f3c3d6f
HT
732d_read_t drm_read;
733d_poll_t drm_poll;
734d_mmap_t drm_mmap;
b3705d71 735extern drm_local_map_t *drm_getsarea(struct drm_device *dev);
7f3c3d6f
HT
736
737/* File operations helpers (drm_fops.c) */
b3705d71
HT
738extern int drm_open_helper(struct cdev *kdev, int flags, int fmt,
739 DRM_STRUCTPROC *p,
740 struct drm_device *dev);
741extern struct drm_file *drm_find_file_by_proc(struct drm_device *dev,
742 DRM_STRUCTPROC *p);
7f3c3d6f
HT
743
744/* Memory management support (drm_memory.c) */
745void drm_mem_init(void);
746void drm_mem_uninit(void);
b3705d71
HT
747void *drm_ioremap_wc(struct drm_device *dev, drm_local_map_t *map);
748void *drm_ioremap(struct drm_device *dev, drm_local_map_t *map);
7f3c3d6f
HT
749void drm_ioremapfree(drm_local_map_t *map);
750int drm_mtrr_add(unsigned long offset, size_t size, int flags);
751int drm_mtrr_del(int handle, unsigned long offset, size_t size, int flags);
752
b3705d71
HT
753int drm_context_switch(struct drm_device *dev, int old, int new);
754int drm_context_switch_complete(struct drm_device *dev, int new);
7f3c3d6f 755
b3705d71
HT
756int drm_ctxbitmap_init(struct drm_device *dev);
757void drm_ctxbitmap_cleanup(struct drm_device *dev);
758void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
759int drm_ctxbitmap_next(struct drm_device *dev);
7f3c3d6f
HT
760
761/* Locking IOCTL support (drm_lock.c) */
b3705d71
HT
762int drm_lock_take(struct drm_lock_data *lock_data,
763 unsigned int context);
764int drm_lock_transfer(struct drm_lock_data *lock_data,
765 unsigned int context);
766int drm_lock_free(struct drm_lock_data *lock_data,
767 unsigned int context);
984263bc 768
7f3c3d6f 769/* Buffer management support (drm_bufs.c) */
b3705d71
HT
770unsigned long drm_get_resource_start(struct drm_device *dev,
771 unsigned int resource);
772unsigned long drm_get_resource_len(struct drm_device *dev,
773 unsigned int resource);
774void drm_rmmap(struct drm_device *dev, drm_local_map_t *map);
7f3c3d6f 775int drm_order(unsigned long size);
b3705d71
HT
776int drm_addmap(struct drm_device *dev, unsigned long offset,
777 unsigned long size,
778 enum drm_map_type type, enum drm_map_flags flags,
7f3c3d6f 779 drm_local_map_t **map_ptr);
b3705d71
HT
780int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *request);
781int drm_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *request);
782int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *request);
7f3c3d6f
HT
783
784/* DMA support (drm_dma.c) */
b3705d71
HT
785int drm_dma_setup(struct drm_device *dev);
786void drm_dma_takedown(struct drm_device *dev);
787void drm_free_buffer(struct drm_device *dev, drm_buf_t *buf);
788void drm_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv);
7f3c3d6f
HT
789#define drm_core_reclaim_buffers drm_reclaim_buffers
790
791/* IRQ support (drm_irq.c) */
b3705d71
HT
792int drm_irq_install(struct drm_device *dev);
793int drm_irq_uninstall(struct drm_device *dev);
7f3c3d6f 794irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
b3705d71
HT
795void drm_driver_irq_preinstall(struct drm_device *dev);
796void drm_driver_irq_postinstall(struct drm_device *dev);
797void drm_driver_irq_uninstall(struct drm_device *dev);
798void drm_handle_vblank(struct drm_device *dev, int crtc);
799u32 drm_vblank_count(struct drm_device *dev, int crtc);
800int drm_vblank_get(struct drm_device *dev, int crtc);
801void drm_vblank_put(struct drm_device *dev, int crtc);
802void drm_vblank_cleanup(struct drm_device *dev);
803int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq);
804int drm_vblank_init(struct drm_device *dev, int num_crtcs);
b3705d71
HT
805int drm_modeset_ctl(struct drm_device *dev, void *data,
806 struct drm_file *file_priv);
7f3c3d6f
HT
807
808/* AGP/PCI Express/GART support (drm_agpsupport.c) */
b3705d71
HT
809int drm_device_is_agp(struct drm_device *dev);
810int drm_device_is_pcie(struct drm_device *dev);
7f3c3d6f 811drm_agp_head_t *drm_agp_init(void);
b3705d71
HT
812int drm_agp_acquire(struct drm_device *dev);
813int drm_agp_release(struct drm_device *dev);
814int drm_agp_info(struct drm_device * dev, struct drm_agp_info *info);
815int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
7f3c3d6f
HT
816void *drm_agp_allocate_memory(size_t pages, u32 type);
817int drm_agp_free_memory(void *handle);
818int drm_agp_bind_memory(void *handle, off_t start);
819int drm_agp_unbind_memory(void *handle);
b3705d71
HT
820int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
821int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
822int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
823int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
7f3c3d6f
HT
824
825/* Scatter Gather Support (drm_scatter.c) */
826void drm_sg_cleanup(drm_sg_mem_t *entry);
b3705d71 827int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request);
7f3c3d6f 828
7f3c3d6f 829/* sysctl support (drm_sysctl.h) */
b3705d71
HT
830extern int drm_sysctl_init(struct drm_device *dev);
831extern int drm_sysctl_cleanup(struct drm_device *dev);
7f3c3d6f
HT
832
833/* ATI PCIGART support (ati_pcigart.c) */
b3705d71 834int drm_ati_pcigart_init(struct drm_device *dev,
7f3c3d6f 835 struct drm_ati_pcigart_info *gart_info);
b3705d71 836int drm_ati_pcigart_cleanup(struct drm_device *dev,
7f3c3d6f
HT
837 struct drm_ati_pcigart_info *gart_info);
838
839/* Locking IOCTL support (drm_drv.c) */
b3705d71
HT
840int drm_lock(struct drm_device *dev, void *data,
841 struct drm_file *file_priv);
842int drm_unlock(struct drm_device *dev, void *data,
843 struct drm_file *file_priv);
844int drm_version(struct drm_device *dev, void *data,
845 struct drm_file *file_priv);
846int drm_setversion(struct drm_device *dev, void *data,
847 struct drm_file *file_priv);
7f3c3d6f
HT
848
849/* Misc. IOCTL support (drm_ioctl.c) */
b3705d71
HT
850int drm_irq_by_busid(struct drm_device *dev, void *data,
851 struct drm_file *file_priv);
852int drm_getunique(struct drm_device *dev, void *data,
853 struct drm_file *file_priv);
854int drm_setunique(struct drm_device *dev, void *data,
855 struct drm_file *file_priv);
856int drm_getmap(struct drm_device *dev, void *data,
857 struct drm_file *file_priv);
858int drm_getclient(struct drm_device *dev, void *data,
859 struct drm_file *file_priv);
860int drm_getstats(struct drm_device *dev, void *data,
861 struct drm_file *file_priv);
862int drm_noop(struct drm_device *dev, void *data,
863 struct drm_file *file_priv);
7f3c3d6f
HT
864
865/* Context IOCTL support (drm_context.c) */
b3705d71
HT
866int drm_resctx(struct drm_device *dev, void *data,
867 struct drm_file *file_priv);
868int drm_addctx(struct drm_device *dev, void *data,
869 struct drm_file *file_priv);
870int drm_modctx(struct drm_device *dev, void *data,
871 struct drm_file *file_priv);
872int drm_getctx(struct drm_device *dev, void *data,
873 struct drm_file *file_priv);
874int drm_switchctx(struct drm_device *dev, void *data,
875 struct drm_file *file_priv);
876int drm_newctx(struct drm_device *dev, void *data,
877 struct drm_file *file_priv);
878int drm_rmctx(struct drm_device *dev, void *data,
879 struct drm_file *file_priv);
880int drm_setsareactx(struct drm_device *dev, void *data,
881 struct drm_file *file_priv);
882int drm_getsareactx(struct drm_device *dev, void *data,
883 struct drm_file *file_priv);
7f3c3d6f
HT
884
885/* Drawable IOCTL support (drm_drawable.c) */
b3705d71
HT
886int drm_adddraw(struct drm_device *dev, void *data,
887 struct drm_file *file_priv);
888int drm_rmdraw(struct drm_device *dev, void *data,
889 struct drm_file *file_priv);
890int drm_update_draw(struct drm_device *dev, void *data,
891 struct drm_file *file_priv);
892struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev,
893 int handle);
894
895/* Drawable support (drm_drawable.c) */
896void drm_drawable_free_all(struct drm_device *dev);
7f3c3d6f
HT
897
898/* Authentication IOCTL support (drm_auth.c) */
b3705d71
HT
899int drm_getmagic(struct drm_device *dev, void *data,
900 struct drm_file *file_priv);
901int drm_authmagic(struct drm_device *dev, void *data,
902 struct drm_file *file_priv);
7f3c3d6f
HT
903
904/* Buffer management support (drm_bufs.c) */
b3705d71
HT
905int drm_addmap_ioctl(struct drm_device *dev, void *data,
906 struct drm_file *file_priv);
907int drm_rmmap_ioctl(struct drm_device *dev, void *data,
908 struct drm_file *file_priv);
909int drm_addbufs(struct drm_device *dev, void *data,
910 struct drm_file *file_priv);
911int drm_infobufs(struct drm_device *dev, void *data,
912 struct drm_file *file_priv);
913int drm_markbufs(struct drm_device *dev, void *data,
914 struct drm_file *file_priv);
915int drm_freebufs(struct drm_device *dev, void *data,
916 struct drm_file *file_priv);
917int drm_mapbufs(struct drm_device *dev, void *data,
918 struct drm_file *file_priv);
7f3c3d6f
HT
919
920/* DMA support (drm_dma.c) */
b3705d71 921int drm_dma(struct drm_device *dev, void *data, struct drm_file *file_priv);
7f3c3d6f
HT
922
923/* IRQ support (drm_irq.c) */
b3705d71
HT
924int drm_control(struct drm_device *dev, void *data,
925 struct drm_file *file_priv);
926int drm_wait_vblank(struct drm_device *dev, void *data,
927 struct drm_file *file_priv);
7f3c3d6f
HT
928
929/* AGP/GART support (drm_agpsupport.c) */
b3705d71
HT
930int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
931 struct drm_file *file_priv);
932int drm_agp_release_ioctl(struct drm_device *dev, void *data,
933 struct drm_file *file_priv);
934int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
935 struct drm_file *file_priv);
936int drm_agp_info_ioctl(struct drm_device *dev, void *data,
937 struct drm_file *file_priv);
938int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
939 struct drm_file *file_priv);
940int drm_agp_free_ioctl(struct drm_device *dev, void *data,
941 struct drm_file *file_priv);
942int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
943 struct drm_file *file_priv);
944int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
945 struct drm_file *file_priv);
7f3c3d6f
HT
946
947/* Scatter Gather Support (drm_scatter.c) */
b3705d71
HT
948int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
949 struct drm_file *file_priv);
950int drm_sg_free(struct drm_device *dev, void *data,
951 struct drm_file *file_priv);
7f3c3d6f
HT
952
953/* consistent PCI memory functions (drm_pci.c) */
b3705d71
HT
954drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
955 size_t align, dma_addr_t maxaddr);
956void drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah);
957
958/* Inline replacements for drm_alloc and friends */
959static __inline__ void *
960drm_alloc(size_t size, struct malloc_type *area)
961{
962 return malloc(size, area, M_NOWAIT);
963}
964
965static __inline__ void *
966drm_calloc(size_t nmemb, size_t size, struct malloc_type *area)
967{
968 return malloc(size * nmemb, area, M_NOWAIT | M_ZERO);
969}
970
971static __inline__ void *
972drm_realloc(void *oldpt, size_t oldsize, size_t size,
973 struct malloc_type *area)
974{
975 return reallocf(oldpt, size, area, M_NOWAIT);
976}
977
978static __inline__ void
979drm_free(void *pt, size_t size, struct malloc_type *area)
980{
981 free(pt, area);
982}
7f3c3d6f
HT
983
984/* Inline replacements for DRM_IOREMAP macros */
b3705d71
HT
985static __inline__ void
986drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev)
987{
988 map->handle = drm_ioremap_wc(dev, map);
989}
990static __inline__ void
991drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
7f3c3d6f
HT
992{
993 map->handle = drm_ioremap(dev, map);
994}
b3705d71
HT
995static __inline__ void
996drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
7f3c3d6f
HT
997{
998 if ( map->handle && map->size )
999 drm_ioremapfree(map);
1000}
1001
b3705d71
HT
1002static __inline__ struct drm_local_map *
1003drm_core_findmap(struct drm_device *dev, unsigned long offset)
7f3c3d6f
HT
1004{
1005 drm_local_map_t *map;
1006
1007 DRM_SPINLOCK_ASSERT(&dev->dev_lock);
1008 TAILQ_FOREACH(map, &dev->maplist, link) {
1009 if (map->offset == offset)
1010 return map;
1011 }
1012 return NULL;
1013}
1014
1015static __inline__ void drm_core_dropmap(struct drm_map *map)
1016{
1017}
984263bc
MD
1018
1019#endif /* __KERNEL__ */
1020#endif /* _DRM_P_H_ */