drmP.h 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102
  1. /**
  2. * \file drmP.h
  3. * Private header for Direct Rendering Manager
  4. *
  5. * \author Rickard E. (Rik) Faith <faith@valinux.com>
  6. * \author Gareth Hughes <gareth@valinux.com>
  7. */
  8. /*
  9. * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  10. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
  11. * All rights reserved.
  12. *
  13. * Permission is hereby granted, free of charge, to any person obtaining a
  14. * copy of this software and associated documentation files (the "Software"),
  15. * to deal in the Software without restriction, including without limitation
  16. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  17. * and/or sell copies of the Software, and to permit persons to whom the
  18. * Software is furnished to do so, subject to the following conditions:
  19. *
  20. * The above copyright notice and this permission notice (including the next
  21. * paragraph) shall be included in all copies or substantial portions of the
  22. * Software.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  26. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  27. * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  28. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  29. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  30. * OTHER DEALINGS IN THE SOFTWARE.
  31. */
  32. #ifndef _DRM_P_H_
  33. #define _DRM_P_H_
  34. /* If you want the memory alloc debug functionality, change define below */
  35. /* #define DEBUG_MEMORY */
  36. #ifdef __KERNEL__
  37. #ifdef __alpha__
  38. /* add include of current.h so that "current" is defined
  39. * before static inline funcs in wait.h. Doing this so we
  40. * can build the DRM (part of PI DRI). 4/21/2000 S + B */
  41. #include <asm/current.h>
  42. #endif /* __alpha__ */
  43. #include <linux/module.h>
  44. #include <linux/kernel.h>
  45. #include <linux/miscdevice.h>
  46. #include <linux/fs.h>
  47. #include <linux/proc_fs.h>
  48. #include <linux/init.h>
  49. #include <linux/file.h>
  50. #include <linux/pci.h>
  51. #include <linux/jiffies.h>
  52. #include <linux/smp_lock.h> /* For (un)lock_kernel */
  53. #include <linux/mm.h>
  54. #include <linux/cdev.h>
  55. #include <linux/mutex.h>
  56. #if defined(__alpha__) || defined(__powerpc__)
  57. #include <asm/pgtable.h> /* For pte_wrprotect */
  58. #endif
  59. #include <asm/io.h>
  60. #include <asm/mman.h>
  61. #include <asm/uaccess.h>
  62. #ifdef CONFIG_MTRR
  63. #include <asm/mtrr.h>
  64. #endif
  65. #if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
  66. #include <linux/types.h>
  67. #include <linux/agp_backend.h>
  68. #endif
  69. #include <linux/workqueue.h>
  70. #include <linux/poll.h>
  71. #include <asm/pgalloc.h>
  72. #include "drm.h"
  73. #define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
  74. #define __OS_HAS_MTRR (defined(CONFIG_MTRR))
  75. #include "drm_os_linux.h"
  76. /***********************************************************************/
  77. /** \name DRM template customization defaults */
  78. /*@{*/
  79. /* driver capabilities and requirements mask */
  80. #define DRIVER_USE_AGP 0x1
  81. #define DRIVER_REQUIRE_AGP 0x2
  82. #define DRIVER_USE_MTRR 0x4
  83. #define DRIVER_PCI_DMA 0x8
  84. #define DRIVER_SG 0x10
  85. #define DRIVER_HAVE_DMA 0x20
  86. #define DRIVER_HAVE_IRQ 0x40
  87. #define DRIVER_IRQ_SHARED 0x80
  88. #define DRIVER_IRQ_VBL 0x100
  89. #define DRIVER_DMA_QUEUE 0x200
  90. #define DRIVER_FB_DMA 0x400
  91. /***********************************************************************/
  92. /** \name Begin the DRM... */
  93. /*@{*/
  94. #define DRM_DEBUG_CODE 2 /**< Include debugging code if > 1, then
  95. also include looping detection. */
  96. #define DRM_HASH_SIZE 16 /**< Size of key hash table. Must be power of 2. */
  97. #define DRM_KERNEL_CONTEXT 0 /**< Change drm_resctx if changed */
  98. #define DRM_RESERVED_CONTEXTS 1 /**< Change drm_resctx if changed */
  99. #define DRM_LOOPING_LIMIT 5000000
  100. #define DRM_TIME_SLICE (HZ/20) /**< Time slice for GLXContexts */
  101. #define DRM_LOCK_SLICE 1 /**< Time slice for lock, in jiffies */
  102. #define DRM_FLAG_DEBUG 0x01
  103. #define DRM_MEM_DMA 0
  104. #define DRM_MEM_SAREA 1
  105. #define DRM_MEM_DRIVER 2
  106. #define DRM_MEM_MAGIC 3
  107. #define DRM_MEM_IOCTLS 4
  108. #define DRM_MEM_MAPS 5
  109. #define DRM_MEM_VMAS 6
  110. #define DRM_MEM_BUFS 7
  111. #define DRM_MEM_SEGS 8
  112. #define DRM_MEM_PAGES 9
  113. #define DRM_MEM_FILES 10
  114. #define DRM_MEM_QUEUES 11
  115. #define DRM_MEM_CMDS 12
  116. #define DRM_MEM_MAPPINGS 13
  117. #define DRM_MEM_BUFLISTS 14
  118. #define DRM_MEM_AGPLISTS 15
  119. #define DRM_MEM_TOTALAGP 16
  120. #define DRM_MEM_BOUNDAGP 17
  121. #define DRM_MEM_CTXBITMAP 18
  122. #define DRM_MEM_STUB 19
  123. #define DRM_MEM_SGLISTS 20
  124. #define DRM_MEM_CTXLIST 21
  125. #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
  126. /*@}*/
  127. /***********************************************************************/
  128. /** \name Backward compatibility section */
  129. /*@{*/
  130. #define DRM_RPR_ARG(vma) vma,
  131. #define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT)
  132. /*@}*/
  133. /***********************************************************************/
  134. /** \name Macros to make printk easier */
  135. /*@{*/
  136. /**
  137. * Error output.
  138. *
  139. * \param fmt printf() like format string.
  140. * \param arg arguments
  141. */
  142. #define DRM_ERROR(fmt, arg...) \
  143. printk(KERN_ERR "[" DRM_NAME ":%s] *ERROR* " fmt , __FUNCTION__ , ##arg)
  144. /**
  145. * Memory error output.
  146. *
  147. * \param area memory area where the error occurred.
  148. * \param fmt printf() like format string.
  149. * \param arg arguments
  150. */
  151. #define DRM_MEM_ERROR(area, fmt, arg...) \
  152. printk(KERN_ERR "[" DRM_NAME ":%s:%s] *ERROR* " fmt , __FUNCTION__, \
  153. drm_mem_stats[area].name , ##arg)
  154. #define DRM_INFO(fmt, arg...) printk(KERN_INFO "[" DRM_NAME "] " fmt , ##arg)
  155. /**
  156. * Debug output.
  157. *
  158. * \param fmt printf() like format string.
  159. * \param arg arguments
  160. */
  161. #if DRM_DEBUG_CODE
  162. #define DRM_DEBUG(fmt, arg...) \
  163. do { \
  164. if ( drm_debug ) \
  165. printk(KERN_DEBUG \
  166. "[" DRM_NAME ":%s] " fmt , \
  167. __FUNCTION__ , ##arg); \
  168. } while (0)
  169. #else
  170. #define DRM_DEBUG(fmt, arg...) do { } while (0)
  171. #endif
  172. #define DRM_PROC_LIMIT (PAGE_SIZE-80)
  173. #define DRM_PROC_PRINT(fmt, arg...) \
  174. len += sprintf(&buf[len], fmt , ##arg); \
  175. if (len > DRM_PROC_LIMIT) { *eof = 1; return len - offset; }
  176. #define DRM_PROC_PRINT_RET(ret, fmt, arg...) \
  177. len += sprintf(&buf[len], fmt , ##arg); \
  178. if (len > DRM_PROC_LIMIT) { ret; *eof = 1; return len - offset; }
  179. /*@}*/
  180. /***********************************************************************/
  181. /** \name Internal types and structures */
  182. /*@{*/
  183. #define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x)
  184. #define DRM_MIN(a,b) min(a,b)
  185. #define DRM_MAX(a,b) max(a,b)
  186. #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1))
  187. #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x))
  188. #define DRM_WAITCOUNT(dev,idx) DRM_BUFCOUNT(&dev->queuelist[idx]->waitlist)
  189. #define DRM_IF_VERSION(maj, min) (maj << 16 | min)
  190. /**
  191. * Get the private SAREA mapping.
  192. *
  193. * \param _dev DRM device.
  194. * \param _ctx context number.
  195. * \param _map output mapping.
  196. */
  197. #define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \
  198. (_map) = (_dev)->context_sareas[_ctx]; \
  199. } while(0)
  200. /**
  201. * Test that the hardware lock is held by the caller, returning otherwise.
  202. *
  203. * \param dev DRM device.
  204. * \param filp file pointer of the caller.
  205. */
  206. #define LOCK_TEST_WITH_RETURN( dev, filp ) \
  207. do { \
  208. if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \
  209. dev->lock.filp != filp ) { \
  210. DRM_ERROR( "%s called without lock held\n", \
  211. __FUNCTION__ ); \
  212. return -EINVAL; \
  213. } \
  214. } while (0)
  215. /**
  216. * Copy and IOCTL return string to user space
  217. */
  218. #define DRM_COPY( name, value ) \
  219. len = strlen( value ); \
  220. if ( len > name##_len ) len = name##_len; \
  221. name##_len = strlen( value ); \
  222. if ( len && name ) { \
  223. if ( copy_to_user( name, value, len ) ) \
  224. return -EFAULT; \
  225. }
  226. /**
  227. * Ioctl function type.
  228. *
  229. * \param inode device inode.
  230. * \param filp file pointer.
  231. * \param cmd command.
  232. * \param arg argument.
  233. */
  234. typedef int drm_ioctl_t(struct inode *inode, struct file *filp,
  235. unsigned int cmd, unsigned long arg);
  236. typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
  237. unsigned long arg);
  238. #define DRM_AUTH 0x1
  239. #define DRM_MASTER 0x2
  240. #define DRM_ROOT_ONLY 0x4
  241. typedef struct drm_ioctl_desc {
  242. drm_ioctl_t *func;
  243. int flags;
  244. } drm_ioctl_desc_t;
  245. typedef struct drm_devstate {
  246. pid_t owner; /**< X server pid holding x_lock */
  247. } drm_devstate_t;
  248. typedef struct drm_magic_entry {
  249. drm_magic_t magic;
  250. struct drm_file *priv;
  251. struct drm_magic_entry *next;
  252. } drm_magic_entry_t;
  253. typedef struct drm_magic_head {
  254. struct drm_magic_entry *head;
  255. struct drm_magic_entry *tail;
  256. } drm_magic_head_t;
  257. typedef struct drm_vma_entry {
  258. struct vm_area_struct *vma;
  259. struct drm_vma_entry *next;
  260. pid_t pid;
  261. } drm_vma_entry_t;
  262. /**
  263. * DMA buffer.
  264. */
  265. typedef struct drm_buf {
  266. int idx; /**< Index into master buflist */
  267. int total; /**< Buffer size */
  268. int order; /**< log-base-2(total) */
  269. int used; /**< Amount of buffer in use (for DMA) */
  270. unsigned long offset; /**< Byte offset (used internally) */
  271. void *address; /**< Address of buffer */
  272. unsigned long bus_address; /**< Bus address of buffer */
  273. struct drm_buf *next; /**< Kernel-only: used for free list */
  274. __volatile__ int waiting; /**< On kernel DMA queue */
  275. __volatile__ int pending; /**< On hardware DMA queue */
  276. wait_queue_head_t dma_wait; /**< Processes waiting */
  277. struct file *filp; /**< Pointer to holding file descr */
  278. int context; /**< Kernel queue for this buffer */
  279. int while_locked; /**< Dispatch this buffer while locked */
  280. enum {
  281. DRM_LIST_NONE = 0,
  282. DRM_LIST_FREE = 1,
  283. DRM_LIST_WAIT = 2,
  284. DRM_LIST_PEND = 3,
  285. DRM_LIST_PRIO = 4,
  286. DRM_LIST_RECLAIM = 5
  287. } list; /**< Which list we're on */
  288. int dev_priv_size; /**< Size of buffer private storage */
  289. void *dev_private; /**< Per-buffer private storage */
  290. } drm_buf_t;
  291. /** bufs is one longer than it has to be */
  292. typedef struct drm_waitlist {
  293. int count; /**< Number of possible buffers */
  294. drm_buf_t **bufs; /**< List of pointers to buffers */
  295. drm_buf_t **rp; /**< Read pointer */
  296. drm_buf_t **wp; /**< Write pointer */
  297. drm_buf_t **end; /**< End pointer */
  298. spinlock_t read_lock;
  299. spinlock_t write_lock;
  300. } drm_waitlist_t;
  301. typedef struct drm_freelist {
  302. int initialized; /**< Freelist in use */
  303. atomic_t count; /**< Number of free buffers */
  304. drm_buf_t *next; /**< End pointer */
  305. wait_queue_head_t waiting; /**< Processes waiting on free bufs */
  306. int low_mark; /**< Low water mark */
  307. int high_mark; /**< High water mark */
  308. atomic_t wfh; /**< If waiting for high mark */
  309. spinlock_t lock;
  310. } drm_freelist_t;
  311. typedef struct drm_dma_handle {
  312. dma_addr_t busaddr;
  313. void *vaddr;
  314. size_t size;
  315. } drm_dma_handle_t;
  316. /**
  317. * Buffer entry. There is one of this for each buffer size order.
  318. */
  319. typedef struct drm_buf_entry {
  320. int buf_size; /**< size */
  321. int buf_count; /**< number of buffers */
  322. drm_buf_t *buflist; /**< buffer list */
  323. int seg_count;
  324. int page_order;
  325. drm_dma_handle_t **seglist;
  326. drm_freelist_t freelist;
  327. } drm_buf_entry_t;
  328. /** File private data */
  329. typedef struct drm_file {
  330. int authenticated;
  331. int master;
  332. int minor;
  333. pid_t pid;
  334. uid_t uid;
  335. drm_magic_t magic;
  336. unsigned long ioctl_count;
  337. struct drm_file *next;
  338. struct drm_file *prev;
  339. struct drm_head *head;
  340. int remove_auth_on_close;
  341. unsigned long lock_count;
  342. void *driver_priv;
  343. } drm_file_t;
  344. /** Wait queue */
  345. typedef struct drm_queue {
  346. atomic_t use_count; /**< Outstanding uses (+1) */
  347. atomic_t finalization; /**< Finalization in progress */
  348. atomic_t block_count; /**< Count of processes waiting */
  349. atomic_t block_read; /**< Queue blocked for reads */
  350. wait_queue_head_t read_queue; /**< Processes waiting on block_read */
  351. atomic_t block_write; /**< Queue blocked for writes */
  352. wait_queue_head_t write_queue; /**< Processes waiting on block_write */
  353. #if 1
  354. atomic_t total_queued; /**< Total queued statistic */
  355. atomic_t total_flushed; /**< Total flushes statistic */
  356. atomic_t total_locks; /**< Total locks statistics */
  357. #endif
  358. drm_ctx_flags_t flags; /**< Context preserving and 2D-only */
  359. drm_waitlist_t waitlist; /**< Pending buffers */
  360. wait_queue_head_t flush_queue; /**< Processes waiting until flush */
  361. } drm_queue_t;
  362. /**
  363. * Lock data.
  364. */
  365. typedef struct drm_lock_data {
  366. drm_hw_lock_t *hw_lock; /**< Hardware lock */
  367. struct file *filp; /**< File descr of lock holder (0=kernel) */
  368. wait_queue_head_t lock_queue; /**< Queue of blocked processes */
  369. unsigned long lock_time; /**< Time of last lock in jiffies */
  370. } drm_lock_data_t;
  371. /**
  372. * DMA data.
  373. */
  374. typedef struct drm_device_dma {
  375. drm_buf_entry_t bufs[DRM_MAX_ORDER + 1]; /**< buffers, grouped by their size order */
  376. int buf_count; /**< total number of buffers */
  377. drm_buf_t **buflist; /**< Vector of pointers into drm_device_dma::bufs */
  378. int seg_count;
  379. int page_count; /**< number of pages */
  380. unsigned long *pagelist; /**< page list */
  381. unsigned long byte_count;
  382. enum {
  383. _DRM_DMA_USE_AGP = 0x01,
  384. _DRM_DMA_USE_SG = 0x02,
  385. _DRM_DMA_USE_FB = 0x04
  386. } flags;
  387. } drm_device_dma_t;
  388. /**
  389. * AGP memory entry. Stored as a doubly linked list.
  390. */
  391. typedef struct drm_agp_mem {
  392. unsigned long handle; /**< handle */
  393. DRM_AGP_MEM *memory;
  394. unsigned long bound; /**< address */
  395. int pages;
  396. struct drm_agp_mem *prev; /**< previous entry */
  397. struct drm_agp_mem *next; /**< next entry */
  398. } drm_agp_mem_t;
  399. /**
  400. * AGP data.
  401. *
  402. * \sa drm_agp_init() and drm_device::agp.
  403. */
  404. typedef struct drm_agp_head {
  405. DRM_AGP_KERN agp_info; /**< AGP device information */
  406. drm_agp_mem_t *memory; /**< memory entries */
  407. unsigned long mode; /**< AGP mode */
  408. struct agp_bridge_data *bridge;
  409. int enabled; /**< whether the AGP bus as been enabled */
  410. int acquired; /**< whether the AGP device has been acquired */
  411. unsigned long base;
  412. int agp_mtrr;
  413. int cant_use_aperture;
  414. unsigned long page_mask;
  415. } drm_agp_head_t;
  416. /**
  417. * Scatter-gather memory.
  418. */
  419. typedef struct drm_sg_mem {
  420. unsigned long handle;
  421. void *virtual;
  422. int pages;
  423. struct page **pagelist;
  424. dma_addr_t *busaddr;
  425. } drm_sg_mem_t;
  426. typedef struct drm_sigdata {
  427. int context;
  428. drm_hw_lock_t *lock;
  429. } drm_sigdata_t;
  430. /**
  431. * Mappings list
  432. */
  433. typedef struct drm_map_list {
  434. struct list_head head; /**< list head */
  435. drm_map_t *map; /**< mapping */
  436. unsigned int user_token;
  437. } drm_map_list_t;
  438. typedef drm_map_t drm_local_map_t;
  439. /**
  440. * Context handle list
  441. */
  442. typedef struct drm_ctx_list {
  443. struct list_head head; /**< list head */
  444. drm_context_t handle; /**< context handle */
  445. drm_file_t *tag; /**< associated fd private data */
  446. } drm_ctx_list_t;
  447. typedef struct drm_vbl_sig {
  448. struct list_head head;
  449. unsigned int sequence;
  450. struct siginfo info;
  451. struct task_struct *task;
  452. } drm_vbl_sig_t;
  453. /* location of GART table */
  454. #define DRM_ATI_GART_MAIN 1
  455. #define DRM_ATI_GART_FB 2
  456. typedef struct ati_pcigart_info {
  457. int gart_table_location;
  458. int is_pcie;
  459. void *addr;
  460. dma_addr_t bus_addr;
  461. drm_local_map_t mapping;
  462. } drm_ati_pcigart_info;
  463. /**
  464. * DRM driver structure. This structure represent the common code for
  465. * a family of cards. There will one drm_device for each card present
  466. * in this family
  467. */
  468. struct drm_device;
  469. struct drm_driver {
  470. int (*load) (struct drm_device *, unsigned long flags);
  471. int (*firstopen) (struct drm_device *);
  472. int (*open) (struct drm_device *, drm_file_t *);
  473. void (*preclose) (struct drm_device *, struct file * filp);
  474. void (*postclose) (struct drm_device *, drm_file_t *);
  475. void (*lastclose) (struct drm_device *);
  476. int (*unload) (struct drm_device *);
  477. int (*dma_ioctl) (DRM_IOCTL_ARGS);
  478. void (*dma_ready) (struct drm_device *);
  479. int (*dma_quiescent) (struct drm_device *);
  480. int (*context_ctor) (struct drm_device * dev, int context);
  481. int (*context_dtor) (struct drm_device * dev, int context);
  482. int (*kernel_context_switch) (struct drm_device * dev, int old,
  483. int new);
  484. void (*kernel_context_switch_unlock) (struct drm_device * dev,
  485. drm_lock_t *lock);
  486. int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence);
  487. int (*dri_library_name) (struct drm_device *dev, char *buf);
  488. /**
  489. * Called by \c drm_device_is_agp. Typically used to determine if a
  490. * card is really attached to AGP or not.
  491. *
  492. * \param dev DRM device handle
  493. *
  494. * \returns
  495. * One of three values is returned depending on whether or not the
  496. * card is absolutely \b not AGP (return of 0), absolutely \b is AGP
  497. * (return of 1), or may or may not be AGP (return of 2).
  498. */
  499. int (*device_is_agp) (struct drm_device * dev);
  500. /* these have to be filled in */
  501. irqreturn_t(*irq_handler) (DRM_IRQ_ARGS);
  502. void (*irq_preinstall) (struct drm_device * dev);
  503. void (*irq_postinstall) (struct drm_device * dev);
  504. void (*irq_uninstall) (struct drm_device * dev);
  505. void (*reclaim_buffers) (struct drm_device * dev, struct file * filp);
  506. void (*reclaim_buffers_locked) (struct drm_device *dev,
  507. struct file *filp);
  508. unsigned long (*get_map_ofs) (drm_map_t * map);
  509. unsigned long (*get_reg_ofs) (struct drm_device * dev);
  510. void (*set_version) (struct drm_device * dev, drm_set_version_t * sv);
  511. int major;
  512. int minor;
  513. int patchlevel;
  514. char *name;
  515. char *desc;
  516. char *date;
  517. u32 driver_features;
  518. int dev_priv_size;
  519. drm_ioctl_desc_t *ioctls;
  520. int num_ioctls;
  521. struct file_operations fops;
  522. struct pci_driver pci_driver;
  523. };
  524. /**
  525. * DRM head structure. This structure represent a video head on a card
  526. * that may contain multiple heads. Embed one per head of these in the
  527. * private drm_device structure.
  528. */
  529. typedef struct drm_head {
  530. int minor; /**< Minor device number */
  531. struct drm_device *dev;
  532. struct proc_dir_entry *dev_root; /**< proc directory entry */
  533. dev_t device; /**< Device number for mknod */
  534. struct class_device *dev_class;
  535. } drm_head_t;
  536. /**
  537. * DRM device structure. This structure represent a complete card that
  538. * may contain multiple heads.
  539. */
  540. typedef struct drm_device {
  541. char *unique; /**< Unique identifier: e.g., busid */
  542. int unique_len; /**< Length of unique field */
  543. char *devname; /**< For /proc/interrupts */
  544. int if_version; /**< Highest interface version set */
  545. int blocked; /**< Blocked due to VC switch? */
  546. /** \name Locks */
  547. /*@{ */
  548. spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */
  549. struct mutex struct_mutex; /**< For others */
  550. /*@} */
  551. /** \name Usage Counters */
  552. /*@{ */
  553. int open_count; /**< Outstanding files open */
  554. atomic_t ioctl_count; /**< Outstanding IOCTLs pending */
  555. atomic_t vma_count; /**< Outstanding vma areas open */
  556. int buf_use; /**< Buffers in use -- cannot alloc */
  557. atomic_t buf_alloc; /**< Buffer allocation in progress */
  558. /*@} */
  559. /** \name Performance counters */
  560. /*@{ */
  561. unsigned long counters;
  562. drm_stat_type_t types[15];
  563. atomic_t counts[15];
  564. /*@} */
  565. /** \name Authentication */
  566. /*@{ */
  567. drm_file_t *file_first; /**< file list head */
  568. drm_file_t *file_last; /**< file list tail */
  569. drm_magic_head_t magiclist[DRM_HASH_SIZE]; /**< magic hash table */
  570. /*@} */
  571. /** \name Memory management */
  572. /*@{ */
  573. drm_map_list_t *maplist; /**< Linked list of regions */
  574. int map_count; /**< Number of mappable regions */
  575. /** \name Context handle management */
  576. /*@{ */
  577. drm_ctx_list_t *ctxlist; /**< Linked list of context handles */
  578. int ctx_count; /**< Number of context handles */
  579. struct mutex ctxlist_mutex; /**< For ctxlist */
  580. drm_map_t **context_sareas; /**< per-context SAREA's */
  581. int max_context;
  582. drm_vma_entry_t *vmalist; /**< List of vmas (for debugging) */
  583. drm_lock_data_t lock; /**< Information on hardware lock */
  584. /*@} */
  585. /** \name DMA queues (contexts) */
  586. /*@{ */
  587. int queue_count; /**< Number of active DMA queues */
  588. int queue_reserved; /**< Number of reserved DMA queues */
  589. int queue_slots; /**< Actual length of queuelist */
  590. drm_queue_t **queuelist; /**< Vector of pointers to DMA queues */
  591. drm_device_dma_t *dma; /**< Optional pointer for DMA support */
  592. /*@} */
  593. /** \name Context support */
  594. /*@{ */
  595. int irq; /**< Interrupt used by board */
  596. int irq_enabled; /**< True if irq handler is enabled */
  597. __volatile__ long context_flag; /**< Context swapping flag */
  598. __volatile__ long interrupt_flag; /**< Interruption handler flag */
  599. __volatile__ long dma_flag; /**< DMA dispatch flag */
  600. struct timer_list timer; /**< Timer for delaying ctx switch */
  601. wait_queue_head_t context_wait; /**< Processes waiting on ctx switch */
  602. int last_checked; /**< Last context checked for DMA */
  603. int last_context; /**< Last current context */
  604. unsigned long last_switch; /**< jiffies at last context switch */
  605. /*@} */
  606. struct work_struct work;
  607. /** \name VBLANK IRQ support */
  608. /*@{ */
  609. wait_queue_head_t vbl_queue; /**< VBLANK wait queue */
  610. atomic_t vbl_received;
  611. spinlock_t vbl_lock;
  612. drm_vbl_sig_t vbl_sigs; /**< signal list to send on VBLANK */
  613. unsigned int vbl_pending;
  614. /*@} */
  615. cycles_t ctx_start;
  616. cycles_t lck_start;
  617. struct fasync_struct *buf_async;/**< Processes waiting for SIGIO */
  618. wait_queue_head_t buf_readers; /**< Processes waiting to read */
  619. wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */
  620. drm_agp_head_t *agp; /**< AGP data */
  621. struct pci_dev *pdev; /**< PCI device structure */
  622. int pci_domain; /**< PCI bus domain number */
  623. int pci_bus; /**< PCI bus number */
  624. int pci_slot; /**< PCI slot number */
  625. int pci_func; /**< PCI function number */
  626. #ifdef __alpha__
  627. struct pci_controller *hose;
  628. #endif
  629. drm_sg_mem_t *sg; /**< Scatter gather memory */
  630. unsigned long *ctx_bitmap; /**< context bitmap */
  631. void *dev_private; /**< device private data */
  632. drm_sigdata_t sigdata; /**< For block_all_signals */
  633. sigset_t sigmask;
  634. struct drm_driver *driver;
  635. drm_local_map_t *agp_buffer_map;
  636. unsigned int agp_buffer_token;
  637. drm_head_t primary; /**< primary screen head */
  638. } drm_device_t;
  639. static __inline__ int drm_core_check_feature(struct drm_device *dev,
  640. int feature)
  641. {
  642. return ((dev->driver->driver_features & feature) ? 1 : 0);
  643. }
  644. #if __OS_HAS_AGP
  645. static inline int drm_core_has_AGP(struct drm_device *dev)
  646. {
  647. return drm_core_check_feature(dev, DRIVER_USE_AGP);
  648. }
  649. #else
  650. #define drm_core_has_AGP(dev) (0)
  651. #endif
  652. #if __OS_HAS_MTRR
  653. static inline int drm_core_has_MTRR(struct drm_device *dev)
  654. {
  655. return drm_core_check_feature(dev, DRIVER_USE_MTRR);
  656. }
  657. #define DRM_MTRR_WC MTRR_TYPE_WRCOMB
  658. static inline int drm_mtrr_add(unsigned long offset, unsigned long size,
  659. unsigned int flags)
  660. {
  661. return mtrr_add(offset, size, flags, 1);
  662. }
  663. static inline int drm_mtrr_del(int handle, unsigned long offset,
  664. unsigned long size, unsigned int flags)
  665. {
  666. return mtrr_del(handle, offset, size);
  667. }
  668. #else
  669. #define drm_core_has_MTRR(dev) (0)
  670. #define DRM_MTRR_WC 0
  671. static inline int drm_mtrr_add(unsigned long offset, unsigned long size,
  672. unsigned int flags)
  673. {
  674. return 0;
  675. }
  676. static inline int drm_mtrr_del(int handle, unsigned long offset,
  677. unsigned long size, unsigned int flags)
  678. {
  679. return 0;
  680. }
  681. #endif
  682. /******************************************************************/
  683. /** \name Internal function definitions */
  684. /*@{*/
  685. /* Driver support (drm_drv.h) */
  686. extern int drm_init(struct drm_driver *driver);
  687. extern void drm_exit(struct drm_driver *driver);
  688. extern int drm_ioctl(struct inode *inode, struct file *filp,
  689. unsigned int cmd, unsigned long arg);
  690. extern long drm_compat_ioctl(struct file *filp,
  691. unsigned int cmd, unsigned long arg);
  692. extern int drm_lastclose(drm_device_t *dev);
  693. /* Device support (drm_fops.h) */
  694. extern int drm_open(struct inode *inode, struct file *filp);
  695. extern int drm_stub_open(struct inode *inode, struct file *filp);
  696. extern int drm_fasync(int fd, struct file *filp, int on);
  697. extern int drm_release(struct inode *inode, struct file *filp);
  698. /* Mapping support (drm_vm.h) */
  699. extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
  700. extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
  701. /* Memory management support (drm_memory.h) */
  702. #include "drm_memory.h"
  703. extern void drm_mem_init(void);
  704. extern int drm_mem_info(char *buf, char **start, off_t offset,
  705. int request, int *eof, void *data);
  706. extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);
  707. extern void *drm_ioremap(unsigned long offset, unsigned long size,
  708. drm_device_t * dev);
  709. extern void drm_ioremapfree(void *pt, unsigned long size, drm_device_t * dev);
  710. extern DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type);
  711. extern int drm_free_agp(DRM_AGP_MEM * handle, int pages);
  712. extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);
  713. extern int drm_unbind_agp(DRM_AGP_MEM * handle);
  714. /* Misc. IOCTL support (drm_ioctl.h) */
  715. extern int drm_irq_by_busid(struct inode *inode, struct file *filp,
  716. unsigned int cmd, unsigned long arg);
  717. extern int drm_getunique(struct inode *inode, struct file *filp,
  718. unsigned int cmd, unsigned long arg);
  719. extern int drm_setunique(struct inode *inode, struct file *filp,
  720. unsigned int cmd, unsigned long arg);
  721. extern int drm_getmap(struct inode *inode, struct file *filp,
  722. unsigned int cmd, unsigned long arg);
  723. extern int drm_getclient(struct inode *inode, struct file *filp,
  724. unsigned int cmd, unsigned long arg);
  725. extern int drm_getstats(struct inode *inode, struct file *filp,
  726. unsigned int cmd, unsigned long arg);
  727. extern int drm_setversion(struct inode *inode, struct file *filp,
  728. unsigned int cmd, unsigned long arg);
  729. extern int drm_noop(struct inode *inode, struct file *filp,
  730. unsigned int cmd, unsigned long arg);
  731. /* Context IOCTL support (drm_context.h) */
  732. extern int drm_resctx(struct inode *inode, struct file *filp,
  733. unsigned int cmd, unsigned long arg);
  734. extern int drm_addctx(struct inode *inode, struct file *filp,
  735. unsigned int cmd, unsigned long arg);
  736. extern int drm_modctx(struct inode *inode, struct file *filp,
  737. unsigned int cmd, unsigned long arg);
  738. extern int drm_getctx(struct inode *inode, struct file *filp,
  739. unsigned int cmd, unsigned long arg);
  740. extern int drm_switchctx(struct inode *inode, struct file *filp,
  741. unsigned int cmd, unsigned long arg);
  742. extern int drm_newctx(struct inode *inode, struct file *filp,
  743. unsigned int cmd, unsigned long arg);
  744. extern int drm_rmctx(struct inode *inode, struct file *filp,
  745. unsigned int cmd, unsigned long arg);
  746. extern int drm_ctxbitmap_init(drm_device_t * dev);
  747. extern void drm_ctxbitmap_cleanup(drm_device_t * dev);
  748. extern void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle);
  749. extern int drm_setsareactx(struct inode *inode, struct file *filp,
  750. unsigned int cmd, unsigned long arg);
  751. extern int drm_getsareactx(struct inode *inode, struct file *filp,
  752. unsigned int cmd, unsigned long arg);
  753. /* Drawable IOCTL support (drm_drawable.h) */
  754. extern int drm_adddraw(struct inode *inode, struct file *filp,
  755. unsigned int cmd, unsigned long arg);
  756. extern int drm_rmdraw(struct inode *inode, struct file *filp,
  757. unsigned int cmd, unsigned long arg);
  758. /* Authentication IOCTL support (drm_auth.h) */
  759. extern int drm_getmagic(struct inode *inode, struct file *filp,
  760. unsigned int cmd, unsigned long arg);
  761. extern int drm_authmagic(struct inode *inode, struct file *filp,
  762. unsigned int cmd, unsigned long arg);
  763. /* Locking IOCTL support (drm_lock.h) */
  764. extern int drm_lock(struct inode *inode, struct file *filp,
  765. unsigned int cmd, unsigned long arg);
  766. extern int drm_unlock(struct inode *inode, struct file *filp,
  767. unsigned int cmd, unsigned long arg);
  768. extern int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context);
  769. extern int drm_lock_free(drm_device_t * dev,
  770. __volatile__ unsigned int *lock, unsigned int context);
  771. /* Buffer management support (drm_bufs.h) */
  772. extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request);
  773. extern int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request);
  774. extern int drm_addmap(drm_device_t * dev, unsigned int offset,
  775. unsigned int size, drm_map_type_t type,
  776. drm_map_flags_t flags, drm_local_map_t ** map_ptr);
  777. extern int drm_addmap_ioctl(struct inode *inode, struct file *filp,
  778. unsigned int cmd, unsigned long arg);
  779. extern int drm_rmmap(drm_device_t * dev, drm_local_map_t * map);
  780. extern int drm_rmmap_locked(drm_device_t * dev, drm_local_map_t * map);
  781. extern int drm_rmmap_ioctl(struct inode *inode, struct file *filp,
  782. unsigned int cmd, unsigned long arg);
  783. extern int drm_order(unsigned long size);
  784. extern int drm_addbufs(struct inode *inode, struct file *filp,
  785. unsigned int cmd, unsigned long arg);
  786. extern int drm_infobufs(struct inode *inode, struct file *filp,
  787. unsigned int cmd, unsigned long arg);
  788. extern int drm_markbufs(struct inode *inode, struct file *filp,
  789. unsigned int cmd, unsigned long arg);
  790. extern int drm_freebufs(struct inode *inode, struct file *filp,
  791. unsigned int cmd, unsigned long arg);
  792. extern int drm_mapbufs(struct inode *inode, struct file *filp,
  793. unsigned int cmd, unsigned long arg);
  794. extern unsigned long drm_get_resource_start(drm_device_t * dev,
  795. unsigned int resource);
  796. extern unsigned long drm_get_resource_len(drm_device_t * dev,
  797. unsigned int resource);
  798. /* DMA support (drm_dma.h) */
  799. extern int drm_dma_setup(drm_device_t * dev);
  800. extern void drm_dma_takedown(drm_device_t * dev);
  801. extern void drm_free_buffer(drm_device_t * dev, drm_buf_t * buf);
  802. extern void drm_core_reclaim_buffers(drm_device_t * dev, struct file *filp);
  803. /* IRQ support (drm_irq.h) */
  804. extern int drm_control(struct inode *inode, struct file *filp,
  805. unsigned int cmd, unsigned long arg);
  806. extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
  807. extern int drm_irq_uninstall(drm_device_t * dev);
  808. extern void drm_driver_irq_preinstall(drm_device_t * dev);
  809. extern void drm_driver_irq_postinstall(drm_device_t * dev);
  810. extern void drm_driver_irq_uninstall(drm_device_t * dev);
  811. extern int drm_wait_vblank(struct inode *inode, struct file *filp,
  812. unsigned int cmd, unsigned long arg);
  813. extern int drm_vblank_wait(drm_device_t * dev, unsigned int *vbl_seq);
  814. extern void drm_vbl_send_signals(drm_device_t * dev);
  815. /* AGP/GART support (drm_agpsupport.h) */
  816. extern drm_agp_head_t *drm_agp_init(drm_device_t * dev);
  817. extern int drm_agp_acquire(drm_device_t * dev);
  818. extern int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp,
  819. unsigned int cmd, unsigned long arg);
  820. extern int drm_agp_release(drm_device_t * dev);
  821. extern int drm_agp_release_ioctl(struct inode *inode, struct file *filp,
  822. unsigned int cmd, unsigned long arg);
  823. extern int drm_agp_enable(drm_device_t * dev, drm_agp_mode_t mode);
  824. extern int drm_agp_enable_ioctl(struct inode *inode, struct file *filp,
  825. unsigned int cmd, unsigned long arg);
  826. extern int drm_agp_info(drm_device_t * dev, drm_agp_info_t * info);
  827. extern int drm_agp_info_ioctl(struct inode *inode, struct file *filp,
  828. unsigned int cmd, unsigned long arg);
  829. extern int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request);
  830. extern int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp,
  831. unsigned int cmd, unsigned long arg);
  832. extern int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request);
  833. extern int drm_agp_free_ioctl(struct inode *inode, struct file *filp,
  834. unsigned int cmd, unsigned long arg);
  835. extern int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request);
  836. extern int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp,
  837. unsigned int cmd, unsigned long arg);
  838. extern int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request);
  839. extern int drm_agp_bind_ioctl(struct inode *inode, struct file *filp,
  840. unsigned int cmd, unsigned long arg);
  841. extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge,
  842. size_t pages, u32 type);
  843. extern int drm_agp_free_memory(DRM_AGP_MEM * handle);
  844. extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start);
  845. extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle);
  846. /* Stub support (drm_stub.h) */
  847. extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
  848. struct drm_driver *driver);
  849. extern int drm_put_dev(drm_device_t * dev);
  850. extern int drm_put_head(drm_head_t * head);
  851. extern unsigned int drm_debug;
  852. extern unsigned int drm_cards_limit;
  853. extern drm_head_t **drm_heads;
  854. extern struct class *drm_class;
  855. extern struct proc_dir_entry *drm_proc_root;
  856. /* Proc support (drm_proc.h) */
  857. extern int drm_proc_init(drm_device_t * dev,
  858. int minor,
  859. struct proc_dir_entry *root,
  860. struct proc_dir_entry **dev_root);
  861. extern int drm_proc_cleanup(int minor,
  862. struct proc_dir_entry *root,
  863. struct proc_dir_entry *dev_root);
  864. /* Scatter Gather Support (drm_scatter.h) */
  865. extern void drm_sg_cleanup(drm_sg_mem_t * entry);
  866. extern int drm_sg_alloc(struct inode *inode, struct file *filp,
  867. unsigned int cmd, unsigned long arg);
  868. extern int drm_sg_free(struct inode *inode, struct file *filp,
  869. unsigned int cmd, unsigned long arg);
  870. /* ATI PCIGART support (ati_pcigart.h) */
  871. extern int drm_ati_pcigart_init(drm_device_t * dev,
  872. drm_ati_pcigart_info * gart_info);
  873. extern int drm_ati_pcigart_cleanup(drm_device_t * dev,
  874. drm_ati_pcigart_info * gart_info);
  875. extern drm_dma_handle_t *drm_pci_alloc(drm_device_t * dev, size_t size,
  876. size_t align, dma_addr_t maxaddr);
  877. extern void __drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah);
  878. extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah);
  879. /* sysfs support (drm_sysfs.c) */
  880. extern struct class *drm_sysfs_create(struct module *owner, char *name);
  881. extern void drm_sysfs_destroy(struct class *cs);
  882. extern struct class_device *drm_sysfs_device_add(struct class *cs,
  883. drm_head_t *head);
  884. extern void drm_sysfs_device_remove(struct class_device *class_dev);
  885. /* Inline replacements for DRM_IOREMAP macros */
  886. static __inline__ void drm_core_ioremap(struct drm_map *map,
  887. struct drm_device *dev)
  888. {
  889. map->handle = drm_ioremap(map->offset, map->size, dev);
  890. }
  891. #if 0
  892. static __inline__ void drm_core_ioremap_nocache(struct drm_map *map,
  893. struct drm_device *dev)
  894. {
  895. map->handle = drm_ioremap_nocache(map->offset, map->size, dev);
  896. }
  897. #endif /* 0 */
  898. static __inline__ void drm_core_ioremapfree(struct drm_map *map,
  899. struct drm_device *dev)
  900. {
  901. if (map->handle && map->size)
  902. drm_ioremapfree(map->handle, map->size, dev);
  903. }
  904. static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev,
  905. unsigned int token)
  906. {
  907. drm_map_list_t *_entry;
  908. list_for_each_entry(_entry, &dev->maplist->head, head)
  909. if (_entry->user_token == token)
  910. return _entry->map;
  911. return NULL;
  912. }
  913. static __inline__ int drm_device_is_agp(drm_device_t * dev)
  914. {
  915. if (dev->driver->device_is_agp != NULL) {
  916. int err = (*dev->driver->device_is_agp) (dev);
  917. if (err != 2) {
  918. return err;
  919. }
  920. }
  921. return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP);
  922. }
  923. static __inline__ int drm_device_is_pcie(drm_device_t * dev)
  924. {
  925. return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
  926. }
  927. static __inline__ void drm_core_dropmap(struct drm_map *map)
  928. {
  929. }
  930. #ifndef DEBUG_MEMORY
  931. /** Wrapper around kmalloc() */
  932. static __inline__ void *drm_alloc(size_t size, int area)
  933. {
  934. return kmalloc(size, GFP_KERNEL);
  935. }
  936. /** Wrapper around kfree() */
  937. static __inline__ void drm_free(void *pt, size_t size, int area)
  938. {
  939. kfree(pt);
  940. }
  941. /** Wrapper around kcalloc() */
  942. static __inline__ void *drm_calloc(size_t nmemb, size_t size, int area)
  943. {
  944. return kcalloc(nmemb, size, GFP_KERNEL);
  945. }
  946. #else
  947. extern void *drm_alloc(size_t size, int area);
  948. extern void drm_free(void *pt, size_t size, int area);
  949. extern void *drm_calloc(size_t nmemb, size_t size, int area);
  950. #endif
  951. /*@}*/
  952. extern unsigned long drm_core_get_map_ofs(drm_map_t * map);
  953. extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev);
  954. #ifndef pci_pretty_name
  955. #define pci_pretty_name(dev) ""
  956. #endif
  957. #endif /* __KERNEL__ */
  958. #endif