drmP.h revision 182080
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 * 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> 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 $"); 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; 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> 52#include <sys/stat.h> 53#if __FreeBSD_version >= 700000 54#include <sys/priv.h> 55#endif 56#include <sys/proc.h> 57#include <sys/lock.h> 58#include <sys/fcntl.h> 59#include <sys/uio.h> 60#include <sys/filio.h> 61#include <sys/sysctl.h> 62#include <sys/bus.h> 63#include <sys/signalvar.h> 64#include <sys/poll.h> 65#include <sys/tree.h> 66#include <sys/taskqueue.h> 67#include <vm/vm.h> 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/sysarch.h> 77#include <sys/endian.h> 78#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> 88#if __FreeBSD_version >= 500000 89#include <sys/mutex.h> 90#include <dev/pci/pcivar.h> 91#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 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 */ 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 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 149#define DRM_MEM_IOCTLS 4 150#define DRM_MEM_MAPS 5 151#define DRM_MEM_BUFS 6 152#define DRM_MEM_SEGS 7 153#define DRM_MEM_PAGES 8 154#define DRM_MEM_FILES 9 155#define DRM_MEM_QUEUES 10 156#define DRM_MEM_CMDS 11 157#define DRM_MEM_MAPPINGS 12 158#define DRM_MEM_BUFLISTS 13 159#define DRM_MEM_AGPLISTS 14 160#define DRM_MEM_TOTALAGP 15 161#define DRM_MEM_BOUNDAGP 16 162#define DRM_MEM_CTXBITMAP 17 163#define DRM_MEM_STUB 18 164#define DRM_MEM_SGLISTS 19 165#define DRM_MEM_DRAWABLE 20 166 167#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) 168 169 /* Internal types and structures */ 170#define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) 171#define DRM_MIN(a,b) ((a)<(b)?(a):(b)) 172#define DRM_MAX(a,b) ((a)>(b)?(a):(b)) 173 174#define DRM_IF_VERSION(maj, min) (maj << 16 | min) 175 176MALLOC_DECLARE(M_DRM); 177 178#define __OS_HAS_AGP 1 179 180#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) 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 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) 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 240#if defined(__FreeBSD__) 241#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 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 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 283 284typedef unsigned long dma_addr_t; 285typedef u_int64_t u64; 286typedef u_int32_t u32; 287typedef u_int16_t u16; 288typedef u_int8_t u8; 289 290/* DRM_READMEMORYBARRIER() prevents reordering of reads. 291 * DRM_WRITEMEMORYBARRIER() prevents reordering of writes. 292 * DRM_MEMORYBARRIER() prevents reordering of reads and writes. 293 */ 294#if defined(__i386__) 295#define DRM_READMEMORYBARRIER() __asm __volatile( \ 296 "lock; addl $0,0(%%esp)" : : : "memory"); 297#define DRM_WRITEMEMORYBARRIER() __asm __volatile("" : : : "memory"); 298#define DRM_MEMORYBARRIER() __asm __volatile( \ 299 "lock; addl $0,0(%%esp)" : : : "memory"); 300#elif defined(__alpha__) 301#define DRM_READMEMORYBARRIER() alpha_mb(); 302#define DRM_WRITEMEMORYBARRIER() alpha_wmb(); 303#define DRM_MEMORYBARRIER() alpha_mb(); 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 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 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) 358#if __FreeBSD_version > 500000 359#define DRM_GET_USER_UNCHECKED(val, uaddr) \ 360 ((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 373#define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \ 374 (_map) = (_dev)->context_sareas[_ctx]; \ 375} while(0) 376 377#define LOCK_TEST_WITH_RETURN(dev, file_priv) \ 378do { \ 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 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} 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 { \ 418 if (drm_debug_flag) \ 419 printf("[" DRM_NAME ":pid%d:%s] " fmt, DRM_CURRENTPID, \ 420 __func__ , ## arg); \ 421} while (0) 422 423typedef struct drm_pci_id_list 424{ 425 int vendor; 426 int device; 427 long driver_private; 428 char *name; 429} drm_pci_id_list_t; 430 431#define DRM_AUTH 0x1 432#define DRM_MASTER 0x2 433#define DRM_ROOT_ONLY 0x4 434typedef struct drm_ioctl_desc { 435 unsigned long cmd; 436 int (*func)(struct drm_device *dev, void *data, 437 struct drm_file *file_priv); 438 int flags; 439} drm_ioctl_desc_t; 440/** 441 * Creates a driver or general drm_ioctl_desc array entry for the given 442 * ioctl, for use by drm_ioctl(). 443 */ 444#define DRM_IOCTL_DEF(ioctl, func, flags) \ 445 [DRM_IOCTL_NR(ioctl)] = {ioctl, func, flags} 446 447typedef struct drm_magic_entry { 448 drm_magic_t magic; 449 struct drm_file *priv; 450 struct drm_magic_entry *next; 451} drm_magic_entry_t; 452 453typedef struct drm_magic_head { 454 struct drm_magic_entry *head; 455 struct drm_magic_entry *tail; 456} drm_magic_head_t; 457 458typedef struct drm_buf { 459 int idx; /* Index into master buflist */ 460 int total; /* Buffer size */ 461 int order; /* log-base-2(total) */ 462 int used; /* Amount of buffer in use (for DMA) */ 463 unsigned long offset; /* Byte offset (used internally) */ 464 void *address; /* Address of buffer */ 465 unsigned long bus_address; /* Bus address of buffer */ 466 struct drm_buf *next; /* Kernel-only: used for free list */ 467 __volatile__ int pending; /* On hardware DMA queue */ 468 struct drm_file *file_priv; /* Unique identifier of holding process */ 469 int context; /* Kernel queue for this buffer */ 470 enum { 471 DRM_LIST_NONE = 0, 472 DRM_LIST_FREE = 1, 473 DRM_LIST_WAIT = 2, 474 DRM_LIST_PEND = 3, 475 DRM_LIST_PRIO = 4, 476 DRM_LIST_RECLAIM = 5 477 } list; /* Which list we're on */ 478 479 int dev_priv_size; /* Size of buffer private stoarge */ 480 void *dev_private; /* Per-buffer private storage */ 481} drm_buf_t; 482 483typedef struct drm_freelist { 484 int initialized; /* Freelist in use */ 485 atomic_t count; /* Number of free buffers */ 486 drm_buf_t *next; /* End pointer */ 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; 495#if defined(__FreeBSD__) 496 bus_dma_tag_t tag; 497 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; 517 int authenticated; 518 int master; 519 int minor; 520 pid_t pid; 521 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 { 529 drm_hw_lock_t *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 538 * when set marks that no further bufs may be allocated until device teardown 539 * occurs (when the last open of the device has closed). The high/low 540 * watermarks of bufs are only touched by the X Server, and thus not 541 * concurrently accessed, so no locking is needed. 542 */ 543typedef struct drm_device_dma { 544 drm_buf_entry_t bufs[DRM_MAX_ORDER+1]; 545 int buf_count; 546 drm_buf_t **buflist; /* Vector of pointers info bufs */ 547 int seg_count; 548 int page_count; 549 unsigned long *pagelist; 550 unsigned long byte_count; 551 enum { 552 _DRM_DMA_USE_AGP = 0x01, 553 _DRM_DMA_USE_SG = 0x02 554 } flags; 555} drm_device_dma_t; 556 557typedef struct drm_agp_mem { 558 void *handle; 559 unsigned long bound; /* address */ 560 int pages; 561 struct drm_agp_mem *prev; 562 struct drm_agp_mem *next; 563} drm_agp_mem_t; 564 565typedef struct drm_agp_head { 566 device_t agpdev; 567 struct agp_info info; 568 const char *chipset; 569 drm_agp_mem_t *memory; 570 unsigned long mode; 571 int enabled; 572 int acquired; 573 unsigned long base; 574 int mtrr; 575 int cant_use_aperture; 576 unsigned long page_mask; 577} drm_agp_head_t; 578 579typedef struct drm_sg_mem { 580 unsigned long handle; 581 void *virtual; 582 int pages; 583 dma_addr_t *busaddr; 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) */ 592 drm_map_type_t type; /* Type of memory mapped */ 593 drm_map_flags_t 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; 602 drm_dma_handle_t *dmah; 603 TAILQ_ENTRY(drm_local_map) link; 604} drm_local_map_t; 605 606TAILQ_HEAD(drm_vbl_sig_list, drm_vbl_sig); 607typedef struct drm_vbl_sig { 608 TAILQ_ENTRY(drm_vbl_sig) link; 609 unsigned int sequence; 610 int signo; 611 int pid; 612} drm_vbl_sig_t; 613 614struct drm_vblank_info { 615 wait_queue_head_t queue; /* vblank wait queue */ 616 atomic_t count; /* number of VBLANK interrupts */ 617 /* (driver must alloc the right number of counters) */ 618 struct drm_vbl_sig_list sigs; /* signal list to send on VBLANK */ 619 atomic_t refcount; /* number of users of vblank interrupts */ 620 u32 last; /* protected by dev->vbl_lock, used */ 621 /* for wraparound handling */ 622 int enabled; /* so we don't call enable more than */ 623 /* once per disable */ 624 int inmodeset; /* Display driver is setting mode */ 625}; 626 627/* location of GART table */ 628#define DRM_ATI_GART_MAIN 1 629#define DRM_ATI_GART_FB 2 630 631#define DRM_ATI_GART_PCI 1 632#define DRM_ATI_GART_PCIE 2 633#define DRM_ATI_GART_IGP 3 634 635struct drm_ati_pcigart_info { 636 int gart_table_location; 637 int gart_reg_if; 638 void *addr; 639 dma_addr_t bus_addr; 640 dma_addr_t table_mask; 641 dma_addr_t member_mask; 642 struct drm_dma_handle *table_handle; 643 drm_local_map_t mapping; 644 int table_size; 645}; 646 647#ifndef DMA_BIT_MASK 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 *); 656 int (*open)(struct drm_device *, drm_file_t *); 657 void (*preclose)(struct drm_device *, struct drm_file *file_priv); 658 void (*postclose)(struct drm_device *, drm_file_t *); 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, 668 drm_lock_flags_t flags); 669 int (*dma_flush_unblock)(struct drm_device *, int context, 670 drm_lock_flags_t 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); 679 void (*irq_handler)(DRM_IRQ_ARGS); 680 u32 (*get_vblank_counter)(struct drm_device *dev, int crtc); 681 int (*enable_vblank)(struct drm_device *dev, int crtc); 682 void (*disable_vblank)(struct drm_device *dev, int crtc); 683 684 drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */ 685 686 /** 687 * Called by \c drm_device_is_agp. Typically used to determine if a 688 * card is really attached to AGP or not. 689 * 690 * \param dev DRM device handle 691 * 692 * \returns 693 * One of three values is returned depending on whether or not the 694 * card is absolutely \b not AGP (return of 0), absolutely \b is AGP 695 * (return of 1), or may or may not be AGP (return of 2). 696 */ 697 int (*device_is_agp) (struct drm_device * dev); 698 699 drm_ioctl_desc_t *ioctls; 700 int max_ioctl; 701 702 int buf_priv_size; 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 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; 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 { 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; 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 */ 742#ifdef __FreeBSD__ 743 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 */ 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 */ 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; 766 drm_stat_type_t 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; 775 776 drm_local_map_t **context_sareas; 777 int max_context; 778 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 */ 787#ifdef __FreeBSD__ 788 int irqrid; /* Interrupt used by board */ 789 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; 801 int pci_slot; 802 int pci_func; 803 804 atomic_t context_flag; /* Context swapping flag */ 805 int last_context; /* Last current context */ 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 814#ifdef __FreeBSD__ 815 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 838extern int drm_debug_flag; 839 840/* 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); 844int drm_detach(device_t nbdev); 845d_ioctl_t drm_ioctl; 846d_open_t drm_open; 847d_close_t drm_close; 848d_read_t drm_read; 849d_poll_t drm_poll; 850d_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) */ 864#ifdef __FreeBSD__ 865extern int drm_open_helper(struct cdev *kdev, int flags, int fmt, 866 DRM_STRUCTPROC *p, 867 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); 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) */ 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, 904 unsigned int context); 905int drm_lock_free(struct drm_device *dev, 906 __volatile__ unsigned int *lock, 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, 918 drm_map_type_t type, drm_map_flags_t flags, 919 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); 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 931/* IRQ support (drm_irq.c) */ 932int drm_irq_install(struct drm_device *dev); 933int drm_irq_uninstall(struct drm_device *dev); 934irqreturn_t drm_irq_handler(DRM_IRQ_ARGS); 935void drm_driver_irq_preinstall(struct drm_device *dev); 936void drm_driver_irq_postinstall(struct drm_device *dev); 937void drm_driver_irq_uninstall(struct drm_device *dev); 938void drm_handle_vblank(struct drm_device *dev, int crtc); 939u32 drm_vblank_count(struct drm_device *dev, int crtc); 940int drm_vblank_get(struct drm_device *dev, int crtc); 941void drm_vblank_put(struct drm_device *dev, int crtc); 942int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); 943int drm_vblank_init(struct drm_device *dev, int num_crtcs); 944void drm_vbl_send_signals(struct drm_device *dev, int crtc); 945int drm_modeset_ctl(struct drm_device *dev, void *data, 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); 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); 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); 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); 964 965/* Scatter Gather Support (drm_scatter.c) */ 966void drm_sg_cleanup(drm_sg_mem_t *entry); 967int drm_sg_alloc(struct drm_device *dev, drm_scatter_gather_t * request); 968 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); 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) */ 982int drm_lock(struct drm_device *dev, void *data, 983 struct drm_file *file_priv); 984int drm_unlock(struct drm_device *dev, void *data, 985 struct drm_file *file_priv); 986int drm_version(struct drm_device *dev, void *data, 987 struct drm_file *file_priv); 988int drm_setversion(struct drm_device *dev, void *data, 989 struct drm_file *file_priv); 990 991/* Misc. IOCTL support (drm_ioctl.c) */ 992int drm_irq_by_busid(struct drm_device *dev, void *data, 993 struct drm_file *file_priv); 994int drm_getunique(struct drm_device *dev, void *data, 995 struct drm_file *file_priv); 996int drm_setunique(struct drm_device *dev, void *data, 997 struct drm_file *file_priv); 998int drm_getmap(struct drm_device *dev, void *data, 999 struct drm_file *file_priv); 1000int drm_getclient(struct drm_device *dev, void *data, 1001 struct drm_file *file_priv); 1002int drm_getstats(struct drm_device *dev, void *data, 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, 1011struct 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); 1020int drm_rmctx(struct drm_device *dev, void *data, 1021 struct drm_file *file_priv); 1022int drm_setsareactx(struct drm_device *dev, void *data, 1023 struct drm_file *file_priv); 1024int drm_getsareactx(struct drm_device *dev, void *data, 1025 struct drm_file *file_priv); 1026 1027/* Drawable IOCTL support (drm_drawable.c) */ 1028int drm_adddraw(struct drm_device *dev, void *data, 1029 struct drm_file *file_priv); 1030int drm_rmdraw(struct drm_device *dev, void *data, 1031 struct drm_file *file_priv); 1032int drm_update_draw(struct drm_device *dev, void *data, 1033 struct drm_file *file_priv); 1034struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev, 1035 int handle); 1036 1037/* Drawable support (drm_drawable.c) */ 1038void drm_drawable_free_all(struct drm_device *dev); 1039 1040/* Authentication IOCTL support (drm_auth.c) */ 1041int drm_getmagic(struct drm_device *dev, void *data, 1042 struct drm_file *file_priv); 1043int drm_authmagic(struct drm_device *dev, void *data, 1044 struct drm_file *file_priv); 1045 1046/* Buffer management support (drm_bufs.c) */ 1047int drm_addmap_ioctl(struct drm_device *dev, void *data, 1048 struct drm_file *file_priv); 1049int drm_rmmap_ioctl(struct drm_device *dev, void *data, 1050 struct drm_file *file_priv); 1051int drm_addbufs_ioctl(struct drm_device *dev, void *data, 1052 struct drm_file *file_priv); 1053int drm_infobufs(struct drm_device *dev, void *data, 1054 struct drm_file *file_priv); 1055int drm_markbufs(struct drm_device *dev, void *data, 1056 struct drm_file *file_priv); 1057int drm_freebufs(struct drm_device *dev, void *data, 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) */ 1066int drm_control(struct drm_device *dev, void *data, 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); 1075int drm_agp_release_ioctl(struct drm_device *dev, void *data, 1076 struct drm_file *file_priv); 1077int drm_agp_enable_ioctl(struct drm_device *dev, void *data, 1078 struct drm_file *file_priv); 1079int drm_agp_info_ioctl(struct drm_device *dev, void *data, 1080 struct drm_file *file_priv); 1081int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, 1082 struct drm_file *file_priv); 1083int drm_agp_free_ioctl(struct drm_device *dev, void *data, 1084 struct drm_file *file_priv); 1085int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, 1086 struct drm_file *file_priv); 1087int drm_agp_bind_ioctl(struct drm_device *dev, void *data, 1088 struct drm_file *file_priv); 1089 1090/* Scatter Gather Support (drm_scatter.c) */ 1091int drm_sg_alloc_ioctl(struct drm_device *dev, void *data, 1092 struct drm_file *file_priv); 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 1101#define drm_core_ioremap_wc drm_core_ioremap 1102 1103/* Inline replacements for DRM_IOREMAP macros */ 1104static __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 ) 1113 drm_ioremapfree(map); 1114} 1115 1116static __inline__ struct drm_local_map * 1117drm_core_findmap(struct drm_device *dev, unsigned long offset) 1118{ 1119 drm_local_map_t *map; 1120 1121 DRM_SPINLOCK_ASSERT(&dev->dev_lock); 1122 TAILQ_FOREACH(map, &dev->maplist, link) { 1123 if (map->offset == offset) 1124 return map; 1125 } 1126 return NULL; 1127} 1128 1129static __inline__ void drm_core_dropmap(struct drm_map *map) 1130{ 1131} 1132 1133#endif /* __KERNEL__ */ 1134#endif /* _DRM_P_H_ */ 1135