drmP.h revision 139749
1139743Simp/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*- 243412Snewton * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com */ 343412Snewton/*- 443412Snewton * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 543412Snewton * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 643412Snewton * All rights reserved. 743412Snewton * 843412Snewton * Permission is hereby granted, free of charge, to any person obtaining a 943412Snewton * copy of this software and associated documentation files (the "Software"), 1043412Snewton * to deal in the Software without restriction, including without limitation 1143412Snewton * the rights to use, copy, modify, merge, publish, distribute, sublicense, 1243412Snewton * and/or sell copies of the Software, and to permit persons to whom the 1343412Snewton * Software is furnished to do so, subject to the following conditions: 1443412Snewton * 1543412Snewton * The above copyright notice and this permission notice (including the next 1643412Snewton * paragraph) shall be included in all copies or substantial portions of the 1743412Snewton * Software. 1843412Snewton * 1943412Snewton * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2043412Snewton * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2143412Snewton * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 2243412Snewton * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 2343412Snewton * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 2443412Snewton * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2543412Snewton * OTHER DEALINGS IN THE SOFTWARE. 2643412Snewton * 2743412Snewton * Authors: 2843412Snewton * Rickard E. (Rik) Faith <faith@valinux.com> 2943412Snewton * Gareth Hughes <gareth@valinux.com> 3043412Snewton * 31101709Srwatson * $FreeBSD: head/sys/dev/drm/drmP.h 139749 2005-01-06 01:43:34Z imp $ 32116174Sobrien */ 33116174Sobrien 34116174Sobrien#ifndef _DRM_P_H_ 35101709Srwatson#define _DRM_P_H_ 36101709Srwatson 3743412Snewton#if defined(_KERNEL) || defined(__KERNEL__) 3843412Snewton 3943412Snewton/* DRM template customization defaults 4043412Snewton */ 4143412Snewton#ifndef __HAVE_AGP 4276166Smarkm#define __HAVE_AGP 0 43141486Sjhb#endif 4443412Snewton#ifndef __HAVE_MTRR 4576166Smarkm#define __HAVE_MTRR 0 4676166Smarkm#endif 47164033Srwatson#ifndef __HAVE_CTX_BITMAP 4876166Smarkm#define __HAVE_CTX_BITMAP 0 4976166Smarkm#endif 50134266Sjhb#ifndef __HAVE_DMA 5176166Smarkm#define __HAVE_DMA 0 5243412Snewton#endif 5343412Snewton#ifndef __HAVE_IRQ 5443412Snewton#define __HAVE_IRQ 0 5543412Snewton#endif 5665302Sobrien 5765302Sobrien#define DRM_DEBUG_CODE 0 /* Include debugging code (if > 1, then 5865302Sobrien also include looping detection. */ 5965302Sobrien 6065302Sobrientypedef struct drm_device drm_device_t; 6165302Sobrientypedef struct drm_file drm_file_t; 6243412Snewton 63163606Srwatson/* There's undoubtably more of this file to go into these OS dependent ones. */ 64163606Srwatson 6592761Salfred#ifdef __FreeBSD__ 6692761Salfred#include "dev/drm/drm_os_freebsd.h" 6792761Salfred#elif defined __NetBSD__ 6892761Salfred#include "dev/drm/drm_os_netbsd.h" 6992761Salfred#endif 7092761Salfred 7192761Salfred#include "dev/drm/drm.h" 7292761Salfred 7392761Salfred/* Begin the DRM... */ 7443412Snewton 7543412Snewton#define DRM_HASH_SIZE 16 /* Size of key hash table */ 7643412Snewton#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */ 7743412Snewton#define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */ 7843412Snewton 7943412Snewton#define DRM_FLAG_DEBUG 0x01 8043412Snewton 8143412Snewton#define DRM_MEM_DMA 0 8243412Snewton#define DRM_MEM_SAREA 1 8343412Snewton#define DRM_MEM_DRIVER 2 8443412Snewton#define DRM_MEM_MAGIC 3 8543412Snewton#define DRM_MEM_IOCTLS 4 8643412Snewton#define DRM_MEM_MAPS 5 8743412Snewton#define DRM_MEM_BUFS 6 8843412Snewton#define DRM_MEM_SEGS 7 8943412Snewton#define DRM_MEM_PAGES 8 9043412Snewton#define DRM_MEM_FILES 9 9143412Snewton#define DRM_MEM_QUEUES 10 9243412Snewton#define DRM_MEM_CMDS 11 9343412Snewton#define DRM_MEM_MAPPINGS 12 9443412Snewton#define DRM_MEM_BUFLISTS 13 9543412Snewton#define DRM_MEM_AGPLISTS 14 9643412Snewton#define DRM_MEM_TOTALAGP 15 9743412Snewton#define DRM_MEM_BOUNDAGP 16 9843412Snewton#define DRM_MEM_CTXBITMAP 17 9943412Snewton#define DRM_MEM_STUB 18 10043412Snewton#define DRM_MEM_SGLISTS 19 10143412Snewton 10243412Snewton#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) 10343412Snewton 10443412Snewton /* Mapping helper macros */ 10543412Snewton#define DRM_IOREMAP(map, dev) \ 10643412Snewton (map)->handle = DRM(ioremap)( dev, map ) 10743412Snewton 10843412Snewton#define DRM_IOREMAP_NOCACHE(map, dev) \ 10943412Snewton (map)->handle = DRM(ioremap_nocache)( dev, map ) 11043412Snewton 11143412Snewton#define DRM_IOREMAPFREE(map, dev) \ 11243412Snewton do { \ 11343412Snewton if ( (map)->handle && (map)->size ) \ 11443412Snewton DRM(ioremapfree)( map ); \ 11543412Snewton } while (0) 11643412Snewton 11743412Snewton /* Internal types and structures */ 11843412Snewton#define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) 11943412Snewton#define DRM_MIN(a,b) ((a)<(b)?(a):(b)) 12043412Snewton#define DRM_MAX(a,b) ((a)>(b)?(a):(b)) 12143412Snewton 12243412Snewton#define DRM_IF_VERSION(maj, min) (maj << 16 | min) 12343412Snewton 12443412Snewton#define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \ 12543412Snewton (_map) = (_dev)->context_sareas[_ctx]; \ 12643412Snewton} while(0) 12743412Snewton 12843412Snewton 12943412Snewtontypedef struct drm_pci_id_list 13043412Snewton{ 13143412Snewton int vendor; 13243412Snewton int device; 13343412Snewton long driver_private; 13443412Snewton char *name; 13543412Snewton} drm_pci_id_list_t; 13643412Snewton 13743412Snewtontypedef struct drm_ioctl_desc { 13843412Snewton int (*func)(DRM_IOCTL_ARGS); 13943412Snewton int auth_needed; 14043412Snewton int root_only; 14143412Snewton} drm_ioctl_desc_t; 14243412Snewton 14343412Snewtontypedef struct drm_magic_entry { 14443412Snewton drm_magic_t magic; 14543412Snewton struct drm_file *priv; 14643412Snewton struct drm_magic_entry *next; 14743412Snewton} drm_magic_entry_t; 14843412Snewton 14943412Snewtontypedef struct drm_magic_head { 15043412Snewton struct drm_magic_entry *head; 15143412Snewton struct drm_magic_entry *tail; 15243412Snewton} drm_magic_head_t; 15343412Snewton 15443412Snewtontypedef struct drm_buf { 15543412Snewton int idx; /* Index into master buflist */ 15643412Snewton int total; /* Buffer size */ 15743412Snewton int order; /* log-base-2(total) */ 15843412Snewton int used; /* Amount of buffer in use (for DMA) */ 15943412Snewton unsigned long offset; /* Byte offset (used internally) */ 16043412Snewton void *address; /* Address of buffer */ 16143412Snewton unsigned long bus_address; /* Bus address of buffer */ 16243412Snewton struct drm_buf *next; /* Kernel-only: used for free list */ 16343412Snewton __volatile__ int pending; /* On hardware DMA queue */ 16443412Snewton DRMFILE filp; /* Unique identifier of holding process */ 16543412Snewton int context; /* Kernel queue for this buffer */ 16643412Snewton enum { 16743412Snewton DRM_LIST_NONE = 0, 16843412Snewton DRM_LIST_FREE = 1, 16943412Snewton DRM_LIST_WAIT = 2, 17043412Snewton DRM_LIST_PEND = 3, 17143412Snewton DRM_LIST_PRIO = 4, 17243412Snewton DRM_LIST_RECLAIM = 5 17343412Snewton } list; /* Which list we're on */ 17443412Snewton 17543412Snewton int dev_priv_size; /* Size of buffer private stoarge */ 17643412Snewton void *dev_private; /* Per-buffer private storage */ 17743412Snewton} drm_buf_t; 17843412Snewton 17943412Snewtontypedef struct drm_freelist { 18043412Snewton int initialized; /* Freelist in use */ 18143412Snewton atomic_t count; /* Number of free buffers */ 18243412Snewton drm_buf_t *next; /* End pointer */ 18343412Snewton 18443412Snewton int low_mark; /* Low water mark */ 18543412Snewton int high_mark; /* High water mark */ 18643412Snewton} drm_freelist_t; 18743412Snewton 18843412Snewtontypedef struct drm_buf_entry { 18943412Snewton int buf_size; 19043412Snewton int buf_count; 19143412Snewton drm_buf_t *buflist; 19243412Snewton int seg_count; 19343412Snewton int page_order; 19443412Snewton vm_offset_t *seglist; 19543412Snewton dma_addr_t *seglist_bus; 19643412Snewton 19743412Snewton drm_freelist_t freelist; 19843412Snewton} drm_buf_entry_t; 19943412Snewton 20043412Snewtontypedef TAILQ_HEAD(drm_file_list, drm_file) drm_file_list_t; 20143412Snewtonstruct drm_file { 20243412Snewton TAILQ_ENTRY(drm_file) link; 20343412Snewton int authenticated; 20443412Snewton int minor; 20543412Snewton pid_t pid; 20643412Snewton uid_t uid; 20743412Snewton int refs; 20843412Snewton drm_magic_t magic; 20943412Snewton unsigned long ioctl_count; 21043412Snewton struct drm_device *devXX; 21143412Snewton#ifdef DRIVER_FILE_FIELDS 21243412Snewton DRIVER_FILE_FIELDS; 21343412Snewton#endif 21443412Snewton}; 21543412Snewton 21643412Snewtontypedef struct drm_lock_data { 21743412Snewton drm_hw_lock_t *hw_lock; /* Hardware lock */ 21843412Snewton DRMFILE filp; /* Unique identifier of holding process (NULL is kernel)*/ 21943412Snewton int lock_queue; /* Queue of blocked processes */ 22043412Snewton unsigned long lock_time; /* Time of last lock in jiffies */ 22143412Snewton} drm_lock_data_t; 22243412Snewton 22343412Snewton/* This structure, in the drm_device_t, is always initialized while the device 22443412Snewton * is open. dev->dma_lock protects the incrementing of dev->buf_use, which 22543412Snewton * when set marks that no further bufs may be allocated until device teardown 22643412Snewton * occurs (when the last open of the device has closed). The high/low 22743412Snewton * watermarks of bufs are only touched by the X Server, and thus not 22843412Snewton * concurrently accessed, so no locking is needed. 22943412Snewton */ 23043412Snewtontypedef struct drm_device_dma { 23143412Snewton drm_buf_entry_t bufs[DRM_MAX_ORDER+1]; 23243412Snewton int buf_count; 23343412Snewton drm_buf_t **buflist; /* Vector of pointers info bufs */ 23443412Snewton int seg_count; 23543412Snewton int page_count; 23643412Snewton unsigned long *pagelist; 23743412Snewton unsigned long byte_count; 23843412Snewton enum { 23943412Snewton _DRM_DMA_USE_AGP = 0x01, 24043412Snewton _DRM_DMA_USE_SG = 0x02 24143412Snewton } flags; 24243412Snewton 24343412Snewton /* DMA support */ 24443412Snewton drm_buf_t *this_buffer; /* Buffer being sent */ 24543412Snewton drm_buf_t *next_buffer; /* Selected buffer to send */ 24643412Snewton} drm_device_dma_t; 24743412Snewton 24843412Snewton#if __REALLY_HAVE_AGP 24943412Snewtontypedef struct drm_agp_mem { 25043412Snewton void *handle; 25143412Snewton unsigned long bound; /* address */ 25243412Snewton int pages; 25343412Snewton struct drm_agp_mem *prev; 25483366Sjulian struct drm_agp_mem *next; 25583366Sjulian} drm_agp_mem_t; 25643412Snewton 25743412Snewtontypedef struct drm_agp_head { 25843412Snewton device_t agpdev; 25962976Smckusick struct agp_info info; 26043412Snewton const char *chipset; 26143412Snewton drm_agp_mem_t *memory; 26243412Snewton unsigned long mode; 26383366Sjulian int enabled; 26489319Salfred int acquired; 26589319Salfred unsigned long base; 26643412Snewton int mtrr; 26743412Snewton int cant_use_aperture; 26843412Snewton unsigned long page_mask; 26943412Snewton} drm_agp_head_t; 27043412Snewton#endif 27143412Snewton 272101709Srwatsontypedef struct drm_sg_mem { 273101709Srwatson unsigned long handle; 274101709Srwatson void *virtual; 275101709Srwatson int pages; 276101709Srwatson dma_addr_t *busaddr; 277101709Srwatson} drm_sg_mem_t; 278101709Srwatson 279101709Srwatsontypedef struct drm_local_map { 28091406Sjhb unsigned long offset; /* Physical address (0 for SAREA)*/ 28143412Snewton unsigned long size; /* Physical size (bytes) */ 28243412Snewton drm_map_type_t type; /* Type of memory mapped */ 28391406Sjhb drm_map_flags_t flags; /* Flags */ 284164033Srwatson void *handle; /* User-space: "Handle" to pass to mmap */ 285164033Srwatson /* Kernel-space: kernel-virtual address */ 28643412Snewton int mtrr; /* Boolean: MTRR used */ 28743412Snewton /* Private data */ 28862976Smckusick bus_space_tag_t iot; 28962976Smckusick bus_space_handle_t ioh; 29050405Sphk} drm_local_map_t; 29143412Snewton 29262976Smckusicktypedef TAILQ_HEAD(drm_map_list, drm_map_list_entry) drm_map_list_t; 29343412Snewtontypedef struct drm_map_list_entry { 29443412Snewton TAILQ_ENTRY(drm_map_list_entry) link; 29543412Snewton drm_local_map_t *map; 29643412Snewton} drm_map_list_entry_t; 29743412Snewton 29843412SnewtonTAILQ_HEAD(drm_vbl_sig_list, drm_vbl_sig); 29943412Snewtontypedef struct drm_vbl_sig { 30083366Sjulian TAILQ_ENTRY(drm_vbl_sig) link; 30183366Sjulian unsigned int sequence; 30243412Snewton int signo; 30343412Snewton int pid; 30443412Snewton} drm_vbl_sig_t; 30543412Snewton 30689534Salfredstruct drm_device { 30743412Snewton#ifdef __NetBSD__ 30843412Snewton struct device device; /* NetBSD's softc is an extension of struct device */ 30943412Snewton#endif 31043412Snewton const char *name; /* Simple driver name */ 31143412Snewton char *unique; /* Unique identifier: e.g., busid */ 31283366Sjulian int unique_len; /* Length of unique field */ 31343412Snewton#ifdef __FreeBSD__ 31443412Snewton device_t device; /* Device instance from newbus */ 31543412Snewton#endif 31643412Snewton struct cdev *devnode; /* Device number for mknod */ 31789534Salfred int if_version; /* Highest interface version set */ 31889319Salfred 31943412Snewton int flags; /* Flags to open(2) */ 320116678Sphk 32189534Salfred /* Locks */ 32289534Salfred#if defined(__FreeBSD__) && __FreeBSD_version > 500000 32389534Salfred#if __HAVE_DMA 32443412Snewton struct mtx dma_lock; /* protects dev->dma */ 32589306Salfred#endif 32643412Snewton#if __HAVE_IRQ 32791406Sjhb struct mtx irq_lock; /* protects irq condition checks */ 32889534Salfred#endif 32943412Snewton struct mtx dev_lock; /* protects everything else */ 33089306Salfred#endif 33143412Snewton /* Usage Counters */ 33243412Snewton int open_count; /* Outstanding files open */ 33343412Snewton int buf_use; /* Buffers in use -- cannot alloc */ 33443412Snewton 33543412Snewton /* Performance counters */ 33643412Snewton unsigned long counters; 33743412Snewton drm_stat_type_t types[15]; 33843412Snewton atomic_t counts[15]; 33943412Snewton 34043412Snewton /* Authentication */ 34143412Snewton drm_file_list_t files; 34243412Snewton drm_magic_head_t magiclist[DRM_HASH_SIZE]; 34343412Snewton 34443412Snewton /* Linked list of mappable regions. Protected by dev_lock */ 34543412Snewton drm_map_list_t *maplist; 34643412Snewton 34743412Snewton drm_local_map_t **context_sareas; 34889534Salfred int max_context; 34943412Snewton 35043412Snewton drm_lock_data_t lock; /* Information on hardware lock */ 35143412Snewton 35243412Snewton /* DMA queues (contexts) */ 35343412Snewton drm_device_dma_t *dma; /* Optional pointer for DMA support */ 35489534Salfred 35543412Snewton /* Context support */ 35643412Snewton int irq; /* Interrupt used by board */ 35743412Snewton int irq_enabled; /* True if the irq handler is enabled */ 358107849Salfred#ifdef __FreeBSD__ 359107849Salfred int irqrid; /* Interrupt used by board */ 36043412Snewton struct resource *irqr; /* Resource for interrupt used by board */ 36189306Salfred#elif defined(__NetBSD__) 36289306Salfred struct pci_attach_args pa; 36389534Salfred pci_intr_handle_t ih; 36489306Salfred#endif 36543412Snewton void *irqh; /* Handle from bus_setup_intr */ 36643412Snewton 36743412Snewton int pci_domain; 36883366Sjulian int pci_bus; 36983366Sjulian int pci_slot; 37043412Snewton int pci_func; 37143412Snewton 37283366Sjulian atomic_t context_flag; /* Context swapping flag */ 373141486Sjhb int last_context; /* Last current context */ 374141486Sjhb#if __FreeBSD_version >= 400005 37543412Snewton struct task task; 376141486Sjhb#endif 37743412Snewton#if __HAVE_VBL_IRQ 378141486Sjhb int vbl_queue; /* vbl wait channel */ 379141486Sjhb atomic_t vbl_received; 380141486Sjhb#endif 38143412Snewton 38243412Snewton#ifdef __FreeBSD__ 383150663Srwatson struct sigio *buf_sigio; /* Processes waiting for SIGIO */ 384150663Srwatson#elif defined(__NetBSD__) 38543412Snewton pid_t buf_pgid; 38643412Snewton#endif 38743412Snewton 38883366Sjulian /* Sysctl support */ 38943412Snewton struct drm_sysctl_info *sysctl; 39071454Sjhb 391141486Sjhb#if __REALLY_HAVE_AGP 392141486Sjhb drm_agp_head_t *agp; 39343412Snewton#endif 39489306Salfred drm_sg_mem_t *sg; /* Scatter gather memory */ 39543412Snewton atomic_t *ctx_bitmap; 39689319Salfred void *dev_private; 39771454Sjhb}; 39889306Salfred 39989306Salfredextern int DRM(flags); 40089306Salfred 40189306Salfred /* Memory management support (drm_memory.h) */ 40289319Salfredextern void DRM(mem_init)(void); 40389306Salfredextern void DRM(mem_uninit)(void); 40443412Snewtonextern void *DRM(alloc)(size_t size, int area); 40543412Snewtonextern void *DRM(calloc)(size_t nmemb, size_t size, int area); 406102003Srwatsonextern void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, 407102003Srwatson int area); 40889306Salfredextern void DRM(free)(void *pt, size_t size, int area); 40989306Salfredextern void *DRM(ioremap)(drm_device_t *dev, drm_local_map_t *map); 41071454Sjhbextern void DRM(ioremapfree)(drm_local_map_t *map); 41189306Salfredextern int DRM(mtrr_add)(unsigned long offset, size_t size, int flags); 41271454Sjhbextern int DRM(mtrr_del)(unsigned long offset, size_t size, int flags); 41371454Sjhb 41471454Sjhb#if __REALLY_HAVE_AGP 41543412Snewtonextern agp_memory *DRM(alloc_agp)(int pages, u32 type); 41643412Snewtonextern int DRM(free_agp)(agp_memory *handle, int pages); 41743412Snewtonextern int DRM(bind_agp)(agp_memory *handle, unsigned int start); 41843412Snewtonextern int DRM(unbind_agp)(agp_memory *handle); 41943412Snewton#endif 42083366Sjulian 42183366Sjulianextern int DRM(context_switch)(drm_device_t *dev, int old, int new); 42243412Snewtonextern int DRM(context_switch_complete)(drm_device_t *dev, int new); 42343412Snewton 42483366Sjulian#if __HAVE_CTX_BITMAP 42543412Snewtonextern int DRM(ctxbitmap_init)( drm_device_t *dev ); 42643412Snewtonextern void DRM(ctxbitmap_cleanup)( drm_device_t *dev ); 42743412Snewtonextern void DRM(ctxbitmap_free)( drm_device_t *dev, int ctx_handle ); 42883366Sjulianextern int DRM(ctxbitmap_next)( drm_device_t *dev ); 42983366Sjulian#endif 43043412Snewton 43143412Snewton /* Locking IOCTL support (drm_lock.h) */ 432141486Sjhbextern int DRM(lock_take)(__volatile__ unsigned int *lock, 433141486Sjhb unsigned int context); 43443412Snewtonextern int DRM(lock_transfer)(drm_device_t *dev, 435141486Sjhb __volatile__ unsigned int *lock, 43643412Snewton unsigned int context); 437141486Sjhbextern int DRM(lock_free)(drm_device_t *dev, 438141486Sjhb __volatile__ unsigned int *lock, 439141486Sjhb unsigned int context); 440141486Sjhb 44143412Snewton /* Buffer management support (drm_bufs.h) */ 44243412Snewtonextern int DRM(order)( unsigned long size ); 44343412Snewton 44483366Sjulian#if __HAVE_DMA 44583366Sjulian /* DMA support (drm_dma.h) */ 44643412Snewtonextern int DRM(dma_setup)(drm_device_t *dev); 44743412Snewtonextern void DRM(dma_takedown)(drm_device_t *dev); 44883366Sjulianextern void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf); 44943412Snewtonextern void DRM(reclaim_buffers)(drm_device_t *dev, DRMFILE filp); 45043412Snewton#endif 45143412Snewton 45283366Sjulian#if __HAVE_IRQ 45383366Sjulian /* IRQ support (drm_irq.h) */ 45471454Sjhbextern int DRM(irq_install)(drm_device_t *dev); 45543412Snewtonextern int DRM(irq_uninstall)( drm_device_t *dev ); 45643412Snewtonextern irqreturn_t DRM(irq_handler)( DRM_IRQ_ARGS ); 45743412Snewtonextern void DRM(driver_irq_preinstall)( drm_device_t *dev ); 458107849Salfredextern void DRM(driver_irq_postinstall)( drm_device_t *dev ); 45943412Snewtonextern void DRM(driver_irq_uninstall)( drm_device_t *dev ); 46043412Snewton#if __HAVE_IRQ_BH 461107849Salfredextern void DRM(irq_immediate_bh)( DRM_TASKQUEUE_ARGS ); 462107849Salfred#endif 46343412Snewton#endif 464107849Salfred 465107849Salfred#if __HAVE_VBL_IRQ 46643412Snewtonextern int DRM(vblank_wait)(drm_device_t *dev, unsigned int *vbl_seq); 467107849Salfredextern void DRM(vbl_send_signals)( drm_device_t *dev ); 46843412Snewton#endif 46983366Sjulian 47043412Snewton#if __REALLY_HAVE_AGP 47143412Snewton /* AGP/GART support (drm_agpsupport.h) */ 47243412Snewtonextern drm_agp_head_t *DRM(agp_init)(void); 47383366Sjulianextern void DRM(agp_uninit)(void); 47483366Sjulianextern void DRM(agp_do_release)(void); 47543412Snewtonextern agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type); 47643412Snewtonextern int DRM(agp_free_memory)(agp_memory *handle); 477141486Sjhbextern int DRM(agp_bind_memory)(agp_memory *handle, off_t start); 478141486Sjhbextern int DRM(agp_unbind_memory)(agp_memory *handle); 47943412Snewton#endif 480141486Sjhb 481141486Sjhb#if __HAVE_SG 482141486Sjhb /* Scatter Gather Support (drm_scatter.h) */ 483141486Sjhbextern void DRM(sg_cleanup)(drm_sg_mem_t *entry); 48443412Snewton#endif 48543412Snewton 48643412Snewton#if __REALLY_HAVE_SG 48743412Snewton /* ATI PCIGART support (ati_pcigart.h) */ 48883366Sjulianextern int DRM(ati_pcigart_init)(drm_device_t *dev, 48983366Sjulian unsigned long *addr, 49043412Snewton dma_addr_t *bus_addr); 49143412Snewtonextern int DRM(ati_pcigart_cleanup)(drm_device_t *dev, 49243412Snewton unsigned long addr, 49343412Snewton dma_addr_t bus_addr); 49443412Snewton#endif 49543412Snewton 49643412Snewton/* Locking IOCTL support (drm_drv.h) */ 49743412Snewtonextern int DRM(lock)(DRM_IOCTL_ARGS); 498107849Salfredextern int DRM(unlock)(DRM_IOCTL_ARGS); 499107849Salfredextern int DRM(version)( DRM_IOCTL_ARGS ); 500107849Salfredextern int DRM(setversion)( DRM_IOCTL_ARGS ); 501107849Salfred 50243412Snewton/* Misc. IOCTL support (drm_ioctl.h) */ 50383366Sjulianextern int DRM(irq_by_busid)(DRM_IOCTL_ARGS); 50443412Snewtonextern int DRM(getunique)(DRM_IOCTL_ARGS); 50543412Snewtonextern int DRM(setunique)(DRM_IOCTL_ARGS); 50643412Snewtonextern int DRM(getmap)(DRM_IOCTL_ARGS); 50743412Snewtonextern int DRM(getclient)(DRM_IOCTL_ARGS); 50843412Snewtonextern int DRM(getstats)(DRM_IOCTL_ARGS); 50983366Sjulianextern int DRM(noop)(DRM_IOCTL_ARGS); 51083366Sjulian 51143412Snewton/* Context IOCTL support (drm_context.h) */ 51243412Snewtonextern int DRM(resctx)(DRM_IOCTL_ARGS); 51343412Snewtonextern int DRM(addctx)(DRM_IOCTL_ARGS); 51443412Snewtonextern int DRM(modctx)(DRM_IOCTL_ARGS); 51543412Snewtonextern int DRM(getctx)(DRM_IOCTL_ARGS); 51643412Snewtonextern int DRM(switchctx)(DRM_IOCTL_ARGS); 51743412Snewtonextern int DRM(newctx)(DRM_IOCTL_ARGS); 51843412Snewtonextern int DRM(rmctx)(DRM_IOCTL_ARGS); 51943412Snewtonextern int DRM(setsareactx)(DRM_IOCTL_ARGS); 52043412Snewtonextern int DRM(getsareactx)(DRM_IOCTL_ARGS); 52143412Snewton 522107849Salfred/* Drawable IOCTL support (drm_drawable.h) */ 523107849Salfredextern int DRM(adddraw)(DRM_IOCTL_ARGS); 524107849Salfredextern int DRM(rmdraw)(DRM_IOCTL_ARGS); 525107849Salfred 52643412Snewton/* Authentication IOCTL support (drm_auth.h) */ 52783366Sjulianextern int DRM(getmagic)(DRM_IOCTL_ARGS); 52843412Snewtonextern int DRM(authmagic)(DRM_IOCTL_ARGS); 52943412Snewton 53043412Snewton/* Buffer management support (drm_bufs.h) */ 53143412Snewtonextern int DRM(addmap)(DRM_IOCTL_ARGS); 53243412Snewtonextern int DRM(rmmap)(DRM_IOCTL_ARGS); 53383366Sjulian#if __HAVE_DMA 53483366Sjulianextern int DRM(addbufs)(DRM_IOCTL_ARGS); 53543412Snewtonextern int DRM(infobufs)(DRM_IOCTL_ARGS); 53643412Snewtonextern int DRM(markbufs)(DRM_IOCTL_ARGS); 53743412Snewtonextern int DRM(freebufs)(DRM_IOCTL_ARGS); 53843412Snewtonextern int DRM(mapbufs)(DRM_IOCTL_ARGS); 53943412Snewton#endif 54043412Snewton 54143412Snewton/* IRQ support (drm_irq.h) */ 54243412Snewton#if __HAVE_IRQ || __HAVE_DMA 543107849Salfredextern int DRM(control)(DRM_IOCTL_ARGS); 544107849Salfred#endif 545107849Salfred#if __HAVE_VBL_IRQ 546107849Salfredextern int DRM(wait_vblank)(DRM_IOCTL_ARGS); 54743412Snewton#endif 54883366Sjulian 54943412Snewton/* AGP/GART support (drm_agpsupport.h) */ 55043412Snewton#if __REALLY_HAVE_AGP 55143412Snewtonextern int DRM(agp_acquire)(DRM_IOCTL_ARGS); 55243412Snewtonextern int DRM(agp_release)(DRM_IOCTL_ARGS); 55343412Snewtonextern int DRM(agp_enable)(DRM_IOCTL_ARGS); 55483366Sjulianextern int DRM(agp_info)(DRM_IOCTL_ARGS); 55583366Sjulianextern int DRM(agp_alloc)(DRM_IOCTL_ARGS); 55643412Snewtonextern int DRM(agp_free)(DRM_IOCTL_ARGS); 55743412Snewtonextern int DRM(agp_unbind)(DRM_IOCTL_ARGS); 55843412Snewtonextern int DRM(agp_bind)(DRM_IOCTL_ARGS); 55943412Snewton#endif 56043412Snewton 56143412Snewton/* Scatter Gather Support (drm_scatter.h) */ 56243412Snewton#if __HAVE_SG 56343412Snewtonextern int DRM(sg_alloc)(DRM_IOCTL_ARGS); 56443412Snewtonextern int DRM(sg_free)(DRM_IOCTL_ARGS); 56543412Snewton#endif 566107849Salfred 567107849Salfred/* consistent PCI memory functions (drm_pci.h) */ 568107849Salfredextern void *DRM(pci_alloc)(drm_device_t *dev, size_t size, 569107849Salfred size_t align, dma_addr_t maxaddr, 57043412Snewton dma_addr_t *busaddr); 57183366Sjulianextern void DRM(pci_free)(drm_device_t *dev, size_t size, 57243412Snewton void *vaddr, dma_addr_t busaddr); 57343412Snewton 57443412Snewton#endif /* __KERNEL__ */ 57543412Snewton#endif /* _DRM_P_H_ */ 57683366Sjulian