diff options
author | Gareth Hughes <gareth@users.sourceforge.net> | 2000-12-23 06:47:58 +0000 |
---|---|---|
committer | Gareth Hughes <gareth@users.sourceforge.net> | 2000-12-23 06:47:58 +0000 |
commit | 3b89d5aaa53ddec0047d57631a12e236f9e7dec1 (patch) | |
tree | 6fbe07671b41044efb55b2c0c6d6fcd1e7a6c710 /linux-core | |
parent | 7c7885903a6fa3f561f3fe7ece28ac5b7aed8e7c (diff) |
Merge in XFree86 4.0.2 updates from trunk.ati-5-0-0-20001223-merge
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/Makefile.kernel | 18 | ||||
-rw-r--r-- | linux-core/drmP.h | 27 | ||||
-rw-r--r-- | linux-core/i810_drv.c | 7 | ||||
-rw-r--r-- | linux-core/mga_drv.c | 7 | ||||
-rw-r--r-- | linux-core/r128_drv.c | 45 | ||||
-rw-r--r-- | linux-core/radeon_drv.c | 5 | ||||
-rw-r--r-- | linux-core/sis_drv.c | 23 | ||||
-rw-r--r-- | linux-core/tdfx_drv.c | 6 |
8 files changed, 59 insertions, 79 deletions
diff --git a/linux-core/Makefile.kernel b/linux-core/Makefile.kernel index 261eb0d8..1e61ae97 100644 --- a/linux-core/Makefile.kernel +++ b/linux-core/Makefile.kernel @@ -36,16 +36,16 @@ else endif endif -gamma-objs := $(lib-objs) gamma_drv.o gamma_dma.o -tdfx-objs := $(lib-objs) tdfx_drv.o tdfx_context.o -r128-objs := $(lib-objs) r128_drv.o r128_cce.o r128_context.o \ - r128_bufs.o r128_state.o -radeon-objs := $(lib-objs) radeon_drv.o radeon_cp.o radeon_context.o \ +gamma-objs := $(lib-objs) gamma_drv.o gamma_dma.o +tdfx-objs := $(lib-objs) tdfx_drv.o tdfx_context.o +r128-objs := $(lib-objs) r128_drv.o r128_cce.o r128_context.o \ + r128_bufs.o r128_state.o +radeon-objs := $(lib-objs) radeon_drv.o radeon_cp.o radeon_context.o \ radeon_bufs.o radeon_state.o -ffb-objs := $(lib-objs) ffb_drv.o ffb_context.o -mga-objs := $(lib-objs) mga_drv.o mga_dma.o mga_context.o \ - mga_bufs.o mga_state.o -i810-objs := $(lib-objs) i810_drv.o i810_dma.o i810_context.o \ +ffb-objs := $(lib-objs) ffb_drv.o ffb_context.o +mga-objs := $(lib-objs) mga_drv.o mga_dma.o mga_context.o \ + mga_bufs.o mga_state.o +i810-objs := $(lib-objs) i810_drv.o i810_dma.o i810_context.o \ i810_bufs.o obj-$(CONFIG_DRM_GAMMA) += gamma.o $(gamma-objs) diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 46e08e05..affeae70 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -59,15 +59,6 @@ #include <asm/io.h> #include <asm/mman.h> #include <asm/uaccess.h> - -#ifndef copy_to_user_ret -#define copy_to_user_ret(to,from,n,retval) ({ if (copy_to_user(to,from,n)) return retval; }) -#endif - -#ifndef copy_from_user_ret -#define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n)) return retval; }) -#endif - #ifdef CONFIG_MTRR #include <asm/mtrr.h> #endif @@ -519,19 +510,6 @@ typedef struct drm_agp_head { unsigned long base; int agp_mtrr; } drm_agp_head_t; - -typedef struct { - void (*free_memory)(agp_memory *); - agp_memory *(*allocate_memory)(size_t, u32); - int (*bind_memory)(agp_memory *, off_t); - int (*unbind_memory)(agp_memory *); - void (*enable)(u32); - int (*acquire)(void); - void (*release)(void); - void (*copy_info)(agp_kern_info *); -} drm_agp_func_t; - -extern drm_agp_func_t drm_agp; #endif typedef struct drm_sigdata { @@ -833,6 +811,7 @@ extern drm_agp_head_t *drm_agp_init(void); extern void drm_agp_uninit(void); extern int drm_agp_acquire(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); +extern void _drm_agp_release(void); extern int drm_agp_release(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int drm_agp_enable(struct inode *inode, struct file *filp, @@ -847,6 +826,10 @@ extern int drm_agp_unbind(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int drm_agp_bind(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); +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 #endif #endif diff --git a/linux-core/i810_drv.c b/linux-core/i810_drv.c index ed880c41..7152eac3 100644 --- a/linux-core/i810_drv.c +++ b/linux-core/i810_drv.c @@ -255,8 +255,7 @@ static int i810_takedown(drm_device_t *dev) } dev->agp->memory = NULL; - if (dev->agp->acquired && drm_agp.release) - (*drm_agp.release)(); + if (dev->agp->acquired) _drm_agp_release(); dev->agp->acquired = 0; dev->agp->enabled = 0; @@ -338,7 +337,7 @@ static int i810_takedown(drm_device_t *dev) /* i810_init is called via init_module at module load time, or via * linux/init/main.c (this is not currently supported). */ -static int i810_init(void) +static int __init i810_init(void) { int retcode; drm_device_t *dev = &i810_device; @@ -397,7 +396,7 @@ static int i810_init(void) /* i810_cleanup is called via cleanup_module at module unload time. */ -static void i810_cleanup(void) +static void __exit i810_cleanup(void) { drm_device_t *dev = &i810_device; diff --git a/linux-core/mga_drv.c b/linux-core/mga_drv.c index 4aaac625..883eb75c 100644 --- a/linux-core/mga_drv.c +++ b/linux-core/mga_drv.c @@ -255,8 +255,7 @@ static int mga_takedown(drm_device_t *dev) } dev->agp->memory = NULL; - if (dev->agp->acquired && drm_agp.release) - (*drm_agp.release)(); + if (dev->agp->acquired) _drm_agp_release(); dev->agp->acquired = 0; dev->agp->enabled = 0; @@ -338,7 +337,7 @@ static int mga_takedown(drm_device_t *dev) /* mga_init is called via init_module at module load time, or via * linux/init/main.c (this is not currently supported). */ -static int mga_init(void) +static int __init mga_init(void) { int retcode; drm_device_t *dev = &mga_device; @@ -398,7 +397,7 @@ static int mga_init(void) /* mga_cleanup is called via cleanup_module at module unload time. */ -static void mga_cleanup(void) +static void __exit mga_cleanup(void) { drm_device_t *dev = &mga_device; diff --git a/linux-core/r128_drv.c b/linux-core/r128_drv.c index 66bdf36e..dbfc9b74 100644 --- a/linux-core/r128_drv.c +++ b/linux-core/r128_drv.c @@ -37,10 +37,10 @@ #define R128_NAME "r128" #define R128_DESC "ATI Rage 128" -#define R128_DATE "20001106" +#define R128_DATE "20001215" #define R128_MAJOR 2 -#define R128_MINOR 0 -#define R128_PATCHLEVEL 0 +#define R128_MINOR 1 +#define R128_PATCHLEVEL 2 static drm_device_t r128_device; drm_ctx_t r128_res_ctx; @@ -119,6 +119,8 @@ static drm_ioctl_desc_t r128_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_R128_VERTEX)] = { r128_cce_vertex, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_R128_INDICES)] = { r128_cce_indices, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_R128_BLIT)] = { r128_cce_blit, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_DEPTH)] = { r128_cce_depth, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_R128_STIPPLE)] = { r128_cce_stipple, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_R128_PACKET)] = { r128_cce_packet, 1, 0 }, }; #define R128_IOCTL_COUNT DRM_ARRAY_SIZE(r128_ioctls) @@ -261,8 +263,7 @@ static int r128_takedown(drm_device_t *dev) } dev->agp->memory = NULL; - if (dev->agp->acquired && drm_agp.release) - (*drm_agp.release)(); + if (dev->agp->acquired) _drm_agp_release(); dev->agp->acquired = 0; dev->agp->enabled = 0; @@ -332,7 +333,7 @@ static int r128_takedown(drm_device_t *dev) /* r128_init is called via init_module at module load time, or via * linux/init/main.c (this is not currently supported). */ -static int r128_init(void) +static int __init r128_init(void) { int retcode; drm_device_t *dev = &r128_device; @@ -359,12 +360,12 @@ static int r128_init(void) #if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) dev->agp = drm_agp_init(); - if (dev->agp == NULL) { - DRM_ERROR("Cannot initialize agpgart module.\n"); - drm_proc_cleanup(); - misc_deregister(&r128_misc); - r128_takedown(dev); - return -ENOMEM; + if (dev->agp == NULL) { + DRM_ERROR("Cannot initialize agpgart module.\n"); + drm_proc_cleanup(); + misc_deregister(&r128_misc); + r128_takedown(dev); + return -ENOMEM; } #ifdef CONFIG_MTRR @@ -396,7 +397,7 @@ static int r128_init(void) /* r128_cleanup is called via cleanup_module at module unload time. */ -static void r128_cleanup(void) +static void __exit r128_cleanup(void) { drm_device_t *dev = &r128_device; @@ -423,8 +424,8 @@ module_init(r128_init); module_exit(r128_cleanup); -int r128_version(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +int r128_version(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { drm_version_t version; int len; @@ -516,8 +517,8 @@ int r128_release(struct inode *inode, struct file *filp) } /* r128_ioctl is called whenever a process performs an ioctl on /dev/drm. */ -int r128_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +int r128_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { int nr = DRM_IOCTL_NR(cmd); drm_file_t *priv = filp->private_data; @@ -543,7 +544,7 @@ int r128_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, DRM_DEBUG("no function\n"); retcode = -EINVAL; } else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN)) - || (ioctl->auth_needed && !priv->authenticated)) { + || (ioctl->auth_needed && !priv->authenticated)) { retcode = -EACCES; } else { retcode = (func)(inode, filp, cmd, arg); @@ -560,8 +561,8 @@ int r128_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, return retcode; } -int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +int r128_lock(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; @@ -656,8 +657,8 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd, } -int r128_unlock(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +int r128_unlock(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; diff --git a/linux-core/radeon_drv.c b/linux-core/radeon_drv.c index 9cbb1264..35539766 100644 --- a/linux-core/radeon_drv.c +++ b/linux-core/radeon_drv.c @@ -34,7 +34,7 @@ #define RADEON_NAME "radeon" #define RADEON_DESC "ATI Radeon" -#define RADEON_DATE "20001108" +#define RADEON_DATE "20001223" #define RADEON_MAJOR 1 #define RADEON_MINOR 0 #define RADEON_PATCHLEVEL 0 @@ -258,8 +258,7 @@ static int radeon_takedown(drm_device_t *dev) } dev->agp->memory = NULL; - if (dev->agp->acquired && drm_agp.release) - (*drm_agp.release)(); + if (dev->agp->acquired) _drm_agp_release(); dev->agp->acquired = 0; dev->agp->enabled = 0; diff --git a/linux-core/sis_drv.c b/linux-core/sis_drv.c index 2f98e322..92ec32dd 100644 --- a/linux-core/sis_drv.c +++ b/linux-core/sis_drv.c @@ -250,7 +250,7 @@ static int sis_takedown(drm_device_t *dev) drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS); temp = temp_next; } - if (dev->agp->acquired) (*drm_agp.release)(); + if (dev->agp->acquired) _drm_agp_release(); } #endif /* Clear vma list (only built for debugging) */ @@ -394,17 +394,16 @@ int sis_version(struct inode *inode, struct file *filp, unsigned int cmd, drm_version_t version; int len; - copy_from_user_ret(&version, - (drm_version_t *)arg, - sizeof(version), - -EFAULT); + if (copy_from_user(&version, (drm_version_t *)arg, sizeof(version))) + return -EFAULT; #define DRM_COPY(name,value) \ len = strlen(value); \ if (len > name##_len) len = name##_len; \ name##_len = strlen(value); \ if (len && name) { \ - copy_to_user_ret(name, value, len, -EFAULT); \ + if (copy_to_user(name, value, len)) \ + return -EFAULT; \ } version.version_major = SIS_MAJOR; @@ -415,10 +414,8 @@ int sis_version(struct inode *inode, struct file *filp, unsigned int cmd, DRM_COPY(version.date, SIS_DATE); DRM_COPY(version.desc, SIS_DESC); - copy_to_user_ret((drm_version_t *)arg, - &version, - sizeof(version), - -EFAULT); + if (copy_to_user((drm_version_t *)arg, &version, sizeof(version))) + return -EFAULT; return 0; } @@ -533,7 +530,8 @@ int sis_lock(struct inode *inode, struct file *filp, unsigned int cmd, dev->lck_start = start = get_cycles(); #endif - copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT); + if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) + return -EFAULT; if (lock.context == DRM_KERNEL_CONTEXT) { DRM_ERROR("Process %d using kernel context %d\n", @@ -667,7 +665,8 @@ int sis_unlock(struct inode *inode, struct file *filp, unsigned int cmd, drm_device_t *dev = priv->dev; drm_lock_t lock; - copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT); + if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) + return -EFAULT; if (lock.context == DRM_KERNEL_CONTEXT) { DRM_ERROR("Process %d using kernel context %d\n", diff --git a/linux-core/tdfx_drv.c b/linux-core/tdfx_drv.c index 5f2c804a..7d79a013 100644 --- a/linux-core/tdfx_drv.c +++ b/linux-core/tdfx_drv.c @@ -235,7 +235,7 @@ static int tdfx_takedown(drm_device_t *dev) drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS); temp = temp_next; } - if (dev->agp->acquired) (*drm_agp.release)(); + if (dev->agp->acquired) _drm_agp_release(); } #endif /* Clear vma list (only built for debugging) */ @@ -298,7 +298,7 @@ static int tdfx_takedown(drm_device_t *dev) /* tdfx_init is called via init_module at module load time, or via * linux/init/main.c (this is not currently supported). */ -static int tdfx_init(void) +static int __init tdfx_init(void) { int retcode; drm_device_t *dev = &tdfx_device; @@ -346,7 +346,7 @@ static int tdfx_init(void) /* tdfx_cleanup is called via cleanup_module at module unload time. */ -static void tdfx_cleanup(void) +static void __exit tdfx_cleanup(void) { drm_device_t *dev = &tdfx_device; |