diff options
-rw-r--r-- | bsd-core/drmP.h | 4 | ||||
-rw-r--r-- | bsd-core/drm_auth.c | 1 | ||||
-rw-r--r-- | bsd-core/drm_dma.c | 19 | ||||
-rw-r--r-- | bsd-core/drm_drv.c | 2 | ||||
-rw-r--r-- | bsd-core/drm_memory.c | 24 | ||||
-rw-r--r-- | bsd-core/drm_scatter.c | 2 | ||||
-rw-r--r-- | bsd/drm.h | 7 | ||||
-rw-r--r-- | bsd/drmP.h | 4 | ||||
-rw-r--r-- | bsd/drm_auth.h | 1 | ||||
-rw-r--r-- | bsd/drm_dma.h | 19 | ||||
-rw-r--r-- | bsd/drm_drv.h | 2 | ||||
-rw-r--r-- | bsd/drm_lists.h | 2 | ||||
-rw-r--r-- | bsd/drm_memory.h | 24 | ||||
-rw-r--r-- | bsd/drm_scatter.h | 2 |
14 files changed, 109 insertions, 4 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h index ead40f86..5841ea96 100644 --- a/bsd-core/drmP.h +++ b/bsd-core/drmP.h @@ -119,6 +119,9 @@ typedef struct drm_file drm_file_t; #define DRM_IOREMAP(map) \ (map)->handle = DRM(ioremap)( (map)->offset, (map)->size ) +#define DRM_IOREMAP_NOCACHE(map) \ + (map)->handle = DRM(ioremap_nocache)((map)->offset, (map)->size) + #define DRM_IOREMAPFREE(map) \ do { \ if ( (map)->handle && (map)->size ) \ @@ -512,6 +515,7 @@ extern unsigned long DRM(alloc_pages)(int order, int area); extern void DRM(free_pages)(unsigned long address, int order, int area); extern void *DRM(ioremap)(unsigned long offset, unsigned long size); +extern void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size); extern void DRM(ioremapfree)(void *pt, unsigned long size); #if __REALLY_HAVE_AGP diff --git a/bsd-core/drm_auth.c b/bsd-core/drm_auth.c index f2c2d8da..db0c0118 100644 --- a/bsd-core/drm_auth.c +++ b/bsd-core/drm_auth.c @@ -64,6 +64,7 @@ int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) hash = DRM(hash_magic)(magic); entry = (drm_magic_entry_t*) DRM(alloc)(sizeof(*entry), DRM_MEM_MAGIC); if (!entry) DRM_OS_RETURN(ENOMEM); + memset(entry, 0, sizeof(*entry)); entry->magic = magic; entry->priv = priv; entry->next = NULL; diff --git a/bsd-core/drm_dma.c b/bsd-core/drm_dma.c index e5aef241..3fd1bfe6 100644 --- a/bsd-core/drm_dma.c +++ b/bsd-core/drm_dma.c @@ -600,6 +600,25 @@ int DRM(control)( DRM_OS_IOCTL ) } } +#else + +int DRM(control)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_control_t ctl; + + if ( copy_from_user( &ctl, (drm_control_t *)arg, sizeof(ctl) ) ) + return -EFAULT; + + switch ( ctl.func ) { + case DRM_INST_HANDLER: + case DRM_UNINST_HANDLER: + return 0; + default: + return -EINVAL; + } +} + #endif /* __HAVE_DMA_IRQ */ #endif /* __HAVE_DMA */ diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index 4e5d76fb..ee5e3fbe 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -198,10 +198,8 @@ static drm_ioctl_desc_t DRM(ioctls)[] = { /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */ -#if __HAVE_DMA_IRQ [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { DRM(control), 1, 1 }, #endif -#endif #if __REALLY_HAVE_AGP [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { DRM(agp_acquire), 1, 1 }, diff --git a/bsd-core/drm_memory.c b/bsd-core/drm_memory.c index 605b42ae..97f2bb81 100644 --- a/bsd-core/drm_memory.c +++ b/bsd-core/drm_memory.c @@ -290,6 +290,30 @@ void *DRM(ioremap)(unsigned long offset, unsigned long size) return pt; } +void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size) +{ + void *pt; + + if (!size) { + DRM_MEM_ERROR(DRM_MEM_MAPPINGS, + "Mapping 0 bytes at 0x%08lx\n", offset); + return NULL; + } + + /* FIXME FOR BSD */ + if (!(pt = ioremap_nocache(offset, size))) { + DRM_OS_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count; + DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + return NULL; + } + DRM_OS_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; + DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_allocated += size; + DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + return pt; +} + void DRM(ioremapfree)(void *pt, unsigned long size) { int alloc_count; diff --git a/bsd-core/drm_scatter.c b/bsd-core/drm_scatter.c index a6b8275f..07e8e4e5 100644 --- a/bsd-core/drm_scatter.c +++ b/bsd-core/drm_scatter.c @@ -97,6 +97,8 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp, return -ENOMEM; } + memset(entry->pagelist, 0, pages * sizeof(*entry->pagelist)); + entry->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr), DRM_MEM_PAGES ); if ( !entry->busaddr ) { @@ -100,6 +100,7 @@ typedef struct drm_tex_region { #include "r128_drm.h" #include "radeon_drm.h" #include "sis_drm.h" +#include "gamma_drm.h" typedef struct drm_version { int version_major; /* Major version */ @@ -459,6 +460,7 @@ typedef struct drm_scatter_gather { #define DRM_IOCTL_R128_STIPPLE DRM_IOW( 0x4d, drm_r128_stipple_t) #define DRM_IOCTL_R128_INDIRECT DRM_IOWR(0x4f, drm_r128_indirect_t) #define DRM_IOCTL_R128_FULLSCREEN DRM_IOW( 0x50, drm_r128_fullscreen_t) +#define DRM_IOCTL_R128_CLEAR2 DRM_IOW( 0x51, drm_r128_clear2_t) /* Radeon specific ioctls */ #define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( 0x40, drm_radeon_init_t) @@ -475,6 +477,11 @@ typedef struct drm_scatter_gather { #define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t) #define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t) #define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(0x4e, drm_radeon_texture_t) +#define DRM_IOCTL_RADEON_VERTEX2 DRM_IOW( 0x4f, drm_radeon_vertex_t) + +/* Gamma specific ioctls */ +#define DRM_IOCTL_GAMMA_INIT DRM_IOW( 0x40, drm_gamma_init_t) +#define DRM_IOCTL_GAMMA_COPY DRM_IOW( 0x41, drm_gamma_copy_t) /* SiS specific ioctls */ @@ -119,6 +119,9 @@ typedef struct drm_file drm_file_t; #define DRM_IOREMAP(map) \ (map)->handle = DRM(ioremap)( (map)->offset, (map)->size ) +#define DRM_IOREMAP_NOCACHE(map) \ + (map)->handle = DRM(ioremap_nocache)((map)->offset, (map)->size) + #define DRM_IOREMAPFREE(map) \ do { \ if ( (map)->handle && (map)->size ) \ @@ -512,6 +515,7 @@ extern unsigned long DRM(alloc_pages)(int order, int area); extern void DRM(free_pages)(unsigned long address, int order, int area); extern void *DRM(ioremap)(unsigned long offset, unsigned long size); +extern void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size); extern void DRM(ioremapfree)(void *pt, unsigned long size); #if __REALLY_HAVE_AGP diff --git a/bsd/drm_auth.h b/bsd/drm_auth.h index f2c2d8da..db0c0118 100644 --- a/bsd/drm_auth.h +++ b/bsd/drm_auth.h @@ -64,6 +64,7 @@ int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) hash = DRM(hash_magic)(magic); entry = (drm_magic_entry_t*) DRM(alloc)(sizeof(*entry), DRM_MEM_MAGIC); if (!entry) DRM_OS_RETURN(ENOMEM); + memset(entry, 0, sizeof(*entry)); entry->magic = magic; entry->priv = priv; entry->next = NULL; diff --git a/bsd/drm_dma.h b/bsd/drm_dma.h index e5aef241..3fd1bfe6 100644 --- a/bsd/drm_dma.h +++ b/bsd/drm_dma.h @@ -600,6 +600,25 @@ int DRM(control)( DRM_OS_IOCTL ) } } +#else + +int DRM(control)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_control_t ctl; + + if ( copy_from_user( &ctl, (drm_control_t *)arg, sizeof(ctl) ) ) + return -EFAULT; + + switch ( ctl.func ) { + case DRM_INST_HANDLER: + case DRM_UNINST_HANDLER: + return 0; + default: + return -EINVAL; + } +} + #endif /* __HAVE_DMA_IRQ */ #endif /* __HAVE_DMA */ diff --git a/bsd/drm_drv.h b/bsd/drm_drv.h index 4e5d76fb..ee5e3fbe 100644 --- a/bsd/drm_drv.h +++ b/bsd/drm_drv.h @@ -198,10 +198,8 @@ static drm_ioctl_desc_t DRM(ioctls)[] = { /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */ -#if __HAVE_DMA_IRQ [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { DRM(control), 1, 1 }, #endif -#endif #if __REALLY_HAVE_AGP [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { DRM(agp_acquire), 1, 1 }, diff --git a/bsd/drm_lists.h b/bsd/drm_lists.h index ea6d34a7..682f56b0 100644 --- a/bsd/drm_lists.h +++ b/bsd/drm_lists.h @@ -44,6 +44,8 @@ int DRM(waitlist_create)(drm_waitlist_t *bl, int count) if(!bl->bufs) DRM_OS_RETURN(ENOMEM); + memset(bl->bufs, 0, sizeof(*bl->bufs)); + bl->count = count; bl->rp = bl->bufs; bl->wp = bl->bufs; diff --git a/bsd/drm_memory.h b/bsd/drm_memory.h index 605b42ae..97f2bb81 100644 --- a/bsd/drm_memory.h +++ b/bsd/drm_memory.h @@ -290,6 +290,30 @@ void *DRM(ioremap)(unsigned long offset, unsigned long size) return pt; } +void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size) +{ + void *pt; + + if (!size) { + DRM_MEM_ERROR(DRM_MEM_MAPPINGS, + "Mapping 0 bytes at 0x%08lx\n", offset); + return NULL; + } + + /* FIXME FOR BSD */ + if (!(pt = ioremap_nocache(offset, size))) { + DRM_OS_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count; + DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + return NULL; + } + DRM_OS_SPINLOCK(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; + DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_allocated += size; + DRM_OS_SPINUNLOCK(&DRM(mem_lock)); + return pt; +} + void DRM(ioremapfree)(void *pt, unsigned long size) { int alloc_count; diff --git a/bsd/drm_scatter.h b/bsd/drm_scatter.h index a6b8275f..07e8e4e5 100644 --- a/bsd/drm_scatter.h +++ b/bsd/drm_scatter.h @@ -97,6 +97,8 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp, return -ENOMEM; } + memset(entry->pagelist, 0, pages * sizeof(*entry->pagelist)); + entry->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr), DRM_MEM_PAGES ); if ( !entry->busaddr ) { |