Home | History | Annotate | Download | only in mii
History log of /src/sys/dev/mii/makphy.c
RevisionDateAuthorComments
 1.73  09-Feb-2024  andvar fix spelling mistakes, mainly in comments and log messages.
 1.72  06-Jan-2022  msaitoh QEMU e1000's PHY code doesn't reflect the PSSR_LINK bit. Do workaround.

IEEE 802.3 clause 22's PHY device has a link status bit in the BMCR
register, but it's required to read twice to get the correct value.
Almost all PHY devices have the vendor specific register which has
the link status bit that it's not required to read twice. makphy(4)
use the bit in the PSSR register to reduce the access cost.

QEMU's e1000 provides the PHY specific status register at 0x11 but the
link indication bit (PSSR_LINK.) is always 1 because
e1000x_update_regs_on_link_{down,up}() modify MII_SR_LINK_STATUS
(BMSR_LINK in NetBSD) but don't modify PSSR_LINK. It causes
"virsh domif-setlink xxx yyy down" doesn't work.
To avoid this problem, read the BMSR and check the BMSR_LINK bit. Add
MAKPHY_QUIRK_PSSR_LINK bit for this quirk. Set it if MII_EXTSR doesn't
exist because it's one of the case of QEMU.

Found and tested by ozaki-r.
 1.71  28-Dec-2021  msaitoh Reduce the access of the ESSR register.

- makphyattach() have a code to detect the Fiber/Copper auto selection
feature. Save the info to sc_flags to reduce the access
to the ESSR register. One of the reason is that the register is not
implemented on QEMU. Another reason is that it's not required to
access the register if the device is in the copper only mode.
 1.70  28-Dec-2021  msaitoh QEMU e1000's PHY code doesn't implement register 16. Do workaround.

- Marvell 88E1[01]11 (and many other Marvell PHYs) have the Fiber/Copper
auto selection feature. Our makphy(4) implement it but QEMU doesn't.
If it fails, a garbage data is used in the attach function and unexpected
media may be used. Fix this behavior by checking the return value of
PHY_READ(MAKPHY_ESSR). If the access failed, the media is regarded
as copper only. It's just a cosmetic change. It's not affected to the
packet processing.
 1.69  28-Dec-2021  msaitoh QEMU e1000's PHY code doesn't implement page 0 register 15. Do workaround.

- The BMSR register bit 8 (BMSR_EXTSTAT) denote the existence of page 0
register 15. qemu's e1000 sets BMSR_EXTSTAT but the access to register 15
fails. It doesn't conforms to the IEEE standard. Our makphy automatically
check the existence of 1000BASE-T or 1000BASE-SX by accessing the register
15. If the access failed, neither 1000BASE-T nor 1000BASE-SX is set to
the ability(mii_extcapabilities). Set EXTSR_1000TFDX and EXTSR_1000THDX
if the access failed in the attach function. It's just a cosmetic change.
It's not affected to the packet processing.
 1.68  04-Nov-2020  msaitoh Fix a bug that "ifconfig xx0 media none" set LINK_STATE_UNKNOWN instead of
LINK_STATE_DOWN.

XXX We should check for other PHY drivers, too.
 1.67  20-Oct-2020  msaitoh branches: 1.67.2;
Add Intel I347-AT4.
 1.66  03-Aug-2020  msaitoh Rename PSSR_* to MAKPHY_PSSR_* and IGPHY_PSSR_* to avoid conflict.
No functional change.
 1.65  15-Mar-2020  thorpej Define and implement a locking protocol for the ifmedia / mii layers:
- MP-safe drivers provide a mutex to ifmedia that is used to serialize
access to media-related structures / hardware regsiters. Converted
drivers use the new ifmedia_init_with_lock() function for this. The
new name is provided to ease the transition.
- Un-converted drivers continue to call ifmedia_init(), which will supply
a compatibility lock to be used instead. Several media-related entry
points must be aware of this compatibility lock, and are able to acquire
it recursively a limited number of times, if needed. This is a SPIN
mutex with priority IPL_NET.
- This same lock is used to serialize access to PHY registers and other
MII-related data structures.

The PHY drivers are modified to acquire and release the lock, as needed,
and assert the lock is held as a diagnostic aid.

The "usbnet" framework has had an overhaul of its internal locking
protocols to fit in with the media / mii changes, and the drivers adapted.

USB wifi drivers have been changed to provide their own adaptive mutex
to the ifmedia later via a new ieee80211_media_init_with_lock() function.
This is required because the USB drivers need an adaptive mutex.

Besised "usbnet", a few other drivers are converted: vmx, wm, ixgbe / ixv.

mcx also now calls ifmedia_init_with_lock() because it needs to also use
an adaptive mutex. The mcx driver still needs to be fully converted to
NET_MPSAFE.
 1.64  28-Jan-2020  msaitoh Fix comment.
 1.63  12-Dec-2019  msaitoh branches: 1.63.2;
