Sync MII support with NetBSD/OpenBSD:
- Standard conforming GMII support:
1) replace mii_media_add() with mii_phy_add_media().
2) ukphy has generic GMII support now, thus retire nvphy.
- Factor common code of PHY modules out into mii_physubr.c, noticably
mii_phy_{set_media, tick, update}().
In order to support this refactoring:
1) mii_softc.{mii_reset,mii_status} funtion pointers are added, which are
used to reset PHY modules and get PHY modules' status.
2) mii_softc.mii_anegticks is added, which is used by PHY modules to tell
mii_phy_tick(), how often auto-negociation should happen. Two commonly
used values are defined as MII_ANEGTICKS and MII_ANEGTICKS_GIGE.
mii_softc.mii_anegticks is set to MII_ANEGTICKS by default.
- Add mii_softc.mii_media_status and rename mii_softc.mii_active to
mii_softc.mii_media_active. Now changes in either one of them will cause
MIIBUS_STATCHG() being involked.
- For PHY modules that utilize mii_phy_add_media(), ifmedia_entry.ifm_data
no longer stores value of BMCR. It stores an index of mii_media_table[],
which stores BMCR, ANAR and GTCR.
- Replace slightly different PHY modules detach routines with ukphy_detach().
- Use OUI and MODEL id array + mii_phy_match() in PHY modules probe routines,
instead of original large `if, else if' or `switch' code segment.
- Support more OUIs and MODELs in individual PHY module.
- Make the usage of `mii' and `sc' stack variable more consistent. `mii'
refers to miibus softc, while `sc' refers to PHY module softc.
- Nuke no longer used functions' definition and declaration.
- Regen miidevs.h
Following PHY modules were tested:
acphy(dc), brgphy(bge), e1000phy(nv,sk), exphy(xl), inphy(fxp), rgephy(re),
rlphy(rl), ruephy(rue), ukphy(nv,vr,...)
MII generic code is mainly synced with NetBSD.
Individual PHY modules are mainly synced with OpenBSD.
Tested-by: swildner, corecode
35 files changed: