Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/if_bgereg.h
RevisionDateAuthorComments
 1.98  09-Feb-2024  andvar fix spelling mistakes, mainly in comments and log messages.
 1.97  02-Jul-2022  skrll Use C99 types. same code before and after.
 1.96  05-Mar-2019  msaitoh Centralize ETHER_ALIGN into net/if_ether.h. Note that this commit also changes
if_upgt.c's ETHER_ALIGN from 0 to 2.
 1.95  20-Feb-2019  msaitoh - Add support for BCM5762 ASIC devices.
- Add BCM5762, BCM5725, BCM5727, BCM57764, BCM57767 and BCM57787.
 1.94  02-Dec-2018  bouyer Don't destroy the dma maps if we're not disabling the adapter, avoids
a KASSERT() when bus_dmamap_destroy() is called from interrupt
context via bge_watchdog()
Set IFF_OACTIVE only when bge_encap() fails on adapter ressource shortage.
Otherwise we may set IFF_OACTIVE while no transmit is in progress, and
nothing will clear it.
If bus_dmamap_load_mbuf() fails with EFBIG, m_defrag() the chain and retry.
Refine the check for the 4GB boundary workaround (a fragment should also
not cross the boundary), and do it only for TSO.
If bge_encap() fails and didn't set IFF_OACTIVE, drop the packet.
Bring in more hardware bug workarounds from freebsd.

With these it seems that a BCM5720 A0 can survive a few hours of internet
load with TSO4 enabled.
 1.93  13-Apr-2017  msaitoh branches: 1.93.4; 1.93.10; 1.93.12;
- Read chip ID correctly on BCM57782 and BCM57786.
- Add BXCM57766 A0 string.
- Add comment for BCM5776[56]'s workaround.
 1.92  12-Apr-2017  msaitoh Add a workaround for BCM57780 to prevent device timeout. This change prevent
L1PM feature do wrongy. Tested with Dell latitude 2120.
 1.91  17-May-2015  msaitoh branches: 1.91.2; 1.91.4;
- Add MSI support.
- Use tagged status function for 5717 and newer devices. All controllers
except BCM5700 support tagged status but we use tagged status only for MSI
case on BCM5717. Otherwise MSI on BCM5717 does not work. Same as other *BSDs.
 1.90  30-Apr-2015  msaitoh 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.
 1.89  30-Apr-2015  msaitoh - BGE_CHIPID_BCM5784_A1 is not 0x5784100 but 0x5784001. Only dmesg output
is affected.
- Add BGE_CHIPREV_5784_AX and BGE_CHIPID_BCM5784_B0.
 1.88  17-Jun-2014  msaitoh branches: 1.88.2; 1.88.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.
 1.87  27-May-2014  msaitoh Fix typo in a comment.
 1.86  31-Oct-2013  msaitoh branches: 1.86.2;
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.85  31-Oct-2013  msaitoh 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.84  13-Jul-2013  msaitoh Fix the chip revision of 57765_AX.
 1.83  08-Jul-2013  msaitoh - 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.
 1.82  08-Jul-2013  msaitoh 57765 series is not based on 5717 series. 5717 series is based on 57765
series.
 1.81  31-May-2013  msaitoh branches: 1.81.2;
Remove unused macros.
 1.80  30-May-2013  msaitoh 0x4B657654(BGE_SRAM_FW_MB_MAGIC) == ~0xB49A89AB(BGE_SRAM_FW_MB_RESET_MAGIC),
so the same code I added in rev. 1.223 exists in bge_poll_fw(), too. Remove it.

And then, call bge_poll_fw() before writing BGE_MODE_CTL register like the
latest linux tg3 dirver.
 1.79  28-May-2013  msaitoh Fix a bug that the PHY address bits in MI_MODE register is wrongly cleard.
Set the PHY address correctly.
 1.78  14-May-2013  msaitoh Add some definitions.
Fix compile error.
 1.77  08-May-2013  msaitoh No functional change:
- Fix typo
- Add comment
- Remove duplicated definitions
 1.76  08-May-2013  msaitoh Check the hardware config words and print them. This change only read them
and print the values.
 1.75  21-Apr-2013  msaitoh Delete "PCI_" from PCIX and PICE capability registers.
 1.74  11-Apr-2013  msaitoh Fix typo in comment.
 1.73  11-Apr-2013  msaitoh Add BGE_PCIMISCCTL_PCISTATE_RW in BGE_INIT. It's required to set the PCISTATE
register correctly.
 1.72  08-Apr-2013  msaitoh Fix the setting of Tx Random Backoff Register.
 1.71  27-Mar-2013  msaitoh Add BGE_SRAM_FW_MB_RESET_MAGIC again.
 1.70  27-Mar-2013  msaitoh Revert rev. 1.68.
 1.69  27-Mar-2013  msaitoh Fix a bug that chips which have BCM5906 ASIC touch GPIO wrongly.
 1.68  21-Mar-2013  msaitoh Wait for the bootcode to complete initialization for 5717 and newer devices.
