From 6d5b92b486c8d398571c698ccc8c3fcf35a99b34 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 1 Jun 1996 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1996-06-01 --- pc/devether.c | 16 ++++++++++------ pc/ether82557.c | 5 +++-- pc/etherif.h | 1 + port/devssl.c | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/pc/devether.c b/pc/devether.c index 16984ac0062b294e8b7ab20a8678b3eab27ea708..8c6457ae110f5010dd14af07c2be6683442a73e7 100644 --- a/pc/devether.c +++ b/pc/devether.c @@ -214,6 +214,8 @@ etherreset(void) if(ctlr == 0) ctlr = malloc(sizeof(Ether)); memset(ctlr, 0, sizeof(Ether)); + ctlr->ctlrno = ctlrno; + ctlr->mbps = 10; if(isaconfig("ether", ctlrno, ctlr) == 0) continue; for(n = 0; cards[n].type; n++){ @@ -231,23 +233,25 @@ etherreset(void) ctlr->irq = 9; setvec(Int0vec+ctlr->irq, ctlr->interrupt, ctlr); - print("ether%d: %s: port 0x%luX irq %d", - ctlrno, ctlr->type, ctlr->port, ctlr->irq); + print("ether%d: %s: %dMbps port 0x%luX irq %d", + ctlrno, ctlr->type, ctlr->mbps, ctlr->port, ctlr->irq); if(ctlr->mem) print(" addr 0x%luX", ctlr->mem & ~KZERO); if(ctlr->size) print(" size 0x%luX", ctlr->size); - print(":"); + print(": "); for(i = 0; i < sizeof(ctlr->ea); i++) - print(" %2.2uX", ctlr->ea[i]); + print("%2.2uX", ctlr->ea[i]); print("\n"); - netifinit(ctlr, "ether", Ntypes, 32*1024); + if(ctlr->mbps == 100) + netifinit(ctlr, "ether", Ntypes, 100*1024); + else + netifinit(ctlr, "ether", Ntypes, 32*1024); ctlr->alen = Eaddrlen; memmove(ctlr->addr, ctlr->ea, sizeof(ctlr->ea)); memmove(ctlr->bcast, etherbcast, sizeof(etherbcast)); - ctlr->ctlrno = ctlrno; ether[ctlrno] = ctlr; ctlr = 0; break; diff --git a/pc/ether82557.c b/pc/ether82557.c index d26f517db4510cac394f848dc01da20065d75900..7d3dff054c8133f179937f00a4ddc506a8239f17 100644 --- a/pc/ether82557.c +++ b/pc/ether82557.c @@ -214,7 +214,7 @@ static uchar configdata[24] = { 0x60, /* inter-frame spacing */ 0x00, 0xF2, - 0x48, /* promiscuous mode off */ + 0xC8, /* promiscuous mode off */ 0x00, 0x40, 0xF2, /* transmit padding enable */ @@ -652,7 +652,8 @@ reset(Ether* ether) x = dp83840r(ctlr, i, 0x1B); if((x & 0x0200) == 0){ ctlr->configdata[8] = 1; - ctlr->configdata[15] |= 0x80; + ctlr->configdata[15] &= ~0x80; + ether->mbps = 100; } break; } diff --git a/pc/etherif.h b/pc/etherif.h index af232afcf9980242bc8b111c8ab42892c9b379eb..f58d0151f6aa77f307287de11e890cddc338bd91 100644 --- a/pc/etherif.h +++ b/pc/etherif.h @@ -7,6 +7,7 @@ typedef struct Ether Ether; struct Ether { ISAConf; /* hardware info */ int ctlrno; + int mbps; /* Mbps */ void (*attach)(Ether*); /* filled in by reset routine */ long (*write)(Ether*, void*, long); diff --git a/port/devssl.c b/port/devssl.c index 18d6472130b28989858ebb2de84afceb31178634..7a9db1c333262309a738307ceda28d2f690d3797 100644 --- a/port/devssl.c +++ b/port/devssl.c @@ -184,7 +184,7 @@ sslclose(Chan *c) s = c->aux; dighangup(s); if(s->c) - cclose(s->c); + close(s->c); if(s->in.secret) free(s->in.secret); if(s->out.secret)