Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
[pandora-kernel.git] / drivers / staging / xgifb / vgatypes.h
1
2 #ifndef _VGATYPES_
3 #define _VGATYPES_
4
5 #include "osdef.h"
6
7 #ifdef LINUX_XF86
8 #include "xf86Version.h"
9 #include "xf86Pci.h"
10 #endif
11
12 #ifdef LINUX_KERNEL  /* We don't want the X driver to depend on kernel source */
13 #include <linux/ioctl.h>
14 #endif
15
16 #ifndef FALSE
17 #define FALSE   0
18 #endif
19
20 #ifndef TRUE
21 #define TRUE    1
22 #endif
23
24 #ifndef NULL
25 #define NULL    0
26 #endif
27
28 #ifndef CHAR
29 typedef char CHAR;
30 #endif
31
32 #ifndef SHORT
33 typedef short SHORT;
34 #endif
35
36 #ifndef LONG
37 typedef long  LONG;
38 #endif
39
40 #ifndef UCHAR
41 typedef unsigned char UCHAR;
42 #endif
43
44 #ifndef USHORT
45 typedef unsigned short USHORT;
46 #endif
47
48 #ifndef ULONG
49 typedef unsigned long ULONG;
50 #endif
51
52 #ifndef PUCHAR
53 typedef UCHAR *PUCHAR;
54 #endif
55
56 #ifndef PUSHORT
57 typedef USHORT *PUSHORT;
58 #endif
59
60 #ifndef PLONGU
61 typedef ULONG *PULONG;
62 #endif
63
64 #ifndef VOID
65 typedef void VOID;
66 #endif
67
68 #ifndef PVOID
69 typedef void *PVOID;
70 #endif
71
72 #ifndef BOOLEAN
73 typedef UCHAR BOOLEAN;
74 #endif
75 /*
76 #ifndef bool
77 typedef UCHAR bool;
78 #endif
79 */
80 #ifdef LINUX_KERNEL
81 typedef unsigned long XGIIOADDRESS;
82 #endif
83
84 #ifdef LINUX_XF86
85 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,0,0,0)
86 typedef unsigned char IOADDRESS;
87 typedef unsigned char XGIIOADDRESS;
88 #else
89 typedef IOADDRESS XGIIOADDRESS;
90 #endif
91 #endif
92
93 #ifndef VBIOS_VER_MAX_LENGTH
94 #define VBIOS_VER_MAX_LENGTH    4
95 #endif
96
97 #ifndef WIN2000
98
99 #ifndef LINUX_KERNEL   /* For the linux kernel, this is defined in xgifb.h */
100 #ifndef XGI_CHIP_TYPE
101 typedef enum _XGI_CHIP_TYPE {
102     XGI_VGALegacy = 0,
103 #ifdef LINUX_XF86
104     XGI_530,
105     XGI_OLD,
106 #endif
107     XGI_300,
108     XGI_630,
109     XGI_640,
110     XGI_315H,
111     XGI_315,
112     XGI_315PRO,
113     XGI_550,
114     XGI_650,
115     XGI_650M,
116     XGI_740,
117     XGI_330,
118     XGI_661,
119     XGI_660,
120     XGI_760,
121     XG40 = 32,
122     XG41,
123     XG42,
124     XG45,
125     XG20 = 48,
126     XG21,
127     XG27,
128     MAX_XGI_CHIP
129 } XGI_CHIP_TYPE;
130 #endif
131 #endif
132
133 #ifndef XGI_VB_CHIP_TYPE
134 typedef enum _XGI_VB_CHIP_TYPE {
135     VB_CHIP_Legacy = 0,
136     VB_CHIP_301,
137     VB_CHIP_301B,
138     VB_CHIP_301LV,
139     VB_CHIP_302,
140     VB_CHIP_302B,
141     VB_CHIP_302LV,
142     VB_CHIP_301C,
143     VB_CHIP_302ELV,
144     VB_CHIP_UNKNOWN, /* other video bridge or no video bridge */
145     MAX_VB_CHIP
146 } XGI_VB_CHIP_TYPE;
147 #endif
148
149 #ifndef XGI_LCD_TYPE
150 typedef enum _XGI_LCD_TYPE {
151     LCD_INVALID = 0,
152     LCD_320x480,       /* FSTN, DSTN */
153     LCD_640x480,
154     LCD_640x480_2,     /* FSTN, DSTN */
155     LCD_640x480_3,     /* FSTN, DSTN */
156     LCD_800x600,
157     LCD_848x480,
158     LCD_1024x600,
159     LCD_1024x768,
160     LCD_1152x768,
161     LCD_1152x864,
162     LCD_1280x720,
163     LCD_1280x768,
164     LCD_1280x800,
165     LCD_1280x960,
166     LCD_1280x1024,
167     LCD_1400x1050,
168     LCD_1600x1200,
169     LCD_1680x1050,
170     LCD_1920x1440,
171     LCD_2048x1536,
172     LCD_CUSTOM,
173     LCD_UNKNOWN
174 } XGI_LCD_TYPE;
175 #endif
176
177 #endif   /* not WIN2000 */
178
179 #ifndef PXGI_DSReg
180 typedef struct _XGI_DSReg
181 {
182   UCHAR  jIdx;
183   UCHAR  jVal;
184 } XGI_DSReg, *PXGI_DSReg;
185 #endif
186
187 #ifndef XGI_HW_DEVICE_INFO
188
189 typedef struct _XGI_HW_DEVICE_INFO  XGI_HW_DEVICE_INFO, *PXGI_HW_DEVICE_INFO;
190
191 typedef BOOLEAN (*PXGI_QUERYSPACE)   (PXGI_HW_DEVICE_INFO, ULONG, ULONG, ULONG *);
192
193 struct _XGI_HW_DEVICE_INFO
194 {
195     ULONG  ulExternalChip;       /* NO VB or other video bridge*/
196                                  /* if ujVBChipID = VB_CHIP_UNKNOWN, */
197 #ifdef LINUX_XF86
198     PCITAG PciTag;               /* PCI Tag */
199 #endif
200
201     PUCHAR  pjVirtualRomBase;    /* ROM image */
202
203     BOOLEAN UseROM;              /* Use the ROM image if provided */
204
205     PVOID   pDevice;
206
207     PUCHAR  pjVideoMemoryAddress;/* base virtual memory address */
208                                  /* of Linear VGA memory */
209
210     ULONG  ulVideoMemorySize;    /* size, in bytes, of the memory on the board */
211
212     PUCHAR pjIOAddress;          /* base I/O address of VGA ports (0x3B0) */
213
214     PUCHAR pjCustomizedROMImage;
215
216     PUCHAR pj2ndVideoMemoryAddress;
217     ULONG  ul2ndVideoMemorySize;
218
219     PUCHAR pj2ndIOAddress;
220 /*#ifndef WIN2000
221     XGIIOADDRESS pjIOAddress;   //  base I/O address of VGA ports (0x3B0)
222 #endif */
223     UCHAR  jChipType;            /* Used to Identify Graphics Chip */
224                                  /* defined in the data structure type  */
225                                  /* "XGI_CHIP_TYPE" */
226
227     UCHAR  jChipRevision;        /* Used to Identify Graphics Chip Revision */
228
229     UCHAR  ujVBChipID;           /* the ID of video bridge */
230                                  /* defined in the data structure type */
231                                  /* "XGI_VB_CHIP_TYPE" */
232
233     BOOLEAN    bNewScratch;
234
235     ULONG  ulCRT2LCDType;        /* defined in the data structure type */
236
237     ULONG usExternalChip;       /* NO VB or other video bridge (other than  */
238                                  /*  video bridge) */
239
240     BOOLEAN bIntegratedMMEnabled;/* supporting integration MM enable */
241
242     BOOLEAN bSkipDramSizing;     /* True: Skip video memory sizing. */
243
244     BOOLEAN bSkipSense;
245
246     BOOLEAN bIsPowerSaving;     /* True: XGIInit() is invoked by power management,
247                                    otherwise by 2nd adapter's initialzation */
248
249     PXGI_DSReg  pSR;             /* restore SR registers in initial function. */
250                                  /* end data :(idx, val) =  (FF, FF). */
251                                  /* Note : restore SR registers if  */
252                                  /* bSkipDramSizing = TRUE */
253
254     PXGI_DSReg  pCR;             /* restore CR registers in initial function. */
255                                  /* end data :(idx, val) =  (FF, FF) */
256                                  /* Note : restore cR registers if  */
257                                  /* bSkipDramSizing = TRUE */
258 /*
259 #endif
260 */
261
262     PXGI_QUERYSPACE  pQueryVGAConfigSpace;
263
264     PXGI_QUERYSPACE  pQueryNorthBridgeSpace;
265
266     UCHAR  szVBIOSVer[VBIOS_VER_MAX_LENGTH];
267
268 };
269 #endif
270
271 /* Addtional IOCTL for communication xgifb <> X driver        */
272 /* If changing this, xgifb.h must also be changed (for xgifb) */
273
274 #ifdef LINUX_XF86  /* We don't want the X driver to depend on the kernel source */
275
276 /* ioctl for identifying and giving some info (esp. memory heap start) */
277 #define XGIFB_GET_INFO    0x80046ef8  /* Wow, what a terrible hack... */
278
279 /* Structure argument for XGIFB_GET_INFO ioctl  */
280 typedef struct _XGIFB_INFO xgifb_info, *pxgifb_info;
281
282 struct _XGIFB_INFO {
283         CARD32  xgifb_id;               /* for identifying xgifb */
284 #ifndef XGIFB_ID
285 #define XGIFB_ID          0x53495346    /* Identify myself with 'XGIF' */
286 #endif
287         CARD32  chip_id;                /* PCI ID of detected chip */
288         CARD32  memory;                 /* video memory in KB which xgifb manages */
289         CARD32  heapstart;              /* heap start (= xgifb "mem" argument) in KB */
290         CARD8   fbvidmode;              /* current xgifb mode */
291
292         CARD8   xgifb_version;
293         CARD8   xgifb_revision;
294         CARD8   xgifb_patchlevel;
295
296         CARD8   xgifb_caps;             /* xgifb's capabilities */
297
298         CARD32  xgifb_tqlen;            /* turbo queue length (in KB) */
299
300         CARD32  xgifb_pcibus;           /* The card's PCI ID */
301         CARD32  xgifb_pcislot;
302         CARD32  xgifb_pcifunc;
303
304         CARD8   xgifb_lcdpdc;
305
306         CARD8   xgifb_lcda;
307
308         CARD32  xgifb_vbflags;
309         CARD32  xgifb_currentvbflags;
310
311         CARD32  xgifb_scalelcd;
312         CARD32  xgifb_specialtiming;
313
314         CARD8   xgifb_haveemi;
315         CARD8   xgifb_emi30,xgifb_emi31,xgifb_emi32,xgifb_emi33;
316         CARD8   xgifb_haveemilcd;
317
318         CARD8   xgifb_lcdpdca;
319
320         CARD8 reserved[212];            /* for future use */
321 };
322 #endif
323
324 #endif
325