See BCM5718 programmer's guide's "step 13, Device reset Procedure, Section 7".
57781's document has the same note.

I verified the loop really looped on those chips.

But, I don't know why tg3 doesn't it.
 1.67  21-Mar-2013  msaitoh - 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
- Add/sync some of the comments
- Use macro.
- Remove unused code.
 1.66  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.65  19-Mar-2013  msaitoh Fix three bugs:
- An workaround for TX data corruption is only for 5719 "A0".
Fix the wrong evaluation.
- 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().
 1.64  17-Mar-2013  msaitoh No functional change:
- Fix comment
- Use macro
- Remove unused macro
 1.63  17-Mar-2013  msaitoh - ADD support for BCM5719, BCM5720, BCM57766, BCM57782 and BCM57786.
- Use macros.
- Remove unused code.
- Sync with the latest {Free,Open}BSD's bge.
 1.62  13-Mar-2013  msaitoh - Add some workarounds for 5717 A0 and 5776[56] to be stable.
From Linux tg3 driver.
- Use macro.
 1.61  27-Feb-2013  msaitoh No functional change:
- Fix comments.
- Change macro name.
- Change sysctl related functions for consistency.
 1.60  26-Feb-2013  msaitoh 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)
 1.59  26-Feb-2013  msaitoh Use macro. Remove extra semicolon. No functional change.
 1.58  25-Feb-2013  msaitoh Use macro. Remove duplicated macro. Remove unused variable.
No functional Change.
 1.57  17-Sep-2012  tsutsui Add support for BCM57762, found in Apple's Thunderbolt to Gigabit Ethernet
Adapter. PR kern/46961 from Ryo ONODERA.

Also revert weird BGE_MAX_FRAMELEN macro definition to sync its usage
with the original FreeBSD's bge.
 1.56  03-Feb-2010  msaitoh branches: 1.56.12; 1.56.18; 1.56.22;
- Make the initialize sequence close to the document.
- Fix ASF heartbeat sending bug (FreeBSD rev. 1.271 (r202821))
- Use new handshake command for BCM5750 or new controllers (FreeBSD rev. 1.272
(r202822))
 1.55  28-Jan-2010  msaitoh - 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().
- remove an unused structure.
- KNF
 1.54  24-Jan-2010  msaitoh Many changes from FreeBSD and OpenBSD:
- 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.
- Many other bugfixes.
- Use proplib for no EEPROM systems (e.g. sparc64 with onboard bge).
- Add debug function to show some flags.
 1.53  04-Aug-2009  taca Fix a bug of BGE_RDMA_MODE_FIFO_LONG_BURST definition.

Confirmed by msaito@.
 1.52  23-Apr-2009  msaitoh use proplib
 1.51  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.50  16-Apr-2009  msaitoh Take some code from FreeBSD and OpenBSD:

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)

Add some known CHIPID entries.
 1.49  22-Mar-2009  msaitoh Make bge(4) close to FreBSD and OpenBSD.

NO FUNCTIONAL CHANGE BY THIS COMMIT.
 1.48  25-Aug-2008  cegger branches: 1.48.2; 1.48.4; 1.48.8; 1.48.12;
PR 39241: Add support for Broadcom BCM5906(M) from Karl Uwe Lockhoff
 1.47  24-Jul-2008  sborrill Add support for Broadcom 5722 and identify 5755 ASICs.
 1.46  17-Jun-2008  mlelstv branches: 1.46.2;
add rnd(4) hooks. Note that interrupts on bge hardware may occur
with certain patterns, especially when the interrupt mitigation
logic kicks in. So this might be a very weak entropy source.
 1.45  09-Dec-2007  jmcneill branches: 1.45.10; 1.45.12; 1.45.14; 1.45.16; 1.45.18;
Merge jmcneill-pm branch.
 1.44  24-Sep-2007  joerg branches: 1.44.6; 1.44.8;
Convert bge(4) to device/softc separation. Use aprint_* instead of
printf all over the place. Only the debug macros are kept. Place the TSO
message about the hard case under debug.
 1.43  06-Aug-2007  markd branches: 1.43.2; 1.43.4; 1.43.6;
Add a couple more BGE_CHIPIDs
 1.42  18-May-2007  pavel branches: 1.42.2; 1.42.6;
from FreeBSD's src/sys/dev/bge/if_bgereg.h rev 1.22:
Fix a typo. BGE_HCC_TX_MAX_COAL_BDS_INT is at offset 0x3C24, not 0x3C34
Noticed by Patrick Welche on tech-kern@, ok cube.
 1.41  04-Mar-2007  christos branches: 1.41.2; 1.41.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.40  17-Feb-2007  bouyer bus_dma fixes for bge(4). It now works on amd64 with more than 4GB physical
