From 2daec0b5fc69bba8f7fb6f4736debfe5bc837a28 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 6 Jun 2000 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2000-06-06 --- pc/devastar.c | 2 +- pc/sdata.c | 37 ++++++++++++++++++++++--------------- pc/vgamach64xx.c | 2 ++ port/devbridge.c | 16 +++++----------- 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/pc/devastar.c b/pc/devastar.c index 88a1d144da7483ee9c6b0b2ab3aa64273f31b014..9a18277c0f2647ababaeb4fb4f9679cf639473f4 100644 --- a/pc/devastar.c +++ b/pc/devastar.c @@ -432,7 +432,7 @@ astarreset(void) a->ramsize = 0; /* check all possible names */ - if(cistrcmp(a->type, "a100i") == 0 || cistrcmp(a->type,"A100I") == 0) + if(cistrcmp(a->type, "a100i") == 0) a->ramsize = 16*1024; else if(cistrcmp(a->type, "a200i") == 0 || cistrcmp(a->type,"A200I") == 0 || diff --git a/pc/sdata.c b/pc/sdata.c index c65816ab27e926034e6712ec2979271266b2509f..b104b1f70ca12e491f6b93b4f592697b5b5315dd 100644 --- a/pc/sdata.c +++ b/pc/sdata.c @@ -340,7 +340,7 @@ atadebug(int cmdport, int ctlport, char* fmt, ...) n--; n += snprint(buf+n, PRINTSIZE-n, " ataregs 0x%uX:", cmdport); - for(i = 1; i < 7; i++) + for(i = Features; i < Command; i++) n += snprint(buf+n, PRINTSIZE-n, " 0x%2.2uX", inb(cmdport+i)); if(ctlport) @@ -366,7 +366,7 @@ ataready(int cmdport, int ctlport, int dev, int reset, int ready, int micro) * Wait for the controller to become not busy and * possibly for a status bit to become true (usually * Drdy). Must change to the appropriate device - * register set before testing for ready. + * register set if necessary before testing for ready. * Always run through the loop at least once so it * can be used as a test for !Bsy. */ @@ -385,8 +385,7 @@ ataready(int cmdport, int ctlport, int dev, int reset, int ready, int micro) } if(micro-- <= 0){ - atadebug(0, 0, "ataready: %d 0x%2.2uX\n", - micro, as); + atadebug(0, 0, "ataready: %d 0x%2.2uX\n", micro, as); break; } microdelay(1); @@ -417,35 +416,43 @@ atacsfenabled(Drive* drive, vlong csf) static int atasetrwmode(Drive* drive, int cmdport, int ctlport, int dev) { - int as, block; + int as, maxrwm, rwm; drive->block = drive->secsize; drive->pior = Crs; drive->piow = Cws; - if((block = drive->info[Imaxrwm] & 0xFF) == 0) + maxrwm = (drive->info[Imaxrwm] & 0xFF); + if(maxrwm == 0) return 0; /* - * Prior to ATA-4 there was no way to determine the - * current block count (now in Irwm). * Sometimes drives come up with the current count set - * to 0, so always set a suitable value. + * to 0; if so, set a suitable value, otherwise believe + * the value in Irwm if the 0x100 bit is set. */ - if(ataready(cmdport, ctlport, dev, Bsy|Drq, Drdy, 100*1000) < 0) + if(drive->info[Irwm] & 0x100) + rwm = (drive->info[Irwm] & 0xFF); + else + rwm = 0; + if(rwm == 0) + rwm = maxrwm; + if(rwm > 16) + rwm = 16; + if(ataready(cmdport, ctlport, dev, Bsy|Drq, Drdy, 102*1000) < 0) return 0; - outb(cmdport+Sector, block); + outb(cmdport+Sector, rwm); outb(cmdport+Command, Csm); microdelay(1); as = ataready(cmdport, ctlport, dev, Bsy, Drdy|Df|Err, 1000); + inb(cmdport+Status); if(as < 0 || (as & (Df|Err))) - return -1; + return 0; - drive->info[Irwm] = 0x100|block; - drive->block = block*drive->secsize; + drive->block = rwm*drive->secsize; drive->pior = Crsm; drive->piow = Cwsm; - return block; + return rwm; } static Drive* diff --git a/pc/vgamach64xx.c b/pc/vgamach64xx.c index a5ca070414c719da7d06fbde4ec2d754881571ff..e9a19fac0da43755efb9e3ded3631068ed00f2ea 100644 --- a/pc/vgamach64xx.c +++ b/pc/vgamach64xx.c @@ -25,6 +25,8 @@ static ushort mach64xxdid[] = { ('G'<<8)|'Q', ('G'<<8)|'T', ('G'<<8)|'U', + ('G'<<8)|'V', + ('G'<<8)|'Z', ('V'<<8)|'T', ('V'<<8)|'U', ('L'<<8)|'I', diff --git a/port/devbridge.c b/port/devbridge.c index 61e752737975c073efec667ab4a87b03abd84968..0fce23ac56286a4089d1b0960ad29eb43de18d0e 100644 --- a/port/devbridge.c +++ b/port/devbridge.c @@ -256,21 +256,10 @@ bridgeopen(Chan* c, int omode) switch(TYPE(c->qid)) { default: break; - case Qtopdir: - case Qbridgedir: - case Qportdir: - case Qstatus: - case Qlocal: - case Qstats: - if(omode != OREAD) - error(Eperm); - break; case Qlog: logopen(b); break; case Qcache: - if(omode != OREAD) - error(Eperm); c->aux = cachedump(b); break; } @@ -341,6 +330,11 @@ bridgeread(Chan *c, void *a, long n, vlong off) n = readstr(off, a, n, buf); qunlock(b); return n; + case Qbctl: + snprint(buf, sizeof(buf), "%s tcpmss\ndelay %ld %ld\n", b->tcpmss ? "set" : "clear", + b->delay0, b->delayn); + n = readstr(off, a, n, buf); + return n; case Qcache: n = readstr(off, a, n, c->aux); return n;