From 004c679d006b5955f8c30bb6eea99c3d45bf963b Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 8 Oct 2002 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2002-10-08 --- pc/ether2114x.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/pc/ether2114x.c b/pc/ether2114x.c index bc2d7aa0a5b783b2c14b1ef258203978698cae91..854fcae769518278d608af594cf6bc1b95351963 100644 --- a/pc/ether2114x.c +++ b/pc/ether2114x.c @@ -188,6 +188,7 @@ enum { /* Variants */ Tulip3 = (0x0019<<16)|0x1011, Pnic = (0x0002<<16)|0x11AD, Pnic2 = (0xC115<<16)|0x11AD, + CentaurP = (0x0985<<16)|0x1317, }; typedef struct Ctlr Ctlr; @@ -989,7 +990,7 @@ typephymode(Ctlr* ctlr, uchar* block, int wait) if(!wait) return 0; - for(timeo = 0; timeo < 30; timeo++){ + for(timeo = 0; timeo < 45; timeo++){ if(typephylink(ctlr, block)) return 0; delay(100); @@ -1361,7 +1362,7 @@ srom(Ctlr* ctlr) } /* - * There are 2 SROM layouts: + * There are at least 2 SROM layouts: * e.g. Digital EtherWORKS station address at offset 20; * this complies with the 21140A SROM * application note from Digital; @@ -1383,9 +1384,10 @@ srom(Ctlr* ctlr) } /* - * Fake up the SROM for the PNIC. - * It looks like a 21140 with a PHY. - * The MAC address is byte-swapped in the orginal SROM data. + * Fake up the SROM for the PNIC and AMDtek. + * They look like a 21140 with a PHY. + * The MAC address is byte-swapped in the orginal + * PNIC SROM data. */ if(ctlr->id == Pnic){ memmove(&ctlr->srom[20], leafpnic, sizeof(leafpnic)); @@ -1394,6 +1396,13 @@ srom(Ctlr* ctlr) ctlr->srom[20+i+1] = ctlr->srom[i]; } } + if(ctlr->id == CentaurP){ + memmove(&ctlr->srom[20], leafpnic, sizeof(leafpnic)); + for(i = 0; i < Eaddrlen; i += 2){ + ctlr->srom[20+i] = ctlr->srom[8+i]; + ctlr->srom[20+i+1] = ctlr->srom[8+i+1]; + } + } /* * Next, try to find the info leaf in the SROM for media detection. @@ -1466,8 +1475,11 @@ srom(Ctlr* ctlr) if(phy){ x = 0; for(k = 0; k < nelem(ctlr->phy); k++){ + if(ctlr->id == CentaurP && k != 1) + continue; if((oui = miir(ctlr, k, 2)) == -1 || oui == 0) continue; +debug("phy reg 2 %4.4uX\n", oui); if(DEBUG){ oui = (oui & 0x3FF)<<6; oui |= miir(ctlr, k, 3)>>10; @@ -1510,9 +1522,10 @@ dec2114xpci(void) pcicfgw32(p, 0x40, x); /*FALLTHROUGH*/ + case Tulip0: /* 21140 */ case Pnic: /* PNIC */ case Pnic2: /* PNIC-II */ - case Tulip0: /* 21140 */ + case CentaurP: /* ADMtek */ break; } @@ -1555,6 +1568,20 @@ dec2114xpci(void) */ csr32w(ctlr, 15, 0x00000001); break; + case CentaurP: + /* + * Nice - the register offsets change from *8 to *4 + * for CSR16 and up... + * CSR25/26 give the MAC address read from the SROM. + * Don't really need to use this other than as a check, + * the SROM will be read in anyway so the value there + * can be used directly. + */ + debug("csr25 %8.8luX csr26 %8.8luX\n", + inl(ctlr->port+0xA4), inl(ctlr->port+0xA8)); + debug("phyidr1 %4.4luX phyidr2 %4.4luX\n", + inl(ctlr->port+0xBC), inl(ctlr->port+0xC0)); + break; } if(ctlrhead != nil)