- Remove ESSR_FIBER_LINK bit check in makphyattach(). This bit is valid only
when the link is up, so it's not good to check in the attach function.
- There is an environment that both copper and fiber bits are set in EXTSR
but it support copper only. To resolve this problem, check the ESSR
register's HWCFG_MODE bit and drop unsupported bits.
- If the chip is in Fiber/Copper auto select mode, check which media is
selected. Currently, the code supports 88E1011, 88E1111 and 88E1112 only.
To support other chips documents are required.
 1.62  27-Nov-2019  msaitoh - Simplify sc->mii_anegticks setting. Same as FreeBSD.

Don't set the default value not in the attach function. Instead, set the
default value (MII_ANEGTICKS) first in the beginning of the
mii_phy_add_media(). The function already has the code to change the value to
MII_ANEGTICKS_GIGE if it's gigabit capable.

- Remove extra pmf_device_register() call. It's done in mii_phy_add_media().
 1.61  26-Nov-2019  msaitoh KNF. No functional change.
 1.60  03-Jul-2019  maxv branches: 1.60.2;
Check the return value of PHY_READ(). Because, if it fails, 'reg' is not
initialized. On Qemu, this read systematically fails.

Print an error in this case, and act as if there was no fiber. Maybe there
is a smarter way to fix this kind of things.
 1.59  25-Mar-2019  msaitoh KNF. No functional change.
 1.58  25-Mar-2019  msaitoh - 88E1000(S) has no page select register, so don't access it.
Note that qemu doesn't implement the register and the access fails.
For I210, we can use the register.
- Don't set PSCR_CRS_ON_TX bit on I210.
 1.57  27-Feb-2019  jakllsch Use symbolic MII_MODEL_xxMARVELL_I210 instead of a literal 0 in makphy_isi210().
 1.56  25-Feb-2019  msaitoh Remove xxMARVELL E1000 and duplicated xxMARVELL E1000S to make functionality
the same as rev. 1.54.
 1.55  24-Feb-2019  christos use a macro to tidy up the phydesc array initialization, from FreeBSD
 1.54  19-Feb-2019  msaitoh - Match Intel I21[01]. These chips' model number is wrongly set to 0
(== 88E1000 with model number 0). It seems the PHY function is almost the
same as 88E1512. When we add 88E1512 related change to makphy.c, I21[01]
should be take into account.
- KNF.
 1.53  08-Feb-2019  msaitoh - Add 88E1240.
- Rename E1116R_29 to E1318S
 1.52  22-Jan-2019  msaitoh Change MII PHY read/write API from:

int (*mii_readreg_t)(device_t, int, int);
void (*mii_writereg_t)(device_t, int, int, int);
to:

int (*mii_readreg_t)(device_t, int, int, uint16_t *);
int (*mii_writereg_t)(device_t, int, int, uint16_t);

Now we can test if a read/write operation failed or not by the return value.

In 802.3 spec says that the PHY shall not respond to read/write transaction
to the unimplemented register(22.2.4.3). Detecting timeout can be used to
check whether a register is implemented or not (if the register conforms to
the spec). ukphy(4) can be used this for MII_MMDACR and MII_MMDAADR.

Note that I noticed that the following code do infinite loop in the
read/wirte function. If it accesses unimplemented PHY register, it will hang.
It should be fixed:

arm/at91/at91emac.c
arm/ep93xx/epe.c
arm/omap/omapl1x_emac.c
mips/ralink/ralink_eth.c
arch/powerpc/booke/dev/pq3etsec.c(read)
dev/cadence/if_cemac.c <- hkenken
dev/ic/lan9118.c


Tested with the following device:

axe+ukphy
axe+rgephy
axen+rgephy (tested by Andrius V)
wm+atphy
wm+ukphy
wm+igphy
wm+ihphy
wm+makphy
sk+makphy
sk+brgphy
sk+gentbi
msk+makphy
sip+icsphy
sip+ukphy
re+rgephy
bge+brgphy
bnx+brgphy
gsip+gphyter
rtk+rlphy
fxp+inphy (tested by Andrius V)
tlp+acphy
ex+exphy
epic+qsphy
vge+ciphy (tested by Andrius V)
vr+ukphy (tested by Andrius V)
vte+ukphy (tested by Andrius V)

Not tested (MAC):
arm:at91emac
arm:cemac
arm:epe
arm:geminigmac
arm:enet
arm:cpsw
arm:emac(omac)
arm:emac(sunxi)
arm:npe
evbppc:temac
macppc:bm
macppc:gm
mips:aumac
mips:ae
mips:cnmac
mips:reth
mips:sbmac
playstation2:smap
powerpc:tsec
powerpc:emac(ibm4xx)
sgimips:mec
sparc:be
sf
ne(ax88190, dl10019)
awge
ep
gem
hme
smsh
mtd
sm
age
alc
ale
bce
cas
et
jme
lii
nfe
pcn
ste
stge
tl
xi
aue
mue
smsc
udav
url

