- Update to 2.6.25-rc3.
[linux-flexiantxendom0-3.2.10.git] / drivers / video / sis / sis.h
1 /*
2  * SiS 300/540/630[S]/730[S],
3  * SiS 315[E|PRO]/550/[M]65x/[M]661[F|M]X/740/[M]741[GX]/330/[M]76x[GX],
4  * XGI V3XT/V5/V8, Z7
5  * frame buffer driver for Linux kernels >=2.4.14 and >=2.6.3
6  *
7  * Copyright (C) 2001-2005 Thomas Winischhofer, Vienna, Austria.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the named License,
12  * or any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
22  */
23
24 #ifndef _SIS_H_
25 #define _SIS_H_
26
27 #include <linux/version.h>
28
29 #include "osdef.h"
30 #include <video/sisfb.h>
31
32 #include "vgatypes.h"
33 #include "vstruct.h"
34
35 #define VER_MAJOR               1
36 #define VER_MINOR               8
37 #define VER_LEVEL               9
38
39 #include <linux/spinlock.h>
40
41 #ifdef CONFIG_COMPAT
42 #define SIS_NEW_CONFIG_COMPAT
43 #endif  /* CONFIG_COMPAT */
44
45 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
46 #define SIS_IOTYPE1 void __iomem
47 #define SIS_IOTYPE2 __iomem
48 #define SISINITSTATIC static
49 #else
50 #define SIS_IOTYPE1 unsigned char
51 #define SIS_IOTYPE2
52 #define SISINITSTATIC
53 #endif
54
55 #undef SISFBDEBUG
56
57 #ifdef SISFBDEBUG
58 #define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
59 #define TWDEBUG(x) printk(KERN_INFO x "\n");
60 #else
61 #define DPRINTK(fmt, args...)
62 #define TWDEBUG(x)
63 #endif
64
65 #define SISFAIL(x) do { printk(x "\n"); return -EINVAL; } while(0)
66
67 /* To be included in pci_ids.h */
68 #ifndef PCI_DEVICE_ID_SI_650_VGA
69 #define PCI_DEVICE_ID_SI_650_VGA        0x6325
70 #endif
71 #ifndef PCI_DEVICE_ID_SI_650
72 #define PCI_DEVICE_ID_SI_650            0x0650
73 #endif
74 #ifndef PCI_DEVICE_ID_SI_651
75 #define PCI_DEVICE_ID_SI_651            0x0651
76 #endif
77 #ifndef PCI_DEVICE_ID_SI_740
78 #define PCI_DEVICE_ID_SI_740            0x0740
79 #endif
80 #ifndef PCI_DEVICE_ID_SI_330
81 #define PCI_DEVICE_ID_SI_330            0x0330
82 #endif
83 #ifndef PCI_DEVICE_ID_SI_660_VGA
84 #define PCI_DEVICE_ID_SI_660_VGA        0x6330
85 #endif
86 #ifndef PCI_DEVICE_ID_SI_661
87 #define PCI_DEVICE_ID_SI_661            0x0661
88 #endif
89 #ifndef PCI_DEVICE_ID_SI_741
90 #define PCI_DEVICE_ID_SI_741            0x0741
91 #endif
92 #ifndef PCI_DEVICE_ID_SI_660
93 #define PCI_DEVICE_ID_SI_660            0x0660
94 #endif
95 #ifndef PCI_DEVICE_ID_SI_760
96 #define PCI_DEVICE_ID_SI_760            0x0760
97 #endif
98 #ifndef PCI_DEVICE_ID_SI_761
99 #define PCI_DEVICE_ID_SI_761            0x0761
100 #endif
101
102 #ifndef PCI_VENDOR_ID_XGI
103 #define PCI_VENDOR_ID_XGI               0x18ca
104 #endif
105
106 #ifndef PCI_DEVICE_ID_XGI_20
107 #define PCI_DEVICE_ID_XGI_20            0x0020
108 #endif
109
110 #ifndef PCI_DEVICE_ID_XGI_40
111 #define PCI_DEVICE_ID_XGI_40            0x0040
112 #endif
113
114 /* To be included in fb.h */
115 #ifndef FB_ACCEL_SIS_GLAMOUR_2
116 #define FB_ACCEL_SIS_GLAMOUR_2  40      /* SiS 315, 65x, 740, 661, 741  */
117 #endif
118 #ifndef FB_ACCEL_SIS_XABRE
119 #define FB_ACCEL_SIS_XABRE      41      /* SiS 330 ("Xabre"), 76x       */
120 #endif
121 #ifndef FB_ACCEL_XGI_VOLARI_V
122 #define FB_ACCEL_XGI_VOLARI_V   47      /* XGI Volari Vx (V3XT, V5, V8) */
123 #endif
124 #ifndef FB_ACCEL_XGI_VOLARI_Z
125 #define FB_ACCEL_XGI_VOLARI_Z   48      /* XGI Volari Z7                */
126 #endif
127
128 /* ivideo->caps */
129 #define HW_CURSOR_CAP           0x80
130 #define TURBO_QUEUE_CAP         0x40
131 #define AGP_CMD_QUEUE_CAP       0x20
132 #define VM_CMD_QUEUE_CAP        0x10
133 #define MMIO_CMD_QUEUE_CAP      0x08
134
135 /* For 300 series */
136 #define TURBO_QUEUE_AREA_SIZE   (512 * 1024)    /* 512K */
137 #define HW_CURSOR_AREA_SIZE_300 4096            /* 4K */
138
139 /* For 315/Xabre series */
140 #define COMMAND_QUEUE_AREA_SIZE (512 * 1024)    /* 512K */
141 #define COMMAND_QUEUE_AREA_SIZE_Z7 (128 * 1024) /* 128k for XGI Z7 */
142 #define HW_CURSOR_AREA_SIZE_315 16384           /* 16K */
143 #define COMMAND_QUEUE_THRESHOLD 0x1F
144
145 #define SIS_OH_ALLOC_SIZE       4000
146 #define SENTINEL                0x7fffffff
147
148 #define SEQ_ADR                 0x14
149 #define SEQ_DATA                0x15
150 #define DAC_ADR                 0x18
151 #define DAC_DATA                0x19
152 #define CRTC_ADR                0x24
153 #define CRTC_DATA               0x25
154 #define DAC2_ADR                (0x16-0x30)
155 #define DAC2_DATA               (0x17-0x30)
156 #define VB_PART1_ADR            (0x04-0x30)
157 #define VB_PART1_DATA           (0x05-0x30)
158 #define VB_PART2_ADR            (0x10-0x30)
159 #define VB_PART2_DATA           (0x11-0x30)
160 #define VB_PART3_ADR            (0x12-0x30)
161 #define VB_PART3_DATA           (0x13-0x30)
162 #define VB_PART4_ADR            (0x14-0x30)
163 #define VB_PART4_DATA           (0x15-0x30)
164
165 #define SISSR                   ivideo->SiS_Pr.SiS_P3c4
166 #define SISCR                   ivideo->SiS_Pr.SiS_P3d4
167 #define SISDACA                 ivideo->SiS_Pr.SiS_P3c8
168 #define SISDACD                 ivideo->SiS_Pr.SiS_P3c9
169 #define SISPART1                ivideo->SiS_Pr.SiS_Part1Port
170 #define SISPART2                ivideo->SiS_Pr.SiS_Part2Port
171 #define SISPART3                ivideo->SiS_Pr.SiS_Part3Port
172 #define SISPART4                ivideo->SiS_Pr.SiS_Part4Port
173 #define SISPART5                ivideo->SiS_Pr.SiS_Part5Port
174 #define SISDAC2A                SISPART5
175 #define SISDAC2D                (SISPART5 + 1)
176 #define SISMISCR                (ivideo->SiS_Pr.RelIO + 0x1c)
177 #define SISMISCW                ivideo->SiS_Pr.SiS_P3c2
178 #define SISINPSTAT              (ivideo->SiS_Pr.RelIO + 0x2a)
179 #define SISPEL                  ivideo->SiS_Pr.SiS_P3c6
180 #define SISVGAENABLE            (ivideo->SiS_Pr.RelIO + 0x13)
181 #define SISVID                  (ivideo->SiS_Pr.RelIO + 0x02 - 0x30)
182 #define SISCAP                  (ivideo->SiS_Pr.RelIO + 0x00 - 0x30)
183
184 #define IND_SIS_PASSWORD                0x05  /* SRs */
185 #define IND_SIS_COLOR_MODE              0x06
186 #define IND_SIS_RAMDAC_CONTROL          0x07
187 #define IND_SIS_DRAM_SIZE               0x14
188 #define IND_SIS_MODULE_ENABLE           0x1E
189 #define IND_SIS_PCI_ADDRESS_SET         0x20
190 #define IND_SIS_TURBOQUEUE_ADR          0x26
191 #define IND_SIS_TURBOQUEUE_SET          0x27
192 #define IND_SIS_POWER_ON_TRAP           0x38
193 #define IND_SIS_POWER_ON_TRAP2          0x39
194 #define IND_SIS_CMDQUEUE_SET            0x26
195 #define IND_SIS_CMDQUEUE_THRESHOLD      0x27
196
197 #define IND_SIS_AGP_IO_PAD      0x48
198
199 #define SIS_CRT2_WENABLE_300    0x24  /* Part1 */
200 #define SIS_CRT2_WENABLE_315    0x2F
201
202 #define SIS_PASSWORD            0x86  /* SR05 */
203
204 #define SIS_INTERLACED_MODE     0x20  /* SR06 */
205 #define SIS_8BPP_COLOR_MODE     0x0
206 #define SIS_15BPP_COLOR_MODE    0x1
207 #define SIS_16BPP_COLOR_MODE    0x2
208 #define SIS_32BPP_COLOR_MODE    0x4
209
210 #define SIS_ENABLE_2D           0x40  /* SR1E */
211
212 #define SIS_MEM_MAP_IO_ENABLE   0x01  /* SR20 */
213 #define SIS_PCI_ADDR_ENABLE     0x80
214
215 #define SIS_AGP_CMDQUEUE_ENABLE         0x80  /* 315/330/340 series SR26 */
216 #define SIS_VRAM_CMDQUEUE_ENABLE        0x40
217 #define SIS_MMIO_CMD_ENABLE             0x20
218 #define SIS_CMD_QUEUE_SIZE_512k         0x00
219 #define SIS_CMD_QUEUE_SIZE_1M           0x04
220 #define SIS_CMD_QUEUE_SIZE_2M           0x08
221 #define SIS_CMD_QUEUE_SIZE_4M           0x0C
222 #define SIS_CMD_QUEUE_RESET             0x01
223 #define SIS_CMD_AUTO_CORR               0x02
224
225 #define SIS_CMD_QUEUE_SIZE_Z7_64k       0x00 /* XGI Z7 */
226 #define SIS_CMD_QUEUE_SIZE_Z7_128k      0x04
227
228 #define SIS_SIMULTANEOUS_VIEW_ENABLE    0x01  /* CR30 */
229 #define SIS_MODE_SELECT_CRT2            0x02
230 #define SIS_VB_OUTPUT_COMPOSITE         0x04
231 #define SIS_VB_OUTPUT_SVIDEO            0x08
232 #define SIS_VB_OUTPUT_SCART             0x10
233 #define SIS_VB_OUTPUT_LCD               0x20
234 #define SIS_VB_OUTPUT_CRT2              0x40
235 #define SIS_VB_OUTPUT_HIVISION          0x80
236
237 #define SIS_VB_OUTPUT_DISABLE   0x20  /* CR31 */
238 #define SIS_DRIVER_MODE         0x40
239
240 #define SIS_VB_COMPOSITE        0x01  /* CR32 */
241 #define SIS_VB_SVIDEO           0x02
242 #define SIS_VB_SCART            0x04
243 #define SIS_VB_LCD              0x08
244 #define SIS_VB_CRT2             0x10
245 #define SIS_CRT1                0x20
246 #define SIS_VB_HIVISION         0x40
247 #define SIS_VB_YPBPR            0x80
248 #define SIS_VB_TV               (SIS_VB_COMPOSITE | SIS_VB_SVIDEO | \
249                                 SIS_VB_SCART | SIS_VB_HIVISION | SIS_VB_YPBPR)
250
251 #define SIS_EXTERNAL_CHIP_MASK                  0x0E  /* CR37 (< SiS 660) */
252 #define SIS_EXTERNAL_CHIP_SIS301                0x01  /* in CR37 << 1 ! */
253 #define SIS_EXTERNAL_CHIP_LVDS                  0x02
254 #define SIS_EXTERNAL_CHIP_TRUMPION              0x03
255 #define SIS_EXTERNAL_CHIP_LVDS_CHRONTEL         0x04
256 #define SIS_EXTERNAL_CHIP_CHRONTEL              0x05
257 #define SIS310_EXTERNAL_CHIP_LVDS               0x02
258 #define SIS310_EXTERNAL_CHIP_LVDS_CHRONTEL      0x03
259
260 #define SIS_AGP_2X              0x20  /* CR48 */
261
262 /* vbflags, private entries (others in sisfb.h) */
263 #define VB_CONEXANT             0x00000800      /* 661 series only */
264 #define VB_TRUMPION             VB_CONEXANT     /* 300 series only */
265 #define VB_302ELV               0x00004000
266 #define VB_301                  0x00100000      /* Video bridge type */
267 #define VB_301B                 0x00200000
268 #define VB_302B                 0x00400000
269 #define VB_30xBDH               0x00800000      /* 30xB DH version (w/o LCD support) */
270 #define VB_LVDS                 0x01000000
271 #define VB_CHRONTEL             0x02000000
272 #define VB_301LV                0x04000000
273 #define VB_302LV                0x08000000
274 #define VB_301C                 0x10000000
275
276 #define VB_SISBRIDGE            (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)
277 #define VB_VIDEOBRIDGE          (VB_SISBRIDGE | VB_LVDS | VB_CHRONTEL | VB_CONEXANT)
278
279 /* vbflags2 (static stuff only!) */
280 #define VB2_SISUMC              0x00000001
281 #define VB2_301                 0x00000002      /* Video bridge type */
282 #define VB2_301B                0x00000004
283 #define VB2_301C                0x00000008
284 #define VB2_307T                0x00000010
285 #define VB2_302B                0x00000800
286 #define VB2_301LV               0x00001000
287 #define VB2_302LV               0x00002000
288 #define VB2_302ELV              0x00004000
289 #define VB2_307LV               0x00008000
290 #define VB2_30xBDH              0x08000000      /* 30xB DH version (w/o LCD support) */
291 #define VB2_CONEXANT            0x10000000
292 #define VB2_TRUMPION            0x20000000
293 #define VB2_LVDS                0x40000000
294 #define VB2_CHRONTEL            0x80000000
295
296 #define VB2_SISLVDSBRIDGE       (VB2_301LV | VB2_302LV | VB2_302ELV | VB2_307LV)
297 #define VB2_SISTMDSBRIDGE       (VB2_301   | VB2_301B  | VB2_301C   | VB2_302B | VB2_307T)
298 #define VB2_SISBRIDGE           (VB2_SISLVDSBRIDGE | VB2_SISTMDSBRIDGE)
299
300 #define VB2_SISTMDSLCDABRIDGE   (VB2_301C | VB2_307T)
301 #define VB2_SISLCDABRIDGE       (VB2_SISTMDSLCDABRIDGE | VB2_301LV | VB2_302LV | VB2_302ELV | VB2_307LV)
302
303 #define VB2_SISHIVISIONBRIDGE   (VB2_301  | VB2_301B | VB2_302B)
304 #define VB2_SISYPBPRBRIDGE      (VB2_301C | VB2_307T | VB2_SISLVDSBRIDGE)
305 #define VB2_SISYPBPRARBRIDGE    (VB2_301C | VB2_307T | VB2_307LV)
306 #define VB2_SISTAP4SCALER       (VB2_301C | VB2_307T | VB2_302ELV | VB2_307LV)
307 #define VB2_SISTVBRIDGE         (VB2_SISHIVISIONBRIDGE | VB2_SISYPBPRBRIDGE)
308
309 #define VB2_SISVGA2BRIDGE       (VB2_301 | VB2_301B | VB2_301C | VB2_302B | VB2_307T)
310
311 #define VB2_VIDEOBRIDGE         (VB2_SISBRIDGE | VB2_LVDS | VB2_CHRONTEL | VB2_CONEXANT)
312
313 #define VB2_30xB                (VB2_301B  | VB2_301C   | VB2_302B  | VB2_307T)
314 #define VB2_30xBLV              (VB2_30xB  | VB2_SISLVDSBRIDGE)
315 #define VB2_30xC                (VB2_301C  | VB2_307T)
316 #define VB2_30xCLV              (VB2_301C  | VB2_307T   | VB2_302ELV| VB2_307LV)
317 #define VB2_SISEMIBRIDGE        (VB2_302LV | VB2_302ELV | VB2_307LV)
318 #define VB2_LCD162MHZBRIDGE     (VB2_301C  | VB2_307T)
319 #define VB2_LCDOVER1280BRIDGE   (VB2_301C  | VB2_307T   | VB2_302LV | VB2_302ELV | VB2_307LV)
320 #define VB2_LCDOVER1600BRIDGE   (VB2_307T  | VB2_307LV)
321 #define VB2_RAMDAC202MHZBRIDGE  (VB2_301C  | VB2_307T)
322
323 /* I/O port access macros */
324 #define inSISREG(base)          inb(base)
325
326 #define outSISREG(base,val)     outb(val,base)
327
328 #define orSISREG(base,val)                              \
329                 do {                                    \
330                         u8 __Temp = inSISREG(base);     \
331                         outSISREG(base, __Temp | (val));\
332                 } while (0)
333
334 #define andSISREG(base,val)                             \
335                 do {                                    \
336                         u8 __Temp = inSISREG(base);     \
337                         outSISREG(base, __Temp & (val));\
338                 } while (0)
339
340 #define inSISIDXREG(base,idx,var)                       \
341                 do {                                    \
342                         outSISREG(base, idx);           \
343                         var = inSISREG((base)+1);       \
344                 } while (0)
345
346 #define outSISIDXREG(base,idx,val)                      \
347                 do {                                    \
348                         outSISREG(base, idx);           \
349                         outSISREG((base)+1, val);       \
350                 } while (0)
351
352 #define orSISIDXREG(base,idx,val)                               \
353                 do {                                            \
354                         u8 __Temp;                              \
355                         outSISREG(base, idx);                   \
356                         __Temp = inSISREG((base)+1) | (val);    \
357                         outSISREG((base)+1, __Temp);            \
358                 } while (0)
359
360 #define andSISIDXREG(base,idx,and)                              \
361                 do {                                            \
362                         u8 __Temp;                              \
363                         outSISREG(base, idx);                   \
364                         __Temp = inSISREG((base)+1) & (and);    \
365                         outSISREG((base)+1, __Temp);            \
366                 } while (0)
367
368 #define setSISIDXREG(base,idx,and,or)                                   \
369                 do {                                                    \
370                         u8 __Temp;                                      \
371                         outSISREG(base, idx);                           \
372                         __Temp = (inSISREG((base)+1) & (and)) | (or);   \
373                         outSISREG((base)+1, __Temp);                    \
374                 } while (0)
375
376 /* MMIO access macros */
377 #define MMIO_IN8(base, offset)  readb((base+offset))
378 #define MMIO_IN16(base, offset) readw((base+offset))
379 #define MMIO_IN32(base, offset) readl((base+offset))
380
381 #define MMIO_OUT8(base, offset, val)  writeb(((u8)(val)), (base+offset))
382 #define MMIO_OUT16(base, offset, val) writew(((u16)(val)), (base+offset))
383 #define MMIO_OUT32(base, offset, val) writel(((u32)(val)), (base+offset))
384
385 /* Queue control MMIO registers */
386 #define Q_BASE_ADDR             0x85C0  /* Base address of software queue */
387 #define Q_WRITE_PTR             0x85C4  /* Current write pointer */
388 #define Q_READ_PTR              0x85C8  /* Current read pointer */
389 #define Q_STATUS                0x85CC  /* queue status */
390
391 #define MMIO_QUEUE_PHYBASE      Q_BASE_ADDR
392 #define MMIO_QUEUE_WRITEPORT    Q_WRITE_PTR
393 #define MMIO_QUEUE_READPORT     Q_READ_PTR
394
395 #ifndef FB_BLANK_UNBLANK
396 #define FB_BLANK_UNBLANK        0
397 #endif
398 #ifndef FB_BLANK_NORMAL
399 #define FB_BLANK_NORMAL         1
400 #endif
401 #ifndef FB_BLANK_VSYNC_SUSPEND
402 #define FB_BLANK_VSYNC_SUSPEND  2
403 #endif
404 #ifndef FB_BLANK_HSYNC_SUSPEND
405 #define FB_BLANK_HSYNC_SUSPEND  3
406 #endif
407 #ifndef FB_BLANK_POWERDOWN
408 #define FB_BLANK_POWERDOWN      4
409 #endif
410
411 enum _SIS_LCD_TYPE {
412     LCD_INVALID = 0,
413     LCD_800x600,
414     LCD_1024x768,
415     LCD_1280x1024,
416     LCD_1280x960,
417     LCD_640x480,
418     LCD_1600x1200,
419     LCD_1920x1440,
420     LCD_2048x1536,
421     LCD_320x240,        /* FSTN */
422     LCD_1400x1050,
423     LCD_1152x864,
424     LCD_1152x768,
425     LCD_1280x768,
426     LCD_1024x600,
427     LCD_320x240_2,      /* DSTN */
428     LCD_320x240_3,      /* DSTN */
429     LCD_848x480,
430     LCD_1280x800,
431     LCD_1680x1050,
432     LCD_1280x720,
433     LCD_1280x854,
434     LCD_CUSTOM,
435     LCD_UNKNOWN
436 };
437
438 enum _SIS_CMDTYPE {
439     MMIO_CMD = 0,
440     AGP_CMD_QUEUE,
441     VM_CMD_QUEUE,
442 };
443
444 struct SIS_OH {
445         struct SIS_OH *poh_next;
446         struct SIS_OH *poh_prev;
447         u32            offset;
448         u32            size;
449 };
450
451 struct SIS_OHALLOC {
452         struct SIS_OHALLOC *poha_next;
453         struct SIS_OH aoh[1];
454 };
455
456 struct SIS_HEAP {
457         struct SIS_OH   oh_free;
458         struct SIS_OH   oh_used;
459         struct SIS_OH   *poh_freelist;
460         struct SIS_OHALLOC *poha_chain;
461         u32             max_freesize;
462         struct sis_video_info *vinfo;
463 };
464
465 /* Our "par" */
466 struct sis_video_info {
467         int             cardnumber;
468         struct fb_info  *memyselfandi;
469
470         struct SiS_Private SiS_Pr;
471
472         struct sisfb_info sisfbinfo;    /* For ioctl SISFB_GET_INFO */
473
474         struct fb_var_screeninfo default_var;
475
476         struct fb_fix_screeninfo sisfb_fix;
477         u32             pseudo_palette[16];
478
479         struct sisfb_monitor {
480                 u16 hmin;
481                 u16 hmax;
482                 u16 vmin;
483                 u16 vmax;
484                 u32 dclockmax;
485                 u8  feature;
486                 bool datavalid;
487         }               sisfb_thismonitor;
488
489         unsigned short  chip_id;        /* PCI ID of chip */
490         unsigned short  chip_vendor;    /* PCI ID of vendor */
491         char            myid[40];
492
493         struct pci_dev  *nbridge;
494         struct pci_dev  *lpcdev;
495
496         int             mni;    /* Mode number index */
497
498         unsigned long   video_size;
499         unsigned long   video_base;
500         unsigned long   mmio_size;
501         unsigned long   mmio_base;
502         unsigned long   vga_base;
503
504         unsigned long   video_offset;
505
506         unsigned long   UMAsize, LFBsize;
507
508         SIS_IOTYPE1     *video_vbase;
509         SIS_IOTYPE1     *mmio_vbase;
510
511         unsigned char   *bios_abase;
512
513         int             mtrr;
514
515         u32             sisfb_mem;
516
517         u32             sisfb_parm_mem;
518         int             sisfb_accel;
519         int             sisfb_ypan;
520         int             sisfb_max;
521         int             sisfb_userom;
522         int             sisfb_useoem;
523         int             sisfb_mode_idx;
524         int             sisfb_parm_rate;
525         int             sisfb_crt1off;
526         int             sisfb_forcecrt1;
527         int             sisfb_crt2type;
528         int             sisfb_crt2flags;
529         int             sisfb_dstn;
530         int             sisfb_fstn;
531         int             sisfb_tvplug;
532         int             sisfb_tvstd;
533         int             sisfb_nocrt2rate;
534
535         u32             heapstart;              /* offset  */
536         SIS_IOTYPE1     *sisfb_heap_start;      /* address */
537         SIS_IOTYPE1     *sisfb_heap_end;        /* address */
538         u32             sisfb_heap_size;
539         int             havenoheap;
540
541         struct SIS_HEAP sisfb_heap;             /* This card's vram heap */
542
543         int             video_bpp;
544         int             video_cmap_len;
545         int             video_width;
546         int             video_height;
547         unsigned int    refresh_rate;
548
549         unsigned int    chip;
550         u8              revision_id;
551         int             sisvga_enabled;         /* PCI device was enabled */
552
553         int             video_linelength;       /* real pitch */
554         int             scrnpitchCRT1;          /* pitch regarding interlace */
555
556         u16             DstColor;               /* For 2d acceleration */
557         u32             SiS310_AccelDepth;
558         u32             CommandReg;
559         int             cmdqueuelength;         /* Current (for accel) */
560         u32             cmdQueueSize;           /* Total size in KB */
561
562         spinlock_t      lockaccel;              /* Do not use outside of kernel! */
563
564         unsigned int    pcibus;
565         unsigned int    pcislot;
566         unsigned int    pcifunc;
567
568         int             accel;
569         int             engineok;
570
571         u16             subsysvendor;
572         u16             subsysdevice;
573
574         u32             vbflags;                /* Replacing deprecated stuff from above */
575         u32             currentvbflags;
576         u32             vbflags2;
577
578         int             lcdxres, lcdyres;
579         int             lcddefmodeidx, tvdefmodeidx, defmodeidx;
580         u32             CRT2LCDType;            /* defined in "SIS_LCD_TYPE" */
581         u32             curFSTN, curDSTN;
582
583         int             current_bpp;
584         int             current_width;
585         int             current_height;
586         int             current_htotal;
587         int             current_vtotal;
588         int             current_linelength;
589         __u32           current_pixclock;
590         int             current_refresh_rate;
591
592         unsigned int    current_base;
593
594         u8              mode_no;
595         u8              rate_idx;
596         int             modechanged;
597         unsigned char   modeprechange;
598
599         u8              sisfb_lastrates[128];
600
601         int             newrom;
602         int             haveXGIROM;
603         int             registered;
604         int             warncount;
605
606         int             sisvga_engine;
607         int             hwcursor_size;
608         int             CRT2_write_enable;
609         u8              caps;
610
611         u8              detectedpdc;
612         u8              detectedpdca;
613         u8              detectedlcda;
614
615         SIS_IOTYPE1     *hwcursor_vbase;
616
617         int             chronteltype;
618         int             tvxpos, tvypos;
619         u8              p2_1f,p2_20,p2_2b,p2_42,p2_43,p2_01,p2_02;
620         int             tvx, tvy;
621
622         u8              sisfblocked;
623
624         struct sisfb_info sisfb_infoblock;
625
626         struct sisfb_cmd sisfb_command;
627
628         u32             sisfb_id;
629
630         u8              sisfb_can_post;
631         u8              sisfb_card_posted;
632         u8              sisfb_was_boot_device;
633
634         struct sis_video_info *next;
635 };
636
637 #endif