9 * Tseng Labs Inc. ET4000 Video Controller.
12 Crtcbx = 0x217A, /* Secondary CRT controller */
24 outportb(0x3BF, 0x03);
25 outportb(0x3D8, 0xA0);
26 outportb(0x3CD, 0x00);
30 snarf(Vga* vga, Ctlr* ctlr)
36 vga->sequencer[0x06] = vgaxi(Seqx, 0x06);
37 vga->sequencer[0x07] = vgaxi(Seqx, 0x07);
39 for(i = 0x30; i < 0x38; i++)
40 vga->crt[i] = vgaxi(Crtx, i);
41 vga->crt[0x3F] = vgaxi(Crtx, 0x3F);
43 vga->attribute[0x16] = vgaxi(Attrx, 0x16);
44 vga->attribute[0x17] = vgaxi(Attrx, 0x17);
49 switch(vga->crt[0x37] & 0x03){
63 if(strncmp(ctlr->name, "et4000-w32", 10) == 0){
64 if(vga->crt[0x32] & 0x80)
67 else if(vga->crt[0x37] & 0x80)
74 options(Vga* vga, Ctlr* ctlr)
77 * The ET4000 does not need to have the vertical
78 * timing values divided by 2 for interlace mode.
80 if(vga->mode->interlace == 'v')
81 vga->mode->interlace = 'V';
83 if(strncmp(ctlr->name, "et4000-w32", 10) == 0)
84 ctlr->flag |= Hpclk2x8;
86 ctlr->flag |= Hclkdiv|Foptions;
90 init(Vga* vga, Ctlr* ctlr)
96 error("depth %d not supported\n", vga->mode->z);
98 if(ctlr->flag & Upclk2x8){
100 vga->crt[0x00] = ((mode->ht/2)>>3)-5;
101 vga->crt[0x01] = ((mode->x/2)>>3)-1;
102 vga->crt[0x02] = ((mode->shb/2)>>3)-1;
104 x = (mode->ehb/2)>>3;
105 vga->crt[0x03] = 0x80|(x & 0x1F);
106 vga->crt[0x04] = (mode->shs/2)>>3;
107 vga->crt[0x05] = ((mode->ehs/2)>>3) & 0x1F;
109 vga->crt[0x05] |= 0x80;
114 if(vga->crt[0x14] & 0x20)
115 vga->crt[0x17] |= 0x08;
116 vga->crt[0x17] &= ~0x20;
118 vga->crt[0x30] = 0x00;
119 vga->crt[0x33] = 0x00;
124 vga->crt[0x35] = 0x00;
125 if(vga->crt[0x15] & 0x400)
126 vga->crt[0x35] |= 0x01;
127 if(vga->crt[0x06] & 0x400)
128 vga->crt[0x35] |= 0x02;
129 if(vga->crt[0x12] & 0x400)
130 vga->crt[0x35] |= 0x04;
131 if(vga->crt[0x10] & 0x400)
132 vga->crt[0x35] |= 0x08;
133 if(vga->crt[0x18] & 0x400)
134 vga->crt[0x35] |= 0x10;
135 if(vga->mode->interlace == 'V')
136 vga->crt[0x35] |= 0x80;
139 * Horizontal Overflow.
141 vga->crt[0x3F] = 0x00;
142 if(vga->crt[0x00] & 0x100)
143 vga->crt[0x3F] |= 0x01;
144 if(vga->crt[0x02] & 0x100)
145 vga->crt[0x3F] |= 0x04;
146 if(vga->crt[0x04] & 0x100)
147 vga->crt[0x3F] |= 0x10;
148 if(vga->crt[0x13] & 0x100)
149 vga->crt[0x3F] |= 0x80;
152 * Turn off MMU buffers, linear map
153 * and memory-mapped registers.
155 vga->crt[0x36] &= ~0x38;
157 if(strncmp(ctlr->name, "et4000-w32", 10) == 0)
158 vga->crt[0x37] |= 0x80;
160 vga->sequencer[0x06] = 0x00;
165 if(vga->f[0] > 86000000)
166 error("%s: invalid pclk - %ld\n", ctlr->name, vga->f[0]);
168 vga->misc |= (vga->i[0] & 0x03)<<2;
170 vga->crt[0x34] |= 0x02;
172 vga->crt[0x34] &= ~0x02;
173 vga->crt[0x31] &= ~0xC0;
174 vga->crt[0x31] |= (vga->i[0] & 0x18)<<3;
176 vga->sequencer[0x07] &= ~0x41;
178 vga->sequencer[0x07] |= 0x01;
179 else if(vga->d[0] == 2)
180 vga->sequencer[0x07] |= 0x40;
182 vga->attribute[0x10] &= ~0x40;
183 vga->attribute[0x11] = Pblack;
184 vga->attribute[0x16] = 0x80;
186 if(ctlr->flag & Upclk2x8)
187 vga->attribute[0x16] |= 0x20;
193 load(Vga* vga, Ctlr* ctlr)
195 vgaxo(Crtx, 0x30, vga->crt[0x30]);
196 vgaxo(Crtx, 0x31, vga->crt[0x31]);
197 vgaxo(Crtx, 0x33, vga->crt[0x33]);
198 vgaxo(Crtx, 0x34, vga->crt[0x34]);
199 vgaxo(Crtx, 0x35, vga->crt[0x35]);
200 vgaxo(Crtx, 0x36, vga->crt[0x36]);
201 vgaxo(Crtx, 0x37, vga->crt[0x37]);
202 vgaxo(Crtx, 0x3F, vga->crt[0x3F]);
204 vgaxo(Seqx, 0x06, vga->sequencer[0x06]);
205 vgaxo(Seqx, 0x07, vga->sequencer[0x07]);
207 vgaxo(Attrx, 0x16, vga->attribute[0x16]);
213 dump(Vga* vga, Ctlr* ctlr)
221 printitem(name, "Seq06");
222 printreg(vga->sequencer[0x06]);
223 printreg(vga->sequencer[0x07]);
225 printitem(name, "Crt30");
226 for(i = 0x30; i < 0x38; i++)
227 printreg(vga->crt[i]);
228 printitem(name, "Crt3F");
229 printreg(vga->crt[0x3F]);
231 printitem(name, "Attr16");
232 printreg(vga->attribute[0x16]);
233 printreg(vga->attribute[0x17]);
235 if(strncmp(name, "et4000-w32", 10) == 0){
236 printitem(name, "SpriteE0");
237 for(i = Sprite; i < Sprite+NSprite; i++){
239 printreg(inportb(Crtcbx+1));
241 printitem(name, "ImaF0");
242 for(i = Ima; i < Ima+NIma; i++){
244 printreg(inportb(Crtcbx+1));
249 * Try to disassemble the snarfed values into
250 * understandable numbers.
251 * Only do this if we weren't called after Finit.
253 if(ctlr->flag & Finit)
256 x = (vga->crt[0x01]+1)<<3;
257 printitem(name, "hde");
259 Bprint(&stdout, "%6ud", x);
261 shb = ((((vga->crt[0x3F] & 0x04)<<6)|vga->crt[0x02])+1)<<3;
262 printitem(name, "shb");
264 Bprint(&stdout, "%6ud", shb);
266 x = (((vga->crt[0x05] & 0x80)>>2)|(vga->crt[0x03] & 0x1F))<<3;
267 printitem(name, "ehb");
269 for(i = 0; x < shb; i++)
271 Bprint(&stdout, "%6ud", x);
273 x = ((((vga->crt[0x3F] & 0x01)<<8)|vga->crt[0x00])+5)<<3;
274 printitem(name, "ht");
276 Bprint(&stdout, "%6ud", x);
279 if(vga->crt[0x07] & 0x02)
281 if(vga->crt[0x07] & 0x40)
283 if(vga->crt[0x35] & 0x04)
286 printitem(name, "vde");
288 Bprint(&stdout, "%6ud", x);
290 vrs = vga->crt[0x10];
291 if(vga->crt[0x07] & 0x04)
293 if(vga->crt[0x07] & 0x80)
295 if(vga->crt[0x35] & 0x08)
297 printitem(name, "vrs");
299 Bprint(&stdout, "%6ud", vrs);
301 x = (vrs & ~0x0F)|(vga->crt[0x11] & 0x0F);
302 printitem(name, "vre");
304 Bprint(&stdout, "%6ud", x);
307 if(vga->crt[0x07] & 0x01)
309 if(vga->crt[0x07] & 0x20)
311 if(vga->crt[0x35] & 0x02)
314 printitem(name, "vt");
316 Bprint(&stdout, "%6ud", x);
318 printitem(name, "d i");
319 if(vga->sequencer[0x07] & 0x01)
321 else if(vga->sequencer[0x07] & 0x40)
325 Bprint(&stdout, "%9ud", x);
326 x = (vga->misc & 0x0C)>>2;
327 if(vga->crt[0x34] & 0x02)
329 x |= (vga->crt[0x31] & 0xC0)>>3;
330 Bprint(&stdout, "%8ud\n", x);
336 options, /* options */