aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/matrox/matroxfb_DAC1064.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/matrox/matroxfb_DAC1064.c')
-rw-r--r--drivers/video/matrox/matroxfb_DAC1064.c378
1 files changed, 189 insertions, 189 deletions
diff --git a/drivers/video/matrox/matroxfb_DAC1064.c b/drivers/video/matrox/matroxfb_DAC1064.c
index a74e5da17aa0..7662a2862898 100644
--- a/drivers/video/matrox/matroxfb_DAC1064.c
+++ b/drivers/video/matrox/matroxfb_DAC1064.c
@@ -85,19 +85,19 @@ static void DAC1064_setpclk(WPMINFO unsigned long fout) {
85 85
86 DBG(__func__) 86 DBG(__func__)
87 87
88 DAC1064_calcclock(PMINFO fout, ACCESS_FBINFO(max_pixel_clock), &m, &n, &p); 88 DAC1064_calcclock(PMINFO fout, minfo->max_pixel_clock, &m, &n, &p);
89 ACCESS_FBINFO(hw).DACclk[0] = m; 89 minfo->hw.DACclk[0] = m;
90 ACCESS_FBINFO(hw).DACclk[1] = n; 90 minfo->hw.DACclk[1] = n;
91 ACCESS_FBINFO(hw).DACclk[2] = p; 91 minfo->hw.DACclk[2] = p;
92} 92}
93 93
94static void DAC1064_setmclk(WPMINFO int oscinfo, unsigned long fmem) { 94static void DAC1064_setmclk(WPMINFO int oscinfo, unsigned long fmem) {
95 u_int32_t mx; 95 u_int32_t mx;
96 struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); 96 struct matrox_hw_state *hw = &minfo->hw;
97 97
98 DBG(__func__) 98 DBG(__func__)
99 99
100 if (ACCESS_FBINFO(devflags.noinit)) { 100 if (minfo->devflags.noinit) {
101 /* read MCLK and give up... */ 101 /* read MCLK and give up... */
102 hw->DACclk[3] = inDAC1064(PMINFO DAC1064_XSYSPLLM); 102 hw->DACclk[3] = inDAC1064(PMINFO DAC1064_XSYSPLLM);
103 hw->DACclk[4] = inDAC1064(PMINFO DAC1064_XSYSPLLN); 103 hw->DACclk[4] = inDAC1064(PMINFO DAC1064_XSYSPLLN);
@@ -105,7 +105,7 @@ static void DAC1064_setmclk(WPMINFO int oscinfo, unsigned long fmem) {
105 return; 105 return;
106 } 106 }
107 mx = hw->MXoptionReg | 0x00000004; 107 mx = hw->MXoptionReg | 0x00000004;
108 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, mx); 108 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, mx);
109 mx &= ~0x000000BB; 109 mx &= ~0x000000BB;
110 if (oscinfo & DAC1064_OPT_GDIV1) 110 if (oscinfo & DAC1064_OPT_GDIV1)
111 mx |= 0x00000008; 111 mx |= 0x00000008;
@@ -120,9 +120,9 @@ static void DAC1064_setmclk(WPMINFO int oscinfo, unsigned long fmem) {
120 120
121 /* powerup system PLL, select PCI clock */ 121 /* powerup system PLL, select PCI clock */
122 mx |= 0x00000020; 122 mx |= 0x00000020;
123 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, mx); 123 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, mx);
124 mx &= ~0x00000004; 124 mx &= ~0x00000004;
125 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, mx); 125 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, mx);
126 126
127 /* !!! you must not access device if MCLK is not running !!! 127 /* !!! you must not access device if MCLK is not running !!!
128 Doing so cause immediate PCI lockup :-( Maybe they should 128 Doing so cause immediate PCI lockup :-( Maybe they should
@@ -131,7 +131,7 @@ static void DAC1064_setmclk(WPMINFO int oscinfo, unsigned long fmem) {
131 perfect... */ 131 perfect... */
132 /* (bit 2 of PCI_OPTION_REG must be 0... and bits 0,1 must not 132 /* (bit 2 of PCI_OPTION_REG must be 0... and bits 0,1 must not
133 select PLL... because of PLL can be stopped at this time) */ 133 select PLL... because of PLL can be stopped at this time) */
134 DAC1064_calcclock(PMINFO fmem, ACCESS_FBINFO(max_pixel_clock), &m, &n, &p); 134 DAC1064_calcclock(PMINFO fmem, minfo->max_pixel_clock, &m, &n, &p);
135 outDAC1064(PMINFO DAC1064_XSYSPLLM, hw->DACclk[3] = m); 135 outDAC1064(PMINFO DAC1064_XSYSPLLM, hw->DACclk[3] = m);
136 outDAC1064(PMINFO DAC1064_XSYSPLLN, hw->DACclk[4] = n); 136 outDAC1064(PMINFO DAC1064_XSYSPLLN, hw->DACclk[4] = n);
137 outDAC1064(PMINFO DAC1064_XSYSPLLP, hw->DACclk[5] = p); 137 outDAC1064(PMINFO DAC1064_XSYSPLLP, hw->DACclk[5] = p);
@@ -147,9 +147,9 @@ static void DAC1064_setmclk(WPMINFO int oscinfo, unsigned long fmem) {
147 /* select specified system clock source */ 147 /* select specified system clock source */
148 mx |= oscinfo & DAC1064_OPT_SCLK_MASK; 148 mx |= oscinfo & DAC1064_OPT_SCLK_MASK;
149 } 149 }
150 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, mx); 150 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, mx);
151 mx &= ~0x00000004; 151 mx &= ~0x00000004;
152 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, mx); 152 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, mx);
153 hw->MXoptionReg = mx; 153 hw->MXoptionReg = mx;
154} 154}
155 155
@@ -157,19 +157,19 @@ static void DAC1064_setmclk(WPMINFO int oscinfo, unsigned long fmem) {
157static void g450_set_plls(WPMINFO2) { 157static void g450_set_plls(WPMINFO2) {
158 u_int32_t c2_ctl; 158 u_int32_t c2_ctl;
159 unsigned int pxc; 159 unsigned int pxc;
160 struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); 160 struct matrox_hw_state *hw = &minfo->hw;
161 int pixelmnp; 161 int pixelmnp;
162 int videomnp; 162 int videomnp;
163 163
164 c2_ctl = hw->crtc2.ctl & ~0x4007; /* Clear PLL + enable for CRTC2 */ 164 c2_ctl = hw->crtc2.ctl & ~0x4007; /* Clear PLL + enable for CRTC2 */
165 c2_ctl |= 0x0001; /* Enable CRTC2 */ 165 c2_ctl |= 0x0001; /* Enable CRTC2 */
166 hw->DACreg[POS1064_XPWRCTRL] &= ~0x02; /* Stop VIDEO PLL */ 166 hw->DACreg[POS1064_XPWRCTRL] &= ~0x02; /* Stop VIDEO PLL */
167 pixelmnp = ACCESS_FBINFO(crtc1).mnp; 167 pixelmnp = minfo->crtc1.mnp;
168 videomnp = ACCESS_FBINFO(crtc2).mnp; 168 videomnp = minfo->crtc2.mnp;
169 if (videomnp < 0) { 169 if (videomnp < 0) {
170 c2_ctl &= ~0x0001; /* Disable CRTC2 */ 170 c2_ctl &= ~0x0001; /* Disable CRTC2 */
171 hw->DACreg[POS1064_XPWRCTRL] &= ~0x10; /* Powerdown CRTC2 */ 171 hw->DACreg[POS1064_XPWRCTRL] &= ~0x10; /* Powerdown CRTC2 */
172 } else if (ACCESS_FBINFO(crtc2).pixclock == ACCESS_FBINFO(features).pll.ref_freq) { 172 } else if (minfo->crtc2.pixclock == minfo->features.pll.ref_freq) {
173 c2_ctl |= 0x4002; /* Use reference directly */ 173 c2_ctl |= 0x4002; /* Use reference directly */
174 } else if (videomnp == pixelmnp) { 174 } else if (videomnp == pixelmnp) {
175 c2_ctl |= 0x0004; /* Use pixel PLL */ 175 c2_ctl |= 0x0004; /* Use pixel PLL */
@@ -200,11 +200,11 @@ static void g450_set_plls(WPMINFO2) {
200 mga_outl(0x3C10, c2_ctl); 200 mga_outl(0x3C10, c2_ctl);
201 } 201 }
202 202
203 pxc = ACCESS_FBINFO(crtc1).pixclock; 203 pxc = minfo->crtc1.pixclock;
204 if (pxc == 0 || ACCESS_FBINFO(outputs[2]).src == MATROXFB_SRC_CRTC2) { 204 if (pxc == 0 || minfo->outputs[2].src == MATROXFB_SRC_CRTC2) {
205 pxc = ACCESS_FBINFO(crtc2).pixclock; 205 pxc = minfo->crtc2.pixclock;
206 } 206 }
207 if (ACCESS_FBINFO(chip) == MGA_G550) { 207 if (minfo->chip == MGA_G550) {
208 if (pxc < 45000) { 208 if (pxc < 45000) {
209 hw->DACreg[POS1064_XPANMODE] = 0x00; /* 0-50 */ 209 hw->DACreg[POS1064_XPANMODE] = 0x00; /* 0-50 */
210 } else if (pxc < 55000) { 210 } else if (pxc < 55000) {
@@ -246,17 +246,17 @@ static void g450_set_plls(WPMINFO2) {
246#endif 246#endif
247 247
248void DAC1064_global_init(WPMINFO2) { 248void DAC1064_global_init(WPMINFO2) {
249 struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); 249 struct matrox_hw_state *hw = &minfo->hw;
250 250
251 hw->DACreg[POS1064_XMISCCTRL] &= M1064_XMISCCTRL_DAC_WIDTHMASK; 251 hw->DACreg[POS1064_XMISCCTRL] &= M1064_XMISCCTRL_DAC_WIDTHMASK;
252 hw->DACreg[POS1064_XMISCCTRL] |= M1064_XMISCCTRL_LUT_EN; 252 hw->DACreg[POS1064_XMISCCTRL] |= M1064_XMISCCTRL_LUT_EN;
253 hw->DACreg[POS1064_XPIXCLKCTRL] = M1064_XPIXCLKCTRL_PLL_UP | M1064_XPIXCLKCTRL_EN | M1064_XPIXCLKCTRL_SRC_PLL; 253 hw->DACreg[POS1064_XPIXCLKCTRL] = M1064_XPIXCLKCTRL_PLL_UP | M1064_XPIXCLKCTRL_EN | M1064_XPIXCLKCTRL_SRC_PLL;
254#ifdef CONFIG_FB_MATROX_G 254#ifdef CONFIG_FB_MATROX_G
255 if (ACCESS_FBINFO(devflags.g450dac)) { 255 if (minfo->devflags.g450dac) {
256 hw->DACreg[POS1064_XPWRCTRL] = 0x1F; /* powerup everything */ 256 hw->DACreg[POS1064_XPWRCTRL] = 0x1F; /* powerup everything */
257 hw->DACreg[POS1064_XOUTPUTCONN] = 0x00; /* disable outputs */ 257 hw->DACreg[POS1064_XOUTPUTCONN] = 0x00; /* disable outputs */
258 hw->DACreg[POS1064_XMISCCTRL] |= M1064_XMISCCTRL_DAC_EN; 258 hw->DACreg[POS1064_XMISCCTRL] |= M1064_XMISCCTRL_DAC_EN;
259 switch (ACCESS_FBINFO(outputs[0]).src) { 259 switch (minfo->outputs[0].src) {
260 case MATROXFB_SRC_CRTC1: 260 case MATROXFB_SRC_CRTC1:
261 case MATROXFB_SRC_CRTC2: 261 case MATROXFB_SRC_CRTC2:
262 hw->DACreg[POS1064_XOUTPUTCONN] |= 0x01; /* enable output; CRTC1/2 selection is in CRTC2 ctl */ 262 hw->DACreg[POS1064_XOUTPUTCONN] |= 0x01; /* enable output; CRTC1/2 selection is in CRTC2 ctl */
@@ -265,12 +265,12 @@ void DAC1064_global_init(WPMINFO2) {
265 hw->DACreg[POS1064_XMISCCTRL] &= ~M1064_XMISCCTRL_DAC_EN; 265 hw->DACreg[POS1064_XMISCCTRL] &= ~M1064_XMISCCTRL_DAC_EN;
266 break; 266 break;
267 } 267 }
268 switch (ACCESS_FBINFO(outputs[1]).src) { 268 switch (minfo->outputs[1].src) {
269 case MATROXFB_SRC_CRTC1: 269 case MATROXFB_SRC_CRTC1:
270 hw->DACreg[POS1064_XOUTPUTCONN] |= 0x04; 270 hw->DACreg[POS1064_XOUTPUTCONN] |= 0x04;
271 break; 271 break;
272 case MATROXFB_SRC_CRTC2: 272 case MATROXFB_SRC_CRTC2:
273 if (ACCESS_FBINFO(outputs[1]).mode == MATROXFB_OUTPUT_MODE_MONITOR) { 273 if (minfo->outputs[1].mode == MATROXFB_OUTPUT_MODE_MONITOR) {
274 hw->DACreg[POS1064_XOUTPUTCONN] |= 0x08; 274 hw->DACreg[POS1064_XOUTPUTCONN] |= 0x08;
275 } else { 275 } else {
276 hw->DACreg[POS1064_XOUTPUTCONN] |= 0x0C; 276 hw->DACreg[POS1064_XOUTPUTCONN] |= 0x0C;
@@ -280,7 +280,7 @@ void DAC1064_global_init(WPMINFO2) {
280 hw->DACreg[POS1064_XPWRCTRL] &= ~0x01; /* Poweroff DAC2 */ 280 hw->DACreg[POS1064_XPWRCTRL] &= ~0x01; /* Poweroff DAC2 */
281 break; 281 break;
282 } 282 }
283 switch (ACCESS_FBINFO(outputs[2]).src) { 283 switch (minfo->outputs[2].src) {
284 case MATROXFB_SRC_CRTC1: 284 case MATROXFB_SRC_CRTC1:
285 hw->DACreg[POS1064_XOUTPUTCONN] |= 0x20; 285 hw->DACreg[POS1064_XOUTPUTCONN] |= 0x20;
286 break; 286 break;
@@ -303,30 +303,30 @@ void DAC1064_global_init(WPMINFO2) {
303 } else 303 } else
304#endif 304#endif
305 { 305 {
306 if (ACCESS_FBINFO(outputs[1]).src == MATROXFB_SRC_CRTC1) { 306 if (minfo->outputs[1].src == MATROXFB_SRC_CRTC1) {
307 hw->DACreg[POS1064_XPIXCLKCTRL] = M1064_XPIXCLKCTRL_PLL_UP | M1064_XPIXCLKCTRL_EN | M1064_XPIXCLKCTRL_SRC_EXT; 307 hw->DACreg[POS1064_XPIXCLKCTRL] = M1064_XPIXCLKCTRL_PLL_UP | M1064_XPIXCLKCTRL_EN | M1064_XPIXCLKCTRL_SRC_EXT;
308 hw->DACreg[POS1064_XMISCCTRL] |= GX00_XMISCCTRL_MFC_MAFC | G400_XMISCCTRL_VDO_MAFC12; 308 hw->DACreg[POS1064_XMISCCTRL] |= GX00_XMISCCTRL_MFC_MAFC | G400_XMISCCTRL_VDO_MAFC12;
309 } else if (ACCESS_FBINFO(outputs[1]).src == MATROXFB_SRC_CRTC2) { 309 } else if (minfo->outputs[1].src == MATROXFB_SRC_CRTC2) {
310 hw->DACreg[POS1064_XMISCCTRL] |= GX00_XMISCCTRL_MFC_MAFC | G400_XMISCCTRL_VDO_C2_MAFC12; 310 hw->DACreg[POS1064_XMISCCTRL] |= GX00_XMISCCTRL_MFC_MAFC | G400_XMISCCTRL_VDO_C2_MAFC12;
311 } else if (ACCESS_FBINFO(outputs[2]).src == MATROXFB_SRC_CRTC1) 311 } else if (minfo->outputs[2].src == MATROXFB_SRC_CRTC1)
312 hw->DACreg[POS1064_XMISCCTRL] |= GX00_XMISCCTRL_MFC_PANELLINK | G400_XMISCCTRL_VDO_MAFC12; 312 hw->DACreg[POS1064_XMISCCTRL] |= GX00_XMISCCTRL_MFC_PANELLINK | G400_XMISCCTRL_VDO_MAFC12;
313 else 313 else
314 hw->DACreg[POS1064_XMISCCTRL] |= GX00_XMISCCTRL_MFC_DIS; 314 hw->DACreg[POS1064_XMISCCTRL] |= GX00_XMISCCTRL_MFC_DIS;
315 315
316 if (ACCESS_FBINFO(outputs[0]).src != MATROXFB_SRC_NONE) 316 if (minfo->outputs[0].src != MATROXFB_SRC_NONE)
317 hw->DACreg[POS1064_XMISCCTRL] |= M1064_XMISCCTRL_DAC_EN; 317 hw->DACreg[POS1064_XMISCCTRL] |= M1064_XMISCCTRL_DAC_EN;
318 } 318 }
319} 319}
320 320
321void DAC1064_global_restore(WPMINFO2) { 321void DAC1064_global_restore(WPMINFO2) {
322 struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); 322 struct matrox_hw_state *hw = &minfo->hw;
323 323
324 outDAC1064(PMINFO M1064_XPIXCLKCTRL, hw->DACreg[POS1064_XPIXCLKCTRL]); 324 outDAC1064(PMINFO M1064_XPIXCLKCTRL, hw->DACreg[POS1064_XPIXCLKCTRL]);
325 outDAC1064(PMINFO M1064_XMISCCTRL, hw->DACreg[POS1064_XMISCCTRL]); 325 outDAC1064(PMINFO M1064_XMISCCTRL, hw->DACreg[POS1064_XMISCCTRL]);
326 if (ACCESS_FBINFO(devflags.accelerator) == FB_ACCEL_MATROX_MGAG400) { 326 if (minfo->devflags.accelerator == FB_ACCEL_MATROX_MGAG400) {
327 outDAC1064(PMINFO 0x20, 0x04); 327 outDAC1064(PMINFO 0x20, 0x04);
328 outDAC1064(PMINFO 0x1F, ACCESS_FBINFO(devflags.dfp_type)); 328 outDAC1064(PMINFO 0x1F, minfo->devflags.dfp_type);
329 if (ACCESS_FBINFO(devflags.g450dac)) { 329 if (minfo->devflags.g450dac) {
330 outDAC1064(PMINFO M1064_XSYNCCTRL, 0xCC); 330 outDAC1064(PMINFO M1064_XSYNCCTRL, 0xCC);
331 outDAC1064(PMINFO M1064_XPWRCTRL, hw->DACreg[POS1064_XPWRCTRL]); 331 outDAC1064(PMINFO M1064_XPWRCTRL, hw->DACreg[POS1064_XPWRCTRL]);
332 outDAC1064(PMINFO M1064_XPANMODE, hw->DACreg[POS1064_XPANMODE]); 332 outDAC1064(PMINFO M1064_XPANMODE, hw->DACreg[POS1064_XPANMODE]);
@@ -336,18 +336,18 @@ void DAC1064_global_restore(WPMINFO2) {
336} 336}
337 337
338static int DAC1064_init_1(WPMINFO struct my_timming* m) { 338static int DAC1064_init_1(WPMINFO struct my_timming* m) {
339 struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); 339 struct matrox_hw_state *hw = &minfo->hw;
340 340
341 DBG(__func__) 341 DBG(__func__)
342 342
343 memcpy(hw->DACreg, MGA1064_DAC, sizeof(MGA1064_DAC_regs)); 343 memcpy(hw->DACreg, MGA1064_DAC, sizeof(MGA1064_DAC_regs));
344 switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { 344 switch (minfo->fbcon.var.bits_per_pixel) {
345 /* case 4: not supported by MGA1064 DAC */ 345 /* case 4: not supported by MGA1064 DAC */
346 case 8: 346 case 8:
347 hw->DACreg[POS1064_XMULCTRL] = M1064_XMULCTRL_DEPTH_8BPP | M1064_XMULCTRL_GRAPHICS_PALETIZED; 347 hw->DACreg[POS1064_XMULCTRL] = M1064_XMULCTRL_DEPTH_8BPP | M1064_XMULCTRL_GRAPHICS_PALETIZED;
348 break; 348 break;
349 case 16: 349 case 16:
350 if (ACCESS_FBINFO(fbcon).var.green.length == 5) 350 if (minfo->fbcon.var.green.length == 5)
351 hw->DACreg[POS1064_XMULCTRL] = M1064_XMULCTRL_DEPTH_15BPP_1BPP | M1064_XMULCTRL_GRAPHICS_PALETIZED; 351 hw->DACreg[POS1064_XMULCTRL] = M1064_XMULCTRL_DEPTH_15BPP_1BPP | M1064_XMULCTRL_GRAPHICS_PALETIZED;
352 else 352 else
353 hw->DACreg[POS1064_XMULCTRL] = M1064_XMULCTRL_DEPTH_16BPP | M1064_XMULCTRL_GRAPHICS_PALETIZED; 353 hw->DACreg[POS1064_XMULCTRL] = M1064_XMULCTRL_DEPTH_16BPP | M1064_XMULCTRL_GRAPHICS_PALETIZED;
@@ -361,7 +361,7 @@ static int DAC1064_init_1(WPMINFO struct my_timming* m) {
361 default: 361 default:
362 return 1; /* unsupported depth */ 362 return 1; /* unsupported depth */
363 } 363 }
364 hw->DACreg[POS1064_XVREFCTRL] = ACCESS_FBINFO(features.DAC1064.xvrefctrl); 364 hw->DACreg[POS1064_XVREFCTRL] = minfo->features.DAC1064.xvrefctrl;
365 hw->DACreg[POS1064_XGENCTRL] &= ~M1064_XGENCTRL_SYNC_ON_GREEN_MASK; 365 hw->DACreg[POS1064_XGENCTRL] &= ~M1064_XGENCTRL_SYNC_ON_GREEN_MASK;
366 hw->DACreg[POS1064_XGENCTRL] |= (m->sync & FB_SYNC_ON_GREEN)?M1064_XGENCTRL_SYNC_ON_GREEN:M1064_XGENCTRL_NO_SYNC_ON_GREEN; 366 hw->DACreg[POS1064_XGENCTRL] |= (m->sync & FB_SYNC_ON_GREEN)?M1064_XGENCTRL_SYNC_ON_GREEN:M1064_XGENCTRL_NO_SYNC_ON_GREEN;
367 hw->DACreg[POS1064_XCURADDL] = 0; 367 hw->DACreg[POS1064_XCURADDL] = 0;
@@ -372,11 +372,11 @@ static int DAC1064_init_1(WPMINFO struct my_timming* m) {
372} 372}
373 373
374static int DAC1064_init_2(WPMINFO struct my_timming* m) { 374static int DAC1064_init_2(WPMINFO struct my_timming* m) {
375 struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); 375 struct matrox_hw_state *hw = &minfo->hw;
376 376
377 DBG(__func__) 377 DBG(__func__)
378 378
379 if (ACCESS_FBINFO(fbcon).var.bits_per_pixel > 16) { /* 256 entries */ 379 if (minfo->fbcon.var.bits_per_pixel > 16) { /* 256 entries */
380 int i; 380 int i;
381 381
382 for (i = 0; i < 256; i++) { 382 for (i = 0; i < 256; i++) {
@@ -384,8 +384,8 @@ static int DAC1064_init_2(WPMINFO struct my_timming* m) {
384 hw->DACpal[i * 3 + 1] = i; 384 hw->DACpal[i * 3 + 1] = i;
385 hw->DACpal[i * 3 + 2] = i; 385 hw->DACpal[i * 3 + 2] = i;
386 } 386 }
387 } else if (ACCESS_FBINFO(fbcon).var.bits_per_pixel > 8) { 387 } else if (minfo->fbcon.var.bits_per_pixel > 8) {
388 if (ACCESS_FBINFO(fbcon).var.green.length == 5) { /* 0..31, 128..159 */ 388 if (minfo->fbcon.var.green.length == 5) { /* 0..31, 128..159 */
389 int i; 389 int i;
390 390
391 for (i = 0; i < 32; i++) { 391 for (i = 0; i < 32; i++) {
@@ -414,7 +414,7 @@ static int DAC1064_init_2(WPMINFO struct my_timming* m) {
414} 414}
415 415
416static void DAC1064_restore_1(WPMINFO2) { 416static void DAC1064_restore_1(WPMINFO2) {
417 struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); 417 struct matrox_hw_state *hw = &minfo->hw;
418 418
419 CRITFLAGS 419 CRITFLAGS
420 420
@@ -453,12 +453,12 @@ static void DAC1064_restore_2(WPMINFO2) {
453#ifdef DEBUG 453#ifdef DEBUG
454 dprintk(KERN_DEBUG "DAC1064regs "); 454 dprintk(KERN_DEBUG "DAC1064regs ");
455 for (i = 0; i < sizeof(MGA1064_DAC_regs); i++) { 455 for (i = 0; i < sizeof(MGA1064_DAC_regs); i++) {
456 dprintk("R%02X=%02X ", MGA1064_DAC_regs[i], ACCESS_FBINFO(hw).DACreg[i]); 456 dprintk("R%02X=%02X ", MGA1064_DAC_regs[i], minfo->hw.DACreg[i]);
457 if ((i & 0x7) == 0x7) dprintk(KERN_DEBUG "continuing... "); 457 if ((i & 0x7) == 0x7) dprintk(KERN_DEBUG "continuing... ");
458 } 458 }
459 dprintk(KERN_DEBUG "DAC1064clk "); 459 dprintk(KERN_DEBUG "DAC1064clk ");
460 for (i = 0; i < 6; i++) 460 for (i = 0; i < 6; i++)
461 dprintk("C%02X=%02X ", i, ACCESS_FBINFO(hw).DACclk[i]); 461 dprintk("C%02X=%02X ", i, minfo->hw.DACclk[i]);
462 dprintk("\n"); 462 dprintk("\n");
463#endif 463#endif
464} 464}
@@ -475,7 +475,7 @@ static int m1064_compute(void* out, struct my_timming* m) {
475 CRITBEGIN 475 CRITBEGIN
476 476
477 for (i = 0; i < 3; i++) 477 for (i = 0; i < 3; i++)
478 outDAC1064(PMINFO M1064_XPIXPLLCM + i, ACCESS_FBINFO(hw).DACclk[i]); 478 outDAC1064(PMINFO M1064_XPIXPLLCM + i, minfo->hw.DACclk[i]);
479 for (tmout = 500000; tmout; tmout--) { 479 for (tmout = 500000; tmout; tmout--) {
480 if (inDAC1064(PMINFO M1064_XPIXPLLSTAT) & 0x40) 480 if (inDAC1064(PMINFO M1064_XPIXPLLSTAT) & 0x40)
481 break; 481 break;
@@ -519,7 +519,7 @@ static struct matrox_altout g450out = {
519 519
520#ifdef CONFIG_FB_MATROX_MYSTIQUE 520#ifdef CONFIG_FB_MATROX_MYSTIQUE
521static int MGA1064_init(WPMINFO struct my_timming* m) { 521static int MGA1064_init(WPMINFO struct my_timming* m) {
522 struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); 522 struct matrox_hw_state *hw = &minfo->hw;
523 523
524 DBG(__func__) 524 DBG(__func__)
525 525
@@ -541,7 +541,7 @@ static int MGA1064_init(WPMINFO struct my_timming* m) {
541 541
542#ifdef CONFIG_FB_MATROX_G 542#ifdef CONFIG_FB_MATROX_G
543static int MGAG100_init(WPMINFO struct my_timming* m) { 543static int MGAG100_init(WPMINFO struct my_timming* m) {
544 struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); 544 struct matrox_hw_state *hw = &minfo->hw;
545 545
546 DBG(__func__) 546 DBG(__func__)
547 547
@@ -567,15 +567,15 @@ static void MGA1064_ramdac_init(WPMINFO2) {
567 567
568 DBG(__func__) 568 DBG(__func__)
569 569
570 /* ACCESS_FBINFO(features.DAC1064.vco_freq_min) = 120000; */ 570 /* minfo->features.DAC1064.vco_freq_min = 120000; */
571 ACCESS_FBINFO(features.pll.vco_freq_min) = 62000; 571 minfo->features.pll.vco_freq_min = 62000;
572 ACCESS_FBINFO(features.pll.ref_freq) = 14318; 572 minfo->features.pll.ref_freq = 14318;
573 ACCESS_FBINFO(features.pll.feed_div_min) = 100; 573 minfo->features.pll.feed_div_min = 100;
574 ACCESS_FBINFO(features.pll.feed_div_max) = 127; 574 minfo->features.pll.feed_div_max = 127;
575 ACCESS_FBINFO(features.pll.in_div_min) = 1; 575 minfo->features.pll.in_div_min = 1;
576 ACCESS_FBINFO(features.pll.in_div_max) = 31; 576 minfo->features.pll.in_div_max = 31;
577 ACCESS_FBINFO(features.pll.post_shift_max) = 3; 577 minfo->features.pll.post_shift_max = 3;
578 ACCESS_FBINFO(features.DAC1064.xvrefctrl) = DAC1064_XVREFCTRL_EXTERNAL; 578 minfo->features.DAC1064.xvrefctrl = DAC1064_XVREFCTRL_EXTERNAL;
579 /* maybe cmdline MCLK= ?, doc says gclk=44MHz, mclk=66MHz... it was 55/83 with old values */ 579 /* maybe cmdline MCLK= ?, doc says gclk=44MHz, mclk=66MHz... it was 55/83 with old values */
580 DAC1064_setmclk(PMINFO DAC1064_OPT_MDIV2 | DAC1064_OPT_GDIV3 | DAC1064_OPT_SCLK_PLL, 133333); 580 DAC1064_setmclk(PMINFO DAC1064_OPT_MDIV2 | DAC1064_OPT_GDIV3 | DAC1064_OPT_SCLK_PLL, 133333);
581} 581}
@@ -638,7 +638,7 @@ static void MGAG100_setPixClock(CPMINFO int flags, int freq) {
638 638
639 DBG(__func__) 639 DBG(__func__)
640 640
641 DAC1064_calcclock(PMINFO freq, ACCESS_FBINFO(max_pixel_clock), &m, &n, &p); 641 DAC1064_calcclock(PMINFO freq, minfo->max_pixel_clock, &m, &n, &p);
642 MGAG100_progPixClock(PMINFO flags, m, n, p); 642 MGAG100_progPixClock(PMINFO flags, m, n, p);
643} 643}
644#endif 644#endif
@@ -648,30 +648,30 @@ static int MGA1064_preinit(WPMINFO2) {
648 static const int vxres_mystique[] = { 512, 640, 768, 800, 832, 960, 648 static const int vxres_mystique[] = { 512, 640, 768, 800, 832, 960,
649 1024, 1152, 1280, 1600, 1664, 1920, 649 1024, 1152, 1280, 1600, 1664, 1920,
650 2048, 0}; 650 2048, 0};
651 struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); 651 struct matrox_hw_state *hw = &minfo->hw;
652 652
653 DBG(__func__) 653 DBG(__func__)
654 654
655 /* ACCESS_FBINFO(capable.cfb4) = 0; ... preinitialized by 0 */ 655 /* minfo->capable.cfb4 = 0; ... preinitialized by 0 */
656 ACCESS_FBINFO(capable.text) = 1; 656 minfo->capable.text = 1;
657 ACCESS_FBINFO(capable.vxres) = vxres_mystique; 657 minfo->capable.vxres = vxres_mystique;
658 658
659 ACCESS_FBINFO(outputs[0]).output = &m1064; 659 minfo->outputs[0].output = &m1064;
660 ACCESS_FBINFO(outputs[0]).src = ACCESS_FBINFO(outputs[0]).default_src; 660 minfo->outputs[0].src = minfo->outputs[0].default_src;
661 ACCESS_FBINFO(outputs[0]).data = MINFO; 661 minfo->outputs[0].data = minfo;
662 ACCESS_FBINFO(outputs[0]).mode = MATROXFB_OUTPUT_MODE_MONITOR; 662 minfo->outputs[0].mode = MATROXFB_OUTPUT_MODE_MONITOR;
663 663
664 if (ACCESS_FBINFO(devflags.noinit)) 664 if (minfo->devflags.noinit)
665 return 0; /* do not modify settings */ 665 return 0; /* do not modify settings */
666 hw->MXoptionReg &= 0xC0000100; 666 hw->MXoptionReg &= 0xC0000100;
667 hw->MXoptionReg |= 0x00094E20; 667 hw->MXoptionReg |= 0x00094E20;
668 if (ACCESS_FBINFO(devflags.novga)) 668 if (minfo->devflags.novga)
669 hw->MXoptionReg &= ~0x00000100; 669 hw->MXoptionReg &= ~0x00000100;
670 if (ACCESS_FBINFO(devflags.nobios)) 670 if (minfo->devflags.nobios)
671 hw->MXoptionReg &= ~0x40000000; 671 hw->MXoptionReg &= ~0x40000000;
672 if (ACCESS_FBINFO(devflags.nopciretry)) 672 if (minfo->devflags.nopciretry)
673 hw->MXoptionReg |= 0x20000000; 673 hw->MXoptionReg |= 0x20000000;
674 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, hw->MXoptionReg); 674 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, hw->MXoptionReg);
675 mga_setr(M_SEQ_INDEX, 0x01, 0x20); 675 mga_setr(M_SEQ_INDEX, 0x01, 0x20);
676 mga_outl(M_CTLWTST, 0x00000000); 676 mga_outl(M_CTLWTST, 0x00000000);
677 udelay(200); 677 udelay(200);
@@ -692,14 +692,14 @@ static void MGA1064_reset(WPMINFO2) {
692#ifdef CONFIG_FB_MATROX_G 692#ifdef CONFIG_FB_MATROX_G
693static void g450_mclk_init(WPMINFO2) { 693static void g450_mclk_init(WPMINFO2) {
694 /* switch all clocks to PCI source */ 694 /* switch all clocks to PCI source */
695 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, ACCESS_FBINFO(hw).MXoptionReg | 4); 695 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, minfo->hw.MXoptionReg | 4);
696 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION3_REG, ACCESS_FBINFO(values).reg.opt3 & ~0x00300C03); 696 pci_write_config_dword(minfo->pcidev, PCI_OPTION3_REG, minfo->values.reg.opt3 & ~0x00300C03);
697 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, ACCESS_FBINFO(hw).MXoptionReg); 697 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, minfo->hw.MXoptionReg);
698 698
699 if (((ACCESS_FBINFO(values).reg.opt3 & 0x000003) == 0x000003) || 699 if (((minfo->values.reg.opt3 & 0x000003) == 0x000003) ||
700 ((ACCESS_FBINFO(values).reg.opt3 & 0x000C00) == 0x000C00) || 700 ((minfo->values.reg.opt3 & 0x000C00) == 0x000C00) ||
701 ((ACCESS_FBINFO(values).reg.opt3 & 0x300000) == 0x300000)) { 701 ((minfo->values.reg.opt3 & 0x300000) == 0x300000)) {
702 matroxfb_g450_setclk(PMINFO ACCESS_FBINFO(values.pll.video), M_VIDEO_PLL); 702 matroxfb_g450_setclk(PMINFO minfo->values.pll.video, M_VIDEO_PLL);
703 } else { 703 } else {
704 unsigned long flags; 704 unsigned long flags;
705 unsigned int pwr; 705 unsigned int pwr;
@@ -709,53 +709,53 @@ static void g450_mclk_init(WPMINFO2) {
709 outDAC1064(PMINFO M1064_XPWRCTRL, pwr); 709 outDAC1064(PMINFO M1064_XPWRCTRL, pwr);
710 matroxfb_DAC_unlock_irqrestore(flags); 710 matroxfb_DAC_unlock_irqrestore(flags);
711 } 711 }
712 matroxfb_g450_setclk(PMINFO ACCESS_FBINFO(values.pll.system), M_SYSTEM_PLL); 712 matroxfb_g450_setclk(PMINFO minfo->values.pll.system, M_SYSTEM_PLL);
713 713
714 /* switch clocks to their real PLL source(s) */ 714 /* switch clocks to their real PLL source(s) */
715 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, ACCESS_FBINFO(hw).MXoptionReg | 4); 715 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, minfo->hw.MXoptionReg | 4);
716 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION3_REG, ACCESS_FBINFO(values).reg.opt3); 716 pci_write_config_dword(minfo->pcidev, PCI_OPTION3_REG, minfo->values.reg.opt3);
717 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, ACCESS_FBINFO(hw).MXoptionReg); 717 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, minfo->hw.MXoptionReg);
718 718
719} 719}
720 720
721static void g450_memory_init(WPMINFO2) { 721static void g450_memory_init(WPMINFO2) {
722 /* disable memory refresh */ 722 /* disable memory refresh */
723 ACCESS_FBINFO(hw).MXoptionReg &= ~0x001F8000; 723 minfo->hw.MXoptionReg &= ~0x001F8000;
724 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, ACCESS_FBINFO(hw).MXoptionReg); 724 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, minfo->hw.MXoptionReg);
725 725
726 /* set memory interface parameters */ 726 /* set memory interface parameters */
727 ACCESS_FBINFO(hw).MXoptionReg &= ~0x00207E00; 727 minfo->hw.MXoptionReg &= ~0x00207E00;
728 ACCESS_FBINFO(hw).MXoptionReg |= 0x00207E00 & ACCESS_FBINFO(values).reg.opt; 728 minfo->hw.MXoptionReg |= 0x00207E00 & minfo->values.reg.opt;
729 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, ACCESS_FBINFO(hw).MXoptionReg); 729 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, minfo->hw.MXoptionReg);
730 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION2_REG, ACCESS_FBINFO(values).reg.opt2); 730 pci_write_config_dword(minfo->pcidev, PCI_OPTION2_REG, minfo->values.reg.opt2);
731 731
732 mga_outl(M_CTLWTST, ACCESS_FBINFO(values).reg.mctlwtst); 732 mga_outl(M_CTLWTST, minfo->values.reg.mctlwtst);
733 733
734 /* first set up memory interface with disabled memory interface clocks */ 734 /* first set up memory interface with disabled memory interface clocks */
735 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_MEMMISC_REG, ACCESS_FBINFO(values).reg.memmisc & ~0x80000000U); 735 pci_write_config_dword(minfo->pcidev, PCI_MEMMISC_REG, minfo->values.reg.memmisc & ~0x80000000U);
736 mga_outl(M_MEMRDBK, ACCESS_FBINFO(values).reg.memrdbk); 736 mga_outl(M_MEMRDBK, minfo->values.reg.memrdbk);
737 mga_outl(M_MACCESS, ACCESS_FBINFO(values).reg.maccess); 737 mga_outl(M_MACCESS, minfo->values.reg.maccess);
738 /* start memory clocks */ 738 /* start memory clocks */
739 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_MEMMISC_REG, ACCESS_FBINFO(values).reg.memmisc | 0x80000000U); 739 pci_write_config_dword(minfo->pcidev, PCI_MEMMISC_REG, minfo->values.reg.memmisc | 0x80000000U);
740 740
741 udelay(200); 741 udelay(200);
742 742
743 if (ACCESS_FBINFO(values).memory.ddr && (!ACCESS_FBINFO(values).memory.emrswen || !ACCESS_FBINFO(values).memory.dll)) { 743 if (minfo->values.memory.ddr && (!minfo->values.memory.emrswen || !minfo->values.memory.dll)) {
744 mga_outl(M_MEMRDBK, ACCESS_FBINFO(values).reg.memrdbk & ~0x1000); 744 mga_outl(M_MEMRDBK, minfo->values.reg.memrdbk & ~0x1000);
745 } 745 }
746 mga_outl(M_MACCESS, ACCESS_FBINFO(values).reg.maccess | 0x8000); 746 mga_outl(M_MACCESS, minfo->values.reg.maccess | 0x8000);
747 747
748 udelay(200); 748 udelay(200);
749 749
750 ACCESS_FBINFO(hw).MXoptionReg |= 0x001F8000 & ACCESS_FBINFO(values).reg.opt; 750 minfo->hw.MXoptionReg |= 0x001F8000 & minfo->values.reg.opt;
751 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, ACCESS_FBINFO(hw).MXoptionReg); 751 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, minfo->hw.MXoptionReg);
752 752
753 /* value is written to memory chips only if old != new */ 753 /* value is written to memory chips only if old != new */
754 mga_outl(M_PLNWT, 0); 754 mga_outl(M_PLNWT, 0);
755 mga_outl(M_PLNWT, ~0); 755 mga_outl(M_PLNWT, ~0);
756 756
757 if (ACCESS_FBINFO(values).reg.mctlwtst != ACCESS_FBINFO(values).reg.mctlwtst_core) { 757 if (minfo->values.reg.mctlwtst != minfo->values.reg.mctlwtst_core) {
758 mga_outl(M_CTLWTST, ACCESS_FBINFO(values).reg.mctlwtst_core); 758 mga_outl(M_CTLWTST, minfo->values.reg.mctlwtst_core);
759 } 759 }
760 760
761} 761}
@@ -765,17 +765,17 @@ static void g450_preinit(WPMINFO2) {
765 u_int8_t curctl; 765 u_int8_t curctl;
766 u_int8_t c1ctl; 766 u_int8_t c1ctl;
767 767
768 /* ACCESS_FBINFO(hw).MXoptionReg = minfo->values.reg.opt; */ 768 /* minfo->hw.MXoptionReg = minfo->values.reg.opt; */
769 ACCESS_FBINFO(hw).MXoptionReg &= 0xC0000100; 769 minfo->hw.MXoptionReg &= 0xC0000100;
770 ACCESS_FBINFO(hw).MXoptionReg |= 0x00000020; 770 minfo->hw.MXoptionReg |= 0x00000020;
771 if (ACCESS_FBINFO(devflags.novga)) 771 if (minfo->devflags.novga)
772 ACCESS_FBINFO(hw).MXoptionReg &= ~0x00000100; 772 minfo->hw.MXoptionReg &= ~0x00000100;
773 if (ACCESS_FBINFO(devflags.nobios)) 773 if (minfo->devflags.nobios)
774 ACCESS_FBINFO(hw).MXoptionReg &= ~0x40000000; 774 minfo->hw.MXoptionReg &= ~0x40000000;
775 if (ACCESS_FBINFO(devflags.nopciretry)) 775 if (minfo->devflags.nopciretry)
776 ACCESS_FBINFO(hw).MXoptionReg |= 0x20000000; 776 minfo->hw.MXoptionReg |= 0x20000000;
777 ACCESS_FBINFO(hw).MXoptionReg |= ACCESS_FBINFO(values).reg.opt & 0x03400040; 777 minfo->hw.MXoptionReg |= minfo->values.reg.opt & 0x03400040;
778 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, ACCESS_FBINFO(hw).MXoptionReg); 778 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, minfo->hw.MXoptionReg);
779 779
780 /* Init system clocks */ 780 /* Init system clocks */
781 781
@@ -812,7 +812,7 @@ static int MGAG100_preinit(WPMINFO2) {
812 static const int vxres_g100[] = { 512, 640, 768, 800, 832, 960, 812 static const int vxres_g100[] = { 512, 640, 768, 800, 832, 960,
813 1024, 1152, 1280, 1600, 1664, 1920, 813 1024, 1152, 1280, 1600, 1664, 1920,
814 2048, 0}; 814 2048, 0};
815 struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); 815 struct matrox_hw_state *hw = &minfo->hw;
816 816
817 u_int32_t reg50; 817 u_int32_t reg50;
818#if 0 818#if 0
@@ -822,68 +822,68 @@ static int MGAG100_preinit(WPMINFO2) {
822 DBG(__func__) 822 DBG(__func__)
823 823
824 /* there are some instabilities if in_div > 19 && vco < 61000 */ 824 /* there are some instabilities if in_div > 19 && vco < 61000 */
825 if (ACCESS_FBINFO(devflags.g450dac)) { 825 if (minfo->devflags.g450dac) {
826 ACCESS_FBINFO(features.pll.vco_freq_min) = 130000; /* my sample: >118 */ 826 minfo->features.pll.vco_freq_min = 130000; /* my sample: >118 */
827 } else { 827 } else {
828 ACCESS_FBINFO(features.pll.vco_freq_min) = 62000; 828 minfo->features.pll.vco_freq_min = 62000;
829 } 829 }
830 if (!ACCESS_FBINFO(features.pll.ref_freq)) { 830 if (!minfo->features.pll.ref_freq) {
831 ACCESS_FBINFO(features.pll.ref_freq) = 27000; 831 minfo->features.pll.ref_freq = 27000;
832 } 832 }
833 ACCESS_FBINFO(features.pll.feed_div_min) = 7; 833 minfo->features.pll.feed_div_min = 7;
834 ACCESS_FBINFO(features.pll.feed_div_max) = 127; 834 minfo->features.pll.feed_div_max = 127;
835 ACCESS_FBINFO(features.pll.in_div_min) = 1; 835 minfo->features.pll.in_div_min = 1;
836 ACCESS_FBINFO(features.pll.in_div_max) = 31; 836 minfo->features.pll.in_div_max = 31;
837 ACCESS_FBINFO(features.pll.post_shift_max) = 3; 837 minfo->features.pll.post_shift_max = 3;
838 ACCESS_FBINFO(features.DAC1064.xvrefctrl) = DAC1064_XVREFCTRL_G100_DEFAULT; 838 minfo->features.DAC1064.xvrefctrl = DAC1064_XVREFCTRL_G100_DEFAULT;
839 /* ACCESS_FBINFO(capable.cfb4) = 0; ... preinitialized by 0 */ 839 /* minfo->capable.cfb4 = 0; ... preinitialized by 0 */
840 ACCESS_FBINFO(capable.text) = 1; 840 minfo->capable.text = 1;
841 ACCESS_FBINFO(capable.vxres) = vxres_g100; 841 minfo->capable.vxres = vxres_g100;
842 ACCESS_FBINFO(capable.plnwt) = ACCESS_FBINFO(devflags.accelerator) == FB_ACCEL_MATROX_MGAG100 842 minfo->capable.plnwt = minfo->devflags.accelerator == FB_ACCEL_MATROX_MGAG100
843 ? ACCESS_FBINFO(devflags.sgram) : 1; 843 ? minfo->devflags.sgram : 1;
844 844
845#ifdef CONFIG_FB_MATROX_G 845#ifdef CONFIG_FB_MATROX_G
846 if (ACCESS_FBINFO(devflags.g450dac)) { 846 if (minfo->devflags.g450dac) {
847 ACCESS_FBINFO(outputs[0]).output = &g450out; 847 minfo->outputs[0].output = &g450out;
848 } else 848 } else
849#endif 849#endif
850 { 850 {
851 ACCESS_FBINFO(outputs[0]).output = &m1064; 851 minfo->outputs[0].output = &m1064;
852 } 852 }
853 ACCESS_FBINFO(outputs[0]).src = ACCESS_FBINFO(outputs[0]).default_src; 853 minfo->outputs[0].src = minfo->outputs[0].default_src;
854 ACCESS_FBINFO(outputs[0]).data = MINFO; 854 minfo->outputs[0].data = minfo;
855 ACCESS_FBINFO(outputs[0]).mode = MATROXFB_OUTPUT_MODE_MONITOR; 855 minfo->outputs[0].mode = MATROXFB_OUTPUT_MODE_MONITOR;
856 856
857 if (ACCESS_FBINFO(devflags.g450dac)) { 857 if (minfo->devflags.g450dac) {
858 /* we must do this always, BIOS does not do it for us 858 /* we must do this always, BIOS does not do it for us
859 and accelerator dies without it */ 859 and accelerator dies without it */
860 mga_outl(0x1C0C, 0); 860 mga_outl(0x1C0C, 0);
861 } 861 }
862 if (ACCESS_FBINFO(devflags.noinit)) 862 if (minfo->devflags.noinit)
863 return 0; 863 return 0;
864 if (ACCESS_FBINFO(devflags.g450dac)) { 864 if (minfo->devflags.g450dac) {
865 g450_preinit(PMINFO2); 865 g450_preinit(PMINFO2);
866 return 0; 866 return 0;
867 } 867 }
868 hw->MXoptionReg &= 0xC0000100; 868 hw->MXoptionReg &= 0xC0000100;
869 hw->MXoptionReg |= 0x00000020; 869 hw->MXoptionReg |= 0x00000020;
870 if (ACCESS_FBINFO(devflags.novga)) 870 if (minfo->devflags.novga)
871 hw->MXoptionReg &= ~0x00000100; 871 hw->MXoptionReg &= ~0x00000100;
872 if (ACCESS_FBINFO(devflags.nobios)) 872 if (minfo->devflags.nobios)
873 hw->MXoptionReg &= ~0x40000000; 873 hw->MXoptionReg &= ~0x40000000;
874 if (ACCESS_FBINFO(devflags.nopciretry)) 874 if (minfo->devflags.nopciretry)
875 hw->MXoptionReg |= 0x20000000; 875 hw->MXoptionReg |= 0x20000000;
876 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, hw->MXoptionReg); 876 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, hw->MXoptionReg);
877 DAC1064_setmclk(PMINFO DAC1064_OPT_MDIV2 | DAC1064_OPT_GDIV3 | DAC1064_OPT_SCLK_PCI, 133333); 877 DAC1064_setmclk(PMINFO DAC1064_OPT_MDIV2 | DAC1064_OPT_GDIV3 | DAC1064_OPT_SCLK_PCI, 133333);
878 878
879 if (ACCESS_FBINFO(devflags.accelerator) == FB_ACCEL_MATROX_MGAG100) { 879 if (minfo->devflags.accelerator == FB_ACCEL_MATROX_MGAG100) {
880 pci_read_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION2_REG, &reg50); 880 pci_read_config_dword(minfo->pcidev, PCI_OPTION2_REG, &reg50);
881 reg50 &= ~0x3000; 881 reg50 &= ~0x3000;
882 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION2_REG, reg50); 882 pci_write_config_dword(minfo->pcidev, PCI_OPTION2_REG, reg50);
883 883
884 hw->MXoptionReg |= 0x1080; 884 hw->MXoptionReg |= 0x1080;
885 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, hw->MXoptionReg); 885 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, hw->MXoptionReg);
886 mga_outl(M_CTLWTST, ACCESS_FBINFO(values).reg.mctlwtst); 886 mga_outl(M_CTLWTST, minfo->values.reg.mctlwtst);
887 udelay(100); 887 udelay(100);
888 mga_outb(0x1C05, 0x00); 888 mga_outb(0x1C05, 0x00);
889 mga_outb(0x1C05, 0x80); 889 mga_outb(0x1C05, 0x80);
@@ -893,68 +893,68 @@ static int MGAG100_preinit(WPMINFO2) {
893 udelay(100); 893 udelay(100);
894 reg50 &= ~0xFF; 894 reg50 &= ~0xFF;
895 reg50 |= 0x07; 895 reg50 |= 0x07;
896 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION2_REG, reg50); 896 pci_write_config_dword(minfo->pcidev, PCI_OPTION2_REG, reg50);
897 /* it should help with G100 */ 897 /* it should help with G100 */
898 mga_outb(M_GRAPHICS_INDEX, 6); 898 mga_outb(M_GRAPHICS_INDEX, 6);
899 mga_outb(M_GRAPHICS_DATA, (mga_inb(M_GRAPHICS_DATA) & 3) | 4); 899 mga_outb(M_GRAPHICS_DATA, (mga_inb(M_GRAPHICS_DATA) & 3) | 4);
900 mga_setr(M_EXTVGA_INDEX, 0x03, 0x81); 900 mga_setr(M_EXTVGA_INDEX, 0x03, 0x81);
901 mga_setr(M_EXTVGA_INDEX, 0x04, 0x00); 901 mga_setr(M_EXTVGA_INDEX, 0x04, 0x00);
902 mga_writeb(ACCESS_FBINFO(video.vbase), 0x0000, 0xAA); 902 mga_writeb(minfo->video.vbase, 0x0000, 0xAA);
903 mga_writeb(ACCESS_FBINFO(video.vbase), 0x0800, 0x55); 903 mga_writeb(minfo->video.vbase, 0x0800, 0x55);
904 mga_writeb(ACCESS_FBINFO(video.vbase), 0x4000, 0x55); 904 mga_writeb(minfo->video.vbase, 0x4000, 0x55);
905#if 0 905#if 0
906 if (mga_readb(ACCESS_FBINFO(video.vbase), 0x0000) != 0xAA) { 906 if (mga_readb(minfo->video.vbase, 0x0000) != 0xAA) {
907 hw->MXoptionReg &= ~0x1000; 907 hw->MXoptionReg &= ~0x1000;
908 } 908 }
909#endif 909#endif
910 hw->MXoptionReg |= 0x00078020; 910 hw->MXoptionReg |= 0x00078020;
911 } else if (ACCESS_FBINFO(devflags.accelerator) == FB_ACCEL_MATROX_MGAG200) { 911 } else if (minfo->devflags.accelerator == FB_ACCEL_MATROX_MGAG200) {
912 pci_read_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION2_REG, &reg50); 912 pci_read_config_dword(minfo->pcidev, PCI_OPTION2_REG, &reg50);
913 reg50 &= ~0x3000; 913 reg50 &= ~0x3000;
914 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION2_REG, reg50); 914 pci_write_config_dword(minfo->pcidev, PCI_OPTION2_REG, reg50);
915 915
916 if (ACCESS_FBINFO(devflags.memtype) == -1) 916 if (minfo->devflags.memtype == -1)
917 hw->MXoptionReg |= ACCESS_FBINFO(values).reg.opt & 0x1C00; 917 hw->MXoptionReg |= minfo->values.reg.opt & 0x1C00;
918 else 918 else
919 hw->MXoptionReg |= (ACCESS_FBINFO(devflags.memtype) & 7) << 10; 919 hw->MXoptionReg |= (minfo->devflags.memtype & 7) << 10;
920 if (ACCESS_FBINFO(devflags.sgram)) 920 if (minfo->devflags.sgram)
921 hw->MXoptionReg |= 0x4000; 921 hw->MXoptionReg |= 0x4000;
922 mga_outl(M_CTLWTST, ACCESS_FBINFO(values).reg.mctlwtst); 922 mga_outl(M_CTLWTST, minfo->values.reg.mctlwtst);
923 mga_outl(M_MEMRDBK, ACCESS_FBINFO(values).reg.memrdbk); 923 mga_outl(M_MEMRDBK, minfo->values.reg.memrdbk);
924 udelay(200); 924 udelay(200);
925 mga_outl(M_MACCESS, 0x00000000); 925 mga_outl(M_MACCESS, 0x00000000);
926 mga_outl(M_MACCESS, 0x00008000); 926 mga_outl(M_MACCESS, 0x00008000);
927 udelay(100); 927 udelay(100);
928 mga_outw(M_MEMRDBK, ACCESS_FBINFO(values).reg.memrdbk); 928 mga_outw(M_MEMRDBK, minfo->values.reg.memrdbk);
929 hw->MXoptionReg |= 0x00078020; 929 hw->MXoptionReg |= 0x00078020;
930 } else { 930 } else {
931 pci_read_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION2_REG, &reg50); 931 pci_read_config_dword(minfo->pcidev, PCI_OPTION2_REG, &reg50);
932 reg50 &= ~0x00000100; 932 reg50 &= ~0x00000100;
933 reg50 |= 0x00000000; 933 reg50 |= 0x00000000;
934 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION2_REG, reg50); 934 pci_write_config_dword(minfo->pcidev, PCI_OPTION2_REG, reg50);
935 935
936 if (ACCESS_FBINFO(devflags.memtype) == -1) 936 if (minfo->devflags.memtype == -1)
937 hw->MXoptionReg |= ACCESS_FBINFO(values).reg.opt & 0x1C00; 937 hw->MXoptionReg |= minfo->values.reg.opt & 0x1C00;
938 else 938 else
939 hw->MXoptionReg |= (ACCESS_FBINFO(devflags.memtype) & 7) << 10; 939 hw->MXoptionReg |= (minfo->devflags.memtype & 7) << 10;
940 if (ACCESS_FBINFO(devflags.sgram)) 940 if (minfo->devflags.sgram)
941 hw->MXoptionReg |= 0x4000; 941 hw->MXoptionReg |= 0x4000;
942 mga_outl(M_CTLWTST, ACCESS_FBINFO(values).reg.mctlwtst); 942 mga_outl(M_CTLWTST, minfo->values.reg.mctlwtst);
943 mga_outl(M_MEMRDBK, ACCESS_FBINFO(values).reg.memrdbk); 943 mga_outl(M_MEMRDBK, minfo->values.reg.memrdbk);
944 udelay(200); 944 udelay(200);
945 mga_outl(M_MACCESS, 0x00000000); 945 mga_outl(M_MACCESS, 0x00000000);
946 mga_outl(M_MACCESS, 0x00008000); 946 mga_outl(M_MACCESS, 0x00008000);
947 udelay(100); 947 udelay(100);
948 mga_outl(M_MEMRDBK, ACCESS_FBINFO(values).reg.memrdbk); 948 mga_outl(M_MEMRDBK, minfo->values.reg.memrdbk);
949 hw->MXoptionReg |= 0x00040020; 949 hw->MXoptionReg |= 0x00040020;
950 } 950 }
951 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, hw->MXoptionReg); 951 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, hw->MXoptionReg);
952 return 0; 952 return 0;
953} 953}
954 954
955static void MGAG100_reset(WPMINFO2) { 955static void MGAG100_reset(WPMINFO2) {
956 u_int8_t b; 956 u_int8_t b;
957 struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); 957 struct matrox_hw_state *hw = &minfo->hw;
958 958
959 DBG(__func__) 959 DBG(__func__)
960 960
@@ -964,22 +964,22 @@ static void MGAG100_reset(WPMINFO2) {
964 964
965 find 1014/22 (IBM/82351); /* if found and bridging Matrox, do some strange stuff */ 965 find 1014/22 (IBM/82351); /* if found and bridging Matrox, do some strange stuff */
966 pci_read_config_byte(ibm, PCI_SECONDARY_BUS, &b); 966 pci_read_config_byte(ibm, PCI_SECONDARY_BUS, &b);
967 if (b == ACCESS_FBINFO(pcidev)->bus->number) { 967 if (b == minfo->pcidev->bus->number) {
968 pci_write_config_byte(ibm, PCI_COMMAND+1, 0); /* disable back-to-back & SERR */ 968 pci_write_config_byte(ibm, PCI_COMMAND+1, 0); /* disable back-to-back & SERR */
969 pci_write_config_byte(ibm, 0x41, 0xF4); /* ??? */ 969 pci_write_config_byte(ibm, 0x41, 0xF4); /* ??? */
970 pci_write_config_byte(ibm, PCI_IO_BASE, 0xF0); /* ??? */ 970 pci_write_config_byte(ibm, PCI_IO_BASE, 0xF0); /* ??? */
971 pci_write_config_byte(ibm, PCI_IO_LIMIT, 0x00); /* ??? */ 971 pci_write_config_byte(ibm, PCI_IO_LIMIT, 0x00); /* ??? */
972 } 972 }
973#endif 973#endif
974 if (!ACCESS_FBINFO(devflags.noinit)) { 974 if (!minfo->devflags.noinit) {
975 if (x7AF4 & 8) { 975 if (x7AF4 & 8) {
976 hw->MXoptionReg |= 0x40; /* FIXME... */ 976 hw->MXoptionReg |= 0x40; /* FIXME... */
977 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, hw->MXoptionReg); 977 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, hw->MXoptionReg);
978 } 978 }
979 mga_setr(M_EXTVGA_INDEX, 0x06, 0x00); 979 mga_setr(M_EXTVGA_INDEX, 0x06, 0x00);
980 } 980 }
981 } 981 }
982 if (ACCESS_FBINFO(devflags.g450dac)) { 982 if (minfo->devflags.g450dac) {
983 /* either leave MCLK as is... or they were set in preinit */ 983 /* either leave MCLK as is... or they were set in preinit */
984 hw->DACclk[3] = inDAC1064(PMINFO DAC1064_XSYSPLLM); 984 hw->DACclk[3] = inDAC1064(PMINFO DAC1064_XSYSPLLM);
985 hw->DACclk[4] = inDAC1064(PMINFO DAC1064_XSYSPLLN); 985 hw->DACclk[4] = inDAC1064(PMINFO DAC1064_XSYSPLLN);
@@ -987,14 +987,14 @@ static void MGAG100_reset(WPMINFO2) {
987 } else { 987 } else {
988 DAC1064_setmclk(PMINFO DAC1064_OPT_RESERVED | DAC1064_OPT_MDIV2 | DAC1064_OPT_GDIV1 | DAC1064_OPT_SCLK_PLL, 133333); 988 DAC1064_setmclk(PMINFO DAC1064_OPT_RESERVED | DAC1064_OPT_MDIV2 | DAC1064_OPT_GDIV1 | DAC1064_OPT_SCLK_PLL, 133333);
989 } 989 }
990 if (ACCESS_FBINFO(devflags.accelerator) == FB_ACCEL_MATROX_MGAG400) { 990 if (minfo->devflags.accelerator == FB_ACCEL_MATROX_MGAG400) {
991 if (ACCESS_FBINFO(devflags.dfp_type) == -1) { 991 if (minfo->devflags.dfp_type == -1) {
992 ACCESS_FBINFO(devflags.dfp_type) = inDAC1064(PMINFO 0x1F); 992 minfo->devflags.dfp_type = inDAC1064(PMINFO 0x1F);
993 } 993 }
994 } 994 }
995 if (ACCESS_FBINFO(devflags.noinit)) 995 if (minfo->devflags.noinit)
996 return; 996 return;
997 if (ACCESS_FBINFO(devflags.g450dac)) { 997 if (minfo->devflags.g450dac) {
998 } else { 998 } else {
999 MGAG100_setPixClock(PMINFO 4, 25175); 999 MGAG100_setPixClock(PMINFO 4, 25175);
1000 MGAG100_setPixClock(PMINFO 5, 28322); 1000 MGAG100_setPixClock(PMINFO 5, 28322);
@@ -1011,7 +1011,7 @@ static void MGAG100_reset(WPMINFO2) {
1011#ifdef CONFIG_FB_MATROX_MYSTIQUE 1011#ifdef CONFIG_FB_MATROX_MYSTIQUE
1012static void MGA1064_restore(WPMINFO2) { 1012static void MGA1064_restore(WPMINFO2) {
1013 int i; 1013 int i;
1014 struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); 1014 struct matrox_hw_state *hw = &minfo->hw;
1015 1015
1016 CRITFLAGS 1016 CRITFLAGS
1017 1017
@@ -1019,7 +1019,7 @@ static void MGA1064_restore(WPMINFO2) {
1019 1019
1020 CRITBEGIN 1020 CRITBEGIN
1021 1021
1022 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, hw->MXoptionReg); 1022 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, hw->MXoptionReg);
1023 mga_outb(M_IEN, 0x00); 1023 mga_outb(M_IEN, 0x00);
1024 mga_outb(M_CACHEFLUSH, 0x00); 1024 mga_outb(M_CACHEFLUSH, 0x00);
1025 1025
@@ -1027,7 +1027,7 @@ static void MGA1064_restore(WPMINFO2) {
1027 1027
1028 DAC1064_restore_1(PMINFO2); 1028 DAC1064_restore_1(PMINFO2);
1029 matroxfb_vgaHWrestore(PMINFO2); 1029 matroxfb_vgaHWrestore(PMINFO2);
1030 ACCESS_FBINFO(crtc1.panpos) = -1; 1030 minfo->crtc1.panpos = -1;
1031 for (i = 0; i < 6; i++) 1031 for (i = 0; i < 6; i++)
1032 mga_setr(M_EXTVGA_INDEX, i, hw->CRTCEXT[i]); 1032 mga_setr(M_EXTVGA_INDEX, i, hw->CRTCEXT[i]);
1033 DAC1064_restore_2(PMINFO2); 1033 DAC1064_restore_2(PMINFO2);
@@ -1037,7 +1037,7 @@ static void MGA1064_restore(WPMINFO2) {
1037#ifdef CONFIG_FB_MATROX_G 1037#ifdef CONFIG_FB_MATROX_G
1038static void MGAG100_restore(WPMINFO2) { 1038static void MGAG100_restore(WPMINFO2) {
1039 int i; 1039 int i;
1040 struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); 1040 struct matrox_hw_state *hw = &minfo->hw;
1041 1041
1042 CRITFLAGS 1042 CRITFLAGS
1043 1043
@@ -1045,16 +1045,16 @@ static void MGAG100_restore(WPMINFO2) {
1045 1045
1046 CRITBEGIN 1046 CRITBEGIN
1047 1047
1048 pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, hw->MXoptionReg); 1048 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, hw->MXoptionReg);
1049 CRITEND 1049 CRITEND
1050 1050
1051 DAC1064_restore_1(PMINFO2); 1051 DAC1064_restore_1(PMINFO2);
1052 matroxfb_vgaHWrestore(PMINFO2); 1052 matroxfb_vgaHWrestore(PMINFO2);
1053#ifdef CONFIG_FB_MATROX_32MB 1053#ifdef CONFIG_FB_MATROX_32MB
1054 if (ACCESS_FBINFO(devflags.support32MB)) 1054 if (minfo->devflags.support32MB)
1055 mga_setr(M_EXTVGA_INDEX, 8, hw->CRTCEXT[8]); 1055 mga_setr(M_EXTVGA_INDEX, 8, hw->CRTCEXT[8]);
1056#endif 1056#endif
1057 ACCESS_FBINFO(crtc1.panpos) = -1; 1057 minfo->crtc1.panpos = -1;
1058 for (i = 0; i < 6; i++) 1058 for (i = 0; i < 6; i++)
1059 mga_setr(M_EXTVGA_INDEX, i, hw->CRTCEXT[i]); 1059 mga_setr(M_EXTVGA_INDEX, i, hw->CRTCEXT[i]);
1060 DAC1064_restore_2(PMINFO2); 1060 DAC1064_restore_2(PMINFO2);