Not tested (PHY):
amhphy
bmtphy
dmphy
etphy
glxtphy
ikphy
iophy
lxtphy
nsphyter
pnaphy
rdcphy
sqphy
tlphy
tqphy
urlphy
 1.51  16-Jan-2019  msaitoh Change the register size to uint16_t again in makphy_reset(). No functional
change intended.
 1.50  16-Jan-2019  msaitoh Restore a comment which was removed in rev. 1.46.
 1.49  08-Jan-2019  msaitoh Whitespace fixes. No functional change.
 1.48  30-Dec-2018  msaitoh Add 88E1512.
 1.47  30-Dec-2018  msaitoh - Control BMCR_PDOWN for IFM_NONE. Some chips still don't work as expected.
It would be required to modify PSCR and/or other register.
- Set mii_media_active correctly on non-autonego mode.
 1.46  28-Dec-2018  msaitoh - Backout some changes done in rev. 1.44. OK'd by jdolecek@:
- Remove e1000phyreg.h and use makphyreg.h again.
- Remove Energy detect stuff. Leave it by default.
- Remove MDI crossover configuraton. Leave it by default. I think it's OK to
add new API to change the mode.
- PHY_RESET() is used to commit some changes, so I think it's not good to
always clear BMCR_AUTOEN before reset in makphy_reset().
- It's not required to read MII_100T2SR twice because this register has no
any bit which is latched.
- Use mii_phy_reset() instead of extracted code.
- Don't set PSCR_CRS_ON_TX on newer. Those chips have no this bit.
- Add some "XXX FIXME" comment. Non GMII mode uses different page except
very old chip. Some bits are at the same location but others are not.
- Remove obsolete comment.
- s/MII_MAKPHY_/MAKPHY_/

XXX rev. 1.44 changed the setting of mii_media_active when the interface is
set to other than auto. I suspect the intention of the change is to reflect
the link up/down status. But, it didn't work because non auto setting makes
PSSR_LINK bit alwasy set "without modifing some registers".
This commit won't fix the change and it'll be fixed in the next commit.
 1.45  18-Jun-2018  msaitoh branches: 1.45.2;
- All of Marvell PHY's registers from addr 0x0 to 0xf conforms IEEE 802.3
specification, so those register definitions are not required. Use mii.h's
definitions. Note that E1000_ER_PAR_DETECT_FAULT should be 0x0010 instead of
0x0100(typo).
- Restore code for BMCR_ISO which was removed in makphy.c rev. 1.44
- Whitespace fix.
 1.44  16-Jun-2018  jdolecek switch to using OpenBSD eehpy(4) code to drive maphy(4), synchronizing support
for several special PHY conditions, particularly:
- Properly re-initialise the PHY upon resume
- Store next page in the Link Partner Next Page register for compatibility
with 802.3ab on 88E3016 PHYs. Fixes some autonegotiation problems on msk(4)
- Make 88E3016 actually work
- Make sure page 0 is selected when we initialize the PHY. Fixes problems
with the eephy(4) that attaches to nfe(4) on machines like the Sun Ultra 40.
(we had condition for this, now the page 0 is selected for any PHY type)
- Disable fiber/copper auto-selection on the 88E1111 if it is in RGMII mode, to
work around the fact that the onboard PHYs attached to nfe(4) on the Sun
X4100 M2 have fiber/copper auto-selection enabled even though the interfaces
are clearly copper-only

make sure to also add appropriate licenses, since basically nothing
really significant remains out of previous code

use FreeBSD <dev/mii/e1000reg.h> for register definitions as a base instead
of OpenBSD <dev/mii/eephyreg.h>, since it has some extra definitions for some
3016 bits, but add the several extra bits from OpenBSD needed by the code;
removed no longed used <dev/mii/makphyreg.h>

tested with PHY 88E1111, there no particular change observed - the
link status works as it did before, just now it does media nego
even before the interface is up

should however fix 88E3016 support and hence PR kern/49270 and PR kern/53301
 1.43  13-Jun-2018  jdolecek sort the models, and add several more variants; data found in OpenBSD eephy.c

this also makes makphy match model 88E3016, which adresses PR kern/53301
by Chris Humphries
 1.42  08-Nov-2016  msaitoh branches: 1.42.8; 1.42.14;
Set mii_mpd_{oui,rev}.
 1.41  07-Jul-2016  msaitoh branches: 1.41.2;
KNF. Remove extra spaces. No functional change.
 1.40  16-Jun-2014  msaitoh branches: 1.40.2; 1.40.4; 1.40.8;
IFM_FDX and IFM_HDX use different bit, so set IFM_HDX bit if it's not full
duplex. For many drivers, it recognize half duplex if IFM_FDX isn't set,
but not for others. Same as {Free|Open}BSD.
 1.39  13-May-2014  christos Add some code from FreeBSD to make the E1147* work. Still does not autoneg
to GiGE for some reason but it autonegs to 100BaseTX full-duplex.
 1.38  21-Dec-2013  kiyohara branches: 1.38.2;
