Home | History | Annotate | Download | only in mii
History log of /src/sys/dev/mii/brgphy.c
RevisionDateAuthorComments
 1.91  22-Feb-2023  msaitoh Retry autonegotiation every mii_anegticks seconds instead of mii_anegticks+1.
 1.90  25-May-2020  jmcneill branches: 1.90.20;
Add support for BCM54213PE RGMII clock delays, from OpenBSD
 1.89  28-Mar-2020  thorpej Don't set DVF_DETACH_SHUTDOWN. The MII layer wants to manage the lifecycle
of the PHY devices, and if a NIC driver chooses not to detach its PHYs
at shutdown, that's the driver's business.

PR kern/55121.
 1.88  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.87  22-Feb-2020  jmcneill Match BCM54213PE
 1.86  27-Nov-2019  msaitoh branches: 1.86.2;
- 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.85  26-Nov-2019  msaitoh Fix typo in comment.
 1.84  11-Apr-2019  msaitoh branches: 1.84.4;
Fix a bug that the duplex of manual media setting may be wrong
when the IFM_GMASK bit other than IFM_[FH]DX is set. Same as a part of
FreeBSD r217413.
 1.83  25-Mar-2019  msaitoh KNF. No functional change.
 1.82  25-Feb-2019  msaitoh - Add Broadcom BCM540[24], BCM5424 and BCM5466.
- Sort lines.
 1.81  24-Feb-2019  christos use a macro to tidy up the phydesc array initialization, from FreeBSD
 1.80  20-Feb-2019  msaitoh - Add support for BCM5762 ASIC devices.
- Add BCM5762, BCM5725, BCM5727, BCM57764, BCM57767 and BCM57787.
 1.79  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.78  11-Jan-2019  msaitoh Remove extra PHY read in brgphy_mii_phy_auto().
 1.77  08-Jan-2019  msaitoh Whitespace fixes. No functional change.
 1.76  02-Jul-2014  msaitoh branches: 1.76.20; 1.76.26; 1.76.28;
Add BCM5706.
 1.75  02-Jul-2014  msaitoh - 5720S and 5709S share the same PHY id. Assume 5720S PHY if parent device
is bge(4). Same as FreeBSD. Tested on HP Moonshot.
- Fix media detect on some Fiber chips. Tested on my own BCM5709 card.
Same as {Free,Open}BSD.
 1.74  02-Jul-2014  msaitoh Don't check BNX_CHIP_NUM. Check MII PHY ID because this check is used
for both bge(4) and bnx(4).
 1.73  02-Jul-2014  msaitoh - Remove extra delay in brgphy_mii_phy_auto. Same as {Free,Open}BSD.
- s/u_int/uint/
- KNF.
 1.72  18-Jun-2014  msaitoh Fix uninitiazed variable problem found on zaurus. I don't know why
only zaurus found it.
 1.71  17-Jun-2014  msaitoh - Fix detection of BGEPHYF_FIBER_{MII|TBI}
- Add BCM5708S support in brgphy(4). The auto negotiation may have some bugs.
- Add 2500SX support (not tested).
- Fix bit definition of BRGPHY_MRBE_MSG_PG5_NP_T2 from FreeBSD.
 1.70  16-Jun-2014  msaitoh 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.69  12-Jun-2014  msaitoh No functional change:
- Remove BRGPHY_SERDES_ANAR_* and BRGPHY_SERDES_ANLPAR_*. Those registers
are the same as MII_ANAR_* and MII_ANLPAR_*.
- Fix typo.
- Remove trailing white spaces.
- KNF.
 1.68  31-Oct-2013  msaitoh branches: 1.68.2;
Cleanup flag setting. No functional change.
- Split flags into bge_flags and bge_phy_flags.
- Rename flags. PHY related flags are prefixed with BGEPHYF_*.
Other flags are prefixed with BGEF_*.
 1.67  21-Jun-2013  msaitoh branches: 1.67.2;
Call brgpy specific autonego function in MII_TICK. Before this commit,
only MII_MEDIACHG calls brgphy_mii_phy_auto() and MII_TICK calls MI
mii_phy_auto(). That was not intended.
 1.66  16-Jun-2013  msaitoh The bit location of link ability is different between 1000Base-X and others
(See annex 28B.2 and 28D). The old mii.h defined ANAR_X_PAUSE_* macros. Those
macros were named for 1000Base-X, but the bit definitions were not for
1000Base-X but for others (e.g. 1000BaseT). So there was bug in auto
negotiation for 1000Base-X, but there was no bug for other media. Define new
macro named ANAR_PAUSE_* and ANLPAR_PAUSE_* for other than 1000Base-X and fix
the bit definitions of ANAR_X_PAUSE_* and ANLPPAR_X_*. Change some PHY drivers
to use true macro. Same as other *BSDs.
 1.65  14-Jun-2013  msaitoh KNF.
 1.64  06-Jun-2013  msaitoh Fix a bug that the auto negotiation timer isn't cleard as we expected.
To not to forget clearing the timer and to reduce the code duplication,
clear mii_ticks in *mii_phy_auto().
 1.63  01-Apr-2013  msaitoh In brgphyattach(), set sc_isbge, sc_isbnx and sc_phyflags before PHY_RESET()
because brgphy_reset() refers those flags.
 1.62  19-Mar-2013  msaitoh - Rename PHY related flags for the consistency. It's the same as FreeBSD.
- Remove BGE_10_100_ONLY flag because this was not used.
For 10/100 devices, when calling mii_attach(), mask BMSR_EXTSTAT flag to
not to check Gigabit flags. It's the same as FreeBSD.
 1.61  15-Mar-2013  msaitoh Add BCM5756, BCM5717C, BCM5719C, BCM5720C and BCM57780.
 1.60  17-Sep-2012  tsutsui Add support for BCM57765. PR kern/46961
 1.59  07-Jun-2011  cegger branches: 1.59.2; 1.59.8; 1.59.12;
add BCM5785 phy:

brgphy0 at bge0 phy 1: BCM5785 1000BASE-T media interface, rev. 3
brgphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FD , auto
 1.58  02-May-2011  jym branches: 1.58.2;
Fix BCM5709 PHY detection for ethernet PHYs (the SerDes case being already
handled):
- export bge(4) and bnx(4) CHIP ID and PHY flags to brgphy(4). Move to
"unsigned int" rather than "int", and reuse the same softc members for
chipid and phyflags (behavior controlled by the sc_isbge/isbnx boolean).
- apply bug fix for revisions A and B, so that autonegotiation can
complete (from OpenBSD).

Bug reported by Rivo Nurges via private mail, patch tested and
confirmed working by him (with thanks!)
 1.57  09-Dec-2010  jym branches: 1.57.2;
Add support for BCM5709S (SerDes PHY) in brgphy(4).

From FreeBSD, via OpenBSD, with some minor adaptations.

No comments, no objections on tech-kern@.

The driver was tested on a Dell M710. Access was kindly provided by
Uwe Toenjes, whom I thank for this.