RAM (jumbo frames untested yet).
 1.39  26-Nov-2006  tsutsui branches: 1.39.2; 1.39.4;
Revert a CHIPID entry in the previous:
In OpenBSD's if_bgereg.h, CHIPID 0x4101000 is defined as BCM5750_B1
but our PR kern/31028 says it's BCM5751_A1 on BCM5751M on IBM T43p,
and the value seems reasonable.
 1.38  26-Nov-2006  tsutsui Add and fix some BGE_CHIPIDs. From FreeBSD and OpenBSD.
 1.37  26-Nov-2006  tsutsui TAB/space cleanup.
 1.36  26-Nov-2006  tsutsui Add support for BCM5752M. from Matt Kolb on tech-kern and OpenBSD.
 1.35  26-Nov-2006  tsutsui make DMA descriptor members volatile.
 1.34  18-Apr-2006  christos branches: 1.34.8; 1.34.10;
PR/33828: Pawel Chwalowski: Add support for Broadcom BCM5789 chip
 1.33  16-Feb-2006  perry branches: 1.33.2; 1.33.4; 1.33.6;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.32  24-Dec-2005  perry branches: 1.32.2; 1.32.4; 1.32.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.31  12-Dec-2005  jonathan Add support for bcm5714 and (possibly incorrect) support for the
bcm5715 PCI-Express dual-port NICs. Taken from the Broadcom-supplied
Linux driver, bcm-8.3.13a.

Add nascent support for the bcm5780, but (since I have no bcm5780 to
test), don't yet add an entry which allows us to match or attach to a
5780.

Change 5752 support: Follow the lead of the Broadcom-supplied Linux
driver (bcm) and the Linux tg3 driver, and treat the 5752 like a 5750.
 1.30  07-Dec-2005  jonathan Add PCI device-ids to sys/dev/pci/pcidevs for newer Broadcom gigabit
ethernet devices: bcm5714, bcm5752 (previously the 5789, but fvdl
committed that whilst I was musing).

Add definitions to sys/dev/pci/if_bgereg.h for the Broadcom 57xx-family
ASIC revisions on these newer chips.

Add entries to the PCI-device-version and bge-internal-asic-revision
tables in sys/dev/pci/if_bge.c to use these new devices. Pending
further information, follow the lead of FreeBSD's if_bge.c driver and,
pending further info, treat these new chips as we do the 5750.
 1.29  25-Nov-2005  tsutsui Remove unnecessary byteswap code so that bge(4) should work
at least on macppc.
 1.28  24-Nov-2005  jonathan Add TSO support to bge(4) for PCI-Express bge devices, which are
shipped from the factory with TSO-capable firmware. The TSO support
here may also work on 5705 chips, but that is (so far) untested.

TSO support written after careful reading of the Linux tg3 driver,
and (after attempting to deconstruct the cut-and-paste mess therein)
very close reading of the Broadcom-supplied Linux driver, particularly
the building of Tx-DMA buffer descriptors (bds). The TSO code herein was
then rewritten from scratch, circa 4am local time, October 27 2005.
(In other words: this is 4am software; caveat emptor.)

Other magic register settings in this patch are required; without
them, attepmting to use TSO locks up the chip. The required register
settings were extracted from the cited Linux drivers.

Note that TSO-capable firmware for the 5703/5704 is distributed in
non-GPL form with the aforementioned Linux drivers. Once the 5705 case
is debugged, (particularly the pseudo-header checksum precalculation
flagged with an XXX) downloading that TSO-capable firmware to the
5703/5704 should, in principle, enable TSO support on all but the
original bcm5700 (I forget if the 5701 can support TSO, or not).

Note also that the ``hard case '' of IP/TCP headers spanning more than
one mbuf is not handled; I haven't been able to trigger it. In any
case, since TSO applies only to packets generated by the local TCP,
and our TCP always leaves space for TCP headers and a normal IP
header, TSO on an IP/TCP header spanning multiple headers can only
arise due to insertion of IP options. I beleive that we are clearly
better off outlawing that case, and requiring ip_insertoptions()
to pull-up TCP headers on any packets with M_CSUM_TSOv4 set.

As far as I know, bge hardwar does not support TSO for IPv6.
 1.27  15-Nov-2005  jonathan Correct a performance bug from Bill Paul's original FreeBSD bge(4) driver:

Each call to the FreeBSD bge_start() routine the transmit producer
pointer index from the chip mailbox register BGE_MBX_TX_HOST_PROD0_LO.
The local copy of that value is then updated by bge_encap() as
bge_encap() encapsulates packets in the Tx ring. If bge_encap()
succeds in encpuslating one or more packets, bge_start() tells the
chip to start sending the newly-encinitiates writes the new value back
to the chip mailbox register.

However, comparison of the Linux drivers (Broadcom-supplied and
open-source tg3.c) and to the OpenSolaris driver confirms that
register BGE_MBX_TX_HOST_PROD0_LO is write-only to software.
Thus, we can just keep a copy in the softc, and eliminate the
(expensive) PCI register write on each call to bge_start().

``Make it so''.
 1.26  28-Aug-2005  thorpej branches: 1.26.6;
Remove unused and incorrect macro BGE_HOSTADDR().
 1.25  22-Aug-2005  gavan Add quirk for BGE_CHIPID_BCM5751_A1. From Kurt Schreiner <ks at ub.uni-mainz
dot de> via PR kern/31028.
 1.24  27-Feb-2005  perry branches: 1.24.2; 1.24.4;
nuke trailing whitespace
 1.23  26-Jan-2005  jmcneill Add powerhook to bge(4)
 1.22  28-Oct-2004  cube branches: 1.22.4; 1.22.6;
Add support for the BCM575x variants. They're close to the 5705 one, with
some special cases for the PCI-Express versions. As there is no
documentation available, all of this is inspired from Linux or taken from
FreeBSD (itself inspired from Linux). There are a lot of magic numbers.

Tested on two BCM5751 devices as found in newer Dell computers.
 1.21  15-May-2004  thorpej Add PAUSE-related event counters. Slightly modified from patch supplied by
HITOSHI Osada.
 1.20  15-May-2004  thorpej Patches from HITOSHI Osada:
* Set buffer management high water marks for MTU > 1514.
* Set BGE_MAX_RX_FRAME_LOWAT (from Linux driver).
 1.19  10-Apr-2004  thorpej Add 802.3x flow control support. From HITOSHI Osada.
 1.18  20-Mar-2004  jonathan branches: 1.18.4;
Possibloe fix for some bge chip revisions taking a long time to reset
(e.g., polling for a half-second or more at splnet(), blocking most
interrupts, durin an ifconfig down/ifconfig up).

Appears to help for a 5704C rev A3, which is the only chip I've
ever seen that had even a mild version of the reported problem.
 1.17  22-Jan-2004  jonathan Add hooks to dynamically change the bge Rx interrupt thresholds. I
found empiricaly that (at least on bcm5700s) the Rx coalesce and bd
counts cannot be updated on-the-fly; attempting to do so (even at
splhigh()) causes weird behaviour.

Instead, add a softc flag to record that the desired softc values for
Rx-interrupt thresholds have changed; check that boolean in the interrupt
routine. If set, apply the new values there and clear the flag.
 1.16  22-Jan-2004  jonathan Add some extra register definitions from FreeBSD and Linux:
BGE_MISC_TIMER register definition, and more bit definitions for
HCC-mode. (I would credit individuals, but the attributions are buried
deep in my own tree.)
 1.15  08-Dec-2003  pooka Match 5703 ASIC A3.

Also, when printing the ASIC ID, print the revision in hex in all
cases to avoid extra confusion if only the "superclass" of the ASIC
is recognized.
 1.14  02-Nov-2003  wiz boundary, not boundry. Inspired by Tom Cosgrove.
 1.13  23-Oct-2003  fvdl * match more cards (from FreeBSD)
* don't set the NOCRC bit in the mode control register, it can cause
problems on some chips (from the broadcom errata via FreeBSD)
* implement a fallback quirktable that is searched only using the
major asic revision, so that the driver has a shot at supporting
newer versions properly without modification
* rename asicrev -> chipid, like the FreeBSD driver
 1.12  27-Aug-2003  fvdl Support the BCM5704C rev 3. From Nicolas Joly, PR 22620
 1.11  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.10  01-Jun-2003  fvdl branches: 1.10.2;
Add newer 5704 asic revs, and add them to the table, with the
BGE_QUIRK_ONLY_PHY_1 quirk in their entry.
 1.9  07-Mar-2003  jonathan Commit workaround for hardware bug: 5701 chips running in PCI-X mode
require that the DMA receive buffers be aligned. The driver was
deliberately mis-aligning by 2 bytes, to force the layer-2/3
headers to 32-bit alignment.

Workaround: if chip is a 5701, and is in PCI-X mode, leave the DMA
buffers aligned. If the host CPU requires alignment, copy the buffer
after reception to force aligment.

Tested on an i386 in PCI-X bus, with __NO_STRICT_ALIGNMENT forced off.

Patch and comments reworked to minimize drift from
FreeBSD if_bge.c rev 1.14.
 1.8  06-Mar-2003  jonathan Commit the FreeBSD alternative of a private patch to check NIC internal
ram for using TBI, versus MII/GMII.

FreeBSD commit log and versions:
Obtain the media type from the shared memory and only use the eeprom
as a fallback.

if_bge.c: rev 1.30
if_bgereg.h: rev 1.13

Thanks to Paul Saab @mu.org.
 1.7  06-Mar-2003  jonathan FreeBSD fix for problems reported (to FreeBSD) with 16-bit accesses
to 32-bit device registers. Add (untested) NetBSD fix for big-endian hosts.
From FreeBSD versions:
if_bge.c: 1.26 and 1.27
if_bgereg.h: 1.12

FreeBSD (MFC) comment:

MFC: Avoid 16-bit accesses to device memory. Use volatile where
appropriate in referencing device memory. Parenthesize BGE_HOSTADDR
define properly.
 1.6  17-Jan-2003  fvdl branches: 1.6.2;
Add local_ctl_reg field to softc.
 1.5  17-Jan-2003  jonathan Add register definitions for 5704 internal ASIC revision.
Add cpp definitions for the DMA control register fields needed for
5703/5704 configuration on PCI-X.
Add softc copy of internal"local control" register clobbered by reset.
 1.4  13-Jul-2002  thorpej branches: 1.4.2; 1.4.4; 1.4.6;
Give BCM5700 Ax and Bx revs the BGE_QUIRK_LINK_STATE_BROKEN quirk,
and test for that, rather than checking revision where the quirk is
handled.
 1.3  13-Jul-2002  thorpej Add a lookup table with ASIC revision, name, and any quirks. Print
ASIC revision at attach time. Add BCM5703 revisions.
 1.2  24-Jun-2002  fvdl Add a few revision definitions.
 1.1  22-Jun-2002  fvdl Driver for Broadcom 570x / Altima AC 1000 gigabit ethernet cards.
