Linux-2.6.12-rc2
[pandora-kernel.git] / drivers / video / sis / vgatypes.h
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 EXPRESS 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_KERNEL  /* We don't want the X driver to depend on kernel source */
57 #include <linux/ioctl.h>
58 #include <linux/version.h>
59 #endif
60
61 #ifndef FALSE
62 #define FALSE   0
63 #endif
64
65 #ifndef TRUE
66 #define TRUE    1
67 #endif
68
69 #ifndef NULL
70 #define NULL    0
71 #endif
72
73 #ifndef CHAR
74 typedef char CHAR;
75 #endif
76
77 #ifndef SHORT
78 typedef short SHORT;
79 #endif
80
81 #ifndef LONG
82 typedef long  LONG;
83 #endif
84
85 #ifndef UCHAR
86 typedef unsigned char UCHAR;
87 #endif
88
89 #ifndef USHORT
90 typedef unsigned short USHORT;
91 #endif
92
93 #ifndef ULONG
94 typedef unsigned long ULONG;
95 #endif
96
97 #ifndef BOOLEAN
98 typedef unsigned char BOOLEAN;
99 #endif
100
101 #define SISIOMEMTYPE
102
103 #ifdef LINUX_KERNEL
104 typedef unsigned long SISIOADDRESS;
105 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
106 #include <linux/types.h>  /* Need __iomem */
107 #undef SISIOMEMTYPE
108 #define SISIOMEMTYPE __iomem
109 #endif
110 #endif
111
112 #ifdef LINUX_XF86
113 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,0,0,0)
114 typedef unsigned long IOADDRESS;
115 typedef unsigned long SISIOADDRESS;
116 #else
117 typedef IOADDRESS SISIOADDRESS;
118 #endif
119 #endif
120
121 enum _SIS_CHIP_TYPE {
122     SIS_VGALegacy = 0,
123     SIS_530,
124     SIS_OLD,
125     SIS_300,
126     SIS_630,
127     SIS_730,
128     SIS_540,
129     SIS_315H,   /* SiS 310 */
130     SIS_315,
131     SIS_315PRO,
132     SIS_550,
133     SIS_650,
134     SIS_740,
135     SIS_330,
136     SIS_661,
137     SIS_741,
138     SIS_660,
139     SIS_760,
140     SIS_761,
141     SIS_340,
142     MAX_SIS_CHIP
143 };
144
145 #ifndef SIS_HW_INFO
146 typedef struct _SIS_HW_INFO  SIS_HW_INFO, *PSIS_HW_INFO;
147
148 struct _SIS_HW_INFO
149 {
150 #ifdef LINUX_XF86
151     PCITAG PciTag;               /* PCI Tag */
152 #endif
153
154     UCHAR *pjVirtualRomBase;     /* ROM image */
155
156     BOOLEAN UseROM;              /* Use the ROM image if provided */
157
158 #ifdef LINUX_KERNEL
159     UCHAR SISIOMEMTYPE *pjVideoMemoryAddress;
160                                  /* base virtual memory address */
161                                  /* of Linear VGA memory */
162
163     ULONG  ulVideoMemorySize;    /* size, in bytes, of the memory on the board */
164 #endif
165
166     SISIOADDRESS ulIOAddress;    /* base I/O address of VGA ports (0x3B0; relocated) */
167
168     UCHAR  jChipType;            /* Used to Identify SiS Graphics Chip */
169                                  /* defined in the enum "SIS_CHIP_TYPE" (above or sisfb.h) */
170
171     UCHAR  jChipRevision;        /* Used to Identify SiS Graphics Chip Revision */
172
173     BOOLEAN bIntegratedMMEnabled;/* supporting integration MM enable */
174 };
175 #endif
176
177 /* Addtional IOCTLs for communication sisfb <> X driver        */
178 /* If changing this, sisfb.h must also be changed (for sisfb) */
179
180 #ifdef LINUX_XF86  /* We don't want the X driver to depend on the kernel source */
181
182 /* ioctl for identifying and giving some info (esp. memory heap start) */
183 #define SISFB_GET_INFO_SIZE     0x8004f300
184 #define SISFB_GET_INFO          0x8000f301  /* Must be patched with result from ..._SIZE at D[29:16] */
185 /* deprecated ioctl number (for older versions of sisfb) */
186 #define SISFB_GET_INFO_OLD      0x80046ef8
187
188 /* ioctls for tv parameters (position) */
189 #define SISFB_SET_TVPOSOFFSET   0x4004f304
190
191 /* lock sisfb from register access */
192 #define SISFB_SET_LOCK          0x4004f306
193
194 /* Structure argument for SISFB_GET_INFO ioctl  */
195 typedef struct _SISFB_INFO sisfb_info, *psisfb_info;
196
197 struct _SISFB_INFO {
198         CARD32  sisfb_id;               /* for identifying sisfb */
199 #ifndef SISFB_ID
200 #define SISFB_ID          0x53495346    /* Identify myself with 'SISF' */
201 #endif
202         CARD32  chip_id;                /* PCI ID of detected chip */
203         CARD32  memory;                 /* video memory in KB which sisfb manages */
204         CARD32  heapstart;              /* heap start (= sisfb "mem" argument) in KB */
205         CARD8   fbvidmode;              /* current sisfb mode */
206
207         CARD8   sisfb_version;
208         CARD8   sisfb_revision;
209         CARD8   sisfb_patchlevel;
210
211         CARD8   sisfb_caps;             /* sisfb's capabilities */
212
213         CARD32  sisfb_tqlen;            /* turbo queue length (in KB) */
214
215         CARD32  sisfb_pcibus;           /* The card's PCI ID */
216         CARD32  sisfb_pcislot;
217         CARD32  sisfb_pcifunc;
218
219         CARD8   sisfb_lcdpdc;
220
221         CARD8   sisfb_lcda;
222
223         CARD32  sisfb_vbflags;
224         CARD32  sisfb_currentvbflags;
225
226         CARD32  sisfb_scalelcd;
227         CARD32  sisfb_specialtiming;
228
229         CARD8   sisfb_haveemi;
230         CARD8   sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33;
231         CARD8   sisfb_haveemilcd;
232
233         CARD8   sisfb_lcdpdca;
234
235         CARD16  sisfb_tvxpos, sisfb_tvypos;     /* Warning: Values + 32 ! */
236
237         CARD8 reserved[208];                    /* for future use */
238 };
239 #endif
240
241 #endif
242