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