diff options
Diffstat (limited to 'drivers/char/drm/drmP.h')
-rw-r--r-- | drivers/char/drm/drmP.h | 886 |
1 files changed, 446 insertions, 440 deletions
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 121cc85f347e..3dc3c9d79ae4 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /** | 1 | /** |
2 | * \file drmP.h | 2 | * \file drmP.h |
3 | * Private header for Direct Rendering Manager | 3 | * Private header for Direct Rendering Manager |
4 | * | 4 | * |
5 | * \author Rickard E. (Rik) Faith <faith@valinux.com> | 5 | * \author Rickard E. (Rik) Faith <faith@valinux.com> |
6 | * \author Gareth Hughes <gareth@valinux.com> | 6 | * \author Gareth Hughes <gareth@valinux.com> |
7 | */ | 7 | */ |
@@ -43,7 +43,7 @@ | |||
43 | * before static inline funcs in wait.h. Doing this so we | 43 | * before static inline funcs in wait.h. Doing this so we |
44 | * can build the DRM (part of PI DRI). 4/21/2000 S + B */ | 44 | * can build the DRM (part of PI DRI). 4/21/2000 S + B */ |
45 | #include <asm/current.h> | 45 | #include <asm/current.h> |
46 | #endif /* __alpha__ */ | 46 | #endif /* __alpha__ */ |
47 | #include <linux/config.h> | 47 | #include <linux/config.h> |
48 | #include <linux/module.h> | 48 | #include <linux/module.h> |
49 | #include <linux/kernel.h> | 49 | #include <linux/kernel.h> |
@@ -58,7 +58,7 @@ | |||
58 | #include <linux/mm.h> | 58 | #include <linux/mm.h> |
59 | #include <linux/cdev.h> | 59 | #include <linux/cdev.h> |
60 | #if defined(__alpha__) || defined(__powerpc__) | 60 | #if defined(__alpha__) || defined(__powerpc__) |
61 | #include <asm/pgtable.h> /* For pte_wrprotect */ | 61 | #include <asm/pgtable.h> /* For pte_wrprotect */ |
62 | #endif | 62 | #endif |
63 | #include <asm/io.h> | 63 | #include <asm/io.h> |
64 | #include <asm/mman.h> | 64 | #include <asm/mman.h> |
@@ -108,7 +108,6 @@ | |||
108 | #define DRM_KERNEL_CONTEXT 0 /**< Change drm_resctx if changed */ | 108 | #define DRM_KERNEL_CONTEXT 0 /**< Change drm_resctx if changed */ |
109 | #define DRM_RESERVED_CONTEXTS 1 /**< Change drm_resctx if changed */ | 109 | #define DRM_RESERVED_CONTEXTS 1 /**< Change drm_resctx if changed */ |
110 | #define DRM_LOOPING_LIMIT 5000000 | 110 | #define DRM_LOOPING_LIMIT 5000000 |
111 | #define DRM_BSZ 1024 /**< Buffer size for /dev/drm? output */ | ||
112 | #define DRM_TIME_SLICE (HZ/20) /**< Time slice for GLXContexts */ | 111 | #define DRM_TIME_SLICE (HZ/20) /**< Time slice for GLXContexts */ |
113 | #define DRM_LOCK_SLICE 1 /**< Time slice for lock, in jiffies */ | 112 | #define DRM_LOCK_SLICE 1 /**< Time slice for lock, in jiffies */ |
114 | 113 | ||
@@ -138,16 +137,15 @@ | |||
138 | #define DRM_MEM_CTXLIST 21 | 137 | #define DRM_MEM_CTXLIST 21 |
139 | 138 | ||
140 | #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) | 139 | #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) |
141 | |||
142 | /*@}*/ | ||
143 | 140 | ||
141 | /*@}*/ | ||
144 | 142 | ||
145 | /***********************************************************************/ | 143 | /***********************************************************************/ |
146 | /** \name Backward compatibility section */ | 144 | /** \name Backward compatibility section */ |
147 | /*@{*/ | 145 | /*@{*/ |
148 | 146 | ||
149 | #ifndef MODULE_LICENSE | 147 | #ifndef MODULE_LICENSE |
150 | #define MODULE_LICENSE(x) | 148 | #define MODULE_LICENSE(x) |
151 | #endif | 149 | #endif |
152 | 150 | ||
153 | #ifndef preempt_disable | 151 | #ifndef preempt_disable |
@@ -155,7 +153,7 @@ | |||
155 | #define preempt_enable() | 153 | #define preempt_enable() |
156 | #endif | 154 | #endif |
157 | 155 | ||
158 | #ifndef pte_offset_map | 156 | #ifndef pte_offset_map |
159 | #define pte_offset_map pte_offset | 157 | #define pte_offset_map pte_offset |
160 | #define pte_unmap(pte) | 158 | #define pte_unmap(pte) |
161 | #endif | 159 | #endif |
@@ -166,7 +164,6 @@ | |||
166 | 164 | ||
167 | /*@}*/ | 165 | /*@}*/ |
168 | 166 | ||
169 | |||
170 | /***********************************************************************/ | 167 | /***********************************************************************/ |
171 | /** \name Macros to make printk easier */ | 168 | /** \name Macros to make printk easier */ |
172 | /*@{*/ | 169 | /*@{*/ |
@@ -195,7 +192,7 @@ | |||
195 | 192 | ||
196 | /** | 193 | /** |
197 | * Debug output. | 194 | * Debug output. |
198 | * | 195 | * |
199 | * \param fmt printf() like format string. | 196 | * \param fmt printf() like format string. |
200 | * \param arg arguments | 197 | * \param arg arguments |
201 | */ | 198 | */ |
@@ -223,14 +220,13 @@ | |||
223 | 220 | ||
224 | /*@}*/ | 221 | /*@}*/ |
225 | 222 | ||
226 | |||
227 | /***********************************************************************/ | 223 | /***********************************************************************/ |
228 | /** \name Internal types and structures */ | 224 | /** \name Internal types and structures */ |
229 | /*@{*/ | 225 | /*@{*/ |
230 | 226 | ||
231 | #define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) | 227 | #define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x) |
232 | #define DRM_MIN(a,b) ((a)<(b)?(a):(b)) | 228 | #define DRM_MIN(a,b) min(a,b) |
233 | #define DRM_MAX(a,b) ((a)>(b)?(a):(b)) | 229 | #define DRM_MAX(a,b) max(a,b) |
234 | 230 | ||
235 | #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) | 231 | #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) |
236 | #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) | 232 | #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) |
@@ -275,7 +271,7 @@ do { \ | |||
275 | if ( copy_to_user( name, value, len ) ) \ | 271 | if ( copy_to_user( name, value, len ) ) \ |
276 | return -EFAULT; \ | 272 | return -EFAULT; \ |
277 | } | 273 | } |
278 | 274 | ||
279 | /** | 275 | /** |
280 | * Ioctl function type. | 276 | * Ioctl function type. |
281 | * | 277 | * |
@@ -284,25 +280,25 @@ do { \ | |||
284 | * \param cmd command. | 280 | * \param cmd command. |
285 | * \param arg argument. | 281 | * \param arg argument. |
286 | */ | 282 | */ |
287 | typedef int drm_ioctl_t( struct inode *inode, struct file *filp, | 283 | typedef int drm_ioctl_t(struct inode *inode, struct file *filp, |
288 | unsigned int cmd, unsigned long arg ); | 284 | unsigned int cmd, unsigned long arg); |
289 | 285 | ||
290 | typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, | 286 | typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, |
291 | unsigned long arg); | 287 | unsigned long arg); |
292 | 288 | ||
293 | typedef struct drm_ioctl_desc { | 289 | typedef struct drm_ioctl_desc { |
294 | drm_ioctl_t *func; | 290 | drm_ioctl_t *func; |
295 | int auth_needed; | 291 | int auth_needed; |
296 | int root_only; | 292 | int root_only; |
297 | } drm_ioctl_desc_t; | 293 | } drm_ioctl_desc_t; |
298 | 294 | ||
299 | typedef struct drm_devstate { | 295 | typedef struct drm_devstate { |
300 | pid_t owner; /**< X server pid holding x_lock */ | 296 | pid_t owner; /**< X server pid holding x_lock */ |
301 | } drm_devstate_t; | 297 | } drm_devstate_t; |
302 | 298 | ||
303 | typedef struct drm_magic_entry { | 299 | typedef struct drm_magic_entry { |
304 | drm_magic_t magic; | 300 | drm_magic_t magic; |
305 | struct drm_file *priv; | 301 | struct drm_file *priv; |
306 | struct drm_magic_entry *next; | 302 | struct drm_magic_entry *next; |
307 | } drm_magic_entry_t; | 303 | } drm_magic_entry_t; |
308 | 304 | ||
@@ -313,111 +309,110 @@ typedef struct drm_magic_head { | |||
313 | 309 | ||
314 | typedef struct drm_vma_entry { | 310 | typedef struct drm_vma_entry { |
315 | struct vm_area_struct *vma; | 311 | struct vm_area_struct *vma; |
316 | struct drm_vma_entry *next; | 312 | struct drm_vma_entry *next; |
317 | pid_t pid; | 313 | pid_t pid; |
318 | } drm_vma_entry_t; | 314 | } drm_vma_entry_t; |
319 | 315 | ||
320 | /** | 316 | /** |
321 | * DMA buffer. | 317 | * DMA buffer. |
322 | */ | 318 | */ |
323 | typedef struct drm_buf { | 319 | typedef struct drm_buf { |
324 | int idx; /**< Index into master buflist */ | 320 | int idx; /**< Index into master buflist */ |
325 | int total; /**< Buffer size */ | 321 | int total; /**< Buffer size */ |
326 | int order; /**< log-base-2(total) */ | 322 | int order; /**< log-base-2(total) */ |
327 | int used; /**< Amount of buffer in use (for DMA) */ | 323 | int used; /**< Amount of buffer in use (for DMA) */ |
328 | unsigned long offset; /**< Byte offset (used internally) */ | 324 | unsigned long offset; /**< Byte offset (used internally) */ |
329 | void *address; /**< Address of buffer */ | 325 | void *address; /**< Address of buffer */ |
330 | unsigned long bus_address; /**< Bus address of buffer */ | 326 | unsigned long bus_address; /**< Bus address of buffer */ |
331 | struct drm_buf *next; /**< Kernel-only: used for free list */ | 327 | struct drm_buf *next; /**< Kernel-only: used for free list */ |
332 | __volatile__ int waiting; /**< On kernel DMA queue */ | 328 | __volatile__ int waiting; /**< On kernel DMA queue */ |
333 | __volatile__ int pending; /**< On hardware DMA queue */ | 329 | __volatile__ int pending; /**< On hardware DMA queue */ |
334 | wait_queue_head_t dma_wait; /**< Processes waiting */ | 330 | wait_queue_head_t dma_wait; /**< Processes waiting */ |
335 | struct file *filp; /**< Pointer to holding file descr */ | 331 | struct file *filp; /**< Pointer to holding file descr */ |
336 | int context; /**< Kernel queue for this buffer */ | 332 | int context; /**< Kernel queue for this buffer */ |
337 | int while_locked;/**< Dispatch this buffer while locked */ | 333 | int while_locked; /**< Dispatch this buffer while locked */ |
338 | enum { | 334 | enum { |
339 | DRM_LIST_NONE = 0, | 335 | DRM_LIST_NONE = 0, |
340 | DRM_LIST_FREE = 1, | 336 | DRM_LIST_FREE = 1, |
341 | DRM_LIST_WAIT = 2, | 337 | DRM_LIST_WAIT = 2, |
342 | DRM_LIST_PEND = 3, | 338 | DRM_LIST_PEND = 3, |
343 | DRM_LIST_PRIO = 4, | 339 | DRM_LIST_PRIO = 4, |
344 | DRM_LIST_RECLAIM = 5 | 340 | DRM_LIST_RECLAIM = 5 |
345 | } list; /**< Which list we're on */ | 341 | } list; /**< Which list we're on */ |
346 | 342 | ||
347 | int dev_priv_size; /**< Size of buffer private storage */ | 343 | int dev_priv_size; /**< Size of buffer private storage */ |
348 | void *dev_private; /**< Per-buffer private storage */ | 344 | void *dev_private; /**< Per-buffer private storage */ |
349 | } drm_buf_t; | 345 | } drm_buf_t; |
350 | 346 | ||
351 | |||
352 | /** bufs is one longer than it has to be */ | 347 | /** bufs is one longer than it has to be */ |
353 | typedef struct drm_waitlist { | 348 | typedef struct drm_waitlist { |
354 | int count; /**< Number of possible buffers */ | 349 | int count; /**< Number of possible buffers */ |
355 | drm_buf_t **bufs; /**< List of pointers to buffers */ | 350 | drm_buf_t **bufs; /**< List of pointers to buffers */ |
356 | drm_buf_t **rp; /**< Read pointer */ | 351 | drm_buf_t **rp; /**< Read pointer */ |
357 | drm_buf_t **wp; /**< Write pointer */ | 352 | drm_buf_t **wp; /**< Write pointer */ |
358 | drm_buf_t **end; /**< End pointer */ | 353 | drm_buf_t **end; /**< End pointer */ |
359 | spinlock_t read_lock; | 354 | spinlock_t read_lock; |
360 | spinlock_t write_lock; | 355 | spinlock_t write_lock; |
361 | } drm_waitlist_t; | 356 | } drm_waitlist_t; |
362 | 357 | ||
363 | typedef struct drm_freelist { | 358 | typedef struct drm_freelist { |
364 | int initialized; /**< Freelist in use */ | 359 | int initialized; /**< Freelist in use */ |
365 | atomic_t count; /**< Number of free buffers */ | 360 | atomic_t count; /**< Number of free buffers */ |
366 | drm_buf_t *next; /**< End pointer */ | 361 | drm_buf_t *next; /**< End pointer */ |
367 | 362 | ||
368 | wait_queue_head_t waiting; /**< Processes waiting on free bufs */ | 363 | wait_queue_head_t waiting; /**< Processes waiting on free bufs */ |
369 | int low_mark; /**< Low water mark */ | 364 | int low_mark; /**< Low water mark */ |
370 | int high_mark; /**< High water mark */ | 365 | int high_mark; /**< High water mark */ |
371 | atomic_t wfh; /**< If waiting for high mark */ | 366 | atomic_t wfh; /**< If waiting for high mark */ |
372 | spinlock_t lock; | 367 | spinlock_t lock; |
373 | } drm_freelist_t; | 368 | } drm_freelist_t; |
374 | 369 | ||
375 | /** | 370 | /** |
376 | * Buffer entry. There is one of this for each buffer size order. | 371 | * Buffer entry. There is one of this for each buffer size order. |
377 | */ | 372 | */ |
378 | typedef struct drm_buf_entry { | 373 | typedef struct drm_buf_entry { |
379 | int buf_size; /**< size */ | 374 | int buf_size; /**< size */ |
380 | int buf_count; /**< number of buffers */ | 375 | int buf_count; /**< number of buffers */ |
381 | drm_buf_t *buflist; /**< buffer list */ | 376 | drm_buf_t *buflist; /**< buffer list */ |
382 | int seg_count; | 377 | int seg_count; |
383 | int page_order; | 378 | int page_order; |
384 | unsigned long *seglist; | 379 | unsigned long *seglist; |
385 | 380 | ||
386 | drm_freelist_t freelist; | 381 | drm_freelist_t freelist; |
387 | } drm_buf_entry_t; | 382 | } drm_buf_entry_t; |
388 | 383 | ||
389 | /** File private data */ | 384 | /** File private data */ |
390 | typedef struct drm_file { | 385 | typedef struct drm_file { |
391 | int authenticated; | 386 | int authenticated; |
392 | int minor; | 387 | int minor; |
393 | pid_t pid; | 388 | pid_t pid; |
394 | uid_t uid; | 389 | uid_t uid; |
395 | drm_magic_t magic; | 390 | drm_magic_t magic; |
396 | unsigned long ioctl_count; | 391 | unsigned long ioctl_count; |
397 | struct drm_file *next; | 392 | struct drm_file *next; |
398 | struct drm_file *prev; | 393 | struct drm_file *prev; |
399 | struct drm_head *head; | 394 | struct drm_head *head; |
400 | int remove_auth_on_close; | 395 | int remove_auth_on_close; |
401 | unsigned long lock_count; | 396 | unsigned long lock_count; |
402 | void *driver_priv; | 397 | void *driver_priv; |
403 | } drm_file_t; | 398 | } drm_file_t; |
404 | 399 | ||
405 | /** Wait queue */ | 400 | /** Wait queue */ |
406 | typedef struct drm_queue { | 401 | typedef struct drm_queue { |
407 | atomic_t use_count; /**< Outstanding uses (+1) */ | 402 | atomic_t use_count; /**< Outstanding uses (+1) */ |
408 | atomic_t finalization; /**< Finalization in progress */ | 403 | atomic_t finalization; /**< Finalization in progress */ |
409 | atomic_t block_count; /**< Count of processes waiting */ | 404 | atomic_t block_count; /**< Count of processes waiting */ |
410 | atomic_t block_read; /**< Queue blocked for reads */ | 405 | atomic_t block_read; /**< Queue blocked for reads */ |
411 | wait_queue_head_t read_queue; /**< Processes waiting on block_read */ | 406 | wait_queue_head_t read_queue; /**< Processes waiting on block_read */ |
412 | atomic_t block_write; /**< Queue blocked for writes */ | 407 | atomic_t block_write; /**< Queue blocked for writes */ |
413 | wait_queue_head_t write_queue; /**< Processes waiting on block_write */ | 408 | wait_queue_head_t write_queue; /**< Processes waiting on block_write */ |
414 | #if 1 | 409 | #if 1 |
415 | atomic_t total_queued; /**< Total queued statistic */ | 410 | atomic_t total_queued; /**< Total queued statistic */ |
416 | atomic_t total_flushed;/**< Total flushes statistic */ | 411 | atomic_t total_flushed; /**< Total flushes statistic */ |
417 | atomic_t total_locks; /**< Total locks statistics */ | 412 | atomic_t total_locks; /**< Total locks statistics */ |
418 | #endif | 413 | #endif |
419 | drm_ctx_flags_t flags; /**< Context preserving and 2D-only */ | 414 | drm_ctx_flags_t flags; /**< Context preserving and 2D-only */ |
420 | drm_waitlist_t waitlist; /**< Pending buffers */ | 415 | drm_waitlist_t waitlist; /**< Pending buffers */ |
421 | wait_queue_head_t flush_queue; /**< Processes waiting until flush */ | 416 | wait_queue_head_t flush_queue; /**< Processes waiting until flush */ |
422 | } drm_queue_t; | 417 | } drm_queue_t; |
423 | 418 | ||
@@ -425,10 +420,10 @@ typedef struct drm_queue { | |||
425 | * Lock data. | 420 | * Lock data. |
426 | */ | 421 | */ |
427 | typedef struct drm_lock_data { | 422 | typedef struct drm_lock_data { |
428 | drm_hw_lock_t *hw_lock; /**< Hardware lock */ | 423 | drm_hw_lock_t *hw_lock; /**< Hardware lock */ |
429 | struct file *filp; /**< File descr of lock holder (0=kernel) */ | 424 | struct file *filp; /**< File descr of lock holder (0=kernel) */ |
430 | wait_queue_head_t lock_queue; /**< Queue of blocked processes */ | 425 | wait_queue_head_t lock_queue; /**< Queue of blocked processes */ |
431 | unsigned long lock_time; /**< Time of last lock in jiffies */ | 426 | unsigned long lock_time; /**< Time of last lock in jiffies */ |
432 | } drm_lock_data_t; | 427 | } drm_lock_data_t; |
433 | 428 | ||
434 | /** | 429 | /** |
@@ -436,29 +431,29 @@ typedef struct drm_lock_data { | |||
436 | */ | 431 | */ |
437 | typedef struct drm_device_dma { | 432 | typedef struct drm_device_dma { |
438 | 433 | ||
439 | drm_buf_entry_t bufs[DRM_MAX_ORDER+1]; /**< buffers, grouped by their size order */ | 434 | drm_buf_entry_t bufs[DRM_MAX_ORDER + 1]; /**< buffers, grouped by their size order */ |
440 | int buf_count; /**< total number of buffers */ | 435 | int buf_count; /**< total number of buffers */ |
441 | drm_buf_t **buflist; /**< Vector of pointers into drm_device_dma::bufs */ | 436 | drm_buf_t **buflist; /**< Vector of pointers into drm_device_dma::bufs */ |
442 | int seg_count; | 437 | int seg_count; |
443 | int page_count; /**< number of pages */ | 438 | int page_count; /**< number of pages */ |
444 | unsigned long *pagelist; /**< page list */ | 439 | unsigned long *pagelist; /**< page list */ |
445 | unsigned long byte_count; | 440 | unsigned long byte_count; |
446 | enum { | 441 | enum { |
447 | _DRM_DMA_USE_AGP = 0x01, | 442 | _DRM_DMA_USE_AGP = 0x01, |
448 | _DRM_DMA_USE_SG = 0x02, | 443 | _DRM_DMA_USE_SG = 0x02, |
449 | _DRM_DMA_USE_FB = 0x04 | 444 | _DRM_DMA_USE_FB = 0x04 |
450 | } flags; | 445 | } flags; |
451 | 446 | ||
452 | } drm_device_dma_t; | 447 | } drm_device_dma_t; |
453 | 448 | ||
454 | /** | 449 | /** |
455 | * AGP memory entry. Stored as a doubly linked list. | 450 | * AGP memory entry. Stored as a doubly linked list. |
456 | */ | 451 | */ |
457 | typedef struct drm_agp_mem { | 452 | typedef struct drm_agp_mem { |
458 | unsigned long handle; /**< handle */ | 453 | unsigned long handle; /**< handle */ |
459 | DRM_AGP_MEM *memory; | 454 | DRM_AGP_MEM *memory; |
460 | unsigned long bound; /**< address */ | 455 | unsigned long bound; /**< address */ |
461 | int pages; | 456 | int pages; |
462 | struct drm_agp_mem *prev; /**< previous entry */ | 457 | struct drm_agp_mem *prev; /**< previous entry */ |
463 | struct drm_agp_mem *next; /**< next entry */ | 458 | struct drm_agp_mem *next; /**< next entry */ |
464 | } drm_agp_mem_t; | 459 | } drm_agp_mem_t; |
@@ -469,31 +464,31 @@ typedef struct drm_agp_mem { | |||
469 | * \sa drm_agp_init() and drm_device::agp. | 464 | * \sa drm_agp_init() and drm_device::agp. |
470 | */ | 465 | */ |
471 | typedef struct drm_agp_head { | 466 | typedef struct drm_agp_head { |
472 | DRM_AGP_KERN agp_info; /**< AGP device information */ | 467 | DRM_AGP_KERN agp_info; /**< AGP device information */ |
473 | drm_agp_mem_t *memory; /**< memory entries */ | 468 | drm_agp_mem_t *memory; /**< memory entries */ |
474 | unsigned long mode; /**< AGP mode */ | 469 | unsigned long mode; /**< AGP mode */ |
475 | struct agp_bridge_data *bridge; | 470 | struct agp_bridge_data *bridge; |
476 | int enabled; /**< whether the AGP bus as been enabled */ | 471 | int enabled; /**< whether the AGP bus as been enabled */ |
477 | int acquired; /**< whether the AGP device has been acquired */ | 472 | int acquired; /**< whether the AGP device has been acquired */ |
478 | unsigned long base; | 473 | unsigned long base; |
479 | int agp_mtrr; | 474 | int agp_mtrr; |
480 | int cant_use_aperture; | 475 | int cant_use_aperture; |
481 | unsigned long page_mask; | 476 | unsigned long page_mask; |
482 | } drm_agp_head_t; | 477 | } drm_agp_head_t; |
483 | 478 | ||
484 | /** | 479 | /** |
485 | * Scatter-gather memory. | 480 | * Scatter-gather memory. |
486 | */ | 481 | */ |
487 | typedef struct drm_sg_mem { | 482 | typedef struct drm_sg_mem { |
488 | unsigned long handle; | 483 | unsigned long handle; |
489 | void *virtual; | 484 | void *virtual; |
490 | int pages; | 485 | int pages; |
491 | struct page **pagelist; | 486 | struct page **pagelist; |
492 | dma_addr_t *busaddr; | 487 | dma_addr_t *busaddr; |
493 | } drm_sg_mem_t; | 488 | } drm_sg_mem_t; |
494 | 489 | ||
495 | typedef struct drm_sigdata { | 490 | typedef struct drm_sigdata { |
496 | int context; | 491 | int context; |
497 | drm_hw_lock_t *lock; | 492 | drm_hw_lock_t *lock; |
498 | } drm_sigdata_t; | 493 | } drm_sigdata_t; |
499 | 494 | ||
@@ -507,8 +502,8 @@ typedef struct drm_dma_handle { | |||
507 | * Mappings list | 502 | * Mappings list |
508 | */ | 503 | */ |
509 | typedef struct drm_map_list { | 504 | typedef struct drm_map_list { |
510 | struct list_head head; /**< list head */ | 505 | struct list_head head; /**< list head */ |
511 | drm_map_t *map; /**< mapping */ | 506 | drm_map_t *map; /**< mapping */ |
512 | unsigned int user_token; | 507 | unsigned int user_token; |
513 | } drm_map_list_t; | 508 | } drm_map_list_t; |
514 | 509 | ||
@@ -518,19 +513,28 @@ typedef drm_map_t drm_local_map_t; | |||
518 | * Context handle list | 513 | * Context handle list |
519 | */ | 514 | */ |
520 | typedef struct drm_ctx_list { | 515 | typedef struct drm_ctx_list { |
521 | struct list_head head; /**< list head */ | 516 | struct list_head head; /**< list head */ |
522 | drm_context_t handle; /**< context handle */ | 517 | drm_context_t handle; /**< context handle */ |
523 | drm_file_t *tag; /**< associated fd private data */ | 518 | drm_file_t *tag; /**< associated fd private data */ |
524 | } drm_ctx_list_t; | 519 | } drm_ctx_list_t; |
525 | 520 | ||
526 | |||
527 | typedef struct drm_vbl_sig { | 521 | typedef struct drm_vbl_sig { |
528 | struct list_head head; | 522 | struct list_head head; |
529 | unsigned int sequence; | 523 | unsigned int sequence; |
530 | struct siginfo info; | 524 | struct siginfo info; |
531 | struct task_struct *task; | 525 | struct task_struct *task; |
532 | } drm_vbl_sig_t; | 526 | } drm_vbl_sig_t; |
533 | 527 | ||
528 | /* location of GART table */ | ||
529 | #define DRM_ATI_GART_MAIN 1 | ||
530 | #define DRM_ATI_GART_FB 2 | ||
531 | |||
532 | typedef struct ati_pcigart_info { | ||
533 | int gart_table_location; | ||
534 | int is_pcie; | ||
535 | unsigned long addr; | ||
536 | dma_addr_t bus_addr; | ||
537 | } drm_ati_pcigart_info; | ||
534 | 538 | ||
535 | /** | 539 | /** |
536 | * DRM driver structure. This structure represent the common code for | 540 | * DRM driver structure. This structure represent the common code for |
@@ -540,24 +544,26 @@ typedef struct drm_vbl_sig { | |||
540 | struct drm_device; | 544 | struct drm_device; |
541 | 545 | ||
542 | struct drm_driver { | 546 | struct drm_driver { |
543 | int (*preinit)(struct drm_device *, unsigned long flags); | 547 | int (*preinit) (struct drm_device *, unsigned long flags); |
544 | void (*prerelease)(struct drm_device *, struct file *filp); | 548 | void (*prerelease) (struct drm_device *, struct file * filp); |
545 | void (*pretakedown)(struct drm_device *); | 549 | void (*pretakedown) (struct drm_device *); |
546 | int (*postcleanup)(struct drm_device *); | 550 | int (*postcleanup) (struct drm_device *); |
547 | int (*presetup)(struct drm_device *); | 551 | int (*presetup) (struct drm_device *); |
548 | int (*postsetup)(struct drm_device *); | 552 | int (*postsetup) (struct drm_device *); |
549 | int (*dma_ioctl)( DRM_IOCTL_ARGS ); | 553 | int (*dma_ioctl) (DRM_IOCTL_ARGS); |
550 | int (*open_helper)(struct drm_device *, drm_file_t *); | 554 | int (*open_helper) (struct drm_device *, drm_file_t *); |
551 | void (*free_filp_priv)(struct drm_device *, drm_file_t *); | 555 | void (*free_filp_priv) (struct drm_device *, drm_file_t *); |
552 | void (*release)(struct drm_device *, struct file *filp); | 556 | void (*release) (struct drm_device *, struct file * filp); |
553 | void (*dma_ready)(struct drm_device *); | 557 | void (*dma_ready) (struct drm_device *); |
554 | int (*dma_quiescent)(struct drm_device *); | 558 | int (*dma_quiescent) (struct drm_device *); |
555 | int (*context_ctor)(struct drm_device *dev, int context); | 559 | int (*context_ctor) (struct drm_device * dev, int context); |
556 | int (*context_dtor)(struct drm_device *dev, int context); | 560 | int (*context_dtor) (struct drm_device * dev, int context); |
557 | int (*kernel_context_switch)(struct drm_device *dev, int old, int new); | 561 | int (*kernel_context_switch) (struct drm_device * dev, int old, |
558 | void (*kernel_context_switch_unlock)(struct drm_device *dev, drm_lock_t *lock); | 562 | int new); |
559 | int (*vblank_wait)(struct drm_device *dev, unsigned int *sequence); | 563 | void (*kernel_context_switch_unlock) (struct drm_device * dev, |
560 | 564 | drm_lock_t * lock); | |
565 | int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence); | ||
566 | |||
561 | /** | 567 | /** |
562 | * Called by \c drm_device_is_agp. Typically used to determine if a | 568 | * Called by \c drm_device_is_agp. Typically used to determine if a |
563 | * card is really attached to AGP or not. | 569 | * card is really attached to AGP or not. |
@@ -572,17 +578,17 @@ struct drm_driver { | |||
572 | int (*device_is_agp) (struct drm_device * dev); | 578 | int (*device_is_agp) (struct drm_device * dev); |
573 | 579 | ||
574 | /* these have to be filled in */ | 580 | /* these have to be filled in */ |
575 | 581 | ||
576 | int (*postinit)(struct drm_device *, unsigned long flags); | 582 | int (*postinit) (struct drm_device *, unsigned long flags); |
577 | irqreturn_t (*irq_handler)( DRM_IRQ_ARGS ); | 583 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); |
578 | void (*irq_preinstall)(struct drm_device *dev); | 584 | void (*irq_preinstall) (struct drm_device * dev); |
579 | void (*irq_postinstall)(struct drm_device *dev); | 585 | void (*irq_postinstall) (struct drm_device * dev); |
580 | void (*irq_uninstall)(struct drm_device *dev); | 586 | void (*irq_uninstall) (struct drm_device * dev); |
581 | void (*reclaim_buffers)(struct drm_device *dev, struct file *filp); | 587 | void (*reclaim_buffers) (struct drm_device * dev, struct file * filp); |
582 | unsigned long (*get_map_ofs)(drm_map_t *map); | 588 | unsigned long (*get_map_ofs) (drm_map_t * map); |
583 | unsigned long (*get_reg_ofs)(struct drm_device *dev); | 589 | unsigned long (*get_reg_ofs) (struct drm_device * dev); |
584 | void (*set_version)(struct drm_device *dev, drm_set_version_t *sv); | 590 | void (*set_version) (struct drm_device * dev, drm_set_version_t * sv); |
585 | int (*version)(drm_version_t *version); | 591 | int (*version) (drm_version_t * version); |
586 | u32 driver_features; | 592 | u32 driver_features; |
587 | int dev_priv_size; | 593 | int dev_priv_size; |
588 | drm_ioctl_desc_t *ioctls; | 594 | drm_ioctl_desc_t *ioctls; |
@@ -609,128 +615,125 @@ typedef struct drm_head { | |||
609 | * may contain multiple heads. | 615 | * may contain multiple heads. |
610 | */ | 616 | */ |
611 | typedef struct drm_device { | 617 | typedef struct drm_device { |
612 | char *unique; /**< Unique identifier: e.g., busid */ | 618 | char *unique; /**< Unique identifier: e.g., busid */ |
613 | int unique_len; /**< Length of unique field */ | 619 | int unique_len; /**< Length of unique field */ |
614 | char *devname; /**< For /proc/interrupts */ | 620 | char *devname; /**< For /proc/interrupts */ |
615 | int if_version; /**< Highest interface version set */ | 621 | int if_version; /**< Highest interface version set */ |
616 | 622 | ||
617 | int blocked; /**< Blocked due to VC switch? */ | 623 | int blocked; /**< Blocked due to VC switch? */ |
618 | 624 | ||
619 | /** \name Locks */ | 625 | /** \name Locks */ |
620 | /*@{*/ | 626 | /*@{ */ |
621 | spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */ | 627 | spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */ |
622 | struct semaphore struct_sem; /**< For others */ | 628 | struct semaphore struct_sem; /**< For others */ |
623 | /*@}*/ | 629 | /*@} */ |
624 | 630 | ||
625 | /** \name Usage Counters */ | 631 | /** \name Usage Counters */ |
626 | /*@{*/ | 632 | /*@{ */ |
627 | int open_count; /**< Outstanding files open */ | 633 | int open_count; /**< Outstanding files open */ |
628 | atomic_t ioctl_count; /**< Outstanding IOCTLs pending */ | 634 | atomic_t ioctl_count; /**< Outstanding IOCTLs pending */ |
629 | atomic_t vma_count; /**< Outstanding vma areas open */ | 635 | atomic_t vma_count; /**< Outstanding vma areas open */ |
630 | int buf_use; /**< Buffers in use -- cannot alloc */ | 636 | int buf_use; /**< Buffers in use -- cannot alloc */ |
631 | atomic_t buf_alloc; /**< Buffer allocation in progress */ | 637 | atomic_t buf_alloc; /**< Buffer allocation in progress */ |
632 | /*@}*/ | 638 | /*@} */ |
633 | 639 | ||
634 | /** \name Performance counters */ | 640 | /** \name Performance counters */ |
635 | /*@{*/ | 641 | /*@{ */ |
636 | unsigned long counters; | 642 | unsigned long counters; |
637 | drm_stat_type_t types[15]; | 643 | drm_stat_type_t types[15]; |
638 | atomic_t counts[15]; | 644 | atomic_t counts[15]; |
639 | /*@}*/ | 645 | /*@} */ |
640 | 646 | ||
641 | /** \name Authentication */ | 647 | /** \name Authentication */ |
642 | /*@{*/ | 648 | /*@{ */ |
643 | drm_file_t *file_first; /**< file list head */ | 649 | drm_file_t *file_first; /**< file list head */ |
644 | drm_file_t *file_last; /**< file list tail */ | 650 | drm_file_t *file_last; /**< file list tail */ |
645 | drm_magic_head_t magiclist[DRM_HASH_SIZE]; /**< magic hash table */ | 651 | drm_magic_head_t magiclist[DRM_HASH_SIZE]; /**< magic hash table */ |
646 | /*@}*/ | 652 | /*@} */ |
647 | 653 | ||
648 | /** \name Memory management */ | 654 | /** \name Memory management */ |
649 | /*@{*/ | 655 | /*@{ */ |
650 | drm_map_list_t *maplist; /**< Linked list of regions */ | 656 | drm_map_list_t *maplist; /**< Linked list of regions */ |
651 | int map_count; /**< Number of mappable regions */ | 657 | int map_count; /**< Number of mappable regions */ |
652 | 658 | ||
653 | /** \name Context handle management */ | 659 | /** \name Context handle management */ |
654 | /*@{*/ | 660 | /*@{ */ |
655 | drm_ctx_list_t *ctxlist; /**< Linked list of context handles */ | 661 | drm_ctx_list_t *ctxlist; /**< Linked list of context handles */ |
656 | int ctx_count; /**< Number of context handles */ | 662 | int ctx_count; /**< Number of context handles */ |
657 | struct semaphore ctxlist_sem; /**< For ctxlist */ | 663 | struct semaphore ctxlist_sem; /**< For ctxlist */ |
658 | 664 | ||
659 | drm_map_t **context_sareas; /**< per-context SAREA's */ | 665 | drm_map_t **context_sareas; /**< per-context SAREA's */ |
660 | int max_context; | 666 | int max_context; |
661 | 667 | ||
662 | drm_vma_entry_t *vmalist; /**< List of vmas (for debugging) */ | 668 | drm_vma_entry_t *vmalist; /**< List of vmas (for debugging) */ |
663 | drm_lock_data_t lock; /**< Information on hardware lock */ | 669 | drm_lock_data_t lock; /**< Information on hardware lock */ |
664 | /*@}*/ | 670 | /*@} */ |
665 | 671 | ||
666 | /** \name DMA queues (contexts) */ | 672 | /** \name DMA queues (contexts) */ |
667 | /*@{*/ | 673 | /*@{ */ |
668 | int queue_count; /**< Number of active DMA queues */ | 674 | int queue_count; /**< Number of active DMA queues */ |
669 | int queue_reserved; /**< Number of reserved DMA queues */ | 675 | int queue_reserved; /**< Number of reserved DMA queues */ |
670 | int queue_slots; /**< Actual length of queuelist */ | 676 | int queue_slots; /**< Actual length of queuelist */ |
671 | drm_queue_t **queuelist; /**< Vector of pointers to DMA queues */ | 677 | drm_queue_t **queuelist; /**< Vector of pointers to DMA queues */ |
672 | drm_device_dma_t *dma; /**< Optional pointer for DMA support */ | 678 | drm_device_dma_t *dma; /**< Optional pointer for DMA support */ |
673 | /*@}*/ | 679 | /*@} */ |
674 | 680 | ||
675 | /** \name Context support */ | 681 | /** \name Context support */ |
676 | /*@{*/ | 682 | /*@{ */ |
677 | int irq; /**< Interrupt used by board */ | 683 | int irq; /**< Interrupt used by board */ |
678 | int irq_enabled; /**< True if irq handler is enabled */ | 684 | int irq_enabled; /**< True if irq handler is enabled */ |
679 | __volatile__ long context_flag; /**< Context swapping flag */ | 685 | __volatile__ long context_flag; /**< Context swapping flag */ |
680 | __volatile__ long interrupt_flag; /**< Interruption handler flag */ | 686 | __volatile__ long interrupt_flag; /**< Interruption handler flag */ |
681 | __volatile__ long dma_flag; /**< DMA dispatch flag */ | 687 | __volatile__ long dma_flag; /**< DMA dispatch flag */ |
682 | struct timer_list timer; /**< Timer for delaying ctx switch */ | 688 | struct timer_list timer; /**< Timer for delaying ctx switch */ |
683 | wait_queue_head_t context_wait; /**< Processes waiting on ctx switch */ | 689 | wait_queue_head_t context_wait; /**< Processes waiting on ctx switch */ |
684 | int last_checked; /**< Last context checked for DMA */ | 690 | int last_checked; /**< Last context checked for DMA */ |
685 | int last_context; /**< Last current context */ | 691 | int last_context; /**< Last current context */ |
686 | unsigned long last_switch; /**< jiffies at last context switch */ | 692 | unsigned long last_switch; /**< jiffies at last context switch */ |
687 | /*@}*/ | 693 | /*@} */ |
688 | 694 | ||
689 | struct work_struct work; | 695 | struct work_struct work; |
690 | /** \name VBLANK IRQ support */ | 696 | /** \name VBLANK IRQ support */ |
691 | /*@{*/ | 697 | /*@{ */ |
692 | 698 | ||
693 | wait_queue_head_t vbl_queue; /**< VBLANK wait queue */ | 699 | wait_queue_head_t vbl_queue; /**< VBLANK wait queue */ |
694 | atomic_t vbl_received; | 700 | atomic_t vbl_received; |
695 | spinlock_t vbl_lock; | 701 | spinlock_t vbl_lock; |
696 | drm_vbl_sig_t vbl_sigs; /**< signal list to send on VBLANK */ | 702 | drm_vbl_sig_t vbl_sigs; /**< signal list to send on VBLANK */ |
697 | unsigned int vbl_pending; | 703 | unsigned int vbl_pending; |
698 | 704 | ||
699 | /*@}*/ | 705 | /*@} */ |
700 | cycles_t ctx_start; | 706 | cycles_t ctx_start; |
701 | cycles_t lck_start; | 707 | cycles_t lck_start; |
702 | 708 | ||
703 | char buf[DRM_BSZ]; /**< Output buffer */ | ||
704 | char *buf_rp; /**< Read pointer */ | ||
705 | char *buf_wp; /**< Write pointer */ | ||
706 | char *buf_end; /**< End pointer */ | ||
707 | struct fasync_struct *buf_async;/**< Processes waiting for SIGIO */ | 709 | struct fasync_struct *buf_async;/**< Processes waiting for SIGIO */ |
708 | wait_queue_head_t buf_readers; /**< Processes waiting to read */ | 710 | wait_queue_head_t buf_readers; /**< Processes waiting to read */ |
709 | wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */ | 711 | wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */ |
710 | 712 | ||
711 | drm_agp_head_t *agp; /**< AGP data */ | 713 | drm_agp_head_t *agp; /**< AGP data */ |
712 | 714 | ||
713 | struct pci_dev *pdev; /**< PCI device structure */ | 715 | struct pci_dev *pdev; /**< PCI device structure */ |
714 | int pci_domain; /**< PCI bus domain number */ | 716 | int pci_domain; /**< PCI bus domain number */ |
715 | int pci_bus; /**< PCI bus number */ | 717 | int pci_bus; /**< PCI bus number */ |
716 | int pci_slot; /**< PCI slot number */ | 718 | int pci_slot; /**< PCI slot number */ |
717 | int pci_func; /**< PCI function number */ | 719 | int pci_func; /**< PCI function number */ |
718 | #ifdef __alpha__ | 720 | #ifdef __alpha__ |
719 | struct pci_controller *hose; | 721 | struct pci_controller *hose; |
720 | #endif | 722 | #endif |
721 | drm_sg_mem_t *sg; /**< Scatter gather memory */ | 723 | drm_sg_mem_t *sg; /**< Scatter gather memory */ |
722 | unsigned long *ctx_bitmap; /**< context bitmap */ | 724 | unsigned long *ctx_bitmap; /**< context bitmap */ |
723 | void *dev_private; /**< device private data */ | 725 | void *dev_private; /**< device private data */ |
724 | drm_sigdata_t sigdata; /**< For block_all_signals */ | 726 | drm_sigdata_t sigdata; /**< For block_all_signals */ |
725 | sigset_t sigmask; | 727 | sigset_t sigmask; |
726 | 728 | ||
727 | struct drm_driver *driver; | 729 | struct drm_driver *driver; |
728 | drm_local_map_t *agp_buffer_map; | 730 | drm_local_map_t *agp_buffer_map; |
729 | unsigned int agp_buffer_token; | 731 | unsigned int agp_buffer_token; |
730 | drm_head_t primary; /**< primary screen head */ | 732 | drm_head_t primary; /**< primary screen head */ |
731 | } drm_device_t; | 733 | } drm_device_t; |
732 | 734 | ||
733 | static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature) | 735 | static __inline__ int drm_core_check_feature(struct drm_device *dev, |
736 | int feature) | ||
734 | { | 737 | { |
735 | return ((dev->driver->driver_features & feature) ? 1 : 0); | 738 | return ((dev->driver->driver_features & feature) ? 1 : 0); |
736 | } | 739 | } |
@@ -738,7 +741,7 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature | |||
738 | #if __OS_HAS_AGP | 741 | #if __OS_HAS_AGP |
739 | static inline int drm_core_has_AGP(struct drm_device *dev) | 742 | static inline int drm_core_has_AGP(struct drm_device *dev) |
740 | { | 743 | { |
741 | return drm_core_check_feature(dev, DRIVER_USE_AGP); | 744 | return drm_core_check_feature(dev, DRIVER_USE_AGP); |
742 | } | 745 | } |
743 | #else | 746 | #else |
744 | #define drm_core_has_AGP(dev) (0) | 747 | #define drm_core_has_AGP(dev) (0) |
@@ -747,7 +750,7 @@ static inline int drm_core_has_AGP(struct drm_device *dev) | |||
747 | #if __OS_HAS_MTRR | 750 | #if __OS_HAS_MTRR |
748 | static inline int drm_core_has_MTRR(struct drm_device *dev) | 751 | static inline int drm_core_has_MTRR(struct drm_device *dev) |
749 | { | 752 | { |
750 | return drm_core_check_feature(dev, DRIVER_USE_MTRR); | 753 | return drm_core_check_feature(dev, DRIVER_USE_MTRR); |
751 | } | 754 | } |
752 | #else | 755 | #else |
753 | #define drm_core_has_MTRR(dev) (0) | 756 | #define drm_core_has_MTRR(dev) (0) |
@@ -758,234 +761,229 @@ static inline int drm_core_has_MTRR(struct drm_device *dev) | |||
758 | /*@{*/ | 761 | /*@{*/ |
759 | 762 | ||
760 | /* Misc. support (drm_init.h) */ | 763 | /* Misc. support (drm_init.h) */ |
761 | extern int drm_flags; | 764 | extern int drm_flags; |
762 | extern void drm_parse_options( char *s ); | 765 | extern void drm_parse_options(char *s); |
763 | extern int drm_cpu_valid( void ); | 766 | extern int drm_cpu_valid(void); |
764 | 767 | ||
765 | /* Driver support (drm_drv.h) */ | 768 | /* Driver support (drm_drv.h) */ |
766 | extern int drm_init(struct drm_driver *driver); | 769 | extern int drm_init(struct drm_driver *driver); |
767 | extern void drm_exit(struct drm_driver *driver); | 770 | extern void drm_exit(struct drm_driver *driver); |
768 | extern int drm_ioctl(struct inode *inode, struct file *filp, | 771 | extern int drm_ioctl(struct inode *inode, struct file *filp, |
769 | unsigned int cmd, unsigned long arg); | 772 | unsigned int cmd, unsigned long arg); |
770 | extern long drm_compat_ioctl(struct file *filp, | 773 | extern long drm_compat_ioctl(struct file *filp, |
771 | unsigned int cmd, unsigned long arg); | 774 | unsigned int cmd, unsigned long arg); |
772 | extern int drm_takedown(drm_device_t * dev); | 775 | extern int drm_takedown(drm_device_t * dev); |
773 | 776 | ||
774 | /* Device support (drm_fops.h) */ | 777 | /* Device support (drm_fops.h) */ |
775 | extern int drm_open(struct inode *inode, struct file *filp); | 778 | extern int drm_open(struct inode *inode, struct file *filp); |
776 | extern int drm_stub_open(struct inode *inode, struct file *filp); | 779 | extern int drm_stub_open(struct inode *inode, struct file *filp); |
777 | extern int drm_flush(struct file *filp); | 780 | extern int drm_flush(struct file *filp); |
778 | extern int drm_fasync(int fd, struct file *filp, int on); | 781 | extern int drm_fasync(int fd, struct file *filp, int on); |
779 | extern int drm_release(struct inode *inode, struct file *filp); | 782 | extern int drm_release(struct inode *inode, struct file *filp); |
780 | 783 | ||
781 | /* Mapping support (drm_vm.h) */ | 784 | /* Mapping support (drm_vm.h) */ |
782 | extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); | 785 | extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); |
783 | extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); | 786 | extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); |
784 | 787 | ||
785 | /* Memory management support (drm_memory.h) */ | 788 | /* Memory management support (drm_memory.h) */ |
786 | #include "drm_memory.h" | 789 | #include "drm_memory.h" |
787 | extern void drm_mem_init(void); | 790 | extern void drm_mem_init(void); |
788 | extern int drm_mem_info(char *buf, char **start, off_t offset, | 791 | extern int drm_mem_info(char *buf, char **start, off_t offset, |
789 | int request, int *eof, void *data); | 792 | int request, int *eof, void *data); |
790 | extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, | 793 | extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); |
791 | int area); | ||
792 | extern unsigned long drm_alloc_pages(int order, int area); | 794 | extern unsigned long drm_alloc_pages(int order, int area); |
793 | extern void drm_free_pages(unsigned long address, int order, | 795 | extern void drm_free_pages(unsigned long address, int order, int area); |
794 | int area); | 796 | extern void *drm_ioremap(unsigned long offset, unsigned long size, |
795 | extern void *drm_ioremap(unsigned long offset, unsigned long size, drm_device_t *dev); | 797 | drm_device_t * dev); |
796 | extern void *drm_ioremap_nocache(unsigned long offset, unsigned long size, | 798 | extern void *drm_ioremap_nocache(unsigned long offset, unsigned long size, |
797 | drm_device_t *dev); | 799 | drm_device_t * dev); |
798 | extern void drm_ioremapfree(void *pt, unsigned long size, drm_device_t *dev); | 800 | extern void drm_ioremapfree(void *pt, unsigned long size, drm_device_t * dev); |
799 | 801 | ||
800 | extern DRM_AGP_MEM *drm_alloc_agp(drm_device_t *dev, int pages, u32 type); | 802 | extern DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type); |
801 | extern int drm_free_agp(DRM_AGP_MEM *handle, int pages); | 803 | extern int drm_free_agp(DRM_AGP_MEM * handle, int pages); |
802 | extern int drm_bind_agp(DRM_AGP_MEM *handle, unsigned int start); | 804 | extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); |
803 | extern int drm_unbind_agp(DRM_AGP_MEM *handle); | 805 | extern int drm_unbind_agp(DRM_AGP_MEM * handle); |
804 | 806 | ||
805 | /* Misc. IOCTL support (drm_ioctl.h) */ | 807 | /* Misc. IOCTL support (drm_ioctl.h) */ |
806 | extern int drm_irq_by_busid(struct inode *inode, struct file *filp, | 808 | extern int drm_irq_by_busid(struct inode *inode, struct file *filp, |
807 | unsigned int cmd, unsigned long arg); | 809 | unsigned int cmd, unsigned long arg); |
808 | extern int drm_getunique(struct inode *inode, struct file *filp, | 810 | extern int drm_getunique(struct inode *inode, struct file *filp, |
809 | unsigned int cmd, unsigned long arg); | 811 | unsigned int cmd, unsigned long arg); |
810 | extern int drm_setunique(struct inode *inode, struct file *filp, | 812 | extern int drm_setunique(struct inode *inode, struct file *filp, |
811 | unsigned int cmd, unsigned long arg); | 813 | unsigned int cmd, unsigned long arg); |
812 | extern int drm_getmap(struct inode *inode, struct file *filp, | 814 | extern int drm_getmap(struct inode *inode, struct file *filp, |
813 | unsigned int cmd, unsigned long arg); | 815 | unsigned int cmd, unsigned long arg); |
814 | extern int drm_getclient(struct inode *inode, struct file *filp, | 816 | extern int drm_getclient(struct inode *inode, struct file *filp, |
815 | unsigned int cmd, unsigned long arg); | 817 | unsigned int cmd, unsigned long arg); |
816 | extern int drm_getstats(struct inode *inode, struct file *filp, | 818 | extern int drm_getstats(struct inode *inode, struct file *filp, |
817 | unsigned int cmd, unsigned long arg); | 819 | unsigned int cmd, unsigned long arg); |
818 | extern int drm_setversion(struct inode *inode, struct file *filp, | 820 | extern int drm_setversion(struct inode *inode, struct file *filp, |
819 | unsigned int cmd, unsigned long arg); | 821 | unsigned int cmd, unsigned long arg); |
820 | 822 | ||
821 | /* Context IOCTL support (drm_context.h) */ | 823 | /* Context IOCTL support (drm_context.h) */ |
822 | extern int drm_resctx( struct inode *inode, struct file *filp, | 824 | extern int drm_resctx(struct inode *inode, struct file *filp, |
823 | unsigned int cmd, unsigned long arg ); | 825 | unsigned int cmd, unsigned long arg); |
824 | extern int drm_addctx( struct inode *inode, struct file *filp, | 826 | extern int drm_addctx(struct inode *inode, struct file *filp, |
825 | unsigned int cmd, unsigned long arg ); | 827 | unsigned int cmd, unsigned long arg); |
826 | extern int drm_modctx( struct inode *inode, struct file *filp, | 828 | extern int drm_modctx(struct inode *inode, struct file *filp, |
827 | unsigned int cmd, unsigned long arg ); | 829 | unsigned int cmd, unsigned long arg); |
828 | extern int drm_getctx( struct inode *inode, struct file *filp, | 830 | extern int drm_getctx(struct inode *inode, struct file *filp, |
829 | unsigned int cmd, unsigned long arg ); | 831 | unsigned int cmd, unsigned long arg); |
830 | extern int drm_switchctx( struct inode *inode, struct file *filp, | 832 | extern int drm_switchctx(struct inode *inode, struct file *filp, |
831 | unsigned int cmd, unsigned long arg ); | 833 | unsigned int cmd, unsigned long arg); |
832 | extern int drm_newctx( struct inode *inode, struct file *filp, | 834 | extern int drm_newctx(struct inode *inode, struct file *filp, |
833 | unsigned int cmd, unsigned long arg ); | 835 | unsigned int cmd, unsigned long arg); |
834 | extern int drm_rmctx( struct inode *inode, struct file *filp, | 836 | extern int drm_rmctx(struct inode *inode, struct file *filp, |
835 | unsigned int cmd, unsigned long arg ); | 837 | unsigned int cmd, unsigned long arg); |
836 | 838 | ||
837 | extern int drm_ctxbitmap_init( drm_device_t *dev ); | 839 | extern int drm_ctxbitmap_init(drm_device_t * dev); |
838 | extern void drm_ctxbitmap_cleanup( drm_device_t *dev ); | 840 | extern void drm_ctxbitmap_cleanup(drm_device_t * dev); |
839 | extern void drm_ctxbitmap_free( drm_device_t *dev, int ctx_handle ); | 841 | extern void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle); |
840 | 842 | ||
841 | extern int drm_setsareactx( struct inode *inode, struct file *filp, | 843 | extern int drm_setsareactx(struct inode *inode, struct file *filp, |
842 | unsigned int cmd, unsigned long arg ); | 844 | unsigned int cmd, unsigned long arg); |
843 | extern int drm_getsareactx( struct inode *inode, struct file *filp, | 845 | extern int drm_getsareactx(struct inode *inode, struct file *filp, |
844 | unsigned int cmd, unsigned long arg ); | 846 | unsigned int cmd, unsigned long arg); |
845 | 847 | ||
846 | /* Drawable IOCTL support (drm_drawable.h) */ | 848 | /* Drawable IOCTL support (drm_drawable.h) */ |
847 | extern int drm_adddraw(struct inode *inode, struct file *filp, | 849 | extern int drm_adddraw(struct inode *inode, struct file *filp, |
848 | unsigned int cmd, unsigned long arg); | 850 | unsigned int cmd, unsigned long arg); |
849 | extern int drm_rmdraw(struct inode *inode, struct file *filp, | 851 | extern int drm_rmdraw(struct inode *inode, struct file *filp, |
850 | unsigned int cmd, unsigned long arg); | 852 | unsigned int cmd, unsigned long arg); |
851 | |||
852 | 853 | ||
853 | /* Authentication IOCTL support (drm_auth.h) */ | 854 | /* Authentication IOCTL support (drm_auth.h) */ |
854 | extern int drm_getmagic(struct inode *inode, struct file *filp, | 855 | extern int drm_getmagic(struct inode *inode, struct file *filp, |
855 | unsigned int cmd, unsigned long arg); | 856 | unsigned int cmd, unsigned long arg); |
856 | extern int drm_authmagic(struct inode *inode, struct file *filp, | 857 | extern int drm_authmagic(struct inode *inode, struct file *filp, |
857 | unsigned int cmd, unsigned long arg); | 858 | unsigned int cmd, unsigned long arg); |
858 | 859 | ||
859 | /* Placeholder for ioctls past */ | 860 | /* Placeholder for ioctls past */ |
860 | extern int drm_noop(struct inode *inode, struct file *filp, | 861 | extern int drm_noop(struct inode *inode, struct file *filp, |
861 | unsigned int cmd, unsigned long arg); | 862 | unsigned int cmd, unsigned long arg); |
862 | 863 | ||
863 | /* Locking IOCTL support (drm_lock.h) */ | 864 | /* Locking IOCTL support (drm_lock.h) */ |
864 | extern int drm_lock(struct inode *inode, struct file *filp, | 865 | extern int drm_lock(struct inode *inode, struct file *filp, |
865 | unsigned int cmd, unsigned long arg); | 866 | unsigned int cmd, unsigned long arg); |
866 | extern int drm_unlock(struct inode *inode, struct file *filp, | 867 | extern int drm_unlock(struct inode *inode, struct file *filp, |
867 | unsigned int cmd, unsigned long arg); | 868 | unsigned int cmd, unsigned long arg); |
868 | extern int drm_lock_take(__volatile__ unsigned int *lock, | 869 | extern int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context); |
869 | unsigned int context); | 870 | extern int drm_lock_free(drm_device_t * dev, |
870 | extern int drm_lock_free(drm_device_t *dev, | 871 | __volatile__ unsigned int *lock, unsigned int context); |
871 | __volatile__ unsigned int *lock, | ||
872 | unsigned int context); | ||
873 | 872 | ||
874 | /* Buffer management support (drm_bufs.h) */ | 873 | /* Buffer management support (drm_bufs.h) */ |
875 | extern int drm_addbufs_agp(drm_device_t *dev, drm_buf_desc_t *request); | 874 | extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request); |
876 | extern int drm_addbufs_pci(drm_device_t *dev, drm_buf_desc_t *request); | 875 | extern int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request); |
877 | extern int drm_addmap(drm_device_t *dev, unsigned int offset, | 876 | extern int drm_addmap(drm_device_t * dev, unsigned int offset, |
878 | unsigned int size, drm_map_type_t type, | 877 | unsigned int size, drm_map_type_t type, |
879 | drm_map_flags_t flags, drm_local_map_t **map_ptr); | 878 | drm_map_flags_t flags, drm_local_map_t ** map_ptr); |
880 | extern int drm_addmap_ioctl(struct inode *inode, struct file *filp, | 879 | extern int drm_addmap_ioctl(struct inode *inode, struct file *filp, |
881 | unsigned int cmd, unsigned long arg); | 880 | unsigned int cmd, unsigned long arg); |
882 | extern int drm_rmmap(drm_device_t *dev, drm_local_map_t *map); | 881 | extern int drm_rmmap(drm_device_t * dev, drm_local_map_t * map); |
883 | extern int drm_rmmap_locked(drm_device_t *dev, drm_local_map_t *map); | 882 | extern int drm_rmmap_locked(drm_device_t * dev, drm_local_map_t * map); |
884 | extern int drm_rmmap_ioctl(struct inode *inode, struct file *filp, | 883 | extern int drm_rmmap_ioctl(struct inode *inode, struct file *filp, |
885 | unsigned int cmd, unsigned long arg); | 884 | unsigned int cmd, unsigned long arg); |
886 | 885 | ||
887 | extern int drm_order( unsigned long size ); | 886 | extern int drm_order(unsigned long size); |
888 | extern int drm_addbufs( struct inode *inode, struct file *filp, | 887 | extern int drm_addbufs(struct inode *inode, struct file *filp, |
889 | unsigned int cmd, unsigned long arg ); | 888 | unsigned int cmd, unsigned long arg); |
890 | extern int drm_infobufs( struct inode *inode, struct file *filp, | 889 | extern int drm_infobufs(struct inode *inode, struct file *filp, |
891 | unsigned int cmd, unsigned long arg ); | 890 | unsigned int cmd, unsigned long arg); |
892 | extern int drm_markbufs( struct inode *inode, struct file *filp, | 891 | extern int drm_markbufs(struct inode *inode, struct file *filp, |
893 | unsigned int cmd, unsigned long arg ); | 892 | unsigned int cmd, unsigned long arg); |
894 | extern int drm_freebufs( struct inode *inode, struct file *filp, | 893 | extern int drm_freebufs(struct inode *inode, struct file *filp, |
895 | unsigned int cmd, unsigned long arg ); | 894 | unsigned int cmd, unsigned long arg); |
896 | extern int drm_mapbufs( struct inode *inode, struct file *filp, | 895 | extern int drm_mapbufs(struct inode *inode, struct file *filp, |
897 | unsigned int cmd, unsigned long arg ); | 896 | unsigned int cmd, unsigned long arg); |
898 | extern unsigned long drm_get_resource_start(drm_device_t *dev, | 897 | extern unsigned long drm_get_resource_start(drm_device_t * dev, |
899 | unsigned int resource); | 898 | unsigned int resource); |
900 | extern unsigned long drm_get_resource_len(drm_device_t *dev, | 899 | extern unsigned long drm_get_resource_len(drm_device_t * dev, |
901 | unsigned int resource); | 900 | unsigned int resource); |
902 | 901 | ||
903 | /* DMA support (drm_dma.h) */ | 902 | /* DMA support (drm_dma.h) */ |
904 | extern int drm_dma_setup(drm_device_t *dev); | 903 | extern int drm_dma_setup(drm_device_t * dev); |
905 | extern void drm_dma_takedown(drm_device_t *dev); | 904 | extern void drm_dma_takedown(drm_device_t * dev); |
906 | extern void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf); | 905 | extern void drm_free_buffer(drm_device_t * dev, drm_buf_t * buf); |
907 | extern void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp); | 906 | extern void drm_core_reclaim_buffers(drm_device_t * dev, struct file *filp); |
908 | 907 | ||
909 | /* IRQ support (drm_irq.h) */ | 908 | /* IRQ support (drm_irq.h) */ |
910 | extern int drm_control( struct inode *inode, struct file *filp, | 909 | extern int drm_control(struct inode *inode, struct file *filp, |
911 | unsigned int cmd, unsigned long arg ); | 910 | unsigned int cmd, unsigned long arg); |
912 | extern int drm_irq_uninstall( drm_device_t *dev ); | 911 | extern int drm_irq_uninstall(drm_device_t * dev); |
913 | extern irqreturn_t drm_irq_handler( DRM_IRQ_ARGS ); | 912 | extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS); |
914 | extern void drm_driver_irq_preinstall( drm_device_t *dev ); | 913 | extern void drm_driver_irq_preinstall(drm_device_t * dev); |
915 | extern void drm_driver_irq_postinstall( drm_device_t *dev ); | 914 | extern void drm_driver_irq_postinstall(drm_device_t * dev); |
916 | extern void drm_driver_irq_uninstall( drm_device_t *dev ); | 915 | extern void drm_driver_irq_uninstall(drm_device_t * dev); |
917 | 916 | ||
918 | extern int drm_wait_vblank(struct inode *inode, struct file *filp, | 917 | extern int drm_wait_vblank(struct inode *inode, struct file *filp, |
919 | unsigned int cmd, unsigned long arg); | 918 | unsigned int cmd, unsigned long arg); |
920 | extern int drm_vblank_wait(drm_device_t *dev, unsigned int *vbl_seq); | 919 | extern int drm_vblank_wait(drm_device_t * dev, unsigned int *vbl_seq); |
921 | extern void drm_vbl_send_signals( drm_device_t *dev ); | 920 | extern void drm_vbl_send_signals(drm_device_t * dev); |
922 | 921 | ||
923 | /* AGP/GART support (drm_agpsupport.h) */ | 922 | /* AGP/GART support (drm_agpsupport.h) */ |
924 | extern drm_agp_head_t *drm_agp_init(drm_device_t *dev); | 923 | extern drm_agp_head_t *drm_agp_init(drm_device_t * dev); |
925 | extern int drm_agp_acquire(drm_device_t * dev); | 924 | extern int drm_agp_acquire(drm_device_t * dev); |
926 | extern int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp, | 925 | extern int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp, |
927 | unsigned int cmd, unsigned long arg); | 926 | unsigned int cmd, unsigned long arg); |
928 | extern int drm_agp_release(drm_device_t *dev); | 927 | extern int drm_agp_release(drm_device_t * dev); |
929 | extern int drm_agp_release_ioctl(struct inode *inode, struct file *filp, | 928 | extern int drm_agp_release_ioctl(struct inode *inode, struct file *filp, |
930 | unsigned int cmd, unsigned long arg); | 929 | unsigned int cmd, unsigned long arg); |
931 | extern int drm_agp_enable(drm_device_t *dev, drm_agp_mode_t mode); | 930 | extern int drm_agp_enable(drm_device_t * dev, drm_agp_mode_t mode); |
932 | extern int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, | 931 | extern int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, |
933 | unsigned int cmd, unsigned long arg); | 932 | unsigned int cmd, unsigned long arg); |
934 | extern int drm_agp_info(drm_device_t * dev, drm_agp_info_t *info); | 933 | extern int drm_agp_info(drm_device_t * dev, drm_agp_info_t * info); |
935 | extern int drm_agp_info_ioctl(struct inode *inode, struct file *filp, | 934 | extern int drm_agp_info_ioctl(struct inode *inode, struct file *filp, |
935 | unsigned int cmd, unsigned long arg); | ||
936 | extern int drm_agp_alloc(struct inode *inode, struct file *filp, | ||
937 | unsigned int cmd, unsigned long arg); | ||
938 | extern int drm_agp_free(struct inode *inode, struct file *filp, | ||
939 | unsigned int cmd, unsigned long arg); | ||
940 | extern int drm_agp_unbind(struct inode *inode, struct file *filp, | ||
941 | unsigned int cmd, unsigned long arg); | ||
942 | extern int drm_agp_bind(struct inode *inode, struct file *filp, | ||
936 | unsigned int cmd, unsigned long arg); | 943 | unsigned int cmd, unsigned long arg); |
937 | extern int drm_agp_alloc(struct inode *inode, struct file *filp, | 944 | extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, |
938 | unsigned int cmd, unsigned long arg); | 945 | size_t pages, u32 type); |
939 | extern int drm_agp_free(struct inode *inode, struct file *filp, | 946 | extern int drm_agp_free_memory(DRM_AGP_MEM * handle); |
940 | unsigned int cmd, unsigned long arg); | 947 | extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start); |
941 | extern int drm_agp_unbind(struct inode *inode, struct file *filp, | 948 | extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle); |
942 | unsigned int cmd, unsigned long arg); | ||
943 | extern int drm_agp_bind(struct inode *inode, struct file *filp, | ||
944 | unsigned int cmd, unsigned long arg); | ||
945 | extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type); | ||
946 | extern int drm_agp_free_memory(DRM_AGP_MEM *handle); | ||
947 | extern int drm_agp_bind_memory(DRM_AGP_MEM *handle, off_t start); | ||
948 | extern int drm_agp_unbind_memory(DRM_AGP_MEM *handle); | ||
949 | 949 | ||
950 | /* Stub support (drm_stub.h) */ | 950 | /* Stub support (drm_stub.h) */ |
951 | extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, | 951 | extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, |
952 | struct drm_driver *driver); | 952 | struct drm_driver *driver); |
953 | extern int drm_put_dev(drm_device_t * dev); | 953 | extern int drm_put_dev(drm_device_t * dev); |
954 | extern int drm_put_head(drm_head_t * head); | 954 | extern int drm_put_head(drm_head_t * head); |
955 | extern unsigned int drm_debug; | 955 | extern unsigned int drm_debug; |
956 | extern unsigned int drm_cards_limit; | 956 | extern unsigned int drm_cards_limit; |
957 | extern drm_head_t **drm_heads; | 957 | extern drm_head_t **drm_heads; |
958 | extern struct drm_sysfs_class *drm_class; | 958 | extern struct drm_sysfs_class *drm_class; |
959 | extern struct proc_dir_entry *drm_proc_root; | 959 | extern struct proc_dir_entry *drm_proc_root; |
960 | 960 | ||
961 | /* Proc support (drm_proc.h) */ | 961 | /* Proc support (drm_proc.h) */ |
962 | extern int drm_proc_init(drm_device_t *dev, | 962 | extern int drm_proc_init(drm_device_t * dev, |
963 | int minor, | 963 | int minor, |
964 | struct proc_dir_entry *root, | 964 | struct proc_dir_entry *root, |
965 | struct proc_dir_entry **dev_root); | 965 | struct proc_dir_entry **dev_root); |
966 | extern int drm_proc_cleanup(int minor, | 966 | extern int drm_proc_cleanup(int minor, |
967 | struct proc_dir_entry *root, | 967 | struct proc_dir_entry *root, |
968 | struct proc_dir_entry *dev_root); | 968 | struct proc_dir_entry *dev_root); |
969 | 969 | ||
970 | /* Scatter Gather Support (drm_scatter.h) */ | 970 | /* Scatter Gather Support (drm_scatter.h) */ |
971 | extern void drm_sg_cleanup(drm_sg_mem_t *entry); | 971 | extern void drm_sg_cleanup(drm_sg_mem_t * entry); |
972 | extern int drm_sg_alloc(struct inode *inode, struct file *filp, | 972 | extern int drm_sg_alloc(struct inode *inode, struct file *filp, |
973 | unsigned int cmd, unsigned long arg); | 973 | unsigned int cmd, unsigned long arg); |
974 | extern int drm_sg_free(struct inode *inode, struct file *filp, | 974 | extern int drm_sg_free(struct inode *inode, struct file *filp, |
975 | unsigned int cmd, unsigned long arg); | 975 | unsigned int cmd, unsigned long arg); |
976 | 976 | ||
977 | /* ATI PCIGART support (ati_pcigart.h) */ | 977 | /* ATI PCIGART support (ati_pcigart.h) */ |
978 | extern int drm_ati_pcigart_init(drm_device_t *dev, | 978 | extern int drm_ati_pcigart_init(drm_device_t * dev, |
979 | unsigned long *addr, | 979 | drm_ati_pcigart_info * gart_info); |
980 | dma_addr_t *bus_addr); | 980 | extern int drm_ati_pcigart_cleanup(drm_device_t * dev, |
981 | extern int drm_ati_pcigart_cleanup(drm_device_t *dev, | 981 | drm_ati_pcigart_info * gart_info); |
982 | unsigned long addr, | 982 | |
983 | dma_addr_t bus_addr); | 983 | extern drm_dma_handle_t *drm_pci_alloc(drm_device_t * dev, size_t size, |
984 | |||
985 | extern drm_dma_handle_t *drm_pci_alloc(drm_device_t *dev, size_t size, | ||
986 | size_t align, dma_addr_t maxaddr); | 984 | size_t align, dma_addr_t maxaddr); |
987 | extern void __drm_pci_free(drm_device_t *dev, drm_dma_handle_t *dmah); | 985 | extern void __drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah); |
988 | extern void drm_pci_free(drm_device_t *dev, drm_dma_handle_t *dmah); | 986 | extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah); |
989 | 987 | ||
990 | /* sysfs support (drm_sysfs.c) */ | 988 | /* sysfs support (drm_sysfs.c) */ |
991 | struct drm_sysfs_class; | 989 | struct drm_sysfs_class; |
@@ -998,38 +996,41 @@ extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, | |||
998 | const char *fmt, ...); | 996 | const char *fmt, ...); |
999 | extern void drm_sysfs_device_remove(dev_t dev); | 997 | extern void drm_sysfs_device_remove(dev_t dev); |
1000 | 998 | ||
1001 | |||
1002 | /* Inline replacements for DRM_IOREMAP macros */ | 999 | /* Inline replacements for DRM_IOREMAP macros */ |
1003 | static __inline__ void drm_core_ioremap(struct drm_map *map, struct drm_device *dev) | 1000 | static __inline__ void drm_core_ioremap(struct drm_map *map, |
1001 | struct drm_device *dev) | ||
1004 | { | 1002 | { |
1005 | map->handle = drm_ioremap( map->offset, map->size, dev ); | 1003 | map->handle = drm_ioremap(map->offset, map->size, dev); |
1006 | } | 1004 | } |
1007 | 1005 | ||
1008 | static __inline__ void drm_core_ioremap_nocache(struct drm_map *map, struct drm_device *dev) | 1006 | static __inline__ void drm_core_ioremap_nocache(struct drm_map *map, |
1007 | struct drm_device *dev) | ||
1009 | { | 1008 | { |
1010 | map->handle = drm_ioremap_nocache(map->offset, map->size, dev); | 1009 | map->handle = drm_ioremap_nocache(map->offset, map->size, dev); |
1011 | } | 1010 | } |
1012 | 1011 | ||
1013 | static __inline__ void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev) | 1012 | static __inline__ void drm_core_ioremapfree(struct drm_map *map, |
1013 | struct drm_device *dev) | ||
1014 | { | 1014 | { |
1015 | if ( map->handle && map->size ) | 1015 | if (map->handle && map->size) |
1016 | drm_ioremapfree( map->handle, map->size, dev ); | 1016 | drm_ioremapfree(map->handle, map->size, dev); |
1017 | } | 1017 | } |
1018 | 1018 | ||
1019 | static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, unsigned int token) | 1019 | static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, |
1020 | unsigned int token) | ||
1020 | { | 1021 | { |
1021 | drm_map_list_t *_entry; | 1022 | drm_map_list_t *_entry; |
1022 | list_for_each_entry(_entry, &dev->maplist->head, head) | 1023 | list_for_each_entry(_entry, &dev->maplist->head, head) |
1023 | if (_entry->user_token == token) | 1024 | if (_entry->user_token == token) |
1024 | return _entry->map; | 1025 | return _entry->map; |
1025 | return NULL; | 1026 | return NULL; |
1026 | } | 1027 | } |
1027 | 1028 | ||
1028 | static __inline__ int drm_device_is_agp(drm_device_t *dev) | 1029 | static __inline__ int drm_device_is_agp(drm_device_t * dev) |
1029 | { | 1030 | { |
1030 | if ( dev->driver->device_is_agp != NULL ) { | 1031 | if (dev->driver->device_is_agp != NULL) { |
1031 | int err = (*dev->driver->device_is_agp)( dev ); | 1032 | int err = (*dev->driver->device_is_agp) (dev); |
1032 | 1033 | ||
1033 | if (err != 2) { | 1034 | if (err != 2) { |
1034 | return err; | 1035 | return err; |
1035 | } | 1036 | } |
@@ -1038,6 +1039,11 @@ static __inline__ int drm_device_is_agp(drm_device_t *dev) | |||
1038 | return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); | 1039 | return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); |
1039 | } | 1040 | } |
1040 | 1041 | ||
1042 | static __inline__ int drm_device_is_pcie(drm_device_t * dev) | ||
1043 | { | ||
1044 | return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); | ||
1045 | } | ||
1046 | |||
1041 | static __inline__ void drm_core_dropmap(struct drm_map *map) | 1047 | static __inline__ void drm_core_dropmap(struct drm_map *map) |
1042 | { | 1048 | { |
1043 | } | 1049 | } |
@@ -1068,12 +1074,12 @@ extern void *drm_calloc(size_t nmemb, size_t size, int area); | |||
1068 | 1074 | ||
1069 | /*@}*/ | 1075 | /*@}*/ |
1070 | 1076 | ||
1071 | extern unsigned long drm_core_get_map_ofs(drm_map_t *map); | 1077 | extern unsigned long drm_core_get_map_ofs(drm_map_t * map); |
1072 | extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev); | 1078 | extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev); |
1073 | 1079 | ||
1074 | #ifndef pci_pretty_name | 1080 | #ifndef pci_pretty_name |
1075 | #define pci_pretty_name(dev) "" | 1081 | #define pci_pretty_name(dev) "" |
1076 | #endif | 1082 | #endif |
1077 | 1083 | ||
1078 | #endif /* __KERNEL__ */ | 1084 | #endif /* __KERNEL__ */ |
1079 | #endif | 1085 | #endif |