Add Marvell 88E1543. Tested on OPENBLOCKS_AX3.
 1.37  21-Jan-2012  chs branches: 1.37.2; 1.37.6; 1.37.10;
disable the entry for Marvell E1149 for now since this driver doesn't work
with some instances of this hardware (in particular, the ones on the
motherboard of an HP XW9400 workstation, which is supposedly a Tyan S2915).
ukphy works fine for this.
 1.36  12-Nov-2011  sekiya branches: 1.36.4;
Add support for makphy 0x0029 variation found on most recent Globalscale Dreamplug.
 1.35  11-Dec-2010  matt branches: 1.35.8;
Match Marvell E1145
 1.34  01-Aug-2010  kiyohara Add Marvell E1116R.
 1.33  14-Dec-2009  matt branches: 1.33.2; 1.33.4;
Add E1149 Phy.
 1.32  19-Oct-2009  bouyer Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !
 1.31  19-Apr-2009  msaitoh Oooops. Back out some of previous my commit.
 1.30  19-Apr-2009  msaitoh Some fixes and enhancements:

Both if_bge* and brgphy.[ch]:
Check the parent's MAC and use the quirk code for the bug like OpenBSD and
FreeBSD. Some bugs can't identify the PHY ID. For example, 5704 Ax has the
ADC bug, but 5704 A3 and 5704 B0 have the same PHY ID and revision. Add
BGE_PHY_CRC_BUG, BGE_PHY_ADC_BUG, BGE_PHY_5704_A0_BUG, BGE_PHY_JITTER_BUG,
BGE_PHY_ADJUST_TRIM and BGE_PHY_BER_BUG for this flag. Some of the DSP
patches are newly taken from OpenBSD and FreeBSD.

if_bge*:
Remove duplicated BGE_CHIPID_BCM5714_A0 entry in the known CHIPID table.
Fix obsolete comments.

brgphy.[ch]:
Add some PHY IDs.

