ref: 3b06ca8566fb90eaf4118144ea4750cea914ea9f
parent: c23715d2686823cc6821b218eb9e12691d9506fd
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Sun Jul 28 22:32:16 EDT 2013
ether82563: make link status work for 82567 on the 82567, reading any phy register just gives 0 back. however, the card works just fine and no action is required to (re-)start auto negotiation. so we add maclproc() which just reads the speed setting and link status from the mac status register instead of reading the phy registers. we'v probably seen this symptom on other cards (link: 0) like 82566. we should test if we can make link status work on these cards as well by just using the maclproc().
--- a/sys/src/9/pc/ether82563.c
+++ b/sys/src/9/pc/ether82563.c
@@ -1281,6 +1281,31 @@
}
static void
+maclproc(void *v)
+{+ uint i;
+ Ctlr *c;
+ Ether *e;
+
+ e = v;
+ c = e->ctlr;
+
+ for(;;){+ i = csr32r(c, Status);
+ e->link = (i & Lu) != 0;
+ i = (i >> 6) & 3; /* link speed 6:7 */
+ if(e->link == 0)
+ i = 3;
+ c->speeds[i]++;
+ e->mbps = speedtab[i];
+ c->lim = 0;
+ i82563im(c, Lsc);
+ c->lsleep++;
+ sleep(&c->lrendez, i82563lim, c);
+ }
+}
+
+static void
i82563attach(Ether *edev)
{char name[KNAMELEN];
@@ -1329,6 +1354,8 @@
kproc(name, pcslproc, edev); /* phy based serdes */
else if(cttab[ctlr->type].flag & F79phy)
kproc(name, phyl79proc, edev);
+ else if(ctlr->type == i82567)
+ kproc(name, maclproc, edev); /* use mac link status */
else
kproc(name, phylproc, edev);
--
⑨