See also http://mail-index.netbsd.org/tech-kern/2010/12/01/msg009478.html
 1.56  27-Nov-2010  jym Use device_private() instead of casting softc to (void *).
 1.55  02-May-2010  pgoyette Include support for BCM5481. From OpenBSD and confirmed to work by
myself on XFX nForce 790i motherboard.
 1.54  27-Apr-2010  dyoung For a couple of flags, use bool/true/false instead of int/1/0.
 1.53  13-Mar-2010  kiyohara branches: 1.53.2;
Add Broadcom BCM5482.
It tested on OpenBlockS600. (coming soon ;-)
And reorder.
 1.52  24-Jan-2010  msaitoh branches: 1.52.2;
Add support for BCM5461,BCM5784 and BCM5761.
Enable brgphy_jumbo_settings().
Enable the Ethernet@Wirespeed function.
 1.51  18-Nov-2009  bouyer Support BCM5709CAX and BCM5709C PHYs.
 1.50  19-Oct-2009  bouyer Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !
 1.49  12-Aug-2009  simonb Match the Broadcom BCM5464 PHY.
 1.48  17-Jun-2009  tsutsui Unwrap not so long lines.
 1.47  17-Jun-2009  tsutsui - no need to use device_parent() because device_t parent is passed
via config_attach(9)
- use device_is_a() rather than strcmp() for readability
 1.46  12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.45  12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.44  23-Apr-2009  msaitoh use proplib
 1.43  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.42  07-Apr-2009  dyoung Detach brgphy(4) at shutdown.
 1.41  17-Nov-2008  dyoung branches: 1.41.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.40  25-Aug-2008  cegger branches: 1.40.2; 1.40.4; 1.40.8;
PR 39241: Add support for Broadcom BCM5906(M) from Karl Uwe Lockhoff
 1.39  04-May-2008  xtraeme branches: 1.39.2; 1.39.6;
device_t/softc split for all mii(4) devices, and other related
cosmetic changes.
 1.38  28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.37  08-Apr-2008  cegger branches: 1.37.2; 1.37.4;
use aprint_*_dev and device_xname
 1.36  20-Feb-2008  markd branches: 1.36.6;
Add BCM5708C. Treating it like 5750/5780 is a guess but my Dell
PowerEdge 1950 now successfully negotiates 1000baseT full-duplex
where it didn't previously.
 1.35  09-Dec-2007  jmcneill Merge jmcneill-pm branch.
 1.34  06-Aug-2007  markd branches: 1.34.2; 1.34.10; 1.34.12; 1.34.14;
Add support for BCM5754 and BCM5755. From suggestions from Jonathan
Stone.
 1.33  13-Mar-2007  msaitoh branches: 1.33.6; 1.33.10;
tabify
 1.32  10-Mar-2007  msaitoh branches: 1.32.2; 1.32.4;
Commit from AsiaBSDCon 2007's place

Fix the problem "ifconfig bge0 media auto" negotiates to 100Mbps on 1000BaseT
HUB.
 1.31  26-Nov-2006  tsutsui branches: 1.31.2; 1.31.4;
Match BCM5752 PHY. From Matthias Drochner and FreeBSD/OpenBSD.
 1.30  16-Nov-2006  christos - don't hardcode 5, 10 define and use MII_ANEGTICKS{,_GIGE}
- instead of != limit, use <= limit (conservative)
 1.29  16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.28  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.27  27-Apr-2006  jonathan branches: 1.27.8; 1.27.10;
Add PHY ID for the integral 1000base-T PHY in the bcm5780 (also known
as Broadcom/Serverworks HT-2000). Following the Broadcom-supplied
Linux driver, update brgphy.c to treat the bcm5780 integral copper PHY
just like the 5714/5715 PHY.

For NetBSB-3 pullup purposes, this commit includes:

src/sys/dev/mii/miidevs revision: 1.65 -> 1.66
src/sys/dev/mii/brgphy.c revision: 1.26 -> 1.27

plus a regen of src/sys/dev/mii/{miidevs.h,miidevs_data.h}.
 1.26  29-Mar-2006  thorpej Use device_private().
 1.25  10-Dec-2005  jonathan branches: 1.25.4; 1.25.6; 1.25.8; 1.25.10; 1.25.12;
Oops! Restore brgphys[]z stanza for bcm5705 integral PHY, somehow
lost in the previous addition of the bcm5714 integral phy.
 1.24  08-Dec-2005  jonathan Add PHY mii-id for the Broadcom 1000base-T PHY integral to the
bcm5714, added yesterday to sys/dev/pci/if_bge.c in revision 1.98,
since it appears the 5714 has a new PHY revision. Pending further
details, follow the FreeBSD code (as submitted by
John Cagle <john dot cagle at hp dot com> and committed by
ps@FreeBSD.ORG), and treat the 5714 integral PHY the same way as we
treat the bcm5750 integral PHY.
 1.23  27-Feb-2005  perry branches: 1.23.2; 1.23.4;
nuke trailing whitespace
 1.22  28-Oct-2004  cube branches: 1.22.4; 1.22.6;
Add support for the PHY found with BCM575x chips. Beware the magic
numbers!

From FreeBSD.
 1.21  23-Aug-2004  thorpej Make use of static.
 1.20  11-Apr-2004  thorpej gmii_phy_getflowcontrol() -> mii_phy_flowstatus(). From HITOSHI Osada.
 1.19  10-Apr-2004  thorpej Fetch negotiated flow control parameters. From HITOSHI Osada.
 1.18  17-Jul-2003  hannken Add support for the BCM5705:
- Only BCM5705M asic rev A1 was tested.

Thanks to Bill Paul (wpaul@freebsd.org) for help and support.

Approved by: Frank van der Linden <fvdl@netbsd.org>
 1.17  29-Apr-2003  thorpej branches: 1.17.2;
Use aprint*().
 1.16  16-Jan-2003  jonathan Update first 16-bit word of 5401 DSP patch to match latest Linux drivers.
Add comment saying what the magic values do: disable tap power management.
 1.15  16-Jan-2003  jonathan Add PHY entry for bcm5704c (copper) integral phy to miidevs.
Add 5704 phy and dsp patch, and untestsed dsp patch for 5703, to brgphy.c.
 1.14  27-Dec-2002  matt Recognize BCM5703 phy. (with this and the bge changes, the bge0 on my
ASUS P4PE m/b is now working)
 1.13  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.12  30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.11  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.10  13-Jul-2002  thorpej Move the BCM5401 DSP patch out of the bge driver and into
the brgphy driver; all users of the BCM5400 and BCM5401 need
the DSP patch and the sledgehammer-reset-at-media-set-time.

Also add a DSP patch for the BCM5411 gleaned from Apple's
GMAC driver for Darwin.

Tested with a 3Com 3c996-T (BCM5700 + BCM5401).
 1.9  12-Jul-2002  thorpej Match the BCM5421, found on the Apple Xserve. From Matt Thomas.
 1.8  03-Jul-2002  simonb Don't include <malloc.h> - no memory management style functions are use
