recently i got my machine into a state were it would never link. after quite a while with the documentation, and puzzling over how the existing the phy code in ether1116 matches, i think i've gotten to the bottom of the problems. i don't currently have a working guru or sheva. i'd be interested if anyone tries this on one of those machines. here's the breakdown of the changes, and some commentary on what and why it was changed: - first and foremost, reg->phy was being set to ctlrno in reset(). this is not correct for any phy we know about. one usually gets 8, 9 or 8, 24. since this register is already correct, just use it. since this register controls mac/phy interaction during autonegotiation, incorrect setting explains failure to link. /n/dump/2011/1023/sys/src/9/kw/ether1116.c:1718,1724 - ether1116.c:1630,1635 - since we already have a correct phy, and the documentation says that the smi register is only connected for mac0, we don't need mymii(). also, setting ctlrs[1]->mii == ctlrs[0]->mii, means that mii->curphy is wrong for one (ctlr[1]). use different mii structures that differ only in ->currphy instead to correct this. /n/dump/2011/1023/sys/src/9/kw/ether1116.c:1213,1230 - ether1116.c:1120,1139 /n/dump/2011/1023/sys/src/9/kw/ether1116.c:1096,1203 - ether1116.c:1101,1110 - additionally, since the phy is now correct, we can reset the phy in kirkwoodmii(). the original code didn't work for me. /n/dump/2011/1023/sys/src/9/kw/ether1116.c:1213,1230 - ether1116.c:1120,1139 - miiwr() and miird() didn't match the documentation. this has been corrected. in addition, it seems to me that we need to lock smi access as it's shared between macs, and there are two-phase operations. /n/dump/2011/1023/sys/src/9/kw/ether1116.c:993,1022 - ether1116.c:996,1023 /n/dump/2011/1023/sys/src/9/kw/ether1116.c:1026,1051 - ether1116.c:1027,1054 /n/dump/2011/1023/sys/src/9/kw/ether1116.c:1052,1058 - ether1116.c:1055,1060 /n/dump/2011/1023/sys/src/9/kw/ether1116.c:1061,1072 - ether1116.c:1063,1077 - the Bmsr register has a wierd protocol, and requires a back-to-back read to get the current value rather than the last edge. so a few eads in kirkwoodmii() were doubled. when we are resetting the link, this is key to seeing a link. /n/dump/2011/1023/sys/src/9/kw/ether1116.c:1233,1238 - ether1116.c:1142,1148 - in ctlrinit, miiphyinit, turn on phy interrupts so we can get link events. /n/dump/2011/1023/sys/src/9/kw/ether1116.c:1496,1504 - ether1116.c:1408,1416 /n/dump/2011/1023/sys/src/9/kw/ether1116.c:1307,1312 - ether1116.c:1217,1224 - in interrupt() set the link both on link down and on link up. /n/dump/2011/1023/sys/src/9/kw/ether1116.c:883,890 - ether1116.c:883,892 /n/dump/2011/1023/sys/src/9/kw/ether1116.c:893,899 - ether1116.c:895,901 /n/dump/2011/1023/sys/src/9/kw/ether1116.c:916,921 - ether1116.c:918,924 - erik