Written by Bill Paul for FreeBSD. This port started out with the
port done to OpenBSD by nate@openbsd.org, but ended up looking much
more like the port of the ti driver done by drochner@netbsd.org
(they are similar in structure).
 1.4.6.2  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.6.1  13-Jul-2002  jdolecek file if_bgereg.h was added on branch kqueue on 2002-09-06 08:45:14 +0000
 1.4.4.3  17-Jan-2003  thorpej Sync with HEAD.
 1.4.4.2  01-Aug-2002  nathanw Catch up to -current.
 1.4.4.1  13-Jul-2002  nathanw file if_bgereg.h was added on branch nathanw_sa on 2002-08-01 02:45:14 +0000
 1.4.2.2  15-Jul-2002  gehenna catch up with -current.
 1.4.2.1  13-Jul-2002  gehenna file if_bgereg.h was added on branch gehenna-devsw on 2002-07-15 10:35:36 +0000
 1.6.2.4  16-Jun-2003  grant Pull up revision 1.8 (requested by tron in ticket #1250):

Commit the FreeBSD alternative of a private patch to check NIC internal
ram for using TBI, versus MII/GMII.

FreeBSD commit log and versions:
Obtain the media type from the shared memory and only use the eeprom
as a fallback.

if_bge.c: rev 1.30
if_bgereg.h: rev 1.13

Thanks to Paul Saab @mu.org.
 1.6.2.3  16-Jun-2003  grant Pull up revision 1.7 (requested by tron in ticket #1249):

FreeBSD fix for problems reported (to FreeBSD) with 16-bit accesses
to 32-bit device registers. Add (untested) NetBSD fix for big-endian hosts.
From FreeBSD versions:
if_bge.c: 1.26 and 1.27
if_bgereg.h: 1.12

FreeBSD (MFC) comment:

MFC: Avoid 16-bit accesses to device memory. Use volatile where
appropriate in referencing device memory. Parenthesize BGE_HOSTADDR
define properly.
 1.6.2.2  28-Jan-2003  jmc Pullup from -current (lots of revisions 1.1-1.6
(requested by fvdl in ticket #1126)
Pullup support for bge device. (Broadcom Gigabit Ethernet)
 1.6.2.1  17-Jan-2003  jmc file if_bgereg.h was added on branch netbsd-1-6 on 2003-01-28 06:20:12 +0000
 1.10.2.8  11-Dec-2005  christos Sync with head.
 1.10.2.7  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.6  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.2.5  04-Feb-2005  skrll Sync with HEAD.
 1.10.2.4  02-Nov-2004  skrll Sync with HEAD.
 1.10.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1  03-Aug-2004  skrll Sync with HEAD
 1.18.4.1  01-Dec-2005  riz Pull up following revision(s) (requested by tsutsui in ticket #10169):
sys/dev/pci/if_bgereg.h: revision 1.29
Remove unnecessary byteswap code so that bge(4) should work
at least on macppc.
 1.22.6.2  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.22.6.1  12-Feb-2005  yamt sync with head.
 1.22.4.1  29-Apr-2005  kent sync with -current
 1.24.4.6  21-Jan-2008  yamt sync with head
 1.24.4.5  27-Oct-2007  yamt sync with head.
 1.24.4.4  03-Sep-2007  yamt sync with head.
 1.24.4.3  26-Feb-2007  yamt sync with head.
 1.24.4.2  30-Dec-2006  yamt sync with head.
 1.24.4.1  21-Jun-2006  yamt sync with head.
 1.24.2.6  19-Nov-2007  bouyer Pull up following revision(s) via patch (requested by msaitoh in ticket #1862):
sys/dev/pci/if_bge.c 1.89,1.95,1.97,1.101,1.103,
1.105,1.107,1.117-1.122,
1.128-1.131,1.133-1.135,1.139
via patch
sys/dev/pci/if_bgereg.h 1.31,1.34-1.39,1.42-1.43
sys/dev/pci/pcidevs patch

Some cleanups(typo, whitespace, debug message).
Add TSO support to bge(4)
Add support for BCM5715, BCM5752M, BCM5754, BCM5755, BCM5786 and 5787.
Add support for BCM5789. Fixes PR/33828 from Pawel Chwalowskibg.
Add support for BCM5753 and BCM5753M Fixes PR kern/36139 from Mustafa Dogan.
Add and fix some BGE_CHIPIDs. From FreeBSD and OpenBSD.
In bge_ioctl(), don't call bge_init() if the interface is already up
(Makes ifwatchd work on this interface).
BCM5701 B2 requires BGE_QUIRK_ONLY_PHY_1 quirk. From Brian Baird in kern/23778.
Move TX ring full sanity check further up and check the number of DMA
segments from the DMA map, instead of counting the DMA segments in the
for loop and breaking out later.
Unload the DMA map if encountering an error condition.
Fix a NULL reference on failing mbuf allocation.
In bge_start return if IFF_OACTIVE is set in combination with
IFF_RUNNING, drop obscure check for length of interface queue.
Remove message about failing bge_encap, it can happen just too easily
because of full descriptor rings.
Fix some watchdog timeout and "block failed to stop" problems on
some cards.
Fix "pcistate failed to revert" problem on many cards.
 1.24.2.5  05-Mar-2007  ghen Pull up following revision(s) (requested by bouyer in ticket #1671):
sys/dev/pci/if_bgereg.h: revision 1.40
sys/dev/pci/if_bge.c: revision 1.124
sys/dev/pci/if_bge.c: revision 1.125
bus_dma fixes for bge(4). It now works on amd64 with more than 4GB physical
RAM (jumbo frames untested yet).
We have to bus_mapmap_load() after m_adj, otherwise the map will point at
the wrong place in the buffer. Fix an issue in the !sc->bge_rx_alignment_bug
case reported by Nicolas Joly.
While there remove a duplicate m_adj(), and add a missing bus_dmamap_unload().
 1.24.2.4  04-Jun-2006  tron Apply patch (requested by jonathan in ticket #1351):
Add support to bge(4) for bcm5714, bcm5715, bcm5780/HT-2000 and
bcm5752 chip variants.
 1.24.2.3  27-Nov-2005  riz Pull up following revision(s) (requested by tsutsui in ticket #1004):
sys/dev/pci/if_bgereg.h: revision 1.29
Remove unnecessary byteswap code so that bge(4) should work
at least on macppc.
 1.24.2.2  22-Nov-2005  tron Pull up following revision(s) (requested by jonathan in ticket #985):
sys/dev/pci/if_bgereg.h: revision 1.27
sys/dev/pci/if_bge.c: revision 1.94
Correct a performance bug from Bill Paul's original FreeBSD bge(4) driver:
Each call to the FreeBSD bge_start() routine the transmit producer
pointer index from the chip mailbox register BGE_MBX_TX_HOST_PROD0_LO.
The local copy of that value is then updated by bge_encap() as
bge_encap() encapsulates packets in the Tx ring. If bge_encap()
succeds in encpuslating one or more packets, bge_start() tells the
chip to start sending the newly-encinitiates writes the new value back
to the chip mailbox register.
However, comparison of the Linux drivers (Broadcom-supplied and
open-source tg3.c) and to the OpenSolaris driver confirms that
register BGE_MBX_TX_HOST_PROD0_LO is write-only to software.
Thus, we can just keep a copy in the softc, and eliminate the
(expensive) PCI register write on each call to bge_start().
``Make it so''.
 1.24.2.1  08-Sep-2005  tron Pull up following revision(s) (requested by gavan in ticket #752):
sys/dev/pci/if_bgereg.h: revision 1.25
sys/dev/pci/if_bge.c: revision 1.92
Add quirk for BGE_CHIPID_BCM5751_A1. From Kurt Schreiner <ks at ub.uni-mainz
dot de> via PR kern/31028.
 1.26.6.2  29-Nov-2005  yamt sync with head.
 1.26.6.1  22-Nov-2005  yamt sync with head.
 1.32.6.1  22-Apr-2006  simonb Sync with head.
 1.32.4.1  09-Sep-2006  rpaulo sync with head
 1.32.2.1  18-Feb-2006  yamt sync with head.
 1.33.6.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.33.4.1  19-Apr-2006  elad sync with head.
 1.33.2.1  24-May-2006  yamt sync with head.
 1.34.10.1  10-Dec-2006  yamt sync with head.
 1.34.8.1  12-Jan-2007  ad Sync with head.
 1.39.4.2  12-Mar-2007  rmind Sync with HEAD.
 1.39.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.39.2.5  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.39.2.4  20-Aug-2008  bouyer Pull up following revision(s) (requested by sborrill in ticket #1172):
sys/dev/pci/if_bge.c: revision 1.149
sys/dev/pci/if_bgereg.h: revision 1.47
Add support for Broadcom 5722 and identify 5755 ASICs.
 1.39.2.3  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.39.2.2  30-May-2007  riz Pull up following revision(s) (requested by pavel in ticket #671):
sys/dev/pci/if_bgereg.h: revision 1.42
from FreeBSD's src/sys/dev/bge/if_bgereg.h rev 1.22:
Fix a typo. BGE_HCC_TX_MAX_COAL_BDS_INT is at offset 0x3C24, not 0x3C34
Noticed by Patrick Welche on tech-kern@, ok cube.
 1.39.2.1  27-Feb-2007  riz branches: 1.39.2.1.2;
Pull up following revision(s) (requested by bouyer in ticket #466):
sys/dev/pci/if_bgereg.h: revision 1.40
sys/dev/pci/if_bge.c: revision 1.124-1.125
bus_dma fixes for bge(4). It now works on amd64 with more than 4GB physical
RAM (jumbo frames untested yet).
We have to bus_mapmap_load() after m_adj, otherwise the map will point at
the wrong place in the buffer. Fix an issue in the !sc->bge_rx_alignment_bug
case reported by Nicolas Joly.
While there remove a duplicate m_adj(), and add a missing bus_dmamap_unload().
 1.39.2.1.2.3  04-Sep-2008  skrll Sync with netbsd-4.
 1.39.2.1.2.2  03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.39.2.1.2.1  04-Jun-2007  wrstuden Update to today's netbsd-4.
 1.41.4.1  11-Jul-2007  mjf Sync with head.
 1.41.2.3  09-Oct-2007  ad Sync with head.
 1.41.2.2  20-Aug-2007  ad Sync with HEAD.
 1.41.2.1  27-May-2007  ad Sync with head.
 1.42.6.4  02-Oct-2007  joerg Sync with HEAD.
 1.42.6.3  01-Oct-2007  joerg Extend device API by device_power_private and device_power_set_private.
The latter is a temporary mean until the pnp_register API itself is
overhault. This functions allow a generic power handler to store its
state independent of the driver.

Use this and revamp the PCI power handling. Pretty much all PCI devices
had power handlers that did the same thing, generalize this in
pci_generic_power_register/deregister and the handler. This interface
offers callbacks for the drivers to save and restore state on
transistions. After a long discussion with jmcneill@ it was considered
to be powerful enough until evidence is shown that devices can handle
D1/D2 with less code and higher speed than without the full
save/restore. The generic code is carefully written to handle device
without PCI-PM support and ensure that the correct registers are written
to when D3 loses all state.

Reimplement the generic PCI network device handling on
top of PCI generic power handling.

Introduce pci_disable_retry as used and implemented locally at least by
ath(4) and iwi(4). Use it in this drivers to restore behaviour from
before the introduction of generic PCI network handling.

Convert all PCI drivers that were using pnp_register to the new
framework. The only exception is vga(4) as it is commonly used as
console device. Add a note therein that this should be fixed later.
 1.42.6.2  21-Aug-2007  joerg Make bge(4) a bit more like other drivers in the tree with regard to
the data stored in the softc. Convert to pnp_register.
 1.42.6.1  09-Aug-2007  jmcneill Sync with HEAD.
 1.42.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.43.6.2  06-Aug-2007  markd Add a couple more BGE_CHIPIDs
 1.43.6.1  06-Aug-2007  markd file if_bgereg.h was added on branch matt-mips64 on 2007-08-06 12:23:09 +0000
 1.43.4.1  06-Oct-2007  yamt sync with head.
 1.43.2.2  09-Jan-2008  matt sync with HEAD
 1.43.2.1  06-Nov-2007  matt sync with HEAD
 1.44.8.1  11-Dec-2007  yamt sync with head.
 1.44.6.1  26-Dec-2007  ad Sync with head.
 1.45.18.2  28-Jul-2008  simonb Sync with head.
 1.45.18.1  18-Jun-2008  simonb Sync with head.
 1.45.16.2  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.45.16.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.45.14.3  11-Mar-2010  yamt sync with head
 1.45.14.2  19-Aug-2009  yamt sync with head.
 1.45.14.1  04-May-2009  yamt sync with head.
 1.45.12.1  17-Jun-2008  yamt sync with head.
 1.45.10.2  28-Sep-2008  mjf Sync with HEAD.
 1.45.10.1  29-Jun-2008  mjf Sync with HEAD.
 1.46.2.1  19-Oct-2008  haad Sync with HEAD.
 1.48.12.1  21-Apr-2010  matt sync to netbsd-5
 1.48.8.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.48.4.3  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.48.4.2  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.48.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.48.2.1  28-Apr-2009  skrll Sync with HEAD.
 1.56.22.4  03-Dec-2017  jdolecek update from HEAD
 1.56.22.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.56.22.2  23-Jun-2013  tls resync from head
 1.56.22.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.56.18.4  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.56.18.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.56.18.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.56.18.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.56.12.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.56.12.1  30-Oct-2012  yamt sync with head
 1.81.2.2  18-May-2014  rmind sync with head
 1.81.2.1  28-Aug-2013  rmind sync with head
 1.86.2.1  10-Aug-2014  tls Rebase.
 1.88.4.2  28-Aug-2017  skrll Sync with HEAD
 1.88.4.1  06-Jun-2015  skrll Sync with HEAD
 1.88.2.1  09-May-2015  snj Pull up following revision(s) (requested by msaitoh in ticket #740):
sys/dev/pci/if_bge.c: revision 1.285
sys/dev/pci/if_bgereg.h: revision 1.90
Use another firmware command in bge_asf_driver_up(). Same as Lunux.
This change fixes a bug that watchdog timeout occurs every 25-30 minutes
on HP ML110 G6 reported enami@ in PR#49657.
 1.91.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.91.2.1  26-Apr-2017  pgoyette Sync with HEAD
 1.93.12.1  10-Jun-2019  christos Sync with HEAD
 1.93.10.1  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.93.4.2  07-Mar-2019  martin Pull up the following, requested by msaitoh in ticket #1209:

sys/dev/pci/if_bge.c 1.323-1.327
sys/dev/pci/if_bgereg.h 1.95
sys/dev/mii/brgphy.c 1.80
share/man/man4/bge.4 1.16

- Add BCM5717's another device ID support.
- Add BCM5702FE, another BCM5704S and SysKonnect SK-9Mxx support.
- Add support for BCM5762 ASIC devices.
- Add BCM5762, BCM5725, BCM5727, BCM57764, BCM57767 and BCM57787.
- Simplify PCI device table.
- Add /* FALLTHROUGH */
 1.93.4.1  08-Dec-2018  martin Pull up following revision(s) (requested by bouyer in ticket #1130):

sys/dev/pci/if_bge.c: revision 1.320
sys/dev/pci/if_bgevar.h: revision 1.24
sys/dev/pci/if_bge.c: revision 1.317
sys/dev/pci/if_bgereg.h: revision 1.94

More TSO4 fixes, from the freebsd driver:
- the chip doens't want the lenght of options, but the complete lenght of
ip headers (ip + tcp + options). Fix this for the BGE_IS_5717_PLUS()
and BGE_IS_5705_PLUS() cases; FreeBSD doens't cover the last case so
leave it as is for now. This fixes checksum failures for heavy transfers.
- It looks like the transmit engine hangs if the TCP segment crosses a 4GB
boundary. FreeBSD fixes it by mapping everything below 4GB; instead
try detect when this happens and do the bounce only when needed.

With these fixes I could transfers 3GB images over ftp at gigabit speed
(112MB/s with wget) without problems. Tested on a
bge0 at pci4 dev 0 function 0: Broadcom BCM5720 Gigabit Ethernet
bge0: APE firmware NCSI 1.4.22.0
bge0: interrupting at msi1 vec 0
bge0: HW config 002b1194, 00006014, 0002aa38, 00000000 0000000c
bge0: ASIC BCM5720 A0 (0x5720000), Ethernet address d0:94:66:8b:9c:18
bge0: setting short Tx thresholds
brgphy0 at bge0 phy 1: BCM5720C 1000BASE-T media interface, rev. 0

-

Don't destroy the dma maps if we're not disabling the adapter, avoids
a KASSERT() when bus_dmamap_destroy() is called from interrupt
context via bge_watchdog()

Set IFF_OACTIVE only when bge_encap() fails on adapter ressource shortage.
Otherwise we may set IFF_OACTIVE while no transmit is in progress, and
nothing will clear it.

If bus_dmamap_load_mbuf() fails with EFBIG, m_defrag() the chain and retry.
Refine the check for the 4GB boundary workaround (a fragment should also
not cross the boundary), and do it only for TSO.

If bge_encap() fails and didn't set IFF_OACTIVE, drop the packet.

Bring in more hardware bug workarounds from freebsd.

With these it seems that a BCM5720 A0 can survive a few hours of internet
load with TSO4 enabled.

RSS XML Feed