Root/drivers/staging/xgifb/XGI_main.h

1#ifndef _XGIFB_MAIN
2#define _XGIFB_MAIN
3/* ------------------- Constant Definitions ------------------------- */
4#include "XGIfb.h"
5#include "vb_def.h"
6
7#ifndef PCI_DEVICE_ID_XGI_42
8#define PCI_DEVICE_ID_XGI_42 0x042
9#endif
10#ifndef PCI_DEVICE_ID_XGI_27
11#define PCI_DEVICE_ID_XGI_27 0x027
12#endif
13
14static DEFINE_PCI_DEVICE_TABLE(xgifb_pci_table) = {
15    {PCI_DEVICE(PCI_VENDOR_ID_XGI, PCI_DEVICE_ID_XGI_20)},
16    {PCI_DEVICE(PCI_VENDOR_ID_XGI, PCI_DEVICE_ID_XGI_27)},
17    {PCI_DEVICE(PCI_VENDOR_ID_XGI, PCI_DEVICE_ID_XGI_40)},
18    {PCI_DEVICE(PCI_VENDOR_ID_XGI, PCI_DEVICE_ID_XGI_42)},
19    {0}
20};
21
22MODULE_DEVICE_TABLE(pci, xgifb_pci_table);
23
24/* To be included in fb.h */
25#define XGISR (xgifb_info->dev_info.P3c4)
26#define XGICR (xgifb_info->dev_info.P3d4)
27#define XGIDACA (xgifb_info->dev_info.P3c8)
28#define XGIDACD (xgifb_info->dev_info.P3c9)
29#define XGIPART1 (xgifb_info->dev_info.Part1Port)
30#define XGIPART2 (xgifb_info->dev_info.Part2Port)
31#define XGIPART3 (xgifb_info->dev_info.Part3Port)
32#define XGIPART4 (xgifb_info->dev_info.Part4Port)
33#define XGIPART5 (xgifb_info->dev_info.Part5Port)
34#define XGIDAC2A XGIPART5
35#define XGIDAC2D (XGIPART5 + 1)
36
37#define IND_XGI_SCRATCH_REG_CR30 0x30 /* CRs */
38#define IND_XGI_SCRATCH_REG_CR31 0x31
39#define IND_XGI_SCRATCH_REG_CR32 0x32
40#define IND_XGI_SCRATCH_REG_CR33 0x33
41#define IND_XGI_LCD_PANEL 0x36
42#define IND_XGI_SCRATCH_REG_CR37 0x37
43
44#define XGI_DRAM_SIZE_MASK 0xF0 /*SR14 */
45#define XGI_DRAM_SIZE_1MB 0x00
46#define XGI_DRAM_SIZE_2MB 0x01
47#define XGI_DRAM_SIZE_4MB 0x02
48#define XGI_DRAM_SIZE_8MB 0x03
49#define XGI_DRAM_SIZE_16MB 0x04
50#define XGI_DRAM_SIZE_32MB 0x05
51#define XGI_DRAM_SIZE_64MB 0x06
52#define XGI_DRAM_SIZE_128MB 0x07
53#define XGI_DRAM_SIZE_256MB 0x08
54
55/* ------------------- Global Variables ----------------------------- */
56
57/* display status */
58static int XGIfb_crt1off;
59static int XGIfb_forcecrt1 = -1;
60
61/* global flags */
62static int XGIfb_tvmode;
63static int enable_dstn;
64static int XGIfb_ypan = -1;
65
66/* TW: CRT2 type (for overriding autodetection) */
67static int XGIfb_crt2type = -1;
68/* PR: Tv plug type (for overriding autodetection) */
69static int XGIfb_tvplug = -1;
70
71#define MD_XGI315 1
72
73/* mode table */
74static const struct _XGIbios_mode {
75    u8 mode_no;
76    u16 vesa_mode_no_1; /* "XGI defined" VESA mode number */
77    u16 vesa_mode_no_2; /* Real VESA mode numbers */
78    u16 xres;
79    u16 yres;
80    u16 bpp;
81    u8 chipset;
82} XGIbios_mode[] = {
83    { 0x56, 0x0000, 0x0000, 320, 240, 16, MD_XGI315 },
84    { 0x5A, 0x0000, 0x0000, 320, 480, 8, MD_XGI315 },
85    { 0x5B, 0x0000, 0x0000, 320, 480, 16, MD_XGI315 },
86    { 0x2E, 0x0101, 0x0101, 640, 480, 8, MD_XGI315 },
87    { 0x44, 0x0111, 0x0111, 640, 480, 16, MD_XGI315 },
88    { 0x62, 0x013a, 0x0112, 640, 480, 32, MD_XGI315 },
89    { 0x31, 0x0000, 0x0000, 720, 480, 8, MD_XGI315 },
90    { 0x33, 0x0000, 0x0000, 720, 480, 16, MD_XGI315 },
91    { 0x35, 0x0000, 0x0000, 720, 480, 32, MD_XGI315 },
92    { 0x32, 0x0000, 0x0000, 720, 576, 8, MD_XGI315 },
93    { 0x34, 0x0000, 0x0000, 720, 576, 16, MD_XGI315 },
94    { 0x36, 0x0000, 0x0000, 720, 576, 32, MD_XGI315 },
95    { 0x36, 0x0000, 0x0000, 720, 576, 32, MD_XGI315 },
96    { 0x70, 0x0000, 0x0000, 800, 480, 8, MD_XGI315 },
97    { 0x7a, 0x0000, 0x0000, 800, 480, 16, MD_XGI315 },
98    { 0x76, 0x0000, 0x0000, 800, 480, 32, MD_XGI315 },
99    { 0x30, 0x0103, 0x0103, 800, 600, 8, MD_XGI315 },
100#define DEFAULT_MODE 17 /* index for 800x600x16 */
101    { 0x47, 0x0114, 0x0114, 800, 600, 16, MD_XGI315 },
102    { 0x63, 0x013b, 0x0115, 800, 600, 32, MD_XGI315 },
103    { 0x71, 0x0000, 0x0000, 1024, 576, 8, MD_XGI315 },
104    { 0x74, 0x0000, 0x0000, 1024, 576, 16, MD_XGI315 },
105    { 0x77, 0x0000, 0x0000, 1024, 576, 32, MD_XGI315 },
106    { 0x77, 0x0000, 0x0000, 1024, 576, 32, MD_XGI315 },
107    { 0x20, 0x0000, 0x0000, 1024, 600, 8, },
108    { 0x21, 0x0000, 0x0000, 1024, 600, 16, },
109    { 0x22, 0x0000, 0x0000, 1024, 600, 32, },
110    { 0x38, 0x0105, 0x0105, 1024, 768, 8, MD_XGI315 },
111    { 0x4A, 0x0117, 0x0117, 1024, 768, 16, MD_XGI315 },
112    { 0x64, 0x013c, 0x0118, 1024, 768, 32, MD_XGI315 },
113    { 0x64, 0x013c, 0x0118, 1024, 768, 32, MD_XGI315 },
114    { 0x23, 0x0000, 0x0000, 1152, 768, 8, },
115    { 0x24, 0x0000, 0x0000, 1152, 768, 16, },
116    { 0x25, 0x0000, 0x0000, 1152, 768, 32, },
117    { 0x79, 0x0000, 0x0000, 1280, 720, 8, MD_XGI315 },
118    { 0x75, 0x0000, 0x0000, 1280, 720, 16, MD_XGI315 },
119    { 0x78, 0x0000, 0x0000, 1280, 720, 32, MD_XGI315 },
120    { 0x23, 0x0000, 0x0000, 1280, 768, 8, MD_XGI315 },
121    { 0x24, 0x0000, 0x0000, 1280, 768, 16, MD_XGI315 },
122    { 0x25, 0x0000, 0x0000, 1280, 768, 32, MD_XGI315 },
123    { 0x7C, 0x0000, 0x0000, 1280, 960, 8, MD_XGI315 },
124    { 0x7D, 0x0000, 0x0000, 1280, 960, 16, MD_XGI315 },
125    { 0x7E, 0x0000, 0x0000, 1280, 960, 32, MD_XGI315 },
126    { 0x3A, 0x0107, 0x0107, 1280, 1024, 8, MD_XGI315 },
127    { 0x4D, 0x011a, 0x011a, 1280, 1024, 16, MD_XGI315 },
128    { 0x65, 0x013d, 0x011b, 1280, 1024, 32, MD_XGI315 },
129    { 0x26, 0x0000, 0x0000, 1400, 1050, 8, MD_XGI315 },
130    { 0x27, 0x0000, 0x0000, 1400, 1050, 16, MD_XGI315 },
131    { 0x28, 0x0000, 0x0000, 1400, 1050, 32, MD_XGI315 },
132    { 0x3C, 0x0130, 0x011c, 1600, 1200, 8, MD_XGI315 },
133    { 0x3D, 0x0131, 0x011e, 1600, 1200, 16, MD_XGI315 },
134    { 0x66, 0x013e, 0x011f, 1600, 1200, 32, MD_XGI315 },
135    { 0x68, 0x013f, 0x0000, 1920, 1440, 8, MD_XGI315 },
136    { 0x69, 0x0140, 0x0000, 1920, 1440, 16, MD_XGI315 },
137    { 0x6B, 0x0141, 0x0000, 1920, 1440, 32, MD_XGI315 },
138    { 0x6c, 0x0000, 0x0000, 2048, 1536, 8, MD_XGI315 },
139    { 0x6d, 0x0000, 0x0000, 2048, 1536, 16, MD_XGI315 },
140    { 0x6e, 0x0000, 0x0000, 2048, 1536, 32, MD_XGI315 },
141    { 0 },
142};
143
144static const unsigned short XGI310paneltype[] = {
145     LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024,
146     LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960,
147    LCD_1152x768, LCD_1400x1050, LCD_1280x768, LCD_1600x1200,
148    LCD_1024x768, LCD_1024x768, LCD_1024x768};
149
150static const struct _XGI_crt2type {
151    char name[10];
152    int type_no;
153    int tvplug_no;
154} XGI_crt2type[] = {
155    {"NONE", 0, -1},
156    {"LCD", XGIFB_DISP_LCD, -1},
157    {"TV", XGIFB_DISP_TV, -1},
158    {"VGA", XGIFB_DISP_CRT, -1},
159    {"SVIDEO", XGIFB_DISP_TV, TVPLUG_SVIDEO},
160    {"COMPOSITE", XGIFB_DISP_TV, TVPLUG_COMPOSITE},
161    {"SCART", XGIFB_DISP_TV, TVPLUG_SCART},
162    {"none", 0, -1},
163    {"lcd", XGIFB_DISP_LCD, -1},
164    {"tv", XGIFB_DISP_TV, -1},
165    {"vga", XGIFB_DISP_CRT, -1},
166    {"svideo", XGIFB_DISP_TV, TVPLUG_SVIDEO},
167    {"composite", XGIFB_DISP_TV, TVPLUG_COMPOSITE},
168    {"scart", XGIFB_DISP_TV, TVPLUG_SCART},
169    {"\0", -1, -1}
170};
171
172/* TV standard */
173static const struct _XGI_tvtype {
174    char name[6];
175    int type_no;
176} XGI_tvtype[] = {
177    {"PAL", 1},
178    {"NTSC", 2},
179    {"pal", 1},
180    {"ntsc", 2},
181    {"\0", -1}
182};
183
184static const struct _XGI_vrate {
185    u16 idx;
186    u16 xres;
187    u16 yres;
188    u16 refresh;
189} XGIfb_vrate[] = {
190    {1, 640, 480, 60}, {2, 640, 480, 72},
191    {3, 640, 480, 75}, {4, 640, 480, 85},
192
193    {5, 640, 480, 100}, {6, 640, 480, 120},
194    {7, 640, 480, 160}, {8, 640, 480, 200},
195
196    {1, 720, 480, 60},
197    {1, 720, 576, 58},
198    {1, 800, 480, 60}, {2, 800, 480, 75}, {3, 800, 480, 85},
199    {1, 800, 600, 60}, {2, 800, 600, 72}, {3, 800, 600, 75},
200    {4, 800, 600, 85}, {5, 800, 600, 100},
201    {6, 800, 600, 120}, {7, 800, 600, 160},
202
203    {1, 1024, 768, 60}, {2, 1024, 768, 70}, {3, 1024, 768, 75},
204    {4, 1024, 768, 85}, {5, 1024, 768, 100}, {6, 1024, 768, 120},
205    {1, 1024, 576, 60}, {2, 1024, 576, 75}, {3, 1024, 576, 85},
206    {1, 1024, 600, 60},
207    {1, 1152, 768, 60},
208    {1, 1280, 720, 60}, {2, 1280, 720, 75}, {3, 1280, 720, 85},
209    {1, 1280, 768, 60},
210    {1, 1280, 1024, 60}, {2, 1280, 1024, 75}, {3, 1280, 1024, 85},
211    {1, 1280, 960, 70},
212    {1, 1400, 1050, 60},
213    {1, 1600, 1200, 60}, {2, 1600, 1200, 65},
214    {3, 1600, 1200, 70}, {4, 1600, 1200, 75},
215
216    {5, 1600, 1200, 85}, {6, 1600, 1200, 100},
217    {7, 1600, 1200, 120},
218
219    {1, 1920, 1440, 60}, {2, 1920, 1440, 65},
220    {3, 1920, 1440, 70}, {4, 1920, 1440, 75},
221
222    {5, 1920, 1440, 85}, {6, 1920, 1440, 100},
223    {1, 2048, 1536, 60}, {2, 2048, 1536, 65},
224    {3, 2048, 1536, 70}, {4, 2048, 1536, 75},
225
226    {5, 2048, 1536, 85},
227    {0, 0, 0, 0}
228};
229
230static const struct _XGI_TV_filter {
231    u8 filter[9][4];
232} XGI_TV_filter[] = {
233    { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_0 */
234        {0x00, 0xE0, 0x10, 0x60},
235        {0x00, 0xEE, 0x10, 0x44},
236        {0x00, 0xF4, 0x10, 0x38},
237        {0xF8, 0xF4, 0x18, 0x38},
238        {0xFC, 0xFB, 0x14, 0x2A},
239        {0x00, 0x00, 0x10, 0x20},
240        {0x00, 0x04, 0x10, 0x18},
241        {0xFF, 0xFF, 0xFF, 0xFF} } },
242    { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_1 */
243        {0x00, 0xE0, 0x10, 0x60},
244        {0x00, 0xEE, 0x10, 0x44},
245        {0x00, 0xF4, 0x10, 0x38},
246        {0xF8, 0xF4, 0x18, 0x38},
247        {0xFC, 0xFB, 0x14, 0x2A},
248        {0x00, 0x00, 0x10, 0x20},
249        {0x00, 0x04, 0x10, 0x18},
250        {0xFF, 0xFF, 0xFF, 0xFF} } },
251    { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_2 */
252        {0xF5, 0xEE, 0x1B, 0x44},
253        {0xF8, 0xF4, 0x18, 0x38},
254        {0xEB, 0x04, 0x25, 0x18},
255        {0xF1, 0x05, 0x1F, 0x16},
256        {0xF6, 0x06, 0x1A, 0x14},
257        {0xFA, 0x06, 0x16, 0x14},
258        {0x00, 0x04, 0x10, 0x18},
259        {0xFF, 0xFF, 0xFF, 0xFF} } },
260    { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_3 */
261        {0xF1, 0x04, 0x1F, 0x18},
262        {0xEE, 0x0D, 0x22, 0x06},
263        {0xF7, 0x06, 0x19, 0x14},
264        {0xF4, 0x0B, 0x1C, 0x0A},
265        {0xFA, 0x07, 0x16, 0x12},
266        {0xF9, 0x0A, 0x17, 0x0C},
267        {0x00, 0x07, 0x10, 0x12},
268        {0xFF, 0xFF, 0xFF, 0xFF} } },
269    { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_4 */
270        {0x00, 0xE0, 0x10, 0x60},
271        {0x00, 0xEE, 0x10, 0x44},
272        {0x00, 0xF4, 0x10, 0x38},
273        {0xF8, 0xF4, 0x18, 0x38},
274        {0xFC, 0xFB, 0x14, 0x2A},
275        {0x00, 0x00, 0x10, 0x20},
276        {0x00, 0x04, 0x10, 0x18},
277        {0xFF, 0xFF, 0xFF, 0xFF} } },
278    { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_5 */
279        {0xF5, 0xEE, 0x1B, 0x44},
280        {0xF8, 0xF4, 0x18, 0x38},
281        {0xEB, 0x04, 0x25, 0x18},
282        {0xF1, 0x05, 0x1F, 0x16},
283        {0xF6, 0x06, 0x1A, 0x14},
284        {0xFA, 0x06, 0x16, 0x14},
285        {0x00, 0x04, 0x10, 0x18},
286        {0xFF, 0xFF, 0xFF, 0xFF} } },
287    { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_6 */
288        {0xEB, 0x04, 0x25, 0x18},
289        {0xE7, 0x0E, 0x29, 0x04},
290        {0xEE, 0x0C, 0x22, 0x08},
291        {0xF6, 0x0B, 0x1A, 0x0A},
292        {0xF9, 0x0A, 0x17, 0x0C},
293        {0xFC, 0x0A, 0x14, 0x0C},
294        {0x00, 0x08, 0x10, 0x10},
295        {0xFF, 0xFF, 0xFF, 0xFF} } },
296    { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_7 */
297        {0xEC, 0x02, 0x24, 0x1C},
298        {0xF2, 0x04, 0x1E, 0x18},
299        {0xEB, 0x15, 0x25, 0xF6},
300        {0xF4, 0x10, 0x1C, 0x00},
301        {0xF8, 0x0F, 0x18, 0x02},
302        {0x00, 0x04, 0x10, 0x18},
303        {0x01, 0x06, 0x0F, 0x14},
304        {0xFF, 0xFF, 0xFF, 0xFF} } },
305    { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_0 */
306        {0x00, 0xE0, 0x10, 0x60},
307        {0x00, 0xEE, 0x10, 0x44},
308        {0x00, 0xF4, 0x10, 0x38},
309        {0xF8, 0xF4, 0x18, 0x38},
310        {0xFC, 0xFB, 0x14, 0x2A},
311        {0x00, 0x00, 0x10, 0x20},
312        {0x00, 0x04, 0x10, 0x18},
313        {0xFF, 0xFF, 0xFF, 0xFF} } },
314    { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_1 */
315        {0x00, 0xE0, 0x10, 0x60},
316        {0x00, 0xEE, 0x10, 0x44},
317        {0x00, 0xF4, 0x10, 0x38},
318        {0xF8, 0xF4, 0x18, 0x38},
319        {0xFC, 0xFB, 0x14, 0x2A},
320        {0x00, 0x00, 0x10, 0x20},
321        {0x00, 0x04, 0x10, 0x18},
322        {0xFF, 0xFF, 0xFF, 0xFF} } },
323    { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_2 */
324        {0xF5, 0xEE, 0x1B, 0x44},
325        {0xF8, 0xF4, 0x18, 0x38},
326        {0xF1, 0xF7, 0x01, 0x32},
327        {0xF5, 0xFB, 0x1B, 0x2A},
328        {0xF9, 0xFF, 0x17, 0x22},
329        {0xFB, 0x01, 0x15, 0x1E},
330        {0x00, 0x04, 0x10, 0x18},
331        {0xFF, 0xFF, 0xFF, 0xFF} } },
332    { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_3 */
333        {0xF5, 0xFB, 0x1B, 0x2A},
334        {0xEE, 0xFE, 0x22, 0x24},
335        {0xF3, 0x00, 0x1D, 0x20},
336        {0xF9, 0x03, 0x17, 0x1A},
337        {0xFB, 0x02, 0x14, 0x1E},
338        {0xFB, 0x04, 0x15, 0x18},
339        {0x00, 0x06, 0x10, 0x14},
340        {0xFF, 0xFF, 0xFF, 0xFF} } },
341    { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_4 */
342        {0x00, 0xE0, 0x10, 0x60},
343        {0x00, 0xEE, 0x10, 0x44},
344        {0x00, 0xF4, 0x10, 0x38},
345        {0xF8, 0xF4, 0x18, 0x38},
346        {0xFC, 0xFB, 0x14, 0x2A},
347        {0x00, 0x00, 0x10, 0x20},
348        {0x00, 0x04, 0x10, 0x18},
349        {0xFF, 0xFF, 0xFF, 0xFF} } },
350    { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_5 */
351        {0xF5, 0xEE, 0x1B, 0x44},
352        {0xF8, 0xF4, 0x18, 0x38},
353        {0xF1, 0xF7, 0x1F, 0x32},
354        {0xF5, 0xFB, 0x1B, 0x2A},
355        {0xF9, 0xFF, 0x17, 0x22},
356        {0xFB, 0x01, 0x15, 0x1E},
357        {0x00, 0x04, 0x10, 0x18},
358        {0xFF, 0xFF, 0xFF, 0xFF} } },
359    { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_6 */
360        {0xF5, 0xEE, 0x1B, 0x2A},
361        {0xEE, 0xFE, 0x22, 0x24},
362        {0xF3, 0x00, 0x1D, 0x20},
363        {0xF9, 0x03, 0x17, 0x1A},
364        {0xFB, 0x02, 0x14, 0x1E},
365        {0xFB, 0x04, 0x15, 0x18},
366        {0x00, 0x06, 0x10, 0x14},
367        {0xFF, 0xFF, 0xFF, 0xFF} } },
368    { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_7 */
369        {0xF5, 0xEE, 0x1B, 0x44},
370        {0xF8, 0xF4, 0x18, 0x38},
371        {0xFC, 0xFB, 0x14, 0x2A},
372        {0xEB, 0x05, 0x25, 0x16},
373        {0xF1, 0x05, 0x1F, 0x16},
374        {0xFA, 0x07, 0x16, 0x12},
375        {0x00, 0x07, 0x10, 0x12},
376        {0xFF, 0xFF, 0xFF, 0xFF} } }
377};
378
379static int filter = -1;
380
381#endif
382

Archive Download this file



interactive