1 /* $XFree86$ */
2 /* $XdotOrg$ */
3 /*
4  * General type definitions for universal mode switching modules
5  *
6  * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
7  *
8  * If distributed as part of the Linux kernel, the following license terms
9  * apply:
10  *
11  * * This program is free software; you can redistribute it and/or modify
12  * * it under the terms of the GNU General Public License as published by
13  * * the Free Software Foundation; either version 2 of the named License,
14  * * or any later version.
15  * *
16  * * This program is distributed in the hope that it will be useful,
17  * * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * * GNU General Public License for more details.
20  * *
21  * * You should have received a copy of the GNU General Public License
22  * * along with this program; if not, write to the Free Software
23  * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
24  *
25  * Otherwise, the following license terms apply:
26  *
27  * * Redistribution and use in source and binary forms, with or without
28  * * modification, are permitted provided that the following conditions
29  * * are met:
30  * * 1) Redistributions of source code must retain the above copyright
31  * *    notice, this list of conditions and the following disclaimer.
32  * * 2) Redistributions in binary form must reproduce the above copyright
33  * *    notice, this list of conditions and the following disclaimer in the
34  * *    documentation and/or other materials provided with the distribution.
35  * * 3) The name of the author may not be used to endorse or promote products
36  * *    derived from this software without specific prior written permission.
37  * *
38  * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
39  * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
40  * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
41  * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
42  * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
43  * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
44  * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
45  * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
46  * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
47  * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48  *
49  * Author: 	Thomas Winischhofer <thomas@winischhofer.net>
50  *
51  */
52 
53 #ifndef _VGATYPES_
54 #define _VGATYPES_
55 
56 #ifdef LINUX_XF86
57 #include "xf86Version.h"
58 #include "xf86Pci.h"
59 #endif
60 
61 #ifdef LINUX_KERNEL  /* We don't want the X driver to depend on kernel source */
62 #include <linux/ioctl.h>
63 #endif
64 
65 #ifndef FALSE
66 #define FALSE   0
67 #endif
68 
69 #ifndef TRUE
70 #define TRUE    1
71 #endif
72 
73 #ifndef NULL
74 #define NULL    0
75 #endif
76 
77 #ifndef CHAR
78 typedef char CHAR;
79 #endif
80 
81 #ifndef SHORT
82 typedef short SHORT;
83 #endif
84 
85 #ifndef LONG
86 typedef long  LONG;
87 #endif
88 
89 #ifndef UCHAR
90 typedef unsigned char UCHAR;
91 #endif
92 
93 #ifndef USHORT
94 typedef unsigned short USHORT;
95 #endif
96 
97 #ifndef ULONG
98 typedef unsigned long ULONG;
99 #endif
100 
101 #ifndef BOOLEAN
102 typedef UCHAR BOOLEAN;
103 #endif
104 
105 #ifndef bool
106 typedef UCHAR bool;
107 #endif
108 
109 #ifdef LINUX_KERNEL
110 typedef unsigned long SISIOADDRESS;
111 #endif
112 
113 #ifdef LINUX_XF86
114 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,0,0,0)
115 typedef unsigned long IOADDRESS;
116 typedef unsigned long SISIOADDRESS;
117 #else
118 typedef IOADDRESS SISIOADDRESS;
119 #endif
120 #endif
121 
122 enum _SIS_CHIP_TYPE {
123     SIS_VGALegacy = 0,
124     SIS_530,
125     SIS_OLD,
126     SIS_300,
127     SIS_630,
128     SIS_730,
129     SIS_540,
130     SIS_315H,   /* SiS 310 */
131     SIS_315,
132     SIS_315PRO,
133     SIS_550,
134     SIS_650,
135     SIS_740,
136     SIS_330,
137     SIS_661,
138     SIS_741,
139     SIS_660,
140     SIS_760,
141     SIS_761,
142     SIS_340,
143     MAX_SIS_CHIP
144 };
145 
146 #ifdef LINUX_KERNEL
147 enum _SIS_LCD_TYPE {
148     LCD_INVALID = 0,
149     LCD_800x600,
150     LCD_1024x768,
151     LCD_1280x1024,
152     LCD_1280x960,
153     LCD_640x480,
154     LCD_1600x1200,
155     LCD_1920x1440,
156     LCD_2048x1536,
157     LCD_320x480,       /* FSTN */
158     LCD_1400x1050,
159     LCD_1152x864,
160     LCD_1152x768,
161     LCD_1280x768,
162     LCD_1024x600,
163     LCD_640x480_2,     /* DSTN */
164     LCD_640x480_3,     /* DSTN */
165     LCD_848x480,
166     LCD_1280x800,
167     LCD_1680x1050,
168     LCD_1280x720,
169     LCD_CUSTOM,
170     LCD_UNKNOWN
171 };
172 typedef unsigned int SIS_LCD_TYPE;
173 #endif
174 
175 #ifndef SIS_HW_INFO
176 
177 typedef struct _SIS_HW_INFO  SIS_HW_INFO, *PSIS_HW_INFO;
178 
179 typedef BOOLEAN (*PSIS_QUERYSPACE)   (PSIS_HW_INFO, ULONG, ULONG, ULONG *);
180 
181 struct _SIS_HW_INFO
182 {
183 #ifdef LINUX_XF86
184     PCITAG PciTag;		 /* PCI Tag */
185 #endif
186 
187     UCHAR  *pjVirtualRomBase;    /* ROM image */
188 
189     BOOLEAN UseROM;		 /* Use the ROM image if provided */
190 
191     UCHAR  *pjVideoMemoryAddress;/* base virtual memory address */
192                                  /* of Linear VGA memory */
193 
194     ULONG  ulVideoMemorySize;    /* size, in bytes, of the memory on the board */
195 
196     SISIOADDRESS ulIOAddress;    /* base I/O address of VGA ports (0x3B0; relocated) */
197 
198     UCHAR  jChipType;            /* Used to Identify SiS Graphics Chip */
199                                  /* defined in the enum "SIS_CHIP_TYPE" (above or sisfb.h) */
200 
201     UCHAR  jChipRevision;        /* Used to Identify SiS Graphics Chip Revision */
202 
203     BOOLEAN bIntegratedMMEnabled;/* supporting integration MM enable */
204 
205 #ifdef LINUX_KERNEL
206     ULONG  ulCRT2LCDType;        /* defined in the data structure type */
207                                  /* "SIS_LCD_TYPE" */
208 #endif
209 };
210 #endif
211 
212 /* Addtional IOCTLs for communication sisfb <> X driver        */
213 /* If changing this, sisfb.h must also be changed (for sisfb) */
214 
215 #ifdef LINUX_XF86  /* We don't want the X driver to depend on the kernel source */
216 
217 /* ioctl for identifying and giving some info (esp. memory heap start) */
218 #define SISFB_GET_INFO_SIZE	0x8004f300
219 #define SISFB_GET_INFO		0x8000f301  /* Must be patched with result from ..._SIZE at D[29:16] */
220 /* deprecated ioctl number (for older versions of sisfb) */
221 #define SISFB_GET_INFO_OLD    	0x80046ef8
222 
223 /* ioctls for tv parameters (position) */
224 #define SISFB_SET_TVPOSOFFSET   0x4004f304
225 
226 /* lock sisfb from register access */
227 #define SISFB_SET_LOCK		0x4004f306
228 
229 /* Structure argument for SISFB_GET_INFO ioctl  */
230 typedef struct _SISFB_INFO sisfb_info, *psisfb_info;
231 
232 struct _SISFB_INFO {
233 	CARD32 	sisfb_id;         	/* for identifying sisfb */
234 #ifndef SISFB_ID
235 #define SISFB_ID	  0x53495346    /* Identify myself with 'SISF' */
236 #endif
237  	CARD32 	chip_id;		/* PCI ID of detected chip */
238 	CARD32	memory;			/* video memory in KB which sisfb manages */
239 	CARD32	heapstart;             	/* heap start (= sisfb "mem" argument) in KB */
240 	CARD8 	fbvidmode;		/* current sisfb mode */
241 
242 	CARD8 	sisfb_version;
243 	CARD8	sisfb_revision;
244 	CARD8 	sisfb_patchlevel;
245 
246 	CARD8 	sisfb_caps;		/* sisfb's capabilities */
247 
248 	CARD32 	sisfb_tqlen;		/* turbo queue length (in KB) */
249 
250 	CARD32 	sisfb_pcibus;      	/* The card's PCI ID */
251 	CARD32 	sisfb_pcislot;
252 	CARD32 	sisfb_pcifunc;
253 
254 	CARD8 	sisfb_lcdpdc;
255 
256 	CARD8	sisfb_lcda;
257 
258 	CARD32	sisfb_vbflags;
259 	CARD32	sisfb_currentvbflags;
260 
261 	CARD32 	sisfb_scalelcd;
262 	CARD32 	sisfb_specialtiming;
263 
264 	CARD8 	sisfb_haveemi;
265 	CARD8 	sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33;
266 	CARD8 	sisfb_haveemilcd;
267 
268 	CARD8 	sisfb_lcdpdca;
269 
270 	CARD16  sisfb_tvxpos, sisfb_tvypos;  	/* Warning: Values + 32 ! */
271 
272 	CARD8 reserved[208]; 			/* for future use */
273 };
274 #endif
275 
276 #endif
277 
278