diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-02-20 22:01:54 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-02-20 22:01:54 +0100 |
commit | a32d11dff358f60d6184fe8c9a0521cf878c6a4f (patch) | |
tree | 55983fd523de2ee0006cf6e19489ef705d8694ae /sys/src/9/pc | |
parent | 55373a649820a952ca26f5f315a8a2c60997a480 (diff) |
ether82563: work arround phyprobe() failing on 82579LM without cable plugged in (thanks mischief)
on 82579LM, the phy status is inaccessible without
a cable plugged, so we wait and retry phyprobe() once
the link status changes.
Diffstat (limited to 'sys/src/9/pc')
-rw-r--r-- | sys/src/9/pc/ether82563.c | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/sys/src/9/pc/ether82563.c b/sys/src/9/pc/ether82563.c index cf116a824..6cf819881 100644 --- a/sys/src/9/pc/ether82563.c +++ b/sys/src/9/pc/ether82563.c @@ -1180,6 +1180,15 @@ phyprobe(Ctlr *c, uint mask) } static void +lsleep(Ctlr *c, uint m) +{ + c->lim = 0; + i82563im(c, m); + c->lsleep++; + sleep(&c->lrendez, i82563lim, c); +} + +static void phyl79proc(void *v) { uint a, i, r, phy, phyno; @@ -1188,15 +1197,12 @@ phyl79proc(void *v) e = v; c = e->ctlr; - - phyno = phyprobe(c, 3<<1); - if(phyno == ~0){ - print("%s: no phy, exiting\n", up->text); - pexit("no phy", 1); - } - while(waserror()) ; + + while((phyno = phyprobe(c, 3<<1)) == ~0) + lsleep(c, Lsc); + for(;;){ phy = phyread(c, phyno, Phystat); if(phy == ~0){ @@ -1216,10 +1222,7 @@ next: i = 3; c->speeds[i]++; e->mbps = speedtab[i]; - c->lim = 0; - i82563im(c, Lsc); - c->lsleep++; - sleep(&c->lrendez, i82563lim, c); + lsleep(c, Lsc); } } @@ -1232,18 +1235,15 @@ phylproc(void *v) e = v; c = e->ctlr; + while(waserror()) + ; - phyno = phyprobe(c, 3<<1); - if(phyno == ~0){ - print("%s: no phy, exiting\n", up->text); - pexit("no phy", 1); - } + while((phyno = phyprobe(c, 3<<1)) == ~0) + lsleep(c, Lsc); if(c->type == i82573 && (phy = phyread(c, phyno, Phyier)) != ~0) phywrite(c, phyno, Phyier, phy | Lscie | Ancie | Spdie | Panie); - while(waserror()) - ; for(;;){ phy = phyread(c, phyno, Physsr); if(phy == ~0){ @@ -1280,10 +1280,7 @@ next: e->mbps = speedtab[i]; if(c->type == i82563) phyerrata(e, c, phyno); - c->lim = 0; - i82563im(c, Lsc); - c->lsleep++; - sleep(&c->lrendez, i82563lim, c); + lsleep(c, Lsc); } } @@ -1296,11 +1293,11 @@ pcslproc(void *v) e = v; c = e->ctlr; + while(waserror()) + ; if(c->type == i82575 || c->type == i82576) csr32w(c, Connsw, Enrgirq); - while(waserror()) - ; for(;;){ phy = csr32r(c, Pcsstat); e->link = phy & Linkok; @@ -1311,10 +1308,7 @@ pcslproc(void *v) csr32w(c, Pcsctl, csr32r(c, Pcsctl) | Pan | Prestart); c->speeds[i]++; e->mbps = speedtab[i]; - c->lim = 0; - i82563im(c, Lsc | Omed); - c->lsleep++; - sleep(&c->lrendez, i82563lim, c); + lsleep(c, Lsc | Omed); } } @@ -1327,7 +1321,6 @@ serdeslproc(void *v) e = v; c = e->ctlr; - while(waserror()) ; for(;;){ @@ -1341,10 +1334,7 @@ serdeslproc(void *v) i = 2; c->speeds[i]++; e->mbps = speedtab[i]; - c->lim = 0; - i82563im(c, Lsc); - c->lsleep++; - sleep(&c->lrendez, i82563lim, c); + lsleep(c, Lsc); } } |