TODO:
Add more three quirk code into bge and brgphy (the brgphy side's are
currently #if0'ed).
Add support for bnx into brgphy (currently #if0'ed)
 1.29  17-Nov-2008  dyoung branches: 1.29.4;
Reduce code duplication: most PHY drivers call mii_phy_add_media()
when they attach to the device tree, so call pmf_device_register(9)
once there instead of once in more than twenty drivers.
 1.28  04-May-2008  xtraeme branches: 1.28.6; 1.28.8; 1.28.14; 1.28.18;
device_t/softc split for all mii(4) devices, and other related
cosmetic changes.
 1.27  28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.26  08-Apr-2008  cegger branches: 1.26.2; 1.26.4;
use aprint_*_dev and device_xname
 1.25  29-Dec-2007  wiz branches: 1.25.6;
Recognize Marvell 88E1116 Gigabit PHY.
 1.24  09-Dec-2007  jmcneill branches: 1.24.2;
Merge jmcneill-pm branch.
 1.23  23-Feb-2007  msaitoh branches: 1.23.16; 1.23.18; 1.23.24; 1.23.26; 1.23.28;
fix some negotiation problems on wm(4).

will fix PR#30078, PR#30490, PR#30906, PR#33429, PR#35386.
 1.22  16-Nov-2006  christos branches: 1.22.2; 1.22.4;
- don't hardcode 5, 10 define and use MII_ANEGTICKS{,_GIGE}
- instead of != limit, use <= limit (conservative)
 1.21  16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.20  21-Oct-2006  bouyer Restart negotiation when we change media even if autoneg is not enabled.
Otherwise switching from a fixed media to another fixed media isn't noticed
by the switch and the effective speed doesn't change.
 1.19  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.18  29-Mar-2006  thorpej branches: 1.18.8; 1.18.10;
Use device_private().
 1.17  11-Dec-2005  christos branches: 1.17.4; 1.17.6; 1.17.8; 1.17.10; 1.17.12;
merge ktrace-lwp.
 1.16  23-Jun-2005  briggs branches: 1.16.2;
Match Marvell 88E1111 from Dave Huang in PR kern/30556
 1.15  23-Aug-2004  thorpej branches: 1.15.10;
Make use of static.
 1.14  11-Apr-2004  thorpej gmii_phy_getflowcontrol() -> mii_phy_flowstatus(). From HITOSHI Osada.
 1.13  10-Apr-2004  thorpej Fetch negotiated flow control parameters. From HITOSHI Osada.
 1.12  29-Apr-2003  thorpej branches: 1.12.2;
Use aprint*().
 1.11  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.10  30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.9  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.8  08-Aug-2002  fvdl Match 881011 PHY.
 1.7  03-Jul-2002  simonb Don't include <malloc.h> - no memory management style functions are use
in any of the MII drivers.
 1.6  25-Mar-2002  thorpej branches: 1.6.2; 1.6.4;
Get flags passed down to PHY drivers correctly. This was done on
an adhoc basis in a couple of PHY drivers, this fixes it more generally.

Per a discussion w/ Cliff Neighbors <cliff@allegronetworks.com>.
 1.5  15-Jan-2002  thorpej Update for 88E1000 model number changes.
 1.4  13-Nov-2001  lukem add RCSID
 1.3  25-Aug-2001  thorpej ANSI'ify.
 1.2  20-Jul-2001  thorpej branches: 1.2.2; 1.2.4;
Adjust for the corrected Marvell entry.
 1.1  12-Jul-2001  thorpej Driver for the Marvell 88E1000 ``Alaska'' 10/100/1000 PHY.
 1.2.4.9  18-Oct-2002  nathanw Catch up to -current.
 1.2.4.8  13-Aug-2002  nathanw Catch up to -current.
 1.2.4.7  01-Aug-2002  nathanw Catch up to -current.
 1.2.4.6  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.4.5  28-Feb-2002  nathanw Catch up to -current.
 1.2.4.4  14-Nov-2001  nathanw Catch up to -current.
 1.2.4.3  21-Sep-2001  nathanw Catch up to -current.
 1.2.4.2  24-Aug-2001  nathanw Catch up with -current.
 1.2.4.1  20-Jul-2001  nathanw file makphy.c was added on branch nathanw_sa on 2001-08-24 00:09:58 +0000
 1.2.2.8  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.2.7  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.2.6  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.2.5  11-Feb-2002  jdolecek Sync w/ -current.
 1.2.2.4  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.3  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.2.2.2  03-Aug-2001  lukem update to -current
 1.2.2.1  20-Jul-2001  lukem file makphy.c was added on branch kqueue on 2001-08-03 04:13:13 +0000
 1.6.4.1  16-Nov-2002  he Pull up revision 1.8 (requested by thorpej in ticket #649):
Match 881011 PHY.
 1.6.2.2  29-Aug-2002  gehenna catch up with -current.
 1.6.2.1  15-Jul-2002  gehenna catch up with -current.
 1.12.2.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.12.2.2  25-Aug-2004  skrll Sync with HEAD.
 1.12.2.1  03-Aug-2004  skrll Sync with HEAD
 1.15.10.2  31-Mar-2007  bouyer pullup the following revisions (requested by msaitoh in ticket 1681):
sys/dev/pci/if_wm.c 1.104-1.105, 1.116-1.121,
1.127,1.133-1.134 via patch
sys/dev/pci/if_wmreg.h 1.17-1.20
sys/dev/pci/pcidevs patch
sys/dev/mii/igphy.c 1.11
sys/dev/mii/makphy.c 1.20, 1.23
sys/dev/mii/ikphy.c patch
sys/dev/mii/ikphyreg.h patch
sys/dev/mii/miidevs 1.68
sys/dev/mii/files.mii 1.39
sys/arch/i386/conf/GENERIC 1.788-1.789 via patch
sys/arch/i386/conf/GENERIC.MPACPI patch
sys/arch/i386/conf/GENERIC_LAPTOP 1.209 via patch
sys/arch/i386/conf/INSTALL 1.291 via patch
sys/arch/i386/conf/INSTALL_LAPTOP 1.104 via patch
sys/arch/i386/conf/XEN2_DOM0 1.13 via patch
share/man/man4/wm.4 1.14-1.16
Add support for many cards (include PCI-express based chips).
Many bug fixes about auto negotiations (PR#30078, PR#30490,
PR#30906, PR#33429 and PR#35386).
Fix media link issues with fiber-based card (PR#35797).
 1.15.10.1  03-Jul-2005  tron Pull up revision 1.16 (requested by briggs in ticket #524):
Match Marvell 88E1111 from Dave Huang in PR kern/30556
 1.16.2.4  21-Jan-2008  yamt sync with head
 1.16.2.3  26-Feb-2007  yamt sync with head.
 1.16.2.2  30-Dec-2006  yamt sync with head.
 1.16.2.1  21-Jun-2006  yamt sync with head.
 1.17.12.1  31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.17.10.1  19-Apr-2006  elad sync with head.
 1.17.8.1  01-Apr-2006  yamt sync with head.
 1.17.6.1  22-Apr-2006  simonb Sync with head.
 1.17.4.1  09-Sep-2006  rpaulo sync with head
 1.18.10.2  10-Dec-2006  yamt sync with head.
 1.18.10.1  22-Oct-2006  yamt sync with head
 1.18.8.1  18-Nov-2006  ad Sync with head.
 1.22.4.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.22.2.1  26-Mar-2007  jdc Pull up revision 1.23 (requested by msaitoh in ticket #514).

fix some negotiation problems on wm(4).

will fix PR#30078, PR#30490, PR#30906, PR#33429, PR#35386.
 1.23.28.1  11-Dec-2007  yamt sync with head.
 1.23.26.1  26-Dec-2007  ad Sync with head.
 1.23.24.1  18-Feb-2008  mjf Sync with HEAD.
 1.23.18.1  09-Jan-2008  matt sync with HEAD
 1.23.16.2  08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.23.16.1  27-Nov-2007  joerg Register MII PHY drives with the PM framework. Nothing to do on suspend,
just reset the PHY on resume.
 1.24.2.1  02-Jan-2008  bouyer Sync with HEAD
 1.25.6.2  17-Jan-2009  mjf Sync with HEAD.
 1.25.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.26.4.4  11-Aug-2010  yamt sync with head.
 1.26.4.3  11-Mar-2010  yamt sync with head
 1.26.4.2  04-May-2009  yamt sync with head.
 1.26.4.1  16-May-2008  yamt sync with head.
 1.26.2.1  18-May-2008  yamt sync with head.
 1.28.18.1  07-Jan-2011  matt Match some more phys.
 1.28.14.2  24-Dec-2011  matt Match 88E1114
 1.28.14.1  09-Nov-2009  cliff - add table entry for MII_STR_xxMARVELL_E1149
no spec available, may need special handling?
 1.28.8.1  19-Jan-2009  skrll Sync with HEAD.
 1.28.6.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.29.4.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.33.4.1  05-Mar-2011  rmind sync with head
 1.33.2.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.35.8.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.35.8.1  17-Apr-2012  yamt sync with head
 1.36.4.1  18-Feb-2012  mrg merge to -current.
 1.37.10.1  18-May-2014  rmind sync with head
 1.37.6.2  03-Dec-2017  jdolecek update from HEAD
 1.37.6.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.37.2.1  09-Nov-2014  martin Pull up following revision(s) (requested by msaitoh in ticket #1189):
sys/dev/pci/if_wm.c: revision 1.270
sys/dev/mii/inphy.c: revision 1.53
sys/dev/mii/glxtphy.c: revision 1.24
sys/dev/mii/tlphy.c: revision 1.62
sys/dev/mii/iophy.c: revision 1.37
sys/dev/mii/brgphy.c: revision 1.70
sys/dev/mii/ihphy.c: revision 1.8
sys/dev/mii/bmtphy.c: revision 1.31
sys/dev/mii/urlphy.c: revision 1.30
sys/dev/mii/makphy.c: revision 1.40
sys/dev/mii/qsphy.c: revision 1.48
sys/dev/mii/igphy.c: revision 1.23
sys/dev/mii/nsphy.c: revision 1.58
sys/dev/mii/mvphy.c: revision 1.10
sys/dev/pci/if_txp.c: revision 1.41
sys/dev/mii/nsphy.c: revision 1.59
sys/dev/mii/rlphy.c: revision 1.28
sys/dev/mii/icsphy.c: revision 1.49
sys/dev/mii/rlphy.c: revision 1.29
sys/dev/mii/lxtphy.c: revision 1.49
sys/dev/mii/ciphyreg.h: revision 1.5
sys/dev/mii/nsphyter.c: revision 1.38
sys/dev/mii/sqphy.c: revision 1.50
sys/dev/mii/gentbi.c: revision 1.26
sys/dev/mii/gentbi.c: revision 1.27
sys/dev/mii/tqphy.c: revision 1.39
sys/dev/mii/ikphy.c: revision 1.10
sys/dev/mii/dmphy.c: revision 1.35
sys/dev/mii/amhphy.c: revision 1.20
sys/dev/mii/acphy.c: revision 1.24
sys/dev/mii/ciphy.c: revision 1.25
sys/dev/mii/brgphyreg.h: revision 1.8
sys/dev/mii/ukphy_subr.c: revision 1.12
sys/dev/ic/rtl80x9.c: revision 1.16
sys/arch/mips/adm5120/dev/if_admsw.c: revision 1.12
sys/dev/pci/if_kse.c: revision 1.28
sys/dev/mii/ukphy_subr.c: revision 1.13
sys/dev/mii/mii.h: revision 1.18
sys/dev/mii/gphyter.c: revision 1.29
No functional change:
- Fix typo.
- Remove trailing white spaces.
- Capitalize comments.
- Tabify.
- KNF.
IFM_FDX and IFM_HDX use different bit, so set IFM_HDX bit if it's not full
duplex. For many drivers, it recognize half duplex if IFM_FDX isn't set,
but not for others. Same as {Free|Open}BSD.
 1.38.2.1  10-Aug-2014  tls Rebase.
 1.40.8.1  18-Jan-2017  skrll Sync with netbsd-5
 1.40.4.2  05-Dec-2016  skrll Sync with HEAD
 1.40.4.1  09-Jul-2016  skrll Sync with HEAD
 1.40.2.1  12-Dec-2016  snj Pull up following revision(s) (requested by msaitoh in ticket #1301):
sys/dev/mii/inphy.c: revision 1.55
sys/dev/mii/makphy.c: revision 1.42
sys/dev/mii/ikphy.c: revision 1.12
sys/dev/mii/atphy.c: revision 1.18
sys/dev/mii/ihphy.c: revision 1.10
Set mii_mpd_{oui,model,rev}.
--
Set mii_mpd_{oui,model,rev}.
--
Set mii_mpd_{oui,model,rev}.
--
Set mii_mpd_{oui,rev}.
 1.41.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.42.14.3  26-Jan-2019  pgoyette Sync with HEAD
 1.42.14.2  18-Jan-2019  pgoyette Synch with HEAD
 1.42.14.1  25-Jun-2018  pgoyette Sync with HEAD
 1.42.8.6  29-Jan-2022  martin Pull up following revision(s) (requested by msaitoh in ticket #1726):

sys/dev/mii/igphy.c: revision 1.37
sys/dev/mii/ihphy.c: revision 1.19
sys/dev/mii/makphy.c: revision 1.68

Fix a bug that "ifconfig xx0 media none" set LINK_STATE_UNKNOWN instead of
LINK_STATE_DOWN.

XXX We should check for other PHY drivers, too.
 1.42.8.5  05-Aug-2020  martin Pull up the following revisions, requested by msaitoh in ticket #1594:

sys/dev/pci/if_wm.c 1.655-1.658, 1.660,
1.662, 1.664-1.668,
1.671-1.674, 1.678,
1.680-1.685 via patch
sys/dev/pci/if_wmreg.c 1.118-1.119 via patch
sys/dev/pci/if_wmvar.c 1.45 via patch
sys/dev/mii/igphy.c 1.35-1.36 via patch
sys/dev/mii/igphyreg.h 1.12-1.13
sys/dev/mii/makphy.c 1.66 via patch
sys/dev/mii/makphyreg.h 1.11

- Add SFP support. Module insertion/removal is not supported yet.
Currently, SFP detection is only done in the driver's attach phase.
- Detect the Media Auto Sense feature. Not supported yet.
- Fix SFF_SFP_ETH_FLAGS_100FX. It's not 0x10 but 0x20.
- Add extra delay in wm_serdes_power_up_link_82575().
- Add Intel I219 LM10-LM15 and V10-V14.
- wm(4) can use workqueue as deferred Rx/Tx handler).
Set hw.wm*.txrx_workqueue=1 to use workqueue instead of softint.
The default value of hw.wm*.txrx_workqueue is 0 which use softint
as before.
- Unset RSS UDP flags like ixg(4) and other OSes. To handle IP
fragmented UDP, first packet and second packet should be processed
in the same Rx queue.
- It's useless to not to set PCI_PMCSR_PME_STS bit when writing because
the bit is W1C. Instead, always write PCI_PMCSR_PME_STS bit to clear
in case it's already set.
- Actually writing always the checksum offload context descriptor
makes the HW do extra processing, avoid doing that if possible.
- Fix a bug that the WMREG_EEARBC_I210 register is incorrectly set if
the system uses iNVM.
- "wmX: 0" on 82542 is difficult to understand, so don't print it.
- Explicitly cast from uint16_t to uint32_t before shifting 16bit left
when printing Image Unique ID to avoid undefined behavior.
- Set if_baudrate for non-MII device.
- Rename some macros and function.
- KNF. Add comment.
 1.42.8.4  28-Jan-2020  martin Pull up the following, requested by msaitoh in ticket #1493:

sys/dev/mii/makphy.c 1.61, 1.63-1.64 via patch
sys/dev/mii/makphyreg.h 1.10

- Remove ESSR_FIBER_LINK bit check in makphyattach(). This bit is
valid only when the link is up, so it's not good to check in the
attach function.
- There is an environment that both copper and fiber bits are set in
EXTSR but it support copper only. To resolve this problem, check the
ESSR register's HWCFG_MODE bit and drop unsupported bits.
- If the chip is in Fiber/Copper auto select mode, check which media is
selected. Currently, the code supports 88E1011, 88E1111 and 88E1112
only.
- Fix comment. KNF.
 1.42.8.3  01-Aug-2019  martin Pull up the following revision, requested by msaitoh in ticket #1316:

sys/dev/mii/makphy.c 1.54,1.57-1.60 via patch
sys/dev/mii/makphyvar.h 1.1-1.2
sys/dev/mii/ihphy.c 1.12,1.14 via patch

- Support Intel I21[01].
- 88E1000(S) has no page select register, so don't access it.
Note that qemu doesn't implement the register and the access fails.
- Check the result of the ESSR register access because Qemu doesn't
implement the register.
- KNF.
 1.42.8.2  07-Mar-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1208):

sys/dev/mii/makphy.c: revision 1.53

- Add 88E1240.
- Rename E1116R_29 to E1318S
 1.42.8.1  17-Jan-2019  martin Pull up the following (requested by msaitoh in ticket #1164):

sys/dev/mii/miidevs 1.128, 1.132 (patch)
sys/dev/mii/makphy.c 1.43-1.51
sys/dev/mii/makphyreg.h 1.7-1.9

- miidevs: Add E1000 with model id 0x0006, it exists according to
OpenBSD rename E1000 model 0x0000 to E1000_0 for consistency.
- Match 88E1112, 88E1118, 88E1512, 88E3082 and G65G.
- Match 88E3016 and add some 88E3016 specific code. Fixes part of
PR kern/49270 and PR kern/53301.
- Make sure page 0 is selected when we initialize the PHY. Fixes
problems with the eephy(4) that attaches to nfe(4) on machines like
the Sun Ultra 40. (we had condition for this, now the page 0 is
selected for any PHY type)
- If autonegotiation is not enabled, we need a software reset for the
settings to take effect in makphy_service().
- Don't set PSCR_CRS_ON_TX on newer. Those chips have no this bit.
- Control BMCR_PDOWN for IFM_NONE. Some chips still don't work as
expected. It would be required to modify PSCR and/or other register.
- Set mii_media_active correctly on non-autonego mode.
- Remove obsolete comment.
- Whitespace fix.
 1.45.2.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.45.2.1  10-Jun-2019  christos Sync with HEAD
 1.60.2.4  29-Jan-2022  martin Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1410:

sys/dev/mii/makphy.c 1.67,1.69-1.72
sys/dev/mii/makphyvar.h 1.3-1.4

- Add I347-AT4 support.
- Add three workarounds for QEMU e1000:
- QEMU sets BMSR_EXTSTAT but the access to register 15 fails.
Set EXTSR_1000TFDX and EXTSR_1000THDX if the access failed in the
attach function. It's just a cosmetic change.
- Marvell 88E1[01]11 have the Fiber/Copper auto selection feature,
but QEMU doesn't implement it. If the register access failed,
the media is regarded as copper only. It's just a cosmetic change.
- QEMU provides the PHY specific status register at 0x11 but the
link indication bit (PSSR_LINK) is always 1. It causes
"virsh domif-setlink xxx yyy down" doesn't work. To avoid this
problem, read the BMSR and check the BMSR_LINK bit. Add
MAKPHY_QUIRK_PSSR_LINK bit for this quirk. Set it if MII_EXTSR
doesn't exist because it's one of the case of QEMU.
- Reduce the number of access to the ESSR register. One of the reason
is that the register is not implemented on QEMU. Another reason is
that it's not required to access the register if the device is in
the copper only mode.
 1.60.2.3  29-Jan-2022  martin Pull up following revision(s) (requested by msaitoh in ticket #1409):

sys/dev/mii/igphy.c: revision 1.37
sys/dev/mii/ihphy.c: revision 1.19
sys/dev/mii/makphy.c: revision 1.68

Fix a bug that "ifconfig xx0 media none" set LINK_STATE_UNKNOWN instead of
LINK_STATE_DOWN.

XXX We should check for other PHY drivers, too.
 1.60.2.2  05-Aug-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #1040):

sys/dev/mii/igphy.c: revision 1.35
sys/dev/mii/igphy.c: revision 1.36
sys/dev/mii/igphyreg.h: revision 1.12
sys/dev/mii/igphyreg.h: revision 1.13
sys/dev/mii/makphyreg.h: revision 1.11
sys/dev/pci/if_wm.c: revision 1.682
sys/dev/pci/if_wm.c: revision 1.683
sys/dev/pci/if_wm.c: revision 1.684
sys/dev/pci/if_wm.c: revision 1.685
sys/dev/mii/makphy.c: revision 1.66

s/MII_IGPHY_/IGPHY_/. No functional change.

Rename PSSR_* to MAKPHY_PSSR_* and IGPHY_PSSR_* to avoid conflict.
No functional change.

Setup PCS and SGMII for SFP correctly. It still doesn't support SFP
insertion/removal.

Copper:
wm2: SGMII(SFP)
wm2: 0x1043c440<SPI,IOH_VALID,PCIE,SGMII,NEWQUEUE,ASF_FIRM,EEE,SFP>
makphy0 at wm2 phy 6: Marvell 88E1111 Gigabit PHY, rev. 1

Fiber:
wm3: SERDES(SFP)
wm3: 0x10034440<SPI,IOH_VALID,PCIE,NEWQUEUE,ASF_FIRM,SFP>
wm3: 1000baseSX, 1000baseSX-FDX, auto

Explicitly cast from uint16_t to uint32_t before shifting 16bit left
when printing Image Unique ID. Found by kUBSan.

Set if_baudrate for non-MII device. Before this commit, it was 0.
 1.60.2.1  28-Jan-2020  martin Pull up the following, requested by msaitoh in ticket #663:

sys/dev/mii/makphy.c 1.61, 1.63-1.64 via patch
sys/dev/mii/makphyreg.h 1.10

- Remove ESSR_FIBER_LINK bit check in makphyattach(). This bit is
valid only when the link is up, so it's not good to check in the
attach function.
- There is an environment that both copper and fiber bits are set in
EXTSR but it support copper only. To resolve this problem, check the
ESSR register's HWCFG_MODE bit and drop unsupported bits.
- If the chip is in Fiber/Copper auto select mode, check which media is
selected. Currently, the code supports 88E1011, 88E1111 and 88E1112
only.
- Fix comment. KNF.
 1.63.2.1  29-Feb-2020  ad Sync with head.
 1.67.2.1  14-Dec-2020  thorpej Sync w/ HEAD.

RSS XML Feed