in any of the MII drivers.
 1.7  22-Jun-2002  fvdl Match BCM5701
 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  13-Nov-2001  lukem add RCSID
 1.4  25-Aug-2001  thorpej ANSI'ify.
 1.3  30-Jun-2001  bjh21 branches: 1.3.2;
IFM_1000_TX -> IFM_1000_T, as (breifly) discussed on tech-net.
 1.2  02-Jun-2001  thorpej branches: 1.2.2;
Make PHY matching all table-driven.
 1.1  01-Jun-2001  thorpej Driver for Broadcom BCM5400-family Gig-E PHYs. Programming
information gleaned from FreeBSD.
 1.2.2.10  17-Jan-2003  thorpej Sync with HEAD.
 1.2.2.9  29-Dec-2002  thorpej Sync with HEAD.
 1.2.2.8  18-Oct-2002  nathanw Catch up to -current.
 1.2.2.7  01-Aug-2002  nathanw Catch up to -current.
 1.2.2.6  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.5  14-Nov-2001  nathanw Catch up to -current.
 1.2.2.4  21-Sep-2001  nathanw Catch up to -current.
 1.2.2.3  24-Aug-2001  nathanw Catch up with -current.
 1.2.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.2.2.1  02-Jun-2001  nathanw file brgphy.c was added on branch nathanw_sa on 2001-06-21 20:04:16 +0000
 1.3.2.5  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.3.2.4  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.2.3  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.1  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.6.4.2  28-Jan-2003  jmc Pullup revisions 1.9-1.10,1.13-1.16 (requested by fvdl in ticket #1126)
Pullup support for bge device. (Broadcom Gigabit Ethernet)
 1.6.4.1  12-Jul-2002  thorpej Match BCM5421 and BCM5701. Spurred by pullup-1-6 ticket #492.
 1.6.2.1  15-Jul-2002  gehenna catch up with -current.
 1.17.2.7  11-Dec-2005  christos Sync with head.
 1.17.2.6  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.17.2.5  02-Nov-2004  skrll Sync with HEAD.
 1.17.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.17.2.2  25-Aug-2004  skrll Sync with HEAD.
 1.17.2.1  03-Aug-2004  skrll Sync with HEAD
 1.22.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.22.4.1  29-Apr-2005  kent sync with -current
 1.23.4.5  27-Feb-2008  yamt sync with head.
 1.23.4.4  21-Jan-2008  yamt sync with head
 1.23.4.3  03-Sep-2007  yamt sync with head.
 1.23.4.2  30-Dec-2006  yamt sync with head.
 1.23.4.1  21-Jun-2006  yamt sync with head.
 1.23.2.4  23-Sep-2007  bouyer Pull up following revision(s) (requested by msaitoh in ticket #1842):
sys/dev/mii/miidevs: revisions 1.69, 1.71
sys/dev/mii/brgphy.c: revisions 1.31 - 1.34
Add support for BCM5752, BCM5754 and BCM5755.
Fix the problem "ifconfig bge0 media auto" negotiates to 100Mbps
on 1000BaseT HUB.
 1.23.2.3  28-Apr-2006  riz Pull up following revision(s) (requested by jonathan in ticket #1292):
sys/dev/mii/brgphy.c: revision 1.27
sys/dev/mii/miidevs: revision 1.66
Add PHY ID for the integral 1000base-T PHY in the bcm5780 (also known
as Broadcom/Serverworks HT-2000). Following the Broadcom-supplied
Linux driver, update brgphy.c to treat the bcm5780 integral copper PHY
just like the 5714/5715 PHY.
For NetBSB-3 pullup purposes, this commit includes:
src/sys/dev/mii/miidevs revision: 1.65 -> 1.66
src/sys/dev/mii/brgphy.c revision: 1.26 -> 1.27
plus a regen of src/sys/dev/mii/{miidevs.h,miidevs_data.h}.
 1.23.2.2  29-Dec-2005  riz Pull up following revision(s) (requested by jonathan in ticket #1044):
sys/dev/mii/brgphy.c: revision 1.25
Oops! Restore brgphys[]z stanza for bcm5705 integral PHY, somehow
lost in the previous addition of the bcm5714 integral phy.
 1.23.2.1  29-Dec-2005  riz Pull up following revision(s) (requested by jonathan in ticket #1044):
sys/dev/mii/brgphy.c: revision 1.24
sys/dev/mii/miidevs: revision 1.61
Add PHY mii-id for the Broadcom 1000base-T PHY integral to the
bcm5714, added yesterday to sys/dev/pci/if_bge.c in revision 1.98,
since it appears the 5714 has a new PHY revision. Pending further
details, follow the FreeBSD code (as submitted by
John Cagle <john dot cagle at hp dot com> and committed by
ps@FreeBSD.ORG), and treat the 5714 integral PHY the same way as we
treat the bcm5750 integral PHY.
 1.25.12.2  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.25.12.1  31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.25.10.2  11-May-2006  elad sync with head
 1.25.10.1  19-Apr-2006  elad sync with head.
 1.25.8.2  24-May-2006  yamt sync with head.
 1.25.8.1  01-Apr-2006  yamt sync with head.
 1.25.6.2  01-Jun-2006  kardel Sync with head.
 1.25.6.1  22-Apr-2006  simonb Sync with head.
 1.25.4.1  09-Sep-2006  rpaulo sync with head
 1.27.10.2  10-Dec-2006  yamt sync with head.
 1.27.10.1  22-Oct-2006  yamt sync with head
 1.27.8.2  12-Jan-2007  ad Sync with head.
 1.27.8.1  18-Nov-2006  ad Sync with head.
 1.31.4.2  24-Mar-2007  yamt sync with head.
 1.31.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.31.2.3  18-Aug-2009  bouyer Pull up following revision(s) (requested by msaitoh in ticket #1342):
sys/dev/pci/if_bge.c: revisions 1.135, 1.146, 1.151-1.152,
1.155-1.167 via patch
sys/dev/pci/if_bgereg.h: revisions 1.43, 1.48-1.52
sys/dev/pci/if_bgevar.h: revision 1.1
sys/dev/mii/brgphy.c: revisions 1.36, 1.40, 1.43-1.44 and
1.47-1.48 via patch
sys/dev/mii/brgphyreg.h: revisions 1.3-1.4
sys/dev/mii/miidevs: revisions 1.75, 1.77, 1.85
sys/dev/mii/miidevs.h: regen
sys/dev/mii/miidevs_data.h: regen
sys/dev/mii/miivar.h: revision 1.54
For bge:
- Really set Tx threshold.
- Fix the case of setting a flag in BGE_PCI_DMA_RW_CTL on
conventional PCI.
- Fix some bugs that the driver unable to detect link loss
(OpenBSD 1.135, FreeBSD 1.102)
- bge_tick(): fix some extra input error (OpenBSD 1.221 FreeBSD 1.212)
- Acknowledge link change interrupts by setting the "link changed" bit
in the status register (used to have no effect). FreeBSD 1.44
(OpenBSD 1.21)
- Add some fiber support (OpenBSD 1.220)
- Set BGE_MISCCFG_KEEP_GPHY_POWER as {Open,Free}BSD and linux.
- Add special case code to fix a problem with the BCM5704 in TBI
mode (FreeBSD rev. 1.71, OpenBSD rev. 1.35)
- Force an interrupt in bge_ifmedia_upd (FreeBSD rev. 1.205, OpenBSD
rev. 1.242)
- Add missing workaround for 5705 (FreeBSD rev. 1.44, OpenBSD rev.
1.21)
- Don't print error message only when the register is BGE_SRS_MODE.
It occurs on some environment (and once after boot?). Other *BSDs
and Linux don't print the error message for all registers.
- Fix comments.
- Remove obsolete codes.
- Add BCM5786 support.
for brgphy:
- Add some quirk codes.
- Add support for BCM5462, BCM54K2, BCM5708C, BCM5722, and BCM5906.
 1.31.2.2  31-Aug-2007  xtraeme Pull up following revision(s) (requested by phil in ticket #819):
sys/dev/mii/miidevs.h: regen
sys/dev/mii/miidevs: revision 1.71
sys/dev/pci/if_bge.c: revision 1.133
sys/dev/pci/if_bge.c: revision 1.134
sys/dev/pci/if_bgereg.h: revision 1.43
sys/dev/mii/brgphy.c: revision 1.34
sys/dev/mii/miidevs_data.h: regen
Add BCM5755 and 5754 Gig-E PHYs.
Regen for BCM5755 and 5754.
Add support for BCM5754 and BCM5755. From suggestions from Jonathan
Stone.
Add a couple more BGE_CHIPIDs
Add support for BCM5755 and BCM5754/5787. Suggestions from Jonathan
Stone and fixes from OpenBSD for various hardware bugs/errata.
Disable firmware fastboot on 5754 and 5755. From FreeBSD by way of Phil
Nelson.
 1.31.2.1  26-Mar-2007  jdc branches: 1.31.2.1.2;
Pull up revisions 1.32-1.33 (requested by msaitoh in ticket #518).

Commit from AsiaBSDCon 2007's place

Fix the problem "ifconfig bge0 media auto" negotiates to 100Mbps on 1000BaseT
HUB.

tabify
 1.31.2.1.2.1  03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.32.4.1  11-Jul-2007  mjf Sync with head.
 1.32.2.2  20-Aug-2007  ad Sync with HEAD.
 1.32.2.1  13-Mar-2007  ad Sync with head.
 1.33.10.4  08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.33.10.3  27-Nov-2007  joerg Register MII PHY drives with the PM framework. Nothing to do on suspend,
just reset the PHY on resume.
 1.33.10.2  06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.33.10.1  09-Aug-2007  jmcneill Sync with HEAD.
 1.33.6.1  15-Aug-2007  skrll Sync with HEAD.
 1.34.14.2  06-Aug-2007  markd Add support for BCM5754 and BCM5755. From suggestions from Jonathan
Stone.
 1.34.14.1  06-Aug-2007  markd file brgphy.c was added on branch matt-mips64 on 2007-08-06 12:16:34 +0000
 1.34.12.1  11-Dec-2007  yamt sync with head.
 1.34.10.1  26-Dec-2007  ad Sync with head.
 1.34.2.2  23-Mar-2008  matt sync with HEAD
 1.34.2.1  09-Jan-2008  matt sync with HEAD
 1.36.6.3  17-Jan-2009  mjf Sync with HEAD.
 1.36.6.2  28-Sep-2008  mjf Sync with HEAD.
 1.36.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.37.4.7  11-Aug-2010  yamt sync with head.
 1.37.4.6  11-Mar-2010  yamt sync with head
 1.37.4.5  19-Aug-2009  yamt sync with head.
 1.37.4.4  20-Jun-2009  yamt sync with head
 1.37.4.3  16-May-2009  yamt sync with head
 1.37.4.2  04-May-2009  yamt sync with head.
 1.37.4.1  16-May-2008  yamt sync with head.
 1.37.2.1  18-May-2008  yamt sync with head.
 1.39.6.2  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.39.6.1  19-Oct-2008  haad Sync with HEAD.
 1.39.2.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.40.8.1  21-Apr-2010  matt sync to netbsd-5
 1.40.4.4  09-Nov-2015  sborrill Pull up the following revisions(s) (requested by msaitoh in ticket #1983):
sys/dev/pci/pcidevs: revisions 1.1079, 1.1134, 1.1148-1.1149, 1.1151
sys/dev/pci/pcidevs.h: regen
sys/dev/pci/pcidevs_data.h: regen
sys/dev/pci/if_bge.c: revisions 1.183-1.185, 1.187, 1.189-1.193, 1.195-1.199, 1.202-1.226, 1.228-1.237, 1.240-1.264, 1.267-1.276, 1.278-1.280, 1.283-1.287 via patch
sys/dev/pci/if_bgereg.h: revisions 1.57-1.74, 1.76-1.90 via patch
sys/dev/pci/if_bgevar.h: revisions 1.6, 1.10-1.13, 1.15-1.17 via patch
sys/dev/pci/if_bnx.c: revisions 1.32, 1.34-1.43, 1.48-1.49, 1.52
sys/dev/pci/if_bnxreg.h: revisions 1.8, 1.11-1.14
sys/dev/pci/if_bnxvar.h: revisions 1.1-1.3
sys/dev/mii/brgphy.c: revisions 1.53-1.63, 1.65-69, 1.72-1.74 via patch
sys/dev/mii/brgphyreg.h: revisions 1.5-1.8
sys/dev/mii/miivar.h: revisions 1.61
sys/dev/pci/pcireg.h: patch

Sync bge(4) up to if_bge.c rev. 1.287. Sync brgphy(4) up to 1.74.
Fix some bugs on bnx(4).

Common:
- Add device IDs for Broadcom BCM57710, BCM57711(E), BCM57712(E) and
BCM57766 (pcidevs only).
- Fix BCM5709 PHY detection.
- Fix detection of BGEPHYF_FIBER_{MII|TBI}
- Add BCM5708S support in brgphy(4).
- Don't use the WIRESPEED function for fiber devices.
bge(4):
- Add some Fujitsu's device support from Michael Moll.
- Add BCM57762 support (PR#46961 from Ryo Onodera).
- Add Altima AC1003, APPLE BCM5701, Broadcom BCM5785F. BCM5785G,
BCM5787F, BCM5719, BCM5720, BCM57766, BCM57782 and BCM57786.
- Fix DMA setting for read/write on conventional PCI bus devices.
This bug was added in rev. 1.166.
- Fix printing "discarding oversize frame (len=-4)" message and
crash by NULL pointer dereferencing.
- The BCM5785 is a PCIe chip but does not report PCIe capabilities.
Check for this chip explicitely and enable PCIe. Fixes
'firmware handshake timeout'.
- Allow disabling interrupt mitigation.
- Workaround for BCM5906 silicon bug. When auto-negotiation results
in half-duplex operation, excess collision on the ethernet link may
cause internal chip delays that may result in subsequent valid
frames being dropped due to insufficient receive buffer resources.
(FreeBSD: r214219, r214251, r214292).
- Allow write DMA to request larger DMA burst size to get better
performance on BCM5785. (FreeBSD r213333: OpenBSD 1.294)
- Enable TX MAC state machine lockup fix for both BCM5755 or higher
and BCM5906. Publicly available data sheet just says it may happen
due to corrupted TxMbuf. (FreeBSD r214216)
- Follow Broadcom datasheet:
Delay 100 microseconds after enabling transmit MAC.
Delay 10 microseconds after enabling receive MAC. (FreeBSD
r241220)
- Insert the completion barrier between register write and the
consecutive delay(). It will fix some device timeout problems we have
seen before.
- Add DELAY(40) after turning on write DMA state machine.
- Add some workarounds for 5717 A0 and 5776[56] to be stable.
- Check BGE_RXBDFLAG_IPV6 flag for 5717_PLUS case. Note that
{tcp,udp}6csum flag is currently not added in the capability.
- Add delay after clearing BGE_MACMODE_TBI_SEND_CFGS for the link
checking.
- Do not touch the jumbo replenish threshold register on chips that do
not have jumbo support.
- Wait for the bootcode to complete initialization for 5717 and newer
devices.
- 5718 and 57785 document say we should wait 100us in init.
- Fix a bug that chips which have BCM5906 ASIC touch GPIO wrongly.
- Fix the setting of Tx Random Backoff Register.
- Check the hardware config words and print them.
- Set BGE_MISC_CTL's byte/word swap options before using
bge_readmem_ind(). Fixes PR#47716.
- For BGE_IS_575X_PLUS() devices, don't set
BGE_RXLPSTATCONTROL_DACK_FIX bits because these bits are reserved.
- Document says 5717 and newer chips have no
BGE_PCISTATE_INTR_NOT_ACTIVE bit, so don't use the bit on those
chips. Same as OpenBSD.
- Fix a bug that the PHY address bits in MI_MODE register is wrongly
cleard. Set the PHY address correctly.
- Use BGE_SETBIT() instead of CSR_WRITE_4() for the BGE_MISC_LOCAL_CTL
register to not to modify some GPIO bits.
- Set DMA watermark depend on the PCI max payload size.
- Set BGE_JUMBO_CAPABLE correctly.
- Fix a link detect bug on non-autopoll systems.
- Change the TX ring size for 5717 series and 57764 series.
- Set maximum read byte count to 2048 for PCI-X BCM5703/5704 devices.
- For PCI-X BCM5704, set maximum outstanding split transactions to 0.
- Add 40bit DMA bug workaround(BGEF_40BIT_BUG) from FreeBSD.
This workaround is for 5714/5715 controllers and is not actually a
MAC controller bug but an issue with the embedded PCIe to PCI-X
bridge in the device. This change uses bus_dmatag_subregion(),
so this workaround won't work on some archs which doesn't support
bus_dmatag_subregion().
- Add 2500SX support (not tested).
- Don't use the PHY Auto Poll Mode on many chips. This fixes a bug
that MII Fiber NIC drop packet about 50%. Tested on HP Moonshot.
- Add workaround for PR#48451. Some BCM5717-5720 based systems getNMI
on boot. This problem doesn't occur when we don't use prefetchable
memory in the APE area. Tested with HP MicroServer Gen8.
- In the BCM5703, the DMA read watermark should be set to less than
or equal to the maximum memory read byte count of the PCI-X command
register.
- Fix a bug that BGE_PHY_TEST_CTRL_REG isn't set correctly on some
PCIe devices.
- Use another firmware command in bge_asf_driver_up(). Same as Linux.
This change fixes a bug that watchdog timeout occurs every 25-30
minutes on HP ML110 G6 reported enami@ in PR#49657.
- Fix mbuf leak on failure.
- Remove PCI_PRODUCT_BROADCOM_BCM5724 and
PCI_PRODUCT_BROADCOM_BCM5750M. These devices have not released to
public.
- Add some workaround code for BGE_ASICREV_BCM5784 from Linux.
- Change some printf() to aprint_*().
- Fix typo in comments.
- Cleanup.
brgphy(4):
- Fix bit definition of BRGPHY_MRBE_MSG_PG5_NP_T2 from FreeBSD.
- Add BCM5481, BCM5709S, BCM5756, BCM5717C, BCM5720C, BCM5785,
BCM57765(PR#46961), BCM57780
- In brgphyattach(), set sc_isbge, sc_isbnx and sc_phyflags before
PHY_RESET() because brgphy_reset() refers those flags.
- Call brgpy specific autonego function in MII_TICK. Before this
commit, only MII_MEDIACHG calls brgphy_mii_phy_auto() and MII_TICK
calls MI mii_phy_auto(). That was not intended.
- Remove extra delay in brgphy_mii_phy_auto. Same as {Free,Open}BSD.
bnx(4):
- Add missing ifmedia_delete_instance() in bnx_detach().
- Fix a bug that BNX_NO_WOL_FLAG isn't correctly set on some chips.
Reported by From Henning Petersen in PR#44151.
- Fix SERDES initialization.
- Get out of the interrupt handler early if !IFF_RUNNING.
 1.40.4.3  19-Nov-2010  riz Pull up revisions (requested by msaitoh in ticket #1359):
sys/dev/pci/if_bge.c 1.170-1.181
sys/dev/pci/if_bgereg.h 1.53-1.56
sys/dev/pci/if_bgevar.h 1.2-1.5
sys/dev/pci/pcidevs 1.1017, 1.1021
sys/dev/pci/pcidevs.h regen
sys/dev/pci/pcidevs_data.h regen
sys/dev/mii/miidevs 1.89, 1.93
sys/dev/mii/miidevs.h regen
sys/dev/mii/miidevs_data.h regen
sys/dev/mii/brgphy.c 1.49, 1.52

- Fix a bug of BGE_RDMA_MODE_FIFO_LONG_BURST definition.
- Fix the bug that both BGE_PCIE and BGE_PCIX are set on PCI-Express devices.
- Add support for BCM5705F,BCM5714,SBCM5715S,BCM5717,BCM5718,BCM5720,BCM5723,
BCM5724,BCM5751F,BCM5753F,BCM5756,BCM5761,BCM5761E,BCM5761S,BCM5761SE,
BCM5764,BCM5781,BCM5784M,BCM5903M,BCM57760,BCM57761,BCM57765,BCM57780,
BCM57781,BCM57785,BCM57788,BCM57790,BCM57791 and BCM57795. Fixes PR#41694.
- Fix misunderstanding the capability for TSO4 on some chips.
- Use proplib for no EEPROM systems (e.g. sparc64 with onboard bge).
- Add debug function to show some flags.
- (brgphy(4)) Add support for BCM5461, BCM5464, BCM5784 and BCM5761.
- (brgphy(4)) Enable brgphy_jumbo_settings().
- (brgphy(4)) Enable the Ethernet@Wirespeed function.
- Add support for device properties to override the mac address and set
the BGE_NO_EEPROM flag if we have an onboard device w/o SEEPROM.
- Introduce IPMI and ASF related code from FreeBSD. It fixes some problems
which occured in netboot on sparc64 and PR#32767
- move the code of disabling host interrput in bge_stop() like linux tg3
driver.
- fix the return value of bge_eeprom_getbyte().
- Fixes the bug that error bits arent cleard because these bit are W2C
(in other words W1C).
- Many other bugfixes from FreeBSD and OpenBSD.
- remove an unused structure.
- ANSI C, KNF and tabify
- fix typo in comment.
 1.40.4.2  27-Jan-2010  sborrill Pull up the following revisions(s) (requested by bouyer in ticket #1268):
sys/dev/mii/miidevs: revision 1.90
sys/dev/pci/pcidevs: revision 1.1001
sys/dev/mii/brgphy.c: revision 1.51
sys/dev/microcode/bnx/bnxfw.h: revision 1.3
sys/dev/pci/if_bnx.c: revision 1.29
sys/dev/pci/if_bnxreg.h: revision 1.9
sys/dev/pci/if_bnx.c: revision 1.30

Add support for the Broadcom BCM5709 and BCM5716 chips. Upgrade
the B06 firmware and add the B09 firmware required by the BCM5709.
Replace TX dmamap array with a dynamically-grown list.
Support associated BCM5709CAX and BCM5709C PHYs.
 1.40.4.1  04-Aug-2009  snj Apply patch (requested by msaitoh in ticket #866):
For bge:
- Fix the case of setting a flag in BGE_PCI_DMA_RW_CTL on
conventional PCI.
- Fix some bugs that the driver unable to detect link loss
(OpenBSD 1.135, FreeBSD 1.102)
- bge_tick(): fix some extra input error (OpenBSD 1.221 FreeBSD 1.212)
- Acknowledge link change interrupts by setting the 'link changed' bit
in the status register (used to have no effect). FreeBSD 1.44
(OpenBSD 1.21)
- Add some fiber support (OpenBSD 1.220)
- Set BGE_MISCCFG_KEEP_GPHY_POWER as {Open,Free}BSD and linux.
- Add special case code to fix a problem with the BCM5704 in TBI
mode (FreeBSD rev. 1.71, OpenBSD rev. 1.35)
- Force an interrupt in bge_ifmedia_upd (FreeBSD rev. 1.205, OpenBSD
rev. 1.242)
- Add missing workaround for 5705 (FreeBSD rev. 1.44, OpenBSD rev.
1.21)
- Don't print error message only when the register is BGE_SRS_MODE.
It occurs on some environment (and once after boot?). Other *BSDs
and Linux don't print the error message for all registers.
- Fix comments.
- Remove obsolete codes.
For brgphy:
- Add some quirk codes.
- Add support for BCM5462, BCM54K2 and BCM5722.
 1.40.2.2  28-Apr-2009  skrll Sync with HEAD.
 1.40.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.41.4.2  23-Jul-2009  jym Sync with HEAD.
 1.41.4.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.52.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.52.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.53.2.4  12-Jun-2011  rmind sync with head
 1.53.2.3  31-May-2011  rmind sync with head
 1.53.2.2  05-Mar-2011  rmind sync with head
 1.53.2.1  30-May-2010  rmind sync with head
 1.57.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.58.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.59.12.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.59.12.2  23-Jun-2013  tls resync from head
 1.59.12.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.59.8.8  04-Feb-2015  martin Pull up following revision(s) (requested by msaitoh in ticket #1245):
sys/dev/mii/rgephy.c: revision 1.30
sys/dev/mii/brgphy.c: revision 1.64
sys/dev/mii/atphy.c: revision 1.13
sys/dev/mii/urlphy.c: revision 1.26
sys/dev/mii/ciphy.c: revision 1.20
sys/dev/mii/mii_physubr.c: revision 1.76
Fix a bug that the auto negotiation timer isn't cleard as we expected.
To not to forget clearing the timer and to reduce the code duplication,
clear mii_ticks in *mii_phy_auto().
 1.59.8.7  07-Dec-2014  martin Pull up the following, requested by msaitoh in #1207:

sys/dev/mii/brgphy.c 1.69, 1.71-1.76 via patch
sys/dev/mii/brgphyreg.h 1.6-1.7, 1.9
sys/dev/pci/if_bge.c 1.259,1.267-1.276 via patch
sys/dev/pci/if_bgereg.h 1.87-1.88
sys/dev/pci/if_bnx.c 1.48, 1.49, 1.52-1.57 via patch
sys/dev/pci/if_bnxreg.h 1.15-1.18
sys/dev/pci/if_bnxvar.h 1.4-1.6

Changes for bge(4), bnx(4) and brgphy(4):
- Add device IDs for Broadcom BCM57710, BCM57711(E), BCM57712(E) and
BCM5719 into pcidevs.
- Change BCM5720's device ID from 0x1658 to 0x165f. 0x1658 is only for
the pre-product and not released to public.
- Fix detection of BGEPHYF_FIBER_{MII|TBI}
- Fix typo in comment.
- KNF
- brgphy(4):
- Add BCM5708S support.
- Add 2500SX support.
- Fix bit definition of BRGPHY_MRBE_MSG_PG5_NP_T2 from FreeBSD.
- Remove extra delay in brgphy_mii_phy_auto. Same as {Free,Open}BSD.
- Fix media detect on some Fiber chips.
- Add BCM5706.
- bge(4):
- Print yet another hardware config word in SRAM(BGE_SRAM_DATA_CFG_5)
for BCM5717 and newer devices.
- Fix a trivial bug in #ifdef NOTYET.
- Add BGEPHYF_NO_WIRESPEED flag for fiber devices.
- Print APE firmware correctly.
- Don't use the PHY Auto Poll Mode on many chips. This fixes a bug
that MII Fiber NIC drop packets about 50%. Same as {Free,Open}BSD.
Tested on HP Moonshot.
- Add workaround for PR#48451. Some BCM5717-5720 based systems get
NMI on boot. This problem doesn't occur when we don't use
prefetchable memory in the APE area. I don't know the reason...
Tested with HP MicroServer Gen8.
- Fix a bug that bge can't be initialized correctly on some sparc64
systems (PR#49018).
- Change initializaton order as the same as the document, Linux tg3
and FreeBSD (part of r241436).
- In the BCM5703, the DMA read watermark should be set to less than
or equal to the maximum memory read byte count of the PCI-X command
register. Same as FreeBSD r204978 and Linux tg3 driver.
- bnx(4):
- Enclose #ifdef BNX_DEBUG correctly.
- Add 2500SX support.
- Print some information (ASCI revision, PCI status, etc).
From FreeBSD.
 1.59.8.6  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.59.8.5  04-Nov-2014  martin Pull up following revision(s) (requested by msaitoh in ticket #1146):
sys/dev/mii/mii_physubr.c: revision 1.79
sys/dev/mii/rgephy.c: revision 1.33
sys/dev/mii/brgphy.c: revision 1.66
sys/dev/mii/atphy.c: revision 1.15
sys/dev/mii/mii.h: revision 1.17
The bit location of link ability is different between 1000Base-X and others
(See annex 28B.2 and 28D). The old mii.h defined ANAR_X_PAUSE_* macros. Those
macros were named for 1000Base-X, but the bit definitions were not for
1000Base-X but for others (e.g. 1000BaseT). So there was bug in auto
negotiation for 1000Base-X, but there was no bug for other media. Define new
macro named ANAR_PAUSE_* and ANLPAR_PAUSE_* for other than 1000Base-X and fix
the bit definitions of ANAR_X_PAUSE_* and ANLPPAR_X_*. Change some PHY drivers
to use true macro. Same as other *BSDs.
 1.59.8.4  18-Nov-2013  msaitoh Fix commpile error. This diff was in ticket #983.
 1.59.8.3  17-Nov-2013  bouyer Apply patch, requested by msaitoh in ticket #983:
sys/dev/mii/brgphy.c 1.68 via patch
sys/dev/pci/if_bge.c 1.260-1.262 via patch
sys/dev/pci/if_bgereg.h 1.85-1.86 via patch
sys/dev/pci/if_bgevar.h 1.17 via patch

Set maximum read byte count to 2048 for PCI-X BCM5703/5704 devices.
For PCI-X BCM5704, set maximum outstanding split transactions to 0.
Same as Linux tg3 and FreeBSD (part of FreeBSD r204978).
Add 40bit DMA bug workaround(BGEF_40BIT_BUG) from FreeBSD
(part of r199670). This workaround is for 5714/5715 controllers and
is not actually a MAC controller bug but an issue with the embedded
PCIe to PCI-X bridge in the device. This change
uses bus_dmatag_subregion(), so this workaround won't work on some
archs which doesn't support bus_dmatag_subregion().
 1.59.8.2  07-Sep-2013  bouyer sys/dev/pci/if_bge.c 1.203-1.237, 1.239-1.241, 1.243-1.258 via patch
sys/dev/pci/if_bgereg.h 1.58-1.74, 1.76-1.83 via patch
sys/dev/pci/if_bgevar.h 1.10-1.16 via patch
sys/dev/pci/pcidevs 1.1149 via patch
sys/dev/pci/pcidevs.h regen
sys/dev/pci/pcidevs_data.h regen
sys/dev/mii/brgphy.c 1.61-1.63, 1.65, 1.67 via patch
sys/dev/mii/miivar.h 1.61 via patch
sys/dev/mii/miidevs 1.112-1.113 via patch
sys/dev/mii/miidevs.h regen
sys/dev/mii/miidevs_data.h regen
share/man/man4/bge.4 1.13-1.15 via patch

Add some device support, fix a lot of bugs and add some enahcements.
- Add Altima AC1003, APPLE BCM5701, Broadcom BCM5785F,
BCM5785G, BCM5787F, BCM5719, BCM5720, BCM57766, BCM57782 and BCM57786.
- brgphy(4): Add BCM5756, BCM5717C, BCM5719C, BCM5720C and BCM57780.
- Add some bugfixes and enhancement from FreeBSD:
- Workaround for BCM5906 silicon bug. When auto-negotiation results in
half-duplex operation, excess collision on the ethernet link may
cause internal chip delays that may result in subsequent valid
frames being dropped due to insufficient receive buffer resources.
(FreeBSD: r214219, r214251, r214292)
- Allow write DMA to request larger DMA burst size to get better
performance on BCM5785.
(FreeBSD r213333: OpenBSD 1.294)
- Enable TX MAC state machine lockup fix for both BCM5755 or higher
and BCM5906. Publicly available data sheet just says it may happen
due to corrupted TxMbuf.
(FreeBSD r214216)
- Follow Broadcom datasheet:
Delay 100 microseconds after enabling transmit MAC.
Delay 10 microseconds after enabling receive MAC.
(FreeBSD r241220)
- Insert the completion barrier between register write and the
consecutive delay(). It will fix some device timeout problems
we have seen before.
- Add DELAY(40) after turning on write DMA state machine.
- Add some workarounds for 5717 A0 and 5776[56] to be stable.
From Linux tg3 driver.
- Sync with *BSD. No functional change:
- make bge_chipid() and use it.
- use switch() instead of a lot of if()s.
- Check BGE_RXBDFLAG_IPV6 flag for 5717_PLUS case.
Note that {tcp,udp}6csum flag is currently not added in the
capability.
- Add delay after clearing BGE_MACMODE_TBI_SEND_CFGS for the link
checking. FreeBSD has the same delay().
- Rename PHY related flags for the consistency. It's the same as
FreeBSD.
- Remove BGE_10_100_ONLY flag because this was not used.
For 10/100 devices, when calling mii_attach(), mask BMSR_EXTSTAT
flag to not to check Gigabit flags. It's the same as FreeBSD.
- In brgphyattach(), set sc_isbge, sc_isbnx and sc_phyflags before
PHY_RESET() because brgphy_reset() refers those flags.
- Call brgpy specific autonego function in MII_TICK. Before this commit,
only MII_MEDIACHG calls brgphy_mii_phy_auto() and MII_TICK calls MI
mii_phy_auto(). That was not intended.
- Sync with FreeBSD and OpenBSD. Almost the same as OpenBSD rev. 1.325:
- Sync the ring setup code closer to FreeBSD's driver
- Do not touch the jumbo replenish threshold register on chips that
do not have jumbo support
- Wait for the bootcode to complete initialization for 5717 and newer
devices. See BCM5718 programmer's guide's "step 13,
Device reset Procedure, Section7".
57781's document has the same note.
- 5718 and 57785 document say we should wait 100us.
- Change the order of register settings a little to match both
Broadcom's document and Linux tg3.
- Add detach function.
- Fix a bug that chips which have BCM5906 ASIC touch GPIO wrongly.
- Fix a bug that the NVRAM lock timeout occured on sparc64 onboard bge.
- Check BGE_SGDIG_STS when the chip is NOT a 5717 A0, like freebsd
(OpenBSD rev. 1.327).
- Fix the setting of Tx Random Backoff Register.
- Add BGE_PCIMISCCTL_PCISTATE_RW in BGE_INIT. It's required to set the
PCISTATE register correctly.
- Update comments from 57XX-PG105-R.pdf and 5718-PG106-R.pdf.
- Add missing bus_dmamap_sync() in bge_intr(). The status word is
in DMAed area. Same as other *BSDs.
- Check the hardware config words and print them. This change only
read them and print the values.
- Set BGE_MISC_CTL's byte/word swap options before using
bge_readmem_ind().
- For BGE_IS_575X_PLUS() devices, don't set
BGE_RXLPSTATCONTROL_DACK_FIX bits because these bits are reserved.
- bge_init_tx_ring() uses BGE_RSLOTS (==256) but bge_free_tx_ring() uses
BGE_TX_RING_CNT (== 512). Delete BGE_RSLOTS and use BGE_TX_RING_CNT.
Same as OpenBSD's if_bge.c rev. 1.86.
- Document says 5717 and newer chips have no
BGE_PCISTATE_INTR_NOT_ACTIVE bit, so don't use the bit on those
chips. Same as OpenBSD.
- Fix a bug that the PHY address bits in MI_MODE register is wrongly
cleard. Set the PHY address correctly.
- Use BGE_SETBIT() instead of CSR_WRITE_4() for the BGE_MISC_LOCAL_CTL
register to not to modify some GPIO bits.
- Call bge_poll_fw() before writing BGE_MODE_CTL register like the
latest linux tg3 dirver.
- Set DMA watermark depend on the PCI max payload size.
- Add BGE_JUMBO_CAPABLE flag to some chips. With this commit, 5714,
5780, 5717, 5718, 5719 (exclude rev. A0), 5720, 57765 and 57766 are
added to support jumbo frame.
- Fix the setting of sc->bge_flags for 5717 and newer devices.
- Fix a link detect bug on non-autopoll systems. Same as OpenBSD
(rev.1.329 and 1.336) and FreeBSD (r213710).
- 57765 series is not based on 5717 series. 5717 series is based on
57765 series.
- Set the TX DMA segment size based on the MTU size.
- Change the TX ring size for 5717 series and 57764 series.
- For 57766, set BGE_RDMAMODE_JMB_2K_MMRR for non-jumbo frame.
Same as Linux tg3.
- For 57765 and newer devices, set BGE_MAX_RX_FRAME_LOWAT to 1.
This value is recommended by the document.
- Change sysctl related functions for consistency.
- Style change.
- Use macro. Remove duplicated macro. Remove unused variable.
- Fix comments. Add comments.
- Remove extra semicolon. Remove unused code.
[msaitoh, ticket #939]
 1.59.8.1  26-Aug-2013  msaitoh Pull up following revision(s) (requested by tsutsui in ticket #652):
sys/dev/mii/brgphy.c 1.60
sys/dev/pci/if_bge.c 1.202
sys/dev/pci/if_bgereg.h 1.57
Add support for BCM57762 and BCM57765, found in Apple's Thunderbolt
to Gigabit Ethernet adapter. PR kern/46961.
 1.59.2.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.59.2.1  30-Oct-2012  yamt sync with head
 1.67.2.1  18-May-2014  rmind sync with head
 1.68.2.1  10-Aug-2014  tls Rebase.
 1.76.28.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.76.28.1  10-Jun-2019  christos Sync with HEAD
 1.76.26.2  26-Jan-2019  pgoyette Sync with HEAD
 1.76.26.1  18-Jan-2019  pgoyette Synch with HEAD
 1.76.20.3  14-Apr-2020  martin Pull up the following revisions, requested by msaitoh in ticket #1529:

sys/dev/mii/miidevs 1.154, 1.162-1.167
sys/dev/mii/atphy.c 1.28 via patch
sys/dev/mii/brgphy.c 1.87 via patch
sys/dev/mii/etphy.c 1.5, 1.6 via patch
sys/dev/mii/rdcphy.c 1.6, 1.8 via patch

- Add support Broadcom BCM54213PE and some new RDC devices.
- Rename RDC to xxRDC.
- Use xxVIA instead of VIA.
- etphy(4):
- Rename ET1011 to ET1011C and add ET1011 support.
- Use mii_phy_flowstatus() to reflect flow status from negotiated
result.
- Use static.
- KNF.
 1.76.20.2  13-May-2019  martin Pull up the following, via patch, requested by msaitoh in ticket #1263:

sys/dev/mii/brgphy.c 1.84
sys/dev/mii/ciphy.c 1.33 via patch
sys/dev/mii/rgephy.c 1.53
sys/arch/arm/imx/if_enet.c 1.18
sys/arch/mips/adm5120/dev/if_admsw.c 1.19-1.20
sys/dev/pci/if_bge.c 1.329
sys/dev/pci/if_bnx.c 1.81
sys/dev/pci/if_et.c 1.21
sys/dev/pci/if_lii.c 1.22
sys/dev/pci/if_msk.c 1.87
sys/dev/pci/if_nfe.c 1.68
sys/dev/pci/if_sk.c 1.95
sys/dev/pci/if_ti.c 1.107
sys/dev/pci/if_txp.c 1.52
sys/dev/pci/if_vge.c 1.69
sys/dev/usb/if_axen.c 1.38
sys/dev/usb/if_aue.c 1.149

Fix a bug that the duplex of manual media setting may be wrong
when the IFM_GMASK bit other than IFM_[FH]DX is set.
 1.76.20.1  07-Mar-2019  martin Pull up r1.80, requested by msaitoh in ticket #1209
 1.84.4.1  14-Apr-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #831):

sys/dev/mii/rdcphy.c: revision 1.6
sys/dev/mii/rdcphy.c: revision 1.8
sys/dev/mii/miidevs: revision 1.162
sys/dev/mii/miidevs: revision 1.163
sys/dev/mii/miidevs: revision 1.164
sys/dev/mii/miidevs: revision 1.165
sys/dev/mii/miidevs: revision 1.167
sys/dev/mii/brgphy.c: revision 1.87

Change the OUI macro name of RDC to xxRDC. 0x00d02d is non-bitreverse value
of official 0x000bb4. From Andrius V.
RDC -> xxRDC. No functional change.

Add BCM54213PE

Match BCM54213PE

Use xxVIA instead of VIA.
0x004063 is VIA's official OUI but VT6103 use 0x0002c6.
0x0002c6 is non-bitreversed value of 0x004063. Reported by Andrius V.

- Add Quake Technologies and Aeluros' OUI
- Add Teranetics TN1010 10GBase-T PHY
Add two new RDC PHYs from Andrius V.
Add two new RDC PHYs from Andrius V.
 1.86.2.1  29-Feb-2020  ad Sync with head.
 1.90.20.1  21-Jun-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #208):

sys/dev/mii/ciphy.c: revision 1.42
sys/dev/mii/brgphy.c: revision 1.91
sys/dev/mii/mii_physubr.c: revision 1.102
sys/dev/mii/ipgphy.c: revision 1.11
sys/dev/mii/tlphy.c: revision 1.72
sys/dev/mii/jmphy.c: revision 1.5
sys/dev/mii/urlphy.c: revision 1.40
sys/dev/mii/atphy.c: revision 1.31

Retry autonegotiation every mii_anegticks seconds instead of mii_anegticks+1.

RSS XML Feed