Sync MII support with NetBSD/OpenBSD:
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 6 Aug 2006 10:32:23 +0000 (10:32 +0000)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 6 Aug 2006 10:32:23 +0000 (10:32 +0000)
commit46ad174e411f5a43bfbf65811350a6fcc31d2d77
treec4d1c89e4012e2609b1fb38c99d112c0493a725d
parentbcfb15559a9a66b59eca5dc4431378ee6e248bc3
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:
sys/conf/files
sys/dev/netif/mii_layer/Makefile
sys/dev/netif/mii_layer/acphy.c
sys/dev/netif/mii_layer/amphy.c
sys/dev/netif/mii_layer/brgphy.c
sys/dev/netif/mii_layer/ciphy.c
sys/dev/netif/mii_layer/ciphyreg.h
sys/dev/netif/mii_layer/dcphy.c
sys/dev/netif/mii_layer/e1000phy.c
sys/dev/netif/mii_layer/exphy.c
sys/dev/netif/mii_layer/inphy.c
sys/dev/netif/mii_layer/inphyreg.h
sys/dev/netif/mii_layer/lxtphy.c
sys/dev/netif/mii_layer/mii.c
sys/dev/netif/mii_layer/mii.h
sys/dev/netif/mii_layer/mii_physubr.c
sys/dev/netif/mii_layer/miidevs
sys/dev/netif/mii_layer/miidevs.h
sys/dev/netif/mii_layer/miivar.h
sys/dev/netif/mii_layer/mlphy.c
sys/dev/netif/mii_layer/nsgphy.c
sys/dev/netif/mii_layer/nsphy.c
sys/dev/netif/mii_layer/nsphyreg.h
sys/dev/netif/mii_layer/nvphy.c [deleted file]
sys/dev/netif/mii_layer/pnaphy.c
sys/dev/netif/mii_layer/pnphy.c
sys/dev/netif/mii_layer/qsphy.c
sys/dev/netif/mii_layer/rgephy.c
sys/dev/netif/mii_layer/rlphy.c
sys/dev/netif/mii_layer/ruephy.c
sys/dev/netif/mii_layer/tlphy.c
sys/dev/netif/mii_layer/ukphy.c
sys/dev/netif/mii_layer/ukphy_subr.c
sys/dev/netif/mii_layer/xmphy.c
sys/net/if_media.h