diff options
author | Jeff Hartmann <jhartmann@valinux.com> | 2001-02-21 15:48:40 +0000 |
---|---|---|
committer | Jeff Hartmann <jhartmann@valinux.com> | 2001-02-21 15:48:40 +0000 |
commit | 89daf2d5ab8626b9287687a6b81da9d682520856 (patch) | |
tree | e1bbf2f28e7793df5069f86d8135baf3a27c312c /linux | |
parent | ba3a1aa6b68e62513f5a61fa46adcf4b25f9f21d (diff) |
Initial gamma kernel initialization routine, not done just yet
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drm.h | 4 | ||||
-rw-r--r-- | linux/gamma_dma.c | 39 | ||||
-rw-r--r-- | linux/gamma_drm.h | 41 | ||||
-rw-r--r-- | linux/gamma_drv.c | 6 | ||||
-rw-r--r-- | linux/gamma_drv.h | 7 |
5 files changed, 93 insertions, 4 deletions
diff --git a/linux/drm.h b/linux/drm.h index 89ca74ad..6d366e7a 100644 --- a/linux/drm.h +++ b/linux/drm.h @@ -88,6 +88,7 @@ typedef struct drm_tex_region { #include "i810_drm.h" #include "r128_drm.h" #include "radeon_drm.h" +#include "gamma_drm.h" #ifdef CONFIG_DRM_SIS #include "sis_drm.h" #endif @@ -402,6 +403,9 @@ typedef struct drm_agp_info { #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t) #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t) +/* Gamma specific ioctls */ +#define DRM_IOCTL_GAMMA_INIT DRM_IOW( 0x40, drm_gamma_init_t) + /* MGA specific ioctls */ #define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t) #define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t) diff --git a/linux/gamma_dma.c b/linux/gamma_dma.c index e2ac6061..d6c10fea 100644 --- a/linux/gamma_dma.c +++ b/linux/gamma_dma.c @@ -711,7 +711,6 @@ int gamma_irq_uninstall(drm_device_t *dev) return 0; } - int gamma_control(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { @@ -737,3 +736,41 @@ int gamma_control(struct inode *inode, struct file *filp, unsigned int cmd, } return 0; } + +void gamma_dma_cleanup(drm_device_t *dev) +{ + drm_gamma_private_t *dev_priv; + + if(dev->dev_private) { + dev_priv = (drm_gamma_private_t *)dev->dev_private; + DRM(free)(dev_priv, + sizeof(drm_gamma_private_t), + DRM_MEM_DRIVER); + dev->dev_private = NULL; + } +} + +int gamma_dma_init(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; + drm_gamma_init_t init; + drm_gamma_private_t *dev_priv; + + if (copy_from_user(&init, (drm_gamma_init_t *)arg, sizeof(init))) + return -EFAULT; + + dev_priv = DRM(alloc)(sizeof(drm_gamma_private_t), + DRM_MEM_DRIVER); + if(!dev_priv) return -ENOMEM; + + memset(dev_priv, 0, sizeof(drm_gamma_private_t)); + + DRM_FIND_MAP(dev_priv->mmio0, init.hControlRegs0); + DRM_FIND_MAP(dev_priv->mmio1, init.hControlRegs1); + DRM_FIND_MAP(dev_priv->mmio2, init.hControlRegs2); + DRM_FIND_MAP(dev_priv->mmio3, init.hControlRegs3); + + return 0; +} diff --git a/linux/gamma_drm.h b/linux/gamma_drm.h new file mode 100644 index 00000000..b4acd70a --- /dev/null +++ b/linux/gamma_drm.h @@ -0,0 +1,41 @@ +/* gamma_drm.h -- Public header for the Gamma driver -*- linux-c -*- + * Created: Tue Jan 25 01:50:01 1999 by jhartmann@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Jeff Hartmann <jhartmann@valinux.com> + */ + +#ifndef __GAMMA_DRM_H__ +#define __GAMMA_DRM_H__ + +typedef struct drm_gamma_init { + unsigned long hControlRegs0; + unsigned long hControlRegs1; + unsigned long hControlRegs2; + unsigned long hControlRegs3; +} drm_gamma_init_t; + +#endif diff --git a/linux/gamma_drv.c b/linux/gamma_drv.c index c24d5a33..ae73aca4 100644 --- a/linux/gamma_drv.c +++ b/linux/gamma_drv.c @@ -46,7 +46,8 @@ #define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { gamma_dma, 1, 0 } + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { gamma_dma, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_GAMMA_INIT)] = { gamma_dma_init, 1, 0 } #define __HAVE_MTRR 1 #define __HAVE_CTX_BITMAP 0 @@ -89,14 +90,13 @@ do { \ gamma_reclaim_buffers( dev, priv->pid ); \ if ( dev->dev_private ) { \ drm_gamma_private_t *dev_priv = dev->dev_private; \ - dev_priv->dispatch_status &= MGA_IN_DISPATCH; \ } \ } while (0) #endif #if 0 #define DRIVER_PRETAKEDOWN() do { \ - if ( dev->dev_private ) gamma_do_cleanup_dma( dev ); \ + if ( dev->dev_private ) gamma_dma_cleanup( dev ); \ } while (0) #endif diff --git a/linux/gamma_drv.h b/linux/gamma_drv.h index 1bfa2650..ae2ec59b 100644 --- a/linux/gamma_drv.h +++ b/linux/gamma_drv.h @@ -35,6 +35,10 @@ typedef struct drm_gamma_private { drm_map_t *buffers; + drm_map_t *mmio0; + drm_map_t *mmio1; + drm_map_t *mmio2; + drm_map_t *mmio3; } drm_gamma_private_t; #define LOCK_TEST_WITH_RETURN( dev ) \ @@ -72,5 +76,8 @@ extern int gamma_control(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int gamma_find_devices(void); extern int gamma_found(void); +extern void gamma_dma_cleanup(drm_device_t *dev); +extern int gamma_dma_init(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); #endif |