FreeBSD Bugzilla – Attachment 16905 Details for
Bug 30836
Chipset SiS735 / NIC SiS 900
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
rlphy.diff
rlphy.diff (text/plain; charset=us-ascii), 3.58 KB, created by
martin
on 2002-03-27 12:39:02 UTC
(
hide
)
Description:
rlphy.diff
Filename:
MIME Type:
Creator:
martin
Created:
2002-03-27 12:39:02 UTC
Size:
3.58 KB
patch
obsolete
>*** sys/dev/mii/rlphy.c.orig Wed Mar 27 13:09:12 2002 >--- sys/dev/mii/rlphy.c Wed Mar 27 13:09:17 2002 >*************** >*** 80,85 **** >--- 80,86 ---- > DRIVER_MODULE(rlphy, miibus, rlphy_driver, rlphy_devclass, 0, 0); > > int rlphy_service __P((struct mii_softc *, struct mii_data *, int)); >+ void rlphy_status __P((struct mii_softc *)); > > static int rlphy_probe(dev) > device_t dev; >*************** >*** 90,95 **** >--- 91,103 ---- > ma = device_get_ivars(dev); > parent = device_get_parent(device_get_parent(dev)); > >+ /* Realtek 8201L */ >+ if (MII_OUI(ma->mii_id1, ma->mii_id2) == 0x000020 && >+ MII_MODEL(ma->mii_id2) == 0x20) { >+ device_set_desc(dev, "RealTek 8201(L) media interface"); >+ return (0); >+ } >+ > /* > * RealTek PHY doesn't have vendor/device ID registers: > * the rl driver fakes up a return value of all zeros. >*************** >*** 259,265 **** > } > > /* Update the media status. */ >! ukphy_status(sc); > > /* Callback if something changed. */ > if (sc->mii_active != mii->mii_media_active || cmd == MII_MEDIACHG) { >--- 267,273 ---- > } > > /* Update the media status. */ >! rlphy_status(sc); > > /* Callback if something changed. */ > if (sc->mii_active != mii->mii_media_active || cmd == MII_MEDIACHG) { >*************** >*** 267,270 **** >--- 275,356 ---- > sc->mii_active = mii->mii_media_active; > } > return (0); >+ } >+ >+ void >+ rlphy_status(phy) >+ struct mii_softc *phy; >+ { >+ struct mii_data *mii = phy->mii_pdata; >+ int bmsr, bmcr, anlpar; >+ device_t parent; >+ >+ mii->mii_media_status = IFM_AVALID; >+ mii->mii_media_active = IFM_ETHER; >+ >+ bmsr = PHY_READ(phy, MII_BMSR) | PHY_READ(phy, MII_BMSR); >+ if (bmsr & BMSR_LINK) >+ mii->mii_media_status |= IFM_ACTIVE; >+ >+ bmcr = PHY_READ(phy, MII_BMCR); >+ if (bmcr & BMCR_ISO) { >+ mii->mii_media_active |= IFM_NONE; >+ mii->mii_media_status = 0; >+ return; >+ } >+ >+ if (bmcr & BMCR_LOOP) >+ mii->mii_media_active |= IFM_LOOP; >+ >+ if (bmcr & BMCR_AUTOEN) { >+ /* >+ * NWay autonegotiation takes the highest-order common >+ * bit of the ANAR and ANLPAR (i.e. best media advertised >+ * both by us and our link partner). >+ */ >+ if ((bmsr & BMSR_ACOMP) == 0) { >+ /* Erg, still trying, I guess... */ >+ mii->mii_media_active |= IFM_NONE; >+ return; >+ } >+ >+ if( anlpar = PHY_READ(phy, MII_ANAR) & PHY_READ(phy, MII_ANLPAR) ) { >+ if (anlpar & ANLPAR_T4) >+ mii->mii_media_active |= IFM_100_T4; >+ else if (anlpar & ANLPAR_TX_FD) >+ mii->mii_media_active |= IFM_100_TX|IFM_FDX; >+ else if (anlpar & ANLPAR_TX) >+ mii->mii_media_active |= IFM_100_TX; >+ else if (anlpar & ANLPAR_10_FD) >+ mii->mii_media_active |= IFM_10_T|IFM_FDX; >+ else if (anlpar & ANLPAR_10) >+ mii->mii_media_active |= IFM_10_T; >+ else >+ mii->mii_media_active |= IFM_NONE; >+ return; >+ } >+ /* >+ * If the other side doesn't support NWAY, then the >+ * best we can do is determine if we have a 10Mbps or >+ * 100Mbps link. There's no way to know if the link >+ * is full or half duplex, so we default to half duplex >+ * and hope that the user is clever enough to manually >+ * change the media settings if we're wrong. >+ */ >+ >+ >+ /* >+ * RTL8201 Link partner is not capable of autonegotiation. >+ * Magic register (0x0019) found in Linux driver for SiS900 >+ */ >+ parent = device_get_parent(phy->mii_dev); >+ if (strcmp(device_get_name(parent), "rl") != 0) { >+ if( PHY_READ(phy, 0x0019) & 0x01) >+ mii->mii_media_active |= IFM_100_TX; >+ else >+ mii->mii_media_active |= IFM_10_T; >+ } >+ >+ } else >+ mii->mii_media_active = mii_media_from_bmcr(bmcr); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 30836
: 16905