#!/bin/rc # # command: /bin/boddle /n/juke/plan_9/sys/src/9/pc/devi82365.c devi82365.c # srcdir: /n/juke/plan_9/sys/src/9/pc # version: 905143291 # date: Mon Sep 7 00:41:31 EDT 1998 # myname=$0 doextract=no fn usage{ echo $myname: usage: $myname '[-X] [src-directory]' >[1=2] exit usage } fn sigint{ rm -rf 905143291 exit interrupt } while(~ $1 -*){ switch($1){ case -X doextract=yes case -* usage } shift } switch($#*){ case 0 srcdir=/sys/src/9/pc 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 905143291 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 905143291 mkdir 905143291 target=905143291/devi82365.c echo -n '905143291/devi82365.c: ' if(! test -f $srcdir/devi82365.c || ! test -r $srcdir/devi82365.c){ echo $srcdir/devi82365.c unreadable exit unreadable } sum=`{sum < $srcdir/devi82365.c} if(! ~ ee2c456424234 $sum(1)^$sum(2)){ echo $srcdir/devi82365.c is not the original distribution file exit original } cp $srcdir/devi82365.c 905143291/devi82365.c ed 905143291/devi82365.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM devi82365.c' 1323a } /* * oldness */ void i82365init(void) { } Chan * i82365clone(Chan *c, Chan *nc) { return devclone(c, nc); } void i82365create(Chan *c, char *name, int omode, ulong perm) { USED(c, name, omode, perm); error(Eperm); } void i82365remove(Chan *c) { USED(c); error(Eperm); } void i82365wstat(Chan *c, char *dp) { USED(c, dp); error(Eperm); . 1309d 1303,1304c static void tvers1(Slot *pp, int ) . 1236,1237d 1230,1231c static void tentry(Slot *pp, int ) . 1176c static void . 1043d 1038c tcfig(Slot *pp, int ) . 1009a if(type == 0xFF) break; . 915a if(isa->port == 0 && ct->port == 0) return -1; . 908,914c if(ct == et || ct->nioregs == 0) . 906a if(ct == 0){ /* assume default is right */ if(pp->def) ct = pp->def; else ct = pp->ctab; /* try for best match */ if(ct->nioregs == 0 || ct->port != isa->port || ((1<irqs) == 0){ for(t = pp->ctab; t < et; t++) if(t->nioregs && t->port == isa->port && ((1<irqs)){ ct = t; break; } } if(ct->nioregs == 0 || ((1<irqs) == 0){ for(t = pp->ctab; t < et; t++) if(t->nioregs && ((1<irqs)){ ct = t; break; } } if(ct->nioregs == 0){ for(t = pp->ctab; t < et; t++) if(t->nioregs){ ct = t; break; } } } . 902,905c et = &pp->ctab[pp->nctab]; ct = 0; for(i = 0; i < isa->nopt; i++){ if(strncmp(isa->opt[i], "index=", 6)) continue; index = strtol(&isa->opt[i][6], &cp, 0); if(cp == &isa->opt[i][6] || index >= pp->nctab) return -1; ct = &pp->ctab[index]; . 889c int i, index, irq; char *cp; . 887c Conftab *ct, *et, *t; . 880c * configuration info from the CIS. If not, we won't set up correctly. . 875c error(Ebadarg); return -1; /* not reached */ . 871,873c return n; . 868c n = pcmwrite(pp->slotno, TYPE(c) == Qattr, a, n, off); . 861,862c switch(TYPE(c)){ case Qctl: if(n >= sizeof(buf)) n = sizeof(buf) - 1; strncpy(buf, a, n); buf[n] = 0; pp = slot + SLOTNO(c); if(!pp->occupied) error(Eio); /* set vpp on card */ if(strncmp(buf, "vpp", 3) == 0) wrreg(pp, Rpc, vcode(atoi(buf+3))|Fautopower|Foutena|Fcardena); return n; . 859a char buf[32]; . 858d 856c i82365write(Chan *c, void *a, long n, ulong off) . 844,845c memmoveb((uchar*)(KZERO|(m->isa + offset - m->ca)), ac, i); . 820a ulong offset = off; . 818d 814c pcmwrite(int dev, int attr, void *a, long n, ulong off) . 804,811d 802c error(Ebadarg); return -1; /* not reached */ . 797,800c n = readstr(offset, a, n, p); free(p); return n; . 792,795c len += snprint(p+len, READSTR-len, "busy\n"); snprint(p+len, READSTR-len, "battery lvl %d\n", pp->battery); . 790c len += snprint(p+len, READSTR-len, "write protected\n"); . 788c len += snprint(p+len, READSTR-len, "configed\n"); . 786c len += snprint(p+len, READSTR-len, "powered\n"); . 784c len += snprint(p+len, READSTR-len, "enabled\n"); . 782c len += snprint(p+len, READSTR-len, "occupied\n"); . 780a . 779c p = malloc(READSTR); len = 0; . 777c return pcmread(SLOTNO(c), TYPE(c) == Qattr, a, n, off); . 771,772c switch(TYPE(c)){ . 769a ulong offset = off; . 767,768c char *p; int len; . 765c i82365read(Chan *c, void *a, long n, ulong off) . 753,754c memmoveb(ac, (uchar*)(KZERO|(m->isa + offset - m->ca)), i); . 729a ulong offset = off; . 727d 723c pcmread(int slotno, int attr, void *a, long n, ulong off) . 668,688d 653c Chan* . 635,640d 624,629c Chan* . 621c if(ncontroller) setvec(vector, i82365intr, 0); . 616c wrreg(pp, Rcscic, ((vector-Int0vec)<<4) | Fchangeena); rdreg(pp, Rcsc); . 606a print("#y%d: %d slot %s: port 0x%uX irq %d\n", i, cp->nslot, chipname[cp->type], cp->xreg, vector-Int0vec); . 593a memset(&isa, 0, sizeof(ISAConf)); vector = PCMCIAvec; if(isaconfig("pcmcia", 0, &isa) && isa.irq) vector = Int0vec+isa.irq; . 588a ISAConf isa; . 586c int i, j, vector; . 572,574c if((i&0x0F) == 0) print("\n%2.2uX: ", i); if(((i+1) & 0x0F) == 0x08) print(" - "); print("%2.2uX ", rdreg(pp, i)); . 560c c = inb(d); outb(d, c & ~Flowpow); . 555,556c if(cp->type == Ti82365){ outb(x, 0x0E + (dev<<7)); outb(x, 0x37 + (dev<<7)); outb(x, 0x3A + (dev<<7)); c = inb(d); outb(d, c|0xC0); outb(x, Rid + (dev<<7)); c = inb(d); if(c != id && !(c & 0x08)) print("#y%d: id %uX changed to %uX\n", ncontroller, id, c); if(c & 0x08) cp->type = Tvg46x; outb(x, 0x3A + (dev<<7)); c = inb(d); outb(d, c & ~0xC0); } . 541,546c if((c & 0xc0) != 0xc0) break; c = inb(d); if((c & 0xc0) != 0x00) break; if(c & 0x20){ . 536a case 0x84: . 534c switch(id){ . 523,524c id = inb(d); if((id & 0xf0) != 0x80) . 519c uchar c, id; . 513a [Tvg46x] "Vadem VG-46x", . 482,483c if(i >= 3*nslot) . 474c pcmgen(Chan *c, Dirtab *, int , int i, Dir *dp) . 403d 360c m->isa = getisa(0, len, Mgran)&~KZERO; /* PADDR(umbmalloc(0, len, Mgran)); */ . 357c putisa(m->isa, m->len); /* umbfree(m->isa, m->len); */ . 297d 292,295c if(!pp->occupied) . 283d 277,278c void i82365intr(Ureg *, void *) . 191a static void i82365dump(Slot*); . 187c void i82365reset(void); . 133c ulong nioregs; /* number of io registers */ . 113a Tvg46x, . 9a #define READSTR 1000 /* brazilism */ . 8d wq //GO.SYSIN DD VADIM devi82365.c sum=`{sum < 905143291/devi82365.c} if(~ c4e4736625787 $sum(1)^$sum(2)) echo if not{ echo 905143291/devi82365.c checksum error creating updated file exit checksum }