From fecdad38352a753db69502bbfc7afb12f1bcdba0 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 30 Mar 2001 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2001-03-30 --- pc/ether82543gc.c | 65 ----------------------------------------------- pc/etherelnk3.c | 59 +++++++++++++++++++++--------------------- 2 files changed, 29 insertions(+), 95 deletions(-) diff --git a/pc/ether82543gc.c b/pc/ether82543gc.c index 9a221298ea488a7ec3d93946d36327f7ce95fdcf..9d9234a834f4b19c2ad05c53b9b2385a6f080696 100644 --- a/pc/ether82543gc.c +++ b/pc/ether82543gc.c @@ -344,8 +344,6 @@ gc82543attach(Ether* edev) csr32w(ctlr, Rctl, ctl); ctl = csr32r(ctlr, Tctl)|Ten; csr32w(ctlr, Tctl, ctl); -print("ctrl %8.8uX rctl %8.8uX tclt %8.8uX\n", - csr32r(ctlr, Ctrl), csr32r(ctlr, Rctl), csr32r(ctlr, Tctl)); } static char* statistics[Nstatistics] = { @@ -894,65 +892,6 @@ gc82543reset(Ctlr* ctlr) return 0; } -static int -mdir(Ctlr* ctlr, int p, int r) -{ - int mdic, timeo; - -print("mdir %uX\n", csr32r(ctlr, Mdic)); - if(!(csr32r(ctlr, Mdic) & MDIready)) - return -1; - csr32w(ctlr, Mdic, MDIrop|(p<>10; - print("phy%d: oui %uX reg1 %uX\n", p, oui, mdir(ctlr, p, 1)); - return p; - } - return -1; -} - static void gc82543pci(void) { @@ -987,12 +926,10 @@ gc82543pci(void) ctlr->id = (p->did<<16)|p->vid; ctlr->nic = KADDR(ctlr->port); -print("status0 %8.8uX\n", csr32r(ctlr, Status)); if(gc82543reset(ctlr)){ free(ctlr); continue; } -print("status1 %8.8uX\n", csr32r(ctlr, Status)); if(ctlrhead != nil) ctlrtail->next = ctlr; @@ -1045,8 +982,6 @@ gc82543pnp(Ether* edev) edev->ea[2*i+1] = ctlr->eeprom[i]>>8; } } -if(ctlr->pcidev->did == 0x1004) - scanphy(ctlr); gc82543init(edev); /* diff --git a/pc/etherelnk3.c b/pc/etherelnk3.c index e9bd2cc03d6f34fed75df3126d213aef8d87b68b..3461ef53fb3eb8023e22532030b498cc171b9d80 100644 --- a/pc/etherelnk3.c +++ b/pc/etherelnk3.c @@ -6,8 +6,7 @@ * autoSelect; * PCI latency timer and master enable; * errata list; - * rewrite all initialisation; - * handle the cyclone adapter. + * rewrite all initialisation. * * Product ID: * 9150 ISA 3C509[B] @@ -1716,7 +1715,8 @@ eepromdata(int port, int offset) int etherelnk3reset(Ether* ether) { - int anar, anlpar, busmaster, did, i, j, phyaddr, port, rxearly, rxstatus9, x, xcvr; + int anar, anlpar, phyaddr, phystat, timeo, xcvr; + int busmaster, did, i, j, port, rxearly, rxstatus9, x; Block *bp, **bpp; Adapter *ap; uchar ea[Eaddrlen]; @@ -1805,8 +1805,9 @@ etherelnk3reset(Ether* ether) /* * Check if the adapter's station address is to be overridden. - * If not, read it from the EEPROM and set in ether->ea prior to loading the - * station address in Wstation. The EEPROM returns 16-bits at a time. + * If not, read it from the EEPROM and set in ether->ea prior to + * loading the station address in Wstation. + * The EEPROM returns 16-bits at a time. */ memset(ea, 0, Eaddrlen); if(memcmp(ea, ether->ea, Eaddrlen) == 0){ @@ -1840,18 +1841,18 @@ etherelnk3reset(Ether* ether) xcvr = media[j].xcvr; } -/* - * forgive me, but i am weak - */ -if(did == 0x9055 || did == 0x9200){ - xcvr = xcvrMii; - XCVRDEBUG("905[BC] reset ops 0x%uX\n", - ins(port+ResetOp905B)); -} -else - if(xcvr & autoSelect) + /* + * forgive me, but i am weak + */ + if(did == 0x9055 || did == 0x9200){ + xcvr = xcvrMii; + txrxreset(port); + XCVRDEBUG("905[BC] reset ops 0x%uX\n", ins(port+ResetOp905B)); + } + else if(xcvr & autoSelect) xcvr = autoselect(port, xcvr, rxstatus9); XCVRDEBUG("autoselect returns: xcvr %uX, did 0x%uX\n", xcvr, did); + switch(xcvr){ case xcvrMii: @@ -1860,21 +1861,19 @@ else scanphy(port); */ phyaddr = 24; -for(i = 0; i < 7; i++) - XCVRDEBUG(" %2.2uX", miir(port, phyaddr, i)); -XCVRDEBUG("\n"); - -{ int phystat, timeo; - for(timeo = 0; timeo < 30; timeo++){ - phystat = miir(port, phyaddr, 0x01); - if(phystat & 0x20) - break; - XCVRDEBUG(" %2.2uX", phystat); - delay(100); - } - XCVRDEBUG(" %2.2uX", miir(port, phyaddr, 0x01)); - XCVRDEBUG("\n"); -} + for(i = 0; i < 7; i++) + XCVRDEBUG(" %2.2uX", miir(port, phyaddr, i)); + XCVRDEBUG("\n"); + + for(timeo = 0; timeo < 30; timeo++){ + phystat = miir(port, phyaddr, 0x01); + if(phystat & 0x20) + break; + XCVRDEBUG(" %2.2uX", phystat); + delay(100); + } + XCVRDEBUG(" %2.2uX", miir(port, phyaddr, 0x01)); + XCVRDEBUG("\n"); anar = miir(port, phyaddr, 0x04); anlpar = miir(port, phyaddr, 0x05) & 0x03E0;