Commit WIP of BSD conversion to core model. Compiles for r128, radeon, but
doesn't run yet. Moves the ioctl definitions for these two drivers back to the shared code -- they aren't OS-specific.main
parent
39a23640b2
commit
c9202c8965
|
@ -1,4 +1,4 @@
|
|||
SHARED= ../shared
|
||||
SHARED= ../shared-core
|
||||
SHAREDFILES= drm.h \
|
||||
drm_sarea.h \
|
||||
i915.h \
|
||||
|
@ -54,7 +54,7 @@ SHAREDFILES= drm.h \
|
|||
via_3d_reg.h \
|
||||
via_dma.c
|
||||
|
||||
SUBDIR = i915 mach64 mga r128 radeon sis tdfx
|
||||
SUBDIR = drm i915 mach64 mga r128 radeon sis tdfx
|
||||
|
||||
CLEANFILES+= ${SHAREDFILES}
|
||||
|
||||
|
|
|
@ -43,9 +43,8 @@
|
|||
# define ATI_MAX_PCIGART_PAGES 8192 /* 32 MB aperture, 4K pages */
|
||||
# define ATI_PCIGART_PAGE_SIZE 4096 /* PCI GART page size */
|
||||
|
||||
int DRM(ati_pcigart_init)( drm_device_t *dev,
|
||||
unsigned long *addr,
|
||||
dma_addr_t *bus_addr)
|
||||
int drm_ati_pcigart_init(drm_device_t *dev, unsigned long *addr,
|
||||
dma_addr_t *bus_addr)
|
||||
{
|
||||
drm_sg_mem_t *entry = dev->sg;
|
||||
unsigned long address = 0;
|
||||
|
@ -59,7 +58,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
|
|||
}
|
||||
|
||||
address = (long)contigmalloc((1 << ATI_PCIGART_TABLE_ORDER) * PAGE_SIZE,
|
||||
DRM(M_DRM), M_NOWAIT, 0ul, 0xfffffffful, PAGE_SIZE, 0);
|
||||
M_DRM, M_NOWAIT, 0ul, 0xfffffffful, PAGE_SIZE, 0);
|
||||
if ( !address ) {
|
||||
DRM_ERROR( "cannot allocate PCI GART page!\n" );
|
||||
goto done;
|
||||
|
@ -95,9 +94,8 @@ done:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int DRM(ati_pcigart_cleanup)( drm_device_t *dev,
|
||||
unsigned long addr,
|
||||
dma_addr_t bus_addr)
|
||||
int drm_ati_pcigart_cleanup(drm_device_t *dev, unsigned long addr,
|
||||
dma_addr_t bus_addr)
|
||||
{
|
||||
drm_sg_mem_t *entry = dev->sg;
|
||||
|
||||
|
@ -108,7 +106,9 @@ int DRM(ati_pcigart_cleanup)( drm_device_t *dev,
|
|||
}
|
||||
|
||||
#if __FreeBSD_version > 500000
|
||||
contigfree( (void *)addr, (1 << ATI_PCIGART_TABLE_ORDER) * PAGE_SIZE, DRM(M_DRM)); /* Not available on 4.x */
|
||||
/* Not available on 4.x */
|
||||
contigfree((void *)addr, (1 << ATI_PCIGART_TABLE_ORDER) * PAGE_SIZE,
|
||||
M_DRM);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
|
388
bsd-core/drmP.h
388
bsd-core/drmP.h
|
@ -35,24 +35,6 @@
|
|||
|
||||
#if defined(_KERNEL) || defined(__KERNEL__)
|
||||
|
||||
/* DRM template customization defaults
|
||||
*/
|
||||
#ifndef __HAVE_AGP
|
||||
#define __HAVE_AGP 0
|
||||
#endif
|
||||
#ifndef __HAVE_MTRR
|
||||
#define __HAVE_MTRR 0
|
||||
#endif
|
||||
#ifndef __HAVE_CTX_BITMAP
|
||||
#define __HAVE_CTX_BITMAP 0
|
||||
#endif
|
||||
#ifndef __HAVE_DMA
|
||||
#define __HAVE_DMA 0
|
||||
#endif
|
||||
#ifndef __HAVE_IRQ
|
||||
#define __HAVE_IRQ 0
|
||||
#endif
|
||||
|
||||
#define DRM_DEBUG_CODE 0 /* Include debugging code (if > 1, then
|
||||
also include looping detection. */
|
||||
|
||||
|
@ -193,7 +175,7 @@ struct drm_file {
|
|||
int refs;
|
||||
drm_magic_t magic;
|
||||
unsigned long ioctl_count;
|
||||
struct drm_device *devXX;
|
||||
void *driver_priv;
|
||||
#ifdef DRIVER_FILE_FIELDS
|
||||
DRIVER_FILE_FIELDS;
|
||||
#endif
|
||||
|
@ -231,7 +213,6 @@ typedef struct drm_device_dma {
|
|||
drm_buf_t *next_buffer; /* Selected buffer to send */
|
||||
} drm_device_dma_t;
|
||||
|
||||
#if __REALLY_HAVE_AGP
|
||||
typedef struct drm_agp_mem {
|
||||
void *handle;
|
||||
unsigned long bound; /* address */
|
||||
|
@ -253,7 +234,6 @@ typedef struct drm_agp_head {
|
|||
int cant_use_aperture;
|
||||
unsigned long page_mask;
|
||||
} drm_agp_head_t;
|
||||
#endif
|
||||
|
||||
typedef struct drm_sg_mem {
|
||||
unsigned long handle;
|
||||
|
@ -292,34 +272,63 @@ typedef struct drm_vbl_sig {
|
|||
/**
|
||||
* DRM device functions structure
|
||||
*/
|
||||
struct drm_device;
|
||||
|
||||
struct drm_driver_fn {
|
||||
int (*preinit)(struct drm_device *, unsigned long flags);
|
||||
int (*postinit)(struct drm_device *, unsigned long flags);
|
||||
void (*prerelease)(struct drm_device *, void *filp);
|
||||
void (*pretakedown)(struct drm_device *);
|
||||
int (*postcleanup)(struct drm_device *);
|
||||
int (*presetup)(struct drm_device *);
|
||||
int (*postsetup)(struct drm_device *);
|
||||
void (*open_helper)(struct drm_device *, drm_file_t *);
|
||||
void (*release)(struct drm_device *, void *filp);
|
||||
void (*dma_ready)(struct drm_device *);
|
||||
int (*dma_quiescent)(struct drm_device *);
|
||||
int (*dma_flush_block_and_flush)(struct drm_device *, int context, drm_lock_flags_t flags);
|
||||
int (*dma_flush_unblock)(struct drm_device *, int context, drm_lock_flags_t flags);
|
||||
int (*context_ctor)(struct drm_device *dev, int context);
|
||||
int (*context_dtor)(struct drm_device *dev, int context);
|
||||
int (*kernel_context_switch)(struct drm_device *dev, int old, int new);
|
||||
int (*kernel_context_switch_unlock)(struct drm_device *dev);
|
||||
int (*dma_schedule)(struct drm_device *dev, int locked);
|
||||
};
|
||||
|
||||
struct drm_device {
|
||||
#ifdef __NetBSD__
|
||||
struct device device; /* NetBSD's softc is an extension of struct device */
|
||||
#endif
|
||||
const char *name; /* Simple driver name */
|
||||
|
||||
/* Beginning of driver-config section */
|
||||
int (*preinit)(struct drm_device *, unsigned long flags);
|
||||
int (*postinit)(struct drm_device *, unsigned long flags);
|
||||
void (*prerelease)(struct drm_device *, void *filp);
|
||||
void (*pretakedown)(struct drm_device *);
|
||||
int (*postcleanup)(struct drm_device *);
|
||||
int (*presetup)(struct drm_device *);
|
||||
int (*postsetup)(struct drm_device *);
|
||||
void (*open_helper)(struct drm_device *, drm_file_t *);
|
||||
void (*release)(struct drm_device *, void *filp);
|
||||
void (*dma_ready)(struct drm_device *);
|
||||
int (*dma_quiescent)(struct drm_device *);
|
||||
int (*dma_flush_block_and_flush)(struct drm_device *, int context,
|
||||
drm_lock_flags_t flags);
|
||||
int (*dma_flush_unblock)(struct drm_device *, int context,
|
||||
drm_lock_flags_t flags);
|
||||
int (*context_ctor)(struct drm_device *dev, int context);
|
||||
int (*context_dtor)(struct drm_device *dev, int context);
|
||||
int (*kernel_context_switch)(struct drm_device *dev, int old,
|
||||
int new);
|
||||
int (*kernel_context_switch_unlock)(struct drm_device *dev);
|
||||
int (*dma_schedule)(struct drm_device *dev, int locked);
|
||||
void (*irq_preinstall)(drm_device_t *dev);
|
||||
void (*irq_postinstall)(drm_device_t *dev);
|
||||
void (*irq_uninstall)(drm_device_t *dev);
|
||||
void (*irq_handler)(DRM_IRQ_ARGS);
|
||||
int (*vblank_wait)(drm_device_t *dev, unsigned int *sequence);
|
||||
|
||||
drm_ioctl_desc_t *driver_ioctls;
|
||||
int max_driver_ioctl;
|
||||
|
||||
int dev_priv_size;
|
||||
|
||||
int driver_major;
|
||||
int driver_minor;
|
||||
int driver_patchlevel;
|
||||
const char *driver_name; /* Simple driver name */
|
||||
const char *driver_desc; /* Longer driver name */
|
||||
const char *driver_date; /* Date of last major changes. */
|
||||
|
||||
unsigned use_agp :1;
|
||||
unsigned require_agp :1;
|
||||
unsigned use_sg :1;
|
||||
unsigned use_dma :1;
|
||||
unsigned use_pci_dma :1;
|
||||
unsigned use_dma_queue :1;
|
||||
unsigned use_irq :1;
|
||||
unsigned use_vbl_irq :1;
|
||||
unsigned use_mtrr :1;
|
||||
unsigned use_ctxbitmap :1;
|
||||
/* End of driver-config section */
|
||||
|
||||
char *unique; /* Unique identifier: e.g., busid */
|
||||
int unique_len; /* Length of unique field */
|
||||
#ifdef __FreeBSD__
|
||||
|
@ -332,12 +341,8 @@ struct drm_device {
|
|||
|
||||
/* Locks */
|
||||
#if defined(__FreeBSD__) && __FreeBSD_version > 500000
|
||||
#if __HAVE_DMA
|
||||
struct mtx dma_lock; /* protects dev->dma */
|
||||
#endif
|
||||
#if __HAVE_IRQ
|
||||
struct mtx irq_lock; /* protects irq condition checks */
|
||||
#endif
|
||||
struct mtx dev_lock; /* protects everything else */
|
||||
#endif
|
||||
/* Usage Counters */
|
||||
|
@ -386,10 +391,8 @@ struct drm_device {
|
|||
#if __FreeBSD_version >= 400005
|
||||
struct task task;
|
||||
#endif
|
||||
#if __HAVE_VBL_IRQ
|
||||
int vbl_queue; /* vbl wait channel */
|
||||
atomic_t vbl_received;
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
struct sigio *buf_sigio; /* Processes waiting for SIGIO */
|
||||
|
@ -400,209 +403,182 @@ struct drm_device {
|
|||
/* Sysctl support */
|
||||
struct drm_sysctl_info *sysctl;
|
||||
|
||||
#if __REALLY_HAVE_AGP
|
||||
drm_agp_head_t *agp;
|
||||
#endif
|
||||
drm_sg_mem_t *sg; /* Scatter gather memory */
|
||||
atomic_t *ctx_bitmap;
|
||||
void *dev_private;
|
||||
struct drm_driver_fn fn_tbl;
|
||||
drm_local_map_t *agp_buffer_map;
|
||||
int dev_priv_size;
|
||||
};
|
||||
|
||||
extern void DRM(driver_register_fns)(struct drm_device *dev);
|
||||
extern int drm_flags;
|
||||
|
||||
extern int DRM(flags);
|
||||
|
||||
/* Memory management support (drm_memory.h) */
|
||||
extern void DRM(mem_init)(void);
|
||||
extern void DRM(mem_uninit)(void);
|
||||
extern void *DRM(alloc)(size_t size, int area);
|
||||
extern void *DRM(calloc)(size_t nmemb, size_t size, int area);
|
||||
extern void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size,
|
||||
/* Device setup support (drm_drv.c) */
|
||||
#ifdef __FreeBSD__
|
||||
int drm_probe(device_t nbdev, drm_pci_id_list_t *idlist);
|
||||
int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist);
|
||||
int drm_detach(device_t nbdev);
|
||||
#elif defined(__NetBSD__)
|
||||
int drm_probe(struct pci_attach_args *pa, drm_pci_id_list_t *idlist);
|
||||
int drm_attach(struct pci_attach_args *pa, dev_t kdev, drm_pci_id_list_t *idlist);
|
||||
#endif
|
||||
|
||||
/* Memory management support (drm_memory.c) */
|
||||
void drm_mem_init(void);
|
||||
void drm_mem_uninit(void);
|
||||
void *drm_alloc(size_t size, int area);
|
||||
void *drm_calloc(size_t nmemb, size_t size, int area);
|
||||
void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
|
||||
int area);
|
||||
extern void DRM(free)(void *pt, size_t size, int area);
|
||||
extern void *DRM(ioremap)(drm_device_t *dev, drm_local_map_t *map);
|
||||
extern void DRM(ioremapfree)(drm_local_map_t *map);
|
||||
extern int DRM(mtrr_add)(unsigned long offset, size_t size, int flags);
|
||||
extern int DRM(mtrr_del)(unsigned long offset, size_t size, int flags);
|
||||
void drm_free(void *pt, size_t size, int area);
|
||||
void *drm_ioremap(drm_device_t *dev, drm_local_map_t *map);
|
||||
void drm_ioremapfree(drm_local_map_t *map);
|
||||
int drm_mtrr_add(unsigned long offset, size_t size, int flags);
|
||||
int drm_mtrr_del(unsigned long offset, size_t size, int flags);
|
||||
|
||||
#if __REALLY_HAVE_AGP
|
||||
extern agp_memory *DRM(alloc_agp)(int pages, u32 type);
|
||||
extern int DRM(free_agp)(agp_memory *handle, int pages);
|
||||
extern int DRM(bind_agp)(agp_memory *handle, unsigned int start);
|
||||
extern int DRM(unbind_agp)(agp_memory *handle);
|
||||
#endif
|
||||
agp_memory *drm_alloc_agp(int pages, u32 type);
|
||||
int drm_free_agp(agp_memory *handle, int pages);
|
||||
int drm_bind_agp(agp_memory *handle, unsigned int start);
|
||||
int drm_unbind_agp(agp_memory *handle);
|
||||
|
||||
extern int DRM(context_switch)(drm_device_t *dev, int old, int new);
|
||||
extern int DRM(context_switch_complete)(drm_device_t *dev, int new);
|
||||
int drm_context_switch(drm_device_t *dev, int old, int new);
|
||||
int drm_context_switch_complete(drm_device_t *dev, int new);
|
||||
|
||||
#if __HAVE_CTX_BITMAP
|
||||
extern int DRM(ctxbitmap_init)( drm_device_t *dev );
|
||||
extern void DRM(ctxbitmap_cleanup)( drm_device_t *dev );
|
||||
extern void DRM(ctxbitmap_free)( drm_device_t *dev, int ctx_handle );
|
||||
extern int DRM(ctxbitmap_next)( drm_device_t *dev );
|
||||
#endif
|
||||
int drm_ctxbitmap_init(drm_device_t *dev);
|
||||
void drm_ctxbitmap_cleanup(drm_device_t *dev);
|
||||
void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle);
|
||||
int drm_ctxbitmap_next(drm_device_t *dev);
|
||||
|
||||
/* Locking IOCTL support (drm_lock.h) */
|
||||
extern int DRM(lock_take)(__volatile__ unsigned int *lock,
|
||||
/* Locking IOCTL support (drm_lock.c) */
|
||||
int drm_lock_take(__volatile__ unsigned int *lock,
|
||||
unsigned int context);
|
||||
extern int DRM(lock_transfer)(drm_device_t *dev,
|
||||
int drm_lock_transfer(drm_device_t *dev,
|
||||
__volatile__ unsigned int *lock,
|
||||
unsigned int context);
|
||||
extern int DRM(lock_free)(drm_device_t *dev,
|
||||
int drm_lock_free(drm_device_t *dev,
|
||||
__volatile__ unsigned int *lock,
|
||||
unsigned int context);
|
||||
|
||||
/* Buffer management support (drm_bufs.h) */
|
||||
extern int DRM(order)( unsigned long size );
|
||||
/* Buffer management support (drm_bufs.c) */
|
||||
int drm_order(unsigned long size);
|
||||
|
||||
#if __HAVE_DMA
|
||||
/* DMA support (drm_dma.h) */
|
||||
extern int DRM(dma_setup)(drm_device_t *dev);
|
||||
extern void DRM(dma_takedown)(drm_device_t *dev);
|
||||
extern void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf);
|
||||
extern void DRM(reclaim_buffers)(drm_device_t *dev, DRMFILE filp);
|
||||
#endif
|
||||
/* DMA support (drm_dma.c) */
|
||||
int drm_dma_setup(drm_device_t *dev);
|
||||
void drm_dma_takedown(drm_device_t *dev);
|
||||
void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf);
|
||||
void drm_reclaim_buffers(drm_device_t *dev, DRMFILE filp);
|
||||
|
||||
#if __HAVE_IRQ
|
||||
/* IRQ support (drm_irq.h) */
|
||||
extern int DRM(irq_install)(drm_device_t *dev);
|
||||
extern int DRM(irq_uninstall)( drm_device_t *dev );
|
||||
extern irqreturn_t DRM(irq_handler)( DRM_IRQ_ARGS );
|
||||
extern void DRM(driver_irq_preinstall)( drm_device_t *dev );
|
||||
extern void DRM(driver_irq_postinstall)( drm_device_t *dev );
|
||||
extern void DRM(driver_irq_uninstall)( drm_device_t *dev );
|
||||
#if __HAVE_IRQ_BH
|
||||
extern void DRM(irq_immediate_bh)( DRM_TASKQUEUE_ARGS );
|
||||
#endif
|
||||
#endif
|
||||
/* IRQ support (drm_irq.c) */
|
||||
int drm_irq_install(drm_device_t *dev);
|
||||
int drm_irq_uninstall(drm_device_t *dev);
|
||||
irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
|
||||
void drm_driver_irq_preinstall(drm_device_t *dev);
|
||||
void drm_driver_irq_postinstall(drm_device_t *dev);
|
||||
void drm_driver_irq_uninstall(drm_device_t *dev);
|
||||
int drm_vblank_wait(drm_device_t *dev, unsigned int *vbl_seq);
|
||||
void drm_vbl_send_signals(drm_device_t *dev);
|
||||
|
||||
#if __HAVE_VBL_IRQ
|
||||
extern int DRM(vblank_wait)(drm_device_t *dev, unsigned int *vbl_seq);
|
||||
extern void DRM(vbl_send_signals)( drm_device_t *dev );
|
||||
#endif
|
||||
/* AGP/GART support (drm_agpsupport.c) */
|
||||
int drm_device_is_agp(drm_device_t *dev);
|
||||
drm_agp_head_t *drm_agp_init(void);
|
||||
void drm_agp_uninit(void);
|
||||
void drm_agp_do_release(void);
|
||||
agp_memory *drm_agp_allocate_memory(size_t pages, u32 type);
|
||||
int drm_agp_free_memory(agp_memory *handle);
|
||||
int drm_agp_bind_memory(agp_memory *handle, off_t start);
|
||||
int drm_agp_unbind_memory(agp_memory *handle);
|
||||
|
||||
#if __REALLY_HAVE_AGP
|
||||
/* AGP/GART support (drm_agpsupport.h) */
|
||||
extern drm_agp_head_t *DRM(agp_init)(void);
|
||||
extern void DRM(agp_uninit)(void);
|
||||
extern void DRM(agp_do_release)(void);
|
||||
extern agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type);
|
||||
extern int DRM(agp_free_memory)(agp_memory *handle);
|
||||
extern int DRM(agp_bind_memory)(agp_memory *handle, off_t start);
|
||||
extern int DRM(agp_unbind_memory)(agp_memory *handle);
|
||||
#endif
|
||||
/* Scatter Gather Support (drm_scatter.c) */
|
||||
void drm_sg_cleanup(drm_sg_mem_t *entry);
|
||||
|
||||
#if __HAVE_SG
|
||||
/* Scatter Gather Support (drm_scatter.h) */
|
||||
extern void DRM(sg_cleanup)(drm_sg_mem_t *entry);
|
||||
#endif
|
||||
/* ATI PCIGART support (ati_pcigart.c) */
|
||||
int drm_ati_pcigart_init(drm_device_t *dev, unsigned long *addr,
|
||||
dma_addr_t *bus_addr);
|
||||
int drm_ati_pcigart_cleanup(drm_device_t *dev, unsigned long addr,
|
||||
dma_addr_t bus_addr);
|
||||
|
||||
#if __REALLY_HAVE_SG
|
||||
/* ATI PCIGART support (ati_pcigart.h) */
|
||||
extern int DRM(ati_pcigart_init)(drm_device_t *dev,
|
||||
unsigned long *addr,
|
||||
dma_addr_t *bus_addr);
|
||||
extern int DRM(ati_pcigart_cleanup)(drm_device_t *dev,
|
||||
unsigned long addr,
|
||||
dma_addr_t bus_addr);
|
||||
#endif
|
||||
/* Locking IOCTL support (drm_drv.c) */
|
||||
int drm_lock(DRM_IOCTL_ARGS);
|
||||
int drm_unlock(DRM_IOCTL_ARGS);
|
||||
int drm_version(DRM_IOCTL_ARGS);
|
||||
int drm_setversion(DRM_IOCTL_ARGS);
|
||||
|
||||
/* Locking IOCTL support (drm_drv.h) */
|
||||
extern int DRM(lock)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(unlock)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(version)( DRM_IOCTL_ARGS );
|
||||
extern int DRM(setversion)( DRM_IOCTL_ARGS );
|
||||
/* Misc. IOCTL support (drm_ioctl.c) */
|
||||
int drm_irq_by_busid(DRM_IOCTL_ARGS);
|
||||
int drm_getunique(DRM_IOCTL_ARGS);
|
||||
int drm_setunique(DRM_IOCTL_ARGS);
|
||||
int drm_getmap(DRM_IOCTL_ARGS);
|
||||
int drm_getclient(DRM_IOCTL_ARGS);
|
||||
int drm_getstats(DRM_IOCTL_ARGS);
|
||||
int drm_noop(DRM_IOCTL_ARGS);
|
||||
|
||||
/* Misc. IOCTL support (drm_ioctl.h) */
|
||||
extern int DRM(irq_by_busid)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(getunique)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(setunique)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(getmap)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(getclient)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(getstats)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(noop)(DRM_IOCTL_ARGS);
|
||||
/* Context IOCTL support (drm_context.c) */
|
||||
int drm_resctx(DRM_IOCTL_ARGS);
|
||||
int drm_addctx(DRM_IOCTL_ARGS);
|
||||
int drm_modctx(DRM_IOCTL_ARGS);
|
||||
int drm_getctx(DRM_IOCTL_ARGS);
|
||||
int drm_switchctx(DRM_IOCTL_ARGS);
|
||||
int drm_newctx(DRM_IOCTL_ARGS);
|
||||
int drm_rmctx(DRM_IOCTL_ARGS);
|
||||
int drm_setsareactx(DRM_IOCTL_ARGS);
|
||||
int drm_getsareactx(DRM_IOCTL_ARGS);
|
||||
|
||||
/* Context IOCTL support (drm_context.h) */
|
||||
extern int DRM(resctx)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(addctx)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(modctx)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(getctx)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(switchctx)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(newctx)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(rmctx)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(setsareactx)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(getsareactx)(DRM_IOCTL_ARGS);
|
||||
/* Drawable IOCTL support (drm_drawable.c) */
|
||||
int drm_adddraw(DRM_IOCTL_ARGS);
|
||||
int drm_rmdraw(DRM_IOCTL_ARGS);
|
||||
|
||||
/* Drawable IOCTL support (drm_drawable.h) */
|
||||
extern int DRM(adddraw)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(rmdraw)(DRM_IOCTL_ARGS);
|
||||
/* Authentication IOCTL support (drm_auth.c) */
|
||||
int drm_getmagic(DRM_IOCTL_ARGS);
|
||||
int drm_authmagic(DRM_IOCTL_ARGS);
|
||||
|
||||
/* Authentication IOCTL support (drm_auth.h) */
|
||||
extern int DRM(getmagic)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(authmagic)(DRM_IOCTL_ARGS);
|
||||
/* Buffer management support (drm_bufs.c) */
|
||||
int drm_addmap(DRM_IOCTL_ARGS);
|
||||
int drm_rmmap(DRM_IOCTL_ARGS);
|
||||
int drm_addbufs(DRM_IOCTL_ARGS);
|
||||
int drm_infobufs(DRM_IOCTL_ARGS);
|
||||
int drm_markbufs(DRM_IOCTL_ARGS);
|
||||
int drm_freebufs(DRM_IOCTL_ARGS);
|
||||
int drm_mapbufs(DRM_IOCTL_ARGS);
|
||||
|
||||
/* Buffer management support (drm_bufs.h) */
|
||||
extern int DRM(addmap)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(rmmap)(DRM_IOCTL_ARGS);
|
||||
#if __HAVE_DMA
|
||||
extern int DRM(addbufs)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(infobufs)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(markbufs)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(freebufs)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(mapbufs)(DRM_IOCTL_ARGS);
|
||||
#endif
|
||||
/* IRQ support (drm_irq.c) */
|
||||
int drm_control(DRM_IOCTL_ARGS);
|
||||
int drm_wait_vblank(DRM_IOCTL_ARGS);
|
||||
|
||||
/* IRQ support (drm_irq.h) */
|
||||
#if __HAVE_IRQ || __HAVE_DMA
|
||||
extern int DRM(control)(DRM_IOCTL_ARGS);
|
||||
#endif
|
||||
#if __HAVE_VBL_IRQ
|
||||
extern int DRM(wait_vblank)(DRM_IOCTL_ARGS);
|
||||
#endif
|
||||
/* AGP/GART support (drm_agpsupport.c) */
|
||||
int drm_agp_acquire(DRM_IOCTL_ARGS);
|
||||
int drm_agp_release(DRM_IOCTL_ARGS);
|
||||
int drm_agp_enable(DRM_IOCTL_ARGS);
|
||||
int drm_agp_info(DRM_IOCTL_ARGS);
|
||||
int drm_agp_alloc(DRM_IOCTL_ARGS);
|
||||
int drm_agp_free(DRM_IOCTL_ARGS);
|
||||
int drm_agp_unbind(DRM_IOCTL_ARGS);
|
||||
int drm_agp_bind(DRM_IOCTL_ARGS);
|
||||
|
||||
/* AGP/GART support (drm_agpsupport.h) */
|
||||
#if __REALLY_HAVE_AGP
|
||||
extern int DRM(agp_acquire)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(agp_release)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(agp_enable)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(agp_info)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(agp_alloc)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(agp_free)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(agp_unbind)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(agp_bind)(DRM_IOCTL_ARGS);
|
||||
#endif
|
||||
/* Scatter Gather Support (drm_scatter.c) */
|
||||
int drm_sg_alloc(DRM_IOCTL_ARGS);
|
||||
int drm_sg_free(DRM_IOCTL_ARGS);
|
||||
|
||||
/* Scatter Gather Support (drm_scatter.h) */
|
||||
#if __HAVE_SG
|
||||
extern int DRM(sg_alloc)(DRM_IOCTL_ARGS);
|
||||
extern int DRM(sg_free)(DRM_IOCTL_ARGS);
|
||||
#endif
|
||||
|
||||
/* consistent PCI memory functions (drm_pci.h) */
|
||||
extern void *DRM(pci_alloc)(drm_device_t *dev, size_t size,
|
||||
size_t align, dma_addr_t maxaddr,
|
||||
dma_addr_t *busaddr);
|
||||
extern void DRM(pci_free)(drm_device_t *dev, size_t size,
|
||||
void *vaddr, dma_addr_t busaddr);
|
||||
/* consistent PCI memory functions (drm_pci.c) */
|
||||
void *drm_pci_alloc(drm_device_t *dev, size_t size, size_t align,
|
||||
dma_addr_t maxaddr, dma_addr_t *busaddr);
|
||||
void drm_pci_free(drm_device_t *dev, size_t size, void *vaddr,
|
||||
dma_addr_t busaddr);
|
||||
|
||||
/* Inline replacements for DRM_IOREMAP macros */
|
||||
static __inline__ void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
|
||||
{
|
||||
map->handle = DRM(ioremap)( dev, map );
|
||||
map->handle = drm_ioremap(dev, map);
|
||||
}
|
||||
#if 0
|
||||
static __inline__ void drm_core_ioremap_nocache(struct drm_map *map, struct drm_device *dev)
|
||||
{
|
||||
map->handle = DRM(ioremap_nocache)(dev, map);
|
||||
map->handle = drm_ioremap_nocache(dev, map);
|
||||
}
|
||||
#endif
|
||||
static __inline__ void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
|
||||
{
|
||||
if ( map->handle && map->size )
|
||||
DRM(ioremapfree)( map );
|
||||
drm_ioremapfree(map);
|
||||
}
|
||||
|
||||
static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev, unsigned long offset)
|
||||
|
|
|
@ -32,7 +32,14 @@
|
|||
|
||||
#include "drmP.h"
|
||||
|
||||
int DRM(agp_info)(DRM_IOCTL_ARGS)
|
||||
int
|
||||
drm_device_is_agp(drm_device_t *dev)
|
||||
{
|
||||
/* XXX: FILL ME IN HERE */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int drm_agp_info(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
struct agp_info *kern;
|
||||
|
@ -57,7 +64,7 @@ int DRM(agp_info)(DRM_IOCTL_ARGS)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_acquire)(DRM_IOCTL_ARGS)
|
||||
int drm_agp_acquire(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
int retcode;
|
||||
|
@ -71,7 +78,7 @@ int DRM(agp_acquire)(DRM_IOCTL_ARGS)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_release)(DRM_IOCTL_ARGS)
|
||||
int drm_agp_release(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
|
||||
|
@ -83,7 +90,7 @@ int DRM(agp_release)(DRM_IOCTL_ARGS)
|
|||
|
||||
}
|
||||
|
||||
void DRM(agp_do_release)(void)
|
||||
void drm_agp_do_release(void)
|
||||
{
|
||||
device_t agpdev;
|
||||
|
||||
|
@ -92,7 +99,7 @@ void DRM(agp_do_release)(void)
|
|||
agp_release(agpdev);
|
||||
}
|
||||
|
||||
int DRM(agp_enable)(DRM_IOCTL_ARGS)
|
||||
int drm_agp_enable(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_agp_mode_t mode;
|
||||
|
@ -109,7 +116,7 @@ int DRM(agp_enable)(DRM_IOCTL_ARGS)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_alloc)(DRM_IOCTL_ARGS)
|
||||
int drm_agp_alloc(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_agp_buffer_t request;
|
||||
|
@ -124,7 +131,7 @@ int DRM(agp_alloc)(DRM_IOCTL_ARGS)
|
|||
|
||||
request = *(drm_agp_buffer_t *) data;
|
||||
|
||||
if (!(entry = DRM(alloc)(sizeof(*entry), DRM_MEM_AGPLISTS)))
|
||||
if (!(entry = drm_alloc(sizeof(*entry), DRM_MEM_AGPLISTS)))
|
||||
return ENOMEM;
|
||||
|
||||
bzero(entry, sizeof(*entry));
|
||||
|
@ -132,8 +139,8 @@ int DRM(agp_alloc)(DRM_IOCTL_ARGS)
|
|||
pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE;
|
||||
type = (u_int32_t) request.type;
|
||||
|
||||
if (!(handle = DRM(alloc_agp)(pages, type))) {
|
||||
DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
|
||||
if (!(handle = drm_alloc_agp(pages, type))) {
|
||||
drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -156,7 +163,7 @@ int DRM(agp_alloc)(DRM_IOCTL_ARGS)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static drm_agp_mem_t * DRM(agp_lookup_entry)(drm_device_t *dev, void *handle)
|
||||
static drm_agp_mem_t * drm_agp_lookup_entry(drm_device_t *dev, void *handle)
|
||||
{
|
||||
drm_agp_mem_t *entry;
|
||||
|
||||
|
@ -166,7 +173,7 @@ static drm_agp_mem_t * DRM(agp_lookup_entry)(drm_device_t *dev, void *handle)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int DRM(agp_unbind)(DRM_IOCTL_ARGS)
|
||||
int drm_agp_unbind(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_agp_binding_t request;
|
||||
|
@ -176,10 +183,10 @@ int DRM(agp_unbind)(DRM_IOCTL_ARGS)
|
|||
if (!dev->agp || !dev->agp->acquired)
|
||||
return EINVAL;
|
||||
request = *(drm_agp_binding_t *) data;
|
||||
if (!(entry = DRM(agp_lookup_entry)(dev, (void *) request.handle)))
|
||||
if (!(entry = drm_agp_lookup_entry(dev, (void *)request.handle)))
|
||||
return EINVAL;
|
||||
if (!entry->bound) return EINVAL;
|
||||
retcode=DRM(unbind_agp)(entry->handle);
|
||||
retcode = drm_unbind_agp(entry->handle);
|
||||
if (!retcode)
|
||||
{
|
||||
entry->bound=0;
|
||||
|
@ -189,7 +196,7 @@ int DRM(agp_unbind)(DRM_IOCTL_ARGS)
|
|||
return retcode;
|
||||
}
|
||||
|
||||
int DRM(agp_bind)(DRM_IOCTL_ARGS)
|
||||
int drm_agp_bind(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_agp_binding_t request;
|
||||
|
@ -201,17 +208,17 @@ int DRM(agp_bind)(DRM_IOCTL_ARGS)
|
|||
if (!dev->agp || !dev->agp->acquired)
|
||||
return EINVAL;
|
||||
request = *(drm_agp_binding_t *) data;
|
||||
if (!(entry = DRM(agp_lookup_entry)(dev, (void *) request.handle)))
|
||||
if (!(entry = drm_agp_lookup_entry(dev, (void *)request.handle)))
|
||||
return EINVAL;
|
||||
if (entry->bound) return EINVAL;
|
||||
page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE;
|
||||
if ((retcode = DRM(bind_agp)(entry->handle, page)))
|
||||
if ((retcode = drm_bind_agp(entry->handle, page)))
|
||||
return retcode;
|
||||
entry->bound = dev->agp->base + (page << PAGE_SHIFT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_free)(DRM_IOCTL_ARGS)
|
||||
int drm_agp_free(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_agp_buffer_t request;
|
||||
|
@ -220,10 +227,10 @@ int DRM(agp_free)(DRM_IOCTL_ARGS)
|
|||
if (!dev->agp || !dev->agp->acquired)
|
||||
return EINVAL;
|
||||
request = *(drm_agp_buffer_t *) data;
|
||||
if (!(entry = DRM(agp_lookup_entry)(dev, (void*) request.handle)))
|
||||
if (!(entry = drm_agp_lookup_entry(dev, (void*)request.handle)))
|
||||
return EINVAL;
|
||||
if (entry->bound)
|
||||
DRM(unbind_agp)(entry->handle);
|
||||
drm_unbind_agp(entry->handle);
|
||||
|
||||
if (entry->prev)
|
||||
entry->prev->next = entry->next;
|
||||
|
@ -231,12 +238,12 @@ int DRM(agp_free)(DRM_IOCTL_ARGS)
|
|||
dev->agp->memory = entry->next;
|
||||
if (entry->next)
|
||||
entry->next->prev = entry->prev;
|
||||
DRM(free_agp)(entry->handle, entry->pages);
|
||||
DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
|
||||
drm_free_agp(entry->handle, entry->pages);
|
||||
drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
drm_agp_head_t *DRM(agp_init)(void)
|
||||
drm_agp_head_t *drm_agp_init(void)
|
||||
{
|
||||
device_t agpdev;
|
||||
drm_agp_head_t *head = NULL;
|
||||
|
@ -249,7 +256,7 @@ drm_agp_head_t *DRM(agp_init)(void)
|
|||
DRM_DEBUG("agp_available = %d\n", agp_available);
|
||||
|
||||
if (agp_available) {
|
||||
if (!(head = DRM(alloc)(sizeof(*head), DRM_MEM_AGPLISTS)))
|
||||
if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
|
||||
return NULL;
|
||||
bzero((void *)head, sizeof(*head));
|
||||
head->agpdev = agpdev;
|
||||
|
@ -262,13 +269,13 @@ drm_agp_head_t *DRM(agp_init)(void)
|
|||
return head;
|
||||
}
|
||||
|
||||
void DRM(agp_uninit)(void)
|
||||
void drm_agp_uninit(void)
|
||||
{
|
||||
/* FIXME: What goes here */
|
||||
}
|
||||
|
||||
|
||||
agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type)
|
||||
agp_memory *drm_agp_allocate_memory(size_t pages, u32 type)
|
||||
{
|
||||
device_t agpdev;
|
||||
|
||||
|
@ -279,7 +286,7 @@ agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type)
|
|||
return agp_alloc_memory(agpdev, type, pages << AGP_PAGE_SHIFT);
|
||||
}
|
||||
|
||||
int DRM(agp_free_memory)(agp_memory *handle)
|
||||
int drm_agp_free_memory(agp_memory *handle)
|
||||
{
|
||||
device_t agpdev;
|
||||
|
||||
|
@ -291,7 +298,7 @@ int DRM(agp_free_memory)(agp_memory *handle)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int DRM(agp_bind_memory)(agp_memory *handle, off_t start)
|
||||
int drm_agp_bind_memory(agp_memory *handle, off_t start)
|
||||
{
|
||||
device_t agpdev;
|
||||
|
||||
|
@ -302,7 +309,7 @@ int DRM(agp_bind_memory)(agp_memory *handle, off_t start)
|
|||
return agp_bind_memory(agpdev, handle, start * PAGE_SIZE);
|
||||
}
|
||||
|
||||
int DRM(agp_unbind_memory)(agp_memory *handle)
|
||||
int drm_agp_unbind_memory(agp_memory *handle)
|
||||
{
|
||||
device_t agpdev;
|
||||
|
||||
|
|
|
@ -32,16 +32,18 @@
|
|||
|
||||
#include "drmP.h"
|
||||
|
||||
static int DRM(hash_magic)(drm_magic_t magic)
|
||||
static int drm_hash_magic(drm_magic_t magic)
|
||||
{
|
||||
return magic & (DRM_HASH_SIZE-1);
|
||||
}
|
||||
|
||||
static drm_file_t *DRM(find_file)(drm_device_t *dev, drm_magic_t magic)
|
||||
static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic)
|
||||
{
|
||||
drm_file_t *retval = NULL;
|
||||
drm_magic_entry_t *pt;
|
||||
int hash = DRM(hash_magic)(magic);
|
||||
int hash;
|
||||
|
||||
hash = drm_hash_magic(magic);
|
||||
|
||||
DRM_LOCK();
|
||||
for (pt = dev->magiclist[hash].head; pt; pt = pt->next) {
|
||||
|
@ -54,15 +56,15 @@ static drm_file_t *DRM(find_file)(drm_device_t *dev, drm_magic_t magic)
|
|||
return retval;
|
||||
}
|
||||
|
||||
static int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
|
||||
static int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
|
||||
{
|
||||
int hash;
|
||||
drm_magic_entry_t *entry;
|
||||
|
||||
DRM_DEBUG("%d\n", magic);
|
||||
|
||||
hash = DRM(hash_magic)(magic);
|
||||
entry = (drm_magic_entry_t*) DRM(alloc)(sizeof(*entry), DRM_MEM_MAGIC);
|
||||
hash = drm_hash_magic(magic);
|
||||
entry = (drm_magic_entry_t*) drm_alloc(sizeof(*entry), DRM_MEM_MAGIC);
|
||||
if (!entry) return DRM_ERR(ENOMEM);
|
||||
memset(entry, 0, sizeof(*entry));
|
||||
entry->magic = magic;
|
||||
|
@ -82,14 +84,14 @@ static int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic)
|
||||
static int drm_remove_magic(drm_device_t *dev, drm_magic_t magic)
|
||||
{
|
||||
drm_magic_entry_t *prev = NULL;
|
||||
drm_magic_entry_t *pt;
|
||||
int hash;
|
||||
|
||||
DRM_DEBUG("%d\n", magic);
|
||||
hash = DRM(hash_magic)(magic);
|
||||
hash = drm_hash_magic(magic);
|
||||
|
||||
DRM_LOCK();
|
||||
for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) {
|
||||
|
@ -109,11 +111,11 @@ static int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic)
|
|||
}
|
||||
DRM_UNLOCK();
|
||||
|
||||
DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC);
|
||||
drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC);
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
|
||||
int DRM(getmagic)(DRM_IOCTL_ARGS)
|
||||
int drm_getmagic(DRM_IOCTL_ARGS)
|
||||
{
|
||||
static drm_magic_t sequence = 0;
|
||||
drm_auth_t auth;
|
||||
|
@ -133,9 +135,9 @@ int DRM(getmagic)(DRM_IOCTL_ARGS)
|
|||
|
||||
if (!atomic_cmpset_int(&sequence, old, auth.magic))
|
||||
continue;
|
||||
} while (DRM(find_file)(dev, auth.magic));
|
||||
} while (drm_find_file(dev, auth.magic));
|
||||
priv->magic = auth.magic;
|
||||
DRM(add_magic)(dev, priv, auth.magic);
|
||||
drm_add_magic(dev, priv, auth.magic);
|
||||
}
|
||||
|
||||
DRM_DEBUG("%u\n", auth.magic);
|
||||
|
@ -145,7 +147,7 @@ int DRM(getmagic)(DRM_IOCTL_ARGS)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(authmagic)(DRM_IOCTL_ARGS)
|
||||
int drm_authmagic(DRM_IOCTL_ARGS)
|
||||
{
|
||||
drm_auth_t auth;
|
||||
drm_file_t *file;
|
||||
|
@ -155,9 +157,9 @@ int DRM(authmagic)(DRM_IOCTL_ARGS)
|
|||
|
||||
DRM_DEBUG("%u\n", auth.magic);
|
||||
|
||||
if ((file = DRM(find_file)(dev, auth.magic))) {
|
||||
if ((file = drm_find_file(dev, auth.magic))) {
|
||||
file->authenticated = 1;
|
||||
DRM(remove_magic)(dev, auth.magic);
|
||||
drm_remove_magic(dev, auth.magic);
|
||||
return 0;
|
||||
}
|
||||
return DRM_ERR(EINVAL);
|
||||
|
|
|
@ -32,18 +32,10 @@
|
|||
|
||||
#include "drmP.h"
|
||||
|
||||
#ifndef __HAVE_PCI_DMA
|
||||
#define __HAVE_PCI_DMA 0
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_SG
|
||||
#define __HAVE_SG 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compute order. Can be made faster.
|
||||
*/
|
||||
int DRM(order)( unsigned long size )
|
||||
int drm_order(unsigned long size)
|
||||
{
|
||||
int order;
|
||||
unsigned long tmp;
|
||||
|
@ -56,7 +48,7 @@ int DRM(order)( unsigned long size )
|
|||
return order;
|
||||
}
|
||||
|
||||
int DRM(addmap)( DRM_IOCTL_ARGS )
|
||||
int drm_addmap(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_map_t request;
|
||||
|
@ -68,7 +60,7 @@ int DRM(addmap)( DRM_IOCTL_ARGS )
|
|||
|
||||
DRM_COPY_FROM_USER_IOCTL( request, (drm_map_t *)data, sizeof(drm_map_t) );
|
||||
|
||||
map = (drm_local_map_t *) DRM(alloc)( sizeof(*map), DRM_MEM_MAPS );
|
||||
map = (drm_local_map_t *) drm_alloc(sizeof(*map), DRM_MEM_MAPS);
|
||||
if ( !map )
|
||||
return DRM_ERR(ENOMEM);
|
||||
|
||||
|
@ -84,17 +76,17 @@ int DRM(addmap)( DRM_IOCTL_ARGS )
|
|||
* when processes fork.
|
||||
*/
|
||||
if ( (map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM ) {
|
||||
DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
|
||||
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
DRM_DEBUG( "offset = 0x%08lx, size = 0x%08lx, type = %d\n",
|
||||
map->offset, map->size, map->type );
|
||||
if ( (map->offset & PAGE_MASK) || (map->size & PAGE_MASK) ) {
|
||||
DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
|
||||
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
if (map->offset + map->size < map->offset) {
|
||||
DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
|
||||
|
@ -105,17 +97,15 @@ int DRM(addmap)( DRM_IOCTL_ARGS )
|
|||
break;
|
||||
/* FALLTHROUGH */
|
||||
case _DRM_FRAME_BUFFER:
|
||||
#if __REALLY_HAVE_MTRR
|
||||
if (DRM(mtrr_add)(map->offset, map->size, DRM_MTRR_WC) == 0)
|
||||
if (drm_mtrr_add(map->offset, map->size, DRM_MTRR_WC) == 0)
|
||||
map->mtrr = 1;
|
||||
#endif
|
||||
break;
|
||||
case _DRM_SHM:
|
||||
map->handle = (void *)DRM(alloc)(map->size, DRM_MEM_SAREA);
|
||||
map->handle = (void *)drm_alloc(map->size, DRM_MEM_SAREA);
|
||||
DRM_DEBUG( "%lu %d %p\n",
|
||||
map->size, DRM(order)( map->size ), map->handle );
|
||||
map->size, drm_order(map->size), map->handle );
|
||||
if ( !map->handle ) {
|
||||
DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
|
||||
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
map->offset = (unsigned long)map->handle;
|
||||
|
@ -124,37 +114,34 @@ int DRM(addmap)( DRM_IOCTL_ARGS )
|
|||
DRM_LOCK();
|
||||
if (dev->lock.hw_lock != NULL) {
|
||||
DRM_UNLOCK();
|
||||
DRM(free)(map->handle, map->size,
|
||||
DRM_MEM_SAREA);
|
||||
DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
drm_free(map->handle, map->size, DRM_MEM_SAREA);
|
||||
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
return DRM_ERR(EBUSY);
|
||||
}
|
||||
dev->lock.hw_lock = map->handle; /* Pointer to lock */
|
||||
DRM_UNLOCK();
|
||||
}
|
||||
break;
|
||||
#if __REALLY_HAVE_AGP
|
||||
case _DRM_AGP:
|
||||
map->offset += dev->agp->base;
|
||||
map->mtrr = dev->agp->mtrr; /* for getmap */
|
||||
break;
|
||||
#endif
|
||||
case _DRM_SCATTER_GATHER:
|
||||
if (!dev->sg) {
|
||||
DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
map->offset = map->offset + dev->sg->handle;
|
||||
break;
|
||||
|
||||
default:
|
||||
DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
|
||||
drm_free( map, sizeof(*map), DRM_MEM_MAPS );
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
|
||||
list = DRM(calloc)(1, sizeof(*list), DRM_MEM_MAPS);
|
||||
list = drm_calloc(1, sizeof(*list), DRM_MEM_MAPS);
|
||||
if (list == NULL) {
|
||||
DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
list->map = map;
|
||||
|
@ -184,7 +171,7 @@ int DRM(addmap)( DRM_IOCTL_ARGS )
|
|||
* isn't in use.
|
||||
*/
|
||||
|
||||
int DRM(rmmap)( DRM_IOCTL_ARGS )
|
||||
int drm_rmmap(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_map_list_entry_t *list;
|
||||
|
@ -209,65 +196,59 @@ int DRM(rmmap)( DRM_IOCTL_ARGS )
|
|||
TAILQ_REMOVE(dev->maplist, list, link);
|
||||
DRM_UNLOCK();
|
||||
|
||||
DRM(free)(list, sizeof(*list), DRM_MEM_MAPS);
|
||||
drm_free(list, sizeof(*list), DRM_MEM_MAPS);
|
||||
|
||||
switch (map->type) {
|
||||
case _DRM_REGISTERS:
|
||||
case _DRM_FRAME_BUFFER:
|
||||
#if __REALLY_HAVE_MTRR
|
||||
if (map->mtrr) {
|
||||
int __unused retcode;
|
||||
|
||||
retcode = DRM(mtrr_del)(map->offset, map->size,
|
||||
retcode = drm_mtrr_del(map->offset, map->size,
|
||||
DRM_MTRR_WC);
|
||||
DRM_DEBUG("mtrr_del = %d\n", retcode);
|
||||
}
|
||||
#endif
|
||||
DRM(ioremapfree)(map);
|
||||
drm_ioremapfree(map);
|
||||
break;
|
||||
case _DRM_SHM:
|
||||
DRM(free)(map->handle, map->size, DRM_MEM_SAREA);
|
||||
drm_free(map->handle, map->size, DRM_MEM_SAREA);
|
||||
break;
|
||||
case _DRM_AGP:
|
||||
case _DRM_SCATTER_GATHER:
|
||||
break;
|
||||
}
|
||||
DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if __HAVE_DMA
|
||||
|
||||
|
||||
static void DRM(cleanup_buf_error)(drm_device_t *dev, drm_buf_entry_t *entry)
|
||||
static void drm_cleanup_buf_error(drm_device_t *dev, drm_buf_entry_t *entry)
|
||||
{
|
||||
int i;
|
||||
|
||||
#if __HAVE_PCI_DMA
|
||||
if (entry->seg_count) {
|
||||
for (i = 0; i < entry->seg_count; i++) {
|
||||
if (entry->seglist[i] != 0)
|
||||
DRM(pci_free)(dev, entry->buf_size,
|
||||
drm_pci_free(dev, entry->buf_size,
|
||||
(void *)entry->seglist[i],
|
||||
entry->seglist_bus[i]);
|
||||
}
|
||||
DRM(free)(entry->seglist,
|
||||
drm_free(entry->seglist,
|
||||
entry->seg_count *
|
||||
sizeof(*entry->seglist),
|
||||
DRM_MEM_SEGS);
|
||||
DRM(free)(entry->seglist_bus, entry->seg_count *
|
||||
drm_free(entry->seglist_bus, entry->seg_count *
|
||||
sizeof(*entry->seglist_bus), DRM_MEM_SEGS);
|
||||
|
||||
entry->seg_count = 0;
|
||||
}
|
||||
#endif /* __HAVE_PCI_DMA */
|
||||
|
||||
if (entry->buf_count) {
|
||||
for (i = 0; i < entry->buf_count; i++) {
|
||||
DRM(free)(entry->buflist[i].dev_private,
|
||||
drm_free(entry->buflist[i].dev_private,
|
||||
entry->buflist[i].dev_priv_size, DRM_MEM_BUFS);
|
||||
}
|
||||
DRM(free)(entry->buflist,
|
||||
drm_free(entry->buflist,
|
||||
entry->buf_count *
|
||||
sizeof(*entry->buflist),
|
||||
DRM_MEM_BUFS);
|
||||
|
@ -276,8 +257,7 @@ static void DRM(cleanup_buf_error)(drm_device_t *dev, drm_buf_entry_t *entry)
|
|||
}
|
||||
}
|
||||
|
||||
#if __REALLY_HAVE_AGP
|
||||
static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
|
||||
static int drm_addbufs_agp(drm_device_t *dev, drm_buf_desc_t *request)
|
||||
{
|
||||
drm_device_dma_t *dma = dev->dma;
|
||||
drm_buf_entry_t *entry;
|
||||
|
@ -295,7 +275,7 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
drm_buf_t **temp_buflist;
|
||||
|
||||
count = request->count;
|
||||
order = DRM(order)(request->size);
|
||||
order = drm_order(request->size);
|
||||
size = 1 << order;
|
||||
|
||||
alignment = (request->flags & _DRM_PAGE_ALIGN)
|
||||
|
@ -316,8 +296,8 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
|
||||
entry = &dma->bufs[order];
|
||||
|
||||
entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist),
|
||||
DRM_MEM_BUFS );
|
||||
entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
|
||||
DRM_MEM_BUFS);
|
||||
if ( !entry->buflist ) {
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
|
@ -343,12 +323,12 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
buf->filp = NULL;
|
||||
|
||||
buf->dev_priv_size = dev->dev_priv_size;
|
||||
buf->dev_private = DRM(calloc)(1, buf->dev_priv_size,
|
||||
buf->dev_private = drm_calloc(1, buf->dev_priv_size,
|
||||
DRM_MEM_BUFS);
|
||||
if (buf->dev_private == NULL) {
|
||||
/* Set count correctly so we free the proper amount. */
|
||||
entry->buf_count = count;
|
||||
DRM(cleanup_buf_error)(dev, entry);
|
||||
drm_cleanup_buf_error(dev, entry);
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
|
||||
|
@ -359,14 +339,14 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
|
||||
DRM_DEBUG( "byte_count: %d\n", byte_count );
|
||||
|
||||
temp_buflist = DRM(realloc)( dma->buflist,
|
||||
temp_buflist = drm_realloc(dma->buflist,
|
||||
dma->buf_count * sizeof(*dma->buflist),
|
||||
(dma->buf_count + entry->buf_count)
|
||||
* sizeof(*dma->buflist),
|
||||
DRM_MEM_BUFS );
|
||||
if (temp_buflist == NULL) {
|
||||
/* Free the entry because it isn't valid */
|
||||
DRM(cleanup_buf_error)(dev, entry);
|
||||
drm_cleanup_buf_error(dev, entry);
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
dma->buflist = temp_buflist;
|
||||
|
@ -388,10 +368,8 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif /* __REALLY_HAVE_AGP */
|
||||
|
||||
#if __HAVE_PCI_DMA
|
||||
static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
||||
static int drm_addbufs_pci(drm_device_t *dev, drm_buf_desc_t *request)
|
||||
{
|
||||
drm_device_dma_t *dma = dev->dma;
|
||||
int count;
|
||||
|
@ -412,7 +390,7 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
dma_addr_t bus_addr;
|
||||
|
||||
count = request->count;
|
||||
order = DRM(order)(request->size);
|
||||
order = drm_order(request->size);
|
||||
size = 1 << order;
|
||||
|
||||
DRM_DEBUG( "count=%d, size=%d (%d), order=%d\n",
|
||||
|
@ -425,26 +403,26 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
|
||||
entry = &dma->bufs[order];
|
||||
|
||||
entry->buflist = DRM(alloc)(count * sizeof(*entry->buflist),
|
||||
entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
|
||||
DRM_MEM_BUFS);
|
||||
entry->seglist = DRM(alloc)(count * sizeof(*entry->seglist),
|
||||
entry->seglist = drm_alloc(count * sizeof(*entry->seglist),
|
||||
DRM_MEM_SEGS);
|
||||
entry->seglist_bus = DRM(alloc)(count * sizeof(*entry->seglist_bus),
|
||||
entry->seglist_bus = drm_alloc(count * sizeof(*entry->seglist_bus),
|
||||
DRM_MEM_SEGS);
|
||||
|
||||
/* Keep the original pagelist until we know all the allocations
|
||||
* have succeeded
|
||||
*/
|
||||
temp_pagelist = DRM(alloc)((dma->page_count + (count << page_order)) *
|
||||
temp_pagelist = drm_alloc((dma->page_count + (count << page_order)) *
|
||||
sizeof(*dma->pagelist), DRM_MEM_PAGES);
|
||||
|
||||
if (entry->buflist == NULL || entry->seglist == NULL ||
|
||||
temp_pagelist == NULL) {
|
||||
DRM(free)(entry->buflist, count * sizeof(*entry->buflist),
|
||||
drm_free(entry->buflist, count * sizeof(*entry->buflist),
|
||||
DRM_MEM_BUFS);
|
||||
DRM(free)(entry->seglist, count * sizeof(*entry->seglist),
|
||||
drm_free(entry->seglist, count * sizeof(*entry->seglist),
|
||||
DRM_MEM_SEGS);
|
||||
DRM(free)(entry->seglist_bus, count *
|
||||
drm_free(entry->seglist_bus, count *
|
||||
sizeof(*entry->seglist_bus), DRM_MEM_SEGS);
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
|
@ -464,14 +442,14 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
page_count = 0;
|
||||
|
||||
while ( entry->buf_count < count ) {
|
||||
vaddr = (vm_offset_t) DRM(pci_alloc)(dev, size, alignment,
|
||||
vaddr = (vm_offset_t)drm_pci_alloc(dev, size, alignment,
|
||||
0xfffffffful, &bus_addr);
|
||||
if (vaddr == 0) {
|
||||
/* Set count correctly so we free the proper amount. */
|
||||
entry->buf_count = count;
|
||||
entry->seg_count = count;
|
||||
DRM(cleanup_buf_error)(dev, entry);
|
||||
DRM(free)(temp_pagelist, (dma->page_count +
|
||||
drm_cleanup_buf_error(dev, entry);
|
||||
drm_free(temp_pagelist, (dma->page_count +
|
||||
(count << page_order)) * sizeof(*dma->pagelist),
|
||||
DRM_MEM_PAGES);
|
||||
return DRM_ERR(ENOMEM);
|
||||
|
@ -502,14 +480,14 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
buf->filp = NULL;
|
||||
|
||||
buf->dev_priv_size = dev->dev_priv_size;
|
||||
buf->dev_private = DRM(alloc)(buf->dev_priv_size,
|
||||
buf->dev_private = drm_alloc(buf->dev_priv_size,
|
||||
DRM_MEM_BUFS);
|
||||
if (buf->dev_private == NULL) {
|
||||
/* Set count correctly so we free the proper amount. */
|
||||
entry->buf_count = count;
|
||||
entry->seg_count = count;
|
||||
DRM(cleanup_buf_error)(dev, entry);
|
||||
DRM(free)(temp_pagelist, (dma->page_count +
|
||||
drm_cleanup_buf_error(dev, entry);
|
||||
drm_free(temp_pagelist, (dma->page_count +
|
||||
(count << page_order)) *
|
||||
sizeof(*dma->pagelist), DRM_MEM_PAGES );
|
||||
return DRM_ERR(ENOMEM);
|
||||
|
@ -522,15 +500,15 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
byte_count += PAGE_SIZE << page_order;
|
||||
}
|
||||
|
||||
temp_buflist = DRM(realloc)( dma->buflist,
|
||||
dma->buf_count * sizeof(*dma->buflist),
|
||||
(dma->buf_count + entry->buf_count)
|
||||
* sizeof(*dma->buflist),
|
||||
DRM_MEM_BUFS );
|
||||
temp_buflist = drm_realloc(dma->buflist,
|
||||
dma->buf_count * sizeof(*dma->buflist),
|
||||
(dma->buf_count + entry->buf_count)
|
||||
* sizeof(*dma->buflist),
|
||||
DRM_MEM_BUFS);
|
||||
if (temp_buflist == NULL) {
|
||||
/* Free the entry because it isn't valid */
|
||||
DRM(cleanup_buf_error)(dev, entry);
|
||||
DRM(free)(temp_pagelist, (dma->page_count +
|
||||
drm_cleanup_buf_error(dev, entry);
|
||||
drm_free(temp_pagelist, (dma->page_count +
|
||||
(count << page_order)) * sizeof(*dma->pagelist),
|
||||
DRM_MEM_PAGES);
|
||||
return DRM_ERR(ENOMEM);
|
||||
|
@ -544,7 +522,7 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
/* No allocations failed, so now we can replace the orginal pagelist
|
||||
* with the new one.
|
||||
*/
|
||||
DRM(free)(dma->pagelist, dma->page_count * sizeof(*dma->pagelist),
|
||||
drm_free(dma->pagelist, dma->page_count * sizeof(*dma->pagelist),
|
||||
DRM_MEM_PAGES);
|
||||
dma->pagelist = temp_pagelist;
|
||||
|
||||
|
@ -559,10 +537,8 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
return 0;
|
||||
|
||||
}
|
||||
#endif /* __HAVE_PCI_DMA */
|
||||
|
||||
#if __REALLY_HAVE_SG
|
||||
static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
|
||||
static int drm_addbufs_sg(drm_device_t *dev, drm_buf_desc_t *request)
|
||||
{
|
||||
drm_device_dma_t *dma = dev->dma;
|
||||
drm_buf_entry_t *entry;
|
||||
|
@ -580,7 +556,7 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
drm_buf_t **temp_buflist;
|
||||
|
||||
count = request->count;
|
||||
order = DRM(order)(request->size);
|
||||
order = drm_order(request->size);
|
||||
size = 1 << order;
|
||||
|
||||
alignment = (request->flags & _DRM_PAGE_ALIGN)
|
||||
|
@ -601,7 +577,7 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
|
||||
entry = &dma->bufs[order];
|
||||
|
||||
entry->buflist = DRM(calloc)(1, count * sizeof(*entry->buflist),
|
||||
entry->buflist = drm_calloc(1, count * sizeof(*entry->buflist),
|
||||
DRM_MEM_BUFS);
|
||||
if (entry->buflist == NULL)
|
||||
return DRM_ERR(ENOMEM);
|
||||
|
@ -626,12 +602,12 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
buf->filp = NULL;
|
||||
|
||||
buf->dev_priv_size = dev->dev_priv_size;
|
||||
buf->dev_private = DRM(calloc)(1, buf->dev_priv_size,
|
||||
buf->dev_private = drm_calloc(1, buf->dev_priv_size,
|
||||
DRM_MEM_BUFS);
|
||||
if (buf->dev_private == NULL) {
|
||||
/* Set count correctly so we free the proper amount. */
|
||||
entry->buf_count = count;
|
||||
DRM(cleanup_buf_error)(dev, entry);
|
||||
drm_cleanup_buf_error(dev, entry);
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
|
||||
|
@ -645,14 +621,14 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
|
||||
DRM_DEBUG( "byte_count: %d\n", byte_count );
|
||||
|
||||
temp_buflist = DRM(realloc)( dma->buflist,
|
||||
temp_buflist = drm_realloc(dma->buflist,
|
||||
dma->buf_count * sizeof(*dma->buflist),
|
||||
(dma->buf_count + entry->buf_count)
|
||||
* sizeof(*dma->buflist),
|
||||
DRM_MEM_BUFS );
|
||||
if (temp_buflist == NULL) {
|
||||
/* Free the entry because it isn't valid */
|
||||
DRM(cleanup_buf_error)(dev, entry);
|
||||
drm_cleanup_buf_error(dev, entry);
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
dma->buflist = temp_buflist;
|
||||
|
@ -674,9 +650,8 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif /* __REALLY_HAVE_SG */
|
||||
|
||||
int DRM(addbufs)( DRM_IOCTL_ARGS )
|
||||
int drm_addbufs(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_buf_desc_t request;
|
||||
|
@ -688,7 +663,7 @@ int DRM(addbufs)( DRM_IOCTL_ARGS )
|
|||
if (request.count < 0 || request.count > 4096)
|
||||
return DRM_ERR(EINVAL);
|
||||
|
||||
order = DRM(order)(request.size);
|
||||
order = drm_order(request.size);
|
||||
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
|
||||
return DRM_ERR(EINVAL);
|
||||
|
||||
|
@ -704,21 +679,13 @@ int DRM(addbufs)( DRM_IOCTL_ARGS )
|
|||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
|
||||
#if __REALLY_HAVE_AGP
|
||||
if ( request.flags & _DRM_AGP_BUFFER )
|
||||
err = DRM(addbufs_agp)(dev, &request);
|
||||
err = drm_addbufs_agp(dev, &request);
|
||||
else
|
||||
#endif
|
||||
#if __REALLY_HAVE_SG
|
||||
if ( request.flags & _DRM_SG_BUFFER )
|
||||
err = DRM(addbufs_sg)(dev, &request);
|
||||
err = drm_addbufs_sg(dev, &request);
|
||||
else
|
||||
#endif
|
||||
#if __HAVE_PCI_DMA
|
||||
err = DRM(addbufs_pci)(dev, &request);
|
||||
#else
|
||||
err = DRM_ERR(EINVAL);
|
||||
#endif
|
||||
err = drm_addbufs_pci(dev, &request);
|
||||
DRM_SPINUNLOCK(&dev->dma_lock);
|
||||
|
||||
DRM_COPY_TO_USER_IOCTL((drm_buf_desc_t *)data, request, sizeof(request));
|
||||
|
@ -726,7 +693,7 @@ int DRM(addbufs)( DRM_IOCTL_ARGS )
|
|||
return err;
|
||||
}
|
||||
|
||||
int DRM(infobufs)( DRM_IOCTL_ARGS )
|
||||
int drm_infobufs(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_device_dma_t *dma = dev->dma;
|
||||
|
@ -780,7 +747,7 @@ int DRM(infobufs)( DRM_IOCTL_ARGS )
|
|||
return retcode;
|
||||
}
|
||||
|
||||
int DRM(markbufs)( DRM_IOCTL_ARGS )
|
||||
int drm_markbufs(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_device_dma_t *dma = dev->dma;
|
||||
|
@ -793,7 +760,7 @@ int DRM(markbufs)( DRM_IOCTL_ARGS )
|
|||
request.size, request.low_mark, request.high_mark );
|
||||
|
||||
|
||||
order = DRM(order)(request.size);
|
||||
order = drm_order(request.size);
|
||||
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ||
|
||||
request.low_mark < 0 || request.high_mark < 0) {
|
||||
return DRM_ERR(EINVAL);
|
||||
|
@ -812,7 +779,7 @@ int DRM(markbufs)( DRM_IOCTL_ARGS )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(freebufs)( DRM_IOCTL_ARGS )
|
||||
int drm_freebufs(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_device_dma_t *dma = dev->dma;
|
||||
|
@ -845,14 +812,14 @@ int DRM(freebufs)( DRM_IOCTL_ARGS )
|
|||
retcode = DRM_ERR(EINVAL);
|
||||
break;
|
||||
}
|
||||
DRM(free_buffer)( dev, buf );
|
||||
drm_free_buffer(dev, buf);
|
||||
}
|
||||
DRM_SPINUNLOCK(&dev->dma_lock);
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
||||
int DRM(mapbufs)( DRM_IOCTL_ARGS )
|
||||
int drm_mapbufs(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_device_dma_t *dma = dev->dma;
|
||||
|
@ -894,8 +861,8 @@ int DRM(mapbufs)( DRM_IOCTL_ARGS )
|
|||
if (request.count < dma->buf_count)
|
||||
goto done;
|
||||
|
||||
if ((__HAVE_AGP && (dma->flags & _DRM_DMA_USE_AGP)) ||
|
||||
(__HAVE_SG && (dma->flags & _DRM_DMA_USE_SG))) {
|
||||
if ((dev->use_agp && (dma->flags & _DRM_DMA_USE_AGP)) ||
|
||||
(dev->use_sg && (dma->flags & _DRM_DMA_USE_SG))) {
|
||||
drm_local_map_t *map = dev->agp_buffer_map;
|
||||
|
||||
if (map == NULL) {
|
||||
|
@ -957,5 +924,3 @@ int DRM(mapbufs)( DRM_IOCTL_ARGS )
|
|||
|
||||
return DRM_ERR(retcode);
|
||||
}
|
||||
|
||||
#endif /* __HAVE_DMA */
|
||||
|
|
|
@ -32,15 +32,11 @@
|
|||
|
||||
#include "drmP.h"
|
||||
|
||||
#if !__HAVE_CTX_BITMAP
|
||||
#error "__HAVE_CTX_BITMAP must be defined"
|
||||
#endif
|
||||
|
||||
/* ================================================================
|
||||
* Context bitmap support
|
||||
*/
|
||||
|
||||
void DRM(ctxbitmap_free)( drm_device_t *dev, int ctx_handle )
|
||||
void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle)
|
||||
{
|
||||
if (ctx_handle < 0 || ctx_handle >= DRM_MAX_CTXBITMAP ||
|
||||
dev->ctx_bitmap == NULL) {
|
||||
|
@ -56,7 +52,7 @@ void DRM(ctxbitmap_free)( drm_device_t *dev, int ctx_handle )
|
|||
return;
|
||||
}
|
||||
|
||||
int DRM(ctxbitmap_next)( drm_device_t *dev )
|
||||
int drm_ctxbitmap_next(drm_device_t *dev)
|
||||
{
|
||||
int bit;
|
||||
|
||||
|
@ -77,7 +73,7 @@ int DRM(ctxbitmap_next)( drm_device_t *dev )
|
|||
if (dev->context_sareas != NULL) {
|
||||
drm_local_map_t **ctx_sareas;
|
||||
|
||||
ctx_sareas = DRM(realloc)(dev->context_sareas,
|
||||
ctx_sareas = drm_realloc(dev->context_sareas,
|
||||
(dev->max_context - 1) *
|
||||
sizeof(*dev->context_sareas),
|
||||
dev->max_context *
|
||||
|
@ -92,7 +88,7 @@ int DRM(ctxbitmap_next)( drm_device_t *dev )
|
|||
dev->context_sareas[bit] = NULL;
|
||||
} else {
|
||||
/* max_context == 1 at this point */
|
||||
dev->context_sareas = DRM(alloc)(dev->max_context *
|
||||
dev->context_sareas = drm_alloc(dev->max_context *
|
||||
sizeof(*dev->context_sareas), DRM_MEM_MAPS);
|
||||
if (dev->context_sareas == NULL) {
|
||||
clear_bit(bit, dev->ctx_bitmap);
|
||||
|
@ -106,13 +102,13 @@ int DRM(ctxbitmap_next)( drm_device_t *dev )
|
|||
return bit;
|
||||
}
|
||||
|
||||
int DRM(ctxbitmap_init)( drm_device_t *dev )
|
||||
int drm_ctxbitmap_init(drm_device_t *dev)
|
||||
{
|
||||
int i;
|
||||
int temp;
|
||||
|
||||
DRM_LOCK();
|
||||
dev->ctx_bitmap = (atomic_t *)DRM(calloc)(1, PAGE_SIZE,
|
||||
dev->ctx_bitmap = (atomic_t *)drm_calloc(1, PAGE_SIZE,
|
||||
DRM_MEM_CTXBITMAP);
|
||||
if ( dev->ctx_bitmap == NULL ) {
|
||||
DRM_UNLOCK();
|
||||
|
@ -123,20 +119,20 @@ int DRM(ctxbitmap_init)( drm_device_t *dev )
|
|||
DRM_UNLOCK();
|
||||
|
||||
for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) {
|
||||
temp = DRM(ctxbitmap_next)( dev );
|
||||
temp = drm_ctxbitmap_next(dev);
|
||||
DRM_DEBUG( "drm_ctxbitmap_init : %d\n", temp );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DRM(ctxbitmap_cleanup)( drm_device_t *dev )
|
||||
void drm_ctxbitmap_cleanup(drm_device_t *dev)
|
||||
{
|
||||
DRM_LOCK();
|
||||
if (dev->context_sareas != NULL)
|
||||
DRM(free)(dev->context_sareas, sizeof(*dev->context_sareas) *
|
||||
drm_free(dev->context_sareas, sizeof(*dev->context_sareas) *
|
||||
dev->max_context, DRM_MEM_MAPS);
|
||||
DRM(free)( (void *)dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP );
|
||||
drm_free((void *)dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP);
|
||||
DRM_UNLOCK();
|
||||
}
|
||||
|
||||
|
@ -144,7 +140,7 @@ void DRM(ctxbitmap_cleanup)( drm_device_t *dev )
|
|||
* Per Context SAREA Support
|
||||
*/
|
||||
|
||||
int DRM(getsareactx)( DRM_IOCTL_ARGS )
|
||||
int drm_getsareactx( DRM_IOCTL_ARGS )
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_ctx_priv_map_t request;
|
||||
|
@ -169,7 +165,7 @@ int DRM(getsareactx)( DRM_IOCTL_ARGS )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(setsareactx)( DRM_IOCTL_ARGS )
|
||||
int drm_setsareactx( DRM_IOCTL_ARGS )
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_ctx_priv_map_t request;
|
||||
|
@ -202,7 +198,7 @@ bad:
|
|||
* The actual DRM context handling routines
|
||||
*/
|
||||
|
||||
int DRM(context_switch)( drm_device_t *dev, int old, int new )
|
||||
int drm_context_switch(drm_device_t *dev, int old, int new)
|
||||
{
|
||||
if ( test_and_set_bit( 0, &dev->context_flag ) ) {
|
||||
DRM_ERROR( "Reentering -- FIXME\n" );
|
||||
|
@ -219,7 +215,7 @@ int DRM(context_switch)( drm_device_t *dev, int old, int new )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(context_switch_complete)( drm_device_t *dev, int new )
|
||||
int drm_context_switch_complete(drm_device_t *dev, int new)
|
||||
{
|
||||
dev->last_context = new; /* PRE/POST: This is the _only_ writer. */
|
||||
|
||||
|
@ -235,7 +231,7 @@ int DRM(context_switch_complete)( drm_device_t *dev, int new )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(resctx)( DRM_IOCTL_ARGS )
|
||||
int drm_resctx(DRM_IOCTL_ARGS)
|
||||
{
|
||||
drm_ctx_res_t res;
|
||||
drm_ctx_t ctx;
|
||||
|
@ -259,17 +255,17 @@ int DRM(resctx)( DRM_IOCTL_ARGS )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(addctx)( DRM_IOCTL_ARGS )
|
||||
int drm_addctx(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_ctx_t ctx;
|
||||
|
||||
DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) );
|
||||
|
||||
ctx.handle = DRM(ctxbitmap_next)( dev );
|
||||
ctx.handle = drm_ctxbitmap_next(dev);
|
||||
if ( ctx.handle == DRM_KERNEL_CONTEXT ) {
|
||||
/* Skip kernel's context and get a new one. */
|
||||
ctx.handle = DRM(ctxbitmap_next)( dev );
|
||||
ctx.handle = drm_ctxbitmap_next(dev);
|
||||
}
|
||||
DRM_DEBUG( "%d\n", ctx.handle );
|
||||
if ( ctx.handle == -1 ) {
|
||||
|
@ -278,21 +274,21 @@ int DRM(addctx)( DRM_IOCTL_ARGS )
|
|||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
|
||||
if ( dev->fn_tbl.context_ctor && ctx.handle != DRM_KERNEL_CONTEXT )
|
||||
dev->fn_tbl.context_ctor(dev, ctx.handle);
|
||||
if (dev->context_ctor && ctx.handle != DRM_KERNEL_CONTEXT)
|
||||
dev->context_ctor(dev, ctx.handle);
|
||||
|
||||
DRM_COPY_TO_USER_IOCTL( (drm_ctx_t *)data, ctx, sizeof(ctx) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(modctx)( DRM_IOCTL_ARGS )
|
||||
int drm_modctx(DRM_IOCTL_ARGS)
|
||||
{
|
||||
/* This does nothing */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(getctx)( DRM_IOCTL_ARGS )
|
||||
int drm_getctx(DRM_IOCTL_ARGS)
|
||||
{
|
||||
drm_ctx_t ctx;
|
||||
|
||||
|
@ -306,7 +302,7 @@ int DRM(getctx)( DRM_IOCTL_ARGS )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(switchctx)( DRM_IOCTL_ARGS )
|
||||
int drm_switchctx(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_ctx_t ctx;
|
||||
|
@ -314,10 +310,10 @@ int DRM(switchctx)( DRM_IOCTL_ARGS )
|
|||
DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) );
|
||||
|
||||
DRM_DEBUG( "%d\n", ctx.handle );
|
||||
return DRM(context_switch)( dev, dev->last_context, ctx.handle );
|
||||
return drm_context_switch(dev, dev->last_context, ctx.handle);
|
||||
}
|
||||
|
||||
int DRM(newctx)( DRM_IOCTL_ARGS )
|
||||
int drm_newctx(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_ctx_t ctx;
|
||||
|
@ -325,12 +321,12 @@ int DRM(newctx)( DRM_IOCTL_ARGS )
|
|||
DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) );
|
||||
|
||||
DRM_DEBUG( "%d\n", ctx.handle );
|
||||
DRM(context_switch_complete)( dev, ctx.handle );
|
||||
drm_context_switch_complete(dev, ctx.handle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(rmctx)( DRM_IOCTL_ARGS )
|
||||
int drm_rmctx(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_ctx_t ctx;
|
||||
|
@ -339,10 +335,10 @@ int DRM(rmctx)( DRM_IOCTL_ARGS )
|
|||
|
||||
DRM_DEBUG( "%d\n", ctx.handle );
|
||||
if ( ctx.handle != DRM_KERNEL_CONTEXT ) {
|
||||
if (dev->fn_tbl.context_dtor)
|
||||
dev->fn_tbl.context_dtor(dev, ctx.handle);
|
||||
if (dev->context_dtor)
|
||||
dev->context_dtor(dev, ctx.handle);
|
||||
|
||||
DRM(ctxbitmap_free)( dev, ctx.handle );
|
||||
drm_ctxbitmap_free(dev, ctx.handle);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -32,22 +32,10 @@
|
|||
|
||||
#include "drmP.h"
|
||||
|
||||
#ifndef __HAVE_DMA_WAITQUEUE
|
||||
#define __HAVE_DMA_WAITQUEUE 0
|
||||
#endif
|
||||
#ifndef __HAVE_DMA_RECLAIM
|
||||
#define __HAVE_DMA_RECLAIM 0
|
||||
#endif
|
||||
#ifndef __HAVE_SHARED_IRQ
|
||||
#define __HAVE_SHARED_IRQ 0
|
||||
#endif
|
||||
|
||||
#if __HAVE_DMA
|
||||
|
||||
int DRM(dma_setup)( drm_device_t *dev )
|
||||
int drm_dma_setup(drm_device_t *dev)
|
||||
{
|
||||
|
||||
dev->dma = DRM(calloc)(1, sizeof(*dev->dma), DRM_MEM_DRIVER);
|
||||
dev->dma = drm_calloc(1, sizeof(*dev->dma), DRM_MEM_DRIVER);
|
||||
if (dev->dma == NULL)
|
||||
return DRM_ERR(ENOMEM);
|
||||
|
||||
|
@ -56,7 +44,7 @@ int DRM(dma_setup)( drm_device_t *dev )
|
|||
return 0;
|
||||
}
|
||||
|
||||
void DRM(dma_takedown)(drm_device_t *dev)
|
||||
void drm_dma_takedown(drm_device_t *dev)
|
||||
{
|
||||
drm_device_dma_t *dma = dev->dma;
|
||||
int i, j;
|
||||
|
@ -66,7 +54,6 @@ void DRM(dma_takedown)(drm_device_t *dev)
|
|||
|
||||
/* Clear dma buffers */
|
||||
for (i = 0; i <= DRM_MAX_ORDER; i++) {
|
||||
#if __HAVE_PCI_DMA
|
||||
if (dma->bufs[i].seg_count) {
|
||||
DRM_DEBUG("order %d: buf_count = %d,"
|
||||
" seg_count = %d\n",
|
||||
|
@ -75,45 +62,44 @@ void DRM(dma_takedown)(drm_device_t *dev)
|
|||
dma->bufs[i].seg_count);
|
||||
for (j = 0; j < dma->bufs[i].seg_count; j++) {
|
||||
if (dma->bufs[i].seglist[j] != 0)
|
||||
DRM(pci_free)(dev, dma->bufs[i].buf_size,
|
||||
drm_pci_free(dev, dma->bufs[i].buf_size,
|
||||
(void *)dma->bufs[i].seglist[j],
|
||||
dma->bufs[i].seglist_bus[j]);
|
||||
}
|
||||
DRM(free)(dma->bufs[i].seglist,
|
||||
drm_free(dma->bufs[i].seglist,
|
||||
dma->bufs[i].seg_count
|
||||
* sizeof(*dma->bufs[0].seglist),
|
||||
DRM_MEM_SEGS);
|
||||
DRM(free)(dma->bufs[i].seglist_bus,
|
||||
drm_free(dma->bufs[i].seglist_bus,
|
||||
dma->bufs[i].seg_count
|
||||
* sizeof(*dma->bufs[0].seglist_bus),
|
||||
DRM_MEM_SEGS);
|
||||
}
|
||||
#endif /* __HAVE_PCI_DMA */
|
||||
|
||||
if (dma->bufs[i].buf_count) {
|
||||
for (j = 0; j < dma->bufs[i].buf_count; j++) {
|
||||
DRM(free)(dma->bufs[i].buflist[j].dev_private,
|
||||
drm_free(dma->bufs[i].buflist[j].dev_private,
|
||||
dma->bufs[i].buflist[j].dev_priv_size,
|
||||
DRM_MEM_BUFS);
|
||||
}
|
||||
DRM(free)(dma->bufs[i].buflist,
|
||||
drm_free(dma->bufs[i].buflist,
|
||||
dma->bufs[i].buf_count *
|
||||
sizeof(*dma->bufs[0].buflist),
|
||||
DRM_MEM_BUFS);
|
||||
}
|
||||
}
|
||||
|
||||
DRM(free)(dma->buflist, dma->buf_count * sizeof(*dma->buflist),
|
||||
drm_free(dma->buflist, dma->buf_count * sizeof(*dma->buflist),
|
||||
DRM_MEM_BUFS);
|
||||
DRM(free)(dma->pagelist, dma->page_count * sizeof(*dma->pagelist),
|
||||
drm_free(dma->pagelist, dma->page_count * sizeof(*dma->pagelist),
|
||||
DRM_MEM_PAGES);
|
||||
DRM(free)(dev->dma, sizeof(*dev->dma), DRM_MEM_DRIVER);
|
||||
drm_free(dev->dma, sizeof(*dev->dma), DRM_MEM_DRIVER);
|
||||
dev->dma = NULL;
|
||||
DRM_SPINUNINIT(dev->dma_lock);
|
||||
}
|
||||
|
||||
|
||||
void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf)
|
||||
void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf)
|
||||
{
|
||||
if (!buf) return;
|
||||
|
||||
|
@ -122,8 +108,7 @@ void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf)
|
|||
buf->used = 0;
|
||||
}
|
||||
|
||||
#if !__HAVE_DMA_RECLAIM
|
||||
void DRM(reclaim_buffers)(drm_device_t *dev, DRMFILE filp)
|
||||
void drm_reclaim_buffers(drm_device_t *dev, DRMFILE filp)
|
||||
{
|
||||
drm_device_dma_t *dma = dev->dma;
|
||||
int i;
|
||||
|
@ -133,7 +118,7 @@ void DRM(reclaim_buffers)(drm_device_t *dev, DRMFILE filp)
|
|||
if (dma->buflist[i]->filp == filp) {
|
||||
switch (dma->buflist[i]->list) {
|
||||
case DRM_LIST_NONE:
|
||||
DRM(free_buffer)(dev, dma->buflist[i]);
|
||||
drm_free_buffer(dev, dma->buflist[i]);
|
||||
break;
|
||||
case DRM_LIST_WAIT:
|
||||
dma->buflist[i]->list = DRM_LIST_RECLAIM;
|
||||
|
@ -145,27 +130,3 @@ void DRM(reclaim_buffers)(drm_device_t *dev, DRMFILE filp)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !__HAVE_IRQ
|
||||
/* This stub DRM_IOCTL_CONTROL handler is for the drivers that used to require
|
||||
* IRQs for DMA but no longer do. It maintains compatibility with the X Servers
|
||||
* that try to use the control ioctl by simply returning success.
|
||||
*/
|
||||
int DRM(control)( DRM_IOCTL_ARGS )
|
||||
{
|
||||
drm_control_t ctl;
|
||||
|
||||
DRM_COPY_FROM_USER_IOCTL( ctl, (drm_control_t *) data, sizeof(ctl) );
|
||||
|
||||
switch ( ctl.func ) {
|
||||
case DRM_INST_HANDLER:
|
||||
case DRM_UNINST_HANDLER:
|
||||
return 0;
|
||||
default:
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __HAVE_DMA */
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "drmP.h"
|
||||
|
||||
int DRM(adddraw)( DRM_IOCTL_ARGS )
|
||||
int drm_adddraw(DRM_IOCTL_ARGS)
|
||||
{
|
||||
drm_draw_t draw;
|
||||
|
||||
|
@ -44,7 +44,7 @@ int DRM(adddraw)( DRM_IOCTL_ARGS )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(rmdraw)( DRM_IOCTL_ARGS )
|
||||
int drm_rmdraw(DRM_IOCTL_ARGS)
|
||||
{
|
||||
return 0; /* NOOP */
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include "drmP.h"
|
||||
|
||||
drm_file_t *DRM(find_file_by_proc)(drm_device_t *dev, DRM_STRUCTPROC *p)
|
||||
drm_file_t *drm_find_file_by_proc(drm_device_t *dev, DRM_STRUCTPROC *p)
|
||||
{
|
||||
#if __FreeBSD_version >= 500021
|
||||
uid_t uid = p->td_ucred->cr_svuid;
|
||||
|
@ -52,8 +52,8 @@ drm_file_t *DRM(find_file_by_proc)(drm_device_t *dev, DRM_STRUCTPROC *p)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* DRM(open_helper) is called whenever a process opens /dev/drm. */
|
||||
int DRM(open_helper)(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
|
||||
/* drm_open_helper is called whenever a process opens /dev/drm. */
|
||||
int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
|
||||
drm_device_t *dev)
|
||||
{
|
||||
int m = minor(kdev);
|
||||
|
@ -66,11 +66,11 @@ int DRM(open_helper)(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
|
|||
DRM_DEBUG("pid = %d, minor = %d\n", DRM_CURRENTPID, m);
|
||||
|
||||
DRM_LOCK();
|
||||
priv = DRM(find_file_by_proc)(dev, p);
|
||||
priv = drm_find_file_by_proc(dev, p);
|
||||
if (priv) {
|
||||
priv->refs++;
|
||||
} else {
|
||||
priv = (drm_file_t *) DRM(alloc)(sizeof(*priv), DRM_MEM_FILES);
|
||||
priv = (drm_file_t *)drm_alloc(sizeof(*priv), DRM_MEM_FILES);
|
||||
if (priv == NULL) {
|
||||
DRM_UNLOCK();
|
||||
return DRM_ERR(ENOMEM);
|
||||
|
@ -86,12 +86,11 @@ int DRM(open_helper)(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
|
|||
|
||||
priv->refs = 1;
|
||||
priv->minor = m;
|
||||
priv->devXX = dev;
|
||||
priv->ioctl_count = 0;
|
||||
priv->authenticated = !DRM_SUSER(p);
|
||||
|
||||
if (dev->fn_tbl.open_helper)
|
||||
dev->fn_tbl.open_helper(dev, priv);
|
||||
if (dev->open_helper)
|
||||
dev->open_helper(dev, priv);
|
||||
|
||||
TAILQ_INSERT_TAIL(&dev->files, priv, link);
|
||||
}
|
||||
|
@ -103,15 +102,15 @@ int DRM(open_helper)(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
|
|||
}
|
||||
|
||||
|
||||
/* The DRM(read) and DRM(poll) are stubs to prevent spurious errors
|
||||
/* The drm_read and drm_poll are stubs to prevent spurious errors
|
||||
* on older X Servers (4.3.0 and earlier) */
|
||||
|
||||
int DRM(read)(struct cdev *kdev, struct uio *uio, int ioflag)
|
||||
int drm_read(struct cdev *kdev, struct uio *uio, int ioflag)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(poll)(struct cdev *kdev, int events, DRM_STRUCTPROC *p)
|
||||
int drm_poll(struct cdev *kdev, int events, DRM_STRUCTPROC *p)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
* before setunique has been called. The format for the bus-specific part of
|
||||
* the unique is not defined for any other bus.
|
||||
*/
|
||||
int DRM(getunique)( DRM_IOCTL_ARGS )
|
||||
int drm_getunique(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_unique_t u;
|
||||
|
@ -59,7 +59,7 @@ int DRM(getunique)( DRM_IOCTL_ARGS )
|
|||
/* Deprecated in DRM version 1.1, and will return EBUSY when setversion has
|
||||
* requested version 1.1 or greater.
|
||||
*/
|
||||
int DRM(setunique)( DRM_IOCTL_ARGS )
|
||||
int drm_setunique(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_unique_t u;
|
||||
|
@ -74,7 +74,7 @@ int DRM(setunique)( DRM_IOCTL_ARGS )
|
|||
return DRM_ERR(EINVAL);
|
||||
|
||||
dev->unique_len = u.unique_len;
|
||||
dev->unique = DRM(alloc)(u.unique_len + 1, DRM_MEM_DRIVER);
|
||||
dev->unique = drm_alloc(u.unique_len + 1, DRM_MEM_DRIVER);
|
||||
|
||||
if (dev->unique == NULL)
|
||||
return DRM_ERR(ENOMEM);
|
||||
|
@ -104,14 +104,14 @@ int DRM(setunique)( DRM_IOCTL_ARGS )
|
|||
|
||||
|
||||
static int
|
||||
DRM(set_busid)(drm_device_t *dev)
|
||||
drm_set_busid(drm_device_t *dev)
|
||||
{
|
||||
|
||||
if (dev->unique != NULL)
|
||||
return EBUSY;
|
||||
|
||||
dev->unique_len = 20;
|
||||
dev->unique = DRM(alloc)(dev->unique_len + 1, DRM_MEM_DRIVER);
|
||||
dev->unique = drm_alloc(dev->unique_len + 1, DRM_MEM_DRIVER);
|
||||
if (dev->unique == NULL)
|
||||
return ENOMEM;
|
||||
|
||||
|
@ -121,7 +121,7 @@ DRM(set_busid)(drm_device_t *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(getmap)( DRM_IOCTL_ARGS )
|
||||
int drm_getmap(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_map_t map;
|
||||
|
@ -164,7 +164,7 @@ int DRM(getmap)( DRM_IOCTL_ARGS )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(getclient)( DRM_IOCTL_ARGS )
|
||||
int drm_getclient(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_client_t client;
|
||||
|
@ -198,7 +198,7 @@ int DRM(getclient)( DRM_IOCTL_ARGS )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(getstats)( DRM_IOCTL_ARGS )
|
||||
int drm_getstats(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_stats_t stats;
|
||||
|
@ -230,7 +230,7 @@ int DRM(getstats)( DRM_IOCTL_ARGS )
|
|||
#define DRM_IF_MAJOR 1
|
||||
#define DRM_IF_MINOR 2
|
||||
|
||||
int DRM(setversion)(DRM_IOCTL_ARGS)
|
||||
int drm_setversion(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_set_version_t sv;
|
||||
|
@ -241,9 +241,9 @@ int DRM(setversion)(DRM_IOCTL_ARGS)
|
|||
|
||||
retv.drm_di_major = DRM_IF_MAJOR;
|
||||
retv.drm_di_minor = DRM_IF_MINOR;
|
||||
retv.drm_dd_major = DRIVER_MAJOR;
|
||||
retv.drm_dd_minor = DRIVER_MINOR;
|
||||
|
||||
retv.drm_dd_major = dev->driver_major;
|
||||
retv.drm_dd_minor = dev->driver_minor;
|
||||
|
||||
DRM_COPY_TO_USER_IOCTL((drm_set_version_t *)data, retv, sizeof(sv));
|
||||
|
||||
if (sv.drm_di_major != -1) {
|
||||
|
@ -256,13 +256,13 @@ int DRM(setversion)(DRM_IOCTL_ARGS)
|
|||
/*
|
||||
* Version 1.1 includes tying of DRM to specific device
|
||||
*/
|
||||
DRM(set_busid)(dev);
|
||||
drm_set_busid(dev);
|
||||
}
|
||||
}
|
||||
|
||||
if (sv.drm_dd_major != -1) {
|
||||
if (sv.drm_dd_major != DRIVER_MAJOR ||
|
||||
sv.drm_dd_minor < 0 || sv.drm_dd_minor > DRIVER_MINOR)
|
||||
if (sv.drm_dd_major != dev->driver_major ||
|
||||
sv.drm_dd_minor < 0 || sv.drm_dd_minor > dev->driver_minor)
|
||||
return EINVAL;
|
||||
#ifdef DRIVER_SETVERSION
|
||||
DRIVER_SETVERSION(dev, &sv);
|
||||
|
@ -272,7 +272,7 @@ int DRM(setversion)(DRM_IOCTL_ARGS)
|
|||
}
|
||||
|
||||
|
||||
int DRM(noop)(DRM_IOCTL_ARGS)
|
||||
int drm_noop(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEBUG("\n");
|
||||
return 0;
|
||||
|
|
|
@ -28,7 +28,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
int DRM(irq_by_busid)( DRM_IOCTL_ARGS )
|
||||
#include "drmP.h"
|
||||
#include "drm.h"
|
||||
|
||||
int drm_irq_by_busid(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_irq_busid_t irq;
|
||||
|
@ -53,17 +56,17 @@ int DRM(irq_by_busid)( DRM_IOCTL_ARGS )
|
|||
|
||||
#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
|
||||
static irqreturn_t
|
||||
DRM(irq_handler_wrap)(DRM_IRQ_ARGS)
|
||||
drm_irq_handler_wrap(DRM_IRQ_ARGS)
|
||||
{
|
||||
drm_device_t *dev = (drm_device_t *)arg;
|
||||
|
||||
DRM_SPINLOCK(&dev->irq_lock);
|
||||
DRM(irq_handler)(arg);
|
||||
dev->irq_handler(arg);
|
||||
DRM_SPINUNLOCK(&dev->irq_lock);
|
||||
}
|
||||
#endif
|
||||
|
||||
int DRM(irq_install)(drm_device_t *dev)
|
||||
int drm_irq_install(drm_device_t *dev)
|
||||
{
|
||||
int retcode;
|
||||
|
||||
|
@ -85,14 +88,10 @@ int DRM(irq_install)(drm_device_t *dev)
|
|||
dev->dma->next_buffer = NULL;
|
||||
dev->dma->this_buffer = NULL;
|
||||
|
||||
#if __HAVE_IRQ_BH
|
||||
TASK_INIT(&dev->task, 0, DRM(dma_immediate_bh), dev);
|
||||
#endif
|
||||
|
||||
DRM_SPININIT(dev->irq_lock, "DRM IRQ lock");
|
||||
|
||||
/* Before installing handler */
|
||||
DRM(driver_irq_preinstall)( dev );
|
||||
dev->irq_preinstall(dev);
|
||||
|
||||
/* Install handler */
|
||||
#ifdef __FreeBSD__
|
||||
|
@ -105,10 +104,10 @@ int DRM(irq_install)(drm_device_t *dev)
|
|||
}
|
||||
#if __FreeBSD_version < 500000
|
||||
retcode = bus_setup_intr(dev->device, dev->irqr, INTR_TYPE_TTY,
|
||||
DRM(irq_handler), dev, &dev->irqh);
|
||||
dev->irq_handler, dev, &dev->irqh);
|
||||
#else
|
||||
retcode = bus_setup_intr(dev->device, dev->irqr, INTR_TYPE_TTY | INTR_MPSAFE,
|
||||
DRM(irq_handler_wrap), dev, &dev->irqh);
|
||||
drm_irq_handler_wrap, dev, &dev->irqh);
|
||||
#endif
|
||||
if (retcode != 0)
|
||||
goto err;
|
||||
|
@ -118,7 +117,7 @@ int DRM(irq_install)(drm_device_t *dev)
|
|||
goto err;
|
||||
}
|
||||
dev->irqh = pci_intr_establish(&dev->pa.pa_pc, dev->ih, IPL_TTY,
|
||||
(irqreturn_t (*)(DRM_IRQ_ARGS))DRM(irq_handler), dev);
|
||||
(irqreturn_t (*)(DRM_IRQ_ARGS))dev->irq_handler, dev);
|
||||
if (!dev->irqh) {
|
||||
retcode = ENOENT;
|
||||
goto err;
|
||||
|
@ -126,7 +125,7 @@ int DRM(irq_install)(drm_device_t *dev)
|
|||
#endif
|
||||
|
||||
/* After installing handler */
|
||||
DRM(driver_irq_postinstall)( dev );
|
||||
dev->irq_postinstall(dev);
|
||||
|
||||
return 0;
|
||||
err:
|
||||
|
@ -147,7 +146,7 @@ err:
|
|||
/* XXX: This function needs to be called with the device lock held. In some
|
||||
* cases it isn't, so far.
|
||||
*/
|
||||
int DRM(irq_uninstall)( drm_device_t *dev )
|
||||
int drm_irq_uninstall(drm_device_t *dev)
|
||||
{
|
||||
int irqrid;
|
||||
|
||||
|
@ -160,7 +159,7 @@ int DRM(irq_uninstall)( drm_device_t *dev )
|
|||
|
||||
DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, dev->irq );
|
||||
|
||||
DRM(driver_irq_uninstall)( dev );
|
||||
dev->irq_uninstall(dev);
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
bus_teardown_intr(dev->device, dev->irqr, dev->irqh);
|
||||
|
@ -173,7 +172,7 @@ int DRM(irq_uninstall)( drm_device_t *dev )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(control)( DRM_IOCTL_ARGS )
|
||||
int drm_control(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_control_t ctl;
|
||||
|
@ -183,13 +182,20 @@ int DRM(control)( DRM_IOCTL_ARGS )
|
|||
|
||||
switch ( ctl.func ) {
|
||||
case DRM_INST_HANDLER:
|
||||
/* Handle drivers whose DRM used to require IRQ setup but the
|
||||
* no longer does.
|
||||
*/
|
||||
if (!dev->use_irq)
|
||||
return 0;
|
||||
if (dev->if_version < DRM_IF_VERSION(1, 2) &&
|
||||
ctl.irq != dev->irq)
|
||||
return DRM_ERR(EINVAL);
|
||||
return DRM(irq_install)(dev);
|
||||
return drm_irq_install(dev);
|
||||
case DRM_UNINST_HANDLER:
|
||||
if (!dev->use_irq)
|
||||
return 0;
|
||||
DRM_LOCK();
|
||||
err = DRM(irq_uninstall)( dev );
|
||||
err = drm_irq_uninstall(dev);
|
||||
DRM_UNLOCK();
|
||||
return err;
|
||||
default:
|
||||
|
@ -197,8 +203,7 @@ int DRM(control)( DRM_IOCTL_ARGS )
|
|||
}
|
||||
}
|
||||
|
||||
#if __HAVE_VBL_IRQ
|
||||
int DRM(wait_vblank)( DRM_IOCTL_ARGS )
|
||||
int drm_wait_vblank(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_wait_vblank_t vblwait;
|
||||
|
@ -237,8 +242,8 @@ int DRM(wait_vblank)( DRM_IOCTL_ARGS )
|
|||
#endif
|
||||
ret = EINVAL;
|
||||
} else {
|
||||
ret = DRM(vblank_wait)(dev, &vblwait.request.sequence);
|
||||
|
||||
ret = dev->vblank_wait(dev, &vblwait.request.sequence);
|
||||
|
||||
microtime(&now);
|
||||
vblwait.reply.tval_sec = now.tv_sec;
|
||||
vblwait.reply.tval_usec = now.tv_usec;
|
||||
|
@ -250,12 +255,12 @@ int DRM(wait_vblank)( DRM_IOCTL_ARGS )
|
|||
return ret;
|
||||
}
|
||||
|
||||
void DRM(vbl_send_signals)(drm_device_t *dev)
|
||||
void drm_vbl_send_signals(drm_device_t *dev)
|
||||
{
|
||||
}
|
||||
|
||||
#if 0 /* disabled */
|
||||
void DRM(vbl_send_signals)( drm_device_t *dev )
|
||||
void drm_vbl_send_signals( drm_device_t *dev )
|
||||
{
|
||||
drm_vbl_sig_t *vbl_sig;
|
||||
unsigned int vbl_seq = atomic_read( &dev->vbl_received );
|
||||
|
@ -277,5 +282,3 @@ void DRM(vbl_send_signals)( drm_device_t *dev )
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __HAVE_VBL_IRQ */
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "drmP.h"
|
||||
|
||||
int DRM(lock_take)(__volatile__ unsigned int *lock, unsigned int context)
|
||||
int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
|
||||
{
|
||||
unsigned int old, new;
|
||||
|
||||
|
@ -60,7 +60,7 @@ int DRM(lock_take)(__volatile__ unsigned int *lock, unsigned int context)
|
|||
|
||||
/* This takes a lock forcibly and hands it to context. Should ONLY be used
|
||||
inside *_unlock to give lock to kernel before calling *_dma_schedule. */
|
||||
int DRM(lock_transfer)(drm_device_t *dev,
|
||||
int drm_lock_transfer(drm_device_t *dev,
|
||||
__volatile__ unsigned int *lock, unsigned int context)
|
||||
{
|
||||
unsigned int old, new;
|
||||
|
@ -74,7 +74,7 @@ int DRM(lock_transfer)(drm_device_t *dev,
|
|||
return 1;
|
||||
}
|
||||
|
||||
int DRM(lock_free)(drm_device_t *dev,
|
||||
int drm_lock_free(drm_device_t *dev,
|
||||
__volatile__ unsigned int *lock, unsigned int context)
|
||||
{
|
||||
unsigned int old, new;
|
||||
|
|
|
@ -33,56 +33,55 @@
|
|||
#include "drmP.h"
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
#define malloctype DRM(M_DRM)
|
||||
/* The macros conflicted in the MALLOC_DEFINE */
|
||||
MALLOC_DEFINE(malloctype, "drm", "DRM Data Structures");
|
||||
MALLOC_DEFINE(M_DRM, "drm", "DRM Data Structures");
|
||||
#undef malloctype
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_MEMORY
|
||||
#include "drm_memory_debug.h"
|
||||
#else
|
||||
void DRM(mem_init)(void)
|
||||
void drm_mem_init(void)
|
||||
{
|
||||
#ifdef __NetBSD__
|
||||
malloc_type_attach(DRM(M_DRM));
|
||||
malloc_type_attach(M_DRM);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DRM(mem_uninit)(void)
|
||||
void drm_mem_uninit(void)
|
||||
{
|
||||
}
|
||||
|
||||
void *DRM(alloc)(size_t size, int area)
|
||||
void *drm_alloc(size_t size, int area)
|
||||
{
|
||||
return malloc(size, DRM(M_DRM), M_NOWAIT);
|
||||
return malloc(size, M_DRM, M_NOWAIT);
|
||||
}
|
||||
|
||||
void *DRM(calloc)(size_t nmemb, size_t size, int area)
|
||||
void *drm_calloc(size_t nmemb, size_t size, int area)
|
||||
{
|
||||
return malloc(size * nmemb, DRM(M_DRM), M_NOWAIT | M_ZERO);
|
||||
return malloc(size * nmemb, M_DRM, M_NOWAIT | M_ZERO);
|
||||
}
|
||||
|
||||
void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area)
|
||||
void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area)
|
||||
{
|
||||
void *pt;
|
||||
|
||||
pt = malloc(size, DRM(M_DRM), M_NOWAIT);
|
||||
pt = malloc(size, M_DRM, M_NOWAIT);
|
||||
if (pt == NULL)
|
||||
return NULL;
|
||||
if (oldpt && oldsize) {
|
||||
memcpy(pt, oldpt, oldsize);
|
||||
free(oldpt, DRM(M_DRM));
|
||||
free(oldpt, M_DRM);
|
||||
}
|
||||
return pt;
|
||||
}
|
||||
|
||||
void DRM(free)(void *pt, size_t size, int area)
|
||||
void drm_free(void *pt, size_t size, int area)
|
||||
{
|
||||
free(pt, DRM(M_DRM));
|
||||
free(pt, M_DRM);
|
||||
}
|
||||
|
||||
void *DRM(ioremap)( drm_device_t *dev, drm_local_map_t *map )
|
||||
void *drm_ioremap(drm_device_t *dev, drm_local_map_t *map)
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
return pmap_mapdev(map->offset, map->size);
|
||||
|
@ -95,7 +94,7 @@ void *DRM(ioremap)( drm_device_t *dev, drm_local_map_t *map )
|
|||
#endif
|
||||
}
|
||||
|
||||
void DRM(ioremapfree)(drm_local_map_t *map)
|
||||
void drm_ioremapfree(drm_local_map_t *map)
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
pmap_unmapdev((vm_offset_t) map->handle, map->size);
|
||||
|
@ -104,32 +103,29 @@ void DRM(ioremapfree)(drm_local_map_t *map)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if __REALLY_HAVE_AGP
|
||||
agp_memory *DRM(alloc_agp)(int pages, u32 type)
|
||||
agp_memory *drm_alloc_agp(int pages, u32 type)
|
||||
{
|
||||
return DRM(agp_allocate_memory)(pages, type);
|
||||
return drm_agp_allocate_memory(pages, type);
|
||||
}
|
||||
|
||||
int DRM(free_agp)(agp_memory *handle, int pages)
|
||||
int drm_free_agp(agp_memory *handle, int pages)
|
||||
{
|
||||
return DRM(agp_free_memory)(handle);
|
||||
return drm_agp_free_memory(handle);
|
||||
}
|
||||
|
||||
int DRM(bind_agp)(agp_memory *handle, unsigned int start)
|
||||
int drm_bind_agp(agp_memory *handle, unsigned int start)
|
||||
{
|
||||
return DRM(agp_bind_memory)(handle, start);
|
||||
return drm_agp_bind_memory(handle, start);
|
||||
}
|
||||
|
||||
int DRM(unbind_agp)(agp_memory *handle)
|
||||
int drm_unbind_agp(agp_memory *handle)
|
||||
{
|
||||
return DRM(agp_unbind_memory)(handle);
|
||||
return drm_agp_unbind_memory(handle);
|
||||
}
|
||||
#endif /* __REALLY_HAVE_AGP */
|
||||
|
||||
#if __REALLY_HAVE_MTRR
|
||||
#ifdef __FreeBSD__
|
||||
int
|
||||
DRM(mtrr_add)(unsigned long offset, size_t size, int flags)
|
||||
drm_mtrr_add(unsigned long offset, size_t size, int flags)
|
||||
{
|
||||
int act;
|
||||
struct mem_range_desc mrdesc;
|
||||
|
@ -138,12 +134,12 @@ DRM(mtrr_add)(unsigned long offset, size_t size, int flags)
|
|||
mrdesc.mr_len = size;
|
||||
mrdesc.mr_flags = flags;
|
||||
act = MEMRANGE_SET_UPDATE;
|
||||
strlcpy(mrdesc.mr_owner, DRIVER_NAME, sizeof(mrdesc.mr_owner));
|
||||
strlcpy(mrdesc.mr_owner, "drm", sizeof(mrdesc.mr_owner));
|
||||
return mem_range_attr_set(&mrdesc, &act);
|
||||
}
|
||||
|
||||
int
|
||||
DRM(mtrr_del)(unsigned long offset, size_t size, int flags)
|
||||
drm_mtrr_del(unsigned long offset, size_t size, int flags)
|
||||
{
|
||||
int act;
|
||||
struct mem_range_desc mrdesc;
|
||||
|
@ -152,12 +148,12 @@ DRM(mtrr_del)(unsigned long offset, size_t size, int flags)
|
|||
mrdesc.mr_len = size;
|
||||
mrdesc.mr_flags = flags;
|
||||
act = MEMRANGE_SET_REMOVE;
|
||||
strlcpy(mrdesc.mr_owner, DRIVER_NAME, sizeof(mrdesc.mr_owner));
|
||||
strlcpy(mrdesc.mr_owner, "drm", sizeof(mrdesc.mr_owner));
|
||||
return mem_range_attr_set(&mrdesc, &act);
|
||||
}
|
||||
#elif defined(__NetBSD__)
|
||||
int
|
||||
DRM(mtrr_add)(unsigned long offset, size_t size, int flags)
|
||||
drm_mtrr_add(unsigned long offset, size_t size, int flags)
|
||||
{
|
||||
struct mtrr mtrrmap;
|
||||
int one = 1;
|
||||
|
@ -170,7 +166,7 @@ DRM(mtrr_add)(unsigned long offset, size_t size, int flags)
|
|||
}
|
||||
|
||||
int
|
||||
DRM(mtrr_del)(unsigned long offset, size_t size, int flags)
|
||||
drm_mtrr_del(unsigned long offset, size_t size, int flags)
|
||||
{
|
||||
struct mtrr mtrrmap;
|
||||
int one = 1;
|
||||
|
@ -182,6 +178,5 @@ DRM(mtrr_del)(unsigned long offset, size_t size, int flags)
|
|||
return mtrr_set(&mtrrmap, &one, NULL, MTRR_GETSET_KERNEL);
|
||||
}
|
||||
#endif
|
||||
#endif /* __REALLY_HAVE_MTRR */
|
||||
|
||||
#endif /* DEBUG_MEMORY */
|
||||
|
|
|
@ -75,27 +75,10 @@
|
|||
#if __FreeBSD_version >= 500000
|
||||
#include <sys/mutex.h>
|
||||
#endif
|
||||
|
||||
#include "drm_linux_list.h"
|
||||
|
||||
#if __FreeBSD_version >= 400006
|
||||
#define __REALLY_HAVE_AGP __HAVE_AGP
|
||||
#endif
|
||||
|
||||
#ifdef __i386__
|
||||
#define __REALLY_HAVE_MTRR (__HAVE_MTRR) && (__FreeBSD_version >= 460000)
|
||||
#elif defined(__amd64__)
|
||||
#define __REALLY_HAVE_MTRR (__HAVE_MTRR)
|
||||
#else
|
||||
#define __REALLY_HAVE_MTRR 0
|
||||
#endif
|
||||
|
||||
#define __REALLY_HAVE_SG (__HAVE_SG)
|
||||
|
||||
#if __REALLY_HAVE_AGP
|
||||
#include <pci/agpvar.h>
|
||||
#include <sys/agpio.h>
|
||||
#endif
|
||||
|
||||
#include "drm_linux_list.h"
|
||||
|
||||
#include <opt_drm.h>
|
||||
#if DRM_DEBUG
|
||||
|
@ -104,6 +87,11 @@
|
|||
#endif
|
||||
#undef DRM_DEBUG
|
||||
|
||||
#if defined(__amd64__)
|
||||
/* XXX: We don't have the necessary headers yet. At least. */
|
||||
#undef DRM_LINUX
|
||||
#endif
|
||||
|
||||
#if DRM_LINUX
|
||||
#include <sys/file.h>
|
||||
#include <sys/proc.h>
|
||||
|
@ -117,6 +105,8 @@
|
|||
#define DRM_DEV_UID 0
|
||||
#define DRM_DEV_GID 0
|
||||
|
||||
#define __OS_HAS_AGP 1
|
||||
|
||||
#if __FreeBSD_version >= 500000
|
||||
#define DRM_CURPROC curthread
|
||||
#define DRM_STRUCTPROC struct thread
|
||||
|
@ -160,8 +150,8 @@ typedef void irqreturn_t;
|
|||
#define IRQ_HANDLED /* nothing */
|
||||
#define IRQ_NONE /* nothing */
|
||||
#define DRM_DEVICE drm_device_t *dev = kdev->si_drv1
|
||||
#define DRM_MALLOC(size) malloc( size, DRM(M_DRM), M_NOWAIT )
|
||||
#define DRM_FREE(pt,size) free( pt, DRM(M_DRM) )
|
||||
#define DRM_MALLOC(size) malloc(size, M_DRM, M_NOWAIT)
|
||||
#define DRM_FREE(pt,size) free(pt, M_DRM)
|
||||
|
||||
/* Read/write from bus space, with byteswapping to le if necessary */
|
||||
#define DRM_READ8(map, offset) *(volatile u_int8_t *) (((unsigned long)(map)->handle) + (offset))
|
||||
|
@ -188,7 +178,7 @@ do { \
|
|||
return EINVAL; \
|
||||
} \
|
||||
DRM_LOCK(); \
|
||||
_priv = DRM(find_file_by_proc)(dev, DRM_CURPROC); \
|
||||
_priv = drm_find_file_by_proc(dev, DRM_CURPROC); \
|
||||
DRM_UNLOCK(); \
|
||||
if (_priv == NULL) { \
|
||||
DRM_ERROR("can't find authenticator\n"); \
|
||||
|
@ -302,10 +292,7 @@ for ( ret = 0 ; !ret && !(condition) ; ) { \
|
|||
#define M_WAITOK 0
|
||||
#endif
|
||||
|
||||
#define malloctype DRM(M_DRM)
|
||||
/* The macros conflicted in the MALLOC_DEFINE */
|
||||
MALLOC_DECLARE(malloctype);
|
||||
#undef malloctype
|
||||
MALLOC_DECLARE(M_DRM);
|
||||
|
||||
#if __FreeBSD_version < 502109
|
||||
#define bus_alloc_resource_any(dev, type, rid, flags) \
|
||||
|
@ -426,14 +413,14 @@ find_first_zero_bit(volatile void *p, int max)
|
|||
|
||||
#define DRM_MEM_ERROR(area, fmt, arg...) \
|
||||
printf("error: [" DRM_NAME ":pid%d:%s:%s] *ERROR* " fmt, \
|
||||
DRM_CURRENTPID , __func__, DRM(mem_stats)[area].name , ##arg)
|
||||
DRM_CURRENTPID , __func__, drm_mem_stats[area].name , ##arg)
|
||||
|
||||
#define DRM_INFO(fmt, arg...) printf("info: [" DRM_NAME "] " fmt , ## arg)
|
||||
|
||||
#if DRM_DEBUG_CODE
|
||||
#define DRM_DEBUG(fmt, arg...) \
|
||||
do { \
|
||||
if (DRM(flags) & DRM_FLAG_DEBUG) \
|
||||
if (drm_flags & DRM_FLAG_DEBUG) \
|
||||
printf("[" DRM_NAME ":pid%d:%s] " fmt, \
|
||||
DRM_CURRENTPID, __func__ , ## arg); \
|
||||
} while (0)
|
||||
|
@ -450,22 +437,22 @@ find_first_zero_bit(volatile void *p, int max)
|
|||
/* Internal functions */
|
||||
|
||||
/* drm_drv.h */
|
||||
extern d_ioctl_t DRM(ioctl);
|
||||
extern d_open_t DRM(open);
|
||||
extern d_close_t DRM(close);
|
||||
extern d_read_t DRM(read);
|
||||
extern d_poll_t DRM(poll);
|
||||
extern d_mmap_t DRM(mmap);
|
||||
extern int DRM(open_helper)(struct cdev *kdev, int flags, int fmt,
|
||||
extern d_ioctl_t drm_ioctl;
|
||||
extern d_open_t drm_open;
|
||||
extern d_close_t drm_close;
|
||||
extern d_read_t drm_read;
|
||||
extern d_poll_t drm_poll;
|
||||
extern d_mmap_t drm_mmap;
|
||||
extern int drm_open_helper(struct cdev *kdev, int flags, int fmt,
|
||||
DRM_STRUCTPROC *p, drm_device_t *dev);
|
||||
extern drm_file_t *DRM(find_file_by_proc)(drm_device_t *dev,
|
||||
extern drm_file_t *drm_find_file_by_proc(drm_device_t *dev,
|
||||
DRM_STRUCTPROC *p);
|
||||
|
||||
/* sysctl support (drm_sysctl.h) */
|
||||
extern int DRM(sysctl_init)(drm_device_t *dev);
|
||||
extern int DRM(sysctl_cleanup)(drm_device_t *dev);
|
||||
extern int drm_sysctl_init(drm_device_t *dev);
|
||||
extern int drm_sysctl_cleanup(drm_device_t *dev);
|
||||
|
||||
/* Memory info sysctl (drm_memory_debug.h) */
|
||||
#ifdef DEBUG_MEMORY
|
||||
extern int DRM(mem_info) DRM_SYSCTL_HANDLER_ARGS;
|
||||
extern int drm_mem_info DRM_SYSCTL_HANDLER_ARGS;
|
||||
#endif
|
||||
|
|
|
@ -65,15 +65,8 @@
|
|||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
|
||||
#define __REALLY_HAVE_AGP __HAVE_AGP
|
||||
|
||||
#define __REALLY_HAVE_MTRR 1
|
||||
#define __REALLY_HAVE_SG 0
|
||||
|
||||
#if __REALLY_HAVE_AGP
|
||||
#include <dev/pci/agpvar.h>
|
||||
#include <sys/agpio.h>
|
||||
#endif
|
||||
|
||||
#include <opt_drm.h>
|
||||
|
||||
|
@ -89,7 +82,7 @@
|
|||
|
||||
typedef drm_device_t *device_t;
|
||||
|
||||
extern struct cfdriver DRM(cd);
|
||||
extern struct cfdriver drm_cd;
|
||||
|
||||
#define DRM_TIME_SLICE (hz/20) /* Time slice for GLXContexts */
|
||||
|
||||
|
@ -98,6 +91,8 @@ extern struct cfdriver DRM(cd);
|
|||
#define DRM_DEV_GID 0
|
||||
#define CDEV_MAJOR 34
|
||||
|
||||
#define __OS_HAS_AGP 1
|
||||
|
||||
#define DRM_CURPROC curproc
|
||||
#define DRM_STRUCTPROC struct proc
|
||||
#define DRM_SPINTYPE struct simplelock
|
||||
|
@ -120,16 +115,16 @@ extern struct cfdriver DRM(cd);
|
|||
typedef int irqreturn_t;
|
||||
#define IRQ_NONE /* FIXME */
|
||||
#define IRQ_HANDLED /* FIXME */
|
||||
#define DRM_DEVICE drm_device_t *dev = device_lookup(&DRM(cd), minor(kdev))
|
||||
#define DRM_DEVICE drm_device_t *dev = device_lookup(&drm_cd, minor(kdev))
|
||||
/* XXX Not sure if this is the 'right' version.. */
|
||||
#if __NetBSD_Version__ >= 106140000
|
||||
MALLOC_DECLARE(DRM(M_DRM));
|
||||
MALLOC_DECLARE(M_DRM);
|
||||
#else
|
||||
/* XXX Make sure this works */
|
||||
extern const int DRM(M_DRM) = M_DEVBUF;
|
||||
extern const int M_DRM = M_DEVBUF;
|
||||
#endif /* __NetBSD_Version__ */
|
||||
#define DRM_MALLOC(size) malloc( size, DRM(M_DRM), M_NOWAIT )
|
||||
#define DRM_FREE(pt,size) free( pt, DRM(M_DRM) )
|
||||
#define DRM_MALLOC(size) malloc(size, M_DRM, M_NOWAIT)
|
||||
#define DRM_FREE(pt,size) free(pt, M_DRM))
|
||||
|
||||
#define DRM_READ8(map, offset) bus_space_read_1( (map)->iot, (map)->ioh, (offset) )
|
||||
#define DRM_READ32(map, offset) bus_space_read_4( (map)->iot, (map)->ioh, (offset) )
|
||||
|
@ -146,7 +141,7 @@ do { \
|
|||
DRM_ERROR("filp doesn't match curproc\n"); \
|
||||
return EINVAL; \
|
||||
} \
|
||||
_priv = DRM(find_file_by_proc)(dev, DRM_CURPROC); \
|
||||
_priv = drm_find_file_by_proc(dev, DRM_CURPROC); \
|
||||
if (_priv == NULL) { \
|
||||
DRM_ERROR("can't find authenticator\n"); \
|
||||
return EINVAL; \
|
||||
|
@ -344,13 +339,13 @@ do { \
|
|||
|
||||
#define DRM_MEM_ERROR(area, fmt, arg...) \
|
||||
printf("error: [" DRM_NAME ":%s:%s] *ERROR* " fmt , \
|
||||
__func__, DRM(mem_stats)[area].name ,## arg)
|
||||
__func__, drm_mem_stats[area].name ,## arg)
|
||||
#define DRM_INFO(fmt, arg...) printf("info: " "[" DRM_NAME "] " fmt ,## arg)
|
||||
|
||||
#if DRM_DEBUG_CODE
|
||||
#define DRM_DEBUG(fmt, arg...) \
|
||||
do { \
|
||||
if (DRM(flags) & DRM_FLAG_DEBUG) \
|
||||
if (drm_flags & DRM_FLAG_DEBUG) \
|
||||
printf("[" DRM_NAME ":%s] " fmt , __FUNCTION__ ,## arg); \
|
||||
} while (0)
|
||||
#else
|
||||
|
@ -360,16 +355,16 @@ do { \
|
|||
/* Internal functions */
|
||||
|
||||
/* drm_drv.h */
|
||||
extern dev_type_ioctl(DRM(ioctl));
|
||||
extern dev_type_open(DRM(open));
|
||||
extern dev_type_close(DRM(close));
|
||||
extern dev_type_read(DRM(read));
|
||||
extern dev_type_poll(DRM(poll));
|
||||
extern dev_type_mmap(DRM(mmap));
|
||||
extern int DRM(open_helper)(dev_t kdev, int flags, int fmt,
|
||||
extern dev_type_ioctl(drm_ioctl);
|
||||
extern dev_type_open(drm_open);
|
||||
extern dev_type_close(drm_close);
|
||||
extern dev_type_read(drm_read);
|
||||
extern dev_type_poll(drm_poll);
|
||||
extern dev_type_mmap(drm_mmap);
|
||||
extern int drm_open_helper(dev_t kdev, int flags, int fmt,
|
||||
DRM_STRUCTPROC *p, drm_device_t *dev);
|
||||
extern drm_file_t *DRM(find_file_by_proc)(drm_device_t *dev,
|
||||
extern drm_file_t *drm_find_file_by_proc(drm_device_t *dev,
|
||||
DRM_STRUCTPROC *p);
|
||||
|
||||
extern int DRM(sysctl_init)(drm_device_t *dev);
|
||||
extern int DRM(sysctl_cleanup)(drm_device_t *dev);
|
||||
extern int drm_sysctl_init(drm_device_t *dev);
|
||||
extern int drm_sysctl_cleanup(drm_device_t *dev);
|
||||
|
|
|
@ -39,12 +39,12 @@
|
|||
* memory block.
|
||||
*/
|
||||
void *
|
||||
DRM(pci_alloc)(drm_device_t *dev, size_t size, size_t align, dma_addr_t maxaddr,
|
||||
drm_pci_alloc(drm_device_t *dev, size_t size, size_t align, dma_addr_t maxaddr,
|
||||
dma_addr_t *busaddr)
|
||||
{
|
||||
void *vaddr;
|
||||
|
||||
vaddr = contigmalloc(size, DRM(M_DRM), M_NOWAIT, 0ul, maxaddr, align,
|
||||
vaddr = contigmalloc(size, M_DRM, M_NOWAIT, 0ul, maxaddr, align,
|
||||
0);
|
||||
*busaddr = vtophys(vaddr);
|
||||
|
||||
|
@ -55,10 +55,10 @@ DRM(pci_alloc)(drm_device_t *dev, size_t size, size_t align, dma_addr_t maxaddr,
|
|||
* \brief Free a DMA-accessible consistent memory block.
|
||||
*/
|
||||
void
|
||||
DRM(pci_free)(drm_device_t *dev, size_t size, void *vaddr, dma_addr_t busaddr)
|
||||
drm_pci_free(drm_device_t *dev, size_t size, void *vaddr, dma_addr_t busaddr)
|
||||
{
|
||||
#if __FreeBSD_version > 500000
|
||||
contigfree(vaddr, size, DRM(M_DRM)); /* Not available on 4.x */
|
||||
contigfree(vaddr, size, M_DRM); /* Not available on 4.x */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -33,21 +33,17 @@
|
|||
|
||||
#define DEBUG_SCATTER 0
|
||||
|
||||
#if __REALLY_HAVE_SG
|
||||
|
||||
void DRM(sg_cleanup)( drm_sg_mem_t *entry )
|
||||
void drm_sg_cleanup(drm_sg_mem_t *entry)
|
||||
{
|
||||
free( entry->virtual, DRM(M_DRM) );
|
||||
free(entry->virtual, M_DRM);
|
||||
|
||||
DRM(free)( entry->busaddr,
|
||||
drm_free(entry->busaddr,
|
||||
entry->pages * sizeof(*entry->busaddr),
|
||||
DRM_MEM_PAGES );
|
||||
DRM(free)( entry,
|
||||
sizeof(*entry),
|
||||
DRM_MEM_SGLISTS );
|
||||
drm_free(entry, sizeof(*entry), DRM_MEM_SGLISTS);
|
||||
}
|
||||
|
||||
int DRM(sg_alloc)( DRM_IOCTL_ARGS )
|
||||
int drm_sg_alloc(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_scatter_gather_t request;
|
||||
|
@ -62,7 +58,7 @@ int DRM(sg_alloc)( DRM_IOCTL_ARGS )
|
|||
DRM_COPY_FROM_USER_IOCTL(request, (drm_scatter_gather_t *)data,
|
||||
sizeof(request) );
|
||||
|
||||
entry = DRM(alloc)( sizeof(*entry), DRM_MEM_SGLISTS );
|
||||
entry = drm_alloc(sizeof(*entry), DRM_MEM_SGLISTS);
|
||||
if ( !entry )
|
||||
return ENOMEM;
|
||||
|
||||
|
@ -73,24 +69,20 @@ int DRM(sg_alloc)( DRM_IOCTL_ARGS )
|
|||
|
||||
entry->pages = pages;
|
||||
|
||||
entry->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr),
|
||||
DRM_MEM_PAGES );
|
||||
entry->busaddr = drm_alloc(pages * sizeof(*entry->busaddr),
|
||||
DRM_MEM_PAGES);
|
||||
if ( !entry->busaddr ) {
|
||||
DRM(free)( entry,
|
||||
sizeof(*entry),
|
||||
DRM_MEM_SGLISTS );
|
||||
drm_free(entry, sizeof(*entry), DRM_MEM_SGLISTS);
|
||||
return ENOMEM;
|
||||
}
|
||||
bzero( (void *)entry->busaddr, pages * sizeof(*entry->busaddr) );
|
||||
|
||||
entry->virtual = malloc( pages << PAGE_SHIFT, DRM(M_DRM), M_WAITOK );
|
||||
entry->virtual = malloc(pages << PAGE_SHIFT, M_DRM, M_WAITOK);
|
||||
if ( !entry->virtual ) {
|
||||
DRM(free)( entry->busaddr,
|
||||
drm_free(entry->busaddr,
|
||||
entry->pages * sizeof(*entry->busaddr),
|
||||
DRM_MEM_PAGES );
|
||||
DRM(free)( entry,
|
||||
sizeof(*entry),
|
||||
DRM_MEM_SGLISTS );
|
||||
DRM_MEM_PAGES);
|
||||
drm_free(entry, sizeof(*entry), DRM_MEM_SGLISTS);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -111,11 +103,11 @@ int DRM(sg_alloc)( DRM_IOCTL_ARGS )
|
|||
|
||||
return 0;
|
||||
|
||||
DRM(sg_cleanup)( entry );
|
||||
drm_sg_cleanup(entry);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
int DRM(sg_free)( DRM_IOCTL_ARGS )
|
||||
int drm_sg_free(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_scatter_gather_t request;
|
||||
|
@ -132,20 +124,7 @@ int DRM(sg_free)( DRM_IOCTL_ARGS )
|
|||
|
||||
DRM_DEBUG( "sg free virtual = %p\n", entry->virtual );
|
||||
|
||||
DRM(sg_cleanup)( entry );
|
||||
drm_sg_cleanup(entry);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* __REALLY_HAVE_SG */
|
||||
|
||||
int DRM(sg_alloc)( DRM_IOCTL_ARGS )
|
||||
{
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
int DRM(sg_free)( DRM_IOCTL_ARGS )
|
||||
{
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,46 +22,45 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "drmP.h"
|
||||
#include "drm.h"
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
static int DRM(name_info)DRM_SYSCTL_HANDLER_ARGS;
|
||||
static int DRM(vm_info)DRM_SYSCTL_HANDLER_ARGS;
|
||||
static int DRM(clients_info)DRM_SYSCTL_HANDLER_ARGS;
|
||||
#if __HAVE_DMA
|
||||
static int DRM(bufs_info)DRM_SYSCTL_HANDLER_ARGS;
|
||||
#endif
|
||||
static int drm_name_info DRM_SYSCTL_HANDLER_ARGS;
|
||||
static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS;
|
||||
static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS;
|
||||
static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS;
|
||||
|
||||
struct DRM(sysctl_list) {
|
||||
struct drm_sysctl_list {
|
||||
const char *name;
|
||||
int (*f) DRM_SYSCTL_HANDLER_ARGS;
|
||||
} DRM(sysctl_list)[] = {
|
||||
{ "name", DRM(name_info) },
|
||||
} drm_sysctl_list[] = {
|
||||
{"name", drm_name_info},
|
||||
#ifdef DEBUG_MEMORY
|
||||
{ "mem", DRM(mem_info) },
|
||||
#endif
|
||||
{ "vm", DRM(vm_info) },
|
||||
{ "clients", DRM(clients_info) },
|
||||
#if __HAVE_DMA
|
||||
{ "bufs", DRM(bufs_info) },
|
||||
{"mem", drm_mem_info},
|
||||
#endif
|
||||
{"vm", drm_vm_info},
|
||||
{"clients", drm_clients_info},
|
||||
{"bufs", drm_bufs_info},
|
||||
};
|
||||
#define DRM_SYSCTL_ENTRIES (sizeof(DRM(sysctl_list))/sizeof(DRM(sysctl_list)[0]))
|
||||
#define DRM_SYSCTL_ENTRIES (sizeof(drm_sysctl_list)/sizeof(drm_sysctl_list[0]))
|
||||
|
||||
struct drm_sysctl_info {
|
||||
struct sysctl_ctx_list ctx;
|
||||
char name[2];
|
||||
};
|
||||
|
||||
int DRM(sysctl_init)(drm_device_t *dev)
|
||||
int drm_sysctl_init(drm_device_t *dev)
|
||||
{
|
||||
struct drm_sysctl_info *info;
|
||||
struct sysctl_oid *oid;
|
||||
struct sysctl_oid *top, *drioid;
|
||||
int i;
|
||||
|
||||
info = DRM(alloc)(sizeof *info, DRM_MEM_DRIVER);
|
||||
info = drm_alloc(sizeof *info, DRM_MEM_DRIVER);
|
||||
if ( !info )
|
||||
return 1;
|
||||
bzero(info, sizeof *info);
|
||||
|
@ -92,11 +91,11 @@ int DRM(sysctl_init)(drm_device_t *dev)
|
|||
oid = sysctl_add_oid( &info->ctx,
|
||||
SYSCTL_CHILDREN(top),
|
||||
OID_AUTO,
|
||||
DRM(sysctl_list)[i].name,
|
||||
drm_sysctl_list[i].name,
|
||||
CTLTYPE_INT | CTLFLAG_RD,
|
||||
dev,
|
||||
0,
|
||||
DRM(sysctl_list)[i].f,
|
||||
drm_sysctl_list[i].f,
|
||||
"A",
|
||||
NULL);
|
||||
if (!oid)
|
||||
|
@ -105,12 +104,12 @@ int DRM(sysctl_init)(drm_device_t *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DRM(sysctl_cleanup)(drm_device_t *dev)
|
||||
int drm_sysctl_cleanup(drm_device_t *dev)
|
||||
{
|
||||
int error;
|
||||
error = sysctl_ctx_free( &dev->sysctl->ctx );
|
||||
|
||||
DRM(free)(dev->sysctl, sizeof *dev->sysctl, DRM_MEM_DRIVER);
|
||||
drm_free(dev->sysctl, sizeof *dev->sysctl, DRM_MEM_DRIVER);
|
||||
dev->sysctl = NULL;
|
||||
|
||||
return error;
|
||||
|
@ -124,14 +123,14 @@ do { \
|
|||
goto done; \
|
||||
} while (0)
|
||||
|
||||
static int DRM(name_info)DRM_SYSCTL_HANDLER_ARGS
|
||||
static int drm_name_info DRM_SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
drm_device_t *dev = arg1;
|
||||
char buf[128];
|
||||
int retcode;
|
||||
int hasunique = 0;
|
||||
|
||||
DRM_SYSCTL_PRINT("%s 0x%x", dev->name, dev2udev(dev->devnode));
|
||||
DRM_SYSCTL_PRINT("%s 0x%x", dev->driver_name, dev2udev(dev->devnode));
|
||||
|
||||
DRM_LOCK();
|
||||
if (dev->unique) {
|
||||
|
@ -149,7 +148,7 @@ done:
|
|||
return retcode;
|
||||
}
|
||||
|
||||
static int DRM(vm_info)DRM_SYSCTL_HANDLER_ARGS
|
||||
static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
drm_device_t *dev = arg1;
|
||||
drm_local_map_t *map, *tempmaps;
|
||||
|
@ -169,7 +168,7 @@ static int DRM(vm_info)DRM_SYSCTL_HANDLER_ARGS
|
|||
TAILQ_FOREACH(listentry, dev->maplist, link)
|
||||
mapcount++;
|
||||
|
||||
tempmaps = DRM(alloc)(sizeof(drm_local_map_t) * mapcount, DRM_MEM_MAPS);
|
||||
tempmaps = drm_alloc(sizeof(drm_local_map_t) * mapcount, DRM_MEM_MAPS);
|
||||
if (tempmaps == NULL) {
|
||||
DRM_UNLOCK();
|
||||
return ENOMEM;
|
||||
|
@ -205,12 +204,11 @@ static int DRM(vm_info)DRM_SYSCTL_HANDLER_ARGS
|
|||
SYSCTL_OUT(req, "", 1);
|
||||
|
||||
done:
|
||||
DRM(free)(tempmaps, sizeof(drm_local_map_t) * mapcount, DRM_MEM_MAPS);
|
||||
drm_free(tempmaps, sizeof(drm_local_map_t) * mapcount, DRM_MEM_MAPS);
|
||||
return retcode;
|
||||
}
|
||||
|
||||
#if __HAVE_DMA
|
||||
static int DRM(bufs_info) DRM_SYSCTL_HANDLER_ARGS
|
||||
static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
drm_device_t *dev = arg1;
|
||||
drm_device_dma_t *dma = dev->dma;
|
||||
|
@ -230,7 +228,7 @@ static int DRM(bufs_info) DRM_SYSCTL_HANDLER_ARGS
|
|||
}
|
||||
DRM_SPINLOCK(&dev->dma_lock);
|
||||
tempdma = *dma;
|
||||
templists = DRM(alloc)(sizeof(int) * dma->buf_count, DRM_MEM_BUFS);
|
||||
templists = drm_alloc(sizeof(int) * dma->buf_count, DRM_MEM_BUFS);
|
||||
for (i = 0; i < dma->buf_count; i++)
|
||||
templists[i] = dma->buflist[i]->list;
|
||||
dma = &tempdma;
|
||||
|
@ -262,12 +260,11 @@ static int DRM(bufs_info) DRM_SYSCTL_HANDLER_ARGS
|
|||
|
||||
SYSCTL_OUT(req, "", 1);
|
||||
done:
|
||||
DRM(free)(templists, sizeof(int) * dma->buf_count, DRM_MEM_BUFS);
|
||||
drm_free(templists, sizeof(int) * dma->buf_count, DRM_MEM_BUFS);
|
||||
return retcode;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int DRM(clients_info)DRM_SYSCTL_HANDLER_ARGS
|
||||
static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
drm_device_t *dev = arg1;
|
||||
drm_file_t *priv, *tempprivs;
|
||||
|
@ -281,7 +278,7 @@ static int DRM(clients_info)DRM_SYSCTL_HANDLER_ARGS
|
|||
TAILQ_FOREACH(priv, &dev->files, link)
|
||||
privcount++;
|
||||
|
||||
tempprivs = DRM(alloc)(sizeof(drm_file_t) * privcount, DRM_MEM_FILES);
|
||||
tempprivs = drm_alloc(sizeof(drm_file_t) * privcount, DRM_MEM_FILES);
|
||||
if (tempprivs == NULL) {
|
||||
DRM_UNLOCK();
|
||||
return ENOMEM;
|
||||
|
@ -306,18 +303,18 @@ static int DRM(clients_info)DRM_SYSCTL_HANDLER_ARGS
|
|||
|
||||
SYSCTL_OUT(req, "", 1);
|
||||
done:
|
||||
DRM(free)(tempprivs, sizeof(drm_file_t) * privcount, DRM_MEM_FILES);
|
||||
drm_free(tempprivs, sizeof(drm_file_t) * privcount, DRM_MEM_FILES);
|
||||
return retcode;
|
||||
}
|
||||
|
||||
#elif defined(__NetBSD__)
|
||||
/* stub it out for now, sysctl is only for debugging */
|
||||
int DRM(sysctl_init)(drm_device_t *dev)
|
||||
int drm_sysctl_init(drm_device_t *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(sysctl_cleanup)(drm_device_t *dev)
|
||||
int drm_sysctl_cleanup(drm_device_t *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -22,13 +22,16 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "drmP.h"
|
||||
#include "drm.h"
|
||||
|
||||
#if defined(__FreeBSD__) && __FreeBSD_version >= 500102
|
||||
static int DRM(dma_mmap)(struct cdev *kdev, vm_offset_t offset,
|
||||
static int drm_dma_mmap(struct cdev *kdev, vm_offset_t offset,
|
||||
vm_paddr_t *paddr, int prot)
|
||||
#elif defined(__FreeBSD__)
|
||||
static int DRM(dma_mmap)(dev_t kdev, vm_offset_t offset, int prot)
|
||||
static int drm_dma_mmap(dev_t kdev, vm_offset_t offset, int prot)
|
||||
#elif defined(__NetBSD__)
|
||||
static paddr_t DRM(dma_mmap)(dev_t kdev, vm_offset_t offset, int prot)
|
||||
static paddr_t drm_dma_mmap(dev_t kdev, vm_offset_t offset, int prot)
|
||||
#endif
|
||||
{
|
||||
DRM_DEVICE;
|
||||
|
@ -52,12 +55,12 @@ static paddr_t DRM(dma_mmap)(dev_t kdev, vm_offset_t offset, int prot)
|
|||
}
|
||||
|
||||
#if defined(__FreeBSD__) && __FreeBSD_version >= 500102
|
||||
int DRM(mmap)(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr,
|
||||
int drm_mmap(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr,
|
||||
int prot)
|
||||
#elif defined(__FreeBSD__)
|
||||
int DRM(mmap)(dev_t kdev, vm_offset_t offset, int prot)
|
||||
int drm_mmap(dev_t kdev, vm_offset_t offset, int prot)
|
||||
#elif defined(__NetBSD__)
|
||||
paddr_t DRM(mmap)(dev_t kdev, off_t offset, int prot)
|
||||
paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)
|
||||
#endif
|
||||
{
|
||||
DRM_DEVICE;
|
||||
|
@ -74,9 +77,9 @@ paddr_t DRM(mmap)(dev_t kdev, off_t offset, int prot)
|
|||
&& offset >= 0
|
||||
&& offset < ptoa(dev->dma->page_count))
|
||||
#if defined(__FreeBSD__) && __FreeBSD_version >= 500102
|
||||
return DRM(dma_mmap)(kdev, offset, paddr, prot);
|
||||
return drm_dma_mmap(kdev, offset, paddr, prot);
|
||||
#else
|
||||
return DRM(dma_mmap)(kdev, offset, prot);
|
||||
return drm_dma_mmap(kdev, offset, prot);
|
||||
#endif
|
||||
|
||||
/* A sequential search of a linked list is
|
||||
|
|
|
@ -30,34 +30,88 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "r128.h"
|
||||
#include "drmP.h"
|
||||
#include "drm.h"
|
||||
#include "r128_drm.h"
|
||||
#include "r128_drv.h"
|
||||
#if __REALLY_HAVE_SG
|
||||
#include "ati_pcigart.h"
|
||||
#endif
|
||||
#include "drm_pciids.h"
|
||||
|
||||
#include "drm_agpsupport.h"
|
||||
#include "drm_auth.h"
|
||||
#include "drm_bufs.h"
|
||||
#include "drm_context.h"
|
||||
#include "drm_dma.h"
|
||||
#include "drm_drawable.h"
|
||||
#include "drm_drv.h"
|
||||
#include "drm_fops.h"
|
||||
#include "drm_ioctl.h"
|
||||
#include "drm_irq.h"
|
||||
#include "drm_lock.h"
|
||||
#include "drm_memory.h"
|
||||
#include "drm_pci.h"
|
||||
#include "drm_sysctl.h"
|
||||
#include "drm_vm.h"
|
||||
#include "drm_scatter.h"
|
||||
/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
|
||||
static drm_pci_id_list_t r128_pciidlist[] = {
|
||||
r128_PCI_IDS
|
||||
};
|
||||
|
||||
extern drm_ioctl_desc_t r128_ioctls[];
|
||||
extern int r128_max_ioctl;
|
||||
|
||||
static void r128_configure(drm_device_t *dev)
|
||||
{
|
||||
dev->dev_priv_size = sizeof(drm_r128_buf_priv_t);
|
||||
dev->prerelease = r128_driver_prerelease;
|
||||
dev->pretakedown = r128_driver_pretakedown;
|
||||
dev->vblank_wait = r128_driver_vblank_wait;
|
||||
dev->irq_preinstall = r128_driver_irq_preinstall;
|
||||
dev->irq_postinstall = r128_driver_irq_postinstall;
|
||||
dev->irq_uninstall = r128_driver_irq_uninstall;
|
||||
dev->irq_handler = r128_driver_irq_handler;
|
||||
/* XXX dev->reclaim_buffers = drm_core_reclaim_buffers;*/
|
||||
/* XXX dev->get_map_ofs = drm_core_get_map_ofs;
|
||||
dev->get_reg_ofs = drm_core_get_reg_ofs;*/
|
||||
/* XXX: Postinit inlined into drm_drv
|
||||
dev->postinit = postinit; */
|
||||
|
||||
dev->driver_name = DRIVER_NAME;
|
||||
dev->driver_desc = DRIVER_DESC;
|
||||
dev->driver_date = DRIVER_DATE;
|
||||
dev->driver_major = DRIVER_MAJOR;
|
||||
dev->driver_minor = DRIVER_MINOR;
|
||||
dev->driver_patchlevel = DRIVER_PATCHLEVEL;
|
||||
|
||||
dev->use_agp = 1;
|
||||
dev->use_mtrr = 1;
|
||||
dev->use_pci_dma = 1;
|
||||
dev->use_sg = 1;
|
||||
dev->use_dma = 1;
|
||||
dev->use_irq = 1;
|
||||
dev->use_vbl_irq = 1;
|
||||
}
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
DRIVER_MODULE(r128, pci, r128_driver, r128_devclass, 0, 0);
|
||||
static int
|
||||
r128_probe(device_t dev)
|
||||
{
|
||||
return drm_probe(dev, r128_pciidlist);
|
||||
}
|
||||
|
||||
static int
|
||||
r128_attach(device_t nbdev)
|
||||
{
|
||||
drm_device_t *dev = device_get_softc(nbdev);
|
||||
|
||||
bzero(dev, sizeof(drm_device_t));
|
||||
r128_configure(dev);
|
||||
return drm_attach(nbdev, r128_pciidlist);
|
||||
}
|
||||
|
||||
static device_method_t r128_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, r128_probe),
|
||||
DEVMETHOD(device_attach, r128_attach),
|
||||
DEVMETHOD(device_detach, drm_detach),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t r128_driver = {
|
||||
"drm",
|
||||
r128_methods,
|
||||
sizeof(drm_device_t)
|
||||
};
|
||||
|
||||
extern devclass_t drm_devclass;
|
||||
DRIVER_MODULE(r128, pci, r128_driver, drm_devclass, 0, 0);
|
||||
MODULE_DEPEND(r128, drm, 1, 1, 1);
|
||||
|
||||
#elif defined(__NetBSD__)
|
||||
CFDRIVER_DECL(r128, DV_TTY, NULL);
|
||||
#endif /* __FreeBSD__ */
|
||||
#endif
|
||||
|
|
|
@ -28,34 +28,91 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "radeon.h"
|
||||
#include "drmP.h"
|
||||
#include "drm.h"
|
||||
#include "radeon_drm.h"
|
||||
#include "radeon_drv.h"
|
||||
#if __REALLY_HAVE_SG
|
||||
#include "ati_pcigart.h"
|
||||
#endif
|
||||
#include "drm_pciids.h"
|
||||
|
||||
#include "drm_agpsupport.h"
|
||||
#include "drm_auth.h"
|
||||
#include "drm_bufs.h"
|
||||
#include "drm_context.h"
|
||||
#include "drm_dma.h"
|
||||
#include "drm_drawable.h"
|
||||
#include "drm_drv.h"
|
||||
#include "drm_fops.h"
|
||||
#include "drm_ioctl.h"
|
||||
#include "drm_irq.h"
|
||||
#include "drm_lock.h"
|
||||
#include "drm_memory.h"
|
||||
#include "drm_pci.h"
|
||||
#include "drm_vm.h"
|
||||
#include "drm_sysctl.h"
|
||||
#include "drm_scatter.h"
|
||||
/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
|
||||
static drm_pci_id_list_t radeon_pciidlist[] = {
|
||||
radeon_PCI_IDS
|
||||
};
|
||||
|
||||
extern drm_ioctl_desc_t radeon_ioctls[];
|
||||
extern int radeon_max_ioctl;
|
||||
|
||||
static void radeon_configure(drm_device_t *dev)
|
||||
{
|
||||
dev->dev_priv_size = sizeof(drm_radeon_buf_priv_t);
|
||||
dev->prerelease = radeon_driver_prerelease;
|
||||
dev->pretakedown = radeon_driver_pretakedown;
|
||||
dev->vblank_wait = radeon_driver_vblank_wait;
|
||||
dev->irq_preinstall = radeon_driver_irq_preinstall;
|
||||
dev->irq_postinstall = radeon_driver_irq_postinstall;
|
||||
dev->irq_uninstall = radeon_driver_irq_uninstall;
|
||||
dev->irq_handler = radeon_driver_irq_handler;
|
||||
/* XXX dev->reclaim_buffers = drm_core_reclaim_buffers;*/
|
||||
/* XXX dev->get_map_ofs = drm_core_get_map_ofs;
|
||||
dev->get_reg_ofs = drm_core_get_reg_ofs;*/
|
||||
/* XXX: Postinit inlined into drm_drv
|
||||
dev->postinit = postinit; */
|
||||
|
||||
dev->driver_ioctls = radeon_ioctls;
|
||||
dev->max_driver_ioctl = radeon_max_ioctl;
|
||||
|
||||
dev->driver_name = DRIVER_NAME;
|
||||
dev->driver_desc = DRIVER_DESC;
|
||||
dev->driver_date = DRIVER_DATE;
|
||||
dev->driver_major = DRIVER_MAJOR;
|
||||
dev->driver_minor = DRIVER_MINOR;
|
||||
dev->driver_patchlevel = DRIVER_PATCHLEVEL;
|
||||
|
||||
dev->use_agp = 1;
|
||||
dev->use_mtrr = 1;
|
||||
dev->use_pci_dma = 1;
|
||||
dev->use_sg = 1;
|
||||
dev->use_dma = 1;
|
||||
dev->use_irq = 1;
|
||||
dev->use_vbl_irq = 1;
|
||||
}
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
DRIVER_MODULE(DRIVER_NAME, pci, DRM(driver), DRM(devclass), 0, 0);
|
||||
static int
|
||||
radeon_probe(device_t dev)
|
||||
{
|
||||
return drm_probe(dev, radeon_pciidlist);
|
||||
}
|
||||
|
||||
static int
|
||||
radeon_attach(device_t nbdev)
|
||||
{
|
||||
drm_device_t *dev = device_get_softc(nbdev);
|
||||
|
||||
bzero(dev, sizeof(drm_device_t));
|
||||
radeon_configure(dev);
|
||||
return drm_attach(nbdev, radeon_pciidlist);
|
||||
}
|
||||
|
||||
static device_method_t radeon_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, radeon_probe),
|
||||
DEVMETHOD(device_attach, radeon_attach),
|
||||
DEVMETHOD(device_detach, drm_detach),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t radeon_driver = {
|
||||
"drm",
|
||||
radeon_methods,
|
||||
sizeof(drm_device_t)
|
||||
};
|
||||
|
||||
extern devclass_t drm_devclass;
|
||||
DRIVER_MODULE(radeon, pci, radeon_driver, drm_devclass, 0, 0);
|
||||
MODULE_DEPEND(radeon, drm, 1, 1, 1);
|
||||
|
||||
#elif defined(__NetBSD__)
|
||||
CFDRIVER_DECL(radeon, DV_TTY, NULL);
|
||||
#endif /* __FreeBSD__ */
|
||||
|
|
|
@ -66,31 +66,8 @@ static struct pci_device_id pciidlist[] = {
|
|||
r128_PCI_IDS
|
||||
};
|
||||
|
||||
/* Interface history:
|
||||
*
|
||||
* ?? - ??
|
||||
* 2.4 - Add support for ycbcr textures (no new ioctls)
|
||||
* 2.5 - Add FLIP ioctl, disable FULLSCREEN.
|
||||
*/
|
||||
static drm_ioctl_desc_t ioctls[] = {
|
||||
[DRM_IOCTL_NR(DRM_R128_INIT)] = {r128_cce_init, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_R128_CCE_START)] = {r128_cce_start, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_R128_CCE_STOP)] = {r128_cce_stop, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_R128_CCE_RESET)] = {r128_cce_reset, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_R128_CCE_IDLE)] = {r128_cce_idle, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_RESET)] = {r128_engine_reset, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_FULLSCREEN)] = {r128_fullscreen, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_SWAP)] = {r128_cce_swap, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_FLIP)] = {r128_cce_flip, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_CLEAR)] = {r128_cce_clear, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_VERTEX)] = {r128_cce_vertex, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_INDICES)] = {r128_cce_indices, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_BLIT)] = {r128_cce_blit, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_DEPTH)] = {r128_cce_depth, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_STIPPLE)] = {r128_cce_stipple, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_INDIRECT)] = {r128_cce_indirect, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_R128_GETPARAM)] = {r128_getparam, 1, 0},
|
||||
};
|
||||
extern drm_ioctl_desc_t r128_ioctls[];
|
||||
extern int r128_max_ioctl;
|
||||
|
||||
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
|
||||
static struct drm_driver driver = {
|
||||
|
|
|
@ -66,66 +66,8 @@ static struct pci_device_id pciidlist[] = {
|
|||
radeon_PCI_IDS
|
||||
};
|
||||
|
||||
/* Interface history:
|
||||
*
|
||||
* 1.1 - ??
|
||||
* 1.2 - Add vertex2 ioctl (keith)
|
||||
* - Add stencil capability to clear ioctl (gareth, keith)
|
||||
* - Increase MAX_TEXTURE_LEVELS (brian)
|
||||
* 1.3 - Add cmdbuf ioctl (keith)
|
||||
* - Add support for new radeon packets (keith)
|
||||
* - Add getparam ioctl (keith)
|
||||
* - Add flip-buffers ioctl, deprecate fullscreen foo (keith).
|
||||
* 1.4 - Add scratch registers to get_param ioctl.
|
||||
* 1.5 - Add r200 packets to cmdbuf ioctl
|
||||
* - Add r200 function to init ioctl
|
||||
* - Add 'scalar2' instruction to cmdbuf
|
||||
* 1.6 - Add static GART memory manager
|
||||
* Add irq handler (won't be turned on unless X server knows to)
|
||||
* Add irq ioctls and irq_active getparam.
|
||||
* Add wait command for cmdbuf ioctl
|
||||
* Add GART offset query for getparam
|
||||
* 1.7 - Add support for cube map registers: R200_PP_CUBIC_FACES_[0..5]
|
||||
* and R200_PP_CUBIC_OFFSET_F1_[0..5].
|
||||
* Added packets R200_EMIT_PP_CUBIC_FACES_[0..5] and
|
||||
* R200_EMIT_PP_CUBIC_OFFSETS_[0..5]. (brian)
|
||||
* 1.8 - Remove need to call cleanup ioctls on last client exit (keith)
|
||||
* Add 'GET' queries for starting additional clients on different VT's.
|
||||
* 1.9 - Add DRM_IOCTL_RADEON_CP_RESUME ioctl.
|
||||
* Add texture rectangle support for r100.
|
||||
* 1.10- Add SETPARAM ioctl; first parameter to set is FB_LOCATION, which
|
||||
* clients use to tell the DRM where they think the framebuffer is
|
||||
* located in the card's address space
|
||||
* 1.11- Add packet R200_EMIT_RB3D_BLENDCOLOR to support GL_EXT_blend_color
|
||||
* and GL_EXT_blend_[func|equation]_separate on r200
|
||||
*/
|
||||
static drm_ioctl_desc_t ioctls[] = {
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CP_INIT)] = {radeon_cp_init, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CP_START)] = {radeon_cp_start, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CP_STOP)] = {radeon_cp_stop, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CP_RESET)] = {radeon_cp_reset, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CP_IDLE)] = {radeon_cp_idle, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CP_RESUME)] = {radeon_cp_resume, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_RESET)] = {radeon_engine_reset, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_FULLSCREEN)] = {radeon_fullscreen, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_SWAP)] = {radeon_cp_swap, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CLEAR)] = {radeon_cp_clear, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_VERTEX)] = {radeon_cp_vertex, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_INDICES)] = {radeon_cp_indices, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_TEXTURE)] = {radeon_cp_texture, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_STIPPLE)] = {radeon_cp_stipple, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_INDIRECT)] = {radeon_cp_indirect, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_VERTEX2)] = {radeon_cp_vertex2, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CMDBUF)] = {radeon_cp_cmdbuf, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_GETPARAM)] = {radeon_cp_getparam, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_FLIP)] = {radeon_cp_flip, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_ALLOC)] = {radeon_mem_alloc, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_FREE)] = {radeon_mem_free, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_INIT_HEAP)] = {radeon_mem_init_heap, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_IRQ_EMIT)] = {radeon_irq_emit, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_IRQ_WAIT)] = {radeon_irq_wait, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_SETPARAM)] = {radeon_cp_setparam, 1, 0},
|
||||
};
|
||||
extern drm_ioctl_desc_t radeon_ioctls[];
|
||||
extern int radeon_max_ioctl;
|
||||
|
||||
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
|
||||
static struct drm_driver driver = {
|
||||
|
@ -151,8 +93,8 @@ static struct drm_driver driver = {
|
|||
.get_reg_ofs = drm_core_get_reg_ofs,
|
||||
.postinit = postinit,
|
||||
.version = version,
|
||||
.ioctls = ioctls,
|
||||
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
|
||||
.ioctls = radeon_ioctls,
|
||||
.num_ioctls = DRM_ARRAY_SIZE(radeon_ioctls),
|
||||
.dma_ioctl = radeon_cp_buffers,
|
||||
.fops = {
|
||||
.owner = THIS_MODULE,
|
||||
|
|
|
@ -96,8 +96,7 @@ int i915_dma_cleanup(drm_device_t * dev)
|
|||
if (dev_priv->hw_status_page) {
|
||||
#ifdef __FreeBSD__
|
||||
#if __FreeBSD_version > 500000
|
||||
contigfree(dev_priv->hw_status_page, PAGE_SIZE,
|
||||
drm_M_DRM);
|
||||
contigfree(dev_priv->hw_status_page, PAGE_SIZE, M_DRM);
|
||||
#endif
|
||||
#else
|
||||
pci_free_consistent(dev->pdev, PAGE_SIZE,
|
||||
|
@ -182,7 +181,7 @@ static int i915_initialize(drm_device_t * dev,
|
|||
/* Program Hardware Status Page */
|
||||
#ifdef __FreeBSD__
|
||||
dev_priv->hw_status_page =
|
||||
contigmalloc(PAGE_SIZE, drm_M_DRM, M_NOWAIT, 0ul, 0, 0, 0);
|
||||
contigmalloc(PAGE_SIZE, M_DRM, M_NOWAIT, 0ul, 0, 0, 0);
|
||||
dev_priv->dma_status_page = vtophys(dev_priv->hw_status_page);
|
||||
#else
|
||||
dev_priv->hw_status_page =
|
||||
|
|
|
@ -32,6 +32,34 @@
|
|||
#include "r128_drm.h"
|
||||
#include "r128_drv.h"
|
||||
|
||||
/* Interface history:
|
||||
*
|
||||
* ?? - ??
|
||||
* 2.4 - Add support for ycbcr textures (no new ioctls)
|
||||
* 2.5 - Add FLIP ioctl, disable FULLSCREEN.
|
||||
*/
|
||||
static drm_ioctl_desc_t r128_ioctls[] = {
|
||||
[DRM_IOCTL_NR(DRM_R128_INIT)] = {r128_cce_init, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_R128_CCE_START)] = {r128_cce_start, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_R128_CCE_STOP)] = {r128_cce_stop, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_R128_CCE_RESET)] = {r128_cce_reset, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_R128_CCE_IDLE)] = {r128_cce_idle, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_RESET)] = {r128_engine_reset, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_FULLSCREEN)] = {r128_fullscreen, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_SWAP)] = {r128_cce_swap, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_FLIP)] = {r128_cce_flip, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_CLEAR)] = {r128_cce_clear, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_VERTEX)] = {r128_cce_vertex, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_INDICES)] = {r128_cce_indices, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_BLIT)] = {r128_cce_blit, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_DEPTH)] = {r128_cce_depth, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_STIPPLE)] = {r128_cce_stipple, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_R128_INDIRECT)] = {r128_cce_indirect, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_R128_GETPARAM)] = {r128_getparam, 1, 0},
|
||||
};
|
||||
|
||||
int r128_max_ioctl = DRM_ARRAY_SIZE(r128_ioctls);
|
||||
|
||||
/* ================================================================
|
||||
* CCE hardware state programming functions
|
||||
*/
|
||||
|
|
|
@ -2007,6 +2007,7 @@ int radeon_preinit(struct drm_device *dev, unsigned long flags)
|
|||
dev->dev_private = (void *)dev_priv;
|
||||
dev_priv->flags = flags;
|
||||
|
||||
#ifdef __linux__
|
||||
/* registers */
|
||||
if ((ret = drm_initmap(dev, pci_resource_start(dev->pdev, 2),
|
||||
pci_resource_len(dev->pdev, 2), _DRM_REGISTERS,
|
||||
|
@ -2029,19 +2030,23 @@ int radeon_preinit(struct drm_device *dev, unsigned long flags)
|
|||
pci_write_config_dword(dev->pdev, RADEON_AGP_COMMAND_PCI_CONFIG,
|
||||
save | RADEON_AGP_ENABLE);
|
||||
pci_read_config_dword(dev->pdev, RADEON_AGP_COMMAND_PCI_CONFIG, &temp);
|
||||
pci_write_config_dword(dev->pdev, RADEON_AGP_COMMAND_PCI_CONFIG, save);
|
||||
if (temp & RADEON_AGP_ENABLE)
|
||||
dev_priv->flags |= CHIP_IS_AGP;
|
||||
#else
|
||||
if (drm_device_is_agp(dev))
|
||||
dev_priv->flags & CHIP_IS_AGP;
|
||||
#endif
|
||||
DRM_DEBUG("%s card detected\n",
|
||||
((dev_priv->flags & CHIP_IS_AGP) ? "AGP" : "PCI"));
|
||||
pci_write_config_dword(dev->pdev, RADEON_AGP_COMMAND_PCI_CONFIG, save);
|
||||
|
||||
#if defined(__linux__)
|
||||
/* Check if we need a reset */
|
||||
if (!
|
||||
(dev_priv->mmio =
|
||||
drm_core_findmap(dev, pci_resource_start(dev->pdev, 2))))
|
||||
return DRM_ERR(ENOMEM);
|
||||
|
||||
#if defined(__linux__)
|
||||
ret = radeon_create_i2c_busses(dev);
|
||||
#endif
|
||||
return ret;
|
||||
|
|
|
@ -103,9 +103,11 @@ enum radeon_cp_microcode_version {
|
|||
UCODE_R300,
|
||||
};
|
||||
|
||||
#ifdef __linux__
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
|
||||
#include "radeon_i2c.h"
|
||||
#endif
|
||||
#endif /* __linux__ */
|
||||
|
||||
/*
|
||||
* Chip flags
|
||||
|
@ -240,9 +242,11 @@ typedef struct drm_radeon_private {
|
|||
|
||||
/* starting from here on, data is preserved accross an open */
|
||||
uint32_t flags; /* see radeon_chip_flags */
|
||||
#ifdef __linux__
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
|
||||
struct radeon_i2c_chan i2c[4];
|
||||
#endif
|
||||
#endif /* __linux__ */
|
||||
} drm_radeon_private_t;
|
||||
|
||||
typedef struct drm_radeon_buf_priv {
|
||||
|
|
|
@ -33,6 +33,70 @@
|
|||
#include "radeon_drm.h"
|
||||
#include "radeon_drv.h"
|
||||
|
||||
/* Interface history:
|
||||
*
|
||||
* 1.1 - ??
|
||||
* 1.2 - Add vertex2 ioctl (keith)
|
||||
* - Add stencil capability to clear ioctl (gareth, keith)
|
||||
* - Increase MAX_TEXTURE_LEVELS (brian)
|
||||
* 1.3 - Add cmdbuf ioctl (keith)
|
||||
* - Add support for new radeon packets (keith)
|
||||
* - Add getparam ioctl (keith)
|
||||
* - Add flip-buffers ioctl, deprecate fullscreen foo (keith).
|
||||
* 1.4 - Add scratch registers to get_param ioctl.
|
||||
* 1.5 - Add r200 packets to cmdbuf ioctl
|
||||
* - Add r200 function to init ioctl
|
||||
* - Add 'scalar2' instruction to cmdbuf
|
||||
* 1.6 - Add static GART memory manager
|
||||
* Add irq handler (won't be turned on unless X server knows to)
|
||||
* Add irq ioctls and irq_active getparam.
|
||||
* Add wait command for cmdbuf ioctl
|
||||
* Add GART offset query for getparam
|
||||
* 1.7 - Add support for cube map registers: R200_PP_CUBIC_FACES_[0..5]
|
||||
* and R200_PP_CUBIC_OFFSET_F1_[0..5].
|
||||
* Added packets R200_EMIT_PP_CUBIC_FACES_[0..5] and
|
||||
* R200_EMIT_PP_CUBIC_OFFSETS_[0..5]. (brian)
|
||||
* 1.8 - Remove need to call cleanup ioctls on last client exit (keith)
|
||||
* Add 'GET' queries for starting additional clients on different VT's.
|
||||
* 1.9 - Add DRM_IOCTL_RADEON_CP_RESUME ioctl.
|
||||
* Add texture rectangle support for r100.
|
||||
* 1.10- Add SETPARAM ioctl; first parameter to set is FB_LOCATION, which
|
||||
* clients use to tell the DRM where they think the framebuffer is
|
||||
* located in the card's address space
|
||||
* 1.11- Add packet R200_EMIT_RB3D_BLENDCOLOR to support GL_EXT_blend_color
|
||||
* and GL_EXT_blend_[func|equation]_separate on r200
|
||||
*/
|
||||
drm_ioctl_desc_t radeon_ioctls[] = {
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CP_INIT)] = {radeon_cp_init, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CP_START)] = {radeon_cp_start, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CP_STOP)] = {radeon_cp_stop, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CP_RESET)] = {radeon_cp_reset, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CP_IDLE)] = {radeon_cp_idle, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CP_RESUME)] = {radeon_cp_resume, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_RESET)] = {radeon_engine_reset, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_FULLSCREEN)] = {radeon_fullscreen, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_SWAP)] = {radeon_cp_swap, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CLEAR)] = {radeon_cp_clear, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_VERTEX)] = {radeon_cp_vertex, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_INDICES)] = {radeon_cp_indices, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_TEXTURE)] = {radeon_cp_texture, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_STIPPLE)] = {radeon_cp_stipple, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_INDIRECT)] = {radeon_cp_indirect, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_VERTEX2)] = {radeon_cp_vertex2, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_CMDBUF)] = {radeon_cp_cmdbuf, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_GETPARAM)] = {radeon_cp_getparam, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_FLIP)] = {radeon_cp_flip, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_ALLOC)] = {radeon_mem_alloc, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_FREE)] = {radeon_mem_free, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_INIT_HEAP)] = {radeon_mem_init_heap, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_IRQ_EMIT)] = {radeon_irq_emit, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_IRQ_WAIT)] = {radeon_irq_wait, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_RADEON_SETPARAM)] = {radeon_cp_setparam, 1, 0}
|
||||
};
|
||||
|
||||
int radeon_max_ioctl = DRM_ARRAY_SIZE(radeon_ioctls);
|
||||
|
||||
|
||||
/* ================================================================
|
||||
* Helper functions for client state checking and fixup
|
||||
*/
|
||||
|
|
|
@ -97,8 +97,7 @@ int i915_dma_cleanup(drm_device_t * dev)
|
|||
if (dev_priv->hw_status_page) {
|
||||
#ifdef __FreeBSD__
|
||||
#if __FreeBSD_version > 500000
|
||||
contigfree(dev_priv->hw_status_page, PAGE_SIZE,
|
||||
DRM(M_DRM));
|
||||
contigfree(dev_priv->hw_status_page, PAGE_SIZE, M_DRM);
|
||||
#endif
|
||||
#else
|
||||
pci_free_consistent(dev->pdev, PAGE_SIZE,
|
||||
|
|
Loading…
Reference in New Issue