From 5edcddb2b0c45549cedb1305f80922c8d269a540 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 15 Jun 2000 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2000-06-15 --- pc/etherec2t.c | 38 ++++++++++++++++++++++++++------------ port/devdraw.c | 5 +++++ port/devroot.c | 13 +------------ 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/pc/etherec2t.c b/pc/etherec2t.c index cd6ed105701b9a50a97d2889297a161f4f8ccc1a..c4f7689c20647c8310d87c5780fe228ecf6aa541 100644 --- a/pc/etherec2t.c +++ b/pc/etherec2t.c @@ -1,7 +1,5 @@ /* - * Linksys Combo PCMCIA EthernetCard (EC2T) - * and EtherFast 10/100 PC Card (PCMPC100). - * Supposedly NE2000 clones, see the comments in ether2000.c + * Supposed NE2000 PCMCIA clones, see the comments in ether2000.c */ #include "u.h" #include "../port/lib.h" @@ -21,8 +19,9 @@ enum { }; static char* ec2tpcmcia[] = { - "EC2T", - "PCMPC100", + "EC2T", /* Linksys Combo PCMCIA EthernetCard */ + "PCMPC100", /* EtherFast 10/100 PC Card */ + "EN2216", /* Accton EtherPair-PCMCIA */ nil, }; @@ -62,6 +61,15 @@ reset(Ether* ether) if((slot = pcmspecial(type, ether)) >= 0) break; } + if(ec2tpcmcia[i] == nil){ + for(i = 0; i < ether->nopt; i++){ + if(cistrncmp(ether->opt[i], "id=", 3)) + continue; + type = ðer->opt[i][3]; + if((slot = pcmspecial(type, ether)) >= 0) + break; + } + } if(slot < 0){ iofree(port); return -1; @@ -80,6 +88,12 @@ reset(Ether* ether) ctlr->pstop = ctlr->tstart + HOWMANY(ether->size, Dp8390BufSz); ctlr->dummyrr = 0; + for(i = 0; i < ether->nopt; i++){ + if(cistrcmp(ether->opt[i], "nodummyrr") == 0) + ctlr->dummyrr = 0; + else if(cistrncmp(ether->opt[i], "dummyrr=", 8) == 0) + ctlr->dummyrr = strtol(ðer->opt[i][8], nil, 0); + } /* * Reset the board. This is done by doing a read @@ -101,13 +115,7 @@ reset(Ether* ether) */ dp8390reset(ether); sum = 0; - if(strcmp(type, "PCMPC100")){ - memset(buf, 0, sizeof(buf)); - dp8390read(ctlr, buf, 0, sizeof(buf)); - if((buf[0x0E] & 0xFF) == 0x57 && (buf[0x0F] & 0xFF) == 0x57) - sum = 0xFF; - } - else{ + if(cistrcmp(type, "PCMPC100") == 0){ /* * The PCMPC100 has the ethernet address in I/O space. * There's a checksum over 8 bytes which sums to 0xFF. @@ -118,6 +126,12 @@ reset(Ether* ether) buf[i] = (x<<8)|x; } } + else{ + memset(buf, 0, sizeof(buf)); + dp8390read(ctlr, buf, 0, sizeof(buf)); + if((buf[0x0E] & 0xFF) == 0x57 && (buf[0x0F] & 0xFF) == 0x57) + sum = 0xFF; + } if(sum != 0xFF){ pcmspecialclose(slot); iofree(ether->port); diff --git a/port/devdraw.c b/port/devdraw.c index 54ce61675c93e99e1f25536c2b0bb721c48377d3..f0eba384e7e92ae291554e2c6d26a5d06ae07d2f 100644 --- a/port/devdraw.c +++ b/port/devdraw.c @@ -756,6 +756,11 @@ drawnewclient(void) int drawhasclients(void) { + /* + * if draw has ever been used, we can't resize the frame buffer, + * even if all clients have exited (nclients is cumulative); it's too + * hard to make work. + */ return sdraw.nclient != 0; } diff --git a/port/devroot.c b/port/devroot.c index 155ce2b1558e5814e52d298bf6b6d10a334fdccc..5f6b39314efd1a714e3b71c51086cd3fb193d155 100644 --- a/port/devroot.c +++ b/port/devroot.c @@ -176,17 +176,6 @@ rootwrite(Chan *c, void*, long, vlong) return 0; } -static void -rootcreate(Chan *c, char *name, int mode, ulong perm) -{ - if(!iseve() || c->qid.path != (CHDIR|Qdir) || - (perm & CHDIR) == 0 || mode != OREAD) - error(Eperm); - addrootdir(name); - c->flag |= COPEN; - c->mode = OREAD; -} - Dev rootdevtab = { '/', "root", @@ -198,7 +187,7 @@ Dev rootdevtab = { rootwalk, rootstat, rootopen, - rootcreate, + devcreate, rootclose, rootread, devbread,