#!/bin/rc # # command: /bin/boddle /n/juke/plan_9/sys/src/cmd/aux/vga /sys/src/cmd/aux/vga # srcdir: /n/juke/plan_9/sys/src/cmd/aux/vga # version: 810871888 # date: Mon Sep 11 22:11:28 EDT 1995 # myname=$0 doextract=no fn usage{ echo $myname: usage: $myname '[-X] [src-directory]' >[1=2] exit usage } fn sigint{ rm -rf 810871888 exit interrupt } while(~ $1 -*){ switch($1){ case -X doextract=yes case -* usage } shift } switch($#*){ case 0 srcdir=/sys/src/cmd/aux/vga case 1 srcdir=$1 case * usage } if(! ~ $doextract yes){ echo This shell file contains a bundle of diffs representing changes echo to original source files in the Plan 9 distribution. It will run echo against the files in echo ' ' $srcdir echo '(unless overridden by the optional source directory argument)' echo and create a directory 810871888 containing the updated files. echo It will NOT automatically update the original files. echo echo Invoke with argument -X to perform the actual extraction. exit 0 } rm -rf 810871888 mkdir 810871888 target=810871888/att20c49x.c echo -n '810871888/att20c49x.c: ' if(! test -f $srcdir/att20c49x.c || ! test -r $srcdir/att20c49x.c){ echo $srcdir/att20c49x.c unreadable exit unreadable } sum=`{sum < $srcdir/att20c49x.c} if(! ~ a6531ae41610 $sum(1)^$sum(2)){ echo $srcdir/att20c49x.c is not the original distribution file exit original } cp $srcdir/att20c49x.c 810871888/att20c49x.c ed 810871888/att20c49x.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM att20c49x.c' 72a Ctlr att20c490 = { "att20c490", /* name */ 0, /* snarf */ 0, /* options */ init, /* init */ load, /* load */ dump, /* dump */ }; . 7c * ATT20C490 and ATT20C49[12] True-Color CMOS RAMDACs. . wq //GO.SYSIN DD VADIM att20c49x.c sum=`{sum < 810871888/att20c49x.c} if(~ 756d538c1777 $sum(1)^$sum(2)) echo if not{ echo 810871888/att20c49x.c checksum error creating updated file exit checksum } target=810871888/att21c498.c echo -n '810871888/att21c498.c: ' if(! test -f $srcdir/att21c498.c || ! test -r $srcdir/att21c498.c){ echo $srcdir/att21c498.c unreadable exit unreadable } sum=`{sum < $srcdir/att21c498.c} if(! ~ b350d1cd3369 $sum(1)^$sum(2)){ echo $srcdir/att21c498.c is not the original distribution file exit original } cp $srcdir/att21c498.c 810871888/att21c498.c ed 810871888/att21c498.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM att21c498.c' 112c if(vga->ctlr && (vga->ctlr->flag & Hpclk2x8) && vga->mode->z == 8 && vga->f > 80000000){ . 56c outportb(Pixmask, data); inportb(PaddrW); . 48c inportb(PaddrW); . 45,46c attdacio(reg); r = inportb(Pixmask); . 43c uchar r; . 36,37c inportb(Pixmask); . 33,34c inportb(PaddrW); . 25d 21c static void . wq //GO.SYSIN DD VADIM att21c498.c sum=`{sum < 810871888/att21c498.c} if(~ 3d5183423302 $sum(1)^$sum(2)) echo if not{ echo 810871888/att21c498.c checksum error creating updated file exit checksum } target=810871888/ch9294.c echo -n '810871888/ch9294.c: ' if(! test -f $srcdir/ch9294.c || ! test -r $srcdir/ch9294.c){ echo $srcdir/ch9294.c unreadable exit unreadable } sum=`{sum < $srcdir/ch9294.c} if(! ~ b751e3b81368 $sum(1)^$sum(2)){ echo $srcdir/ch9294.c is not the original distribution file exit original } cp $srcdir/ch9294.c 810871888/ch9294.c ed 810871888/ch9294.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM ch9294.c' 59,60c ctlr->flag |= Finit; return; } . 53,57c for(divisor = 1; divisor <= maxdivisor; divisor <<= 1){ f = vga->f - pattern->frequency[index]/divisor; if(f < 0) f = -f; if(f < 1000000){ /*vga->f = pattern->frequency[index];*/ vga->d = divisor; vga->i = index; . 51a maxdivisor = 1; if(vga->ctlr && (vga->ctlr->flag & Hclkdiv)) maxdivisor = 8; . 30c int f, index, divisor, maxdivisor; . 19a { "k", "K", /* Avance Logic */ 50350000, 56644000, 89800000, 72000000, 75000000, 65000000, 63000000, 80000000, 57272000, 85000000, 94000000, 96000000, 100000000, 108000000, 110000000, 77000000, }, . 16,17c { "e", "E", /* Tseng */ 50350000, 56644000, 65000000, 72000000, 80000000, 89800000, 63000000, 75000000, VgaFreq0, VgaFreq1, 31500000, 36000000, 40000000, 44900000, 50000000, 65000000, }, { "g", "G", /* S3, IIT */ VgaFreq0, VgaFreq1, 40000000, 72000000, 50000000, 77000000, 36000000, 44900000, . wq //GO.SYSIN DD VADIM ch9294.c sum=`{sum < 810871888/ch9294.c} if(~ c817f7c42052 $sum(1)^$sum(2)) echo if not{ echo 810871888/ch9294.c checksum error creating updated file exit checksum } target=810871888/clgd542x.c echo -n '810871888/clgd542x.c: ' if(! test -f $srcdir/clgd542x.c || ! test -r $srcdir/clgd542x.c){ echo $srcdir/clgd542x.c unreadable exit unreadable } sum=`{sum < $srcdir/clgd542x.c} if(! ~ f08f7c605224 $sum(1)^$sum(2)){ echo $srcdir/clgd542x.c is not the original distribution file exit original } cp $srcdir/clgd542x.c 810871888/clgd542x.c ed 810871888/clgd542x.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM clgd542x.c' 156c vga->f = (RefFreq*nmin)/(dmin*(1+p)); . 145c f = vga->f - (RefFreq*n)/(d*(1+p)); . 132c * vclk = (RefFreq*n)/(d*(1+p)); . 105c vga->vmz = 2048*1024; . 101c vga->vmz = 1024*1024; . 97c vga->vmz = 512*1024; . 93c vga->vmz = 256*1024; . wq //GO.SYSIN DD VADIM clgd542x.c sum=`{sum < 810871888/clgd542x.c} if(~ e6bd93435218 $sum(1)^$sum(2)) echo if not{ echo 810871888/clgd542x.c checksum error creating updated file exit checksum } target=810871888/data.c echo -n '810871888/data.c: ' if(! test -f $srcdir/data.c || ! test -r $srcdir/data.c){ echo $srcdir/data.c unreadable exit unreadable } sum=`{sum < $srcdir/data.c} if(! ~ 35c28d791035 $sum(1)^$sum(2)){ echo $srcdir/data.c is not the original distribution file exit original } cp $srcdir/data.c 810871888/data.c ed 810871888/data.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM data.c' 38a &vision964, /* ctlr */ . 33a &trio64, /* ctlr */ . 23a &ics534x, /* gendac */ . 9a &att20c490, /* ramdac */ . wq //GO.SYSIN DD VADIM data.c sum=`{sum < 810871888/data.c} if(~ 50ac56191142 $sum(1)^$sum(2)) echo if not{ echo 810871888/data.c checksum error creating updated file exit checksum } target=810871888/db.c echo -n '810871888/db.c: ' if(! test -f $srcdir/db.c || ! test -r $srcdir/db.c){ echo $srcdir/db.c unreadable exit unreadable } sum=`{sum < $srcdir/db.c} if(! ~ 6ed20a745454 $sum(1)^$sum(2)){ echo $srcdir/db.c is not the original distribution file exit original } cp $srcdir/db.c 810871888/db.c ed 810871888/db.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM db.c' 91d 85a if(vga->bios == 0){ vga->bios = alloc(len+1); strncpy(vga->bios, bios, len); } . 72c if(vga->bios == 0) readbios(bios, len, offset); . 68a if(vga->offset && offset != vga->offset) continue; . 67c if((offset = strtol(t->attr, 0, 0)) == 0) . 64a if(vga->bios) strcpy(bios, vga->bios); . 58,59c char bios[256], *string; . wq //GO.SYSIN DD VADIM db.c sum=`{sum < 810871888/db.c} if(~ 30be3d395668 $sum(1)^$sum(2)) echo if not{ echo 810871888/db.c checksum error creating updated file exit checksum } target=810871888/et4000.c echo -n '810871888/et4000.c: ' if(! test -f $srcdir/et4000.c || ! test -r $srcdir/et4000.c){ echo $srcdir/et4000.c unreadable exit unreadable } sum=`{sum < $srcdir/et4000.c} if(! ~ 6fe7954b6628 $sum(1)^$sum(2)){ echo $srcdir/et4000.c is not the original distribution file exit original } cp $srcdir/et4000.c 810871888/et4000.c ed 810871888/et4000.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM et4000.c' 88c ctlr->flag |= Hclkdiv|Foptions; . 68c vga->vmz *= 2; . 65c vga->vmz *= 2; . 60c vga->vmz = 1024*1024; . 56c vga->vmz = 512*1024; . 52c vga->vmz = 256*1024; . wq //GO.SYSIN DD VADIM et4000.c sum=`{sum < 810871888/et4000.c} if(~ ca27daa56636 $sum(1)^$sum(2)) echo if not{ echo 810871888/et4000.c checksum error creating updated file exit checksum } target=810871888/ibm8514.c echo -n '810871888/ibm8514.c: ' if(! test -f $srcdir/ibm8514.c || ! test -r $srcdir/ibm8514.c){ echo $srcdir/ibm8514.c unreadable exit unreadable } sum=`{sum < $srcdir/ibm8514.c} if(! ~ 305a3cb62396 $sum(1)^$sum(2)){ echo $srcdir/ibm8514.c is not the original distribution file exit original } cp $srcdir/ibm8514.c 810871888/ibm8514.c ed 810871888/ibm8514.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM ibm8514.c' 59c outportw(Multifunc, ScissorsB|(vga->vmz/vga->mode->x-1)); . wq //GO.SYSIN DD VADIM ibm8514.c sum=`{sum < 810871888/ibm8514.c} if(~ 426d161c2396 $sum(1)^$sum(2)) echo if not{ echo 810871888/ibm8514.c checksum error creating updated file exit checksum } target=810871888/icd2061a.c echo -n '810871888/icd2061a.c: ' if(! test -f $srcdir/icd2061a.c || ! test -r $srcdir/icd2061a.c){ echo $srcdir/icd2061a.c unreadable exit unreadable } sum=`{sum < $srcdir/icd2061a.c} if(! ~ 4e1c808e2086 $sum(1)^$sum(2)){ echo $srcdir/icd2061a.c is not the original distribution file exit original } cp $srcdir/icd2061a.c 810871888/icd2061a.c ed 810871888/icd2061a.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM icd2061a.c' 99c vga->f = (Prescale*RefFreq*vga->n/vga->d); . 83c f = vga->f - (Prescale*RefFreq*n/d); . 77c * vga->f = (Prescale*RefFreq*n/d); . 71,72c d = RefFreq/1000000 > 3 ? RefFreq/1000000: 3; dmax = RefFreq/200000 < 129 ? RefFreq/200000: 129; . 64c * 200KHz <= RefFreq/d <= 1MHz . wq //GO.SYSIN DD VADIM icd2061a.c sum=`{sum < 810871888/icd2061a.c} if(~ 4bab0d7d2070 $sum(1)^$sum(2)) echo if not{ echo 810871888/icd2061a.c checksum error creating updated file exit checksum } target=810871888/ics2494.c echo -n '810871888/ics2494.c: ' if(! test -f $srcdir/ics2494.c || ! test -r $srcdir/ics2494.c){ echo $srcdir/ics2494.c unreadable exit unreadable } sum=`{sum < $srcdir/ics2494.c} if(! ~ 96bc40d71881 $sum(1)^$sum(2)){ echo $srcdir/ics2494.c is not the original distribution file exit original } cp $srcdir/ics2494.c 810871888/ics2494.c ed 810871888/ics2494.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM ics2494.c' 58c for(divisor = 1; divisor <= maxdivisor; divisor <<= 1){ . 56a maxdivisor = 1; if(vga->ctlr && (vga->ctlr->flag & Hclkdiv)) maxdivisor = 8; . 35c int f, index, divisor, maxdivisor; . wq //GO.SYSIN DD VADIM ics2494.c sum=`{sum < 810871888/ics2494.c} if(~ 35660c871984 $sum(1)^$sum(2)) echo if not{ echo 810871888/ics2494.c checksum error creating updated file exit checksum } target=810871888/mach32.c echo -n '810871888/mach32.c: ' if(! test -f $srcdir/mach32.c || ! test -r $srcdir/mach32.c){ echo $srcdir/mach32.c unreadable exit unreadable } sum=`{sum < $srcdir/mach32.c} if(! ~ 453d886a6283 $sum(1)^$sum(2)){ echo $srcdir/mach32.c is not the original distribution file exit original } cp $srcdir/mach32.c 810871888/mach32.c ed 810871888/mach32.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM mach32.c' 147c vga->vmz = 4*1024*1024; . 143c vga->vmz = 2*1024*1024; . 139c vga->vmz = 1024*1024; . 135c vga->vmz = 512*1024; . 84,87c atix = 0x1CE; . 79,82c * We could try to read in a part of the BIOS and try to determine * the extended register address, but since we can't determine the offset value, * we'll just have to assume the defaults all round. . 57d wq //GO.SYSIN DD VADIM mach32.c sum=`{sum < 810871888/mach32.c} if(~ b64e7fed6119 $sum(1)^$sum(2)) echo if not{ echo 810871888/mach32.c checksum error creating updated file exit checksum } target=810871888/mach64.c echo -n '810871888/mach64.c: ' if(! test -f $srcdir/mach64.c || ! test -r $srcdir/mach64.c){ echo $srcdir/mach64.c unreadable exit unreadable } sum=`{sum < $srcdir/mach64.c} if(! ~ 636d2de78322 $sum(1)^$sum(2)){ echo $srcdir/mach64.c is not the original distribution file exit original } cp $srcdir/mach64.c 810871888/mach64.c ed 810871888/mach64.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM mach64.c' 313c vga->vmz = 1*1024*1024; . 213c vga->vmz = 8*1024*1024; . 209c vga->vmz = 6*1024*1024; . 205c vga->vmz = 4*1024*1024; . 201c vga->vmz = 2*1024*1024; . 197c vga->vmz = 1024*1024; . 193c vga->vmz = 512*1024; . wq //GO.SYSIN DD VADIM mach64.c sum=`{sum < 810871888/mach64.c} if(~ 8e86b4578322 $sum(1)^$sum(2)) echo if not{ echo 810871888/mach64.c checksum error creating updated file exit checksum } target=810871888/main.c echo -n '810871888/main.c: ' if(! test -f $srcdir/main.c || ! test -r $srcdir/main.c){ echo $srcdir/main.c unreadable exit unreadable } sum=`{sum < $srcdir/main.c} if(! ~ b5a7a5cd3680 $sum(1)^$sum(2)){ echo $srcdir/main.c is not the original distribution file exit original } cp $srcdir/main.c 810871888/main.c ed 810871888/main.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM main.c' 205a sequencer(vga, 1); . 200d 194a /* * Turn off the display during the load. */ sequencer(vga, 0); . 186,188c strncpy(buf, vga->ctlr->name, p - vga->ctlr->name); buf[p - vga->ctlr->name] = 0; vgactlw("type", buf); . 178,182d 176c ctlr->name, vga->vmz); . 174c if(vga->vmz && (vga->mode->x*vga->mode->y*vga->mode->z/8 > vga->vmz)) . 122a if(bios){ if((vga->offset = strtol(bios, &p, 0)) == 0 || *p++ != '=') error("bad BIOS string format - %s\n", bios); len = strlen(p); vga->bios = alloc(len+1); strncpy(vga->bios, p, len); verbose("BIOS override: %s: offset 0x%lux, string %s\n", bios, vga->offset, vga->bios); } . 88a case 'b': bios = ARGF(); break; . 82a bios = getenv("vgactlr"); . 79c char *bios, buf[256], *p, *size, *type; int len; . wq //GO.SYSIN DD VADIM main.c sum=`{sum < 810871888/main.c} if(~ d960bfd54047 $sum(1)^$sum(2)) echo if not{ echo 810871888/main.c checksum error creating updated file exit checksum } target=810871888/mkfile echo -n '810871888/mkfile: ' if(! test -f $srcdir/mkfile || ! test -r $srcdir/mkfile){ echo $srcdir/mkfile unreadable exit unreadable } sum=`{sum < $srcdir/mkfile} if(! ~ d33a7c3e481 $sum(1)^$sum(2)){ echo $srcdir/mkfile is not the original distribution file exit original } cp $srcdir/mkfile 810871888/mkfile ed 810871888/mkfile >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM mkfile' 37a vision964.$O\ . 32a trio64.$O\ . 20a ics534x.$O\ . wq //GO.SYSIN DD VADIM mkfile sum=`{sum < 810871888/mkfile} if(~ 4295d944521 $sum(1)^$sum(2)) echo if not{ echo 810871888/mkfile checksum error creating updated file exit checksum } target=810871888/s3clock.c echo -n '810871888/s3clock.c: ' if(! test -f $srcdir/s3clock.c || ! test -r $srcdir/s3clock.c){ echo $srcdir/s3clock.c unreadable exit unreadable } sum=`{sum < $srcdir/s3clock.c} if(! ~ 5c89f9544780 $sum(1)^$sum(2)){ echo $srcdir/s3clock.c is not the original distribution file exit original } cp $srcdir/s3clock.c 810871888/s3clock.c ed 810871888/s3clock.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM s3clock.c' 146,148d 144c if(vga->clock->init && (vga->clock->flag & Finit) == 0) . 114,115c { "icd2061a", icd2061aload, }, { "ch9294", ch9294load, }, { "tvp3025clock", tvp3025load, }, . 109a static void tvp3025load(Vga *vga, Ctlr *ctlr) { uchar crt5c, x; verbose("%s->clock->tvp3025load\n", ctlr->name); /* * Crt5C bit 5 is RS4. * Clear it to select TVP3025 registers for * the calls to tvp302xo(). */ crt5c = vgaxi(Crtx, 0x5C); vgaxo(Crtx, 0x5C, crt5c & ~0x20); tvp3020xo(0x2C, 0x00); tvp3020xo(0x2D, vga->d); tvp3020xo(0x2D, vga->n); tvp3020xo(0x2D, 0x08|vga->p); tvp3020xo(0x2F, 0x01); tvp3020xo(0x2F, 0x01); tvp3020xo(0x2F, vga->p); x = 0x54; if(vga->ctlr && (vga->ctlr->flag & Uenhanced)) x = 0xC4; tvp3020xo(0x1E, x); vgaxo(Crtx, 0x5C, crt5c); vgao(MiscW, vga->misc); ctlr->flag |= Fload; } . wq //GO.SYSIN DD VADIM s3clock.c sum=`{sum < 810871888/s3clock.c} if(~ c1f41b555374 $sum(1)^$sum(2)) echo if not{ echo 810871888/s3clock.c checksum error creating updated file exit checksum } target=810871888/s3generic.c echo -n '810871888/s3generic.c: ' if(! test -f $srcdir/s3generic.c || ! test -r $srcdir/s3generic.c){ echo $srcdir/s3generic.c unreadable exit unreadable } sum=`{sum < $srcdir/s3generic.c} if(! ~ 6d7235b26285 $sum(1)^$sum(2)){ echo $srcdir/s3generic.c is not the original distribution file exit original } cp $srcdir/s3generic.c 810871888/s3generic.c ed 810871888/s3generic.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM s3generic.c' 57c vga->vmz = 512*1024; . 53c vga->vmz = 1*1024*1024; . 49c vga->vmz = 2*1024*1024; . 45c vga->vmz = 3*1024*1024; . 41c vga->vmz = 4*1024*1024; . wq //GO.SYSIN DD VADIM s3generic.c sum=`{sum < 810871888/s3generic.c} if(~ 16c0e4be6285 $sum(1)^$sum(2)) echo if not{ echo 810871888/s3generic.c checksum error creating updated file exit checksum } target=810871888/tvp3025.c echo -n '810871888/tvp3025.c: ' if(! test -f $srcdir/tvp3025.c || ! test -r $srcdir/tvp3025.c){ echo $srcdir/tvp3025.c unreadable exit unreadable } sum=`{sum < $srcdir/tvp3025.c} if(! ~ 97a5bc161322 $sum(1)^$sum(2)){ echo $srcdir/tvp3025.c is not the original distribution file exit original } cp $srcdir/tvp3025.c 810871888/tvp3025.c ed 810871888/tvp3025.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM tvp3025.c' 60a print("%23ld\n", dumpclock(clock[0], clock[1], clock[2] & 0x07)); . 59c printreg(clock[i] = tvp3020xi(0x2F)); . 55a print("%23ld\n", dumpclock(clock[0], clock[1], clock[2] & 0x07)); . 54c printreg(clock[i] = tvp3020xi(0x2E)); . 50a print("%23ld\n", dumpclock(clock[0], clock[1], clock[2] & 0x07)); . 49c printreg(clock[i] = tvp3020xi(0x2D)); . 40a ulong clock[4]; . 35a static ulong dumpclock(ulong d, ulong n, ulong p) { ulong f; f = RefFreq*((n+2)*8); f /= (d+2); f >>= p; return f; } . 33c tvp3020xo(0x0E, 0x00); (tvp3020.load)(vga, ctlr); if(ctlr->flag & Uenhanced) tvp3020xo(0x29, 0x01); ctlr->flag |= Fload; . 20a /* * Although the Tvp3025 has a higher default * speed-grade (135MHz), just use the 3020 code. */ . wq //GO.SYSIN DD VADIM tvp3025.c sum=`{sum < 810871888/tvp3025.c} if(~ 7a49b5931905 $sum(1)^$sum(2)) echo if not{ echo 810871888/tvp3025.c checksum error creating updated file exit checksum } target=810871888/tvp3025clock.c echo -n '810871888/tvp3025clock.c: ' if(! test -f $srcdir/tvp3025clock.c || ! test -r $srcdir/tvp3025clock.c){ echo $srcdir/tvp3025clock.c unreadable exit unreadable } sum=`{sum < $srcdir/tvp3025clock.c} if(! ~ 771255d71863 $sum(1)^$sum(2)){ echo $srcdir/tvp3025clock.c is not the original distribution file exit original } cp $srcdir/tvp3025clock.c 810871888/tvp3025clock.c ed 810871888/tvp3025clock.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM tvp3025clock.c' 98c 0, /* load */ . 69,92d 49c fvco = SCALE(RefFreq)*((n+2)*8)/(d+2); . 47c nmax = ((220000000+RefFreq)*(d+2))/(RefFreq*8) - 2; . 38c dmax = (RefFreq/1000000)-2; . 27c * RefFreq/(n+2) > 1MHz . 24c * Fvco = RefFreq*((n+2)*8)/(d+2) . 14d wq //GO.SYSIN DD VADIM tvp3025clock.c sum=`{sum < 810871888/tvp3025clock.c} if(~ 0f0063a41447 $sum(1)^$sum(2)) echo if not{ echo 810871888/tvp3025clock.c checksum error creating updated file exit checksum } target=810871888/vga.c echo -n '810871888/vga.c: ' if(! test -f $srcdir/vga.c || ! test -r $srcdir/vga.c){ echo $srcdir/vga.c unreadable exit unreadable } sum=`{sum < $srcdir/vga.c} if(! ~ 5822cbfc8220 $sum(1)^$sum(2)){ echo $srcdir/vga.c is not the original distribution file exit original } cp $srcdir/vga.c 810871888/vga.c ed 810871888/vga.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM vga.c' 441,443c if(vga->vmz){ printitem(ctlr->name, "vmz"); print("%9ld\n", vga->vmz); . wq //GO.SYSIN DD VADIM vga.c sum=`{sum < 810871888/vga.c} if(~ 3b8a0eee8220 $sum(1)^$sum(2)) echo if not{ echo 810871888/vga.c checksum error creating updated file exit checksum } target=810871888/vga.h echo -n '810871888/vga.h: ' if(! test -f $srcdir/vga.h || ! test -r $srcdir/vga.h){ echo $srcdir/vga.h unreadable exit unreadable } sum=`{sum < $srcdir/vga.h} if(! ~ f6e82ccb5750 $sum(1)^$sum(2)){ echo $srcdir/vga.h is not the original distribution file exit original } cp $srcdir/vga.h 810871888/vga.h ed 810871888/vga.h >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM vga.h' 256a /* vision964.c */ extern Ctlr vision964; . 234a /* trio64.c */ extern Ctlr trio64; . 178a /* ics534x.c */ extern Ctlr ics534x; . 132a extern Ctlr att20c490; . 120a long offset; /* BIOS string offset */ char* bios; /* matching BIOS string */ . 119c ulong vma; /* video memory linear-address alignment */ ulong vmb; /* video memory linear-address base */ ulong vmz; /* video memory size */ . 117a ulong r; . 115a ulong m; . 71a Hlinear = 0x00040000, /* have linear-address mode */ Ulinear = 0x00080000, /* use linear-address mode */ Hclkdiv = 0x00100000, /* have a clock-divisor */ Uclkdiv = 0x00200000, /* use clock-divisor */ . 33c RefFreq = 14318180, /* External Reference Clock frequency */ . wq //GO.SYSIN DD VADIM vga.h sum=`{sum < 810871888/vga.h} if(~ e9143c7e6310 $sum(1)^$sum(2)) echo if not{ echo 810871888/vga.h checksum error creating updated file exit checksum } target=810871888/vgadb echo -n '810871888/vgadb: ' if(! test -f $srcdir/vgadb || ! test -r $srcdir/vgadb){ echo $srcdir/vgadb unreadable exit unreadable } sum=`{sum < $srcdir/vgadb} if(! ~ 7997b81e7926 $sum(1)^$sum(2)){ echo $srcdir/vgadb is not the original distribution file exit original } cp $srcdir/vgadb 810871888/vgadb ed 810871888/vgadb >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM vgadb' 80a 0xC00E7="MACH64GXP" # AT&T Globalyst 600 . 68a 0xC0039="CL-GD5422" . 66a ctlr 0xC0189="Hercules PCI Bus Dynamite(tm) BIOS. Ver. 8.00N-D2g(11/28/94)" 0xC0076="Tseng Laboratories, Inc. 06/28/94 V1.0CN" # Cardex Challenger link=vga ramdac=ics534x-135 ctlr=et4000-w32p hwgc=et4000hwgc . 63c clock=ics2494-304 ramdac=att20c491-90 # really a MUSIC MU9C4910 ctlr=et4000-w32i hwgc=et4000hwgc ctlr 0xC0189="Hercules PCI Bus Dynamite(tm) BIOS. Ver. 8.00N-B1a(03/30/94)" link=vga clock=ics2494-324 . 61c 0xC0189="Hercules ISA Bus Dynamite(tm) BIOS. Ver. 8.00N-A2b(04/29/94)" . 54a 0xC0094="#9-964 BIOS Version 1.03.03" # #9GXE64pro 0xC0094="#9-964 BIOS Version 1.03.11h" # #9GXE64pro link=vga hwgc=tvp3020hwgc ctlr=vision964 link=ibm8514 ramdac=tvp3025-170 link=s3clock clock=tvp3025clock ctlr 0xC0045="Stealth 64 DRAM Vers. 2.02" # Diamond Stealth 64 DRAM 0xC0045="Stealth SE DRAM Vers. 1.01" # Diamond Stealth SE DRAM 0xC0044="Phoenix S3 TRIO32 Enhanced VGA BIOS. Version 1.3-08-12-57MHz" 0xC0044="Phoenix S3 TRIO64 Enhanced VGA BIOS. Version 1.00-06" link=vga hwgc=s3hwgc ctlr=trio64 link=ibm8514 ctlr . 27c 0XC004F="86C801" # Quadtel S3 86C801/805 link=vga . wq //GO.SYSIN DD VADIM vgadb sum=`{sum < 810871888/vgadb} if(~ b82d63408986 $sum(1)^$sum(2)) echo if not{ echo 810871888/vgadb checksum error creating updated file exit checksum } target=810871888/ics534x.c echo -n '810871888/ics534x.c (new): ' cat > 810871888/ics534x.c >[2]/dev/null <<'//GO.SYSIN DD VADIM /sys/src/cmd/aux/vga' #include #include #include "vga.h" /* * ICS534x GENDAC. * For now assumed to be hooked to a Tseng Labs ET4000-W32p * (Hercules Dynamite Power). The Hercules generates RS2 using * CLK3. */ static void options(Vga*, Ctlr *ctlr) { ctlr->flag |= Hpclk2x8|Foptions; } static void clock(Vga *vga, Ctlr *ctlr) { ulong f, m, n, r; double fmin, fmax, t, tok; /* * The PLL frequency is defined by: * (M+2) * Fout = ------------ x Fref * (N+2) x 2**R * where M, N and R have the following contraints: * 1) 2MHz < Fref < 32MHz * 2) Fref * 600KHz < ----- <= 8Mhz * (N+2) * 3) (M+2) x Fref * 60MHz <= ------------ <= 270MHz * (N+2) * 4) Fout < 135MHz * 5) 1 <= M <= 127, 1 <= N <= 31, 0 <= R <= 3 * * First determine R by finding the highest value * for which * 2**R x Fout <= 270Mhz */ vga->r = 4; for(r = 0; r <= 3; r++){ f = vga->f*(1<r = r; } if(vga->r > 3) error("%s: pclk %d out of range\n", ctlr->name, vga->f); /* * Now find the closest match for M and N. * Lower values of M and N give better noise rejection. */ fmin = vga->f*0.995; fmax = vga->f*1.005; tok = 0.0; for(n = 31; n >= 1; n--){ t = RefFreq/(n+2); if(600000 >= t || t > 8000000) continue; t = vga->f*(n+2)*(1<r); t /= RefFreq; m = (t+0.5) - 2; if(m > 127) continue; t = (m+2)*RefFreq; t /= (n+2)*(1<r); if(fmin <= t < fmax){ vga->m = m; vga->n = n; tok = t; } } if(tok == 0.0) error("%s: pclk %d out of range\n", ctlr->name, vga->f); } static void init(Vga *vga, Ctlr *ctlr) { ulong pclk; char *p; /* * Part comes in -135, -110 and -80MHz speed-grades. */ pclk = 80000000; if(p = strrchr(ctlr->name, '-')) pclk = strtoul(p+1, 0, 0) * 1000000; /* * If we don't already have a desired pclk, * take it from the mode. * Check it's within range. */ if(vga->f == 0) vga->f = vga->mode->frequency; if(vga->f > pclk) error("%s: invalid pclk - %ld\n", ctlr->name, vga->f); /* * Determine whether to use 2x8-bit mode or not. * If yes and the clock has already been initialised, * initialise it again. */ if(vga->ctlr && (vga->ctlr->flag & Hpclk2x8) && vga->mode->z == 8 && vga->f >= pclk/2){ vga->f /= 2; resyncinit(vga, ctlr, Upclk2x8, 0); } /* * Clock bits. If the desired video clock is * one of the two standard VGA clocks it can just be * set using bits <3:2> of vga->misc, otherwise we * need to programme the DCLK PLL. */ vga->misc &= ~0x0C; if(vga->f == VgaFreq0) vga->i = 0; else if(vga->f == VgaFreq1){ vga->misc |= 0x04; vga->i = 1; } else{ /* * Initialise the PLL parameters. * Use CLK0 f7. */ clock(vga, ctlr); vga->i = 7; } ctlr->flag |= Finit; } static void load(Vga *vga, Ctlr *ctlr) { uchar crt31, mode; crt31 = vgaxi(Crtx, 0x31); vgaxo(Crtx, 0x31, 0x40|crt31); /* * Put the chip into snooze mode, * colour mode 0. */ mode = 0x00; outportb(Pixmask, 0x01); /* * The datasheet says that if the multiplexed 16-bit * pseudo-colour mode is used then N2 (vga->r) must * be 2. Is this regardless of the value calculated? */ if(ctlr->flag & Upclk2x8){ mode = 0x10; vga->r = 2; } /* * If necessary, set the PLL parameters for CLK0 f7. */ if(vga->i == 7){ outportb(PaddrW, vga->i); outportb(Pdata, vga->m); outportb(Pdata, (vga->r<<5)|vga->n); } outportb(Pixmask, mode); vgaxo(Crtx, 0x31, crt31); ctlr->flag |= Fload; } static void dump(Vga*, Ctlr *ctlr) { int i; uchar crt31, m, n; char buf[32]; ulong f; crt31 = vgaxi(Crtx, 0x31); vgaxo(Crtx, 0x31, 0x40|crt31); printitem(ctlr->name, "command"); printreg(inportb(Pixmask)); outportb(PaddrR, 0x00); for(i = 0; i < 0x0E; i++){ sprint(buf, "f%X m n", i); printitem(ctlr->name, buf); m = inportb(Pdata); printreg(m); n = inportb(Pdata); printreg(n); f = 14318180*(m+2); f /= (n & 0x1F)+2; f /= 1<<((n>>5) & 0x03); print("%12lud", f); } printitem(ctlr->name, "control"); printreg(inportb(Pdata)); vgaxo(Crtx, 0x31, crt31); } Ctlr ics534x = { "ics534x", /* name */ 0, /* snarf */ options, /* options */ init, /* init */ load, /* load */ dump, /* dump */ }; //GO.SYSIN DD VADIM /sys/src/cmd/aux/vga sum=`{sum < 810871888/ics534x.c} if(~ e28b94fa4307 $sum(1)^$sum(2)) echo if not{ echo 810871888/ics534x.c checksum error extracting new file exit checksum } target=810871888/trio64.c echo -n '810871888/trio64.c (new): ' cat > 810871888/trio64.c >[2]/dev/null <<'//GO.SYSIN DD VADIM /sys/src/cmd/aux/vga' #include #include #include "vga.h" /* * S3 Trio64. */ static void snarf(Vga *vga, Ctlr *ctlr) { int i; /* * The Trio has some extra sequencer registers which * need to be unlocked for access. */ vgaxo(Seqx, 0x08, 0x06); for(i = 0x08; i < 0x19; i++) vga->sequencer[i] = vgaxi(Seqx, i); vga->crt[0x2D] = vgaxi(Crtx, 0x2D); vga->crt[0x2E] = vgaxi(Crtx, 0x2E); vga->crt[0x2F] = vgaxi(Crtx, 0x2F); (*s3generic.snarf)(vga, ctlr); ctlr->flag |= Fsnarf; } static void options(Vga*, Ctlr *ctlr) { ctlr->flag |= Hlinear|Hpclk2x8|Henhanced|Foptions; } static void clock(Vga *vga, Ctlr *ctlr) { int d; ulong f, fmax, fmin, n, m, r; double trouble; /* * The PLL frequency is defined by the following equation: * (M+2) * Fout = ------------- x Fref * (N+2) x 2**R * where M, N and R have the following contraints: * 1) (M+2) x Fref * 135MHz <= ------------ <= 270MHz * (N+2) * 2) 1 <= M <= 127 * 3) 1 <= N <= 31 * 4) 0 <= R <= 3 * * First determine R: * 135MHz < 2**R x Fout <= 270Mhz */ vga->r = 4; for(r = 0; r <= 3; r++){ f = vga->f*(1<r = r; } if(vga->r > 3) error("%s: pclk %d out of range\n", ctlr->name, vga->f); /* * Now find the closest match for M and N. */ vga->d = vga->f+1; for(n = 1; n <= 31; n++){ trouble = vga->f*(n+2)*(1<r); trouble /= RefFreq; m = (trouble+0.5) - 2; if(m > 127) continue; trouble = (m+2)*RefFreq; trouble /= (n+2)*(1<r); f = trouble+0.5; d = vga->f - f; if(d < 0) d = -d; if(d <= vga->d){ vga->m = m; vga->n = n; vga->d = d; } } trouble = vga->f*1.005; fmax = trouble; trouble = vga->f*0.995; fmin = trouble; trouble = (vga->m+2)*RefFreq; trouble /= (vga->n+2)*(1<r); f = trouble+0.5; if(fmin >= f || f >= fmax) error("%s: pclk %d out of range\n", ctlr->name, vga->f); } static void init(Vga *vga, Ctlr *ctlr) { ulong pclk, x; (*s3generic.init)(vga, ctlr); /* * Clock bits. If the desired video clock is * one of the two standard VGA clocks it can just be * set using bits <3:2> of vga->misc, otherwise we * need to programme the DCLK PLL. */ if(vga->f == 0) vga->f = vga->mode->frequency; vga->misc &= ~0x0C; if(vga->f == VgaFreq0) ; else if(vga->f == VgaFreq1) vga->misc |= 0x04; else{ /* * Part comes in -135MHz speed grade. In 8-bit mode * the maximum DCLK is 80MHz. In 2x8-bit mode the maximum * DCLK is 135MHz using the internal clock doubler. */ if((ctlr->flag & Hpclk2x8) && vga->mode->z == 8){ pclk = 135000000; if(vga->f > 80000000) ctlr->flag |= Upclk2x8; } else pclk = 80000000; if(vga->f > pclk) error("%s: invalid pclk - %ld\n", ctlr->name, vga->f); clock(vga, ctlr); vga->sequencer[0x12] = (vga->r<<5)|vga->n; vga->sequencer[0x13] = vga->m; vga->misc |= 0x0C; } /* * Internal clock generator. */ vga->sequencer[0x15] &= ~0x31; vga->sequencer[0x15] |= 0x02; vga->sequencer[0x18] &= ~0x80; vga->crt[0x67] &= ~0xF2; if(ctlr->flag & Upclk2x8){ vga->sequencer[0x15] |= 0x10; vga->sequencer[0x18] |= 0x80; /* * There's a little strip of the border * appears on the left in resolutions * 1280 and above if the 0x02 bit isn't * set (when it appears on the right...). * set. */ vga->crt[0x67] |= 0x10; } /* * VLB address latch delay. */ if((vga->crt[0x36] & 0x03) == 0x01) vga->crt[0x58] &= ~0x08; /* * Start display FIFO fetch. */ x = vga->crt[0]-5; vga->crt[0x3B] = x; if(x & 0x100) vga->crt[0x5D] |= 0x40; /* * Display memory access control. * Calculation of the M-parameter (Crt54) is * memory-system and dot-clock dependent, the * values below are guesses from dumping * registers. */ vga->crt[0x60] = 0xFF; if(vga->mode->x <= 800) vga->crt[0x54] = 0xE8; else if(vga->mode->x <= 1024) vga->crt[0x54] = 0xA8; else vga->crt[0x54] = 0x00/*0x48*/; ctlr->flag |= Finit; } static void load(Vga *vga, Ctlr *ctlr) { ushort advfunc; (*s3generic.load)(vga, ctlr); vgaxo(Crtx, 0x60, vga->crt[0x60]); vgaxo(Crtx, 0x67, vga->crt[0x67]); /* * Load the PLL registers if necessary. * Not sure if the variable-delay method of setting the * PLL will work without a write here to vga->misc, * so use the immediate-load method by toggling bit 5 * of Seq15 if necessary. */ vgaxo(Seqx, 0x12, vga->sequencer[0x12]); vgaxo(Seqx, 0x13, vga->sequencer[0x13]); if((vga->misc & 0x0C) == 0x0C) vgaxo(Seqx, 0x15, vga->sequencer[0x15]|0x20); vgaxo(Seqx, 0x15, vga->sequencer[0x15]); vgaxo(Seqx, 0x18, vga->sequencer[0x18]); advfunc = 0x0000; if(ctlr->flag & Uenhanced) advfunc = 0x0001; outportw(0x4AE8, advfunc); } static void dump(Vga *vga, Ctlr *ctlr) { int i; ulong dclk, m, n, r; (*s3generic.dump)(vga, ctlr); printitem(ctlr->name, "Seq08"); for(i = 0x08; i < 0x19; i++) printreg(vga->sequencer[i]); printitem(ctlr->name, "Crt2D"); printreg(vga->crt[0x2D]); printreg(vga->crt[0x2E]); printreg(vga->crt[0x2F]); n = vga->sequencer[0x12] & 0x1F; r = (vga->sequencer[0x12]>>5) & 0x03; m = vga->sequencer[0x13] & 0x7F; dclk = (m+2)*RefFreq; dclk /= (n+2)*(1<name, "dclk m n r"); print("%9ld %8ld - %8ld %8ld\n", dclk, m, n, r); } Ctlr trio64 = { "trio64", /* name */ snarf, /* snarf */ options, /* options */ init, /* init */ load, /* load */ dump, /* dump */ }; //GO.SYSIN DD VADIM /sys/src/cmd/aux/vga sum=`{sum < 810871888/trio64.c} if(~ 41c12db35457 $sum(1)^$sum(2)) echo if not{ echo 810871888/trio64.c checksum error extracting new file exit checksum } target=810871888/vision964.c echo -n '810871888/vision964.c (new): ' cat > 810871888/vision964.c >[2]/dev/null <<'//GO.SYSIN DD VADIM /sys/src/cmd/aux/vga' #include #include #include "vga.h" /* * S3 Vision964 GUI Accelerator. */ static void snarf(Vga *vga, Ctlr *ctlr) { (*s3generic.snarf)(vga, ctlr); } static void options(Vga*, Ctlr *ctlr) { ctlr->flag |= /*Hlinear|*/Henhanced|Foptions; } static void init(Vga *vga, Ctlr *ctlr) { Mode *mode; ulong x; mode = vga->mode; if(vga->ramdac && (vga->ramdac->flag & Uclk2)){ resyncinit(vga, ctlr, Uenhanced, 0); vga->crt[0x00] = ((mode->ht/2)>>3)-5; vga->crt[0x01] = ((mode->x/2)>>3)-1; vga->crt[0x02] = ((mode->shb/2)>>3)-1; x = (mode->ehb/2)>>3; vga->crt[0x03] = 0x80|(x & 0x1F); vga->crt[0x04] = (mode->shb/2)>>3; vga->crt[0x05] = (x & 0x1F); if(x & 0x20) vga->crt[0x05] |= 0x80; vga->crt[0x13] = mode->x/8; } else if(mode->x == 8) resyncinit(vga, ctlr, Uenhanced, 0); (*s3generic.init)(vga, ctlr); if((ctlr->flag & Uenhanced) == 0) vga->crt[0x33] &= ~0x20; vga->crt[0x3B] = (vga->crt[0]+vga->crt[4]+1)/2; vga->crt[0x55] = 0x00; vga->crt[0x40] &= ~0x10; vga->crt[0x53] &= ~0x20; vga->crt[0x58] &= ~0x48; vga->crt[0x65] = 0x00; vga->crt[0x66] &= ~0x07; vga->crt[0x6D] = 0x00; if(ctlr->flag & Uenhanced){ vga->crt[0x40] |= 0x10; vga->crt[0x58] |= 0x40; if(vga->ramdac && (vga->ramdac->flag & Uclk2)){ vga->crt[0x66] |= 0x02; } else vga->crt[0x66] |= 0x03; vga->crt[0x65] |= 0x02; /* * Some heuristics (what part of aux/vga isn't?) * to prevent some of the right border appearing * on the left edge of the screen. */ if(mode->x > 1024) vga->crt[0x6D] = 0x01; else vga->crt[0x6D] = 0x03; } } static void load(Vga *vga, Ctlr *ctlr) { ushort advfunc; (*s3generic.load)(vga, ctlr); vgaxo(Crtx, 0x65, vga->crt[0x65]); vgaxo(Crtx, 0x66, vga->crt[0x66]); vgaxo(Crtx, 0x6D, vga->crt[0x6D]); advfunc = 0x0000; if(ctlr->flag & Uenhanced) advfunc = 0x0001; outportw(0x4AE8, advfunc); } static void dump(Vga *vga, Ctlr *ctlr) { (*s3generic.dump)(vga, ctlr); } Ctlr vision964 = { "vision964", /* name */ snarf, /* snarf */ options, /* options */ init, /* init */ load, /* load */ dump, /* dump */ }; //GO.SYSIN DD VADIM /sys/src/cmd/aux/vga sum=`{sum < 810871888/vision964.c} if(~ aad927bc2130 $sum(1)^$sum(2)) echo if not{ echo 810871888/vision964.c checksum error extracting new file exit checksum }