Subject: Ethernet, MII, and multiple PHYs
To: None <tech-net@netbsd.org>
From: Erik E. Fair <fair@clock.org>
List: tech-net
Date: 10/16/2002 18:45:04
It looks like we don't properly support multiple PHYs on MII in
the majority of our Ethernet drivers, even though we have the
infrastructure for it.
I found this because I'm trying to make the Ethernet in a wierd
little all-in-one "legacy free" PC work. It's an AMD EasyNow PC,
based around a 450 MHz K6-2, and SiS system chips. Included in one
of those system chips is the core for a SiS 900 Ethernet I/F, but
with an AMD Am79c901 external PHY chip, which presents two PHYs on
the MII: one for HomePNA (1Mb/s networking over home telephone
wires), and a standard 10base-T+FDX PHY (802.3u compliant, so
claimed).
Dmesg and some other information can be found in PR kern/18590.
I just added a commit to sys/dev/pci/if_sip.c that we might want
to make in almost every ethernet driver we have. I changed the
second argument of the call to ifmedia_init() from zero, to IFM_IMASK.
This changes the behavior in ifmedia_match() so that PHY instance
number doesn't matter when attempting to match for a PHY with
particular capabilities; this is key if multiple PHYs are attached
with non-zero instance numbers, because if ifmedia_match() fails,
you get a panic.
Most of the rest of the Ethernet drivers in sys/dev/pci and sys/dev/ic
also call ifmedia_init() with zero in the second argument.
The other irritation is that the "instance" number you give
ifconfig(8) if you want to select a particular PHY does not map
1:1 with the PHY number as probed on the MII. Since all we tell
the users when we probe at boot time is the PHY number, we ought
to use that number directly.
comments? discussion?
Erik <fair@clock.org>