xref: /OK3568_Linux_fs/kernel/drivers/gpu/drm/sis/sis_drv.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* sis_drv.h -- Private header for sis driver -*- linux-c -*- */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
4*4882a593Smuzhiyun  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
5*4882a593Smuzhiyun  * All rights reserved.
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Permission is hereby granted, free of charge, to any person obtaining a
8*4882a593Smuzhiyun  * copy of this software and associated documentation files (the "Software"),
9*4882a593Smuzhiyun  * to deal in the Software without restriction, including without limitation
10*4882a593Smuzhiyun  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11*4882a593Smuzhiyun  * and/or sell copies of the Software, and to permit persons to whom the
12*4882a593Smuzhiyun  * Software is furnished to do so, subject to the following conditions:
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  * The above copyright notice and this permission notice (including the next
15*4882a593Smuzhiyun  * paragraph) shall be included in all copies or substantial portions of the
16*4882a593Smuzhiyun  * Software.
17*4882a593Smuzhiyun  *
18*4882a593Smuzhiyun  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19*4882a593Smuzhiyun  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20*4882a593Smuzhiyun  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21*4882a593Smuzhiyun  * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22*4882a593Smuzhiyun  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23*4882a593Smuzhiyun  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24*4882a593Smuzhiyun  * DEALINGS IN THE SOFTWARE.
25*4882a593Smuzhiyun  *
26*4882a593Smuzhiyun  */
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun #ifndef _SIS_DRV_H_
29*4882a593Smuzhiyun #define _SIS_DRV_H_
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun #include <drm/drm_ioctl.h>
32*4882a593Smuzhiyun #include <drm/drm_legacy.h>
33*4882a593Smuzhiyun #include <drm/drm_mm.h>
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun /* General customization:
36*4882a593Smuzhiyun  */
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun #define DRIVER_AUTHOR		"SIS, Tungsten Graphics"
39*4882a593Smuzhiyun #define DRIVER_NAME		"sis"
40*4882a593Smuzhiyun #define DRIVER_DESC		"SIS 300/630/540 and XGI V3XE/V5/V8"
41*4882a593Smuzhiyun #define DRIVER_DATE		"20070626"
42*4882a593Smuzhiyun #define DRIVER_MAJOR		1
43*4882a593Smuzhiyun #define DRIVER_MINOR		3
44*4882a593Smuzhiyun #define DRIVER_PATCHLEVEL	0
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun enum sis_family {
47*4882a593Smuzhiyun 	SIS_OTHER = 0,
48*4882a593Smuzhiyun 	SIS_CHIP_315 = 1,
49*4882a593Smuzhiyun };
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun #define SIS_READ(reg)         readl(((void __iomem *)dev_priv->mmio->handle) + (reg))
52*4882a593Smuzhiyun #define SIS_WRITE(reg, val)   writel(val, ((void __iomem *)dev_priv->mmio->handle) + (reg))
53*4882a593Smuzhiyun 
54*4882a593Smuzhiyun typedef struct drm_sis_private {
55*4882a593Smuzhiyun 	drm_local_map_t *mmio;
56*4882a593Smuzhiyun 	unsigned int idle_fault;
57*4882a593Smuzhiyun 	unsigned int chipset;
58*4882a593Smuzhiyun 	int vram_initialized;
59*4882a593Smuzhiyun 	int agp_initialized;
60*4882a593Smuzhiyun 	unsigned long vram_offset;
61*4882a593Smuzhiyun 	unsigned long agp_offset;
62*4882a593Smuzhiyun 	struct drm_mm vram_mm;
63*4882a593Smuzhiyun 	struct drm_mm agp_mm;
64*4882a593Smuzhiyun 	/** Mapping of userspace keys to mm objects */
65*4882a593Smuzhiyun 	struct idr object_idr;
66*4882a593Smuzhiyun } drm_sis_private_t;
67*4882a593Smuzhiyun 
68*4882a593Smuzhiyun struct sis_file_private {
69*4882a593Smuzhiyun 	struct list_head obj_list;
70*4882a593Smuzhiyun };
71*4882a593Smuzhiyun 
72*4882a593Smuzhiyun extern int sis_idle(struct drm_device *dev);
73*4882a593Smuzhiyun extern void sis_reclaim_buffers_locked(struct drm_device *dev,
74*4882a593Smuzhiyun 				       struct drm_file *file_priv);
75*4882a593Smuzhiyun extern void sis_lastclose(struct drm_device *dev);
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun extern const struct drm_ioctl_desc sis_ioctls[];
78*4882a593Smuzhiyun extern int sis_max_ioctl;
79*4882a593Smuzhiyun 
80*4882a593Smuzhiyun #endif
81